{"version":3,"file":"twilio_room_controller-qsiM14n3.js","sources":["../../../app/frontend/javascript/controllers/application/dialog_controller.js","../../../app/frontend/javascript/controllers/application/existance_controller.js","../../../app/frontend/javascript/controllers/application/modal_controller.js","../../../node_modules/twilio-video/es5/util/dynamicimport.js","../../../node_modules/twilio-video/es5/vendor/loglevel.js","../../../node_modules/twilio-video/es5/util/constants.js","../../../node_modules/twilio-video/es5/util/log.js","../../../node_modules/twilio-video/es5/noisecancellationadapter.js","../../../node_modules/twilio-video/es5/media/track/noisecancellationimpl.js","../../../node_modules/twilio-video/es5/webrtc/util/index.js","../../../node_modules/twilio-video/es5/util/sid.js","../../../node_modules/twilio-video/es5/util/twiliowarning.js","../../../node_modules/twilio-video/es5/util/index.js","../../../node_modules/twilio-video/es5/webrtc/util/sdp.js","../../../node_modules/twilio-video/es5/webrtc/getstats.js","../../../node_modules/twilio-video/es5/webrtc/getusermedia.js","../../../node_modules/twilio-video/es5/webrtc/mediastream.js","../../../node_modules/twilio-video/es5/webrtc/mediastreamtrack.js","../../../node_modules/twilio-video/es5/webrtc/rtcicecandidate.js","../../../node_modules/twilio-video/es5/webrtc/rtcsessiondescription/chrome.js","../../../node_modules/events/events.js","../../../node_modules/twilio-video/es5/eventtarget.js","../../../node_modules/twilio-video/es5/webrtc/util/latch.js","../../../node_modules/twilio-video/es5/webrtc/rtcrtpsender.js","../../../node_modules/twilio-video/es5/webrtc/rtcpeerconnection/chrome.js","../../../node_modules/twilio-video/es5/webrtc/rtcsessiondescription/firefox.js","../../../node_modules/twilio-video/es5/webrtc/rtcpeerconnection/firefox.js","../../../node_modules/twilio-video/es5/webrtc/rtcpeerconnection/safari.js","../../../node_modules/twilio-video/es5/webrtc/rtcpeerconnection/index.js","../../../node_modules/twilio-video/es5/webrtc/rtcsessiondescription/index.js","../../../node_modules/twilio-video/es5/webrtc/index.js","../../../node_modules/twilio-video/es5/vendor/inherits.js","../../../node_modules/twilio-video/es5/util/browserdetection.js","../../../node_modules/twilio-video/es5/webaudio/detectsilence.js","../../../node_modules/twilio-video/es5/webaudio/audiocontext.js","../../../node_modules/twilio-video/es5/util/detectsilentaudio.js","../../../node_modules/twilio-video/es5/util/localmediarestartdeferreds.js","../../../node_modules/twilio-video/es5/eventemitter.js","../../../node_modules/twilio-video/es5/media/track/index.js","../../../node_modules/twilio-video/es5/media/track/mediatrack.js","../../../node_modules/twilio-video/es5/media/track/audiotrack.js","../../../node_modules/twilio-video/es5/util/detectsilentvideo.js","../../../node_modules/twilio-video/es5/util/documentvisibilitymonitor.js","../../../node_modules/twilio-video/es5/webaudio/workaround180748.js","../../../node_modules/twilio-video/es5/queueingeventemitter.js","../../../node_modules/twilio-video/es5/transceiver.js","../../../node_modules/twilio-video/es5/media/track/transceiver.js","../../../node_modules/twilio-video/es5/media/track/sender.js","../../../node_modules/twilio-video/es5/media/track/localmediatrack.js","../../../node_modules/twilio-video/es5/media/track/localaudiotrack.js","../../../node_modules/twilio-video/es5/media/track/es5/localaudiotrack.js","../../../node_modules/twilio-video/es5/media/track/capturevideoframes.js","../../../node_modules/twilio-video/es5/media/track/videoprocessoreventobserver.js","../../../node_modules/twilio-video/es5/media/track/videotrack.js","../../../node_modules/twilio-video/es5/media/track/localvideotrack.js","../../../node_modules/twilio-video/es5/media/track/es5/localvideotrack.js","../../../node_modules/twilio-video/es5/data/transceiver.js","../../../node_modules/twilio-video/es5/data/sender.js","../../../node_modules/twilio-video/es5/media/track/localdatatrack.js","../../../node_modules/twilio-video/es5/media/track/es5/localdatatrack.js","../../../node_modules/twilio-video/es5/media/track/es5/index.js","../../../node_modules/twilio-video/es5/createlocaltracks.js","../../../node_modules/twilio-video/es5/preflight/timer.js","../../../node_modules/twilio-video/es5/preflight/mos.js","../../../node_modules/twilio-video/es5/preflight/getCombinedConnectionStats.js","../../../node_modules/twilio-video/es5/statemachine.js","../../../node_modules/twilio-video/es5/util/networkmonitor.js","../../../node_modules/twilio-video/es5/util/timeout.js","../../../node_modules/twilio-video/src/ws.js","../../../node_modules/twilio-video/es5/twilioconnection.js","../../../node_modules/twilio-video/es5/util/twilioerror.js","../../../node_modules/twilio-video/es5/util/twilio-video-errors.js","../../../node_modules/twilio-video/es5/preflight/getturncredentials.js","../../../node_modules/twilio-video/es5/preflight/makestat.js","../../../node_modules/twilio-video/es5/preflight/syntheticaudio.js","../../../node_modules/twilio-video/es5/preflight/syntheticvideo.js","../../../node_modules/twilio-video/es5/util/movingaveragedelta.js","../../../node_modules/twilio-video/es5/util/eventobserver.js","../../../node_modules/twilio-video/es5/util/insightspublisher/index.js","../../../node_modules/twilio-video/es5/preflight/preflighttest.js","../../../node_modules/twilio-video/es5/util/cancelablepromise.js","../../../node_modules/twilio-video/es5/cancelableroompromise.js","../../../node_modules/twilio-video/es5/encodingparameters.js","../../../node_modules/twilio-video/es5/util/validate.js","../../../node_modules/twilio-video/es5/media/track/trackpublication.js","../../../node_modules/twilio-video/es5/media/track/localtrackpublication.js","../../../node_modules/twilio-video/es5/media/track/localaudiotrackpublication.js","../../../node_modules/twilio-video/es5/media/track/localdatatrackpublication.js","../../../node_modules/twilio-video/es5/media/track/localvideotrackpublication.js","../../../node_modules/twilio-video/es5/media/track/remotemediatrack.js","../../../node_modules/twilio-video/es5/media/track/remoteaudiotrack.js","../../../node_modules/twilio-video/es5/media/track/remotetrackpublication.js","../../../node_modules/twilio-video/es5/media/track/remoteaudiotrackpublication.js","../../../node_modules/twilio-video/es5/media/track/remotedatatrack.js","../../../node_modules/twilio-video/es5/media/track/remotedatatrackpublication.js","../../../node_modules/twilio-video/es5/util/nullobserver.js","../../../node_modules/twilio-video/es5/media/track/remotevideotrack.js","../../../node_modules/twilio-video/es5/media/track/remotevideotrackpublication.js","../../../node_modules/twilio-video/es5/participant.js","../../../node_modules/twilio-video/es5/localparticipant.js","../../../node_modules/twilio-video/es5/util/insightspublisher/null.js","../../../node_modules/twilio-video/es5/networkqualityconfiguration.js","../../../node_modules/twilio-video/es5/remoteparticipant.js","../../../node_modules/twilio-video/es5/stats/trackstats.js","../../../node_modules/twilio-video/es5/stats/localtrackstats.js","../../../node_modules/twilio-video/es5/stats/localaudiotrackstats.js","../../../node_modules/twilio-video/es5/stats/localvideotrackstats.js","../../../node_modules/twilio-video/es5/stats/remotetrackstats.js","../../../node_modules/twilio-video/es5/stats/remoteaudiotrackstats.js","../../../node_modules/twilio-video/es5/stats/remotevideotrackstats.js","../../../node_modules/twilio-video/es5/stats/statsreport.js","../../../node_modules/twilio-video/es5/room.js","../../../node_modules/twilio-video/es5/util/backoff.js","../../../node_modules/twilio-video/es5/util/sdp/simulcast.js","../../../node_modules/twilio-video/es5/util/sdp/index.js","../../../node_modules/twilio-video/es5/util/filter.js","../../../node_modules/twilio-video/es5/signaling/v2/icebox.js","../../../node_modules/twilio-video/es5/signaling/v2/iceconnectionmonitor.js","../../../node_modules/twilio-video/es5/data/transport.js","../../../node_modules/twilio-video/es5/data/receiver.js","../../../node_modules/twilio-video/es5/media/track/receiver.js","../../../node_modules/twilio-video/es5/util/sdp/trackmatcher.js","../../../node_modules/twilio-video/es5/util/sdp/issue8329.js","../../../node_modules/twilio-video/es5/signaling/v2/peerconnection.js","../../../node_modules/twilio-video/es5/signaling/v2/peerconnectionmanager.js","../../../node_modules/twilio-video/es5/signaling/v2/mediasignaling.js","../../../node_modules/twilio-video/es5/signaling/v2/dominantspeakersignaling.js","../../../node_modules/twilio-video/es5/stats/icereport.js","../../../node_modules/twilio-video/es5/stats/icereportfactory.js","../../../node_modules/twilio-video/es5/stats/average.js","../../../node_modules/twilio-video/es5/stats/senderorreceiverreport.js","../../../node_modules/twilio-video/es5/stats/sum.js","../../../node_modules/twilio-video/es5/stats/receiverreport.js","../../../node_modules/twilio-video/es5/stats/senderreport.js","../../../node_modules/twilio-video/es5/stats/peerconnectionreport.js","../../../node_modules/twilio-video/es5/stats/senderorreceiverreportfactory.js","../../../node_modules/twilio-video/es5/stats/receiverreportfactory.js","../../../node_modules/twilio-video/es5/stats/senderreportfactory.js","../../../node_modules/twilio-video/es5/stats/peerconnectionreportfactory.js","../../../node_modules/twilio-video/es5/signaling/v2/networkqualitymonitor.js","../../../node_modules/twilio-video/es5/util/asyncvar.js","../../../node_modules/twilio-video/es5/signaling/v2/networkqualitysignaling.js","../../../node_modules/twilio-video/es5/signaling/recording.js","../../../node_modules/twilio-video/es5/signaling/v2/recording.js","../../../node_modules/twilio-video/es5/signaling/room.js","../../../node_modules/twilio-video/es5/stats/networkqualitybandwidthstats.js","../../../node_modules/twilio-video/es5/stats/networkqualityfractionloststats.js","../../../node_modules/twilio-video/es5/stats/networkqualitylatencystats.js","../../../node_modules/twilio-video/es5/stats/networkqualitysendorrecvstats.js","../../../node_modules/twilio-video/es5/stats/networkqualitysendstats.js","../../../node_modules/twilio-video/es5/stats/networkqualityrecvstats.js","../../../node_modules/twilio-video/es5/stats/networkqualitymediastats.js","../../../node_modules/twilio-video/es5/stats/networkqualityaudiostats.js","../../../node_modules/twilio-video/es5/stats/networkqualityvideostats.js","../../../node_modules/twilio-video/es5/stats/networkqualitystats.js","../../../node_modules/twilio-video/es5/signaling/participant.js","../../../node_modules/twilio-video/es5/signaling/remoteparticipant.js","../../../node_modules/twilio-video/es5/signaling/track.js","../../../node_modules/twilio-video/es5/signaling/remotetrackpublication.js","../../../node_modules/twilio-video/es5/signaling/v2/remotetrackpublication.js","../../../node_modules/twilio-video/es5/signaling/v2/remoteparticipant.js","../../../node_modules/twilio-video/es5/signaling/v2/trackprioritysignaling.js","../../../node_modules/twilio-video/es5/signaling/v2/trackswitchoffsignaling.js","../../../node_modules/twilio-video/es5/signaling/v2/renderhintssignaling.js","../../../node_modules/twilio-video/es5/signaling/v2/publisherhintsignaling.js","../../../node_modules/twilio-video/es5/signaling/v2/room.js","../../../node_modules/twilio-video/es5/signaling/v2/twilioconnectiontransport.js","../../../node_modules/twilio-video/es5/signaling/v2/cancelableroomsignalingpromise.js","../../../node_modules/twilio-video/es5/signaling/localparticipant.js","../../../node_modules/twilio-video/es5/signaling/localtrackpublication.js","../../../node_modules/twilio-video/es5/signaling/v2/localtrackpublication.js","../../../node_modules/twilio-video/es5/signaling/v2/localparticipant.js","../../../node_modules/twilio-video/es5/signaling/index.js","../../../node_modules/twilio-video/es5/signaling/v2/index.js","../../../node_modules/twilio-video/es5/connect.js","../../../node_modules/twilio-video/es5/createlocaltrack.js","../../../node_modules/twilio-video/es5/util/support.js","../../../node_modules/twilio-video/es5/index.js","../../../app/frontend/javascript/helpers/mobile.js","../../../app/frontend/javascript/controllers/application/twilio_room_controller.js"],"sourcesContent":["import { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static values = {\n form: { type: String, default: 'form' },\n closeOnFormSuccess: { type: Boolean, default: true },\n destroyOnClose: { type: Boolean, default: false }\n }\n\n connect() {\n this.element.addEventListener('turbo:frame-load', this.handleFrameLoad.bind(this))\n }\n\n disconnect() {\n this.element.removeEventListener('turbo:frame-load', this.handleFrameLoad)\n }\n\n handleFrameLoad() {\n if(this.form) {\n this.form.addEventListener('turbo:submit-end', (turboEvent) => {\n if (turboEvent.detail.formSubmission.result.success === true) {\n if (!turboEvent.detail.formSubmission.result.fetchResponse.response.headers.has(\"KEEP_MODAL\")) {\n if (this.closeOnFormSuccessValue) {\n this.close()\n }\n }\n }\n })\n }\n }\n\n get form() { return this.element.querySelector(this.formValue) }\n\n close() {\n this.element.close()\n if (this.destroyOnCloseValue) { this.element.remove() }\n }\n}\n","import { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n remove() {\n this.element.remove()\n }\n}\n","import { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static values = {\n id: String,\n title: String,\n local: String,\n frame: Object,\n form: String,\n closeOnFormSuccess: Boolean,\n destroyOnClose: Boolean\n }\n\n connect() {\n this.element.addEventListener('click', this.handleClick.bind(this))\n }\n\n disconnect() {\n this.element.removeEventListener('click', this.handleClick)\n }\n\n get modal() {\n return document.getElementById(this.idValue)\n }\n\n handleClose() {\n if (this.localParent) {\n this.localParent.append(this.localElement)\n this.localParent = null\n }\n }\n\n handleClick(event) {\n event.stopPropagation()\n event.preventDefault()\n this.createDialog()\n this.modal.showModal()\n }\n\n copyLocalElement() {\n if (!this.localValue) return\n\n this.localElement = document.querySelector(this.localValue)\n this.localParent = this.localElement.parentNode\n const dialogContent = this.modal.querySelector('.content')\n dialogContent.innerHTML = ''\n dialogContent.append(this.localElement)\n }\n\n createDialog() {\n if (!this.modal) {\n const template = document.querySelector('#turbo_modal_template')\n const clone = template.content.cloneNode(true)\n const dialog = clone.querySelector('dialog')\n const dialogTitle = dialog.querySelector('.title')\n const dialogContent = dialog.querySelector('.content')\n const frame = dialogContent.querySelector('turbo-frame')\n\n if (this.hasFormValue) dialog.dataset.dialogFormValue = this.formValue\n if (this.hasCloseOnFormSuccessValue) dialog.dataset.dialogCloseOnFormSuccessValue = this.closeOnFormSuccessValue\n if (this.hasDestroyOnCloseValue) dialog.dataset.dialogDestroyOnCloseValue = this.destroyOnCloseValue\n\n dialog.id = this.idValue\n dialogTitle.innerHTML = this.hasTitleValue ? this.titleValue : this.element.textContent\n\n if (this.hasFrameValue) {\n for (const [key, value] of Object.entries(this.frameValue)) {\n frame.setAttribute(key, value)\n }\n }\n\n dialog.addEventListener('close', this.handleClose.bind(this))\n document.body.appendChild(clone)\n }\n\n this.copyLocalElement()\n }\n}\n","'use strict';\nmodule.exports = (function (scope) {\n var location = scope.location, URL = scope.URL;\n if ([location, URL].some(function (api) { return !api; })) {\n return function dynamicImportNotSupported(module) {\n return Promise.reject(new Error(\"Failed to import: \" + module + \": dynamicImport is not supported\"));\n };\n }\n scope.__twilioVideoImportedModules = {\n // Imported module map.\n };\n return function dynamicImport(module) {\n if (module in scope.__twilioVideoImportedModules) {\n return Promise.resolve(scope.__twilioVideoImportedModules[module]);\n }\n // NOTE(mmalavalli): Calling import() directly can cause build issues in TypeScript and Webpack\n // (and probably other frameworks). So, we create a Function that calls import() in its body.\n // eslint-disable-next-line no-new-func\n return new Function('scope', \"return import('\" + new URL(module, location) + \"').then(m => scope.__twilioVideoImportedModules['\" + module + \"'] = m);\")(scope);\n };\n}(globalThis));\n//# sourceMappingURL=dynamicimport.js.map","/**\n * Copyright (c) 2013 Tim Perry\n * Licensed under the MIT license.\n *\n * Copied from https://github.com/pimterry/loglevel (1.7.0)\n * and modified to remove browser and AMD module support, while keeping CommonJS.\n * It was causing a conflict when this is bundled using CommonJS, and then loaded via RequireJS.\n * The proper way to fix this module is to have a build that outputs CommonJS and AMD separately\n * which needs to be submitted to the original module's repo.\n */\n/* istanbul ignore file */\n/* eslint-disable */\n// Slightly dubious tricks to cut down minimized file size\nvar noop = function () { };\nvar undefinedType = \"undefined\";\nvar isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (/Trident\\/|MSIE /.test(window.navigator.userAgent));\nvar logMethods = [\n \"trace\",\n \"debug\",\n \"info\",\n \"warn\",\n \"error\"\n];\n// Cross-browser bind equivalent that works at least back to IE6\nfunction bindMethod(obj, methodName) {\n var method = obj[methodName];\n if (typeof method.bind === 'function') {\n return method.bind(obj);\n }\n else {\n try {\n return Function.prototype.bind.call(method, obj);\n }\n catch (e) {\n // Missing bind shim or IE8 + Modernizr, fallback to wrapping\n return function () {\n return Function.prototype.apply.apply(method, [obj, arguments]);\n };\n }\n }\n}\n// Trace() doesn't print the message in IE, so for that case we need to wrap it\nfunction traceForIE() {\n if (console.log) {\n if (console.log.apply) {\n console.log.apply(console, arguments);\n }\n else {\n // In old IE, native console methods themselves don't have apply().\n Function.prototype.apply.apply(console.log, [console, arguments]);\n }\n }\n if (console.trace)\n console.trace();\n}\n// Build the best logging method possible for this env\n// Wherever possible we want to bind, not wrap, to preserve stack traces\nfunction realMethod(methodName) {\n if (methodName === 'debug') {\n methodName = 'log';\n }\n if (typeof console === undefinedType) {\n return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives\n }\n else if (methodName === 'trace' && isIE) {\n return traceForIE;\n }\n else if (console[methodName] !== undefined) {\n return bindMethod(console, methodName);\n }\n else if (console.log !== undefined) {\n return bindMethod(console, 'log');\n }\n else {\n return noop;\n }\n}\n// These private functions always need `this` to be set properly\nfunction replaceLoggingMethods(level, loggerName) {\n /*jshint validthis:true */\n for (var i = 0; i < logMethods.length; i++) {\n var methodName = logMethods[i];\n this[methodName] = (i < level) ?\n noop :\n this.methodFactory(methodName, level, loggerName);\n }\n // Define log.log as an alias for log.debug\n this.log = this.debug;\n}\n// In old IE versions, the console isn't present until you first open it.\n// We build realMethod() replacements here that regenerate logging methods\nfunction enableLoggingWhenConsoleArrives(methodName, level, loggerName) {\n return function () {\n if (typeof console !== undefinedType) {\n replaceLoggingMethods.call(this, level, loggerName);\n this[methodName].apply(this, arguments);\n }\n };\n}\n// By default, we use closely bound real methods wherever possible, and\n// otherwise we wait for a console to appear, and then try again.\nfunction defaultMethodFactory(methodName, level, loggerName) {\n /*jshint validthis:true */\n return realMethod(methodName) ||\n enableLoggingWhenConsoleArrives.apply(this, arguments);\n}\nfunction Logger(name, defaultLevel, factory) {\n var self = this;\n var currentLevel;\n var storageKey = \"loglevel\";\n if (typeof name === \"string\") {\n storageKey += \":\" + name;\n }\n else if (typeof name === \"symbol\") {\n storageKey = undefined;\n }\n function persistLevelIfPossible(levelNum) {\n var levelName = (logMethods[levelNum] || 'silent').toUpperCase();\n if (typeof window === undefinedType || !storageKey)\n return;\n // Use localStorage if available\n try {\n window.localStorage[storageKey] = levelName;\n return;\n }\n catch (ignore) { }\n // Use session cookie as fallback\n try {\n window.document.cookie =\n encodeURIComponent(storageKey) + \"=\" + levelName + \";\";\n }\n catch (ignore) { }\n }\n function getPersistedLevel() {\n var storedLevel;\n if (typeof window === undefinedType || !storageKey)\n return;\n try {\n storedLevel = window.localStorage[storageKey];\n }\n catch (ignore) { }\n // Fallback to cookies if local storage gives us nothing\n if (typeof storedLevel === undefinedType) {\n try {\n var cookie = window.document.cookie;\n var location = cookie.indexOf(encodeURIComponent(storageKey) + \"=\");\n if (location !== -1) {\n storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];\n }\n }\n catch (ignore) { }\n }\n // If the stored level is not valid, treat it as if nothing was stored.\n if (self.levels[storedLevel] === undefined) {\n storedLevel = undefined;\n }\n return storedLevel;\n }\n /*\n *\n * Public logger API - see https://github.com/pimterry/loglevel for details\n *\n */\n self.name = name;\n self.levels = { \"TRACE\": 0, \"DEBUG\": 1, \"INFO\": 2, \"WARN\": 3,\n \"ERROR\": 4, \"SILENT\": 5 };\n self.methodFactory = factory || defaultMethodFactory;\n self.getLevel = function () {\n return currentLevel;\n };\n self.setLevel = function (level, persist) {\n if (typeof level === \"string\" && self.levels[level.toUpperCase()] !== undefined) {\n level = self.levels[level.toUpperCase()];\n }\n if (typeof level === \"number\" && level >= 0 && level <= self.levels.SILENT) {\n currentLevel = level;\n if (persist !== false) { // defaults to true\n persistLevelIfPossible(level);\n }\n replaceLoggingMethods.call(self, level, name);\n if (typeof console === undefinedType && level < self.levels.SILENT) {\n return \"No console available for logging\";\n }\n }\n else {\n throw \"log.setLevel() called with invalid level: \" + level;\n }\n };\n self.setDefaultLevel = function (level) {\n if (!getPersistedLevel()) {\n self.setLevel(level, false);\n }\n };\n self.enableAll = function (persist) {\n self.setLevel(self.levels.TRACE, persist);\n };\n self.disableAll = function (persist) {\n self.setLevel(self.levels.SILENT, persist);\n };\n // Initialize with the right level\n var initialLevel = getPersistedLevel();\n if (initialLevel == null) {\n initialLevel = defaultLevel == null ? \"WARN\" : defaultLevel;\n }\n self.setLevel(initialLevel, false);\n}\n/*\n *\n * Top-level API\n *\n */\nvar defaultLogger = new Logger();\nvar _loggersByName = {};\ndefaultLogger.getLogger = function getLogger(name) {\n if ((typeof name !== \"symbol\" && typeof name !== \"string\") || name === \"\") {\n throw new TypeError(\"You must supply a name when creating a logger.\");\n }\n var logger = _loggersByName[name];\n if (!logger) {\n logger = _loggersByName[name] = new Logger(name, defaultLogger.getLevel(), defaultLogger.methodFactory);\n }\n return logger;\n};\n// Grab the current global log variable in case of overwrite\nvar _log = (typeof window !== undefinedType) ? window.log : undefined;\ndefaultLogger.noConflict = function () {\n if (typeof window !== undefinedType &&\n window.log === defaultLogger) {\n window.log = _log;\n }\n return defaultLogger;\n};\ndefaultLogger.getLoggers = function getLoggers() {\n return _loggersByName;\n};\n// ES6 default export, for compatibility\ndefaultLogger['default'] = defaultLogger;\nmodule.exports = defaultLogger;\n//# sourceMappingURL=loglevel.js.map","'use strict';\n/* eslint-disable camelcase */\nvar packageInfo = require('../../package.json');\nmodule.exports.SDK_NAME = packageInfo.name + \".js\";\nmodule.exports.SDK_VERSION = packageInfo.version;\nmodule.exports.SDP_FORMAT = 'unified';\nmodule.exports.hardwareDevicePublisheriPad = {\n hwDeviceManufacturer: 'Apple',\n hwDeviceModel: 'iPad',\n hwDeviceType: 'tablet',\n platformName: 'iOS'\n};\nmodule.exports.hardwareDevicePublisheriPhone = {\n hwDeviceManufacturer: 'Apple',\n hwDeviceModel: 'iPhone',\n hwDeviceType: 'mobile',\n platformName: 'iOS'\n};\nmodule.exports.DEFAULT_ENVIRONMENT = 'prod';\nmodule.exports.DEFAULT_REALM = 'us1';\nmodule.exports.DEFAULT_REGION = 'gll';\nmodule.exports.DEFAULT_LOG_LEVEL = 'warn';\nmodule.exports.DEFAULT_LOGGER_NAME = 'twilio-video';\nmodule.exports.WS_SERVER = function (environment, region) {\n region = region === 'gll' ? 'global' : encodeURIComponent(region);\n return environment === 'prod'\n ? \"wss://\" + region + \".vss.twilio.com/signaling\"\n : \"wss://\" + region + \".vss.\" + environment + \".twilio.com/signaling\";\n};\nmodule.exports.PUBLISH_MAX_ATTEMPTS = 5;\nmodule.exports.PUBLISH_BACKOFF_JITTER = 10;\nmodule.exports.PUBLISH_BACKOFF_MS = 20;\n/**\n * Returns the appropriate indefinite article (\"a\" | \"an\").\n * @param {string} word - The word which determines whether \"a\" | \"an\" is returned\n * @returns {string} \"a\" if word's first letter is a vowel, \"an\" otherwise\n */\nfunction article(word) {\n // NOTE(mmalavalli): This will not be accurate for words like \"hour\",\n // which have consonants as their first character, but are pronounced like\n // vowels. We can address this issue if the need arises.\n return ['a', 'e', 'i', 'o', 'u'].includes(word.toLowerCase()[0]) ? 'an' : 'a';\n}\nmodule.exports.typeErrors = {\n ILLEGAL_INVOKE: function (name, context) {\n return new TypeError(\"Illegal call to \" + name + \": \" + context);\n },\n INVALID_TYPE: function (name, type) {\n return new TypeError(name + \" must be \" + article(type) + \" \" + type);\n },\n INVALID_VALUE: function (name, values) {\n return new RangeError(name + \" must be one of \" + values.join(', '));\n },\n REQUIRED_ARGUMENT: function (name) {\n return new TypeError(name + \" must be specified\");\n }\n};\nmodule.exports.DEFAULT_FRAME_RATE = 24;\nmodule.exports.DEFAULT_VIDEO_PROCESSOR_STATS_INTERVAL_MS = 10000;\nmodule.exports.DEFAULT_ICE_GATHERING_TIMEOUT_MS = 15000;\nmodule.exports.DEFAULT_SESSION_TIMEOUT_SEC = 30;\nmodule.exports.DEFAULT_NQ_LEVEL_LOCAL = 1;\nmodule.exports.DEFAULT_NQ_LEVEL_REMOTE = 0;\nmodule.exports.MAX_NQ_LEVEL = 3;\nmodule.exports.ICE_ACTIVITY_CHECK_PERIOD_MS = 1000;\nmodule.exports.ICE_INACTIVITY_THRESHOLD_MS = 3000;\nmodule.exports.iceRestartBackoffConfig = {\n factor: 1.1,\n min: 1,\n max: module.exports.DEFAULT_SESSION_TIMEOUT_SEC * 1000,\n jitter: 1\n};\nmodule.exports.reconnectBackoffConfig = {\n factor: 1.5,\n min: 80,\n jitter: 1\n};\nmodule.exports.subscriptionMode = {\n MODE_COLLABORATION: 'collaboration',\n MODE_GRID: 'grid',\n MODE_PRESENTATION: 'presentation'\n};\nmodule.exports.trackSwitchOffMode = {\n MODE_DISABLED: 'disabled',\n MODE_DETECTED: 'detected',\n MODE_PREDICTED: 'predicted'\n};\nmodule.exports.trackPriority = {\n PRIORITY_HIGH: 'high',\n PRIORITY_LOW: 'low',\n PRIORITY_STANDARD: 'standard'\n};\nmodule.exports.clientTrackSwitchOffControl = {\n MODE_AUTO: 'auto',\n MODE_MANUAL: 'manual'\n};\nmodule.exports.videoContentPreferencesMode = {\n MODE_AUTO: 'auto',\n MODE_MANUAL: 'manual'\n};\n//# sourceMappingURL=constants.js.map","/* eslint new-cap:0 */\n'use strict';\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar defaultGetLogger = require('../vendor/loglevel').getLogger;\nvar constants = require('./constants');\nvar DEFAULT_LOG_LEVEL = constants.DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME = constants.DEFAULT_LOGGER_NAME;\nvar E = require('./constants').typeErrors;\nvar deprecationWarningsByComponentConstructor;\nfunction getDeprecationWarnings(componentConstructor) {\n deprecationWarningsByComponentConstructor = deprecationWarningsByComponentConstructor || new Map();\n if (deprecationWarningsByComponentConstructor.has(componentConstructor)) {\n return deprecationWarningsByComponentConstructor.get(componentConstructor);\n }\n var deprecationWarnings = new Set();\n deprecationWarningsByComponentConstructor.set(componentConstructor, deprecationWarnings);\n return deprecationWarnings;\n}\n/**\n * Selectively outputs messages to console based on specified minimum module\n * specific log levels.\n *\n * NOTE: The values in the logLevels object passed to the constructor is changed\n * by subsequent calls to {@link Log#setLevels}.\n */\nvar Log = /** @class */ (function () {\n /**\n * Construct a new {@link Log} object.\n * @param {String} moduleName - Name of the logging module (webrtc/media/signaling)\n * @param {object} component - Component owning this instance of {@link Log}\n * @param {LogLevels} logLevels - Logging levels. See {@link LogLevels}\n * @param {String} loggerName - Name of the logger instance. Used when calling getLogger from loglevel module\n * @param {Function} [getLogger] - optional method used internally.\n */\n function Log(moduleName, component, logLevels, loggerName, getLogger) {\n if (typeof moduleName !== 'string') {\n throw E.INVALID_TYPE('moduleName', 'string');\n }\n if (!component) {\n throw E.REQUIRED_ARGUMENT('component');\n }\n if (typeof logLevels !== 'object') {\n logLevels = {};\n }\n getLogger = getLogger || defaultGetLogger;\n validateLogLevels(logLevels);\n /* istanbul ignore next */\n Object.defineProperties(this, {\n _component: {\n value: component\n },\n _logLevels: {\n value: logLevels\n },\n _warnings: {\n value: new Set()\n },\n _loggerName: {\n get: function get() {\n var name = loggerName && typeof loggerName === 'string' ? loggerName : DEFAULT_LOGGER_NAME;\n if (!this._logLevelsEqual) {\n name = name + \"-\" + moduleName;\n }\n return name;\n }\n },\n _logger: {\n get: function get() {\n var logger = getLogger(this._loggerName);\n var level = this._logLevels[moduleName] || DEFAULT_LOG_LEVEL;\n // There is no 'off' in the logger module. It uses 'silent' instead\n level = level === 'off' ? 'silent' : level;\n logger.setDefaultLevel(level);\n return logger;\n }\n },\n _logLevelsEqual: {\n get: function get() {\n // True if all levels are the same\n return (new Set(Object.values(this._logLevels)).size) === 1;\n }\n },\n logLevel: {\n get: function get() {\n return Log.getLevelByName(logLevels[moduleName] || DEFAULT_LOG_LEVEL);\n }\n },\n name: { get: component.toString.bind(component) }\n });\n }\n /**\n * Get the log level (number) by its name (string)\n * @param {String} name - Name of the log level\n * @returns {Number} Requested log level\n * @throws {TwilioError} INVALID_LOG_LEVEL (32056)\n * @public\n */\n Log.getLevelByName = function (name) {\n if (!isNaN(name)) {\n return parseInt(name, 10);\n }\n name = name.toUpperCase();\n validateLogLevel(name);\n return Log[name];\n };\n /**\n * Create a child {@link Log} instance with this._logLevels\n * @param moduleName - Name of the logging module\n * @param component - Component owning this instance of {@link Log}\n * @returns {Log} this\n */\n Log.prototype.createLog = function (moduleName, component) {\n var name = this._loggerName;\n // Grab the original logger name\n if (!this._logLevelsEqual) {\n name = name.substring(0, name.lastIndexOf('-'));\n }\n return new Log(moduleName, component, this._logLevels, name);\n };\n /**\n * Set new log levels.\n * This changes the levels for all its ancestors,\n * siblings, and children and descendants instances of {@link Log}.\n * @param {LogLevels} levels - New log levels\n * @throws {TwilioError} INVALID_ARGUMENT\n * @returns {Log} this\n */\n Log.prototype.setLevels = function (levels) {\n validateLogLevels(levels);\n Object.assign(this._logLevels, levels);\n return this;\n };\n /**\n * Log a message using the logger method appropriate for the specified logLevel\n * @param {Number} logLevel - Log level of the message being logged\n * @param {Array} messages - Message(s) to log\n * @returns {Log} This instance of {@link Log}\n * @public\n */\n Log.prototype.log = function (logLevel, messages) {\n var name = Log._levels[logLevel];\n // eslint-disable-next-line no-use-before-define\n if (!name) {\n throw E.INVALID_VALUE('logLevel', LOG_LEVEL_VALUES);\n }\n name = name.toLowerCase();\n var prefix = [new Date().toISOString(), name, this.name];\n (this._logger[name] || function noop() { }).apply(void 0, __spreadArray([], __read(prefix.concat(messages))));\n return this;\n };\n /**\n * Log a debug message\n * @param {...String} messages - Message(s) to pass to the logger\n * @returns {Log} This instance of {@link Log}\n * @public\n */\n Log.prototype.debug = function () {\n return this.log(Log.DEBUG, [].slice.call(arguments));\n };\n /**\n * Log a deprecation warning. Deprecation warnings are logged as warnings and\n * they are only ever logged once.\n * @param {String} deprecationWarning - The deprecation warning\n * @returns {Log} This instance of {@link Log}\n * @public\n */\n Log.prototype.deprecated = function (deprecationWarning) {\n var deprecationWarnings = getDeprecationWarnings(this._component.constructor);\n if (deprecationWarnings.has(deprecationWarning)) {\n return this;\n }\n deprecationWarnings.add(deprecationWarning);\n return this.warn(deprecationWarning);\n };\n /**\n * Log an info message\n * @param {...String} messages - Message(s) to pass to the logger\n * @returns {Log} This instance of {@link Log}\n * @public\n */\n Log.prototype.info = function () {\n return this.log(Log.INFO, [].slice.call(arguments));\n };\n /**\n * Log a warn message\n * @param {...String} messages - Message(s) to pass to the logger\n * @returns {Log} This instance of {@link Log}\n * @public\n */\n Log.prototype.warn = function () {\n return this.log(Log.WARN, [].slice.call(arguments));\n };\n /**\n * Log a warning once.\n * @param {String} warning\n * @returns {Log} This instance of {@link Log}\n * @public\n */\n Log.prototype.warnOnce = function (warning) {\n if (this._warnings.has(warning)) {\n return this;\n }\n this._warnings.add(warning);\n return this.warn(warning);\n };\n /**\n * Log an error message\n * @param {...String} messages - Message(s) to pass to the logger\n * @returns {Log} This instance of {@link Log}\n * @public\n */\n Log.prototype.error = function () {\n return this.log(Log.ERROR, [].slice.call(arguments));\n };\n /**\n * Log an error message and throw an exception\n * @param {TwilioError} error - Error to throw\n * @param {String} customMessage - Custom message for the error\n * @public\n */\n Log.prototype.throw = function (error, customMessage) {\n if (error.clone) {\n error = error.clone(customMessage);\n }\n this.log(Log.ERROR, error);\n throw error;\n };\n return Log;\n}());\n// Singleton Constants\n/* eslint key-spacing:0 */\n/* istanbul ignore next */\nObject.defineProperties(Log, {\n DEBUG: { value: 0 },\n INFO: { value: 1 },\n WARN: { value: 2 },\n ERROR: { value: 3 },\n OFF: { value: 4 },\n _levels: {\n value: [\n 'DEBUG',\n 'INFO',\n 'WARN',\n 'ERROR',\n 'OFF',\n ]\n }\n});\nvar LOG_LEVELS_SET = {};\nvar LOG_LEVEL_VALUES = [];\nvar LOG_LEVEL_NAMES = Log._levels.map(function (level, i) {\n LOG_LEVELS_SET[level] = true;\n LOG_LEVEL_VALUES.push(i);\n return level;\n});\nfunction validateLogLevel(level) {\n if (!(level in LOG_LEVELS_SET)) {\n throw E.INVALID_VALUE('level', LOG_LEVEL_NAMES);\n }\n}\nfunction validateLogLevels(levels) {\n Object.keys(levels).forEach(function (moduleName) {\n validateLogLevel(levels[moduleName].toUpperCase());\n });\n}\nmodule.exports = Log;\n//# sourceMappingURL=log.js.map","'use strict';\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createNoiseCancellationAudioProcessor = void 0;\nvar dynamicImport = require('./util/dynamicimport');\nvar Log = require('./util/log');\nvar PLUGIN_CONFIG = {\n krisp: {\n supportedVersion: '1.0.0',\n pluginFile: 'krispsdk.mjs'\n },\n rnnoise: {\n supportedVersion: '0.6.0',\n pluginFile: 'rnnoise_sdk.mjs'\n }\n};\nvar ensureVersionSupported = function (_a) {\n var supportedVersion = _a.supportedVersion, plugin = _a.plugin, log = _a.log;\n if (!plugin.getVersion || !plugin.isSupported) {\n throw new Error('Plugin does not export getVersion/isSupported api. Are you using old version of the plugin ?');\n }\n var pluginVersion = plugin.getVersion();\n log.debug(\"Plugin Version = \" + pluginVersion);\n var supportedVersions = supportedVersion.split('.').map(function (version) { return Number(version); });\n var pluginVersions = pluginVersion.split('.').map(function (version) { return Number(version); });\n if (supportedVersions.length !== 3 || pluginVersions.length !== 3) {\n throw new Error(\"Unsupported Plugin version format: \" + supportedVersion + \", \" + pluginVersion);\n }\n if (supportedVersions[0] !== pluginVersions[0]) {\n throw new Error(\"Major version mismatch: [Plugin version \" + pluginVersion + \"], [Supported Version \" + supportedVersion + \"]\");\n }\n if (pluginVersions[1] < supportedVersions[1]) {\n throw new Error(\"Minor version mismatch: [Plugin version \" + pluginVersion + \"] < [Supported Version \" + supportedVersion + \"]\");\n }\n var tempContext = new AudioContext();\n var isSupported = plugin.isSupported(tempContext);\n tempContext.close();\n if (!isSupported) {\n throw new Error('Noise Cancellation plugin is not supported on your browser');\n }\n};\nvar audioProcessors = new Map();\nfunction createNoiseCancellationAudioProcessor(noiseCancellationOptions, log) {\n return __awaiter(this, void 0, void 0, function () {\n var audioProcessor, pluginConfig, supportedVersion, pluginFile, rootDir, sdkFilePath, dynamicModule, plugin_1, er_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n audioProcessor = audioProcessors.get(noiseCancellationOptions.vendor);\n if (!!audioProcessor) return [3 /*break*/, 6];\n pluginConfig = PLUGIN_CONFIG[noiseCancellationOptions.vendor];\n if (!pluginConfig) {\n throw new Error(\"Unsupported NoiseCancellationOptions.vendor: \" + noiseCancellationOptions.vendor);\n }\n supportedVersion = pluginConfig.supportedVersion, pluginFile = pluginConfig.pluginFile;\n rootDir = noiseCancellationOptions.sdkAssetsPath;\n sdkFilePath = rootDir + \"/\" + pluginFile;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 5, , 6]);\n log.debug('loading noise cancellation sdk: ', sdkFilePath);\n return [4 /*yield*/, dynamicImport(sdkFilePath)];\n case 2:\n dynamicModule = _a.sent();\n log.debug('Loaded noise cancellation sdk:', dynamicModule);\n plugin_1 = dynamicModule.default;\n ensureVersionSupported({\n supportedVersion: supportedVersion,\n plugin: plugin_1,\n log: log\n });\n if (!!plugin_1.isInitialized()) return [3 /*break*/, 4];\n log.debug('initializing noise cancellation sdk: ', rootDir);\n return [4 /*yield*/, plugin_1.init({ rootDir: rootDir })];\n case 3:\n _a.sent();\n log.debug('noise cancellation sdk initialized!');\n _a.label = 4;\n case 4:\n audioProcessor = {\n vendor: noiseCancellationOptions.vendor,\n isInitialized: function () { return plugin_1.isInitialized(); },\n isConnected: function () { return plugin_1.isConnected(); },\n isEnabled: function () { return plugin_1.isEnabled(); },\n disconnect: function () { return plugin_1.disconnect(); },\n enable: function () { return plugin_1.enable(); },\n disable: function () { return plugin_1.disable(); },\n destroy: function () { return plugin_1.destroy(); },\n setLogging: function (enable) { return plugin_1.setLogging(enable); },\n connect: function (sourceTrack) {\n log.debug('connect: ', sourceTrack.id);\n if (plugin_1.isConnected()) {\n plugin_1.disconnect();\n }\n var mediaStream = plugin_1.connect(new MediaStream([sourceTrack]));\n if (!mediaStream) {\n throw new Error('Error connecting with noise cancellation sdk');\n }\n var cleanTrack = mediaStream.getAudioTracks()[0];\n if (!cleanTrack) {\n throw new Error('Error getting clean track from noise cancellation sdk');\n }\n plugin_1.enable();\n return cleanTrack;\n },\n };\n audioProcessors.set(noiseCancellationOptions.vendor, audioProcessor);\n return [3 /*break*/, 6];\n case 5:\n er_1 = _a.sent();\n log.error(\"Error loading noise cancellation sdk:\" + sdkFilePath, er_1);\n throw er_1;\n case 6: return [2 /*return*/, audioProcessor];\n }\n });\n });\n}\nexports.createNoiseCancellationAudioProcessor = createNoiseCancellationAudioProcessor;\n//# sourceMappingURL=noisecancellationadapter.js.map","'use strict';\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.applyNoiseCancellation = exports.NoiseCancellationImpl = void 0;\nvar noisecancellationadapter_1 = require(\"../../noisecancellationadapter\");\nvar Log = require('../../util/log');\n/**\n * {@link NoiseCancellation} interface provides methods to control noise cancellation at runtime. This interface is exposed\n * on {@link LocalAudioTrack} property `noiseCancellation`. It is available only when {@link NoiseCancellationOptions} are\n * specified when creating a {@link LocalAudioTrack}, and the plugin is successfully loaded.\n * @alias NoiseCancellation\n * @interface\n *\n * @example\n * const { connect, createLocalAudioTrack } = require('twilio-video');\n *\n * // Create a LocalAudioTrack with Krisp noise cancellation enabled.\n * const localAudioTrack = await createLocalAudioTrack({\n * noiseCancellationOptions: {\n * sdkAssetsPath: 'path/to/hosted/twilio/krisp/audio/plugin/1.0.0/dist',\n * vendor: 'krisp'\n * }\n * });\n *\n * if (!localAudioTrack.noiseCancellation) {\n * // If the Krisp audio plugin fails to load, then a warning message will be logged\n * // in the browser console, and the \"noiseCancellation\" property will be set to null.\n * // You can still use the LocalAudioTrack to join a Room. However, it will use the\n * // browser's noise suppression instead of the Krisp noise cancellation. Make sure\n * // the \"sdkAssetsPath\" provided in \"noiseCancellationOptions\" points to the correct\n * // hosted path of the plugin assets.\n * } else {\n * // Join a Room with the LocalAudioTrack.\n * const room = await connect('token', {\n * name: 'my-cool-room',\n * tracks: [localAudioTrack]\n * });\n *\n * if (!localAudioTrack.noiseCancellation.isEnabled) {\n * // Krisp noise cancellation is permanently disabled in Peer-to-Peer and Go Rooms.\n * }\n * }\n *\n * //\n * // Enable/disable noise cancellation.\n * // @param {boolean} enable - whether noise cancellation should be enabled\n * //\n * function setNoiseCancellation(enable) {\n * const { noiseCancellation } = localAudioTrack;\n * if (noiseCancellation) {\n * if (enable) {\n * // If enabled, then the LocalAudioTrack will use the Krisp noise\n * // cancellation instead of the browser's noise suppression.\n * noiseCancellation.enable();\n * } else {\n * // If disabled, then the LocalAudioTrack will use the browser's\n * // noise suppression instead of the Krisp noise cancellation.\n * noiseCancellation.disable();\n * }\n * }\n * }\n */\nvar NoiseCancellationImpl = /** @class */ (function () {\n function NoiseCancellationImpl(processor, originalTrack) {\n this._processor = processor;\n this._sourceTrack = originalTrack;\n this._disabledPermanent = false;\n }\n Object.defineProperty(NoiseCancellationImpl.prototype, \"vendor\", {\n /**\n * Name of the noise cancellation vendor.\n * @type {NoiseCancellationVendor}\n */\n get: function () {\n return this._processor.vendor;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NoiseCancellationImpl.prototype, \"sourceTrack\", {\n /**\n * The underlying MediaStreamTrack of the {@link LocalAudioTrack}.\n * @type {MediaStreamTrack}\n */\n get: function () {\n return this._sourceTrack;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NoiseCancellationImpl.prototype, \"isEnabled\", {\n /**\n * Whether noise cancellation is enabled.\n * @type {boolean}\n */\n get: function () {\n return this._processor.isEnabled();\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Enable noise cancellation.\n * @returns {Promise} Promise that resolves when the operation is complete\n * @throws {Error} Throws an error if noise cancellation is disabled permanently\n * for the {@link LocalAudioTrack}\n */\n NoiseCancellationImpl.prototype.enable = function () {\n if (this._disabledPermanent) {\n throw new Error(this.vendor + \" noise cancellation is disabled permanently for this track\");\n }\n this._processor.enable();\n return Promise.resolve();\n };\n /**\n * Disable noise cancellation.\n * @returns {Promise} Promise that resolves when the operation is complete\n */\n NoiseCancellationImpl.prototype.disable = function () {\n this._processor.disable();\n return Promise.resolve();\n };\n /**\n * @private\n */\n NoiseCancellationImpl.prototype.reacquireTrack = function (reacquire) {\n return __awaiter(this, void 0, void 0, function () {\n var processorWasEnabled, track, processedTrack;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n processorWasEnabled = this._processor.isEnabled();\n this._processor.disconnect();\n return [4 /*yield*/, reacquire()];\n case 1:\n track = _a.sent();\n this._sourceTrack = track;\n return [4 /*yield*/, this._processor.connect(track)];\n case 2:\n processedTrack = _a.sent();\n if (processorWasEnabled) {\n this._processor.enable();\n }\n else {\n this._processor.disable();\n }\n return [2 /*return*/, processedTrack];\n }\n });\n });\n };\n /**\n * @private\n */\n NoiseCancellationImpl.prototype.disablePermanently = function () {\n this._disabledPermanent = true;\n return this.disable();\n };\n /**\n * @private\n */\n NoiseCancellationImpl.prototype.stop = function () {\n this._processor.disconnect();\n this._sourceTrack.stop();\n };\n return NoiseCancellationImpl;\n}());\nexports.NoiseCancellationImpl = NoiseCancellationImpl;\nfunction applyNoiseCancellation(mediaStreamTrack, noiseCancellationOptions, log) {\n return __awaiter(this, void 0, void 0, function () {\n var processor, cleanTrack, noiseCancellation, ex_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, noisecancellationadapter_1.createNoiseCancellationAudioProcessor(noiseCancellationOptions, log)];\n case 1:\n processor = _a.sent();\n cleanTrack = processor.connect(mediaStreamTrack);\n noiseCancellation = new NoiseCancellationImpl(processor, mediaStreamTrack);\n return [2 /*return*/, { cleanTrack: cleanTrack, noiseCancellation: noiseCancellation }];\n case 2:\n ex_1 = _a.sent();\n // in case of failures to load noise cancellation library just return original media stream.\n log.warn(\"Failed to create noise cancellation. Returning normal audio track: \" + ex_1);\n return [2 /*return*/, { cleanTrack: mediaStreamTrack }];\n case 3: return [2 /*return*/];\n }\n });\n });\n}\nexports.applyNoiseCancellation = applyNoiseCancellation;\n//# sourceMappingURL=noisecancellationimpl.js.map","'use strict';\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\n/**\n * Create a {@link Deferred}.\n * @returns {Deferred}\n */\nfunction defer() {\n var deferred = {};\n deferred.promise = new Promise(function (resolve, reject) {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n return deferred;\n}\n/**\n * Copy a method from a `source` prototype onto a `wrapper` prototype. Invoking\n * the method on the `wrapper` prototype will invoke the corresponding method\n * on an instance accessed by `target`.\n * @param {object} source\n * @param {object} wrapper\n * @param {string} target\n * @param {string} methodName\n * @returns {undefined}\n */\nfunction delegateMethod(source, wrapper, target, methodName) {\n if (methodName in wrapper) {\n // Skip any methods already set.\n return;\n }\n else if (methodName.match(/^on[a-z]+$/)) {\n // Skip EventHandlers (these are handled in the constructor).\n return;\n }\n var isProperty = false;\n try {\n var propDesc = Object.getOwnPropertyDescriptor(source, methodName);\n isProperty = propDesc && !!propDesc.get;\n }\n catch (error) {\n // its okay to eat failure here.\n }\n // NOTE(mpatwardhan):skip properties. we are only interested in overriding\n // functions. we do not even want to evaluate `typeof source[methodName]` for properties\n // because getter would get invoked, and they might have side effects.\n // For example RTCPeerConnection.peerIdentity is a property that returns a promise.\n // calling typeof RTCPeerConnection.peerIdentity, would leak a promise, and in case it rejects\n // we see errors.\n if (isProperty) {\n return;\n }\n var type;\n try {\n type = typeof source[methodName];\n }\n catch (error) {\n // NOTE(mroberts): Attempting to check the type of non-function members\n // on the prototype throws an error for some types.\n }\n if (type !== 'function') {\n // Skip non-function members.\n return;\n }\n /* eslint no-loop-func:0 */\n wrapper[methodName] = function () {\n return this[target][methodName].apply(this[target], arguments);\n };\n}\n/**\n * Copy methods from a `source` prototype onto a `wrapper` prototype. Invoking\n * the methods on the `wrapper` prototype will invoke the corresponding method\n * on an instance accessed by `target`.\n * @param {object} source\n * @param {object} wrapper\n * @param {string} target\n * @returns {undefined}\n */\nfunction delegateMethods(source, wrapper, target) {\n for (var methodName in source) {\n delegateMethod(source, wrapper, target, methodName);\n }\n}\n/**\n * Finds the items in list1 that are not in list2.\n * @param {Array<*>|Map<*>|Set<*>} list1\n * @param {Array<*>|Map<*>|Set<*>} list2\n * @returns {Set}\n */\nfunction difference(list1, list2) {\n list1 = Array.isArray(list1) ? new Set(list1) : new Set(list1.values());\n list2 = Array.isArray(list2) ? new Set(list2) : new Set(list2.values());\n var difference = new Set();\n list1.forEach(function (item) {\n if (!list2.has(item)) {\n difference.add(item);\n }\n });\n return difference;\n}\n/**\n * Map a list to an array of arrays, and return the flattened result.\n * @param {Array<*>|Set<*>|Map<*>} list\n * @param {function(*): Array<*>} mapFn\n * @returns Array<*>\n */\nfunction flatMap(list, mapFn) {\n var listArray = list instanceof Map || list instanceof Set\n ? Array.from(list.values())\n : list;\n return listArray.reduce(function (flattened, item) { return flattened.concat(mapFn(item)); }, []);\n}\n/**\n * Get the browser's user agent, if available.\n * @returns {?string}\n */\nfunction getUserAgent() {\n return typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string'\n ? navigator.userAgent\n : null;\n}\n/**\n * Guess the browser.\n * @param {string} [userAgent=navigator.userAgent]\n * @returns {?string} browser - \"chrome\", \"firefox\", \"safari\", or null\n */\nfunction guessBrowser(userAgent) {\n if (typeof userAgent === 'undefined') {\n userAgent = getUserAgent();\n }\n if (/Chrome|CriOS/.test(userAgent)) {\n return 'chrome';\n }\n if (/Firefox|FxiOS/.test(userAgent)) {\n return 'firefox';\n }\n if (/Safari|iPhone|iPad|iPod/.test(userAgent)) {\n return 'safari';\n }\n return null;\n}\n/**\n * Guess the browser version.\n * @param {string} [userAgent=navigator.userAgent]\n * @returns {?{major: number, minor: number}}\n */\nfunction guessBrowserVersion(userAgent) {\n if (typeof userAgent === 'undefined') {\n userAgent = getUserAgent();\n }\n var prefix = {\n chrome: 'Chrome|CriOS',\n firefox: 'Firefox|FxiOS',\n safari: 'Version'\n }[guessBrowser(userAgent)];\n if (!prefix) {\n return null;\n }\n var regex = new RegExp(\"(\" + prefix + \")/([^\\\\s]+)\");\n var _a = __read(userAgent.match(regex) || [], 3), match = _a[2];\n if (!match) {\n return null;\n }\n var versions = match.split('.').map(Number);\n return {\n major: isNaN(versions[0]) ? null : versions[0],\n minor: isNaN(versions[1]) ? null : versions[1]\n };\n}\n/**\n * Check whether the current browser is iOS Chrome.\n * @param {string} [userAgent=navigator.userAgent]\n * @returns {boolean}\n */\nfunction isIOSChrome(userAgent) {\n if (typeof userAgent === 'undefined') {\n userAgent = getUserAgent();\n }\n return (/Mobi/.test(userAgent) && guessBrowser() === 'chrome' && /iPad|iPhone|iPod/.test(userAgent));\n}\n/**\n * Intercept an event that might otherwise be proxied on an EventTarget.\n * @param {EventTarget} target\n * @param {string} type\n * @returns {void}\n */\nfunction interceptEvent(target, type) {\n var currentListener = null;\n Object.defineProperty(target, 'on' + type, {\n get: function () {\n return currentListener;\n },\n set: function (newListener) {\n if (currentListener) {\n this.removeEventListener(type, currentListener);\n }\n if (typeof newListener === 'function') {\n currentListener = newListener;\n this.addEventListener(type, currentListener);\n }\n else {\n currentListener = null;\n }\n }\n });\n}\n/**\n * This is a function for turning a Promise into the kind referenced in the\n * Legacy Interface Extensions section of the WebRTC spec.\n * @param {Promise<*>} promise\n * @param {function<*>} onSuccess\n * @param {function} onFailure\n * @returns {Promise}\n */\nfunction legacyPromise(promise, onSuccess, onFailure) {\n return onSuccess\n ? promise.then(onSuccess, onFailure)\n : promise;\n}\n/**\n * Make a unique ID.\n * @return {string}\n */\nfunction makeUUID() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0;\n var v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n}\n/**\n * For each property name on the `source` prototype, add getters and/or setters\n * to `wrapper` that proxy to `target`.\n * @param {object} source\n * @param {object} wrapper\n * @param {string} target\n * @returns {undefined}\n */\nfunction proxyProperties(source, wrapper, target) {\n Object.getOwnPropertyNames(source).forEach(function (propertyName) {\n proxyProperty(source, wrapper, target, propertyName);\n });\n}\n/**\n * For the property name on the `source` prototype, add a getter and/or setter\n * to `wrapper` that proxies to `target`.\n * @param {object} source\n * @param {object} wrapper\n * @param {string} target\n * @param {string} propertyName\n * @returns {undefined}\n */\nfunction proxyProperty(source, wrapper, target, propertyName) {\n if (propertyName in wrapper) {\n // Skip any properties already set.\n return;\n }\n else if (propertyName.match(/^on[a-z]+$/)) {\n Object.defineProperty(wrapper, propertyName, {\n value: null,\n writable: true\n });\n target.addEventListener(propertyName.slice(2), function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return wrapper.dispatchEvent.apply(wrapper, __spreadArray([], __read(args)));\n });\n return;\n }\n Object.defineProperty(wrapper, propertyName, {\n enumerable: true,\n get: function () {\n return target[propertyName];\n }\n });\n}\n/**\n * Check whether native WebRTC APIs are supported.\n * @returns {boolean}\n */\nfunction support() {\n return typeof navigator === 'object'\n && typeof navigator.mediaDevices === 'object'\n && typeof navigator.mediaDevices.getUserMedia === 'function'\n && typeof RTCPeerConnection === 'function';\n}\n/**\n * Create a Set of supported codecs for a certain kind of media.\n * @param {'audio'|'video'} kind\n * @returns {Promise>}\n */\nfunction createSupportedCodecsSet(kind) {\n if (typeof RTCRtpSender !== 'undefined'\n && typeof RTCRtpSender.getCapabilities === 'function') {\n return Promise.resolve(new Set(RTCRtpSender\n .getCapabilities(kind)\n .codecs\n .map(function (_a) {\n var mimeType = _a.mimeType;\n return mimeType.split('/')[1].toLowerCase();\n })));\n }\n if (typeof RTCPeerConnection === 'undefined'\n || typeof RTCPeerConnection.prototype === 'undefined'\n || typeof RTCPeerConnection.prototype.addTransceiver !== 'function'\n || typeof RTCPeerConnection.prototype.close !== 'function'\n || typeof RTCPeerConnection.prototype.createOffer !== 'function') {\n return Promise.resolve(new Set());\n }\n var pc = new RTCPeerConnection();\n pc.addTransceiver(kind);\n return pc.createOffer().then(function (_a) {\n var sdp = _a.sdp;\n pc.close();\n return new Set((sdp.match(/^a=rtpmap:.+$/gm) || [])\n .map(function (line) { return line.match(/^a=rtpmap:.+ ([^/]+)/)[1].toLowerCase(); }));\n }, function () {\n pc.close();\n return new Set();\n });\n}\n// NOTE(mmalavalli): Cache the supported audio and video codecs here.\nvar supportedCodecs = new Map();\n/**\n * Check whether a given codec for a certain kind of media is supported.\n * @param {AudioCodec|VideoCodec} codec\n * @param {'audio'|'video'} kind\n * @returns {Promise}\n */\nfunction isCodecSupported(codec, kind) {\n var codecs = supportedCodecs.get(kind);\n if (codecs) {\n return Promise.resolve(codecs.has(codec.toLowerCase()));\n }\n return createSupportedCodecsSet(kind).then(function (codecs) {\n supportedCodecs.set(kind, codecs);\n return codecs.has(codec.toLowerCase());\n });\n}\n/**\n * Clear cached supported codecs (unit tests only).\n */\nfunction clearCachedSupportedCodecs() {\n supportedCodecs.clear();\n}\n/**\n * @typedef {object} Deferred\n * @property {Promise} promise\n * @property {function} reject\n * @property {function} resolve\n */\nexports.clearCachedSupportedCodecs = clearCachedSupportedCodecs;\nexports.defer = defer;\nexports.delegateMethods = delegateMethods;\nexports.difference = difference;\nexports.flatMap = flatMap;\nexports.guessBrowser = guessBrowser;\nexports.guessBrowserVersion = guessBrowserVersion;\nexports.isCodecSupported = isCodecSupported;\nexports.isIOSChrome = isIOSChrome;\nexports.interceptEvent = interceptEvent;\nexports.legacyPromise = legacyPromise;\nexports.makeUUID = makeUUID;\nexports.proxyProperties = proxyProperties;\nexports.support = support;\n//# sourceMappingURL=index.js.map","var SID_CHARS = '1234567890abcdef';\nvar SID_CHAR_LENGTH = 32;\n// copied from: https://code.hq.twilio.com/flex/monkey/blob/0fdce2b6c52d6be0b17a5cdb92f0c54f119b8ea8/src/client/lib/sid.ts#L39\n/**\n * Generates a random sid using given prefix.\n * @param {string} prefix\n * @returns string\n */\nfunction createSID(prefix) {\n var result = '';\n for (var i = 0; i < SID_CHAR_LENGTH; i++) {\n result += SID_CHARS.charAt(Math.floor(Math.random() * SID_CHARS.length));\n }\n return \"\" + prefix + result;\n}\nexports.sessionSID = createSID('SS');\nexports.createSID = createSID;\n//# sourceMappingURL=sid.js.map","'use strict';\n/**\n * @private\n * Represents a warning encountered when\n * interacting with one of Twilio's services.\n */\n// eslint-disable-next-line\nvar TwilioWarning = {\n recordingMediaLost: 'recording-media-lost'\n};\nmodule.exports = TwilioWarning;\n//# sourceMappingURL=twiliowarning.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar constants = require('./constants');\nvar E = constants.typeErrors, trackPriority = constants.trackPriority;\nvar util = require('../webrtc/util');\nvar sessionSID = require('./sid').sessionSID;\nvar TwilioWarning = require('./twiliowarning');\n/**\n * Return the given {@link LocalTrack} or a new {@link LocalTrack} for the\n * given MediaStreamTrack.\n * @param {LocalTrack|MediaStreamTrack} track\n * @param {object} options\n * @returns {LocalTrack}\n * @throws {TypeError}\n */\nfunction asLocalTrack(track, options) {\n if (track instanceof options.LocalAudioTrack\n || track instanceof options.LocalVideoTrack\n || track instanceof options.LocalDataTrack) {\n return track;\n }\n if (track instanceof options.MediaStreamTrack) {\n return track.kind === 'audio'\n ? new options.LocalAudioTrack(track, options)\n : new options.LocalVideoTrack(track, options);\n }\n /* eslint new-cap:0 */\n throw E.INVALID_TYPE('track', 'LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack');\n}\n/**\n * Create a new {@link LocalTrackPublication} for the given {@link LocalTrack}.\n * @param {LocalTrack} track\n * @param {LocalTrackPublicationSignaling} signaling\n * @param {function(track: LocalTrackPublication): void} unpublish\n * @param {object} options\n */\nfunction asLocalTrackPublication(track, signaling, unpublish, options) {\n var LocalTrackPublication = {\n audio: options.LocalAudioTrackPublication,\n video: options.LocalVideoTrackPublication,\n data: options.LocalDataTrackPublication\n }[track.kind];\n return new LocalTrackPublication(signaling, track, unpublish, options);\n}\n/**\n * Capitalize a word.\n * @param {string} word\n * @returns {string} capitalized\n */\nfunction capitalize(word) {\n return word[0].toUpperCase() + word.slice(1);\n}\n/**\n * Log deprecation warnings for the given events of an EventEmitter.\n * @param {string} name\n * @param {EventEmitter} emitter\n * @param {Map} events\n * @param {Log} log\n */\nfunction deprecateEvents(name, emitter, events, log) {\n var warningsShown = new Set();\n emitter.on('newListener', function newListener(event) {\n if (events.has(event) && !warningsShown.has(event)) {\n log.deprecated(name + \"#\" + event + \" has been deprecated and scheduled for removal in twilio-video.js@2.0.0.\" + (events.get(event)\n ? \" Use \" + name + \"#\" + events.get(event) + \" instead.\"\n : ''));\n warningsShown.add(event);\n }\n if (warningsShown.size >= events.size) {\n emitter.removeListener('newListener', newListener);\n }\n });\n}\n/**\n * Finds the items in list1 that are not in list2.\n * @param {Array<*>|Map<*>|Set<*>} list1\n * @param {Array<*>|Map<*>|Set<*>} list2\n * @returns {Set}\n */\nfunction difference(list1, list2) {\n list1 = Array.isArray(list1) ? new Set(list1) : new Set(list1.values());\n list2 = Array.isArray(list2) ? new Set(list2) : new Set(list2.values());\n var difference = new Set();\n list1.forEach(function (item) {\n if (!list2.has(item)) {\n difference.add(item);\n }\n });\n return difference;\n}\n/**\n * Filter out the keys in an object with a given value.\n * @param {object} object - Object to be filtered\n * @param {*} [filterValue] - Value to be filtered out; If not specified, then\n * filters out all keys which have an explicit value of \"undefined\"\n * @returns {object} - Filtered object\n */\nfunction filterObject(object, filterValue) {\n return Object.keys(object).reduce(function (filtered, key) {\n if (object[key] !== filterValue) {\n filtered[key] = object[key];\n }\n return filtered;\n }, {});\n}\n/**\n * Map a list to an array of arrays, and return the flattened result.\n * @param {Array<*>|Set<*>|Map<*>} list\n * @param {function(*): Array<*>} [mapFn]\n * @returns Array<*>\n */\nfunction flatMap(list, mapFn) {\n var listArray = list instanceof Map || list instanceof Set\n ? Array.from(list.values())\n : list;\n mapFn = mapFn || function mapFn(item) {\n return item;\n };\n return listArray.reduce(function (flattened, item) {\n var mapped = mapFn(item);\n return flattened.concat(mapped);\n }, []);\n}\n/**\n * Get the user agent string, or return \"Unknown\".\n * @returns {string}\n */\nfunction getUserAgent() {\n return typeof navigator !== 'undefined' && navigator.userAgent\n ? navigator.userAgent\n : 'Unknown';\n}\n/**\n * Get the platform component of the user agent string.\n * Example:\n * Input - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36\n * Output - macintosh\n * @returns {string}\n */\nfunction getPlatform() {\n var userAgent = getUserAgent();\n var _a = __read(userAgent.match(/\\(([^)]+)\\)/) || [], 2), _b = _a[1], match = _b === void 0 ? 'unknown' : _b;\n var _c = __read(match.split(';').map(function (entry) { return entry.trim(); }), 1), platform = _c[0];\n return platform.toLowerCase();\n}\n/**\n * Create a unique identifier.\n * @returns {string}\n */\nfunction makeUUID() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0;\n var v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n}\n/**\n * Ensure that the given function is called once per tick.\n * @param {function} fn - Function to be executed\n * @returns {function} - Schedules the given function to be called on the next tick\n */\nfunction oncePerTick(fn) {\n var timeout = null;\n function nextTick() {\n timeout = null;\n fn();\n }\n return function scheduleNextTick() {\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(nextTick);\n };\n}\nfunction promiseFromEvents(operation, eventEmitter, successEvent, failureEvent) {\n return new Promise(function (resolve, reject) {\n function onSuccess() {\n var args = [].slice.call(arguments);\n if (failureEvent) {\n eventEmitter.removeListener(failureEvent, onFailure);\n }\n resolve.apply(void 0, __spreadArray([], __read(args)));\n }\n function onFailure() {\n var args = [].slice.call(arguments);\n eventEmitter.removeListener(successEvent, onSuccess);\n reject.apply(void 0, __spreadArray([], __read(args)));\n }\n eventEmitter.once(successEvent, onSuccess);\n if (failureEvent) {\n eventEmitter.once(failureEvent, onFailure);\n }\n operation();\n });\n}\n/**\n * Traverse down multiple nodes on an object and return null if\n * any link in the path is unavailable.\n * @param {Object} obj - Object to traverse\n * @param {String} path - Path to traverse. Period-separated.\n * @returns {Any|null}\n */\nfunction getOrNull(obj, path) {\n return path.split('.').reduce(function (output, step) {\n if (!output) {\n return null;\n }\n return output[step];\n }, obj);\n}\n/**\n * @typedef {object} Deferred\n * @property {Promise} promise\n * @property {function} reject\n * @property {function} resolve\n */\n/**\n * Create a {@link Deferred}.\n * @returns {Deferred}\n */\nfunction defer() {\n var deferred = {};\n deferred.promise = new Promise(function (resolve, reject) {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n return deferred;\n}\n/**\n * Copy a method from a `source` prototype onto a `wrapper` prototype. Invoking\n * the method on the `wrapper` prototype will invoke the corresponding method\n * on an instance accessed by `target`.\n * @param {object} source\n * @param {object} wrapper\n * @param {string} target\n * @param {string} methodName\n * @returns {undefined}\n */\nfunction delegateMethod(source, wrapper, target, methodName) {\n if (methodName in wrapper) {\n // Skip any methods already set.\n return;\n }\n else if (methodName.match(/^on[a-z]+$/)) {\n // Skip EventHandlers (these are handled in the constructor).\n return;\n }\n var type;\n try {\n type = typeof source[methodName];\n }\n catch (error) {\n // NOTE(mroberts): Attempting to check the type of non-function members\n // on the prototype throws an error for some types.\n }\n if (type !== 'function') {\n // Skip non-function members.\n return;\n }\n /* eslint no-loop-func:0 */\n wrapper[methodName] = function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_a = this[target])[methodName].apply(_a, __spreadArray([], __read(args)));\n };\n}\n/**\n * Copy methods from a `source` prototype onto a `wrapper` prototype. Invoking\n * the methods on the `wrapper` prototype will invoke the corresponding method\n * on an instance accessed by `target`.\n * @param {object} source\n * @param {object} wrapper\n * @param {string} target\n * @returns {undefined}\n */\nfunction delegateMethods(source, wrapper, target) {\n for (var methodName in source) {\n delegateMethod(source, wrapper, target, methodName);\n }\n}\n/**\n * Determine whether two values are deeply equal.\n * @param {*} val1\n * @param {*} val2\n * @returns {boolean}\n */\nfunction isDeepEqual(val1, val2) {\n if (val1 === val2) {\n return true;\n }\n if (typeof val1 !== typeof val2) {\n return false;\n }\n if (val1 === null) {\n return val2 === null;\n }\n if (val2 === null) {\n return false;\n }\n if (Array.isArray(val1)) {\n return Array.isArray(val2)\n && val1.length === val2.length\n && val1.every(function (val, i) { return isDeepEqual(val, val2[i]); });\n }\n if (typeof val1 === 'object') {\n var val1Keys = Object.keys(val1).sort();\n var val2Keys = Object.keys(val2).sort();\n return !Array.isArray(val2)\n && isDeepEqual(val1Keys, val2Keys)\n && val1Keys.every(function (key) { return isDeepEqual(val1[key], val2[key]); });\n }\n return false;\n}\n/**\n * Whether the given argument is a non-array object.\n * @param {*} object\n * @return {boolean}\n */\nfunction isNonArrayObject(object) {\n return typeof object === 'object' && !Array.isArray(object);\n}\n/**\n * For each property name on the `source` prototype, add getters and/or setters\n * to `wrapper` that proxy to `target`.\n * @param {object} source\n * @param {object} wrapper\n * @param {string} target\n * @returns {undefined}\n */\nfunction proxyProperties(source, wrapper, target) {\n Object.getOwnPropertyNames(source).forEach(function (propertyName) {\n proxyProperty(source, wrapper, target, propertyName);\n });\n}\n/**\n * For the property name on the `source` prototype, add a getter and/or setter\n * to `wrapper` that proxies to `target`.\n * @param {object} source\n * @param {object} wrapper\n * @param {string} target\n * @param {string} propertyName\n * @returns {undefined}\n */\nfunction proxyProperty(source, wrapper, target, propertyName) {\n if (propertyName in wrapper) {\n // Skip any properties already set.\n return;\n }\n else if (propertyName.match(/^on[a-z]+$/)) {\n Object.defineProperty(wrapper, propertyName, {\n value: null,\n writable: true\n });\n target.addEventListener(propertyName.slice(2), function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n wrapper.dispatchEvent.apply(wrapper, __spreadArray([], __read(args)));\n });\n return;\n }\n Object.defineProperty(wrapper, propertyName, {\n enumerable: true,\n get: function () {\n return target[propertyName];\n }\n });\n}\n/**\n * This is a function for turning a Promise into the kind referenced in the\n * Legacy Interface Extensions section of the WebRTC spec.\n * @param {Promise<*>} promise\n * @param {function<*>} onSuccess\n * @param {function} onFailure\n * @returns {Promise}\n */\nfunction legacyPromise(promise, onSuccess, onFailure) {\n if (onSuccess) {\n return promise.then(function (result) {\n onSuccess(result);\n }, function (error) {\n onFailure(error);\n });\n }\n return promise;\n}\n/**\n * Build the {@link LogLevels} object.\n * @param {String|LogLevel} logLevel - Log level name or object\n * @returns {LogLevels}\n */\nfunction buildLogLevels(logLevel) {\n if (typeof logLevel === 'string') {\n return {\n default: logLevel,\n media: logLevel,\n signaling: logLevel,\n webrtc: logLevel\n };\n }\n return logLevel;\n}\n/**\n * Get the {@link Track}'s derived class name\n * @param {Track} track\n * @param {?boolean} [local=undefined]\n * @returns {string}\n */\nfunction trackClass(track, local) {\n local = local ? 'Local' : '';\n return local + (track.kind || '').replace(/\\w{1}/, function (m) { return m.toUpperCase(); }) + \"Track\";\n}\n/**\n * Get the {@link TrackPublication}'s derived class name\n * @param {TrackPublication} publication\n * @param {?boolean} [local=undefined]\n * @returns {string}\n */\nfunction trackPublicationClass(publication, local) {\n local = local ? 'Local' : '';\n return local + (publication.kind || '').replace(/\\w{1}/, function (m) { return m.toUpperCase(); }) + \"TrackPublication\";\n}\n/**\n * Sets all underscore-prefixed properties on `object` non-enumerable.\n * @param {Object} object\n * @returns {void}\n */\nfunction hidePrivateProperties(object) {\n Object.getOwnPropertyNames(object).forEach(function (name) {\n if (name.startsWith('_')) {\n hideProperty(object, name);\n }\n });\n}\n/**\n * Creates a new subclass which, in the constructor, sets all underscore-prefixed\n * properties and the given public properties non-enumerable. This is useful for\n * patching up classes like EventEmitter which may set properties like `_events`\n * and `domain`.\n * @param {Function} klass\n * @param {Array} props\n * @returns {Function} subclass\n */\nfunction hidePrivateAndCertainPublicPropertiesInClass(klass, props) {\n // NOTE(mroberts): We do this to avoid giving the class a name.\n return /** @class */ (function (_super) {\n __extends(class_1, _super);\n function class_1() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _this = _super.apply(this, __spreadArray([], __read(args))) || this;\n hidePrivateProperties(_this);\n hidePublicProperties(_this, props);\n return _this;\n }\n return class_1;\n }(klass));\n}\n/**\n * Hide a property of an object.\n * @param {object} object\n * @param {string} name\n */\nfunction hideProperty(object, name) {\n var descriptor = Object.getOwnPropertyDescriptor(object, name);\n descriptor.enumerable = false;\n Object.defineProperty(object, name, descriptor);\n}\n/**\n * Hide the given public properties of an object.\n * @param {object} object\n * @param {Array} [props=[]]\n */\nfunction hidePublicProperties(object, props) {\n if (props === void 0) { props = []; }\n props.forEach(function (name) {\n // eslint-disable-next-line no-prototype-builtins\n if (object.hasOwnProperty(name)) {\n hideProperty(object, name);\n }\n });\n}\n/**\n * Convert an Array of values to an Array of JSON values by calling\n * `valueToJSON` on each value.\n * @param {Array<*>} array\n * @returns {Array<*>}\n */\nfunction arrayToJSON(array) {\n return array.map(valueToJSON);\n}\n/**\n * Convert a Set of values to an Array of JSON values by calling `valueToJSON`\n * on each value.\n * @param {Set<*>} set\n * @returns {Array<*>}\n */\nfunction setToJSON(set) {\n return arrayToJSON(__spreadArray([], __read(set)));\n}\n/**\n * Convert a Map from strings to values to an object of JSON values by calling\n * `valueToJSON` on each value.\n * @param {Map} map\n * @returns {object}\n */\nfunction mapToJSON(map) {\n return __spreadArray([], __read(map.entries())).reduce(function (json, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n return Object.assign((_b = {}, _b[key] = valueToJSON(value), _b), json);\n }, {});\n}\n/**\n * Convert an object to a JSON value by calling `valueToJSON` on its enumerable\n * keys.\n * @param {object} object\n * @returns {object}\n */\nfunction objectToJSON(object) {\n return Object.entries(object).reduce(function (json, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n return Object.assign((_b = {}, _b[key] = valueToJSON(value), _b), json);\n }, {});\n}\n/**\n * Convert a value into a JSON value.\n * @param {*} value\n * @returns {*}\n */\nfunction valueToJSON(value) {\n if (Array.isArray(value)) {\n return arrayToJSON(value);\n }\n else if (value instanceof Set) {\n return setToJSON(value);\n }\n else if (value instanceof Map) {\n return mapToJSON(value);\n }\n else if (value && typeof value === 'object') {\n return objectToJSON(value);\n }\n return value;\n}\nfunction createRoomConnectEventPayload(connectOptions) {\n function boolToString(val) {\n return val ? 'true' : 'false';\n }\n var payload = {\n sessionSID: sessionSID,\n // arrays props converted to lengths.\n iceServers: (connectOptions.iceServers || []).length,\n audioTracks: (connectOptions.tracks || []).filter(function (track) { return track.kind === 'audio'; }).length,\n videoTracks: (connectOptions.tracks || []).filter(function (track) { return track.kind === 'video'; }).length,\n dataTracks: (connectOptions.tracks || []).filter(function (track) { return track.kind === 'data'; }).length,\n };\n // boolean properties.\n [['audio'], ['automaticSubscription'], ['enableDscp'], ['eventListener'], ['preflight'], ['video'], ['dominantSpeaker', 'enableDominantSpeaker']].forEach(function (_a) {\n var _b = __read(_a, 2), prop = _b[0], eventProp = _b[1];\n eventProp = eventProp || prop;\n payload[eventProp] = boolToString(!!connectOptions[prop]);\n });\n // numbers properties.\n [['maxVideoBitrate'], ['maxAudioBitrate']].forEach(function (_a) {\n var _b = __read(_a, 2), prop = _b[0], eventProp = _b[1];\n eventProp = eventProp || prop;\n if (typeof connectOptions[prop] === 'number') {\n payload[eventProp] = connectOptions[prop];\n }\n else if (!isNaN(Number(connectOptions[prop]))) {\n payload[eventProp] = Number(connectOptions[prop]);\n }\n });\n // string properties.\n [['iceTransportPolicy'], ['region'], ['name', 'roomName']].forEach(function (_a) {\n var _b = __read(_a, 2), prop = _b[0], eventProp = _b[1];\n eventProp = eventProp || prop;\n if (typeof connectOptions[prop] === 'string') {\n payload[eventProp] = connectOptions[prop];\n }\n else if (typeof connectOptions[prop] === 'number' && prop === 'name') {\n payload[eventProp] = connectOptions[prop].toString();\n }\n });\n // array props stringified.\n ['preferredAudioCodecs', 'preferredVideoCodecs'].forEach(function (prop) {\n if (prop in connectOptions) {\n payload[prop] = JSON.stringify(connectOptions[prop]);\n }\n });\n if ('networkQuality' in connectOptions) {\n payload.networkQualityConfiguration = {};\n if (isNonArrayObject(connectOptions.networkQuality)) {\n ['local', 'remote'].forEach(function (prop) {\n if (typeof connectOptions.networkQuality[prop] === 'number') {\n payload.networkQualityConfiguration[prop] = connectOptions.networkQuality[prop];\n }\n });\n }\n else {\n payload.networkQualityConfiguration.remote = 0;\n payload.networkQualityConfiguration.local = connectOptions.networkQuality ? 1 : 0;\n }\n }\n if (connectOptions.bandwidthProfile && connectOptions.bandwidthProfile.video) {\n var videoBPOptions_1 = connectOptions.bandwidthProfile.video || {};\n payload.bandwidthProfileOptions = {};\n ['mode', 'maxTracks', 'trackSwitchOffMode', 'dominantSpeakerPriority', 'maxSubscriptionBitrate', 'renderDimensions', 'contentPreferencesMode', 'clientTrackSwitchOffControl'].forEach(function (prop) {\n if (typeof videoBPOptions_1[prop] === 'number' || typeof videoBPOptions_1[prop] === 'string') {\n payload.bandwidthProfileOptions[prop] = videoBPOptions_1[prop];\n }\n else if (typeof videoBPOptions_1[prop] === 'boolean') {\n payload.bandwidthProfileOptions[prop] = boolToString(videoBPOptions_1[prop]);\n }\n else if (typeof videoBPOptions_1[prop] === 'object') {\n payload.bandwidthProfileOptions[prop] = JSON.stringify(videoBPOptions_1[prop]);\n }\n });\n }\n return {\n group: 'room',\n name: 'connect',\n level: 'info',\n payload: payload\n };\n}\n/**\n * Create the bandwidth profile payload included in an RSP connect message.\n * @param {BandwidthProfileOptions} bandwidthProfile\n * @returns {object}\n */\nfunction createBandwidthProfilePayload(bandwidthProfile) {\n return createRSPPayload(bandwidthProfile, [\n { prop: 'video', type: 'object', transform: createBandwidthProfileVideoPayload }\n ]);\n}\n/**\n * Create the bandwidth profile video payload included in an RSP connect message.\n * @param {VideoBandwidthProfileOptions} bandwidthProfileVideo\n * @returns {object}\n */\nfunction createBandwidthProfileVideoPayload(bandwidthProfileVideo) {\n return createRSPPayload(bandwidthProfileVideo, [\n { prop: 'dominantSpeakerPriority', type: 'string', payloadProp: 'active_speaker_priority' },\n { prop: 'maxSubscriptionBitrate', type: 'number', payloadProp: 'max_subscription_bandwidth' },\n { prop: 'maxTracks', type: 'number', payloadProp: 'max_tracks' },\n { prop: 'mode', type: 'string' },\n { prop: 'renderDimensions', type: 'object', payloadProp: 'render_dimensions', transform: createRenderDimensionsPayload },\n { prop: 'trackSwitchOffMode', type: 'string', payloadProp: 'track_switch_off' }\n ]);\n}\n/**\n * Create the Media Signaling payload included in an RSP connect message.\n * @param {boolean} dominantSpeaker - whether to enable the Dominant Speaker\n * protocol or not\n * @param {boolean} networkQuality - whether to enable the Network Quality\n * protocol or not\n * @param {boolean} trackPriority - whether to enable the Track Priority\n * protocol or not\n * @param {boolean} trackSwitchOff - whether to enable the Track Switch-Off\n * protocol or not.\n * @param {boolean} renderHints - whether to enable the renderHints\n * protocol or not.\n * @returns {object}\n */\nfunction createMediaSignalingPayload(dominantSpeaker, networkQuality, trackPriority, trackSwitchOff, adaptiveSimulcast, renderHints) {\n var transports = { transports: [{ type: 'data-channel' }] };\n return Object.assign(dominantSpeaker\n // eslint-disable-next-line\n ? { active_speaker: transports }\n : {}, networkQuality\n // eslint-disable-next-line\n ? { network_quality: transports }\n : {}, renderHints\n // eslint-disable-next-line\n ? { render_hints: transports }\n : {}, adaptiveSimulcast\n // eslint-disable-next-line\n ? { publisher_hints: transports }\n : {}, trackPriority\n // eslint-disable-next-line\n ? { track_priority: transports }\n : {}, trackSwitchOff\n // eslint-disable-next-line\n ? { track_switch_off: transports }\n : {});\n}\n/**\n * Create {@link VideoTrack.Dimensions} RSP payload.\n * @param {VideoTrack.Dimensions} [dimensions]\n * @returns {object}\n */\nfunction createDimensionsPayload(dimensions) {\n return createRSPPayload(dimensions, [\n { prop: 'height', type: 'number' },\n { prop: 'width', type: 'number' }\n ]);\n}\n/**\n * Create {@link VideoRenderDimensions} RSP payload.\n * @param renderDimensions\n * @returns {object}\n */\nfunction createRenderDimensionsPayload(renderDimensions) {\n var PRIORITY_HIGH = trackPriority.PRIORITY_HIGH, PRIORITY_LOW = trackPriority.PRIORITY_LOW, PRIORITY_STANDARD = trackPriority.PRIORITY_STANDARD;\n return createRSPPayload(renderDimensions, [\n { prop: PRIORITY_HIGH, type: 'object', transform: createDimensionsPayload },\n { prop: PRIORITY_LOW, type: 'object', transform: createDimensionsPayload },\n { prop: PRIORITY_STANDARD, type: 'object', transform: createDimensionsPayload }\n ]);\n}\n/**\n * Create an RSP payload for the given object.\n * @param {object} object - object for which RSP payload is to be generated\n * @param {Array} propConversions - conversion rules for object properties;\n * they specify how object properties should be converted to their corresponding\n * RSP payload properties\n * @returns {object}\n */\nfunction createRSPPayload(object, propConversions) {\n return propConversions.reduce(function (payload, _a) {\n var _b;\n var prop = _a.prop, type = _a.type, _c = _a.payloadProp, payloadProp = _c === void 0 ? prop : _c, _d = _a.transform, transform = _d === void 0 ? function (x) { return x; } : _d;\n return typeof object[prop] === type\n ? Object.assign((_b = {}, _b[payloadProp] = transform(object[prop]), _b), payload)\n : payload;\n }, {});\n}\n/**\n * Create the subscribe payload included in an RSP connect/update message.\n * @param {boolean} automaticSubscription - whether to subscribe to all RemoteTracks\n * @returns {object}\n */\nfunction createSubscribePayload(automaticSubscription) {\n return {\n rules: [{\n type: automaticSubscription ? 'include' : 'exclude',\n all: true\n }],\n revision: 1\n };\n}\nfunction createMediaWarningsPayload(notifyWarnings) {\n var _a;\n var mediaWarnings = (_a = {},\n _a[TwilioWarning.recordingMediaLost] = 'recordings',\n _a);\n return notifyWarnings\n .map(function (twilioWarningName) { return mediaWarnings[twilioWarningName]; })\n .filter(function (name) { return !!name; });\n}\n/**\n * Add random jitter to a given value in the range [-jitter, jitter].\n * @private\n * @param {number} value\n * @param {number} jitter\n * @returns {number} value + random(-jitter, +jitter)\n */\nfunction withJitter(value, jitter) {\n var rand = Math.random();\n return value - jitter + Math.floor(2 * jitter * rand + 0.5);\n}\n/**\n * Checks if the a number is in the range [min, max].\n * @private\n * @param {num} num\n * @param {number} min\n * @param {number} max\n * @return {boolean}\n */\nfunction inRange(num, min, max) {\n return min <= num && num <= max;\n}\n/**\n * returns true if given MediaStreamTrack is a screen share track\n * @private\n * @param {MediaStreamTrack} track\n * @returns {boolean}\n */\nfunction isChromeScreenShareTrack(track) {\n // NOTE(mpatwardhan): Chrome creates screen share tracks with label like: \"screen:69734272*\"\n // we will check for label that starts with \"screen:D\" where D being a digit.\n return util.guessBrowser() === 'chrome' && track.kind === 'video' && 'displaySurface' in track.getSettings();\n}\n/**\n * Returns a promise that resolve after timeoutMS have passed.\n * @param {number} timeoutMS - time to wait in milliseconds.\n * @returns {Promise}\n */\nfunction waitForSometime(timeoutMS) {\n if (timeoutMS === void 0) { timeoutMS = 10; }\n return new Promise(function (resolve) { return setTimeout(resolve, timeoutMS); });\n}\n/**\n * Returns a promise that resolve after event is received\n * @returns {Promise}\n */\nfunction waitForEvent(eventTarget, event) {\n return new Promise(function (resolve) {\n eventTarget.addEventListener(event, function onevent(e) {\n eventTarget.removeEventListener(event, onevent);\n resolve(e);\n });\n });\n}\nexports.constants = constants;\nexports.createBandwidthProfilePayload = createBandwidthProfilePayload;\nexports.createMediaSignalingPayload = createMediaSignalingPayload;\nexports.createMediaWarningsPayload = createMediaWarningsPayload;\nexports.createRoomConnectEventPayload = createRoomConnectEventPayload;\nexports.createSubscribePayload = createSubscribePayload;\nexports.asLocalTrack = asLocalTrack;\nexports.asLocalTrackPublication = asLocalTrackPublication;\nexports.capitalize = capitalize;\nexports.deprecateEvents = deprecateEvents;\nexports.difference = difference;\nexports.filterObject = filterObject;\nexports.flatMap = flatMap;\nexports.getPlatform = getPlatform;\nexports.getUserAgent = getUserAgent;\nexports.hidePrivateProperties = hidePrivateProperties;\nexports.hidePrivateAndCertainPublicPropertiesInClass = hidePrivateAndCertainPublicPropertiesInClass;\nexports.isDeepEqual = isDeepEqual;\nexports.isNonArrayObject = isNonArrayObject;\nexports.inRange = inRange;\nexports.makeUUID = makeUUID;\nexports.oncePerTick = oncePerTick;\nexports.promiseFromEvents = promiseFromEvents;\nexports.getOrNull = getOrNull;\nexports.defer = defer;\nexports.delegateMethods = delegateMethods;\nexports.proxyProperties = proxyProperties;\nexports.legacyPromise = legacyPromise;\nexports.buildLogLevels = buildLogLevels;\nexports.trackClass = trackClass;\nexports.trackPublicationClass = trackPublicationClass;\nexports.valueToJSON = valueToJSON;\nexports.withJitter = withJitter;\nexports.isChromeScreenShareTrack = isChromeScreenShareTrack;\nexports.waitForSometime = waitForSometime;\nexports.waitForEvent = waitForEvent;\n//# sourceMappingURL=index.js.map","/* globals RTCPeerConnection, RTCRtpTransceiver */\n'use strict';\nvar _a = require('./'), flatMap = _a.flatMap, guessBrowser = _a.guessBrowser;\n// NOTE(mmalavalli): We cache Chrome's sdpSemantics support in order to prevent\n// instantiation of more than one RTCPeerConnection.\nvar isSdpSemanticsSupported = null;\n/**\n * Check if Chrome supports specifying sdpSemantics for an RTCPeerConnection.\n * @return {boolean}\n */\nfunction checkIfSdpSemanticsIsSupported() {\n if (typeof isSdpSemanticsSupported === 'boolean') {\n return isSdpSemanticsSupported;\n }\n if (typeof RTCPeerConnection === 'undefined') {\n isSdpSemanticsSupported = false;\n return isSdpSemanticsSupported;\n }\n try {\n // eslint-disable-next-line no-new\n new RTCPeerConnection({ sdpSemantics: 'foo' });\n isSdpSemanticsSupported = false;\n }\n catch (e) {\n isSdpSemanticsSupported = true;\n }\n return isSdpSemanticsSupported;\n}\n// NOTE(mmalavalli): We cache Chrome's SDP format in order to prevent\n// instantiation of more than one RTCPeerConnection.\nvar chromeSdpFormat = null;\n/**\n * Clear cached Chrome's SDP format\n */\nfunction clearChromeCachedSdpFormat() {\n chromeSdpFormat = null;\n}\n/**\n * Get Chrome's default SDP format.\n * @returns {'planb'|'unified'}\n */\nfunction getChromeDefaultSdpFormat() {\n if (!chromeSdpFormat) {\n if (typeof RTCPeerConnection !== 'undefined'\n && 'addTransceiver' in RTCPeerConnection.prototype) {\n var pc = new RTCPeerConnection();\n try {\n pc.addTransceiver('audio');\n chromeSdpFormat = 'unified';\n }\n catch (e) {\n chromeSdpFormat = 'planb';\n }\n pc.close();\n }\n else {\n chromeSdpFormat = 'planb';\n }\n }\n return chromeSdpFormat;\n}\n/**\n * Get Chrome's SDP format.\n * @param {'plan-b'|'unified-plan'} [sdpSemantics]\n * @returns {'planb'|'unified'}\n */\nfunction getChromeSdpFormat(sdpSemantics) {\n if (!sdpSemantics || !checkIfSdpSemanticsIsSupported()) {\n return getChromeDefaultSdpFormat();\n }\n return {\n 'plan-b': 'planb',\n 'unified-plan': 'unified'\n }[sdpSemantics];\n}\n/**\n * Get Safari's default SDP format.\n * @returns {'planb'|'unified'}\n */\nfunction getSafariSdpFormat() {\n return typeof RTCRtpTransceiver !== 'undefined'\n && 'currentDirection' in RTCRtpTransceiver.prototype\n ? 'unified'\n : 'planb';\n}\n/**\n * Get the browser's default SDP format.\n * @param {'plan-b'|'unified-plan'} [sdpSemantics]\n * @returns {'planb'|'unified'}\n */\nfunction getSdpFormat(sdpSemantics) {\n return {\n chrome: getChromeSdpFormat(sdpSemantics),\n firefox: 'unified',\n safari: getSafariSdpFormat()\n }[guessBrowser()] || null;\n}\n/**\n * Match a pattern across lines, returning the first capture group for any\n * matches.\n * @param {string} pattern\n * @param {string} lines\n * @returns {Set} matches\n */\nfunction getMatches(pattern, lines) {\n var matches = lines.match(new RegExp(pattern, 'gm')) || [];\n return matches.reduce(function (results, line) {\n var match = line.match(new RegExp(pattern));\n return match ? results.add(match[1]) : results;\n }, new Set());\n}\n/**\n * Get a Set of MediaStreamTrack IDs from an SDP.\n * @param {string} pattern\n * @param {string} sdp\n * @returns {Set}\n */\nfunction getTrackIds(pattern, sdp) {\n return getMatches(pattern, sdp);\n}\n/**\n * Get a Set of MediaStreamTrack IDs from a Plan B SDP.\n * @param {string} sdp - Plan B SDP\n * @returns {Set} trackIds\n */\nfunction getPlanBTrackIds(sdp) {\n return getTrackIds('^a=ssrc:[0-9]+ +msid:.+ +(.+) *$', sdp);\n}\n/**\n * Get a Set of MediaStreamTrack IDs from a Unified Plan SDP.\n * @param {string} sdp - Unified Plan SDP\n * @returns {Set} trackIds\n */\nfunction getUnifiedPlanTrackIds(sdp) {\n return getTrackIds('^a=msid:.+ +(.+) *$', sdp);\n}\n/**\n * Get a Set of SSRCs for a MediaStreamTrack from a Plan B SDP.\n * @param {string} sdp - Plan B SDP\n * @param {string} trackId - MediaStreamTrack ID\n * @returns {Set}\n */\nfunction getPlanBSSRCs(sdp, trackId) {\n var pattern = \"^a=ssrc:([0-9]+) +msid:[^ ]+ +\" + trackId + \" *$\";\n return getMatches(pattern, sdp);\n}\n/**\n * Get the m= sections of a particular kind and direction from an sdp.\n * @param {string} sdp - sdp string\n * @param {string} [kind] - Pattern for matching kind\n * @param {string} [direction] - Pattern for matching direction\n * @returns {Array} mediaSections\n */\nfunction getMediaSections(sdp, kind, direction) {\n if (kind === void 0) { kind = '.*'; }\n if (direction === void 0) { direction = '.*'; }\n return sdp.split('\\r\\nm=').slice(1).map(function (mediaSection) { return \"m=\" + mediaSection; }).filter(function (mediaSection) {\n var kindPattern = new RegExp(\"m=\" + kind, 'gm');\n var directionPattern = new RegExp(\"a=\" + direction, 'gm');\n return kindPattern.test(mediaSection) && directionPattern.test(mediaSection);\n });\n}\n/**\n * Get the Set of SSRCs announced in a MediaSection.\n * @param {string} mediaSection\n * @returns {Array} ssrcs\n */\nfunction getMediaSectionSSRCs(mediaSection) {\n return Array.from(getMatches('^a=ssrc:([0-9]+) +.*$', mediaSection));\n}\n/**\n * Get a Set of SSRCs for a MediaStreamTrack from a Unified Plan SDP.\n * @param {string} sdp - Unified Plan SDP\n * @param {string} trackId - MediaStreamTrack ID\n * @returns {Set}\n */\nfunction getUnifiedPlanSSRCs(sdp, trackId) {\n var mediaSections = getMediaSections(sdp);\n var msidAttrRegExp = new RegExp(\"^a=msid:[^ ]+ +\" + trackId + \" *$\", 'gm');\n var matchingMediaSections = mediaSections.filter(function (mediaSection) { return mediaSection.match(msidAttrRegExp); });\n return new Set(flatMap(matchingMediaSections, getMediaSectionSSRCs));\n}\n/**\n * Get a Map from MediaStreamTrack IDs to SSRCs from an SDP.\n * @param {function(string): Set} getTrackIds\n * @param {function(string, string): Set} getSSRCs\n * @param {string} sdp - SDP\n * @returns {Map>} trackIdsToSSRCs\n */\nfunction getTrackIdsToSSRCs(getTrackIds, getSSRCs, sdp) {\n return new Map(Array.from(getTrackIds(sdp)).map(function (trackId) { return [trackId, getSSRCs(sdp, trackId)]; }));\n}\n/**\n * Get a Map from MediaStreamTrack IDs to SSRCs from a Plan B SDP.\n * @param {string} sdp - Plan B SDP\n * @returns {Map>} trackIdsToSSRCs\n */\nfunction getPlanBTrackIdsToSSRCs(sdp) {\n return getTrackIdsToSSRCs(getPlanBTrackIds, getPlanBSSRCs, sdp);\n}\n/**\n * Get a Map from MediaStreamTrack IDs to SSRCs from a Plan B SDP.\n * @param {string} sdp - Plan B SDP\n * @returns {Map>} trackIdsToSSRCs\n */\nfunction getUnifiedPlanTrackIdsToSSRCs(sdp) {\n return getTrackIdsToSSRCs(getUnifiedPlanTrackIds, getUnifiedPlanSSRCs, sdp);\n}\n/**\n * Update the mappings from MediaStreamTrack IDs to SSRCs as indicated by both\n * the Map from MediaStreamTrack IDs to SSRCs and the SDP itself. This method\n * ensures that SSRCs never change once announced.\n * @param {function(string): Map>} getTrackIdsToSSRCs\n * @param {Map>} trackIdsToSSRCs\n * @param {string} sdp - SDP\n * @returns {strinng} updatedSdp - updated SDP\n */\nfunction updateTrackIdsToSSRCs(getTrackIdsToSSRCs, trackIdsToSSRCs, sdp) {\n var newTrackIdsToSSRCs = getTrackIdsToSSRCs(sdp);\n var newSSRCsToOldSSRCs = new Map();\n // NOTE(mroberts): First, update a=ssrc attributes.\n newTrackIdsToSSRCs.forEach(function (ssrcs, trackId) {\n if (!trackIdsToSSRCs.has(trackId)) {\n trackIdsToSSRCs.set(trackId, ssrcs);\n return;\n }\n var oldSSRCs = Array.from(trackIdsToSSRCs.get(trackId));\n var newSSRCs = Array.from(ssrcs);\n oldSSRCs.forEach(function (oldSSRC, i) {\n var newSSRC = newSSRCs[i];\n newSSRCsToOldSSRCs.set(newSSRC, oldSSRC);\n var pattern = \"^a=ssrc:\" + newSSRC + \" (.*)$\";\n var replacement = \"a=ssrc:\" + oldSSRC + \" $1\";\n sdp = sdp.replace(new RegExp(pattern, 'gm'), replacement);\n });\n });\n // NOTE(mroberts): Then, update a=ssrc-group attributes.\n var pattern = '^(a=ssrc-group:[^ ]+ +)(.*)$';\n var matches = sdp.match(new RegExp(pattern, 'gm')) || [];\n matches.forEach(function (line) {\n var match = line.match(new RegExp(pattern));\n if (!match) {\n return;\n }\n var prefix = match[1];\n var newSSRCs = match[2];\n var oldSSRCs = newSSRCs.split(' ').map(function (newSSRC) {\n var oldSSRC = newSSRCsToOldSSRCs.get(newSSRC);\n return oldSSRC ? oldSSRC : newSSRC;\n }).join(' ');\n sdp = sdp.replace(match[0], prefix + oldSSRCs);\n });\n return sdp;\n}\n/**\n * Update the mappings from MediaStreamTrack IDs to SSRCs as indicated by both\n * the Map from MediaStreamTrack IDs to SSRCs and the Plan B SDP itself. This\n * method ensures that SSRCs never change once announced.\n * @param {Map>} trackIdsToSSRCs\n * @param {string} sdp - Plan B SDP\n * @returns {string} updatedSdp - updated Plan B SDP\n */\nfunction updatePlanBTrackIdsToSSRCs(trackIdsToSSRCs, sdp) {\n return updateTrackIdsToSSRCs(getPlanBTrackIdsToSSRCs, trackIdsToSSRCs, sdp);\n}\n/**\n * Update the mappings from MediaStreamTrack IDs to SSRCs as indicated by both\n * the Map from MediaStreamTrack IDs to SSRCs and the Plan B SDP itself. This\n * method ensures that SSRCs never change once announced.\n * @param {Map>} trackIdsToSSRCs\n * @param {string} sdp - Plan B SDP\n * @returns {string} updatedSdp - updated Plan B SDP\n */\nfunction updateUnifiedPlanTrackIdsToSSRCs(trackIdsToSSRCs, sdp) {\n return updateTrackIdsToSSRCs(getUnifiedPlanTrackIdsToSSRCs, trackIdsToSSRCs, sdp);\n}\nexports.clearChromeCachedSdpFormat = clearChromeCachedSdpFormat;\nexports.getSdpFormat = getSdpFormat;\nexports.getMediaSections = getMediaSections;\nexports.getPlanBTrackIds = getPlanBTrackIds;\nexports.getUnifiedPlanTrackIds = getUnifiedPlanTrackIds;\nexports.getPlanBSSRCs = getPlanBSSRCs;\nexports.getUnifiedPlanSSRCs = getUnifiedPlanSSRCs;\nexports.updatePlanBTrackIdsToSSRCs = updatePlanBTrackIdsToSSRCs;\nexports.updateUnifiedPlanTrackIdsToSSRCs = updateUnifiedPlanTrackIdsToSSRCs;\n//# sourceMappingURL=sdp.js.map","'use strict';\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar _a = require('./util'), flatMap = _a.flatMap, guessBrowser = _a.guessBrowser, guessBrowserVersion = _a.guessBrowserVersion;\nvar getSdpFormat = require('./util/sdp').getSdpFormat;\nvar guess = guessBrowser();\nvar guessVersion = guessBrowserVersion();\nvar isChrome = guess === 'chrome';\nvar isFirefox = guess === 'firefox';\nvar isSafari = guess === 'safari';\nvar chromeMajorVersion = isChrome ? guessVersion.major : null;\nvar CHROME_LEGACY_MAX_AUDIO_LEVEL = 32767;\n/**\n * Get the standardized {@link RTCPeerConnection} statistics.\n * @param {RTCPeerConnection} peerConnection\n * @param {object} [options] - Used for testing\n * @returns {Promise.}\n */\nfunction getStats(peerConnection, options) {\n if (!(peerConnection && typeof peerConnection.getStats === 'function')) {\n return Promise.reject(new Error('Given PeerConnection does not support getStats'));\n }\n return _getStats(peerConnection, options);\n}\n/**\n * getStats() implementation.\n * @param {RTCPeerConnection} peerConnection\n * @param {object} [options] - Used for testing\n * @returns {Promise.}\n */\nfunction _getStats(peerConnection, options) {\n var localAudioTracks = getTracks(peerConnection, 'audio', 'local');\n var localVideoTracks = getTracks(peerConnection, 'video', 'local');\n var remoteAudioTracks = getTracks(peerConnection, 'audio');\n var remoteVideoTracks = getTracks(peerConnection, 'video');\n var statsResponse = {\n activeIceCandidatePair: null,\n localAudioTrackStats: [],\n localVideoTrackStats: [],\n remoteAudioTrackStats: [],\n remoteVideoTrackStats: []\n };\n var trackStatsPromises = flatMap([\n [localAudioTracks, 'localAudioTrackStats', false],\n [localVideoTracks, 'localVideoTrackStats', false],\n [remoteAudioTracks, 'remoteAudioTrackStats', true],\n [remoteVideoTracks, 'remoteVideoTrackStats', true]\n ], function (_a) {\n var _b = __read(_a, 3), tracks = _b[0], statsArrayName = _b[1], isRemote = _b[2];\n return tracks.map(function (track) {\n return getTrackStats(peerConnection, track, Object.assign({ isRemote: isRemote }, options)).then(function (trackStatsArray) {\n trackStatsArray.forEach(function (trackStats) {\n trackStats.trackId = track.id;\n statsResponse[statsArrayName].push(trackStats);\n });\n });\n });\n });\n return Promise.all(trackStatsPromises).then(function () {\n return getActiveIceCandidatePairStats(peerConnection, options);\n }).then(function (activeIceCandidatePairStatsReport) {\n statsResponse.activeIceCandidatePair = activeIceCandidatePairStatsReport;\n return statsResponse;\n });\n}\n/**\n * Generate the {@link StandardizedActiveIceCandidatePairStatsReport} for the\n * {@link RTCPeerConnection}.\n * @param {RTCPeerConnection} peerConnection\n * @param {object} [options]\n * @returns {Promise}\n */\nfunction getActiveIceCandidatePairStats(peerConnection, options) {\n if (options === void 0) { options = {}; }\n if (typeof options.testForChrome !== 'undefined' || isChrome\n || typeof options.testForSafari !== 'undefined' || isSafari) {\n return peerConnection.getStats().then(standardizeChromeOrSafariActiveIceCandidatePairStats);\n }\n if (typeof options.testForFirefox !== 'undefined' || isFirefox) {\n return peerConnection.getStats().then(standardizeFirefoxActiveIceCandidatePairStats);\n }\n return Promise.reject(new Error('RTCPeerConnection#getStats() not supported'));\n}\n/**\n * Standardize the active RTCIceCandidate pair's statistics in Chrome or Safari.\n * @param {RTCStatsReport} stats\n * @returns {?StandardizedActiveIceCandidatePairStatsReport}\n */\nfunction standardizeChromeOrSafariActiveIceCandidatePairStats(stats) {\n var activeCandidatePairStats = Array.from(stats.values()).find(function (_a) {\n var nominated = _a.nominated, type = _a.type;\n return type === 'candidate-pair' && nominated;\n });\n if (!activeCandidatePairStats) {\n return null;\n }\n var activeLocalCandidateStats = stats.get(activeCandidatePairStats.localCandidateId);\n var activeRemoteCandidateStats = stats.get(activeCandidatePairStats.remoteCandidateId);\n var standardizedCandidateStatsKeys = [\n { key: 'candidateType', type: 'string' },\n { key: 'ip', type: 'string' },\n { key: 'port', type: 'number' },\n { key: 'priority', type: 'number' },\n { key: 'protocol', type: 'string' },\n { key: 'url', type: 'string' }\n ];\n var standardizedLocalCandidateStatsKeys = standardizedCandidateStatsKeys.concat([\n { key: 'deleted', type: 'boolean' },\n { key: 'relayProtocol', type: 'string' }\n ]);\n var standatdizedLocalCandidateStatsReport = activeLocalCandidateStats\n ? standardizedLocalCandidateStatsKeys.reduce(function (report, _a) {\n var key = _a.key, type = _a.type;\n report[key] = typeof activeLocalCandidateStats[key] === type\n ? activeLocalCandidateStats[key]\n : key === 'deleted' ? false : null;\n return report;\n }, {})\n : null;\n var standardizedRemoteCandidateStatsReport = activeRemoteCandidateStats\n ? standardizedCandidateStatsKeys.reduce(function (report, _a) {\n var key = _a.key, type = _a.type;\n report[key] = typeof activeRemoteCandidateStats[key] === type\n ? activeRemoteCandidateStats[key]\n : null;\n return report;\n }, {})\n : null;\n return [\n { key: 'availableIncomingBitrate', type: 'number' },\n { key: 'availableOutgoingBitrate', type: 'number' },\n { key: 'bytesReceived', type: 'number' },\n { key: 'bytesSent', type: 'number' },\n { key: 'consentRequestsSent', type: 'number' },\n { key: 'currentRoundTripTime', type: 'number' },\n { key: 'lastPacketReceivedTimestamp', type: 'number' },\n { key: 'lastPacketSentTimestamp', type: 'number' },\n { key: 'nominated', type: 'boolean' },\n { key: 'priority', type: 'number' },\n { key: 'readable', type: 'boolean' },\n { key: 'requestsReceived', type: 'number' },\n { key: 'requestsSent', type: 'number' },\n { key: 'responsesReceived', type: 'number' },\n { key: 'responsesSent', type: 'number' },\n { key: 'retransmissionsReceived', type: 'number' },\n { key: 'retransmissionsSent', type: 'number' },\n { key: 'state', type: 'string', fixup: function (state) { return state === 'inprogress' ? 'in-progress' : state; } },\n { key: 'totalRoundTripTime', type: 'number' },\n { key: 'transportId', type: 'string' },\n { key: 'writable', type: 'boolean' }\n ].reduce(function (report, _a) {\n var key = _a.key, type = _a.type, fixup = _a.fixup;\n report[key] = typeof activeCandidatePairStats[key] === type\n ? (fixup ? fixup(activeCandidatePairStats[key]) : activeCandidatePairStats[key])\n : null;\n return report;\n }, {\n localCandidate: standatdizedLocalCandidateStatsReport,\n remoteCandidate: standardizedRemoteCandidateStatsReport\n });\n}\n/**\n * Standardize the active RTCIceCandidate pair's statistics in Firefox.\n * @param {RTCStatsReport} stats\n * @returns {?StandardizedActiveIceCandidatePairStatsReport}\n */\nfunction standardizeFirefoxActiveIceCandidatePairStats(stats) {\n var activeCandidatePairStats = Array.from(stats.values()).find(function (_a) {\n var nominated = _a.nominated, type = _a.type;\n return type === 'candidate-pair' && nominated;\n });\n if (!activeCandidatePairStats) {\n return null;\n }\n var activeLocalCandidateStats = stats.get(activeCandidatePairStats.localCandidateId);\n var activeRemoteCandidateStats = stats.get(activeCandidatePairStats.remoteCandidateId);\n var standardizedCandidateStatsKeys = [\n { key: 'candidateType', type: 'string' },\n { key: 'ip', ffKeys: ['address', 'ipAddress'], type: 'string' },\n { key: 'port', ffKeys: ['portNumber'], type: 'number' },\n { key: 'priority', type: 'number' },\n { key: 'protocol', ffKeys: ['transport'], type: 'string' },\n { key: 'url', type: 'string' }\n ];\n var standardizedLocalCandidateStatsKeys = standardizedCandidateStatsKeys.concat([\n { key: 'deleted', type: 'boolean' },\n { key: 'relayProtocol', type: 'string' }\n ]);\n var candidateTypes = {\n host: 'host',\n peerreflexive: 'prflx',\n relayed: 'relay',\n serverreflexive: 'srflx'\n };\n var standatdizedLocalCandidateStatsReport = activeLocalCandidateStats\n ? standardizedLocalCandidateStatsKeys.reduce(function (report, _a) {\n var ffKeys = _a.ffKeys, key = _a.key, type = _a.type;\n var localStatKey = ffKeys && ffKeys.find(function (key) { return key in activeLocalCandidateStats; }) || key;\n report[key] = typeof activeLocalCandidateStats[localStatKey] === type\n ? localStatKey === 'candidateType'\n ? candidateTypes[activeLocalCandidateStats[localStatKey]] || activeLocalCandidateStats[localStatKey]\n : activeLocalCandidateStats[localStatKey]\n : localStatKey === 'deleted' ? false : null;\n return report;\n }, {})\n : null;\n var standardizedRemoteCandidateStatsReport = activeRemoteCandidateStats\n ? standardizedCandidateStatsKeys.reduce(function (report, _a) {\n var ffKeys = _a.ffKeys, key = _a.key, type = _a.type;\n var remoteStatKey = ffKeys && ffKeys.find(function (key) { return key in activeRemoteCandidateStats; }) || key;\n report[key] = typeof activeRemoteCandidateStats[remoteStatKey] === type\n ? remoteStatKey === 'candidateType'\n ? candidateTypes[activeRemoteCandidateStats[remoteStatKey]] || activeRemoteCandidateStats[remoteStatKey]\n : activeRemoteCandidateStats[remoteStatKey]\n : null;\n return report;\n }, {})\n : null;\n return [\n { key: 'availableIncomingBitrate', type: 'number' },\n { key: 'availableOutgoingBitrate', type: 'number' },\n { key: 'bytesReceived', type: 'number' },\n { key: 'bytesSent', type: 'number' },\n { key: 'consentRequestsSent', type: 'number' },\n { key: 'currentRoundTripTime', type: 'number' },\n { key: 'lastPacketReceivedTimestamp', type: 'number' },\n { key: 'lastPacketSentTimestamp', type: 'number' },\n { key: 'nominated', type: 'boolean' },\n { key: 'priority', type: 'number' },\n { key: 'readable', type: 'boolean' },\n { key: 'requestsReceived', type: 'number' },\n { key: 'requestsSent', type: 'number' },\n { key: 'responsesReceived', type: 'number' },\n { key: 'responsesSent', type: 'number' },\n { key: 'retransmissionsReceived', type: 'number' },\n { key: 'retransmissionsSent', type: 'number' },\n { key: 'state', type: 'string' },\n { key: 'totalRoundTripTime', type: 'number' },\n { key: 'transportId', type: 'string' },\n { key: 'writable', type: 'boolean' }\n ].reduce(function (report, _a) {\n var key = _a.key, type = _a.type;\n report[key] = typeof activeCandidatePairStats[key] === type\n ? activeCandidatePairStats[key]\n : null;\n return report;\n }, {\n localCandidate: standatdizedLocalCandidateStatsReport,\n remoteCandidate: standardizedRemoteCandidateStatsReport\n });\n}\n/**\n * Get local/remote audio/video MediaStreamTracks.\n * @param {RTCPeerConnection} peerConnection - The RTCPeerConnection\n * @param {string} kind - 'audio' or 'video'\n * @param {string} [localOrRemote] - 'local' or 'remote'\n * @returns {Array}\n */\nfunction getTracks(peerConnection, kind, localOrRemote) {\n var getSendersOrReceivers = localOrRemote === 'local' ? 'getSenders' : 'getReceivers';\n if (peerConnection[getSendersOrReceivers]) {\n return peerConnection[getSendersOrReceivers]()\n .map(function (_a) {\n var track = _a.track;\n return track;\n })\n .filter(function (track) { return track && track.kind === kind; });\n }\n var getStreams = localOrRemote === 'local' ? 'getLocalStreams' : 'getRemoteStreams';\n var getTracks = kind === 'audio' ? 'getAudioTracks' : 'getVideoTracks';\n return flatMap(peerConnection[getStreams](), function (stream) { return stream[getTracks](); });\n}\n/**\n * Get the standardized statistics for a particular MediaStreamTrack.\n * @param {RTCPeerConnection} peerConnection\n * @param {MediaStreamTrack} track\n * @param {object} [options] - Used for testing\n * @returns {Promise.>}\n */\nfunction getTrackStats(peerConnection, track, options) {\n if (options === void 0) { options = {}; }\n if (typeof options.testForChrome !== 'undefined' || isChrome) {\n return chromeOrSafariGetTrackStats(peerConnection, track, options);\n }\n if (typeof options.testForFirefox !== 'undefined' || isFirefox) {\n return firefoxGetTrackStats(peerConnection, track, options);\n }\n if (typeof options.testForSafari !== 'undefined' || isSafari) {\n if (typeof options.testForSafari !== 'undefined' || getSdpFormat() === 'unified') {\n return chromeOrSafariGetTrackStats(peerConnection, track, options);\n }\n // NOTE(syerrapragada): getStats() is not supported on\n // Safari versions where plan-b is the SDP format\n // due to this bug: https://bugs.webkit.org/show_bug.cgi?id=192601\n return Promise.reject(new Error([\n 'getStats() is not supported on this version of Safari',\n 'due to this bug: https://bugs.webkit.org/show_bug.cgi?id=192601'\n ].join(' ')));\n }\n return Promise.reject(new Error('RTCPeerConnection#getStats() not supported'));\n}\n/**\n * Get the standardized statistics for a particular MediaStreamTrack in Chrome or Safari.\n * @param {RTCPeerConnection} peerConnection\n * @param {MediaStreamTrack} track\n * @param {object} options - Used for testing\n * @returns {Promise.>}\n */\nfunction chromeOrSafariGetTrackStats(peerConnection, track, options) {\n if (chromeMajorVersion && chromeMajorVersion < 67) {\n return new Promise(function (resolve, reject) {\n peerConnection.getStats(function (response) {\n resolve([standardizeChromeLegacyStats(response, track)]);\n }, null, reject);\n });\n }\n return peerConnection.getStats(track).then(function (response) {\n return standardizeChromeOrSafariStats(response, options);\n });\n}\n/**\n * Get the standardized statistics for a particular MediaStreamTrack in Firefox.\n * @param {RTCPeerConnection} peerConnection\n * @param {MediaStreamTrack} track\n * @param {object} options\n * @returns {Promise.>}\n */\nfunction firefoxGetTrackStats(peerConnection, track, options) {\n return peerConnection.getStats(track).then(function (response) {\n return [standardizeFirefoxStats(response, options)];\n });\n}\n/**\n * Standardize the MediaStreamTrack's legacy statistics in Chrome.\n * @param {RTCStatsResponse} response\n * @param {MediaStreamTrack} track\n * @returns {StandardizedTrackStatsReport}\n */\nfunction standardizeChromeLegacyStats(response, track) {\n var ssrcReport = response.result().find(function (report) {\n return report.type === 'ssrc' && report.stat('googTrackId') === track.id;\n });\n var standardizedStats = {};\n if (ssrcReport) {\n standardizedStats.timestamp = Math.round(Number(ssrcReport.timestamp));\n standardizedStats = ssrcReport.names().reduce(function (stats, name) {\n switch (name) {\n case 'googCodecName':\n stats.codecName = ssrcReport.stat(name);\n break;\n case 'googRtt':\n stats.roundTripTime = Number(ssrcReport.stat(name));\n break;\n case 'googJitterReceived':\n stats.jitter = Number(ssrcReport.stat(name));\n break;\n case 'googFrameWidthInput':\n stats.frameWidthInput = Number(ssrcReport.stat(name));\n break;\n case 'googFrameHeightInput':\n stats.frameHeightInput = Number(ssrcReport.stat(name));\n break;\n case 'googFrameWidthSent':\n stats.frameWidthSent = Number(ssrcReport.stat(name));\n break;\n case 'googFrameHeightSent':\n stats.frameHeightSent = Number(ssrcReport.stat(name));\n break;\n case 'googFrameWidthReceived':\n stats.frameWidthReceived = Number(ssrcReport.stat(name));\n break;\n case 'googFrameHeightReceived':\n stats.frameHeightReceived = Number(ssrcReport.stat(name));\n break;\n case 'googFrameRateInput':\n stats.frameRateInput = Number(ssrcReport.stat(name));\n break;\n case 'googFrameRateSent':\n stats.frameRateSent = Number(ssrcReport.stat(name));\n break;\n case 'googFrameRateReceived':\n stats.frameRateReceived = Number(ssrcReport.stat(name));\n break;\n case 'ssrc':\n stats[name] = ssrcReport.stat(name);\n break;\n case 'bytesReceived':\n case 'bytesSent':\n case 'packetsLost':\n case 'packetsReceived':\n case 'packetsSent':\n case 'audioInputLevel':\n case 'audioOutputLevel':\n stats[name] = Number(ssrcReport.stat(name));\n break;\n }\n return stats;\n }, standardizedStats);\n }\n return standardizedStats;\n}\n/**\n * Standardize the MediaStreamTrack's statistics in Chrome or Safari.\n * @param {RTCStatsResponse} response\n * @param {object} options - Used for testing\n * @returns {Array}\n */\nfunction standardizeChromeOrSafariStats(response, _a) {\n var _b = _a.simulateExceptionWhileStandardizingStats, simulateExceptionWhileStandardizingStats = _b === void 0 ? false : _b;\n if (simulateExceptionWhileStandardizingStats) {\n throw new Error('Error while gathering stats');\n }\n var inbound = null;\n // NOTE(mpatwardhan): We should expect more than one \"outbound-rtp\" stats for a\n // VP8 simulcast MediaStreamTrack.\n var outbound = [];\n var remoteInbound = null;\n var remoteOutbound = null;\n var track = null;\n var codec = null;\n var localMedia = null;\n response.forEach(function (stat) {\n var type = stat.type;\n switch (type) {\n case 'inbound-rtp':\n inbound = stat;\n break;\n case 'outbound-rtp':\n outbound.push(stat);\n break;\n case 'media-source':\n localMedia = stat;\n break;\n case 'track':\n track = stat;\n break;\n case 'codec':\n codec = stat;\n break;\n case 'remote-inbound-rtp':\n remoteInbound = stat;\n break;\n case 'remote-outbound-rtp':\n remoteOutbound = stat;\n break;\n }\n });\n var isRemote = track ? track.remoteSource : !localMedia;\n var mainSources = isRemote ? [inbound] : outbound;\n var stats = [];\n var remoteSource = isRemote ? remoteOutbound : remoteInbound; // remote rtp stats\n mainSources.forEach(function (source) {\n var standardizedStats = {};\n var statSources = [\n source,\n localMedia,\n track,\n codec,\n remoteSource && remoteSource.ssrc === source.ssrc ? remoteSource : null, // remote rtp stats\n ];\n function getStatValue(name) {\n var sourceFound = statSources.find(function (statSource) {\n return statSource && typeof statSource[name] !== 'undefined';\n }) || null;\n return sourceFound ? sourceFound[name] : null;\n }\n var ssrc = getStatValue('ssrc');\n if (typeof ssrc === 'number') {\n standardizedStats.ssrc = String(ssrc);\n }\n var timestamp = getStatValue('timestamp');\n standardizedStats.timestamp = Math.round(timestamp);\n var mimeType = getStatValue('mimeType');\n if (typeof mimeType === 'string') {\n mimeType = mimeType.split('/');\n standardizedStats.codecName = mimeType[mimeType.length - 1];\n }\n var roundTripTime = getStatValue('roundTripTime');\n if (typeof roundTripTime === 'number') {\n standardizedStats.roundTripTime = Math.round(roundTripTime * 1000);\n }\n var jitter = getStatValue('jitter');\n if (typeof jitter === 'number') {\n standardizedStats.jitter = Math.round(jitter * 1000);\n }\n var frameWidth = getStatValue('frameWidth');\n if (typeof frameWidth === 'number') {\n if (isRemote) {\n standardizedStats.frameWidthReceived = frameWidth;\n }\n else {\n standardizedStats.frameWidthSent = frameWidth;\n standardizedStats.frameWidthInput = track ? track.frameWidth : localMedia.width;\n }\n }\n var frameHeight = getStatValue('frameHeight');\n if (typeof frameHeight === 'number') {\n if (isRemote) {\n standardizedStats.frameHeightReceived = frameHeight;\n }\n else {\n standardizedStats.frameHeightSent = frameHeight;\n standardizedStats.frameHeightInput = track ? track.frameHeight : localMedia.height;\n }\n }\n var framesPerSecond = getStatValue('framesPerSecond');\n if (typeof framesPerSecond === 'number') {\n standardizedStats[isRemote ? 'frameRateReceived' : 'frameRateSent'] = framesPerSecond;\n }\n var bytesReceived = getStatValue('bytesReceived');\n if (typeof bytesReceived === 'number') {\n standardizedStats.bytesReceived = bytesReceived;\n }\n var bytesSent = getStatValue('bytesSent');\n if (typeof bytesSent === 'number') {\n standardizedStats.bytesSent = bytesSent;\n }\n var packetsLost = getStatValue('packetsLost');\n if (typeof packetsLost === 'number') {\n standardizedStats.packetsLost = packetsLost;\n }\n var packetsReceived = getStatValue('packetsReceived');\n if (typeof packetsReceived === 'number') {\n standardizedStats.packetsReceived = packetsReceived;\n }\n var packetsSent = getStatValue('packetsSent');\n if (typeof packetsSent === 'number') {\n standardizedStats.packetsSent = packetsSent;\n }\n var audioLevel = getStatValue('audioLevel');\n if (typeof audioLevel === 'number') {\n audioLevel = Math.round(audioLevel * CHROME_LEGACY_MAX_AUDIO_LEVEL);\n if (isRemote) {\n standardizedStats.audioOutputLevel = audioLevel;\n }\n else {\n standardizedStats.audioInputLevel = audioLevel;\n }\n }\n var totalPacketSendDalay = getStatValue('totalPacketSendDelay');\n if (typeof totalPacketSendDalay === 'number') {\n standardizedStats.totalPacketSendDelay = totalPacketSendDalay;\n }\n var totalEncodeTime = getStatValue('totalEncodeTime');\n if (typeof totalEncodeTime === 'number') {\n standardizedStats.totalEncodeTime = totalEncodeTime;\n }\n var framesEncoded = getStatValue('framesEncoded');\n if (typeof framesEncoded === 'number') {\n standardizedStats.framesEncoded = framesEncoded;\n }\n var estimatedPlayoutTimestamp = getStatValue('estimatedPlayoutTimestamp');\n if (typeof estimatedPlayoutTimestamp === 'number') {\n standardizedStats.estimatedPlayoutTimestamp = estimatedPlayoutTimestamp;\n }\n var totalDecodeTime = getStatValue('totalDecodeTime');\n if (typeof totalDecodeTime === 'number') {\n standardizedStats.totalDecodeTime = totalDecodeTime;\n }\n var framesDecoded = getStatValue('framesDecoded');\n if (typeof framesDecoded === 'number') {\n standardizedStats.framesDecoded = framesDecoded;\n }\n var jitterBufferDelay = getStatValue('jitterBufferDelay');\n if (typeof jitterBufferDelay === 'number') {\n standardizedStats.jitterBufferDelay = jitterBufferDelay;\n }\n var jitterBufferEmittedCount = getStatValue('jitterBufferEmittedCount');\n if (typeof jitterBufferEmittedCount === 'number') {\n standardizedStats.jitterBufferEmittedCount = jitterBufferEmittedCount;\n }\n stats.push(standardizedStats);\n });\n return stats;\n}\n/**\n * Standardize the MediaStreamTrack's statistics in Firefox.\n * @param {RTCStatsReport} response\n * @param {object} options - Used for testing\n * @returns {StandardizedTrackStatsReport}\n */\nfunction standardizeFirefoxStats(response, _a) {\n if (response === void 0) { response = new Map(); }\n var isRemote = _a.isRemote, _b = _a.simulateExceptionWhileStandardizingStats, simulateExceptionWhileStandardizingStats = _b === void 0 ? false : _b;\n if (simulateExceptionWhileStandardizingStats) {\n throw new Error('Error while gathering stats');\n }\n // NOTE(mroberts): If getStats is called on a closed RTCPeerConnection,\n // Firefox returns undefined instead of an RTCStatsReport. We workaround this\n // here. See the following bug for more details:\n //\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1377225\n //\n var inbound = null;\n var outbound = null;\n // NOTE(mmalavalli): Starting from Firefox 63, RTC{Inbound, Outbound}RTPStreamStats.isRemote\n // will be deprecated, followed by its removal in Firefox 66. Also, trying to\n // access members of the remote RTC{Inbound, Outbound}RTPStreamStats without\n // using RTCStatsReport.get(remoteId) will trigger console warnings. So, we\n // no longer depend on \"isRemote\", and we call RTCStatsReport.get(remoteId)\n // to access the remote RTC{Inbound, Outbound}RTPStreamStats.\n //\n // Source: https://blog.mozilla.org/webrtc/getstats-isremote-65/\n //\n response.forEach(function (stat) {\n var isRemote = stat.isRemote, remoteId = stat.remoteId, type = stat.type;\n if (isRemote) {\n return;\n }\n switch (type) {\n case 'inbound-rtp':\n inbound = stat;\n outbound = response.get(remoteId);\n break;\n case 'outbound-rtp':\n outbound = stat;\n inbound = response.get(remoteId);\n break;\n }\n });\n var first = isRemote ? inbound : outbound;\n var second = isRemote ? outbound : inbound;\n function getStatValue(name) {\n if (first && typeof first[name] !== 'undefined') {\n return first[name];\n }\n if (second && typeof second[name] !== 'undefined') {\n return second[name];\n }\n return null;\n }\n var standardizedStats = {};\n var timestamp = getStatValue('timestamp');\n standardizedStats.timestamp = Math.round(timestamp);\n var ssrc = getStatValue('ssrc');\n if (typeof ssrc === 'number') {\n standardizedStats.ssrc = String(ssrc);\n }\n var bytesSent = getStatValue('bytesSent');\n if (typeof bytesSent === 'number') {\n standardizedStats.bytesSent = bytesSent;\n }\n var packetsLost = getStatValue('packetsLost');\n if (typeof packetsLost === 'number') {\n standardizedStats.packetsLost = packetsLost;\n }\n var packetsSent = getStatValue('packetsSent');\n if (typeof packetsSent === 'number') {\n standardizedStats.packetsSent = packetsSent;\n }\n var roundTripTime = getStatValue('roundTripTime');\n if (typeof roundTripTime === 'number') {\n // roundTripTime is double - measured in seconds.\n // https://www.w3.org/TR/webrtc-stats/#dom-rtcremoteinboundrtpstreamstats-roundtriptime\n // cover it to milliseconds (and make it integer)\n standardizedStats.roundTripTime = Math.round(roundTripTime * 1000);\n }\n var jitter = getStatValue('jitter');\n if (typeof jitter === 'number') {\n standardizedStats.jitter = Math.round(jitter * 1000);\n }\n var frameRateSent = getStatValue('framerateMean');\n if (typeof frameRateSent === 'number') {\n standardizedStats.frameRateSent = Math.round(frameRateSent);\n }\n var bytesReceived = getStatValue('bytesReceived');\n if (typeof bytesReceived === 'number') {\n standardizedStats.bytesReceived = bytesReceived;\n }\n var packetsReceived = getStatValue('packetsReceived');\n if (typeof packetsReceived === 'number') {\n standardizedStats.packetsReceived = packetsReceived;\n }\n var frameRateReceived = getStatValue('framerateMean');\n if (typeof frameRateReceived === 'number') {\n standardizedStats.frameRateReceived = Math.round(frameRateReceived);\n }\n var totalPacketSendDalay = getStatValue('totalPacketSendDelay');\n if (typeof totalPacketSendDalay === 'number') {\n standardizedStats.totalPacketSendDelay = totalPacketSendDalay;\n }\n var totalEncodeTime = getStatValue('totalEncodeTime');\n if (typeof totalEncodeTime === 'number') {\n standardizedStats.totalEncodeTime = totalEncodeTime;\n }\n var framesEncoded = getStatValue('framesEncoded');\n if (typeof framesEncoded === 'number') {\n standardizedStats.framesEncoded = framesEncoded;\n }\n var estimatedPlayoutTimestamp = getStatValue('estimatedPlayoutTimestamp');\n if (typeof estimatedPlayoutTimestamp === 'number') {\n standardizedStats.estimatedPlayoutTimestamp = estimatedPlayoutTimestamp;\n }\n var totalDecodeTime = getStatValue('totalDecodeTime');\n if (typeof totalDecodeTime === 'number') {\n standardizedStats.totalDecodeTime = totalDecodeTime;\n }\n var framesDecoded = getStatValue('framesDecoded');\n if (typeof framesDecoded === 'number') {\n standardizedStats.framesDecoded = framesDecoded;\n }\n var jitterBufferDelay = getStatValue('jitterBufferDelay');\n if (typeof jitterBufferDelay === 'number') {\n standardizedStats.jitterBufferDelay = jitterBufferDelay;\n }\n var jitterBufferEmittedCount = getStatValue('jitterBufferEmittedCount');\n if (typeof jitterBufferEmittedCount === 'number') {\n standardizedStats.jitterBufferEmittedCount = jitterBufferEmittedCount;\n }\n return standardizedStats;\n}\n/**\n * Standardized RTCIceCandidate statistics.\n * @typedef {object} StandardizedIceCandidateStatsReport\n * @property {'host'|'prflx'|'relay'|'srflx'} candidateType\n * @property {string} ip\n * @property {number} port\n * @property {number} priority\n * @property {'tcp'|'udp'} protocol\n * @property {string} url\n */\n/**\n * Standardized local RTCIceCandidate statistics.\n * @typedef {StandardizedIceCandidateStatsReport} StandardizedLocalIceCandidateStatsReport\n * @property {boolean} [deleted=false]\n * @property {'tcp'|'tls'|'udp'} relayProtocol\n */\n/**\n * Standardized active RTCIceCandidate pair statistics.\n * @typedef {object} StandardizedActiveIceCandidatePairStatsReport\n * @property {number} availableIncomingBitrate\n * @property {number} availableOutgoingBitrate\n * @property {number} bytesReceived\n * @property {number} bytesSent\n * @property {number} consentRequestsSent\n * @property {number} currentRoundTripTime\n * @property {number} lastPacketReceivedTimestamp\n * @property {number} lastPacketSentTimestamp\n * @property {StandardizedLocalIceCandidateStatsReport} localCandidate\n * @property {boolean} nominated\n * @property {number} priority\n * @property {boolean} readable\n * @property {StandardizedIceCandidateStatsReport} remoteCandidate\n * @property {number} requestsReceived\n * @property {number} requestsSent\n * @property {number} responsesReceived\n * @property {number} responsesSent\n * @property {number} retransmissionsReceived\n * @property {number} retransmissionsSent\n * @property {'frozen'|'waiting'|'in-progress'|'failed'|'succeeded'} state\n * @property {number} totalRoundTripTime\n * @property {string} transportId\n * @property {boolean} writable\n */\n/**\n * Standardized {@link RTCPeerConnection} statistics.\n * @typedef {Object} StandardizedStatsResponse\n * @property {StandardizedActiveIceCandidatePairStatsReport} activeIceCandidatePair - Stats for active ICE candidate pair\n * @property Array localAudioTrackStats - Stats for local audio MediaStreamTracks\n * @property Array localVideoTrackStats - Stats for local video MediaStreamTracks\n * @property Array remoteAudioTrackStats - Stats for remote audio MediaStreamTracks\n * @property Array remoteVideoTrackStats - Stats for remote video MediaStreamTracks\n */\n/**\n * Standardized MediaStreamTrack statistics.\n * @typedef {Object} StandardizedTrackStatsReport\n * @property {string} trackId - MediaStreamTrack ID\n * @property {string} ssrc - SSRC of the MediaStreamTrack\n * @property {number} timestamp - The Unix timestamp in milliseconds\n * @property {string} [codecName] - Name of the codec used to encode the MediaStreamTrack's media\n * @property {number} [roundTripTime] - Round trip time in milliseconds\n * @property {number} [jitter] - Jitter in milliseconds\n * @property {number} [frameWidthInput] - Width in pixels of the local video MediaStreamTrack's captured frame\n * @property {number} [frameHeightInput] - Height in pixels of the local video MediaStreamTrack's captured frame\n * @property {number} [frameWidthSent] - Width in pixels of the local video MediaStreamTrack's encoded frame\n * @property {number} [frameHeightSent] - Height in pixels of the local video MediaStreamTrack's encoded frame\n * @property {number} [frameWidthReceived] - Width in pixels of the remote video MediaStreamTrack's received frame\n * @property {number} [frameHeightReceived] - Height in pixels of the remote video MediaStreamTrack's received frame\n * @property {number} [frameRateInput] - Captured frames per second of the local video MediaStreamTrack\n * @property {number} [frameRateSent] - Frames per second of the local video MediaStreamTrack's encoded video\n * @property {number} [frameRateReceived] - Frames per second of the remote video MediaStreamTrack's received video\n * @property {number} [bytesReceived] - Number of bytes of the remote MediaStreamTrack's media received\n * @property {number} [bytesSent] - Number of bytes of the local MediaStreamTrack's media sent\n * @property {number} [packetsLost] - Number of packets of the MediaStreamTrack's media lost\n * @property {number} [packetsReceived] - Number of packets of the remote MediaStreamTrack's media received\n * @property {number} [packetsSent] - Number of packets of the local MediaStreamTrack's media sent\n * @property {number} [totalPacketSendDelay] - The total number of seconds that the local MediaStreamTrack's packets\n * have spent buffered locally before being sent over the network\n * @property {number} [totalEncodeTime] - The total number of seconds spent on encoding the local MediaStreamTrack's frames\n * @property {number} [framesEncoded] - The total number of frames of the local MediaStreamTrack that have been encoded sor far\n * @property {number} [estimatedPlayoutTimestamp] - The estimated playout time of the remote MediaStreamTrack\n * @property {number} [totalDecodeTime] - The total number of seconds spent on decoding the remote MediaStreamTrack's frames\n * @property {number} [framesDecoded] - The total number of frames of the remote MediaStreamTrack that have been decoded sor far\n * @property {number} [jitterBufferDelay] - The sum of the time, in seconds, each audio sample or a video frame of the remote\n * MediaStreamTrack takes from the time the first packet is received by the jitter buffer to the time it exits the jitter buffer\n * @property {number} [jitterBufferEmittedCount] - The total number of audio samples or video frames that have come out of the jitter buffer\n * @property {AudioLevel} [audioInputLevel] - The {@link AudioLevel} of the local audio MediaStreamTrack\n * @property {AudioLevel} [audioOutputLevel] - The {@link AudioLevel} of the remote video MediaStreamTrack\n */\nmodule.exports = getStats;\n//# sourceMappingURL=getstats.js.map","/* globals navigator */\n'use strict';\n/**\n * This function is very similar to navigator.mediaDevices.getUserMedia\n * except that if no MediaStreamConstraints are provided, then bot audio and video\n * are requested.\n * @function getUserMedia\n * @param {MediaStreamConstraints} [constraints={audio:true,video:true}] - the\n * MediaStreamConstraints object specifying what kind of MediaStream to\n * request from the browser (by default both audio and video)\n * @returns Promise\n */\nfunction getUserMedia(constraints) {\n if (constraints === void 0) { constraints = { audio: true, video: true }; }\n if (typeof navigator === 'object'\n && typeof navigator.mediaDevices === 'object'\n && typeof navigator.mediaDevices.getUserMedia === 'function') {\n return navigator.mediaDevices.getUserMedia(constraints);\n }\n return Promise.reject(new Error('getUserMedia is not supported'));\n}\nmodule.exports = getUserMedia;\n//# sourceMappingURL=getusermedia.js.map","/* globals MediaStream */\n'use strict';\nif (typeof MediaStream === 'function') {\n module.exports = MediaStream;\n}\nelse {\n module.exports = function MediaStream() {\n throw new Error('MediaStream is not supported');\n };\n}\n//# sourceMappingURL=mediastream.js.map","/* global MediaStreamTrack */\n'use strict';\nif (typeof MediaStreamTrack === 'function') {\n module.exports = MediaStreamTrack;\n}\nelse {\n module.exports = function MediaStreamTrack() {\n throw new Error('MediaStreamTrack is not supported');\n };\n}\n//# sourceMappingURL=mediastreamtrack.js.map","/* global RTCIceCandidate */\n'use strict';\nif (typeof RTCIceCandidate === 'function') {\n module.exports = RTCIceCandidate;\n}\nelse {\n module.exports = function RTCIceCandidate() {\n throw new Error('RTCIceCandidate is not supported');\n };\n}\n//# sourceMappingURL=rtcicecandidate.js.map","/* globals RTCSessionDescription */\n'use strict';\n// This class wraps Chrome's RTCSessionDescription implementation. It provides\n// one piece of functionality not currently present in Chrome, namely\n//\n// 1. Rollback support\n// https://bugs.chromium.org/p/webrtc/issues/detail?id=4676\n//\nvar ChromeRTCSessionDescription = /** @class */ (function () {\n function ChromeRTCSessionDescription(descriptionInitDict) {\n this.descriptionInitDict = descriptionInitDict;\n // If this constructor is called with an object with a .type property set to\n // \"rollback\", we should not call Chrome's RTCSessionDescription constructor,\n // because this would throw an RTCSdpType error.\n var description = descriptionInitDict && descriptionInitDict.type === 'rollback'\n ? null\n : new RTCSessionDescription(descriptionInitDict);\n Object.defineProperties(this, {\n _description: {\n get: function () {\n return description;\n }\n }\n });\n }\n Object.defineProperty(ChromeRTCSessionDescription.prototype, \"sdp\", {\n get: function () {\n return this._description ? this._description.sdp : this.descriptionInitDict.sdp;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ChromeRTCSessionDescription.prototype, \"type\", {\n get: function () {\n return this._description ? this._description.type : this.descriptionInitDict.type;\n },\n enumerable: false,\n configurable: true\n });\n return ChromeRTCSessionDescription;\n}());\nmodule.exports = ChromeRTCSessionDescription;\n//# sourceMappingURL=chrome.js.map","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","'use strict';\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar EventEmitter = require('events').EventEmitter;\nvar EventTarget = /** @class */ (function () {\n function EventTarget() {\n Object.defineProperties(this, {\n _eventEmitter: {\n value: new EventEmitter()\n }\n });\n }\n EventTarget.prototype.dispatchEvent = function (event) {\n return this._eventEmitter.emit(event.type, event);\n };\n EventTarget.prototype.addEventListener = function () {\n var _a;\n return (_a = this._eventEmitter).addListener.apply(_a, __spreadArray([], __read(arguments)));\n };\n EventTarget.prototype.removeEventListener = function () {\n var _a;\n return (_a = this._eventEmitter).removeListener.apply(_a, __spreadArray([], __read(arguments)));\n };\n return EventTarget;\n}());\nmodule.exports = EventTarget;\n//# sourceMappingURL=eventtarget.js.map","'use strict';\nvar defer = require('./').defer;\nvar states = {\n high: new Set(['low']),\n low: new Set(['high'])\n};\n/**\n * Construct a {@link Latch}.\n * @class\n * @classdesc A {@link Latch} has two states (\"high\" and \"low\") and methods for\n * transitioning between them ({@link Latch#raise} and {@link Latch#lower}).\n * @param {string} [initialState=\"low\"] - either \"high\" or \"low\"\n */\nvar Latch = /** @class */ (function () {\n function Latch(initialState) {\n if (initialState === void 0) { initialState = 'low'; }\n var state = initialState;\n Object.defineProperties(this, {\n _state: {\n set: function (_state) {\n var _this = this;\n if (state !== _state) {\n state = _state;\n var whenDeferreds = this._whenDeferreds.get(state);\n whenDeferreds.forEach(function (deferred) { return deferred.resolve(_this); });\n whenDeferreds.clear();\n }\n },\n get: function () {\n return state;\n }\n },\n _whenDeferreds: {\n value: new Map([\n ['high', new Set()],\n ['low', new Set()]\n ])\n }\n });\n }\n Object.defineProperty(Latch.prototype, \"state\", {\n get: function () {\n return this._state;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Transition to \"low\".\n * @returns {this}\n * @throws {Error}\n */\n Latch.prototype.lower = function () {\n return this.transition('low');\n };\n /**\n * Transition to \"high\".\n * @returns {this}\n * @throws {Error}\n */\n Latch.prototype.raise = function () {\n return this.transition('high');\n };\n /**\n * Transition to a new state.\n * @param {string} newState\n * @returns {this}\n * @throws {Error}\n */\n Latch.prototype.transition = function (newState) {\n if (!states[this.state].has(newState)) {\n throw createUnreachableStateError(this.state, newState);\n }\n this._state = newState;\n return this;\n };\n /**\n * Return a Promise that resolves when the {@link Latch} transitions to\n * the specified state.\n * @param {string} state\n * @returns {Promise}\n */\n Latch.prototype.when = function (state) {\n if (this.state === state) {\n return Promise.resolve(this);\n }\n if (!states[this.state].has(state)) {\n return Promise.reject(createUnreachableStateError(this.state, state));\n }\n var deferred = defer();\n this._whenDeferreds.get(state).add(deferred);\n return deferred.promise;\n };\n return Latch;\n}());\n/**\n * Create an unreachable state Error.\n * @param {string} from - state to be transitioned from\n * @param {string} to - state to be transitioned to\n * @return {Error}\n */\nfunction createUnreachableStateError(from, to) {\n return new Error(\"Cannot transition from \\\"\" + from + \"\\\" to \\\"\" + to + \"\\\"\");\n}\nmodule.exports = Latch;\n//# sourceMappingURL=latch.js.map","'use strict';\n/**\n * RTCRtpSender shim.\n * @param {MediaStreamTrack} track\n * @property {MediaStreamTrack} track\n */\nvar RTCRtpSenderShim = /** @class */ (function () {\n function RTCRtpSenderShim(track) {\n Object.defineProperties(this, {\n track: {\n enumerable: true,\n value: track,\n writable: true\n }\n });\n }\n return RTCRtpSenderShim;\n}());\n// NOTE(mmalavalli): Because of the way we will be using this shim, there\n// are a couple of use cases that will not be covered:\n//\n// /* Case 1 */\n// const sender = pc.addTrack(track);\n// assert.equal(sender.track, track);\n// pc.removeTrack(sender);\n// assert.equal(sender.track, null); /* Error */\n//\n// /* Case 2 */\n// const sender = pc.addTrack(track);\n// const senders1 = new Set(pc.getSenders());\n// assert(senders1.has(sender));\n// pc.removeTrack(track);\n// const senders2 = new Set(pc.getSenders());\n// assert(senders2.has(sender)); /* Error */\n//\n// For now, since we only use senders for passing them to RTCPeerConnection#removeTrack(),\n// we will omit handling these use cases for now, and revisit them when we start\n// using the RTCRtpSender APIs.\nmodule.exports = RTCRtpSenderShim;\n//# sourceMappingURL=rtcrtpsender.js.map","/* globals RTCDataChannel, RTCPeerConnection, RTCSessionDescription */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar ChromeRTCSessionDescription = require('../rtcsessiondescription/chrome');\nvar EventTarget = require('../../eventtarget');\nvar Latch = require('../util/latch');\nvar MediaStream = require('../mediastream');\nvar RTCRtpSenderShim = require('../rtcrtpsender');\nvar _a = require('../util/sdp'), getSdpFormat = _a.getSdpFormat, updatePlanBTrackIdsToSSRCs = _a.updatePlanBTrackIdsToSSRCs, updateUnifiedPlanTrackIdsToSSRCs = _a.updateUnifiedPlanTrackIdsToSSRCs;\nvar _b = require('../util'), delegateMethods = _b.delegateMethods, interceptEvent = _b.interceptEvent, isIOSChrome = _b.isIOSChrome, legacyPromise = _b.legacyPromise, proxyProperties = _b.proxyProperties;\nvar isUnifiedPlan = getSdpFormat() === 'unified';\n// NOTE(mroberts): This class wraps Chrome's RTCPeerConnection implementation.\n// It provides some functionality not currently present in Chrome, namely the\n// abilities to\n//\n// 1. Rollback, per the workaround suggested here:\n// https://bugs.chromium.org/p/webrtc/issues/detail?id=5738#c3\n//\n// 2. Listen for track events, per the adapter.js workaround.\n//\n// 3. Set iceTransportPolicy.\n//\nvar ChromeRTCPeerConnection = /** @class */ (function (_super) {\n __extends(ChromeRTCPeerConnection, _super);\n function ChromeRTCPeerConnection(configuration, constraints) {\n if (configuration === void 0) { configuration = {}; }\n var _this = _super.call(this) || this;\n var newConfiguration = Object.assign(configuration.iceTransportPolicy\n ? { iceTransports: configuration.iceTransportPolicy }\n : {}, configuration);\n interceptEvent(_this, 'datachannel');\n interceptEvent(_this, 'signalingstatechange');\n var sdpFormat = getSdpFormat(newConfiguration.sdpSemantics);\n var peerConnection = new RTCPeerConnection(newConfiguration, constraints);\n Object.defineProperties(_this, {\n _appliedTracksToSSRCs: {\n value: new Map(),\n writable: true\n },\n _localStream: {\n value: new MediaStream()\n },\n _peerConnection: {\n value: peerConnection\n },\n _pendingLocalOffer: {\n value: null,\n writable: true\n },\n _pendingRemoteOffer: {\n value: null,\n writable: true\n },\n _rolledBackTracksToSSRCs: {\n value: new Map(),\n writable: true\n },\n _sdpFormat: {\n value: sdpFormat\n },\n _senders: {\n value: new Map()\n },\n _signalingStateLatch: {\n value: new Latch()\n },\n _tracksToSSRCs: {\n value: new Map(),\n writable: true\n }\n });\n peerConnection.addEventListener('datachannel', function (event) {\n shimDataChannel(event.channel);\n _this.dispatchEvent(event);\n });\n peerConnection.addEventListener('signalingstatechange', function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (peerConnection.signalingState === 'stable') {\n _this._appliedTracksToSSRCs = new Map(_this._tracksToSSRCs);\n }\n if (!_this._pendingLocalOffer && !_this._pendingRemoteOffer) {\n _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));\n }\n });\n peerConnection.ontrack = function () {\n // NOTE(mroberts): adapter.js's \"track\" event shim only kicks off if we set\n // the ontrack property of the RTCPeerConnection.\n };\n if (typeof peerConnection.addTrack !== 'function') {\n peerConnection.addStream(_this._localStream);\n }\n proxyProperties(RTCPeerConnection.prototype, _this, peerConnection);\n return _this;\n }\n Object.defineProperty(ChromeRTCPeerConnection.prototype, \"localDescription\", {\n get: function () {\n return this._pendingLocalOffer ? this._pendingLocalOffer : this._peerConnection.localDescription;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ChromeRTCPeerConnection.prototype, \"remoteDescription\", {\n get: function () {\n return this._pendingRemoteOffer ? this._pendingRemoteOffer : this._peerConnection.remoteDescription;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ChromeRTCPeerConnection.prototype, \"signalingState\", {\n get: function () {\n if (this._pendingLocalOffer) {\n return 'have-local-offer';\n }\n else if (this._pendingRemoteOffer) {\n return 'have-remote-offer';\n }\n return this._peerConnection.signalingState;\n },\n enumerable: false,\n configurable: true\n });\n // NOTE(mmalavalli): This shim supports our limited case of adding\n // all MediaStreamTracks to one MediaStream. It has been implemented this\n // keeping in mind that this is to be maintained only until \"addTrack\" is\n // supported natively in Chrome.\n ChromeRTCPeerConnection.prototype.addTrack = function (track) {\n var _a;\n var rest = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments[_i];\n }\n if (typeof this._peerConnection.addTrack === 'function') {\n return (_a = this._peerConnection).addTrack.apply(_a, __spreadArray([track], __read(rest)));\n }\n if (this._peerConnection.signalingState === 'closed') {\n throw new Error(\"Cannot add MediaStreamTrack [\" + track.id + \", \\n \" + track.kind + \"]: RTCPeerConnection is closed\");\n }\n var sender = this._senders.get(track);\n if (sender && sender.track) {\n throw new Error(\"Cannot add MediaStreamTrack ['\" + track.id + \", \\n \" + track.kind + \"]: RTCPeerConnection already has it\");\n }\n this._peerConnection.removeStream(this._localStream);\n this._localStream.addTrack(track);\n this._peerConnection.addStream(this._localStream);\n sender = new RTCRtpSenderShim(track);\n this._senders.set(track, sender);\n return sender;\n };\n // NOTE(mmalavalli): This shim supports our limited case of removing\n // MediaStreamTracks from one MediaStream. It has been implemented this\n // keeping in mind that this is to be maintained only until \"removeTrack\" is\n // supported natively in Chrome.\n ChromeRTCPeerConnection.prototype.removeTrack = function (sender) {\n if (this._peerConnection.signalingState === 'closed') {\n throw new Error('Cannot remove MediaStreamTrack: RTCPeerConnection is closed');\n }\n if (typeof this._peerConnection.addTrack === 'function') {\n try {\n return this._peerConnection.removeTrack(sender);\n }\n catch (e) {\n // NOTE(mhuynh): Do nothing. In Chrome, will throw if a 'sender was not\n // created by this peer connection'. This behavior does not seem to be\n // spec compliant, so a temporary shim is introduced. A bug has been filed,\n // and is tracked here:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=860853\n }\n }\n else {\n var track = sender.track;\n if (!track) {\n return;\n }\n sender = this._senders.get(track);\n if (sender && sender.track) {\n sender.track = null;\n this._peerConnection.removeStream(this._localStream);\n this._localStream.removeTrack(track);\n this._peerConnection.addStream(this._localStream);\n }\n }\n };\n ChromeRTCPeerConnection.prototype.getSenders = function () {\n if (typeof this._peerConnection.addTrack === 'function') {\n return this._peerConnection.getSenders();\n }\n return Array.from(this._senders.values());\n };\n ChromeRTCPeerConnection.prototype.addIceCandidate = function (candidate) {\n var _this = this;\n var rest = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments[_i];\n }\n var promise;\n if (this.signalingState === 'have-remote-offer') {\n // NOTE(mroberts): Because the ChromeRTCPeerConnection simulates the\n // \"have-remote-offer\" signalingStates, we only want to invoke the true\n // addIceCandidates method when the remote description has been applied.\n promise = this._signalingStateLatch.when('low').then(function () {\n return _this._peerConnection.addIceCandidate(candidate);\n });\n }\n else {\n promise = this._peerConnection.addIceCandidate(candidate);\n }\n return rest.length > 0\n ? legacyPromise.apply(void 0, __spreadArray([promise], __read(rest))) : promise;\n };\n // NOTE(mroberts): The WebRTC spec does not specify that close should throw an\n // Error; however, in Chrome it does. We workaround this by checking the\n // signalingState manually.\n ChromeRTCPeerConnection.prototype.close = function () {\n if (this.signalingState !== 'closed') {\n this._pendingLocalOffer = null;\n this._pendingRemoteOffer = null;\n this._peerConnection.close();\n }\n };\n // NOTE(mroberts): Because we workaround Chrome's lack of rollback support by\n // \"faking\" setRemoteDescription, we cannot create an answer until we actually\n // apply the remote description. This means, once you call createAnswer, you\n // can no longer rollback. This is acceptable for our use case because we will\n // apply the newly-created answer almost immediately; however, this may be\n // unacceptable for other use cases.\n ChromeRTCPeerConnection.prototype.createAnswer = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var promise;\n if (this._pendingRemoteOffer) {\n promise = this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function () {\n // NOTE(mroberts): The signalingStates between the ChromeRTCPeerConnection\n // and the underlying RTCPeerConnection implementation have converged. We\n // can unblock any pending calls to addIceCandidate now.\n _this._signalingStateLatch.lower();\n return _this._peerConnection.createAnswer();\n }).then(function (answer) {\n _this._pendingRemoteOffer = null;\n // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no\n // longer need to retain the rolled back tracks to SSRCs Map.\n _this._rolledBackTracksToSSRCs.clear();\n return new ChromeRTCSessionDescription({\n type: 'answer',\n sdp: updateTrackIdsToSSRCs(_this._sdpFormat, _this._tracksToSSRCs, answer.sdp)\n });\n }, function (error) {\n _this._pendingRemoteOffer = null;\n throw error;\n });\n }\n else {\n promise = this._peerConnection.createAnswer().then(function (answer) {\n // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no\n // longer need to retain the rolled back tracks to SSRCs Map.\n _this._rolledBackTracksToSSRCs.clear();\n return new ChromeRTCSessionDescription({\n type: 'answer',\n sdp: updateTrackIdsToSSRCs(_this._sdpFormat, _this._tracksToSSRCs, answer.sdp)\n });\n });\n }\n return args.length > 1\n ? legacyPromise.apply(void 0, __spreadArray([promise], __read(args))) : promise;\n };\n ChromeRTCPeerConnection.prototype.createOffer = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = __read(args, 3), arg1 = _a[0], arg2 = _a[1], arg3 = _a[2];\n var options = arg3 || arg1 || {};\n if (isIOSChrome()) {\n // NOTE (joma): From SafariRTCPeerConnection in order to support iOS Chrome.\n if (options.offerToReceiveVideo && !this._audioTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'audio'))) {\n delete options.offerToReceiveAudio;\n try {\n this._audioTransceiver = isUnifiedPlan\n ? this.addTransceiver('audio', { direction: 'recvonly' })\n : this.addTransceiver('audio');\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n if (options.offerToReceiveVideo && !this._videoTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'video'))) {\n delete options.offerToReceiveVideo;\n try {\n this._videoTransceiver = isUnifiedPlan\n ? this.addTransceiver('video', { direction: 'recvonly' })\n : this.addTransceiver('video');\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n }\n var promise = this._peerConnection.createOffer(options).then(function (offer) {\n // NOTE(mmalavalli): If createOffer() is called immediately after rolling back, then we no\n // longer need to retain the rolled back tracks to SSRCs Map.\n _this._rolledBackTracksToSSRCs.clear();\n return new ChromeRTCSessionDescription({\n type: offer.type,\n sdp: updateTrackIdsToSSRCs(_this._sdpFormat, _this._tracksToSSRCs, offer.sdp)\n });\n });\n return args.length > 1\n ? legacyPromise(promise, arg1, arg2)\n : promise;\n };\n ChromeRTCPeerConnection.prototype.createDataChannel = function (label, dataChannelDict) {\n dataChannelDict = shimDataChannelInit(dataChannelDict);\n var dataChannel = this._peerConnection.createDataChannel(label, dataChannelDict);\n shimDataChannel(dataChannel);\n return dataChannel;\n };\n ChromeRTCPeerConnection.prototype.setLocalDescription = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = __read(args, 3), description = _a[0], arg1 = _a[1], arg2 = _a[2];\n // NOTE(mmalavalli): If setLocalDescription() is called immediately after rolling back,\n // then we need to restore the rolled back tracks to SSRCs Map.\n if (this._rolledBackTracksToSSRCs.size > 0) {\n this._tracksToSSRCs = new Map(this._rolledBackTracksToSSRCs);\n this._rolledBackTracksToSSRCs.clear();\n }\n var promise = setDescription(this, true, description);\n return args.length > 1\n ? legacyPromise(promise, arg1, arg2)\n : promise;\n };\n ChromeRTCPeerConnection.prototype.setRemoteDescription = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = __read(args, 3), description = _a[0], arg1 = _a[1], arg2 = _a[2];\n // NOTE(mmalavalli): If setRemoteDescription() is called immediately after rolling back,\n // then we no longer need to retain the rolled back tracks to SSRCs Map.\n this._rolledBackTracksToSSRCs.clear();\n var promise = setDescription(this, false, description);\n return args.length > 1\n ? legacyPromise(promise, arg1, arg2)\n : promise;\n };\n return ChromeRTCPeerConnection;\n}(EventTarget));\ndelegateMethods(RTCPeerConnection.prototype, ChromeRTCPeerConnection.prototype, '_peerConnection');\n// NOTE(mroberts): We workaround Chrome's lack of rollback support, per the\n// workaround suggested here: https://bugs.chromium.org/p/webrtc/issues/detail?id=5738#c3\n// Namely, we \"fake\" setting the local or remote description and instead buffer\n// it. If we receive or create an answer, then we will actually apply the\n// description. Until we receive or create an answer, we will be able to\n// \"rollback\" by simply discarding the buffer description.\nfunction setDescription(peerConnection, local, description) {\n function setPendingLocalOffer(offer) {\n if (local) {\n peerConnection._pendingLocalOffer = offer;\n }\n else {\n peerConnection._pendingRemoteOffer = offer;\n }\n }\n function clearPendingLocalOffer() {\n if (local) {\n peerConnection._pendingLocalOffer = null;\n }\n else {\n peerConnection._pendingRemoteOffer = null;\n }\n }\n var pendingLocalOffer = local ? peerConnection._pendingLocalOffer : peerConnection._pendingRemoteOffer;\n var pendingRemoteOffer = local ? peerConnection._pendingRemoteOffer : peerConnection._pendingLocalOffer;\n var intermediateState = local ? 'have-local-offer' : 'have-remote-offer';\n var setLocalDescription = local ? 'setLocalDescription' : 'setRemoteDescription';\n var promise;\n if (!local && pendingRemoteOffer && description.type === 'answer') {\n promise = setRemoteAnswer(peerConnection, description);\n }\n else if (description.type === 'offer') {\n if (peerConnection.signalingState !== intermediateState && peerConnection.signalingState !== 'stable') {\n // NOTE(mroberts): Error message copied from Firefox.\n return Promise.reject(new Error(\"Cannot set \" + (local ? 'local' : 'remote') + \" offer in state \" + peerConnection.signalingState));\n }\n // We need to save this local offer in case of a rollback. We also need to\n // check to see if the signalingState between the ChromeRTCPeerConnection\n // and the underlying RTCPeerConnection implementation are about to diverge.\n // If so, we need to ensure subsequent calls to addIceCandidate will block.\n if (!pendingLocalOffer && peerConnection._signalingStateLatch.state === 'low') {\n peerConnection._signalingStateLatch.raise();\n }\n var previousSignalingState = peerConnection.signalingState;\n setPendingLocalOffer(unwrap(description));\n promise = Promise.resolve();\n // Only dispatch a signalingstatechange event if we transitioned.\n if (peerConnection.signalingState !== previousSignalingState) {\n promise.then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });\n }\n }\n else if (description.type === 'rollback') {\n if (peerConnection.signalingState !== intermediateState) {\n // NOTE(mroberts): Error message copied from Firefox.\n promise = Promise.reject(new Error(\"Cannot rollback \" + (local ? 'local' : 'remote') + \" description in \" + peerConnection.signalingState));\n }\n else {\n // Reset the pending offer.\n clearPendingLocalOffer();\n // NOTE(mmalavalli): We store the rolled back tracks to SSRCs Map here in case\n // setLocalDescription() is called immediately after a rollback (without calling\n // createOffer() or createAnswer()), in which case this roll back is not due to a\n // glare scenario and this Map should be restored.\n peerConnection._rolledBackTracksToSSRCs = new Map(peerConnection._tracksToSSRCs);\n peerConnection._tracksToSSRCs = new Map(peerConnection._appliedTracksToSSRCs);\n promise = Promise.resolve();\n promise.then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });\n }\n }\n return promise || peerConnection._peerConnection[setLocalDescription](unwrap(description));\n}\nfunction setRemoteAnswer(peerConnection, answer) {\n // Apply the pending local offer.\n var pendingLocalOffer = peerConnection._pendingLocalOffer;\n return peerConnection._peerConnection.setLocalDescription(pendingLocalOffer).then(function () {\n peerConnection._pendingLocalOffer = null;\n return peerConnection.setRemoteDescription(answer);\n }).then(function () {\n // NOTE(mroberts): The signalingStates between the ChromeRTCPeerConnection\n // and the underlying RTCPeerConnection implementation have converged. We\n // can unblock any pending calls to addIceCandidate now.\n peerConnection._signalingStateLatch.lower();\n });\n}\n/**\n * Whether a ChromeRTCPeerConnection has any RTCRtpReceivers(s) for the given\n * MediaStreamTrack kind.\n * @param {ChromeRTCPeerConnection} peerConnection\n * @param {'audio' | 'video'} kind\n * @returns {boolean}\n */\nfunction hasReceiversForTracksOfKind(peerConnection, kind) {\n return !!peerConnection.getTransceivers().find(function (_a) {\n var _b = _a.receiver, receiver = _b === void 0 ? {} : _b;\n var _c = receiver.track, track = _c === void 0 ? {} : _c;\n return track.kind === kind;\n });\n}\nfunction unwrap(description) {\n if (description instanceof ChromeRTCSessionDescription) {\n if (description._description) {\n return description._description;\n }\n }\n return new RTCSessionDescription(description);\n}\n/**\n * Check whether or not we need to apply our maxPacketLifeTime shim. We are\n * pretty conservative: we'll only apply it if the legacy maxRetransmitTime\n * property is available _and_ the standard maxPacketLifeTime property is _not_\n * available (the thinking being that Chrome will land the standards-compliant\n * property).\n * @returns {boolean}\n */\nfunction needsMaxPacketLifeTimeShim() {\n return 'maxRetransmitTime' in RTCDataChannel.prototype\n && !('maxPacketLifeTime' in RTCDataChannel.prototype);\n}\n/**\n * Shim an RTCDataChannelInit dictionary (if necessary). This function returns\n * a copy of the original RTCDataChannelInit.\n * @param {RTCDataChannelInit} dataChannelDict\n * @returns {RTCDataChannelInit}\n */\nfunction shimDataChannelInit(dataChannelDict) {\n dataChannelDict = Object.assign({}, dataChannelDict);\n if (needsMaxPacketLifeTimeShim() && 'maxPacketLifeTime' in dataChannelDict) {\n dataChannelDict.maxRetransmitTime = dataChannelDict.maxPacketLifeTime;\n }\n return dataChannelDict;\n}\n/**\n * Shim an RTCDataChannel (if necessary). This function mutates the\n * RTCDataChannel.\n * @param {RTCDataChannel} dataChannel\n * @returns {RTCDataChannel}\n */\nfunction shimDataChannel(dataChannel) {\n Object.defineProperty(dataChannel, 'maxRetransmits', {\n value: dataChannel.maxRetransmits === 65535\n ? null\n : dataChannel.maxRetransmits\n });\n if (needsMaxPacketLifeTimeShim()) {\n // NOTE(mroberts): We can rename `maxRetransmitTime` to `maxPacketLifeTime`.\n //\n // https://bugs.chromium.org/p/chromium/issues/detail?id=696681\n //\n Object.defineProperty(dataChannel, 'maxPacketLifeTime', {\n value: dataChannel.maxRetransmitTime === 65535\n ? null\n : dataChannel.maxRetransmitTime\n });\n }\n return dataChannel;\n}\n/**\n * Update the mappings from MediaStreamTrack IDs to SSRCs as indicated by both\n * the Map from MediaStreamTrack IDs to SSRCs and the SDP itself. This method\n * ensures that SSRCs never change once announced.\n * @param {'planb'|'unified'} sdpFormat\n * @param {Map>} tracksToSSRCs\n * @param {string} sdp - an SDP whose format is determined by `sdpSemantics`\n * @returns {string} updatedSdp - updated SDP\n */\nfunction updateTrackIdsToSSRCs(sdpFormat, tracksToSSRCs, sdp) {\n return sdpFormat === 'unified'\n ? updateUnifiedPlanTrackIdsToSSRCs(tracksToSSRCs, sdp)\n : updatePlanBTrackIdsToSSRCs(tracksToSSRCs, sdp);\n}\nmodule.exports = ChromeRTCPeerConnection;\n//# sourceMappingURL=chrome.js.map","/* globals RTCSessionDescription */\n'use strict';\nmodule.exports = RTCSessionDescription;\n//# sourceMappingURL=firefox.js.map","/* globals RTCPeerConnection */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar EventTarget = require('../../eventtarget');\nvar FirefoxRTCSessionDescription = require('../rtcsessiondescription/firefox');\nvar updateTracksToSSRCs = require('../util/sdp').updateUnifiedPlanTrackIdsToSSRCs;\nvar _a = require('../util'), delegateMethods = _a.delegateMethods, interceptEvent = _a.interceptEvent, legacyPromise = _a.legacyPromise, proxyProperties = _a.proxyProperties;\n// NOTE(mroberts): This class wraps Firefox's RTCPeerConnection implementation.\n// It provides some functionality not currently present in Firefox, namely the\n// abilities to\n//\n// 1. Call setLocalDescription and setRemoteDescription with new offers in\n// signalingStates \"have-local-offer\" and \"have-remote-offer\",\n// respectively.\n//\n// 2. The ability to call createOffer in signalingState \"have-local-offer\".\n//\n// Both of these are implemented using rollbacks to workaround the following\n// bug:\n//\n// https://bugzilla.mozilla.org/show_bug.cgi?id=1072388\n//\n// We also provide a workaround for a bug where Firefox may change the\n// previously-negotiated DTLS role in an answer, which breaks Chrome:\n//\n// https://bugzilla.mozilla.org/show_bug.cgi?id=1240897\n//\nvar FirefoxRTCPeerConnection = /** @class */ (function (_super) {\n __extends(FirefoxRTCPeerConnection, _super);\n function FirefoxRTCPeerConnection(configuration) {\n var _this = _super.call(this) || this;\n interceptEvent(_this, 'signalingstatechange');\n /* eslint new-cap:0 */\n var peerConnection = new RTCPeerConnection(configuration);\n Object.defineProperties(_this, {\n _initiallyNegotiatedDtlsRole: {\n value: null,\n writable: true\n },\n _isClosed: {\n value: false,\n writable: true\n },\n _peerConnection: {\n value: peerConnection\n },\n _rollingBack: {\n value: false,\n writable: true\n },\n _tracksToSSRCs: {\n value: new Map()\n },\n // NOTE(mmalavalli): Firefox throws a TypeError when the PeerConnection's\n // prototype's \"peerIdentity\" property is accessed. In order to overcome\n // this, we ignore this property while delegating methods.\n // Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=1363815\n peerIdentity: {\n enumerable: true,\n value: Promise.resolve({\n idp: '',\n name: ''\n })\n }\n });\n var previousSignalingState;\n peerConnection.addEventListener('signalingstatechange', function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (!_this._rollingBack && _this.signalingState !== previousSignalingState) {\n previousSignalingState = _this.signalingState;\n // NOTE(mmalavalli): In Firefox, 'signalingstatechange' event is\n // triggered synchronously in the same tick after\n // RTCPeerConnection#close() is called. So we mimic Chrome's behavior\n // by triggering 'signalingstatechange' on the next tick.\n if (_this._isClosed) {\n setTimeout(function () { return _this.dispatchEvent.apply(_this, __spreadArray([], __read(args))); });\n }\n else {\n _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));\n }\n }\n });\n proxyProperties(RTCPeerConnection.prototype, _this, peerConnection);\n return _this;\n }\n Object.defineProperty(FirefoxRTCPeerConnection.prototype, \"iceGatheringState\", {\n get: function () {\n return this._isClosed ? 'complete' : this._peerConnection.iceGatheringState;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FirefoxRTCPeerConnection.prototype, \"localDescription\", {\n get: function () {\n return overwriteWithInitiallyNegotiatedDtlsRole(this._peerConnection.localDescription, this._initiallyNegotiatedDtlsRole);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FirefoxRTCPeerConnection.prototype, \"signalingState\", {\n get: function () {\n return this._isClosed ? 'closed' : this._peerConnection.signalingState;\n },\n enumerable: false,\n configurable: true\n });\n FirefoxRTCPeerConnection.prototype.createAnswer = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var promise;\n promise = this._peerConnection.createAnswer().then(function (answer) {\n saveInitiallyNegotiatedDtlsRole(_this, answer);\n return overwriteWithInitiallyNegotiatedDtlsRole(answer, _this._initiallyNegotiatedDtlsRole);\n });\n return typeof args[0] === 'function'\n ? legacyPromise.apply(void 0, __spreadArray([promise], __read(args))) : promise;\n };\n // NOTE(mroberts): The WebRTC spec allows you to call createOffer from any\n // signalingState other than \"closed\"; however, Firefox has not yet implemented\n // this (https://bugzilla.mozilla.org/show_bug.cgi?id=1072388). We workaround\n // this by rolling back if we are in state \"have-local-offer\" or\n // \"have-remote-offer\". This is acceptable for our use case because we will\n // apply the newly-created offer almost immediately; however, this may be\n // unacceptable for other use cases.\n FirefoxRTCPeerConnection.prototype.createOffer = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = __read(args, 3), arg1 = _a[0], arg2 = _a[1], arg3 = _a[2];\n var options = arg3 || arg1 || {};\n var promise;\n if (this.signalingState === 'have-local-offer' ||\n this.signalingState === 'have-remote-offer') {\n var local = this.signalingState === 'have-local-offer';\n promise = rollback(this, local, function () { return _this.createOffer(options); });\n }\n else {\n promise = this._peerConnection.createOffer(options);\n }\n promise = promise.then(function (offer) {\n return new FirefoxRTCSessionDescription({\n type: offer.type,\n sdp: updateTracksToSSRCs(_this._tracksToSSRCs, offer.sdp)\n });\n });\n return args.length > 1\n ? legacyPromise(promise, arg1, arg2)\n : promise;\n };\n // NOTE(mroberts): While Firefox will reject the Promise returned by\n // setLocalDescription when called from signalingState \"have-local-offer\" with\n // an answer, it still updates the .localDescription property. We workaround\n // this by explicitly handling this case.\n FirefoxRTCPeerConnection.prototype.setLocalDescription = function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _b = __read(args), description = _b[0], rest = _b.slice(1);\n var promise;\n if (description && description.type === 'answer' && this.signalingState === 'have-local-offer') {\n promise = Promise.reject(new Error('Cannot set local answer in state have-local-offer'));\n }\n if (promise) {\n return args.length > 1\n ? legacyPromise.apply(void 0, __spreadArray([promise], __read(rest))) : promise;\n }\n return (_a = this._peerConnection).setLocalDescription.apply(_a, __spreadArray([], __read(args)));\n };\n // NOTE(mroberts): The WebRTC spec allows you to call setRemoteDescription with\n // an offer multiple times in signalingState \"have-remote-offer\"; however,\n // Firefox has not yet implemented this (https://bugzilla.mozilla.org/show_bug.cgi?id=1072388).\n // We workaround this by rolling back if we are in state \"have-remote-offer\".\n // This is acceptable for our use case; however, this may be unacceptable for\n // other use cases.\n //\n // While Firefox will reject the Promise returned by setRemoteDescription when\n // called from signalingState \"have-remote-offer\" with an answer, it sill\n // updates the .remoteDescription property. We workaround this by explicitly\n // handling this case.\n FirefoxRTCPeerConnection.prototype.setRemoteDescription = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = __read(args), description = _a[0], rest = _a.slice(1);\n var promise;\n if (description && this.signalingState === 'have-remote-offer') {\n if (description.type === 'answer') {\n promise = Promise.reject(new Error('Cannot set remote answer in state have-remote-offer'));\n }\n else if (description.type === 'offer') {\n promise = rollback(this, false, function () { return _this._peerConnection.setRemoteDescription(description); });\n }\n }\n if (!promise) {\n promise = this._peerConnection.setRemoteDescription(description);\n }\n promise = promise.then(function () { return saveInitiallyNegotiatedDtlsRole(_this, description, true); });\n return args.length > 1\n ? legacyPromise.apply(void 0, __spreadArray([promise], __read(rest))) : promise;\n };\n // NOTE(mroberts): The WebRTC spec specifies that the PeerConnection's internal\n // isClosed slot should immediately be set to true; however, in Firefox it\n // occurs in the next tick. We workaround this by tracking isClosed manually.\n FirefoxRTCPeerConnection.prototype.close = function () {\n if (this.signalingState !== 'closed') {\n this._isClosed = true;\n this._peerConnection.close();\n }\n };\n return FirefoxRTCPeerConnection;\n}(EventTarget));\ndelegateMethods(RTCPeerConnection.prototype, FirefoxRTCPeerConnection.prototype, '_peerConnection');\nfunction rollback(peerConnection, local, onceRolledBack) {\n var setLocalDescription = local ? 'setLocalDescription' : 'setRemoteDescription';\n peerConnection._rollingBack = true;\n return peerConnection._peerConnection[setLocalDescription](new FirefoxRTCSessionDescription({\n type: 'rollback'\n })).then(onceRolledBack).then(function (result) {\n peerConnection._rollingBack = false;\n return result;\n }, function (error) {\n peerConnection._rollingBack = false;\n throw error;\n });\n}\n/**\n * Extract the initially negotiated DTLS role out of an RTCSessionDescription's\n * sdp property and save it on the FirefoxRTCPeerConnection if and only if\n *\n * 1. A DTLS role was not already saved on the FirefoxRTCPeerConnection, and\n * 2. The description is an answer.\n *\n * @private\n * @param {FirefoxRTCPeerConnection} peerConnection\n * @param {RTCSessionDescription} description\n * @param {boolean} [remote=false] - if true, save the inverse of the DTLS role,\n * e.g. \"active\" instead of \"passive\" and vice versa\n * @returns {undefined}\n */\nfunction saveInitiallyNegotiatedDtlsRole(peerConnection, description, remote) {\n // NOTE(mroberts): JSEP specifies that offers always offer \"actpass\" as the\n // DTLS role. We need to inspect answers to figure out the negotiated DTLS\n // role.\n if (peerConnection._initiallyNegotiatedDtlsRole || description.type === 'offer') {\n return;\n }\n var match = description.sdp.match(/a=setup:([a-z]+)/);\n if (!match) {\n return;\n }\n var dtlsRole = match[1];\n peerConnection._initiallyNegotiatedDtlsRole = remote ? {\n active: 'passive',\n passive: 'active'\n }[dtlsRole] : dtlsRole;\n}\n/**\n * Overwrite the DTLS role in the sdp property of an RTCSessionDescription if\n * and only if\n *\n * 1. The description is an answer, and\n * 2. A DTLS role is provided.\n *\n * @private\n * @param {RTCSessionDescription} [description]\n * @param {string} [dtlsRole] - one of \"active\" or \"passive\"\n * @returns {?RTCSessionDescription} description\n */\nfunction overwriteWithInitiallyNegotiatedDtlsRole(description, dtlsRole) {\n if (description && description.type === 'answer' && dtlsRole) {\n return new FirefoxRTCSessionDescription({\n type: description.type,\n sdp: description.sdp.replace(/a=setup:[a-z]+/g, 'a=setup:' + dtlsRole)\n });\n }\n return description;\n}\nmodule.exports = FirefoxRTCPeerConnection;\n//# sourceMappingURL=firefox.js.map","/* globals RTCPeerConnection, RTCSessionDescription */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar EventTarget = require('../../eventtarget');\nvar Latch = require('../util/latch');\nvar _a = require('../util/sdp'), getSdpFormat = _a.getSdpFormat, updatePlanBTrackIdsToSSRCs = _a.updatePlanBTrackIdsToSSRCs, updateUnifiedPlanTrackIdsToSSRCs = _a.updateUnifiedPlanTrackIdsToSSRCs;\nvar _b = require('../util'), delegateMethods = _b.delegateMethods, interceptEvent = _b.interceptEvent, proxyProperties = _b.proxyProperties;\nvar isUnifiedPlan = getSdpFormat() === 'unified';\nvar updateTrackIdsToSSRCs = isUnifiedPlan\n ? updateUnifiedPlanTrackIdsToSSRCs\n : updatePlanBTrackIdsToSSRCs;\nvar SafariRTCPeerConnection = /** @class */ (function (_super) {\n __extends(SafariRTCPeerConnection, _super);\n function SafariRTCPeerConnection(configuration) {\n var _this = _super.call(this) || this;\n interceptEvent(_this, 'datachannel');\n interceptEvent(_this, 'iceconnectionstatechange');\n interceptEvent(_this, 'signalingstatechange');\n interceptEvent(_this, 'track');\n var peerConnection = new RTCPeerConnection(configuration);\n Object.defineProperties(_this, {\n _appliedTracksToSSRCs: {\n value: new Map(),\n writable: true\n },\n _audioTransceiver: {\n value: null,\n writable: true\n },\n _isClosed: {\n value: false,\n writable: true\n },\n _peerConnection: {\n value: peerConnection\n },\n _pendingLocalOffer: {\n value: null,\n writable: true\n },\n _pendingRemoteOffer: {\n value: null,\n writable: true\n },\n _rolledBackTracksToSSRCs: {\n value: new Map(),\n writable: true\n },\n _signalingStateLatch: {\n value: new Latch()\n },\n _tracksToSSRCs: {\n value: new Map(),\n writable: true\n },\n _videoTransceiver: {\n value: null,\n writable: true\n }\n });\n peerConnection.addEventListener('datachannel', function (event) {\n shimDataChannel(event.channel);\n _this.dispatchEvent(event);\n });\n peerConnection.addEventListener('iceconnectionstatechange', function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (_this._isClosed) {\n return;\n }\n _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));\n });\n peerConnection.addEventListener('signalingstatechange', function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (_this._isClosed) {\n return;\n }\n if (peerConnection.signalingState === 'stable') {\n _this._appliedTracksToSSRCs = new Map(_this._tracksToSSRCs);\n }\n if (!_this._pendingLocalOffer && !_this._pendingRemoteOffer) {\n _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));\n }\n });\n // NOTE(syerrapragada): This ensures that SafariRTCPeerConnection's \"remoteDescription\", when accessed\n // in an RTCTrackEvent listener, will point to the underlying RTCPeerConnection's\n // \"remoteDescription\". Before this fix, this was still pointing to \"_pendingRemoteOffer\"\n // even though a new remote RTCSessionDescription had already been applied.\n peerConnection.addEventListener('track', function (event) {\n _this._pendingRemoteOffer = null;\n _this.dispatchEvent(event);\n });\n proxyProperties(RTCPeerConnection.prototype, _this, peerConnection);\n return _this;\n }\n Object.defineProperty(SafariRTCPeerConnection.prototype, \"localDescription\", {\n get: function () {\n return this._pendingLocalOffer || this._peerConnection.localDescription;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SafariRTCPeerConnection.prototype, \"iceConnectionState\", {\n get: function () {\n return this._isClosed ? 'closed' : this._peerConnection.iceConnectionState;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SafariRTCPeerConnection.prototype, \"iceGatheringState\", {\n get: function () {\n return this._isClosed ? 'complete' : this._peerConnection.iceGatheringState;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SafariRTCPeerConnection.prototype, \"remoteDescription\", {\n get: function () {\n return this._pendingRemoteOffer || this._peerConnection.remoteDescription;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SafariRTCPeerConnection.prototype, \"signalingState\", {\n get: function () {\n if (this._isClosed) {\n return 'closed';\n }\n else if (this._pendingLocalOffer) {\n return 'have-local-offer';\n }\n else if (this._pendingRemoteOffer) {\n return 'have-remote-offer';\n }\n return this._peerConnection.signalingState;\n },\n enumerable: false,\n configurable: true\n });\n SafariRTCPeerConnection.prototype.addIceCandidate = function (candidate) {\n var _this = this;\n if (this.signalingState === 'have-remote-offer') {\n return this._signalingStateLatch.when('low').then(function () { return _this._peerConnection.addIceCandidate(candidate); });\n }\n return this._peerConnection.addIceCandidate(candidate);\n };\n SafariRTCPeerConnection.prototype.createOffer = function (options) {\n var _this = this;\n options = Object.assign({}, options);\n // NOTE(mroberts): In general, this is not the way to do this; however, it's\n // good enough for our application.\n if (options.offerToReceiveVideo && !this._audioTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'audio'))) {\n delete options.offerToReceiveAudio;\n try {\n this._audioTransceiver = isUnifiedPlan\n ? this.addTransceiver('audio', { direction: 'recvonly' })\n : this.addTransceiver('audio');\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n if (options.offerToReceiveVideo && !this._videoTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'video'))) {\n delete options.offerToReceiveVideo;\n try {\n this._videoTransceiver = isUnifiedPlan\n ? this.addTransceiver('video', { direction: 'recvonly' })\n : this.addTransceiver('video');\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n return this._peerConnection.createOffer(options).then(function (offer) {\n // NOTE(mmalavalli): If createOffer() is called immediately after rolling back,\n // then we no longer need to retain the rolled back tracks to SSRCs Map.\n _this._rolledBackTracksToSSRCs.clear();\n return new RTCSessionDescription({\n type: offer.type,\n sdp: updateTrackIdsToSSRCs(_this._tracksToSSRCs, offer.sdp)\n });\n });\n };\n SafariRTCPeerConnection.prototype.createAnswer = function (options) {\n var _this = this;\n if (this._pendingRemoteOffer) {\n return this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function () {\n _this._signalingStateLatch.lower();\n return _this._peerConnection.createAnswer();\n }).then(function (answer) {\n _this._pendingRemoteOffer = null;\n // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no\n // longer need to retain the rolled back tracks to SSRCs Map.\n _this._rolledBackTracksToSSRCs.clear();\n return isUnifiedPlan ? new RTCSessionDescription({\n type: answer.type,\n sdp: updateTrackIdsToSSRCs(_this._tracksToSSRCs, answer.sdp)\n }) : answer;\n }, function (error) {\n _this._pendingRemoteOffer = null;\n throw error;\n });\n }\n return this._peerConnection.createAnswer(options).then(function (answer) {\n // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no\n // longer need to retain the rolled back tracks to SSRCs Map.\n _this._rolledBackTracksToSSRCs.clear();\n return isUnifiedPlan ? new RTCSessionDescription({\n type: answer.type,\n sdp: updateTrackIdsToSSRCs(_this._tracksToSSRCs, answer.sdp)\n }) : answer;\n });\n };\n SafariRTCPeerConnection.prototype.createDataChannel = function (label, dataChannelDict) {\n var dataChannel = this._peerConnection.createDataChannel(label, dataChannelDict);\n shimDataChannel(dataChannel);\n return dataChannel;\n };\n SafariRTCPeerConnection.prototype.removeTrack = function (sender) {\n sender.replaceTrack(null);\n this._peerConnection.removeTrack(sender);\n };\n SafariRTCPeerConnection.prototype.setLocalDescription = function (description) {\n // NOTE(mmalavalli): If setLocalDescription() is called immediately after rolling back,\n // then we need to restore the rolled back tracks to SSRCs Map.\n if (this._rolledBackTracksToSSRCs.size > 0) {\n this._tracksToSSRCs = new Map(this._rolledBackTracksToSSRCs);\n this._rolledBackTracksToSSRCs.clear();\n }\n return setDescription(this, true, description);\n };\n SafariRTCPeerConnection.prototype.setRemoteDescription = function (description) {\n // NOTE(mmalavalli): If setRemoteDescription() is called immediately after rolling back,\n // then we no longer need to retain the rolled back tracks to SSRCs Map.\n this._rolledBackTracksToSSRCs.clear();\n return setDescription(this, false, description);\n };\n SafariRTCPeerConnection.prototype.close = function () {\n var _this = this;\n if (this._isClosed) {\n return;\n }\n this._isClosed = true;\n this._peerConnection.close();\n setTimeout(function () {\n _this.dispatchEvent(new Event('iceconnectionstatechange'));\n _this.dispatchEvent(new Event('signalingstatechange'));\n });\n };\n return SafariRTCPeerConnection;\n}(EventTarget));\ndelegateMethods(RTCPeerConnection.prototype, SafariRTCPeerConnection.prototype, '_peerConnection');\nfunction setDescription(peerConnection, local, description) {\n function setPendingLocalOffer(offer) {\n if (local) {\n peerConnection._pendingLocalOffer = offer;\n }\n else {\n peerConnection._pendingRemoteOffer = offer;\n }\n }\n function clearPendingLocalOffer() {\n if (local) {\n peerConnection._pendingLocalOffer = null;\n }\n else {\n peerConnection._pendingRemoteOffer = null;\n }\n }\n var pendingLocalOffer = local ? peerConnection._pendingLocalOffer : peerConnection._pendingRemoteOffer;\n var pendingRemoteOffer = local ? peerConnection._pendingRemoteOffer : peerConnection._pendingLocalOffer;\n var intermediateState = local ? 'have-local-offer' : 'have-remote-offer';\n var setLocalDescription = local ? 'setLocalDescription' : 'setRemoteDescription';\n if (!local && pendingRemoteOffer && description.type === 'answer') {\n return setRemoteAnswer(peerConnection, description);\n }\n else if (description.type === 'offer') {\n if (peerConnection.signalingState !== intermediateState && peerConnection.signalingState !== 'stable') {\n return Promise.reject(new Error(\"Cannot set \" + (local ? 'local' : 'remote') + \"\\n offer in state \" + peerConnection.signalingState));\n }\n if (!pendingLocalOffer && peerConnection._signalingStateLatch.state === 'low') {\n peerConnection._signalingStateLatch.raise();\n }\n var previousSignalingState = peerConnection.signalingState;\n setPendingLocalOffer(description);\n // Only dispatch a signalingstatechange event if we transitioned.\n if (peerConnection.signalingState !== previousSignalingState) {\n return Promise.resolve().then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });\n }\n return Promise.resolve();\n }\n else if (description.type === 'rollback') {\n if (peerConnection.signalingState !== intermediateState) {\n return Promise.reject(new Error(\"Cannot rollback \\n \" + (local ? 'local' : 'remote') + \" description in \" + peerConnection.signalingState));\n }\n clearPendingLocalOffer();\n // NOTE(mmalavalli): We store the rolled back tracks to SSRCs Map here in case\n // setLocalDescription() is called immediately aftera rollback (without calling\n // createOffer() or createAnswer()), in which case this roll back is not due to\n // a glare scenario and this Map should be restored.\n peerConnection._rolledBackTracksToSSRCs = new Map(peerConnection._tracksToSSRCs);\n peerConnection._tracksToSSRCs = new Map(peerConnection._appliedTracksToSSRCs);\n return Promise.resolve().then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });\n }\n return peerConnection._peerConnection[setLocalDescription](description);\n}\nfunction setRemoteAnswer(peerConnection, answer) {\n var pendingLocalOffer = peerConnection._pendingLocalOffer;\n return peerConnection._peerConnection.setLocalDescription(pendingLocalOffer).then(function () {\n peerConnection._pendingLocalOffer = null;\n return peerConnection.setRemoteDescription(answer);\n }).then(function () { return peerConnection._signalingStateLatch.lower(); });\n}\n/**\n * Whether a SafariRTCPeerConnection has any RTCRtpReceivers(s) for the given\n * MediaStreamTrack kind.\n * @param {SafariRTCPeerConnection} peerConnection\n * @param {'audio' | 'video'} kind\n * @returns {boolean}\n */\nfunction hasReceiversForTracksOfKind(peerConnection, kind) {\n return !!peerConnection.getTransceivers().find(function (_a) {\n var _b = _a.receiver, receiver = _b === void 0 ? {} : _b;\n var _c = receiver.track, track = _c === void 0 ? {} : _c;\n return track.kind === kind;\n });\n}\n/**\n * Shim an RTCDataChannel. This function mutates the RTCDataChannel.\n * @param {RTCDataChannel} dataChannel\n * @returns {RTCDataChannel}\n */\nfunction shimDataChannel(dataChannel) {\n return Object.defineProperties(dataChannel, {\n maxPacketLifeTime: {\n value: dataChannel.maxPacketLifeTime === 65535\n ? null\n : dataChannel.maxPacketLifeTime\n },\n maxRetransmits: {\n value: dataChannel.maxRetransmits === 65535\n ? null\n : dataChannel.maxRetransmits\n }\n });\n}\nmodule.exports = SafariRTCPeerConnection;\n//# sourceMappingURL=safari.js.map","'use strict';\nif (typeof RTCPeerConnection === 'function') {\n var guessBrowser = require('../util').guessBrowser;\n switch (guessBrowser()) {\n case 'chrome':\n module.exports = require('./chrome');\n break;\n case 'firefox':\n module.exports = require('./firefox');\n break;\n case 'safari':\n module.exports = require('./safari');\n break;\n default:\n module.exports = RTCPeerConnection;\n break;\n }\n}\nelse {\n module.exports = function RTCPeerConnection() {\n throw new Error('RTCPeerConnection is not supported');\n };\n}\n//# sourceMappingURL=index.js.map","/* globals RTCSessionDescription */\n'use strict';\nif (typeof RTCSessionDescription === 'function') {\n var guessBrowser = require('../util').guessBrowser;\n switch (guessBrowser()) {\n case 'chrome':\n module.exports = require('./chrome');\n break;\n case 'firefox':\n module.exports = require('./firefox');\n break;\n default:\n module.exports = RTCSessionDescription;\n break;\n }\n}\nelse {\n module.exports = function RTCSessionDescription() {\n throw new Error('RTCSessionDescription is not supported');\n };\n}\n//# sourceMappingURL=index.js.map","'use strict';\nvar WebRTC = {};\nObject.defineProperties(WebRTC, {\n getStats: {\n enumerable: true,\n value: require('./getstats')\n },\n getUserMedia: {\n enumerable: true,\n value: require('./getusermedia')\n },\n MediaStream: {\n enumerable: true,\n value: require('./mediastream')\n },\n MediaStreamTrack: {\n enumerable: true,\n value: require('./mediastreamtrack')\n },\n RTCIceCandidate: {\n enumerable: true,\n value: require('./rtcicecandidate')\n },\n RTCPeerConnection: {\n enumerable: true,\n value: require('./rtcpeerconnection')\n },\n RTCSessionDescription: {\n enumerable: true,\n value: require('./rtcsessiondescription')\n }\n});\nmodule.exports = WebRTC;\n//# sourceMappingURL=index.js.map","/**\n * Copyright (c) 2011-2022 Isaac Z. Schlueter\n * Licensed under the ISC License.\n *\n * Copied from https://github.com/isaacs/inherits (2.0.4)\n*/\nmodule.exports = function inherits(ctor, superCtor) {\n if (ctor && superCtor) {\n ctor.super_ = superCtor;\n if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n }\n else {\n // old school shim for old browsers\n var TempCtor = /** @class */ (function () {\n function TempCtor() {\n }\n return TempCtor;\n }());\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n }\n};\n//# sourceMappingURL=inherits.js.map","/* globals chrome, navigator */\n'use strict';\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\n/**\n * Check whether the current browser is an Android device.\n * @returns {boolean}\n */\nfunction isAndroid() {\n return /Android/.test(navigator.userAgent);\n}\n/**\n * Detects whether or not a device is an Apple touch screen device.\n * @returns {boolean}\n */\nfunction hasTouchScreen() {\n return !!(navigator && navigator.maxTouchPoints && navigator.maxTouchPoints > 2);\n}\n/**\n * Detects whether or not a device is an iPad.\n * @returns {boolean}\n */\nfunction isIpad() {\n return hasTouchScreen() && window.screen.width >= 744 && (/Macintosh/i.test(navigator.userAgent)\n || /iPad/.test(navigator.userAgent)\n || /iPad/.test(navigator.platform));\n}\n/**\n * Detects whether or not a device is an iPhone.\n * @returns {boolean}\n */\nfunction isIphone() {\n return hasTouchScreen() && window.screen.width <= 476 && (/Macintosh/i.test(navigator.userAgent)\n || /iPhone/.test(navigator.userAgent)\n || /iPhone/.test(navigator.platform));\n}\n/**\n * Check whether the current device is an iOS device.\n * @returns {boolean}\n */\nfunction isIOS() {\n return isIpad() || isIphone();\n}\n/**\n * Check whether the current browser is a mobile browser\n * @returns {boolean}\n */\nfunction isMobile() {\n return /Mobi/.test(navigator.userAgent);\n}\n/**\n * Check whether the current browser is non-Chromium Edge.\n * @param {string} browser\n * @returns {boolean}\n */\nfunction isNonChromiumEdge(browser) {\n return browser === 'chrome' && /Edge/.test(navigator.userAgent) && (typeof chrome === 'undefined' || typeof chrome.runtime === 'undefined');\n}\n/**\n * Get the name of the rebranded Chromium browser, if any. Re-branded Chrome's user\n * agent has the following format:\n * / () / () Chrome/ [Mobile] Safari/\n * @param browser\n * @returns {?string} Name of the rebranded Chrome browser, or null if the browser\n * is either not Chrome or vanilla Chrome.\n */\nfunction rebrandedChromeBrowser(browser) {\n // If the browser is not Chrome based, then it is not a rebranded Chrome browser.\n if (browser !== 'chrome') {\n return null;\n }\n // Latest desktop Brave browser has a \"brave\" property in navigator.\n if ('brave' in navigator) {\n return 'brave';\n }\n // Remove the \"(.+)\" entries from the user agent thereby retaining only the\n // [/] entries.\n var parenthesizedSubstrings = getParenthesizedSubstrings(navigator.userAgent);\n var nameAndVersions = parenthesizedSubstrings.reduce(function (userAgent, substring) { return userAgent.replace(substring, ''); }, navigator.userAgent);\n // Extract the potential browser s by ignoring the first two names, which\n // point to and .\n var matches = nameAndVersions.match(/[^\\s]+/g) || [];\n var _a = __read(matches.map(function (nameAndVersion) {\n return nameAndVersion.split('/')[0].toLowerCase();\n })), browserNames = _a.slice(2);\n // Extract the that is not expected to be present in the vanilla Chrome\n // browser, which indicates the rebranded name (ex: \"edg[e]\", \"electron\"). If null,\n // then this is a vanilla Chrome browser.\n return browserNames.find(function (name) {\n return !['chrome', 'mobile', 'safari'].includes(name);\n }) || null;\n}\n/**\n * Get the name of the mobile webkit based browser, if any.\n * @param browser\n * @returns {?string} Name of the mobile webkit based browser, or null if the browser\n * is either not webkit based or mobile safari.\n */\nfunction mobileWebKitBrowser(browser) {\n if (browser !== 'safari') {\n return null;\n }\n if ('brave' in navigator) {\n return 'brave';\n }\n return ['edge', 'edg'].find(function (name) {\n return navigator.userAgent.toLowerCase().includes(name);\n }) || null;\n}\n/**\n * Get the top level parenthesized substrings within a given string. Unmatched\n * parentheses are ignored.\n * Ex: \"abc) (def) gh(ij) (kl (mn)o) (pqr\" => [\"(def)\", \"(ij)\", \"(kl (mn)o)\"]\n * @param {string} string\n * @returns {string[]}\n */\nfunction getParenthesizedSubstrings(string) {\n var openParenthesisPositions = [];\n var substrings = [];\n for (var i = 0; i < string.length; i++) {\n if (string[i] === '(') {\n openParenthesisPositions.push(i);\n }\n else if (string[i] === ')' && openParenthesisPositions.length > 0) {\n var openParenthesisPosition = openParenthesisPositions.pop();\n if (openParenthesisPositions.length === 0) {\n substrings.push(string.substring(openParenthesisPosition, i + 1));\n }\n }\n }\n return substrings;\n}\nmodule.exports = {\n isAndroid: isAndroid,\n isIOS: isIOS,\n isIpad: isIpad,\n isIphone: isIphone,\n isMobile: isMobile,\n isNonChromiumEdge: isNonChromiumEdge,\n mobileWebKitBrowser: mobileWebKitBrowser,\n rebrandedChromeBrowser: rebrandedChromeBrowser\n};\n//# sourceMappingURL=browserdetection.js.map","'use strict';\n/**\n * Return a Promise that resolves after `timeout` milliseconds.\n * @param {?number} [timeout=0]\n * @returns {Promise}\n */\nfunction delay(timeout) {\n timeout = typeof timeout === 'number' ? timeout : 0;\n return new Promise(function (resolve) { return setTimeout(resolve, timeout); });\n}\n/**\n * Attempt to detect silence. The Promise returned by this function returns\n * false as soon as audio is detected or true after `timeout` milliseconds.\n * @param {AudioContext} audioContext\n * @param {MediaStream} stream\n * @param {?number} [timeout=250]\n * @returns {Promise}\n */\nfunction detectSilence(audioContext, stream, timeout) {\n timeout = typeof timeout === 'number' ? timeout : 250;\n var source = audioContext.createMediaStreamSource(stream);\n var analyser = audioContext.createAnalyser();\n analyser.fftSize = 2048;\n source.connect(analyser);\n var samples = new Uint8Array(analyser.fftSize);\n var timeoutDidFire = false;\n setTimeout(function () { timeoutDidFire = true; }, timeout);\n /**\n * We can't use async/await yet, so I need to factor this out.\n * @returns {Promise}\n */\n function doDetectSilence() {\n if (timeoutDidFire) {\n return Promise.resolve(true);\n }\n analyser.getByteTimeDomainData(samples);\n // NOTE(mpatwardhan): An audio MediaStreamTrack can be silent either due to all samples\n // being equal to 128 or all samples being equal to 0.\n return samples.some(function (sample) { return sample !== 128 && sample !== 0; })\n ? Promise.resolve(false)\n : delay().then(doDetectSilence);\n }\n return doDetectSilence().then(function (isSilent) {\n source.disconnect();\n return isSilent;\n }, function (error) {\n source.disconnect();\n throw error;\n });\n}\nmodule.exports = detectSilence;\n//# sourceMappingURL=detectsilence.js.map","/* globals webkitAudioContext, AudioContext */\n'use strict';\nvar NativeAudioContext = typeof AudioContext !== 'undefined'\n ? AudioContext\n : typeof webkitAudioContext !== 'undefined'\n ? webkitAudioContext\n : null;\n/**\n * @interface AudioContextFactoryOptions\n * @property {AudioContext} [AudioContext] - The AudioContext constructor\n */\n/**\n * {@link AudioContextFactory} ensures we construct at most one AudioContext\n * at a time, and that it is eventually closed when we no longer need it.\n * @property {AudioContextFactory} AudioContextFactory - The\n * {@link AudioContextFactory} constructor\n */\nvar AudioContextFactory = /** @class */ (function () {\n /**\n * @param {AudioContextFactoryOptions} [options]\n */\n function AudioContextFactory(options) {\n options = Object.assign({\n AudioContext: NativeAudioContext\n }, options);\n Object.defineProperties(this, {\n _AudioContext: {\n value: options.AudioContext\n },\n _audioContext: {\n value: null,\n writable: true\n },\n _holders: {\n value: new Set()\n },\n AudioContextFactory: {\n enumerable: true,\n value: AudioContextFactory\n }\n });\n }\n /**\n * Each call to {@link AudioContextFactory#getOrCreate} should be paired with a\n * call to {@link AudioContextFactory#release}. Calling this increments an\n * internal reference count.\n * @param {*} holder - The object to hold a reference to the AudioContext\n * @returns {?AudioContext}\n */\n AudioContextFactory.prototype.getOrCreate = function (holder) {\n if (!this._holders.has(holder)) {\n this._holders.add(holder);\n if (this._AudioContext && !this._audioContext) {\n try {\n this._audioContext = new this._AudioContext();\n }\n catch (error) {\n // Do nothing;\n }\n }\n }\n return this._audioContext;\n };\n /**\n * Decrement the internal reference count. If it reaches zero, close and destroy\n * the AudioContext.\n * @param {*} holder - The object that held a reference to the AudioContext\n * @returns {void}\n */\n AudioContextFactory.prototype.release = function (holder) {\n if (this._holders.has(holder)) {\n this._holders.delete(holder);\n if (!this._holders.size && this._audioContext) {\n this._audioContext.close();\n this._audioContext = null;\n }\n }\n };\n return AudioContextFactory;\n}());\nmodule.exports = new AudioContextFactory();\n//# sourceMappingURL=audiocontext.js.map","'use strict';\nvar detectSilence = require('../webaudio/detectsilence');\nvar N_ATTEMPTS = 3;\nvar ATTEMPT_DURATION_MS = 250;\n/**\n * Detect whether the audio stream rendered by the given HTMLVideoElement is silent.\n * @param {HTMLAudioElement} el\n * @returns {Promise} true if silent, false if not.\n */\nfunction detectSilentAudio(el) {\n // NOTE(mmalavalli): We have to delay require-ing AudioContextFactory, because\n // it exports a default instance whose constructor calls Object.assign.\n var AudioContextFactory = require('../webaudio/audiocontext');\n var holder = {};\n var audioContext = AudioContextFactory.getOrCreate(holder);\n var attemptsLeft = N_ATTEMPTS;\n function doCheckSilence() {\n attemptsLeft--;\n return detectSilence(audioContext, el.srcObject, ATTEMPT_DURATION_MS).then(function (isSilent) {\n if (!isSilent) {\n return false;\n }\n if (attemptsLeft > 0) {\n return doCheckSilence();\n }\n return true;\n }).catch(function () {\n // NOTE(mmalavalli): If an error is thrown while detect silence, the audio\n // stream is assumed to be silent.\n return true;\n });\n }\n // Resolve the returned Promise with true if 3 consecutive attempts\n // to detect silent audio are successful.\n return doCheckSilence().finally(function () {\n AudioContextFactory.release(holder);\n });\n}\nmodule.exports = detectSilentAudio;\n//# sourceMappingURL=detectsilentaudio.js.map","'use strict';\nvar defer = require('./').defer;\n/**\n * This is a pair of Deferreds that are set whenever local media is muted and\n * resolved whenever local media is unmuted/ended and restarted if necessary.\n */\nvar LocalMediaRestartDeferreds = /** @class */ (function () {\n /**\n * Constructor.\n */\n function LocalMediaRestartDeferreds() {\n Object.defineProperties(this, {\n _audio: {\n value: defer(),\n writable: true\n },\n _video: {\n value: defer(),\n writable: true\n }\n });\n // Initially, resolve both the Deferreds.\n this._audio.resolve();\n this._video.resolve();\n }\n /**\n * Resolve the Deferred for audio or video.\n * @param {'audio'|'video'} kind\n */\n LocalMediaRestartDeferreds.prototype.resolveDeferred = function (kind) {\n if (kind === 'audio') {\n this._audio.resolve();\n }\n else {\n this._video.resolve();\n }\n };\n /**\n * Start the Deferred for audio or video.\n * @param {'audio' | 'video'} kind\n */\n LocalMediaRestartDeferreds.prototype.startDeferred = function (kind) {\n if (kind === 'audio') {\n this._audio = defer();\n }\n else {\n this._video = defer();\n }\n };\n /**\n * Wait until the Deferred for audio or video is resolved.\n * @param {'audio'|'video'} kind\n * @returns {Promise}\n */\n LocalMediaRestartDeferreds.prototype.whenResolved = function (kind) {\n return kind === 'audio' ? this._audio.promise : this._video.promise;\n };\n return LocalMediaRestartDeferreds;\n}());\nmodule.exports = new LocalMediaRestartDeferreds();\n//# sourceMappingURL=localmediarestartdeferreds.js.map","'use strict';\nvar EventEmitter = require('events').EventEmitter;\nvar hidePrivateAndCertainPublicPropertiesInClass = require('./util').hidePrivateAndCertainPublicPropertiesInClass;\nmodule.exports = hidePrivateAndCertainPublicPropertiesInClass(EventEmitter, ['domain']);\n//# sourceMappingURL=eventemitter.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar EventEmitter = require('../../eventemitter');\nvar _a = require('../../util'), buildLogLevels = _a.buildLogLevels, valueToJSON = _a.valueToJSON;\nvar DEFAULT_LOG_LEVEL = require('../../util/constants').DEFAULT_LOG_LEVEL;\nvar Log = require('../../util/log');\nvar nInstances = 0;\n/**\n * A {@link Track} represents a stream of audio, video, or data.\n * @extends EventEmitter\n * @property {Track.Kind} kind - The {@link Track}'s kind\n * @property {string} name - The {@link Track}'s name\n */\nvar Track = /** @class */ (function (_super) {\n __extends(Track, _super);\n /**\n * Construct a {@link Track}.\n * @param {Track.ID} id - The {@link Track}'s ID\n * @param {Track.Kind} kind - The {@link Track}'s kind\n * @param {{ log: Log, name: ?string }} options\n */\n function Track(id, kind, options) {\n var _this = this;\n options = Object.assign({\n name: id,\n log: null,\n logLevel: DEFAULT_LOG_LEVEL\n }, options);\n _this = _super.call(this) || this;\n var name = String(options.name);\n var logLevels = buildLogLevels(options.logLevel);\n var log = options.log\n ? options.log.createLog('media', _this)\n : new Log('media', _this, logLevels, options.loggerName);\n Object.defineProperties(_this, {\n _instanceId: {\n value: ++nInstances\n },\n _log: {\n value: log\n },\n kind: {\n enumerable: true,\n value: kind\n },\n name: {\n enumerable: true,\n value: name\n }\n });\n return _this;\n }\n Track.prototype.toJSON = function () {\n return valueToJSON(this);\n };\n return Track;\n}(EventEmitter));\n/**\n * The {@link Track} ID is a string identifier for the {@link Track}.\n * @typedef {string} Track.ID\n */\n/**\n * The {@link Track} kind is either \"audio\", \"video\", or \"data\".\n * @typedef {string} Track.Kind\n */\n/**\n * The {@link Track}'s priority can be \"low\", \"standard\", or \"high\".\n * @typedef {string} Track.Priority\n */\n/**\n * The {@link Track} SID is a unique string identifier for the {@link Track}\n * that is published to a {@link Room}.\n * @typedef {string} Track.SID\n */\n/**\n * A {@link DataTrack} is a {@link LocalDataTrack} or {@link RemoteDataTrack}.\n * @typedef {LocalDataTrack|RemoteDataTrack} DataTrack\n */\n/**\n * A {@link LocalTrack} is a {@link LocalAudioTrack}, {@link LocalVideoTrack},\n * or {@link LocalDataTrack}.\n * @typedef {LocalAudioTrack|LocalVideoTrack|LocalDataTrack} LocalTrack\n */\n/**\n * {@link LocalTrack} options\n * @typedef {object} LocalTrackOptions\n * @property {LogLevel|LogLevels} logLevel - Log level for 'media' modules\n * @property {string} [name] - The {@link LocalTrack}'s name; by default,\n * it is set to the {@link LocalTrack}'s ID.\n */\n/**\n * A {@link RemoteTrack} is a {@link RemoteAudioTrack},\n * {@link RemoteVideoTrack}, or {@link RemoteDataTrack}.\n * @typedef {RemoteAudioTrack|RemoteVideoTrack|RemoteDataTrack} RemoteTrack\n */\nmodule.exports = Track;\n//# sourceMappingURL=index.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar isIOS = require('../../util/browserdetection').isIOS;\nvar MediaStream = require('../../webrtc').MediaStream;\nvar _a = require('../../util'), waitForEvent = _a.waitForEvent, waitForSometime = _a.waitForSometime;\nvar localMediaRestartDeferreds = require('../../util/localmediarestartdeferreds');\nvar Track = require('./');\n/**\n * A {@link MediaTrack} represents audio or video that can be sent to or\n * received from a {@link Room}.\n * @extends Track\n * @property {Track.ID} id - This {@link Track}'s ID\n * @property {boolean} isStarted - Whether or not the {@link MediaTrack} has\n * started\n * @property {boolean} isEnabled - Whether or not the {@link MediaTrack} is\n * enabled (i.e., whether it is paused or muted)\n * @property {Track.Kind} kind - The kind of the underlying\n * MediaStreamTrack, \"audio\" or \"video\"\n * @property {MediaStreamTrack} mediaStreamTrack - The underlying\n * MediaStreamTrack\n * @emits MediaTrack#disabled\n * @emits MediaTrack#enabled\n * @emits MediaTrack#started\n */\nvar MediaTrack = /** @class */ (function (_super) {\n __extends(MediaTrack, _super);\n /**\n * Construct a {@link MediaTrack}.\n * @param {MediaTrackTransceiver} mediaTrackTransceiver\n * @param {{log: Log}} options\n */\n function MediaTrack(mediaTrackTransceiver, options) {\n var _this = this;\n options = Object.assign({\n playPausedElementsIfNotBackgrounded: isIOS()\n && typeof document === 'object'\n && typeof document.addEventListener === 'function'\n && typeof document.visibilityState === 'string'\n }, options);\n _this = _super.call(this, mediaTrackTransceiver.id, mediaTrackTransceiver.kind, options) || this;\n var isStarted = false;\n options = Object.assign({\n MediaStream: MediaStream\n }, options);\n /* istanbul ignore next */\n Object.defineProperties(_this, {\n _attachments: {\n value: new Set()\n },\n _dummyEl: {\n value: null,\n writable: true\n },\n _elShims: {\n value: new WeakMap()\n },\n _isStarted: {\n get: function () {\n return isStarted;\n },\n set: function (_isStarted) {\n isStarted = _isStarted;\n }\n },\n _playPausedElementsIfNotBackgrounded: {\n value: options.playPausedElementsIfNotBackgrounded\n },\n _shouldShimAttachedElements: {\n value: options.workaroundWebKitBug212780\n || options.playPausedElementsIfNotBackgrounded\n },\n _unprocessedTrack: {\n value: null,\n writable: true\n },\n _MediaStream: {\n value: options.MediaStream\n },\n isStarted: {\n enumerable: true,\n get: function () {\n return isStarted;\n }\n },\n mediaStreamTrack: {\n enumerable: true,\n get: function () {\n return this._unprocessedTrack || mediaTrackTransceiver.track;\n }\n },\n processedTrack: {\n enumerable: true,\n value: null,\n writable: true\n }\n });\n _this._initialize();\n return _this;\n }\n /**\n * @private\n */\n MediaTrack.prototype._start = function () {\n this._log.debug('Started');\n this._isStarted = true;\n if (this._dummyEl) {\n this._dummyEl.oncanplay = null;\n }\n // eslint-disable-next-line no-use-before-define\n this.emit('started', this);\n };\n /**\n * @private\n */\n MediaTrack.prototype._initialize = function () {\n var self = this;\n this._log.debug('Initializing');\n this._dummyEl = this._createElement();\n this.mediaStreamTrack.addEventListener('ended', function onended() {\n self._end();\n self.mediaStreamTrack.removeEventListener('ended', onended);\n });\n if (this._dummyEl) {\n this._dummyEl.muted = true;\n this._dummyEl.oncanplay = this._start.bind(this, this._dummyEl);\n // NOTE(csantos): We always want to attach the original mediaStreamTrack for dummyEl\n this._attach(this._dummyEl, this.mediaStreamTrack);\n this._attachments.delete(this._dummyEl);\n }\n };\n /**\n * @private\n */\n MediaTrack.prototype._end = function () {\n this._log.debug('Ended');\n if (this._dummyEl) {\n this._dummyEl.remove();\n this._dummyEl.srcObject = null;\n this._dummyEl.oncanplay = null;\n this._dummyEl = null;\n }\n };\n MediaTrack.prototype.attach = function (el) {\n var _this = this;\n if (typeof el === 'string') {\n el = this._selectElement(el);\n }\n else if (!el) {\n el = this._createElement();\n }\n this._log.debug('Attempting to attach to element:', el);\n el = this._attach(el);\n if (this._shouldShimAttachedElements && !this._elShims.has(el)) {\n var onUnintentionallyPaused = this._playPausedElementsIfNotBackgrounded\n ? function () { return playIfPausedAndNotBackgrounded(el, _this._log); }\n : null;\n this._elShims.set(el, shimMediaElement(el, onUnintentionallyPaused));\n }\n return el;\n };\n /**\n * Attach the provided MediaStreamTrack to the media element.\n * @param el - The media element to attach to\n * @param mediaStreamTrack - The MediaStreamTrack to attach. If this is\n * not provided, it uses the processedTrack if it exists\n * or it defaults to the current mediaStreamTrack\n * @private\n */\n MediaTrack.prototype._attach = function (el, mediaStreamTrack) {\n if (mediaStreamTrack === void 0) { mediaStreamTrack = this.processedTrack || this.mediaStreamTrack; }\n var mediaStream = el.srcObject;\n if (!(mediaStream instanceof this._MediaStream)) {\n mediaStream = new this._MediaStream();\n }\n var getTracks = mediaStreamTrack.kind === 'audio'\n ? 'getAudioTracks'\n : 'getVideoTracks';\n mediaStream[getTracks]().forEach(function (track) {\n mediaStream.removeTrack(track);\n });\n mediaStream.addTrack(mediaStreamTrack);\n // NOTE(mpatwardhan): resetting `srcObject` here, causes flicker (JSDK-2641), but it lets us\n // to sidestep the a chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1052353\n //\n el.srcObject = mediaStream;\n el.autoplay = true;\n el.playsInline = true;\n if (!this._attachments.has(el)) {\n this._attachments.add(el);\n }\n return el;\n };\n /**\n * @private\n */\n MediaTrack.prototype._selectElement = function (selector) {\n var el = document.querySelector(selector);\n if (!el) {\n throw new Error(\"Selector matched no element: \" + selector);\n }\n return el;\n };\n /**\n * @private\n */\n MediaTrack.prototype._updateElementsMediaStreamTrack = function () {\n var _this = this;\n this._log.debug('Reattaching all elements to update mediaStreamTrack');\n this._getAllAttachedElements().forEach(function (el) { return _this._attach(el); });\n };\n /**\n * @private\n */\n MediaTrack.prototype._createElement = function () {\n return typeof document !== 'undefined'\n ? document.createElement(this.kind)\n : null;\n };\n MediaTrack.prototype.detach = function (el) {\n var els;\n if (typeof el === 'string') {\n els = [this._selectElement(el)];\n }\n else if (!el) {\n els = this._getAllAttachedElements();\n }\n else {\n els = [el];\n }\n this._log.debug('Attempting to detach from elements:', els);\n this._detachElements(els);\n return el ? els[0] : els;\n };\n /**\n * @private\n */\n MediaTrack.prototype._detachElements = function (elements) {\n return elements.map(this._detachElement.bind(this));\n };\n /**\n * @private\n */\n MediaTrack.prototype._detachElement = function (el) {\n if (!this._attachments.has(el)) {\n return el;\n }\n var mediaStream = el.srcObject;\n if (mediaStream instanceof this._MediaStream) {\n mediaStream.removeTrack(this.processedTrack || this.mediaStreamTrack);\n }\n this._attachments.delete(el);\n if (this._shouldShimAttachedElements && this._elShims.has(el)) {\n var shim = this._elShims.get(el);\n shim.unShim();\n this._elShims.delete(el);\n }\n return el;\n };\n /**\n * @private\n */\n MediaTrack.prototype._getAllAttachedElements = function () {\n var els = [];\n this._attachments.forEach(function (el) {\n els.push(el);\n });\n return els;\n };\n return MediaTrack;\n}(Track));\n/**\n * Play an HTMLMediaElement if it is paused and not backgrounded.\n * @private\n * @param {HTMLMediaElement} el\n * @param {Log} log\n * @returns {void}\n */\nfunction playIfPausedAndNotBackgrounded(el, log) {\n var tag = el.tagName.toLowerCase();\n log.warn('Unintentionally paused:', el);\n // NOTE(mmalavalli): When the element is unintentionally paused, we wait one\n // second for the \"onvisibilitychange\" event on the HTMLDocument to see if the\n // app will be backgrounded. If not, then the element can be safely played.\n Promise.race([\n waitForEvent(document, 'visibilitychange'),\n waitForSometime(1000)\n ]).then(function () {\n if (document.visibilityState === 'visible') {\n // NOTE(mmalavalli): We play the inadvertently paused elements only after\n // the LocalAudioTrack is unmuted to work around WebKit Bug 213853.\n //\n // Bug: https://bugs.webkit.org/show_bug.cgi?id=213853\n //\n localMediaRestartDeferreds.whenResolved('audio').then(function () {\n log.info(\"Playing unintentionally paused <\" + tag + \"> element\");\n log.debug('Element:', el);\n return el.play();\n }).then(function () {\n log.info(\"Successfully played unintentionally paused <\" + tag + \"> element\");\n log.debug('Element:', el);\n }).catch(function (error) {\n log.warn(\"Error while playing unintentionally paused <\" + tag + \"> element:\", { error: error, el: el });\n });\n }\n });\n}\n/**\n * Shim the pause() and play() methods of the given HTMLMediaElement so that\n * we can detect if it was paused unintentionally.\n * @param {HTMLMediaElement} el\n * @param {?function} [onUnintentionallyPaused=null]\n * @returns {{pausedIntentionally: function, unShim: function}}\n */\nfunction shimMediaElement(el, onUnintentionallyPaused) {\n if (onUnintentionallyPaused === void 0) { onUnintentionallyPaused = null; }\n var origPause = el.pause;\n var origPlay = el.play;\n var pausedIntentionally = false;\n el.pause = function () {\n pausedIntentionally = true;\n return origPause.call(el);\n };\n el.play = function () {\n pausedIntentionally = false;\n return origPlay.call(el);\n };\n var onPause = onUnintentionallyPaused ? function () {\n if (!pausedIntentionally) {\n onUnintentionallyPaused();\n }\n } : null;\n if (onPause) {\n el.addEventListener('pause', onPause);\n }\n return {\n pausedIntentionally: function () {\n return pausedIntentionally;\n },\n unShim: function () {\n el.pause = origPause;\n el.play = origPlay;\n if (onPause) {\n el.removeEventListener('pause', onPause);\n }\n }\n };\n}\nmodule.exports = MediaTrack;\n//# sourceMappingURL=mediatrack.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar MediaTrack = require('./mediatrack');\n/**\n * An {@link AudioTrack} is a {@link Track} representing audio.\n * @extends Track\n * @property {boolean} isStarted - Whether or not the {@link AudioTrack} has\n * started; if the {@link AudioTrack} started, there is enough audio data to\n * begin playback\n * @property {boolean} isEnabled - Whether or not the {@link AudioTrack} is\n * enabled; if the {@link AudioTrack} is not enabled, it is \"muted\"\n * @property {Track.Kind} kind - \"audio\"\n * @property {MediaStreamTrack} mediaStreamTrack - An audio MediaStreamTrack\n * @property {?MediaStreamTrack} processedTrack - The source of processed audio samples.\n * It is always null as audio processing is not currently supported.\n * @emits AudioTrack#disabled\n * @emits AudioTrack#enabled\n * @emits AudioTrack#started\n */\nvar AudioTrack = /** @class */ (function (_super) {\n __extends(AudioTrack, _super);\n /**\n * Construct an {@link AudioTrack}.\n * @param {MediaTrackTransceiver} mediaTrackTransceiver\n * @param {{log: Log}} options\n */\n function AudioTrack(mediaTrackTransceiver, options) {\n return _super.call(this, mediaTrackTransceiver, options) || this;\n }\n /**\n * Create an HTMLAudioElement and attach the {@link AudioTrack} to it.\n *\n * The HTMLAudioElement's srcObject will be set to a new\n * MediaStream containing the {@link AudioTrack}'s MediaStreamTrack.\n *\n * @returns {HTMLAudioElement} audioElement\n * @example\n * const Video = require('twilio-video');\n *\n * Video.createLocalAudioTrack().then(function(audioTrack) {\n * const audioElement = audioTrack.attach();\n * document.body.appendChild(audioElement);\n * });\n */ /**\n * Attach the {@link AudioTrack} to an existing HTMLMediaElement. The\n * HTMLMediaElement could be an HTMLAudioElement or an HTMLVideoElement.\n *\n * If the HTMLMediaElement's srcObject is not set to a MediaStream,\n * this method sets it to a new MediaStream containing the {@link AudioTrack}'s\n * MediaStreamTrack; otherwise, it adds the {@link MediaTrack}'s\n * MediaStreamTrack to the existing MediaStream. Finally, if there are any other\n * MediaStreamTracks of the same kind on the MediaStream, this method removes\n * them.\n *\n * @param {HTMLMediaElement} mediaElement - The HTMLMediaElement to attach to\n * @returns {HTMLMediaElement} mediaElement\n * @example\n * const Video = require('twilio-video');\n *\n * const videoElement = document.createElement('video');\n * document.body.appendChild(videoElement);\n *\n * Video.createLocalAudioTrack().then(function(audioTrack) {\n * audioTrack.attach(videoElement);\n * });\n */ /**\n * Attach the {@link AudioTrack} to an HTMLMediaElement selected by\n * document.querySelector. The HTMLMediaElement could be an\n * HTMLAudioElement or an HTMLVideoElement.\n *\n * If the HTMLMediaElement's srcObject is not set to a MediaStream,\n * this method sets it to a new MediaStream containing the {@link AudioTrack}'s\n * MediaStreamTrack; otherwise, it adds the {@link AudioTrack}'s\n * MediaStreamTrack to the existing MediaStream. Finally, if there are any other\n * MediaStreamTracks of the same kind on the MediaStream, this method removes\n * them.\n *\n * @param {string} selector - A query selector for the HTMLMediaElement to\n * attach to\n * @returns {HTMLMediaElement} mediaElement\n * @example\n * const Video = require('twilio-video');\n *\n * const videoElement = document.createElement('video');\n * videoElement.id = 'my-video-element';\n * document.body.appendChild(videoElement);\n *\n * Video.createLocalAudioTrack().then(function(track) {\n * track.attach('#my-video-element');\n * });\n */\n AudioTrack.prototype.attach = function () {\n return _super.prototype.attach.apply(this, arguments);\n };\n /**\n * Detach the {@link AudioTrack} from all previously attached HTMLMediaElements.\n * @returns {Array} mediaElements\n * @example\n * const mediaElements = audioTrack.detach();\n * mediaElements.forEach(mediaElement => mediaElement.remove());\n */ /**\n * Detach the {@link AudioTrack} from a previously attached HTMLMediaElement.\n * @param {HTMLMediaElement} mediaElement - One of the HTMLMediaElements to\n * which the {@link AudioTrack} is attached\n * @returns {HTMLMediaElement} mediaElement\n * @example\n * const videoElement = document.getElementById('my-video-element');\n * audioTrack.detach(videoElement).remove();\n */ /**\n * Detach the {@link AudioTrack} from a previously attached HTMLMediaElement\n * specified by document.querySelector.\n * @param {string} selector - The query selector of HTMLMediaElement to which\n * the {@link AudioTrack} is attached\n * @returns {HTMLMediaElement} mediaElement\n * @example\n * audioTrack.detach('#my-video-element').remove();\n */\n AudioTrack.prototype.detach = function () {\n return _super.prototype.detach.apply(this, arguments);\n };\n return AudioTrack;\n}(MediaTrack));\n/**\n * The {@link AudioTrack} was disabled, i.e. \"muted\".\n * @param {AudioTrack} track - The {@link AudioTrack} that was disabled\n * @event AudioTrack#disabled\n */\n/**\n * The {@link AudioTrack} was enabled, i.e. \"unmuted\".\n * @param {AudioTrack} track - The {@link AudioTrack} that was enabled\n * @event AudioTrack#enabled\n */\n/**\n * The {@link AudioTrack} started. This means there is enough audio data to\n * begin playback.\n * @param {AudioTrack} track - The {@link AudioTrack} that started\n * @event AudioTrack#started\n */\nmodule.exports = AudioTrack;\n//# sourceMappingURL=audiotrack.js.map","'use strict';\n// Cached copy of the used to check silent video frames.\nvar canvas = null;\nvar N_SAMPLES = 3;\nvar SAMPLE_HEIGHT = 50;\nvar SAMPLE_INTERVAL_MS = 250;\nvar SAMPLE_WIDTH = 50;\n/**\n * Check whether the current video frame is silent by selecting a 50x50\n * sample and calculating the max value of the pixel data. If it is 0, then\n * the frame is considered to be silent.\n * @private\n * @param {HTMLVideoElement} el\n * @returns {boolean} true if silent, false if not\n */\nfunction checkSilence(el) {\n try {\n var context = canvas.getContext('2d');\n context.drawImage(el, 0, 0, SAMPLE_WIDTH, SAMPLE_HEIGHT);\n var frame = context.getImageData(0, 0, SAMPLE_WIDTH, SAMPLE_HEIGHT);\n var frameDataWithoutAlpha = frame.data.filter(function (item, i) { return (i + 1) % 4; });\n var max = Math.max.apply(Math, frameDataWithoutAlpha);\n return max === 0;\n }\n catch (ex) {\n // eslint-disable-next-line no-console\n console.log('Error checking silence: ', ex);\n return false;\n }\n}\n/**\n * Detect whether the video stream rendered by the given HTMLVideoElement is silent.\n * @param {HTMLVideoElement} el\n * @returns {Promise} true if silent, false if not.\n */\nfunction detectSilentVideo(el) {\n // Create the canvas when detectSilentVideo() is called for the\n // first time.\n canvas = canvas || document.createElement('canvas');\n // Resolve the returned Promise with true if 3 consecutive sample\n // frames from the video being played by the HTMLVideoElement are\n // silent.\n return new Promise(function (resolve) {\n var samplesLeft = N_SAMPLES;\n setTimeout(function doCheckSilence() {\n samplesLeft--;\n if (!checkSilence(el)) {\n return resolve(false);\n }\n if (samplesLeft > 0) {\n return setTimeout(doCheckSilence, SAMPLE_INTERVAL_MS);\n }\n return resolve(true);\n }, SAMPLE_INTERVAL_MS);\n });\n}\nmodule.exports = detectSilentVideo;\n//# sourceMappingURL=detectsilentvideo.js.map","'use strict';\n/**\n * The {@link DocumentVisibilityMonitor} monitors the visibility state of the DOM\n * and executes the attached listeners in phase order when the DOM is visible.\n */\nvar DocumentVisibilityMonitor = /** @class */ (function () {\n /**\n * Constructor.\n * @param {number} [nPhases=1] - the number of phases\n */\n function DocumentVisibilityMonitor(nPhases) {\n var _this = this;\n if (nPhases === void 0) { nPhases = 1; }\n Object.defineProperties(this, {\n _listeners: {\n value: []\n },\n _onVisibilityChange: {\n value: function () {\n _this._emitVisible(document.visibilityState === 'visible');\n }\n }\n });\n for (var i = 0; i < nPhases; i++) {\n this._listeners.push([]);\n }\n }\n /**\n * clears the state.\n */\n DocumentVisibilityMonitor.prototype.clear = function () {\n var nPhases = this._listeners.length;\n for (var i = 0; i < nPhases; i++) {\n this._listeners[i] = [];\n }\n };\n DocumentVisibilityMonitor.prototype._listenerCount = function () {\n return this._listeners.reduce(function (count, phaseListeners) { return count + phaseListeners.length; }, 0);\n };\n /**\n * Call all the listeners. Makes sure that all listeners for a given phase\n * are executed before calling the listeners of the next phase.\n * @private\n */\n DocumentVisibilityMonitor.prototype._emitVisible = function (isVisible) {\n var _this = this;\n var promise = Promise.resolve();\n var _loop_1 = function (phase) {\n promise = promise.then(function () { return _this._emitVisiblePhase(phase, isVisible); });\n };\n for (var phase = 1; phase <= this._listeners.length; phase++) {\n _loop_1(phase);\n }\n return promise;\n };\n /**\n * Call all the listeners for a given phase.\n * @private\n */\n DocumentVisibilityMonitor.prototype._emitVisiblePhase = function (phase, isVisible) {\n var phaseListeners = this._listeners[phase - 1];\n return Promise.all(phaseListeners.map(function (listener) {\n var ret = listener(isVisible);\n return ret instanceof Promise ? ret : Promise.resolve(ret);\n }));\n };\n /**\n * Start listening to the DOM visibility state change.\n * @private\n */\n DocumentVisibilityMonitor.prototype._start = function () {\n document.addEventListener('visibilitychange', this._onVisibilityChange);\n };\n /**\n * Stop listening to the DOM visibility state change.\n * @private\n */\n DocumentVisibilityMonitor.prototype._stop = function () {\n document.removeEventListener('visibilitychange', this._onVisibilityChange);\n };\n /**\n * Listen for the DOM visibility changes at the given phase.\n * @param {number} phase\n * @param {function} listener\n * @returns {this}\n */\n DocumentVisibilityMonitor.prototype.onVisibilityChange = function (phase, listener) {\n if (typeof phase !== 'number' || phase <= 0 || phase > this._listeners.length) {\n throw new Error('invalid phase: ', phase);\n }\n var phaseListeners = this._listeners[phase - 1];\n phaseListeners.push(listener);\n if (this._listenerCount() === 1) {\n this._start();\n }\n return this;\n };\n /**\n * Stop listening for the DOM visibility change at the given phase.\n * @param {number} phase\n * @param {function} listener\n * @returns {this}\n */\n DocumentVisibilityMonitor.prototype.offVisibilityChange = function (phase, listener) {\n if (typeof phase !== 'number' || phase <= 0 || phase > this._listeners.length) {\n throw new Error('invalid phase: ', phase);\n }\n var phaseListeners = this._listeners[phase - 1];\n var index = phaseListeners.indexOf(listener);\n if (index !== -1) {\n phaseListeners.splice(index, 1);\n if (this._listenerCount() === 0) {\n this._stop();\n }\n }\n return this;\n };\n return DocumentVisibilityMonitor;\n}());\nmodule.exports = new DocumentVisibilityMonitor(2);\n//# sourceMappingURL=documentvisibilitymonitor.js.map","'use strict';\nvar detectSilence = require('./detectsilence');\n/**\n * This function attempts to workaround WebKit Bug 180748. It does so by\n *\n * 1. Calling `getUserMedia`, and\n * 2. Checking to see if the resulting MediaStream is silent.\n * 3. If so, repeat Step 1; otherwise, return the MediaStream.\n *\n * The function only repeats up to `n` times, and it only waits `timeout`\n * milliseconds when detecting silence. Assuming `getUserMedia` is\n * instantaneous, in the best case, this function returns a Promise that\n * resolves immediately; in the worst case, this function returns a Promise that\n * resolves in `n` * `timeout` milliseconds.\n *\n * @param {Log} log\n * @param {function(MediaStreamConstraints): Promise} getUserMedia\n * @param {MediaStreamConstraints} constraints\n * @param {number} [n=3]\n * @param {number} [timeout=250]\n * @returns Promise\n */\nfunction workaround(log, getUserMedia, constraints, n, timeout) {\n n = typeof n === 'number' ? n : 3;\n var retry = 0;\n // NOTE(mroberts): We have to delay require-ing AudioContextFactory, because\n // it exports a default instance whose constructor calls Object.assign.\n var AudioContextFactory = require('./audiocontext');\n var holder = {};\n var audioContext = AudioContextFactory.getOrCreate(holder);\n /**\n * We can't use async/await yet, so I need to factor this out.\n * @returns {Promise}\n */\n function doWorkaround() {\n return getUserMedia(constraints).then(function (stream) {\n var isSilentPromise = constraints.audio\n ? detectSilence(audioContext, stream, timeout).catch(function (err) {\n log.warn('Encountered an error while detecting silence', err);\n return true;\n })\n : Promise.resolve(false);\n return isSilentPromise.then(function (isSilent) {\n if (!isSilent) {\n log.info('Got a non-silent audio MediaStreamTrack; returning it.');\n return stream;\n }\n else if (n <= 0) {\n log.warn('Got a silent audio MediaStreamTrack. Normally we would try \\\nto get a new one, but we\\'ve run out of retries; returning it anyway.');\n return stream;\n }\n log.warn(\"Got a silent audio MediaStreamTrack. Stopping all MediaStreamTracks and calling getUserMedia again. This is retry #\" + ++retry + \".\");\n stream.getTracks().forEach(function (track) { return track.stop(); });\n n--;\n return doWorkaround();\n });\n });\n }\n return doWorkaround().then(function (stream) {\n AudioContextFactory.release(holder);\n return stream;\n }, function (error) {\n AudioContextFactory.release(holder);\n throw error;\n });\n}\nmodule.exports = workaround;\n//# sourceMappingURL=workaround180748.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar EventEmitter = require('events').EventEmitter;\n/**\n * A {@link QueueingEventEmitter} can queue events until a listener has been\n * added.\n * @extends EventEmitter\n */\nvar QueueingEventEmitter = /** @class */ (function (_super) {\n __extends(QueueingEventEmitter, _super);\n /**\n * Construct a {@link QueueingEventEmitter}\n */\n function QueueingEventEmitter() {\n var _this = _super.call(this) || this;\n Object.defineProperties(_this, {\n _queuedEvents: {\n value: new Map()\n }\n });\n return _this;\n }\n /**\n * Emit any queued events.\n * @returns {boolean} true if every event had listeners, false otherwise\n */ /**\n * Emit any queued events matching the event name.\n * @param {string} event\n * @returns {boolean} true if every event had listeners, false otherwise\n */\n QueueingEventEmitter.prototype.dequeue = function (event) {\n var _this = this;\n var result = true;\n if (!event) {\n this._queuedEvents.forEach(function (_, queuedEvent) {\n result = this.dequeue(queuedEvent) && result;\n }, this);\n return result;\n }\n var queue = this._queuedEvents.get(event) || [];\n this._queuedEvents.delete(event);\n return queue.reduce(function (result, args) { return _this.emit.apply(_this, __spreadArray([], __read([event].concat(args)))) && result; }, result);\n };\n /**\n * If the event has listeners, emit the event; otherwise, queue the event.\n * @param {string} event\n * @param {...*} args\n * @returns {boolean} true if the event had listeners, false if the event was queued\n */\n QueueingEventEmitter.prototype.queue = function () {\n var args = [].slice.call(arguments);\n if (this.emit.apply(this, __spreadArray([], __read(args)))) {\n return true;\n }\n var event = args[0];\n if (!this._queuedEvents.has(event)) {\n this._queuedEvents.set(event, []);\n }\n this._queuedEvents.get(event).push(args.slice(1));\n return false;\n };\n return QueueingEventEmitter;\n}(EventEmitter));\nmodule.exports = QueueingEventEmitter;\n//# sourceMappingURL=queueingeventemitter.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar QueueingEventEmitter = require('./queueingeventemitter');\n/**\n * A {@link TrackTransceiver} represents either one or more local RTCRtpSenders\n * or RTCDataChannels, or a single RTCRtpReceiver or remote RTCDataChannel.\n * @extends QueueingEventEmitter\n * @property {Track.ID} id\n * @property {Track.kind} kind\n */\nvar TrackTransceiver = /** @class */ (function (_super) {\n __extends(TrackTransceiver, _super);\n /**\n * Construct a {@link TrackTransceiver}.\n * @param {Track.ID} id\n * @param {Track.kind} kind\n */\n function TrackTransceiver(id, kind) {\n var _this = _super.call(this) || this;\n Object.defineProperties(_this, {\n id: {\n enumerable: true,\n value: id\n },\n kind: {\n enumerable: true,\n value: kind\n }\n });\n return _this;\n }\n /**\n * Stop the {@link TrackTransceiver}.\n * #emits TrackTransceiver#stopped\n * @returns {void}\n */\n TrackTransceiver.prototype.stop = function () {\n this.emit('stopped');\n };\n return TrackTransceiver;\n}(QueueingEventEmitter));\n/**\n * The {@link TrackTransceiver} was stopped.\n * @event TrackTransceiver#stopped\n */\nmodule.exports = TrackTransceiver;\n//# sourceMappingURL=transceiver.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar TrackTransceiver = require('../../transceiver');\n/**\n * A {@link MediaTrackTransceiver} represents either one or more local\n * RTCRtpSenders, or a single RTCRtpReceiver.\n * @extends TrackTransceiver\n * @property {MediaStreamTrack} track\n */\nvar MediaTrackTransceiver = /** @class */ (function (_super) {\n __extends(MediaTrackTransceiver, _super);\n /**\n * Construct a {@link MediaTrackTransceiver}.\n * @param {Track.ID} id - The MediaStreamTrack ID signaled through RSP/SDP\n * @param {MediaStreamTrack} mediaStreamTrack\n */\n function MediaTrackTransceiver(id, mediaStreamTrack) {\n var _this = _super.call(this, id, mediaStreamTrack.kind) || this;\n Object.defineProperties(_this, {\n _track: {\n value: mediaStreamTrack,\n writable: true\n },\n enabled: {\n enumerable: true,\n get: function () {\n return this._track.enabled;\n }\n },\n readyState: {\n enumerable: true,\n get: function () {\n return this._track.readyState;\n }\n },\n track: {\n enumerable: true,\n get: function () {\n return this._track;\n }\n }\n });\n return _this;\n }\n MediaTrackTransceiver.prototype.stop = function () {\n this.track.stop();\n _super.prototype.stop.call(this);\n };\n return MediaTrackTransceiver;\n}(TrackTransceiver));\nmodule.exports = MediaTrackTransceiver;\n//# sourceMappingURL=transceiver.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar MediaTrackTransceiver = require('./transceiver');\n/**\n * A {@link MediaTrackSender} represents one or more local RTCRtpSenders.\n * @extends MediaTrackTransceiver\n * @emits MediaTrackSender#replaced\n */\nvar MediaTrackSender = /** @class */ (function (_super) {\n __extends(MediaTrackSender, _super);\n /**\n * Construct a {@link MediaTrackSender}.\n * @param {MediaStreamTrack} mediaStreamTrack\n */\n function MediaTrackSender(mediaStreamTrack) {\n var _this = _super.call(this, mediaStreamTrack.id, mediaStreamTrack) || this;\n Object.defineProperties(_this, {\n _clones: {\n value: new Set()\n },\n _eventsToReemitters: {\n value: new Map([\n ['mute', function () { return _this.queue('muted'); }],\n ['unmute', function () { return _this.queue('unmuted'); }]\n ])\n },\n _senders: {\n value: new Set()\n },\n _senderToPublisherHintCallbacks: {\n value: new Map()\n },\n isPublishing: {\n enumerable: true,\n get: function () {\n return !!this._clones.size;\n }\n },\n muted: {\n enumerable: true,\n get: function () {\n return this._track.muted;\n }\n }\n });\n _this._reemitMediaStreamTrackEvents();\n return _this;\n }\n /**\n * @private\n */\n MediaTrackSender.prototype._reemitMediaStreamTrackEvents = function (mediaStreamTrack) {\n if (mediaStreamTrack === void 0) { mediaStreamTrack = this._track; }\n var _a = this, eventsToReemitters = _a._eventsToReemitters, track = _a._track;\n eventsToReemitters.forEach(function (reemitter, event) { return mediaStreamTrack.addEventListener(event, reemitter); });\n if (track !== mediaStreamTrack) {\n eventsToReemitters.forEach(function (reemitter, event) { return track.removeEventListener(event, reemitter); });\n if (track.muted !== mediaStreamTrack.muted) {\n var reemitter = eventsToReemitters.get(mediaStreamTrack.muted ? 'mute' : 'unmute');\n reemitter();\n }\n }\n };\n /**\n * Return a new {@link MediaTrackSender} containing a clone of the underlying\n * MediaStreamTrack. No RTCRtpSenders are copied.\n * @returns {MediaTrackSender}\n */\n MediaTrackSender.prototype.clone = function () {\n var clone = new MediaTrackSender(this.track.clone());\n this._clones.add(clone);\n return clone;\n };\n /**\n * Remove a cloned {@link MediaTrackSender}.\n * @returns {void}\n */\n MediaTrackSender.prototype.removeClone = function (clone) {\n this._clones.delete(clone);\n };\n /**\n * Set the given MediaStreamTrack.\n * @param {MediaStreamTrack} mediaStreamTrack\n * @returns {Promise}\n */\n MediaTrackSender.prototype.setMediaStreamTrack = function (mediaStreamTrack) {\n var _this = this;\n var clones = Array.from(this._clones);\n var senders = Array.from(this._senders);\n return Promise.all(clones.map(function (clone) {\n return clone.setMediaStreamTrack(mediaStreamTrack.clone());\n }).concat(senders.map(function (sender) {\n return _this._replaceTrack(sender, mediaStreamTrack);\n }))).finally(function () {\n _this._reemitMediaStreamTrackEvents(mediaStreamTrack);\n _this._track = mediaStreamTrack;\n });\n };\n /**\n * Add an RTCRtpSender.\n * @param {RTCRtpSender} sender\n * @param {?()=>Promise} publisherHintCallback\n * @returns {this}\n */\n MediaTrackSender.prototype.addSender = function (sender, publisherHintCallback) {\n this._senders.add(sender);\n if (publisherHintCallback) {\n this._senderToPublisherHintCallbacks.set(sender, publisherHintCallback);\n }\n return this;\n };\n /**\n * Remove an RTCRtpSender.\n * @param {RTCRtpSender} sender\n * @returns {this}\n */\n MediaTrackSender.prototype.removeSender = function (sender) {\n this._senders.delete(sender);\n this._senderToPublisherHintCallbacks.delete(sender);\n return this;\n };\n /**\n * Applies given encodings, or resets encodings if none specified.\n * @param {Array<{enabled: boolean, layer_index: number}>|null} encodings\n * @returns {Promise}\n */\n MediaTrackSender.prototype.setPublisherHint = function (encodings) {\n // Note(mpatwardhan): since publisher hint applies only to group rooms we only look at 1st call callback.\n var _a = __read(Array.from(this._senderToPublisherHintCallbacks.values()), 1), publisherHintCallback = _a[0];\n return publisherHintCallback ? publisherHintCallback(encodings) : Promise.resolve('COULD_NOT_APPLY_HINT');\n };\n MediaTrackSender.prototype._replaceTrack = function (sender, mediaStreamTrack) {\n var _this = this;\n return sender.replaceTrack(mediaStreamTrack).then(function (replaceTrackResult) {\n // clear any publisherHints and apply default encodings.\n _this.setPublisherHint(null).catch(function () { });\n _this.emit('replaced');\n return replaceTrackResult;\n });\n };\n return MediaTrackSender;\n}(MediaTrackTransceiver));\n/**\n * The {@link MediaTrackSender}'s underlying MediaStreamTrack was muted.\n * @event MediaTrackSender#muted\n */\n/**\n * The {@link MediaTrackSender} replaced the underlying MediaStreamTrack.\n * @event MediaTrackSender#replaced\n */\n/**\n * The {@link MediaTrackSender}'s underlying MediaStreamTrack was unmuted.\n * @event MediaTrackSender#unmuted\n */\nmodule.exports = MediaTrackSender;\n//# sourceMappingURL=sender.js.map","/* eslint new-cap:0 */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar getUserMedia = require('../../webrtc').getUserMedia;\nvar isIOS = require('../../util/browserdetection').isIOS;\nvar _a = require('../../util'), capitalize = _a.capitalize, defer = _a.defer, waitForSometime = _a.waitForSometime, waitForEvent = _a.waitForEvent;\nvar ILLEGAL_INVOKE = require('../../util/constants').typeErrors.ILLEGAL_INVOKE;\nvar detectSilentAudio = require('../../util/detectsilentaudio');\nvar detectSilentVideo = require('../../util/detectsilentvideo');\nvar documentVisibilityMonitor = require('../../util/documentvisibilitymonitor.js');\nvar localMediaRestartDeferreds = require('../../util/localmediarestartdeferreds');\nvar gUMSilentTrackWorkaround = require('../../webaudio/workaround180748');\nvar MediaTrackSender = require('./sender');\nfunction mixinLocalMediaTrack(AudioOrVideoTrack) {\n /**\n * A {@link LocalMediaTrack} represents audio or video that your\n * {@link LocalParticipant} is sending to a {@link Room}. As such, it can be\n * enabled and disabled with {@link LocalMediaTrack#enable} and\n * {@link LocalMediaTrack#disable} or stopped completely with\n * {@link LocalMediaTrack#stop}.\n * @emits LocalMediaTrack#muted\n * @emits LocalMediaTrack#stopped\n * @emits LocalMediaTrack#unmuted\n */\n return /** @class */ (function (_super) {\n __extends(LocalMediaTrack, _super);\n /**\n * Construct a {@link LocalMediaTrack} from a MediaStreamTrack.\n * @param {MediaStreamTrack} mediaStreamTrack - The underlying MediaStreamTrack\n * @param {LocalTrackOptions} [options] - {@link LocalTrack} options\n */\n function LocalMediaTrack(mediaStreamTrack, options) {\n var _this = this;\n var workaroundWebKitBug1208516 = isIOS()\n && typeof document === 'object'\n && typeof document.addEventListener === 'function'\n && typeof document.visibilityState === 'string';\n options = Object.assign({\n getUserMedia: getUserMedia,\n isCreatedByCreateLocalTracks: false,\n workaroundWebKitBug1208516: workaroundWebKitBug1208516,\n gUMSilentTrackWorkaround: gUMSilentTrackWorkaround\n }, options);\n var mediaTrackSender = new MediaTrackSender(mediaStreamTrack);\n var kind = mediaTrackSender.kind;\n _this = _super.call(this, mediaTrackSender, options) || this;\n Object.defineProperties(_this, {\n _constraints: {\n value: typeof options[kind] === 'object'\n ? options[kind]\n : {},\n writable: true\n },\n _getUserMedia: {\n value: options.getUserMedia\n },\n _gUMSilentTrackWorkaround: {\n value: options.gUMSilentTrackWorkaround\n },\n _eventsToReemitters: {\n value: new Map([\n ['muted', function () { return _this.emit('muted', _this); }],\n ['unmuted', function () { return _this.emit('unmuted', _this); }]\n ])\n },\n _workaroundWebKitBug1208516: {\n value: options.workaroundWebKitBug1208516\n },\n _workaroundWebKitBug1208516Cleanup: {\n value: null,\n writable: true\n },\n _didCallEnd: {\n value: false,\n writable: true\n },\n _isCreatedByCreateLocalTracks: {\n value: options.isCreatedByCreateLocalTracks\n },\n _noiseCancellation: {\n value: options.noiseCancellation || null\n },\n _trackSender: {\n value: mediaTrackSender\n },\n id: {\n enumerable: true,\n value: mediaTrackSender.id\n },\n isEnabled: {\n enumerable: true,\n get: function () {\n return mediaTrackSender.enabled;\n }\n },\n isMuted: {\n enumerable: true,\n get: function () {\n return mediaTrackSender.muted;\n }\n },\n isStopped: {\n enumerable: true,\n get: function () {\n return mediaTrackSender.readyState === 'ended';\n }\n }\n });\n // NOTE(mpatwardhan): As a workaround for WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=208516,\n // upon foregrounding, re-acquire new MediaStreamTrack if the existing one is ended or muted.\n if (_this._workaroundWebKitBug1208516) {\n _this._workaroundWebKitBug1208516Cleanup = restartWhenInadvertentlyStopped(_this);\n }\n _this._reemitTrackSenderEvents();\n return _this;\n }\n /**\n * @private\n */\n LocalMediaTrack.prototype._end = function () {\n var _this = this;\n if (this._didCallEnd) {\n return;\n }\n _super.prototype._end.call(this);\n this._didCallEnd = true;\n this._eventsToReemitters.forEach(function (reemitter, event) { return _this._trackSender.removeListener(event, reemitter); });\n this.emit('stopped', this);\n };\n /**\n * @private\n */\n LocalMediaTrack.prototype._initialize = function () {\n if (this._didCallEnd) {\n this._didCallEnd = false;\n }\n if (this._eventsToReemitters) {\n this._reemitTrackSenderEvents();\n }\n _super.prototype._initialize.call(this);\n };\n /**\n * @private\n */\n LocalMediaTrack.prototype._reacquireTrack = function (constraints) {\n var _a;\n var _b = this, getUserMedia = _b._getUserMedia, gUMSilentTrackWorkaround = _b._gUMSilentTrackWorkaround, log = _b._log, kind = _b.mediaStreamTrack.kind;\n log.info('Re-acquiring the MediaStreamTrack');\n log.debug('Constraints:', constraints);\n var gUMConstraints = Object.assign({\n audio: false,\n video: false\n }, (_a = {}, _a[kind] = constraints, _a));\n var gUMPromise = this._workaroundWebKitBug1208516Cleanup\n ? gUMSilentTrackWorkaround(log, getUserMedia, gUMConstraints)\n : getUserMedia(gUMConstraints);\n return gUMPromise.then(function (mediaStream) {\n return mediaStream.getTracks()[0];\n });\n };\n /**\n * @private\n */\n LocalMediaTrack.prototype._reemitTrackSenderEvents = function () {\n var _this = this;\n this._eventsToReemitters.forEach(function (reemitter, event) { return _this._trackSender.on(event, reemitter); });\n this._trackSender.dequeue('muted');\n this._trackSender.dequeue('unmuted');\n };\n /**\n * @private\n */\n LocalMediaTrack.prototype._restart = function (constraints) {\n var _this = this;\n var log = this._log;\n constraints = constraints || this._constraints;\n // NOTE(mmalavalli): If we try and restart a silent MediaStreamTrack\n // without stopping it first, then a NotReadableError is raised in case of\n // video, or the restarted audio will still be silent. Hence, we stop the\n // MediaStreamTrack here.\n this._stop();\n return this._reacquireTrack(constraints).catch(function (error) {\n log.error('Failed to re-acquire the MediaStreamTrack:', { error: error, constraints: constraints });\n throw error;\n }).then(function (newMediaStreamTrack) {\n log.info('Re-acquired the MediaStreamTrack');\n log.debug('MediaStreamTrack:', newMediaStreamTrack);\n _this._constraints = Object.assign({}, constraints);\n return _this._setMediaStreamTrack(newMediaStreamTrack);\n });\n };\n /**\n * @private\n */\n LocalMediaTrack.prototype._setMediaStreamTrack = function (mediaStreamTrack) {\n var _this = this;\n // NOTE(mpatwardhan): Preserve the value of the \"enabled\" flag.\n mediaStreamTrack.enabled = this.mediaStreamTrack.enabled;\n // NOTE(mmalavalli): Stop the current MediaStreamTrack. If not already\n // stopped, this should fire a \"stopped\" event.\n this._stop();\n // NOTE(csantos): If there's an unprocessedTrack, this means RTCRtpSender has\n // the processedTrack already set, we don't want to replace that.\n return (this._unprocessedTrack ? Promise.resolve().then(function () {\n _this._unprocessedTrack = mediaStreamTrack;\n }) : this._trackSender.setMediaStreamTrack(mediaStreamTrack).catch(function (error) {\n _this._log.warn('setMediaStreamTrack failed:', { error: error, mediaStreamTrack: mediaStreamTrack });\n })).then(function () {\n _this._initialize();\n _this._getAllAttachedElements().forEach(function (el) { return _this._attach(el); });\n });\n };\n /**\n * @private\n */\n LocalMediaTrack.prototype._stop = function () {\n this.mediaStreamTrack.stop();\n this._end();\n return this;\n };\n LocalMediaTrack.prototype.enable = function (enabled) {\n enabled = typeof enabled === 'boolean' ? enabled : true;\n if (enabled !== this.mediaStreamTrack.enabled) {\n this._log.info((enabled ? 'En' : 'Dis') + \"abling\");\n this.mediaStreamTrack.enabled = enabled;\n this.emit(enabled ? 'enabled' : 'disabled', this);\n }\n return this;\n };\n LocalMediaTrack.prototype.disable = function () {\n return this.enable(false);\n };\n LocalMediaTrack.prototype.restart = function (constraints) {\n var _this = this;\n var kind = this.kind;\n if (!this._isCreatedByCreateLocalTracks) {\n return Promise.reject(ILLEGAL_INVOKE('restart', 'can only be called on a'\n + (\" Local\" + capitalize(kind) + \"Track that is created using createLocalTracks\")\n + (\" or createLocal\" + capitalize(kind) + \"Track.\")));\n }\n if (this._workaroundWebKitBug1208516Cleanup) {\n this._workaroundWebKitBug1208516Cleanup();\n this._workaroundWebKitBug1208516Cleanup = null;\n }\n var promise = this._restart(constraints);\n if (this._workaroundWebKitBug1208516) {\n promise = promise.finally(function () {\n _this._workaroundWebKitBug1208516Cleanup = restartWhenInadvertentlyStopped(_this);\n });\n }\n return promise;\n };\n LocalMediaTrack.prototype.stop = function () {\n this._log.info('Stopping');\n if (this._workaroundWebKitBug1208516Cleanup) {\n this._workaroundWebKitBug1208516Cleanup();\n this._workaroundWebKitBug1208516Cleanup = null;\n }\n return this._stop();\n };\n return LocalMediaTrack;\n }(AudioOrVideoTrack));\n}\n/**\n * Restart the given {@link LocalMediaTrack} if it has been inadvertently stopped.\n * @private\n * @param {LocalAudioTrack|LocalVideoTrack} localMediaTrack\n * @returns {function} Clean up listeners attached by the workaround\n */\nfunction restartWhenInadvertentlyStopped(localMediaTrack) {\n var log = localMediaTrack._log, kind = localMediaTrack.kind, noiseCancellation = localMediaTrack._noiseCancellation;\n var detectSilence = {\n audio: detectSilentAudio,\n video: detectSilentVideo\n }[kind];\n var getSourceMediaStreamTrack = function () { return noiseCancellation\n ? noiseCancellation.sourceTrack\n : localMediaTrack.mediaStreamTrack; };\n var el = localMediaTrack._dummyEl;\n var mediaStreamTrack = getSourceMediaStreamTrack();\n var trackChangeInProgress = null;\n function checkSilence() {\n // The dummy element is paused, so play it and then detect silence.\n return el.play().then(function () { return detectSilence(el); }).then(function (isSilent) {\n if (isSilent) {\n log.warn('Silence detected');\n }\n else {\n log.info('Non-silence detected');\n }\n return isSilent;\n }).catch(function (error) {\n log.warn('Failed to detect silence:', error);\n }).finally(function () {\n // Pause the dummy element again, if there is no processed track.\n if (!localMediaTrack.processedTrack) {\n el.pause();\n }\n });\n }\n function shouldReacquireTrack() {\n var _workaroundWebKitBug1208516Cleanup = localMediaTrack._workaroundWebKitBug1208516Cleanup, isStopped = localMediaTrack.isStopped;\n var isInadvertentlyStopped = isStopped && !!_workaroundWebKitBug1208516Cleanup;\n var muted = getSourceMediaStreamTrack().muted;\n // NOTE(mmalavalli): Restart the LocalMediaTrack if:\n // 1. The app is foregrounded, and\n // 2. A restart is not already in progress, and\n // 3. The LocalMediaTrack is either muted, inadvertently stopped or silent\n return Promise.resolve().then(function () {\n return document.visibilityState === 'visible'\n && !trackChangeInProgress\n && (muted || isInadvertentlyStopped || checkSilence());\n });\n }\n function maybeRestart() {\n return Promise.race([\n waitForEvent(mediaStreamTrack, 'unmute'),\n waitForSometime(50)\n ]).then(function () { return shouldReacquireTrack(); }).then(function (shouldReacquire) {\n if (shouldReacquire && !trackChangeInProgress) {\n trackChangeInProgress = defer();\n localMediaTrack._restart().finally(function () {\n el = localMediaTrack._dummyEl;\n removeMediaStreamTrackListeners();\n mediaStreamTrack = getSourceMediaStreamTrack();\n addMediaStreamTrackListeners();\n trackChangeInProgress.resolve();\n trackChangeInProgress = null;\n }).catch(function (error) {\n log.error('failed to restart track: ', error);\n });\n }\n // NOTE(mmalavalli): If the MediaStreamTrack ends before the DOM is visible,\n // then this makes sure that visibility callback for phase 2 is called only\n // after the MediaStreamTrack is re-acquired.\n var promise = (trackChangeInProgress && trackChangeInProgress.promise) || Promise.resolve();\n return promise.finally(function () { return localMediaRestartDeferreds.resolveDeferred(kind); });\n }).catch(function (ex) {\n log.error(\"error in maybeRestart: \" + ex.message);\n });\n }\n function onMute() {\n var log = localMediaTrack._log, kind = localMediaTrack.kind;\n log.info('Muted');\n log.debug('LocalMediaTrack:', localMediaTrack);\n // NOTE(mmalavalli): When a LocalMediaTrack is muted without the app being\n // backgrounded, and the inadvertently paused elements are played before it\n // is restarted, it never gets unmuted due to the WebKit Bug 213853. Hence,\n // setting this Deferred will make sure that the inadvertently paused elements\n // are played only after the LocalMediaTrack is unmuted.\n //\n // Bug: https://bugs.webkit.org/show_bug.cgi?id=213853\n //\n localMediaRestartDeferreds.startDeferred(kind);\n }\n function addMediaStreamTrackListeners() {\n mediaStreamTrack.addEventListener('ended', maybeRestart);\n mediaStreamTrack.addEventListener('mute', onMute);\n mediaStreamTrack.addEventListener('unmute', maybeRestart);\n }\n function removeMediaStreamTrackListeners() {\n mediaStreamTrack.removeEventListener('ended', maybeRestart);\n mediaStreamTrack.removeEventListener('mute', onMute);\n mediaStreamTrack.removeEventListener('unmute', maybeRestart);\n }\n // NOTE(mpatwardhan): listen for document visibility callback on phase 1.\n // this ensures that we acquire media tracks before RemoteMediaTrack\n // tries to `play` them (in phase 2). This order is important because\n // play can fail on safari if audio is not being captured.\n var onVisibilityChange = function (isVisible) {\n return isVisible ? maybeRestart() : false;\n };\n documentVisibilityMonitor.onVisibilityChange(1, onVisibilityChange);\n addMediaStreamTrackListeners();\n return function () {\n documentVisibilityMonitor.offVisibilityChange(1, onVisibilityChange);\n removeMediaStreamTrackListeners();\n };\n}\nmodule.exports = mixinLocalMediaTrack;\n//# sourceMappingURL=localmediatrack.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar isIOS = require('../../util/browserdetection').isIOS;\nvar detectSilentAudio = require('../../util/detectsilentaudio');\nvar isIOSChrome = require('../../webrtc/util').isIOSChrome;\nvar AudioTrack = require('./audiotrack');\nvar mixinLocalMediaTrack = require('./localmediatrack');\nvar LocalMediaAudioTrack = mixinLocalMediaTrack(AudioTrack);\n/**\n * A {@link LocalAudioTrack} is an {@link AudioTrack} representing audio that\n * your {@link LocalParticipant} can publish to a {@link Room}. It can be\n * enabled and disabled with {@link LocalAudioTrack#enable} and\n * {@link LocalAudioTrack#disable} or stopped completely with\n * {@link LocalAudioTrack#stop}.\n * @extends AudioTrack\n * @property {Track.ID} id - The {@link LocalAudioTrack}'s ID\n * @property {boolean} isMuted - Whether or not the audio source has stopped sending samples to the\n * {@link LocalAudioTrack}; This can happen when the microphone is taken over by another application,\n * mainly on mobile devices; When this property toggles, then muted and unmuted\n * events are fired appropriately\n * @property {boolean} isStopped - Whether or not the {@link LocalAudioTrack} is\n * stopped\n * @property {NoiseCancellation?} noiseCancellation - When a LocalAudioTrack is created\n * with {@link NoiseCancellationOptions}, this property provides interface\n * to enable or disable the noise cancellation at runtime.\n * @emits LocalAudioTrack#disabled\n * @emits LocalAudioTrack#enabled\n * @emits LocalAudioTrack#muted\n * @emits LocalAudioTrack#started\n * @emits LocalAudioTrack#stopped\n * @emits LocalAudioTrack#unmuted\n */\nvar LocalAudioTrack = /** @class */ (function (_super) {\n __extends(LocalAudioTrack, _super);\n /**\n * Construct a {@link LocalAudioTrack} from a MediaStreamTrack.\n * @param {MediaStreamTrack} mediaStreamTrack - An audio MediaStreamTrack\n * @param {LocalTrackOptions} [options] - {@link LocalTrack} options\n */\n function LocalAudioTrack(mediaStreamTrack, options) {\n var _this = this;\n var noiseCancellation = (options === null || options === void 0 ? void 0 : options.noiseCancellation) || null;\n _this = _super.call(this, mediaStreamTrack, options) || this;\n var log = _this._log;\n var _a = mediaStreamTrack.label, defaultDeviceLabel = _a === void 0 ? '' : _a;\n var _b = mediaStreamTrack.getSettings(), _c = _b.deviceId, defaultDeviceId = _c === void 0 ? '' : _c, _d = _b.groupId, defaultGroupId = _d === void 0 ? '' : _d;\n Object.defineProperties(_this, {\n _currentDefaultDeviceInfo: {\n value: { deviceId: defaultDeviceId, groupId: defaultGroupId, label: defaultDeviceLabel },\n writable: true\n },\n _defaultDeviceCaptureMode: {\n value: !isIOS()\n && _this._isCreatedByCreateLocalTracks\n && typeof navigator === 'object'\n && typeof navigator.mediaDevices === 'object'\n && typeof navigator.mediaDevices.addEventListener === 'function'\n && typeof navigator.mediaDevices.enumerateDevices === 'function'\n ? (options === null || options === void 0 ? void 0 : options.defaultDeviceCaptureMode) || 'auto'\n : 'manual'\n },\n _onDeviceChange: {\n value: function () {\n navigator.mediaDevices.enumerateDevices().then(function (deviceInfos) {\n // NOTE(mmalavalli): In Chrome, when the default device changes, and we restart the LocalAudioTrack with\n // device ID \"default\", it will not switch to the new default device unless all LocalAudioTracks capturing\n // from the old default device are stopped. So, we restart the LocalAudioTrack with the actual device ID of\n // the new default device instead.\n var defaultDeviceInfo = deviceInfos.find(function (_a) {\n var deviceId = _a.deviceId, kind = _a.kind;\n return kind === 'audioinput' && deviceId !== 'default';\n });\n if (defaultDeviceInfo && ['deviceId', 'groupId'].some(function (prop) {\n return defaultDeviceInfo[prop] !== _this._currentDefaultDeviceInfo[prop];\n })) {\n log.info('Default device changed, restarting the LocalAudioTrack');\n log.debug(\"Old default device: \\\"\" + _this._currentDefaultDeviceInfo.deviceId + \"\\\" => \\\"\" + _this._currentDefaultDeviceInfo.label + \"\\\"\");\n log.debug(\"New default device: \\\"\" + defaultDeviceInfo.deviceId + \"\\\" => \\\"\" + defaultDeviceInfo.label + \"\\\"\");\n _this._currentDefaultDeviceInfo = defaultDeviceInfo;\n _this._restartDefaultDevice().catch(function (error) { return log.warn(\"Failed to restart: \" + error.message); });\n }\n }, function (error) {\n log.warn(\"Failed to run enumerateDevices(): \" + error.message);\n });\n }\n },\n _restartOnDefaultDeviceChangeCleanup: {\n value: null,\n writable: true\n },\n noiseCancellation: {\n enumerable: true,\n value: noiseCancellation,\n writable: false\n },\n });\n log.debug('defaultDeviceCaptureMode:', _this._defaultDeviceCaptureMode);\n _this._maybeRestartOnDefaultDeviceChange();\n return _this;\n }\n LocalAudioTrack.prototype.toString = function () {\n return \"[LocalAudioTrack #\" + this._instanceId + \": \" + this.id + \"]\";\n };\n LocalAudioTrack.prototype.attach = function (el) {\n el = _super.prototype.attach.call(this, el);\n el.muted = true;\n return el;\n };\n /**\n * @private\n */\n LocalAudioTrack.prototype._end = function () {\n return _super.prototype._end.apply(this, arguments);\n };\n /**\n * @private\n */\n LocalAudioTrack.prototype._maybeRestartOnDefaultDeviceChange = function () {\n var _this = this;\n var _a = this, constraints = _a._constraints, defaultDeviceCaptureMode = _a._defaultDeviceCaptureMode, log = _a._log;\n var mediaStreamTrack = this.noiseCancellation ? this.noiseCancellation.sourceTrack : this.mediaStreamTrack;\n var deviceId = mediaStreamTrack.getSettings().deviceId;\n var isNotEqualToCapturedDeviceIdOrEqualToDefault = function (requestedDeviceId) {\n return requestedDeviceId !== deviceId || requestedDeviceId === 'default';\n };\n var isCapturingFromDefaultDevice = (function checkIfCapturingFromDefaultDevice(deviceIdConstraint) {\n if (deviceIdConstraint === void 0) { deviceIdConstraint = {}; }\n if (typeof deviceIdConstraint === 'string') {\n return isNotEqualToCapturedDeviceIdOrEqualToDefault(deviceIdConstraint);\n }\n else if (Array.isArray(deviceIdConstraint)) {\n return deviceIdConstraint.every(isNotEqualToCapturedDeviceIdOrEqualToDefault);\n }\n else if (deviceIdConstraint.exact) {\n return checkIfCapturingFromDefaultDevice(deviceIdConstraint.exact);\n }\n else if (deviceIdConstraint.ideal) {\n return checkIfCapturingFromDefaultDevice(deviceIdConstraint.ideal);\n }\n return true;\n }(constraints.deviceId));\n if (defaultDeviceCaptureMode === 'auto' && isCapturingFromDefaultDevice) {\n if (!this._restartOnDefaultDeviceChangeCleanup) {\n log.info('LocalAudioTrack will be restarted if the default device changes');\n navigator.mediaDevices.addEventListener('devicechange', this._onDeviceChange);\n this._restartOnDefaultDeviceChangeCleanup = function () {\n log.info('Cleaning up the listener to restart the LocalAudioTrack if the default device changes');\n navigator.mediaDevices.removeEventListener('devicechange', _this._onDeviceChange);\n _this._restartOnDefaultDeviceChangeCleanup = null;\n };\n }\n }\n else {\n log.info('LocalAudioTrack will NOT be restarted if the default device changes');\n if (this._restartOnDefaultDeviceChangeCleanup) {\n this._restartOnDefaultDeviceChangeCleanup();\n }\n }\n };\n /**\n * @private\n */\n LocalAudioTrack.prototype._reacquireTrack = function (constraints) {\n var _this = this;\n this._log.debug('_reacquireTrack: ', constraints);\n if (this.noiseCancellation) {\n return this.noiseCancellation.reacquireTrack(function () {\n return _super.prototype._reacquireTrack.call(_this, constraints);\n });\n }\n return _super.prototype._reacquireTrack.call(this, constraints);\n };\n /**\n * @private\n */\n LocalAudioTrack.prototype._restartDefaultDevice = function () {\n var _this = this;\n var constraints = Object.assign({}, this._constraints);\n var restartConstraints = Object.assign({}, constraints, { deviceId: this._currentDefaultDeviceInfo.deviceId });\n return this.restart(restartConstraints).then(function () {\n // NOTE(mmalavalli): Since we used the new default device's ID while restarting the LocalAudioTrack,\n // we reset the constraints to the original constraints so that the default device detection logic in\n // _maybeRestartOnDefaultDeviceChange() still works.\n _this._constraints = constraints;\n _this._maybeRestartOnDefaultDeviceChange();\n });\n };\n /**\n * NOTE(mmalavalli): On iOS 17 Chrome, a LocalAudioTrack with Krisp Noise Cancellation\n * enabled that is restarted due to foregrounding the browser is silent for as-of-yet\n * unknown reason. We work around this by discarding the Krisp MediaStreamTrack and using\n * the source MediaStreamTrack. (VIDEO-13006)\n * @private\n */\n LocalAudioTrack.prototype._setMediaStreamTrack = function (mediaStreamTrack) {\n var _this = this;\n var _a = this, log = _a._log, noiseCancellation = _a.noiseCancellation;\n var promise = _super.prototype._setMediaStreamTrack.call(this, mediaStreamTrack);\n if (isIOSChrome() && !!noiseCancellation) {\n log.debug('iOS Chrome detected, checking if the restarted Krisp audio is silent');\n promise = promise.then(function () { return detectSilentAudio(_this._dummyEl); }).then(function (isSilent) {\n log.debug(\"Krisp audio is \" + (isSilent ? 'silent, using source audio' : 'not silent'));\n return isSilent && noiseCancellation.disablePermanently().then(function () {\n return _super.prototype._setMediaStreamTrack.call(_this, noiseCancellation.sourceTrack);\n });\n });\n }\n return promise;\n };\n /**\n * Disable the {@link LocalAudioTrack}. This is equivalent to muting the audio source.\n * @returns {this}\n * @fires LocalAudioTrack#disabled\n */\n LocalAudioTrack.prototype.disable = function () {\n return _super.prototype.disable.apply(this, arguments);\n };\n /**\n * Enable the {@link LocalAudioTrack}. This is equivalent to unmuting the audio source.\n * @returns {this}\n * @fires LocalAudioTrack#enabled\n */ /**\n * Enable or disable the {@link LocalAudioTrack}. This is equivalent to unmuting or muting\n * the audio source respectively.\n * @param {boolean} [enabled] - Specify false to disable the\n * {@link LocalAudioTrack}\n * @returns {this}\n * @fires LocalAudioTrack#disabled\n * @fires LocalAudioTrack#enabled\n */\n LocalAudioTrack.prototype.enable = function () {\n return _super.prototype.enable.apply(this, arguments);\n };\n /**\n * Restart the {@link LocalAudioTrack}. This stops the existing MediaStreamTrack\n * and creates a new MediaStreamTrack. If the {@link LocalAudioTrack} is being published\n * to a {@link Room}, then all the {@link RemoteParticipant}s will start receiving media\n * from the newly created MediaStreamTrack. You can access the new MediaStreamTrack via\n * the mediaStreamTrack property. If you want to listen to events on\n * the MediaStreamTrack directly, please do so in the \"started\" event handler. Also,\n * the {@link LocalAudioTrack}'s ID is no longer guaranteed to be the same as the\n * underlying MediaStreamTrack's ID.\n * @param {MediaTrackConstraints} [constraints] - The optional MediaTrackConstraints\n * for restarting the {@link LocalAudioTrack}; If not specified, then the current MediaTrackConstraints\n * will be used; If {} (empty object) is specified, then the default MediaTrackConstraints\n * will be used\n * @returns {Promise} Rejects with a TypeError if the {@link LocalAudioTrack} was not created\n * using an one of createLocalAudioTrack, createLocalTracks or connect;\n * Also rejects with the DOMException\n * raised by getUserMedia when it fails\n * @fires LocalAudioTrack#stopped\n * @fires LocalAudioTrack#started\n * @example\n * const { connect, createLocalAudioTrack } = require('twilio-video');\n *\n * // Create a LocalAudioTrack that captures audio from a USB microphone.\n * createLocalAudioTrack({ deviceId: 'usb-mic-id' }).then(function(localAudioTrack) {\n * return connect('token', {\n * name: 'my-cool-room',\n * tracks: [localAudioTrack]\n * });\n * }).then(function(room) {\n * // Restart the LocalAudioTrack to capture audio from the default microphone.\n * const localAudioTrack = Array.from(room.localParticipant.audioTracks.values())[0].track;\n * return localAudioTrack.restart({ deviceId: 'default-mic-id' });\n * });\n */\n LocalAudioTrack.prototype.restart = function () {\n return _super.prototype.restart.apply(this, arguments);\n };\n /**\n * Calls stop on the underlying MediaStreamTrack. If you choose to stop a\n * {@link LocalAudioTrack}, you should unpublish it after stopping.\n * @returns {this}\n * @fires LocalAudioTrack#stopped\n */\n LocalAudioTrack.prototype.stop = function () {\n if (this.noiseCancellation) {\n this.noiseCancellation.stop();\n }\n if (this._restartOnDefaultDeviceChangeCleanup) {\n this._restartOnDefaultDeviceChangeCleanup();\n }\n return _super.prototype.stop.apply(this, arguments);\n };\n return LocalAudioTrack;\n}(LocalMediaAudioTrack));\n/**\n * The {@link LocalAudioTrack} was disabled, i.e. the audio source was muted by the user.\n * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that was\n * disabled\n * @event LocalAudioTrack#disabled\n */\n/**\n * The {@link LocalAudioTrack} was enabled, i.e. the audio source was unmuted by the user.\n * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that was enabled\n * @event LocalAudioTrack#enabled\n */\n/**\n * The {@link LocalAudioTrack} was muted because the audio source stopped sending samples, most\n * likely due to another application taking said audio source, especially on mobile devices.\n * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that was muted\n * @event LocalAudioTrack#muted\n */\n/**\n * The {@link LocalAudioTrack} started. This means there is enough audio data to\n * begin playback.\n * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that started\n * @event LocalAudioTrack#started\n */\n/**\n * The {@link LocalAudioTrack} stopped, either because {@link LocalAudioTrack#stop}\n * or {@link LocalAudioTrack#restart} was called or because the underlying\n * MediaStreamTrack ended.\n * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that stopped\n * @event LocalAudioTrack#stopped\n */\n/**\n * The {@link LocalAudioTrack} was unmuted because the audio source resumed sending samples,\n * most likely due to the application that took over the said audio source has released it\n * back to the application, especially on mobile devices. This event is also fired when\n * {@link LocalAudioTrack#restart} is called on a muted {@link LocalAudioTrack} with a\n * new audio source.\n * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that was unmuted\n * @event LocalAudioTrack#unmuted\n */\nmodule.exports = LocalAudioTrack;\n//# sourceMappingURL=localaudiotrack.js.map","// eslint-disable-next-line no-warning-comments\n// TODO(mroberts): Remove this when we go to the next major version. This is\n// only in place so that we can support ES6 classes without requiring `new`.\n'use strict';\nvar inherits = require('../../../vendor/inherits');\nvar LocalAudioTrackClass = require('../localaudiotrack');\nfunction LocalAudioTrack(mediaStreamTrack, options) {\n var track = new LocalAudioTrackClass(mediaStreamTrack, options);\n Object.setPrototypeOf(track, LocalAudioTrack.prototype);\n return track;\n}\ninherits(LocalAudioTrack, LocalAudioTrackClass);\nmodule.exports = LocalAudioTrack;\n//# sourceMappingURL=localaudiotrack.js.map","/* globals MediaStreamTrackGenerator, MediaStreamTrackProcessor, TransformStream */\n'use strict';\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar DEFAULT_FRAME_RATE = require('../../util/constants').DEFAULT_FRAME_RATE;\nfunction captureVideoFramesSetInterval(videoEl, processVideoFrame) {\n var _a = __read(videoEl.srcObject.getVideoTracks(), 1), track = _a[0];\n var _b = track.getSettings().frameRate, frameRate = _b === void 0 ? DEFAULT_FRAME_RATE : _b;\n var sampleInterval;\n var readable = new ReadableStream({\n start: function (controller) {\n sampleInterval = setInterval(function () { return controller.enqueue(); }, 1000 / frameRate);\n }\n });\n var transformer = new TransformStream({\n transform: function () {\n return processVideoFrame();\n }\n });\n readable\n .pipeThrough(transformer)\n .pipeTo(new WritableStream())\n .then(function () { });\n return function () {\n clearInterval(sampleInterval);\n };\n}\nfunction captureVideoFramesInsertableStreams(videoEl, processVideoFrame, videoFrameType) {\n var _a = __read(videoEl.srcObject.getVideoTracks(), 1), track = _a[0];\n var readable = new MediaStreamTrackProcessor({ track: track }).readable;\n var generator = new MediaStreamTrackGenerator({ kind: 'video' });\n var shouldStop = false;\n var transformer = new TransformStream({\n transform: function (videoFrame, controller) {\n var promise = videoFrameType === 'videoframe'\n ? processVideoFrame(videoFrame)\n : Promise.resolve(videoFrame.close())\n .then(processVideoFrame);\n return promise.finally(function () {\n if (shouldStop) {\n controller.terminate();\n }\n });\n }\n });\n readable\n .pipeThrough(transformer)\n .pipeTo(generator.writable)\n .then(function () { });\n return function () {\n shouldStop = true;\n };\n}\nmodule.exports = typeof MediaStreamTrackGenerator === 'function' && typeof MediaStreamTrackProcessor === 'function'\n ? captureVideoFramesInsertableStreams\n : captureVideoFramesSetInterval;\n//# sourceMappingURL=capturevideoframes.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar EventEmitter = require('events').EventEmitter;\nvar DEFAULT_VIDEO_PROCESSOR_STATS_INTERVAL_MS = require('../../util/constants').DEFAULT_VIDEO_PROCESSOR_STATS_INTERVAL_MS;\n/**\n * VideoProcessorEventObserver listens to {@link VideoProcessor} related events\n * and re-emits them as a generic event with some additional information.\n * @extends EventEmitter\n * @emits VideoProcessorEventObserver#event\n */\nvar VideoProcessorEventObserver = /** @class */ (function (_super) {\n __extends(VideoProcessorEventObserver, _super);\n /**\n * Constructor.\n * @param {Log} log\n */\n function VideoProcessorEventObserver(log) {\n var _this = _super.call(this) || this;\n Object.defineProperties(_this, {\n _lastStatsSaveTime: {\n value: null,\n writable: true\n },\n _lastStatsPublishTime: {\n value: null,\n writable: true\n },\n _log: {\n value: log\n },\n _processorInfo: {\n value: null,\n writable: true\n },\n _stats: {\n value: null,\n writable: true\n }\n });\n _this.on('add', function (info) {\n _this._lastStatsSaveTime = Date.now();\n _this._lastStatsPublishTime = Date.now();\n _this._processorInfo = info;\n _this._stats = [];\n _this._reemitEvent('add', _this._getEventData());\n });\n _this.on('remove', function () {\n var data = _this._getEventData();\n _this._lastStatsSaveTime = null;\n _this._lastStatsPublishTime = null;\n _this._processorInfo = null;\n _this._stats = null;\n _this._reemitEvent('remove', data);\n });\n _this.on('start', function () {\n _this._reemitEvent('start', _this._getEventData());\n });\n _this.on('stop', function (message) {\n _this._reemitEvent('stop', Object.assign({ message: message }, _this._getEventData()));\n });\n _this.on('stats', function () { return _this._maybeEmitStats(); });\n return _this;\n }\n /**\n * @private\n */\n VideoProcessorEventObserver.prototype._getEventData = function () {\n if (!this._processorInfo) {\n return {};\n }\n var _a = this._processorInfo, processor = _a.processor, captureHeight = _a.captureHeight, captureWidth = _a.captureWidth, inputFrameRate = _a.inputFrameRate, isRemoteVideoTrack = _a.isRemoteVideoTrack, inputFrameBufferType = _a.inputFrameBufferType, outputFrameBufferContextType = _a.outputFrameBufferContextType;\n var data = { captureHeight: captureHeight, captureWidth: captureWidth, inputFrameRate: inputFrameRate, isRemoteVideoTrack: isRemoteVideoTrack, inputFrameBufferType: inputFrameBufferType, outputFrameBufferContextType: outputFrameBufferContextType };\n data.name = processor._name || 'VideoProcessor';\n ['assetsPath', 'blurFilterRadius', 'debounce', 'fitType', 'isSimdEnabled', 'maskBlurRadius', 'pipeline', 'version'].forEach(function (prop) {\n var val = processor[\"_\" + prop];\n if (typeof val !== 'undefined') {\n data[prop] = val;\n }\n });\n Object.keys(data).forEach(function (prop) {\n var val = data[prop];\n if (typeof val === 'boolean') {\n data[prop] = val ? 'true' : 'false';\n }\n });\n return data;\n };\n /**\n * Save stats every second. If a specific time interval has elapsed,\n * the stats event will be emitted\n * @private\n */\n VideoProcessorEventObserver.prototype._maybeEmitStats = function () {\n if (!this._stats || !this._processorInfo) {\n return;\n }\n var benchmark = this._processorInfo.processor._benchmark;\n if (!benchmark) {\n return;\n }\n var now = Date.now();\n if (now - this._lastStatsSaveTime < 1000) {\n return;\n }\n var entry = { outputFrameRate: benchmark.getRate('totalProcessingDelay') };\n ['captureFrameDelay', 'imageCompositionDelay', 'inputImageResizeDelay', 'processFrameDelay', 'segmentationDelay'].forEach(function (name) {\n entry[name] = benchmark.getAverageDelay(name);\n });\n this._lastStatsSaveTime = now;\n this._stats.push(entry);\n if (now - this._lastStatsPublishTime < DEFAULT_VIDEO_PROCESSOR_STATS_INTERVAL_MS) {\n return;\n }\n this._lastStatsPublishTime = now;\n var stats = this._stats.splice(0);\n var averages = stats.reduce(function (averages, current, n) {\n Object.keys(entry).forEach(function (name) {\n if (!averages[name]) {\n averages[name] = 0;\n }\n averages[name] = ((averages[name] * n) + current[name]) / (n + 1);\n });\n return averages;\n }, {});\n Object.keys(averages).forEach(function (name) {\n averages[name] = parseFloat(averages[name].toFixed(2));\n });\n this._reemitEvent('stats', Object.assign({}, averages, this._getEventData()));\n };\n /**\n * @private\n */\n VideoProcessorEventObserver.prototype._reemitEvent = function (name, data) {\n this._log.debug(\"VideoProcessor:\" + name, data);\n this.emit('event', { name: name, data: data });\n };\n return VideoProcessorEventObserver;\n}(EventEmitter));\nmodule.exports = VideoProcessorEventObserver;\n//# sourceMappingURL=videoprocessoreventobserver.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar MediaTrack = require('./mediatrack');\nvar captureVideoFrames = require('./capturevideoframes');\nvar VideoProcessorEventObserver = require('./videoprocessoreventobserver');\nvar guessBrowser = require('../../webrtc/util').guessBrowser;\nvar DEFAULT_FRAME_RATE = require('../../util/constants').DEFAULT_FRAME_RATE;\n/**\n * A {@link VideoTrack} is a {@link Track} representing video.\n * @extends Track\n * @property {boolean} isStarted - Whether or not the {@link VideoTrack} has\n * started; if the {@link VideoTrack} started, there is enough video data to\n * begin playback\n * @property {boolean} isEnabled - Whether or not the {@link VideoTrack} is\n * enabled; if the {@link VideoTrack} is not enabled, it is \"paused\"\n * @property {VideoTrack.Dimensions} dimensions - The {@link VideoTrack}'s\n * {@link VideoTrack.Dimensions}\n * @property {Track.Kind} kind - \"video\"\n * @property {MediaStreamTrack} mediaStreamTrack - A video MediaStreamTrack\n * @property {?MediaStreamTrack} processedTrack - The source of processed video frames.\n * It is null if no VideoProcessor has been added.\n * @property {?VideoProcessor} processor - A {@link VideoProcessor} that is currently\n * processing video frames. It is null if video frames are not being processed.\n * @emits VideoTrack#dimensionsChanged\n * @emits VideoTrack#disabled\n * @emits VideoTrack#enabled\n * @emits VideoTrack#started\n */\nvar VideoTrack = /** @class */ (function (_super) {\n __extends(VideoTrack, _super);\n /**\n * Construct a {@link VideoTrack}.\n * @param {MediaTrackTransceiver} mediaTrackTransceiver\n * @param {{log: Log}} options\n */\n function VideoTrack(mediaTrackTransceiver, options) {\n var _this = _super.call(this, mediaTrackTransceiver, options) || this;\n Object.defineProperties(_this, {\n _isCapturing: {\n value: false,\n writable: true\n },\n _inputFrame: {\n value: null,\n writable: true\n },\n _outputFrame: {\n value: null,\n writable: true\n },\n _processorEventObserver: {\n value: null,\n writable: true,\n },\n _processorOptions: {\n value: {},\n writable: true,\n },\n _stopCapture: {\n value: function () { },\n writable: true\n },\n _unmuteHandler: {\n value: null,\n writable: true\n },\n dimensions: {\n enumerable: true,\n value: {\n width: null,\n height: null\n }\n },\n processor: {\n enumerable: true,\n value: null,\n writable: true\n }\n });\n _this._processorEventObserver = new (options.VideoProcessorEventObserver || VideoProcessorEventObserver)(_this._log);\n return _this;\n }\n /**\n * @private\n */\n VideoTrack.prototype._checkIfCanCaptureFrames = function (isPublishing) {\n if (isPublishing === void 0) { isPublishing = false; }\n var canCaptureFrames = true;\n var message = '';\n var _a = this.mediaStreamTrack, enabled = _a.enabled, readyState = _a.readyState;\n if (!enabled) {\n canCaptureFrames = false;\n message = 'MediaStreamTrack is disabled';\n }\n if (readyState === 'ended') {\n canCaptureFrames = false;\n message = 'MediaStreamTrack is ended';\n }\n if (!this.processor) {\n canCaptureFrames = false;\n message = 'VideoProcessor not detected.';\n }\n if (!this._attachments.size && !isPublishing) {\n canCaptureFrames = false;\n message = 'VideoTrack is not publishing and there is no attached element.';\n }\n if (message) {\n this._log.debug(message);\n }\n return { canCaptureFrames: canCaptureFrames, message: message };\n };\n /**\n * @private\n */\n VideoTrack.prototype._captureFrames = function () {\n var _this = this;\n if (this._isCapturing) {\n this._log.debug('Ignoring captureFrames call. Capture is already in progress');\n return;\n }\n if (!this._checkIfCanCaptureFrames().canCaptureFrames) {\n this._isCapturing = false;\n this._log.debug('Cannot capture frames. Ignoring captureFrames call.');\n return;\n }\n this._isCapturing = true;\n this._processorEventObserver.emit('start');\n this._log.debug('Start capturing frames');\n var inputFrameBufferType = this._processorOptions.inputFrameBufferType;\n this._dummyEl.play().then(function () {\n var process = function (videoFrame) {\n var checkResult = _this._checkIfCanCaptureFrames();\n if (!checkResult.canCaptureFrames) {\n if (videoFrame) {\n videoFrame.close();\n }\n _this._isCapturing = false;\n _this._stopCapture();\n _this._processorEventObserver.emit('stop', checkResult.message);\n _this._log.debug('Cannot capture frames. Stopping capturing frames.');\n return Promise.resolve();\n }\n var _a = _this.mediaStreamTrack.getSettings(), _b = _a.width, width = _b === void 0 ? 0 : _b, _c = _a.height, height = _c === void 0 ? 0 : _c;\n // Setting the canvas' dimension triggers a redraw.\n // Only set it if it has changed.\n if (_this._outputFrame && _this._outputFrame.width !== width) {\n _this._outputFrame.width = width;\n _this._outputFrame.height = height;\n }\n if (_this._inputFrame) {\n if (_this._inputFrame.width !== width) {\n _this._inputFrame.width = width;\n _this._inputFrame.height = height;\n }\n _this._inputFrame.getContext('2d').drawImage(_this._dummyEl, 0, 0, width, height);\n }\n var input = videoFrame || (['video', 'videoframe'].includes(inputFrameBufferType)\n ? _this._dummyEl\n : _this._inputFrame);\n var result = null;\n try {\n result = _this.processor.processFrame(input, _this._outputFrame);\n }\n catch (ex) {\n _this._log.debug('Exception detected after calling processFrame.', ex);\n }\n return ((result instanceof Promise) ? result : Promise.resolve(result))\n .then(function () {\n if (_this._outputFrame) {\n if (typeof _this.processedTrack.requestFrame === 'function') {\n _this.processedTrack.requestFrame();\n }\n _this._processorEventObserver.emit('stats');\n }\n });\n };\n _this._stopCapture = captureVideoFrames(_this._dummyEl, process, inputFrameBufferType);\n }).catch(function (error) { return _this._log.error('Video element cannot be played', { error: error, track: _this }); });\n };\n /**\n * @private\n */\n VideoTrack.prototype._initialize = function () {\n var _this = this;\n _super.prototype._initialize.call(this);\n if (this._dummyEl) {\n this._dummyEl.onloadedmetadata = function () {\n if (dimensionsChanged(_this, _this._dummyEl)) {\n _this.dimensions.width = _this._dummyEl.videoWidth;\n _this.dimensions.height = _this._dummyEl.videoHeight;\n }\n };\n this._dummyEl.onresize = function () {\n if (dimensionsChanged(_this, _this._dummyEl)) {\n _this.dimensions.width = _this._dummyEl.videoWidth;\n _this.dimensions.height = _this._dummyEl.videoHeight;\n if (_this.isStarted) {\n _this._log.debug('Dimensions changed:', _this.dimensions);\n _this.emit(VideoTrack.DIMENSIONS_CHANGED, _this);\n }\n }\n };\n }\n };\n /**\n * @private\n */\n VideoTrack.prototype._restartProcessor = function () {\n var processor = this.processor;\n if (processor) {\n var processorOptions = Object.assign({}, this._processorOptions);\n this.removeProcessor(processor);\n this.addProcessor(processor, processorOptions);\n }\n };\n /**\n * @private\n */\n VideoTrack.prototype._start = function (dummyEl) {\n this.dimensions.width = dummyEl.videoWidth;\n this.dimensions.height = dummyEl.videoHeight;\n this._log.debug('Dimensions:', this.dimensions);\n this.emit(VideoTrack.DIMENSIONS_CHANGED, this);\n return _super.prototype._start.call(this, dummyEl);\n };\n /**\n * Add a {@link VideoProcessor} to allow for custom processing of video frames belonging to a VideoTrack.\n * @param {VideoProcessor} processor - The {@link VideoProcessor} to use.\n * @param {AddProcessorOptions} [options] - {@link AddProcessorOptions} to provide.\n * @returns {this}\n * @example\n * class GrayScaleProcessor {\n * constructor(percentage) {\n * this.percentage = percentage;\n * }\n * processFrame(inputFrameBuffer, outputFrameBuffer) {\n * const context = outputFrameBuffer.getContext('2d');\n * context.filter = `grayscale(${this.percentage}%)`;\n * context.drawImage(inputFrameBuffer, 0, 0, inputFrameBuffer.width, inputFrameBuffer.height);\n * }\n * }\n *\n * Video.createLocalVideoTrack().then(function(videoTrack) {\n * videoTrack.addProcessor(new GrayScaleProcessor(100));\n * });\n */\n VideoTrack.prototype.addProcessor = function (processor, options) {\n var _this = this;\n if (!processor || typeof processor.processFrame !== 'function') {\n throw new Error('Received an invalid VideoProcessor from addProcessor.');\n }\n if (this.processor) {\n throw new Error('A VideoProcessor has already been added.');\n }\n if (!this._dummyEl) {\n throw new Error('VideoTrack has not been initialized.');\n }\n this._log.debug('Adding VideoProcessor to the VideoTrack', processor);\n if (!this._unmuteHandler) {\n this._unmuteHandler = function () {\n _this._log.debug('mediaStreamTrack unmuted');\n // NOTE(csantos): On certain scenarios where mediaStreamTrack is coming from muted to unmuted state,\n // the processedTrack doesn't unmutes automatically although enabled is already set to true.\n // This is a terminal state for the processedTrack and should be restarted. (VIDEO-4176)\n if (_this.processedTrack.muted) {\n _this._log.debug('mediaStreamTrack is unmuted but processedTrack is muted. Restarting processor.');\n _this._restartProcessor();\n }\n };\n this.mediaStreamTrack.addEventListener('unmute', this._unmuteHandler);\n }\n this._processorOptions = options || {};\n var _a = this._processorOptions, inputFrameBufferType = _a.inputFrameBufferType, outputFrameBufferContextType = _a.outputFrameBufferContextType;\n if (typeof OffscreenCanvas === 'undefined' && inputFrameBufferType === 'offscreencanvas') {\n throw new Error('OffscreenCanvas is not supported by this browser.');\n }\n if (inputFrameBufferType\n && inputFrameBufferType !== 'videoframe'\n && inputFrameBufferType !== 'video'\n && inputFrameBufferType !== 'canvas'\n && inputFrameBufferType !== 'offscreencanvas') {\n throw new Error(\"Invalid inputFrameBufferType of \" + inputFrameBufferType);\n }\n if (!inputFrameBufferType) {\n inputFrameBufferType = typeof OffscreenCanvas === 'undefined' ? 'canvas' : 'offscreencanvas';\n }\n var _b = this.mediaStreamTrack.getSettings(), _c = _b.width, width = _c === void 0 ? 0 : _c, _d = _b.height, height = _d === void 0 ? 0 : _d, _e = _b.frameRate, frameRate = _e === void 0 ? DEFAULT_FRAME_RATE : _e;\n if (inputFrameBufferType === 'offscreencanvas') {\n this._inputFrame = new OffscreenCanvas(width, height);\n }\n if (inputFrameBufferType === 'canvas') {\n this._inputFrame = document.createElement('canvas');\n }\n if (this._inputFrame) {\n this._inputFrame.width = width;\n this._inputFrame.height = height;\n }\n this._outputFrame = document.createElement('canvas');\n this._outputFrame.width = width;\n this._outputFrame.height = height;\n // NOTE(csantos): Initialize the rendering context for future renders. This also ensures\n // that the correct type is used and on Firefox, it throws an exception if you try to capture\n // frames prior calling getContext https://bugzilla.mozilla.org/show_bug.cgi?id=1572422\n outputFrameBufferContextType = outputFrameBufferContextType || '2d';\n var ctx = this._outputFrame.getContext(outputFrameBufferContextType);\n if (!ctx) {\n throw new Error(\"Cannot get outputFrameBufferContextType: \" + outputFrameBufferContextType + \".\");\n }\n // NOTE(csantos): Zero FPS means we can control when to render the next frame by calling requestFrame.\n // Some browsers such as Firefox doesn't support requestFrame so we will use default, which is an undefined value.\n // This means, the browser will use the highest FPS available.\n var targetFps = typeof CanvasCaptureMediaStreamTrack !== 'undefined' && CanvasCaptureMediaStreamTrack.prototype &&\n // eslint-disable-next-line\n typeof CanvasCaptureMediaStreamTrack.prototype.requestFrame === 'function' ? 0 : undefined;\n this.processedTrack = this._outputFrame.captureStream(targetFps).getTracks()[0];\n this.processedTrack.enabled = this.mediaStreamTrack.enabled;\n this.processor = processor;\n this._processorEventObserver.emit('add', {\n processor: processor,\n captureHeight: height,\n captureWidth: width,\n inputFrameRate: frameRate,\n isRemoteVideoTrack: this.toString().includes('RemoteVideoTrack'),\n inputFrameBufferType: inputFrameBufferType,\n outputFrameBufferContextType: outputFrameBufferContextType\n });\n this._updateElementsMediaStreamTrack();\n this._captureFrames();\n return this;\n };\n /**\n * Create an HTMLVideoElement and attach the {@link VideoTrack} to it.\n *\n * The HTMLVideoElement's srcObject will be set to a new\n * MediaStream containing the {@link VideoTrack}'s MediaStreamTrack.\n *\n * @returns {HTMLVideoElement} videoElement\n * @example\n * const Video = require('twilio-video');\n *\n * Video.createLocalVideoTrack().then(function(videoTrack) {\n * const videoElement = videoTrack.attach();\n * document.body.appendChild(videoElement);\n * });\n */ /**\n * Attach the {@link VideoTrack} to an existing HTMLMediaElement. The\n * HTMLMediaElement could be an HTMLAudioElement or an HTMLVideoElement.\n *\n * If the HTMLMediaElement's srcObject is not set to a MediaStream,\n * this method sets it to a new MediaStream containing the {@link VideoTrack}'s\n * MediaStreamTrack; otherwise, it adds the {@link MediaTrack}'s\n * MediaStreamTrack to the existing MediaStream. Finally, if there are any other\n * MediaStreamTracks of the same kind on the MediaStream, this method removes\n * them.\n *\n * @param {HTMLMediaElement} mediaElement - The HTMLMediaElement to attach to\n * @returns {HTMLMediaElement} mediaElement\n * @example\n * const Video = require('twilio-video');\n *\n * const videoElement = document.createElement('video');\n * document.body.appendChild(videoElement);\n *\n * Video.createLocalVideoTrack().then(function(videoTrack) {\n * videoTrack.attach(videoElement);\n * });\n */ /**\n * Attach the {@link VideoTrack} to an HTMLMediaElement selected by\n * document.querySelector. The HTMLMediaElement could be an\n * HTMLAudioElement or an HTMLVideoElement.\n *\n * If the HTMLMediaElement's srcObject is not set to a MediaStream,\n * this method sets it to a new MediaStream containing the {@link VideoTrack}'s\n * MediaStreamTrack; otherwise, it adds the {@link VideoTrack}'s\n * MediaStreamTrack to the existing MediaStream. Finally, if there are any other\n * MediaStreamTracks of the same kind on the MediaStream, this method removes\n * them.\n *\n * @param {string} selector - A query selector for the HTMLMediaElement to\n * attach to\n * @returns {HTMLMediaElement} mediaElement\n * @example\n * const Video = require('twilio-video');\n *\n * const videoElement = document.createElement('video');\n * videoElement.id = 'my-video-element';\n * document.body.appendChild(videoElement);\n *\n * Video.createLocalVideoTrack().then(function(track) {\n * track.attach('#my-video-element');\n * });\n */\n VideoTrack.prototype.attach = function () {\n var result = _super.prototype.attach.apply(this, arguments);\n if (this.processor) {\n this._captureFrames();\n }\n return result;\n };\n /**\n * Detach the {@link VideoTrack} from all previously attached HTMLMediaElements.\n * @returns {Array} mediaElements\n * @example\n * const mediaElements = videoTrack.detach();\n * mediaElements.forEach(mediaElement => mediaElement.remove());\n */ /**\n * Detach the {@link VideoTrack} from a previously attached HTMLMediaElement.\n * @param {HTMLMediaElement} mediaElement - One of the HTMLMediaElements to\n * which the {@link VideoTrack} is attached\n * @returns {HTMLMediaElement} mediaElement\n * @example\n * const videoElement = document.getElementById('my-video-element');\n * videoTrack.detach(videoElement).remove();\n */ /**\n * Detach the {@link VideoTrack} from a previously attached HTMLMediaElement\n * specified by document.querySelector.\n * @param {string} selector - The query selector of HTMLMediaElement to which\n * the {@link VideoTrack} is attached\n * @returns {HTMLMediaElement} mediaElement\n * @example\n * videoTrack.detach('#my-video-element').remove();\n */\n VideoTrack.prototype.detach = function () {\n return _super.prototype.detach.apply(this, arguments);\n };\n /**\n * Remove the previously added {@link VideoProcessor} using `addProcessor` API.\n * @param {VideoProcessor} processor - The {@link VideoProcessor} to remove.\n * @returns {this}\n * @example\n * class GrayScaleProcessor {\n * constructor(percentage) {\n * this.percentage = percentage;\n * }\n * processFrame(inputFrameBuffer, outputFrameBuffer) {\n * const context = outputFrameBuffer.getContext('2d');\n * context.filter = `grayscale(${this.percentage}%)`;\n * context.drawImage(inputFrameBuffer, 0, 0, inputFrameBuffer.width, inputFrameBuffer.height);\n * }\n * }\n *\n * Video.createLocalVideoTrack().then(function(videoTrack) {\n * const grayScaleProcessor = new GrayScaleProcessor(100);\n * videoTrack.addProcessor(grayScaleProcessor);\n * document.getElementById('remove-button').onclick = () => videoTrack.removeProcessor(grayScaleProcessor);\n * });\n */\n VideoTrack.prototype.removeProcessor = function (processor) {\n if (!processor) {\n throw new Error('Received an invalid VideoProcessor from removeProcessor.');\n }\n if (!this.processor) {\n throw new Error('No existing VideoProcessor detected.');\n }\n if (processor !== this.processor) {\n throw new Error('The provided VideoProcessor is different than the existing one.');\n }\n this._processorEventObserver.emit('remove');\n this._log.debug('Removing VideoProcessor from the VideoTrack', processor);\n this._stopCapture();\n this._stopCapture = function () { };\n this.mediaStreamTrack.removeEventListener('unmute', this._unmuteHandler);\n this._processorOptions = {};\n this._unmuteHandler = null;\n this._isCapturing = false;\n this.processor = null;\n this.processedTrack = null;\n this._inputFrame = null;\n this._outputFrame = null;\n this._updateElementsMediaStreamTrack();\n return this;\n };\n return VideoTrack;\n}(MediaTrack));\nVideoTrack.DIMENSIONS_CHANGED = 'dimensionsChanged';\nfunction dimensionsChanged(track, elem) {\n return track.dimensions.width !== elem.videoWidth\n || track.dimensions.height !== elem.videoHeight;\n}\n/**\n * A {@link VideoTrack}'s width and height.\n * @typedef {object} VideoTrack.Dimensions\n * @property {?number} width - The {@link VideoTrack}'s width or null if the\n * {@link VideoTrack} has not yet started\n * @property {?number} height - The {@link VideoTrack}'s height or null if the\n * {@link VideoTrack} has not yet started\n */\n/**\n * A {@link VideoProcessor}, when added via {@link VideoTrack#addProcessor},\n * is used to process incoming video frames before\n * sending to the encoder or renderer.\n * @typedef {object} VideoProcessor\n * @property {function} processFrame - A callback to receive input and output frame buffers for processing.\n * The input frame buffer contains the original video frame which can be used for additional processing\n * such as applying filters to it. The output frame buffer is used to receive the processed video frame\n * before sending to the encoder or renderer.\n *\n * Any exception raised (either synchronously or asynchronously) in `processFrame` will result in the frame being dropped.\n * This callback has the following signature:

\n * processFrame(
\n *   inputFrameBuffer: OffscreenCanvas | HTMLCanvasElement | HTMLVideoElement | VideoFrame,
\n *   outputFrameBuffer: HTMLCanvasElement
\n * ): Promise<void> | void;\n *\n * @example\n * class GrayScaleProcessor {\n * constructor(percentage) {\n * this.percentage = percentage;\n * }\n * processFrame(inputFrameBuffer, outputFrameBuffer) {\n * const context = outputFrameBuffer.getContext('2d');\n * context.filter = `grayscale(${this.percentage}%)`;\n * context.drawImage(inputFrameBuffer, 0, 0, inputFrameBuffer.width, inputFrameBuffer.height);\n * }\n * }\n */\n/**\n * Possible options to provide to {@link LocalVideoTrack#addProcessor} and {@link RemoteVideoTrack#addProcessor}.\n * @typedef {object} AddProcessorOptions\n * @property {string} [inputFrameBufferType=\"offscreencanvas\"] - This option allows you to specify what kind of input you want to receive in your\n * Video Processor. The default is `offscreencanvas` and will fallback to a regular `canvas` if the browser does not support it.\n * Possible values include the following.\n *
\n *
\n * `videoframe` - Your Video Processor will receive a [VideoFrame](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame).\n * On browsers that do not support `VideoFrame`, it will receive an [HTMLVideoElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement) instead.\n *
\n *
\n * `offscreencanvas` - Your Video Processor will receive an [OffscreenCanvas](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas)\n * which is good for canvas-related processing that can be rendered off screen.\n *
\n *
\n * `canvas` - Your Video Processor will receive an [HTMLCanvasElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement).\n * This is recommended on browsers that doesn't support `OffscreenCanvas`, or if you need to render the frame on the screen.\n *
\n *
\n * `video` - Your Video Processor will receive an [HTMLVideoElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement).\n * Use this option if you are processing the frame using WebGL or if you only need to [draw](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage)\n * the frame directly to your output canvas.\n * @property {string} [outputFrameBufferContextType=\"2d\"] - The SDK needs the [context type](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext)\n * that your Video Processor uses in order to properly generate the processed track. For example, if your Video Processor uses WebGL2 (`canvas.getContext('webgl2')`),\n * you should set `outputFrameBufferContextType` to `webgl2`. If you're using Canvas 2D processing (`canvas.getContext('2d')`),\n * you should set `outputFrameBufferContextType` to `2d`. If the output frame is an [ImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap),\n * you should set `outputFrameBufferContextType` to `bitmaprenderer`.\n */\n/**\n * The {@link VideoTrack}'s dimensions changed.\n * @param {VideoTrack} track - The {@link VideoTrack} whose dimensions changed\n * @event VideoTrack#dimensionsChanged\n */\n/**\n * The {@link VideoTrack} was disabled, i.e. \"paused\".\n * @param {VideoTrack} track - The {@link VideoTrack} that was disabled\n * @event VideoTrack#disabled\n */\n/**\n * The {@link VideoTrack} was enabled, i.e. \"unpaused\".\n * @param {VideoTrack} track - The {@link VideoTrack} that was enabled\n * @event VideoTrack#enabled\n */\n/**\n * The {@link VideoTrack} started. This means there is enough video data to\n * begin playback.\n * @param {VideoTrack} track - The {@link VideoTrack} that started\n * @event VideoTrack#started\n */\nmodule.exports = VideoTrack;\n//# sourceMappingURL=videotrack.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar isIOS = require('../../util/browserdetection').isIOS;\nvar detectSilentVideo = require('../../util/detectsilentvideo');\nvar mixinLocalMediaTrack = require('./localmediatrack');\nvar VideoTrack = require('./videotrack');\nvar LocalMediaVideoTrack = mixinLocalMediaTrack(VideoTrack);\n/**\n * A {@link LocalVideoTrack} is a {@link VideoTrack} representing video that\n * your {@link LocalParticipant} can publish to a {@link Room}. It can be\n * enabled and disabled with {@link LocalVideoTrack#enable} and\n * {@link LocalVideoTrack#disable} or stopped completely with\n * {@link LocalVideoTrack#stop}.\n * @extends VideoTrack\n * @property {Track.ID} id - The {@link LocalVideoTrack}'s ID\n * @property {boolean} isMuted - Whether or not the video source has stopped sending frames to the\n * {@link LocalVideoTrack}; This can happen when the camera is taken over by another application,\n * mainly on mobile devices; When this property toggles, then muted and unmuted\n * events are fired appropriately\n * @property {boolean} isStopped - Whether or not the {@link LocalVideoTrack} is\n * stopped\n * @emits LocalVideoTrack#disabled\n * @emits LocalVideoTrack#enabled\n * @emits LocalVideoTrack#muted\n * @emits LocalVideoTrack#started\n * @emits LocalVideoTrack#stopped\n * @emits LocalVideoTrack#unmuted\n */\nvar LocalVideoTrack = /** @class */ (function (_super) {\n __extends(LocalVideoTrack, _super);\n /**\n * Construct a {@link LocalVideoTrack} from a MediaStreamTrack.\n * @param {MediaStreamTrack} mediaStreamTrack - The underlying MediaStreamTrack\n * @param {LocalTrackOptions} [options] - {@link LocalTrack} options\n */\n function LocalVideoTrack(mediaStreamTrack, options) {\n var _this = this;\n options = Object.assign({\n workaroundSilentLocalVideo: isIOS()\n && typeof document !== 'undefined'\n && typeof document.createElement === 'function'\n }, options);\n _this = _super.call(this, mediaStreamTrack, options) || this;\n Object.defineProperties(_this, {\n _workaroundSilentLocalVideo: {\n value: options.workaroundSilentLocalVideo\n ? workaroundSilentLocalVideo\n : null\n },\n _workaroundSilentLocalVideoCleanup: {\n value: null,\n writable: true\n }\n });\n // NOTE(mmalavalli): In iOS Safari, we work around a bug where local video\n // MediaStreamTracks are silent (even though they are enabled, live and unmuted)\n // after accepting/rejecting a phone call.\n if (_this._workaroundSilentLocalVideo) {\n _this._workaroundSilentLocalVideoCleanup = _this._workaroundSilentLocalVideo(_this, document);\n }\n return _this;\n }\n LocalVideoTrack.prototype.toString = function () {\n return \"[LocalVideoTrack #\" + this._instanceId + \": \" + this.id + \"]\";\n };\n /**\n * @private\n */\n LocalVideoTrack.prototype._checkIfCanCaptureFrames = function () {\n return _super.prototype._checkIfCanCaptureFrames.call(this, this._trackSender.isPublishing);\n };\n /**\n * @private\n */\n LocalVideoTrack.prototype._end = function () {\n return _super.prototype._end.apply(this, arguments);\n };\n /**\n * @private\n */\n LocalVideoTrack.prototype._setSenderMediaStreamTrack = function (useProcessed) {\n var _this = this;\n var unprocessedTrack = this.mediaStreamTrack;\n var mediaStreamTrack = useProcessed ? this.processedTrack : unprocessedTrack;\n return this._trackSender.setMediaStreamTrack(mediaStreamTrack)\n .catch(function (error) { return _this._log.warn('setMediaStreamTrack failed on LocalVideoTrack RTCRtpSender', { error: error, mediaStreamTrack: mediaStreamTrack }); })\n .then(function () {\n _this._unprocessedTrack = useProcessed ? unprocessedTrack : null;\n });\n };\n /**\n * Add a {@link VideoProcessor} to allow for custom processing of video frames belonging to a VideoTrack.\n * @param {VideoProcessor} processor - The {@link VideoProcessor} to use.\n * @param {AddProcessorOptions} [options] - {@link AddProcessorOptions} to provide.\n * @returns {this}\n * @example\n * class GrayScaleProcessor {\n * constructor(percentage) {\n * this.percentage = percentage;\n * }\n * processFrame(inputFrameBuffer, outputFrameBuffer) {\n * const context = outputFrameBuffer.getContext('2d');\n * context.filter = `grayscale(${this.percentage}%)`;\n * context.drawImage(inputFrameBuffer, 0, 0, inputFrameBuffer.width, inputFrameBuffer.height);\n * }\n * }\n *\n * const localVideoTrack = Array.from(room.localParticipant.videoTracks.values())[0].track;\n * localVideoTrack.addProcessor(new GrayScaleProcessor(100));\n */\n LocalVideoTrack.prototype.addProcessor = function () {\n this._log.debug('Adding VideoProcessor to the LocalVideoTrack');\n var result = _super.prototype.addProcessor.apply(this, arguments);\n if (!this.processedTrack) {\n return this._log.warn('Unable to add a VideoProcessor to the LocalVideoTrack');\n }\n this._log.debug('Updating LocalVideoTrack\\'s MediaStreamTrack with the processed MediaStreamTrack', this.processedTrack);\n this._setSenderMediaStreamTrack(true);\n return result;\n };\n /**\n * Remove the previously added {@link VideoProcessor} using `addProcessor` API.\n * @param {VideoProcessor} processor - The {@link VideoProcessor} to remove.\n * @returns {this}\n * @example\n * class GrayScaleProcessor {\n * constructor(percentage) {\n * this.percentage = percentage;\n * }\n * processFrame(inputFrameBuffer, outputFrameBuffer) {\n * const context = outputFrameBuffer.getContext('2d');\n * context.filter = `grayscale(${this.percentage}%)`;\n * context.drawImage(inputFrameBuffer, 0, 0, inputFrameBuffer.width, inputFrameBuffer.height);\n * }\n * }\n *\n * const localVideoTrack = Array.from(room.localParticipant.videoTracks.values())[0].track;\n * const grayScaleProcessor = new GrayScaleProcessor(100);\n * localVideoTrack.addProcessor(grayScaleProcessor);\n *\n * document.getElementById('remove-button').onclick = () => localVideoTrack.removeProcessor(grayScaleProcessor);\n */\n LocalVideoTrack.prototype.removeProcessor = function () {\n var _this = this;\n this._log.debug('Removing VideoProcessor from the LocalVideoTrack');\n var result = _super.prototype.removeProcessor.apply(this, arguments);\n this._log.debug('Updating LocalVideoTrack\\'s MediaStreamTrack with the original MediaStreamTrack');\n this._setSenderMediaStreamTrack()\n .then(function () { return _this._updateElementsMediaStreamTrack(); });\n return result;\n };\n /**\n * Disable the {@link LocalVideoTrack}. This is equivalent to pausing a video source.\n * If a {@link VideoProcessor} is added, then processedTrack is also disabled.\n * @returns {this}\n * @fires VideoTrack#disabled\n */\n LocalVideoTrack.prototype.disable = function () {\n var result = _super.prototype.disable.apply(this, arguments);\n if (this.processedTrack) {\n this.processedTrack.enabled = false;\n }\n return result;\n };\n /**\n * Enable the {@link LocalVideoTrack}. This is equivalent to unpausing the video source.\n * If a {@link VideoProcessor} is added, then processedTrack is also enabled.\n * @returns {this}\n * @fires VideoTrack#enabled\n */ /**\n * Enable or disable the {@link LocalVideoTrack}. This is equivalent to unpausing or pausing\n * the video source respectively. If a {@link VideoProcessor} is added, then processedTrack\n * is also enabled or disabled.\n * @param {boolean} [enabled] - Specify false to disable the\n * {@link LocalVideoTrack}\n * @returns {this}\n * @fires VideoTrack#disabled\n * @fires VideoTrack#enabled\n */\n LocalVideoTrack.prototype.enable = function (enabled) {\n if (enabled === void 0) { enabled = true; }\n var result = _super.prototype.enable.apply(this, arguments);\n if (this.processedTrack) {\n this.processedTrack.enabled = enabled;\n if (enabled) {\n this._captureFrames();\n this._log.debug('Updating LocalVideoTrack\\'s MediaStreamTrack with the processed MediaStreamTrack', this.processedTrack);\n this._setSenderMediaStreamTrack(true);\n }\n }\n return result;\n };\n /**\n * Restart the {@link LocalVideoTrack}. This stops the existing MediaStreamTrack\n * and creates a new MediaStreamTrack. If the {@link LocalVideoTrack} is being published\n * to a {@link Room}, then all the {@link RemoteParticipant}s will start receiving media\n * from the newly created MediaStreamTrack. You can access the new MediaStreamTrack via\n * the mediaStreamTrack property. If you want to listen to events on\n * the MediaStreamTrack directly, please do so in the \"started\" event handler. Also,\n * the {@link LocalVideoTrack}'s ID is no longer guaranteed to be the same as the\n * underlying MediaStreamTrack's ID.\n * @param {MediaTrackConstraints} [constraints] - The optional MediaTrackConstraints\n * for restarting the {@link LocalVideoTrack}; If not specified, then the current MediaTrackConstraints\n * will be used; If {} (empty object) is specified, then the default MediaTrackConstraints\n * will be used\n * @returns {Promise} Rejects with a TypeError if the {@link LocalVideoTrack} was not created\n * using an one of createLocalVideoTrack, createLocalTracks or connect;\n * Also rejects with the DOMException\n * raised by getUserMedia when it fails\n * @fires LocalVideoTrack#stopped\n * @fires LocalVideoTrack#started\n * @example\n * const { connect, createLocalVideoTrack } = require('twilio-video');\n *\n * // Create a LocalVideoTrack that captures video from the front-facing camera.\n * createLocalVideoTrack({ facingMode: 'user' }).then(function(localVideoTrack) {\n * return connect('token', {\n * name: 'my-cool-room',\n * tracks: [localVideoTrack]\n * });\n * }).then(function(room) {\n * // Restart the LocalVideoTrack to capture video from the back-facing camera.\n * const localVideoTrack = Array.from(room.localParticipant.videoTracks.values())[0].track;\n * return localVideoTrack.restart({ facingMode: 'environment' });\n * });\n */\n LocalVideoTrack.prototype.restart = function () {\n var _this = this;\n if (this._workaroundSilentLocalVideoCleanup) {\n this._workaroundSilentLocalVideoCleanup();\n this._workaroundSilentLocalVideoCleanup = null;\n }\n var promise = _super.prototype.restart.apply(this, arguments);\n if (this.processor) {\n promise.then(function () {\n _this._restartProcessor();\n });\n }\n if (this._workaroundSilentLocalVideo) {\n promise.finally(function () {\n _this._workaroundSilentLocalVideoCleanup = _this._workaroundSilentLocalVideo(_this, document);\n });\n }\n return promise;\n };\n /**\n * Calls stop on the underlying MediaStreamTrack. If you choose to stop a\n * {@link LocalVideoTrack}, you should unpublish it after stopping.\n * @returns {this}\n * @fires LocalVideoTrack#stopped\n */\n LocalVideoTrack.prototype.stop = function () {\n if (this._workaroundSilentLocalVideoCleanup) {\n this._workaroundSilentLocalVideoCleanup();\n this._workaroundSilentLocalVideoCleanup = null;\n }\n return _super.prototype.stop.apply(this, arguments);\n };\n return LocalVideoTrack;\n}(LocalMediaVideoTrack));\n/**\n * Work around a bug where local video MediaStreamTracks are silent (even though\n * they are enabled, live and unmuted) after accepting/rejecting a phone call.\n * @private\n * @param {LocalVideoTrack} localVideoTrack\n * @param {HTMLDocument} doc\n * @returns {function} Cleans up listeners attached by the workaround\n */\nfunction workaroundSilentLocalVideo(localVideoTrack, doc) {\n var log = localVideoTrack._log;\n var el = localVideoTrack._dummyEl, mediaStreamTrack = localVideoTrack.mediaStreamTrack;\n function onUnmute() {\n if (!localVideoTrack.isEnabled) {\n return;\n }\n log.info('Unmuted, checking silence');\n // The dummy element is paused, so play it and then detect silence.\n el.play().then(function () { return detectSilentVideo(el, doc); }).then(function (isSilent) {\n if (!isSilent) {\n log.info('Non-silent frames detected, so no need to restart');\n return;\n }\n log.warn('Silence detected, restarting');\n // NOTE(mmalavalli): If we try and restart a silent MediaStreamTrack\n // without stopping it first, then a NotReadableError is raised. Hence,\n // we stop the MediaStreamTrack here.\n localVideoTrack._stop();\n // Restart the LocalVideoTrack.\n // eslint-disable-next-line consistent-return\n return localVideoTrack._restart();\n }).catch(function (error) {\n log.warn('Failed to detect silence and restart:', error);\n }).finally(function () {\n // If silent frames were not detected, then pause the dummy element again,\n // if there is no processed track.\n el = localVideoTrack._dummyEl;\n if (el && !el.paused && !localVideoTrack.processedTrack) {\n el.pause();\n }\n // Reset the unmute handler.\n mediaStreamTrack.removeEventListener('unmute', onUnmute);\n mediaStreamTrack = localVideoTrack.mediaStreamTrack;\n mediaStreamTrack.addEventListener('unmute', onUnmute);\n });\n }\n // Set the unmute handler.\n mediaStreamTrack.addEventListener('unmute', onUnmute);\n return function () {\n mediaStreamTrack.removeEventListener('unmute', onUnmute);\n };\n}\n/**\n * The {@link LocalVideoTrack} was disabled, i.e. the video source was paused by the user.\n * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that was\n * disabled\n * @event LocalVideoTrack#disabled\n */\n/**\n * The {@link LocalVideoTrack} was enabled, i.e. the video source was unpaused by the user.\n * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that was enabled\n * @event LocalVideoTrack#enabled\n */\n/**\n * The {@link LocalVideoTrack} was muted because the video source stopped sending frames, most\n * likely due to another application taking said video source, especially on mobile devices.\n * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that was muted\n * @event LocalVideoTrack#muted\n */\n/**\n * The {@link LocalVideoTrack} started. This means there is enough video data\n * to begin playback.\n * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that started\n * @event LocalVideoTrack#started\n */\n/**\n * The {@link LocalVideoTrack} stopped, either because {@link LocalVideoTrack#stop}\n * or {@link LocalVideoTrack#restart} was called or because the underlying\n * MediaStreamTrack ended.\n * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that stopped\n * @event LocalVideoTrack#stopped\n */\n/**\n * The {@link LocalVideoTrack} was unmuted because the video source resumed sending frames,\n * most likely due to the application that took over the said video source has released it\n * back to the application, especially on mobile devices. This event is also fired when\n * {@link LocalVideoTrack#restart} is called on a muted {@link LocalVideoTrack} with a\n * new video source.\n * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that was unmuted\n * @event LocalVideoTrack#unmuted\n */\nmodule.exports = LocalVideoTrack;\n//# sourceMappingURL=localvideotrack.js.map","// eslint-disable-next-line no-warning-comments\n// TODO(mroberts): Remove this when we go to the next major version. This is\n// only in place so that we can support ES6 classes without requiring `new`.\n'use strict';\nvar inherits = require('../../../vendor/inherits');\nvar LocalVideoTrackClass = require('../localvideotrack');\nfunction LocalVideoTrack(mediaStreamTrack, options) {\n var track = new LocalVideoTrackClass(mediaStreamTrack, options);\n Object.setPrototypeOf(track, LocalVideoTrack.prototype);\n return track;\n}\ninherits(LocalVideoTrack, LocalVideoTrackClass);\nmodule.exports = LocalVideoTrack;\n//# sourceMappingURL=localvideotrack.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar TrackTransceiver = require('../transceiver');\n/**\n * A {@link DataTrackTransceiver} represents either one or more local\n * RTCDataChannels or a single remote RTCDataChannel. It can be used to send or\n * receive data.\n * @extends TrackTransceiver\n * @property {string} id\n * @property {string} kind - \"data\"\n * @property {?number} maxPacketLifeTime\n * @property {?number} maxRetransmits\n * @property {boolean} ordered\n */\nvar DataTrackTransceiver = /** @class */ (function (_super) {\n __extends(DataTrackTransceiver, _super);\n /**\n * Construct a {@link DataTrackTransceiver}.\n * @param {string} id\n * @param {?number} maxPacketLifeTime\n * @param {?number} maxRetransmits\n * @param {boolean} ordered\n */\n function DataTrackTransceiver(id, maxPacketLifeTime, maxRetransmits, ordered) {\n var _this = _super.call(this, id, 'data') || this;\n Object.defineProperties(_this, {\n maxPacketLifeTime: {\n enumerable: true,\n value: maxPacketLifeTime\n },\n maxRetransmits: {\n enumerable: true,\n value: maxRetransmits\n },\n ordered: {\n enumerable: true,\n value: ordered\n }\n });\n return _this;\n }\n return DataTrackTransceiver;\n}(TrackTransceiver));\nmodule.exports = DataTrackTransceiver;\n//# sourceMappingURL=transceiver.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar DataTrackTransceiver = require('./transceiver');\nvar makeUUID = require('../util').makeUUID;\n/**\n * A {@link DataTrackSender} represents a {@link DataTrackTransceiver} over\n * which data can be sent. Internally, it uses a collection of RTCDataChannels\n * to send data.\n * @extends DataTrackTransceiver\n */\nvar DataTrackSender = /** @class */ (function (_super) {\n __extends(DataTrackSender, _super);\n /**\n * Construct a {@link DataTrackSender}.\n * @param {?number} maxPacketLifeTime\n * @param {?number} maxRetransmits\n * @param {boolean} ordered\n */\n function DataTrackSender(maxPacketLifeTime, maxRetransmtis, ordered) {\n var _this = _super.call(this, makeUUID(), maxPacketLifeTime, maxRetransmtis, ordered) || this;\n Object.defineProperties(_this, {\n _clones: {\n value: new Set()\n },\n _dataChannels: {\n value: new Set()\n }\n });\n return _this;\n }\n /**\n * Add a cloned {@link DataTrackSender}.\n * @private\n * @returns {void}\n */\n DataTrackSender.prototype._addClone = function (clone) {\n this._clones.add(clone);\n };\n /**\n * Remove a cloned {@link DataTrackSender}.\n * @returns {void}\n */\n DataTrackSender.prototype.removeClone = function (clone) {\n this._clones.delete(clone);\n };\n /**\n * Add an RTCDataChannel to the {@link DataTrackSender}.\n * @param {RTCDataChannel} dataChannel\n * @returns {this}\n */\n DataTrackSender.prototype.addDataChannel = function (dataChannel) {\n this._dataChannels.add(dataChannel);\n return this;\n };\n /**\n * Return a new {@link DataTrackSender}. Any message sent over this\n * {@link DataTrackSender} will also be sent over the clone. Whenever this\n * {@link DataTrackSender} is stopped, so to will the clone.\n * @returns {DataTrackSender}\n */\n DataTrackSender.prototype.clone = function () {\n var _this = this;\n var clone = new DataTrackSender(this.maxPacketLifeTime, this.maxRetransmits, this.ordered);\n this._addClone(clone);\n clone.once('stopped', function () { return _this.removeClone(clone); });\n return clone;\n };\n /**\n * Remove an RTCDataChannel from the {@link DataTrackSender}.\n * @param {RTCDataChannel} dataChannel\n * @returns {this}\n */\n DataTrackSender.prototype.removeDataChannel = function (dataChannel) {\n this._dataChannels.delete(dataChannel);\n return this;\n };\n /**\n * Send data over the {@link DataTrackSender}. Internally, this calls\n * send over each of the underlying RTCDataChannels.\n * @param {string|Blob|ArrayBuffer|ArrayBufferView} data\n * @returns {this}\n */\n DataTrackSender.prototype.send = function (data) {\n this._dataChannels.forEach(function (dataChannel) {\n try {\n dataChannel.send(data);\n }\n catch (error) {\n // Do nothing.\n }\n });\n this._clones.forEach(function (clone) {\n try {\n clone.send(data);\n }\n catch (error) {\n // Do nothing.\n }\n });\n return this;\n };\n DataTrackSender.prototype.stop = function () {\n this._dataChannels.forEach(function (dataChannel) { return dataChannel.close(); });\n this._clones.forEach(function (clone) { return clone.stop(); });\n _super.prototype.stop.call(this);\n };\n return DataTrackSender;\n}(DataTrackTransceiver));\nmodule.exports = DataTrackSender;\n//# sourceMappingURL=sender.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Track = require('./');\nvar DefaultDataTrackSender = require('../../data/sender');\n/**\n * A {@link LocalDataTrack} is a {@link Track} representing data that your\n * {@link LocalParticipant} can publish to a {@link Room}.\n * @extends Track\n * @property {Track.ID} id - The {@link LocalDataTrack}'s ID\n * @property {Track.Kind} kind - \"data\"\n * @property {?number} maxPacketLifeTime - If non-null, this represents a time\n * limit (in milliseconds) during which the {@link LocalDataTrack} will send\n * or re-send data if not acknowledged on the underlying RTCDataChannel(s).\n * @property {?number} maxRetransmits - If non-null, this represents the number\n * of times the {@link LocalDataTrack} will resend data if not successfully\n * delivered on the underlying RTCDataChannel(s).\n * @property {boolean} ordered - true if data on the {@link LocalDataTrack} is\n * guaranteed to be sent in order.\n * @property {boolean} reliable - This is true if both\n * maxPacketLifeTime and maxRetransmits are set to\n * null. In other words, if this is true, there is no bound on packet lifetime\n * or the number of times the {@link LocalDataTrack} will attempt to send\n * data, ensuring \"reliable\" transmission.\n * @example\n * var Video = require('twilio-video');\n *\n * var localDataTrack = new Video.LocalDataTrack();\n * window.addEventListener('mousemove', function(event) {\n * localDataTrack.send(JSON.stringify({\n * x: e.clientX,\n * y: e.clientY\n * }));\n * });\n *\n * var token1 = getAccessToken();\n * Video.connect(token1, {\n * name: 'my-cool-room',\n * tracks: [localDataTrack]\n * });\n *\n * var token2 = getAccessToken();\n * Video.connect(token2, {\n * name: 'my-cool-room',\n * tracks: []\n * }).then(function(room) {\n * room.on('trackSubscribed', function(track) {\n * track.on('message', function(message) {\n * console.log(JSON.parse(message)); // { x: , y: }\n * });\n * });\n * });\n */\nvar LocalDataTrack = /** @class */ (function (_super) {\n __extends(LocalDataTrack, _super);\n /**\n * Construct a {@link LocalDataTrack}.\n * @param {LocalDataTrackOptions} [options] - {@link LocalDataTrack} options\n */\n function LocalDataTrack(options) {\n var _this = this;\n options = Object.assign({\n DataTrackSender: DefaultDataTrackSender,\n maxPacketLifeTime: null,\n maxRetransmits: null,\n ordered: true\n }, options);\n var DataTrackSender = options.DataTrackSender;\n var dataTrackSender = new DataTrackSender(options.maxPacketLifeTime, options.maxRetransmits, options.ordered);\n _this = _super.call(this, dataTrackSender.id, 'data', options) || this;\n Object.defineProperties(_this, {\n _trackSender: {\n value: dataTrackSender\n },\n id: {\n enumerable: true,\n value: dataTrackSender.id\n },\n maxPacketLifeTime: {\n enumerable: true,\n value: options.maxPacketLifeTime\n },\n maxRetransmits: {\n enumerable: true,\n value: options.maxRetransmits\n },\n ordered: {\n enumerable: true,\n value: options.ordered\n },\n reliable: {\n enumerable: true,\n value: options.maxPacketLifeTime === null\n && options.maxRetransmits === null\n }\n });\n return _this;\n }\n /**\n * Send a message over the {@link LocalDataTrack}.\n * @param {string|Blob|ArrayBuffer|ArrayBufferView} data\n * @returns {void}\n */\n LocalDataTrack.prototype.send = function (data) {\n this._trackSender.send(data);\n };\n return LocalDataTrack;\n}(Track));\n/**\n * {@link LocalDataTrack} options\n * @typedef {LocalTrackOptions} LocalDataTrackOptions\n * @property {?number} [maxPacketLifeTime=null] - Set this to limit the time\n * (in milliseconds) during which the LocalDataTrack will send or re-send data\n * if not successfully delivered on the underlying RTCDataChannel(s). It is an\n * error to specify both this and maxRetransmits.\n * @property {?number} [maxRetransmits=null] - Set this to limit the number of\n * times the {@link LocalDataTrack} will send or re-send data if not\n * acknowledged on the underlying RTCDataChannel(s). It is an error to specify\n * both this and maxPacketLifeTime.\n * @property {boolean} [ordered=true] - Set this to false to allow data on the\n * LocalDataTrack to be sent out-of-order.\n */\nmodule.exports = LocalDataTrack;\n//# sourceMappingURL=localdatatrack.js.map","// eslint-disable-next-line no-warning-comments\n// TODO(mroberts): Remove this when we go to the next major version. This is\n// only in place so that we can support ES6 classes without requiring `new`.\n'use strict';\nvar inherits = require('../../../vendor/inherits');\nvar LocalDataTrackClass = require('../localdatatrack');\nfunction LocalDataTrack(options) {\n var track = new LocalDataTrackClass(options);\n Object.setPrototypeOf(track, LocalDataTrack.prototype);\n return track;\n}\ninherits(LocalDataTrack, LocalDataTrackClass);\nmodule.exports = LocalDataTrack;\n//# sourceMappingURL=localdatatrack.js.map","'use strict';\nmodule.exports = {\n LocalAudioTrack: require('./localaudiotrack'),\n LocalVideoTrack: require('./localvideotrack'),\n LocalDataTrack: require('./localdatatrack')\n};\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-explicit-any */\n'use strict';\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createLocalTracks = void 0;\nvar noisecancellationimpl_1 = require(\"./media/track/noisecancellationimpl\");\nvar buildLogLevels = require('./util').buildLogLevels;\nvar _a = require('./webrtc'), getUserMedia = _a.getUserMedia, MediaStreamTrack = _a.MediaStreamTrack;\nvar _b = require('./media/track/es5'), LocalAudioTrack = _b.LocalAudioTrack, LocalDataTrack = _b.LocalDataTrack, LocalVideoTrack = _b.LocalVideoTrack;\nvar Log = require('./util/log');\nvar _c = require('./util/constants'), DEFAULT_LOG_LEVEL = _c.DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME = _c.DEFAULT_LOGGER_NAME, INVALID_VALUE = _c.typeErrors.INVALID_VALUE;\nvar workaround180748 = require('./webaudio/workaround180748');\n// This is used to make out which createLocalTracks() call a particular Log\n// statement belongs to. Each call to createLocalTracks() increments this\n// counter.\nvar createLocalTrackCalls = 0;\n/**\n * Request {@link LocalTrack}s. By default, it requests a\n * {@link LocalAudioTrack} and a {@link LocalVideoTrack}.\n * Note that on mobile browsers, the camera can be reserved by only one {@link LocalVideoTrack}\n * at any given time. If you attempt to create a second {@link LocalVideoTrack}, video frames\n * will no longer be supplied to the first {@link LocalVideoTrack}.\n * @alias module:twilio-video.createLocalTracks\n * @param {CreateLocalTracksOptions} [options]\n * @returns {Promise>}\n * @example\n * var Video = require('twilio-video');\n * // Request audio and video tracks\n * Video.createLocalTracks().then(function(localTracks) {\n * var localMediaContainer = document.getElementById('local-media-container-id');\n * localTracks.forEach(function(track) {\n * localMediaContainer.appendChild(track.attach());\n * });\n * });\n * @example\n * var Video = require('twilio-video');\n * // Request just the default audio track\n * Video.createLocalTracks({ audio: true }).then(function(localTracks) {\n * return Video.connect('my-token', {\n * name: 'my-cool-room',\n * tracks: localTracks\n * });\n * });\n * @example\n * var Video = require('twilio-video');\n * // Request the audio and video tracks with custom names\n * Video.createLocalTracks({\n * audio: { name: 'microphone' },\n * video: { name: 'camera' }\n * }).then(function(localTracks) {\n * localTracks.forEach(function(localTrack) {\n * console.log(localTrack.name);\n * });\n * });\n *\n * @example\n * var Video = require('twilio-video');\n * var localTracks;\n *\n * // Pre-acquire tracks to display camera preview.\n * Video.createLocalTracks().then(function(tracks) {\n * localTracks = tracks;\n * var localVideoTrack = localTracks.find(track => track.kind === 'video');\n * divContainer.appendChild(localVideoTrack.attach());\n * })\n *\n * // Later, join the Room with the pre-acquired LocalTracks.\n * Video.connect('token', {\n * name: 'my-cool-room',\n * tracks: localTracks\n * });\n *\n */\nfunction createLocalTracks(options) {\n return __awaiter(this, void 0, void 0, function () {\n var isAudioVideoAbsent, fullOptions, logComponentName, logLevels, log, localTrackOptions, extraLocalTrackOptions, noiseCancellationOptions, mediaStreamConstraints, workaroundWebKitBug180748, mediaStream, mediaStreamTracks, error_1;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n isAudioVideoAbsent = !(options && ('audio' in options || 'video' in options));\n fullOptions = __assign({ audio: isAudioVideoAbsent, getUserMedia: getUserMedia, loggerName: DEFAULT_LOGGER_NAME, logLevel: DEFAULT_LOG_LEVEL, LocalAudioTrack: LocalAudioTrack,\n LocalDataTrack: LocalDataTrack,\n LocalVideoTrack: LocalVideoTrack,\n MediaStreamTrack: MediaStreamTrack,\n Log: Log, video: isAudioVideoAbsent }, options);\n logComponentName = \"[createLocalTracks #\" + ++createLocalTrackCalls + \"]\";\n logLevels = buildLogLevels(fullOptions.logLevel);\n log = new fullOptions.Log('default', logComponentName, logLevels, fullOptions.loggerName);\n localTrackOptions = Object.assign({ log: log }, fullOptions);\n // NOTE(mmalavalli): The Room \"name\" in \"options\" was being used\n // as the LocalTrack name in asLocalTrack(). So we pass a copy of\n // \"options\" without the \"name\".\n // NOTE(joma): CreateLocalTracksOptions type does not really have a \"name\" property when used publicly by customers.\n // But we are passing this property when used internally by other JS files.\n // We can update this \"any\" type once those JS files are converted to TS.\n delete localTrackOptions.name;\n if (fullOptions.audio === false && fullOptions.video === false) {\n log.info('Neither audio nor video requested, so returning empty LocalTracks');\n return [2 /*return*/, []];\n }\n if (fullOptions.tracks) {\n log.info('Adding user-provided LocalTracks');\n log.debug('LocalTracks:', fullOptions.tracks);\n return [2 /*return*/, fullOptions.tracks];\n }\n extraLocalTrackOptions = {\n audio: typeof fullOptions.audio === 'object' && fullOptions.audio.name\n ? { name: fullOptions.audio.name }\n : { defaultDeviceCaptureMode: 'auto' },\n video: typeof fullOptions.video === 'object' && fullOptions.video.name\n ? { name: fullOptions.video.name }\n : {}\n };\n extraLocalTrackOptions.audio.isCreatedByCreateLocalTracks = true;\n extraLocalTrackOptions.video.isCreatedByCreateLocalTracks = true;\n if (typeof fullOptions.audio === 'object') {\n if (typeof fullOptions.audio.workaroundWebKitBug1208516 === 'boolean') {\n extraLocalTrackOptions.audio.workaroundWebKitBug1208516 = fullOptions.audio.workaroundWebKitBug1208516;\n }\n if ('noiseCancellationOptions' in fullOptions.audio) {\n noiseCancellationOptions = fullOptions.audio.noiseCancellationOptions;\n delete fullOptions.audio.noiseCancellationOptions;\n }\n if (!('defaultDeviceCaptureMode' in fullOptions.audio)) {\n extraLocalTrackOptions.audio.defaultDeviceCaptureMode = 'auto';\n }\n else if (['auto', 'manual'].every(function (mode) { return mode !== fullOptions.audio.defaultDeviceCaptureMode; })) {\n // eslint-disable-next-line new-cap\n throw INVALID_VALUE('CreateLocalAudioTrackOptions.defaultDeviceCaptureMode', ['auto', 'manual']);\n }\n else {\n extraLocalTrackOptions.audio.defaultDeviceCaptureMode = fullOptions.audio.defaultDeviceCaptureMode;\n }\n }\n if (typeof fullOptions.video === 'object' && typeof fullOptions.video.workaroundWebKitBug1208516 === 'boolean') {\n extraLocalTrackOptions.video.workaroundWebKitBug1208516 = fullOptions.video.workaroundWebKitBug1208516;\n }\n if (typeof fullOptions.audio === 'object') {\n delete fullOptions.audio.name;\n }\n if (typeof fullOptions.video === 'object') {\n delete fullOptions.video.name;\n }\n mediaStreamConstraints = {\n audio: fullOptions.audio,\n video: fullOptions.video\n };\n workaroundWebKitBug180748 = typeof fullOptions.audio === 'object' && fullOptions.audio.workaroundWebKitBug180748;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 4, , 5]);\n return [4 /*yield*/, (workaroundWebKitBug180748\n ? workaround180748(log, fullOptions.getUserMedia, mediaStreamConstraints)\n : fullOptions.getUserMedia(mediaStreamConstraints))];\n case 2:\n mediaStream = _a.sent();\n mediaStreamTracks = __spreadArray(__spreadArray([], __read(mediaStream.getAudioTracks())), __read(mediaStream.getVideoTracks()));\n log.info('Call to getUserMedia successful; got tracks:', mediaStreamTracks);\n return [4 /*yield*/, Promise.all(mediaStreamTracks.map(function (mediaStreamTrack) { return __awaiter(_this, void 0, void 0, function () {\n var _a, cleanTrack, noiseCancellation;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!(mediaStreamTrack.kind === 'audio' && noiseCancellationOptions)) return [3 /*break*/, 2];\n return [4 /*yield*/, noisecancellationimpl_1.applyNoiseCancellation(mediaStreamTrack, noiseCancellationOptions, log)];\n case 1:\n _a = _b.sent(), cleanTrack = _a.cleanTrack, noiseCancellation = _a.noiseCancellation;\n return [2 /*return*/, new localTrackOptions.LocalAudioTrack(cleanTrack, __assign(__assign(__assign({}, extraLocalTrackOptions.audio), localTrackOptions), { noiseCancellation: noiseCancellation }))];\n case 2:\n if (mediaStreamTrack.kind === 'audio') {\n return [2 /*return*/, new localTrackOptions.LocalAudioTrack(mediaStreamTrack, __assign(__assign({}, extraLocalTrackOptions.audio), localTrackOptions))];\n }\n _b.label = 3;\n case 3: return [2 /*return*/, new localTrackOptions.LocalVideoTrack(mediaStreamTrack, __assign(__assign({}, extraLocalTrackOptions.video), localTrackOptions))];\n }\n });\n }); }))];\n case 3: return [2 /*return*/, _a.sent()];\n case 4:\n error_1 = _a.sent();\n log.warn('Call to getUserMedia failed:', error_1);\n throw error_1;\n case 5: return [2 /*return*/];\n }\n });\n });\n}\nexports.createLocalTracks = createLocalTracks;\n//# sourceMappingURL=createlocaltracks.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Timer = void 0;\nvar Timer = /** @class */ (function () {\n function Timer() {\n // eslint-disable-next-line no-undefined\n this._end = undefined;\n this.start();\n }\n Timer.prototype.start = function () {\n this._start = Date.now();\n return this;\n };\n Timer.prototype.stop = function () {\n this._end = Date.now();\n return this;\n };\n Timer.prototype.getTimeMeasurement = function () {\n return {\n start: this._start,\n end: this._end,\n // eslint-disable-next-line no-undefined\n duration: this._end === undefined ? undefined : this._end - this._start\n };\n };\n return Timer;\n}());\nexports.Timer = Timer;\n//# sourceMappingURL=timer.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.mosToScore = exports.calculateMOS = void 0;\nvar r0 = 94.768; // Constant used in computing \"rFactor\".\n// copied from https://code.hq.twilio.com/client/sdk-frd/blob/master/voice/voice-mos-calculation.md\nfunction calculateMOS(rtt, jitter, fractionLost) {\n // Compute the effective latency.\n var effectiveLatency = rtt + (jitter * 2) + 10;\n // Compute the initial \"rFactor\" from effective latency.\n var rFactor = 0;\n switch (true) {\n case effectiveLatency < 160:\n rFactor = r0 - (effectiveLatency / 40);\n break;\n case effectiveLatency < 1000:\n rFactor = r0 - ((effectiveLatency - 120) / 10);\n break;\n }\n // Adjust \"rFactor\" with the fraction of packets lost.\n switch (true) {\n case fractionLost <= (rFactor / 2.5):\n rFactor = Math.max(rFactor - fractionLost * 2.5, 6.52);\n break;\n default:\n rFactor = 0;\n break;\n }\n // Compute MOS from \"rFactor\".\n var mos = 1 +\n (0.035 * rFactor) +\n (0.000007 * rFactor) *\n (rFactor - 60) *\n (100 - rFactor);\n return mos;\n}\nexports.calculateMOS = calculateMOS;\nfunction mosToScore(mosValue) {\n var score = 0;\n if (!mosValue) {\n score = 0;\n }\n else if (mosValue > 4.2) {\n score = 5;\n }\n else if (mosValue > 4.0) {\n score = 4;\n }\n else if (mosValue > 3.6) {\n score = 3;\n }\n else if (mosValue > 3) {\n score = 2;\n }\n else {\n score = 1;\n }\n return score;\n}\nexports.mosToScore = mosToScore;\n//# sourceMappingURL=mos.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getCombinedConnectionStats = void 0;\nfunction getStatValues(report, statName, kind, reportTypes) {\n var results = [];\n report.forEach(function (stat) {\n if ((reportTypes.length === 0 || reportTypes.includes(stat.type)) &&\n (kind.length === 0 || kind.includes(stat.kind)) &&\n typeof stat[statName] === 'number') {\n results.push(stat[statName]);\n }\n });\n return results;\n}\nfunction getCombinedConnectionStats(_a) {\n var publisher = _a.publisher, subscriber = _a.subscriber;\n return __awaiter(this, void 0, void 0, function () {\n var _b, publisherStats, subscriberStats, timestamps, timestamp, jitter, packets, packetsLost, trackRoundTripTime, currentRoundTripTime, roundTripTime, bytesSent, bytesReceived, selectedIceCandidatePairStats, iceCandidateStats;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0: return [4 /*yield*/, Promise.all([publisher, subscriber].map(function (pc) { return pc.getStats(); }))];\n case 1:\n _b = __read.apply(void 0, [_c.sent(), 2]), publisherStats = _b[0], subscriberStats = _b[1];\n timestamps = getStatValues(subscriberStats, 'timestamp', ['audio'], ['inbound-rtp']);\n timestamp = timestamps.length > 0 ? timestamps[0] : 0;\n jitter = getStatValues(subscriberStats, 'jitter', ['audio'], ['inbound-rtp']).reduce(function (a, b) { return Math.max(a, b); }, 0);\n packets = getStatValues(subscriberStats, 'packetsReceived', ['audio', 'video'], ['inbound-rtp']).reduce(function (a, b) { return a + b; }, 0);\n packetsLost = getStatValues(subscriberStats, 'packetsLost', ['audio', 'video'], ['inbound-rtp']).reduce(function (a, b) { return a + b; }, 0);\n trackRoundTripTime = getStatValues(publisherStats, 'roundTripTime', ['audio', 'video'], ['remote-inbound-rtp']).reduce(function (a, b) { return Math.max(a, b); }, 0);\n currentRoundTripTime = getStatValues(subscriberStats, 'currentRoundTripTime', [], ['candidate-pair']).reduce(function (a, b) { return Math.max(a, b); }, 0);\n roundTripTime = (currentRoundTripTime || trackRoundTripTime) * 1000;\n bytesSent = getStatValues(publisherStats, 'bytesSent', [], ['candidate-pair']).reduce(function (a, b) { return a + b; }, 0);\n bytesReceived = getStatValues(subscriberStats, 'bytesReceived', [], ['candidate-pair']).reduce(function (a, b) { return a + b; }, 0);\n selectedIceCandidatePairStats = extractSelectedActiveCandidatePair(subscriberStats);\n iceCandidateStats = [];\n subscriberStats.forEach(function (stat) {\n if (stat.type === 'local-candidate' || stat.type === 'remote-candidate') {\n iceCandidateStats.push(makeStandardCandidateStats(stat));\n }\n });\n return [2 /*return*/, { timestamp: timestamp, jitter: jitter, packets: packets, packetsLost: packetsLost, roundTripTime: roundTripTime, bytesSent: bytesSent, bytesReceived: bytesReceived, selectedIceCandidatePairStats: selectedIceCandidatePairStats, iceCandidateStats: iceCandidateStats }];\n }\n });\n });\n}\nexports.getCombinedConnectionStats = getCombinedConnectionStats;\nfunction makeStandardCandidateStats(input) {\n var standardizedCandidateStatsKeys = [\n { key: 'transportId', type: 'string' },\n { key: 'candidateType', type: 'string' },\n { key: 'port', altKeys: ['portNumber'], type: 'number' },\n { key: 'address', altKeys: ['ip', 'ipAddress'], type: 'string' },\n { key: 'priority', type: 'number' },\n { key: 'protocol', altKeys: ['transport'], type: 'string' },\n { key: 'url', type: 'string' },\n { key: 'relayProtocol', type: 'string' },\n ];\n return standardizedCandidateStatsKeys.reduce(function (report, keyInfo) {\n var keysToLookFor = [keyInfo.key];\n if (keyInfo.altKeys) {\n keysToLookFor = keysToLookFor.concat(keyInfo.altKeys);\n }\n var key = keysToLookFor.find(function (key) { return key in input; });\n if (key && typeof input[key] === keyInfo.type) {\n report[keyInfo.key] = input[key];\n }\n return report;\n }, {});\n}\nfunction extractSelectedActiveCandidatePair(stats) {\n var selectedCandidatePairId = null;\n var candidatePairs = [];\n stats.forEach(function (stat) {\n if (stat.type === 'transport' && stat.selectedCandidatePairId) {\n selectedCandidatePairId = stat.selectedCandidatePairId;\n }\n else if (stat.type === 'candidate-pair') {\n candidatePairs.push(stat);\n }\n });\n var activeCandidatePairStatsFound = candidatePairs.find(function (pair) {\n // Firefox\n return pair.selected ||\n // Spec-compliant way\n (selectedCandidatePairId && pair.id === selectedCandidatePairId);\n });\n if (!activeCandidatePairStatsFound) {\n return null;\n }\n var activeCandidatePairStats = activeCandidatePairStatsFound;\n var activeLocalCandidateStats = stats.get(activeCandidatePairStats.localCandidateId);\n var activeRemoteCandidateStats = stats.get(activeCandidatePairStats.remoteCandidateId);\n if (!activeLocalCandidateStats || !activeRemoteCandidateStats) {\n return null;\n }\n return {\n localCandidate: makeStandardCandidateStats(activeLocalCandidateStats),\n remoteCandidate: makeStandardCandidateStats(activeRemoteCandidateStats)\n };\n}\n//# sourceMappingURL=getCombinedConnectionStats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar EventEmitter = require('events').EventEmitter;\nvar util = require('./util');\n/**\n * {@link StateMachine} represents a state machine. The state machine supports a\n * reentrant locking mechanism to allow asynchronous state transitions to ensure\n * they have not been preempted. Calls to {@link StateMachine#takeLock} are\n * guaranteed to be resolved in FIFO order.\n * @extends EventEmitter\n * @property {boolean} isLocked - whether or not the {@link StateMachine} is\n * locked performing asynchronous state transition\n * @property {string} state - the current state\n * @emits {@link StateMachine#stateChanged}\n */\nvar StateMachine = /** @class */ (function (_super) {\n __extends(StateMachine, _super);\n /**\n * Construct a {@link StateMachine}.\n * @param {string} initialState - the intiial state\n * @param {object} states\n */\n function StateMachine(initialState, states) {\n var _this = _super.call(this) || this;\n var lock = null;\n var state = initialState;\n states = transformStates(states);\n Object.defineProperties(_this, {\n _lock: {\n get: function () {\n return lock;\n },\n set: function (_lock) {\n lock = _lock;\n }\n },\n _reachableStates: {\n value: reachable(states)\n },\n _state: {\n get: function () {\n return state;\n },\n set: function (_state) {\n state = _state;\n }\n },\n _states: {\n value: states\n },\n _whenDeferreds: {\n value: new Set()\n },\n isLocked: {\n enumerable: true,\n get: function () {\n return lock !== null;\n }\n },\n state: {\n enumerable: true,\n get: function () {\n return state;\n }\n }\n });\n _this.on('stateChanged', function (state) {\n _this._whenDeferreds.forEach(function (deferred) {\n deferred.when(state, deferred.resolve, deferred.reject);\n });\n });\n return _this;\n }\n /**\n * Returns a promise whose executor function is called on each state change.\n * @param {function(state: string, resolve: function, reject: function): void} when\n * @returns {Promise.<*>}\n * @private\n */\n StateMachine.prototype._whenPromise = function (when) {\n var _this = this;\n if (typeof when !== 'function') {\n return Promise.reject(new Error('when() executor must be a function'));\n }\n var deferred = util.defer();\n deferred.when = when;\n this._whenDeferreds.add(deferred);\n return deferred.promise.then(function (payload) {\n _this._whenDeferreds.delete(deferred);\n return payload;\n }, function (error) {\n _this._whenDeferreds.delete(deferred);\n throw error;\n });\n };\n /**\n * This method takes a lock and passes the {@link StateMachine#Key} to your\n * transition function. You may perform zero or more state transitions in your\n * transition function, but you should check for preemption in each tick. You\n * may also reenter the lock. Once the Promise returned by your transition\n * function resolves or rejects, this method releases the lock it acquired for\n * you.\n * @param {string} name - a name for the lock\n * @param {function(StateMachine#Key): Promise} transitionFunction\n * @returns {Promise}\n */\n // NOTE(mroberts): This method is named after a Haskell function:\n // https://hackage.haskell.org/package/base-4.8.2.0/docs/Control-Exception.html#v:bracket\n StateMachine.prototype.bracket = function (name, transitionFunction) {\n var key;\n var self = this;\n function releaseLock(error) {\n if (self.hasLock(key)) {\n self.releaseLockCompletely(key);\n }\n if (error) {\n throw error;\n }\n }\n return this.takeLock(name).then(function gotKey(_key) {\n key = _key;\n return transitionFunction(key);\n }).then(function success(result) {\n releaseLock();\n return result;\n }, releaseLock);\n };\n /**\n * Check whether or not a {@link StateMachine#Key} matches the lock.\n * @param {StateMachine#Key} key\n * @returns {boolean}\n */\n StateMachine.prototype.hasLock = function (key) {\n return this._lock === key;\n };\n /**\n * Preempt any pending state transitions and immediately transition to the new\n * state. If a lock name is specified, take the lock and return the\n * {@link StateMachine#Key}.\n * @param {string} newState\n * @param {?string} [name=null] - a name for the lock\n * @param {Array<*>} [payload=[]]\n * @returns {?StateMachine#Key}\n */\n StateMachine.prototype.preempt = function (newState, name, payload) {\n // 1. Check that the new state is valid.\n if (!isValidTransition(this._states, this.state, newState)) {\n throw new Error(\"Cannot transition from \\\"\" + this.state + \"\\\" to \\\"\" + newState + \"\\\"\");\n }\n // 2. Release the old lock, if any.\n var oldLock;\n if (this.isLocked) {\n oldLock = this._lock;\n this._lock = null;\n }\n // 3. Take the lock, if requested.\n var key = null;\n if (name) {\n key = this.takeLockSync(name);\n }\n // 4. If a lock wasn't requested, take a \"preemption\" lock in order to\n // maintain FIFO order of those taking locks.\n var preemptionKey = key ? null : this.takeLockSync('preemption');\n // 5. Transition.\n this.transition(newState, key || preemptionKey, payload);\n // 6. Preempt anyone blocked on the old lock.\n if (oldLock) {\n oldLock.resolve();\n }\n // 7. Release the \"preemption\" lock, if we took it.\n if (preemptionKey) {\n this.releaseLock(preemptionKey);\n }\n return key;\n };\n /**\n * Release a lock. This method succeeds only if the {@link StateMachine} is\n * still locked and has not been preempted.\n * @param {StateMachine#Key} key\n * @throws Error\n */\n StateMachine.prototype.releaseLock = function (key) {\n if (!this.isLocked) {\n throw new Error(\"Could not release the lock for \" + key.name + \" because the StateMachine is not locked\");\n }\n else if (!this.hasLock(key)) {\n throw new Error(\"Could not release the lock for \" + key.name + \" because \" + this._lock.name + \" has the lock\");\n }\n if (key.depth === 0) {\n this._lock = null;\n key.resolve();\n }\n else {\n key.depth--;\n }\n };\n /**\n * Release a lock completely, even if it has been reentered. This method\n * succeeds only if the {@link StateMachine} is still locked and has not been\n * preempted.\n * @param {StateMachine#Key} key\n * @throws Error\n */\n StateMachine.prototype.releaseLockCompletely = function (key) {\n if (!this.isLocked) {\n throw new Error(\"Could not release the lock for \" + key.name + \" because the StateMachine is not locked\");\n }\n else if (!this.hasLock(key)) {\n throw new Error(\"Could not release the lock for \" + key.name + \" because \" + this._lock.name + \" has the lock\");\n }\n key.depth = 0;\n this._lock = null;\n key.resolve();\n };\n /**\n * Take a lock, returning a Promise for the {@link StateMachine#Key}. You should\n * take a lock anytime you intend to perform asynchronous transitions. Calls to\n * this method are guaranteed to be resolved in FIFO order. You may reenter\n * a lock by passing its {@link StateMachine#Key}.\n * @param {string|StateMachine#Key} nameOrKey - a name for the lock or an\n * existing {@link StateMachine#Key}\n * @returns {Promise}\n */\n StateMachine.prototype.takeLock = function (nameOrKey) {\n var _this = this;\n // Reentrant lock\n if (typeof nameOrKey === 'object') {\n var key_1 = nameOrKey;\n return new Promise(function (resolve) {\n resolve(_this.takeLockSync(key_1));\n });\n }\n // New lock\n var name = nameOrKey;\n if (this.isLocked) {\n var takeLock = this.takeLock.bind(this, name);\n return this._lock.promise.then(takeLock);\n }\n return Promise.resolve(this.takeLockSync(name));\n };\n /**\n * Take a lock, returning the {@Link StateMachine#Key}. This method throws if\n * the {@link StateMachine} is locked or the wrong {@link StateMachine#Key} is\n * provided. You may reenter a lock by passing its {@link StateMachine#Key}.\n * @param {string|StateMachine#Key} nameOrKey - a name for the lock or an\n * existing {@link StateMachine#Key}\n * @returns {object}\n * @throws Error\n */\n StateMachine.prototype.takeLockSync = function (nameOrKey) {\n var key = typeof nameOrKey === 'string' ? null : nameOrKey;\n var name = key ? key.name : nameOrKey;\n if (key && !this.hasLock(key) || !key && this.isLocked) {\n throw new Error(\"Could not take the lock for \" + name + \" because the lock for \" + this._lock.name + \" was not released\");\n }\n // Reentrant lock\n if (key) {\n key.depth++;\n return key;\n }\n // New lock\n var lock = makeLock(name);\n this._lock = lock;\n return lock;\n };\n /**\n * Transition to a new state. If the {@link StateMachine} is locked, you must\n * provide the {@link StateMachine#Key}. An invalid state or the wrong\n * {@link StateMachine#Key} will throw an error.\n * @param {string} newState\n * @param {?StateMachine#Key} [key=null]\n * @param {Array<*>} [payload=[]]\n * @throws {Error}\n */\n StateMachine.prototype.transition = function (newState, key, payload) {\n payload = payload || [];\n // 1. If we're locked, required the key.\n if (this.isLocked) {\n if (!key) {\n throw new Error('You must provide the key in order to ' +\n 'transition');\n }\n else if (!this.hasLock(key)) {\n throw new Error(\"Could not transition using the key for \" + key.name + \" because \" + this._lock.name + \" has the lock\");\n }\n }\n else if (key) {\n throw new Error(\"Key provided for \" + key.name + \", but the StateMachine was not locked (possibly due to preemption)\");\n }\n // 2. Check that the new state is valid.\n if (!isValidTransition(this._states, this.state, newState)) {\n throw new Error(\"Cannot transition from \\\"\" + this.state + \"\\\" to \\\"\" + newState + \"\\\"\");\n }\n // 3. Update the state and emit an event.\n this._state = newState;\n this.emit.apply(this, __spreadArray([], __read(['stateChanged', newState].concat(payload))));\n };\n /**\n * Attempt to transition to a new state. Unlike {@link StateMachine#transition},\n * this method does not throw.\n * @param {string} newState\n * @param {?StateMachine#Key} [key=null]\n * @param {Array<*>} [payload=[]]\n * @returns {boolean}\n */\n StateMachine.prototype.tryTransition = function (newState, key, payload) {\n try {\n this.transition(newState, key, payload);\n }\n catch (error) {\n return false;\n }\n return true;\n };\n /**\n * Return a Promise that resolves when the {@link StateMachine} transitions to\n * the specified state. If the {@link StateMachine} transitions such that the\n * requested state becomes unreachable, the Promise rejects.\n * @param {string} state\n * @returns {Promise}\n */\n StateMachine.prototype.when = function (state) {\n var _this = this;\n if (this.state === state) {\n return Promise.resolve(this);\n }\n else if (!isValidTransition(this._reachableStates, this.state, state)) {\n return Promise.reject(createUnreachableError(this.state, state));\n }\n return this._whenPromise(function (newState, resolve, reject) {\n if (newState === state) {\n resolve(_this);\n }\n else if (!isValidTransition(_this._reachableStates, newState, state)) {\n reject(createUnreachableError(newState, state));\n }\n });\n };\n return StateMachine;\n}(EventEmitter));\n/**\n * @event StateMachine#stateChanged\n * @param {string} newState\n */\n/**\n * Check if a transition is valid.\n * @private\n * @param {Map<*, Set<*>>} graph\n * @param {*} from\n * @param {*} to\n * @returns {boolean}\n */\nfunction isValidTransition(graph, from, to) {\n return graph.get(from).has(to);\n}\n/**\n * @typedef {object} StateMachine#Key\n */\nfunction makeLock(name) {\n var lock = util.defer();\n lock.name = name;\n lock.depth = 0;\n return lock;\n}\n/**\n * Compute the transitive closure of a graph (i.e. what nodes are reachable from\n * where).\n * @private\n * @param {Map<*, Set<*>>} graph\n * @returns {Map<*, Set<*>>}\n */\nfunction reachable(graph) {\n return Array.from(graph.keys()).reduce(function (newGraph, from) { return newGraph.set(from, reachableFrom(graph, from)); }, new Map());\n}\n/**\n * Compute the Set of node reachable from a particular node in the graph.\n * @private\n * @param {Map<*, Set<*>>} graph\n * @param {*} from\n * @param {Set<*>} [to]\n * @returns {Set<*>}\n */\nfunction reachableFrom(graph, from, to) {\n to = to || new Set();\n graph.get(from).forEach(function (node) {\n if (!to.has(node)) {\n to.add(node);\n reachableFrom(graph, node, to).forEach(to.add, to);\n }\n });\n return to;\n}\nfunction transformStates(states) {\n var newStates = new Map();\n for (var key in states) {\n newStates.set(key, new Set(states[key]));\n }\n return newStates;\n}\n/**\n * Create an \"unreachable state\" Error.\n * @param {string} here\n * @param {string} there\n * @returns {Error}\n */\nfunction createUnreachableError(here, there) {\n return new Error(\"\\\"\" + there + \"\\\" cannot be reached from \\\"\" + here + \"\\\"\");\n}\nmodule.exports = StateMachine;\n//# sourceMappingURL=statemachine.js.map","'use strict';\n/**\n * Monitor the network connection status to detect interruptions and handoffs.\n */\nvar NetworkMonitor = /** @class */ (function () {\n /**\n * Construct a {@link NetworkMonitor}.\n * @param {function} onNetworkChanged\n * @param {*} [options]\n */\n function NetworkMonitor(onNetworkChanged, options) {\n var _this = this;\n options = Object.assign({\n navigator: navigator,\n window: window,\n }, options);\n var nav = options.navigator;\n var connection = nav.connection || { type: null };\n var type = connection.type;\n var _a = connection.type ? {\n _events: {\n value: ['change', 'typechange']\n },\n _listener: {\n value: function () {\n var networkChanged = type !== _this.type && _this.isOnline;\n type = _this.type;\n if (networkChanged) {\n onNetworkChanged();\n }\n }\n },\n _target: {\n value: connection\n }\n } : {\n _events: {\n value: ['online']\n },\n _listener: {\n value: onNetworkChanged\n },\n _target: {\n value: options.window\n }\n }, _events = _a._events, _listener = _a._listener, _target = _a._target;\n Object.defineProperties(this, {\n isOnline: {\n enumerable: true,\n get: function () {\n return typeof nav.onLine === 'boolean'\n ? nav.onLine\n : true;\n }\n },\n type: {\n enumerable: true,\n get: function () {\n return connection.type || null;\n }\n },\n _listener: _listener,\n _events: _events,\n _target: _target\n });\n }\n /**\n * Start the {@link NetworkMonitor}.\n */\n NetworkMonitor.prototype.start = function () {\n var _this = this;\n this._events.forEach(function (event) {\n _this._target.addEventListener(event, _this._listener);\n });\n };\n /**\n * Stop the {@link NetworkMonitor}.\n */\n NetworkMonitor.prototype.stop = function () {\n var _this = this;\n this._events.forEach(function (event) {\n _this._target.removeEventListener(event, _this._listener);\n });\n };\n return NetworkMonitor;\n}());\nmodule.exports = NetworkMonitor;\n//# sourceMappingURL=networkmonitor.js.map","'use strict';\n/**\n * A {@link Timeout} represents a resettable and clearable timeout.\n */\nvar Timeout = /** @class */ (function () {\n /**\n * Construct a {@link Timeout}.\n * @param {function} fn - Function to call\n * @param {number} delay - Delay in milliseconds\n * @param {boolean} [autoStart=true] - If true, then start the {@link Timeout}.\n */\n function Timeout(fn, delay, autoStart) {\n if (autoStart === void 0) { autoStart = true; }\n Object.defineProperties(this, {\n _delay: {\n value: delay,\n writable: true\n },\n _fn: {\n value: fn\n },\n _timeout: {\n value: null,\n writable: true\n }\n });\n if (autoStart) {\n this.start();\n }\n }\n Object.defineProperty(Timeout.prototype, \"delay\", {\n /**\n * The {@link Timeout} delay in milliseconds.\n * @property {number}\n */\n get: function () {\n return this._delay;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Timeout.prototype, \"isSet\", {\n /**\n * Whether the {@link Timeout} is set.\n * @property {boolean}\n */\n get: function () {\n return !!this._timeout;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Update the {@link Timeout} delay.\n * @param {number} delay\n * @returns {void}\n */\n Timeout.prototype.setDelay = function (delay) {\n this._delay = delay;\n };\n /**\n * Start the {@link Timeout}, if not already started.\n * @returns {void}\n */\n Timeout.prototype.start = function () {\n var _this = this;\n if (!this.isSet) {\n this._timeout = setTimeout(function () {\n var fn = _this._fn;\n _this.clear();\n fn();\n }, this._delay);\n }\n };\n /**\n * Clear the {@link Timeout}.\n * @returns {void}\n */\n Timeout.prototype.clear = function () {\n clearTimeout(this._timeout);\n this._timeout = null;\n };\n /**\n * Reset the {@link Timeout}.\n * @returns {void}\n */\n Timeout.prototype.reset = function () {\n this.clear();\n this.start();\n };\n return Timeout;\n}());\nmodule.exports = Timeout;\n//# sourceMappingURL=timeout.js.map","module.exports = WebSocket;\n","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar StateMachine = require('./statemachine');\nvar _a = require('./util'), buildLogLevels = _a.buildLogLevels, makeUUID = _a.makeUUID;\nvar Log = require('./util/log');\nvar NetworkMonitor = require('./util/networkmonitor');\nvar Timeout = require('./util/timeout');\nvar nInstances = 0;\n/*\n TwilioConnection states\n -----------------------\n\n ------------------------------------------\n | |\n | v\n +---------+ +--------------+ +----------+\n | early | ----> | connecting | ----> | closed |\n +---------+ +--------------+ +----------+\n ^ | ^ | ^ ^\n | --------------------- | | | |\n | | --------------------- | | |\n | | | --------------------|------------------ |\n | v | | v |\n +----------+ +--------+ |\n | waiting | --------> | open | ---------------\n +----------+ +--------+\n */\nvar states = {\n closed: [],\n connecting: ['closed', 'open', 'waiting'],\n early: ['closed', 'connecting'],\n open: ['closed'],\n waiting: ['closed', 'connecting', 'early', 'open']\n};\nvar events = {\n closed: 'close',\n open: 'open',\n waiting: 'waiting'\n};\nvar TCMP_VERSION = 2;\nvar DEFAULT_MAX_CONSECUTIVE_MISSED_HEARTBEATS = 3;\nvar DEFAULT_MAX_CONSECUTIVE_FAILED_HELLOS = 3;\nvar DEFAULT_MAX_REQUESTED_HEARTBEAT_TIMEOUT = 5000;\nvar DEFAULT_OPEN_TIMEOUT = 15000;\nvar DEFAULT_WELCOME_TIMEOUT = 5000;\nvar OUTGOING_HEARTBEAT_OFFSET = 200;\nvar WS_CLOSE_NORMAL = 1000;\nvar WS_CLOSE_WELCOME_TIMEOUT = 3000;\nvar WS_CLOSE_HEARTBEATS_MISSED = 3001;\nvar WS_CLOSE_HELLO_FAILED = 3002;\nvar WS_CLOSE_SEND_FAILED = 3003;\nvar WS_CLOSE_NETWORK_CHANGED = 3004;\nvar WS_CLOSE_BUSY_WAIT = 3005;\nvar WS_CLOSE_SERVER_BUSY = 3006;\nvar WS_CLOSE_OPEN_TIMEOUT = 3007;\n// NOTE(joma): If you want to use close code 3008, please increment\n// the close code in test/integration/spec/docker/reconnection.js\n// line number 492.\nvar toplevel = globalThis;\nvar WebSocket = toplevel.WebSocket ? toplevel.WebSocket : require('ws');\nvar CloseReason = {\n BUSY: 'busy',\n FAILED: 'failed',\n LOCAL: 'local',\n REMOTE: 'remote',\n TIMEOUT: 'timeout'\n};\nvar wsCloseCodesToCloseReasons = new Map([\n [WS_CLOSE_WELCOME_TIMEOUT, CloseReason.TIMEOUT],\n [WS_CLOSE_HEARTBEATS_MISSED, CloseReason.TIMEOUT],\n [WS_CLOSE_HELLO_FAILED, CloseReason.FAILED],\n [WS_CLOSE_SEND_FAILED, CloseReason.FAILED],\n [WS_CLOSE_NETWORK_CHANGED, CloseReason.TIMEOUT],\n [WS_CLOSE_SERVER_BUSY, CloseReason.BUSY],\n [WS_CLOSE_OPEN_TIMEOUT, CloseReason.TIMEOUT]\n]);\n/**\n * A {@link TwilioConnection} represents a WebSocket connection\n * to a Twilio Connections Messaging Protocol (TCMP) server.\n * @fires TwilioConnection#close\n * @fires TwilioConnection#error\n * @fires TwilioConnection#message\n * @fires TwilioConnection#open\n * @fires TwilioConnection#waiting\n */\nvar TwilioConnection = /** @class */ (function (_super) {\n __extends(TwilioConnection, _super);\n /**\n * Construct a {@link TwilioConnection}.\n * @param {string} serverUrl - TCMP server url\n * @param {TwilioConnectionOptions} options - {@link TwilioConnection} options\n */\n function TwilioConnection(serverUrl, options) {\n var _this = _super.call(this, 'early', states) || this;\n options = Object.assign({\n helloBody: null,\n maxConsecutiveFailedHellos: DEFAULT_MAX_CONSECUTIVE_FAILED_HELLOS,\n maxConsecutiveMissedHeartbeats: DEFAULT_MAX_CONSECUTIVE_MISSED_HEARTBEATS,\n requestedHeartbeatTimeout: DEFAULT_MAX_REQUESTED_HEARTBEAT_TIMEOUT,\n openTimeout: DEFAULT_OPEN_TIMEOUT,\n welcomeTimeout: DEFAULT_WELCOME_TIMEOUT,\n Log: Log,\n WebSocket: WebSocket\n }, options);\n var logLevels = buildLogLevels(options.logLevel);\n var log = new options.Log('default', _this, logLevels, options.loggerName);\n var networkMonitor = options.networkMonitor ? new NetworkMonitor(function () {\n var type = networkMonitor.type;\n var reason = \"Network changed\" + (type ? \" to \" + type : '');\n log.debug(reason);\n _this._close({ code: WS_CLOSE_NETWORK_CHANGED, reason: reason });\n }) : null;\n Object.defineProperties(_this, {\n _busyWaitTimeout: {\n value: null,\n writable: true\n },\n _consecutiveHeartbeatsMissed: {\n value: 0,\n writable: true\n },\n _cookie: {\n value: null,\n writable: true\n },\n _eventObserver: {\n value: options.eventObserver\n },\n _heartbeatTimeout: {\n value: null,\n writable: true\n },\n _hellosLeft: {\n value: options.maxConsecutiveFailedHellos,\n writable: true\n },\n _instanceId: {\n value: ++nInstances\n },\n _log: {\n value: log\n },\n _messageQueue: {\n value: []\n },\n _networkMonitor: {\n value: networkMonitor\n },\n _options: {\n value: options\n },\n _openTimeout: {\n value: null,\n writable: true\n },\n _sendHeartbeatTimeout: {\n value: null,\n writable: true\n },\n _serverUrl: {\n value: serverUrl\n },\n _welcomeTimeout: {\n value: null,\n writable: true\n },\n _ws: {\n value: null,\n writable: true\n }\n });\n var eventsToLevels = {\n connecting: 'info',\n early: 'info',\n open: 'info',\n waiting: 'warning',\n closed: 'info'\n };\n _this.on('stateChanged', function (state) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (state in events) {\n _this.emit.apply(_this, __spreadArray([events[state]], __read(args)));\n }\n var event = { name: state, group: 'signaling', level: eventsToLevels[_this.state] };\n if (state === 'closed') {\n var _a = __read(args, 1), reason = _a[0];\n event.payload = { reason: reason };\n event.level = reason === CloseReason.LOCAL ? 'info' : 'error';\n }\n _this._eventObserver.emit('event', event);\n });\n _this._eventObserver.emit('event', { name: _this.state, group: 'signaling', level: eventsToLevels[_this.state] });\n _this._connect();\n return _this;\n }\n TwilioConnection.prototype.toString = function () {\n return \"[TwilioConnection #\" + this._instanceId + \": \" + this._ws.url + \"]\";\n };\n /**\n * Close the {@link TwilioConnection}.\n * @param {{code: number, reason: string}} event\n * @private\n */\n TwilioConnection.prototype._close = function (_a) {\n var code = _a.code, reason = _a.reason;\n if (this.state === 'closed') {\n return;\n }\n if (this._openTimeout) {\n this._openTimeout.clear();\n }\n if (this._welcomeTimeout) {\n this._welcomeTimeout.clear();\n }\n if (this._heartbeatTimeout) {\n this._heartbeatTimeout.clear();\n }\n if (this._sendHeartbeatTimeout) {\n this._sendHeartbeatTimeout.clear();\n }\n if (this._networkMonitor) {\n this._networkMonitor.stop();\n }\n if (this._busyWaitTimeout && code !== WS_CLOSE_BUSY_WAIT) {\n this._busyWaitTimeout.clear();\n }\n this._messageQueue.splice(0);\n var log = this._log;\n if (code === WS_CLOSE_NORMAL) {\n log.debug('Closed');\n this.transition('closed', null, [CloseReason.LOCAL]);\n }\n else {\n log.warn(\"Closed: \" + code + \" - \" + reason);\n if (code !== WS_CLOSE_BUSY_WAIT) {\n this.transition('closed', null, [\n wsCloseCodesToCloseReasons.get(code) || CloseReason.REMOTE\n ]);\n }\n }\n var readyState = this._ws.readyState;\n var WebSocket = this._options.WebSocket;\n if (readyState !== WebSocket.CLOSING && readyState !== WebSocket.CLOSED) {\n this._ws.close(code, reason);\n }\n };\n /**\n * Connect to the TCMP server.\n * @private\n */\n TwilioConnection.prototype._connect = function () {\n var _this = this;\n var log = this._log;\n if (this.state === 'waiting') {\n this.transition('early');\n }\n else if (this.state !== 'early') {\n log.warn(\"Unexpected state \\\"\" + this.state + \"\\\" for connecting to the\"\n + ' TCMP server.');\n return;\n }\n this._ws = new this._options.WebSocket(this._serverUrl);\n var ws = this._ws;\n log.debug('Created a new WebSocket:', ws);\n ws.addEventListener('close', function (event) { return _this._close(event); });\n var openTimeout = this._options.openTimeout;\n // Add a timeout for getting the onopen event on the WebSocket (15 sec). After that, attempt to reconnect only if this is not the first attempt.\n this._openTimeout = new Timeout(function () {\n var reason = \"Failed to open in \" + openTimeout + \" ms\";\n _this._close({ code: WS_CLOSE_OPEN_TIMEOUT, reason: reason });\n }, openTimeout);\n ws.addEventListener('open', function () {\n log.debug('WebSocket opened:', ws);\n _this._openTimeout.clear();\n _this._startHandshake();\n if (_this._networkMonitor) {\n _this._networkMonitor.start();\n }\n });\n ws.addEventListener('message', function (message) {\n log.debug(\"Incoming: \" + message.data);\n try {\n message = JSON.parse(message.data);\n }\n catch (error) {\n _this.emit('error', error);\n return;\n }\n switch (message.type) {\n case 'bad':\n _this._handleBad(message);\n break;\n case 'busy':\n _this._handleBusy(message);\n break;\n case 'bye':\n // Do nothing.\n break;\n case 'msg':\n _this._handleMessage(message);\n // NOTE(mpatwardhan): Each incoming message should be treated as an incoming\n // heartbeat intentionally falling through to 'heartbeat' case.\n // eslint-disable-next-line no-fallthrough\n case 'heartbeat':\n _this._handleHeartbeat();\n break;\n case 'welcome':\n _this._handleWelcome(message);\n break;\n default:\n _this._log.debug(\"Unknown message type: \" + message.type);\n _this.emit('error', new Error(\"Unknown message type: \" + message.type));\n break;\n }\n });\n };\n /**\n * Handle an incoming \"bad\" message.\n * @param {{reason: string}} message\n * @private\n */\n TwilioConnection.prototype._handleBad = function (_a) {\n var reason = _a.reason;\n var log = this._log;\n if (!['connecting', 'open'].includes(this.state)) {\n log.warn(\"Unexpected state \\\"\" + this.state + \"\\\" for handling a \\\"bad\\\" message\"\n + ' from the TCMP server.');\n return;\n }\n if (this.state === 'connecting') {\n log.warn(\"Closing: \" + WS_CLOSE_HELLO_FAILED + \" - \" + reason);\n this._close({ code: WS_CLOSE_HELLO_FAILED, reason: reason });\n return;\n }\n log.debug(\"Error: \" + reason);\n this.emit('error', new Error(reason));\n };\n /**\n * Handle an incoming \"busy\" message.\n * @param {{cookie: ?string, keepAlive: boolean, retryAfter: number}} message\n * @private\n */\n TwilioConnection.prototype._handleBusy = function (_a) {\n var _this = this;\n var cookie = _a.cookie, keepAlive = _a.keepAlive, retryAfter = _a.retryAfter;\n var log = this._log;\n if (!['connecting', 'waiting'].includes(this.state)) {\n log.warn(\"Unexpected state \\\"\" + this.state + \"\\\" for handling a \\\"busy\\\" message\"\n + ' from the TCMP server.');\n return;\n }\n if (this._busyWaitTimeout) {\n this._busyWaitTimeout.clear();\n }\n if (this._welcomeTimeout) {\n this._welcomeTimeout.clear();\n }\n var reason = retryAfter < 0\n ? 'Received terminal \"busy\" message'\n : \"Received \\\"busy\\\" message, retrying after \" + retryAfter + \" ms\";\n if (retryAfter < 0) {\n log.warn(\"Closing: \" + WS_CLOSE_SERVER_BUSY + \" - \" + reason);\n this._close({ code: WS_CLOSE_SERVER_BUSY, reason: reason });\n return;\n }\n var maxConsecutiveFailedHellos = this._options.maxConsecutiveFailedHellos;\n this._hellosLeft = maxConsecutiveFailedHellos;\n this._cookie = cookie || null;\n if (keepAlive) {\n log.warn(reason);\n this._busyWaitTimeout = new Timeout(function () { return _this._startHandshake(); }, retryAfter);\n }\n else {\n log.warn(\"Closing: \" + WS_CLOSE_BUSY_WAIT + \" - \" + reason);\n this._close({ code: WS_CLOSE_BUSY_WAIT, reason: reason });\n this._busyWaitTimeout = new Timeout(function () { return _this._connect(); }, retryAfter);\n }\n this.transition('waiting', null, [keepAlive, retryAfter]);\n };\n /**\n * Handle an incoming \"heartbeat\" message.\n * @private\n */\n TwilioConnection.prototype._handleHeartbeat = function () {\n if (this.state !== 'open') {\n this._log.warn(\"Unexpected state \\\"\" + this.state + \"\\\" for handling a \\\"heartbeat\\\"\"\n + ' message from the TCMP server.');\n return;\n }\n this._heartbeatTimeout.reset();\n };\n /**\n * Handle a missed \"heartbeat\" message.\n * @private\n */\n TwilioConnection.prototype._handleHeartbeatTimeout = function () {\n if (this.state !== 'open') {\n return;\n }\n var log = this._log;\n var maxConsecutiveMissedHeartbeats = this._options.maxConsecutiveMissedHeartbeats;\n log.debug(\"Consecutive heartbeats missed: \" + maxConsecutiveMissedHeartbeats);\n var reason = \"Missed \" + maxConsecutiveMissedHeartbeats + \" \\\"heartbeat\\\" messages\";\n log.warn(\"Closing: \" + WS_CLOSE_HEARTBEATS_MISSED + \" - \" + reason);\n this._close({ code: WS_CLOSE_HEARTBEATS_MISSED, reason: reason });\n };\n /**\n * Handle an incoming \"msg\" message.\n * @param {{body: object}} message\n * @private\n */\n TwilioConnection.prototype._handleMessage = function (_a) {\n var body = _a.body;\n if (this.state !== 'open') {\n this._log.warn(\"Unexpected state \\\"\" + this.state + \"\\\" for handling a \\\"msg\\\" message\"\n + ' from the TCMP server.');\n return;\n }\n this.emit('message', body);\n };\n /**\n * Handle an incoming \"welcome\" message.\n * @param {{ negotiatedTimeout: number }} message\n * @private\n */\n TwilioConnection.prototype._handleWelcome = function (_a) {\n var _this = this;\n var negotiatedTimeout = _a.negotiatedTimeout;\n var log = this._log;\n if (!['connecting', 'waiting'].includes(this.state)) {\n log.warn(\"Unexpected state \\\"\" + this.state + \"\\\" for handling a \\\"welcome\\\"\"\n + ' message from the TCMP server.');\n return;\n }\n if (this.state === 'waiting') {\n log.debug('Received \"welcome\" message, no need to retry connection.');\n this._busyWaitTimeout.clear();\n }\n var maxConsecutiveMissedHeartbeats = this._options.maxConsecutiveMissedHeartbeats;\n var heartbeatTimeout = negotiatedTimeout * maxConsecutiveMissedHeartbeats;\n var outgoingHeartbeatTimeout = negotiatedTimeout - OUTGOING_HEARTBEAT_OFFSET;\n this._welcomeTimeout.clear();\n this._heartbeatTimeout = new Timeout(function () { return _this._handleHeartbeatTimeout(); }, heartbeatTimeout);\n this._messageQueue.splice(0).forEach(function (message) { return _this._send(message); });\n this._sendHeartbeatTimeout = new Timeout(function () { return _this._sendHeartbeat(); }, outgoingHeartbeatTimeout);\n this.transition('open');\n };\n /**\n * Handle a missed \"welcome\" message.\n * @private\n */\n TwilioConnection.prototype._handleWelcomeTimeout = function () {\n if (this.state !== 'connecting') {\n return;\n }\n var log = this._log;\n if (this._hellosLeft <= 0) {\n var reason = 'All handshake attempts failed';\n log.warn(\"Closing: \" + WS_CLOSE_WELCOME_TIMEOUT + \" - \" + reason);\n this._close({ code: WS_CLOSE_WELCOME_TIMEOUT, reason: reason });\n return;\n }\n var maxConsecutiveFailedHellos = this._options.maxConsecutiveFailedHellos;\n log.warn(\"Handshake attempt \" + (maxConsecutiveFailedHellos - this._hellosLeft) + \" failed\");\n this._startHandshake();\n };\n /**\n * Send a message to the TCMP server.\n * @param {*} message\n * @private\n */\n TwilioConnection.prototype._send = function (message) {\n var readyState = this._ws.readyState;\n var WebSocket = this._options.WebSocket;\n if (readyState === WebSocket.OPEN) {\n var data = JSON.stringify(message);\n this._log.debug(\"Outgoing: \" + data);\n try {\n this._ws.send(data);\n if (this._sendHeartbeatTimeout) {\n // Each outgoing message is to be treated as an outgoing heartbeat.\n this._sendHeartbeatTimeout.reset();\n }\n }\n catch (error) {\n var reason = 'Failed to send message';\n this._log.warn(\"Closing: \" + WS_CLOSE_SEND_FAILED + \" - \" + reason);\n this._close({ code: WS_CLOSE_SEND_FAILED, reason: reason });\n }\n }\n };\n /**\n * Send a \"heartbeat\" message.\n * @private\n */\n TwilioConnection.prototype._sendHeartbeat = function () {\n if (this.state === 'closed') {\n return;\n }\n this._send({ type: 'heartbeat' });\n };\n /**\n * Send a \"hello\" message.\n * @private\n */\n TwilioConnection.prototype._sendHello = function () {\n var _a = this._options, helloBody = _a.helloBody, timeout = _a.requestedHeartbeatTimeout;\n var hello = {\n id: makeUUID(),\n timeout: timeout,\n type: 'hello',\n version: TCMP_VERSION\n };\n if (this._cookie) {\n hello.cookie = this._cookie;\n }\n if (helloBody) {\n hello.body = helloBody;\n }\n this._send(hello);\n };\n /**\n * Send or enqueue a message.\n * @param {*} message\n * @private\n */\n TwilioConnection.prototype._sendOrEnqueue = function (message) {\n var _this = this;\n if (this.state === 'closed') {\n return;\n }\n var sendOrEnqueue = this.state === 'open'\n ? function (message) { return _this._send(message); }\n : function (message) { return _this._messageQueue.push(message); };\n sendOrEnqueue(message);\n };\n /**\n * Start the TCMP handshake.\n * @private\n */\n TwilioConnection.prototype._startHandshake = function () {\n var _this = this;\n if (['early', 'waiting'].includes(this.state)) {\n this.transition('connecting');\n }\n if (this.state !== 'connecting') {\n return;\n }\n this._hellosLeft--;\n this._sendHello();\n var welcomeTimeout = this._options.welcomeTimeout;\n this._welcomeTimeout = new Timeout(function () { return _this._handleWelcomeTimeout(); }, welcomeTimeout);\n };\n /**\n * Close the {@link TwilioConnection}.\n * @returns {void}\n */\n TwilioConnection.prototype.close = function () {\n if (this.state === 'closed') {\n return;\n }\n this._sendOrEnqueue({ type: 'bye' });\n this._close({ code: WS_CLOSE_NORMAL, reason: 'Normal' });\n };\n /**\n * Send a \"msg\" message.\n * @param {*} body\n * @returns {void}\n */\n TwilioConnection.prototype.sendMessage = function (body) {\n this._sendOrEnqueue({ body: body, type: 'msg' });\n };\n return TwilioConnection;\n}(StateMachine));\n/**\n * A unique string depicting the reason for the {@link TwilioConnection} being closed.\n * @enum {string}\n */\nTwilioConnection.CloseReason = CloseReason;\n/**\n * A {@link TwilioConnection} was closed.\n * @event TwilioConnection#close\n * @param {CloseReason} reason - The reason for the {@link TwilioConnection} being closed\n */\n/**\n * A {@link TwilioConnection} received an error from the TCMP server.\n * @event TwilioConnection#error\n * @param {Error} error - The TCMP server error\n */\n/**\n * A {@link TwilioConnection} received a message from the TCMP server.\n * @event TwilioConnection#message\n * @param {*} body - Message body\n */\n/**\n * A {@link TwilioConnection} completed a hello/welcome handshake with the TCMP server.\n * @event TwilioConnection#open\n */\n/**\n * A {@link TwilioConnection} received a \"busy\" message from the TCMP server.\n * @event TwilioConnection#waiting\n * @param {boolean} keepAlive - true if the WebSocket connection is retained\n * @param {number} retryAfter - delay in milliseconds after which a retry is attempted\n */\n/**\n * {@link TwilioConnection} options\n * @typedef {object} TwilioConnectionOptions\n * @property {EventObserver} [eventObserver] - Optional event observer\n * @property {*} [helloBody=null] - Optional body for \"hello\" message\n * @property {LogLevel} [logLevel=warn] - Log level of the {@link TwilioConnection}\n * @property {number} [maxConsecutiveFailedHellos=3] - Max. number of consecutive failed \"hello\"s\n * @property {number} [maxConsecutiveMissedHeartbeats=3] - Max. number of (effective) consecutive \"heartbeat\" messages that can be missed\n * @property {number} [requestedHeartbeatTimeout=5000] - \"heartbeat\" timeout (ms) requested by the {@link TwilioConnection}\n * @property {number} [welcomeTimeout=5000] - Time (ms) to wait for the \"welcome\" message after sending the \"hello\" message\n */\nmodule.exports = TwilioConnection;\n//# sourceMappingURL=twilioconnection.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\n/**\n * @extends Error\n * @property {number} code - Error code\n */\nvar TwilioError = /** @class */ (function (_super) {\n __extends(TwilioError, _super);\n /**\n * Creates a new {@link TwilioError}\n * @param {number} code - Error code\n * @param {string} [message] - Error message\n * @param {string} [fileName] - Name of the script file where error was generated\n * @param {number} [lineNumber] - Line number of the script file where error was generated\n */\n function TwilioError(code) {\n var _this = this;\n var args = [].slice.call(arguments, 1);\n _this = _super.apply(this, __spreadArray([], __read(args))) || this;\n Object.setPrototypeOf(_this, TwilioError.prototype);\n var error = Error.apply(_this, args);\n error.name = 'TwilioError';\n Object.defineProperty(_this, 'code', {\n value: code,\n enumerable: true\n });\n Object.getOwnPropertyNames(error).forEach(function (prop) {\n Object.defineProperty(this, prop, {\n value: error[prop],\n enumerable: true\n });\n }, _this);\n return _this;\n }\n /**\n * Returns human readable string describing the error.\n * @returns {string}\n */\n TwilioError.prototype.toString = function () {\n var message = this.message ? \": \" + this.message : '';\n return this.name + \" \" + this.code + message;\n };\n return TwilioError;\n}(Error));\nmodule.exports = TwilioError;\n//# sourceMappingURL=twilioerror.js.map","// NOTE: Do not edit this file. This code is auto-generated. Contact the\n// Twilio SDK Team for more information.\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar TwilioError = require('./twilioerror');\nvar TwilioErrorByCode = {};\n/**\n * Create a {@link TwilioError} for a given code and message.\n * @private\n * @param {number} [code] - Error code\n * @param {string} [message] - Error message\n * @returns {TwilioError}\n */\nexports.createTwilioError = function createTwilioError(code, message) {\n code = typeof code === 'number' ? code : 0;\n message = typeof message === 'string' && message ? message : 'Unknown error';\n return TwilioErrorByCode[code] ? new TwilioErrorByCode[code]() : new TwilioError(code, message);\n};\n/**\n * @class AccessTokenInvalidError\n * @classdesc Raised whenever the AccessToken used for connecting to a Room is invalid.\n * @extends TwilioError\n * @property {number} code - 20101\n * @property {string} message - 'Invalid Access Token'\n */\nvar AccessTokenInvalidError = /** @class */ (function (_super) {\n __extends(AccessTokenInvalidError, _super);\n function AccessTokenInvalidError() {\n var _this = _super.call(this, 20101, 'Invalid Access Token') || this;\n Object.setPrototypeOf(_this, AccessTokenInvalidError.prototype);\n return _this;\n }\n return AccessTokenInvalidError;\n}(TwilioError));\nexports.AccessTokenInvalidError = AccessTokenInvalidError;\nObject.defineProperty(TwilioErrorByCode, 20101, { value: AccessTokenInvalidError });\n/**\n * @class AccessTokenHeaderInvalidError\n * @classdesc Raised whenever the AccessToken used for connecting to a Room has an invalid header.\n * @extends TwilioError\n * @property {number} code - 20102\n * @property {string} message - 'Invalid Access Token header'\n */\nvar AccessTokenHeaderInvalidError = /** @class */ (function (_super) {\n __extends(AccessTokenHeaderInvalidError, _super);\n function AccessTokenHeaderInvalidError() {\n var _this = _super.call(this, 20102, 'Invalid Access Token header') || this;\n Object.setPrototypeOf(_this, AccessTokenHeaderInvalidError.prototype);\n return _this;\n }\n return AccessTokenHeaderInvalidError;\n}(TwilioError));\nexports.AccessTokenHeaderInvalidError = AccessTokenHeaderInvalidError;\nObject.defineProperty(TwilioErrorByCode, 20102, { value: AccessTokenHeaderInvalidError });\n/**\n * @class AccessTokenIssuerInvalidError\n * @classdesc Raised whenever the AccessToken used for connecting to a Room contains an invalid issuer or subject.\n * @extends TwilioError\n * @property {number} code - 20103\n * @property {string} message - 'Invalid Access Token issuer/subject'\n */\nvar AccessTokenIssuerInvalidError = /** @class */ (function (_super) {\n __extends(AccessTokenIssuerInvalidError, _super);\n function AccessTokenIssuerInvalidError() {\n var _this = _super.call(this, 20103, 'Invalid Access Token issuer/subject') || this;\n Object.setPrototypeOf(_this, AccessTokenIssuerInvalidError.prototype);\n return _this;\n }\n return AccessTokenIssuerInvalidError;\n}(TwilioError));\nexports.AccessTokenIssuerInvalidError = AccessTokenIssuerInvalidError;\nObject.defineProperty(TwilioErrorByCode, 20103, { value: AccessTokenIssuerInvalidError });\n/**\n * @class AccessTokenExpiredError\n * @classdesc Raised whenever the AccessToken used for connecting, or reconnecting to a Room has expired.\n * @extends TwilioError\n * @property {number} code - 20104\n * @property {string} message - 'Access Token expired or expiration date invalid'\n */\nvar AccessTokenExpiredError = /** @class */ (function (_super) {\n __extends(AccessTokenExpiredError, _super);\n function AccessTokenExpiredError() {\n var _this = _super.call(this, 20104, 'Access Token expired or expiration date invalid') || this;\n Object.setPrototypeOf(_this, AccessTokenExpiredError.prototype);\n return _this;\n }\n return AccessTokenExpiredError;\n}(TwilioError));\nexports.AccessTokenExpiredError = AccessTokenExpiredError;\nObject.defineProperty(TwilioErrorByCode, 20104, { value: AccessTokenExpiredError });\n/**\n * @class AccessTokenNotYetValidError\n * @classdesc Raised whenever the AccessToken used for connecting to a Room is not yet valid.\n * @extends TwilioError\n * @property {number} code - 20105\n * @property {string} message - 'Access Token not yet valid'\n */\nvar AccessTokenNotYetValidError = /** @class */ (function (_super) {\n __extends(AccessTokenNotYetValidError, _super);\n function AccessTokenNotYetValidError() {\n var _this = _super.call(this, 20105, 'Access Token not yet valid') || this;\n Object.setPrototypeOf(_this, AccessTokenNotYetValidError.prototype);\n return _this;\n }\n return AccessTokenNotYetValidError;\n}(TwilioError));\nexports.AccessTokenNotYetValidError = AccessTokenNotYetValidError;\nObject.defineProperty(TwilioErrorByCode, 20105, { value: AccessTokenNotYetValidError });\n/**\n * @class AccessTokenGrantsInvalidError\n * @classdesc Raised whenever the AccessToken used for connecting to a Room has invalid grants.\n * @extends TwilioError\n * @property {number} code - 20106\n * @property {string} message - 'Invalid Access Token grants'\n */\nvar AccessTokenGrantsInvalidError = /** @class */ (function (_super) {\n __extends(AccessTokenGrantsInvalidError, _super);\n function AccessTokenGrantsInvalidError() {\n var _this = _super.call(this, 20106, 'Invalid Access Token grants') || this;\n Object.setPrototypeOf(_this, AccessTokenGrantsInvalidError.prototype);\n return _this;\n }\n return AccessTokenGrantsInvalidError;\n}(TwilioError));\nexports.AccessTokenGrantsInvalidError = AccessTokenGrantsInvalidError;\nObject.defineProperty(TwilioErrorByCode, 20106, { value: AccessTokenGrantsInvalidError });\n/**\n * @class AccessTokenSignatureInvalidError\n * @classdesc Raised whenever the AccessToken used for connecting to a Room has an invalid signature.\n * @extends TwilioError\n * @property {number} code - 20107\n * @property {string} message - 'Invalid Access Token signature'\n */\nvar AccessTokenSignatureInvalidError = /** @class */ (function (_super) {\n __extends(AccessTokenSignatureInvalidError, _super);\n function AccessTokenSignatureInvalidError() {\n var _this = _super.call(this, 20107, 'Invalid Access Token signature') || this;\n Object.setPrototypeOf(_this, AccessTokenSignatureInvalidError.prototype);\n return _this;\n }\n return AccessTokenSignatureInvalidError;\n}(TwilioError));\nexports.AccessTokenSignatureInvalidError = AccessTokenSignatureInvalidError;\nObject.defineProperty(TwilioErrorByCode, 20107, { value: AccessTokenSignatureInvalidError });\n/**\n * @class SignalingConnectionError\n * @classdesc Raised whenever a signaling connection error occurs that is not covered by a more specific error code.\n * @extends TwilioError\n * @property {number} code - 53000\n * @property {string} message - 'Signaling connection error'\n */\nvar SignalingConnectionError = /** @class */ (function (_super) {\n __extends(SignalingConnectionError, _super);\n function SignalingConnectionError() {\n var _this = _super.call(this, 53000, 'Signaling connection error') || this;\n Object.setPrototypeOf(_this, SignalingConnectionError.prototype);\n return _this;\n }\n return SignalingConnectionError;\n}(TwilioError));\nexports.SignalingConnectionError = SignalingConnectionError;\nObject.defineProperty(TwilioErrorByCode, 53000, { value: SignalingConnectionError });\n/**\n * @class SignalingConnectionDisconnectedError\n * @classdesc Raised whenever the signaling connection is unexpectedly disconnected.\n * @extends TwilioError\n * @property {number} code - 53001\n * @property {string} message - 'Signaling connection disconnected'\n */\nvar SignalingConnectionDisconnectedError = /** @class */ (function (_super) {\n __extends(SignalingConnectionDisconnectedError, _super);\n function SignalingConnectionDisconnectedError() {\n var _this = _super.call(this, 53001, 'Signaling connection disconnected') || this;\n Object.setPrototypeOf(_this, SignalingConnectionDisconnectedError.prototype);\n return _this;\n }\n return SignalingConnectionDisconnectedError;\n}(TwilioError));\nexports.SignalingConnectionDisconnectedError = SignalingConnectionDisconnectedError;\nObject.defineProperty(TwilioErrorByCode, 53001, { value: SignalingConnectionDisconnectedError });\n/**\n * @class SignalingConnectionTimeoutError\n * @classdesc Raised when connection liveliness checks fail, or when the signaling session expires.\n * @extends TwilioError\n * @property {number} code - 53002\n * @property {string} message - 'Signaling connection timed out'\n */\nvar SignalingConnectionTimeoutError = /** @class */ (function (_super) {\n __extends(SignalingConnectionTimeoutError, _super);\n function SignalingConnectionTimeoutError() {\n var _this = _super.call(this, 53002, 'Signaling connection timed out') || this;\n Object.setPrototypeOf(_this, SignalingConnectionTimeoutError.prototype);\n return _this;\n }\n return SignalingConnectionTimeoutError;\n}(TwilioError));\nexports.SignalingConnectionTimeoutError = SignalingConnectionTimeoutError;\nObject.defineProperty(TwilioErrorByCode, 53002, { value: SignalingConnectionTimeoutError });\n/**\n * @class SignalingIncomingMessageInvalidError\n * @classdesc Raised whenever the Client receives a message from the Server that the Client cannot handle.\n * @extends TwilioError\n * @property {number} code - 53003\n * @property {string} message - 'Client received an invalid signaling message'\n */\nvar SignalingIncomingMessageInvalidError = /** @class */ (function (_super) {\n __extends(SignalingIncomingMessageInvalidError, _super);\n function SignalingIncomingMessageInvalidError() {\n var _this = _super.call(this, 53003, 'Client received an invalid signaling message') || this;\n Object.setPrototypeOf(_this, SignalingIncomingMessageInvalidError.prototype);\n return _this;\n }\n return SignalingIncomingMessageInvalidError;\n}(TwilioError));\nexports.SignalingIncomingMessageInvalidError = SignalingIncomingMessageInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53003, { value: SignalingIncomingMessageInvalidError });\n/**\n * @class SignalingOutgoingMessageInvalidError\n * @classdesc Raised whenever the Client sends a message to the Server that the Server cannot handle.\n * @extends TwilioError\n * @property {number} code - 53004\n * @property {string} message - 'Client sent an invalid signaling message'\n */\nvar SignalingOutgoingMessageInvalidError = /** @class */ (function (_super) {\n __extends(SignalingOutgoingMessageInvalidError, _super);\n function SignalingOutgoingMessageInvalidError() {\n var _this = _super.call(this, 53004, 'Client sent an invalid signaling message') || this;\n Object.setPrototypeOf(_this, SignalingOutgoingMessageInvalidError.prototype);\n return _this;\n }\n return SignalingOutgoingMessageInvalidError;\n}(TwilioError));\nexports.SignalingOutgoingMessageInvalidError = SignalingOutgoingMessageInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53004, { value: SignalingOutgoingMessageInvalidError });\n/**\n * @class SignalingServerBusyError\n * @classdesc Raised when the server is too busy to accept new clients.\n * @extends TwilioError\n * @property {number} code - 53006\n * @property {string} message - 'Video server is busy'\n */\nvar SignalingServerBusyError = /** @class */ (function (_super) {\n __extends(SignalingServerBusyError, _super);\n function SignalingServerBusyError() {\n var _this = _super.call(this, 53006, 'Video server is busy') || this;\n Object.setPrototypeOf(_this, SignalingServerBusyError.prototype);\n return _this;\n }\n return SignalingServerBusyError;\n}(TwilioError));\nexports.SignalingServerBusyError = SignalingServerBusyError;\nObject.defineProperty(TwilioErrorByCode, 53006, { value: SignalingServerBusyError });\n/**\n * @class RoomNameInvalidError\n * @classdesc Raised whenever a Room name is invalid, and the scenario is not covered by a more specific error code.\n * @extends TwilioError\n * @property {number} code - 53100\n * @property {string} message - 'Room name is invalid'\n */\nvar RoomNameInvalidError = /** @class */ (function (_super) {\n __extends(RoomNameInvalidError, _super);\n function RoomNameInvalidError() {\n var _this = _super.call(this, 53100, 'Room name is invalid') || this;\n Object.setPrototypeOf(_this, RoomNameInvalidError.prototype);\n return _this;\n }\n return RoomNameInvalidError;\n}(TwilioError));\nexports.RoomNameInvalidError = RoomNameInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53100, { value: RoomNameInvalidError });\n/**\n * @class RoomNameTooLongError\n * @classdesc Raised whenever a Room name is too long.\n * @extends TwilioError\n * @property {number} code - 53101\n * @property {string} message - 'Room name is too long'\n */\nvar RoomNameTooLongError = /** @class */ (function (_super) {\n __extends(RoomNameTooLongError, _super);\n function RoomNameTooLongError() {\n var _this = _super.call(this, 53101, 'Room name is too long') || this;\n Object.setPrototypeOf(_this, RoomNameTooLongError.prototype);\n return _this;\n }\n return RoomNameTooLongError;\n}(TwilioError));\nexports.RoomNameTooLongError = RoomNameTooLongError;\nObject.defineProperty(TwilioErrorByCode, 53101, { value: RoomNameTooLongError });\n/**\n * @class RoomNameCharsInvalidError\n * @classdesc Raised whenever a Room name contains invalid characters.\n * @extends TwilioError\n * @property {number} code - 53102\n * @property {string} message - 'Room name contains invalid characters'\n */\nvar RoomNameCharsInvalidError = /** @class */ (function (_super) {\n __extends(RoomNameCharsInvalidError, _super);\n function RoomNameCharsInvalidError() {\n var _this = _super.call(this, 53102, 'Room name contains invalid characters') || this;\n Object.setPrototypeOf(_this, RoomNameCharsInvalidError.prototype);\n return _this;\n }\n return RoomNameCharsInvalidError;\n}(TwilioError));\nexports.RoomNameCharsInvalidError = RoomNameCharsInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53102, { value: RoomNameCharsInvalidError });\n/**\n * @class RoomCreateFailedError\n * @classdesc Raised whenever the Server is unable to create a Room.\n * @extends TwilioError\n * @property {number} code - 53103\n * @property {string} message - 'Unable to create Room'\n */\nvar RoomCreateFailedError = /** @class */ (function (_super) {\n __extends(RoomCreateFailedError, _super);\n function RoomCreateFailedError() {\n var _this = _super.call(this, 53103, 'Unable to create Room') || this;\n Object.setPrototypeOf(_this, RoomCreateFailedError.prototype);\n return _this;\n }\n return RoomCreateFailedError;\n}(TwilioError));\nexports.RoomCreateFailedError = RoomCreateFailedError;\nObject.defineProperty(TwilioErrorByCode, 53103, { value: RoomCreateFailedError });\n/**\n * @class RoomConnectFailedError\n * @classdesc Raised whenever a Client is unable to connect to a Room, and the scenario is not covered by a more specific error code.\n * @extends TwilioError\n * @property {number} code - 53104\n * @property {string} message - 'Unable to connect to Room'\n */\nvar RoomConnectFailedError = /** @class */ (function (_super) {\n __extends(RoomConnectFailedError, _super);\n function RoomConnectFailedError() {\n var _this = _super.call(this, 53104, 'Unable to connect to Room') || this;\n Object.setPrototypeOf(_this, RoomConnectFailedError.prototype);\n return _this;\n }\n return RoomConnectFailedError;\n}(TwilioError));\nexports.RoomConnectFailedError = RoomConnectFailedError;\nObject.defineProperty(TwilioErrorByCode, 53104, { value: RoomConnectFailedError });\n/**\n * @class RoomMaxParticipantsExceededError\n * @classdesc Raised whenever a Client is unable to connect to a Room because the Room contains too many Participants.\n * @extends TwilioError\n * @property {number} code - 53105\n * @property {string} message - 'Room contains too many Participants'\n */\nvar RoomMaxParticipantsExceededError = /** @class */ (function (_super) {\n __extends(RoomMaxParticipantsExceededError, _super);\n function RoomMaxParticipantsExceededError() {\n var _this = _super.call(this, 53105, 'Room contains too many Participants') || this;\n Object.setPrototypeOf(_this, RoomMaxParticipantsExceededError.prototype);\n return _this;\n }\n return RoomMaxParticipantsExceededError;\n}(TwilioError));\nexports.RoomMaxParticipantsExceededError = RoomMaxParticipantsExceededError;\nObject.defineProperty(TwilioErrorByCode, 53105, { value: RoomMaxParticipantsExceededError });\n/**\n * @class RoomNotFoundError\n * @classdesc Raised whenever attempting operation on a non-existent Room.\n * @extends TwilioError\n * @property {number} code - 53106\n * @property {string} message - 'Room not found'\n */\nvar RoomNotFoundError = /** @class */ (function (_super) {\n __extends(RoomNotFoundError, _super);\n function RoomNotFoundError() {\n var _this = _super.call(this, 53106, 'Room not found') || this;\n Object.setPrototypeOf(_this, RoomNotFoundError.prototype);\n return _this;\n }\n return RoomNotFoundError;\n}(TwilioError));\nexports.RoomNotFoundError = RoomNotFoundError;\nObject.defineProperty(TwilioErrorByCode, 53106, { value: RoomNotFoundError });\n/**\n * @class RoomMaxParticipantsOutOfRangeError\n * @classdesc Raised in the REST API when MaxParticipants is set out of range.\n * @extends TwilioError\n * @property {number} code - 53107\n * @property {string} message - 'MaxParticipants is out of range'\n */\nvar RoomMaxParticipantsOutOfRangeError = /** @class */ (function (_super) {\n __extends(RoomMaxParticipantsOutOfRangeError, _super);\n function RoomMaxParticipantsOutOfRangeError() {\n var _this = _super.call(this, 53107, 'MaxParticipants is out of range') || this;\n Object.setPrototypeOf(_this, RoomMaxParticipantsOutOfRangeError.prototype);\n return _this;\n }\n return RoomMaxParticipantsOutOfRangeError;\n}(TwilioError));\nexports.RoomMaxParticipantsOutOfRangeError = RoomMaxParticipantsOutOfRangeError;\nObject.defineProperty(TwilioErrorByCode, 53107, { value: RoomMaxParticipantsOutOfRangeError });\n/**\n * @class RoomTypeInvalidError\n * @classdesc Raised in the REST API when the user attempts to create a Room with an invalid RoomType\n * @extends TwilioError\n * @property {number} code - 53108\n * @property {string} message - 'RoomType is not valid'\n */\nvar RoomTypeInvalidError = /** @class */ (function (_super) {\n __extends(RoomTypeInvalidError, _super);\n function RoomTypeInvalidError() {\n var _this = _super.call(this, 53108, 'RoomType is not valid') || this;\n Object.setPrototypeOf(_this, RoomTypeInvalidError.prototype);\n return _this;\n }\n return RoomTypeInvalidError;\n}(TwilioError));\nexports.RoomTypeInvalidError = RoomTypeInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53108, { value: RoomTypeInvalidError });\n/**\n * @class RoomTimeoutOutOfRangeError\n * @classdesc Raised in the REST API when Timeout is set out of range.\n * @extends TwilioError\n * @property {number} code - 53109\n * @property {string} message - 'Timeout is out of range'\n */\nvar RoomTimeoutOutOfRangeError = /** @class */ (function (_super) {\n __extends(RoomTimeoutOutOfRangeError, _super);\n function RoomTimeoutOutOfRangeError() {\n var _this = _super.call(this, 53109, 'Timeout is out of range') || this;\n Object.setPrototypeOf(_this, RoomTimeoutOutOfRangeError.prototype);\n return _this;\n }\n return RoomTimeoutOutOfRangeError;\n}(TwilioError));\nexports.RoomTimeoutOutOfRangeError = RoomTimeoutOutOfRangeError;\nObject.defineProperty(TwilioErrorByCode, 53109, { value: RoomTimeoutOutOfRangeError });\n/**\n * @class RoomStatusCallbackMethodInvalidError\n * @classdesc Raised in the REST API when StatusCallbackMethod is set to an invalid value.\n * @extends TwilioError\n * @property {number} code - 53110\n * @property {string} message - 'StatusCallbackMethod is invalid'\n */\nvar RoomStatusCallbackMethodInvalidError = /** @class */ (function (_super) {\n __extends(RoomStatusCallbackMethodInvalidError, _super);\n function RoomStatusCallbackMethodInvalidError() {\n var _this = _super.call(this, 53110, 'StatusCallbackMethod is invalid') || this;\n Object.setPrototypeOf(_this, RoomStatusCallbackMethodInvalidError.prototype);\n return _this;\n }\n return RoomStatusCallbackMethodInvalidError;\n}(TwilioError));\nexports.RoomStatusCallbackMethodInvalidError = RoomStatusCallbackMethodInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53110, { value: RoomStatusCallbackMethodInvalidError });\n/**\n * @class RoomStatusCallbackInvalidError\n * @classdesc Raised in the REST API when StatusCallback is not a valid URL or the url is too long.\n * @extends TwilioError\n * @property {number} code - 53111\n * @property {string} message - 'StatusCallback is invalid'\n */\nvar RoomStatusCallbackInvalidError = /** @class */ (function (_super) {\n __extends(RoomStatusCallbackInvalidError, _super);\n function RoomStatusCallbackInvalidError() {\n var _this = _super.call(this, 53111, 'StatusCallback is invalid') || this;\n Object.setPrototypeOf(_this, RoomStatusCallbackInvalidError.prototype);\n return _this;\n }\n return RoomStatusCallbackInvalidError;\n}(TwilioError));\nexports.RoomStatusCallbackInvalidError = RoomStatusCallbackInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53111, { value: RoomStatusCallbackInvalidError });\n/**\n * @class RoomStatusInvalidError\n * @classdesc Raised in the REST API when Status is not valid or the Room is not in-progress.\n * @extends TwilioError\n * @property {number} code - 53112\n * @property {string} message - 'Status is invalid'\n */\nvar RoomStatusInvalidError = /** @class */ (function (_super) {\n __extends(RoomStatusInvalidError, _super);\n function RoomStatusInvalidError() {\n var _this = _super.call(this, 53112, 'Status is invalid') || this;\n Object.setPrototypeOf(_this, RoomStatusInvalidError.prototype);\n return _this;\n }\n return RoomStatusInvalidError;\n}(TwilioError));\nexports.RoomStatusInvalidError = RoomStatusInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53112, { value: RoomStatusInvalidError });\n/**\n * @class RoomRoomExistsError\n * @classdesc Raised in the REST API when the Room creation fails because a Room exists with the same name.\n * @extends TwilioError\n * @property {number} code - 53113\n * @property {string} message - 'Room exists'\n */\nvar RoomRoomExistsError = /** @class */ (function (_super) {\n __extends(RoomRoomExistsError, _super);\n function RoomRoomExistsError() {\n var _this = _super.call(this, 53113, 'Room exists') || this;\n Object.setPrototypeOf(_this, RoomRoomExistsError.prototype);\n return _this;\n }\n return RoomRoomExistsError;\n}(TwilioError));\nexports.RoomRoomExistsError = RoomRoomExistsError;\nObject.defineProperty(TwilioErrorByCode, 53113, { value: RoomRoomExistsError });\n/**\n * @class RoomInvalidParametersError\n * @classdesc Raised in the REST API when one or more Room creation parameter is incompatible with the Room type.\n * @extends TwilioError\n * @property {number} code - 53114\n * @property {string} message - 'Room creation parameter(s) incompatible with the Room type'\n */\nvar RoomInvalidParametersError = /** @class */ (function (_super) {\n __extends(RoomInvalidParametersError, _super);\n function RoomInvalidParametersError() {\n var _this = _super.call(this, 53114, 'Room creation parameter(s) incompatible with the Room type') || this;\n Object.setPrototypeOf(_this, RoomInvalidParametersError.prototype);\n return _this;\n }\n return RoomInvalidParametersError;\n}(TwilioError));\nexports.RoomInvalidParametersError = RoomInvalidParametersError;\nObject.defineProperty(TwilioErrorByCode, 53114, { value: RoomInvalidParametersError });\n/**\n * @class RoomMediaRegionInvalidError\n * @classdesc Raised in the REST API when MediaRegion is set to an invalid value.\n * @extends TwilioError\n * @property {number} code - 53115\n * @property {string} message - 'MediaRegion is invalid'\n */\nvar RoomMediaRegionInvalidError = /** @class */ (function (_super) {\n __extends(RoomMediaRegionInvalidError, _super);\n function RoomMediaRegionInvalidError() {\n var _this = _super.call(this, 53115, 'MediaRegion is invalid') || this;\n Object.setPrototypeOf(_this, RoomMediaRegionInvalidError.prototype);\n return _this;\n }\n return RoomMediaRegionInvalidError;\n}(TwilioError));\nexports.RoomMediaRegionInvalidError = RoomMediaRegionInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53115, { value: RoomMediaRegionInvalidError });\n/**\n * @class RoomMediaRegionUnavailableError\n * @classdesc Raised in the REST API when MediaRegion is set to a valid value but no media servers are available.\n * @extends TwilioError\n * @property {number} code - 53116\n * @property {string} message - 'There are no media servers available in the MediaRegion'\n */\nvar RoomMediaRegionUnavailableError = /** @class */ (function (_super) {\n __extends(RoomMediaRegionUnavailableError, _super);\n function RoomMediaRegionUnavailableError() {\n var _this = _super.call(this, 53116, 'There are no media servers available in the MediaRegion') || this;\n Object.setPrototypeOf(_this, RoomMediaRegionUnavailableError.prototype);\n return _this;\n }\n return RoomMediaRegionUnavailableError;\n}(TwilioError));\nexports.RoomMediaRegionUnavailableError = RoomMediaRegionUnavailableError;\nObject.defineProperty(TwilioErrorByCode, 53116, { value: RoomMediaRegionUnavailableError });\n/**\n * @class RoomSubscriptionOperationNotSupportedError\n * @classdesc Raised whenever the subscription operation requested is not supported for the Room type.\n * @extends TwilioError\n * @property {number} code - 53117\n * @property {string} message - 'The subscription operation requested is not supported for the Room type'\n */\nvar RoomSubscriptionOperationNotSupportedError = /** @class */ (function (_super) {\n __extends(RoomSubscriptionOperationNotSupportedError, _super);\n function RoomSubscriptionOperationNotSupportedError() {\n var _this = _super.call(this, 53117, 'The subscription operation requested is not supported for the Room type') || this;\n Object.setPrototypeOf(_this, RoomSubscriptionOperationNotSupportedError.prototype);\n return _this;\n }\n return RoomSubscriptionOperationNotSupportedError;\n}(TwilioError));\nexports.RoomSubscriptionOperationNotSupportedError = RoomSubscriptionOperationNotSupportedError;\nObject.defineProperty(TwilioErrorByCode, 53117, { value: RoomSubscriptionOperationNotSupportedError });\n/**\n * @class RoomCompletedError\n * @classdesc Raised whenever a Room is completed via the REST API.\n * @extends TwilioError\n * @property {number} code - 53118\n * @property {string} message - 'Room completed'\n */\nvar RoomCompletedError = /** @class */ (function (_super) {\n __extends(RoomCompletedError, _super);\n function RoomCompletedError() {\n var _this = _super.call(this, 53118, 'Room completed') || this;\n Object.setPrototypeOf(_this, RoomCompletedError.prototype);\n return _this;\n }\n return RoomCompletedError;\n}(TwilioError));\nexports.RoomCompletedError = RoomCompletedError;\nObject.defineProperty(TwilioErrorByCode, 53118, { value: RoomCompletedError });\n/**\n * @class RoomAudioOnlyFlagNotSupportedError\n * @classdesc Raised whenever a participant tries to set the AudioOnly flag for a Room type other than Group Rooms.\n * @extends TwilioError\n * @property {number} code - 53124\n * @property {string} message - 'The AudioOnly flag is not supported for the Room type'\n */\nvar RoomAudioOnlyFlagNotSupportedError = /** @class */ (function (_super) {\n __extends(RoomAudioOnlyFlagNotSupportedError, _super);\n function RoomAudioOnlyFlagNotSupportedError() {\n var _this = _super.call(this, 53124, 'The AudioOnly flag is not supported for the Room type') || this;\n Object.setPrototypeOf(_this, RoomAudioOnlyFlagNotSupportedError.prototype);\n return _this;\n }\n return RoomAudioOnlyFlagNotSupportedError;\n}(TwilioError));\nexports.RoomAudioOnlyFlagNotSupportedError = RoomAudioOnlyFlagNotSupportedError;\nObject.defineProperty(TwilioErrorByCode, 53124, { value: RoomAudioOnlyFlagNotSupportedError });\n/**\n * @class RoomTrackKindNotSupportedError\n * @classdesc Raised whenever a participant tries to publish a track or connects with a track that is not supported by the group room.\n * @extends TwilioError\n * @property {number} code - 53125\n * @property {string} message - 'The track kind is not supported by the Room'\n */\nvar RoomTrackKindNotSupportedError = /** @class */ (function (_super) {\n __extends(RoomTrackKindNotSupportedError, _super);\n function RoomTrackKindNotSupportedError() {\n var _this = _super.call(this, 53125, 'The track kind is not supported by the Room') || this;\n Object.setPrototypeOf(_this, RoomTrackKindNotSupportedError.prototype);\n return _this;\n }\n return RoomTrackKindNotSupportedError;\n}(TwilioError));\nexports.RoomTrackKindNotSupportedError = RoomTrackKindNotSupportedError;\nObject.defineProperty(TwilioErrorByCode, 53125, { value: RoomTrackKindNotSupportedError });\n/**\n * @class ParticipantIdentityInvalidError\n * @classdesc Raised whenever a Participant identity is invalid, and the scenario is not covered by a more specific error code.\n * @extends TwilioError\n * @property {number} code - 53200\n * @property {string} message - 'Participant identity is invalid'\n */\nvar ParticipantIdentityInvalidError = /** @class */ (function (_super) {\n __extends(ParticipantIdentityInvalidError, _super);\n function ParticipantIdentityInvalidError() {\n var _this = _super.call(this, 53200, 'Participant identity is invalid') || this;\n Object.setPrototypeOf(_this, ParticipantIdentityInvalidError.prototype);\n return _this;\n }\n return ParticipantIdentityInvalidError;\n}(TwilioError));\nexports.ParticipantIdentityInvalidError = ParticipantIdentityInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53200, { value: ParticipantIdentityInvalidError });\n/**\n * @class ParticipantIdentityTooLongError\n * @classdesc Raised whenever a Participant identity is too long.\n * @extends TwilioError\n * @property {number} code - 53201\n * @property {string} message - 'Participant identity is too long'\n */\nvar ParticipantIdentityTooLongError = /** @class */ (function (_super) {\n __extends(ParticipantIdentityTooLongError, _super);\n function ParticipantIdentityTooLongError() {\n var _this = _super.call(this, 53201, 'Participant identity is too long') || this;\n Object.setPrototypeOf(_this, ParticipantIdentityTooLongError.prototype);\n return _this;\n }\n return ParticipantIdentityTooLongError;\n}(TwilioError));\nexports.ParticipantIdentityTooLongError = ParticipantIdentityTooLongError;\nObject.defineProperty(TwilioErrorByCode, 53201, { value: ParticipantIdentityTooLongError });\n/**\n * @class ParticipantIdentityCharsInvalidError\n * @classdesc Raised whenever a Participant identity contains invalid characters.\n * @extends TwilioError\n * @property {number} code - 53202\n * @property {string} message - 'Participant identity contains invalid characters'\n */\nvar ParticipantIdentityCharsInvalidError = /** @class */ (function (_super) {\n __extends(ParticipantIdentityCharsInvalidError, _super);\n function ParticipantIdentityCharsInvalidError() {\n var _this = _super.call(this, 53202, 'Participant identity contains invalid characters') || this;\n Object.setPrototypeOf(_this, ParticipantIdentityCharsInvalidError.prototype);\n return _this;\n }\n return ParticipantIdentityCharsInvalidError;\n}(TwilioError));\nexports.ParticipantIdentityCharsInvalidError = ParticipantIdentityCharsInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53202, { value: ParticipantIdentityCharsInvalidError });\n/**\n * @class ParticipantMaxTracksExceededError\n * @classdesc Raised whenever a Participant tries to publish a Track and the maximum number of published tracks allowed in the Room at the same time has been reached\n * @extends TwilioError\n * @property {number} code - 53203\n * @property {string} message - 'The maximum number of published tracks allowed in the Room at the same time has been reached'\n */\nvar ParticipantMaxTracksExceededError = /** @class */ (function (_super) {\n __extends(ParticipantMaxTracksExceededError, _super);\n function ParticipantMaxTracksExceededError() {\n var _this = _super.call(this, 53203, 'The maximum number of published tracks allowed in the Room at the same time has been reached') || this;\n Object.setPrototypeOf(_this, ParticipantMaxTracksExceededError.prototype);\n return _this;\n }\n return ParticipantMaxTracksExceededError;\n}(TwilioError));\nexports.ParticipantMaxTracksExceededError = ParticipantMaxTracksExceededError;\nObject.defineProperty(TwilioErrorByCode, 53203, { value: ParticipantMaxTracksExceededError });\n/**\n * @class ParticipantNotFoundError\n * @classdesc Raised whenever attempting an operation on a non-existent Participant.\n * @extends TwilioError\n * @property {number} code - 53204\n * @property {string} message - 'Participant not found'\n */\nvar ParticipantNotFoundError = /** @class */ (function (_super) {\n __extends(ParticipantNotFoundError, _super);\n function ParticipantNotFoundError() {\n var _this = _super.call(this, 53204, 'Participant not found') || this;\n Object.setPrototypeOf(_this, ParticipantNotFoundError.prototype);\n return _this;\n }\n return ParticipantNotFoundError;\n}(TwilioError));\nexports.ParticipantNotFoundError = ParticipantNotFoundError;\nObject.defineProperty(TwilioErrorByCode, 53204, { value: ParticipantNotFoundError });\n/**\n * @class ParticipantDuplicateIdentityError\n * @classdesc Raised by the server to the existing Participant when a new Participant joins a Room with the same identity as the existing Participant.\n * @extends TwilioError\n * @property {number} code - 53205\n * @property {string} message - 'Participant disconnected because of duplicate identity'\n */\nvar ParticipantDuplicateIdentityError = /** @class */ (function (_super) {\n __extends(ParticipantDuplicateIdentityError, _super);\n function ParticipantDuplicateIdentityError() {\n var _this = _super.call(this, 53205, 'Participant disconnected because of duplicate identity') || this;\n Object.setPrototypeOf(_this, ParticipantDuplicateIdentityError.prototype);\n return _this;\n }\n return ParticipantDuplicateIdentityError;\n}(TwilioError));\nexports.ParticipantDuplicateIdentityError = ParticipantDuplicateIdentityError;\nObject.defineProperty(TwilioErrorByCode, 53205, { value: ParticipantDuplicateIdentityError });\n/**\n * @class TrackInvalidError\n * @classdesc Raised whenever a Track is invalid, and the scenario is not covered by a more specific error code.\n * @extends TwilioError\n * @property {number} code - 53300\n * @property {string} message - 'Track is invalid'\n */\nvar TrackInvalidError = /** @class */ (function (_super) {\n __extends(TrackInvalidError, _super);\n function TrackInvalidError() {\n var _this = _super.call(this, 53300, 'Track is invalid') || this;\n Object.setPrototypeOf(_this, TrackInvalidError.prototype);\n return _this;\n }\n return TrackInvalidError;\n}(TwilioError));\nexports.TrackInvalidError = TrackInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53300, { value: TrackInvalidError });\n/**\n * @class TrackNameInvalidError\n * @classdesc Raised whenever a Track name is invalid, and the scenario is not covered by a more specific error code.\n * @extends TwilioError\n * @property {number} code - 53301\n * @property {string} message - 'Track name is invalid'\n */\nvar TrackNameInvalidError = /** @class */ (function (_super) {\n __extends(TrackNameInvalidError, _super);\n function TrackNameInvalidError() {\n var _this = _super.call(this, 53301, 'Track name is invalid') || this;\n Object.setPrototypeOf(_this, TrackNameInvalidError.prototype);\n return _this;\n }\n return TrackNameInvalidError;\n}(TwilioError));\nexports.TrackNameInvalidError = TrackNameInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53301, { value: TrackNameInvalidError });\n/**\n * @class TrackNameTooLongError\n * @classdesc Raised whenever a Track name is too long.\n * @extends TwilioError\n * @property {number} code - 53302\n * @property {string} message - 'Track name is too long'\n */\nvar TrackNameTooLongError = /** @class */ (function (_super) {\n __extends(TrackNameTooLongError, _super);\n function TrackNameTooLongError() {\n var _this = _super.call(this, 53302, 'Track name is too long') || this;\n Object.setPrototypeOf(_this, TrackNameTooLongError.prototype);\n return _this;\n }\n return TrackNameTooLongError;\n}(TwilioError));\nexports.TrackNameTooLongError = TrackNameTooLongError;\nObject.defineProperty(TwilioErrorByCode, 53302, { value: TrackNameTooLongError });\n/**\n * @class TrackNameCharsInvalidError\n * @classdesc Raised whenever a Track name contains invalid characters.\n * @extends TwilioError\n * @property {number} code - 53303\n * @property {string} message - 'Track name contains invalid characters'\n */\nvar TrackNameCharsInvalidError = /** @class */ (function (_super) {\n __extends(TrackNameCharsInvalidError, _super);\n function TrackNameCharsInvalidError() {\n var _this = _super.call(this, 53303, 'Track name contains invalid characters') || this;\n Object.setPrototypeOf(_this, TrackNameCharsInvalidError.prototype);\n return _this;\n }\n return TrackNameCharsInvalidError;\n}(TwilioError));\nexports.TrackNameCharsInvalidError = TrackNameCharsInvalidError;\nObject.defineProperty(TwilioErrorByCode, 53303, { value: TrackNameCharsInvalidError });\n/**\n * @class TrackNameIsDuplicatedError\n * @classdesc Raised whenever a Participant is currently publishing a Track with the same name.\n * @extends TwilioError\n * @property {number} code - 53304\n * @property {string} message - 'Track name is duplicated'\n */\nvar TrackNameIsDuplicatedError = /** @class */ (function (_super) {\n __extends(TrackNameIsDuplicatedError, _super);\n function TrackNameIsDuplicatedError() {\n var _this = _super.call(this, 53304, 'Track name is duplicated') || this;\n Object.setPrototypeOf(_this, TrackNameIsDuplicatedError.prototype);\n return _this;\n }\n return TrackNameIsDuplicatedError;\n}(TwilioError));\nexports.TrackNameIsDuplicatedError = TrackNameIsDuplicatedError;\nObject.defineProperty(TwilioErrorByCode, 53304, { value: TrackNameIsDuplicatedError });\n/**\n * @class TrackServerTrackCapacityReachedError\n * @classdesc The server does not have enough resources available to create a new Track.\n * @extends TwilioError\n * @property {number} code - 53305\n * @property {string} message - 'The server has reached capacity and cannot fulfill this request'\n */\nvar TrackServerTrackCapacityReachedError = /** @class */ (function (_super) {\n __extends(TrackServerTrackCapacityReachedError, _super);\n function TrackServerTrackCapacityReachedError() {\n var _this = _super.call(this, 53305, 'The server has reached capacity and cannot fulfill this request') || this;\n Object.setPrototypeOf(_this, TrackServerTrackCapacityReachedError.prototype);\n return _this;\n }\n return TrackServerTrackCapacityReachedError;\n}(TwilioError));\nexports.TrackServerTrackCapacityReachedError = TrackServerTrackCapacityReachedError;\nObject.defineProperty(TwilioErrorByCode, 53305, { value: TrackServerTrackCapacityReachedError });\n/**\n * @class MediaClientLocalDescFailedError\n * @classdesc Raised whenever a Client is unable to create or apply a local media description.\n * @extends TwilioError\n * @property {number} code - 53400\n * @property {string} message - 'Client is unable to create or apply a local media description'\n */\nvar MediaClientLocalDescFailedError = /** @class */ (function (_super) {\n __extends(MediaClientLocalDescFailedError, _super);\n function MediaClientLocalDescFailedError() {\n var _this = _super.call(this, 53400, 'Client is unable to create or apply a local media description') || this;\n Object.setPrototypeOf(_this, MediaClientLocalDescFailedError.prototype);\n return _this;\n }\n return MediaClientLocalDescFailedError;\n}(TwilioError));\nexports.MediaClientLocalDescFailedError = MediaClientLocalDescFailedError;\nObject.defineProperty(TwilioErrorByCode, 53400, { value: MediaClientLocalDescFailedError });\n/**\n * @class MediaServerLocalDescFailedError\n * @classdesc Raised whenever the Server is unable to create or apply a local media description.\n * @extends TwilioError\n * @property {number} code - 53401\n * @property {string} message - 'Server is unable to create or apply a local media description'\n */\nvar MediaServerLocalDescFailedError = /** @class */ (function (_super) {\n __extends(MediaServerLocalDescFailedError, _super);\n function MediaServerLocalDescFailedError() {\n var _this = _super.call(this, 53401, 'Server is unable to create or apply a local media description') || this;\n Object.setPrototypeOf(_this, MediaServerLocalDescFailedError.prototype);\n return _this;\n }\n return MediaServerLocalDescFailedError;\n}(TwilioError));\nexports.MediaServerLocalDescFailedError = MediaServerLocalDescFailedError;\nObject.defineProperty(TwilioErrorByCode, 53401, { value: MediaServerLocalDescFailedError });\n/**\n * @class MediaClientRemoteDescFailedError\n * @classdesc Raised whenever the Client receives a remote media description but is unable to apply it.\n * @extends TwilioError\n * @property {number} code - 53402\n * @property {string} message - 'Client is unable to apply a remote media description'\n */\nvar MediaClientRemoteDescFailedError = /** @class */ (function (_super) {\n __extends(MediaClientRemoteDescFailedError, _super);\n function MediaClientRemoteDescFailedError() {\n var _this = _super.call(this, 53402, 'Client is unable to apply a remote media description') || this;\n Object.setPrototypeOf(_this, MediaClientRemoteDescFailedError.prototype);\n return _this;\n }\n return MediaClientRemoteDescFailedError;\n}(TwilioError));\nexports.MediaClientRemoteDescFailedError = MediaClientRemoteDescFailedError;\nObject.defineProperty(TwilioErrorByCode, 53402, { value: MediaClientRemoteDescFailedError });\n/**\n * @class MediaServerRemoteDescFailedError\n * @classdesc Raised whenever the Server receives a remote media description but is unable to apply it.\n * @extends TwilioError\n * @property {number} code - 53403\n * @property {string} message - 'Server is unable to apply a remote media description'\n */\nvar MediaServerRemoteDescFailedError = /** @class */ (function (_super) {\n __extends(MediaServerRemoteDescFailedError, _super);\n function MediaServerRemoteDescFailedError() {\n var _this = _super.call(this, 53403, 'Server is unable to apply a remote media description') || this;\n Object.setPrototypeOf(_this, MediaServerRemoteDescFailedError.prototype);\n return _this;\n }\n return MediaServerRemoteDescFailedError;\n}(TwilioError));\nexports.MediaServerRemoteDescFailedError = MediaServerRemoteDescFailedError;\nObject.defineProperty(TwilioErrorByCode, 53403, { value: MediaServerRemoteDescFailedError });\n/**\n * @class MediaNoSupportedCodecError\n * @classdesc Raised whenever the intersection of codecs supported by the Client and the Server (or, in peer-to-peer, the Client and another Participant) is empty.\n * @extends TwilioError\n * @property {number} code - 53404\n * @property {string} message - 'No supported codec'\n */\nvar MediaNoSupportedCodecError = /** @class */ (function (_super) {\n __extends(MediaNoSupportedCodecError, _super);\n function MediaNoSupportedCodecError() {\n var _this = _super.call(this, 53404, 'No supported codec') || this;\n Object.setPrototypeOf(_this, MediaNoSupportedCodecError.prototype);\n return _this;\n }\n return MediaNoSupportedCodecError;\n}(TwilioError));\nexports.MediaNoSupportedCodecError = MediaNoSupportedCodecError;\nObject.defineProperty(TwilioErrorByCode, 53404, { value: MediaNoSupportedCodecError });\n/**\n * @class MediaConnectionError\n * @classdesc Raised by the Client or Server whenever a media connection fails or raised by the Client whenever it detects that media has stopped flowing.\n * @extends TwilioError\n * @property {number} code - 53405\n * @property {string} message - 'Media connection failed or Media activity ceased'\n */\nvar MediaConnectionError = /** @class */ (function (_super) {\n __extends(MediaConnectionError, _super);\n function MediaConnectionError() {\n var _this = _super.call(this, 53405, 'Media connection failed or Media activity ceased') || this;\n Object.setPrototypeOf(_this, MediaConnectionError.prototype);\n return _this;\n }\n return MediaConnectionError;\n}(TwilioError));\nexports.MediaConnectionError = MediaConnectionError;\nObject.defineProperty(TwilioErrorByCode, 53405, { value: MediaConnectionError });\n/**\n * @class MediaDTLSTransportFailedError\n * @classdesc There was a problem while negotiating with the remote DTLS peer. Therefore the Participant will not be able to publish or subscribe to Tracks.\n * @extends TwilioError\n * @property {number} code - 53407\n * @property {string} message - 'Media connection failed due to DTLS handshake failure'\n */\nvar MediaDTLSTransportFailedError = /** @class */ (function (_super) {\n __extends(MediaDTLSTransportFailedError, _super);\n function MediaDTLSTransportFailedError() {\n var _this = _super.call(this, 53407, 'Media connection failed due to DTLS handshake failure') || this;\n Object.setPrototypeOf(_this, MediaDTLSTransportFailedError.prototype);\n return _this;\n }\n return MediaDTLSTransportFailedError;\n}(TwilioError));\nexports.MediaDTLSTransportFailedError = MediaDTLSTransportFailedError;\nObject.defineProperty(TwilioErrorByCode, 53407, { value: MediaDTLSTransportFailedError });\n/**\n * @class ConfigurationAcquireFailedError\n * @classdesc Raised whenever the Client is unable to acquire configuration information from the Server.\n * @extends TwilioError\n * @property {number} code - 53500\n * @property {string} message - 'Unable to acquire configuration'\n */\nvar ConfigurationAcquireFailedError = /** @class */ (function (_super) {\n __extends(ConfigurationAcquireFailedError, _super);\n function ConfigurationAcquireFailedError() {\n var _this = _super.call(this, 53500, 'Unable to acquire configuration') || this;\n Object.setPrototypeOf(_this, ConfigurationAcquireFailedError.prototype);\n return _this;\n }\n return ConfigurationAcquireFailedError;\n}(TwilioError));\nexports.ConfigurationAcquireFailedError = ConfigurationAcquireFailedError;\nObject.defineProperty(TwilioErrorByCode, 53500, { value: ConfigurationAcquireFailedError });\n/**\n * @class ConfigurationAcquireTurnFailedError\n * @classdesc Raised whenever the Server is unable to return TURN credentials to the Client\n * @extends TwilioError\n * @property {number} code - 53501\n * @property {string} message - 'Unable to acquire TURN credentials'\n */\nvar ConfigurationAcquireTurnFailedError = /** @class */ (function (_super) {\n __extends(ConfigurationAcquireTurnFailedError, _super);\n function ConfigurationAcquireTurnFailedError() {\n var _this = _super.call(this, 53501, 'Unable to acquire TURN credentials') || this;\n Object.setPrototypeOf(_this, ConfigurationAcquireTurnFailedError.prototype);\n return _this;\n }\n return ConfigurationAcquireTurnFailedError;\n}(TwilioError));\nexports.ConfigurationAcquireTurnFailedError = ConfigurationAcquireTurnFailedError;\nObject.defineProperty(TwilioErrorByCode, 53501, { value: ConfigurationAcquireTurnFailedError });\n//# sourceMappingURL=twilio-video-errors.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getTurnCredentials = void 0;\n/* eslint-disable camelcase */\nvar TwilioConnection = require('../twilioconnection.js');\nvar ICE_VERSION = require('../util/constants').ICE_VERSION;\nvar _a = require('../util/twilio-video-errors'), createTwilioError = _a.createTwilioError, SignalingConnectionError = _a.SignalingConnectionError;\nvar events_1 = require(\"events\");\nfunction getTurnCredentials(token, wsServer) {\n return new Promise(function (resolve, reject) {\n var eventObserver = new events_1.EventEmitter();\n var connectionOptions = {\n networkMonitor: null,\n eventObserver: eventObserver,\n helloBody: {\n edge: 'roaming',\n preflight: true,\n token: token,\n type: 'ice',\n version: ICE_VERSION\n },\n };\n var twilioConnection = new TwilioConnection(wsServer, connectionOptions);\n var done = false;\n twilioConnection.once('close', function () {\n if (!done) {\n done = true;\n reject(new SignalingConnectionError());\n }\n });\n twilioConnection.on('message', function (messageData) {\n var code = messageData.code, message = messageData.message, ice_servers = messageData.ice_servers, type = messageData.type;\n if ((type === 'iced' || type === 'error') && !done) {\n done = true;\n if (type === 'iced') {\n resolve(ice_servers);\n }\n else {\n reject(createTwilioError(code, message));\n }\n twilioConnection.close();\n }\n });\n });\n}\nexports.getTurnCredentials = getTurnCredentials;\n//# sourceMappingURL=getturncredentials.js.map","\"use strict\";\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.makeStat = void 0;\n/**\n * Computes min, max, average for given array.\n * @param {Array} values\n * @returns {{min: number, max: number: average: number}|null}\n */\nfunction makeStat(values) {\n if (values && values.length) {\n var min = Math.min.apply(Math, __spreadArray([], __read(values)));\n var max = Math.max.apply(Math, __spreadArray([], __read(values)));\n var average = values.reduce(function (total, value) { return total + value; }, 0) / values.length;\n return { min: min, max: max, average: average };\n }\n return null;\n}\nexports.makeStat = makeStat;\n//# sourceMappingURL=makestat.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.syntheticAudio = void 0;\nfunction syntheticAudio() {\n // NOTE(mpatwardhan): We have to delay require-ing AudioContextFactory, because\n // it exports a default instance whose constructor calls Object.assign.\n var audioContextFactory = require('../webaudio/audiocontext');\n var holder = {};\n var audioContext = audioContextFactory.getOrCreate(holder);\n var oscillator = audioContext.createOscillator();\n var dst = oscillator.connect(audioContext.createMediaStreamDestination());\n oscillator.start();\n var track = dst.stream.getAudioTracks()[0];\n var originalStop = track.stop;\n track.stop = function () {\n originalStop.call(track);\n audioContextFactory.release(holder);\n };\n return track;\n}\nexports.syntheticAudio = syntheticAudio;\n//# sourceMappingURL=syntheticaudio.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.syntheticVideo = void 0;\nfunction syntheticVideo(_a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.width, width = _c === void 0 ? 640 : _c, _d = _b.height, height = _d === void 0 ? 480 : _d;\n var canvas = Object.assign(document.createElement('canvas'), { width: width, height: height });\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = 'green';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n var stopped = false;\n requestAnimationFrame(function animate() {\n if (!stopped) {\n // draw random rect/circle.\n var r = Math.round(Math.random() * 255);\n var g = Math.round(Math.random() * 255);\n var b = Math.round(Math.random() * 255);\n var a = Math.round(Math.random() * 255);\n ctx.fillStyle = \"rgba(\" + r + \", \" + g + \", \" + b + \", \" + a + \")\";\n ctx.fillRect(Math.random() * width, Math.random() * height, 50, 50);\n requestAnimationFrame(animate);\n }\n });\n var stream = canvas.captureStream(30);\n var track = stream.getTracks()[0];\n var originalStop = track.stop;\n track.stop = function () {\n stopped = true;\n originalStop.call(track);\n };\n return track;\n}\nexports.syntheticVideo = syntheticVideo;\n//# sourceMappingURL=syntheticvideo.js.map","'use strict';\n/**\n * Calculates the moving average delta for the given pair ofsamples. A sample (S)\n * consists of a numerator (Sn) and a denominator (Sd).The moving average delta is\n * calculated as follows:\n *\n * MovingAvgDelta = (Sn[1] - Sn[0]) / (Sd[1] - Sd[0])\n */\nvar MovingAverageDelta = /** @class */ (function () {\n /**\n * Constructor.\n */\n function MovingAverageDelta() {\n Object.defineProperties(this, {\n _samples: {\n value: [\n { denominator: 0, numerator: 0 },\n { denominator: 0, numerator: 0 }\n ],\n }\n });\n }\n /**\n * Get the moving average delta.\n * @returns {number}\n */\n MovingAverageDelta.prototype.get = function () {\n var samples = this._samples;\n var denominatorDelta = (samples[1].denominator - samples[0].denominator) || Infinity;\n var numeratorDelta = samples[1].numerator - samples[0].numerator;\n return numeratorDelta / denominatorDelta;\n };\n /**\n * Put a sample and get rid of the older sample to maintain sample size of 2.\n * @param numerator\n * @param denominator\n */\n MovingAverageDelta.prototype.putSample = function (numerator, denominator) {\n var samples = this._samples;\n samples.shift();\n samples.push({ denominator: denominator, numerator: numerator });\n };\n return MovingAverageDelta;\n}());\nmodule.exports = MovingAverageDelta;\n//# sourceMappingURL=movingaveragedelta.js.map","/* eslint-disable no-console */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar EventEmitter = require('events').EventEmitter;\nvar VALID_GROUPS = [\n 'signaling',\n 'room',\n 'media',\n 'quality',\n 'video-processor',\n 'preflight'\n];\nvar VALID_LEVELS = [\n 'debug',\n 'error',\n 'info',\n 'warning'\n];\n/**\n * EventObserver listens to SDK events and re-emits them on the\n * @link EventListener} with some additional information.\n * @extends EventEmitter\n * @emits EventObserver#event\n */\nvar EventObserver = /** @class */ (function (_super) {\n __extends(EventObserver, _super);\n /**\n * Constructor.\n * @param {InsightsPublisher} publisher\n * @param {number} connectTimestamp\n * @param {Log} log\n * @param {EventListener} [eventListener]\n */\n function EventObserver(publisher, connectTimestamp, log, eventListener) {\n if (eventListener === void 0) { eventListener = null; }\n var _this = _super.call(this) || this;\n _this.on('event', function (_a) {\n var name = _a.name, group = _a.group, level = _a.level, payload = _a.payload;\n if (typeof name !== 'string') {\n log.error('Unexpected name: ', name);\n throw new Error('Unexpected name: ', name);\n }\n if (!VALID_GROUPS.includes(group)) {\n log.error('Unexpected group: ', group);\n throw new Error('Unexpected group: ', group);\n }\n if (!VALID_LEVELS.includes(level)) {\n log.error('Unexpected level: ', level);\n throw new Error('Unexpected level: ', level);\n }\n var timestamp = Date.now();\n var elapsedTime = timestamp - connectTimestamp;\n var publisherPayload = Object.assign({ elapsedTime: elapsedTime, level: level }, payload ? payload : {});\n publisher.publish(group, name, publisherPayload);\n var event = Object.assign({\n elapsedTime: elapsedTime,\n group: group,\n level: level,\n name: name,\n timestamp: timestamp\n }, payload ? { payload: payload } : {});\n var logLevel = {\n debug: 'debug',\n error: 'error',\n info: 'info',\n warning: 'warn',\n }[level];\n log[logLevel]('event', event);\n if (eventListener && group === 'signaling') {\n eventListener.emit('event', event);\n }\n });\n return _this;\n }\n return EventObserver;\n}(EventEmitter));\n/**\n * An SDK event.\n * @event EventObserver#event\n * @param {{name: string, payload: *}} event\n */\nmodule.exports = EventObserver;\n//# sourceMappingURL=eventobserver.js.map","/* eslint-disable camelcase */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar EventEmitter = require('events').EventEmitter;\nvar getUserAgent = require('..').getUserAgent;\nvar MAX_RECONNECT_ATTEMPTS = 5;\nvar RECONNECT_INTERVAL_MS = 50;\nvar WS_CLOSE_NORMAL = 1000;\nvar toplevel = globalThis;\nvar WebSocket = toplevel.WebSocket ? toplevel.WebSocket : require('ws');\nvar _a = require('../constants'), hardwareDevicePublisheriPad = _a.hardwareDevicePublisheriPad, hardwareDevicePublisheriPhone = _a.hardwareDevicePublisheriPhone;\nvar util = require('../../util');\nvar browserdetection = require('../browserdetection');\n/**\n * Publish events to the Insights gateway.\n * @extends EventEmitter\n * @emits InsightsPublisher#connected\n * @emits InsightsPublisher#disconnected\n * @emits InsightsPublisher#reconnecting\n */\nvar InsightsPublisher = /** @class */ (function (_super) {\n __extends(InsightsPublisher, _super);\n /**\n * @param {string} token - Insights gateway token\n * @param {string} sdkName - Name of the SDK using the {@link InsightsPublisher}\n * @param {string} sdkVersion - Version of the SDK using the {@link InsightsPublisher}\n * @param {string} environment - One of 'dev', 'stage' or 'prod'\n * @param {string} realm - Region identifier\n * @param {InsightsPublisherOptions} options - Override default behavior\n */\n function InsightsPublisher(token, sdkName, sdkVersion, environment, realm, options) {\n var _this = _super.call(this) || this;\n options = Object.assign({\n gateway: createGateway(environment, realm) + \"/v1/VideoEvents\",\n maxReconnectAttempts: MAX_RECONNECT_ATTEMPTS,\n reconnectIntervalMs: RECONNECT_INTERVAL_MS,\n userAgent: getUserAgent(),\n WebSocket: WebSocket,\n }, options);\n Object.defineProperties(_this, {\n _connectTimestamp: {\n value: 0,\n writable: true\n },\n _eventQueue: {\n value: []\n },\n _readyToConnect: {\n value: util.defer()\n },\n _reconnectAttemptsLeft: {\n value: options.maxReconnectAttempts,\n writable: true\n },\n _ws: {\n value: null,\n writable: true\n },\n _WebSocket: {\n value: options.WebSocket\n }\n });\n _this._readyToConnect.promise.then(function (_a) {\n var roomSid = _a.roomSid, participantSid = _a.participantSid;\n var self = _this;\n _this.on('disconnected', function maybeReconnect(error) {\n self._session = null;\n if (error && self._reconnectAttemptsLeft > 0) {\n self.emit('reconnecting');\n reconnect(self, token, sdkName, sdkVersion, roomSid, participantSid, options);\n return;\n }\n self.removeListener('disconnected', maybeReconnect);\n });\n connect(_this, token, sdkName, sdkVersion, roomSid, participantSid, options);\n }).catch(function () {\n // ignore failures to connect\n });\n return _this;\n }\n /**\n * Start connecting to the Insights gateway.\n * @param {string} roomSid\n * @param {string} participantSid\n * @returns {void}\n */\n InsightsPublisher.prototype.connect = function (roomSid, participantSid) {\n this._readyToConnect.resolve({ roomSid: roomSid, participantSid: participantSid });\n };\n /**\n * Publish an event to the Insights gateway.\n * @private\n * @param {*} event\n */\n InsightsPublisher.prototype._publish = function (event) {\n event.session = this._session;\n this._ws.send(JSON.stringify(event));\n };\n /**\n * Disconnect from the Insights gateway.\n * @returns {boolean} true if called when connecting/open, false if not\n */\n InsightsPublisher.prototype.disconnect = function () {\n if (this._ws === null\n || this._ws.readyState === this._WebSocket.CLOSING\n || this._ws.readyState === this._WebSocket.CLOSED) {\n return false;\n }\n try {\n this._ws.close();\n }\n catch (error) {\n // Do nothing.\n }\n this.emit('disconnected');\n return true;\n };\n /**\n * Publish (or queue, if not connected) an event to the Insights gateway.\n * @param {string} groupName - Event group name\n * @param {string} eventName - Event name\n * @param {object} payload - Event payload\n * @returns {boolean} true if queued or published, false if disconnect() called\n */\n InsightsPublisher.prototype.publish = function (groupName, eventName, payload) {\n if (this._ws !== null\n && (this._ws.readyState === this._WebSocket.CLOSING\n || this._ws.readyState === this._WebSocket.CLOSED)) {\n return false;\n }\n var publishOrEnqueue = typeof this._session === 'string'\n ? this._publish.bind(this)\n : this._eventQueue.push.bind(this._eventQueue);\n publishOrEnqueue({\n group: groupName,\n name: eventName,\n payload: payload,\n timestamp: Date.now(),\n type: 'event',\n version: 1\n });\n return true;\n };\n return InsightsPublisher;\n}(EventEmitter));\n/**\n * Start connecting to the Insights gateway.\n * @private\n * @param {InsightsPublisher} publisher\n * @param {string} name\n * @param {string} token\n * @param {string} sdkName\n * @param {string} sdkVersion\n * @param {string} roomSid\n * @param {string} participantSid\n * @param {InsightsPublisherOptions} options\n */\nfunction connect(publisher, token, sdkName, sdkVersion, roomSid, participantSid, options) {\n publisher._connectTimestamp = Date.now();\n publisher._reconnectAttemptsLeft--;\n publisher._ws = new options.WebSocket(options.gateway);\n var ws = publisher._ws;\n ws.addEventListener('close', function (event) {\n if (event.code === WS_CLOSE_NORMAL) {\n publisher.emit('disconnected');\n return;\n }\n publisher.emit('disconnected', new Error(\"WebSocket Error \" + event.code + \": \" + event.reason));\n });\n ws.addEventListener('message', function (message) {\n handleConnectResponse(publisher, JSON.parse(message.data), options);\n });\n ws.addEventListener('open', function () {\n var connectRequest = {\n type: 'connect',\n token: token,\n version: 1\n };\n connectRequest.publisher = {\n name: sdkName,\n sdkVersion: sdkVersion,\n userAgent: options.userAgent,\n participantSid: participantSid,\n roomSid: roomSid,\n };\n if (browserdetection.isIpad()) {\n connectRequest.publisher = __assign(__assign({}, connectRequest.publisher), hardwareDevicePublisheriPad);\n }\n else if (browserdetection.isIphone()) {\n connectRequest.publisher = __assign(__assign({}, connectRequest.publisher), hardwareDevicePublisheriPhone);\n }\n ws.send(JSON.stringify(connectRequest));\n });\n}\n/**\n * Create the Insights Websocket gateway URL.\n * @param {string} environment\n * @param {string} realm\n * @returns {string}\n */\nfunction createGateway(environment, realm) {\n return environment === 'prod' ? \"wss://sdkgw.\" + realm + \".twilio.com\"\n : \"wss://sdkgw.\" + environment + \"-\" + realm + \".twilio.com\";\n}\n/**\n * Handle connect response from the Insights gateway.\n * @param {InsightsPublisher} publisher\n * @param {*} response\n * @param {InsightsPublisherOptions} options\n */\nfunction handleConnectResponse(publisher, response, options) {\n switch (response.type) {\n case 'connected':\n publisher._session = response.session;\n publisher._reconnectAttemptsLeft = options.maxReconnectAttempts;\n publisher._eventQueue.splice(0).forEach(publisher._publish, publisher);\n publisher.emit('connected');\n break;\n case 'error':\n publisher._ws.close();\n publisher.emit('disconnected', new Error(response.message));\n break;\n }\n}\n/**\n * Start re-connecting to the Insights gateway with an appropriate delay based\n * on InsightsPublisherOptions#reconnectIntervalMs.\n * @private\n * @param {InsightsPublisher} publisher\n * @param {string} token\n * @param {string} sdkName\n * @param {string} sdkVersion\n * @param {string} roomSid\n * @param {string} participantSid\n * @param {InsightsPublisherOptions} options\n */\nfunction reconnect(publisher, token, sdkName, sdkVersion, roomSid, participantSid, options) {\n var connectInterval = Date.now() - publisher._connectTimestamp;\n var timeToWait = options.reconnectIntervalMs - connectInterval;\n if (timeToWait > 0) {\n setTimeout(function () {\n connect(publisher, token, sdkName, sdkVersion, roomSid, participantSid, options);\n }, timeToWait);\n return;\n }\n connect(publisher, token, sdkName, sdkVersion, roomSid, participantSid, options);\n}\n/**\n * The {@link InsightsPublisher} is connected to the gateway.\n * @event InsightsPublisher#connected\n */\n/**\n * The {@link InsightsPublisher} is disconnected from the gateway.\n * @event InsightsPublisher#disconnected\n * @param {Error} [error] - Optional error if disconnected unintentionally\n */\n/**\n * The {@link InsightsPublisher} is re-connecting to the gateway.\n * @event InsightsPublisher#reconnecting\n */\n/**\n * {@link InsightsPublisher} options.\n * @typedef {object} InsightsPublisherOptions\n * @property {string} [gateway=sdkgw.{environment}-{realm}.twilio.com] - Insights WebSocket gateway url\n * @property {number} [maxReconnectAttempts=5] - Max re-connect attempts\n * @property {number} [reconnectIntervalMs=50] - Re-connect interval in ms\n */\nmodule.exports = InsightsPublisher;\n//# sourceMappingURL=index.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.runPreflight = exports.PreflightTest = void 0;\nvar constants_1 = require(\"../util/constants\");\nvar timer_1 = require(\"./timer\");\nvar mos_1 = require(\"./mos\");\nvar getCombinedConnectionStats_1 = require(\"./getCombinedConnectionStats\");\nvar getturncredentials_1 = require(\"./getturncredentials\");\nvar makestat_1 = require(\"./makestat\");\nvar syntheticaudio_1 = require(\"./syntheticaudio\");\nvar syntheticvideo_1 = require(\"./syntheticvideo\");\nvar index_1 = require(\"../util/index\");\nvar WS_SERVER = require('../util/constants').WS_SERVER;\nvar Log = require('../util/log');\nvar EventEmitter = require('../eventemitter');\nvar MovingAverageDelta = require('../util/movingaveragedelta');\nvar EventObserver = require('../util/eventobserver');\nvar InsightsPublisher = require('../util/insightspublisher');\nvar _a = require('../util/sid'), createSID = _a.createSID, sessionSID = _a.sessionSID;\nvar _b = require('../util/twilio-video-errors'), SignalingConnectionTimeoutError = _b.SignalingConnectionTimeoutError, MediaConnectionError = _b.MediaConnectionError;\nvar SECOND = 1000;\nvar DEFAULT_TEST_DURATION = 10 * SECOND;\n/**\n * progress values that are sent by {@link PreflightTest#event:progress}\n * @enum {string}\n */\nvar PreflightProgress = {\n /**\n * {@link PreflightTest} has successfully generated synthetic tracks\n */\n mediaAcquired: 'mediaAcquired',\n /**\n * {@link PreflightTest} has successfully connected to twilio server and obtained turn credentials\n */\n connected: 'connected',\n /**\n * SubscriberParticipant successfully subscribed to media tracks.\n */\n mediaSubscribed: 'mediaSubscribed',\n /**\n * Media flow was detected.\n */\n mediaStarted: 'mediaStarted',\n /**\n * Established DTLS connection. This is measured from RTCDtlsTransport `connecting` to `connected` state.\n * On Safari, Support for measuring this is missing, this event will be not be emitted on Safari.\n */\n dtlsConnected: 'dtlsConnected',\n /**\n * Established a PeerConnection, This is measured from PeerConnection `connecting` to `connected` state.\n * On Firefox, Support for measuring this is missing, this event will be not be emitted on Firefox.\n */\n peerConnectionConnected: 'peerConnectionConnected',\n /**\n * Established ICE connection. This is measured from ICE connection `checking` to `connected` state.\n */\n iceConnected: 'iceConnected'\n};\nfunction notEmpty(value) {\n return value !== null && typeof value !== 'undefined';\n}\nvar nInstances = 0;\n/**\n * A {@link PreflightTest} monitors progress of an ongoing preflight test.\n *

\n * Instance of {@link PreflightTest} is returned by calling {@link module:twilio-video.runPreflight}\n * @extends EventEmitter\n * @emits PreflightTest#completed\n * @emits PreflightTest#failed\n * @emits PreflightTest#progress\n */\nvar PreflightTest = /** @class */ (function (_super) {\n __extends(PreflightTest, _super);\n /**\n * Constructs {@link PreflightTest}.\n * @param {string} token\n * @param {?PreflightOptions} [options]\n */\n function PreflightTest(token, options) {\n var _this = _super.call(this) || this;\n _this._testTiming = new timer_1.Timer();\n _this._dtlsTiming = new timer_1.Timer();\n _this._iceTiming = new timer_1.Timer();\n _this._peerConnectionTiming = new timer_1.Timer();\n _this._mediaTiming = new timer_1.Timer();\n _this._connectTiming = new timer_1.Timer();\n _this._sentBytesMovingAverage = new MovingAverageDelta();\n _this._packetLossMovingAverage = new MovingAverageDelta();\n _this._progressEvents = [];\n _this._receivedBytesMovingAverage = new MovingAverageDelta();\n var internalOptions = options;\n var _a = internalOptions.environment, environment = _a === void 0 ? 'prod' : _a, _b = internalOptions.region, region = _b === void 0 ? 'gll' : _b, _c = internalOptions.duration, duration = _c === void 0 ? DEFAULT_TEST_DURATION : _c;\n // eslint-disable-next-line new-cap\n var wsServer = internalOptions.wsServer || WS_SERVER(environment, region);\n _this._log = new Log('default', _this, constants_1.DEFAULT_LOG_LEVEL, constants_1.DEFAULT_LOGGER_NAME);\n _this._testDuration = duration;\n _this._instanceId = nInstances++;\n _this._testTiming.start();\n _this._runPreflightTest(token, environment, wsServer);\n return _this;\n }\n PreflightTest.prototype.toString = function () {\n return \"[Preflight #\" + this._instanceId + \"]\";\n };\n /**\n * stops ongoing tests and emits error\n */\n PreflightTest.prototype.stop = function () {\n this._stopped = true;\n };\n PreflightTest.prototype._generatePreflightReport = function (collectedStats) {\n this._testTiming.stop();\n return {\n testTiming: this._testTiming.getTimeMeasurement(),\n networkTiming: {\n dtls: this._dtlsTiming.getTimeMeasurement(),\n ice: this._iceTiming.getTimeMeasurement(),\n peerConnection: this._peerConnectionTiming.getTimeMeasurement(),\n connect: this._connectTiming.getTimeMeasurement(),\n media: this._mediaTiming.getTimeMeasurement()\n },\n stats: {\n jitter: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.jitter),\n rtt: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.rtt),\n packetLoss: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.packetLoss),\n },\n selectedIceCandidatePairStats: collectedStats ? collectedStats.selectedIceCandidatePairStats : null,\n iceCandidateStats: collectedStats ? collectedStats.iceCandidateStats : [],\n progressEvents: this._progressEvents,\n // NOTE(mpatwardhan): internal properties.\n mos: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.mos),\n };\n };\n PreflightTest.prototype._executePreflightStep = function (stepName, step, timeoutError) {\n return __awaiter(this, void 0, void 0, function () {\n var MAX_STEP_DURATION, stepPromise, timer, timeoutPromise, result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this._log.debug('Executing step: ', stepName);\n MAX_STEP_DURATION = this._testDuration + 10 * SECOND;\n if (this._stopped) {\n throw new Error('stopped');\n }\n stepPromise = Promise.resolve().then(step);\n timer = null;\n timeoutPromise = new Promise(function (_resolve, reject) {\n timer = setTimeout(function () {\n reject(timeoutError || new Error(stepName + \" timeout.\"));\n }, MAX_STEP_DURATION);\n });\n _a.label = 1;\n case 1:\n _a.trys.push([1, , 3, 4]);\n return [4 /*yield*/, Promise.race([timeoutPromise, stepPromise])];\n case 2:\n result = _a.sent();\n return [2 /*return*/, result];\n case 3:\n if (timer !== null) {\n clearTimeout(timer);\n }\n return [7 /*endfinally*/];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n PreflightTest.prototype._collectNetworkTimings = function (pc) {\n var _this = this;\n return new Promise(function (resolve) {\n var dtlsTransport;\n pc.addEventListener('iceconnectionstatechange', function () {\n if (pc.iceConnectionState === 'checking') {\n _this._iceTiming.start();\n }\n if (pc.iceConnectionState === 'connected') {\n _this._iceTiming.stop();\n _this._updateProgress(PreflightProgress.iceConnected);\n if (!dtlsTransport || dtlsTransport && dtlsTransport.state === 'connected') {\n resolve();\n }\n }\n });\n // firefox does not support connectionstatechange.\n pc.addEventListener('connectionstatechange', function () {\n if (pc.connectionState === 'connecting') {\n _this._peerConnectionTiming.start();\n }\n if (pc.connectionState === 'connected') {\n _this._peerConnectionTiming.stop();\n _this._updateProgress(PreflightProgress.peerConnectionConnected);\n }\n });\n // Safari does not expose sender.transport.\n var senders = pc.getSenders();\n var transport = senders.map(function (sender) { return sender.transport; }).find(notEmpty);\n if (typeof transport !== 'undefined') {\n dtlsTransport = transport;\n dtlsTransport.addEventListener('statechange', function () {\n if (dtlsTransport.state === 'connecting') {\n _this._dtlsTiming.start();\n }\n if (dtlsTransport.state === 'connected') {\n _this._dtlsTiming.stop();\n _this._updateProgress(PreflightProgress.dtlsConnected);\n if (pc.iceConnectionState === 'connected') {\n resolve();\n }\n }\n });\n }\n });\n };\n PreflightTest.prototype._setupInsights = function (_a) {\n var token = _a.token, _b = _a.environment, environment = _b === void 0 ? constants_1.DEFAULT_ENVIRONMENT : _b, _c = _a.realm, realm = _c === void 0 ? constants_1.DEFAULT_REALM : _c;\n var eventPublisherOptions = {};\n var eventPublisher = new InsightsPublisher(token, constants_1.SDK_NAME, constants_1.SDK_VERSION, environment, realm, eventPublisherOptions);\n // event publisher requires room sid/participant sid. supply fake ones.\n eventPublisher.connect('PREFLIGHT_ROOM_SID', 'PREFLIGHT_PARTICIPANT');\n var eventObserver = new EventObserver(eventPublisher, Date.now(), this._log);\n // eslint-disable-next-line no-undefined\n var undefinedValue = undefined;\n return {\n reportToInsights: function (_a) {\n var _b, _c;\n var report = _a.report;\n var jitterStats = report.stats.jitter || undefinedValue;\n var rttStats = report.stats.rtt || undefinedValue;\n var packetLossStats = report.stats.packetLoss || undefinedValue;\n var mosStats = report.mos || undefinedValue;\n // stringify important info from ice candidates.\n var candidateTypeToProtocols = new Map();\n report.iceCandidateStats.forEach(function (candidateStats) {\n if (candidateStats.candidateType && candidateStats.protocol) {\n var protocols = candidateTypeToProtocols.get(candidateStats.candidateType) || [];\n if (protocols.indexOf(candidateStats.protocol) < 0) {\n protocols.push(candidateStats.protocol);\n }\n candidateTypeToProtocols.set(candidateStats.candidateType, protocols);\n }\n });\n var iceCandidateStats = JSON.stringify(Object.fromEntries(candidateTypeToProtocols));\n var insightsReport = {\n name: 'report',\n group: 'preflight',\n level: report.error ? 'error' : 'info',\n payload: {\n sessionSID: sessionSID,\n preflightSID: createSID('PF'),\n progressEvents: JSON.stringify(report.progressEvents),\n testTiming: report.testTiming,\n dtlsTiming: report.networkTiming.dtls,\n iceTiming: report.networkTiming.ice,\n peerConnectionTiming: report.networkTiming.peerConnection,\n connectTiming: report.networkTiming.connect,\n mediaTiming: report.networkTiming.media,\n selectedLocalCandidate: (_b = report.selectedIceCandidatePairStats) === null || _b === void 0 ? void 0 : _b.localCandidate,\n selectedRemoteCandidate: (_c = report.selectedIceCandidatePairStats) === null || _c === void 0 ? void 0 : _c.remoteCandidate,\n iceCandidateStats: iceCandidateStats,\n jitterStats: jitterStats,\n rttStats: rttStats,\n packetLossStats: packetLossStats,\n mosStats: mosStats,\n error: report.error\n }\n };\n eventObserver.emit('event', insightsReport);\n setTimeout(function () { return eventPublisher.disconnect(); }, 2000);\n }\n };\n };\n PreflightTest.prototype._runPreflightTest = function (token, environment, wsServer) {\n return __awaiter(this, void 0, void 0, function () {\n var localTracks, pcs, reportToInsights, elements_1, iceServers, senderPC_1, receiverPC_1, remoteTracks_1, collectedStats_1, report, error_1, preflightReport;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n localTracks = [];\n pcs = [];\n reportToInsights = this._setupInsights({ token: token, environment: environment }).reportToInsights;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 8, 9, 10]);\n elements_1 = [];\n return [4 /*yield*/, this._executePreflightStep('Acquire media', function () { return [syntheticaudio_1.syntheticAudio(), syntheticvideo_1.syntheticVideo({ width: 640, height: 480 })]; })];\n case 2:\n localTracks = _a.sent();\n this._updateProgress(PreflightProgress.mediaAcquired);\n this.emit('debug', { localTracks: localTracks });\n this._connectTiming.start();\n return [4 /*yield*/, this._executePreflightStep('Get turn credentials', function () { return getturncredentials_1.getTurnCredentials(token, wsServer); }, new SignalingConnectionTimeoutError())];\n case 3:\n iceServers = _a.sent();\n this._connectTiming.stop();\n this._updateProgress(PreflightProgress.connected);\n senderPC_1 = new RTCPeerConnection({ iceServers: iceServers, iceTransportPolicy: 'relay', bundlePolicy: 'max-bundle' });\n receiverPC_1 = new RTCPeerConnection({ iceServers: iceServers, bundlePolicy: 'max-bundle' });\n pcs.push(senderPC_1);\n pcs.push(receiverPC_1);\n this._mediaTiming.start();\n return [4 /*yield*/, this._executePreflightStep('Setup Peer Connections', function () { return __awaiter(_this, void 0, void 0, function () {\n var remoteTracksPromise, offer, updatedOffer, answer;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n senderPC_1.addEventListener('icecandidate', function (event) { return event.candidate && receiverPC_1.addIceCandidate(event.candidate); });\n receiverPC_1.addEventListener('icecandidate', function (event) { return event.candidate && senderPC_1.addIceCandidate(event.candidate); });\n localTracks.forEach(function (track) { return senderPC_1.addTrack(track); });\n remoteTracksPromise = new Promise(function (resolve) {\n var remoteTracks = [];\n receiverPC_1.addEventListener('track', function (event) {\n remoteTracks.push(event.track);\n if (remoteTracks.length === localTracks.length) {\n resolve(remoteTracks);\n }\n });\n });\n return [4 /*yield*/, senderPC_1.createOffer()];\n case 1:\n offer = _a.sent();\n updatedOffer = offer;\n return [4 /*yield*/, senderPC_1.setLocalDescription(updatedOffer)];\n case 2:\n _a.sent();\n return [4 /*yield*/, receiverPC_1.setRemoteDescription(updatedOffer)];\n case 3:\n _a.sent();\n return [4 /*yield*/, receiverPC_1.createAnswer()];\n case 4:\n answer = _a.sent();\n return [4 /*yield*/, receiverPC_1.setLocalDescription(answer)];\n case 5:\n _a.sent();\n return [4 /*yield*/, senderPC_1.setRemoteDescription(answer)];\n case 6:\n _a.sent();\n return [4 /*yield*/, this._collectNetworkTimings(senderPC_1)];\n case 7:\n _a.sent();\n return [2 /*return*/, remoteTracksPromise];\n }\n });\n }); }, new MediaConnectionError())];\n case 4:\n remoteTracks_1 = _a.sent();\n this.emit('debug', { remoteTracks: remoteTracks_1 });\n remoteTracks_1.forEach(function (track) {\n track.addEventListener('ended', function () { return _this._log.warn(track.kind + ':ended'); });\n track.addEventListener('mute', function () { return _this._log.warn(track.kind + ':muted'); });\n track.addEventListener('unmute', function () { return _this._log.warn(track.kind + ':unmuted'); });\n });\n this._updateProgress(PreflightProgress.mediaSubscribed);\n return [4 /*yield*/, this._executePreflightStep('Wait for tracks to start', function () {\n return new Promise(function (resolve) {\n var element = document.createElement('video');\n element.autoplay = true;\n element.playsInline = true;\n element.muted = true;\n element.srcObject = new MediaStream(remoteTracks_1);\n elements_1.push(element);\n _this.emit('debugElement', element);\n element.oncanplay = resolve;\n });\n }, new MediaConnectionError())];\n case 5:\n _a.sent();\n this._mediaTiming.stop();\n this._updateProgress(PreflightProgress.mediaStarted);\n return [4 /*yield*/, this._executePreflightStep('Collect stats for duration', function () { return _this._collectRTCStatsForDuration(_this._testDuration, initCollectedStats(), senderPC_1, receiverPC_1); })];\n case 6:\n collectedStats_1 = _a.sent();\n return [4 /*yield*/, this._executePreflightStep('Generate report', function () { return _this._generatePreflightReport(collectedStats_1); })];\n case 7:\n report = _a.sent();\n reportToInsights({ report: report });\n this.emit('completed', report);\n return [3 /*break*/, 10];\n case 8:\n error_1 = _a.sent();\n preflightReport = this._generatePreflightReport();\n reportToInsights({ report: __assign(__assign({}, preflightReport), { error: error_1 === null || error_1 === void 0 ? void 0 : error_1.toString() }) });\n this.emit('failed', error_1, preflightReport);\n return [3 /*break*/, 10];\n case 9:\n pcs.forEach(function (pc) { return pc.close(); });\n localTracks.forEach(function (track) { return track.stop(); });\n return [7 /*endfinally*/];\n case 10: return [2 /*return*/];\n }\n });\n });\n };\n PreflightTest.prototype._collectRTCStats = function (collectedStats, senderPC, receiverPC) {\n return __awaiter(this, void 0, void 0, function () {\n var combinedStats, timestamp, bytesSent, bytesReceived, packets, packetsLost, roundTripTime, jitter, selectedIceCandidatePairStats, iceCandidateStats, hasLastData, fractionPacketLost, percentPacketsLost, score;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getCombinedConnectionStats_1.getCombinedConnectionStats({ publisher: senderPC, subscriber: receiverPC })];\n case 1:\n combinedStats = _a.sent();\n timestamp = combinedStats.timestamp, bytesSent = combinedStats.bytesSent, bytesReceived = combinedStats.bytesReceived, packets = combinedStats.packets, packetsLost = combinedStats.packetsLost, roundTripTime = combinedStats.roundTripTime, jitter = combinedStats.jitter, selectedIceCandidatePairStats = combinedStats.selectedIceCandidatePairStats, iceCandidateStats = combinedStats.iceCandidateStats;\n hasLastData = collectedStats.jitter.length > 0;\n collectedStats.jitter.push(jitter);\n collectedStats.rtt.push(roundTripTime);\n this._sentBytesMovingAverage.putSample(bytesSent, timestamp);\n this._receivedBytesMovingAverage.putSample(bytesReceived, timestamp);\n this._packetLossMovingAverage.putSample(packetsLost, packets);\n if (hasLastData) {\n // convert BytesMovingAverage which is in bytes/millisecond to bits/second\n collectedStats.outgoingBitrate.push(this._sentBytesMovingAverage.get() * 1000 * 8);\n collectedStats.incomingBitrate.push(this._receivedBytesMovingAverage.get() * 1000 * 8);\n fractionPacketLost = this._packetLossMovingAverage.get();\n percentPacketsLost = Math.min(100, fractionPacketLost * 100);\n collectedStats.packetLoss.push(percentPacketsLost);\n score = mos_1.calculateMOS(roundTripTime, jitter, fractionPacketLost);\n collectedStats.mos.push(score);\n }\n if (!collectedStats.selectedIceCandidatePairStats) {\n collectedStats.selectedIceCandidatePairStats = selectedIceCandidatePairStats;\n }\n if (collectedStats.iceCandidateStats.length === 0) {\n collectedStats.iceCandidateStats = iceCandidateStats;\n }\n return [2 /*return*/];\n }\n });\n });\n };\n PreflightTest.prototype._collectRTCStatsForDuration = function (duration, collectedStats, senderPC, receiverPC) {\n return __awaiter(this, void 0, void 0, function () {\n var startTime, STAT_INTERVAL, remainingDuration;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n startTime = Date.now();\n STAT_INTERVAL = Math.min(1000, duration);\n return [4 /*yield*/, index_1.waitForSometime(STAT_INTERVAL)];\n case 1:\n _a.sent();\n return [4 /*yield*/, this._collectRTCStats(collectedStats, senderPC, receiverPC)];\n case 2:\n _a.sent();\n remainingDuration = duration - (Date.now() - startTime);\n if (!(remainingDuration > 0)) return [3 /*break*/, 4];\n return [4 /*yield*/, this._collectRTCStatsForDuration(remainingDuration, collectedStats, senderPC, receiverPC)];\n case 3:\n collectedStats = _a.sent();\n _a.label = 4;\n case 4: return [2 /*return*/, collectedStats];\n }\n });\n });\n };\n PreflightTest.prototype._updateProgress = function (name) {\n var duration = Date.now() - this._testTiming.getTimeMeasurement().start;\n this._progressEvents.push({ duration: duration, name: name });\n this.emit('progress', name);\n };\n return PreflightTest;\n}(EventEmitter));\nexports.PreflightTest = PreflightTest;\nfunction initCollectedStats() {\n return {\n mos: [],\n jitter: [],\n rtt: [],\n outgoingBitrate: [],\n incomingBitrate: [],\n packetLoss: [],\n selectedIceCandidatePairStats: null,\n iceCandidateStats: [],\n };\n}\n/**\n * Represents network timing measurements captured during preflight test\n * @typedef {object} NetworkTiming\n * @property {TimeMeasurement} [connect] - Time to establish signaling connection and acquire turn credentials\n * @property {TimeMeasurement} [media] - Time to start media. This is measured from calling connect to remote media getting started.\n * @property {TimeMeasurement} [dtls] - Time to establish dtls connection. This is measured from RTCDtlsTransport `connecting` to `connected` state. (Not available on Safari)\n * @property {TimeMeasurement} [ice] - Time to establish ice connectivity. This is measured from ICE connection `checking` to `connected` state.\n * @property {TimeMeasurement} [peerConnection] - Time to establish peer connectivity. This is measured from PeerConnection `connecting` to `connected` state. (Not available on Firefox)\n */\n/**\n * Represents stats for a numerical metric.\n * @typedef {object} Stats\n * @property {number} [average] - Average value observed.\n * @property {number} [max] - Max value observed.\n * @property {number} [min] - Min value observed.\n */\n/**\n * Represents stats for a numerical metric.\n * @typedef {object} SelectedIceCandidatePairStats\n * @property {RTCIceCandidateStats} [localCandidate] - Selected local ice candidate\n * @property {RTCIceCandidateStats} [remoteCandidate] - Selected local ice candidate\n */\n/**\n * Represents RTC related stats that were observed during preflight test\n * @typedef {object} PreflightReportStats\n * @property {Stats} [jitter] - Packet delay variation in seconds\n * @property {Stats} [rtt] - Round trip time, to the server back to the client in milliseconds.\n * @property {Stats} [packetLoss] - Packet loss as a percent of total packets sent.\n*/\n/**\n * A {@link PreflightProgress} event with timing information.\n * @typedef {object} ProgressEvent\n * @property {number} [duration] - The duration of the event, measured from the start of the test.\n * @property {string} [name] - The {@link PreflightProgress} event name.\n */\n/**\n * Represents report generated by {@link PreflightTest}.\n * @typedef {object} PreflightTestReport\n * @property {TimeMeasurement} [testTiming] - Time measurements of test run time.\n * @property {NetworkTiming} [networkTiming] - Network related time measurements.\n * @property {PreflightReportStats} [stats] - RTC related stats captured during the test.\n * @property {Array} [iceCandidateStats] - List of gathered ice candidates.\n * @property {SelectedIceCandidatePairStats} selectedIceCandidatePairStats - Stats for the ice candidates that were used for the connection.\n * @property {Array} [progressEvents] - {@link ProgressEvent} events detected during the test.\n * Use this information to determine which steps were completed and which ones were not.\n */\n/**\n * You may pass these options to {@link module:twilio-video.testPreflight} in order to override the\n * default behavior.\n * @typedef {object} PreflightOptions\n * @property {string} [region='gll'] - Preferred signaling region; By default, you will be connected to the\n * nearest signaling server determined by latency based routing. Setting a value other\n * than gll bypasses routing and guarantees that signaling traffic will be\n * terminated in the region that you prefer. Please refer to this table\n * for the list of supported signaling regions.\n * @property {number} [duration=10000] - number of milliseconds to run test for.\n * once connected test will run for this duration before generating the stats report.\n */\n/**\n * Preflight test has completed successfully.\n * @param {PreflightTestReport} report - Results of the test.\n * @event PreflightTest#completed\n */\n/**\n * Preflight test has encountered a failure and is now stopped.\n * @param {TwilioError|Error} error - A TwilioError or a DOMException.\n * Possible TwilioErrors include Signaling and Media related errors which can be found\n * here.\n * @param {PreflightTestReport} report - Partial results gathered during the test. Use this information to help determine the cause of failure.\n * @event PreflightTest#failed\n */\n/**\n * Emitted to indicate progress of the test\n * @param {PreflightProgress} progress - Indicates the status completed.\n * @event PreflightTest#progress\n */\n/**\n * @method\n * @name runPreflight\n * @description Run a preflight test. This method will start a test to check the quality of network connection.\n * @memberof module:twilio-video\n * @param {string} token - The Access Token string\n * @param {PreflightOptions} options - Options for the test\n * @returns {PreflightTest} preflightTest - An instance to be used to monitor progress of the test.\n * @example\n * var { runPreflight } = require('twilio-video');\n * var preflight = runPreflight(token, preflightOptions);\n * preflightTest.on('progress', progress => {\n * console.log('preflight progress:', progress);\n * });\n *\n * preflightTest.on('failed', (error, report) => {\n * console.error('preflight error:', error, report);\n * });\n *\n * preflightTest.on('completed', report => {\n * console.log('preflight completed:', report));\n * });\n*/\nfunction runPreflight(token, options) {\n if (options === void 0) { options = {}; }\n var preflight = new PreflightTest(token, options);\n return preflight;\n}\nexports.runPreflight = runPreflight;\n//# sourceMappingURL=preflighttest.js.map","'use strict';\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\n/**\n * A Promise that can be canceled with {@link CancelablePromise#cancel}.\n * @extends Promise\n*/\nvar CancelablePromise = /** @class */ (function () {\n /**\n * Construct a new {@link CancelablePromise}.\n * @param {CancelablePromise.OnCreate} onCreate\n * @param {CancelablePromise.OnCancel} onCancel\n */ /**\n * A function to be called on {@link CancelablePromise} creation\n * @typedef {function} CancelablePromise.OnCreate\n * @param {function(*)} resolve\n * @param {function(*)} reject\n * @param {function(): boolean} isCanceled\n */ /**\n * A function to be called when {@link CancelablePromise#cancel} is called\n * @typedef {function} CancelablePromise.OnCancel\n */\n function CancelablePromise(onCreate, onCancel) {\n var _this = this;\n /* istanbul ignore next */\n Object.defineProperties(this, {\n _isCancelable: {\n writable: true,\n value: true\n },\n _isCanceled: {\n writable: true,\n value: false\n },\n _onCancel: {\n value: onCancel\n }\n });\n Object.defineProperty(this, '_promise', {\n value: new Promise(function (resolve, reject) {\n onCreate(function (value) {\n _this._isCancelable = false;\n resolve(value);\n }, function (reason) {\n _this._isCancelable = false;\n reject(reason);\n }, function () { return _this._isCanceled; });\n })\n });\n }\n /**\n * Create a synchronously-rejected {@link CancelablePromise}.\n * @param {*} reason\n * @returns {Promise<*>}\n */\n CancelablePromise.reject = function (reason) {\n return new CancelablePromise(function rejected(resolve, reject) {\n reject(reason);\n }, function onCancel() {\n // Do nothing.\n });\n };\n /**\n * Create a synchronously-resolved {@link CancelablePromise}.\n * @param {*|Promise<*>|Thenable<*>} result\n * @returns {CancelablePromise<*>}\n */\n CancelablePromise.resolve = function (result) {\n return new CancelablePromise(function resolved(resolve) {\n resolve(result);\n }, function onCancel() {\n // Do nothing.\n });\n };\n /**\n * Attempt to cancel the {@link CancelablePromise}.\n * @returns {this}\n */\n CancelablePromise.prototype.cancel = function () {\n if (this._isCancelable) {\n this._isCanceled = true;\n this._onCancel();\n }\n return this;\n };\n /**\n * @param {function} onRejected\n * @returns {CancelablePromise}\n */\n CancelablePromise.prototype.catch = function () {\n var args = [].slice.call(arguments);\n var promise = this._promise;\n return new CancelablePromise(function onCreate(resolve, reject) {\n promise.catch.apply(promise, __spreadArray([], __read(args))).then(resolve, reject);\n }, this._onCancel);\n };\n /**\n * @param {?function} onResolved\n * @param {function} [onRejected]\n * @returns {CancelablePromise}\n */\n CancelablePromise.prototype.then = function () {\n var args = [].slice.call(arguments);\n var promise = this._promise;\n return new CancelablePromise(function onCreate(resolve, reject) {\n promise.then.apply(promise, __spreadArray([], __read(args))).then(resolve, reject);\n }, this._onCancel);\n };\n /**\n * @param {?function} onFinally\n * @returns {CancelablePromise}\n */\n CancelablePromise.prototype.finally = function () {\n var args = [].slice.call(arguments);\n var promise = this._promise;\n return new CancelablePromise(function onCreate(resolve, reject) {\n promise.finally.apply(promise, __spreadArray([], __read(args))).then(resolve, reject);\n }, this._onCancel);\n };\n return CancelablePromise;\n}());\nmodule.exports = CancelablePromise;\n//# sourceMappingURL=cancelablepromise.js.map","'use strict';\nvar CancelablePromise = require('./util/cancelablepromise');\n/**\n * Create a {@link CancelablePromise}.\n * @param {function(function(Array): CancelablePromise):\n * Promise>} getLocalTracks\n * @param {function(Array): LocalParticipant} createLocalParticipant\n * @param {function(Array): CancelablePromise} createRoomSignaling\n * @param {function(LocalParticipant, RoomSignaling): Room} createRoom\n * @returns CancelablePromise\n */\nfunction createCancelableRoomPromise(getLocalTracks, createLocalParticipant, createRoomSignaling, createRoom) {\n var cancelableRoomSignalingPromise;\n var cancellationError = new Error('Canceled');\n return new CancelablePromise(function onCreate(resolve, reject, isCanceled) {\n var localParticipant;\n getLocalTracks(function getLocalTracksSucceeded(localTracks) {\n if (isCanceled()) {\n return CancelablePromise.reject(cancellationError);\n }\n localParticipant = createLocalParticipant(localTracks);\n return createRoomSignaling(localParticipant).then(function createRoomSignalingSucceeded(getCancelableRoomSignalingPromise) {\n if (isCanceled()) {\n throw cancellationError;\n }\n cancelableRoomSignalingPromise = getCancelableRoomSignalingPromise();\n return cancelableRoomSignalingPromise;\n });\n }).then(function roomSignalingConnected(roomSignaling) {\n if (isCanceled()) {\n roomSignaling.disconnect();\n throw cancellationError;\n }\n resolve(createRoom(localParticipant, roomSignaling));\n }).catch(function onError(error) {\n reject(error);\n });\n }, function onCancel() {\n if (cancelableRoomSignalingPromise) {\n cancelableRoomSignalingPromise.cancel();\n }\n });\n}\nmodule.exports = createCancelableRoomPromise;\n//# sourceMappingURL=cancelableroompromise.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar EventEmitter = require('events').EventEmitter;\n/**\n * {@link EncodingParametersImpl} represents an object which notifies its\n * listeners of any changes in the values of its properties.\n * @extends EventEmitter\n * @implements EncodingParameters\n * @emits EncodingParametersImpl#changed\n * @property {?number} maxAudioBitrate\n * @property {?number} maxVideoBitrate\n */\nvar EncodingParametersImpl = /** @class */ (function (_super) {\n __extends(EncodingParametersImpl, _super);\n /**\n * Construct an {@link EncodingParametersImpl}.\n * @param {EncodingParamters} encodingParameters - Initial {@link EncodingParameters}\n * @param {Boolean} adaptiveSimulcast - true if adaptive simulcast was enabled by connect options.\n */\n function EncodingParametersImpl(encodingParameters, adaptiveSimulcast) {\n var _this = _super.call(this) || this;\n encodingParameters = Object.assign({\n maxAudioBitrate: null,\n maxVideoBitrate: null\n }, encodingParameters);\n Object.defineProperties(_this, {\n maxAudioBitrate: {\n value: encodingParameters.maxAudioBitrate,\n writable: true\n },\n maxVideoBitrate: {\n value: encodingParameters.maxVideoBitrate,\n writable: true\n },\n adaptiveSimulcast: {\n value: adaptiveSimulcast\n }\n });\n return _this;\n }\n /**\n * Returns the bitrate values in an {@link EncodingParameters}.\n * @returns {EncodingParameters}\n */\n EncodingParametersImpl.prototype.toJSON = function () {\n return {\n maxAudioBitrate: this.maxAudioBitrate,\n maxVideoBitrate: this.maxVideoBitrate\n };\n };\n /**\n * Update the bitrate values with those in the given {@link EncodingParameters}.\n * @param {EncodingParameters} encodingParameters - The new {@link EncodingParameters}\n * @fires EncodingParametersImpl#changed\n */\n EncodingParametersImpl.prototype.update = function (encodingParameters) {\n var _this = this;\n encodingParameters = Object.assign({\n maxAudioBitrate: this.maxAudioBitrate,\n maxVideoBitrate: this.maxVideoBitrate\n }, encodingParameters);\n var shouldEmitChanged = [\n 'maxAudioBitrate',\n 'maxVideoBitrate'\n ].reduce(function (shouldEmitChanged, maxKindBitrate) {\n if (_this[maxKindBitrate] !== encodingParameters[maxKindBitrate]) {\n _this[maxKindBitrate] = encodingParameters[maxKindBitrate];\n shouldEmitChanged = true;\n }\n return shouldEmitChanged;\n }, false);\n if (shouldEmitChanged) {\n this.emit('changed');\n }\n };\n return EncodingParametersImpl;\n}(EventEmitter));\n/**\n * At least one of the {@link EncodingParametersImpl}'s bitrate values changed.\n * @event EncodingParametersImpl#changed\n */\nmodule.exports = EncodingParametersImpl;\n//# sourceMappingURL=encodingparameters.js.map","'use strict';\nvar isNonArrayObject = require('./').isNonArrayObject;\nvar _a = require('./constants'), E = _a.typeErrors, clientTrackSwitchOffControl = _a.clientTrackSwitchOffControl, videoContentPreferencesMode = _a.videoContentPreferencesMode, subscriptionMode = _a.subscriptionMode, trackPriority = _a.trackPriority, trackSwitchOffMode = _a.trackSwitchOffMode;\n/**\n * Validate the {@link BandwidthProfileOptions} object.\n * @param {BandwidthProfileOptions} bandwidthProfile\n * @returns {?Error} - null if valid, Error if not.\n */\nfunction validateBandwidthProfile(bandwidthProfile) {\n var error = validateObject(bandwidthProfile, 'options.bandwidthProfile');\n if (!bandwidthProfile || error) {\n return error;\n }\n error = validateObject(bandwidthProfile.video, 'options.bandwidthProfile.video', [\n { prop: 'contentPreferencesMode', values: Object.values(videoContentPreferencesMode) },\n { prop: 'dominantSpeakerPriority', values: Object.values(trackPriority) },\n { prop: 'maxSubscriptionBitrate', type: 'number' },\n { prop: 'maxTracks', type: 'number' },\n { prop: 'mode', values: Object.values(subscriptionMode) },\n { prop: 'clientTrackSwitchOffControl', values: Object.values(clientTrackSwitchOffControl) },\n { prop: 'trackSwitchOffMode', values: Object.values(trackSwitchOffMode) }\n ]);\n if (error) {\n return error;\n }\n if (bandwidthProfile.video) {\n // maxTracks is replaced by clientTrackSwitchOffControl.\n // throw an error if both are specified.\n if ('maxTracks' in bandwidthProfile.video && 'clientTrackSwitchOffControl' in bandwidthProfile.video) {\n return new TypeError('options.bandwidthProfile.video.maxTracks is deprecated. Use options.bandwidthProfile.video.clientTrackSwitchOffControl instead.');\n }\n // renderDimensions is replaced by contentPreferencesMode.\n // throw an error if both are specified.\n if ('renderDimensions' in bandwidthProfile.video && 'contentPreferencesMode' in bandwidthProfile.video) {\n return new TypeError('options.bandwidthProfile.video.renderDimensions is deprecated. Use options.bandwidthProfile.video.contentPreferencesMode instead.');\n }\n return validateRenderDimensions(bandwidthProfile.video.renderDimensions);\n }\n return null;\n}\n/**\n * Throw if the given track is not a {@link LocalAudioTrack}, a\n * {@link LocalVideoTrack} or a MediaStreamTrack.\n * @param {*} track\n * @param {object} options\n */\nfunction validateLocalTrack(track, options) {\n if (!(track instanceof options.LocalAudioTrack\n || track instanceof options.LocalDataTrack\n || track instanceof options.LocalVideoTrack\n || track instanceof options.MediaStreamTrack)) {\n /* eslint new-cap:0 */\n throw E.INVALID_TYPE('track', 'LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack');\n }\n}\n/**\n * Validate an object. An object is valid if it is undefined or a non-null, non-array\n * object whose properties satisfy the specified data-type or value-range requirements.\n * @param {object} object - the object to be validated\n * @param {string} name - the object name to be used to build the error message, if invalid\n * @param {Array} [propChecks] - optional data-type or value-range requirements\n * for the object's properties\n * @returns {?Error} - null if object is valid, Error if not\n */\nfunction validateObject(object, name, propChecks) {\n if (propChecks === void 0) { propChecks = []; }\n // NOTE(mmalavalli): We determine that an undefined object is valid because this\n // means the parent object does not contain this object as a property, which is\n // a valid scenario.\n if (typeof object === 'undefined') {\n return null;\n }\n // NOTE(mmalavalli): We determine that if the object is null, or an Array, or\n // any other non-object type, then it is invalid.\n if (object === null || !isNonArrayObject(object)) {\n return E.INVALID_TYPE(name, 'object');\n }\n // NOTE(mmalavalli): We determine that the object is invalid if at least one of\n // its properties does not satisfy its data-type or value-range requirement.\n return propChecks.reduce(function (error, _a) {\n var prop = _a.prop, type = _a.type, values = _a.values;\n if (error || !(prop in object)) {\n return error;\n }\n var value = object[prop];\n if (type && typeof value !== type) {\n return E.INVALID_TYPE(name + \".\" + prop, type);\n }\n if (type === 'number' && isNaN(value)) {\n return E.INVALID_TYPE(name + \".\" + prop, type);\n }\n if (Array.isArray(values) && !values.includes(value)) {\n return E.INVALID_VALUE(name + \".\" + prop, values);\n }\n return error;\n }, null);\n}\n/**\n * Validates the renderDimensions field to be \"auto\" or {@link VideoRenderDimensions} object.\n * @param {string|VideoRenderDimensions} renderDimensions\n * @returns {?Error} - null if valid, Error if not.\n */\nfunction validateRenderDimensions(renderDimensions) {\n var name = 'options.bandwidthProfile.video.renderDimensions';\n var error = validateObject(renderDimensions, name);\n return renderDimensions ? error || Object.values(trackPriority).reduce(function (error, prop) {\n return error || validateObject(renderDimensions[prop], name + \".\" + prop, [\n { prop: 'height', type: 'number' },\n { prop: 'width', type: 'number' }\n ]);\n }, null) : error;\n}\nexports.validateBandwidthProfile = validateBandwidthProfile;\nexports.validateLocalTrack = validateLocalTrack;\nexports.validateObject = validateObject;\n//# sourceMappingURL=validate.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar EventEmitter = require('../../eventemitter');\nvar _a = require('../../util'), buildLogLevels = _a.buildLogLevels, valueToJSON = _a.valueToJSON;\nvar DEFAULT_LOG_LEVEL = require('../../util/constants').DEFAULT_LOG_LEVEL;\nvar Log = require('../../util/log');\nvar nInstances = 0;\n/**\n * A {@link TrackPublication} represents a {@link Track} that\n * has been published to a {@link Room}.\n * @property {string} trackName - the published {@link Track}'s name\n * @property {Track.SID} trackSid - SID assigned to the published {@link Track}\n * @emits TrackPublication#trackDisabled\n * @emits TrackPublication#trackEnabled\n */\nvar TrackPublication = /** @class */ (function (_super) {\n __extends(TrackPublication, _super);\n /**\n * Construct a {@link TrackPublication}.\n * @param {string} trackName - the published {@link Track}'s name\n * @param {Track.SID} trackSid - SID assigned to the {@link Track}\n * @param {TrackPublicationOptions} options - {@link TrackPublication} options\n */\n function TrackPublication(trackName, trackSid, options) {\n var _this = _super.call(this) || this;\n options = Object.assign({\n logLevel: DEFAULT_LOG_LEVEL\n }, options);\n var logLevels = buildLogLevels(options.logLevel);\n Object.defineProperties(_this, {\n _instanceId: {\n value: nInstances++\n },\n _log: {\n value: options.log ? options.log.createLog('default', _this) : new Log('default', _this, logLevels, options.loggerName)\n },\n trackName: {\n enumerable: true,\n value: trackName\n },\n trackSid: {\n enumerable: true,\n value: trackSid\n }\n });\n return _this;\n }\n TrackPublication.prototype.toJSON = function () {\n return valueToJSON(this);\n };\n TrackPublication.prototype.toString = function () {\n return \"[TrackPublication #\" + this._instanceId + \": \" + this.trackSid + \"]\";\n };\n return TrackPublication;\n}(EventEmitter));\n/**\n * The published {@link Track} was disabled.\n * @event TrackPublication#trackDisabled\n */\n/**\n * The published {@link Track} was enabled.\n * @event TrackPublication#trackEnabled\n */\n/**\n * A {@link LocalAudioTrackPublication} or a {@link RemoteAudioTrackPublication}.\n * @typedef {LocalAudioTrackPublication|RemoteAudioTrackPublication} AudioTrackPublication\n */\n/**\n * A {@link LocalDataTrackPublication} or a {@link RemoteDataTrackPublication}.\n * @typedef {LocalDataTrackPublication|RemoteDataTrackPublication} DataTrackPublication\n */\n/**\n * A {@link LocalVideoTrackPublication} or a {@link RemoteVideoTrackPublication}.\n * @typedef {LocalVideoTrackPublication|RemoteVideoTrackPublication} VideoTrackPublication\n */\n/**\n * {@link TrackPublication} options\n * @typedef {object} TrackPublicationOptions\n * @property {LogLevel|LogLevels} logLevel - Log level for 'media' modules\n */\nmodule.exports = TrackPublication;\n//# sourceMappingURL=trackpublication.js.map","/* eslint new-cap:0 */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar TrackPublication = require('./trackpublication');\nvar _a = require('../../util/constants'), E = _a.typeErrors, trackPriority = _a.trackPriority;\n/**\n * A {@link LocalTrackPublication} is a {@link LocalTrack} that has been\n * published to a {@link Room}.\n * @extends TrackPublication\n * @property {boolean} isTrackEnabled - whether the published {@link LocalTrack}\n * is enabled\n * @property {Track.Kind} kind - kind of the published {@link LocalTrack}\n * @property {Track.Priority} priority - the publish priority of the {@link LocalTrack}\n * @property {LocalTrack} track - the {@link LocalTrack}\n * @emits LocalTrackPublication#warning\n * @emits LocalTrackPublication#warningsCleared\n */\nvar LocalTrackPublication = /** @class */ (function (_super) {\n __extends(LocalTrackPublication, _super);\n /**\n * Construct a {@link LocalTrackPublication}.\n * @param {LocalTrackPublicationSignaling} signaling - The corresponding\n * {@link LocalTrackPublicationSignaling}\n * @param {LocalTrack} track - The {@link LocalTrack}\n * @param {function(LocalTrackPublication): void} unpublish - The callback\n * that unpublishes the {@link LocalTrackPublication}\n * @param {TrackPublicationOptions} options - {@link LocalTrackPublication}\n * options\n */\n function LocalTrackPublication(signaling, track, unpublish, options) {\n var _this = _super.call(this, track.name, signaling.sid, options) || this;\n Object.defineProperties(_this, {\n _reemitSignalingEvent: {\n value: function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return _this.emit.apply(_this, __spreadArray([args && args.length ? 'warning' : 'warningsCleared'], __read(args)));\n }\n },\n _reemitTrackEvent: {\n value: function () { return _this.emit(_this.isTrackEnabled\n ? 'trackEnabled'\n : 'trackDisabled'); }\n },\n _signaling: {\n value: signaling\n },\n _unpublish: {\n value: unpublish\n },\n isTrackEnabled: {\n enumerable: true,\n get: function () {\n return this.track.kind === 'data' ? true : this.track.isEnabled;\n }\n },\n kind: {\n enumerable: true,\n value: track.kind\n },\n priority: {\n enumerable: true,\n get: function () {\n return signaling.updatedPriority;\n }\n },\n track: {\n enumerable: true,\n value: track\n }\n });\n ['disabled', 'enabled'].forEach(function (name) {\n return track.on(name, _this._reemitTrackEvent);\n });\n ['warning', 'warningsCleared'].forEach(function (name) {\n return signaling.on(name, _this._reemitSignalingEvent);\n });\n return _this;\n }\n LocalTrackPublication.prototype.toString = function () {\n return \"[LocalTrackPublication #\" + this._instanceId + \": \" + this.trackSid + \"]\";\n };\n /**\n * Update the {@link Track.Priority} of the published {@link LocalTrack}.\n * @param {Track.Priority} priority - the new {@link Track.priority}\n * @returns {this}\n * @throws {RangeError}\n */\n LocalTrackPublication.prototype.setPriority = function (priority) {\n var priorityValues = Object.values(trackPriority);\n if (!priorityValues.includes(priority)) {\n throw E.INVALID_VALUE('priority', priorityValues);\n }\n this._signaling.setPriority(priority);\n return this;\n };\n /**\n * Unpublish a {@link LocalTrackPublication}. This means that the media\n * from this {@link LocalTrackPublication} is no longer available to the\n * {@link Room}'s {@link RemoteParticipant}s.\n * @returns {this}\n */\n LocalTrackPublication.prototype.unpublish = function () {\n var _this = this;\n ['disabled', 'enabled'].forEach(function (name) {\n return _this.track.removeListener(name, _this._reemitTrackEvent);\n });\n ['warning', 'warningsCleared'].forEach(function (name) {\n return _this._signaling.removeListener(name, _this._reemitSignalingEvent);\n });\n this._unpublish(this);\n return this;\n };\n return LocalTrackPublication;\n}(TrackPublication));\n/**\n * The published {@link LocalTrack} encountered a warning.\n * This event is only raised if you enabled warnings using notifyWarnings in ConnectOptions.\n * @event LocalTrackPublication#warning\n * @param {string} name - The warning that was raised.\n */\n/**\n * The published {@link LocalTrack} cleared all warnings.\n * This event is only raised if you enabled warnings using notifyWarnings in ConnectOptions.\n * @event LocalTrackPublication#warningsCleared\n */\nmodule.exports = LocalTrackPublication;\n//# sourceMappingURL=localtrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar LocalTrackPublication = require('./localtrackpublication');\n/**\n * A {@link LocalAudioTrackPublication} is a {@link LocalAudioTrack} that has\n * been published to a {@link Room}.\n * @extends LocalTrackPublication\n * @property {Track.Kind} kind - \"audio\"\n * @property {LocalAudioTrack} track - the {@link LocalAudioTrack}\n */\nvar LocalAudioTrackPublication = /** @class */ (function (_super) {\n __extends(LocalAudioTrackPublication, _super);\n /**\n * Construct a {@link LocalAudioTrackPublication}.\n * @param {LocalTrackPublicationSignaling} signaling - The corresponding\n * {@link LocalTrackPublicationSignaling}\n * @param {LocalAudioTrack} track - the {@link LocalAudioTrack}\n * @param {function(LocalTrackPublication): void} unpublish - The callback\n * that unpublishes the {@link LocalTrackPublication}\n * @param {TrackPublicationOptions} options - {@link LocalTrackPublication} options\n */\n function LocalAudioTrackPublication(signaling, track, unpublish, options) {\n return _super.call(this, signaling, track, unpublish, options) || this;\n }\n LocalAudioTrackPublication.prototype.toString = function () {\n return \"[LocalAudioTrackPublication #\" + this._instanceId + \": \" + this.trackSid + \"]\";\n };\n return LocalAudioTrackPublication;\n}(LocalTrackPublication));\nmodule.exports = LocalAudioTrackPublication;\n//# sourceMappingURL=localaudiotrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar LocalTrackPublication = require('./localtrackpublication');\n/**\n * A {@link LocalDataTrackPublication} is a {@link LocalDataTrack} that has been\n * published to a {@link Room}.\n * @extends LocalTrackPublication\n * @property {Track.Kind} kind - \"data\"\n * @property {LocalDataTrack} track - the {@link LocalDataTrack}\n */\nvar LocalDataTrackPublication = /** @class */ (function (_super) {\n __extends(LocalDataTrackPublication, _super);\n /**\n * Construct a {@link LocalDataTrackPublication}.\n * @param {LocalTrackPublicationSignaling} signaling - The corresponding\n * {@link LocalTrackPublicationSignaling}\n * @param {LocalDataTrack} track - the {@link LocalDataTrack}\n * @param {function(LocalTrackPublication): void} unpublish - The callback\n * that unpublishes the {@link LocalTrackPublication}\n * @param {TrackPublicationOptions} options - {@link LocalTrackPublication} options\n */\n function LocalDataTrackPublication(signaling, track, unpublish, options) {\n return _super.call(this, signaling, track, unpublish, options) || this;\n }\n LocalDataTrackPublication.prototype.toString = function () {\n return \"[LocalDataTrackPublication #\" + this._instanceId + \": \" + this.trackSid + \"]\";\n };\n return LocalDataTrackPublication;\n}(LocalTrackPublication));\nmodule.exports = LocalDataTrackPublication;\n//# sourceMappingURL=localdatatrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar LocalTrackPublication = require('./localtrackpublication');\n/**\n * A {@link LocalVideoTrackPublication} is a {@link LocalVideoTrack} that has\n * been published to a {@link Room}.\n * @extends LocalTrackPublication\n * @property {Track.Kind} kind - \"video\"\n * @property {LocalVideoTrack} track - the {@link LocalVideoTrack}\n */\nvar LocalVideoTrackPublication = /** @class */ (function (_super) {\n __extends(LocalVideoTrackPublication, _super);\n /**\n * Construct a {@link LocalVideoTrackPublication}.\n * @param {LocalTrackPublicationSignaling} signaling - The corresponding\n * {@link LocalTrackPublicationSignaling}\n * @param {LocalVideoTrack} track - the {@link LocalVideoTrack}\n * @param {function(LocalTrackPublication): void} unpublish - The callback\n * that unpublishes the {@link LocalTrackPublication}\n * @param {TrackPublicationOptions} options - {@link LocalTrackPublication} options\n */\n function LocalVideoTrackPublication(signaling, track, unpublish, options) {\n return _super.call(this, signaling, track, unpublish, options) || this;\n }\n LocalVideoTrackPublication.prototype.toString = function () {\n return \"[LocalVideoTrackPublication #\" + this._instanceId + \": \" + this.trackSid + \"]\";\n };\n return LocalVideoTrackPublication;\n}(LocalTrackPublication));\nmodule.exports = LocalVideoTrackPublication;\n//# sourceMappingURL=localvideotrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar _a = require('../../util/constants'), E = _a.typeErrors, trackPriority = _a.trackPriority;\nvar isIOS = require('../../util/browserdetection').isIOS;\nvar documentVisibilityMonitor = require('../../util/documentvisibilitymonitor.js');\nfunction mixinRemoteMediaTrack(AudioOrVideoTrack) {\n /**\n * A {@link RemoteMediaTrack} represents a {@link MediaTrack} published to a\n * {@link Room} by a {@link RemoteParticipant}.\n * @property {boolean} isEnabled - Whether the {@link RemoteMediaTrack} is enabled\n * @property {boolean} isSwitchedOff - Whether the {@link RemoteMediaTrack} is switched off\n * @property {Track.SID} sid - The SID assigned to the {@link RemoteMediaTrack}\n * @property {?Track.Priority} priority - The subscribe priority of the {@link RemoteMediaTrack}\n * @emits RemoteMediaTrack#disabled\n * @emits RemoteMediaTrack#enabled\n * @emits RemoteMediaTrack#switchedOff\n * @emits RemoteMediaTrack#switchedOn\n */\n return /** @class */ (function (_super) {\n __extends(RemoteMediaTrack, _super);\n /**\n * Construct a {@link RemoteMediaTrack}.\n * @param {Track.SID} sid\n * @param {MediaTrackReceiver} mediaTrackReceiver\n * @param {boolean} isEnabled\n @param {boolean} isSwitchedOff\n * @param {function(?Track.Priority): void} setPriority - Set or clear the subscribe\n * {@link Track.Priority} of the {@link RemoteMediaTrack}\n * @param {function(ClientRenderHint): void} setRenderHint - Set render hints.\n * @param {{log: Log, name: ?string}} options\n */\n function RemoteMediaTrack(sid, mediaTrackReceiver, isEnabled, isSwitchedOff, setPriority, setRenderHint, options) {\n var _this = this;\n options = Object.assign({\n // NOTE(mpatwardhan): WebKit bug: 212780 sometimes causes the audio/video elements to stay paused when safari\n // regains foreground. To workaround it, when safari gains foreground - we will play any elements that were\n // playing before safari lost foreground.\n workaroundWebKitBug212780: isIOS()\n && typeof document === 'object'\n && typeof document.addEventListener === 'function'\n && typeof document.visibilityState === 'string'\n }, options);\n _this = _super.call(this, mediaTrackReceiver, options) || this;\n Object.defineProperties(_this, {\n _isEnabled: {\n value: isEnabled,\n writable: true\n },\n _isSwitchedOff: {\n value: isSwitchedOff,\n writable: true\n },\n _priority: {\n value: null,\n writable: true\n },\n _setPriority: {\n value: setPriority\n },\n _setRenderHint: {\n value: function (renderHint) {\n _this._log.debug('updating render hint:', renderHint);\n setRenderHint(renderHint);\n }\n },\n isEnabled: {\n enumerable: true,\n get: function () {\n return this._isEnabled;\n }\n },\n isSwitchedOff: {\n enumerable: true,\n get: function () {\n return this._isSwitchedOff;\n }\n },\n priority: {\n enumerable: true,\n get: function () {\n return this._priority;\n }\n },\n sid: {\n enumerable: true,\n value: sid\n },\n _workaroundWebKitBug212780: {\n value: options.workaroundWebKitBug212780\n },\n _workaroundWebKitBug212780Cleanup: {\n value: null,\n writable: true\n }\n });\n return _this;\n }\n /**\n * Update the subscribe {@link Track.Priority} of the {@link RemoteMediaTrack}.\n * @param {?Track.Priority} priority - the new subscribe {@link Track.Priority};\n * If null, then the subscribe {@link Track.Priority} is cleared, which\n * means the {@link Track.Priority} set by the publisher is now the effective priority.\n * @returns {this}\n * @throws {RangeError}\n */\n RemoteMediaTrack.prototype.setPriority = function (priority) {\n var priorityValues = __spreadArray([null], __read(Object.values(trackPriority)));\n if (!priorityValues.includes(priority)) {\n // eslint-disable-next-line new-cap\n throw E.INVALID_VALUE('priority', priorityValues);\n }\n if (this._priority !== priority) {\n this._priority = priority;\n this._setPriority(priority);\n }\n return this;\n };\n /**\n * @private\n * @param {boolean} isEnabled\n */\n RemoteMediaTrack.prototype._setEnabled = function (isEnabled) {\n if (this._isEnabled !== isEnabled) {\n this._isEnabled = isEnabled;\n this.emit(this._isEnabled ? 'enabled' : 'disabled', this);\n }\n };\n /**\n * @private\n * @param {boolean} isSwitchedOff\n */\n RemoteMediaTrack.prototype._setSwitchedOff = function (isSwitchedOff) {\n if (this._isSwitchedOff !== isSwitchedOff) {\n this._isSwitchedOff = isSwitchedOff;\n this.emit(isSwitchedOff ? 'switchedOff' : 'switchedOn', this);\n }\n };\n RemoteMediaTrack.prototype.attach = function (el) {\n var result = _super.prototype.attach.call(this, el);\n if (this.mediaStreamTrack.enabled !== true) {\n // NOTE(mpatwardhan): we disable mediaStreamTrack when there\n // are no attachments to it (see notes below). Now that there\n // are attachments re-enable the track.\n this.mediaStreamTrack.enabled = true;\n if (this.processedTrack) {\n this.processedTrack.enabled = true;\n }\n // NOTE(csantos): since remote tracks disables/enables the mediaStreamTrack,\n // captureFrames stops along with it. We need to start it again after re-enabling.\n // See attach/detach methods in this class and in VideoTrack class.\n if (this.processor) {\n this._captureFrames();\n }\n }\n if (this._workaroundWebKitBug212780) {\n this._workaroundWebKitBug212780Cleanup = this._workaroundWebKitBug212780Cleanup\n || playIfPausedWhileInBackground(this);\n }\n return result;\n };\n RemoteMediaTrack.prototype.detach = function (el) {\n var result = _super.prototype.detach.call(this, el);\n if (this._attachments.size === 0) {\n // NOTE(mpatwardhan): chrome continues playing webrtc audio\n // track even after audio element is removed from the DOM.\n // https://bugs.chromium.org/p/chromium/issues/detail?id=749928\n // to workaround: here disable the track when\n // there are no elements attached to it.\n this.mediaStreamTrack.enabled = false;\n if (this.processedTrack) {\n this.processedTrack.enabled = false;\n }\n if (this._workaroundWebKitBug212780Cleanup) {\n // unhook visibility change\n this._workaroundWebKitBug212780Cleanup();\n this._workaroundWebKitBug212780Cleanup = null;\n }\n }\n return result;\n };\n return RemoteMediaTrack;\n }(AudioOrVideoTrack));\n}\nfunction playIfPausedWhileInBackground(remoteMediaTrack) {\n var log = remoteMediaTrack._log, kind = remoteMediaTrack.kind;\n function onVisibilityChanged(isVisible) {\n if (!isVisible) {\n return;\n }\n remoteMediaTrack._attachments.forEach(function (el) {\n var shim = remoteMediaTrack._elShims.get(el);\n var isInadvertentlyPaused = el.paused && shim && !shim.pausedIntentionally();\n if (isInadvertentlyPaused) {\n log.info(\"Playing inadvertently paused <\" + kind + \"> element\");\n log.debug('Element:', el);\n log.debug('RemoteMediaTrack:', remoteMediaTrack);\n el.play().then(function () {\n log.info(\"Successfully played inadvertently paused <\" + kind + \"> element\");\n log.debug('Element:', el);\n log.debug('RemoteMediaTrack:', remoteMediaTrack);\n }).catch(function (err) {\n log.warn(\"Error while playing inadvertently paused <\" + kind + \"> element:\", { err: err, el: el, remoteMediaTrack: remoteMediaTrack });\n });\n }\n });\n }\n // NOTE(mpatwardhan): listen for document visibility callback on phase 2.\n // this ensures that any LocalMediaTrack's restart (which listen on phase 1) gets executed\n // first. This order is important because we `play` tracks in the callback, and\n // play can fail on safari if audio is not being captured.\n documentVisibilityMonitor.onVisibilityChange(2, onVisibilityChanged);\n return function () {\n documentVisibilityMonitor.offVisibilityChange(2, onVisibilityChanged);\n };\n}\n/**\n * A {@link RemoteMediaTrack} was disabled.\n * @param {RemoteMediaTrack} track - The {@link RemoteMediaTrack} that was\n * disabled\n * @event RemoteMediaTrack#disabled\n */\n/**\n * A {@link RemoteMediaTrack} was enabled.\n * @param {RemoteMediaTrack} track - The {@link RemoteMediaTrack} that was\n * enabled\n * @event RemoteMediaTrack#enabled\n */\n/**\n * A {@link RemoteMediaTrack} was switched off.\n * @param {RemoteMediaTrack} track - The {@link RemoteMediaTrack} that was\n * switched off\n * @event RemoteMediaTrack#switchedOff\n */\n/**\n * A {@link RemoteMediaTrack} was switched on.\n * @param {RemoteMediaTrack} track - The {@link RemoteMediaTrack} that was\n * switched on\n * @event RemoteMediaTrack#switchedOn\n */\n/**\n * A {@link ClientRenderHint} object specifies track dimensions and /enabled disable state.\n * This state will be used by the server(SFU) to determine bandwidth allocation for the track,\n * and turn it on or off as needed.\n * @typedef {object} ClientRenderHint\n * @property {boolean} [enabled] - track is enabled or disabled. defaults to disabled.\n * @property {VideoTrack.Dimensions} [renderDimensions] - Optional parameter to specify the desired\n * render dimensions of {@link RemoteVideoTrack}s. This property must be specified if enabled=true\n */\nmodule.exports = mixinRemoteMediaTrack;\n//# sourceMappingURL=remotemediatrack.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar AudioTrack = require('./audiotrack');\nvar mixinRemoteMediaTrack = require('./remotemediatrack');\nvar RemoteMediaAudioTrack = mixinRemoteMediaTrack(AudioTrack);\n/**\n * A {@link RemoteAudioTrack} represents an {@link AudioTrack} published to a\n * {@link Room} by a {@link RemoteParticipant}.\n * @extends AudioTrack\n * @property {boolean} isEnabled - Whether the {@link RemoteAudioTrack} is enabled\n * @property {boolean} isSwitchedOff - Whether the {@link RemoteAudioTrack} is switched off\n * @property {Track.SID} sid - The {@link RemoteAudioTrack}'s SID\n * @property {?Track.Priority} priority - The subscribe priority of the {@link RemoteAudioTrack}\n * @emits RemoteAudioTrack#disabled\n * @emits RemoteAudioTrack#enabled\n * @emits RemoteAudioTrack#started\n * @emits RemoteAudioTrack#switchedOff\n * @emits RemoteAudioTrack#switchedOn\n */\nvar RemoteAudioTrack = /** @class */ (function (_super) {\n __extends(RemoteAudioTrack, _super);\n /**\n * Construct a {@link RemoteAudioTrack}.\n * @param {Track.SID} sid - The {@link RemoteAudioTrack}'s SID\n * @param {MediaTrackReceiver} mediaTrackReceiver - An audio MediaStreamTrack container\n * @param {boolean} isEnabled - Whether the {@link RemoteAudioTrack} is enabled\n * @param {boolean} isSwitchedOff - Whether the {@link RemoteAudioTrack} is switched off\n * @param {function(?Track.Priority): void} setPriority - Set or clear the subscribe\n * {@link Track.Priority} of the {@link RemoteAudioTrack}\n * @param {function(ClientRenderHint): void} setRenderHint - Set render hints.\n * @param {{log: Log}} options - The {@link RemoteTrack} options\n */\n function RemoteAudioTrack(sid, mediaTrackReceiver, isEnabled, isSwitchedOff, setPriority, setRenderHint, options) {\n return _super.call(this, sid, mediaTrackReceiver, isEnabled, isSwitchedOff, setPriority, setRenderHint, options) || this;\n }\n RemoteAudioTrack.prototype.toString = function () {\n return \"[RemoteAudioTrack #\" + this._instanceId + \": \" + this.sid + \"]\";\n };\n /**\n * @private\n */\n RemoteAudioTrack.prototype._start = function () {\n _super.prototype._start.call(this);\n if (this._dummyEl) {\n // NOTE(mpatwardhan): To fix VIDEO-6336, clear dummy element after the\n // RemoteAudioTrack has started.\n this._dummyEl.srcObject = null;\n this._dummyEl = null;\n }\n };\n /**\n * Update the subscribe {@link Track.Priority} of the {@link RemoteAudioTrack}.\n * @param {?Track.Priority} priority - the new subscribe {@link Track.Priority};\n * Currently setPriority has no effect on audio tracks.\n * @returns {this}\n * @throws {RangeError}\n */\n RemoteAudioTrack.prototype.setPriority = function (priority) {\n return _super.prototype.setPriority.call(this, priority);\n };\n return RemoteAudioTrack;\n}(RemoteMediaAudioTrack));\n/**\n * The {@link RemoteAudioTrack} was disabled, i.e. \"muted\".\n * @param {RemoteAudioTrack} track - The {@link RemoteAudioTrack} that was\n * disabled\n * @event RemoteAudioTrack#disabled\n */\n/**\n * The {@link RemoteAudioTrack} was enabled, i.e. \"unmuted\".\n * @param {RemoteAudioTrack} track - The {@link RemoteAudioTrack} that was\n * enabled\n * @event RemoteAudioTrack#enabled\n */\n/**\n * The {@link RemoteAudioTrack} started. This means there is enough audio data\n * to begin playback.\n * @param {RemoteAudioTrack} track - The {@link RemoteAudioTrack} that started\n * @event RemoteAudioTrack#started\n */\n/**\n * A {@link RemoteAudioTrack} was switched off.\n * @param {RemoteAudioTrack} track - The {@link RemoteAudioTrack} that was\n * switched off\n * @event RemoteAudioTrack#switchedOff\n */\n/**\n * A {@link RemoteAudioTrack} was switched on.\n * @param {RemoteAudioTrack} track - The {@link RemoteAudioTrack} that was\n * switched on\n * @event RemoteAudioTrack#switchedOn\n */\nmodule.exports = RemoteAudioTrack;\n//# sourceMappingURL=remoteaudiotrack.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar TrackPublication = require('./trackpublication');\n/**\n * A {@link RemoteTrackPublication} represents a {@link RemoteTrack} that has\n * been published to a {@link Room}.\n * @extends TrackPublication\n * @property {boolean} isSubscribed - whether the published {@link RemoteTrack}\n * is subscribed to\n * @property {boolean} isTrackEnabled - whether the published\n * {@link RemoteTrack} is enabled\n * @property {Track.Kind} kind - kind of the published {@link RemoteTrack}\n * @property {Track.Priority} publishPriority - the {@link Track.Priority} of the published\n * {@link RemoteTrack} set by the {@link RemoteParticipant}\n * @property {?RemoteTrack} track - Unless you have subscribed to the\n * {@link RemoteTrack}, this property is null\n * @emits RemoteTrackPublication#publishPriorityChanged\n * @emits RemoteTrackPublication#subscribed\n * @emits RemoteTrackPublication#subscriptionFailed\n * @emits RemoteTrackPublication#trackDisabled\n * @emits RemoteTrackPublication#trackEnabled\n * @emits RemoteTrackPublication#trackSwitchedOff\n * @emits RemoteTrackPublication#trackSwitchedOn\n * @emits RemoteTrackPublication#unsubscribed\n *\n */\nvar RemoteTrackPublication = /** @class */ (function (_super) {\n __extends(RemoteTrackPublication, _super);\n /**\n * Construct a {@link RemoteTrackPublication}.\n * @param {RemoteTrackPublicationSignaling} signaling - {@link RemoteTrackPublication} signaling\n * @param {RemoteTrackPublicationOptions} options - {@link RemoteTrackPublication}\n * options\n */\n function RemoteTrackPublication(signaling, options) {\n var _this = _super.call(this, signaling.name, signaling.sid, options) || this;\n Object.defineProperties(_this, {\n _signaling: {\n value: signaling\n },\n _track: {\n value: null,\n writable: true\n },\n isSubscribed: {\n enumerable: true,\n get: function () {\n return !!this._track;\n }\n },\n isTrackEnabled: {\n enumerable: true,\n get: function () {\n return signaling.isEnabled;\n }\n },\n kind: {\n enumerable: true,\n value: signaling.kind\n },\n publishPriority: {\n enumerable: true,\n get: function () {\n return signaling.priority;\n }\n },\n track: {\n enumerable: true,\n get: function () {\n return this._track;\n }\n }\n });\n // remember original state, and fire events only on change.\n var error = signaling.error, isEnabled = signaling.isEnabled, isSwitchedOff = signaling.isSwitchedOff, priority = signaling.priority;\n signaling.on('updated', function () {\n if (error !== signaling.error) {\n error = signaling.error;\n _this.emit('subscriptionFailed', signaling.error);\n return;\n }\n if (isEnabled !== signaling.isEnabled) {\n isEnabled = signaling.isEnabled;\n if (_this.track) {\n _this.track._setEnabled(signaling.isEnabled);\n }\n _this.emit(signaling.isEnabled ? 'trackEnabled' : 'trackDisabled');\n }\n if (isSwitchedOff !== signaling.isSwitchedOff) {\n _this._log.debug(_this.trackSid + \": \" + (isSwitchedOff ? 'OFF' : 'ON') + \" => \" + (signaling.isSwitchedOff ? 'OFF' : 'ON'));\n isSwitchedOff = signaling.isSwitchedOff;\n if (_this.track) {\n _this.track._setSwitchedOff(signaling.isSwitchedOff);\n _this.emit(isSwitchedOff ? 'trackSwitchedOff' : 'trackSwitchedOn', _this.track);\n }\n else if (isSwitchedOff) {\n _this._log.warn('Track was not subscribed when switched Off.');\n }\n }\n if (priority !== signaling.priority) {\n priority = signaling.priority;\n _this.emit('publishPriorityChanged', priority);\n }\n });\n return _this;\n }\n RemoteTrackPublication.prototype.toString = function () {\n return \"[RemoteTrackPublication #\" + this._instanceId + \": \" + this.trackSid + \"]\";\n };\n /**\n * @private\n * @param {RemoteTrack} track\n */\n RemoteTrackPublication.prototype._subscribed = function (track) {\n if (!this._track && track) {\n this._track = track;\n this.emit('subscribed', track);\n }\n };\n /**\n * @private\n */\n RemoteTrackPublication.prototype._unsubscribe = function () {\n if (this._track) {\n var track = this._track;\n this._track = null;\n this.emit('unsubscribed', track);\n }\n };\n return RemoteTrackPublication;\n}(TrackPublication));\n/**\n * The {@link RemoteTrack}'s publish {@link Track.Priority} was changed by the\n * {@link RemoteParticipant}.\n * @param {Track.Priority} priority - the {@link RemoteTrack}'s new publish\n * {@link Track.Priority}; RemoteTrackPublication#publishPriority is also\n * updated accordingly\n * @event RemoteTrackPublication#publishPriorityChanged\n */\n/**\n * Your {@link LocalParticipant} subscribed to the {@link RemoteTrack}.\n * @param {RemoteTrack} track - the {@link RemoteTrack} that was subscribed to\n * @event RemoteTrackPublication#subscribed\n */\n/**\n * Your {@link LocalParticipant} failed to subscribe to the {@link RemoteTrack}.\n * @param {TwilioError} error - the reason the {@link RemoteTrack} could not be\n * subscribed to\n * @event RemoteTrackPublication#subscriptionFailed\n */\n/**\n * The {@link RemoteTrack} was disabled.\n * @event RemoteTrackPublication#trackDisabled\n */\n/**\n * The {@link RemoteTrack} was enabled.\n * @event RemoteTrackPublication#trackEnabled\n */\n/**\n * The {@link RemoteTrack} was switched off.\n * @param {RemoteTrack} track - the {@link RemoteTrack} that was switched off\n * @event RemoteTrackPublication#trackSwitchedOff\n */\n/**\n * The {@link RemoteTrack} was switched on.\n * @param {RemoteTrack} track - the {@link RemoteTrack} that was switched on\n * @event RemoteTrackPublication#trackSwitchedOn\n */\n/**\n * Your {@link LocalParticipant} unsubscribed from the {@link RemoteTrack}.\n * @param {RemoteTrack} track - the {@link RemoteTrack} that was unsubscribed from\n * @event RemoteTrackPublication#unsubscribed\n */\n/**\n * {@link RemoteTrackPublication} options\n * @typedef {object} RemoteTrackPublicationOptions\n * @property {LogLevel|LogLevels} logLevel - Log level for 'media' modules\n */\nmodule.exports = RemoteTrackPublication;\n//# sourceMappingURL=remotetrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar RemoteTrackPublication = require('./remotetrackpublication');\n/**\n * A {@link RemoteAudioTrackPublication} represents a {@link RemoteAudioTrack}\n * that has been published to a {@link Room}.\n * @property {Track.Kind} kind - \"audio\"\n * @property {?RemoteAudioTrack} track - unless you have subscribed to the\n * {@link RemoteAudioTrack}, this property is null\n * @emits RemoteAudioTrackPublication#subscribed\n * @emits RemoteAudioTrackPublication#subscriptionFailed\n * @emits RemoteAudioTrackPublication#trackDisabled\n * @emits RemoteAudioTrackPublication#trackEnabled\n * @emits RemoteAudioTrackPublication#unsubscribed\n */\nvar RemoteAudioTrackPublication = /** @class */ (function (_super) {\n __extends(RemoteAudioTrackPublication, _super);\n /**\n * Construct a {@link RemoteAudioTrackPublication}.\n * @param {RemoteTrackPublicationSignaling} signaling - {@link RemoteTrackPublication} signaling\n * @param {RemoteTrackPublicationOptions} options - {@link RemoteTrackPublication}\n * options\n */\n function RemoteAudioTrackPublication(signaling, options) {\n return _super.call(this, signaling, options) || this;\n }\n RemoteAudioTrackPublication.prototype.toString = function () {\n return \"[RemoteAudioTrackPublication #\" + this._instanceId + \": \" + this.trackSid + \"]\";\n };\n return RemoteAudioTrackPublication;\n}(RemoteTrackPublication));\n/**\n * Your {@link LocalParticipant} subscribed to the {@link RemoteAudioTrack}.\n * @param {RemoteAudioTrack} track - the {@link RemoteAudioTrack} that was subscribed to\n * @event RemoteAudioTrackPublication#subscribed\n */\n/**\n * Your {@link LocalParticipant} failed to subscribe to the {@link RemoteAudioTrack}.\n * @param {TwilioError} error - the reason the {@link RemoteAudioTrack} could not be\n * subscribed to\n * @event RemoteAudioTrackPublication#subscriptionFailed\n */\n/**\n * The {@link RemoteAudioTrack} was disabled.\n * @event RemoteAudioTrackPublication#trackDisabled\n */\n/**\n * The {@link RemoteAudioTrack} was enabled.\n * @event RemoteAudioTrackPublication#trackEnabled\n */\n/**\n * Your {@link LocalParticipant} unsubscribed from the {@link RemoteAudioTrack}.\n * @param {RemoteAudioTrack} track - the {@link RemoteAudioTrack} that was unsubscribed from\n * @event RemoteAudioTrackPublication#unsubscribed\n */\nmodule.exports = RemoteAudioTrackPublication;\n//# sourceMappingURL=remoteaudiotrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar Track = require('./');\nvar _a = require('../../util/constants'), E = _a.typeErrors, trackPriority = _a.trackPriority;\n/**\n * A {@link RemoteDataTrack} represents data published to a {@link Room} by a\n * {@link RemoteParticipant}.\n * @extends Track\n * @property {boolean} isEnabled - true\n * @property {boolean} isSubscribed - Whether the {@link RemoteDataTrack} is\n * subscribed to\n * @property {boolean} isSwitchedOff - Whether the {@link RemoteDataTrack} is\n * switched off\n * @property {Track.Kind} kind - \"data\"\n * @property {?number} maxPacketLifeTime - If non-null, this represents a time\n * limit (in milliseconds) during which data will be transmitted or\n * retransmitted if not acknowledged on the underlying RTCDataChannel.\n * @property {?number} maxRetransmits - If non-null, this represents the number\n * of times the data will be retransmitted if not successfully received on the\n * underlying RTCDataChannel.\n * @property {boolean} ordered - true if data on the {@link RemoteDataTrack} can\n * be received out-of-order.\n * @property {?Track.Priority} priority - The subscribe priority of the {@link RemoteDataTrack}\n * @property {boolean} reliable - This is true if both\n * maxPacketLifeTime and maxRetransmits are set to\n * null. In other words, if this is true, there is no bound on packet lifetime\n * or the number of retransmits that will be attempted, ensuring \"reliable\"\n * transmission.\n * @property {Track.SID} sid - The SID assigned to the {@link RemoteDataTrack}\n * @emits RemoteDataTrack#message\n * @emits RemoteDataTrack#switchedOff\n * @emits RemoteDataTrack#switchedOn\n */\nvar RemoteDataTrack = /** @class */ (function (_super) {\n __extends(RemoteDataTrack, _super);\n /**\n * Construct a {@link RemoteDataTrack} from a {@link DataTrackReceiver}.\n * @param {Track.SID} sid\n * @param {DataTrackReceiver} dataTrackReceiver\n * @param {{log: Log, name: ?string}} options\n */\n function RemoteDataTrack(sid, dataTrackReceiver, options) {\n var _this = _super.call(this, dataTrackReceiver.id, 'data', options) || this;\n Object.defineProperties(_this, {\n _isSwitchedOff: {\n value: false,\n writable: true\n },\n _priority: {\n value: null,\n writable: true\n },\n isEnabled: {\n enumerable: true,\n value: true\n },\n isSwitchedOff: {\n enumerable: true,\n get: function () {\n return this._isSwitchedOff;\n }\n },\n maxPacketLifeTime: {\n enumerable: true,\n value: dataTrackReceiver.maxPacketLifeTime\n },\n maxRetransmits: {\n enumerable: true,\n value: dataTrackReceiver.maxRetransmits\n },\n ordered: {\n enumerable: true,\n value: dataTrackReceiver.ordered\n },\n priority: {\n enumerable: true,\n get: function () {\n return this._priority;\n }\n },\n reliable: {\n enumerable: true,\n value: dataTrackReceiver.maxPacketLifeTime === null\n && dataTrackReceiver.maxRetransmits === null\n },\n sid: {\n enumerable: true,\n value: sid\n }\n });\n dataTrackReceiver.on('message', function (data) {\n _this.emit('message', data, _this);\n });\n return _this;\n }\n /**\n * Update the subscriber {@link Track.Priority} of the {@link RemoteDataTrack}.\n * @param {?Track.Priority} priority - the new {@link Track.priority};\n * Currently setPriority has no effect on data tracks.\n * @returns {this}\n * @throws {RangeError}\n */\n RemoteDataTrack.prototype.setPriority = function (priority) {\n var priorityValues = __spreadArray([null], __read(Object.values(trackPriority)));\n if (!priorityValues.includes(priority)) {\n // eslint-disable-next-line new-cap\n throw E.INVALID_VALUE('priority', priorityValues);\n }\n // Note: priority has no real effect on the data tracks.\n this._priority = priority;\n return this;\n };\n /**\n * @private\n */\n RemoteDataTrack.prototype._setEnabled = function () {\n // Do nothing.\n };\n /**\n * @private\n * @param {boolean} isSwitchedOff\n */\n RemoteDataTrack.prototype._setSwitchedOff = function (isSwitchedOff) {\n if (this._isSwitchedOff !== isSwitchedOff) {\n this._isSwitchedOff = isSwitchedOff;\n this.emit(isSwitchedOff ? 'switchedOff' : 'switchedOn', this);\n }\n };\n return RemoteDataTrack;\n}(Track));\n/**\n * A message was received over the {@link RemoteDataTrack}.\n * @event RemoteDataTrack#message\n * @param {string|ArrayBuffer} data\n * @param {RemoteDataTrack} track - The {@link RemoteDataTrack} that received\n * the message\n */\n/**\n * A {@link RemoteDataTrack} was switched off.\n * @param {RemoteDataTrack} track - The {@link RemoteDataTrack} that was\n * switched off\n * @event RemoteDataTrack#switchedOff\n */\n/**\n * A {@link RemoteDataTrack} was switched on.\n * @param {RemoteDataTrack} track - The {@link RemoteDataTrack} that was\n * switched on\n * @event RemoteDataTrack#switchedOn\n */\nmodule.exports = RemoteDataTrack;\n//# sourceMappingURL=remotedatatrack.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar RemoteTrackPublication = require('./remotetrackpublication');\n/**\n * A {@link RemoteDataTrackPublication} represents a {@link RemoteDataTrack}\n * that has been published to a {@link Room}.\n * @property {Track.Kind} kind - \"data\"\n * @property {?RemoteDataTrack} track - unless you have subscribed to the\n * {@link RemoteDataTrack}, this property is null\n * @emits RemoteDataTrackPublication#subscribed\n * @emits RemoteDataTrackPublication#subscriptionFailed\n * @emits RemoteDataTrackPublication#unsubscribed\n */\nvar RemoteDataTrackPublication = /** @class */ (function (_super) {\n __extends(RemoteDataTrackPublication, _super);\n /**\n * Construct a {@link RemoteDataTrackPublication}.\n * @param {RemoteTrackPublicationSignaling} signaling - {@link RemoteTrackPublication} signaling\n * @param {RemoteTrackPublicationOptions} options - {@link RemoteTrackPublication}\n * options\n */\n function RemoteDataTrackPublication(signaling, options) {\n return _super.call(this, signaling, options) || this;\n }\n RemoteDataTrackPublication.prototype.toString = function () {\n return \"[RemoteDataTrackPublication #\" + this._instanceId + \": \" + this.trackSid + \"]\";\n };\n return RemoteDataTrackPublication;\n}(RemoteTrackPublication));\n/**\n * Your {@link LocalParticipant} subscribed to the {@link RemoteDataTrack}.\n * @param {RemoteDataTrack} track - the {@link RemoteDataTrack} that was subscribed to\n * @event RemoteDataTrackPublication#subscribed\n */\n/**\n * Your {@link LocalParticipant} failed to subscribe to the {@link RemoteDataTrack}.\n * @param {TwilioError} error - the reason the {@link RemoteDataTrack} could not be\n * subscribed to\n * @event RemoteDataTrackPublication#subscriptionFailed\n */\n/**\n * Your {@link LocalParticipant} unsubscribed from the {@link RemoteDataTrack}.\n * @param {RemoteDataTrack} track - the {@link RemoteDataTrack} that was unsubscribed from\n * @event RemoteDataTrackPublication#unsubscribed\n */\nmodule.exports = RemoteDataTrackPublication;\n//# sourceMappingURL=remotedatatrackpublication.js.map","/* eslint-disable no-console */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar NullObserver = /** @class */ (function () {\n function NullObserver(callback) {\n Object.defineProperties(this, {\n _callback: {\n value: callback\n }\n });\n }\n NullObserver.prototype.observe = function () {\n };\n NullObserver.prototype.unobserve = function () {\n };\n NullObserver.prototype.makeVisible = function (videoEl) {\n var visibleEntry = this._makeFakeEntry(videoEl, true);\n this._callback([visibleEntry]);\n };\n NullObserver.prototype.makeInvisible = function (videoEl) {\n var invisibleEntry = this._makeFakeEntry(videoEl, false);\n this._callback([invisibleEntry]);\n };\n NullObserver.prototype._makeFakeEntry = function (videoElement, isIntersecting) {\n return { target: videoElement, isIntersecting: isIntersecting };\n };\n return NullObserver;\n}());\nvar NullIntersectionObserver = /** @class */ (function (_super) {\n __extends(NullIntersectionObserver, _super);\n function NullIntersectionObserver() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return NullIntersectionObserver;\n}(NullObserver));\nvar NullResizeObserver = /** @class */ (function (_super) {\n __extends(NullResizeObserver, _super);\n function NullResizeObserver() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n NullResizeObserver.prototype.resize = function (videoEl) {\n var entry = this._makeFakeEntry(videoEl, true);\n this._callback([entry]);\n };\n return NullResizeObserver;\n}(NullObserver));\nmodule.exports = { NullIntersectionObserver: NullIntersectionObserver, NullResizeObserver: NullResizeObserver, NullObserver: NullObserver };\n//# sourceMappingURL=nullobserver.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar mixinRemoteMediaTrack = require('./remotemediatrack');\nvar VideoTrack = require('./videotrack');\nvar documentVisibilityMonitor = require('../../util/documentvisibilitymonitor.js');\nvar NullObserver = require('../../util/nullobserver.js').NullObserver;\nvar Timeout = require('../../util/timeout');\nvar RemoteMediaVideoTrack = mixinRemoteMediaTrack(VideoTrack);\nvar TRACK_TURN_OF_DELAY_MS = 50;\n/**\n * A {@link RemoteVideoTrack} represents a {@link VideoTrack} published to a\n * {@link Room} by a {@link RemoteParticipant}.\n * @extends VideoTrack\n * @property {boolean} isEnabled - Whether the {@link RemoteVideoTrack} is enabled\n * @property {boolean} isSwitchedOff - Whether the {@link RemoteVideoTrack} is switched off\n * @property {Track.SID} sid - The {@link RemoteVideoTrack}'s SID\n * @property {?Track.Priority} priority - The subscribe priority of the {@link RemoteVideoTrack}\n * @emits RemoteVideoTrack#dimensionsChanged\n * @emits RemoteVideoTrack#disabled\n * @emits RemoteVideoTrack#enabled\n * @emits RemoteVideoTrack#started\n * @emits RemoteVideoTrack#switchedOff\n * @emits RemoteVideoTrack#switchedOn\n */\nvar RemoteVideoTrack = /** @class */ (function (_super) {\n __extends(RemoteVideoTrack, _super);\n /**\n * Construct a {@link RemoteVideoTrack}.\n * @param {Track.SID} sid - The {@link RemoteVideoTrack}'s SID\n * @param {MediaTrackReceiver} mediaTrackReceiver - A video MediaStreamTrack container\n * @param {boolean} isEnabled - whether the {@link RemoteVideoTrack} is enabled\n * @param {boolean} isSwitchedOff - Whether the {@link RemoteVideoTrack} is switched off\n * @param {function(?Track.Priority): void} setPriority - Set or clear the subscribe\n * {@link Track.Priority} of the {@link RemoteVideoTrack}\n * @param {function(ClientRenderHint): void} setRenderHint - Set render hints.\n * @param {{log: Log}} options - The {@link RemoteTrack} options\n */\n function RemoteVideoTrack(sid, mediaTrackReceiver, isEnabled, isSwitchedOff, setPriority, setRenderHint, options) {\n var _this = this;\n options = Object.assign({\n clientTrackSwitchOffControl: 'auto',\n contentPreferencesMode: 'auto',\n enableDocumentVisibilityTurnOff: true,\n }, options);\n options = Object.assign({\n IntersectionObserver: typeof IntersectionObserver === 'undefined' || options.clientTrackSwitchOffControl !== 'auto' ? NullObserver : IntersectionObserver,\n ResizeObserver: typeof ResizeObserver === 'undefined' || options.contentPreferencesMode !== 'auto' ? NullObserver : ResizeObserver,\n }, options);\n _this = _super.call(this, sid, mediaTrackReceiver, isEnabled, isSwitchedOff, setPriority, setRenderHint, options) || this;\n Object.defineProperties(_this, {\n _enableDocumentVisibilityTurnOff: {\n value: options.enableDocumentVisibilityTurnOff === true && options.clientTrackSwitchOffControl === 'auto',\n },\n _documentVisibilityTurnOffCleanup: {\n value: null,\n writable: true\n },\n _clientTrackSwitchOffControl: {\n value: options.clientTrackSwitchOffControl,\n },\n _contentPreferencesMode: {\n value: options.contentPreferencesMode,\n },\n _invisibleElements: {\n value: new WeakSet(),\n },\n _elToPipCallbacks: {\n value: new WeakMap(),\n },\n _elToPipWindows: {\n value: new WeakMap(),\n },\n _turnOffTimer: {\n value: new Timeout(function () {\n _this._setRenderHint({ enabled: false });\n }, TRACK_TURN_OF_DELAY_MS, false),\n },\n _resizeObserver: {\n value: new options.ResizeObserver(function (entries) {\n // NOTE(mpatwardhan): we ignore elements in _invisibleElements\n // to ensure that ResizeObserver does not end-up turning off a track when a fresh Video element is\n // attached and IntersectionObserver has not had its callback executed yet.\n var visibleElementResized = entries.find(function (entry) { return !_this._invisibleElements.has(entry.target); });\n if (visibleElementResized) {\n maybeUpdateDimensionHint(_this);\n }\n })\n },\n _intersectionObserver: {\n value: new options.IntersectionObserver(function (entries) {\n var shouldSetRenderHint = false;\n entries.forEach(function (entry) {\n var wasVisible = !_this._invisibleElements.has(entry.target);\n if (wasVisible !== entry.isIntersecting) {\n if (entry.isIntersecting) {\n _this._log.debug('intersectionObserver detected: Off => On');\n _this._invisibleElements.delete(entry.target);\n }\n else {\n _this._log.debug('intersectionObserver detected: On => Off');\n _this._invisibleElements.add(entry.target);\n }\n shouldSetRenderHint = true;\n }\n });\n if (shouldSetRenderHint) {\n maybeUpdateEnabledHint(_this);\n // when visibility of an element changes that may cause the \"biggest\" element to change,\n // update dimensions as well. since dimensions are cached and de-duped at signaling layer,\n // its okay if they got resent.\n maybeUpdateDimensionHint(_this);\n }\n }, { threshold: 0.25 })\n },\n });\n return _this;\n }\n /**\n * @private\n */\n RemoteVideoTrack.prototype._start = function (dummyEl) {\n var result = _super.prototype._start.call(this, dummyEl);\n // NOTE(mpatwardhan): after emitting started, update turn off track if not visible.\n maybeUpdateEnabledHint(this);\n return result;\n };\n /**\n * Request to switch on a {@link RemoteVideoTrack}, This method is applicable only for the group rooms and only when connected with\n * clientTrackSwitchOffControl in video bandwidth profile options set to 'manual'\n * @returns {this}\n */\n RemoteVideoTrack.prototype.switchOn = function () {\n if (this._clientTrackSwitchOffControl !== 'manual') {\n throw new Error('Invalid state. You can call switchOn only when bandwidthProfile.video.clientTrackSwitchOffControl is set to \"manual\"');\n }\n this._setRenderHint({ enabled: true });\n return this;\n };\n /**\n * Request to switch off a {@link RemoteVideoTrack}, This method is applicable only for the group rooms and only when connected with\n * clientTrackSwitchOffControl in video bandwidth profile options set to 'manual'\n * @returns {this}\n */\n RemoteVideoTrack.prototype.switchOff = function () {\n if (this._clientTrackSwitchOffControl !== 'manual') {\n throw new Error('Invalid state. You can call switchOff only when bandwidthProfile.video.clientTrackSwitchOffControl is set to \"manual\"');\n }\n this._setRenderHint({ enabled: false });\n return this;\n };\n /**\n * Set the {@link RemoteVideoTrack}'s content preferences. This method is applicable only for the group rooms and only when connected with\n * videoContentPreferencesMode in video bandwidth profile options set to 'manual'\n * @param {VideoContentPreferences} contentPreferences - requested preferences.\n * @returns {this}\n */\n RemoteVideoTrack.prototype.setContentPreferences = function (contentPreferences) {\n if (this._contentPreferencesMode !== 'manual') {\n throw new Error('Invalid state. You can call switchOn only when bandwidthProfile.video.contentPreferencesMode is set to \"manual\"');\n }\n if (contentPreferences.renderDimensions) {\n this._setRenderHint({ renderDimensions: contentPreferences.renderDimensions });\n }\n return this;\n };\n RemoteVideoTrack.prototype._unObservePip = function (el) {\n var pipCallbacks = this._elToPipCallbacks.get(el);\n if (pipCallbacks) {\n el.removeEventListener('enterpictureinpicture', pipCallbacks.onEnterPip);\n el.removeEventListener('leavepictureinpicture', pipCallbacks.onLeavePip);\n this._elToPipCallbacks.delete(el);\n }\n };\n RemoteVideoTrack.prototype._observePip = function (el) {\n var _this = this;\n var pipCallbacks = this._elToPipCallbacks.get(el);\n if (!pipCallbacks) {\n var onEnterPip = function (event) { return _this._onEnterPip(event, el); };\n var onLeavePip = function (event) { return _this._onLeavePip(event, el); };\n var onResizePip = function (event) { return _this._onResizePip(event, el); };\n el.addEventListener('enterpictureinpicture', onEnterPip);\n el.addEventListener('leavepictureinpicture', onLeavePip);\n this._elToPipCallbacks.set(el, { onEnterPip: onEnterPip, onLeavePip: onLeavePip, onResizePip: onResizePip });\n }\n };\n RemoteVideoTrack.prototype._onEnterPip = function (event, videoEl) {\n this._log.debug('onEnterPip');\n var pipWindow = event.pictureInPictureWindow;\n this._elToPipWindows.set(videoEl, pipWindow);\n var onResizePip = this._elToPipCallbacks.get(videoEl).onResizePip;\n pipWindow.addEventListener('resize', onResizePip);\n maybeUpdateEnabledHint(this);\n };\n RemoteVideoTrack.prototype._onLeavePip = function (event, videoEl) {\n this._log.debug('onLeavePip');\n this._elToPipWindows.delete(videoEl);\n var onResizePip = this._elToPipCallbacks.get(videoEl).onResizePip;\n var pipWindow = event.pictureInPictureWindow;\n pipWindow.removeEventListener('resize', onResizePip);\n maybeUpdateEnabledHint(this);\n };\n RemoteVideoTrack.prototype._onResizePip = function () {\n maybeUpdateDimensionHint(this);\n };\n RemoteVideoTrack.prototype.attach = function (el) {\n var result = _super.prototype.attach.call(this, el);\n if (this._clientTrackSwitchOffControl === 'auto') {\n // start off the element as invisible. will mark it\n // visible (and update render hints) once intersection observer calls back.\n this._invisibleElements.add(result);\n }\n this._intersectionObserver.observe(result);\n this._resizeObserver.observe(result);\n if (this._enableDocumentVisibilityTurnOff) {\n this._documentVisibilityTurnOffCleanup = this._documentVisibilityTurnOffCleanup || setupDocumentVisibilityTurnOff(this);\n }\n this._observePip(result);\n return result;\n };\n RemoteVideoTrack.prototype.detach = function (el) {\n var _this = this;\n var result = _super.prototype.detach.call(this, el);\n var elements = Array.isArray(result) ? result : [result];\n elements.forEach(function (element) {\n _this._intersectionObserver.unobserve(element);\n _this._resizeObserver.unobserve(element);\n _this._invisibleElements.delete(element);\n _this._unObservePip(element);\n });\n if (this._attachments.size === 0) {\n if (this._documentVisibilityTurnOffCleanup) {\n this._documentVisibilityTurnOffCleanup();\n this._documentVisibilityTurnOffCleanup = null;\n }\n }\n maybeUpdateEnabledHint(this);\n maybeUpdateDimensionHint(this);\n return result;\n };\n /**\n * Add a {@link VideoProcessor} to allow for custom processing of video frames belonging to a VideoTrack.\n * When a Participant un-publishes and re-publishes a VideoTrack, a new RemoteVideoTrack is created and\n * any VideoProcessors attached to the previous RemoteVideoTrack would have to be re-added again.\n * @param {VideoProcessor} processor - The {@link VideoProcessor} to use.\n * @param {AddProcessorOptions} [options] - {@link AddProcessorOptions} to provide.\n * @returns {this}\n * @example\n * class GrayScaleProcessor {\n * constructor(percentage) {\n * this.percentage = percentage;\n * }\n * processFrame(inputFrameBuffer, outputFrameBuffer) {\n * const context = outputFrameBuffer.getContext('2d');\n * context.filter = `grayscale(${this.percentage}%)`;\n * context.drawImage(inputFrameBuffer, 0, 0, inputFrameBuffer.width, inputFrameBuffer.height);\n * }\n * }\n *\n * const grayscaleProcessor = new GrayScaleProcessor(100);\n *\n * Array.from(room.participants.values()).forEach(participant => {\n * const remoteVideoTrack = Array.from(participant.videoTracks.values())[0].track;\n * remoteVideoTrack.addProcessor(grayscaleProcessor);\n * });\n */\n RemoteVideoTrack.prototype.addProcessor = function () {\n return _super.prototype.addProcessor.apply(this, arguments);\n };\n /**\n * Remove the previously added {@link VideoProcessor} using `addProcessor` API.\n * @param {VideoProcessor} processor - The {@link VideoProcessor} to remove.\n * @returns {this}\n * @example\n * class GrayScaleProcessor {\n * constructor(percentage) {\n * this.percentage = percentage;\n * }\n * processFrame(inputFrameBuffer, outputFrameBuffer) {\n * const context = outputFrameBuffer.getContext('2d');\n * context.filter = `grayscale(${this.percentage}%)`;\n * context.drawImage(inputFrameBuffer, 0, 0, inputFrameBuffer.width, inputFrameBuffer.height);\n * }\n * }\n *\n * const grayscaleProcessor = new GrayScaleProcessor(100);\n *\n * Array.from(room.participants.values()).forEach(participant => {\n * const remoteVideoTrack = Array.from(participant.videoTracks.values())[0].track;\n * remoteVideoTrack.addProcessor(grayscaleProcessor);\n * });\n *\n * document.getElementById('remove-button').onclick = () => {\n * Array.from(room.participants.values()).forEach(participant => {\n * const remoteVideoTrack = Array.from(participant.videoTracks.values())[0].track;\n * remoteVideoTrack.removeProcessor(grayscaleProcessor);\n * });\n * }\n */\n RemoteVideoTrack.prototype.removeProcessor = function () {\n return _super.prototype.removeProcessor.apply(this, arguments);\n };\n RemoteVideoTrack.prototype.toString = function () {\n return \"[RemoteVideoTrack #\" + this._instanceId + \": \" + this.sid + \"]\";\n };\n /**\n * Update the subscribe {@link Track.Priority} of the {@link RemoteVideoTrack}.\n * @param {?Track.Priority} priority - the new subscribe {@link Track.Priority};\n * If null, then the subscribe {@link Track.Priority} is cleared, which\n * means the {@link Track.Priority} set by the publisher is now the effective priority.\n * @returns {this}\n * @throws {RangeError}\n */\n RemoteVideoTrack.prototype.setPriority = function (priority) {\n return _super.prototype.setPriority.call(this, priority);\n };\n return RemoteVideoTrack;\n}(RemoteMediaVideoTrack));\nfunction setupDocumentVisibilityTurnOff(removeVideoTrack) {\n function onVisibilityChanged() {\n maybeUpdateEnabledHint(removeVideoTrack);\n }\n documentVisibilityMonitor.onVisibilityChange(1, onVisibilityChanged);\n return function () {\n documentVisibilityMonitor.offVisibilityChange(1, onVisibilityChanged);\n };\n}\nfunction maybeUpdateEnabledHint(remoteVideoTrack) {\n if (remoteVideoTrack._clientTrackSwitchOffControl !== 'auto') {\n return;\n }\n var visibleElements = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return !remoteVideoTrack._invisibleElements.has(el); });\n var pipWindows = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return remoteVideoTrack._elToPipWindows.has(el); });\n // even when document is invisible we may have track playing in pip window.\n var enabled = pipWindows.length > 0 || (document.visibilityState === 'visible' && visibleElements.length > 0);\n if (enabled === true) {\n remoteVideoTrack._turnOffTimer.clear();\n remoteVideoTrack._setRenderHint({ enabled: true });\n }\n else if (!remoteVideoTrack._turnOffTimer.isSet) {\n // set the track to be turned off after some delay.\n remoteVideoTrack._turnOffTimer.start();\n }\n}\nfunction maybeUpdateDimensionHint(remoteVideoTrack) {\n if (remoteVideoTrack._contentPreferencesMode !== 'auto') {\n return;\n }\n var visibleElements = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return !remoteVideoTrack._invisibleElements.has(el); });\n var pipElements = remoteVideoTrack._getAllAttachedElements().map(function (el) {\n var pipWindow = remoteVideoTrack._elToPipWindows.get(el);\n return pipWindow ? { clientHeight: pipWindow.height, clientWidth: pipWindow.width } : { clientHeight: 0, clientWidth: 0 };\n });\n var totalElements = visibleElements.concat(pipElements);\n if (totalElements.length > 0) {\n var _a = __read(totalElements.sort(function (el1, el2) {\n return el2.clientHeight + el2.clientWidth - el1.clientHeight - el1.clientWidth - 1;\n }), 1), _b = _a[0], clientHeight = _b.clientHeight, clientWidth = _b.clientWidth;\n var renderDimensions = { height: clientHeight, width: clientWidth };\n remoteVideoTrack._setRenderHint({ renderDimensions: renderDimensions });\n }\n}\n/**\n * @typedef {object} VideoContentPreferences\n * @property {VideoTrack.Dimensions} [renderDimensions] - Render Dimensions to request for the {@link RemoteVideoTrack}.\n */\n/**\n * The {@link RemoteVideoTrack}'s dimensions changed.\n * @param {RemoteVideoTrack} track - The {@link RemoteVideoTrack} whose\n * dimensions changed\n * @event RemoteVideoTrack#dimensionsChanged\n */\n/**\n * The {@link RemoteVideoTrack} was disabled, i.e. \"paused\".\n * @param {RemoteVideoTrack} track - The {@link RemoteVideoTrack} that was\n * disabled\n * @event RemoteVideoTrack#disabled\n */\n/**\n * The {@link RemoteVideoTrack} was enabled, i.e. \"resumed\".\n * @param {RemoteVideoTrack} track - The {@link RemoteVideoTrack} that was\n * enabled\n * @event RemoteVideoTrack#enabled\n */\n/**\n * The {@link RemoteVideoTrack} started. This means there is enough video data\n * to begin playback.\n * @param {RemoteVideoTrack} track - The {@link RemoteVideoTrack} that started\n * @event RemoteVideoTrack#started\n */\n/**\n * A {@link RemoteVideoTrack} was switched off.\n * @param {RemoteVideoTrack} track - The {@link RemoteVideoTrack} that was\n * switched off\n * @event RemoteVideoTrack#switchedOff\n */\n/**\n * A {@link RemoteVideoTrack} was switched on.\n * @param {RemoteVideoTrack} track - The {@link RemoteVideoTrack} that was\n * switched on\n * @event RemoteVideoTrack#switchedOn\n */\nmodule.exports = RemoteVideoTrack;\n//# sourceMappingURL=remotevideotrack.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar RemoteTrackPublication = require('./remotetrackpublication');\n/**\n * A {@link RemoteVideoTrackPublication} represents a {@link RemoteVideoTrack}\n * that has been published to a {@link Room}.\n * @property {Track.Kind} kind - \"video\"\n * @property {?RemoteVideoTrack} track - unless you have subscribed to the\n * {@link RemoteVideoTrack}, this property is null\n * @emits RemoteVideoTrackPublication#subscribed\n * @emits RemoteVideoTrackPublication#subscriptionFailed\n * @emits RemoteVideoTrackPublication#trackDisabled\n * @emits RemoteVideoTrackPublication#trackEnabled\n * @emits RemoteVideoTrackPublication#unsubscribed\n */\nvar RemoteVideoTrackPublication = /** @class */ (function (_super) {\n __extends(RemoteVideoTrackPublication, _super);\n /**\n * Construct a {@link RemoteVideoTrackPublication}.\n * @param {RemoteTrackPublicationSignaling} signaling - {@link RemoteTrackPublication} signaling\n * @param {RemoteTrackPublicationOptions} options - {@link RemoteTrackPublication}\n * options\n */\n function RemoteVideoTrackPublication(signaling, options) {\n return _super.call(this, signaling, options) || this;\n }\n RemoteVideoTrackPublication.prototype.toString = function () {\n return \"[RemoteVideoTrackPublication #\" + this._instanceId + \": \" + this.trackSid + \"]\";\n };\n return RemoteVideoTrackPublication;\n}(RemoteTrackPublication));\n/**\n * Your {@link LocalParticipant} subscribed to the {@link RemoteVideoTrack}.\n * @param {RemoteVideoTrack} track - the {@link RemoteVideoTrack} that was subscribed to\n * @event RemoteVideoTrackPublication#subscribed\n */\n/**\n * Your {@link LocalParticipant} failed to subscribe to the {@link RemoteVideoTrack}.\n * @param {TwilioError} error - the reason the {@link RemoteVideoTrack} could not be\n * subscribed to\n * @event RemoteVideoTrackPublication#subscriptionFailed\n */\n/**\n * The {@link RemoteVideoTrack} was disabled.\n * @event RemoteVideoTrackPublication#trackDisabled\n */\n/**\n * The {@link RemoteVideoTrack} was enabled.\n * @event RemoteVideoTrackPublication#trackEnabled\n */\n/**\n * Your {@link LocalParticipant} unsubscribed from the {@link RemoteVideoTrack}.\n * @param {RemoteVideoTrack} track - the {@link RemoteVideoTrack} that was unsubscribed from\n * @event RemoteVideoTrackPublication#unsubscribed\n */\nmodule.exports = RemoteVideoTrackPublication;\n//# sourceMappingURL=remotevideotrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar EventEmitter = require('./eventemitter');\nvar RemoteAudioTrack = require('./media/track/remoteaudiotrack');\nvar RemoteAudioTrackPublication = require('./media/track/remoteaudiotrackpublication');\nvar RemoteDataTrack = require('./media/track/remotedatatrack');\nvar RemoteDataTrackPublication = require('./media/track/remotedatatrackpublication');\nvar RemoteVideoTrack = require('./media/track/remotevideotrack');\nvar RemoteVideoTrackPublication = require('./media/track/remotevideotrackpublication');\nvar util = require('./util');\nvar nInstances = 0;\n/**\n * {@link NetworkQualityLevel} is a value from 0–5, inclusive, representing the\n * quality of a network connection.\n * @typedef {number} NetworkQualityLevel\n */\n/**\n * @extends EventEmitter\n * @property {Map} audioTracks -\n * The {@link Participant}'s {@link AudioTrackPublication}s\n * @property {Map} dataTracks -\n * The {@link Participant}'s {@link DataTrackPublication}s.\n * @property {Participant.Identity} identity - The identity of the {@link Participant}\n * @property {?NetworkQualityLevel} networkQualityLevel - The\n * {@link Participant}'s current {@link NetworkQualityLevel}, if any\n * @property {?NetworkQualityStats} networkQualityStats - The\n * {@link Participant}'s current {@link NetworkQualityStats}, if any\n * @property {Participant.SID} sid - The {@link Participant}'s SID\n * @property {string} state - \"connected\", \"disconnected\" or \"reconnecting\"\n * @property {Map} tracks -\n * The {@link Participant}'s {@link TrackPublication}s\n * @property {Map} videoTracks -\n * The {@link Participant}'s {@link VideoTrackPublication}s\n * @emits Participant#disconnected\n * @emits Participant#networkQualityLevelChanged\n * @emits Participant#reconnected\n * @emits Participant#reconnecting\n * @emits Participant#trackDimensionsChanged\n * @emits Participant#trackStarted\n */\nvar Participant = /** @class */ (function (_super) {\n __extends(Participant, _super);\n /**\n * Construct a {@link Participant}.\n * @param {ParticipantSignaling} signaling\n * @param {object} [options]\n */\n function Participant(signaling, options) {\n var _this = _super.call(this) || this;\n options = Object.assign({\n RemoteAudioTrack: RemoteAudioTrack,\n RemoteAudioTrackPublication: RemoteAudioTrackPublication,\n RemoteDataTrack: RemoteDataTrack,\n RemoteDataTrackPublication: RemoteDataTrackPublication,\n RemoteVideoTrack: RemoteVideoTrack,\n RemoteVideoTrackPublication: RemoteVideoTrackPublication,\n tracks: []\n }, options);\n var indexed = indexTracksById(options.tracks);\n var log = options.log.createLog('default', _this);\n var audioTracks = new Map(indexed.audioTracks);\n var dataTracks = new Map(indexed.dataTracks);\n var tracks = new Map(indexed.tracks);\n var videoTracks = new Map(indexed.videoTracks);\n Object.defineProperties(_this, {\n _RemoteAudioTrack: {\n value: options.RemoteAudioTrack\n },\n _RemoteAudioTrackPublication: {\n value: options.RemoteAudioTrackPublication\n },\n _RemoteDataTrack: {\n value: options.RemoteDataTrack\n },\n _RemoteDataTrackPublication: {\n value: options.RemoteDataTrackPublication\n },\n _RemoteVideoTrack: {\n value: options.RemoteVideoTrack\n },\n _RemoteVideoTrackPublication: {\n value: options.RemoteVideoTrackPublication\n },\n _audioTracks: {\n value: audioTracks\n },\n _dataTracks: {\n value: dataTracks\n },\n _instanceId: {\n value: ++nInstances\n },\n _clientTrackSwitchOffControl: {\n value: options.clientTrackSwitchOffControl,\n },\n _contentPreferencesMode: {\n value: options.contentPreferencesMode,\n },\n _log: {\n value: log\n },\n _signaling: {\n value: signaling\n },\n _tracks: {\n value: tracks\n },\n _trackEventReemitters: {\n value: new Map()\n },\n _trackPublicationEventReemitters: {\n value: new Map()\n },\n _trackSignalingUpdatedEventCallbacks: {\n value: new Map()\n },\n _videoTracks: {\n value: videoTracks\n },\n audioTracks: {\n enumerable: true,\n value: new Map()\n },\n dataTracks: {\n enumerable: true,\n value: new Map()\n },\n identity: {\n enumerable: true,\n get: function () {\n return signaling.identity;\n }\n },\n networkQualityLevel: {\n enumerable: true,\n get: function () {\n return signaling.networkQualityLevel;\n }\n },\n networkQualityStats: {\n enumerable: true,\n get: function () {\n return signaling.networkQualityStats;\n }\n },\n sid: {\n enumerable: true,\n get: function () {\n return signaling.sid;\n }\n },\n state: {\n enumerable: true,\n get: function () {\n return signaling.state;\n }\n },\n tracks: {\n enumerable: true,\n value: new Map()\n },\n videoTracks: {\n enumerable: true,\n value: new Map()\n }\n });\n _this._tracks.forEach(reemitTrackEvents.bind(null, _this));\n signaling.on('networkQualityLevelChanged', function () {\n return _this.emit('networkQualityLevelChanged', _this.networkQualityLevel, _this.networkQualityStats &&\n (_this.networkQualityStats.audio || _this.networkQualityStats.video)\n ? _this.networkQualityStats\n : null);\n });\n reemitSignalingStateChangedEvents(_this, signaling);\n log.info(\"Created a new Participant\" + (_this.identity ? \": \" + _this.identity : ''));\n return _this;\n }\n /**\n * Get the {@link RemoteTrack} events to re-emit.\n * @private\n * @returns {Array>} events\n */\n Participant.prototype._getTrackEvents = function () {\n return [\n ['dimensionsChanged', 'trackDimensionsChanged'],\n ['message', 'trackMessage'],\n ['started', 'trackStarted']\n ];\n };\n /**\n * @private\n */\n Participant.prototype._getTrackPublicationEvents = function () {\n return [];\n };\n Participant.prototype.toString = function () {\n return \"[Participant #\" + this._instanceId + \": \" + this.sid + \"]\";\n };\n /**\n * @private\n * @param {RemoteTrack} track\n * @param {Track.ID} id\n * @returns {?RemoteTrack}\n */\n Participant.prototype._addTrack = function (track, id) {\n var log = this._log;\n if (this._tracks.has(id)) {\n return null;\n }\n this._tracks.set(id, track);\n var tracksByKind = {\n audio: this._audioTracks,\n video: this._videoTracks,\n data: this._dataTracks\n }[track.kind];\n tracksByKind.set(id, track);\n reemitTrackEvents(this, track, id);\n log.info(\"Added a new \" + util.trackClass(track) + \":\", id);\n log.debug(util.trackClass(track) + \":\", track);\n return track;\n };\n /**\n * @private\n * @param {RemoteTrackPublication} publication\n * @returns {?RemoteTrackPublication}\n */\n Participant.prototype._addTrackPublication = function (publication) {\n var log = this._log;\n if (this.tracks.has(publication.trackSid)) {\n return null;\n }\n this.tracks.set(publication.trackSid, publication);\n var trackPublicationsByKind = {\n audio: this.audioTracks,\n data: this.dataTracks,\n video: this.videoTracks\n }[publication.kind];\n trackPublicationsByKind.set(publication.trackSid, publication);\n reemitTrackPublicationEvents(this, publication);\n log.info(\"Added a new \" + util.trackPublicationClass(publication) + \":\", publication.trackSid);\n log.debug(util.trackPublicationClass(publication) + \":\", publication);\n return publication;\n };\n /**\n * @private\n */\n Participant.prototype._handleTrackSignalingEvents = function () {\n var _a = this, log = _a._log, clientTrackSwitchOffControl = _a._clientTrackSwitchOffControl, contentPreferencesMode = _a._contentPreferencesMode;\n var self = this;\n if (this.state === 'disconnected') {\n return;\n }\n var RemoteAudioTrack = this._RemoteAudioTrack;\n var RemoteAudioTrackPublication = this._RemoteAudioTrackPublication;\n var RemoteVideoTrack = this._RemoteVideoTrack;\n var RemoteVideoTrackPublication = this._RemoteVideoTrackPublication;\n var RemoteDataTrack = this._RemoteDataTrack;\n var RemoteDataTrackPublication = this._RemoteDataTrackPublication;\n var participantSignaling = this._signaling;\n function trackSignalingAdded(signaling) {\n var RemoteTrackPublication = {\n audio: RemoteAudioTrackPublication,\n data: RemoteDataTrackPublication,\n video: RemoteVideoTrackPublication\n }[signaling.kind];\n var publication = new RemoteTrackPublication(signaling, { log: log });\n self._addTrackPublication(publication);\n var isSubscribed = signaling.isSubscribed;\n if (isSubscribed) {\n trackSignalingSubscribed(signaling);\n }\n self._trackSignalingUpdatedEventCallbacks.set(signaling.sid, function () {\n if (isSubscribed !== signaling.isSubscribed) {\n isSubscribed = signaling.isSubscribed;\n if (isSubscribed) {\n trackSignalingSubscribed(signaling);\n return;\n }\n trackSignalingUnsubscribed(signaling);\n }\n });\n signaling.on('updated', self._trackSignalingUpdatedEventCallbacks.get(signaling.sid));\n }\n function trackSignalingRemoved(signaling) {\n if (signaling.isSubscribed) {\n signaling.setTrackTransceiver(null);\n }\n var updated = self._trackSignalingUpdatedEventCallbacks.get(signaling.sid);\n if (updated) {\n signaling.removeListener('updated', updated);\n self._trackSignalingUpdatedEventCallbacks.delete(signaling.sid);\n }\n var publication = self.tracks.get(signaling.sid);\n if (publication) {\n self._removeTrackPublication(publication);\n }\n }\n function trackSignalingSubscribed(signaling) {\n var isEnabled = signaling.isEnabled, name = signaling.name, kind = signaling.kind, sid = signaling.sid, trackTransceiver = signaling.trackTransceiver, isSwitchedOff = signaling.isSwitchedOff;\n var RemoteTrack = {\n audio: RemoteAudioTrack,\n video: RemoteVideoTrack,\n data: RemoteDataTrack\n }[kind];\n var publication = self.tracks.get(sid);\n // NOTE(mroberts): It should never be the case that the TrackSignaling and\n // MediaStreamTrack or DataTrackReceiver kinds disagree; however, just in\n // case, we handle it here.\n if (!RemoteTrack || kind !== trackTransceiver.kind) {\n return;\n }\n var options = { log: log, name: name, clientTrackSwitchOffControl: clientTrackSwitchOffControl, contentPreferencesMode: contentPreferencesMode };\n var setPriority = function (newPriority) { return participantSignaling.updateSubscriberTrackPriority(sid, newPriority); };\n var setRenderHint = function (renderHint) {\n if (signaling.isSubscribed) {\n participantSignaling.updateTrackRenderHint(sid, renderHint);\n }\n };\n var track = kind === 'data'\n ? new RemoteTrack(sid, trackTransceiver, options)\n : new RemoteTrack(sid, trackTransceiver, isEnabled, isSwitchedOff, setPriority, setRenderHint, options);\n self._addTrack(track, publication, trackTransceiver.id);\n }\n function trackSignalingUnsubscribed(signaling) {\n var _a = __read(Array.from(self._tracks.entries()).find(function (_a) {\n var _b = __read(_a, 2), track = _b[1];\n return track.sid === signaling.sid;\n }), 2), id = _a[0], track = _a[1];\n var publication = self.tracks.get(signaling.sid);\n if (track) {\n self._removeTrack(track, publication, id);\n }\n }\n participantSignaling.on('trackAdded', trackSignalingAdded);\n participantSignaling.on('trackRemoved', trackSignalingRemoved);\n participantSignaling.tracks.forEach(trackSignalingAdded);\n participantSignaling.on('stateChanged', function stateChanged(state) {\n if (state === 'disconnected') {\n log.debug('Removing event listeners');\n participantSignaling.removeListener('stateChanged', stateChanged);\n participantSignaling.removeListener('trackAdded', trackSignalingAdded);\n participantSignaling.removeListener('trackRemoved', trackSignalingRemoved);\n }\n else if (state === 'connected') {\n // NOTE(mmalavalli): Any transition to \"connected\" here is a result of\n // successful signaling reconnection, and not a first-time establishment\n // of the signaling connection.\n log.info('reconnected');\n // NOTE(mpatwardhan): `stateChanged` can get emitted with StateMachine locked.\n // Do not signal public events synchronously with lock held.\n setTimeout(function () { return self.emit('reconnected'); }, 0);\n }\n });\n };\n /**\n * @private\n * @param {RemoteTrack} track\n * @param {Track.ID} id\n * @returns {?RemoteTrack}\n */\n Participant.prototype._removeTrack = function (track, id) {\n if (!this._tracks.has(id)) {\n return null;\n }\n this._tracks.delete(id);\n var tracksByKind = {\n audio: this._audioTracks,\n video: this._videoTracks,\n data: this._dataTracks\n }[track.kind];\n tracksByKind.delete(id);\n var reemitters = this._trackEventReemitters.get(id) || new Map();\n reemitters.forEach(function (reemitter, event) {\n track.removeListener(event, reemitter);\n });\n var log = this._log;\n log.info(\"Removed a \" + util.trackClass(track) + \":\", id);\n log.debug(util.trackClass(track) + \":\", track);\n return track;\n };\n /**\n * @private\n * @param {RemoteTrackPublication} publication\n * @returns {?RemoteTrackPublication}\n */\n Participant.prototype._removeTrackPublication = function (publication) {\n publication = this.tracks.get(publication.trackSid);\n if (!publication) {\n return null;\n }\n this.tracks.delete(publication.trackSid);\n var trackPublicationsByKind = {\n audio: this.audioTracks,\n data: this.dataTracks,\n video: this.videoTracks\n }[publication.kind];\n trackPublicationsByKind.delete(publication.trackSid);\n var reemitters = this._trackPublicationEventReemitters.get(publication.trackSid) || new Map();\n reemitters.forEach(function (reemitter, event) {\n publication.removeListener(event, reemitter);\n });\n var log = this._log;\n log.info(\"Removed a \" + util.trackPublicationClass(publication) + \":\", publication.trackSid);\n log.debug(util.trackPublicationClass(publication) + \":\", publication);\n return publication;\n };\n Participant.prototype.toJSON = function () {\n return util.valueToJSON(this);\n };\n return Participant;\n}(EventEmitter));\n/**\n * A {@link Participant.SID} is a 34-character string starting with \"PA\"\n * that uniquely identifies a {@link Participant}.\n * @type string\n * @typedef Participant.SID\n */\n/**\n * A {@link Participant.Identity} is a string that identifies a\n * {@link Participant}. You can think of it like a name.\n * @typedef {string} Participant.Identity\n */\n/**\n * The {@link Participant} has disconnected.\n * @param {Participant} participant - The {@link Participant} that disconnected.\n * @event Participant#disconnected\n */\n/**\n * The {@link Participant}'s {@link NetworkQualityLevel} changed.\n * @param {NetworkQualityLevel} networkQualityLevel - The new\n * {@link NetworkQualityLevel}\n * @param {?NetworkQualityStats} networkQualityStats - The {@link NetworkQualityStats}\n * based on which {@link NetworkQualityLevel} is calculated, if any\n * @event Participant#networkQualityLevelChanged\n */\n/**\n * The {@link Participant} has reconnected to the {@link Room} after a signaling connection disruption.\n * @event Participant#reconnected\n */\n/**\n * The {@link Participant} is reconnecting to the {@link Room} after a signaling connection disruption.\n * @event Participant#reconnecting\n */\n/**\n * One of the {@link Participant}'s {@link VideoTrack}'s dimensions changed.\n * @param {VideoTrack} track - The {@link VideoTrack} whose dimensions changed\n * @event Participant#trackDimensionsChanged\n */\n/**\n * One of the {@link Participant}'s {@link Track}s started.\n * @param {Track} track - The {@link Track} that started\n * @event Participant#trackStarted\n */\n/**\n * Indexed {@link Track}s by {@link Track.ID}.\n * @typedef {object} IndexedTracks\n * @property {Array<{0: Track.ID, 1: AudioTrack}>} audioTracks - Indexed\n * {@link AudioTrack}s\n * @property {Array<{0: Track.ID, 1: DataTrack}>} dataTracks - Indexed\n * {@link DataTrack}s\n * @property {Array<{0: Track.ID, 1: Track}>} tracks - Indexed {@link Track}s\n * @property {Array<{0: Track.ID, 1: VideoTrack}>} videoTracks - Indexed\n * {@link VideoTrack}s\n * @private\n */\n/**\n * Index tracks by {@link Track.ID}.\n * @param {Array} tracks\n * @returns {IndexedTracks}\n * @private\n */\nfunction indexTracksById(tracks) {\n var indexedTracks = tracks.map(function (track) { return [track.id, track]; });\n var indexedAudioTracks = indexedTracks.filter(function (keyValue) { return keyValue[1].kind === 'audio'; });\n var indexedVideoTracks = indexedTracks.filter(function (keyValue) { return keyValue[1].kind === 'video'; });\n var indexedDataTracks = indexedTracks.filter(function (keyValue) { return keyValue[1].kind === 'data'; });\n return {\n audioTracks: indexedAudioTracks,\n dataTracks: indexedDataTracks,\n tracks: indexedTracks,\n videoTracks: indexedVideoTracks\n };\n}\n/**\n * Re-emit {@link ParticipantSignaling} 'stateChanged' events.\n * @param {Participant} participant\n * @param {ParticipantSignaling} signaling\n * @private\n */\nfunction reemitSignalingStateChangedEvents(participant, signaling) {\n var log = participant._log;\n if (participant.state === 'disconnected') {\n return;\n }\n // Reemit state transition events from the ParticipantSignaling.\n signaling.on('stateChanged', function stateChanged(state) {\n log.debug('Transitioned to state:', state);\n participant.emit(state, participant);\n if (state === 'disconnected') {\n log.debug('Removing Track event reemitters');\n signaling.removeListener('stateChanged', stateChanged);\n participant._tracks.forEach(function (track) {\n var reemitters = participant._trackEventReemitters.get(track.id);\n if (track && reemitters) {\n reemitters.forEach(function (reemitter, event) {\n track.removeListener(event, reemitter);\n });\n }\n });\n // eslint-disable-next-line no-warning-comments\n // TODO(joma): Removing this introduced unit test failures in the RemoteParticipant.\n // Investigate further before removing.\n signaling.tracks.forEach(function (trackSignaling) {\n var track = participant._tracks.get(trackSignaling.id);\n var reemitters = participant._trackEventReemitters.get(trackSignaling.id);\n if (track && reemitters) {\n reemitters.forEach(function (reemitter, event) {\n track.removeListener(event, reemitter);\n });\n }\n });\n participant._trackEventReemitters.clear();\n participant.tracks.forEach(function (publication) {\n participant._trackPublicationEventReemitters.get(publication.trackSid)\n .forEach(function (reemitter, event) {\n publication.removeListener(event, reemitter);\n });\n });\n participant._trackPublicationEventReemitters.clear();\n }\n });\n}\n/**\n * Re-emit {@link Track} events.\n * @param {Participant} participant\n * @param {Track} track\n * @param {Track.ID} id\n * @private\n */\nfunction reemitTrackEvents(participant, track, id) {\n var trackEventReemitters = new Map();\n if (participant.state === 'disconnected') {\n return;\n }\n participant._getTrackEvents().forEach(function (eventPair) {\n var trackEvent = eventPair[0];\n var participantEvent = eventPair[1];\n trackEventReemitters.set(trackEvent, function () {\n var args = [participantEvent].concat([].slice.call(arguments));\n return participant.emit.apply(participant, __spreadArray([], __read(args)));\n });\n track.on(trackEvent, trackEventReemitters.get(trackEvent));\n });\n participant._trackEventReemitters.set(id, trackEventReemitters);\n}\n/**\n * Re-emit {@link TrackPublication} events.\n * @private\n * @param {Participant} participant\n * @param {TrackPublication} publication\n */\nfunction reemitTrackPublicationEvents(participant, publication) {\n var publicationEventReemitters = new Map();\n if (participant.state === 'disconnected') {\n return;\n }\n participant._getTrackPublicationEvents().forEach(function (_a) {\n var _b = __read(_a, 2), publicationEvent = _b[0], participantEvent = _b[1];\n publicationEventReemitters.set(publicationEvent, function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n participant.emit.apply(participant, __spreadArray(__spreadArray([participantEvent], __read(args)), [publication]));\n });\n publication.on(publicationEvent, publicationEventReemitters.get(publicationEvent));\n });\n participant._trackPublicationEventReemitters.set(publication.trackSid, publicationEventReemitters);\n}\nmodule.exports = Participant;\n//# sourceMappingURL=participant.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar MediaStreamTrack = require('./webrtc').MediaStreamTrack;\nvar _a = require('./util'), asLocalTrack = _a.asLocalTrack, asLocalTrackPublication = _a.asLocalTrackPublication, trackClass = _a.trackClass;\nvar _b = require('./util/constants'), E = _b.typeErrors, trackPriority = _b.trackPriority;\nvar validateLocalTrack = require('./util/validate').validateLocalTrack;\nvar _c = require('./media/track/es5'), LocalAudioTrack = _c.LocalAudioTrack, LocalDataTrack = _c.LocalDataTrack, LocalVideoTrack = _c.LocalVideoTrack;\nvar LocalAudioTrackPublication = require('./media/track/localaudiotrackpublication');\nvar LocalDataTrackPublication = require('./media/track/localdatatrackpublication');\nvar LocalVideoTrackPublication = require('./media/track/localvideotrackpublication');\nvar Participant = require('./participant');\n/**\n * A {@link LocalParticipant} represents the local {@link Participant} in a\n * {@link Room}.\n * @extends Participant\n * @property {Map} audioTracks -\n * The {@link LocalParticipant}'s {@link LocalAudioTrackPublication}s\n * @property {Map} dataTracks -\n * The {@link LocalParticipant}'s {@link LocalDataTrackPublication}s\n * @property {Map} tracks -\n * The {@link LocalParticipant}'s {@link LocalTrackPublication}s\n * @property {Map} videoTracks -\n * The {@link LocalParticipant}'s {@link LocalVideoTrackPublication}s\n * @property {string} signalingRegion - The geographical region of the\n * signaling edge the {@link LocalParticipant} is connected to.\n *\n * @emits RemoteParticipant#reconnected\n * @emits RemoteParticipant#reconnecting\n * @emits LocalParticipant#trackDimensionsChanged\n * @emits LocalParticipant#trackDisabled\n * @emits LocalParticipant#trackEnabled\n * @emits LocalParticipant#trackPublicationFailed\n * @emits LocalParticipant#trackPublished\n * @emits LocalParticipant#trackStarted\n * @emits LocalParticipant#trackStopped\n * @emits LocalParticipant#trackWarning\n * @emits LocalParticipant#trackWarningsCleared\n */\nvar LocalParticipant = /** @class */ (function (_super) {\n __extends(LocalParticipant, _super);\n /**\n * Construct a {@link LocalParticipant}.\n * @param {ParticipantSignaling} signaling\n * @param {Array} localTracks\n * @param {Object} options\n */\n function LocalParticipant(signaling, localTracks, options) {\n var _this = this;\n options = Object.assign({\n LocalAudioTrack: LocalAudioTrack,\n LocalVideoTrack: LocalVideoTrack,\n LocalDataTrack: LocalDataTrack,\n MediaStreamTrack: MediaStreamTrack,\n LocalAudioTrackPublication: LocalAudioTrackPublication,\n LocalVideoTrackPublication: LocalVideoTrackPublication,\n LocalDataTrackPublication: LocalDataTrackPublication,\n shouldStopLocalTracks: false,\n tracks: localTracks\n }, options);\n var tracksToStop = options.shouldStopLocalTracks\n ? new Set(localTracks.filter(function (localTrack) { return localTrack.kind !== 'data'; }))\n : new Set();\n _this = _super.call(this, signaling, options) || this;\n Object.defineProperties(_this, {\n _eventObserver: {\n value: options.eventObserver\n },\n _LocalAudioTrack: {\n value: options.LocalAudioTrack\n },\n _LocalDataTrack: {\n value: options.LocalDataTrack\n },\n _LocalVideoTrack: {\n value: options.LocalVideoTrack\n },\n _MediaStreamTrack: {\n value: options.MediaStreamTrack\n },\n _LocalAudioTrackPublication: {\n value: options.LocalAudioTrackPublication\n },\n _LocalDataTrackPublication: {\n value: options.LocalDataTrackPublication\n },\n _LocalVideoTrackPublication: {\n value: options.LocalVideoTrackPublication\n },\n _tracksToStop: {\n value: tracksToStop\n },\n signalingRegion: {\n enumerable: true,\n get: function () {\n return signaling.signalingRegion;\n }\n }\n });\n _this._handleTrackSignalingEvents();\n return _this;\n }\n /**\n * @private\n * @param {LocalTrack} track\n * @param {Track.ID} id\n * @param {Track.Priority} priority\n * @returns {?LocalTrack}\n */\n LocalParticipant.prototype._addTrack = function (track, id, priority) {\n var addedTrack = _super.prototype._addTrack.call(this, track, id);\n if (addedTrack && this.state !== 'disconnected') {\n this._addLocalTrack(track, priority);\n }\n return addedTrack;\n };\n /**\n * @private\n * @param {LocalTrack} track\n * @param {Track.Priority} priority\n * @returns {void}\n */\n LocalParticipant.prototype._addLocalTrack = function (track, priority) {\n var _a;\n // check if track has noise cancellation enabled.\n var vendor = (_a = track.noiseCancellation) === null || _a === void 0 ? void 0 : _a.vendor;\n this._signaling.addTrack(track._trackSender, track.name, priority, vendor);\n this._log.info(\"Added a new \" + trackClass(track, true) + \":\", track.id);\n this._log.debug(trackClass(track, true) + \":\", track);\n };\n /**\n * @private\n * @param {LocalTrack} track\n * @param {Track.ID} id\n * @returns {?LocalTrack}\n */\n LocalParticipant.prototype._removeTrack = function (track, id) {\n var removedTrack = _super.prototype._removeTrack.call(this, track, id);\n if (removedTrack && this.state !== 'disconnected') {\n this._signaling.removeTrack(track._trackSender);\n this._log.info(\"Removed a \" + trackClass(track, true) + \":\", track.id);\n this._log.debug(trackClass(track, true) + \":\", track);\n }\n return removedTrack;\n };\n /**\n * Get the {@link LocalTrack} events to re-emit.\n * @private\n * @returns {Array>} events\n */\n LocalParticipant.prototype._getTrackEvents = function () {\n return _super.prototype._getTrackEvents.call(this).concat([\n ['disabled', 'trackDisabled'],\n ['enabled', 'trackEnabled'],\n ['stopped', 'trackStopped']\n ]);\n };\n LocalParticipant.prototype.toString = function () {\n return \"[LocalParticipant #\" + this._instanceId + (this.sid ? \": \" + this.sid : '') + \"]\";\n };\n /**\n * @private\n */\n LocalParticipant.prototype._handleTrackSignalingEvents = function () {\n var _this = this;\n var log = this._log;\n if (this.state === 'disconnected') {\n return;\n }\n var localTrackDisabled = function (localTrack) {\n var trackSignaling = _this._signaling.getPublication(localTrack._trackSender);\n if (trackSignaling) {\n trackSignaling.disable();\n log.debug(\"Disabled the \" + trackClass(localTrack, true) + \":\", localTrack.id);\n }\n };\n var localTrackEnabled = function (localTrack) {\n var trackSignaling = _this._signaling.getPublication(localTrack._trackSender);\n if (trackSignaling) {\n trackSignaling.enable();\n log.debug(\"Enabled the \" + trackClass(localTrack, true) + \":\", localTrack.id);\n }\n };\n var localTrackStopped = function (localTrack) {\n // NOTE(mroberts): We shouldn't need to check for `stop`, since DataTracks\n // do not emit \"stopped\".\n var trackSignaling = _this._signaling.getPublication(localTrack._trackSender);\n if (trackSignaling) {\n trackSignaling.stop();\n }\n return trackSignaling;\n };\n var stateChanged = function (state) {\n log.debug('Transitioned to state:', state);\n if (state === 'disconnected') {\n log.debug('Removing LocalTrack event listeners');\n _this._signaling.removeListener('stateChanged', stateChanged);\n _this.removeListener('trackDisabled', localTrackDisabled);\n _this.removeListener('trackEnabled', localTrackEnabled);\n _this.removeListener('trackStopped', localTrackStopped);\n // NOTE(mmalavalli): Remove the stale MediaTrackSender clones so that we\n // do not call replaceTrack() on their RTCRtpSenders.\n _this._tracks.forEach(function (track) {\n var trackSignaling = localTrackStopped(track);\n if (trackSignaling) {\n track._trackSender.removeClone(trackSignaling._trackTransceiver);\n }\n });\n log.info(\"LocalParticipant disconnected. Stopping \" + _this._tracksToStop.size + \" automatically-acquired LocalTracks\");\n _this._tracksToStop.forEach(function (track) {\n track.stop();\n });\n }\n else if (state === 'connected') {\n // NOTE(mmalavalli): Any transition to \"connected\" here is a result of\n // successful signaling reconnection, and not a first-time establishment\n // of the signaling connection.\n log.info('reconnected');\n // NOTE(mpatwardhan): `stateChanged` can get emitted with StateMachine locked.\n // Do not signal public events synchronously with lock held.\n setTimeout(function () { return _this.emit('reconnected'); }, 0);\n }\n };\n this.on('trackDisabled', localTrackDisabled);\n this.on('trackEnabled', localTrackEnabled);\n this.on('trackStopped', localTrackStopped);\n this._signaling.on('stateChanged', stateChanged);\n this._tracks.forEach(function (track) {\n _this._addLocalTrack(track, trackPriority.PRIORITY_STANDARD);\n _this._getOrCreateLocalTrackPublication(track).catch(function (error) {\n // Just log a warning for now.\n log.warn(\"Failed to get or create LocalTrackPublication for \" + track + \":\", error);\n });\n });\n };\n /**\n * @private\n * @param {LocalTrack} localTrack\n * @returns {Promise}\n */\n LocalParticipant.prototype._getOrCreateLocalTrackPublication = function (localTrack) {\n var localTrackPublication = getTrackPublication(this.tracks, localTrack);\n if (localTrackPublication) {\n return Promise.resolve(localTrackPublication);\n }\n var log = this._log;\n var self = this;\n var trackSignaling = this._signaling.getPublication(localTrack._trackSender);\n if (!trackSignaling) {\n return Promise.reject(new Error(\"Unexpected error: The \" + localTrack + \" cannot be published\"));\n }\n return new Promise(function (resolve, reject) {\n function updated() {\n var error = trackSignaling.error;\n if (error) {\n trackSignaling.removeListener('updated', updated);\n log.warn(\"Failed to publish the \" + trackClass(localTrack, true) + \": \" + error.message);\n self._removeTrack(localTrack, localTrack.id);\n setTimeout(function () {\n self.emit('trackPublicationFailed', error, localTrack);\n });\n reject(error);\n return;\n }\n if (!self._tracks.has(localTrack.id)) {\n trackSignaling.removeListener('updated', updated);\n reject(new Error(\"The \" + localTrack + \" was unpublished\"));\n return;\n }\n var sid = trackSignaling.sid;\n if (!sid) {\n return;\n }\n trackSignaling.removeListener('updated', updated);\n var options = {\n log: log,\n LocalAudioTrackPublication: self._LocalAudioTrackPublication,\n LocalDataTrackPublication: self._LocalDataTrackPublication,\n LocalVideoTrackPublication: self._LocalVideoTrackPublication\n };\n localTrackPublication = getTrackPublication(self.tracks, localTrack);\n var warningHandler = function (twilioWarningName) {\n return self.emit('trackWarning', twilioWarningName, localTrackPublication);\n };\n var warningsClearedHandler = function () {\n return self.emit('trackWarningsCleared', localTrackPublication);\n };\n var unpublish = function (publication) {\n localTrackPublication.removeListener('trackWarning', warningHandler);\n localTrackPublication.removeListener('trackWarningsCleared', warningsClearedHandler);\n self.unpublishTrack(publication.track);\n };\n if (!localTrackPublication) {\n localTrackPublication = asLocalTrackPublication(localTrack, trackSignaling, unpublish, options);\n self._addTrackPublication(localTrackPublication);\n }\n localTrackPublication.on('warning', warningHandler);\n localTrackPublication.on('warningsCleared', warningsClearedHandler);\n var state = self._signaling.state;\n if (state === 'connected' || state === 'connecting') {\n if (localTrack._processorEventObserver) {\n localTrack._processorEventObserver.on('event', function (event) {\n self._eventObserver.emit('event', {\n name: event.name,\n payload: event.data,\n group: 'video-processor',\n level: 'info'\n });\n });\n }\n // NOTE(csantos): For tracks created before joining a room or already joined but about to publish it\n if (localTrack.processedTrack) {\n localTrack._captureFrames();\n localTrack._setSenderMediaStreamTrack(true);\n }\n }\n if (state === 'connected') {\n setTimeout(function () {\n self.emit('trackPublished', localTrackPublication);\n });\n }\n resolve(localTrackPublication);\n }\n trackSignaling.on('updated', updated);\n });\n };\n /**\n * Publishes a {@link LocalTrack} to the {@link Room}.\n * @param {LocalTrack} localTrack - The {@link LocalTrack} to publish\n * @param {LocalTrackPublishOptions} [options] - The {@link LocalTrackPublishOptions}\n * for publishing the {@link LocalTrack}\n * @returns {Promise} - Resolves with the corresponding\n * {@link LocalTrackPublication} if successful; In a Large Group Room (Maximum\n * Participants greater than 50), rejects with a {@link ParticipantMaxTracksExceededError}\n * if either the total number of published Tracks in the Room exceeds 16, or the {@link LocalTrack}\n * is part of a set of {@link LocalTrack}s which along with the published Tracks exceeds 16.\n * @throws {TypeError}\n * @throws {RangeError}\n * @example\n * var Video = require('twilio-video');\n *\n * Video.connect(token, {\n * name: 'my-cool-room',\n * audio: true\n * }).then(function(room) {\n * return Video.createLocalVideoTrack({\n * name: 'camera'\n * }).then(function(localVideoTrack) {\n * return room.localParticipant.publishTrack(localVideoTrack, {\n * priority: 'high'\n * });\n * });\n * }).then(function(publication) {\n * console.log('The LocalTrack \"' + publication.trackName\n * + '\" was successfully published with priority \"'\n * * publication.priority + '\"');\n * });\n */ /**\n * Publishes a MediaStreamTrack to the {@link Room}.\n * @param {MediaStreamTrack} mediaStreamTrack - The MediaStreamTrack\n * to publish; if a corresponding {@link LocalAudioTrack} or\n * {@link LocalVideoTrack} has not yet been published, this method will\n * construct one\n * @param {MediaStreamTrackPublishOptions} [options] - The options for publishing\n * the MediaStreamTrack\n * @returns {Promise} - Resolves with the corresponding\n * {@link LocalTrackPublication} if successful; In a Large Group Room (Maximum\n * Participants greater than 50), rejects with a {@link ParticipantMaxTracksExceededError}\n * if the total number of published Tracks in the Room exceeds 16, or the {@link LocalTrack}\n * is part of a set of {@link LocalTrack}s which along with the published Tracks exceeds 16.\n * @throws {TypeError}\n * @throws {RangeError}\n * @example\n * var Video = require('twilio-video');\n *\n * Video.connect(token, {\n * name: 'my-cool-room',\n * audio: true\n * }).then(function(room) {\n * return navigator.mediaDevices.getUserMedia({\n * video: true\n * }).then(function(mediaStream) {\n * var mediaStreamTrack = mediaStream.getTracks()[0];\n * return room.localParticipant.publishTrack(mediaStreamTrack, {\n * name: 'camera',\n * priority: 'high'\n * });\n * });\n * }).then(function(publication) {\n * console.log('The LocalTrack \"' + publication.trackName\n * + '\" was successfully published with priority \"'\n * * publication.priority + '\"');\n * });\n */\n LocalParticipant.prototype.publishTrack = function (localTrackOrMediaStreamTrack, options) {\n var trackPublication = getTrackPublication(this.tracks, localTrackOrMediaStreamTrack);\n if (trackPublication) {\n return Promise.resolve(trackPublication);\n }\n options = Object.assign({\n log: this._log,\n priority: trackPriority.PRIORITY_STANDARD,\n LocalAudioTrack: this._LocalAudioTrack,\n LocalDataTrack: this._LocalDataTrack,\n LocalVideoTrack: this._LocalVideoTrack,\n MediaStreamTrack: this._MediaStreamTrack\n }, options);\n var localTrack;\n try {\n localTrack = asLocalTrack(localTrackOrMediaStreamTrack, options);\n }\n catch (error) {\n return Promise.reject(error);\n }\n var noiseCancellation = localTrack.noiseCancellation;\n var allowedAudioProcessors = this._signaling.audioProcessors;\n if (noiseCancellation && !allowedAudioProcessors.includes(noiseCancellation.vendor)) {\n this._log.warn(noiseCancellation.vendor + \" is not supported in this room. disabling it permanently\");\n noiseCancellation.disablePermanently();\n }\n var priorityValues = Object.values(trackPriority);\n if (!priorityValues.includes(options.priority)) {\n // eslint-disable-next-line new-cap\n return Promise.reject(E.INVALID_VALUE('LocalTrackPublishOptions.priority', priorityValues));\n }\n var addedLocalTrack = this._addTrack(localTrack, localTrack.id, options.priority)\n || this._tracks.get(localTrack.id);\n return this._getOrCreateLocalTrackPublication(addedLocalTrack);\n };\n /**\n * Publishes multiple {@link LocalTrack}s to the {@link Room}.\n * @param {Array} tracks - The {@link LocalTrack}s\n * to publish; for any MediaStreamTracks provided, if a corresponding\n * {@link LocalAudioTrack} or {@link LocalVideoTrack} has not yet been\n * published, this method will construct one\n * @returns {Promise>} - The resulting\n * {@link LocalTrackPublication}s if successful; In a Large Group Room (Maximum\n * Participants greater than 50), rejects with a {@link ParticipantMaxTracksExceededError}\n * if the total number of published Tracks in the Room exceeds 16, or the {@link LocalTrack}s\n * along with the published Tracks exceeds 16.\n * @throws {TypeError}\n */\n LocalParticipant.prototype.publishTracks = function (tracks) {\n if (!Array.isArray(tracks)) {\n // eslint-disable-next-line new-cap\n throw E.INVALID_TYPE('tracks', 'Array of LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack');\n }\n return Promise.all(tracks.map(this.publishTrack, this));\n };\n LocalParticipant.prototype.setBandwidthProfile = function () {\n this._log.warn('setBandwidthProfile is not implemented yet and may be available in future versions of twilio-video.js');\n };\n /**\n * Sets the {@link NetworkQualityVerbosity} for the {@link LocalParticipant} and\n * {@link RemoteParticipant}s. It does nothing if Network Quality is not enabled\n * while calling {@link connect}.\n * @param {NetworkQualityConfiguration} networkQualityConfiguration - The new\n * {@link NetworkQualityConfiguration}; If either or both of the local and\n * remote {@link NetworkQualityVerbosity} values are absent, then the corresponding\n * existing values are retained\n * @returns {this}\n * @example\n * // Update verbosity levels for both LocalParticipant and RemoteParticipants\n * localParticipant.setNetworkQualityConfiguration({\n * local: 1,\n * remote: 2\n * });\n * @example\n * // Update verbosity level for only the LocalParticipant\n * localParticipant.setNetworkQualityConfiguration({\n * local: 1\n * });\n * @example\n * // Update verbosity level for only the RemoteParticipants\n * localParticipant.setNetworkQualityConfiguration({\n * remote: 2\n * });\n */\n LocalParticipant.prototype.setNetworkQualityConfiguration = function (networkQualityConfiguration) {\n if (typeof networkQualityConfiguration !== 'object'\n || networkQualityConfiguration === null) {\n // eslint-disable-next-line new-cap\n throw E.INVALID_TYPE('networkQualityConfiguration', 'NetworkQualityConfiguration');\n }\n ['local', 'remote'].forEach(function (prop) {\n if (prop in networkQualityConfiguration && (typeof networkQualityConfiguration[prop] !== 'number' || isNaN(networkQualityConfiguration[prop]))) {\n // eslint-disable-next-line new-cap\n throw E.INVALID_TYPE(\"networkQualityConfiguration.\" + prop, 'number');\n }\n });\n this._signaling.setNetworkQualityConfiguration(networkQualityConfiguration);\n return this;\n };\n /**\n * Set the {@link LocalParticipant}'s {@link EncodingParameters}.\n * @param {?EncodingParameters} [encodingParameters] - The new\n * {@link EncodingParameters}; If null, then the bitrate limits are removed;\n * If not specified, then the existing bitrate limits are preserved\n * @returns {this}\n * @throws {TypeError}\n */\n LocalParticipant.prototype.setParameters = function (encodingParameters) {\n if (typeof encodingParameters !== 'undefined'\n && typeof encodingParameters !== 'object') {\n // eslint-disable-next-line new-cap\n throw E.INVALID_TYPE('encodingParameters', 'EncodingParameters, null or undefined');\n }\n if (encodingParameters) {\n if (this._signaling.getParameters().adaptiveSimulcast && encodingParameters.maxVideoBitrate) {\n // eslint-disable-next-line new-cap\n throw E.INVALID_TYPE('encodingParameters', 'encodingParameters.maxVideoBitrate is not compatible with \"preferredVideoCodecs=auto\"');\n }\n ['maxAudioBitrate', 'maxVideoBitrate'].forEach(function (prop) {\n if (typeof encodingParameters[prop] !== 'undefined'\n && typeof encodingParameters[prop] !== 'number'\n && encodingParameters[prop] !== null) {\n // eslint-disable-next-line new-cap\n throw E.INVALID_TYPE(\"encodingParameters.\" + prop, 'number, null or undefined');\n }\n });\n }\n else if (encodingParameters === null) {\n encodingParameters = { maxAudioBitrate: null, maxVideoBitrate: null };\n }\n this._signaling.setParameters(encodingParameters);\n return this;\n };\n /**\n * Stops publishing a {@link LocalTrack} to the {@link Room}.\n * @param {LocalTrack|MediaStreamTrack} track - The {@link LocalTrack}\n * to stop publishing; if a MediaStreamTrack is provided, this method\n * looks up the corresponding {@link LocalAudioTrack} or\n * {@link LocalVideoTrack} to stop publishing\n * @returns {?LocalTrackPublication} - The corresponding\n * {@link LocalTrackPublication} if the {@link LocalTrack} was previously\n * published, null otherwise\n * @throws {TypeError}\n */\n LocalParticipant.prototype.unpublishTrack = function (track) {\n validateLocalTrack(track, {\n LocalAudioTrack: this._LocalAudioTrack,\n LocalDataTrack: this._LocalDataTrack,\n LocalVideoTrack: this._LocalVideoTrack,\n MediaStreamTrack: this._MediaStreamTrack\n });\n var localTrack = this._tracks.get(track.id);\n if (!localTrack) {\n return null;\n }\n var trackSignaling = this._signaling.getPublication(localTrack._trackSender);\n trackSignaling.publishFailed(new Error(\"The \" + localTrack + \" was unpublished\"));\n localTrack = this._removeTrack(localTrack, localTrack.id);\n if (!localTrack) {\n return null;\n }\n var localTrackPublication = getTrackPublication(this.tracks, localTrack);\n if (localTrackPublication) {\n this._removeTrackPublication(localTrackPublication);\n }\n return localTrackPublication;\n };\n /**\n * Stops publishing multiple {@link LocalTrack}s to the {@link Room}.\n * @param {Array} tracks - The {@link LocalTrack}s\n * to stop publishing; for any MediaStreamTracks provided, this method looks\n * up the corresponding {@link LocalAudioTrack} or {@link LocalVideoTrack} to\n * stop publishing\n * @returns {Array} - The corresponding\n * {@link LocalTrackPublication}s that were successfully unpublished\n * @throws {TypeError}\n */\n LocalParticipant.prototype.unpublishTracks = function (tracks) {\n var _this = this;\n if (!Array.isArray(tracks)) {\n // eslint-disable-next-line new-cap\n throw E.INVALID_TYPE('tracks', 'Array of LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack');\n }\n return tracks.reduce(function (unpublishedTracks, track) {\n var unpublishedTrack = _this.unpublishTrack(track);\n return unpublishedTrack ? unpublishedTracks.concat(unpublishedTrack) : unpublishedTracks;\n }, []);\n };\n return LocalParticipant;\n}(Participant));\n/**\n * The {@link LocalParticipant} has reconnected to the {@link Room} after a signaling connection disruption.\n * @event LocalParticipant#reconnected\n */\n/**\n * The {@link LocalParticipant} is reconnecting to the {@link Room} after a signaling connection disruption.\n * @event LocalParticipant#reconnecting\n */\n/**\n * One of the {@link LocalParticipant}'s {@link LocalVideoTrack}'s dimensions changed.\n * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} whose dimensions changed\n * @event LocalParticipant#trackDimensionsChanged\n */\n/**\n * A {@link LocalTrack} was disabled by the {@link LocalParticipant}.\n * @param {LocalTrack} track - The {@link LocalTrack} that was disabled\n * @event LocalParticipant#trackDisabled\n */\n/**\n * A {@link LocalTrack} was enabled by the {@link LocalParticipant}.\n * @param {LocalTrack} track - The {@link LocalTrack} that was enabled\n * @event LocalParticipant#trackEnabled\n */\n/**\n * A {@link LocalTrack} failed to publish. Check the error message for more\n * information. In a Large Group Room (Maximum Participants greater than 50),\n * this event is raised with a {@link ParticipantMaxTracksExceededError} either\n * when attempting to publish the {@link LocalTrack} will exceed the Maximum Published\n * Tracks limit of 16, or the {@link LocalTrack} is part of a set of {@link LocalTrack}s\n * which along with the published Tracks exceeds 16.\n * @param {TwilioError} error - A {@link TwilioError} explaining why publication\n * failed\n * @param {LocalTrack} localTrack - The {@link LocalTrack} that failed to\n * publish\n * @event LocalParticipant#trackPublicationFailed\n */\n/**\n * A {@link LocalTrack} that was added using {@link LocalParticipant#publishTrack} was successfully published. This event\n * is not raised for {@link LocalTrack}s added in {@link ConnectOptions}.tracks or auto-created within\n * {@link connect}.\n * @param {LocalTrackPublication} publication - The resulting\n * {@link LocalTrackPublication} for the published {@link LocalTrack}\n * @event LocalParticipant#trackPublished\n */\n/**\n * One of the {@link LocalParticipant}'s {@link LocalTrack}s started.\n * @param {LocalTrack} track - The {@link LocalTrack} that started\n * @event LocalParticipant#trackStarted\n */\n/**\n * One of the {@link LocalParticipant}'s {@link LocalTrack}s stopped, either\n * because {@link LocalTrack#stop} was called or because the underlying\n * MediaStreamTrack ended).\n * @param {LocalTrack} track - The {@link LocalTrack} that stopped\n * @event LocalParticipant#trackStopped\n */\n/**\n * One of the {@link LocalParticipant}'s {@link LocalTrackPublication}s encountered a warning.\n * This event is only raised if you enabled warnings using notifyWarnings in ConnectOptions.\n * @param {string} name - The warning that was raised.\n * @param {LocalTrackPublication} publication - The {@link LocalTrackPublication} that encountered the warning.\n * @event LocalParticipant#trackWarning\n */\n/**\n * One of the {@link LocalParticipant}'s {@link LocalTrackPublication}s cleared all warnings.\n * This event is only raised if you enabled warnings using notifyWarnings in ConnectOptions.\n * @param {LocalTrackPublication} publication - The {@link LocalTrackPublication} that cleared all warnings.\n * @event LocalParticipant#trackWarningsCleared\n */\n/**\n * Outgoing media encoding parameters.\n * @typedef {object} EncodingParameters\n * @property {?number} [maxAudioBitrate] - Max outgoing audio bitrate (bps);\n * If not specified, retains the existing bitrate limit; A null or a\n * 0 value removes any previously set bitrate limit; This value is set\n * as a hint for variable bitrate codecs, but will not take effect for fixed bitrate\n * codecs; Based on our tests, Chrome, Firefox and Safari support a bitrate range of\n * 12000 bps to 256000 bps for Opus codec; This parameter has no effect on iSAC, PCMU\n * and PCMA codecs\n * @property {?number} [maxVideoBitrate] - Max outgoing video bitrate (bps);\n * If not specified, retains the existing bitrate limit; A null or\n * a 0 value removes any previously set bitrate limit; This value is\n * set as a hint for variable bitrate codecs, but will not take effect for fixed\n * bitrate codecs; Based on our tests, Chrome, Firefox and Safari all seem to support\n * an average bitrate range of 20000 bps (20 kbps) to 8000000 bps (8 mbps) for a\n * 720p VideoTrack.\n * Note: this limit is not applied for screen share tracks published on Chrome.\n */\n/**\n * Options for publishing a {@link LocalTrack}.\n * @typedef {object} LocalTrackPublishOptions\n * @property {Track.Priority} [priority='standard'] - The priority with which the {@link LocalTrack}\n * is to be published; In Group or Small Group Rooms, the appropriate bandwidth is\n * allocated to the {@link LocalTrack} based on its {@link Track.Priority}; It has no\n * effect in Peer-to-Peer Rooms; It defaults to \"standard\" when not provided\n */\n/**\n * Options for publishing a {@link MediaStreamTrack}.\n * @typedef {LocalTrackOptions} MediaStreamTrackPublishOptions\n * @property {Track.Priority} [priority='standard'] - The priority with which the {@link LocalTrack}\n * is to be published; In Group or Small Group Rooms, the appropriate bandwidth is\n * allocated to the {@link LocalTrack} based on its {@link Track.Priority}; It has no\n * effect in Peer-to-Peer Rooms; It defaults to \"standard\" when not provided\n */\n/**\n * @private\n * @param {Map} trackPublications\n * @param {LocalTrack|MediaStreamTrack} track\n * @returns {?LocalTrackPublication} trackPublication\n */\nfunction getTrackPublication(trackPublications, track) {\n return Array.from(trackPublications.values()).find(function (trackPublication) { return trackPublication.track === track\n || trackPublication.track.mediaStreamTrack === track; }) || null;\n}\nmodule.exports = LocalParticipant;\n//# sourceMappingURL=localparticipant.js.map","// eslint-disable-next-line no-warning-comments\n// TODO(mroberts): This should be described as implementing some\n// InsightsPublisher interface.\n'use strict';\n/**\n * Null Insights publisher.\n */\nvar InsightsPublisher = /** @class */ (function () {\n function InsightsPublisher() {\n Object.defineProperties(this, {\n _connected: {\n writable: true,\n value: true\n }\n });\n }\n /**\n * Connect\n * @returns {void}\n */\n InsightsPublisher.prototype.connect = function () {\n };\n /**\n * Disconnect.\n * @returns {boolean}\n */\n InsightsPublisher.prototype.disconnect = function () {\n if (this._connected) {\n this._connected = false;\n return true;\n }\n return false;\n };\n /**\n * Publish.\n * @returns {boolean}\n */\n InsightsPublisher.prototype.publish = function () {\n return this._connected;\n };\n return InsightsPublisher;\n}());\nmodule.exports = InsightsPublisher;\n//# sourceMappingURL=null.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar EventEmitter = require('events').EventEmitter;\nvar _a = require('./util/constants'), DEFAULT_NQ_LEVEL_LOCAL = _a.DEFAULT_NQ_LEVEL_LOCAL, DEFAULT_NQ_LEVEL_REMOTE = _a.DEFAULT_NQ_LEVEL_REMOTE, MAX_NQ_LEVEL = _a.MAX_NQ_LEVEL;\nvar inRange = require('./util').inRange;\n/**\n * {@link NetworkQualityConfigurationImpl} represents an object which notifies its\n * listeners of any changes in the values of its properties.\n * @extends EventEmitter\n * @implements NetworkQualityConfiguration\n * @property {?NetworkQualityVerbosity} local - Verbosity level for {@link LocalParticipant}\n * @property {?NetworkQualityVerbosity} remote - Verbosity level for {@link RemoteParticipant}s\n */\nvar NetworkQualityConfigurationImpl = /** @class */ (function (_super) {\n __extends(NetworkQualityConfigurationImpl, _super);\n /**\n * Construct an {@link NetworkQualityConfigurationImpl}.\n * @param {NetworkQualityConfiguration} networkQualityConfiguration - Initial {@link NetworkQualityConfiguration}\n */\n function NetworkQualityConfigurationImpl(networkQualityConfiguration) {\n var _this = _super.call(this) || this;\n networkQualityConfiguration = Object.assign({\n local: DEFAULT_NQ_LEVEL_LOCAL,\n remote: DEFAULT_NQ_LEVEL_REMOTE\n }, networkQualityConfiguration);\n Object.defineProperties(_this, {\n local: {\n value: inRange(networkQualityConfiguration.local, DEFAULT_NQ_LEVEL_LOCAL, MAX_NQ_LEVEL)\n ? networkQualityConfiguration.local\n : DEFAULT_NQ_LEVEL_LOCAL,\n writable: true\n },\n remote: {\n value: inRange(networkQualityConfiguration.remote, DEFAULT_NQ_LEVEL_REMOTE, MAX_NQ_LEVEL)\n ? networkQualityConfiguration.remote\n : DEFAULT_NQ_LEVEL_REMOTE,\n writable: true\n }\n });\n return _this;\n }\n /**\n * Update the verbosity levels for network quality information for\n * {@link LocalParticipant} and {@link RemoteParticipant} with those\n * in the given {@link NetworkQualityConfiguration}.\n * @param {NetworkQualityConfiguration} networkQualityConfiguration - The new {@link NetworkQualityConfiguration}\n */\n NetworkQualityConfigurationImpl.prototype.update = function (networkQualityConfiguration) {\n var _this = this;\n networkQualityConfiguration = Object.assign({\n local: this.local,\n remote: this.remote\n }, networkQualityConfiguration);\n [\n ['local', DEFAULT_NQ_LEVEL_LOCAL, 3],\n ['remote', DEFAULT_NQ_LEVEL_REMOTE, 3]\n ].forEach(function (_a) {\n var _b = __read(_a, 3), localOrRemote = _b[0], min = _b[1], max = _b[2];\n _this[localOrRemote] = typeof networkQualityConfiguration[localOrRemote] === 'number'\n && inRange(networkQualityConfiguration[localOrRemote], min, max)\n ? networkQualityConfiguration[localOrRemote]\n : min;\n });\n };\n return NetworkQualityConfigurationImpl;\n}(EventEmitter));\nmodule.exports = NetworkQualityConfigurationImpl;\n//# sourceMappingURL=networkqualityconfiguration.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar Participant = require('./participant');\n/**\n * A {@link RemoteParticipant} represents a remote {@link Participant} in a\n * {@link Room}.\n * @extends Participant\n * @property {Map} audioTracks -\n * The {@link Participant}'s {@link RemoteAudioTrackPublication}s\n * @property {Map} dataTracks -\n * The {@link Participant}'s {@link RemoteDataTrackPublication}s\n * @property {Map} tracks -\n * The {@link Participant}'s {@link RemoteTrackPublication}s\n * @property {Map} videoTracks -\n * The {@link Participant}'s {@link RemoteVideoTrackPublication}s\n * @emits RemoteParticipant#reconnected\n * @emits RemoteParticipant#reconnecting\n * @emits RemoteParticipant#trackDimensionsChanged\n * @emits RemoteParticipant#trackDisabled\n * @emits RemoteParticipant#trackEnabled\n * @emits RemoteParticipant#trackMessage\n * @emits RemoteParticipant#trackPublished\n * @emits RemoteParticipant#trackPublishPriorityChanged\n * @emits RemoteParticipant#trackStarted\n * @emits RemoteParticipant#trackSubscribed\n * @emits RemoteParticipant#trackSubscriptionFailed\n * @emits RemoteParticipant#trackSwitchedOff\n * @emits RemoteParticipant#trackSwitchedOn\n * @emits RemoteParticipant#trackUnpublished\n * @emits RemoteParticipant#trackUnsubscribed\n */\nvar RemoteParticipant = /** @class */ (function (_super) {\n __extends(RemoteParticipant, _super);\n /**\n * Construct a {@link RemoteParticipant}.\n * @param {ParticipantSignaling} signaling\n * @param {object} [options]\n */\n function RemoteParticipant(signaling, options) {\n var _this = _super.call(this, signaling, options) || this;\n _this._handleTrackSignalingEvents();\n _this.once('disconnected', _this._unsubscribeTracks.bind(_this));\n return _this;\n }\n RemoteParticipant.prototype.toString = function () {\n return \"[RemoteParticipant #\" + this._instanceId + (this.sid ? \": \" + this.sid : '') + \"]\";\n };\n /**\n * @private\n * @param {RemoteTrack} remoteTrack\n * @param {RemoteTrackPublication} publication\n * @param {Track.ID} id\n * @returns {?RemoteTrack}\n */\n RemoteParticipant.prototype._addTrack = function (remoteTrack, publication, id) {\n if (!_super.prototype._addTrack.call(this, remoteTrack, id)) {\n return null;\n }\n publication._subscribed(remoteTrack);\n this.emit('trackSubscribed', remoteTrack, publication);\n return remoteTrack;\n };\n /**\n * @private\n * @param {RemoteTrackPublication} publication\n * @returns {?RemoteTrackPublication}\n */\n RemoteParticipant.prototype._addTrackPublication = function (publication) {\n var addedPublication = _super.prototype._addTrackPublication.call(this, publication);\n if (!addedPublication) {\n return null;\n }\n this.emit('trackPublished', addedPublication);\n return addedPublication;\n };\n /**\n * @private\n */\n RemoteParticipant.prototype._getTrackPublicationEvents = function () {\n return __spreadArray(__spreadArray([], __read(_super.prototype._getTrackPublicationEvents.call(this))), [\n ['subscriptionFailed', 'trackSubscriptionFailed'],\n ['trackDisabled', 'trackDisabled'],\n ['trackEnabled', 'trackEnabled'],\n ['publishPriorityChanged', 'trackPublishPriorityChanged'],\n ['trackSwitchedOff', 'trackSwitchedOff'],\n ['trackSwitchedOn', 'trackSwitchedOn']\n ]);\n };\n /**\n * @private\n */\n RemoteParticipant.prototype._unsubscribeTracks = function () {\n var _this = this;\n this.tracks.forEach(function (publication) {\n if (publication.isSubscribed) {\n var track = publication.track;\n publication._unsubscribe();\n _this.emit('trackUnsubscribed', track, publication);\n }\n });\n };\n /**\n * @private\n * @param {RemoteTrack} remoteTrack\n * @param {RemoteTrackPublication} publication\n * @param {Track.ID} id\n * @returns {?RemoteTrack}\n */\n RemoteParticipant.prototype._removeTrack = function (remoteTrack, publication, id) {\n var unsubscribedTrack = this._tracks.get(id);\n if (!unsubscribedTrack) {\n return null;\n }\n _super.prototype._removeTrack.call(this, unsubscribedTrack, id);\n publication._unsubscribe();\n this.emit('trackUnsubscribed', unsubscribedTrack, publication);\n return unsubscribedTrack;\n };\n /**\n * @private\n * @param {RemoteTrackPublication} publication\n * @returns {?RemoteTrackPublication}\n */\n RemoteParticipant.prototype._removeTrackPublication = function (publication) {\n this._signaling.clearTrackHint(publication.trackSid);\n var removedPublication = _super.prototype._removeTrackPublication.call(this, publication);\n if (!removedPublication) {\n return null;\n }\n this.emit('trackUnpublished', removedPublication);\n return removedPublication;\n };\n return RemoteParticipant;\n}(Participant));\n/**\n * The {@link RemoteParticipant} has reconnected to the {@link Room} after a signaling connection disruption.\n * @event RemoteParticipant#reconnected\n */\n/**\n * The {@link RemoteParticipant} is reconnecting to the {@link Room} after a signaling connection disruption.\n * @event RemoteParticipant#reconnecting\n */\n/**\n * One of the {@link RemoteParticipant}'s {@link RemoteVideoTrack}'s dimensions changed.\n * @param {RemoteVideoTrack} track - The {@link RemoteVideoTrack} whose dimensions changed\n * @event RemoteParticipant#trackDimensionsChanged\n */\n/**\n * A {@link RemoteTrack} was disabled by the {@link RemoteParticipant}.\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication} associated with the disabled {@link RemoteTrack}\n * @event RemoteParticipant#trackDisabled\n */\n/**\n * A {@link RemoteTrack} was enabled by the {@link RemoteParticipant}.\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication} associated with the enabled {@link RemoteTrack}\n * @event RemoteParticipant#trackEnabled\n */\n/**\n * A message was received over one of the {@link RemoteParticipant}'s\n * {@link RemoteDataTrack}s.\n * @event RemoteParticipant#trackMessage\n * @param {string|ArrayBuffer} data\n * @param {RemoteDataTrack} track - The {@link RemoteDataTrack} over which the\n * message was received\n */\n/**\n * A {@link RemoteTrack} was published by the {@link RemoteParticipant} after\n * connecting to the {@link Room}. This event is not emitted for\n * {@link RemoteTrack}s that were published while the {@link RemoteParticipant}\n * was connecting to the {@link Room}.\n * @event RemoteParticipant#trackPublished\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * which represents the published {@link RemoteTrack}\n * @example\n * function trackPublished(publication) {\n * console.log(`Track ${publication.trackSid} was published`);\n * }\n *\n * room.on('participantConnected', participant => {\n * // Handle RemoteTracks published while connecting to the Room.\n * participant.trackPublications.forEach(trackPublished);\n *\n * // Handle RemoteTracks published after connecting to the Room.\n * participant.on('trackPublished', trackPublished);\n * });\n */\n/**\n * One of the {@link RemoteParticipant}'s {@link RemoteTrack}s started.\n * @param {RemoteTrack} track - The {@link RemoteTrack} that started\n * @event RemoteParticipant#trackStarted\n */\n/**\n * A {@link RemoteParticipant}'s {@link RemoteTrack} was subscribed to.\n * @param {RemoteTrack} track - The {@link RemoteTrack} that was subscribed to\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * for the {@link RemoteTrack} that was subscribed to\n * @event RemoteParticipant#trackSubscribed\n */\n/**\n * A {@link RemoteParticipant}'s {@link RemoteTrack} could not be subscribed to.\n * @param {TwilioError} error - The reason the {@link RemoteTrack} could not be\n * subscribed to\n * @param {RemoteTrackPublication} publication - The\n * {@link RemoteTrackPublication} for the {@link RemoteTrack} that could not\n * be subscribed to\n * @event RemoteParticipant#trackSubscriptionFailed\n */\n/**\n * The {@link RemoteTrackPublication}'s publish {@link Track.Priority} was changed by the\n * {@link RemoteParticipant}.\n * @param {Track.Priority} priority - the {@link RemoteTrack}'s new publish\n * {@link Track.Priority};\n * @param {RemoteTrackPublication} publication - The\n * {@link RemoteTrackPublication} for the {@link RemoteTrack} that changed priority\n * @event RemoteParticipant#trackPublishPriorityChanged\n */\n/**\n * A {@link RemoteParticipant}'s {@link RemoteTrack} was subscribed to.\n * @param {RemoteTrack} track - The {@link RemoteTrack} that was switched off\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * for the {@link RemoteTrack} that was switched off\n * @event RemoteParticipant#trackSwitchedOff\n */\n/**\n * A {@link RemoteParticipant}'s {@link RemoteTrack} was switched on.\n * @param {RemoteTrack} track - The {@link RemoteTrack} that was switched on.\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * for the {@link RemoteTrack} that was switched on\n * @event RemoteParticipant#trackSwitchedOn\n */\n/**\n * A {@link RemoteTrack} was unpublished by the {@link RemoteParticipant}.\n * @event RemoteParticipant#trackUnpublished\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * which represents the unpublished {@link RemoteTrack}\n */\n/**\n * A {@link RemoteParticipant}'s {@link RemoteTrack} was unsubscribed from.\n * @param {RemoteTrack} track - The {@link RemoteTrack} that was unsubscribed from\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * for the {@link RemoteTrack} that was unsubscribed from\n * @event RemoteParticipant#trackUnsubscribed\n */\nmodule.exports = RemoteParticipant;\n//# sourceMappingURL=remoteparticipant.js.map","'use strict';\n/**\n * Statistics for a {@link Track}.\n * @property {Track.ID} trackId - The {@link Track} ID\n * @property {Track.SID} trackSid - The {@link Track}'s SID when published in\n * in a {@link Room}\n * @property {number} timestamp - A Unix timestamp in milliseconds indicating\n * when the {@link TrackStats} were gathered\n * @property {string} ssrc - The {@link Track}'s SSRC when transmitted over the\n * RTCPeerConnection\n * @property {?number} packetsLost - The number of packets lost\n * @property {?string} codec - The name of the codec used to encode the\n * {@link Track}'s media\n */\nvar TrackStats = /** @class */ (function () {\n /**\n * @param {string} trackId - {@link Track} ID\n * @param {StandardizedTrackStatsReport} statsReport\n */\n function TrackStats(trackId, statsReport) {\n if (typeof trackId !== 'string') {\n throw new Error('Track id must be a string');\n }\n Object.defineProperties(this, {\n trackId: {\n value: trackId,\n enumerable: true\n },\n trackSid: {\n value: statsReport.trackSid,\n enumerable: true\n },\n timestamp: {\n value: statsReport.timestamp,\n enumerable: true\n },\n ssrc: {\n value: statsReport.ssrc,\n enumerable: true\n },\n packetsLost: {\n value: typeof statsReport.packetsLost === 'number'\n ? statsReport.packetsLost\n : null,\n enumerable: true\n },\n codec: {\n value: typeof statsReport.codecName === 'string'\n ? statsReport.codecName\n : null,\n enumerable: true\n }\n });\n }\n return TrackStats;\n}());\nmodule.exports = TrackStats;\n//# sourceMappingURL=trackstats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar TrackStats = require('./trackstats');\n/**\n * Statistics for a {@link LocalTrack}.\n * @extends TrackStats\n * @property {?number} bytesSent - Number of bytes sent\n * @property {?number} packetsSent - Number of packets sent\n * @property {?number} roundTripTime - Round trip time in milliseconds\n */\nvar LocalTrackStats = /** @class */ (function (_super) {\n __extends(LocalTrackStats, _super);\n /**\n * @param {string} trackId - {@link LocalTrack} ID\n * @param {StandardizedTrackStatsReport} statsReport\n * @param {boolean} prepareForInsights\n */\n function LocalTrackStats(trackId, statsReport, prepareForInsights) {\n var _this = _super.call(this, trackId, statsReport) || this;\n Object.defineProperties(_this, {\n bytesSent: {\n value: typeof statsReport.bytesSent === 'number'\n ? statsReport.bytesSent\n : prepareForInsights ? 0 : null,\n enumerable: true\n },\n packetsSent: {\n value: typeof statsReport.packetsSent === 'number'\n ? statsReport.packetsSent\n : prepareForInsights ? 0 : null,\n enumerable: true\n },\n roundTripTime: {\n value: typeof statsReport.roundTripTime === 'number'\n ? statsReport.roundTripTime\n : prepareForInsights ? 0 : null,\n enumerable: true\n }\n });\n return _this;\n }\n return LocalTrackStats;\n}(TrackStats));\nmodule.exports = LocalTrackStats;\n//# sourceMappingURL=localtrackstats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar LocalTrackStats = require('./localtrackstats');\n/**\n * Statistics for a {@link LocalAudioTrack}.\n * @extends LocalTrackStats\n * @property {?AudioLevel} audioLevel - Input {@link AudioLevel}\n * @property {?number} jitter - Audio jitter in milliseconds\n */\nvar LocalAudioTrackStats = /** @class */ (function (_super) {\n __extends(LocalAudioTrackStats, _super);\n /**\n * @param {string} trackId - {@link LocalAudioTrack} ID\n * @param {StandardizedTrackStatsReport} statsReport\n * @param {boolean} prepareForInsights\n */\n function LocalAudioTrackStats(trackId, statsReport, prepareForInsights) {\n var _this = _super.call(this, trackId, statsReport, prepareForInsights) || this;\n Object.defineProperties(_this, {\n audioLevel: {\n value: typeof statsReport.audioInputLevel === 'number'\n ? statsReport.audioInputLevel\n : null,\n enumerable: true\n },\n jitter: {\n value: typeof statsReport.jitter === 'number'\n ? statsReport.jitter\n : null,\n enumerable: true\n }\n });\n return _this;\n }\n return LocalAudioTrackStats;\n}(LocalTrackStats));\n/**\n * The maximum absolute amplitude of a set of audio samples in the\n * range of 0 to 32767 inclusive.\n * @typedef {number} AudioLevel\n */\nmodule.exports = LocalAudioTrackStats;\n//# sourceMappingURL=localaudiotrackstats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar LocalTrackStats = require('./localtrackstats');\n/**\n * Statistics for a {@link LocalVideoTrack}.\n * @extends LocalTrackStats\n * @property {?VideoTrack#Dimensions} captureDimensions - Video capture resolution\n * @property {?VideoTrack#Dimensions} dimensions - Video encoding resolution\n * @property {?number} captureFrameRate - Video capture frame rate\n * @property {?number} frameRate - Video encoding frame rate\n */\nvar LocalVideoTrackStats = /** @class */ (function (_super) {\n __extends(LocalVideoTrackStats, _super);\n /**\n * @param {string} trackId - {@link LocalVideoTrack} ID\n * @param {StandardizedTrackStatsReport} statsReport\n * @param {boolean} prepareForInsights\n */\n function LocalVideoTrackStats(trackId, statsReport, prepareForInsights) {\n var _this = _super.call(this, trackId, statsReport, prepareForInsights) || this;\n var captureDimensions = null;\n if (typeof statsReport.frameWidthInput === 'number' &&\n typeof statsReport.frameHeightInput === 'number') {\n captureDimensions = {};\n Object.defineProperties(captureDimensions, {\n width: {\n value: statsReport.frameWidthInput,\n enumerable: true\n },\n height: {\n value: statsReport.frameHeightInput,\n enumerable: true\n }\n });\n }\n var dimensions = null;\n if (typeof statsReport.frameWidthSent === 'number' &&\n typeof statsReport.frameHeightSent === 'number') {\n dimensions = {};\n Object.defineProperties(dimensions, {\n width: {\n value: statsReport.frameWidthSent,\n enumerable: true\n },\n height: {\n value: statsReport.frameHeightSent,\n enumerable: true\n }\n });\n }\n Object.defineProperties(_this, {\n captureDimensions: {\n value: captureDimensions,\n enumerable: true\n },\n dimensions: {\n value: dimensions,\n enumerable: true\n },\n captureFrameRate: {\n value: typeof statsReport.frameRateInput === 'number'\n ? statsReport.frameRateInput\n : null,\n enumerable: true\n },\n frameRate: {\n value: typeof statsReport.frameRateSent === 'number'\n ? statsReport.frameRateSent\n : null,\n enumerable: true\n }\n });\n return _this;\n }\n return LocalVideoTrackStats;\n}(LocalTrackStats));\nmodule.exports = LocalVideoTrackStats;\n//# sourceMappingURL=localvideotrackstats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar TrackStats = require('./trackstats');\n/**\n * Statistics for a remote {@link Track}.\n * @extends TrackStats\n * @property {?number} bytesReceived - Number of bytes received\n * @property {?number} packetsReceived - Number of packets received\n */\nvar RemoteTrackStats = /** @class */ (function (_super) {\n __extends(RemoteTrackStats, _super);\n /*\n * @param {string} trackId - {@link Track} ID\n * @param {StandardizedTrackStatsReport} statsReport\n */\n function RemoteTrackStats(trackId, statsReport) {\n var _this = _super.call(this, trackId, statsReport) || this;\n Object.defineProperties(_this, {\n bytesReceived: {\n value: typeof statsReport.bytesReceived === 'number'\n ? statsReport.bytesReceived\n : null,\n enumerable: true\n },\n packetsReceived: {\n value: typeof statsReport.packetsReceived === 'number'\n ? statsReport.packetsReceived\n : null,\n enumerable: true\n }\n });\n return _this;\n }\n return RemoteTrackStats;\n}(TrackStats));\nmodule.exports = RemoteTrackStats;\n//# sourceMappingURL=remotetrackstats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar RemoteTrackStats = require('./remotetrackstats');\n/**\n * Statistics for an {@link AudioTrack}.\n * @extends RemoteTrackStats\n * @property {?AudioLevel} audioLevel - Output {@link AudioLevel}\n * @property {?number} jitter - Audio jitter in milliseconds\n */\nvar RemoteAudioTrackStats = /** @class */ (function (_super) {\n __extends(RemoteAudioTrackStats, _super);\n /**\n * @param {string} trackId - {@link AudioTrack} ID\n * @param {StandardizedTrackStatsReport} statsReport\n */\n function RemoteAudioTrackStats(trackId, statsReport) {\n var _this = _super.call(this, trackId, statsReport) || this;\n Object.defineProperties(_this, {\n audioLevel: {\n value: typeof statsReport.audioOutputLevel === 'number'\n ? statsReport.audioOutputLevel\n : null,\n enumerable: true\n },\n jitter: {\n value: typeof statsReport.jitter === 'number'\n ? statsReport.jitter\n : null,\n enumerable: true\n }\n });\n return _this;\n }\n return RemoteAudioTrackStats;\n}(RemoteTrackStats));\nmodule.exports = RemoteAudioTrackStats;\n//# sourceMappingURL=remoteaudiotrackstats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar RemoteTrackStats = require('./remotetrackstats');\n/**\n * Statistics for a {@link VideoTrack}.\n * @extends RemoteTrackStats\n * @property {?VideoTrack#Dimensions} dimensions - Received video resolution\n * @property {?number} frameRate - Received video frame rate\n */\nvar RemoteVideoTrackStats = /** @class */ (function (_super) {\n __extends(RemoteVideoTrackStats, _super);\n /**\n * @param {string} trackId - {@link VideoTrack} ID\n * @param {StandardizedTrackStatsReport} statsReport\n */\n function RemoteVideoTrackStats(trackId, statsReport) {\n var _this = _super.call(this, trackId, statsReport) || this;\n var dimensions = null;\n if (typeof statsReport.frameWidthReceived === 'number' &&\n typeof statsReport.frameHeightReceived === 'number') {\n dimensions = {};\n Object.defineProperties(dimensions, {\n width: {\n value: statsReport.frameWidthReceived,\n enumerable: true\n },\n height: {\n value: statsReport.frameHeightReceived,\n enumerable: true\n }\n });\n }\n Object.defineProperties(_this, {\n dimensions: {\n value: dimensions,\n enumerable: true\n },\n frameRate: {\n value: typeof statsReport.frameRateReceived === 'number'\n ? statsReport.frameRateReceived\n : null,\n enumerable: true\n }\n });\n return _this;\n }\n return RemoteVideoTrackStats;\n}(RemoteTrackStats));\nmodule.exports = RemoteVideoTrackStats;\n//# sourceMappingURL=remotevideotrackstats.js.map","'use strict';\nvar LocalAudioTrackStats = require('./localaudiotrackstats');\nvar LocalVideoTrackStats = require('./localvideotrackstats');\nvar RemoteAudioTrackStats = require('./remoteaudiotrackstats');\nvar RemoteVideoTrackStats = require('./remotevideotrackstats');\n/**\n * Statistics report for an RTCPeerConnection.\n * @property {string} peerConnectionId - ID of the RTCPeerConnection\n * @property {Array} localAudioTrackStats - List of {@link LocalAudioTrackStats}\n * @property {Array} localVideoTrackStats - List of {@link LocalVideoTrackStats}\n * @property {Array} remoteAudioTrackStats - List of {@link RemoteAudioTrackStats}\n * @property {Array} remoteVideoTrackStats - List of {@link RemoteVideoTrackStats}\n */\nvar StatsReport = /** @class */ (function () {\n /**\n * @param {string} peerConnectionId - RTCPeerConnection ID\n * @param {StandardizedStatsResponse} statsResponse\n * @param {boolean} prepareForInsights - if report is being prepared to send to insights.\n */\n function StatsReport(peerConnectionId, statsResponse, prepareForInsights) {\n if (typeof peerConnectionId !== 'string') {\n throw new Error('RTCPeerConnection id must be a string');\n }\n Object.defineProperties(this, {\n peerConnectionId: {\n value: peerConnectionId,\n enumerable: true\n },\n localAudioTrackStats: {\n value: statsResponse.localAudioTrackStats.map(function (report) { return new LocalAudioTrackStats(report.trackId, report, prepareForInsights); }),\n enumerable: true\n },\n localVideoTrackStats: {\n value: statsResponse.localVideoTrackStats.map(function (report) { return new LocalVideoTrackStats(report.trackId, report, prepareForInsights); }),\n enumerable: true\n },\n remoteAudioTrackStats: {\n value: statsResponse.remoteAudioTrackStats.map(function (report) { return new RemoteAudioTrackStats(report.trackId, report); }),\n enumerable: true\n },\n remoteVideoTrackStats: {\n value: statsResponse.remoteVideoTrackStats.map(function (report) { return new RemoteVideoTrackStats(report.trackId, report); }),\n enumerable: true\n }\n });\n }\n return StatsReport;\n}());\nmodule.exports = StatsReport;\n//# sourceMappingURL=statsreport.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar EventEmitter = require('./eventemitter');\nvar RemoteParticipant = require('./remoteparticipant');\nvar StatsReport = require('./stats/statsreport');\nvar _a = require('./util'), flatMap = _a.flatMap, valueToJSON = _a.valueToJSON;\nvar nInstances = 0;\n/**\n * A {@link Room} represents communication between you and one or more\n * {@link RemoteParticipant}s sharing {@link AudioTrack}s and\n * {@link VideoTrack}s.\n *

\n * You can connect to a {@link Room} by calling {@link module:twilio-video.connect}.\n * @extends EventEmitter\n * @property {?RemoteParticipant} dominantSpeaker - The Dominant Speaker in the\n * {@link Room}, if any\n * @property {boolean} isRecording - Whether or not the {@link Room} is being\n * recorded\n * @property {LocalParticipant} localParticipant - Your {@link LocalParticipant}\n * in the {@link Room}\n * @property {string} mediaRegion - String indicating geographical region\n * where media is processed for the {@link Room}.\n * @property {string} name - The {@link Room}'s name\n * @property {Map} participants -\n * The {@link RemoteParticipant}s participating in this {@link Room}\n * @property {Room.SID} sid - The {@link Room}'s SID\n * @property {string} state - \"connected\", \"reconnecting\", or \"disconnected\"\n * @throws {SignalingConnectionDisconnectedError}\n * @emits Room#disconnected\n * @emits Room#participantConnected\n * @emits Room#participantDisconnected\n * @emits Room#participantReconnected\n * @emits Room#participantReconnecting\n * @emits Room#reconnected\n * @emits Room#reconnecting\n * @emits Room#recordingStarted\n * @emits Room#recordingStopped\n * @emits Room#trackDimensionsChanged\n * @emits Room#trackDisabled\n * @emits Room#trackEnabled\n * @emits Room#trackMessage\n * @emits Room#trackPublished\n * @emits Room#trackPublishPriorityChanged\n * @emits Room#trackStarted\n * @emits Room#trackSubscribed\n * @emits Room#trackSwitchedOff\n * @emits Room#trackSwitchedOn\n * @emits Room#trackUnpublished\n * @emits Room#trackUnsubscribed\n * @emits Room#trackWarning\n * @emits Room#trackWarningsCleared\n */\nvar Room = /** @class */ (function (_super) {\n __extends(Room, _super);\n /**\n * Construct a {@link Room}.\n * @param {RoomSignaling} signaling\n * @param {?object} [options={}]\n */\n function Room(localParticipant, signaling, options) {\n var _this = _super.call(this) || this;\n var log = options.log.createLog('default', _this);\n var participants = new Map();\n /* istanbul ignore next */\n Object.defineProperties(_this, {\n _log: {\n value: log\n },\n _clientTrackSwitchOffControl: {\n value: options.clientTrackSwitchOffControl || 'disabled'\n },\n _contentPreferencesMode: {\n value: options.contentPreferencesMode || 'disabled'\n },\n _instanceId: {\n value: ++nInstances\n },\n _options: {\n value: options\n },\n _participants: {\n value: participants\n },\n _signaling: {\n value: signaling\n },\n dominantSpeaker: {\n enumerable: true,\n get: function () {\n return this.participants.get(signaling.dominantSpeakerSid) || null;\n }\n },\n isRecording: {\n enumerable: true,\n get: function () {\n return signaling.recording.isEnabled || false;\n }\n },\n localParticipant: {\n enumerable: true,\n value: localParticipant\n },\n name: {\n enumerable: true,\n value: signaling.name\n },\n participants: {\n enumerable: true,\n value: participants\n },\n sid: {\n enumerable: true,\n value: signaling.sid\n },\n state: {\n enumerable: true,\n get: function () {\n return signaling.state;\n }\n },\n mediaRegion: {\n enumerable: true,\n value: signaling.mediaRegion\n }\n });\n handleLocalParticipantEvents(_this, localParticipant);\n handleRecordingEvents(_this, signaling.recording);\n handleSignalingEvents(_this, signaling);\n verifyNoiseCancellation(_this);\n log.info('Created a new Room:', _this.name);\n log.debug('Initial RemoteParticipants:', Array.from(_this._participants.values()));\n return _this;\n }\n Room.prototype.toString = function () {\n return \"[Room #\" + this._instanceId + \": \" + this.sid + \"]\";\n };\n /**\n * Disconnect from the {@link Room}.\n * @returns {this}\n */\n Room.prototype.disconnect = function () {\n this._log.info('Disconnecting');\n this._signaling.disconnect();\n return this;\n };\n /**\n * Get the {@link Room}'s media statistics. This is not supported in Safari 12.0 or below\n * due to this bug : https://bugs.webkit.org/show_bug.cgi?id=192601\n *\n * @returns {Promise.>}\n */\n Room.prototype.getStats = function () {\n var _this = this;\n return this._signaling.getStats().then(function (responses) {\n return Array.from(responses).map(function (_a) {\n var _b = __read(_a, 2), id = _b[0], response = _b[1];\n return new StatsReport(id, Object.assign({}, response, {\n localAudioTrackStats: rewriteLocalTrackIds(_this, response.localAudioTrackStats),\n localVideoTrackStats: rewriteLocalTrackIds(_this, response.localVideoTrackStats)\n }));\n });\n });\n };\n /**\n * Restart the muted local media {@link Track}s and play inadvertently paused HTMLMediaElements\n * that are attached to local and remote media {@link Track}s. This method is useful mainly on\n * mobile browsers (Safari and Chrome on iOS), where there is a possibility that the muted local\n * media {@link Track}s are never unmuted and inadvertently paused HTMLMediaElements are never\n * played again, especially after handling an incoming phone call.\n * @returns {this}\n */\n Room.prototype.refreshInactiveMedia = function () {\n var localTrackPublications = this.localParticipant.tracks;\n var localMediaTracks = Array.from(localTrackPublications.values())\n .filter(function (_a) {\n var kind = _a.track.kind;\n return kind !== 'data';\n })\n .map(function (_a) {\n var track = _a.track;\n return track;\n });\n var remoteMediaTracks = flatMap(this.participants, function (participants) { return Array.from(participants.tracks.values()); })\n .filter(function (_a) {\n var track = _a.track;\n return track && track.kind !== 'data';\n })\n .map(function (_a) {\n var track = _a.track;\n return track;\n });\n var mediaTracks = localMediaTracks.concat(remoteMediaTracks);\n var unmuteEvent = new Event('unmute');\n localMediaTracks.forEach(function (_a) {\n var isMuted = _a.isMuted, mediaStreamTrack = _a.mediaStreamTrack;\n if (isMuted) {\n mediaStreamTrack.dispatchEvent(unmuteEvent);\n }\n });\n var pauseEvent = new Event('pause');\n mediaTracks.forEach(function (_a) {\n var attachments = _a._attachments, elShims = _a._elShims;\n return attachments.forEach(function (el) {\n var shim = elShims.get(el);\n var isInadvertentlyPaused = el.paused && shim && !shim.pausedIntentionally();\n if (isInadvertentlyPaused) {\n el.dispatchEvent(pauseEvent);\n }\n });\n });\n return this;\n };\n Room.prototype.toJSON = function () {\n return valueToJSON(this);\n };\n return Room;\n}(EventEmitter));\nfunction verifyNoiseCancellation(room) {\n var allowedAudioProcessors = room.localParticipant._signaling.audioProcessors;\n room.localParticipant.audioTracks.forEach(function (_a) {\n var track = _a.track;\n var noiseCancellation = track.noiseCancellation;\n if (noiseCancellation && !allowedAudioProcessors.includes(noiseCancellation.vendor)) {\n room._log.warn(noiseCancellation.vendor + \" is not supported in this room. disabling it permanently\");\n noiseCancellation.disablePermanently();\n }\n });\n}\nfunction rewriteLocalTrackIds(room, trackStats) {\n var localParticipantSignaling = room.localParticipant._signaling;\n return trackStats.reduce(function (trackStats, trackStat) {\n var publication = localParticipantSignaling.tracks.get(trackStat.trackId);\n var trackSender = localParticipantSignaling.getSender(publication);\n return trackSender\n ? [Object.assign({}, trackStat, { trackId: trackSender.id })].concat(trackStats)\n : trackStats;\n }, []);\n}\n/**\n * A {@link Room.SID} is a 34-character string starting with \"RM\"\n * that uniquely identifies a {@link Room}.\n * @type string\n * @typedef Room.SID\n */\n/**\n * The Dominant Speaker in the {@link Room} changed. Either the Dominant Speaker\n * is a new {@link RemoteParticipant} or the Dominant Speaker has been reset and\n * is now null.\n * @param {?RemoteParticipant} dominantSpeaker - The Dominant Speaker in the\n * {@link Room}, if any\n * @event Room#dominantSpeakerChanged\n */\n/**\n * Your {@link LocalParticipant} was disconnected from the {@link Room} and all\n * other {@link RemoteParticipant}s.\n * @param {Room} room - The {@link Room} your\n * {@link LocalParticipant} was disconnected from\n * @param {?TwilioError} error - Present when the {@link LocalParticipant} got\n * disconnected from the {@link Room} unexpectedly\n * @event Room#disconnected\n * @example\n * myRoom.on('disconnected', function(room, error) {\n * if (error) {\n * console.log('Unexpectedly disconnected:', error);\n * }\n * myRoom.localParticipant.tracks.forEach(function(track) {\n * track.stop();\n * track.detach();\n * });\n * });\n */\n/**\n * A {@link RemoteParticipant} joined the {@link Room}. In Large Group Rooms (Maximum\n * Participants greater than 50), this event is raised only when a {@link RemoteParticipant}\n * publishes at least one {@link LocalTrack}.\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} who joined\n * @event Room#participantConnected\n * @example\n * myRoom.on('participantConnected', function(participant) {\n * console.log(participant.identity + ' joined the Room');\n * });\n */\n/**\n * A {@link RemoteParticipant} left the {@link Room}. In Large Group Rooms (Maximum\n * Participants greater than 50), this event is raised only when a {@link RemoteParticipant}\n * unpublishes all its {@link LocalTrack}s.\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} who left\n * @event Room#participantDisconnected\n * @example\n * myRoom.on('participantDisconnected', function(participant) {\n * console.log(participant.identity + ' left the Room');\n * participant.tracks.forEach(function(track) {\n * track.detach().forEach(function(mediaElement) {\n * mediaElement.remove();\n * });\n * });\n * });\n */\n/**\n * A {@link RemoteParticipant} has reconnected to the {@link Room} after a signaling connection disruption.\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} that has reconnected.\n * @event Room#participantReconnected\n * @example\n * myRoom.on('participantReconnected', participant => {\n * console.log(participant.identity + ' reconnected to the Room');\n * });\n */\n/**\n * A {@link RemoteParticipant} is reconnecting to the {@link Room} after a signaling connection disruption.\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} that is reconnecting.\n * @event Room#participantReconnecting\n * @example\n * myRoom.on('participantReconnecting', participant => {\n * console.log(participant.identity + ' is reconnecting to the Room');\n * });\n */\n/**\n * Your application successfully reconnected to the {@link Room}. When this\n * event is emitted, the {@link Room} is in state \"connected\".\n * @event Room#reconnected\n * @example\n * myRoom.on('reconnected', () => {\n * console.log('Reconnected!');\n * });\n */\n/**\n * Your application is reconnecting to the {@link Room}. This happens when there\n * is a disruption in your signaling connection and/or your media connection. When\n * this event is emitted, the {@link Room} is in state \"reconnecting\". If reconnecting\n * succeeds, the {@link Room} will emit a \"reconnected\" event.\n * @param {MediaConnectionError|SignalingConnectionDisconnectedError} error - A\n * {@link MediaConnectionError} if your application is reconnecting due to a\n * disruption in your media connection, or a {@link SignalingConnectionDisconnectedError}\n * if your application is reconnecting due to a disruption in your signaling connection\n * @event Room#reconnecting\n * @example\n * myRoom.on('reconnecting', error => {\n * if (error.code === 53001) {\n * console.log('Reconnecting your signaling connection!', error.message);\n * } else if (error.code === 53405) {\n * console.log('Reconnecting your media connection!', error.message);\n * }\n * });\n */\n/**\n * The {@link Room} is now being recorded\n * @event Room#recordingStarted\n */\n/**\n * The {@link Room} is no longer being recorded\n * @event Room#recordingStopped\n */\n/**\n * One of the {@link RemoteParticipant}'s {@link VideoTrack}'s dimensions changed.\n * @param {RemoteVideoTrack} track - The {@link RemoteVideoTrack} whose dimensions changed\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} whose\n * {@link RemoteVideoTrack}'s dimensions changed\n * @event Room#trackDimensionsChanged\n */\n/**\n * A {@link RemoteTrack} was disabled by a {@link RemoteParticipant} in the {@link Room}.\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication} that represents disabled {@link RemoteTrack}\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} who\n * disabled the {@link RemoteTrack}\n * @event Room#trackDisabled\n */\n/**\n * A {@link RemoteTrack} was enabled by a {@link RemoteParticipant} in the {@link Room}.\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication} that represents enabled {@link RemoteTrack}\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} who\n * enabled the {@link RemoteTrack}\n * @event Room#trackEnabled\n */\n/**\n * A message was received over one of the {@link RemoteParticipant}'s\n * {@link RemoteDataTrack}'s.\n * @param {string|ArrayBuffer} data\n * @param {RemoteDataTrack} track - The {@link RemoteDataTrack} over which the\n * message was received\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} whose\n * {@link RemoteDataTrack} received the message\n * @event Room#trackMessage\n */\n/**\n * A {@link RemoteTrack} was published by a {@link RemoteParticipant} after\n * connecting to the {@link Room}. This event is not emitted for\n * {@link RemoteTrack}s that were published while the {@link RemoteParticipant}\n * was connecting to the {@link Room}.\n * @event Room#trackPublished\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * which represents the published {@link RemoteTrack}\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} who\n * published the {@link RemoteTrack}\n * @example\n * function trackPublished(publication, participant) {\n * console.log(`RemoteParticipant ${participant.sid} published Track ${publication.trackSid}`);\n * }\n *\n * // Handle RemoteTracks published after connecting to the Room.\n * room.on('trackPublished', trackPublished);\n *\n * room.on('participantConnected', participant => {\n * // Handle RemoteTracks published while connecting to the Room.\n * participant.trackPublications.forEach(publication => trackPublished(publication, participant));\n * });\n */\n/**\n * One of a {@link RemoteParticipant}'s {@link RemoteTrack}s in the {@link Room} started.\n * @param {RemoteTrack} track - The {@link RemoteTrack} that started\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} whose\n * {@link RemoteTrack} started\n * @event Room#trackStarted\n */\n/**\n * A {@link RemoteParticipant}'s {@link RemoteTrack} was subscribed to.\n * @param {RemoteTrack} track - The {@link RemoteTrack} that was subscribed\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * for the {@link RemoteTrack} that was subscribed to\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} whose\n * {@link RemoteTrack} was subscribed\n * @event Room#trackSubscribed\n * @example\n * room.on('trackSubscribed', function(track, publication, participant) {\n * var participantView = document.getElementById('participant-view-' + participant.identity);\n * participantView.appendChild(track.attach());\n * });\n */\n/**\n * A {@link RemoteParticipant}'s {@link RemoteTrack} was switched off.\n * @param {RemoteTrack} track - The {@link RemoteTrack} that was switched off\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * for the {@link RemoteTrack} that was subscribed to\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} whose\n * {@link RemoteTrack} was switched off\n * @event Room#trackSwitchedOff\n */\n/**\n * A {@link RemoteParticipant}'s {@link RemoteTrack} was switched on.\n * @param {RemoteTrack} track - The {@link RemoteTrack} that was switched on\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * for the {@link RemoteTrack} that was subscribed to\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} whose\n * {@link RemoteTrack} was switched on\n * @event Room#trackSwitchedOn\n */\n/**\n * A {@link RemoteParticipant}'s {@link RemoteTrack} could not be subscribed to.\n * @param {TwilioError} error - The reason the {@link RemoteTrack} could not be\n * subscribed to\n * @param {RemoteTrackPublication} publication - The\n * {@link RemoteTrackPublication} for the {@link RemoteTrack} that could not\n * be subscribed to\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} whose\n * {@link RemoteTrack} could not be subscribed to\n * @event Room#trackSubscriptionFailed\n */\n/**\n * The {@link RemoteTrack}'s publish {@link Track.Priority} was changed by the\n * {@link RemoteParticipant}.\n * @param {Track.Priority} priority - the {@link RemoteTrack}'s new publish\n * {@link Track.Priority};\n * @param {RemoteTrackPublication} publication - The\n * {@link RemoteTrackPublication} for the {@link RemoteTrack} that changed priority\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} whose\n * {@link RemoteTrack} changed priority\n * @event Room#trackPublishPriorityChanged\n */\n/**\n * A {@link RemoteTrack} was unpublished by a {@link RemoteParticipant} to the {@link Room}.\n * @event Room#trackUnpublished\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * which represents the unpublished {@link RemoteTrack}\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} who\n * unpublished the {@link RemoteTrack}\n */\n/**\n * A {@link RemoteParticipant}'s {@link RemoteTrack} was unsubscribed from.\n * @param {RemoteTrack} track - The {@link RemoteTrack} that was unsubscribed\n * @param {RemoteTrackPublication} publication - The {@link RemoteTrackPublication}\n * for the {@link RemoteTrack} that was unsubscribed from\n * @param {RemoteParticipant} participant - The {@link RemoteParticipant} whose\n * {@link RemoteTrack} was unsubscribed\n * @event Room#trackUnsubscribed\n * @example\n * room.on('trackUnsubscribed', function(track, publication, participant) {\n * track.detach().forEach(function(mediaElement) {\n * mediaElement.remove();\n * });\n * });\n */\n/**\n * One of the {@link LocalParticipant}'s {@link LocalTrackPublication}s in the {@link Room} encountered a warning.\n * This event is only raised if you enabled warnings using notifyWarnings in ConnectOptions.\n * @param {string} name - The warning that was raised.\n * @param {LocalTrackPublication} publication - The {@link LocalTrackPublication} that encountered the warning.\n * @param {LocalParticipant} participant - The {@link LocalParticipant}\n * @event Room#trackWarning\n * @example\n * room.on('trackWarning', (name, publication, participant) => {\n * if (name === 'recording-media-lost') {\n * log(`LocalTrack ${publication.track.name} is not recording media.`,\n * name, publication, participant);\n *\n * // Wait a reasonable amount of time to clear the warning.\n * const timer = setTimeout(() => {\n * // If the warning is not cleared, you can manually\n * // reconnect to the room, or show a dialog to the user\n * }, 5000);\n *\n * room.once('trackWarningsCleared', (publication, participant) => {\n * log('LocalTrack warnings have cleared!',\n * publication, participant);\n * clearTimeout(timer);\n * });\n * }\n});\n */\n/**\n * One of the {@link LocalParticipant}'s {@link LocalTrackPublication}s in the {@link Room} cleared all warnings.\n * This event is only raised if you enabled warnings using notifyWarnings in ConnectOptions.\n * @param {LocalTrackPublication} publication - The {@link LocalTrackPublication} that cleared all warnings.\n * @param {LocalParticipant} participant - The {@link LocalParticipant}\n * @event Room#trackWarningsCleared\n */\nfunction connectParticipant(room, participantSignaling) {\n var log = room._log, clientTrackSwitchOffControl = room._clientTrackSwitchOffControl, contentPreferencesMode = room._contentPreferencesMode;\n var participant = new RemoteParticipant(participantSignaling, { log: log, clientTrackSwitchOffControl: clientTrackSwitchOffControl, contentPreferencesMode: contentPreferencesMode });\n log.info('A new RemoteParticipant connected:', participant);\n room._participants.set(participant.sid, participant);\n room.emit('participantConnected', participant);\n // Reemit Track and RemoteParticipant events.\n var eventListeners = [\n ['reconnected', 'participantReconnected'],\n ['reconnecting', 'participantReconnecting'],\n 'trackDimensionsChanged',\n 'trackDisabled',\n 'trackEnabled',\n 'trackMessage',\n 'trackPublished',\n 'trackPublishPriorityChanged',\n 'trackStarted',\n 'trackSubscribed',\n 'trackSubscriptionFailed',\n 'trackSwitchedOff',\n 'trackSwitchedOn',\n 'trackUnpublished',\n 'trackUnsubscribed'\n ].map(function (eventOrPair) {\n var _a = __read(Array.isArray(eventOrPair)\n ? eventOrPair\n : [eventOrPair, eventOrPair], 2), event = _a[0], participantEvent = _a[1];\n function reemit() {\n var args = [].slice.call(arguments);\n args.unshift(participantEvent);\n args.push(participant);\n room.emit.apply(room, __spreadArray([], __read(args)));\n }\n participant.on(event, reemit);\n return [event, reemit];\n });\n participant.once('disconnected', function participantDisconnected() {\n var dominantSpeaker = room.dominantSpeaker;\n log.info('RemoteParticipant disconnected:', participant);\n room._participants.delete(participant.sid);\n eventListeners.forEach(function (args) {\n participant.removeListener(args[0], args[1]);\n });\n room.emit('participantDisconnected', participant);\n if (participant === dominantSpeaker) {\n room.emit('dominantSpeakerChanged', room.dominantSpeaker);\n }\n });\n}\nfunction handleLocalParticipantEvents(room, localParticipant) {\n var events = ['trackWarning', 'trackWarningsCleared'].map(function (event) { return ({\n eventName: event,\n handler: function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return room.emit.apply(room, __spreadArray([event], __read(__spreadArray(__spreadArray([], __read(args)), [localParticipant]))));\n },\n }); });\n events.forEach(function (_a) {\n var eventName = _a.eventName, handler = _a.handler;\n return localParticipant.on(eventName, handler);\n });\n room.once('disconnected', function () {\n return events.forEach(function (_a) {\n var eventName = _a.eventName, handler = _a.handler;\n return localParticipant.removeListener(eventName, handler);\n });\n });\n}\nfunction handleRecordingEvents(room, recording) {\n recording.on('updated', function updated() {\n var started = recording.isEnabled;\n room._log.info(\"Recording \" + (started ? 'started' : 'stopped'));\n room.emit(\"recording\" + (started ? 'Started' : 'Stopped'));\n });\n}\nfunction handleSignalingEvents(room, signaling) {\n var log = room._log;\n // Reemit RemoteParticipant events from the RoomSignaling.\n log.debug('Creating a new RemoteParticipant for each ParticipantSignaling '\n + 'in the RoomSignaling');\n signaling.participants.forEach(connectParticipant.bind(null, room));\n log.debug('Setting up RemoteParticipant creation for all subsequent '\n + 'ParticipantSignalings that connect to the RoomSignaling');\n signaling.on('participantConnected', connectParticipant.bind(null, room));\n signaling.on('dominantSpeakerChanged', function () { return room.emit('dominantSpeakerChanged', room.dominantSpeaker); });\n // Reemit state transition events from the RoomSignaling.\n signaling.on('stateChanged', function stateChanged(state, error) {\n log.info('Transitioned to state:', state);\n switch (state) {\n case 'disconnected':\n room.participants.forEach(function (participant) {\n participant._unsubscribeTracks();\n });\n room.emit(state, room, error);\n room.localParticipant.tracks.forEach(function (publication) {\n publication.unpublish();\n });\n signaling.removeListener('stateChanged', stateChanged);\n break;\n case 'reconnecting':\n // NOTE(mpatwardhan): `stateChanged` can get emitted with StateMachine locked.\n // Do not signal public events synchronously with lock held.\n setTimeout(function () { return room.emit('reconnecting', error); }, 0);\n break;\n default:\n // NOTE(mpatwardhan): `stateChanged` can get emitted with StateMachine locked.\n // Do not signal public events synchronously with lock held.\n setTimeout(function () { return room.emit('reconnected'); }, 0);\n }\n });\n}\nmodule.exports = Room;\n//# sourceMappingURL=room.js.map","/**\n * Expose `Backoff`.\n */\nvar Backoff = /** @class */ (function () {\n /**\n * Construct a {@link Backoff}.\n * @param {object} options\n * @property {number} min - Initial timeout in milliseconds [100]\n * @property {number} max - Max timeout [10000]\n * @property {boolean} jitter - Apply jitter [0]\n * @property {number} factor - Multiplication factor for Backoff operation [2]\n */\n function Backoff(options) {\n Object.defineProperties(this, {\n _min: {\n value: options.min || 100\n },\n _max: {\n value: options.max || 10000\n },\n _jitter: {\n value: options.jitter > 0 && options.jitter <= 1 ? options.jitter : 0\n },\n _factor: {\n value: options.factor || 2\n },\n _attempts: {\n value: 0,\n writable: true\n },\n _duration: {\n enumerable: false,\n get: function () {\n var ms = this._min * Math.pow(this._factor, this._attempts);\n if (this._jitter) {\n var rand = Math.random();\n var deviation = Math.floor(rand * this._jitter * ms);\n ms = (Math.floor(rand * 10) & 1) === 0 ? ms - deviation : ms + deviation;\n }\n return Math.min(ms, this._max) | 0;\n }\n },\n _timeoutID: {\n value: null,\n writable: true\n }\n });\n }\n /**\n * Start the backoff operation.\n * @param {function} fn - Function to call\n * @return {void}\n * @api public\n */\n Backoff.prototype.backoff = function (fn) {\n var _this = this;\n var duration = this._duration;\n if (this._timeoutID) {\n clearTimeout(this._timeoutID);\n this._timeoutID = null;\n }\n this._timeoutID = setTimeout(function () {\n _this._attempts++;\n fn();\n }, duration);\n };\n /**\n * Reset the number of attempts and clear the timer.\n *\n * @return {void}\n * @api public\n */\n Backoff.prototype.reset = function () {\n this._attempts = 0;\n if (this._timeoutID) {\n clearTimeout(this._timeoutID);\n this._timeoutID = null;\n }\n };\n return Backoff;\n}());\nmodule.exports = Backoff;\n//# sourceMappingURL=backoff.js.map","'use strict';\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar _a = require('../'), difference = _a.difference, flatMap = _a.flatMap;\n/**\n * Create a random {@link SSRC}.\n * @returns {SSRC}\n */\nfunction createSSRC() {\n var ssrcMax = 0xffffffff;\n return String(Math.floor(Math.random() * ssrcMax));\n}\n/**\n * @property {string} cName\n * @property {boolean} isSimulcastEnabled\n * @property {Map} rtxPairs\n * @property {Set} primarySSRCs\n * @property {string} streamId\n * @property {Track.ID} trackId\n */\nvar TrackAttributes = /** @class */ (function () {\n /**\n * Construct a {@link MediaStreamTrack} attribute store.\n * @param {Track.ID} trackId - The MediaStreamTrack ID\n * @param {MediaStreamID} streamId - The MediaStream ID\n * @param {string} cName - The MediaStream cname\n */\n function TrackAttributes(trackId, streamId, cName) {\n Object.defineProperties(this, {\n cName: {\n enumerable: true,\n value: cName\n },\n isSimulcastEnabled: {\n enumerable: true,\n value: false,\n writable: true\n },\n primarySSRCs: {\n enumerable: true,\n value: new Set()\n },\n rtxPairs: {\n enumerable: true,\n value: new Map()\n },\n streamId: {\n enumerable: true,\n value: streamId\n },\n trackId: {\n enumerable: true,\n value: trackId\n }\n });\n }\n /**\n * Add {@link SimSSRC}s to the {@link TrackAttributes}.\n * @returns {void}\n */\n TrackAttributes.prototype.addSimulcastSSRCs = function () {\n if (this.isSimulcastEnabled) {\n return;\n }\n var simulcastSSRCs = [createSSRC(), createSSRC()];\n simulcastSSRCs.forEach(function (ssrc) {\n this.primarySSRCs.add(ssrc);\n }, this);\n if (this.rtxPairs.size) {\n simulcastSSRCs.forEach(function (ssrc) {\n this.rtxPairs.set(createSSRC(), ssrc);\n }, this);\n }\n };\n /**\n * Add the given {@link PrimarySSRC} or {@link RtxSSRC} to the {@link TrackAttributes}\n * and update the \"isSimulcastEnabled\" flag if it is also a {@link SimSSRC}.\n * @param {SSRC} ssrc - The {@link SSRC} to be added\n * @param {?PrimarySSRC} primarySSRC - The {@link PrimarySSRC}; if the given\n * {@link SSRC} itself is the {@link PrimarySSRC}, then this is set to null\n * @param {boolean} isSimSSRC - true if the given {@link SSRC} is a\n * {@link SimSSRC}; false otherwise\n * @returns {void}\n */\n TrackAttributes.prototype.addSSRC = function (ssrc, primarySSRC, isSimSSRC) {\n if (primarySSRC) {\n this.rtxPairs.set(ssrc, primarySSRC);\n }\n else {\n this.primarySSRCs.add(ssrc);\n }\n this.isSimulcastEnabled = this.isSimulcastEnabled || isSimSSRC;\n };\n /**\n * Construct the SDP lines for the {@link TrackAttributes}.\n * @param {boolean} [excludeRtx=false]\n * @returns {Array} Array of SDP lines\n */\n TrackAttributes.prototype.toSdpLines = function (excludeRtx) {\n var _this = this;\n var rtxPairs = excludeRtx\n ? []\n : Array.from(this.rtxPairs.entries()).map(function (rtxPair) { return rtxPair.reverse(); });\n var simSSRCs = Array.from(this.primarySSRCs.values());\n var ssrcs = rtxPairs.length ? flatMap(rtxPairs) : simSSRCs;\n var attrLines = flatMap(ssrcs, function (ssrc) { return [\n \"a=ssrc:\" + ssrc + \" cname:\" + _this.cName,\n \"a=ssrc:\" + ssrc + \" msid:\" + _this.streamId + \" \" + _this.trackId\n ]; });\n var rtxPairLines = rtxPairs.map(function (rtxPair) { return \"a=ssrc-group:FID \" + rtxPair.join(' '); });\n var simGroupLines = [\n \"a=ssrc-group:SIM \" + simSSRCs.join(' ')\n ];\n return rtxPairLines.concat(attrLines).concat(simGroupLines);\n };\n return TrackAttributes;\n}());\n/**\n * Get the matches for a given RegEx pattern.\n * @param {string} section - SDP media section\n * @param {string} pattern - RegEx pattern\n * @returns {Array>} - Array of pattern matches\n */\nfunction getMatches(section, pattern) {\n var matches = section.match(new RegExp(pattern, 'gm')) || [];\n return matches.map(function (match) {\n var matches = match.match(new RegExp(pattern)) || [];\n return matches.slice(1);\n });\n}\n/**\n * Get the {@link SimSSRC}s that belong to a simulcast group.\n * @param {string} section - SDP media section\n * @returns {Set} Set of simulcast {@link SSRC}s\n */\nfunction getSimulcastSSRCs(section) {\n var simGroupPattern = '^a=ssrc-group:SIM ([0-9]+) ([0-9]+) ([0-9]+)$';\n return new Set(flatMap(getMatches(section, simGroupPattern)));\n}\n/**\n * Get the value of the given attribute for an SSRC.\n * @param {string} section - SDP media section\n * @param {SSRC} ssrc - {@link SSRC} whose attribute's value is to be determinded\n * @param {string} attribute - {@link SSRC} attribute name\n * @param {string} - {@link SSRC} attribute value\n */\nfunction getSSRCAttribute(section, ssrc, attribute) {\n var pattern = \"a=ssrc:\" + ssrc + \" \" + attribute + \":(.+)\";\n return section.match(new RegExp(pattern))[1];\n}\n/**\n * Create a Map of {@link PrimarySSRC}s and their {@link RtxSSRC}s.\n * @param {string} section - SDP media section\n * @returns {Map} - Map of {@link RtxSSRC}s and their\n * corresponding {@link PrimarySSRC}s\n */\nfunction getSSRCRtxPairs(section) {\n var rtxPairPattern = '^a=ssrc-group:FID ([0-9]+) ([0-9]+)$';\n return new Map(getMatches(section, rtxPairPattern).map(function (pair) { return pair.reverse(); }));\n}\n/**\n * Create SSRC attribute tuples.\n * @param {string} section\n * @returns {Array<[SSRC, MediaStreamID, Track.ID]>}\n */\nfunction createSSRCAttributeTuples(section) {\n var _a = __read(flatMap(getMatches(section, '^a=msid:(.+) (.+)$')), 2), streamId = _a[0], trackId = _a[1];\n var ssrcs = flatMap(getMatches(section, '^a=ssrc:(.+) cname:.+$'));\n return ssrcs.map(function (ssrc) { return [ssrc, streamId, trackId]; });\n}\n/**\n * Create a Map of MediaStreamTrack IDs and their {@link TrackAttributes}.\n * @param {string} section - SDP media section\n * @returns {Map}\n */\nfunction createTrackIdsToAttributes(section) {\n var simSSRCs = getSimulcastSSRCs(section);\n var rtxPairs = getSSRCRtxPairs(section);\n var ssrcAttrTuples = createSSRCAttributeTuples(section);\n return ssrcAttrTuples.reduce(function (trackIdsToSSRCs, tuple) {\n var ssrc = tuple[0];\n var streamId = tuple[1];\n var trackId = tuple[2];\n var trackAttributes = trackIdsToSSRCs.get(trackId) || new TrackAttributes(trackId, streamId, getSSRCAttribute(section, ssrc, 'cname'));\n var primarySSRC = rtxPairs.get(ssrc) || null;\n trackAttributes.addSSRC(ssrc, primarySSRC, simSSRCs.has(ssrc));\n return trackIdsToSSRCs.set(trackId, trackAttributes);\n }, new Map());\n}\n/**\n * Apply simulcast settings to the given SDP media section.\n * @param {string} section - SDP media section\n * @param {Map} trackIdsToAttributes - Existing\n * map which will be updated for new MediaStreamTrack IDs\n * @returns {string} - The transformed SDP media section\n */\nfunction setSimulcastInMediaSection(section, trackIdsToAttributes) {\n var newTrackIdsToAttributes = createTrackIdsToAttributes(section);\n var newTrackIds = Array.from(newTrackIdsToAttributes.keys());\n var trackIds = Array.from(trackIdsToAttributes.keys());\n var trackIdsToAdd = difference(newTrackIds, trackIds);\n var trackIdsToIgnore = difference(trackIds, newTrackIds);\n // Update \"trackIdsToAttributes\" with TrackAttributes for new\n // MediaStreamTrack IDs.\n var trackAttributesToAdd = flatMap(trackIdsToAdd, function (trackId) { return newTrackIdsToAttributes.get(trackId); });\n trackAttributesToAdd.forEach(function (trackAttributes) {\n trackAttributes.addSimulcastSSRCs();\n trackIdsToAttributes.set(trackAttributes.trackId, trackAttributes);\n });\n // Get the SDP lines of the relevant MediaStreamTrack IDs from\n // \"trackIdsToAttributes\".\n trackIds = Array.from(trackIdsToAttributes.keys());\n var relevantTrackIds = difference(trackIds, trackIdsToIgnore);\n var relevantTrackAttributes = flatMap(relevantTrackIds, function (trackId) { return trackIdsToAttributes.get(trackId); });\n var excludeRtx = !section.match(/a=rtpmap:[0-9]+ rtx/);\n var relevantSdpLines = flatMap(relevantTrackAttributes, function (trackAttributes) { return trackAttributes.toSdpLines(excludeRtx); });\n // Add the simulcast SSRC SDP lines to the media section. The Set ensures\n // that the duplicates of the SSRC SDP lines that are in both \"section\" and\n // \"relevantSdpLines\" are removed.\n var sectionLines = flatMap(new Set(section.split('\\r\\n').concat(relevantSdpLines)));\n var xGoogleFlagConference = 'a=x-google-flag:conference';\n if (!section.match(xGoogleFlagConference)) {\n sectionLines.push(xGoogleFlagConference);\n }\n return sectionLines.join('\\r\\n');\n}\n/**\n * String representing a MediaStream ID.\n * @typedef {string} MediaStreamID\n */\n/**\n * String representing the SSRC of a MediaStreamTrack.\n * @typedef {string} SSRC\n */\n/**\n * Primary SSRC.\n * @typedef {SSRC} PrimarySSRC\n */\n/**\n * Retransmission SSRC.\n * @typedef {SSRC} RtxSSRC\n */\n/**\n * Simulcast SSRC.\n * @typedef {SSRC} SimSSRC\n */\nmodule.exports = setSimulcastInMediaSection;\n//# sourceMappingURL=simulcast.js.map","'use strict';\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar _a = require('../'), difference = _a.difference, flatMap = _a.flatMap;\nvar setSimulcastInMediaSection = require('./simulcast');\nvar ptToFixedBitrateAudioCodecName = {\n 0: 'PCMU',\n 8: 'PCMA'\n};\n/**\n * A payload type\n * @typedef {number} PT\n */\n/**\n * An {@link AudioCodec} or {@link VideoCodec}\n * @typedef {AudioCodec|VideoCodec} Codec\n */\n/**\n * Create a Codec Map for the given m= section.\n * @param {string} section - The given m= section\n * @returns {Map>}\n */\nfunction createCodecMapForMediaSection(section) {\n return Array.from(createPtToCodecName(section)).reduce(function (codecMap, pair) {\n var pt = pair[0];\n var codecName = pair[1];\n var pts = codecMap.get(codecName) || [];\n return codecMap.set(codecName, pts.concat(pt));\n }, new Map());\n}\n/**\n * Create a Map of MIDs to m= sections for the given SDP.\n * @param {string} sdp\n * @returns {Map}\n */\nfunction createMidToMediaSectionMap(sdp) {\n return getMediaSections(sdp).reduce(function (midsToMediaSections, mediaSection) {\n var mid = getMidForMediaSection(mediaSection);\n return mid ? midsToMediaSections.set(mid, mediaSection) : midsToMediaSections;\n }, new Map());\n}\n/**\n * Create a Map from PTs to codec names for the given m= section.\n * @param {string} mediaSection - The given m= section.\n * @returns {Map} ptToCodecName\n */\nfunction createPtToCodecName(mediaSection) {\n return getPayloadTypesInMediaSection(mediaSection).reduce(function (ptToCodecName, pt) {\n var rtpmapPattern = new RegExp(\"a=rtpmap:\" + pt + \" ([^/]+)\");\n var matches = mediaSection.match(rtpmapPattern);\n var codecName = matches\n ? matches[1].toLowerCase()\n : ptToFixedBitrateAudioCodecName[pt]\n ? ptToFixedBitrateAudioCodecName[pt].toLowerCase()\n : '';\n return ptToCodecName.set(pt, codecName);\n }, new Map());\n}\n/**\n * Get the associated fmtp attributes for the given Payload Type in an m= section.\n * @param {PT} pt\n * @param {string} mediaSection\n * @returns {?object}\n */\nfunction getFmtpAttributesForPt(pt, mediaSection) {\n // In \"a=fmtp: =[;=]*\", the regex matches the codec\n // profile parameters expressed as name/value pairs separated by \";\".\n var fmtpRegex = new RegExp(\"^a=fmtp:\" + pt + \" (.+)$\", 'm');\n var matches = mediaSection.match(fmtpRegex);\n return matches && matches[1].split(';').reduce(function (attrs, nvPair) {\n var _a = __read(nvPair.split('='), 2), name = _a[0], value = _a[1];\n attrs[name] = isNaN(value) ? value : parseInt(value, 10);\n return attrs;\n }, {});\n}\n/**\n * Get the MID for the given m= section.\n * @param {string} mediaSection\n * @return {?string}\n */\nfunction getMidForMediaSection(mediaSection) {\n // In \"a=mid:\", the regex matches .\n var midMatches = mediaSection.match(/^a=mid:(.+)$/m);\n return midMatches && midMatches[1];\n}\n/**\n * Get the m= sections of a particular kind and direction from an sdp.\n * @param {string} sdp - SDP string\n * @param {string} [kind] - Pattern for matching kind\n * @param {string} [direction] - Pattern for matching direction\n * @returns {Array} mediaSections\n */\nfunction getMediaSections(sdp, kind, direction) {\n return sdp.replace(/\\r\\n\\r\\n$/, '\\r\\n').split('\\r\\nm=').slice(1).map(function (mediaSection) { return \"m=\" + mediaSection; }).filter(function (mediaSection) {\n var kindPattern = new RegExp(\"m=\" + (kind || '.*'), 'gm');\n var directionPattern = new RegExp(\"a=\" + (direction || '.*'), 'gm');\n return kindPattern.test(mediaSection) && directionPattern.test(mediaSection);\n });\n}\n/**\n * Get the Codec Payload Types present in the first line of the given m= section\n * @param {string} section - The m= section\n * @returns {Array} Payload Types\n */\nfunction getPayloadTypesInMediaSection(section) {\n var mLine = section.split('\\r\\n')[0];\n // In \"m= ... \",\n // the regex matches and the Payload Types.\n var matches = mLine.match(/([0-9]+)/g);\n // This should not happen, but in case there are no Payload Types in\n // the m= line, return an empty array.\n if (!matches) {\n return [];\n }\n // Since only the Payload Types are needed, we discard the .\n return matches.slice(1).map(function (match) { return parseInt(match, 10); });\n}\n/**\n * Create the reordered Codec Payload Types based on the preferred Codec Names.\n * @param {Map>} codecMap - Codec Map\n * @param {Array} preferredCodecs - Preferred Codecs\n * @returns {Array} Reordered Payload Types\n */\nfunction getReorderedPayloadTypes(codecMap, preferredCodecs) {\n preferredCodecs = preferredCodecs.map(function (_a) {\n var codec = _a.codec;\n return codec.toLowerCase();\n });\n var preferredPayloadTypes = flatMap(preferredCodecs, function (codecName) { return codecMap.get(codecName) || []; });\n var remainingCodecs = difference(Array.from(codecMap.keys()), preferredCodecs);\n var remainingPayloadTypes = flatMap(remainingCodecs, function (codecName) { return codecMap.get(codecName); });\n return preferredPayloadTypes.concat(remainingPayloadTypes);\n}\n/**\n * Set the given Codec Payload Types in the first line of the given m= section.\n * @param {Array} payloadTypes - Payload Types\n * @param {string} section - Given m= section\n * @returns {string} - Updated m= section\n */\nfunction setPayloadTypesInMediaSection(payloadTypes, section) {\n var lines = section.split('\\r\\n');\n var mLine = lines[0];\n var otherLines = lines.slice(1);\n mLine = mLine.replace(/([0-9]+\\s?)+$/, payloadTypes.join(' '));\n return [mLine].concat(otherLines).join('\\r\\n');\n}\n/**\n * Return a new SDP string with the re-ordered codec preferences.\n * @param {string} sdp\n * @param {Array} preferredAudioCodecs - If empty, the existing order\n * of audio codecs is preserved\n * @param {Array} preferredVideoCodecs - If empty, the\n * existing order of video codecs is preserved\n * @returns {string} Updated SDP string\n */\nfunction setCodecPreferences(sdp, preferredAudioCodecs, preferredVideoCodecs) {\n var mediaSections = getMediaSections(sdp);\n var session = sdp.split('\\r\\nm=')[0];\n return [session].concat(mediaSections.map(function (section) {\n // Codec preferences should not be applied to m=application sections.\n if (!/^m=(audio|video)/.test(section)) {\n return section;\n }\n var kind = section.match(/^m=(audio|video)/)[1];\n var codecMap = createCodecMapForMediaSection(section);\n var preferredCodecs = kind === 'audio' ? preferredAudioCodecs : preferredVideoCodecs;\n var payloadTypes = getReorderedPayloadTypes(codecMap, preferredCodecs);\n var newSection = setPayloadTypesInMediaSection(payloadTypes, section);\n var pcmaPayloadTypes = codecMap.get('pcma') || [];\n var pcmuPayloadTypes = codecMap.get('pcmu') || [];\n var fixedBitratePayloadTypes = kind === 'audio'\n ? new Set(pcmaPayloadTypes.concat(pcmuPayloadTypes))\n : new Set();\n return fixedBitratePayloadTypes.has(payloadTypes[0])\n ? newSection.replace(/\\r\\nb=(AS|TIAS):([0-9]+)/g, '')\n : newSection;\n })).join('\\r\\n');\n}\n/**\n * Return a new SDP string with simulcast settings.\n * @param {string} sdp\n * @param {Map} trackIdsToAttributes\n * @returns {string} Updated SDP string\n */\nfunction setSimulcast(sdp, trackIdsToAttributes) {\n var mediaSections = getMediaSections(sdp);\n var session = sdp.split('\\r\\nm=')[0];\n return [session].concat(mediaSections.map(function (section) {\n section = section.replace(/\\r\\n$/, '');\n if (!/^m=video/.test(section)) {\n return section;\n }\n var codecMap = createCodecMapForMediaSection(section);\n var payloadTypes = getPayloadTypesInMediaSection(section);\n var vp8PayloadTypes = new Set(codecMap.get('vp8') || []);\n var hasVP8PayloadType = payloadTypes.some(function (payloadType) { return vp8PayloadTypes.has(payloadType); });\n return hasVP8PayloadType\n ? setSimulcastInMediaSection(section, trackIdsToAttributes)\n : section;\n })).concat('').join('\\r\\n');\n}\n/**\n * Get the matching Payload Types in an m= section for a particular peer codec.\n * @param {Codec} peerCodec\n * @param {PT} peerPt\n * @param {Map} codecsToPts\n * @param {string} section\n * @param {string} peerSection\n * @returns {Array}\n */\nfunction getMatchingPayloadTypes(peerCodec, peerPt, codecsToPts, section, peerSection) {\n // If there is at most one local Payload Type that matches the remote codec, retain it.\n var matchingPts = codecsToPts.get(peerCodec) || [];\n if (matchingPts.length <= 1) {\n return matchingPts;\n }\n // If there are no fmtp attributes for the codec in the peer m= section, then we\n // cannot get a match in the m= section. In that case, retain all matching Payload\n // Types.\n var peerFmtpAttrs = getFmtpAttributesForPt(peerPt, peerSection);\n if (!peerFmtpAttrs) {\n return matchingPts;\n }\n // Among the matched local Payload Types, find the one that matches the remote\n // fmtp attributes.\n var matchingPt = matchingPts.find(function (pt) {\n var fmtpAttrs = getFmtpAttributesForPt(pt, section);\n return fmtpAttrs && Object.keys(peerFmtpAttrs).every(function (attr) {\n return peerFmtpAttrs[attr] === fmtpAttrs[attr];\n });\n });\n // If none of the matched Payload Types also have matching fmtp attributes,\n // then retain all of them, otherwise retain only the Payload Type that\n // matches the peer fmtp attributes.\n return typeof matchingPt === 'number' ? [matchingPt] : matchingPts;\n}\n/**\n * Filter codecs in an m= section based on its peer m= section from the other peer.\n * @param {string} section\n * @param {Map} peerMidsToMediaSections\n * @param {Array} codecsToRemove\n * @returns {string}\n */\nfunction filterCodecsInMediaSection(section, peerMidsToMediaSections, codecsToRemove) {\n // Do nothing if the m= section represents neither audio nor video.\n if (!/^m=(audio|video)/.test(section)) {\n return section;\n }\n // Do nothing if the m= section does not have an equivalent remote m= section.\n var mid = getMidForMediaSection(section);\n var peerSection = mid && peerMidsToMediaSections.get(mid);\n if (!peerSection) {\n return section;\n }\n // Construct a Map of the peer Payload Types to their codec names.\n var peerPtToCodecs = createPtToCodecName(peerSection);\n // Construct a Map of the codec names to their Payload Types.\n var codecsToPts = createCodecMapForMediaSection(section);\n // Maintain a list of non-rtx Payload Types to retain.\n var pts = flatMap(Array.from(peerPtToCodecs), function (_a) {\n var _b = __read(_a, 2), peerPt = _b[0], peerCodec = _b[1];\n return peerCodec !== 'rtx' && !codecsToRemove.includes(peerCodec)\n ? getMatchingPayloadTypes(peerCodec, peerPt, codecsToPts, section, peerSection)\n : [];\n });\n // For each Payload Type that will be retained, retain their corresponding rtx\n // Payload Type if present.\n var rtxPts = codecsToPts.get('rtx') || [];\n // In \"a=fmtp: apt=\", extract the codec PT associated with rtxPt.\n pts = pts.concat(rtxPts.filter(function (rtxPt) {\n var fmtpAttrs = getFmtpAttributesForPt(rtxPt, section);\n return fmtpAttrs && pts.includes(fmtpAttrs.apt);\n }));\n // Filter out the below mentioned attribute lines in the m= section that do not\n // belong to one of the Payload Types that are to be retained.\n // 1. \"a=rtpmap: \"\n // 2. \"a=rtcp-fb: [ ]*\"\n // 3. \"a=fmtp: =[;=]*\"\n var lines = section.split('\\r\\n').filter(function (line) {\n var ptMatches = line.match(/^a=(rtpmap|fmtp|rtcp-fb):(.+) .+$/);\n var pt = ptMatches && ptMatches[2];\n return !ptMatches || (pt && pts.includes(parseInt(pt, 10)));\n });\n // Filter the list of Payload Types in the first line of the m= section.\n var orderedPts = getPayloadTypesInMediaSection(section).filter(function (pt) { return pts.includes(pt); });\n return setPayloadTypesInMediaSection(orderedPts, lines.join('\\r\\n'));\n}\n/**\n * Filter local codecs based on the remote SDP.\n * @param {string} localSdp\n * @param {string} remoteSdp\n * @returns {string} - Updated local SDP\n */\nfunction filterLocalCodecs(localSdp, remoteSdp) {\n var localMediaSections = getMediaSections(localSdp);\n var localSession = localSdp.split('\\r\\nm=')[0];\n var remoteMidsToMediaSections = createMidToMediaSectionMap(remoteSdp);\n return [localSession].concat(localMediaSections.map(function (localSection) {\n return filterCodecsInMediaSection(localSection, remoteMidsToMediaSections, []);\n })).join('\\r\\n');\n}\n/**\n * Return a new SDP string after reverting simulcast for non vp8 sections in remote sdp.\n * @param localSdp - simulcast enabled local sdp\n * @param localSdpWithoutSimulcast - local sdp before simulcast was set\n * @param remoteSdp - remote sdp\n * @param revertForAll - when true simulcast will be reverted for all codecs. when false it will be reverted\n * only for non-vp8 codecs.\n * @return {string} Updated SDP string\n */\nfunction revertSimulcast(localSdp, localSdpWithoutSimulcast, remoteSdp, revertForAll) {\n if (revertForAll === void 0) { revertForAll = false; }\n var remoteMidToMediaSections = createMidToMediaSectionMap(remoteSdp);\n var localMidToMediaSectionsWithoutSimulcast = createMidToMediaSectionMap(localSdpWithoutSimulcast);\n var mediaSections = getMediaSections(localSdp);\n var session = localSdp.split('\\r\\nm=')[0];\n return [session].concat(mediaSections.map(function (section) {\n section = section.replace(/\\r\\n$/, '');\n if (!/^m=video/.test(section)) {\n return section;\n }\n var midMatches = section.match(/^a=mid:(.+)$/m);\n var mid = midMatches && midMatches[1];\n if (!mid) {\n return section;\n }\n var remoteSection = remoteMidToMediaSections.get(mid);\n var remotePtToCodecs = createPtToCodecName(remoteSection);\n var remotePayloadTypes = getPayloadTypesInMediaSection(remoteSection);\n var isVP8ThePreferredCodec = remotePayloadTypes.length && remotePtToCodecs.get(remotePayloadTypes[0]) === 'vp8';\n var shouldRevertSimulcast = revertForAll || !isVP8ThePreferredCodec;\n return shouldRevertSimulcast ? localMidToMediaSectionsWithoutSimulcast.get(mid).replace(/\\r\\n$/, '') : section;\n })).concat('').join('\\r\\n');\n}\n/**\n * Add or rewrite MSIDs for new m= sections in the given SDP with their corresponding\n * local MediaStreamTrack IDs. These can be different when previously removed MediaStreamTracks\n * are added back (or Track IDs may not be present in the SDPs at all once browsers implement\n * the latest WebRTC spec).\n * @param {string} sdp\n * @param {Map} activeMidsToTrackIds\n * @param {Map>} trackIdsByKind\n * @returns {string}\n */\nfunction addOrRewriteNewTrackIds(sdp, activeMidsToTrackIds, trackIdsByKind) {\n // NOTE(mmalavalli): The m= sections for the new MediaStreamTracks are usually\n // present after the m= sections for the existing MediaStreamTracks, in order\n // of addition.\n var newMidsToTrackIds = Array.from(trackIdsByKind).reduce(function (midsToTrackIds, _a) {\n var _b = __read(_a, 2), kind = _b[0], trackIds = _b[1];\n var mediaSections = getMediaSections(sdp, kind, 'send(only|recv)');\n var newMids = mediaSections.map(getMidForMediaSection).filter(function (mid) { return !activeMidsToTrackIds.has(mid); });\n newMids.forEach(function (mid, i) { return midsToTrackIds.set(mid, trackIds[i]); });\n return midsToTrackIds;\n }, new Map());\n return addOrRewriteTrackIds(sdp, newMidsToTrackIds);\n}\n/**\n * Add or rewrite MSIDs in the given SDP with their corresponding local MediaStreamTrack IDs.\n * These IDs need not be the same (or Track IDs may not be present in the SDPs at all once\n * browsers implement the latest WebRTC spec).\n * @param {string} sdp\n * @param {Map} midsToTrackIds\n * @returns {string}\n */\nfunction addOrRewriteTrackIds(sdp, midsToTrackIds) {\n var mediaSections = getMediaSections(sdp);\n var session = sdp.split('\\r\\nm=')[0];\n return [session].concat(mediaSections.map(function (mediaSection) {\n // Do nothing if the m= section represents neither audio nor video.\n if (!/^m=(audio|video)/.test(mediaSection)) {\n return mediaSection;\n }\n // This shouldn't happen, but in case there is no MID for the m= section, do nothing.\n var mid = getMidForMediaSection(mediaSection);\n if (!mid) {\n return mediaSection;\n }\n // In case there is no Track ID for the given MID in the map, do nothing.\n var trackId = midsToTrackIds.get(mid);\n if (!trackId) {\n return mediaSection;\n }\n // This shouldn't happen, but in case there is no a=msid: line, do nothing.\n var attributes = (mediaSection.match(/^a=msid:(.+)$/m) || [])[1];\n if (!attributes) {\n return mediaSection;\n }\n // If the a=msid: line contains the \"appdata\" field, then replace it with the Track ID,\n // otherwise append the Track ID.\n var _a = __read(attributes.split(' '), 2), msid = _a[0], trackIdToRewrite = _a[1];\n var msidRegex = new RegExp(\"msid:\" + msid + (trackIdToRewrite ? \" \" + trackIdToRewrite : '') + \"$\", 'gm');\n return mediaSection.replace(msidRegex, \"msid:\" + msid + \" \" + trackId);\n })).join('\\r\\n');\n}\n/**\n * Removes specified ssrc attributes from given sdp.\n * @param {string} sdp\n * @param {Array} ssrcAttributesToRemove\n * @returns {string}\n */\nfunction removeSSRCAttributes(sdp, ssrcAttributesToRemove) {\n return sdp.split('\\r\\n').filter(function (line) {\n return !ssrcAttributesToRemove.find(function (srcAttribute) { return new RegExp('a=ssrc:.*' + srcAttribute + ':', 'g').test(line); });\n }).join('\\r\\n');\n}\n/**\n * Disable RTX in a given sdp.\n * @param {string} sdp\n * @returns {string} sdp without RTX\n */\nfunction disableRtx(sdp) {\n var mediaSections = getMediaSections(sdp);\n var session = sdp.split('\\r\\nm=')[0];\n return [session].concat(mediaSections.map(function (mediaSection) {\n // Do nothing if the m= section does not represent a video track.\n if (!/^m=video/.test(mediaSection)) {\n return mediaSection;\n }\n // Create a map of codecs to payload types.\n var codecsToPts = createCodecMapForMediaSection(mediaSection);\n // Get the RTX payload types.\n var rtxPts = codecsToPts.get('rtx');\n // Do nothing if there are no RTX payload types.\n if (!rtxPts) {\n return mediaSection;\n }\n // Remove the RTX payload types.\n var pts = new Set(getPayloadTypesInMediaSection(mediaSection));\n rtxPts.forEach(function (rtxPt) { return pts.delete(rtxPt); });\n // Get the RTX SSRC.\n var rtxSSRCMatches = mediaSection.match(/a=ssrc-group:FID [0-9]+ ([0-9]+)/);\n var rtxSSRC = rtxSSRCMatches && rtxSSRCMatches[1];\n // Remove the following lines associated with the RTX payload types:\n // 1. \"a=fmtp: apt=\"\n // 2. \"a=rtpmap: rtx/...\"\n // 3. \"a=ssrc: cname:...\"\n // 4. \"a=ssrc-group:FID \"\n var filterRegexes = [\n /^a=fmtp:.+ apt=.+$/,\n /^a=rtpmap:.+ rtx\\/.+$/,\n /^a=ssrc-group:.+$/\n ].concat(rtxSSRC\n ? [new RegExp(\"^a=ssrc:\" + rtxSSRC + \" .+$\")]\n : []);\n mediaSection = mediaSection.split('\\r\\n')\n .filter(function (line) { return filterRegexes.every(function (regex) { return !regex.test(line); }); })\n .join('\\r\\n');\n // Reconstruct the m= section without the RTX payload types.\n return setPayloadTypesInMediaSection(Array.from(pts), mediaSection);\n })).join('\\r\\n');\n}\n/**\n * Generate an a=fmtp: line from the given payload type and attributes.\n * @param {PT} pt\n * @param {*} fmtpAttrs\n * @returns {string}\n */\nfunction generateFmtpLineFromPtAndAttributes(pt, fmtpAttrs) {\n var serializedFmtpAttrs = Object.entries(fmtpAttrs).map(function (_a) {\n var _b = __read(_a, 2), name = _b[0], value = _b[1];\n return name + \"=\" + value;\n }).join(';');\n return \"a=fmtp:\" + pt + \" \" + serializedFmtpAttrs;\n}\n/**\n * Enable DTX for opus in the m= sections for the given MIDs.`\n * @param {string} sdp\n * @param {Array} [mids] - If not specified, enables opus DTX for all\n * audio m= lines.\n * @returns {string}\n */\nfunction enableDtxForOpus(sdp, mids) {\n var mediaSections = getMediaSections(sdp);\n var session = sdp.split('\\r\\nm=')[0];\n mids = mids || mediaSections\n .filter(function (section) { return /^m=audio/.test(section); })\n .map(getMidForMediaSection);\n return [session].concat(mediaSections.map(function (section) {\n // Do nothing if the m= section is not audio.\n if (!/^m=audio/.test(section)) {\n return section;\n }\n // Build a map codecs to payload types.\n var codecsToPts = createCodecMapForMediaSection(section);\n // Do nothing if a payload type for opus does not exist.\n var opusPt = codecsToPts.get('opus');\n if (!opusPt) {\n return section;\n }\n // If no fmtp attributes are found for opus, do nothing.\n var opusFmtpAttrs = getFmtpAttributesForPt(opusPt, section);\n if (!opusFmtpAttrs) {\n return section;\n }\n // Add usedtx=1 to the a=fmtp: line for opus.\n var origOpusFmtpLine = generateFmtpLineFromPtAndAttributes(opusPt, opusFmtpAttrs);\n var origOpusFmtpRegex = new RegExp(origOpusFmtpLine);\n // If the m= section's MID is in the list of MIDs, then enable dtx. Otherwise disable it.\n var mid = getMidForMediaSection(section);\n if (mids.includes(mid)) {\n opusFmtpAttrs.usedtx = 1;\n }\n else {\n delete opusFmtpAttrs.usedtx;\n }\n var opusFmtpLineWithDtx = generateFmtpLineFromPtAndAttributes(opusPt, opusFmtpAttrs);\n return section.replace(origOpusFmtpRegex, opusFmtpLineWithDtx);\n })).join('\\r\\n');\n}\nexports.addOrRewriteNewTrackIds = addOrRewriteNewTrackIds;\nexports.addOrRewriteTrackIds = addOrRewriteTrackIds;\nexports.createCodecMapForMediaSection = createCodecMapForMediaSection;\nexports.createPtToCodecName = createPtToCodecName;\nexports.disableRtx = disableRtx;\nexports.enableDtxForOpus = enableDtxForOpus;\nexports.filterLocalCodecs = filterLocalCodecs;\nexports.getMediaSections = getMediaSections;\nexports.removeSSRCAttributes = removeSSRCAttributes;\nexports.revertSimulcast = revertSimulcast;\nexports.setCodecPreferences = setCodecPreferences;\nexports.setSimulcast = setSimulcast;\n//# sourceMappingURL=index.js.map","'use strict';\nvar Filter = /** @class */ (function () {\n function Filter(options) {\n options = Object.assign({\n getKey: function defaultGetKey(a) { return a; },\n getValue: function defaultGetValue(a) { return a; },\n isLessThanOrEqualTo: function defaultIsLessThanOrEqualTo(a, b) { return a <= b; }\n }, options);\n Object.defineProperties(this, {\n _getKey: {\n value: options.getKey\n },\n _getValue: {\n value: options.getValue\n },\n _isLessThanOrEqualTo: {\n value: options.isLessThanOrEqualTo\n },\n _map: {\n value: new Map()\n }\n });\n }\n Filter.prototype.toMap = function () {\n return new Map(this._map);\n };\n Filter.prototype.updateAndFilter = function (entries) {\n return entries.filter(this.update, this);\n };\n Filter.prototype.update = function (entry) {\n var key = this._getKey(entry);\n var value = this._getValue(entry);\n if (this._map.has(key) &&\n this._isLessThanOrEqualTo(value, this._map.get(key))) {\n return false;\n }\n this._map.set(key, value);\n return true;\n };\n return Filter;\n}());\nmodule.exports = Filter;\n//# sourceMappingURL=filter.js.map","'use strict';\nvar Filter = require('../../util/filter');\n/**\n * An {@link IceBox} stores trickled ICE candidates. Candidates added to the\n * {@link IceBox} via {@link IceBox#update} are compared against previously\n * trickled candidates and only new candidates will be returned (assuming they\n * match the current ICE username fragment set by {@link IceBox#setUfrag}).\n * @property {?string} ufrag\n */\nvar IceBox = /** @class */ (function () {\n /**\n * Construct an {@link IceBox}.\n */\n function IceBox() {\n Object.defineProperties(this, {\n _filter: {\n value: new Filter({\n getKey: function getKey(iceState) {\n return iceState.ufrag;\n },\n isLessThanOrEqualTo: function isLessThanOrEqualTo(a, b) {\n return a.revision <= b.revision;\n }\n })\n },\n _ufrag: {\n writable: true,\n value: null\n },\n ufrag: {\n enumerable: true,\n get: function () {\n return this._ufrag;\n }\n }\n });\n }\n /**\n * Set the ICE username fragment on the {@link IceBox}. This method returns any\n * ICE candidates associated with the username fragment.\n * @param {string} ufrag\n * @returns {Array}\n */\n IceBox.prototype.setUfrag = function (ufrag) {\n this._ufrag = ufrag;\n var ice = this._filter.toMap().get(ufrag);\n return ice ? ice.candidates : [];\n };\n /**\n * Update the {@link IceBox}. This method returns any new ICE candidates\n * associated with the current username fragment.\n * @param {object} iceState\n * @returns {Array}\n */\n IceBox.prototype.update = function (iceState) {\n // NOTE(mroberts): The Server sometimes does not set the candidates property.\n iceState.candidates = iceState.candidates || [];\n var oldIceState = this._filter.toMap().get(iceState.ufrag);\n var oldCandidates = oldIceState ? oldIceState.candidates : [];\n return this._filter.update(iceState) && this._ufrag === iceState.ufrag\n ? iceState.candidates.slice(oldCandidates.length)\n : [];\n };\n return IceBox;\n}());\nmodule.exports = IceBox;\n//# sourceMappingURL=icebox.js.map","'use strict';\nvar _a = require('../../util/constants'), ICE_ACTIVITY_CHECK_PERIOD_MS = _a.ICE_ACTIVITY_CHECK_PERIOD_MS, ICE_INACTIVITY_THRESHOLD_MS = _a.ICE_INACTIVITY_THRESHOLD_MS;\n/**\n * Monitors a {@link RTCPeerConnection}'s stats and notifies\n * caller when inactivity is detected.\n */\nvar IceConnectionMonitor = /** @class */ (function () {\n /**\n * Construct an {@link IceConnectionMonitor}.\n * @param {RTCPeerConnection} peerConnection\n * @param {object} [options]\n */\n function IceConnectionMonitor(peerConnection, options) {\n options = Object.assign({\n activityCheckPeriodMs: ICE_ACTIVITY_CHECK_PERIOD_MS,\n inactivityThresholdMs: ICE_INACTIVITY_THRESHOLD_MS,\n }, options);\n Object.defineProperties(this, {\n _activityCheckPeriodMs: {\n value: options.activityCheckPeriodMs\n },\n _inactivityThresholdMs: {\n value: options.inactivityThresholdMs\n },\n _lastActivity: {\n value: null,\n writable: true\n },\n _peerConnection: {\n value: peerConnection\n },\n _timer: {\n value: null,\n writable: true,\n },\n _onIceConnectionStateChanged: {\n value: null,\n writable: true\n }\n });\n }\n IceConnectionMonitor.prototype._getActivePairStat = function (stats) {\n var statsArray = Array.from(stats.values());\n var activePairStats = statsArray.find(function (stat) { return stat.type === 'candidate-pair' && stat.nominated; });\n // NOTE(mpatwardhan): sometimes (JSDK-2667) after getting disconnected while switching network\n // we may not find active pair. Treat this as 0 bytesReceived so that we count it towards inactivity.\n return activePairStats || {\n bytesReceived: 0,\n timestamp: Math.round((new Date()).getTime())\n };\n };\n /**\n * Get ICE connection stats, and extract received and send bytes.\n * @returns Promise\n */\n IceConnectionMonitor.prototype._getIceConnectionStats = function () {\n var _this = this;\n return this._peerConnection.getStats().then(function (stats) { return _this._getActivePairStat(stats); }).catch(function () {\n return null;\n });\n };\n /**\n * schedules/un-schedules inactivity callback.\n */\n IceConnectionMonitor.prototype._scheduleInactivityCallback = function (callback) {\n var _this = this;\n if (callback && this._onIceConnectionStateChanged === null) {\n // schedule callback\n this._onIceConnectionStateChanged = function () {\n if (_this._peerConnection.iceConnectionState === 'disconnected') {\n // eslint-disable-next-line callback-return\n callback();\n }\n };\n this._peerConnection.addEventListener('iceconnectionstatechange', this._onIceConnectionStateChanged);\n }\n else if (!callback && this._onIceConnectionStateChanged) {\n // unschedule callback\n this._peerConnection.removeEventListener('iceconnectionstatechange', this._onIceConnectionStateChanged);\n this._onIceConnectionStateChanged = null;\n }\n };\n /**\n * Start monitoring the ICE connection.\n * Monitors bytes received on active ice connection pair,\n * invokes onIceConnectionInactive when inactivity is detected.\n * @param {function} onIceConnectionInactive\n */\n IceConnectionMonitor.prototype.start = function (onIceConnectionInactive) {\n var _this = this;\n this.stop();\n this._timer = setInterval(function () {\n _this._getIceConnectionStats().then(function (iceStats) {\n if (!iceStats) {\n return;\n }\n // NOTE(mpatwardhan): We look at bytesReceived on active candidate pair as an indication of active ice connection.\n // As per spec (https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-bytesreceived) this value\n // includes RTCP traffic and is +ve even when there are no tracks subscribed to.\n if (!_this._lastActivity || _this._lastActivity.bytesReceived !== iceStats.bytesReceived) {\n _this._lastActivity = iceStats;\n // detected activity, cancel scheduled callback if any.\n _this._scheduleInactivityCallback(null);\n }\n if (iceStats.timestamp - _this._lastActivity.timestamp >= _this._inactivityThresholdMs) {\n // detected inactivity.\n if (_this._peerConnection.iceConnectionState === 'disconnected') {\n onIceConnectionInactive();\n }\n else if (_this._onIceConnectionStateChanged === null) {\n _this._scheduleInactivityCallback(onIceConnectionInactive);\n }\n }\n });\n }, this._activityCheckPeriodMs);\n };\n /**\n * Stop monitoring the ICE connection state.\n * @returns {void}\n */\n IceConnectionMonitor.prototype.stop = function () {\n this._scheduleInactivityCallback(null);\n if (this._timer !== null) {\n clearInterval(this._timer);\n this._timer = null;\n this._lastActivity = null;\n }\n };\n return IceConnectionMonitor;\n}());\nmodule.exports = IceConnectionMonitor;\n//# sourceMappingURL=iceconnectionmonitor.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar EventEmitter = require('events').EventEmitter;\n/**\n * @classdesc A {@link DataTransport} implements {@link MediaSignalingTransport}\n * in terms of an RTCDataChannel.\n * @extends EventEmitter\n * @implements MediaSignalingTransport\n * @emits DataTransport#message\n */\nvar DataTransport = /** @class */ (function (_super) {\n __extends(DataTransport, _super);\n /**\n * Construct a {@link DataTransport}.\n * @param {RTCDataChannel} dataChannel\n */\n function DataTransport(dataChannel) {\n var _this = _super.call(this) || this;\n Object.defineProperties(_this, {\n _dataChannel: {\n value: dataChannel\n },\n _messageQueue: {\n value: []\n }\n });\n dataChannel.addEventListener('open', function () {\n _this._messageQueue.splice(0).forEach(function (message) { return _this._publish(message); });\n });\n dataChannel.addEventListener('message', function (_a) {\n var data = _a.data;\n try {\n var message = JSON.parse(data);\n _this.emit('message', message);\n }\n catch (error) {\n // Do nothing.\n }\n });\n _this.publish({ type: 'ready' });\n return _this;\n }\n /**\n * @param message\n * @private\n */\n DataTransport.prototype._publish = function (message) {\n var data = JSON.stringify(message);\n try {\n this._dataChannel.send(data);\n }\n catch (error) {\n // Do nothing.\n }\n };\n /**\n * Publish a message. Returns true if calling the method resulted in\n * publishing (or eventually publishing) the update.\n * @param {object} message\n * @returns {boolean}\n */\n DataTransport.prototype.publish = function (message) {\n var dataChannel = this._dataChannel;\n if (dataChannel.readyState === 'closing' || dataChannel.readyState === 'closed') {\n return false;\n }\n if (dataChannel.readyState === 'connecting') {\n this._messageQueue.push(message);\n return true;\n }\n this._publish(message);\n return true;\n };\n return DataTransport;\n}(EventEmitter));\n/**\n * The {@link DataTransport} received a message.\n * @event DataTransport#message\n * @param {object} message\n */\nmodule.exports = DataTransport;\n//# sourceMappingURL=transport.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar DataTrackTransceiver = require('./transceiver');\nvar DataTransport = require('./transport');\n/**\n * A {@link DataTrackReceiver} represents a {@link DataTrackTransceiver} over\n * which data can be received. Internally, it users a single RTCDataChannel to\n * receive data.\n * @extends DataTrackTransceiver\n * @emits DataTrackReceiver#message\n * @emits DataTrackReceiver#close\n */\nvar DataTrackReceiver = /** @class */ (function (_super) {\n __extends(DataTrackReceiver, _super);\n /**\n * Construct an {@link DataTrackReceiver}.\n * @param {RTCDataChannel} dataChannel\n */\n function DataTrackReceiver(dataChannel) {\n var _this = _super.call(this, dataChannel.label, dataChannel.maxPacketLifeTime, dataChannel.maxRetransmits, dataChannel.ordered) || this;\n Object.defineProperties(_this, {\n _dataChannel: {\n value: dataChannel\n }\n });\n // NOTE(mmalavalli): In Firefox, the default value for \"binaryType\" is \"blob\".\n // So, we set it to \"arraybuffer\" to ensure that it is consistent with Chrome\n // and Safari.\n dataChannel.binaryType = 'arraybuffer';\n dataChannel.addEventListener('message', function (event) {\n _this.emit('message', event.data);\n });\n dataChannel.addEventListener('close', function () {\n _this.emit('close');\n });\n return _this;\n }\n DataTrackReceiver.prototype.stop = function () {\n this._dataChannel.close();\n _super.prototype.stop.call(this);\n };\n /**\n * Create a {@link DataTransport} from the {@link DataTrackReceiver}.\n * @returns {DataTransport}\n */\n DataTrackReceiver.prototype.toDataTransport = function () {\n return new DataTransport(this._dataChannel);\n };\n return DataTrackReceiver;\n}(DataTrackTransceiver));\n/**\n * @event DataTrackReceiver#message\n * @param {string|ArrayBuffer} data\n */\n/**\n * @event DataTrackReceiver#close\n */\nmodule.exports = DataTrackReceiver;\n//# sourceMappingURL=receiver.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar MediaTrackTransceiver = require('./transceiver');\n/**\n * A {@link MediaTrackReceiver} represents a remote MediaStreamTrack.\n * @extends MediaTrackTransceiver\n */\nvar MediaTrackReceiver = /** @class */ (function (_super) {\n __extends(MediaTrackReceiver, _super);\n /**\n * Construct a {@link MediaTrackReceiver}.\n * @param {Track.ID} id - The MediaStreamTrack ID signaled through RSP/SDP\n * @param {MediaStreamTrack} mediaStreamTrack - The remote MediaStreamTrack\n */\n function MediaTrackReceiver(id, mediaStreamTrack) {\n return _super.call(this, id, mediaStreamTrack) || this;\n }\n return MediaTrackReceiver;\n}(MediaTrackTransceiver));\nmodule.exports = MediaTrackReceiver;\n//# sourceMappingURL=receiver.js.map","'use strict';\nvar getMediaSections = require('./').getMediaSections;\n/**\n * An {@link TrackMatcher} matches an RTCTrackEvent with a MediaStreamTrack\n * ID based on the MID of the underlying RTCRtpTransceiver.\n */\nvar TrackMatcher = /** @class */ (function () {\n /**\n * Construct an {@link TrackMatcher}.\n */\n function TrackMatcher() {\n Object.defineProperties(this, {\n _midsToTrackIds: {\n value: new Map(),\n writable: true\n }\n });\n }\n /**\n * Match a given MediaStreamTrack with its ID.\n * @param {RTCTrackEvent} event\n * @returns {?Track.ID}\n */\n TrackMatcher.prototype.match = function (event) {\n return this._midsToTrackIds.get(event.transceiver.mid) || null;\n };\n /**\n * Update the {@link TrackMatcher} with a new SDP.\n * @param {string} sdp\n */\n TrackMatcher.prototype.update = function (sdp) {\n var sections = getMediaSections(sdp, '(audio|video)');\n this._midsToTrackIds = sections.reduce(function (midsToTrackIds, section) {\n var midMatches = section.match(/^a=mid:(.+)$/m) || [];\n var trackIdMatches = section.match(/^a=msid:.+ (.+)$/m) || [];\n var mid = midMatches[1];\n var trackId = trackIdMatches[1];\n return mid && trackId ? midsToTrackIds.set(mid, trackId) : midsToTrackIds;\n }, this._midsToTrackIds);\n };\n return TrackMatcher;\n}());\nmodule.exports = TrackMatcher;\n//# sourceMappingURL=trackmatcher.js.map","'use strict';\nvar RTCSessionDescription = require('../../webrtc').RTCSessionDescription;\nvar _a = require('./'), createPtToCodecName = _a.createPtToCodecName, getMediaSections = _a.getMediaSections;\n/**\n * An RTX payload type\n * @typedef {PT} RtxPT\n */\n/**\n * A non-RTX payload type\n * @typedef {PT} NonRtxPT\n */\n/**\n * A Set with at least one element\n * @typedef {Set} NonEmptySet\n */\n/**\n * Apply the workaround for Issue 8329 to an RTCSessionDescriptionInit.\n * @param {RTCSessionDescriptionInit} description\n * @returns {RTCSessionDescription} newDescription\n */\nfunction workaround(description) {\n var descriptionInit = { type: description.type };\n if (description.type !== 'rollback') {\n descriptionInit.sdp = sdpWorkaround(description.sdp);\n }\n return new RTCSessionDescription(descriptionInit);\n}\n/**\n * @param {string} sdp\n * @returns {string} newSdp\n */\nfunction sdpWorkaround(sdp) {\n var mediaSections = getMediaSections(sdp);\n var session = sdp.split('\\r\\nm=')[0];\n return [session]\n .concat(mediaSections.map(mediaSectionWorkaround))\n .join('\\r\\n');\n}\n/**\n * @param {string} mediaSection\n * @returns {string} newMediaSection\n */\nfunction mediaSectionWorkaround(mediaSection) {\n var ptToCodecName = createPtToCodecName(mediaSection);\n mediaSection = deleteDuplicateRtxPts(mediaSection, ptToCodecName);\n var codecNameToPts = createCodecNameToPts(ptToCodecName);\n var rtxPts = codecNameToPts.get('rtx') || new Set();\n var invalidRtxPts = new Set();\n var rtxPtToAssociatedPt = createRtxPtToAssociatedPt(mediaSection, ptToCodecName, rtxPts, invalidRtxPts);\n var associatedPtToRtxPt = createAssociatedPtToRtxPt(rtxPtToAssociatedPt, invalidRtxPts);\n var unassociatedRtxPts = Array.from(invalidRtxPts);\n // NOTE(mroberts): We normalize to lowercase.\n var knownCodecNames = ['h264', 'vp8', 'vp9'];\n var unassociatedPts = knownCodecNames.reduce(function (unassociatedPts, codecName) {\n var pts = codecNameToPts.get(codecName) || new Set();\n return Array.from(pts).reduce(function (unassociatedPts, pt) { return associatedPtToRtxPt.has(pt)\n ? unassociatedPts\n : unassociatedPts.add(pt); }, unassociatedPts);\n }, new Set());\n unassociatedPts.forEach(function (pt) {\n if (unassociatedRtxPts.length) {\n var rtxPt = unassociatedRtxPts.shift();\n mediaSection = deleteFmtpAttributesForRtxPt(mediaSection, rtxPt);\n mediaSection = addFmtpAttributeForRtxPt(mediaSection, rtxPt, pt);\n }\n });\n unassociatedRtxPts.forEach(function (rtxPt) {\n mediaSection = deleteFmtpAttributesForRtxPt(mediaSection, rtxPt);\n mediaSection = deleteRtpmapAttributesForRtxPt(mediaSection, rtxPt);\n });\n return mediaSection;\n}\n/**\n * @param {string} mediaSection\n * @param {Map} ptToCodecName\n * @returns {string} newMediaSection\n */\nfunction deleteDuplicateRtxPts(mediaSection, ptToCodecName) {\n // NOTE(syerrapragada): In some cases Chrome produces an offer/answer\n // with duplicate \"rtx\" payload mapping in media section. When applied,\n // Chrome rejects the SDP. We workaround this by deleting duplicate\n // \"rtx\" mappings found in SDP.\n return Array.from(ptToCodecName.keys()).reduce(function (section, pt) {\n var rtpmapRegex = new RegExp(\"^a=rtpmap:\" + pt + \" rtx.+$\", 'gm');\n return (section.match(rtpmapRegex) || []).slice(ptToCodecName.get(pt) === 'rtx' ? 1 : 0).reduce(function (section, rtpmap) {\n var rtpmapRegex = new RegExp(\"\\r\\n\" + rtpmap);\n var fmtpmapRegex = new RegExp(\"\\r\\na=fmtp:\" + pt + \" apt=[0-9]+\");\n return section.replace(rtpmapRegex, '').replace(fmtpmapRegex, '');\n }, section);\n }, mediaSection);\n}\n/**\n * @param {Map} ptToCodecName\n * @returns {Map>} codecNameToPts\n */\nfunction createCodecNameToPts(ptToCodecName) {\n var codecNameToPts = new Map();\n ptToCodecName.forEach(function (codecName, pt) {\n var pts = codecNameToPts.get(codecName) || new Set();\n return codecNameToPts.set(codecName, pts.add(pt));\n });\n return codecNameToPts;\n}\n/**\n * @param {string} mediaSection\n * @param {Map} ptToCodecName\n * @param {Set} rtxPts\n * @param {Set} invalidRtxPts\n * @returns {Map} rtxPtToAssociatedPt\n */\nfunction createRtxPtToAssociatedPt(mediaSection, ptToCodecName, rtxPts, invalidRtxPts) {\n return Array.from(rtxPts).reduce(function (rtxPtToAssociatedPt, rtxPt) {\n var fmtpPattern = new RegExp(\"a=fmtp:\" + rtxPt + \" apt=(\\\\d+)\");\n var matches = mediaSection.match(fmtpPattern);\n if (!matches) {\n invalidRtxPts.add(rtxPt);\n return rtxPtToAssociatedPt;\n }\n var pt = Number.parseInt(matches[1]);\n if (!ptToCodecName.has(pt)) {\n // This is Issue 8329.\n invalidRtxPts.add(rtxPt);\n return rtxPtToAssociatedPt;\n }\n var codecName = ptToCodecName.get(pt);\n if (codecName === 'rtx') {\n // Strange\n invalidRtxPts.add(rtxPt);\n return rtxPtToAssociatedPt;\n }\n return rtxPtToAssociatedPt.set(rtxPt, pt);\n }, new Map());\n}\n/**\n * @param {string} mediaSection\n * @param {Map} rtxPtToAssociatedPt\n * @param {Set} invalidRtxPts\n * @returns {Map} associatedPtToRtxPt\n */\nfunction createAssociatedPtToRtxPt(rtxPtToAssociatedPt, invalidRtxPts) {\n // First, we construct a Map>.\n var associatedPtToRtxPts = Array.from(rtxPtToAssociatedPt).reduce(function (associatedPtToRtxPts, pair) {\n var rtxPt = pair[0];\n var pt = pair[1];\n var rtxPts = associatedPtToRtxPts.get(pt) || new Set();\n return associatedPtToRtxPts.set(pt, rtxPts.add(rtxPt));\n }, new Map());\n // Then, we filter down to a Map. Any RtxPTs that map to the\n // same NonRtxPT are removed and added to invalidRtxPts.\n return Array.from(associatedPtToRtxPts).reduce(function (associatedPtToRtxPt, pair) {\n var pt = pair[0];\n var rtxPts = Array.from(pair[1]);\n if (rtxPts.length > 1) {\n rtxPts.forEach(function (rtxPt) {\n invalidRtxPts.add(rtxPt);\n });\n return associatedPtToRtxPt;\n }\n return associatedPtToRtxPt.set(pt, rtxPts[0]);\n }, new Map());\n}\n/**\n * @param {string} mediaSection\n * @param {RtxPT} rtxPt\n * @returns {string} newMediaSection\n */\nfunction deleteFmtpAttributesForRtxPt(mediaSection, rtxPt) {\n var pattern = new RegExp(\"a=fmtp:\" + rtxPt + \".*\\r\\n\", 'gm');\n return mediaSection.replace(pattern, '');\n}\n/**\n * @param {string} mediaSection\n * @param {RtxPT} rtxPt\n * @returns {string} newMediaSection\n */\nfunction deleteRtpmapAttributesForRtxPt(mediaSection, rtxPt) {\n var pattern = new RegExp(\"a=rtpmap:\" + rtxPt + \".*\\r\\n\", 'gm');\n return mediaSection.replace(pattern, '');\n}\n/**\n * @param {string} mediaSection\n * @param {RtxPT} rtxPt\n * @param {NonRtxPT} pt\n * @returns {string} newMediaSection\n */\nfunction addFmtpAttributeForRtxPt(mediaSection, rtxPt, pt) {\n return mediaSection.endsWith('\\r\\n')\n ? mediaSection + \"a=fmtp:\" + rtxPt + \" apt=\" + pt + \"\\r\\n\"\n : mediaSection + \"\\r\\na=fmtp:\" + rtxPt + \" apt=\" + pt;\n}\nmodule.exports = workaround;\n//# sourceMappingURL=issue8329.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar DefaultBackoff = require('../../util/backoff');\nvar _a = require('../../webrtc'), DefaultRTCIceCandidate = _a.RTCIceCandidate, DefaultRTCPeerConnection = _a.RTCPeerConnection, DefaultRTCSessionDescription = _a.RTCSessionDescription, getStatistics = _a.getStats;\nvar util = require('../../webrtc/util');\nvar _b = require('../../util/constants'), DEFAULT_ICE_GATHERING_TIMEOUT_MS = _b.DEFAULT_ICE_GATHERING_TIMEOUT_MS, DEFAULT_LOG_LEVEL = _b.DEFAULT_LOG_LEVEL, DEFAULT_SESSION_TIMEOUT_SEC = _b.DEFAULT_SESSION_TIMEOUT_SEC, iceRestartBackoffConfig = _b.iceRestartBackoffConfig;\nvar _c = require('../../util/sdp'), addOrRewriteNewTrackIds = _c.addOrRewriteNewTrackIds, addOrRewriteTrackIds = _c.addOrRewriteTrackIds, createCodecMapForMediaSection = _c.createCodecMapForMediaSection, disableRtx = _c.disableRtx, enableDtxForOpus = _c.enableDtxForOpus, filterLocalCodecs = _c.filterLocalCodecs, getMediaSections = _c.getMediaSections, removeSSRCAttributes = _c.removeSSRCAttributes, revertSimulcast = _c.revertSimulcast, setCodecPreferences = _c.setCodecPreferences, setSimulcast = _c.setSimulcast;\nvar DefaultTimeout = require('../../util/timeout');\nvar _d = require('../../util/twilio-video-errors'), MediaClientLocalDescFailedError = _d.MediaClientLocalDescFailedError, MediaClientRemoteDescFailedError = _d.MediaClientRemoteDescFailedError;\nvar _e = require('../../util'), buildLogLevels = _e.buildLogLevels, getPlatform = _e.getPlatform, isChromeScreenShareTrack = _e.isChromeScreenShareTrack, oncePerTick = _e.oncePerTick, defer = _e.defer;\nvar IceBox = require('./icebox');\nvar DefaultIceConnectionMonitor = require('./iceconnectionmonitor.js');\nvar DataTrackReceiver = require('../../data/receiver');\nvar MediaTrackReceiver = require('../../media/track/receiver');\nvar StateMachine = require('../../statemachine');\nvar Log = require('../../util/log');\nvar TrackMatcher = require('../../util/sdp/trackmatcher');\nvar workaroundIssue8329 = require('../../util/sdp/issue8329');\nvar guess = util.guessBrowser();\nvar platform = getPlatform();\nvar isAndroid = /android/.test(platform);\nvar isChrome = guess === 'chrome';\nvar isFirefox = guess === 'firefox';\nvar isSafari = guess === 'safari';\nvar nInstances = 0;\n/*\nPeerConnectionV2 States\n-----------------------\n\n +------+ +--------+\n | | | |\n | open |--->| closed |\n | | | |\n +------+ +--------+\n | ^ ^\n | | |\n | | |\n v | |\n +----------+ |\n | | |\n | updating |------+\n | |\n +----------+\n\n*/\nvar states = {\n open: [\n 'closed',\n 'updating'\n ],\n updating: [\n 'closed',\n 'open'\n ],\n closed: []\n};\n/**\n * @extends StateMachine\n * @property {id}\n * @emits PeerConnectionV2#connectionStateChanged\n * @emits PeerConnectionV2#iceConnectionStateChanged\n * @emits PeerConnectionV2#candidates\n * @emits PeerConnectionV2#description\n */\nvar PeerConnectionV2 = /** @class */ (function (_super) {\n __extends(PeerConnectionV2, _super);\n /**\n * Construct a {@link PeerConnectionV2}.\n * @param {string} id\n * @param {EncodingParametersImpl} encodingParameters\n * @param {PreferredCodecs} preferredCodecs\n * @param {object} [options]\n */\n function PeerConnectionV2(id, encodingParameters, preferredCodecs, options) {\n var _this = _super.call(this, 'open', states) || this;\n options = Object.assign({\n enableDscp: false,\n dummyAudioMediaStreamTrack: null,\n isChromeScreenShareTrack: isChromeScreenShareTrack,\n iceServers: [],\n logLevel: DEFAULT_LOG_LEVEL,\n offerOptions: {},\n revertSimulcast: revertSimulcast,\n sessionTimeout: DEFAULT_SESSION_TIMEOUT_SEC * 1000,\n setCodecPreferences: setCodecPreferences,\n setSimulcast: setSimulcast,\n Backoff: DefaultBackoff,\n IceConnectionMonitor: DefaultIceConnectionMonitor,\n RTCIceCandidate: DefaultRTCIceCandidate,\n RTCPeerConnection: DefaultRTCPeerConnection,\n RTCSessionDescription: DefaultRTCSessionDescription,\n Timeout: DefaultTimeout\n }, options);\n var configuration = getConfiguration(options);\n var logLevels = buildLogLevels(options.logLevel);\n var RTCPeerConnection = options.RTCPeerConnection;\n if (options.enableDscp === true) {\n options.chromeSpecificConstraints = options.chromeSpecificConstraints || {};\n options.chromeSpecificConstraints.optional = options.chromeSpecificConstraints.optional || [];\n options.chromeSpecificConstraints.optional.push({ googDscp: true });\n }\n var log = options.log ? options.log.createLog('webrtc', _this) : new Log('webrtc', _this, logLevels, options.loggerName);\n var peerConnection = new RTCPeerConnection(configuration, options.chromeSpecificConstraints);\n if (options.dummyAudioMediaStreamTrack) {\n peerConnection.addTrack(options.dummyAudioMediaStreamTrack);\n }\n Object.defineProperties(_this, {\n _appliedTrackIdsToAttributes: {\n value: new Map(),\n writable: true\n },\n _dataChannels: {\n value: new Map()\n },\n _dataTrackReceivers: {\n value: new Set()\n },\n _descriptionRevision: {\n writable: true,\n value: 0\n },\n _didGenerateLocalCandidates: {\n writable: true,\n value: false\n },\n _enableDscp: {\n value: options.enableDscp\n },\n _encodingParameters: {\n value: encodingParameters\n },\n _isChromeScreenShareTrack: {\n value: options.isChromeScreenShareTrack,\n },\n _iceGatheringFailed: {\n value: false,\n writable: true\n },\n _iceGatheringTimeout: {\n value: new options.Timeout(function () { return _this._handleIceGatheringTimeout(); }, DEFAULT_ICE_GATHERING_TIMEOUT_MS, false)\n },\n _iceRestartBackoff: {\n // eslint-disable-next-line new-cap\n value: new options.Backoff(iceRestartBackoffConfig)\n },\n _instanceId: {\n value: ++nInstances\n },\n _isIceConnectionInactive: {\n writable: true,\n value: false\n },\n _isIceLite: {\n writable: true,\n value: false\n },\n _isIceRestartBackoffInProgress: {\n writable: true,\n value: false\n },\n _isRestartingIce: {\n writable: true,\n value: false\n },\n _lastIceConnectionState: {\n writable: true,\n value: null\n },\n _lastStableDescriptionRevision: {\n writable: true,\n value: 0\n },\n _localCandidates: {\n writable: true,\n value: []\n },\n _localCodecs: {\n value: new Set()\n },\n _localCandidatesRevision: {\n writable: true,\n value: 1\n },\n _localDescriptionWithoutSimulcast: {\n writable: true,\n value: null\n },\n _localDescription: {\n writable: true,\n value: null\n },\n _localUfrag: {\n writable: true,\n value: null\n },\n _log: {\n value: log\n },\n _eventObserver: {\n value: options.eventObserver\n },\n _remoteCodecMaps: {\n value: new Map()\n },\n _rtpSenders: {\n value: new Map()\n },\n _rtpNewSenders: {\n value: new Set()\n },\n _iceConnectionMonitor: {\n value: new options.IceConnectionMonitor(peerConnection)\n },\n _mediaTrackReceivers: {\n value: new Set()\n },\n _needsAnswer: {\n writable: true,\n value: false\n },\n _negotiationRole: {\n writable: true,\n value: null\n },\n _offerOptions: {\n writable: true,\n value: options.offerOptions\n },\n _onEncodingParametersChanged: {\n value: oncePerTick(function () {\n if (!_this._needsAnswer) {\n updateEncodingParameters(_this);\n }\n })\n },\n _peerConnection: {\n value: peerConnection\n },\n _preferredAudioCodecs: {\n value: preferredCodecs.audio\n },\n _preferredVideoCodecs: {\n value: preferredCodecs.video\n },\n _shouldApplyDtx: {\n value: preferredCodecs.audio.every(function (_a) {\n var codec = _a.codec;\n return codec !== 'opus';\n })\n || preferredCodecs.audio.some(function (_a) {\n var codec = _a.codec, dtx = _a.dtx;\n return codec === 'opus' && dtx;\n })\n },\n _queuedDescription: {\n writable: true,\n value: null\n },\n _iceReconnectTimeout: {\n value: new options.Timeout(function () {\n log.debug('ICE reconnect timed out');\n _this.close();\n }, options.sessionTimeout, false)\n },\n _recycledTransceivers: {\n value: {\n audio: [],\n video: []\n }\n },\n _replaceTrackPromises: {\n value: new Map()\n },\n _remoteCandidates: {\n writable: true,\n value: new IceBox()\n },\n _setCodecPreferences: {\n // NOTE(mmalavalli): Re-ordering payload types in order to make sure a non-H264\n // preferred codec is selected does not work on Android Firefox due to this behavior:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1683258. So, we work around this by\n // not applying any non-H264 preferred video codec.\n value: isFirefox && isAndroid && preferredCodecs.video[0] && preferredCodecs.video[0].codec.toLowerCase() !== 'h264'\n ? function (sdp) { return sdp; }\n : options.setCodecPreferences\n },\n _setSimulcast: {\n value: options.setSimulcast\n },\n _revertSimulcast: {\n value: options.revertSimulcast\n },\n _RTCIceCandidate: {\n value: options.RTCIceCandidate\n },\n _RTCPeerConnection: {\n value: options.RTCPeerConnection\n },\n _RTCSessionDescription: {\n value: options.RTCSessionDescription\n },\n _shouldOffer: {\n writable: true,\n value: false\n },\n _shouldRestartIce: {\n writable: true,\n value: false\n },\n _trackIdsToAttributes: {\n value: new Map(),\n writable: true\n },\n _trackMatcher: {\n writable: true,\n value: null\n },\n _mediaTrackSenderToPublisherHints: {\n value: new Map()\n },\n id: {\n enumerable: true,\n value: id\n }\n });\n encodingParameters.on('changed', _this._onEncodingParametersChanged);\n peerConnection.addEventListener('connectionstatechange', _this._handleConnectionStateChange.bind(_this));\n peerConnection.addEventListener('datachannel', _this._handleDataChannelEvent.bind(_this));\n peerConnection.addEventListener('icecandidate', _this._handleIceCandidateEvent.bind(_this));\n peerConnection.addEventListener('iceconnectionstatechange', _this._handleIceConnectionStateChange.bind(_this));\n peerConnection.addEventListener('icegatheringstatechange', _this._handleIceGatheringStateChange.bind(_this));\n peerConnection.addEventListener('signalingstatechange', _this._handleSignalingStateChange.bind(_this));\n peerConnection.addEventListener('track', _this._handleTrackEvent.bind(_this));\n var self = _this;\n _this.on('stateChanged', function stateChanged(state) {\n if (state !== 'closed') {\n return;\n }\n self.removeListener('stateChanged', stateChanged);\n self._dataChannels.forEach(function (dataChannel, dataTrackSender) {\n self.removeDataTrackSender(dataTrackSender);\n });\n });\n return _this;\n }\n PeerConnectionV2.prototype.toString = function () {\n return \"[PeerConnectionV2 #\" + this._instanceId + \": \" + this.id + \"]\";\n };\n PeerConnectionV2.prototype.setEffectiveAdaptiveSimulcast = function (effectiveAdaptiveSimulcast) {\n this._log.debug('Setting setEffectiveAdaptiveSimulcast: ', effectiveAdaptiveSimulcast);\n // clear adaptive simulcast from codec preferences if it was set.\n this._preferredVideoCodecs.forEach(function (cs) {\n if ('adaptiveSimulcast' in cs) {\n cs.adaptiveSimulcast = effectiveAdaptiveSimulcast;\n }\n });\n };\n Object.defineProperty(PeerConnectionV2.prototype, \"_shouldApplySimulcast\", {\n get: function () {\n if (!isChrome && !isSafari) {\n return false;\n }\n // adaptiveSimulcast is set to false after connected message is received if other party does not support it.\n var simulcast = this._preferredVideoCodecs.some(function (cs) {\n return cs.codec.toLowerCase() === 'vp8' && cs.simulcast && cs.adaptiveSimulcast !== false;\n });\n return simulcast;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(PeerConnectionV2.prototype, \"connectionState\", {\n /**\n * The {@link PeerConnectionV2}'s underlying RTCPeerConnection's RTCPeerConnectionState\n * if supported by the browser, its RTCIceConnectionState otherwise.\n * @property {RTCPeerConnectionState}\n */\n get: function () {\n return this.iceConnectionState === 'failed'\n ? 'failed' : (this._peerConnection.connectionState || this.iceConnectionState);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(PeerConnectionV2.prototype, \"iceConnectionState\", {\n /**\n * The {@link PeerConnectionV2}'s underlying RTCPeerConnection's\n * RTCIceConnectionState.\n * @property {RTCIceConnectionState}\n */\n get: function () {\n return ((this._isIceConnectionInactive && this._peerConnection.iceConnectionState === 'disconnected') || this._iceGatheringFailed)\n ? 'failed' : this._peerConnection.iceConnectionState;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(PeerConnectionV2.prototype, \"isApplicationSectionNegotiated\", {\n /**\n * Whether the {@link PeerConnectionV2} has negotiated or is in the process\n * of negotiating the application m= section.\n * @returns {boolean}\n */\n get: function () {\n if (this._peerConnection.signalingState !== 'closed') {\n // accessing .localDescription in 'closed' state causes it throw exceptions.\n return this._peerConnection.localDescription\n ? getMediaSections(this._peerConnection.localDescription.sdp, 'application').length > 0\n : false;\n }\n return true;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(PeerConnectionV2.prototype, \"_isAdaptiveSimulcastEnabled\", {\n /**\n * Whether adaptive simulcast is enabled.\n * @returns {boolean}\n */\n get: function () {\n var adaptiveSimulcastEntry = this._preferredVideoCodecs.find(function (cs) { return 'adaptiveSimulcast' in cs; });\n return adaptiveSimulcastEntry && adaptiveSimulcastEntry.adaptiveSimulcast === true;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * @param {MediaStreamTrack} track\n * @param {Array} encodings\n * @param {boolean} trackReplaced\n * @returns {boolean} true if encodings were updated.\n */\n PeerConnectionV2.prototype._maybeUpdateEncodings = function (track, encodings, trackReplaced) {\n if (trackReplaced === void 0) { trackReplaced = false; }\n if (track.kind !== 'video' || track.readyState === 'ended') {\n return false;\n }\n // NOTE(mmalavalli): There is no guarantee that CanvasCaptureMediaStreamTracks will always have \"width\" and \"height\"\n // in their settings. So, we don't update the encodings if they are not present.\n // Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1367082\n var _a = track.getSettings(), height = _a.height, width = _a.width;\n if (typeof height !== 'number' || typeof width !== 'number') {\n return false;\n }\n // Note(mpatwardhan): always configure encodings for safari.\n // for chrome only when adaptive simulcast enabled.\n var browser = util.guessBrowser();\n if (browser === 'safari' || (browser === 'chrome' && this._isAdaptiveSimulcastEnabled)) {\n this._updateEncodings(track, encodings, trackReplaced);\n return true;\n }\n return false;\n };\n /**\n * Configures with default encodings depending on track type and resolution.\n * Default configuration sets some encodings to disabled, and for others set scaleResolutionDownBy\n * values. When trackReplaced is set to true, it will clear 'active' for any encodings that\n * needs to be enabled.\n * @param {MediaStreamTrack} track\n * @param {Array} encodings\n * @param {boolean} trackReplaced\n */\n PeerConnectionV2.prototype._updateEncodings = function (track, encodings, trackReplaced) {\n if (this._isChromeScreenShareTrack(track)) {\n var screenShareActiveLayerConfig_1 = [\n { scaleResolutionDownBy: 1 },\n { scaleResolutionDownBy: 1 }\n ];\n encodings.forEach(function (encoding, i) {\n var activeLayerConfig = screenShareActiveLayerConfig_1[i];\n if (activeLayerConfig) {\n encoding.scaleResolutionDownBy = activeLayerConfig.scaleResolutionDownBy;\n if (trackReplaced) {\n delete encoding.active;\n }\n }\n else {\n encoding.active = false;\n delete encoding.scaleResolutionDownBy;\n }\n });\n }\n else {\n var _a = track.getSettings(), width = _a.width, height = _a.height;\n // NOTE(mpatwardhan): for non-screen share tracks\n // enable layers depending on track resolutions\n var pixelsToMaxActiveLayers = [\n { pixels: 960 * 540, maxActiveLayers: 3 },\n { pixels: 480 * 270, maxActiveLayers: 2 },\n { pixels: 0, maxActiveLayers: 1 }\n ];\n var trackPixels_1 = width * height;\n var activeLayersInfo = pixelsToMaxActiveLayers.find(function (layer) { return trackPixels_1 >= layer.pixels; });\n var activeLayers_1 = Math.min(encodings.length, activeLayersInfo.maxActiveLayers);\n encodings.forEach(function (encoding, i) {\n var enabled = i < activeLayers_1;\n if (enabled) {\n encoding.scaleResolutionDownBy = 1 << (activeLayers_1 - i - 1);\n if (trackReplaced) {\n encoding.active = true;\n }\n }\n else {\n encoding.active = false;\n delete encoding.scaleResolutionDownBy;\n }\n });\n }\n this._log.debug('_updateEncodings:', encodings.map(function (_a, i) {\n var active = _a.active, scaleResolutionDownBy = _a.scaleResolutionDownBy;\n return \"[\" + i + \": \" + active + \", \" + (scaleResolutionDownBy || 0) + \"]\";\n }).join(', '));\n };\n /**\n * Add an ICE candidate to the {@link PeerConnectionV2}.\n * @private\n * @param {object} candidate\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._addIceCandidate = function (candidate) {\n var _this = this;\n return Promise.resolve().then(function () {\n candidate = new _this._RTCIceCandidate(candidate);\n return _this._peerConnection.addIceCandidate(candidate);\n }).catch(function (error) {\n // NOTE(mmalavalli): Firefox 68+ now generates an RTCIceCandidate with an\n // empty candidate string to signal end-of-candidates, followed by a null\n // candidate. As of now, Chrome and Safari reject this RTCIceCandidate. Since\n // this does not affect the media connection between Firefox 68+ and Chrome/Safari\n // in Peer-to-Peer Rooms, we suppress the Error and log a warning message.\n //\n // Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=978582\n //\n _this._log.warn(\"Failed to add RTCIceCandidate \" + (candidate ? \"\\\"\" + candidate.candidate + \"\\\"\" : 'null') + \": \"\n + error.message);\n });\n };\n /**\n * Add ICE candidates to the {@link PeerConnectionV2}.\n * @private\n * @param {Array} candidates\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._addIceCandidates = function (candidates) {\n return Promise.all(candidates.map(this._addIceCandidate, this)).then(function () { });\n };\n /**\n * Add a new RTCRtpTransceiver or update an existing RTCRtpTransceiver for the\n * given MediaStreamTrack.\n * @private\n * @param {MediaStreamTrack} track\n * @returns {RTCRtpTransceiver}\n */\n PeerConnectionV2.prototype._addOrUpdateTransceiver = function (track) {\n var _this = this;\n var transceiver = takeRecycledTransceiver(this, track.kind);\n if (transceiver && transceiver.sender) {\n var oldTrackId = transceiver.sender.track ? transceiver.sender.track.id : null;\n if (oldTrackId) {\n this._log.warn(\"Reusing transceiver: \" + transceiver.mid + \"] \" + oldTrackId + \" => \" + track.id);\n }\n // NOTE(mpatwardhan):remember this transceiver while we replace track.\n // we recycle transceivers that are not in use after 'negotiationCompleted', but we want to prevent\n // this one from getting recycled while replaceTrack is pending.\n this._replaceTrackPromises.set(transceiver, transceiver.sender.replaceTrack(track).then(function () {\n transceiver.direction = 'sendrecv';\n }, function () {\n // Do nothing.\n }).finally(function () {\n _this._replaceTrackPromises.delete(transceiver);\n }));\n return transceiver;\n }\n return this._peerConnection.addTransceiver(track);\n };\n /**\n * Check the {@link IceBox}.\n * @private\n * @param {RTCSessionDescriptionInit} description\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._checkIceBox = function (description) {\n var ufrag = getUfrag(description);\n if (!ufrag) {\n return Promise.resolve();\n }\n var candidates = this._remoteCandidates.setUfrag(ufrag);\n return this._addIceCandidates(candidates);\n };\n /**\n * Create an answer and set it on the {@link PeerConnectionV2}.\n * @private\n * @param {RTCSessionDescriptionInit} offer\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._answer = function (offer) {\n var _this = this;\n return Promise.resolve().then(function () {\n if (!_this._negotiationRole) {\n _this._negotiationRole = 'answerer';\n }\n return _this._setRemoteDescription(offer);\n }).catch(function () {\n throw new MediaClientRemoteDescFailedError();\n }).then(function () {\n return _this._peerConnection.createAnswer();\n }).then(function (answer) {\n if (isFirefox) {\n // NOTE(mmalavalli): We work around Chromium bug 1106157 by disabling\n // RTX in Firefox 79+. For more details about the bug, please go here:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1106157\n answer = new _this._RTCSessionDescription({\n sdp: disableRtx(answer.sdp),\n type: answer.type\n });\n }\n else {\n answer = workaroundIssue8329(answer);\n }\n // NOTE(mpatwardhan): Upcoming chrome versions are going to remove ssrc attributes\n // mslabel and label. See this bug https://bugs.chromium.org/p/webrtc/issues/detail?id=7110\n // and PSA: https://groups.google.com/forum/#!searchin/discuss-webrtc/PSA%7Csort:date/discuss-webrtc/jcZO-Wj0Wus/k2XvPCvoAwAJ\n // We are not referencing those attributes, but this changes goes ahead and removes them to see if it works.\n // this also helps reduce bytes on wires\n var updatedSdp = removeSSRCAttributes(answer.sdp, ['mslabel', 'label']);\n if (_this._shouldApplySimulcast) {\n var sdpWithoutSimulcast = updatedSdp;\n updatedSdp = _this._setSimulcast(sdpWithoutSimulcast, _this._trackIdsToAttributes);\n // NOTE(syerrapragada): VMS does not support H264 simulcast. So,\n // unset simulcast for sections in local offer where corresponding\n // sections in answer doesn't have vp8 as preferred codec and reapply offer.\n updatedSdp = _this._revertSimulcast(updatedSdp, sdpWithoutSimulcast, offer.sdp);\n }\n // NOTE(mmalavalli): Work around Chromium bug 1074421.\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1074421\n updatedSdp = updatedSdp.replace(/42e015/g, '42e01f');\n return _this._setLocalDescription({\n type: answer.type,\n sdp: updatedSdp\n });\n }).then(function () {\n return _this._checkIceBox(offer);\n }).then(function () {\n return _this._queuedDescription\n && _this._updateDescription(_this._queuedDescription);\n }).then(function () {\n _this._queuedDescription = null;\n return _this._maybeReoffer(_this._peerConnection.localDescription);\n }).catch(function (error) {\n var errorToThrow = error instanceof MediaClientRemoteDescFailedError ? error : new MediaClientLocalDescFailedError();\n _this._publishMediaWarning({\n message: 'Failed to _answer',\n code: errorToThrow.code,\n error: error\n });\n throw errorToThrow;\n });\n };\n /**\n * Close the underlying RTCPeerConnection. Returns false if the\n * RTCPeerConnection was already closed.\n * @private\n * @returns {boolean}\n */\n PeerConnectionV2.prototype._close = function () {\n this._iceConnectionMonitor.stop();\n if (this._peerConnection.signalingState !== 'closed') {\n this._peerConnection.close();\n this.preempt('closed');\n this._encodingParameters.removeListener('changed', this._onEncodingParametersChanged);\n return true;\n }\n return false;\n };\n /**\n * Handle a \"connectionstatechange\" event.\n * @private\n * @returns {void}\n */\n PeerConnectionV2.prototype._handleConnectionStateChange = function () {\n this.emit('connectionStateChanged');\n };\n /**\n * Handle a \"datachannel\" event.\n * @private\n * @param {RTCDataChannelEvent} event\n * @returns {void}\n */\n PeerConnectionV2.prototype._handleDataChannelEvent = function (event) {\n var _this = this;\n var dataChannel = event.channel;\n var dataTrackReceiver = new DataTrackReceiver(dataChannel);\n this._dataTrackReceivers.add(dataTrackReceiver);\n dataChannel.addEventListener('close', function () {\n _this._dataTrackReceivers.delete(dataTrackReceiver);\n });\n this.emit('trackAdded', dataTrackReceiver);\n };\n /**\n * Handle a glare scenario on the {@link PeerConnectionV2}.\n * @private\n * @param {RTCSessionDescriptionInit} offer\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._handleGlare = function (offer) {\n var _this = this;\n this._log.debug('Glare detected; rolling back');\n if (this._isRestartingIce) {\n this._log.debug('An ICE restart was in progress; we\\'ll need to restart ICE again after rolling back');\n this._isRestartingIce = false;\n this._shouldRestartIce = true;\n }\n return Promise.resolve().then(function () {\n _this._trackIdsToAttributes = new Map(_this._appliedTrackIdsToAttributes);\n return _this._setLocalDescription({ type: 'rollback' });\n }).then(function () {\n _this._needsAnswer = false;\n return _this._answer(offer);\n }).then(function (didReoffer) {\n return didReoffer ? Promise.resolve() : _this._offer();\n });\n };\n PeerConnectionV2.prototype._publishMediaWarning = function (_a) {\n var message = _a.message, code = _a.code, error = _a.error, sdp = _a.sdp;\n this._eventObserver.emit('event', { level: 'warning', name: 'error', group: 'media', payload: {\n message: message,\n code: code,\n context: JSON.stringify({ error: error.message, sdp: sdp })\n } });\n };\n /**\n * Handle an ICE candidate event.\n * @private\n * @param {Event} event\n * @returns {void}\n */\n PeerConnectionV2.prototype._handleIceCandidateEvent = function (event) {\n if (event.candidate) {\n this._log.debug('Clearing ICE gathering timeout');\n this._didGenerateLocalCandidates = true;\n this._iceGatheringTimeout.clear();\n this._localCandidates.push(event.candidate);\n }\n var peerConnectionState = {\n ice: {\n candidates: this._isIceLite ? [] : this._localCandidates.slice(),\n ufrag: this._localUfrag\n },\n id: this.id\n };\n if (!event.candidate) {\n peerConnectionState.ice.complete = true;\n }\n if (!(this._isIceLite && event.candidate)) {\n peerConnectionState.ice.revision = this._localCandidatesRevision++;\n this.emit('candidates', peerConnectionState);\n }\n };\n /**\n * Handle an ICE connection state change event.\n * @private\n * @returns {void}\n */\n PeerConnectionV2.prototype._handleIceConnectionStateChange = function () {\n var _this = this;\n var iceConnectionState = this._peerConnection.iceConnectionState;\n var isIceConnectedOrComplete = ['connected', 'completed'].includes(iceConnectionState);\n var log = this._log;\n log.debug(\"ICE connection state is \\\"\" + iceConnectionState + \"\\\"\");\n if (isIceConnectedOrComplete) {\n this._iceReconnectTimeout.clear();\n this._iceRestartBackoff.reset();\n }\n if (this._lastIceConnectionState !== 'failed' && iceConnectionState === 'failed' && !this._shouldRestartIce && !this._isRestartingIce) {\n // Case 1: Transition to \"failed\".\n log.warn('ICE failed');\n this._initiateIceRestartBackoff();\n }\n else if (['disconnected', 'failed'].includes(this._lastIceConnectionState) && isIceConnectedOrComplete) {\n // Case 2: Transition from \"disconnected\" or \"failed\".\n log.debug('ICE reconnected');\n }\n // start monitor media when connected, and continue to monitor while state is complete-disconnected-connected.\n if (iceConnectionState === 'connected') {\n this._isIceConnectionInactive = false;\n this._iceConnectionMonitor.start(function () {\n // note: iceConnection monitor waits for iceConnectionState=disconnected for\n // detecting inactivity. Its possible that it may know about disconnected before _handleIceConnectionStateChange\n _this._iceConnectionMonitor.stop();\n if (!_this._shouldRestartIce && !_this._isRestartingIce) {\n log.warn('ICE Connection Monitor detected inactivity');\n _this._isIceConnectionInactive = true;\n _this._initiateIceRestartBackoff();\n _this.emit('iceConnectionStateChanged');\n _this.emit('connectionStateChanged');\n }\n });\n }\n else if (!['disconnected', 'completed'].includes(iceConnectionState)) { // don't stop monitoring for disconnected or completed.\n this._iceConnectionMonitor.stop();\n this._isIceConnectionInactive = false;\n }\n this._lastIceConnectionState = iceConnectionState;\n this.emit('iceConnectionStateChanged');\n };\n /**\n * Handle ICE gathering timeout.\n * @private\n * @returns {void}\n */\n PeerConnectionV2.prototype._handleIceGatheringTimeout = function () {\n this._log.warn('ICE failed to gather any local candidates');\n this._iceGatheringFailed = true;\n this._initiateIceRestartBackoff();\n this.emit('iceConnectionStateChanged');\n this.emit('connectionStateChanged');\n };\n /**\n * Handle an ICE gathering state change event.\n * @private\n * @returns {void}\n */\n PeerConnectionV2.prototype._handleIceGatheringStateChange = function () {\n var iceGatheringState = this._peerConnection.iceGatheringState;\n var log = this._log;\n log.debug(\"ICE gathering state is \\\"\" + iceGatheringState + \"\\\"\");\n // NOTE(mmalavalli): Start the ICE gathering timeout only if the RTCPeerConnection\n // has started gathering candidates for the first time since the initial offer/answer\n // or an offer/answer with ICE restart.\n var _a = this._iceGatheringTimeout, delay = _a.delay, isSet = _a.isSet;\n if (iceGatheringState === 'gathering' && !this._didGenerateLocalCandidates && !isSet) {\n log.debug(\"Starting ICE gathering timeout: \" + delay);\n this._iceGatheringFailed = false;\n this._iceGatheringTimeout.start();\n }\n };\n /**\n * Handle a signaling state change event.\n * @private\n * @returns {void}\n */\n PeerConnectionV2.prototype._handleSignalingStateChange = function () {\n if (this._peerConnection.signalingState === 'stable') {\n this._appliedTrackIdsToAttributes = new Map(this._trackIdsToAttributes);\n }\n };\n /**\n * Handle a track event.\n * @private\n * @param {RTCTrackEvent} event\n * @returns {void}\n */\n PeerConnectionV2.prototype._handleTrackEvent = function (event) {\n var _this = this;\n var sdp = this._peerConnection.remoteDescription\n ? this._peerConnection.remoteDescription.sdp\n : null;\n this._trackMatcher = this._trackMatcher || new TrackMatcher();\n this._trackMatcher.update(sdp);\n var mediaStreamTrack = event.track;\n var signaledTrackId = this._trackMatcher.match(event) || mediaStreamTrack.id;\n var mediaTrackReceiver = new MediaTrackReceiver(signaledTrackId, mediaStreamTrack);\n // NOTE(mmalavalli): \"ended\" is not fired on the remote MediaStreamTrack when\n // the remote peer removes a track. So, when this MediaStreamTrack is re-used\n // for a different track due to the remote peer calling RTCRtpSender.replaceTrack(),\n // we delete the previous MediaTrackReceiver that owned this MediaStreamTrack\n // before adding the new MediaTrackReceiver.\n this._mediaTrackReceivers.forEach(function (trackReceiver) {\n if (trackReceiver.track.id === mediaTrackReceiver.track.id) {\n _this._mediaTrackReceivers.delete(trackReceiver);\n }\n });\n this._mediaTrackReceivers.add(mediaTrackReceiver);\n mediaStreamTrack.addEventListener('ended', function () { return _this._mediaTrackReceivers.delete(mediaTrackReceiver); });\n this.emit('trackAdded', mediaTrackReceiver);\n };\n /**\n * Initiate ICE Restart.\n * @private\n * @returns {void}\n */\n PeerConnectionV2.prototype._initiateIceRestart = function () {\n if (this._peerConnection.signalingState === 'closed') {\n return;\n }\n var log = this._log;\n log.warn('Attempting to restart ICE');\n this._didGenerateLocalCandidates = false;\n this._isIceRestartBackoffInProgress = false;\n this._shouldRestartIce = true;\n var _a = this._iceReconnectTimeout, delay = _a.delay, isSet = _a.isSet;\n if (!isSet) {\n log.debug(\"Starting ICE reconnect timeout: \" + delay);\n this._iceReconnectTimeout.start();\n }\n this.offer().catch(function (ex) {\n log.error(\"offer failed in _initiateIceRestart with: \" + ex.message);\n });\n };\n /**\n * Schedule an ICE Restart.\n * @private\n * @returns {void}\n */\n PeerConnectionV2.prototype._initiateIceRestartBackoff = function () {\n var _this = this;\n if (this._peerConnection.signalingState === 'closed' || this._isIceRestartBackoffInProgress) {\n return;\n }\n this._log.warn('An ICE restart has been scheduled');\n this._isIceRestartBackoffInProgress = true;\n this._iceRestartBackoff.backoff(function () { return _this._initiateIceRestart(); });\n };\n /**\n * Conditionally re-offer.\n * @private\n * @param {?RTCSessionDescriptionInit} localDescription\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._maybeReoffer = function (localDescription) {\n var shouldReoffer = this._shouldOffer;\n if (localDescription && localDescription.sdp) {\n // NOTE(mmalavalli): If the local RTCSessionDescription has fewer audio and/or\n // video send* m= lines than the corresponding RTCRtpSenders with non-null\n // MediaStreamTracks, it means that the newly added RTCRtpSenders require\n // renegotiation.\n var senders_1 = this._peerConnection.getSenders().filter(function (sender) { return sender.track; });\n shouldReoffer = ['audio', 'video'].reduce(function (shouldOffer, kind) {\n var mediaSections = getMediaSections(localDescription.sdp, kind, '(sendrecv|sendonly)');\n var sendersOfKind = senders_1.filter(isSenderOfKind.bind(null, kind));\n return shouldOffer || (mediaSections.length < sendersOfKind.length);\n }, shouldReoffer);\n // NOTE(mroberts): We also need to re-offer if we have a DataTrack to share\n // but no m= application section.\n var hasDataTrack = this._dataChannels.size > 0;\n var hasApplicationMediaSection = getMediaSections(localDescription.sdp, 'application').length > 0;\n var needsApplicationMediaSection = hasDataTrack && !hasApplicationMediaSection;\n shouldReoffer = shouldReoffer || needsApplicationMediaSection;\n }\n var promise = shouldReoffer ? this._offer() : Promise.resolve();\n return promise.then(function () { return shouldReoffer; });\n };\n /**\n * Create an offer and set it on the {@link PeerConnectionV2}.\n * @private\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._offer = function () {\n var _this = this;\n var offerOptions = Object.assign({}, this._offerOptions);\n this._needsAnswer = true;\n if (this._shouldRestartIce) {\n this._shouldRestartIce = false;\n this._isRestartingIce = true;\n offerOptions.iceRestart = true;\n }\n return Promise.all(this._replaceTrackPromises.values()).then(function () {\n return _this._peerConnection.createOffer(offerOptions);\n }).catch(function (error) {\n var errorToThrow = new MediaClientLocalDescFailedError();\n _this._publishMediaWarning({\n message: 'Failed to create offer',\n code: errorToThrow.code,\n error: error\n });\n throw errorToThrow;\n }).then(function (offer) {\n if (isFirefox) {\n // NOTE(mmalavalli): We work around Chromium bug 1106157 by disabling\n // RTX in Firefox 79+. For more details about the bug, please go here:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1106157\n offer = new _this._RTCSessionDescription({\n sdp: disableRtx(offer.sdp),\n type: offer.type\n });\n }\n else {\n offer = workaroundIssue8329(offer);\n }\n // NOTE(mpatwardhan): upcoming chrome versions are going to remove ssrc attributes\n // mslabel and label. See this bug https://bugs.chromium.org/p/webrtc/issues/detail?id=7110\n // and PSA: https://groups.google.com/forum/#!searchin/discuss-webrtc/PSA%7Csort:date/discuss-webrtc/jcZO-Wj0Wus/k2XvPCvoAwAJ\n // Looks like we are not referencing those attributes, but this changes goes ahead and removes them to see if it works.\n // this also helps reduce bytes on wires\n var sdp = removeSSRCAttributes(offer.sdp, ['mslabel', 'label']);\n sdp = _this._peerConnection.remoteDescription\n ? filterLocalCodecs(sdp, _this._peerConnection.remoteDescription.sdp)\n : sdp;\n var updatedSdp = _this._setCodecPreferences(sdp, _this._preferredAudioCodecs, _this._preferredVideoCodecs);\n _this._shouldOffer = false;\n if (!_this._negotiationRole) {\n _this._negotiationRole = 'offerer';\n }\n if (_this._shouldApplySimulcast) {\n _this._localDescriptionWithoutSimulcast = {\n type: 'offer',\n sdp: updatedSdp\n };\n updatedSdp = _this._setSimulcast(updatedSdp, _this._trackIdsToAttributes);\n }\n return _this._setLocalDescription({\n type: 'offer',\n sdp: updatedSdp\n });\n });\n };\n /**\n * Get the MediaTrackSender ID of the given MediaStreamTrack ID.\n * Since a MediaTrackSender's underlying MediaStreamTrack can be\n * replaced, the corresponding IDs can mismatch.\n * @private\n * @param {Track.ID} id\n * @returns {Track.ID}\n */\n PeerConnectionV2.prototype._getMediaTrackSenderId = function (trackId) {\n var mediaTrackSender = Array.from(this._rtpSenders.keys()).find(function (_a) {\n var id = _a.track.id;\n return id === trackId;\n });\n return mediaTrackSender ? mediaTrackSender.id : trackId;\n };\n /**\n * Add or rewrite local MediaStreamTrack IDs in the given RTCSessionDescription.\n * @private\n * @param {RTCSessionDescription} description\n * @return {RTCSessionDescription}\n */\n PeerConnectionV2.prototype._addOrRewriteLocalTrackIds = function (description) {\n var _this = this;\n var transceivers = this._peerConnection.getTransceivers();\n var activeTransceivers = transceivers.filter(function (_a) {\n var sender = _a.sender, stopped = _a.stopped;\n return !stopped && sender && sender.track;\n });\n // NOTE(mmalavalli): There is no guarantee that MediaStreamTrack IDs will be present in\n // SDPs, and even if they are, there is no guarantee that they will be the same as the\n // actual MediaStreamTrack IDs. So, we add or re-write the actual MediaStreamTrack IDs\n // to the assigned m= sections here.\n var assignedTransceivers = activeTransceivers.filter(function (_a) {\n var mid = _a.mid;\n return mid;\n });\n var midsToTrackIds = new Map(assignedTransceivers.map(function (_a) {\n var mid = _a.mid, sender = _a.sender;\n return [mid, _this._getMediaTrackSenderId(sender.track.id)];\n }));\n var sdp1 = addOrRewriteTrackIds(description.sdp, midsToTrackIds);\n // NOTE(mmalavalli): Chrome and Safari do not apply the offer until they get an answer.\n // So, we add or re-write the actual MediaStreamTrack IDs to the unassigned m= sections here.\n var unassignedTransceivers = activeTransceivers.filter(function (_a) {\n var mid = _a.mid;\n return !mid;\n });\n var newTrackIdsByKind = new Map(['audio', 'video'].map(function (kind) { return [\n kind,\n unassignedTransceivers.filter(function (_a) {\n var sender = _a.sender;\n return sender.track.kind === kind;\n }).map(function (_a) {\n var sender = _a.sender;\n return _this._getMediaTrackSenderId(sender.track.id);\n })\n ]; }));\n var sdp2 = addOrRewriteNewTrackIds(sdp1, midsToTrackIds, newTrackIdsByKind);\n return new this._RTCSessionDescription({\n sdp: sdp2,\n type: description.type\n });\n };\n /**\n * Rollback and apply the given offer.\n * @private\n * @param {RTCSessionDescriptionInit} offer\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._rollbackAndApplyOffer = function (offer) {\n var _this = this;\n return this._setLocalDescription({ type: 'rollback' }).then(function () { return _this._setLocalDescription(offer); });\n };\n /**\n * Set a local description on the {@link PeerConnectionV2}.\n * @private\n * @param {RTCSessionDescription|RTCSessionDescriptionInit} description\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._setLocalDescription = function (description) {\n var _this = this;\n if (description.type !== 'rollback' && this._shouldApplyDtx) {\n description = new this._RTCSessionDescription({\n sdp: enableDtxForOpus(description.sdp),\n type: description.type\n });\n }\n return this._peerConnection.setLocalDescription(description).catch(function (error) {\n _this._log.warn(\"Calling setLocalDescription with an RTCSessionDescription of type \\\"\" + description.type + \"\\\" failed with the error \\\"\" + error.message + \"\\\".\", error);\n var errorToThrow = new MediaClientLocalDescFailedError();\n var publishWarning = {\n message: \"Calling setLocalDescription with an RTCSessionDescription of type \\\"\" + description.type + \"\\\" failed\",\n code: errorToThrow.code,\n error: error\n };\n if (description.sdp) {\n _this._log.warn(\"The SDP was \" + description.sdp);\n publishWarning.sdp = description.sdp;\n }\n _this._publishMediaWarning(publishWarning);\n throw errorToThrow;\n }).then(function () {\n if (description.type !== 'rollback') {\n _this._localDescription = _this._addOrRewriteLocalTrackIds(description);\n // NOTE(mmalavalli): In order for this feature to be backward compatible with older\n // SDK versions which to not support opus DTX, we append \"usedtx=1\" to the local SDP\n // only while applying it. We will not send it over the wire to prevent inadvertent\n // enabling of opus DTX in older SDKs. Newer SDKs will append \"usedtx=1\" by themselves\n // if the developer has requested opus DTX to be enabled. (JSDK-3063)\n if (_this._shouldApplyDtx) {\n _this._localDescription = new _this._RTCSessionDescription({\n sdp: enableDtxForOpus(_this._localDescription.sdp, []),\n type: _this._localDescription.type\n });\n }\n _this._localCandidates = [];\n if (description.type === 'offer') {\n _this._descriptionRevision++;\n }\n else if (description.type === 'answer') {\n _this._lastStableDescriptionRevision = _this._descriptionRevision;\n negotiationCompleted(_this);\n }\n _this._localUfrag = getUfrag(description);\n _this.emit('description', _this.getState());\n }\n });\n };\n /**\n * Set a remote RTCSessionDescription on the {@link PeerConnectionV2}.\n * @private\n * @param {RTCSessionDescriptionInit} description\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._setRemoteDescription = function (description) {\n var _this = this;\n if (description.sdp) {\n description.sdp = this._setCodecPreferences(description.sdp, this._preferredAudioCodecs, this._preferredVideoCodecs);\n if (this._shouldApplyDtx) {\n description.sdp = enableDtxForOpus(description.sdp);\n }\n else {\n // NOTE(mmalavalli): Remove \"usedtx=1\" from opus's fmtp line if present\n // since DTX is disabled.\n description.sdp = enableDtxForOpus(description.sdp, []);\n }\n if (isFirefox) {\n // NOTE(mroberts): Do this to reduce our MediaStream count in Firefox. By\n // mapping MediaStream IDs in the SDP to \"-\", we ensure the \"track\" event\n // doesn't include any new MediaStreams in Firefox. Its `streams` member\n // will always be the empty Array.\n description.sdp = filterOutMediaStreamIds(description.sdp);\n }\n if (!this._peerConnection.remoteDescription) {\n this._isIceLite = /a=ice-lite/.test(description.sdp);\n }\n }\n description = new this._RTCSessionDescription(description);\n // eslint-disable-next-line consistent-return\n return Promise.resolve().then(function () {\n // NOTE(syerrapragada): VMS does not support H264 simulcast. So,\n // unset simulcast for sections in local offer where corresponding\n // sections in answer doesn't have vp8 as preferred codec and reapply offer.\n if (description.type === 'answer' && _this._localDescriptionWithoutSimulcast) {\n // NOTE(mpatwardhan):if we were using adaptive simulcast, and if its not supported by server\n // revert simulcast even for vp8.\n var adaptiveSimulcastEntry = _this._preferredVideoCodecs.find(function (cs) { return 'adaptiveSimulcast' in cs; });\n var revertForAll = !!adaptiveSimulcastEntry && adaptiveSimulcastEntry.adaptiveSimulcast === false;\n var sdpWithoutSimulcastForNonVP8MediaSections = _this._revertSimulcast(_this._localDescription.sdp, _this._localDescriptionWithoutSimulcast.sdp, description.sdp, revertForAll);\n _this._localDescriptionWithoutSimulcast = null;\n if (sdpWithoutSimulcastForNonVP8MediaSections !== _this._localDescription.sdp) {\n return _this._rollbackAndApplyOffer({\n type: _this._localDescription.type,\n sdp: sdpWithoutSimulcastForNonVP8MediaSections\n });\n }\n }\n }).then(function () { return _this._peerConnection.setRemoteDescription(description); }).then(function () {\n if (description.type === 'answer') {\n if (_this._isRestartingIce) {\n _this._log.debug('An ICE restart was in-progress and is now completed');\n _this._isRestartingIce = false;\n }\n negotiationCompleted(_this);\n }\n }, function (error) {\n _this._log.warn(\"Calling setRemoteDescription with an RTCSessionDescription of type \\\"\" + description.type + \"\\\" failed with the error \\\"\" + error.message + \"\\\".\", error);\n if (description.sdp) {\n _this._log.warn(\"The SDP was \" + description.sdp);\n }\n throw error;\n });\n };\n /**\n * Update the {@link PeerConnectionV2}'s description.\n * @private\n * @param {RTCSessionDescriptionInit} description\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._updateDescription = function (description) {\n var _this = this;\n switch (description.type) {\n case 'answer':\n case 'pranswer':\n if (description.revision !== this._descriptionRevision\n || this._peerConnection.signalingState !== 'have-local-offer') {\n return Promise.resolve();\n }\n this._descriptionRevision = description.revision;\n break;\n case 'close':\n return this._close();\n case 'create-offer':\n if (description.revision <= this._lastStableDescriptionRevision) {\n return Promise.resolve();\n }\n else if (this._needsAnswer) {\n this._queuedDescription = description;\n return Promise.resolve();\n }\n this._descriptionRevision = description.revision;\n return this._offer();\n case 'offer':\n if (description.revision <= this._lastStableDescriptionRevision\n || this._peerConnection.signalingState === 'closed') {\n return Promise.resolve();\n }\n if (this._peerConnection.signalingState === 'have-local-offer') {\n // NOTE(mpatwardhan): For a peer connection\n // 1) createOffer always generate SDP with `setup:actpass`\n // 2) when remote description is set `setup:active` - the answer generated selects the dtls role of setup:passive\n // 3) when remote description is set `setup:passive` - the answer generated selects the dtls role of setup:active\n // 4) when remote description is set `setup:actpass` - the answer generated uses the previously negotiated role (if not negotiated previously setup:active is used)\n // This test shows the behavior: https://github.com/twilio/twilio-webrtc.js/blob/master/test/integration/spec/rtcpeerconnection.js#L936\n // with glare handling (if dtls role was not negotiated before ) the generated answer will set setup:active.\n // we do not want that. lets wait for \"initial negotiation\" before attempting glare handling.\n if (this._needsAnswer && this._lastStableDescriptionRevision === 0) {\n this._queuedDescription = description;\n return Promise.resolve();\n }\n this._descriptionRevision = description.revision;\n return this._handleGlare(description);\n }\n this._descriptionRevision = description.revision;\n return this._answer(description).then(function () { });\n default:\n // Do nothing.\n }\n // Handle answer or pranswer.\n var revision = description.revision;\n return Promise.resolve().then(function () {\n return _this._setRemoteDescription(description);\n }).catch(function (error) {\n var errorToThrow = new MediaClientRemoteDescFailedError();\n _this._publishMediaWarning({\n message: \"Calling setRemoteDescription with an RTCSessionDescription of type \\\"\" + description.type + \"\\\" failed\",\n code: errorToThrow.code,\n error: error,\n sdp: description.sdp\n });\n throw errorToThrow;\n }).then(function () {\n _this._lastStableDescriptionRevision = revision;\n _this._needsAnswer = false;\n return _this._checkIceBox(description);\n }).then(function () {\n return _this._queuedDescription\n && _this._updateDescription(_this._queuedDescription);\n }).then(function () {\n _this._queuedDescription = null;\n return _this._maybeReoffer(_this._peerConnection.localDescription).then(function () { });\n });\n };\n /**\n * Update the {@link PeerConnectionV2}'s ICE candidates.\n * @private\n * @param {object} iceState\n * @returns {Promise}\n */\n PeerConnectionV2.prototype._updateIce = function (iceState) {\n var candidates = this._remoteCandidates.update(iceState);\n return this._addIceCandidates(candidates);\n };\n /**\n * Add a {@link DataTrackSender} to the {@link PeerConnectionV2}.\n * @param {DataTrackSender} dataTrackSender\n * @returns {void}\n */\n PeerConnectionV2.prototype.addDataTrackSender = function (dataTrackSender) {\n if (this._dataChannels.has(dataTrackSender)) {\n return;\n }\n try {\n var dataChannelDict = {\n ordered: dataTrackSender.ordered\n };\n if (dataTrackSender.maxPacketLifeTime !== null) {\n dataChannelDict.maxPacketLifeTime = dataTrackSender.maxPacketLifeTime;\n }\n if (dataTrackSender.maxRetransmits !== null) {\n dataChannelDict.maxRetransmits = dataTrackSender.maxRetransmits;\n }\n var dataChannel = this._peerConnection.createDataChannel(dataTrackSender.id, dataChannelDict);\n dataTrackSender.addDataChannel(dataChannel);\n this._dataChannels.set(dataTrackSender, dataChannel);\n }\n catch (error) {\n this._log.warn(\"Error creating an RTCDataChannel for DataTrack \\\"\" + dataTrackSender.id + \"\\\": \" + error.message);\n }\n };\n PeerConnectionV2.prototype._handleQueuedPublisherHints = function () {\n var _this = this;\n if (this._peerConnection.signalingState === 'stable') {\n this._mediaTrackSenderToPublisherHints.forEach(function (_a, mediaTrackSender) {\n var deferred = _a.deferred, encodings = _a.encodings;\n _this._mediaTrackSenderToPublisherHints.delete(mediaTrackSender);\n _this._setPublisherHint(mediaTrackSender, encodings)\n .then(function (result) { return deferred.resolve(result); })\n .catch(function (error) { return deferred.reject(error); });\n });\n }\n };\n /**\n * updates encodings for simulcast layers of given sender.\n * @param {RTCRtpSender} sender\n * @param {Array<{enabled: boolean, layer_index: number}>|null} encodings\n * @returns {Promise} string indicating result of the operation. can be one of\n * \"OK\", \"INVALID_HINT\", \"COULD_NOT_APPLY_HINT\", \"UNKNOWN_TRACK\"\n */\n PeerConnectionV2.prototype._setPublisherHint = function (mediaTrackSender, encodings) {\n var _this = this;\n if (isFirefox) {\n return Promise.resolve('COULD_NOT_APPLY_HINT');\n }\n if (this._mediaTrackSenderToPublisherHints.has(mediaTrackSender)) {\n // skip any stale hint associated with the mediaTrackSender.\n var queuedHint = this._mediaTrackSenderToPublisherHints.get(mediaTrackSender);\n queuedHint.deferred.resolve('REQUEST_SKIPPED');\n this._mediaTrackSenderToPublisherHints.delete(mediaTrackSender);\n }\n var sender = this._rtpSenders.get(mediaTrackSender);\n if (!sender) {\n this._log.warn('Could not apply publisher hint because RTCRtpSender was not found');\n return Promise.resolve('UNKNOWN_TRACK');\n }\n if (this._peerConnection.signalingState === 'closed') {\n this._log.warn('Could not apply publisher hint because signalingState was \"closed\"');\n return Promise.resolve('COULD_NOT_APPLY_HINT');\n }\n if (this._peerConnection.signalingState !== 'stable') {\n // enqueue this hint to be applied when pc becomes stable.\n this._log.debug('Queuing up publisher hint because signalingState:', this._peerConnection.signalingState);\n var deferred = defer();\n this._mediaTrackSenderToPublisherHints.set(mediaTrackSender, { deferred: deferred, encodings: encodings });\n return deferred.promise;\n }\n var parameters = sender.getParameters();\n if (encodings !== null) {\n encodings.forEach(function (_a) {\n var enabled = _a.enabled, layerIndex = _a.layer_index;\n if (parameters.encodings.length > layerIndex) {\n _this._log.debug(\"layer:\" + layerIndex + \", active:\" + parameters.encodings[layerIndex].active + \" => \" + enabled);\n parameters.encodings[layerIndex].active = enabled;\n }\n else {\n _this._log.warn(\"invalid layer:\" + layerIndex + \", active:\" + enabled);\n }\n });\n }\n // Note(mpatwardhan): after publisher hints are applied, overwrite with default encodings\n // to disable any encoding that shouldn't have been enabled by publisher_hints.\n // When encodings===null (that is we are asked to reset encodings for replaceTrack)\n // along with disabling encodings, clear active flag for encodings that should not be disabled\n this._maybeUpdateEncodings(sender.track, parameters.encodings, encodings === null /* trackReplaced */);\n return sender.setParameters(parameters).then(function () { return 'OK'; }).catch(function (error) {\n _this._log.error('Failed to apply publisher hints:', error);\n return 'COULD_NOT_APPLY_HINT';\n });\n };\n /**\n * Add the {@link MediaTrackSender} to the {@link PeerConnectionV2}.\n * @param {MediaTrackSender} mediaTrackSender\n * @returns {void}\n */\n PeerConnectionV2.prototype.addMediaTrackSender = function (mediaTrackSender) {\n var _this = this;\n if (this._peerConnection.signalingState === 'closed' || this._rtpSenders.has(mediaTrackSender)) {\n return;\n }\n var transceiver = this._addOrUpdateTransceiver(mediaTrackSender.track);\n var sender = transceiver.sender;\n mediaTrackSender.addSender(sender, function (encodings) { return _this._setPublisherHint(mediaTrackSender, encodings); });\n this._rtpNewSenders.add(sender);\n this._rtpSenders.set(mediaTrackSender, sender);\n };\n /**\n * Close the {@link PeerConnectionV2}.\n * @returns {void}\n */\n PeerConnectionV2.prototype.close = function () {\n if (this._close()) {\n this._descriptionRevision++;\n this._localDescription = { type: 'close' };\n this.emit('description', this.getState());\n }\n };\n /**\n * Get the {@link DataTrackReceiver}s and the {@link MediaTrackReceiver}s on the\n * {@link PeerConnectionV2}.\n * @returns {Array} trackReceivers\n */\n PeerConnectionV2.prototype.getTrackReceivers = function () {\n return Array.from(this._dataTrackReceivers).concat(Array.from(this._mediaTrackReceivers));\n };\n /**\n * Get the {@link PeerConnectionV2}'s state (specifically, its description).\n * @returns {?object}\n */\n PeerConnectionV2.prototype.getState = function () {\n if (!this._localDescription) {\n return null;\n }\n // NOTE(mpatwardhan): Return most recent localDescription. If the most recent local description is an\n // answer, and this method is called for sending a \"sync\" message while the next remote offer is being processed,\n // we need to send the most recent stable description revision instead of the current description revision,\n // which is supposed to be for the next local answer.\n var localDescriptionRevision = this._localDescription.type === 'answer' ? this._lastStableDescriptionRevision : this._descriptionRevision;\n var localDescription = {\n type: this._localDescription.type,\n revision: localDescriptionRevision\n };\n if (this._localDescription.sdp) {\n localDescription.sdp = this._localDescription.sdp;\n }\n return {\n description: localDescription,\n id: this.id\n };\n };\n /**\n * Create an offer and set it on the {@link PeerConnectionV2}.\n * @returns {Promise}\n */\n PeerConnectionV2.prototype.offer = function () {\n var _this = this;\n if (this._needsAnswer || this._isRestartingIce) {\n this._shouldOffer = true;\n return Promise.resolve();\n }\n return this.bracket('offering', function (key) {\n _this.transition('updating', key);\n var promise = _this._needsAnswer || _this._isRestartingIce ? Promise.resolve() : _this._offer();\n return promise.then(function () {\n _this.tryTransition('open', key);\n }, function (error) {\n _this.tryTransition('open', key);\n throw error;\n });\n });\n };\n /**\n * Remove a {@link DataTrackSender} from the {@link PeerConnectionV2}.\n * @param {DataTrackSender} dataTrackSender\n * @returns {void}\n */\n PeerConnectionV2.prototype.removeDataTrackSender = function (dataTrackSender) {\n var dataChannel = this._dataChannels.get(dataTrackSender);\n if (dataChannel) {\n dataTrackSender.removeDataChannel(dataChannel);\n this._dataChannels.delete(dataTrackSender);\n dataChannel.close();\n }\n };\n /**\n * Remove the {@link MediaTrackSender} from the {@link PeerConnectionV2}.\n * @param {MediaTrackSender} mediaTrackSender\n * @returns {void}\n */\n PeerConnectionV2.prototype.removeMediaTrackSender = function (mediaTrackSender) {\n var sender = this._rtpSenders.get(mediaTrackSender);\n if (!sender) {\n return;\n }\n if (this._peerConnection.signalingState !== 'closed') {\n this._peerConnection.removeTrack(sender);\n }\n mediaTrackSender.removeSender(sender);\n // clean up any pending publisher hints associated with this mediaTrackSender.\n if (this._mediaTrackSenderToPublisherHints.has(mediaTrackSender)) {\n var queuedHint = this._mediaTrackSenderToPublisherHints.get(mediaTrackSender);\n queuedHint.deferred.resolve('UNKNOWN_TRACK');\n this._mediaTrackSenderToPublisherHints.delete(mediaTrackSender);\n }\n this._rtpNewSenders.delete(sender);\n this._rtpSenders.delete(mediaTrackSender);\n };\n /**\n * Set the RTCConfiguration on the underlying RTCPeerConnection.\n * @param {RTCConfiguration} configuration\n * @returns {void}\n */\n PeerConnectionV2.prototype.setConfiguration = function (configuration) {\n if (typeof this._peerConnection.setConfiguration === 'function') {\n this._peerConnection.setConfiguration(getConfiguration(configuration));\n }\n };\n /**\n * Set the ICE reconnect timeout period.\n * @param {number} period - Period in milliseconds.\n * @returns {this}\n */\n PeerConnectionV2.prototype.setIceReconnectTimeout = function (period) {\n this._iceReconnectTimeout.setDelay(period);\n this._log.debug('Updated ICE reconnection timeout period:', this._iceReconnectTimeout.delay);\n return this;\n };\n /**\n * Update the {@link PeerConnectionV2}.\n * @param {object} peerConnectionState\n * @returns {Promise}\n */\n PeerConnectionV2.prototype.update = function (peerConnectionState) {\n var _this = this;\n return this.bracket('updating', function (key) {\n if (_this.state === 'closed') {\n return Promise.resolve();\n }\n _this.transition('updating', key);\n var updates = [];\n if (peerConnectionState.ice) {\n updates.push(_this._updateIce(peerConnectionState.ice));\n }\n if (peerConnectionState.description) {\n updates.push(_this._updateDescription(peerConnectionState.description));\n }\n return Promise.all(updates).then(function () {\n _this.tryTransition('open', key);\n }, function (error) {\n _this.tryTransition('open', key);\n throw error;\n });\n });\n };\n /**\n * Get the {@link PeerConnectionV2}'s media statistics.\n * @returns {Promise}\n */\n PeerConnectionV2.prototype.getStats = function () {\n var _this = this;\n return getStatistics(this._peerConnection).then(function (response) { return rewriteTrackIds(_this, response); });\n };\n return PeerConnectionV2;\n}(StateMachine));\nfunction rewriteLocalTrackId(pcv2, stats) {\n var trackId = pcv2._getMediaTrackSenderId(stats.trackId);\n return Object.assign(stats, { trackId: trackId });\n}\nfunction rewriteTrackId(pcv2, stats) {\n var receiver = __spreadArray([], __read(pcv2._mediaTrackReceivers)).find(function (receiver) { return receiver.track.id === stats.trackId; });\n var trackId = receiver ? receiver.id : null;\n return Object.assign(stats, { trackId: trackId });\n}\nfunction rewriteTrackIds(pcv2, response) {\n return Object.assign(response, {\n remoteAudioTrackStats: response.remoteAudioTrackStats.map(function (stats) { return rewriteTrackId(pcv2, stats); }),\n remoteVideoTrackStats: response.remoteVideoTrackStats.map(function (stats) { return rewriteTrackId(pcv2, stats); }),\n localAudioTrackStats: response.localAudioTrackStats.map(function (stats) { return rewriteLocalTrackId(pcv2, stats); }),\n localVideoTrackStats: response.localVideoTrackStats.map(function (stats) { return rewriteLocalTrackId(pcv2, stats); }),\n });\n}\n/**\n * @event PeerConnectionV2#candidates\n * @param {object} candidates\n */\n/**\n * @event PeerConnectionV2#connectionStateChanged\n */\n/**\n * @event PeerConnectionV2#description\n * @param {object} description\n */\n/**\n * @event PeerConnectionV2#iceConnectionStateChanged\n */\n/**\n * @event PeerConnectionV2#trackAdded\n * @param {DataTrackReceiver|MediaTrackReceiver} trackReceiver\n */\nfunction getUfrag(description) {\n if (description.sdp) {\n var match = description.sdp.match(/^a=ice-ufrag:([a-zA-Z0-9+/]+)/m);\n if (match) {\n return match[1];\n }\n }\n return null;\n}\nfunction getConfiguration(configuration) {\n return Object.assign({\n bundlePolicy: 'max-bundle',\n rtcpMuxPolicy: 'require'\n }, configuration);\n}\n/**\n * Whether the MediaStreamTrack of the given RTCRTPSender is a non-ended\n * MediaStreamTrack of a given kind.\n * @private\n * @param {string} kind\n * @param {RTCRtpSender} sender\n * @return {boolean}\n */\nfunction isSenderOfKind(kind, sender) {\n var track = sender.track;\n return track && track.kind === kind && track.readyState !== 'ended';\n}\n/**\n * Preferred codecs.\n * @typedef {object} PreferredCodecs\n * @property {Array} audio\n * @property {Array} video\n */\nfunction filterOutMediaStreamIds(sdp) {\n return sdp.replace(/a=msid:[^ ]+ /g, 'a=msid:- ');\n}\n/**\n * Whether an RTCRtpTransceiver can be recycled.\n * @param {RTCRtpTransceiver} transceiver\n * @returns {boolean}\n */\nfunction shouldRecycleTransceiver(transceiver, pcv2) {\n return !transceiver.stopped\n && !pcv2._replaceTrackPromises.has(transceiver)\n && ['inactive', 'recvonly'].includes(transceiver.direction);\n}\n/**\n * Take a recycled RTCRtpTransceiver if available.\n * @param {PeerConnectionV2} pcv2\n * @param {Track.Kind} kind\n * @returns {?RTCRtpTransceiver}\n */\nfunction takeRecycledTransceiver(pcv2, kind) {\n var preferredCodecs = {\n audio: pcv2._preferredAudioCodecs.map(function (_a) {\n var codec = _a.codec;\n return codec.toLowerCase();\n }),\n video: pcv2._preferredVideoCodecs.map(function (_a) {\n var codec = _a.codec;\n return codec.toLowerCase();\n })\n }[kind];\n var recycledTransceivers = pcv2._recycledTransceivers[kind];\n var localCodec = preferredCodecs.find(function (codec) { return pcv2._localCodecs.has(codec); });\n if (!localCodec) {\n return recycledTransceivers.shift();\n }\n var transceiver = recycledTransceivers.find(function (transceiver) {\n var remoteCodecMap = pcv2._remoteCodecMaps.get(transceiver.mid);\n return remoteCodecMap && remoteCodecMap.has(localCodec);\n });\n if (transceiver) {\n recycledTransceivers.splice(recycledTransceivers.indexOf(transceiver), 1);\n }\n return transceiver;\n}\n/**\n * Update the set of locally supported {@link Codec}s.\n * @param pcv2\n * @returns {void}\n */\nfunction updateLocalCodecs(pcv2) {\n var description = pcv2._peerConnection.localDescription;\n if (!description || !description.sdp) {\n return;\n }\n getMediaSections(description.sdp).forEach(function (section) {\n var codecMap = createCodecMapForMediaSection(section);\n codecMap.forEach(function (pts, codec) { return pcv2._localCodecs.add(codec); });\n });\n}\n/**\n * Update the {@link Codec} maps for all m= sections in the remote {@link RTCSessionDescription}s.\n * @param {PeerConnectionV2} pcv2\n * @returns {void}\n */\nfunction updateRemoteCodecMaps(pcv2) {\n var description = pcv2._peerConnection.remoteDescription;\n if (!description || !description.sdp) {\n return;\n }\n getMediaSections(description.sdp).forEach(function (section) {\n var matched = section.match(/^a=mid:(.+)$/m);\n if (!matched || !matched[1]) {\n return;\n }\n var mid = matched[1];\n var codecMap = createCodecMapForMediaSection(section);\n pcv2._remoteCodecMaps.set(mid, codecMap);\n });\n}\n/**\n * Update the list of recycled RTCRtpTransceivers.\n * @param {PeerConnectionV2} pcv2\n */\nfunction updateRecycledTransceivers(pcv2) {\n pcv2._recycledTransceivers.audio = [];\n pcv2._recycledTransceivers.video = [];\n pcv2._peerConnection.getTransceivers().forEach(function (transceiver) {\n if (shouldRecycleTransceiver(transceiver, pcv2)) {\n var track = transceiver.receiver.track;\n pcv2._recycledTransceivers[track.kind].push(transceiver);\n }\n });\n}\n/**\n * Perform certain updates after an SDP negotiation is completed.\n * @param {PeerConnectionV2} pcv2\n * @returns {void}\n */\nfunction negotiationCompleted(pcv2) {\n updateRecycledTransceivers(pcv2);\n updateLocalCodecs(pcv2);\n updateRemoteCodecMaps(pcv2);\n updateEncodingParameters(pcv2).then(function () {\n // if there any any publisher hints queued, apply them now.\n pcv2._handleQueuedPublisherHints();\n });\n}\n/**\n * Update the RTCRtpEncodingParameters of all active RTCRtpSenders.\n * @param {PeerConnectionV2} pcv2\n * @returns {void}\n */\nfunction updateEncodingParameters(pcv2) {\n var _a = pcv2._encodingParameters, maxAudioBitrate = _a.maxAudioBitrate, maxVideoBitrate = _a.maxVideoBitrate;\n var maxBitrates = new Map([\n ['audio', maxAudioBitrate],\n ['video', maxVideoBitrate]\n ]);\n var promises = [];\n pcv2._peerConnection.getSenders().filter(function (sender) { return sender.track; }).forEach(function (sender) {\n var maxBitrate = maxBitrates.get(sender.track.kind);\n var params = sender.getParameters();\n if (maxBitrate === null || maxBitrate === 0) {\n removeMaxBitrate(params);\n }\n else if (pcv2._isChromeScreenShareTrack(sender.track)) {\n // NOTE(mpatwardhan): Sometimes (JSDK-2557) chrome does not send any bytes on screen track if MaxBitRate is set on it via setParameters,\n // To workaround this issue we will not apply maxBitrate if the track appears to be a screen share track created by chrome\n pcv2._log.warn(\"Not setting maxBitrate for \" + sender.track.kind + \" Track \" + sender.track.id + \" because it appears to be screen share track: \" + sender.track.label);\n }\n else {\n setMaxBitrate(params, maxBitrate);\n }\n if (!isFirefox && params.encodings.length > 0) {\n if (sender.track.kind === 'audio') {\n // NOTE(mmalavalli): \"priority\" is a per-sender property and not\n // a per-encoding-layer property. So, we set the value only on the first\n // encoding layer. Any attempt to set the value on subsequent encoding\n // layers (in the case of simulcast) will result in the Promise returned\n // by RTCRtpSender.setParameters() being rejected. With this, audio encoding\n // is prioritized the most.\n params.encodings[0].priority = 'high';\n }\n else if (pcv2._isChromeScreenShareTrack(sender.track)) {\n // NOTE(mmalavalli): Screen share encodings are prioritized more than those\n // of the camera.\n params.encodings[0].priority = 'medium';\n }\n if (pcv2._enableDscp) {\n // NOTE(mmalavalli): \"networkPriority\" is a per-sender property and not\n // a per-encoding-layer property. So, we set the value only on the first\n // encoding layer. Any attempt to set the value on subsequent encoding\n // layers (in the case of simulcast) will result in the Promise returned\n // by RTCRtpSender.setParameters() being rejected.\n params.encodings[0].networkPriority = 'high';\n }\n }\n // when a sender is reused, delete any active encodings set by server.\n var trackReplaced = pcv2._rtpNewSenders.has(sender);\n pcv2._maybeUpdateEncodings(sender.track, params.encodings, trackReplaced);\n pcv2._rtpNewSenders.delete(sender);\n var promise = sender.setParameters(params).catch(function (error) {\n pcv2._log.warn(\"Error while setting encodings parameters for \" + sender.track.kind + \" Track \" + sender.track.id + \": \" + (error.message || error.name));\n });\n promises.push(promise);\n });\n return Promise.all(promises);\n}\n/**\n * Remove maxBitrate from the RTCRtpSendParameters' encodings.\n * @param {RTCRtpSendParameters} params\n * @returns {void}\n */\nfunction removeMaxBitrate(params) {\n if (Array.isArray(params.encodings)) {\n params.encodings.forEach(function (encoding) { return delete encoding.maxBitrate; });\n }\n}\n/**\n * Set the given maxBitrate in the RTCRtpSendParameters' encodings.\n * @param {RTCRtpSendParameters} params\n * @param {number} maxBitrate\n * @returns {void}\n */\nfunction setMaxBitrate(params, maxBitrate) {\n if (isFirefox) {\n params.encodings = [{ maxBitrate: maxBitrate }];\n }\n else {\n params.encodings.forEach(function (encoding) {\n encoding.maxBitrate = maxBitrate;\n });\n }\n}\nmodule.exports = PeerConnectionV2;\n//# sourceMappingURL=peerconnection.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar guessBrowser = require('../../webrtc/util').guessBrowser;\nvar PeerConnectionV2 = require('./peerconnection');\nvar MediaTrackSender = require('../../media/track/sender');\nvar QueueingEventEmitter = require('../../queueingeventemitter');\nvar util = require('../../util');\nvar MediaConnectionError = require('../../util/twilio-video-errors').MediaConnectionError;\nvar isFirefox = guessBrowser() === 'firefox';\n/**\n * {@link PeerConnectionManager} manages multiple {@link PeerConnectionV2}s.\n * @extends QueueingEventEmitter\n * @emits PeerConnectionManager#candidates\n * @emits PeerConnectionManager#connectionStateChanged\n * @emits PeerConnectionManager#description\n * @emits PeerConnectionManager#iceConnectionStateChanged\n * @emits PeerConnectionManager#trackAdded\n */\nvar PeerConnectionManager = /** @class */ (function (_super) {\n __extends(PeerConnectionManager, _super);\n /**\n * Construct {@link PeerConnectionManager}.\n * @param {EncodingParametersImpl} encodingParameters\n * @param {PreferredCodecs} preferredCodecs\n * @param {object} options\n */\n function PeerConnectionManager(encodingParameters, preferredCodecs, options) {\n var _this = _super.call(this) || this;\n options = Object.assign({\n audioContextFactory: isFirefox\n ? require('../../webaudio/audiocontext')\n : null,\n PeerConnectionV2: PeerConnectionV2\n }, options);\n var audioContext = options.audioContextFactory\n ? options.audioContextFactory.getOrCreate(_this)\n : null;\n // NOTE(mroberts): If we're using an AudioContext, we don't need to specify\n // `offerToReceiveAudio` in RTCOfferOptions.\n var offerOptions = audioContext\n ? { offerToReceiveVideo: true }\n : { offerToReceiveAudio: true, offerToReceiveVideo: true };\n Object.defineProperties(_this, {\n _audioContextFactory: {\n value: options.audioContextFactory\n },\n _closedPeerConnectionIds: {\n value: new Set()\n },\n _configuration: {\n writable: true,\n value: null\n },\n _configurationDeferred: {\n writable: true,\n value: util.defer()\n },\n _connectionState: {\n value: 'new',\n writable: true\n },\n _dummyAudioTrackSender: {\n value: audioContext\n ? new MediaTrackSender(createDummyAudioMediaStreamTrack(audioContext))\n : null\n },\n _encodingParameters: {\n value: encodingParameters\n },\n _iceConnectionState: {\n writable: true,\n value: 'new'\n },\n _dataTrackSenders: {\n writable: true,\n value: new Set()\n },\n _lastConnectionState: {\n value: 'new',\n writable: true\n },\n _lastIceConnectionState: {\n writable: true,\n value: 'new'\n },\n _mediaTrackSenders: {\n writable: true,\n value: new Set()\n },\n _offerOptions: {\n value: offerOptions\n },\n _peerConnections: {\n value: new Map()\n },\n _preferredCodecs: {\n value: preferredCodecs\n },\n _sessionTimeout: {\n value: null,\n writable: true\n },\n _PeerConnectionV2: {\n value: options.PeerConnectionV2\n }\n });\n return _this;\n }\n PeerConnectionManager.prototype.setEffectiveAdaptiveSimulcast = function (effectiveAdaptiveSimulcast) {\n this._peerConnections.forEach(function (pc) { return pc.setEffectiveAdaptiveSimulcast(effectiveAdaptiveSimulcast); });\n this._preferredCodecs.video.forEach(function (cs) {\n if ('adaptiveSimulcast' in cs) {\n cs.adaptiveSimulcast = effectiveAdaptiveSimulcast;\n }\n });\n };\n Object.defineProperty(PeerConnectionManager.prototype, \"connectionState\", {\n /**\n * A summarized RTCPeerConnectionState across all the\n * {@link PeerConnectionManager}'s underlying {@link PeerConnectionV2}s.\n * @property {RTCPeerConnectionState}\n */\n get: function () {\n return this._connectionState;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(PeerConnectionManager.prototype, \"iceConnectionState\", {\n /**\n * A summarized RTCIceConnectionState across all the\n * {@link PeerConnectionManager}'s underlying {@link PeerConnectionV2}s.\n * @property {RTCIceConnectionState}\n */\n get: function () {\n return this._iceConnectionState;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Close the {@link PeerConnectionV2}s which are no longer relevant.\n * @param {Array} peerConnectionStates\n * @returns {this}\n */\n PeerConnectionManager.prototype._closeAbsentPeerConnections = function (peerConnectionStates) {\n var peerConnectionIds = new Set(peerConnectionStates.map(function (peerConnectionState) { return peerConnectionState.id; }));\n this._peerConnections.forEach(function (peerConnection) {\n if (!peerConnectionIds.has(peerConnection.id)) {\n peerConnection._close();\n }\n });\n return this;\n };\n /**\n * Get the {@link PeerConnectionManager}'s configuration.\n * @private\n * @returns {Promise}\n */\n PeerConnectionManager.prototype._getConfiguration = function () {\n return this._configurationDeferred.promise;\n };\n /**\n * Get or create a {@link PeerConnectionV2}.\n * @private\n * @param {string} id\n * @param {object} [configuration]\n * @returns {PeerConnectionV2}\n */\n PeerConnectionManager.prototype._getOrCreate = function (id, configuration) {\n var _this = this;\n var self = this;\n var peerConnection = this._peerConnections.get(id);\n if (!peerConnection) {\n var PeerConnectionV2_1 = this._PeerConnectionV2;\n var options = Object.assign({\n dummyAudioMediaStreamTrack: this._dummyAudioTrackSender\n ? this._dummyAudioTrackSender.track\n : null,\n offerOptions: this._offerOptions\n }, this._sessionTimeout ? {\n sessionTimeout: this._sessionTimeout\n } : {}, configuration);\n try {\n peerConnection = new PeerConnectionV2_1(id, this._encodingParameters, this._preferredCodecs, options);\n }\n catch (e) {\n throw new MediaConnectionError();\n }\n this._peerConnections.set(peerConnection.id, peerConnection);\n peerConnection.on('candidates', this.queue.bind(this, 'candidates'));\n peerConnection.on('description', this.queue.bind(this, 'description'));\n peerConnection.on('trackAdded', this.queue.bind(this, 'trackAdded'));\n peerConnection.on('stateChanged', function stateChanged(state) {\n if (state === 'closed') {\n peerConnection.removeListener('stateChanged', stateChanged);\n self._dataTrackSenders.forEach(function (sender) { return peerConnection.removeDataTrackSender(sender); });\n self._mediaTrackSenders.forEach(function (sender) { return peerConnection.removeMediaTrackSender(sender); });\n self._peerConnections.delete(peerConnection.id);\n self._closedPeerConnectionIds.add(peerConnection.id);\n updateConnectionState(self);\n updateIceConnectionState(self);\n }\n });\n peerConnection.on('connectionStateChanged', function () { return updateConnectionState(_this); });\n peerConnection.on('iceConnectionStateChanged', function () { return updateIceConnectionState(_this); });\n this._dataTrackSenders.forEach(peerConnection.addDataTrackSender, peerConnection);\n this._mediaTrackSenders.forEach(peerConnection.addMediaTrackSender, peerConnection);\n updateIceConnectionState(this);\n }\n return peerConnection;\n };\n /**\n * Close all the {@link PeerConnectionV2}s in this {@link PeerConnectionManager}.\n * @returns {this}\n */\n PeerConnectionManager.prototype.close = function () {\n this._peerConnections.forEach(function (peerConnection) {\n peerConnection.close();\n });\n if (this._dummyAudioTrackSender) {\n this._dummyAudioTrackSender.stop();\n }\n if (this._audioContextFactory) {\n this._audioContextFactory.release(this);\n }\n updateIceConnectionState(this);\n return this;\n };\n /**\n * Create a new {@link PeerConnectionV2} on this {@link PeerConnectionManager}.\n * Then, create a new offer with the newly-created {@link PeerConnectionV2}.\n * @return {Promise}\n */\n PeerConnectionManager.prototype.createAndOffer = function () {\n var _this = this;\n return this._getConfiguration().then(function (configuration) {\n var id;\n do {\n id = util.makeUUID();\n } while (_this._peerConnections.has(id));\n return _this._getOrCreate(id, configuration);\n }).then(function (peerConnection) {\n return peerConnection.offer();\n }).then(function () {\n return _this;\n });\n };\n /**\n * Get the {@link DataTrackReceiver}s and {@link MediaTrackReceiver}s of all\n * the {@link PeerConnectionV2}s.\n * @returns {Array} trackReceivers\n */\n PeerConnectionManager.prototype.getTrackReceivers = function () {\n return util.flatMap(this._peerConnections, function (peerConnection) { return peerConnection.getTrackReceivers(); });\n };\n /**\n * Get the states of all {@link PeerConnectionV2}s.\n * @returns {Array}\n */\n PeerConnectionManager.prototype.getStates = function () {\n var peerConnectionStates = [];\n this._peerConnections.forEach(function (peerConnection) {\n var peerConnectionState = peerConnection.getState();\n if (peerConnectionState) {\n peerConnectionStates.push(peerConnectionState);\n }\n });\n return peerConnectionStates;\n };\n /**\n * Set the {@link PeerConnectionManager}'s configuration.\n * @param {object} configuration\n * @returns {this}\n */\n PeerConnectionManager.prototype.setConfiguration = function (configuration) {\n if (this._configuration) {\n this._configurationDeferred = util.defer();\n this._peerConnections.forEach(function (peerConnection) {\n peerConnection.setConfiguration(configuration);\n });\n }\n this._configuration = configuration;\n this._configurationDeferred.resolve(configuration);\n return this;\n };\n /**\n * Set the ICE reconnect timeout period for all {@link PeerConnectionV2}s.\n * @param {number} period - Period in milliseconds.\n * @returns {this}\n */\n PeerConnectionManager.prototype.setIceReconnectTimeout = function (period) {\n if (this._sessionTimeout === null) {\n this._peerConnections.forEach(function (peerConnection) {\n peerConnection.setIceReconnectTimeout(period);\n });\n this._sessionTimeout = period;\n }\n return this;\n };\n /**\n * Set the {@link DataTrackSender}s and {@link MediaTrackSender}s on the\n * {@link PeerConnectionManager}'s underlying {@link PeerConnectionV2}s.\n * @param {Array} trackSenders\n * @returns {this}\n */\n PeerConnectionManager.prototype.setTrackSenders = function (trackSenders) {\n var dataTrackSenders = new Set(trackSenders.filter(function (trackSender) { return trackSender.kind === 'data'; }));\n var mediaTrackSenders = new Set(trackSenders\n .filter(function (trackSender) { return trackSender && (trackSender.kind === 'audio' || trackSender.kind === 'video'); }));\n var changes = getTrackSenderChanges(this, dataTrackSenders, mediaTrackSenders);\n this._dataTrackSenders = dataTrackSenders;\n this._mediaTrackSenders = mediaTrackSenders;\n applyTrackSenderChanges(this, changes);\n return this;\n };\n /**\n * Update the {@link PeerConnectionManager}.\n * @param {Array} peerConnectionStates\n * @param {boolean} [synced=false]\n * @returns {Promise}\n */\n PeerConnectionManager.prototype.update = function (peerConnectionStates, synced) {\n var _this = this;\n if (synced === void 0) { synced = false; }\n if (synced) {\n this._closeAbsentPeerConnections(peerConnectionStates);\n }\n return this._getConfiguration().then(function (configuration) {\n return Promise.all(peerConnectionStates.map(function (peerConnectionState) {\n if (_this._closedPeerConnectionIds.has(peerConnectionState.id)) {\n return null;\n }\n var peerConnection = _this._getOrCreate(peerConnectionState.id, configuration);\n return peerConnection.update(peerConnectionState);\n }));\n }).then(function () {\n return _this;\n });\n };\n /**\n * Get the {@link PeerConnectionManager}'s media statistics.\n * @returns {Promise.>}\n */\n PeerConnectionManager.prototype.getStats = function () {\n var peerConnections = Array.from(this._peerConnections.values());\n return Promise.all(peerConnections.map(function (peerConnection) { return peerConnection.getStats().then(function (response) { return [\n peerConnection.id,\n response\n ]; }); })).then(function (responses) { return new Map(responses); });\n };\n return PeerConnectionManager;\n}(QueueingEventEmitter));\n/**\n * Create a dummy audio MediaStreamTrack with the given AudioContext.\n * @private\n * @param {AudioContext} audioContext\n * @return {MediaStreamTrack}\n */\nfunction createDummyAudioMediaStreamTrack(audioContext) {\n var mediaStreamDestination = audioContext.createMediaStreamDestination();\n return mediaStreamDestination.stream.getAudioTracks()[0];\n}\n/**\n * @event {PeerConnectionManager#candidates}\n * @param {object} candidates\n */\n/**\n * @event {PeerConnectionManager#connectionStateChanged}\n */\n/**\n * @event {PeerConnectionManager#description}\n * @param {object} description\n */\n/**\n * @event {PeerConnectionManager#iceConnectionStateChanged}\n */\n/**\n * @event {PeerConnectionManager#trackAdded}\n * @param {MediaStreamTrack|DataTrackReceiver} mediaStreamTrackOrDataTrackReceiver\n */\n/**\n * Apply {@link TrackSenderChanges}.\n * @param {PeerConnectionManager} peerConnectionManager\n * @param {TrackSenderChanges} changes\n * @returns {void}\n */\nfunction applyTrackSenderChanges(peerConnectionManager, changes) {\n if (changes.data.add.size\n || changes.data.remove.size\n || changes.media.add.size\n || changes.media.remove.size) {\n peerConnectionManager._peerConnections.forEach(function (peerConnection) {\n changes.data.remove.forEach(peerConnection.removeDataTrackSender, peerConnection);\n changes.media.remove.forEach(peerConnection.removeMediaTrackSender, peerConnection);\n changes.data.add.forEach(peerConnection.addDataTrackSender, peerConnection);\n changes.media.add.forEach(peerConnection.addMediaTrackSender, peerConnection);\n if (changes.media.add.size\n || changes.media.remove.size\n || (changes.data.add.size && !peerConnection.isApplicationSectionNegotiated)) {\n peerConnection.offer();\n }\n });\n }\n}\n/**\n * @interface DataTrackSenderChanges\n * @property {Set} add\n * @property {Set} remove\n */\n/**\n * Get the {@Link DataTrackSender} changes.\n * @param {PeerConnectionManager} peerConnectionManager\n * @param {Array} dataTrackSenders\n * @returns {DataTrackSenderChanges} changes\n */\nfunction getDataTrackSenderChanges(peerConnectionManager, dataTrackSenders) {\n var dataTrackSendersToAdd = util.difference(dataTrackSenders, peerConnectionManager._dataTrackSenders);\n var dataTrackSendersToRemove = util.difference(peerConnectionManager._dataTrackSenders, dataTrackSenders);\n return {\n add: dataTrackSendersToAdd,\n remove: dataTrackSendersToRemove\n };\n}\n/**\n * @interface TrackSenderChanges\n * @property {DataTrackSenderChanges} data\n * @property {MediaTrackSenderChanges} media\n */\n/**\n * Get {@link DataTrackSender} and {@link MediaTrackSender} changes.\n * @param {PeerConnectionManager} peerConnectionManager\n * @param {Array} dataTrackSenders\n * @param {Array} mediaTrackSenders\n * @returns {TrackSenderChanges} changes\n */\nfunction getTrackSenderChanges(peerConnectionManager, dataTrackSenders, mediaTrackSenders) {\n return {\n data: getDataTrackSenderChanges(peerConnectionManager, dataTrackSenders),\n media: getMediaTrackSenderChanges(peerConnectionManager, mediaTrackSenders)\n };\n}\n/**\n * @interface MediaTrackSenderChanges\n * @property {Set} add\n * @property {Set} remove\n */\n/**\n * Get the {@link MediaTrackSender} changes.\n * @param {PeerConnectionManager} peerConnectionManager\n * @param {Array} mediaTrackSenders\n * @returns {MediaTrackSenderChanges} changes\n */\nfunction getMediaTrackSenderChanges(peerConnectionManager, mediaTrackSenders) {\n var mediaTrackSendersToAdd = util.difference(mediaTrackSenders, peerConnectionManager._mediaTrackSenders);\n var mediaTrackSendersToRemove = util.difference(peerConnectionManager._mediaTrackSenders, mediaTrackSenders);\n return {\n add: mediaTrackSendersToAdd,\n remove: mediaTrackSendersToRemove\n };\n}\n/**\n * This object maps RTCIceConnectionState and RTCPeerConnectionState values to a \"rank\".\n */\nvar toRank = {\n new: 0,\n checking: 1,\n connecting: 2,\n connected: 3,\n completed: 4,\n disconnected: -1,\n failed: -2,\n closed: -3\n};\n/**\n * This object maps \"rank\" back to RTCIceConnectionState or RTCPeerConnectionState values.\n */\nvar fromRank;\n/**\n * `Object.keys` is not supported in older browsers, so we can't just\n * synchronously call it in this module; we need to defer invoking it until we\n * know we're in a modern environment (i.e., anything that supports WebRTC).\n * @returns {object} fromRank\n */\nfunction createFromRank() {\n return Object.keys(toRank).reduce(function (fromRank, state) {\n var _a;\n return Object.assign(fromRank, (_a = {}, _a[toRank[state]] = state, _a));\n }, {});\n}\n/**\n * Summarize RTCIceConnectionStates or RTCPeerConnectionStates.\n * @param {Array|Array} states\n * @returns {RTCIceConnectionState|RTCPeerConnectionState} summary\n */\nfunction summarizeIceOrPeerConnectionStates(states) {\n if (!states.length) {\n return 'new';\n }\n fromRank = fromRank || createFromRank();\n return states.reduce(function (state1, state2) {\n return fromRank[Math.max(toRank[state1], toRank[state2])];\n });\n}\n/**\n * Update the {@link PeerConnectionManager}'s `iceConnectionState`, and emit an\n * \"iceConnectionStateChanged\" event, if necessary.\n * @param {PeerConnectionManager} pcm\n * @returns {void}\n */\nfunction updateIceConnectionState(pcm) {\n pcm._lastIceConnectionState = pcm.iceConnectionState;\n pcm._iceConnectionState = summarizeIceOrPeerConnectionStates(__spreadArray([], __read(pcm._peerConnections.values())).map(function (pcv2) { return pcv2.iceConnectionState; }));\n if (pcm.iceConnectionState !== pcm._lastIceConnectionState) {\n pcm.emit('iceConnectionStateChanged');\n }\n}\n/**\n * Update the {@link PeerConnectionManager}'s `connectionState`, and emit a\n * \"connectionStateChanged\" event, if necessary.\n * @param {PeerConnectionManager} pcm\n * @returns {void}\n */\nfunction updateConnectionState(pcm) {\n pcm._lastConnectionState = pcm.connectionState;\n pcm._connectionState = summarizeIceOrPeerConnectionStates(__spreadArray([], __read(pcm._peerConnections.values())).map(function (pcv2) { return pcv2.connectionState; }));\n if (pcm.connectionState !== pcm._lastConnectionState) {\n pcm.emit('connectionStateChanged');\n }\n}\nmodule.exports = PeerConnectionManager;\n//# sourceMappingURL=peerconnectionmanager.js.map","/* eslint callback-return:0 */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar EventEmitter = require('events');\nvar nInstances = 0;\nvar MediaSignaling = /** @class */ (function (_super) {\n __extends(MediaSignaling, _super);\n /**\n * Construct a {@link MediaSignaling}.\n * @param {Promise} getReceive\n * @param {string} channel\n */\n function MediaSignaling(getReceiver, channel, options) {\n var _this = _super.call(this) || this;\n Object.defineProperties(_this, {\n _instanceId: {\n value: nInstances++\n },\n channel: {\n value: channel,\n },\n _log: {\n value: options.log.createLog('default', _this)\n },\n _getReceiver: {\n value: getReceiver\n },\n _receiverPromise: {\n value: null,\n writable: true,\n },\n _transport: {\n value: null,\n writable: true\n }\n });\n return _this;\n }\n Object.defineProperty(MediaSignaling.prototype, \"isSetup\", {\n get: function () {\n return !!this._receiverPromise;\n },\n enumerable: false,\n configurable: true\n });\n MediaSignaling.prototype.toString = function () {\n return \"[MediaSignaling #\" + this._instanceId + \":\" + this.channel + \"]\";\n };\n MediaSignaling.prototype.setup = function (id) {\n var _this = this;\n this._teardown();\n this._log.info('setting up msp transport for id:', id);\n var receiverPromise = this._getReceiver(id).then(function (receiver) {\n if (receiver.kind !== 'data') {\n _this._log.error('Expected a DataTrackReceiver');\n }\n if (_this._receiverPromise !== receiverPromise) {\n return;\n }\n try {\n _this._transport = receiver.toDataTransport();\n _this.emit('ready', _this._transport);\n }\n catch (ex) {\n _this._log.error(\"Failed to toDataTransport: \" + ex.message);\n }\n receiver.once('close', function () { return _this._teardown(); });\n });\n this._receiverPromise = receiverPromise;\n };\n MediaSignaling.prototype._teardown = function () {\n if (this._transport) {\n this._log.info('Tearing down');\n this._transport = null;\n this._receiverPromise = null;\n this.emit('teardown');\n }\n };\n return MediaSignaling;\n}(EventEmitter));\nmodule.exports = MediaSignaling;\n//# sourceMappingURL=mediasignaling.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar MediaSignaling = require('./mediasignaling');\n/**\n * @property {?Track.SID} loudestParticipantSid\n * @emits DominantSpeakerSignaling#updated\n */\nvar DominantSpeakerSignaling = /** @class */ (function (_super) {\n __extends(DominantSpeakerSignaling, _super);\n /**\n * Construct an {@link DominantSpeakerSignaling}.\n */\n function DominantSpeakerSignaling(getReceiver, options) {\n var _this = _super.call(this, getReceiver, 'active_speaker', options) || this;\n Object.defineProperties(_this, {\n _loudestParticipantSid: {\n value: null,\n writable: true\n },\n });\n _this.on('ready', function (transport) {\n transport.on('message', function (message) {\n switch (message.type) {\n case 'active_speaker':\n _this._setLoudestParticipantSid(message.participant);\n break;\n default:\n break;\n }\n });\n });\n return _this;\n }\n Object.defineProperty(DominantSpeakerSignaling.prototype, \"loudestParticipantSid\", {\n /**\n * Get the loudest {@link Track.SID}, if known.\n * @returns {?Track.SID}\n */\n get: function () {\n return this._loudestParticipantSid;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * @private\n * @param {Track.SID} loudestParticipantSid\n * @returns {void}\n */\n DominantSpeakerSignaling.prototype._setLoudestParticipantSid = function (loudestParticipantSid) {\n if (this.loudestParticipantSid === loudestParticipantSid) {\n return;\n }\n this._loudestParticipantSid = loudestParticipantSid;\n this.emit('updated');\n };\n return DominantSpeakerSignaling;\n}(MediaSignaling));\n/**\n * @event DominantSpeakerSignaling#updated\n */\nmodule.exports = DominantSpeakerSignaling;\n//# sourceMappingURL=dominantspeakersignaling.js.map","'use strict';\n/**\n * @property {number} [availableSend] - bps (undefined in Firefox)\n * @property {number} recv - bps\n * @property {number} [rtt] - s (undefined in Firefox)\n * @property {number} send - bps\n */\nvar IceReport = /** @class */ (function () {\n /**\n * Construct an {@link IceReport}.\n * @param {number} send - bps\n * @param {number} recv - bps\n * @param {number} [rtt] - s\n * @param {number} [availableSend] - bps\n */\n function IceReport(send, recv, availableSend, rtt) {\n Object.defineProperties(this, {\n availableSend: {\n enumerable: true,\n value: availableSend\n },\n recv: {\n enumerable: true,\n value: recv\n },\n rtt: {\n enumerable: true,\n value: rtt\n },\n send: {\n enumerable: true,\n value: send\n }\n });\n }\n /**\n * @param {RTCStats} olderStats\n * @param {RTCStats} newerStats\n * @returns {IceReport}\n */\n IceReport.of = function (olderStats, newerStats) {\n var secondsElapsed = (newerStats.timestamp - olderStats.timestamp) / 1000;\n var deltaBytesSent = newerStats.bytesSent - olderStats.bytesSent;\n var deltaBytesReceived = newerStats.bytesReceived - olderStats.bytesReceived;\n var send = secondsElapsed > 0\n ? (deltaBytesSent / secondsElapsed) * 8\n : 0;\n var recv = secondsElapsed > 0\n ? (deltaBytesReceived / secondsElapsed) * 8\n : 0;\n var availableSend = newerStats.availableOutgoingBitrate, rtt = newerStats.currentRoundTripTime;\n return new IceReport(send, recv, availableSend, rtt);\n };\n return IceReport;\n}());\nmodule.exports = IceReport;\n//# sourceMappingURL=icereport.js.map","'use strict';\nvar IceReport = require('./icereport');\n/**\n * @property {IceReport} lastReport\n * @property {?RTCStats} lastStats\n */\nvar IceReportFactory = /** @class */ (function () {\n /**\n * Construct an {@link IceReportFactory}.\n */\n function IceReportFactory() {\n Object.defineProperties(this, {\n lastReport: {\n enumerable: true,\n value: new IceReport(0, 0),\n writable: true\n },\n lastStats: {\n enumerable: true,\n value: null,\n writable: true\n }\n });\n }\n /**\n * Create an {@link IceReport}.\n * @param {RTCStats} newerStats;\n * @returns {IceReport}\n */\n IceReportFactory.prototype.next = function (newerStats) {\n var olderStats = this.lastStats;\n this.lastStats = newerStats;\n if (olderStats) {\n var report = olderStats.id === newerStats.id\n ? IceReport.of(olderStats, newerStats)\n : new IceReport(0, 0);\n this.lastReport = report;\n }\n return this.lastReport;\n };\n return IceReportFactory;\n}());\nmodule.exports = IceReportFactory;\n//# sourceMappingURL=icereportfactory.js.map","/* eslint no-undefined:0 */\n'use strict';\n/**\n * @param {Array} xs\n * @returns {number|undefined}\n */\nfunction average(xs) {\n xs = xs.filter(function (x) { return typeof x === 'number'; });\n return xs.length < 1 ? undefined : xs.reduce(function (y, x) { return x + y; }) / xs.length;\n}\nmodule.exports = average;\n//# sourceMappingURL=average.js.map","'use strict';\n/**\n * @property {StatsId} id\n * @property {TrackId} trackId\n * @property {number} bitrate - bps\n */\nvar SenderOrReceiverReport = /** @class */ (function () {\n /**\n * Construct a {@link SenderOrReceiverReport}.\n * @param {StatsId} id\n * @param {TrackId} trackId\n * @param {number} bitrate - bps\n */\n function SenderOrReceiverReport(id, trackId, bitrate) {\n Object.defineProperties(this, {\n id: {\n enumerable: true,\n value: id\n },\n trackId: {\n enumerable: true,\n value: trackId\n },\n bitrate: {\n enumerable: true,\n value: bitrate\n }\n });\n }\n return SenderOrReceiverReport;\n}());\nmodule.exports = SenderOrReceiverReport;\n//# sourceMappingURL=senderorreceiverreport.js.map","'use strict';\n/**\n * @param {Array} xs\n * @returns {number}\n */\nfunction sum(xs) {\n return xs.reduce(function (y, x) { return typeof x === 'number' ? x + y : y; }, 0);\n}\nmodule.exports = sum;\n//# sourceMappingURL=sum.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar average = require('./average');\nvar SenderOrReceiverReport = require('./senderorreceiverreport');\nvar sum = require('./sum');\n/**\n * @interface ReceiverSummary\n * @property {number} bitrate\n * @property {number} fractionLost - 0–1\n * @property {number} [jitter] - s (undefined for video tracks in Chrome)\n */\n/**\n * @extends SenderOrReceiverReport\n * @property {number} deltaPacketsLost\n * @property {number} deltaPacketsReceived\n * @property {number} [fractionLost] - 0–1 (undefined in Firefox)\n * @property {number} [jitter] - s (undefined for video tracks in Chrome)\n * @property {number} phonyPacketsLost - 0–1\n */\nvar ReceiverReport = /** @class */ (function (_super) {\n __extends(ReceiverReport, _super);\n /**\n * @param {StatsId} id\n * @param {TrackId} trackId\n * @param {number} bitrate - bps\n * @param {number} deltaPacketsLost\n * @param {number} deltaPacketsReceived\n * @param {number} [fractionLost] - 0–1 (undefined in Firefox)\n * @param {number} [jitter] - s (undefined for video tracks in Chrome)\n */\n function ReceiverReport(id, trackId, bitrate, deltaPacketsLost, deltaPacketsReceived, fractionLost, jitter) {\n var _this = _super.call(this, id, trackId, bitrate) || this;\n var phonyFractionLost = deltaPacketsReceived > 0\n ? deltaPacketsLost / deltaPacketsReceived\n : 0;\n Object.defineProperties(_this, {\n deltaPacketsLost: {\n enumerable: true,\n value: deltaPacketsLost\n },\n deltaPacketsReceived: {\n enumerable: true,\n value: deltaPacketsReceived\n },\n fractionLost: {\n enumerable: true,\n value: fractionLost\n },\n jitter: {\n enumerable: true,\n value: jitter\n },\n phonyFractionLost: {\n enumerable: true,\n value: phonyFractionLost\n }\n });\n return _this;\n }\n /**\n * Create a {@link ReceiverReport}.\n * @param {string} trackId\n * @param {RTCStats} olderStats\n * @param {RTCStats} newerStats\n * @returns {ReceiverReport}\n */\n ReceiverReport.of = function (trackId, olderStats, newerStats) {\n if (olderStats.id !== newerStats.id) {\n throw new Error('RTCStats IDs must match');\n }\n var secondsElapsed = (newerStats.timestamp - olderStats.timestamp) / 1000;\n var deltaBytesReceived = newerStats.bytesReceived - olderStats.bytesReceived;\n var bitrate = secondsElapsed > 0\n ? (deltaBytesReceived / secondsElapsed) * 8\n : 0;\n var deltaPacketsLost = Math.max(newerStats.packetsLost - olderStats.packetsLost, 0);\n var deltaPacketsReceived = newerStats.packetsReceived - olderStats.packetsReceived;\n var fractionLost = newerStats.fractionLost, jitter = newerStats.jitter;\n return new ReceiverReport(olderStats.id, trackId, bitrate, deltaPacketsLost, deltaPacketsReceived, fractionLost, jitter);\n };\n /**\n * Summarize {@link ReceiverReport}s by summing and averaging their values.\n * @param {Array} reports\n * @returns {ReceiverSummary}\n */\n ReceiverReport.summarize = function (reports) {\n var summaries = reports.map(function (report) { return report.summarize(); });\n var bitrate = sum(summaries.map(function (summary) { return summary.bitrate; }));\n var fractionLost = average(summaries.map(function (summary) { return summary.fractionLost; }));\n var jitter = average(summaries.map(function (summary) { return summary.jitter; }));\n return {\n bitrate: bitrate,\n fractionLost: fractionLost,\n jitter: jitter\n };\n };\n /**\n * Summarize the {@link ReceiveReport}.\n * @returns {ReceiverSummary}\n */\n ReceiverReport.prototype.summarize = function () {\n return {\n bitrate: this.bitrate,\n fractionLost: typeof this.fractionLost === 'number' ? this.fractionLost : this.phonyFractionLost,\n jitter: this.jitter\n };\n };\n return ReceiverReport;\n}(SenderOrReceiverReport));\nmodule.exports = ReceiverReport;\n//# sourceMappingURL=receiverreport.js.map","/* eslint no-undefined:0 */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar average = require('./average');\nvar SenderOrReceiverReport = require('./senderorreceiverreport');\nvar sum = require('./sum');\n/**\n * @interface SenderSummary\n * @property {number} bitrate\n * @property {number} [rtt] - s (undefined in Chrome)\n */\n/**\n * @extends SenderOrReceiverReport\n * @property {number} [rtt] - s (undefined in Chrome)\n */\nvar SenderReport = /** @class */ (function (_super) {\n __extends(SenderReport, _super);\n /**\n * Construct a {@link SenderReport}.\n * @param {StatsId} id\n * @param {TrackId} trackId\n * @param {number} bitrate - bps\n * @param {number} [rtt] - s\n */\n function SenderReport(id, trackId, bitrate, rtt) {\n var _this = _super.call(this, id, trackId, bitrate) || this;\n Object.defineProperties(_this, {\n rtt: {\n enumerable: true,\n value: rtt\n }\n });\n return _this;\n }\n /**\n * Create a {@link SenderReport}.\n * @param {string} trackId\n * @param {RTCStats} olderStats\n * @param {RTCStats} newerStats\n * @param {RTCRemoteInboundRtpStreamStats} [newerRemoteStats]\n * @returns {SenderReport}\n */\n SenderReport.of = function (trackId, olderStats, newerStats, newerRemoteStats) {\n if (olderStats.id !== newerStats.id) {\n throw new Error('RTCStats IDs must match');\n }\n var secondsElapsed = (newerStats.timestamp - olderStats.timestamp) / 1000;\n var deltaBytesSent = newerStats.bytesSent - olderStats.bytesSent;\n var bitrate = secondsElapsed > 0\n ? (deltaBytesSent / secondsElapsed) * 8\n : 0;\n var rtt = newerRemoteStats && typeof newerRemoteStats.roundTripTime === 'number'\n ? newerRemoteStats.roundTripTime / 1000\n : undefined;\n return new SenderReport(olderStats.id, trackId, bitrate, rtt);\n };\n /**\n * Summarize {@link SenderReport}s by summing and averaging their values.\n * @param {Array} reports\n * @returns {SenderSummary}\n */\n SenderReport.summarize = function (reports) {\n var bitrate = sum(reports.map(function (report) { return report.bitrate; }));\n var rtt = average(reports.map(function (report) { return report.rtt; }));\n return {\n bitrate: bitrate,\n rtt: rtt\n };\n };\n return SenderReport;\n}(SenderOrReceiverReport));\nmodule.exports = SenderReport;\n//# sourceMappingURL=senderreport.js.map","'use strict';\nvar ReceiverReport = require('./receiverreport');\nvar SenderReport = require('./senderreport');\n/**\n * @interface SenderAndReceiverReports\n * @property {Array} send\n * @property {Array} recv\n */\n/**\n * @interface SenderAndReceiverSummary\n * @property {SenderSummary} send\n * @property {ReceiverSummary} recv\n */\n/**\n * @interface PeerConnectionSummary\n * @property {IceReport} ice\n * @property {SenderSummary} send\n * @property {ReceiverSummary} recv\n * @property {SenderAndReceiverSummary} audio\n * @property {SenderAndReceiverSummary} video\n */\n/**\n * @property {IceReport} ice\n * @roperty {SenderAndReceiverReports} audio\n * @roperty {SenderAndReceiverReports} video\n */\nvar PeerConnectionReport = /** @class */ (function () {\n /**\n * Construct a {@link PeerConnectionReport}.\n * @param {IceReport} ice\n * @param {SenderAndReceiverReports} audio\n * @param {SenderAndReceiverReports} video\n */\n function PeerConnectionReport(ice, audio, video) {\n Object.defineProperties(this, {\n ice: {\n enumerable: true,\n value: ice\n },\n audio: {\n enumerable: true,\n value: audio\n },\n video: {\n enumerable: true,\n value: video\n }\n });\n }\n /**\n * Summarize the {@link PeerConnectionReport} by summarizing its\n * {@link SenderReport}s and {@link ReceiverReport}s.\n * @returns {PeerConnectionSummary}\n */\n PeerConnectionReport.prototype.summarize = function () {\n var senderReports = this.audio.send.concat(this.video.send);\n var send = SenderReport.summarize(senderReports);\n var receiverReports = this.audio.recv.concat(this.video.recv);\n var recv = ReceiverReport.summarize(receiverReports);\n return {\n ice: this.ice,\n send: send,\n recv: recv,\n audio: {\n send: SenderReport.summarize(this.audio.send),\n recv: ReceiverReport.summarize(this.audio.recv)\n },\n video: {\n send: SenderReport.summarize(this.video.send),\n recv: ReceiverReport.summarize(this.video.recv)\n }\n };\n };\n return PeerConnectionReport;\n}());\nmodule.exports = PeerConnectionReport;\n//# sourceMappingURL=peerconnectionreport.js.map","'use strict';\n/**\n * @property {StatsId} id\n * @property {TrackId} trackId\n * @property {RTCStats} lastStats\n */\nvar SenderOrReceiverReportFactory = /** @class */ (function () {\n /**\n * @param {StatsId} id\n * @param {TrackId} trackId\n * @param {RTCStats} initialStats\n */\n function SenderOrReceiverReportFactory(id, trackId, initialStats) {\n Object.defineProperties(this, {\n id: {\n enumerable: true,\n value: id,\n writable: true\n },\n trackId: {\n enumerable: true,\n value: trackId,\n writable: true\n },\n lastStats: {\n enumerable: true,\n value: initialStats,\n writable: true\n }\n });\n }\n return SenderOrReceiverReportFactory;\n}());\nmodule.exports = SenderOrReceiverReportFactory;\n//# sourceMappingURL=senderorreceiverreportfactory.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar ReceiverReport = require('./receiverreport');\nvar SenderOrReceiverReportFactory = require('./senderorreceiverreportfactory');\n/**\n * @extends SenderOrReceiverReportFactory\n * @param {?ReceiverReport} lastReport\n */\nvar ReceiverReportFactory = /** @class */ (function (_super) {\n __extends(ReceiverReportFactory, _super);\n /**\n * Construct a {@link ReceiverReportFactory}.\n * @param {TrackId} trackId\n * @param {RTCStats} initialStats\n */\n function ReceiverReportFactory(trackId, initialStats) {\n var _this = _super.call(this, initialStats.id, trackId, initialStats) || this;\n Object.defineProperties(_this, {\n lastReport: {\n enumerable: true,\n value: null,\n writable: true\n }\n });\n return _this;\n }\n /**\n * Create a {@link ReceiverReport}.\n * @param {TrackId} trackId\n * @param {RTCStats} newerStats\n * @returns {ReceiverReport}\n */\n ReceiverReportFactory.prototype.next = function (trackId, newerStats) {\n var olderStats = this.lastStats;\n this.lastStats = newerStats;\n this.trackId = trackId;\n var report = ReceiverReport.of(trackId, olderStats, newerStats);\n this.lastReport = report;\n return report;\n };\n return ReceiverReportFactory;\n}(SenderOrReceiverReportFactory));\nmodule.exports = ReceiverReportFactory;\n//# sourceMappingURL=receiverreportfactory.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar SenderOrReceiverReportFactory = require('./senderorreceiverreportfactory');\nvar SenderReport = require('./senderreport');\n/**\n * @extends {SenderOrReceiverReportFactory}\n * @property {?SenderReport} lastReport\n */\nvar SenderReportFactory = /** @class */ (function (_super) {\n __extends(SenderReportFactory, _super);\n /**\n * Construct a {@link SenderReportFactory}.\n * @param {TrackId} trackId\n * @param {RTCStats} initialStats\n */\n function SenderReportFactory(trackId, initialStats) {\n var _this = _super.call(this, initialStats.id, trackId, initialStats) || this;\n Object.defineProperties(_this, {\n lastReport: {\n enumerable: true,\n value: null,\n writable: true\n }\n });\n return _this;\n }\n /**\n * @param {TrackId} trackId\n * @param {RTCStats} newerStats\n * @param {RTCRemoteInboundRtpStreamStats} [newerRemoteStats]\n * @returns {SenderReport}\n */\n SenderReportFactory.prototype.next = function (trackId, newerStats, newerRemoteStats) {\n var olderStats = this.lastStats;\n this.lastStats = newerStats;\n this.trackId = trackId;\n var report = SenderReport.of(trackId, olderStats, newerStats, newerRemoteStats);\n this.lastReport = report;\n return report;\n };\n return SenderReportFactory;\n}(SenderOrReceiverReportFactory));\nmodule.exports = SenderReportFactory;\n//# sourceMappingURL=senderreportfactory.js.map","'use strict';\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nvar guessBrowser = require('../webrtc/util').guessBrowser;\nvar IceReportFactory = require('./icereportfactory');\nvar PeerConnectionReport = require('./peerconnectionreport');\nvar ReceiverReportFactory = require('./receiverreportfactory');\nvar SenderReportFactory = require('./senderreportfactory');\n/**\n * @typedef {string} TrackId\n */\n/**\n * @typedef {string} StatsId\n */\n/**\n * @interface SenderReportFactoriesByMediaType\n * @property {Map} audio\n * @property {Map} video\n */\n/**\n * @interface ReceiverReportFactoriesByMediaType\n * @property {Map} audio\n * @property {Map} video\n */\n/**\n * @interface SenderAndReceiverReportFactories\n * @property {Map} send\n * @property {Map} recv\n */\n/**\n * @interface {StatsIdsByMediaType}\n * @property {Set} audio\n * @property {Set} video\n */\n/**\n * @property {RTCPeerConnection} pc\n * @property {IceReportFactory} iceReportFactory\n * @property {SenderAndReceiverReportFactories} audio\n * @property {SenderAndReceiverReportFactories} video\n * @property {?PeerConnectionReport} lastReport\n */\nvar PeerConnectionReportFactory = /** @class */ (function () {\n /**\n * Construct a {@link PeerConnectionReportFactory}.\n * @param {RTCPeerConnection} pc\n */\n function PeerConnectionReportFactory(pc) {\n Object.defineProperties(this, {\n pc: {\n enumerable: true,\n value: pc\n },\n ice: {\n enumerable: true,\n value: new IceReportFactory()\n },\n audio: {\n enumerable: true,\n value: {\n send: new Map(),\n recv: new Map()\n }\n },\n video: {\n enumerable: true,\n value: {\n send: new Map(),\n recv: new Map()\n }\n },\n lastReport: {\n enumerable: true,\n value: null,\n writable: true\n }\n });\n }\n /**\n * Create a {@link PeerConnectionReport}.\n * @returns {Promise}\n */\n PeerConnectionReportFactory.prototype.next = function () {\n var _this = this;\n var updatePromise = guessBrowser() === 'firefox'\n ? updateFirefox(this)\n : updateChrome(this);\n return updatePromise.then(function () {\n var audioSenderReportFactories = __spreadArray([], __read(_this.audio.send.values()));\n var videoSenderReportFactories = __spreadArray([], __read(_this.video.send.values()));\n var audioReceiverReportFactories = __spreadArray([], __read(_this.audio.recv.values()));\n var videoReceiverReportFactories = __spreadArray([], __read(_this.video.recv.values()));\n var report = new PeerConnectionReport(_this.ice.lastReport, {\n send: audioSenderReportFactories.map(function (factory) { return factory.lastReport; }).filter(function (report) { return report; }),\n recv: audioReceiverReportFactories.map(function (factory) { return factory.lastReport; }).filter(function (report) { return report; })\n }, {\n send: videoSenderReportFactories.map(function (factory) { return factory.lastReport; }).filter(function (report) { return report; }),\n recv: videoReceiverReportFactories.map(function (factory) { return factory.lastReport; }).filter(function (report) { return report; })\n });\n _this.lastReport = report;\n return report;\n });\n };\n return PeerConnectionReportFactory;\n}());\n/**\n * Construct a Map from MediaStreamTrack Ids to RTCStatsReports.\n * @param {Array|Array} sendersOrReceivers - each\n * RTCRtpSender should have a non-null track\n * @returns {Promise>}\n */\nfunction getSenderOrReceiverReports(sendersOrReceivers) {\n return Promise.all(sendersOrReceivers.map(function (senderOrReceiver) {\n var trackId = senderOrReceiver.track.id;\n return senderOrReceiver.getStats().then(function (report) {\n var e_1, _a;\n try {\n // NOTE(mroberts): We have to rewrite Ids due to this bug:\n //\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1463430\n //\n for (var _b = __values(report.values()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var stats = _c.value;\n if (stats.type === 'inbound-rtp') {\n stats.id = trackId + \"-\" + stats.id;\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return [trackId, report];\n });\n })).then(function (pairs) { return new Map(pairs); });\n}\n/**\n * @param {SenderReportFactory.constructor} SenderReportFactory\n * @param {SenderReportFactoriesByMediaType} sendersByMediaType\n * @param {RTCStatsReport} report\n * @param {RTCStats} stats\n * @param {TrackId} [trackId]\n * @returns {?SenderReportFactory}\n */ /**\n* @param {ReceiverReportFactory.constructor} ReceiverReportFactory\n* @param {ReceiverReportFactoriesByMediaType} receiversByMediaType\n* @param {RTCStatsReport} report\n* @param {RTCStats} stats\n* @param {TrackId} [trackId]\n* @returns {?ReceiverReportFactory}\n*/\nfunction getOrCreateSenderOrReceiverReportFactory(SenderOrReceiverReportFactory, sendersOrReceiversByMediaType, report, stats, trackId) {\n var sendersOrReceivers = sendersOrReceiversByMediaType[stats.mediaType];\n if (!trackId) {\n var trackStats = report.get(stats.trackId);\n if (trackStats) {\n trackId = trackStats.trackIdentifier;\n }\n }\n if (sendersOrReceivers && trackId) {\n if (sendersOrReceivers.has(stats.id)) {\n return sendersOrReceivers.get(stats.id);\n }\n var senderOrReceiverFactory = new SenderOrReceiverReportFactory(trackId, stats);\n sendersOrReceivers.set(stats.id, senderOrReceiverFactory);\n }\n return null;\n}\n/**\n * @param {PeerConnectionReportFactory} factory\n * @returns {SenderReportFactoriesByMediaType}\n */\nfunction getSenderReportFactoriesByMediaType(factory) {\n return { audio: factory.audio.send, video: factory.video.send };\n}\n/**\n * @param {PeerConnectionReportFactory} factory\n * @returns {ReceiverReportFactoriesByMediaType}\n */\nfunction getReceiverReportFactoriesByMediaType(factory) {\n return { audio: factory.audio.recv, video: factory.video.recv };\n}\n/**\n * @param {PeerConnectionReportFactory} factory\n * @param {RTCStatsReport} report\n * @param {RTCStats} stats\n * @param {TrackId} [trackId]\n * @returns {?SenderReportFactory}\n */\nfunction getOrCreateSenderReportFactory(factory, report, stats, trackId) {\n return getOrCreateSenderOrReceiverReportFactory(SenderReportFactory, getSenderReportFactoriesByMediaType(factory), report, stats, trackId);\n}\n/**\n * @param {PeerConnectionReportFactory} factory\n * @param {RTCStatsReport} report\n * @param {RTCStats} stats\n * @param {TrackId} [trackId]\n * @returns {?ReceiverReportFactory}\n */\nfunction getOrCreateReceiverReportFactory(factory, report, stats, trackId) {\n return getOrCreateSenderOrReceiverReportFactory(ReceiverReportFactory, getReceiverReportFactoriesByMediaType(factory), report, stats, trackId);\n}\n/**\n * @param {PeerConnectionReportFactory} factory\n * @retuns {StatsIdsByMediaType}\n */\nfunction getSenderReportFactoryIdsByMediaType(factory) {\n return {\n audio: new Set(factory.audio.send.keys()),\n video: new Set(factory.video.send.keys())\n };\n}\n/**\n * @param {PeerConnectionReportFactory} factory\n * @retuns {StatsIdsByMediaType}\n */\nfunction getReceiverReportFactoryIdsByMediaType(factory) {\n return {\n audio: new Set(factory.audio.recv.keys()),\n video: new Set(factory.video.recv.keys())\n };\n}\n/**\n * @param {PeerConnectionReportFactory} factory\n * @param {RTCStatsReport} report\n * @param {StatsIdsByMediaType} senderReportFactoryIdsToDeleteByMediaType\n * @param {TrackId} [trackId]\n * @returns {void}\n */\nfunction updateSenderReports(factory, report, senderReportFactoryIdsToDeleteByMediaType, trackId) {\n var e_2, _a;\n try {\n for (var _b = __values(report.values()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var stats = _c.value;\n if (stats.type === 'outbound-rtp' && !stats.isRemote) {\n if (guessBrowser() !== 'firefox' && !stats.trackId) {\n continue;\n }\n var senderReportFactoryIdsToDelete = senderReportFactoryIdsToDeleteByMediaType[stats.mediaType];\n if (senderReportFactoryIdsToDelete) {\n senderReportFactoryIdsToDelete.delete(stats.id);\n }\n var senderReportFactory = getOrCreateSenderReportFactory(factory, report, stats, trackId);\n if (senderReportFactory) {\n var remoteInboundStats = report.get(stats.remoteId);\n senderReportFactory.next(trackId || senderReportFactory.trackId, stats, remoteInboundStats);\n }\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_2) throw e_2.error; }\n }\n}\n/**\n * @param {PeerConnectionReportFactory} factory\n * @param {RTCStatsReport} report\n * @param {StatsIdsByMediaType} receiverReportFactoryIdsToDeleteByMediaType\n * @param {TrackId} [trackId]\n * @returns {void}\n */\nfunction updateReceiverReports(factory, report, receiverReportFactoryIdsToDeleteByMediaType, trackId) {\n var e_3, _a;\n try {\n for (var _b = __values(report.values()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var stats = _c.value;\n if (stats.type === 'inbound-rtp' && !stats.isRemote) {\n var receiverReportFactoryIdsToDelete = receiverReportFactoryIdsToDeleteByMediaType[stats.mediaType];\n if (receiverReportFactoryIdsToDelete) {\n receiverReportFactoryIdsToDelete.delete(stats.id);\n }\n var receiverReportFactory = getOrCreateReceiverReportFactory(factory, report, stats, trackId);\n if (receiverReportFactory) {\n receiverReportFactory.next(trackId || receiverReportFactory.trackId, stats);\n }\n }\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n}\n/**\n * @param {SenderReportFactoriesByMediaType|ReceiverReportFactoriesByMediaType} senderOrReceiverReportFactoriesByMediaType\n * @param {StatsIdsByMediaType} senderOrReceiverReportFactoryIdsByMediaType\n * @returns {void}\n */\nfunction deleteSenderOrReceiverReportFactories(senderOrReceiverReportFactoriesByMediaType, senderOrReceiverReportFactoryIdsByMediaType) {\n var _loop_1 = function (mediaType) {\n var senderOrReceiverReportFactories = senderOrReceiverReportFactoriesByMediaType[mediaType];\n var senderOrReceiverReportFactoryIds = senderOrReceiverReportFactoryIdsByMediaType[mediaType];\n senderOrReceiverReportFactoryIds.forEach(function (senderOrReceiverReportFactoryId) { return senderOrReceiverReportFactories.delete(senderOrReceiverReportFactoryId); });\n };\n for (var mediaType in senderOrReceiverReportFactoryIdsByMediaType) {\n _loop_1(mediaType);\n }\n}\n/**\n * @param {IceReportFactory} ice\n * @param {RTCStatsReport} report\n * @returns {void}\n */\nfunction updateIceReport(ice, report) {\n var e_4, _a, e_5, _b;\n var selectedCandidatePair;\n try {\n for (var _c = __values(report.values()), _d = _c.next(); !_d.done; _d = _c.next()) {\n var stats = _d.value;\n if (stats.type === 'transport') {\n selectedCandidatePair = report.get(stats.selectedCandidatePairId);\n }\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_4) throw e_4.error; }\n }\n if (selectedCandidatePair) {\n ice.next(selectedCandidatePair);\n return;\n }\n try {\n for (var _e = __values(report.values()), _f = _e.next(); !_f.done; _f = _e.next()) {\n var stats = _f.value;\n if (stats.type === 'candidate-pair'\n && stats.nominated\n && ('selected' in stats ? stats.selected : true)) {\n ice.next(stats);\n }\n }\n }\n catch (e_5_1) { e_5 = { error: e_5_1 }; }\n finally {\n try {\n if (_f && !_f.done && (_b = _e.return)) _b.call(_e);\n }\n finally { if (e_5) throw e_5.error; }\n }\n}\n/**\n * @param {PeerConnectionReportFactory} factory\n * @returns {Promise}\n */\nfunction updateFirefox(factory) {\n var senders = factory.pc.getTransceivers()\n .filter(function (transceiver) { return transceiver.currentDirection && transceiver.currentDirection.match(/send/) && transceiver.sender.track; })\n .map(function (transceiver) { return transceiver.sender; });\n var receivers = factory.pc.getTransceivers()\n .filter(function (transceiver) { return transceiver.currentDirection && transceiver.currentDirection.match(/recv/); })\n .map(function (transceiver) { return transceiver.receiver; });\n return Promise.all([\n getSenderOrReceiverReports(senders),\n getSenderOrReceiverReports(receivers),\n factory.pc.getStats()\n ]).then(function (_a) {\n var _b = __read(_a, 3), senderReports = _b[0], receiverReports = _b[1], pcReport = _b[2];\n var senderReportFactoriesByMediaType = getSenderReportFactoriesByMediaType(factory);\n var senderReportFactoryIdsToDeleteByMediaType = getSenderReportFactoryIdsByMediaType(factory);\n senderReports.forEach(function (report, trackId) { return updateSenderReports(factory, report, senderReportFactoryIdsToDeleteByMediaType, trackId); });\n deleteSenderOrReceiverReportFactories(senderReportFactoriesByMediaType, senderReportFactoryIdsToDeleteByMediaType);\n var receiverReportFactoriesByMediaType = getReceiverReportFactoriesByMediaType(factory);\n var receiverReportFactoryIdsToDeleteByMediaType = getReceiverReportFactoryIdsByMediaType(factory);\n receiverReports.forEach(function (report, trackId) { return updateReceiverReports(factory, report, receiverReportFactoryIdsToDeleteByMediaType, trackId); });\n deleteSenderOrReceiverReportFactories(receiverReportFactoriesByMediaType, receiverReportFactoryIdsToDeleteByMediaType);\n updateIceReport(factory.ice, pcReport);\n });\n}\n/**\n * @param {PeerConnectionReportFactory} factory\n * @returns {Promise}\n */\nfunction updateChrome(factory) {\n return factory.pc.getStats().then(function (report) {\n var senderReportFactoriesByMediaType = getSenderReportFactoriesByMediaType(factory);\n var senderReportFactoryIdsToDeleteByMediaType = getSenderReportFactoryIdsByMediaType(factory);\n updateSenderReports(factory, report, senderReportFactoryIdsToDeleteByMediaType);\n deleteSenderOrReceiverReportFactories(senderReportFactoriesByMediaType, senderReportFactoryIdsToDeleteByMediaType);\n var receiverReportFactoriesByMediaType = getReceiverReportFactoriesByMediaType(factory);\n var receiverReportFactoryIdsToDeleteByMediaType = getReceiverReportFactoryIdsByMediaType(factory);\n updateReceiverReports(factory, report, receiverReportFactoryIdsToDeleteByMediaType);\n deleteSenderOrReceiverReportFactories(receiverReportFactoriesByMediaType, receiverReportFactoryIdsToDeleteByMediaType);\n updateIceReport(factory.ice, report);\n });\n}\nmodule.exports = PeerConnectionReportFactory;\n//# sourceMappingURL=peerconnectionreportfactory.js.map","/* eslint callback-return:0 */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar EventEmitter = require('events');\nvar PeerConnectionReportFactory = require('../../stats/peerconnectionreportfactory');\n/**\n * @emits NetworkQualityMonitor#updated\n */\nvar NetworkQualityMonitor = /** @class */ (function (_super) {\n __extends(NetworkQualityMonitor, _super);\n /**\n * Construct a {@link NetworkQualityMonitor}.\n * @param {PeerConnectionManager} manager\n * @param {NetworkQualitySignaling} signaling\n */\n function NetworkQualityMonitor(manager, signaling) {\n var _this = _super.call(this) || this;\n Object.defineProperties(_this, {\n _factories: {\n value: new WeakMap()\n },\n _manager: {\n value: manager\n },\n _signaling: {\n value: signaling\n }\n });\n signaling.on('updated', function () { return _this.emit('updated'); });\n return _this;\n }\n Object.defineProperty(NetworkQualityMonitor.prototype, \"level\", {\n /**\n * Get the current {@link NetworkQualityLevel}, if any.\n * @returns {?NetworkQualityLevel} level - initially null\n */\n get: function () {\n return this._signaling.level;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NetworkQualityMonitor.prototype, \"levels\", {\n /**\n * Get the current {@link NetworkQualityLevels}, if any.\n * @returns {?NetworkQualityLevels} levels - initially null\n */\n get: function () {\n return this._signaling.levels;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NetworkQualityMonitor.prototype, \"remoteLevels\", {\n /**\n * Get the current {@link NetworkQualityLevels} of remote participants, if any.\n * @returns {Map} remoteLevels\n */\n get: function () {\n return this._signaling.remoteLevels;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Start monitoring.\n * @returns {void}\n */\n NetworkQualityMonitor.prototype.start = function () {\n var _this = this;\n this.stop();\n var timeout = setTimeout(function () {\n if (_this._timeout !== timeout) {\n return;\n }\n next(_this).then(function (reports) {\n if (_this._timeout !== timeout) {\n return;\n }\n if (reports.length) {\n var _a = __read(reports, 1), report = _a[0];\n _this._signaling.put(report);\n }\n _this.start();\n });\n }, 200);\n this._timeout = timeout;\n };\n /**\n * Stop monitoring.\n * @returns {void}\n */\n NetworkQualityMonitor.prototype.stop = function () {\n clearTimeout(this._timeout);\n this._timeout = null;\n };\n return NetworkQualityMonitor;\n}(EventEmitter));\n/**\n * @param {NetworkQualityMonitor}\n * @returns {Promise}\n */\nfunction next(monitor) {\n var pcv2s = monitor._manager._peerConnections\n ? Array.from(monitor._manager._peerConnections.values())\n : [];\n var pcs = pcv2s\n .map(function (pcv2) { return pcv2._peerConnection; })\n .filter(function (pc) { return pc.signalingState !== 'closed'; });\n var factories = pcs.map(function (pc) {\n if (monitor._factories.has(pc)) {\n return monitor._factories.get(pc);\n }\n var factory = new PeerConnectionReportFactory(pc);\n monitor._factories.set(pc, factory);\n return factory;\n });\n var reportsOrNullPromises = factories.map(function (factory) { return factory.next().catch(function () { return null; }); });\n return Promise.all(reportsOrNullPromises).then(function (reportsOrNull) { return reportsOrNull\n .filter(function (reportOrNull) { return reportOrNull; })\n .map(function (report) { return report.summarize(); }); });\n}\n/**\n * The {@link NetworkQualityLevel} changed.\n * @event NetworkQualityMonitor#updated\n */\nmodule.exports = NetworkQualityMonitor;\n//# sourceMappingURL=networkqualitymonitor.js.map","'use strict';\nvar defer = require('./').defer;\n/**\n * An {@link AsyncVar} is an \"asynchronous variable\" which may or may not\n * contain a value of some type T. You can put a value into the {@link AsyncVar}\n * with {@link AsyncVar#put}. Callers can take a value out of the\n * {@link AsyncVar} by queueing up with {@link AsyncVar#take}. N calls to\n * {@link AsyncVar#take} require N calls to {@link AsyncVar#put} to resolve, and\n * they resolve in order.\n */\nvar AsyncVar = /** @class */ (function () {\n /**\n * Construct an {@link AsyncVar}.\n */\n function AsyncVar() {\n Object.defineProperties(this, {\n _deferreds: {\n value: []\n },\n _hasValue: {\n value: false,\n writable: true\n },\n _value: {\n value: null,\n writable: true\n }\n });\n }\n /**\n * Put a value into the {@link AsyncVar}.\n * @param {T} value\n * @returns {this}\n */\n AsyncVar.prototype.put = function (value) {\n this._hasValue = true;\n this._value = value;\n var deferred = this._deferreds.shift();\n if (deferred) {\n deferred.resolve(value);\n }\n return this;\n };\n /**\n * Take the value out of the {@link AsyncVar}.\n * @returns {Promise}\n */\n AsyncVar.prototype.take = function () {\n var _this = this;\n if (this._hasValue && !this._deferreds.length) {\n this._hasValue = false;\n return Promise.resolve(this._value);\n }\n var deferred = defer();\n this._deferreds.push(deferred);\n return deferred.promise.then(function (value) {\n _this._hasValue = false;\n return value;\n });\n };\n return AsyncVar;\n}());\nmodule.exports = AsyncVar;\n//# sourceMappingURL=asyncvar.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar MediaSignaling = require('./mediasignaling');\nvar AsyncVar = require('../../util/asyncvar');\nvar Timeout = require('../../util/timeout');\nvar NETWORK_QUALITY_RESPONSE_TIME_MS = 5000;\n/**\n * @interface MediaSignalingTransport\n * @property {function(object): boolean} send\n * @emits MediaSignalingTransport#message\n */\n/**\n * The {@link MediaSignalingTransport} received a message.\n * @event MediaSignalingTransport#message\n * @param {object} message\n */\n/**\n * @interface LatencyStats\n * @property {number} jitter\n * @property {number} rtt\n * @property {number} level\n */\n/**\n * @interface FractionLostStats\n * @property {number} fractionLost\n * @property {number} level\n */\n/**\n * @interface BandwidthStats\n * @property {number} actual\n * @property {number} available\n * @property {number} level\n */\n/**\n * @interface SendOrRecvStats\n * @property {BandwidthStats} bandwidth\n * @property {FractionLostStats} fractionLost\n * @property {LatencyStats} latency\n */\n/**\n * @interface MediaLevels\n * @property {number} send\n * @property {SendOrRecvStats} sendStats\n * @property {number} recv\n * @property {SendOrRecvStats} recvStats\n */\n/**\n * @interface NetworkQualityLevels\n * @property {number} level\n * @property {MediaLevels} audio\n * @property {MediaLevels} video\n */\n/**\n * @typedef {PeerConnectionSummary} NetworkQualityInputs\n */\n/**\n * @classdesc The {@link NetworkQualitySignaling} class allows submitting\n * {@link NetworkQualityInputs} for computing {@link NetworkQualityLevel}. It\n * does so by sending and receiving messages over a\n * {@link MediaSignalingTransport}. The exact transport used depends on the\n * topology of the {@link Room} that {@link NetworkQualitySignaling} is being\n * used within: for P2P Rooms, we re-use the {@link TransportV2}; and for\n * Group Rooms, we use a {@link DataTransport}.\n * @emits NetworkQualitySignaling#updated\n */\nvar NetworkQualitySignaling = /** @class */ (function (_super) {\n __extends(NetworkQualitySignaling, _super);\n /**\n * Construct a {@link NetworkQualitySignaling}.\n * @param {Promise} getReceiver\n * @param {NetworkQualityConfigurationImpl} networkQualityConfiguration\n */\n function NetworkQualitySignaling(getReceiver, networkQualityConfiguration, options) {\n var _this = _super.call(this, getReceiver, 'network_quality', options) || this;\n Object.defineProperties(_this, {\n _level: {\n value: null,\n writable: true\n },\n _levels: {\n value: null,\n writable: true\n },\n _remoteLevels: {\n value: new Map(),\n writable: true\n },\n _networkQualityInputs: {\n value: new AsyncVar()\n },\n _resendTimer: {\n value: new Timeout(function () {\n // and schedule next timer at x1.5 the delay..\n _this._resendTimer.setDelay(_this._resendTimer.delay * 1.5);\n _this._sendNetworkQualityInputs();\n }, NETWORK_QUALITY_RESPONSE_TIME_MS, false),\n },\n _networkQualityReportLevels: {\n get: function () {\n return {\n reportLevel: networkQualityConfiguration.local,\n remoteReportLevel: networkQualityConfiguration.remote\n };\n }\n }\n });\n _this.on('ready', function (transport) {\n transport.on('message', function (message) {\n _this._log.debug('Incoming: ', message);\n switch (message.type) {\n case 'network_quality':\n _this._handleNetworkQualityMessage(message);\n break;\n default:\n break;\n }\n });\n });\n _this._sendNetworkQualityInputs();\n return _this;\n }\n Object.defineProperty(NetworkQualitySignaling.prototype, \"level\", {\n /**\n * Get the current {@link NetworkQualityLevel}, if any.\n * @returns {?NetworkQualityLevel} level - initially null\n */\n get: function () {\n return this._level;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NetworkQualitySignaling.prototype, \"levels\", {\n /**\n * Get the current {@link NetworkQualityLevels}, if any.\n * @returns {?NetworkQualityLevels} levels - initially null\n */\n get: function () {\n return this._levels;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(NetworkQualitySignaling.prototype, \"remoteLevels\", {\n /**\n * Get the current {@link NetworkQualityLevels} of remote participants, if any.\n * @returns {Map} remoteLevels\n */\n get: function () {\n return this._remoteLevels;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Check to see if the {@link NetworkQualityLevel} is new, and raise an\n * event if necessary.\n * @private\n * @param {object} message\n * @returns {void}\n */\n NetworkQualitySignaling.prototype._handleNetworkQualityMessage = function (message) {\n var _this = this;\n var updated = false;\n var level = null;\n var local = message ? message.local : null;\n if (typeof local === 'number') {\n // NOTE(mroberts): In prod, we plan to only send the level.\n level = local;\n this._levels = null;\n }\n else if (typeof local === 'object' && local) {\n // NOTE(mroberts): In dev, we plan to send the decomposed levels. An early\n // VMS version does not compute `level` for us, so we fallback to taking\n // the minimum ourselves.\n this._levels = local;\n level = typeof local.level === 'number'\n ? local.level\n : Math.min(local.audio.send, local.audio.recv, local.video.send, local.video.recv);\n }\n if (level !== null && this.level !== level) {\n this._level = level;\n updated = true;\n }\n this._remoteLevels = message && message.remotes\n ? message.remotes.reduce(function (levels, obj) {\n var oldObj = _this._remoteLevels.get(obj.sid) || {};\n if (oldObj.level !== obj.level) {\n updated = true;\n }\n return levels.set(obj.sid, obj);\n }, new Map())\n : this._remoteLevels;\n if (updated) {\n this.emit('updated');\n }\n // score is received. so reset the timer to default timeout.\n this._resendTimer.setDelay(NETWORK_QUALITY_RESPONSE_TIME_MS);\n // timer is cleared only while we are sending inputs.\n // if we are already sending inputs do not send them again.\n if (this._resendTimer.isSet) {\n setTimeout(function () { return _this._sendNetworkQualityInputs(); }, 1000);\n }\n };\n /**\n * Start sending {@link NetworkQualityInputs}.\n * @private\n * @returns {Promise}\n */\n NetworkQualitySignaling.prototype._sendNetworkQualityInputs = function () {\n var _this = this;\n this._resendTimer.clear();\n return this._networkQualityInputs.take().then(function (networkQualityInputs) {\n if (_this._transport) {\n _this._transport.publish(createNetworkQualityInputsMessage(networkQualityInputs, _this._networkQualityReportLevels));\n }\n }).finally(function () {\n _this._resendTimer.start();\n });\n };\n /**\n * Put {@link NetworkQualityInputs} to be used for computing\n * {@link NetworkQualityLevel}.\n * @param {NetworkQualityInputs} networkQualityInputs\n * @returns {void}\n */\n NetworkQualitySignaling.prototype.put = function (networkQualityInputs) {\n this._networkQualityInputs.put(networkQualityInputs);\n };\n return NetworkQualitySignaling;\n}(MediaSignaling));\n/**\n * The {@link NetworkQualityLevel} changed.\n * @event NetworkQualitySignaling#updated\n */\n/**\n * @typedef {object} NetworkQualityReportLevels\n * @param {number} reportLevel\n * @param {number} remoteReportLevel\n */\n/**\n * @param {NetworkQualityInputs} networkQualityInputs\n * @param {NetworkQualityReportLevels} networkQualityReportLevels\n * @returns {object} message\n */\nfunction createNetworkQualityInputsMessage(networkQualityInputs, networkQualityReportLevels) {\n return Object.assign({ type: 'network_quality' }, networkQualityInputs, networkQualityReportLevels);\n}\nmodule.exports = NetworkQualitySignaling;\n//# sourceMappingURL=networkqualitysignaling.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar EventEmitter = require('events').EventEmitter;\n/**\n * Represents recording state\n * @extends EventEmitter\n * @property {?boolean} isEnabled\n */\nvar RecordingSignaling = /** @class */ (function (_super) {\n __extends(RecordingSignaling, _super);\n /**\n * Construct a {@link RecordingSignaling}.\n */\n function RecordingSignaling() {\n var _this = _super.call(this) || this;\n Object.defineProperties(_this, {\n _isEnabled: {\n value: null,\n writable: true\n },\n isEnabled: {\n enumerable: true,\n get: function () {\n return this._isEnabled;\n }\n }\n });\n return _this;\n }\n /**\n * Disable the {@link RecordingSignaling} if it is not already disabled.\n * @return {this}\n */\n RecordingSignaling.prototype.disable = function () {\n return this.enable(false);\n };\n /**\n * Enable (or disable) the {@link RecordingSignaling} if it is not already enabled\n * (or disabled).\n * @param {boolean} [enabled=true]\n * @return {this}\n */\n RecordingSignaling.prototype.enable = function (enabled) {\n enabled = typeof enabled === 'boolean' ? enabled : true;\n if (this.isEnabled !== enabled) {\n this._isEnabled = enabled;\n this.emit('updated');\n }\n return this;\n };\n return RecordingSignaling;\n}(EventEmitter));\n/**\n * Emitted whenever the {@link RecordingSignaling} is updated\n * @event RecordingSignaling#updated\n */\nmodule.exports = RecordingSignaling;\n//# sourceMappingURL=recording.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar RecordingSignaling = require('../recording');\n/**\n * @extends RecordingSignaling\n */\nvar RecordingV2 = /** @class */ (function (_super) {\n __extends(RecordingV2, _super);\n /**\n * Construct a {@link RecordingV2}.\n */\n function RecordingV2() {\n var _this = _super.call(this) || this;\n Object.defineProperties(_this, {\n _revision: {\n value: 1,\n writable: true\n }\n });\n return _this;\n }\n /**\n * Compare the {@link RecordingV2} to a {@link RecordingV2#Representation}\n * of itself and perform any updates necessary.\n * @param {RecordingV2#Representation} recording\n * @returns {this}\n * @fires RecordingSignaling#updated\n */\n RecordingV2.prototype.update = function (recording) {\n if (recording.revision < this._revision) {\n return this;\n }\n this._revision = recording.revision;\n return this.enable(recording.is_recording);\n };\n return RecordingV2;\n}(RecordingSignaling));\n/**\n * The Room Signaling Protocol (RSP) representation of a {@link RecordingV2}\n * @typedef {object} RecordingV2#Representation\n * @property {boolean} enabled\n * @property {number} revision\n */\nmodule.exports = RecordingV2;\n//# sourceMappingURL=recording.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar DefaultRecordingSignaling = require('./recording');\nvar StateMachine = require('../statemachine');\nvar DefaultTimeout = require('../util/timeout');\nvar buildLogLevels = require('../util').buildLogLevels;\nvar DEFAULT_LOG_LEVEL = require('../util/constants').DEFAULT_LOG_LEVEL;\nvar Log = require('../util/log');\nvar _a = require('../util/twilio-video-errors'), MediaConnectionError = _a.MediaConnectionError, MediaDTLSTransportFailedError = _a.MediaDTLSTransportFailedError, SignalingConnectionDisconnectedError = _a.SignalingConnectionDisconnectedError;\nvar nInstances = 0;\n/*\nRoomSignaling States\n-----------------------\n\n +-----------+ +--------------+\n | | | |\n | connected |---->| disconnected |\n | | | |\n +-----------+ +--------------+\n | ^ ^\n | | |\n | | +--------------+\n | +---| |\n | | reconnecting |\n +----->| |\n +--------------+\n\n*/\nvar states = {\n connected: [\n 'reconnecting',\n 'disconnected'\n ],\n reconnecting: [\n 'connected',\n 'disconnected'\n ],\n disconnected: []\n};\n/**\n * A {@link Room} implementation\n * @extends StateMachine\n * @property {RTCPeerConnectionState} connectionState\n * @property {?Participant.SID} dominantSpeakerSid\n * @property {ParticipantSignaling} localParticipant\n * @property {RTCIceConnectionState} iceConnectionState\n * @property {string} name\n * @property {Map} participants\n * @property {RecordingSignaling} recording\n * @property {Room.SID} sid\n * @property {string} state - \"connected\", \"reconnecting\", or \"disconnected\"\n * @property {string} signalingConnectionState - \"connected\",\n * \"reconnecting\", or \"disconnected\"\n * @emits RoomSignaling#connectionStateChanged\n * @emits RoomSignaling#dominantSpeakerChanged\n * @emits RoomSignaling#iceConnectionStateChanged\n * @emits RoomSignaling#signalingConnectionStateChanged\n */\nvar RoomSignaling = /** @class */ (function (_super) {\n __extends(RoomSignaling, _super);\n /**\n * Construct a {@link RoomSignaling}.\n * @param {ParticipantSignaling} localParticipant\n * @param {Room.SID} sid\n * @param {string} name\n * @param {object} options\n */\n function RoomSignaling(localParticipant, sid, name, options) {\n var _this = this;\n options = Object.assign({\n logLevel: DEFAULT_LOG_LEVEL,\n RecordingSignaling: DefaultRecordingSignaling,\n Timeout: DefaultTimeout\n }, options);\n var logLevels = buildLogLevels(options.logLevel);\n _this = _super.call(this, 'connected', states) || this;\n var RecordingSignaling = options.RecordingSignaling;\n var sessionTimeout = new options.Timeout(function () {\n _this._disconnect(_this._reconnectingError);\n }, options.sessionTimeout, false);\n Object.defineProperties(_this, {\n _instanceId: {\n value: nInstances++\n },\n _log: {\n value: options.log\n ? options.log.createLog('default', _this)\n : new Log('default', _this, logLevels, options.loggerName)\n },\n _mediaConnectionIsReconnecting: {\n writable: true,\n value: false\n },\n _options: {\n value: options\n },\n _reconnectingError: {\n value: null,\n writable: true\n },\n _sessionTimeout: {\n value: sessionTimeout\n },\n dominantSpeakerSid: {\n enumerable: true,\n value: null,\n writable: true\n },\n localParticipant: {\n enumerable: true,\n value: localParticipant\n },\n name: {\n enumerable: true,\n value: name\n },\n participants: {\n enumerable: true,\n value: new Map()\n },\n recording: {\n enumerable: true,\n value: new RecordingSignaling()\n },\n sid: {\n enumerable: true,\n value: sid\n }\n });\n _this.on('connectionStateChanged', function () {\n if (_this.connectionState === 'failed'\n && !['disconnected', 'failed'].includes(_this.iceConnectionState)) {\n _this._disconnect(new MediaDTLSTransportFailedError());\n }\n });\n _this.on('iceConnectionStateChanged', function () { return maybeUpdateState(_this); });\n _this.on('signalingConnectionStateChanged', function () { return maybeUpdateState(_this); });\n // NOTE(mmalavalli): In case \"iceConnectionState\" is already failed, update\n // the RoomSignaling state. setTimeout() ensures that the state is updated\n // after RoomV2's constructor is fully executed, thereby making \"signalingConnectionState\"\n // available here.\n setTimeout(function () { return maybeUpdateState(_this); });\n return _this;\n }\n /**\n * Disconnect, possibly with an Error.\n * @private\n * @param {Error} [error]\n * @returns {boolean}\n */\n RoomSignaling.prototype._disconnect = function (error) {\n if (this.state !== 'disconnected') {\n this.preempt('disconnected', null, [error]);\n return true;\n }\n return false;\n };\n RoomSignaling.prototype.toString = function () {\n return \"[RoomSignaling #\" + this._instanceId + \": \" + (this.localParticipant ? this.localParticipant.sid : 'null') + \"]\";\n };\n /**\n * Connect {@link RemoteParticipantSignaling} to the {@link RoomSignaling}.\n * @param {RemoteParticipantSignaling} participant\n * @returns {boolean}\n */\n RoomSignaling.prototype.connectParticipant = function (participant) {\n var self = this;\n if (participant.state === 'disconnected') {\n return false;\n }\n if (this.participants.has(participant.sid)) {\n return false;\n }\n this.participants.set(participant.sid, participant);\n participant.on('stateChanged', function stateChanged(state) {\n if (state === 'disconnected') {\n participant.removeListener('stateChanged', stateChanged);\n self.participants.delete(participant.sid);\n self.emit('participantDisconnected', participant);\n }\n });\n this.emit('participantConnected', participant);\n return true;\n };\n /**\n * Disconnect.\n * @returns {boolean}\n */\n RoomSignaling.prototype.disconnect = function () {\n return this._disconnect();\n };\n /**\n * Set (or unset) the Dominant Speaker.\n * @param {?Participant.SID} dominantSpeakerSid\n * @returns {void}\n */\n RoomSignaling.prototype.setDominantSpeaker = function (dominantSpeakerSid) {\n this.dominantSpeakerSid = dominantSpeakerSid;\n this.emit('dominantSpeakerChanged');\n };\n return RoomSignaling;\n}(StateMachine));\n/**\n * @event RoomSignaling#event:connectionStateChanged\n */\n/**\n * @event RoomSignaling#event:dominantSpeakerChanged\n */\n/**\n * {@link RemoteParticipantSignaling} connected to the {@link RoomSignaling}.\n * @event RoomSignaling#event:participantConnected\n * @param {RemoteParticipantSignaling} participantSignaling\n */\n/**\n * {@link RemoteParticipantSignaling} disconnected from the {@link RoomSignaling}.\n * @event RoomSignaling#event:participantDisconnected\n * @param {RemoteParticipantSignaling} participantSignaling\n */\n/**\n * @event RoomSignaling#event:iceConnectionStateChanged\n */\n/**\n * @event RoomSignaling#event:signalingConnectionStateChanged\n */\n/**\n * Maybe update the {@link RoomSignaling} state.\n * @param {RoomSignaling} roomSignaling\n */\nfunction maybeUpdateState(roomSignaling) {\n if (roomSignaling.state === 'disconnected' || roomSignaling.signalingConnectionState === 'disconnected') {\n roomSignaling._sessionTimeout.clear();\n return;\n }\n var newState;\n if (roomSignaling.signalingConnectionState === 'reconnecting') {\n newState = roomSignaling.signalingConnectionState;\n }\n else if (roomSignaling.iceConnectionState === 'failed') {\n roomSignaling._mediaConnectionIsReconnecting = true;\n newState = 'reconnecting';\n }\n else if (roomSignaling.iceConnectionState === 'new' || roomSignaling.iceConnectionState === 'checking') {\n newState = roomSignaling._mediaConnectionIsReconnecting ? 'reconnecting' : 'connected';\n }\n else {\n roomSignaling._mediaConnectionIsReconnecting = false;\n roomSignaling._reconnectingError = null;\n roomSignaling._sessionTimeout.clear();\n newState = 'connected';\n }\n if (newState === roomSignaling.state) {\n return;\n }\n if (newState === 'reconnecting') {\n roomSignaling._reconnectingError = roomSignaling.signalingConnectionState === 'reconnecting'\n ? new SignalingConnectionDisconnectedError()\n : new MediaConnectionError();\n roomSignaling._sessionTimeout.start();\n roomSignaling.preempt(newState, null, [roomSignaling._reconnectingError]);\n }\n else {\n roomSignaling.preempt(newState);\n }\n}\nmodule.exports = RoomSignaling;\n//# sourceMappingURL=room.js.map","'use strict';\n/**\n * Bandwidth network quality statistics.\n * @property {?number} actual - the actual bandwidth used, in bits per second\n * @property {?number} available - an estimate of available useable bandwidth, in bits per second\n * @property {?NetworkQualityLevel} level - {@link NetworkQualityLevel} for bandwidth\n */\nvar NetworkQualityBandwidthStats = /** @class */ (function () {\n /**\n * Construct a {@link NetworkQualityBandwidthStats}.\n * @param {BandwidthStats} bandwidthStats\n */\n function NetworkQualityBandwidthStats(_a) {\n var _b = _a.actual, actual = _b === void 0 ? null : _b, _c = _a.available, available = _c === void 0 ? null : _c, _d = _a.level, level = _d === void 0 ? null : _d;\n Object.defineProperties(this, {\n actual: {\n value: actual,\n enumerable: true\n },\n available: {\n value: available,\n enumerable: true\n },\n level: {\n value: level,\n enumerable: true\n }\n });\n }\n return NetworkQualityBandwidthStats;\n}());\nmodule.exports = NetworkQualityBandwidthStats;\n//# sourceMappingURL=networkqualitybandwidthstats.js.map","'use strict';\n/**\n * Fraction lost network quality statistics.\n * @property {?number} fractionLost - packets lost\n * @property {?NetworkQualityLevel} level - {@link NetworkQualityLevel} for fraction lost\n */\nvar NetworkQualityFractionLostStats = /** @class */ (function () {\n /**\n * Construct a {@link NetworkQualityFractionLostStats}.\n * @param {FractionLostStats} fractionLostStats\n */\n function NetworkQualityFractionLostStats(_a) {\n var _b = _a.fractionLost, fractionLost = _b === void 0 ? null : _b, _c = _a.level, level = _c === void 0 ? null : _c;\n Object.defineProperties(this, {\n fractionLost: {\n value: fractionLost,\n enumerable: true\n },\n level: {\n value: level,\n enumerable: true\n }\n });\n }\n return NetworkQualityFractionLostStats;\n}());\nmodule.exports = NetworkQualityFractionLostStats;\n//# sourceMappingURL=networkqualityfractionloststats.js.map","'use strict';\n/**\n * Latency network quality statistics.\n * @property {?number} jitter - media jitter in seconds\n * @property {?number} rtt - round trip time in seconds\n * @property {?NetworkQualityLevel} level - {@link NetworkQualityLevel} for latency\n */\nvar NetworkQualityLatencyStats = /** @class */ (function () {\n /**\n * Construct a {@link NetworkQualityLatencyStats}.\n * @param {LatencyStats} latencyStats\n */\n function NetworkQualityLatencyStats(_a) {\n var _b = _a.jitter, jitter = _b === void 0 ? null : _b, _c = _a.rtt, rtt = _c === void 0 ? null : _c, _d = _a.level, level = _d === void 0 ? null : _d;\n Object.defineProperties(this, {\n jitter: {\n value: jitter,\n enumerable: true\n },\n rtt: {\n value: rtt,\n enumerable: true\n },\n level: {\n value: level,\n enumerable: true\n }\n });\n }\n return NetworkQualityLatencyStats;\n}());\nmodule.exports = NetworkQualityLatencyStats;\n//# sourceMappingURL=networkqualitylatencystats.js.map","'use strict';\nvar NetworkQualityBandwidthStats = require('./networkqualitybandwidthstats');\nvar NetworkQualityFractionLostStats = require('./networkqualityfractionloststats');\nvar NetworkQualityLatencyStats = require('./networkqualitylatencystats');\n/**\n * Network quality statistics shared between {@link NetworkQualitySendStats} and\n * {@link NetworkQualityRecvStats} based on which a {@link Participant}'s\n * {@link NetworkQualityMediaStats}#send or\n * {@link NetworkQualityMediaStats}#recv is calculated.\n * @property {?NetworkQualityBandwidthStats} bandwidth - bandwidth statistics\n * @property {?NetworkQualityLatencyStats} latency - latency statistics\n * @property {?NetworkQualityFractionLostStats} fractionLost - fraction lost statistics\n */\nvar NetworkQualitySendOrRecvStats = /** @class */ (function () {\n /**\n * Construct a {@link NetworkQualitySendOrRecvStats}.\n * @param {SendOrRecvStats} sendOrRecvStats\n */\n function NetworkQualitySendOrRecvStats(_a) {\n var _b = _a.bandwidth, bandwidth = _b === void 0 ? null : _b, _c = _a.fractionLost, fractionLost = _c === void 0 ? null : _c, _d = _a.latency, latency = _d === void 0 ? null : _d;\n Object.defineProperties(this, {\n bandwidth: {\n value: bandwidth ? new NetworkQualityBandwidthStats(bandwidth) : null,\n enumerable: true\n },\n fractionLost: {\n value: fractionLost ? new NetworkQualityFractionLostStats(fractionLost) : null,\n enumerable: true\n },\n latency: {\n value: latency ? new NetworkQualityLatencyStats(latency) : null,\n enumerable: true\n }\n });\n }\n return NetworkQualitySendOrRecvStats;\n}());\nmodule.exports = NetworkQualitySendOrRecvStats;\n//# sourceMappingURL=networkqualitysendorrecvstats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar NetworkQualitySendOrRecvStats = require('./networkqualitysendorrecvstats');\n/**\n * {@link NetworkQualitySendOrRecvStats} based on which a {@link Participant}'s\n * {@link NetworkQualityMediaStats}#send is calculated.\n */\nvar NetworkQualitySendStats = /** @class */ (function (_super) {\n __extends(NetworkQualitySendStats, _super);\n /**\n * Construct a {@link NetworkQualitySendStats}.\n * @param {SendOrRecvStats} sendOrRecvStats\n */\n function NetworkQualitySendStats(sendOrRecvStats) {\n return _super.call(this, sendOrRecvStats) || this;\n }\n return NetworkQualitySendStats;\n}(NetworkQualitySendOrRecvStats));\nmodule.exports = NetworkQualitySendStats;\n//# sourceMappingURL=networkqualitysendstats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar NetworkQualitySendOrRecvStats = require('./networkqualitysendorrecvstats');\n/**\n * {@link NetworkQualitySendOrRecvStats} based on which a {@link Participant}'s\n * {@link NetworkQualityMediaStats}#recv is calculated.\n */\nvar NetworkQualityRecvStats = /** @class */ (function (_super) {\n __extends(NetworkQualityRecvStats, _super);\n /**\n * Construct a {@link NetworkQualityRecvStats}.\n * @param {SendOrRecvStats} sendOrRecvStats\n */\n function NetworkQualityRecvStats(sendOrRecvStats) {\n return _super.call(this, sendOrRecvStats) || this;\n }\n return NetworkQualityRecvStats;\n}(NetworkQualitySendOrRecvStats));\nmodule.exports = NetworkQualityRecvStats;\n//# sourceMappingURL=networkqualityrecvstats.js.map","'use strict';\nvar NetworkQualitySendStats = require('./networkqualitysendstats');\nvar NetworkQualityRecvStats = require('./networkqualityrecvstats');\n/**\n * Network quality statistics shared between a {@link Participant}'s audio or video.\n * @property {NetworkQualityLevel} send - {@link NetworkQualityLevel} of the\n * {@link Participant}'s published audio or video\n * @property {number} recv - {@link NetworkQualityLevel} of the\n * {@link Participant}'s subscribed audio or video\n * @property {?NetworkQualitySendOrRecvStats} sendStats - {@link NetworkQualitySendOrRecvStats}\n * based on which {@link NetworkQualityMediaStats}#send\n * is calculated\n * @property {?NetworkQualitySendOrRecvStats} recvStats - {@link NetworkQualitySendOrRecvStats}\n * based on which {@link NetworkQualityMediaStats}#recv\n * is calculated\n */\nvar NetworkQualityMediaStats = /** @class */ (function () {\n /**\n * Construct a {@link NetworkQualityMediaStats}.\n * @param {MediaLevels} mediaLevels\n */\n function NetworkQualityMediaStats(_a) {\n var send = _a.send, recv = _a.recv, _b = _a.sendStats, sendStats = _b === void 0 ? null : _b, _c = _a.recvStats, recvStats = _c === void 0 ? null : _c;\n Object.defineProperties(this, {\n send: {\n value: send,\n enumerable: true\n },\n recv: {\n value: recv,\n enumerable: true\n },\n sendStats: {\n value: sendStats ? new NetworkQualitySendStats(sendStats) : null,\n enumerable: true\n },\n recvStats: {\n value: recvStats ? new NetworkQualityRecvStats(recvStats) : null,\n enumerable: true\n }\n });\n }\n return NetworkQualityMediaStats;\n}());\nmodule.exports = NetworkQualityMediaStats;\n//# sourceMappingURL=networkqualitymediastats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar NetworkQualityMediaStats = require('./networkqualitymediastats');\n/**\n * {@link NetworkQualityMediaStats} for a {@link Participant}'s audio.\n */\nvar NetworkQualityAudioStats = /** @class */ (function (_super) {\n __extends(NetworkQualityAudioStats, _super);\n /**\n * Construct a {@link NetworkQualityAudioStats}.\n * @param {MediaLevels} mediaLevels\n */\n function NetworkQualityAudioStats(mediaLevels) {\n return _super.call(this, mediaLevels) || this;\n }\n return NetworkQualityAudioStats;\n}(NetworkQualityMediaStats));\nmodule.exports = NetworkQualityAudioStats;\n//# sourceMappingURL=networkqualityaudiostats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar NetworkQualityMediaStats = require('./networkqualitymediastats');\n/**\n * {@link NetworkQualityMediaStats} for a {@link Participant}'s video.\n */\nvar NetworkQualityVideoStats = /** @class */ (function (_super) {\n __extends(NetworkQualityVideoStats, _super);\n /**\n * Construct a {@link NetworkQualityVideoStats}.\n * @param {MediaLevels} mediaLevels\n */\n function NetworkQualityVideoStats(mediaLevels) {\n return _super.call(this, mediaLevels) || this;\n }\n return NetworkQualityVideoStats;\n}(NetworkQualityMediaStats));\nmodule.exports = NetworkQualityVideoStats;\n//# sourceMappingURL=networkqualityvideostats.js.map","'use strict';\nvar NetworkQualityAudioStats = require('./networkqualityaudiostats');\nvar NetworkQualityVideoStats = require('./networkqualityvideostats');\n/**\n * Network quality statistics for a {@link Participant}.\n * @property {NetworkQualityLevel} level - {@link NetworkQualityLevel} of the {@link Participant}\n * @property {?NetworkQualityAudioStats} audio - {@link NetworkQualityMediaStats}\n * for audio; null if {@link NetworkQualityVerbosity} is {@link NetworkQualityVerbosity}#minimal\n * or below\n * @property {?NetworkQualityVideoStats} video - {@link NetworkQualityMediaStats}\n * for video; null if {@link NetworkQualityVerbosity} is {@link NetworkQualityVerbosity}#minimal\n * or below\n */\nvar NetworkQualityStats = /** @class */ (function () {\n /**\n * Construct a {@link NetworkQualityStats}.\n * @param {NetworkQualityLevels} networkQualityLevels\n */\n function NetworkQualityStats(_a) {\n var level = _a.level, audio = _a.audio, video = _a.video;\n Object.defineProperties(this, {\n level: {\n value: level,\n enumerable: true\n },\n audio: {\n value: audio ? new NetworkQualityAudioStats(audio) : null,\n enumerable: true\n },\n video: {\n value: video ? new NetworkQualityVideoStats(video) : null,\n enumerable: true\n }\n });\n }\n return NetworkQualityStats;\n}());\nmodule.exports = NetworkQualityStats;\n//# sourceMappingURL=networkqualitystats.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar StateMachine = require('../statemachine');\nvar NetworkQualityStats = require('../stats/networkqualitystats');\n/*\nParticipantSignaling States\n----------------------\n\n +------------+ +-----------+ +--------------+\n | | | | | |\n | connecting |---->| connected |---->| disconnected |\n | | | | | |\n +------------+ +-----------+ +--------------+\n | ^ ^\n | | +--------------+ |\n | |--| | |\n |--->| reconnecting |--|\n | |\n +--------------+\n*/\nvar states = {\n connecting: [\n 'connected'\n ],\n connected: [\n 'disconnected',\n 'reconnecting'\n ],\n reconnecting: [\n 'connected',\n 'disconnected'\n ],\n disconnected: []\n};\n/**\n * A {@link Participant} implementation\n * @extends StateMachine\n * @property {?string} identity\n * @property {?Participant.SID} sid\n * @property {string} state - \"connecting\", \"connected\", or \"disconnected\"\n * @property {Map} tracks\n * @emits ParticipantSignaling#networkQualityLevelChanged\n * @emits ParticipantSignaling#trackAdded\n * @emits ParticipantSignaling#trackRemoved\n */\nvar ParticipantSignaling = /** @class */ (function (_super) {\n __extends(ParticipantSignaling, _super);\n /**\n * Construct a {@link ParticipantSignaling}.\n */\n function ParticipantSignaling() {\n var _this = _super.call(this, 'connecting', states) || this;\n Object.defineProperties(_this, {\n _identity: {\n writable: true,\n value: null\n },\n _networkQualityLevel: {\n value: null,\n writable: true\n },\n _networkQualityStats: {\n value: null,\n writable: true\n },\n _sid: {\n writable: true,\n value: null\n },\n identity: {\n enumerable: true,\n get: function () {\n return this._identity;\n }\n },\n sid: {\n enumerable: true,\n get: function () {\n return this._sid;\n }\n },\n tracks: {\n enumerable: true,\n value: new Map()\n }\n });\n return _this;\n }\n Object.defineProperty(ParticipantSignaling.prototype, \"networkQualityLevel\", {\n /**\n * Get the current {@link NetworkQualityLevel}, if any.\n * @returns {?NetworkQualityLevel} networkQualityLevel - initially null\n */\n get: function () {\n return this._networkQualityLevel;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParticipantSignaling.prototype, \"networkQualityStats\", {\n /**\n * Get the current {@link NetworkQualityStats}\n * @returns {?NetworkQualityStats} networkQualityStats - initially null\n */\n get: function () {\n return this._networkQualityStats;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Add the {@link TrackSignaling}, MediaStreamTrack, or\n * {@link DataTrackSender} to the {@link ParticipantSignaling}.\n * @param {TrackSignaling|DataTrackSender|MediaTrackSender} track\n * @returns {this}\n * @fires ParticipantSignaling#trackAdded\n */\n ParticipantSignaling.prototype.addTrack = function (track) {\n this.tracks.set(track.id || track.sid, track);\n this.emit('trackAdded', track);\n return this;\n };\n /**\n * Disconnect the {@link ParticipantSignaling}.\n * @returns {boolean}\n */\n ParticipantSignaling.prototype.disconnect = function () {\n if (this.state !== 'disconnected') {\n this.preempt('disconnected');\n return true;\n }\n return false;\n };\n /**\n * Remove the {@link TrackSignaling}, MediaStreamTrack, or\n * {@link DataTrackSender} from the {@link ParticipantSignaling}.\n * @param {TrackSignaling|DataTrackSender|MediaTrackSender} track\n * @returns {?TrackSignaling}\n * @fires ParticipantSignaling#trackRemoved\n */\n ParticipantSignaling.prototype.removeTrack = function (track) {\n var signaling = this.tracks.get(track.id || track.sid);\n this.tracks.delete(track.id || track.sid);\n if (signaling) {\n this.emit('trackRemoved', track);\n }\n return signaling || null;\n };\n /**\n * @param {NetworkQualityLevel} networkQualityLevel\n * @param {?NetworkQualityLevels} [networkQualityLevels=null]\n * @returns {void}\n */\n ParticipantSignaling.prototype.setNetworkQualityLevel = function (networkQualityLevel, networkQualityLevels) {\n if (this._networkQualityLevel !== networkQualityLevel) {\n this._networkQualityLevel = networkQualityLevel;\n this._networkQualityStats = networkQualityLevels\n && (networkQualityLevels.audio || networkQualityLevels.video)\n ? new NetworkQualityStats(networkQualityLevels)\n : null;\n this.emit('networkQualityLevelChanged');\n }\n };\n /**\n * Connect the {@link ParticipantSignaling}.\n * @param {Participant.SID} sid\n * @param {string} identity\n * @returns {boolean}\n */\n ParticipantSignaling.prototype.connect = function (sid, identity) {\n if (this.state === 'connecting' || this.state === 'reconnecting') {\n if (!this._sid) {\n this._sid = sid;\n }\n if (!this._identity) {\n this._identity = identity;\n }\n this.preempt('connected');\n return true;\n }\n return false;\n };\n /**\n * Transition to \"reconnecting\" state.\n * @returns {boolean}\n */\n ParticipantSignaling.prototype.reconnecting = function () {\n if (this.state === 'connecting' || this.state === 'connected') {\n this.preempt('reconnecting');\n return true;\n }\n return false;\n };\n return ParticipantSignaling;\n}(StateMachine));\n/**\n * @event ParticipantSignaling#event:networkQualityLevelChanged\n */\n/**\n * {@link TrackSignaling} was added to the {@link ParticipantSignaling}.\n * @event ParticipantSignaling#trackAdded\n * @param {TrackSignaling} track\n */\n/**\n * {@link TrackSignaling} was removed from the {@link ParticipantSignaling}.\n * @event ParticipantSignaling#trackRemoved\n * @param {TrackSignaling} track\n */\nmodule.exports = ParticipantSignaling;\n//# sourceMappingURL=participant.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar ParticipantSignaling = require('./participant');\n/**\n * A {@link Participant} implementation\n * @extends ParticipantSignaling\n * @property {string} identity\n * @property {Participant.SID} sid\n */\nvar RemoteParticipantSignaling = /** @class */ (function (_super) {\n __extends(RemoteParticipantSignaling, _super);\n /**\n * Construct a {@link RemoteParticipantSignaling}.\n * @param {Participant.SID} sid\n * @param {string} identity\n */\n function RemoteParticipantSignaling(sid, identity) {\n var _this = _super.call(this) || this;\n _this.connect(sid, identity);\n return _this;\n }\n return RemoteParticipantSignaling;\n}(ParticipantSignaling));\nmodule.exports = RemoteParticipantSignaling;\n//# sourceMappingURL=remoteparticipant.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar EventEmitter = require('events').EventEmitter;\n/**\n * A {@link Track} implementation\n * @extends EventEmitter\n * @property {Track.Kind} kind\n * @property {string} name\n */\nvar TrackSignaling = /** @class */ (function (_super) {\n __extends(TrackSignaling, _super);\n /**\n * Construct a {@link TrackSignaling}.\n * @param {string} name\n * @param {Track.Kind} kind\n * @param {boolean} isEnabled\n * @param {Track.Priority} priority\n */\n function TrackSignaling(name, kind, isEnabled, priority) {\n var _this = _super.call(this) || this;\n var sid = null;\n Object.defineProperties(_this, {\n _error: {\n value: null,\n writable: true\n },\n _isEnabled: {\n value: isEnabled,\n writable: true\n },\n _priority: {\n value: priority,\n writable: true\n },\n _trackTransceiver: {\n value: null,\n writable: true\n },\n _sid: {\n get: function () {\n return sid;\n },\n set: function (_sid) {\n if (sid === null) {\n sid = _sid;\n }\n }\n },\n kind: {\n enumerable: true,\n value: kind\n },\n name: {\n enumerable: true,\n value: name\n }\n });\n return _this;\n }\n Object.defineProperty(TrackSignaling.prototype, \"error\", {\n /**\n * Non-null if publication or subscription failed.\n * @property {?Error} error\n */\n get: function () {\n return this._error;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TrackSignaling.prototype, \"isEnabled\", {\n /**\n * Whether the {@link TrackSignaling} is enabled.\n * @property {boolean}\n */\n get: function () {\n return this._isEnabled;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TrackSignaling.prototype, \"priority\", {\n /**\n * The {@link TrackSignaling}'s priority.\n * @property {Track.Priority}\n */\n get: function () {\n return this._priority;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TrackSignaling.prototype, \"sid\", {\n /**\n * The {@link TrackSignaling}'s {@link Track.SID}.\n * @property {Track.SID}\n */\n get: function () {\n return this._sid;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TrackSignaling.prototype, \"trackTransceiver\", {\n /**\n * The {@link TrackSignaling}'s {@link TrackTransceiver}.\n * @property {TrackTransceiver}\n */\n get: function () {\n return this._trackTransceiver;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Disable the {@link TrackSignaling} if it is not already disabled.\n * @return {this}\n */\n TrackSignaling.prototype.disable = function () {\n return this.enable(false);\n };\n /**\n * Enable (or disable) the {@link TrackSignaling} if it is not already enabled\n * (or disabled).\n * @param {boolean} [enabled=true]\n * @return {this}\n */\n TrackSignaling.prototype.enable = function (enabled) {\n enabled = typeof enabled === 'boolean' ? enabled : true;\n if (this.isEnabled !== enabled) {\n this._isEnabled = enabled;\n this.emit('updated');\n }\n return this;\n };\n /**\n * Set the {@link TrackTransceiver} on the {@link TrackSignaling}.\n * @param {TrackTransceiver} trackTransceiver\n * @returns {this}\n */\n TrackSignaling.prototype.setTrackTransceiver = function (trackTransceiver) {\n trackTransceiver = trackTransceiver || null;\n if (this.trackTransceiver !== trackTransceiver) {\n this._trackTransceiver = trackTransceiver;\n this.emit('updated');\n }\n return this;\n };\n /**\n * Set the SID on the {@link TrackSignaling} once.\n * @param {string} sid\n * @returns {this}\n */\n TrackSignaling.prototype.setSid = function (sid) {\n if (this.sid === null) {\n this._sid = sid;\n this.emit('updated');\n }\n return this;\n };\n return TrackSignaling;\n}(EventEmitter));\n/**\n * Emitted whenever the {@link TrackSignaling} is updated\n * @event TrackSignaling#updated\n */\nmodule.exports = TrackSignaling;\n//# sourceMappingURL=track.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar TrackSignaling = require('./track');\n/**\n * A {@link RemoteTrackPublication} implementation\n * @extends TrackSignaling\n */\nvar RemoteTrackPublicationSignaling = /** @class */ (function (_super) {\n __extends(RemoteTrackPublicationSignaling, _super);\n /**\n * Construct a {@link RemoteTrackPublicationSignaling}.\n * @param {Track.SID} sid\n * @param {string} name\n * @param {Track.Kind} kind\n * @param {boolean} isEnabled\n * @param {Track.Priority} priority\n * @param {boolean} isSwitchedOff\n */\n function RemoteTrackPublicationSignaling(sid, name, kind, isEnabled, priority, isSwitchedOff) {\n var _this = _super.call(this, name, kind, isEnabled, priority) || this;\n Object.defineProperties(_this, {\n _isSwitchedOff: {\n value: isSwitchedOff,\n writable: true\n },\n });\n _this.setSid(sid);\n return _this;\n }\n Object.defineProperty(RemoteTrackPublicationSignaling.prototype, \"isSubscribed\", {\n /**\n * Whether the {@link RemoteTrackPublicationSignaling} is subscribed to.\n * @property {boolean}\n */\n get: function () {\n return !!this.trackTransceiver;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(RemoteTrackPublicationSignaling.prototype, \"isSwitchedOff\", {\n /**\n * Whether the {@link RemoteTrackPublicationSignaling} is switched off.\n * @property {boolean}\n */\n get: function () {\n return this._isSwitchedOff;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * @param {Error} error\n * @returns {this}\n */\n RemoteTrackPublicationSignaling.prototype.subscribeFailed = function (error) {\n if (!this.error) {\n this._error = error;\n this.emit('updated');\n }\n return this;\n };\n /**\n * Update the publish {@link Track.Priority}.\n * @param {Track.Priority} priority\n * @returns {this}\n */\n RemoteTrackPublicationSignaling.prototype.setPriority = function (priority) {\n if (this._priority !== priority) {\n this._priority = priority;\n this.emit('updated');\n }\n return this;\n };\n /**\n * Updates track switch on/off state.\n * @param {boolean} isSwitchedOff\n * @returns {this}\n */\n RemoteTrackPublicationSignaling.prototype.setSwitchedOff = function (isSwitchedOff) {\n if (this._isSwitchedOff !== isSwitchedOff) {\n this._isSwitchedOff = isSwitchedOff;\n this.emit('updated');\n }\n return this;\n };\n return RemoteTrackPublicationSignaling;\n}(TrackSignaling));\nmodule.exports = RemoteTrackPublicationSignaling;\n//# sourceMappingURL=remotetrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar RemoteTrackPublicationSignaling = require('../remotetrackpublication');\n/**\n * @extends RemoteTrackPublicationSignaling\n */\nvar RemoteTrackPublicationV2 = /** @class */ (function (_super) {\n __extends(RemoteTrackPublicationV2, _super);\n /**\n * Construct a {@link RemoteTrackPublicationV2}.\n * @param {RemoteTrackPublicationV2#Representation} track\n * @param {boolean} isSwitchedOff\n *\n */\n function RemoteTrackPublicationV2(track, isSwitchedOff) {\n return _super.call(this, track.sid, track.name, track.kind, track.enabled, track.priority, isSwitchedOff) || this;\n }\n /**\n * Compare the {@link RemoteTrackPublicationV2} to a\n * {@link RemoteTrackPublicationV2#Representation} of itself and perform any\n * updates necessary.\n * @param {RemoteTrackPublicationV2#Representation} track\n * @returns {this}\n * @fires TrackSignaling#updated\n */\n RemoteTrackPublicationV2.prototype.update = function (track) {\n this.enable(track.enabled);\n this.setPriority(track.priority);\n return this;\n };\n return RemoteTrackPublicationV2;\n}(RemoteTrackPublicationSignaling));\n/**\n * The Room Signaling Protocol (RSP) representation of a {@link RemoteTrackPublicationV2}.\n * @typedef {LocalTrackPublicationV2#Representation} RemoteTrackPublicationV2#Representation\n * @property {boolean} subscribed\n */\nmodule.exports = RemoteTrackPublicationV2;\n//# sourceMappingURL=remotetrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar RemoteParticipantSignaling = require('../remoteparticipant');\nvar RemoteTrackPublicationV2 = require('./remotetrackpublication');\n/**\n * @extends RemoteParticipantSignaling\n * @property {?number} revision\n */\nvar RemoteParticipantV2 = /** @class */ (function (_super) {\n __extends(RemoteParticipantV2, _super);\n /**\n * Construct a {@link RemoteParticipantV2}.\n * @param {object} participantState\n * @param {function(Track.SID): boolean} getInitialTrackSwitchOffState\n * @param {function(Track.SID, Track.Priority): boolean} setPriority\n * @param {function(Track.SID, ClientRenderHint): Promise} setRenderHint\n * @param {function(Track.SID): void} clearTrackHint\n * @param {object} [options]\n */\n function RemoteParticipantV2(participantState, getInitialTrackSwitchOffState, setPriority, setRenderHint, clearTrackHint, options) {\n var _this = _super.call(this, participantState.sid, participantState.identity) || this;\n options = Object.assign({\n RemoteTrackPublicationV2: RemoteTrackPublicationV2\n }, options);\n Object.defineProperties(_this, {\n _revision: {\n writable: true,\n value: null\n },\n _RemoteTrackPublicationV2: {\n value: options.RemoteTrackPublicationV2\n },\n _getInitialTrackSwitchOffState: {\n value: getInitialTrackSwitchOffState\n },\n updateSubscriberTrackPriority: {\n value: function (trackSid, priority) { return setPriority(trackSid, priority); }\n },\n updateTrackRenderHint: {\n value: function (trackSid, renderHint) { return setRenderHint(trackSid, renderHint); }\n },\n clearTrackHint: {\n value: function (trackSid) { return clearTrackHint(trackSid); }\n },\n revision: {\n enumerable: true,\n get: function () {\n return this._revision;\n }\n }\n });\n return _this.update(participantState);\n }\n /**\n * @private\n */\n RemoteParticipantV2.prototype._getOrCreateTrack = function (trackState) {\n var RemoteTrackPublicationV2 = this._RemoteTrackPublicationV2;\n var track = this.tracks.get(trackState.sid);\n if (!track) {\n var isSwitchedOff = this._getInitialTrackSwitchOffState(trackState.sid);\n track = new RemoteTrackPublicationV2(trackState, isSwitchedOff);\n this.addTrack(track);\n }\n return track;\n };\n /**\n * Update the {@link RemoteParticipantV2} with the new state.\n * @param {object} participantState\n * @returns {this}\n */\n RemoteParticipantV2.prototype.update = function (participantState) {\n var _this = this;\n if (this.revision !== null && participantState.revision <= this.revision) {\n return this;\n }\n this._revision = participantState.revision;\n var tracksToKeep = new Set();\n participantState.tracks.forEach(function (trackState) {\n var track = _this._getOrCreateTrack(trackState);\n track.update(trackState);\n tracksToKeep.add(track);\n });\n this.tracks.forEach(function (track) {\n if (!tracksToKeep.has(track)) {\n _this.removeTrack(track);\n }\n });\n switch (participantState.state) {\n case 'disconnected':\n this.disconnect();\n break;\n case 'reconnecting':\n this.reconnecting();\n break;\n case 'connected':\n this.connect(this.sid, this.identity);\n break;\n }\n return this;\n };\n return RemoteParticipantV2;\n}(RemoteParticipantSignaling));\nmodule.exports = RemoteParticipantV2;\n//# sourceMappingURL=remoteparticipant.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar MediaSignaling = require('./mediasignaling');\nvar TrackPrioritySignaling = /** @class */ (function (_super) {\n __extends(TrackPrioritySignaling, _super);\n /**\n * Construct a {@link TrackPrioritySignaling}.\n * @param {Promise} getReceiver\n */\n function TrackPrioritySignaling(getReceiver, options) {\n var _this = _super.call(this, getReceiver, 'track_priority', options) || this;\n Object.defineProperties(_this, {\n _enqueuedPriorityUpdates: {\n value: new Map()\n },\n });\n _this.on('ready', function (transport) {\n Array.from(_this._enqueuedPriorityUpdates.keys()).forEach(function (trackSid) {\n transport.publish({\n type: 'track_priority',\n track: trackSid,\n subscribe: _this._enqueuedPriorityUpdates.get(trackSid)\n });\n // NOTE(mpatwardhan)- we do not clear _enqueuedPriorityUpdates intentionally,\n // this cache will is used to re-send the priorities in case of VMS-FailOver.\n });\n });\n return _this;\n }\n /**\n * @param {Track.SID} trackSid\n * @param {'publish'|'subscribe'} publishOrSubscribe\n * @param {Track.Priority} priority\n */\n TrackPrioritySignaling.prototype.sendTrackPriorityUpdate = function (trackSid, publishOrSubscribe, priority) {\n if (publishOrSubscribe !== 'subscribe') {\n throw new Error('only subscribe priorities are supported, found: ' + publishOrSubscribe);\n }\n this._enqueuedPriorityUpdates.set(trackSid, priority);\n if (this._transport) {\n this._transport.publish({\n type: 'track_priority',\n track: trackSid,\n subscribe: priority\n });\n }\n };\n return TrackPrioritySignaling;\n}(MediaSignaling));\nmodule.exports = TrackPrioritySignaling;\n//# sourceMappingURL=trackprioritysignaling.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar MediaSignaling = require('./mediasignaling');\n/**\n * @emits TrackSwitchOffSignalinging#updated\n */\nvar TrackSwitchOffSignaling = /** @class */ (function (_super) {\n __extends(TrackSwitchOffSignaling, _super);\n /**\n * Construct a {@link TrackSwitchOffSignaling}.\n * @param {Promise} getReceiver\n */\n function TrackSwitchOffSignaling(getReceiver, options) {\n var _this = _super.call(this, getReceiver, 'track_switch_off', options) || this;\n _this.on('ready', function (transport) {\n transport.on('message', function (message) {\n switch (message.type) {\n case 'track_switch_off':\n _this._setTrackSwitchOffUpdates(message.off || [], message.on || []);\n break;\n default:\n break;\n }\n });\n });\n return _this;\n }\n /**\n * @private\n * @param {[Track.SID]} tracksSwitchedOff\n * @param {[Track.SID]} tracksSwitchedOn\n * @returns {void}\n */\n TrackSwitchOffSignaling.prototype._setTrackSwitchOffUpdates = function (tracksSwitchedOff, tracksSwitchedOn) {\n this.emit('updated', tracksSwitchedOff, tracksSwitchedOn);\n };\n return TrackSwitchOffSignaling;\n}(MediaSignaling));\n/**\n * @event TrackSwitchOffSignaling#updated\n */\nmodule.exports = TrackSwitchOffSignaling;\n//# sourceMappingURL=trackswitchoffsignaling.js.map","/* eslint callback-return:0 */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar MediaSignaling = require('./mediasignaling');\nvar Timeout = require('../../util/timeout');\nvar isDeepEqual = require('../../util').isDeepEqual;\nvar RENDER_HINT_RESPONSE_TIME_MS = 2000; // time to wait for server response (before resending all hints.)\nvar messageId = 1;\nvar RenderHintsSignaling = /** @class */ (function (_super) {\n __extends(RenderHintsSignaling, _super);\n /**\n * Construct a {@link RenderHintsSignaling}.\n */\n function RenderHintsSignaling(getReceiver, options) {\n var _this = _super.call(this, getReceiver, 'render_hints', options) || this;\n Object.defineProperties(_this, {\n _trackSidsToRenderHints: {\n value: new Map()\n },\n _responseTimer: {\n value: new Timeout(function () {\n _this._sendAllHints();\n // once timer fires, for next round double the delay.\n _this._responseTimer.setDelay(_this._responseTimer.delay * 2);\n }, RENDER_HINT_RESPONSE_TIME_MS, false),\n }\n });\n _this.on('ready', function (transport) {\n transport.on('message', function (message) {\n _this._log.debug('Incoming: ', message);\n switch (message.type) {\n case 'render_hints':\n _this._processHintResults((message && message.subscriber && message.subscriber.hints) || []);\n break;\n default:\n _this._log.warn('Unknown message type: ', message.type);\n break;\n }\n });\n // NOTE(mpatwardhan): When transport is set (either 1st time of after vms failover)\n // resend all track states.\n _this._sendAllHints();\n });\n return _this;\n }\n RenderHintsSignaling.prototype._sendAllHints = function () {\n var _this = this;\n // to force sending all hints simply mark all tracks as dirty.\n Array.from(this._trackSidsToRenderHints.keys()).forEach(function (trackSid) {\n var trackState = _this._trackSidsToRenderHints.get(trackSid);\n if (trackState.renderDimensions) {\n trackState.isDimensionDirty = true;\n }\n if ('enabled' in trackState) {\n trackState.isEnabledDirty = true;\n }\n });\n this._sendHints();\n };\n RenderHintsSignaling.prototype._processHintResults = function (hintResults) {\n var _this = this;\n this._responseTimer.clear();\n this._responseTimer.setDelay(RENDER_HINT_RESPONSE_TIME_MS);\n hintResults.forEach(function (hintResult) {\n if (hintResult.result !== 'OK') {\n _this._log.debug('Server error processing hint:', hintResult);\n }\n });\n this._sendHints();\n };\n RenderHintsSignaling.prototype._sendHints = function () {\n var _this = this;\n if (!this._transport || this._responseTimer.isSet) {\n return;\n }\n var hints = [];\n Array.from(this._trackSidsToRenderHints.keys()).forEach(function (trackSid) {\n var trackState = _this._trackSidsToRenderHints.get(trackSid);\n if (trackState.isEnabledDirty || trackState.isDimensionDirty) {\n var mspHint = {\n 'track': trackSid,\n };\n if (trackState.isEnabledDirty) {\n mspHint.enabled = trackState.enabled;\n trackState.isEnabledDirty = false;\n }\n if (trackState.isDimensionDirty) {\n // eslint-disable-next-line camelcase\n mspHint.render_dimensions = trackState.renderDimensions;\n trackState.isDimensionDirty = false;\n }\n hints.push(mspHint);\n }\n });\n if (hints.length > 0) {\n var payLoad = {\n type: 'render_hints',\n subscriber: {\n id: messageId++,\n hints: hints\n }\n };\n this._log.debug('Outgoing: ', payLoad);\n this._transport.publish(payLoad);\n this._responseTimer.start();\n }\n };\n /**\n * @param {Track.SID} trackSid\n * @param {ClientRenderHint} renderHint\n */\n RenderHintsSignaling.prototype.setTrackHint = function (trackSid, renderHint) {\n var trackState = this._trackSidsToRenderHints.get(trackSid) || { isEnabledDirty: false, isDimensionDirty: false };\n if ('enabled' in renderHint && trackState.enabled !== renderHint.enabled) {\n trackState.enabled = !!renderHint.enabled;\n trackState.isEnabledDirty = true;\n }\n if (renderHint.renderDimensions && !isDeepEqual(renderHint.renderDimensions, trackState.renderDimensions)) {\n // eslint-disable-next-line camelcase\n trackState.renderDimensions = renderHint.renderDimensions;\n trackState.isDimensionDirty = true;\n }\n this._trackSidsToRenderHints.set(trackSid, trackState);\n this._sendHints();\n };\n /**\n * must be called when track is unsubscribed.\n * @param {Track.SID} trackSid\n */\n RenderHintsSignaling.prototype.clearTrackHint = function (trackSid) {\n this._trackSidsToRenderHints.delete(trackSid);\n };\n return RenderHintsSignaling;\n}(MediaSignaling));\nmodule.exports = RenderHintsSignaling;\n//# sourceMappingURL=renderhintssignaling.js.map","/* eslint callback-return:0 */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar MediaSignaling = require('./mediasignaling');\nvar messageId = 1;\nvar PublisherHintsSignaling = /** @class */ (function (_super) {\n __extends(PublisherHintsSignaling, _super);\n /**\n * Construct a {@link RenderHintsSignaling}.\n */\n function PublisherHintsSignaling(getReceiver, options) {\n var _this = _super.call(this, getReceiver, 'publisher_hints', options) || this;\n _this.on('ready', function (transport) {\n _this._log.debug('publisher_hints transport ready:', transport);\n transport.on('message', function (message) {\n _this._log.debug('Incoming: ', message);\n switch (message.type) {\n case 'publisher_hints':\n if (message.publisher && message.publisher.hints && message.publisher.id) {\n _this._processPublisherHints(message.publisher.hints, message.publisher.id);\n }\n break;\n default:\n _this._log.warn('Unknown message type: ', message.type);\n break;\n }\n });\n });\n return _this;\n }\n PublisherHintsSignaling.prototype.sendTrackReplaced = function (_a) {\n var trackSid = _a.trackSid;\n if (!this._transport) {\n return;\n }\n var payLoad = {\n type: 'client_reset',\n track: trackSid,\n id: messageId++\n };\n this._log.debug('Outgoing: ', payLoad);\n this._transport.publish(payLoad);\n };\n PublisherHintsSignaling.prototype.sendHintResponse = function (_a) {\n var id = _a.id, hints = _a.hints;\n if (!this._transport) {\n return;\n }\n var payLoad = {\n type: 'publisher_hints',\n id: id,\n hints: hints\n };\n this._log.debug('Outgoing: ', payLoad);\n this._transport.publish(payLoad);\n };\n /**\n * @private\n */\n PublisherHintsSignaling.prototype._processPublisherHints = function (hints, id) {\n try {\n this.emit('updated', hints, id);\n }\n catch (ex) {\n this._log.error('error processing hints:', ex);\n }\n };\n return PublisherHintsSignaling;\n}(MediaSignaling));\nmodule.exports = PublisherHintsSignaling;\n//# sourceMappingURL=publisherhintsignaling.js.map","/* eslint-disable no-console */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar DominantSpeakerSignaling = require('./dominantspeakersignaling');\nvar NetworkQualityMonitor = require('./networkqualitymonitor');\nvar NetworkQualitySignaling = require('./networkqualitysignaling');\nvar RecordingV2 = require('./recording');\nvar RoomSignaling = require('../room');\nvar RemoteParticipantV2 = require('./remoteparticipant');\nvar StatsReport = require('../../stats/statsreport');\nvar TrackPrioritySignaling = require('./trackprioritysignaling');\nvar TrackSwitchOffSignaling = require('./trackswitchoffsignaling');\nvar RenderHintsSignaling = require('./renderhintssignaling');\nvar PublisherHintsSignaling = require('./publisherhintsignaling.js');\nvar _a = require('../../util'), DEFAULT_SESSION_TIMEOUT_SEC = _a.constants.DEFAULT_SESSION_TIMEOUT_SEC, createBandwidthProfilePayload = _a.createBandwidthProfilePayload, defer = _a.defer, difference = _a.difference, filterObject = _a.filterObject, flatMap = _a.flatMap, oncePerTick = _a.oncePerTick;\nvar MovingAverageDelta = require('../../util/movingaveragedelta');\nvar createTwilioError = require('../../util/twilio-video-errors').createTwilioError;\nvar STATS_PUBLISH_INTERVAL_MS = 10000;\n/**\n * @extends RoomSignaling\n */\nvar RoomV2 = /** @class */ (function (_super) {\n __extends(RoomV2, _super);\n function RoomV2(localParticipant, initialState, transport, peerConnectionManager, options) {\n var _this = this;\n initialState.options = Object.assign({\n session_timeout: DEFAULT_SESSION_TIMEOUT_SEC\n }, initialState.options);\n options = Object.assign({\n DominantSpeakerSignaling: DominantSpeakerSignaling,\n NetworkQualityMonitor: NetworkQualityMonitor,\n NetworkQualitySignaling: NetworkQualitySignaling,\n RecordingSignaling: RecordingV2,\n RemoteParticipantV2: RemoteParticipantV2,\n TrackPrioritySignaling: TrackPrioritySignaling,\n TrackSwitchOffSignaling: TrackSwitchOffSignaling,\n bandwidthProfile: null,\n sessionTimeout: initialState.options.session_timeout * 1000,\n statsPublishIntervalMs: STATS_PUBLISH_INTERVAL_MS\n }, options);\n localParticipant.setBandwidthProfile(options.bandwidthProfile);\n var _a = initialState.options, signalingRegion = _a.signaling_region, _b = _a.audio_processors, audioProcessors = _b === void 0 ? [] : _b;\n localParticipant.setSignalingRegion(signalingRegion);\n if (audioProcessors.includes('krisp')) {\n // Note(mpatwardhan): we add rnnoise as allowed_processor to enable testing our pipeline e2e.\n audioProcessors.push('rnnoise');\n }\n localParticipant.setAudioProcessors(audioProcessors);\n peerConnectionManager.setIceReconnectTimeout(options.sessionTimeout);\n _this = _super.call(this, localParticipant, initialState.sid, initialState.name, options) || this;\n var getTrackReceiver = function (id) { return _this._getTrackReceiver(id); };\n var log = _this._log;\n Object.defineProperties(_this, {\n _disconnectedParticipantRevisions: {\n value: new Map()\n },\n _NetworkQualityMonitor: {\n value: options.NetworkQualityMonitor\n },\n _lastBandwidthProfileRevision: {\n value: localParticipant.bandwidthProfileRevision,\n writable: true\n },\n _mediaStatesWarningsRevision: {\n value: 0,\n writable: true\n },\n _networkQualityMonitor: {\n value: null,\n writable: true\n },\n _networkQualityConfiguration: {\n value: localParticipant.networkQualityConfiguration\n },\n _peerConnectionManager: {\n value: peerConnectionManager\n },\n _published: {\n value: new Map()\n },\n _publishedRevision: {\n value: 0,\n writable: true\n },\n _RemoteParticipantV2: {\n value: options.RemoteParticipantV2\n },\n _subscribed: {\n value: new Map()\n },\n _subscribedRevision: {\n value: 0,\n writable: true\n },\n _subscriptionFailures: {\n value: new Map()\n },\n _dominantSpeakerSignaling: {\n value: new options.DominantSpeakerSignaling(getTrackReceiver, { log: log })\n },\n _networkQualitySignaling: {\n value: new options.NetworkQualitySignaling(getTrackReceiver, localParticipant.networkQualityConfiguration, { log: log })\n },\n _renderHintsSignaling: {\n value: new RenderHintsSignaling(getTrackReceiver, { log: log }),\n },\n _publisherHintsSignaling: {\n value: new PublisherHintsSignaling(getTrackReceiver, { log: log }),\n },\n _trackPrioritySignaling: {\n value: new options.TrackPrioritySignaling(getTrackReceiver, { log: log }),\n },\n _trackSwitchOffSignaling: {\n value: new options.TrackSwitchOffSignaling(getTrackReceiver, { log: log }),\n },\n _pendingSwitchOffStates: {\n value: new Map()\n },\n _transport: {\n value: transport\n },\n _trackReceiverDeferreds: {\n value: new Map()\n },\n mediaRegion: {\n enumerable: true,\n value: initialState.options.media_region || null\n }\n });\n _this._initTrackSwitchOffSignaling();\n _this._initDominantSpeakerSignaling();\n _this._initNetworkQualityMonitorSignaling();\n _this._initPublisherHintSignaling();\n handleLocalParticipantEvents(_this, localParticipant);\n handlePeerConnectionEvents(_this, peerConnectionManager);\n handleTransportEvents(_this, transport);\n periodicallyPublishStats(_this, transport, options.statsPublishIntervalMs);\n _this._update(initialState);\n // NOTE(mpatwardhan) after initial state we know if publisher_hints are enabled or not\n // if they are not enabled. we need to undo simulcast that was enabled with initial offer.\n _this._peerConnectionManager.setEffectiveAdaptiveSimulcast(_this._publisherHintsSignaling.isSetup);\n return _this;\n }\n Object.defineProperty(RoomV2.prototype, \"connectionState\", {\n /**\n * The PeerConnection state.\n * @property {RTCPeerConnectionState}\n */\n get: function () {\n return this._peerConnectionManager.connectionState;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(RoomV2.prototype, \"signalingConnectionState\", {\n /**\n * The Signaling Connection State.\n * @property {string} - \"connected\", \"reconnecting\", \"disconnected\"\n */\n get: function () {\n return this._transport.state === 'syncing'\n ? 'reconnecting'\n : this._transport.state;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(RoomV2.prototype, \"iceConnectionState\", {\n /**\n * The Ice Connection State.\n * @property {RTCIceConnectionState}\n */\n get: function () {\n return this._peerConnectionManager.iceConnectionState;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * @private\n */\n RoomV2.prototype._deleteTrackReceiverDeferred = function (id) {\n return this._trackReceiverDeferreds.delete(id);\n };\n /**\n * @private\n */\n RoomV2.prototype._getOrCreateTrackReceiverDeferred = function (id) {\n var deferred = this._trackReceiverDeferreds.get(id) || defer();\n var trackReceivers = this._peerConnectionManager.getTrackReceivers();\n // NOTE(mmalavalli): In Firefox, there can be instances where a MediaStreamTrack\n // for the given Track ID already exists, for example, when a Track is removed\n // and added back. If that is the case, then we should resolve 'deferred'.\n var trackReceiver = trackReceivers.find(function (trackReceiver) { return trackReceiver.id === id && trackReceiver.readyState !== 'ended'; });\n if (trackReceiver) {\n deferred.resolve(trackReceiver);\n }\n else {\n // NOTE(mmalavalli): Only add the 'deferred' to the map if it's not\n // resolved. This will prevent old copies of the MediaStreamTrack from\n // being used when the remote peer removes and re-adds a MediaStreamTrack.\n this._trackReceiverDeferreds.set(id, deferred);\n }\n return deferred;\n };\n /**\n * @private\n */\n RoomV2.prototype._addTrackReceiver = function (trackReceiver) {\n var deferred = this._getOrCreateTrackReceiverDeferred(trackReceiver.id);\n deferred.resolve(trackReceiver);\n return this;\n };\n /**\n * @private\n */\n RoomV2.prototype._disconnect = function (error) {\n var didDisconnect = _super.prototype._disconnect.call(this, error);\n if (didDisconnect) {\n this._teardownNetworkQualityMonitor();\n this._transport.disconnect();\n this._peerConnectionManager.close();\n }\n this.localParticipant.tracks.forEach(function (track) {\n track.publishFailed(error || new Error('LocalParticipant disconnected'));\n });\n return didDisconnect;\n };\n /**\n * @private\n */\n RoomV2.prototype._getTrackReceiver = function (id) {\n var _this = this;\n return this._getOrCreateTrackReceiverDeferred(id).promise.then(function (trackReceiver) {\n _this._deleteTrackReceiverDeferred(id);\n return trackReceiver;\n });\n };\n /**\n * @private\n */\n RoomV2.prototype._getInitialTrackSwitchOffState = function (trackSid) {\n var initiallySwitchedOff = this._pendingSwitchOffStates.get(trackSid) || false;\n this._pendingSwitchOffStates.delete(trackSid);\n if (initiallySwitchedOff) {\n this._log.warn(\"[\" + trackSid + \"] was initially switched off! \");\n }\n return initiallySwitchedOff;\n };\n /**\n * @private\n */\n RoomV2.prototype._getTrackSidsToTrackSignalings = function () {\n var trackSidsToTrackSignalings = flatMap(this.participants, function (participant) { return Array.from(participant.tracks); });\n return new Map(trackSidsToTrackSignalings);\n };\n /**\n * @private\n */\n RoomV2.prototype._getOrCreateRemoteParticipant = function (participantState) {\n var _this = this;\n var RemoteParticipantV2 = this._RemoteParticipantV2;\n var participant = this.participants.get(participantState.sid);\n var self = this;\n if (!participant) {\n participant = new RemoteParticipantV2(participantState, function (trackSid) { return _this._getInitialTrackSwitchOffState(trackSid); }, function (trackSid, priority) { return _this._trackPrioritySignaling.sendTrackPriorityUpdate(trackSid, 'subscribe', priority); }, function (trackSid, hint) { return _this._renderHintsSignaling.setTrackHint(trackSid, hint); }, function (trackSid) { return _this._renderHintsSignaling.clearTrackHint(trackSid); });\n participant.on('stateChanged', function stateChanged(state) {\n if (state === 'disconnected') {\n participant.removeListener('stateChanged', stateChanged);\n self.participants.delete(participant.sid);\n self._disconnectedParticipantRevisions.set(participant.sid, participant.revision);\n }\n });\n this.connectParticipant(participant);\n }\n return participant;\n };\n /**\n * @private\n */\n RoomV2.prototype._getState = function () {\n return {\n participant: this.localParticipant.getState()\n };\n };\n /**\n * @private\n */\n RoomV2.prototype._maybeAddBandwidthProfile = function (update) {\n var _a = this.localParticipant, bandwidthProfile = _a.bandwidthProfile, bandwidthProfileRevision = _a.bandwidthProfileRevision;\n if (bandwidthProfile && this._lastBandwidthProfileRevision < bandwidthProfileRevision) {\n this._lastBandwidthProfileRevision = bandwidthProfileRevision;\n return Object.assign({\n bandwidth_profile: createBandwidthProfilePayload(bandwidthProfile)\n }, update);\n }\n return update;\n };\n /**\n * @private\n */\n RoomV2.prototype._publishNewLocalParticipantState = function () {\n this._transport.publish(this._maybeAddBandwidthProfile(this._getState()));\n };\n /**\n * @private\n */\n RoomV2.prototype._publishPeerConnectionState = function (peerConnectionState) {\n /* eslint camelcase:0 */\n this._transport.publish(Object.assign({\n peer_connections: [peerConnectionState]\n }, this._getState()));\n };\n /**\n * @private\n */\n RoomV2.prototype._update = function (roomState) {\n var _this = this;\n if (roomState.subscribed && roomState.subscribed.revision > this._subscribedRevision) {\n this._subscribedRevision = roomState.subscribed.revision;\n roomState.subscribed.tracks.forEach(function (trackState) {\n if (trackState.id) {\n _this._subscriptionFailures.delete(trackState.sid);\n _this._subscribed.set(trackState.sid, trackState.id);\n }\n else if (trackState.error && !_this._subscriptionFailures.has(trackState.sid)) {\n _this._subscriptionFailures.set(trackState.sid, trackState.error);\n }\n });\n var subscribedTrackSids_1 = new Set(roomState.subscribed.tracks\n .filter(function (trackState) { return !!trackState.id; })\n .map(function (trackState) { return trackState.sid; }));\n this._subscribed.forEach(function (trackId, trackSid) {\n if (!subscribedTrackSids_1.has(trackSid)) {\n _this._subscribed.delete(trackSid);\n }\n });\n }\n var participantsToKeep = new Set();\n // eslint-disable-next-line no-warning-comments\n // TODO(mroberts): Remove me once the Server is fixed.\n (roomState.participants || []).forEach(function (participantState) {\n if (participantState.sid === _this.localParticipant.sid) {\n return;\n }\n // NOTE(mmalavalli): If the incoming revision for a disconnected Participant is less than or\n // equal to the revision when it was disconnected, then the state is old and can be ignored.\n // Otherwise, the Participant was most likely disconnected in a Large Group Room when it\n // stopped publishing media, and hence needs to be re-added.\n var disconnectedParticipantRevision = _this._disconnectedParticipantRevisions.get(participantState.sid);\n if (disconnectedParticipantRevision && participantState.revision <= disconnectedParticipantRevision) {\n return;\n }\n if (disconnectedParticipantRevision) {\n _this._disconnectedParticipantRevisions.delete(participantState.sid);\n }\n var participant = _this._getOrCreateRemoteParticipant(participantState);\n participant.update(participantState);\n participantsToKeep.add(participant);\n });\n if (roomState.type === 'synced') {\n this.participants.forEach(function (participant) {\n if (!participantsToKeep.has(participant)) {\n participant.disconnect();\n }\n });\n }\n handleSubscriptions(this);\n // eslint-disable-next-line no-warning-comments\n // TODO(mroberts): Remove me once the Server is fixed.\n /* eslint camelcase:0 */\n if (roomState.peer_connections) {\n this._peerConnectionManager.update(roomState.peer_connections, roomState.type === 'synced');\n }\n if (roomState.recording) {\n this.recording.update(roomState.recording);\n }\n if (roomState.published && roomState.published.revision > this._publishedRevision) {\n this._publishedRevision = roomState.published.revision;\n roomState.published.tracks.forEach(function (track) {\n if (track.sid) {\n _this._published.set(track.id, track.sid);\n }\n });\n this.localParticipant.update(roomState.published);\n }\n if (roomState.participant) {\n this.localParticipant.connect(roomState.participant.sid, roomState.participant.identity);\n }\n [\n this._dominantSpeakerSignaling,\n this._networkQualitySignaling,\n this._trackPrioritySignaling,\n this._trackSwitchOffSignaling,\n this._renderHintsSignaling,\n this._publisherHintsSignaling\n ].forEach(function (mediaSignaling) {\n var channel = mediaSignaling.channel;\n if (!mediaSignaling.isSetup\n && roomState.media_signaling\n && roomState.media_signaling[channel]\n && roomState.media_signaling[channel].transport\n && roomState.media_signaling[channel].transport.type === 'data-channel') {\n mediaSignaling.setup(roomState.media_signaling[channel].transport.label);\n }\n });\n if (roomState.type === 'warning' && roomState.states &&\n roomState.states.revision > this._mediaStatesWarningsRevision) {\n this._mediaStatesWarningsRevision = roomState.states.revision;\n this.localParticipant.updateMediaStates(roomState.states);\n }\n return this;\n };\n RoomV2.prototype._initPublisherHintSignaling = function () {\n var _this = this;\n this._publisherHintsSignaling.on('updated', function (hints, id) {\n Promise.all(hints.map(function (hint) {\n return _this.localParticipant.setPublisherHint(hint.track, hint.encodings).then(function (result) {\n return { track: hint.track, result: result };\n });\n })).then(function (hintResponses) {\n _this._publisherHintsSignaling.sendHintResponse({ id: id, hints: hintResponses });\n });\n });\n var handleReplaced = function (track) {\n if (track.kind === 'video') {\n track.trackTransceiver.on('replaced', function () {\n _this._publisherHintsSignaling.sendTrackReplaced({ trackSid: track.sid });\n });\n }\n };\n // hook up for any existing and new tracks getting replaced.\n Array.from(this.localParticipant.tracks.values()).forEach(function (track) { return handleReplaced(track); });\n this.localParticipant.on('trackAdded', function (track) { return handleReplaced(track); });\n };\n RoomV2.prototype._initTrackSwitchOffSignaling = function () {\n var _this = this;\n this._trackSwitchOffSignaling.on('updated', function (tracksOff, tracksOn) {\n try {\n _this._log.debug('received trackSwitch: ', { tracksOn: tracksOn, tracksOff: tracksOff });\n var trackUpdates_1 = new Map();\n tracksOn.forEach(function (trackSid) { return trackUpdates_1.set(trackSid, true); });\n tracksOff.forEach(function (trackSid) {\n if (trackUpdates_1.get(trackSid)) {\n // NOTE(mpatwardhan): This means that VIDEO-3762 has been reproduced.\n _this._log.warn(trackSid + \" is DUPLICATED in both tracksOff and tracksOn list\");\n }\n trackUpdates_1.set(trackSid, false);\n });\n _this.participants.forEach(function (participant) {\n participant.tracks.forEach(function (track) {\n var isOn = trackUpdates_1.get(track.sid);\n if (typeof isOn !== 'undefined') {\n track.setSwitchedOff(!isOn);\n trackUpdates_1.delete(track.sid);\n }\n });\n });\n // NOTE(mpatwardhan): Cache any notification about the tracks that we do not yet know about.\n trackUpdates_1.forEach(function (isOn, trackSid) { return _this._pendingSwitchOffStates.set(trackSid, !isOn); });\n }\n catch (ex) {\n _this._log.error('error processing track switch off:', ex);\n }\n });\n };\n RoomV2.prototype._initDominantSpeakerSignaling = function () {\n var _this = this;\n this._dominantSpeakerSignaling.on('updated', function () { return _this.setDominantSpeaker(_this._dominantSpeakerSignaling.loudestParticipantSid); });\n };\n RoomV2.prototype._initNetworkQualityMonitorSignaling = function () {\n var _this = this;\n this._networkQualitySignaling.on('ready', function () {\n var networkQualityMonitor = new _this._NetworkQualityMonitor(_this._peerConnectionManager, _this._networkQualitySignaling);\n _this._networkQualityMonitor = networkQualityMonitor;\n networkQualityMonitor.on('updated', function () {\n if (_this.iceConnectionState === 'failed') {\n return;\n }\n _this.localParticipant.setNetworkQualityLevel(networkQualityMonitor.level, networkQualityMonitor.levels);\n _this.participants.forEach(function (participant) {\n var levels = networkQualityMonitor.remoteLevels.get(participant.sid);\n if (levels) {\n participant.setNetworkQualityLevel(levels.level, levels);\n }\n });\n });\n networkQualityMonitor.start();\n });\n this._networkQualitySignaling.on('teardown', function () { return _this._teardownNetworkQualityMonitor(); });\n };\n RoomV2.prototype._teardownNetworkQualityMonitor = function () {\n if (this._networkQualityMonitor) {\n this._networkQualityMonitor.stop();\n this._networkQualityMonitor = null;\n }\n };\n /**\n * Get the {@link RoomV2}'s media statistics.\n * @returns {Promise.>}\n */\n RoomV2.prototype.getStats = function () {\n var _this = this;\n return this._peerConnectionManager.getStats().then(function (responses) {\n return new Map(Array.from(responses).map(function (_a) {\n var _b = __read(_a, 2), id = _b[0], response = _b[1];\n return [id, Object.assign({}, response, {\n localAudioTrackStats: filterAndAddLocalTrackSids(_this, response.localAudioTrackStats),\n localVideoTrackStats: filterAndAddLocalTrackSids(_this, response.localVideoTrackStats),\n remoteAudioTrackStats: filterAndAddRemoteTrackSids(_this, response.remoteAudioTrackStats),\n remoteVideoTrackStats: filterAndAddRemoteTrackSids(_this, response.remoteVideoTrackStats)\n })];\n }));\n });\n };\n return RoomV2;\n}(RoomSignaling));\n/**\n * Filter out {@link TrackStats} that aren't in the collection while also\n * stamping their Track SIDs.\n * @param {Map} idToSid\n * @param {Array} trackStats\n * @returns {Array}\n */\nfunction filterAndAddTrackSids(idToSid, trackStats) {\n return trackStats.reduce(function (trackStats, trackStat) {\n var trackSid = idToSid.get(trackStat.trackId);\n return trackSid\n ? [Object.assign({}, trackStat, { trackSid: trackSid })].concat(trackStats)\n : trackStats;\n }, []);\n}\n/**\n * Filter out {@link LocalTrackStats} that aren't currently published while also\n * stamping their Track SIDs.\n * @param {RoomV2} roomV2\n * @param {Array} localTrackStats\n * @returns {Array}\n */\nfunction filterAndAddLocalTrackSids(roomV2, localTrackStats) {\n return filterAndAddTrackSids(roomV2._published, localTrackStats);\n}\n/**\n * Filter out {@link RemoteTrackStats} that aren't currently subscribed while\n * also stamping their Track SIDs.\n * @param {RoomV2} roomV2\n * @param {Array} remoteTrackStats\n * @returns {Array}\n */\nfunction filterAndAddRemoteTrackSids(roomV2, remoteTrackStats) {\n var idToSid = new Map(Array.from(roomV2._subscribed.entries()).map(function (_a) {\n var _b = __read(_a, 2), sid = _b[0], id = _b[1];\n return [id, sid];\n }));\n return filterAndAddTrackSids(idToSid, remoteTrackStats);\n}\n/**\n * @typedef {object} RoomV2#Representation\n * @property {string} name\n * @property {LocalParticipantV2#Representation} participant\n * @property {?Array} participants\n * @property {?Array} peer_connections\n * @property {?RecordingV2#Representation} recording\n * @property {string} sid\n */\nfunction handleLocalParticipantEvents(roomV2, localParticipant) {\n var localParticipantUpdated = oncePerTick(function () {\n roomV2._publishNewLocalParticipantState();\n });\n var renegotiate = oncePerTick(function () {\n var trackSenders = flatMap(localParticipant.tracks, function (trackV2) { return trackV2.trackTransceiver; });\n roomV2._peerConnectionManager.setTrackSenders(trackSenders);\n });\n localParticipant.on('trackAdded', renegotiate);\n localParticipant.on('trackRemoved', renegotiate);\n localParticipant.on('updated', localParticipantUpdated);\n roomV2.on('stateChanged', function stateChanged(state) {\n if (state === 'disconnected') {\n localParticipant.removeListener('trackAdded', renegotiate);\n localParticipant.removeListener('trackRemoved', renegotiate);\n localParticipant.removeListener('updated', localParticipantUpdated);\n roomV2.removeListener('stateChanged', stateChanged);\n localParticipant.disconnect();\n }\n });\n roomV2.on('signalingConnectionStateChanged', function () {\n var localParticipant = roomV2.localParticipant, signalingConnectionState = roomV2.signalingConnectionState;\n var identity = localParticipant.identity, sid = localParticipant.sid;\n switch (signalingConnectionState) {\n case 'connected':\n localParticipant.connect(sid, identity);\n break;\n case 'reconnecting':\n localParticipant.reconnecting();\n break;\n }\n });\n}\nfunction handlePeerConnectionEvents(roomV2, peerConnectionManager) {\n peerConnectionManager.on('description', function onDescription(description) {\n roomV2._publishPeerConnectionState(description);\n });\n peerConnectionManager.dequeue('description');\n peerConnectionManager.on('candidates', function onCandidates(candidates) {\n roomV2._publishPeerConnectionState(candidates);\n });\n peerConnectionManager.dequeue('candidates');\n peerConnectionManager.on('trackAdded', roomV2._addTrackReceiver.bind(roomV2));\n peerConnectionManager.dequeue('trackAdded');\n peerConnectionManager.getTrackReceivers().forEach(roomV2._addTrackReceiver, roomV2);\n peerConnectionManager.on('connectionStateChanged', function () {\n roomV2.emit('connectionStateChanged');\n });\n peerConnectionManager.on('iceConnectionStateChanged', function () {\n roomV2.emit('iceConnectionStateChanged');\n if (roomV2.iceConnectionState === 'failed') {\n if (roomV2.localParticipant.networkQualityLevel !== null) {\n roomV2.localParticipant.setNetworkQualityLevel(0);\n }\n roomV2.participants.forEach(function (participant) {\n if (participant.networkQualityLevel !== null) {\n participant.setNetworkQualityLevel(0);\n }\n });\n }\n });\n}\nfunction handleTransportEvents(roomV2, transport) {\n transport.on('message', roomV2._update.bind(roomV2));\n transport.on('stateChanged', function stateChanged(state, error) {\n if (state === 'disconnected') {\n if (roomV2.state !== 'disconnected') {\n roomV2._disconnect(error);\n }\n transport.removeListener('stateChanged', stateChanged);\n }\n roomV2.emit('signalingConnectionStateChanged');\n });\n}\n/**\n * Periodically publish {@link StatsReport}s.\n * @private\n * @param {RoomV2} roomV2\n * @param {Transport} transport\n * @param {Number} intervalMs\n */\nfunction periodicallyPublishStats(roomV2, transport, intervalMs) {\n var movingAverageDeltas = new Map();\n var oddPublishCount = false;\n var interval = setInterval(function () {\n roomV2.getStats().then(function (stats) {\n oddPublishCount = !oddPublishCount;\n stats.forEach(function (response, id) {\n // NOTE(mmalavalli): A StatsReport is used to publish a \"stats-report\"\n // event instead of using StandardizedStatsResponse directly because\n // StatsReport will add zeros to properties that do not exist.\n var report = new StatsReport(id, response, true /* prepareForInsights */);\n // NOTE(mmalavalli): Since A/V sync metrics are not part of the StatsReport class,\n // we add them to the insights payload here.\n transport.publishEvent('quality', 'stats-report', 'info', {\n audioTrackStats: report.remoteAudioTrackStats.map(function (trackStat, i) {\n return addAVSyncMetricsToRemoteTrackStats(trackStat, response.remoteAudioTrackStats[i], movingAverageDeltas);\n }),\n localAudioTrackStats: report.localAudioTrackStats.map(function (trackStat, i) {\n return addAVSyncMetricsToLocalTrackStats(trackStat, response.localAudioTrackStats[i], movingAverageDeltas);\n }),\n localVideoTrackStats: report.localVideoTrackStats.map(function (trackStat, i) {\n return addAVSyncMetricsToLocalTrackStats(trackStat, response.localVideoTrackStats[i], movingAverageDeltas);\n }),\n peerConnectionId: report.peerConnectionId,\n videoTrackStats: report.remoteVideoTrackStats.map(function (trackStat, i) {\n return addAVSyncMetricsToRemoteTrackStats(trackStat, response.remoteVideoTrackStats[i], movingAverageDeltas);\n }),\n });\n // NOTE(mmalavalli): Clean up entries for Tracks that are no longer published or subscribed to.\n var keys = flatMap([\n 'localAudioTrackStats',\n 'localVideoTrackStats',\n 'remoteAudioTrackStats',\n 'remoteVideoTrackStats'\n ], function (prop) { return report[prop].map(function (_a) {\n var ssrc = _a.ssrc, trackSid = _a.trackSid;\n return trackSid + \"+\" + ssrc;\n }); });\n var movingAverageDeltaKeysToBeRemoved = difference(Array.from(movingAverageDeltas.keys()), keys);\n movingAverageDeltaKeysToBeRemoved.forEach(function (key) { return movingAverageDeltas.delete(key); });\n if (oddPublishCount) {\n // NOTE(mmalavalli): null properties of the \"active-ice-candidate-pair\"\n // payload are assigned default values until the Insights gateway\n // accepts null values.\n var activeIceCandidatePair = replaceNullsWithDefaults(response.activeIceCandidatePair, report.peerConnectionId);\n transport.publishEvent('quality', 'active-ice-candidate-pair', 'info', activeIceCandidatePair);\n }\n });\n }, function () {\n // Do nothing.\n });\n }, intervalMs);\n roomV2.on('stateChanged', function onStateChanged(state) {\n if (state === 'disconnected') {\n clearInterval(interval);\n roomV2.removeListener('stateChanged', onStateChanged);\n }\n });\n}\nfunction handleSubscriptions(room) {\n var trackSidsToTrackSignalings = room._getTrackSidsToTrackSignalings();\n room._subscriptionFailures.forEach(function (error, trackSid) {\n var trackSignaling = trackSidsToTrackSignalings.get(trackSid);\n if (trackSignaling) {\n room._subscriptionFailures.delete(trackSid);\n trackSignaling.subscribeFailed(createTwilioError(error.code, error.message));\n }\n });\n trackSidsToTrackSignalings.forEach(function (trackSignaling) {\n var trackId = room._subscribed.get(trackSignaling.sid);\n if (!trackId || (trackSignaling.isSubscribed && trackSignaling.trackTransceiver.id !== trackId)) {\n trackSignaling.setTrackTransceiver(null);\n }\n if (trackId) {\n room._getTrackReceiver(trackId).then(function (trackReceiver) { return trackSignaling.setTrackTransceiver(trackReceiver); });\n }\n });\n}\n/**\n * NOTE(mmalavalli): Since A/V sync metrics are not part of the public StatsReport class, we add them\n * only for reporting purposes.\n * @private\n */\nfunction addAVSyncMetricsToLocalTrackStats(trackStats, trackResponse, movingAverageDeltas) {\n var framesEncoded = trackResponse.framesEncoded, packetsSent = trackResponse.packetsSent, totalEncodeTime = trackResponse.totalEncodeTime, totalPacketSendDelay = trackResponse.totalPacketSendDelay;\n var augmentedTrackStats = Object.assign({}, trackStats);\n var key = trackStats.trackSid + \"+\" + trackStats.ssrc;\n var trackMovingAverageDeltas = movingAverageDeltas.get(key) || new Map();\n if (typeof totalEncodeTime === 'number' && typeof framesEncoded === 'number') {\n var trackAvgEncodeDelayMovingAverageDelta = trackMovingAverageDeltas.get('avgEncodeDelay')\n || new MovingAverageDelta();\n trackAvgEncodeDelayMovingAverageDelta.putSample(totalEncodeTime * 1000, framesEncoded);\n augmentedTrackStats.avgEncodeDelay = Math.round(trackAvgEncodeDelayMovingAverageDelta.get());\n trackMovingAverageDeltas.set('avgEncodeDelay', trackAvgEncodeDelayMovingAverageDelta);\n }\n if (typeof totalPacketSendDelay === 'number' && typeof packetsSent === 'number') {\n var trackAvgPacketSendDelayMovingAverageDelta = trackMovingAverageDeltas.get('avgPacketSendDelay')\n || new MovingAverageDelta();\n trackAvgPacketSendDelayMovingAverageDelta.putSample(totalPacketSendDelay * 1000, packetsSent);\n augmentedTrackStats.avgPacketSendDelay = Math.round(trackAvgPacketSendDelayMovingAverageDelta.get());\n trackMovingAverageDeltas.set('avgPacketSendDelay', trackAvgPacketSendDelayMovingAverageDelta);\n }\n movingAverageDeltas.set(key, trackMovingAverageDeltas);\n return augmentedTrackStats;\n}\n/**\n * NOTE(mmalavalli): Since A/V sync metrics are not part of the public StatsReport class, we add them\n * only for reporting purposes.\n * @private\n */\nfunction addAVSyncMetricsToRemoteTrackStats(trackStats, trackResponse, movingAverageDeltas) {\n var estimatedPlayoutTimestamp = trackResponse.estimatedPlayoutTimestamp, framesDecoded = trackResponse.framesDecoded, jitterBufferDelay = trackResponse.jitterBufferDelay, jitterBufferEmittedCount = trackResponse.jitterBufferEmittedCount, totalDecodeTime = trackResponse.totalDecodeTime;\n var augmentedTrackStats = Object.assign({}, trackStats);\n var key = trackStats.trackSid + \"+\" + trackStats.ssrc;\n var trackMovingAverageDeltas = movingAverageDeltas.get(key) || new Map();\n if (typeof estimatedPlayoutTimestamp === 'number') {\n augmentedTrackStats.estimatedPlayoutTimestamp = estimatedPlayoutTimestamp;\n }\n if (typeof framesDecoded === 'number' && typeof totalDecodeTime === 'number') {\n var trackAvgDecodeDelayMovingAverageDelta = trackMovingAverageDeltas.get('avgDecodeDelay')\n || new MovingAverageDelta();\n trackAvgDecodeDelayMovingAverageDelta.putSample(totalDecodeTime * 1000, framesDecoded);\n augmentedTrackStats.avgDecodeDelay = Math.round(trackAvgDecodeDelayMovingAverageDelta.get());\n trackMovingAverageDeltas.set('avgDecodeDelay', trackAvgDecodeDelayMovingAverageDelta);\n }\n if (typeof jitterBufferDelay === 'number' && typeof jitterBufferEmittedCount === 'number') {\n var trackAvgJitterBufferDelayMovingAverageDelta = trackMovingAverageDeltas.get('avgJitterBufferDelay')\n || new MovingAverageDelta();\n trackAvgJitterBufferDelayMovingAverageDelta.putSample(jitterBufferDelay * 1000, jitterBufferEmittedCount);\n augmentedTrackStats.avgJitterBufferDelay = Math.round(trackAvgJitterBufferDelayMovingAverageDelta.get());\n trackMovingAverageDeltas.set('avgJitterBufferDelay', trackAvgJitterBufferDelayMovingAverageDelta);\n }\n movingAverageDeltas.set(key, trackMovingAverageDeltas);\n return augmentedTrackStats;\n}\nfunction replaceNullsWithDefaults(activeIceCandidatePair, peerConnectionId) {\n activeIceCandidatePair = Object.assign({\n availableIncomingBitrate: 0,\n availableOutgoingBitrate: 0,\n bytesReceived: 0,\n bytesSent: 0,\n consentRequestsSent: 0,\n currentRoundTripTime: 0,\n lastPacketReceivedTimestamp: 0,\n lastPacketSentTimestamp: 0,\n nominated: false,\n peerConnectionId: peerConnectionId,\n priority: 0,\n readable: false,\n requestsReceived: 0,\n requestsSent: 0,\n responsesReceived: 0,\n responsesSent: 0,\n retransmissionsReceived: 0,\n retransmissionsSent: 0,\n state: 'failed',\n totalRoundTripTime: 0,\n transportId: '',\n writable: false\n }, filterObject(activeIceCandidatePair || {}, null));\n activeIceCandidatePair.localCandidate = Object.assign({\n candidateType: 'host',\n deleted: false,\n ip: '',\n port: 0,\n priority: 0,\n protocol: 'udp',\n url: ''\n }, filterObject(activeIceCandidatePair.localCandidate || {}, null));\n activeIceCandidatePair.remoteCandidate = Object.assign({\n candidateType: 'host',\n ip: '',\n port: 0,\n priority: 0,\n protocol: 'udp',\n url: ''\n }, filterObject(activeIceCandidatePair.remoteCandidate || {}, null));\n return activeIceCandidatePair;\n}\nmodule.exports = RoomV2;\n//# sourceMappingURL=room.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar StateMachine = require('../../statemachine');\nvar TwilioConnection = require('../../twilioconnection');\nvar DefaultBackoff = require('../../util/backoff');\nvar reconnectBackoffConfig = require('../../util/constants').reconnectBackoffConfig;\nvar Timeout = require('../../util/timeout');\nvar _a = require('../../util/constants'), SDK_NAME = _a.SDK_NAME, SDK_VERSION = _a.SDK_VERSION, SDP_FORMAT = _a.SDP_FORMAT;\nvar _b = require('../../util'), createBandwidthProfilePayload = _b.createBandwidthProfilePayload, createMediaSignalingPayload = _b.createMediaSignalingPayload, createMediaWarningsPayload = _b.createMediaWarningsPayload, createSubscribePayload = _b.createSubscribePayload, getUserAgent = _b.getUserAgent, isNonArrayObject = _b.isNonArrayObject;\nvar _c = require('../../util/twilio-video-errors'), createTwilioError = _c.createTwilioError, RoomCompletedError = _c.RoomCompletedError, SignalingConnectionError = _c.SignalingConnectionError, SignalingServerBusyError = _c.SignalingServerBusyError;\nvar ICE_VERSION = 1;\nvar RSP_VERSION = 2;\n/*\nTwilioConnectionTransport States\n----------------\n\n +-----------+\n | |\n | syncing |---------+\n | | |\n +-----------+ |\n ^ | |\n | | |\n | v v\n +------------+ +-----------+ +--------------+\n | | | | | |\n | connecting |--->| connected |--->| disconnected |\n | | | | | |\n +------------+ +-----------+ +--------------+\n | ^\n | |\n | |\n +------------------------------+\n\n*/\nvar states = {\n connecting: [\n 'connected',\n 'disconnected'\n ],\n connected: [\n 'disconnected',\n 'syncing'\n ],\n syncing: [\n 'connected',\n 'disconnected'\n ],\n disconnected: []\n};\n/**\n * A {@link TwilioConnectionTransport} supports sending and receiving Room Signaling Protocol\n * (RSP) messages. It also supports RSP requests, such as Sync and Disconnect.\n * @extends StateMachine\n * @emits TwilioConnectionTransport#connected\n * @emits TwilioConnectionTransport#message\n */\nvar TwilioConnectionTransport = /** @class */ (function (_super) {\n __extends(TwilioConnectionTransport, _super);\n /**\n * Construct a {@link TwilioConnectionTransport}.\n * @param {?string} name\n * @param {string} accessToken\n * @param {ParticipantSignaling} localParticipant\n * @param {PeerConnectionManager} peerConnectionManager\n * @param {string} wsServer\n * @param {object} [options]\n */\n function TwilioConnectionTransport(name, accessToken, localParticipant, peerConnectionManager, wsServer, options) {\n var _this = this;\n options = Object.assign({\n Backoff: DefaultBackoff,\n TwilioConnection: TwilioConnection,\n iceServers: null,\n trackPriority: true,\n trackSwitchOff: true,\n renderHints: true,\n userAgent: getUserAgent()\n }, options);\n _this = _super.call(this, 'connecting', states) || this;\n Object.defineProperties(_this, {\n _accessToken: {\n value: accessToken\n },\n _automaticSubscription: {\n value: options.automaticSubscription\n },\n _bandwidthProfile: {\n value: options.bandwidthProfile\n },\n _dominantSpeaker: {\n value: options.dominantSpeaker\n },\n _adaptiveSimulcast: {\n value: options.adaptiveSimulcast\n },\n _eventObserver: {\n value: options.eventObserver,\n writable: false\n },\n _renderHints: {\n value: options.renderHints\n },\n _iceServersStatus: {\n value: Array.isArray(options.iceServers)\n ? 'overrode'\n : 'acquire'\n },\n _localParticipant: {\n value: localParticipant\n },\n _name: {\n value: name,\n },\n _networkQuality: {\n value: isNonArrayObject(options.networkQuality) || options.networkQuality\n },\n _notifyWarnings: {\n value: options.notifyWarnings\n },\n _options: {\n value: options\n },\n _peerConnectionManager: {\n value: peerConnectionManager\n },\n _sessionTimer: {\n value: null,\n writable: true\n },\n _sessionTimeoutMS: {\n value: 0,\n writable: true\n },\n _reconnectBackoff: {\n value: new options.Backoff(reconnectBackoffConfig)\n },\n _session: {\n value: null,\n writable: true\n },\n _trackPriority: {\n value: options.trackPriority\n },\n _trackSwitchOff: {\n value: options.trackSwitchOff\n },\n _twilioConnection: {\n value: null,\n writable: true\n },\n _updatesReceived: {\n value: []\n },\n _updatesToSend: {\n value: []\n },\n _userAgent: {\n value: options.userAgent\n },\n _wsServer: {\n value: wsServer\n }\n });\n setupTransport(_this);\n return _this;\n }\n /**\n * Create a Connect, Sync or Disconnect RSP message.\n * @private\n * @returns {?object}\n */\n TwilioConnectionTransport.prototype._createConnectOrSyncOrDisconnectMessage = function () {\n if (this.state === 'connected') {\n return null;\n }\n if (this.state === 'disconnected') {\n return {\n session: this._session,\n type: 'disconnect',\n version: RSP_VERSION\n };\n }\n var type = {\n connecting: 'connect',\n syncing: 'sync'\n }[this.state];\n var message = {\n name: this._name,\n participant: this._localParticipant.getState(),\n peer_connections: this._peerConnectionManager.getStates(),\n type: type,\n version: RSP_VERSION\n };\n if (message.type === 'connect') {\n message.ice_servers = this._iceServersStatus;\n message.publisher = {\n name: SDK_NAME,\n sdk_version: SDK_VERSION,\n user_agent: this._userAgent\n };\n if (this._bandwidthProfile) {\n message.bandwidth_profile = createBandwidthProfilePayload(this._bandwidthProfile);\n }\n if (this._notifyWarnings) {\n message.participant.media_warnings = createMediaWarningsPayload(this._notifyWarnings);\n }\n message.media_signaling = createMediaSignalingPayload(this._dominantSpeaker, this._networkQuality, this._trackPriority, this._trackSwitchOff, this._adaptiveSimulcast, this._renderHints);\n message.subscribe = createSubscribePayload(this._automaticSubscription);\n message.format = SDP_FORMAT;\n message.token = this._accessToken;\n }\n else if (message.type === 'sync') {\n message.session = this._session;\n message.token = this._accessToken;\n }\n else if (message.type === 'update') {\n message.session = this._session;\n }\n return message;\n };\n /**\n * Create an \"ice\" message.\n * @private\n */\n TwilioConnectionTransport.prototype._createIceMessage = function () {\n return {\n edge: 'roaming',\n token: this._accessToken,\n type: 'ice',\n version: ICE_VERSION\n };\n };\n /**\n * Send a Connect, Sync or Disconnect RSP message.\n * @private\n */\n TwilioConnectionTransport.prototype._sendConnectOrSyncOrDisconnectMessage = function () {\n var message = this._createConnectOrSyncOrDisconnectMessage();\n if (message) {\n this._twilioConnection.sendMessage(message);\n }\n };\n /**\n * Disconnect the {@link TwilioConnectionTransport}. Returns true if calling the method resulted\n * in disconnection.\n * @param {TwilioError} [error]\n * @returns {boolean}\n */\n TwilioConnectionTransport.prototype.disconnect = function (error) {\n if (this.state !== 'disconnected') {\n this.preempt('disconnected', null, [error]);\n this._sendConnectOrSyncOrDisconnectMessage();\n this._twilioConnection.close();\n return true;\n }\n return false;\n };\n /**\n * Publish an RSP Update. Returns true if calling the method resulted in\n * publishing (or eventually publishing) the update.\n * @param {object} update\n * @returns {boolean}\n */\n TwilioConnectionTransport.prototype.publish = function (update) {\n switch (this.state) {\n case 'connected':\n this._twilioConnection.sendMessage(Object.assign({\n session: this._session,\n type: 'update',\n version: RSP_VERSION\n }, update));\n return true;\n case 'connecting':\n case 'syncing':\n this._updatesToSend.push(update);\n return true;\n case 'disconnected':\n default:\n return false;\n }\n };\n /**\n * Publish (or queue) an event to the Insights gateway.\n * @param {string} group - Event group name\n * @param {string} name - Event name\n * @param {string} level - Event level\n * @param {object} payload - Event payload\n * @returns {void}\n */\n TwilioConnectionTransport.prototype.publishEvent = function (group, name, level, payload) {\n this._eventObserver.emit('event', { group: group, name: name, level: level, payload: payload });\n };\n /**\n * Sync the {@link TwilioConnectionTransport}. Returns true if calling the method resulted in\n * syncing.\n * @returns {boolean}\n */\n TwilioConnectionTransport.prototype.sync = function () {\n if (this.state === 'connected') {\n this.preempt('syncing');\n this._sendConnectOrSyncOrDisconnectMessage();\n return true;\n }\n return false;\n };\n /**\n * @private\n * @returns {void}\n */\n TwilioConnectionTransport.prototype._setSession = function (session, sessionTimeout) {\n this._session = session;\n this._sessionTimeoutMS = sessionTimeout * 1000;\n };\n /**\n * Determines if we should attempt reconnect.\n * returns a Promise to wait on before attempting to\n * reconnect. returns null if its not okay to reconnect.\n * @private\n * @returns {Promise}\n */\n TwilioConnectionTransport.prototype._getReconnectTimer = function () {\n var _this = this;\n if (this._sessionTimeoutMS === 0) {\n // this means either we have never connected.\n // or we timed out while trying to reconnect\n // In either case we do not want to reconnect.\n return null;\n }\n // start session timer\n if (!this._sessionTimer) {\n this._sessionTimer = new Timeout(function () {\n // ensure that _clearReconnectTimer wasn't\n // called while we were waiting.\n if (_this._sessionTimer) {\n // do not allow any more reconnect attempts.\n _this._sessionTimeoutMS = 0;\n }\n }, this._sessionTimeoutMS);\n }\n // return promise that waits with exponential backoff.\n return new Promise(function (resolve) {\n _this._reconnectBackoff.backoff(resolve);\n });\n };\n /**\n * clears the session reconnect timer.\n *\n * @private\n * @returns {void}\n */\n TwilioConnectionTransport.prototype._clearReconnectTimer = function () {\n this._reconnectBackoff.reset();\n if (this._sessionTimer) {\n this._sessionTimer.clear();\n this._sessionTimer = null;\n }\n };\n return TwilioConnectionTransport;\n}(StateMachine));\n/**\n * @event TwilioConnectionTransport#connected\n * @param {object} initialState\n */\n/**\n * @event TwilioConnectionTransport#message\n * @param {object} peerConnections\n */\nfunction reducePeerConnections(peerConnections) {\n return Array.from(peerConnections.reduce(function (peerConnectionsById, update) {\n var reduced = peerConnectionsById.get(update.id) || update;\n // First, reduce the top-level `description` property.\n if (!reduced.description && update.description) {\n reduced.description = update.description;\n }\n else if (reduced.description && update.description) {\n if (update.description.revision > reduced.description.revision) {\n reduced.description = update.description;\n }\n }\n // Then, reduce the top-level `ice` property.\n if (!reduced.ice && update.ice) {\n reduced.ice = update.ice;\n }\n else if (reduced.ice && update.ice) {\n if (update.ice.revision > reduced.ice.revision) {\n reduced.ice = update.ice;\n }\n }\n // Finally, update the map.\n peerConnectionsById.set(reduced.id, reduced);\n return peerConnectionsById;\n }, new Map()).values());\n}\nfunction reduceUpdates(updates) {\n return updates.reduce(function (reduced, update) {\n // First, reduce the top-level `participant` property.\n if (!reduced.participant && update.participant) {\n reduced.participant = update.participant;\n }\n else if (reduced.participant && update.participant) {\n if (update.participant.revision > reduced.participant.revision) {\n reduced.participant = update.participant;\n }\n }\n // Then, reduce the top-level `peer_connections` property.\n /* eslint camelcase:0 */\n if (!reduced.peer_connections && update.peer_connections) {\n reduced.peer_connections = reducePeerConnections(update.peer_connections);\n }\n else if (reduced.peer_connections && update.peer_connections) {\n reduced.peer_connections = reducePeerConnections(reduced.peer_connections.concat(update.peer_connections));\n }\n return reduced;\n }, {});\n}\nfunction setupTransport(transport) {\n function createOrResetTwilioConnection() {\n if (transport.state === 'disconnected') {\n return;\n }\n if (transport._twilioConnection) {\n transport._twilioConnection.removeListener('message', handleMessage);\n }\n var _iceServersStatus = transport._iceServersStatus, _options = transport._options, _wsServer = transport._wsServer, state = transport.state;\n var TwilioConnection = _options.TwilioConnection;\n var twilioConnection = new TwilioConnection(_wsServer, Object.assign({\n helloBody: state === 'connecting' && _iceServersStatus === 'acquire'\n ? transport._createIceMessage()\n : transport._createConnectOrSyncOrDisconnectMessage()\n }, _options));\n twilioConnection.once('close', function (reason) {\n if (reason === TwilioConnection.CloseReason.LOCAL) {\n disconnect();\n }\n else {\n disconnect(new Error(reason));\n }\n });\n twilioConnection.on('message', handleMessage);\n transport._twilioConnection = twilioConnection;\n }\n function disconnect(error) {\n if (transport.state === 'disconnected') {\n return;\n }\n if (!error) {\n transport.disconnect();\n return;\n }\n var reconnectTimer = transport._getReconnectTimer();\n if (!reconnectTimer) {\n var twilioError = error.message === TwilioConnection.CloseReason.BUSY\n ? new SignalingServerBusyError()\n : new SignalingConnectionError();\n transport.disconnect(twilioError);\n return;\n }\n if (transport.state === 'connected') {\n transport.preempt('syncing');\n }\n reconnectTimer.then(createOrResetTwilioConnection);\n }\n function handleMessage(message) {\n if (transport.state === 'disconnected') {\n return;\n }\n if (message.type === 'error') {\n transport.disconnect(createTwilioError(message.code, message.message));\n return;\n }\n switch (transport.state) {\n case 'connected':\n switch (message.type) {\n case 'connected':\n case 'synced':\n case 'update':\n case 'warning':\n transport.emit('message', message);\n return;\n case 'disconnected':\n transport.disconnect(message.status === 'completed'\n ? new RoomCompletedError()\n : null);\n return;\n default:\n // Do nothing.\n return;\n }\n case 'connecting':\n switch (message.type) {\n case 'iced':\n transport._options.onIced(message.ice_servers).then(function () {\n transport._sendConnectOrSyncOrDisconnectMessage();\n });\n return;\n case 'connected':\n transport._setSession(message.session, message.options.session_timeout);\n transport.emit('connected', message);\n transport.preempt('connected');\n return;\n case 'synced':\n case 'update':\n transport._updatesReceived.push(message);\n return;\n case 'disconnected':\n transport.disconnect(message.status === 'completed'\n ? new RoomCompletedError()\n : null);\n return;\n default:\n // Do nothing.\n return;\n }\n case 'syncing':\n switch (message.type) {\n case 'connected':\n case 'update':\n transport._updatesReceived.push(message);\n return;\n case 'synced':\n transport._clearReconnectTimer();\n transport.emit('message', message);\n transport.preempt('connected');\n return;\n case 'disconnected':\n transport.disconnect(message.status === 'completed'\n ? new RoomCompletedError()\n : null);\n return;\n default:\n // Do nothing.\n return;\n }\n default:\n // Impossible\n return;\n }\n }\n transport.on('stateChanged', function stateChanged(state) {\n switch (state) {\n case 'connected': {\n var updates = transport._updatesToSend.splice(0);\n if (updates.length) {\n transport.publish(reduceUpdates(updates));\n }\n transport._updatesReceived.splice(0).forEach(function (update) { return transport.emit('message', update); });\n return;\n }\n case 'disconnected':\n transport._twilioConnection.removeListener('message', handleMessage);\n transport.removeListener('stateChanged', stateChanged);\n return;\n case 'syncing':\n // Do nothing.\n return;\n default:\n // Impossible\n return;\n }\n });\n var _options = transport._options, _iceServersStatus = transport._iceServersStatus;\n var iceServers = _options.iceServers, onIced = _options.onIced;\n if (_iceServersStatus === 'overrode') {\n onIced(iceServers).then(createOrResetTwilioConnection);\n }\n else {\n createOrResetTwilioConnection();\n }\n}\nmodule.exports = TwilioConnectionTransport;\n//# sourceMappingURL=twilioconnectiontransport.js.map","'use strict';\nvar CancelablePromise = require('../../util/cancelablepromise');\nvar DefaultPeerConnectionManager = require('./peerconnectionmanager');\nvar DefaultRoomV2 = require('./room');\nvar DefaultTransport = require('./twilioconnectiontransport');\nvar _a = require('../../util/twilio-video-errors'), SignalingConnectionDisconnectedError = _a.SignalingConnectionDisconnectedError, SignalingIncomingMessageInvalidError = _a.SignalingIncomingMessageInvalidError;\nvar _b = require('../../util'), flatMap = _b.flatMap, createRoomConnectEventPayload = _b.createRoomConnectEventPayload;\nfunction createCancelableRoomSignalingPromise(token, wsServer, localParticipant, encodingParameters, preferredCodecs, options) {\n options = Object.assign({\n PeerConnectionManager: DefaultPeerConnectionManager,\n RoomV2: DefaultRoomV2,\n Transport: DefaultTransport\n }, options);\n var adaptiveSimulcast = preferredCodecs.video[0] && preferredCodecs.video[0].adaptiveSimulcast === true;\n var PeerConnectionManager = options.PeerConnectionManager, RoomV2 = options.RoomV2, Transport = options.Transport, iceServers = options.iceServers, log = options.log;\n var peerConnectionManager = new PeerConnectionManager(encodingParameters, preferredCodecs, options);\n var trackSenders = flatMap(localParticipant.tracks, function (trackV2) { return [trackV2.trackTransceiver]; });\n peerConnectionManager.setTrackSenders(trackSenders);\n var cancellationError = new Error('Canceled');\n var transport;\n var cancelablePromise = new CancelablePromise(function (resolve, reject, isCanceled) {\n var onIced = function (iceServers) {\n if (isCanceled()) {\n reject(cancellationError);\n return Promise.reject(cancellationError);\n }\n log.debug('Got ICE servers:', iceServers);\n options.iceServers = iceServers;\n peerConnectionManager.setConfiguration(options);\n return peerConnectionManager.createAndOffer().then(function () {\n if (isCanceled()) {\n reject(cancellationError);\n throw cancellationError;\n }\n log.debug('createAndOffer() succeeded.');\n // NOTE(mmalavalli): PeerConnectionManager#createAndOffer() queues the\n // initial offer in the event queue for the 'description' event. So,\n // we are dequeueing to prevent the spurious 'update' message sent by\n // the client after connecting to a room.\n peerConnectionManager.dequeue('description');\n }).catch(function (error) {\n log.error('createAndOffer() failed:', error);\n reject(error);\n throw error;\n });\n };\n var automaticSubscription = options.automaticSubscription, bandwidthProfile = options.bandwidthProfile, dominantSpeaker = options.dominantSpeaker, environment = options.environment, eventObserver = options.eventObserver, loggerName = options.loggerName, logLevel = options.logLevel, name = options.name, networkMonitor = options.networkMonitor, networkQuality = options.networkQuality, notifyWarnings = options.notifyWarnings, realm = options.realm, sdpSemantics = options.sdpSemantics;\n // decide which msp channels to request\n // dominantSpeaker, networkQuality\n var trackPriority = !!bandwidthProfile;\n var trackSwitchOff = !!bandwidthProfile;\n var renderHints = !!bandwidthProfile &&\n (options.clientTrackSwitchOffControl !== 'disabled' || options.contentPreferencesMode !== 'disabled');\n var transportOptions = Object.assign({\n adaptiveSimulcast: adaptiveSimulcast,\n automaticSubscription: automaticSubscription,\n dominantSpeaker: dominantSpeaker,\n environment: environment,\n eventObserver: eventObserver,\n loggerName: loggerName,\n logLevel: logLevel,\n networkMonitor: networkMonitor,\n networkQuality: networkQuality,\n notifyWarnings: notifyWarnings,\n iceServers: iceServers,\n onIced: onIced,\n realm: realm,\n renderHints: renderHints,\n sdpSemantics: sdpSemantics,\n trackPriority: trackPriority,\n trackSwitchOff: trackSwitchOff\n }, bandwidthProfile ? {\n bandwidthProfile: bandwidthProfile\n } : {});\n transport = new Transport(name, token, localParticipant, peerConnectionManager, wsServer, transportOptions);\n var connectEventPayload = createRoomConnectEventPayload(options);\n eventObserver.emit('event', connectEventPayload);\n transport.once('connected', function (initialState) {\n log.debug('Transport connected:', initialState);\n if (isCanceled()) {\n reject(cancellationError);\n return;\n }\n var localParticipantState = initialState.participant;\n if (!localParticipantState) {\n reject(new SignalingIncomingMessageInvalidError());\n return;\n }\n resolve(new RoomV2(localParticipant, initialState, transport, peerConnectionManager, options));\n });\n transport.once('stateChanged', function (state, error) {\n if (state === 'disconnected') {\n transport = null;\n reject(error || new SignalingConnectionDisconnectedError());\n }\n else {\n log.debug('Transport state changed:', state);\n }\n });\n }, function () {\n if (transport) {\n transport.disconnect();\n transport = null;\n }\n });\n cancelablePromise.catch(function () {\n if (transport) {\n transport.disconnect();\n transport = null;\n }\n peerConnectionManager.close();\n });\n return cancelablePromise;\n}\nmodule.exports = createCancelableRoomSignalingPromise;\n//# sourceMappingURL=cancelableroomsignalingpromise.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar ParticipantSignaling = require('./participant');\nvar LocalParticipantSignaling = /** @class */ (function (_super) {\n __extends(LocalParticipantSignaling, _super);\n function LocalParticipantSignaling() {\n var _this = _super.call(this) || this;\n Object.defineProperties(_this, {\n _publicationsToTrackSenders: {\n value: new Map()\n },\n _trackSendersToPublications: {\n value: new Map()\n }\n });\n return _this;\n }\n /**\n * @param {DataTrackSender|MediaTrackSender} trackSender\n * @param {string} name\n * @param {Track.Priority} priority\n * @param {?NoiseCancellationVendor} noiseCancellationVendor\n * @returns {LocalTrackPublicationSignaling} publication\n */\n LocalParticipantSignaling.prototype.addTrack = function (trackSender, name, priority, noiseCancellationVendor) {\n if (noiseCancellationVendor === void 0) { noiseCancellationVendor = null; }\n var publication = this._createLocalTrackPublicationSignaling(trackSender, name, priority, noiseCancellationVendor);\n this._trackSendersToPublications.set(trackSender, publication);\n this._publicationsToTrackSenders.set(publication, trackSender);\n _super.prototype.addTrack.call(this, publication);\n return this;\n };\n /**\n * @param {DataTrackSender|MediaTrackSender} trackSender\n * @returns {?LocalTrackPublicationSignaling}\n */\n LocalParticipantSignaling.prototype.getPublication = function (trackSender) {\n return this._trackSendersToPublications.get(trackSender) || null;\n };\n /**\n * @param {LocalTrackPublicationSignaling} trackPublication\n * @returns {?DataTrackSender|MediaTrackSender}\n */\n LocalParticipantSignaling.prototype.getSender = function (trackPublication) {\n return this._publicationsToTrackSenders.get(trackPublication) || null;\n };\n /**\n * @param {DataTrackSender|MediaTrackSender} trackSender\n * @returns {?LocalTrackPublicationSignaling}\n */\n LocalParticipantSignaling.prototype.removeTrack = function (trackSender) {\n var publication = this._trackSendersToPublications.get(trackSender);\n if (!publication) {\n return null;\n }\n this._trackSendersToPublications.delete(trackSender);\n this._publicationsToTrackSenders.delete(publication);\n var didDelete = _super.prototype.removeTrack.call(this, publication);\n if (didDelete) {\n publication.stop();\n }\n return publication;\n };\n return LocalParticipantSignaling;\n}(ParticipantSignaling));\nmodule.exports = LocalParticipantSignaling;\n//# sourceMappingURL=localparticipant.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar TrackSignaling = require('./track');\n/**\n * A {@link LocalTrackPublication} implementation\n * @extends TrackSignaling\n * @property {Track.ID} id\n */\nvar LocalTrackPublicationSignaling = /** @class */ (function (_super) {\n __extends(LocalTrackPublicationSignaling, _super);\n /**\n * Construct a {@link LocalTrackPublicationSignaling}. {@link TrackSenders}\n * are always cloned.\n * @param {DataTrackSender|MediaTrackSender} trackSender - the {@link TrackSender}\n * of the {@link LocalTrack} to be published\n * @param {string} name - the name of the {@link LocalTrack} to be published\n * @param {Track.Priority} priority - initial {@link Track.Priority}\n */\n function LocalTrackPublicationSignaling(trackSender, name, priority) {\n var _this = this;\n // NOTE(lrivas): Safely clone a media stream track while preserving the original\n // enabled state. This is needed because Safari 18 incorrectly enables tracks\n // during cloning. Bug report: https://bugs.webkit.org/show_bug.cgi?id=281758\n var clonedTrackSender = trackSender.clone();\n if (trackSender.kind !== 'data') {\n clonedTrackSender.track.enabled = trackSender.track.enabled;\n }\n trackSender = clonedTrackSender;\n var enabled = trackSender.kind === 'data' ? true : trackSender.track.enabled;\n _this = _super.call(this, name, trackSender.kind, enabled, priority) || this;\n _this.setTrackTransceiver(trackSender);\n Object.defineProperties(_this, {\n _updatedPriority: {\n value: priority,\n writable: true\n },\n id: {\n enumerable: true,\n value: trackSender.id\n }\n });\n return _this;\n }\n Object.defineProperty(LocalTrackPublicationSignaling.prototype, \"updatedPriority\", {\n /**\n * The updated {@link Track.Priority} of the {@link LocalTrack}.\n * @property {Track.priority}\n */\n get: function () {\n return this._updatedPriority;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Enable (or disable) the {@link LocalTrackPublicationSignaling} if it is not\n * already enabled (or disabled). This also updates the cloned\n * {@link MediaTrackSender}'s MediaStreamTracks `enabled` state.\n * @param {boolean} [enabled=true]\n * @return {this}\n */\n LocalTrackPublicationSignaling.prototype.enable = function (enabled) {\n enabled = typeof enabled === 'boolean' ? enabled : true;\n this.trackTransceiver.track.enabled = enabled;\n return _super.prototype.enable.call(this, enabled);\n };\n /**\n * Rejects the SID's deferred promise with the given Error.\n * @param {Error} error\n * @returns {this}\n */\n LocalTrackPublicationSignaling.prototype.publishFailed = function (error) {\n if (setError(this, error)) {\n this.emit('updated');\n }\n return this;\n };\n /**\n * Update the {@link Track.Priority} of the published {@link LocalTrack}.\n * @param {Track.priority} priority\n * @returns {this}\n */\n LocalTrackPublicationSignaling.prototype.setPriority = function (priority) {\n if (this._updatedPriority !== priority) {\n this._updatedPriority = priority;\n this.emit('updated');\n }\n return this;\n };\n /**\n * Set the published {@link LocalTrack}'s {@link Track.SID}.\n * @param {Track.SID} sid\n * @returns {this}\n */\n LocalTrackPublicationSignaling.prototype.setSid = function (sid) {\n if (this._error) {\n return this;\n }\n return _super.prototype.setSid.call(this, sid);\n };\n /**\n * Stop the cloned {@link TrackSender}.\n * @returns {void}\n */\n LocalTrackPublicationSignaling.prototype.stop = function () {\n this.trackTransceiver.stop();\n };\n return LocalTrackPublicationSignaling;\n}(TrackSignaling));\n/**\n * @param {LocalTrackPublication} publication\n * @param {Error} error\n * @returns {boolean} updated\n */\nfunction setError(publication, error) {\n if (publication._sid !== null || publication._error) {\n return false;\n }\n publication._error = error;\n return true;\n}\nmodule.exports = LocalTrackPublicationSignaling;\n//# sourceMappingURL=localtrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar LocalTrackPublicationSignaling = require('../localtrackpublication');\nvar TwilioWarning = require('../../util/twiliowarning');\nvar createTwilioError = require('../../util/twilio-video-errors').createTwilioError;\n/**\n * @extends LocalTrackPublicationSignaling\n */\nvar LocalTrackPublicationV2 = /** @class */ (function (_super) {\n __extends(LocalTrackPublicationV2, _super);\n /**\n * Construct a {@link LocalTrackPublicationV2}.\n * @param {DataTrackSender|MediaTrackSender} trackSender\n * @param {string} name\n * @param {Track.Priority} priority\n * @param {?NoiseCancellationVendor} noiseCancellationVendor\n * @param {object} [options]\n */\n function LocalTrackPublicationV2(trackSender, name, priority, noiseCancellationVendor, options) {\n var _this = _super.call(this, trackSender, name, priority) || this;\n Object.defineProperties(_this, {\n _log: {\n value: options.log.createLog('default', _this)\n },\n _mediaStates: {\n value: { recordings: null },\n writable: true\n },\n _noiseCancellationVendor: {\n value: noiseCancellationVendor,\n }\n });\n return _this;\n }\n /**\n * Get the {@link LocalTrackPublicationV2#Representation} of a given {@link TrackSignaling}.\n * @returns {LocalTrackPublicationV2#Representation} - without the SID\n */\n LocalTrackPublicationV2.prototype.getState = function () {\n var state = {\n enabled: this.isEnabled,\n id: this.id,\n kind: this.kind,\n name: this.name,\n priority: this.updatedPriority,\n };\n if (this._noiseCancellationVendor) {\n // eslint-disable-next-line camelcase\n state.audio_processor = this._noiseCancellationVendor;\n }\n return state;\n };\n LocalTrackPublicationV2.prototype.toString = function () {\n return \"[LocalTrackPublicationV2: \" + this.sid + \"]\";\n };\n /**\n * Compare the {@link LocalTrackPublicationV2} to a {@link LocalTrackPublicationV2#Representation} of itself\n * and perform any updates necessary.\n * @param {PublishedTrack} track\n * @returns {this}\n * @fires TrackSignaling#updated\n */\n LocalTrackPublicationV2.prototype.update = function (track) {\n switch (track.state) {\n case 'ready':\n this.setSid(track.sid);\n break;\n case 'failed': {\n var error = track.error;\n this.publishFailed(createTwilioError(error.code, error.message));\n break;\n }\n default: // 'created'\n break;\n }\n return this;\n };\n LocalTrackPublicationV2.prototype.updateMediaStates = function (mediaStates) {\n if (!mediaStates || !mediaStates.recordings ||\n this._mediaStates.recordings === mediaStates.recordings) {\n return this;\n }\n this._mediaStates.recordings = mediaStates.recordings;\n switch (this._mediaStates.recordings) {\n case 'OK':\n this._log.info('Warnings have cleared.');\n this.emit('warningsCleared');\n break;\n case 'NO_MEDIA':\n this._log.warn('Recording media lost.');\n this.emit('warning', TwilioWarning.recordingMediaLost);\n break;\n default:\n this._log.warn(\"Unknown media state detected: \" + this._mediaStates.recordings);\n break;\n }\n return this;\n };\n return LocalTrackPublicationV2;\n}(LocalTrackPublicationSignaling));\n/**\n * The Room Signaling Protocol (RSP) representation of a {@link LocalTrackPublicationV2}.\n * @typedef {object} LocalTrackPublicationV2#Representation\n * @property {boolean} enabled\n * @property {Track.ID} id\n * @property {Track.Kind} kind\n * @property {string} name\n * @priority {Track.Priority} priority\n * @property {Track.SID} sid\n */\nmodule.exports = LocalTrackPublicationV2;\n//# sourceMappingURL=localtrackpublication.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar LocalParticipantSignaling = require('../localparticipant');\nvar LocalTrackPublicationV2 = require('./localtrackpublication');\nvar DEFAULT_LOG_LEVEL = require('../../util/constants').DEFAULT_LOG_LEVEL;\nvar Log = require('../../util/log');\nvar _a = require('../../util'), buildLogLevels = _a.buildLogLevels, isDeepEqual = _a.isDeepEqual;\n/**\n * @extends ParticipantSignaling\n * @property {BandwidthProfileOptions} bandwidthProfile\n * @property {NetworkQualityConfigurationImpl} networkQualityConfiguration\n * @property {number} revision\n * @emits LocalParticipantV2#updated\n */\nvar LocalParticipantV2 = /** @class */ (function (_super) {\n __extends(LocalParticipantV2, _super);\n /**\n * Construct a {@link LocalParticipantV2}.\n * @param {EncodingParametersImpl} encodingParameters\n * @param {NetworkQualityConfigurationImpl} networkQualityConfiguration\n * @param {object} [options]\n */\n function LocalParticipantV2(encodingParameters, networkQualityConfiguration, options) {\n var _this = this;\n options = Object.assign({\n logLevel: DEFAULT_LOG_LEVEL,\n LocalTrackPublicationV2: LocalTrackPublicationV2\n }, options);\n _this = _super.call(this) || this;\n var logLevels = buildLogLevels(options.logLevel);\n Object.defineProperties(_this, {\n _bandwidthProfile: {\n value: null,\n writable: true\n },\n _bandwidthProfileRevision: {\n value: 0,\n writable: true\n },\n _encodingParameters: {\n value: encodingParameters\n },\n _removeListeners: {\n value: new Map()\n },\n _LocalTrackPublicationV2: {\n value: options.LocalTrackPublicationV2\n },\n _log: {\n value: options.log\n ? options.log.createLog('default', _this)\n : new Log('default', _this, logLevels, options.loggerName)\n },\n _publishedRevision: {\n writable: true,\n value: 0\n },\n _revision: {\n writable: true,\n value: 1\n },\n _signalingRegion: {\n value: null,\n writable: true\n },\n audioProcessors: {\n value: [],\n writable: true\n },\n bandwidthProfile: {\n enumerable: true,\n get: function () {\n return this._bandwidthProfile;\n }\n },\n bandwidthProfileRevision: {\n enumerable: true,\n get: function () {\n return this._bandwidthProfileRevision;\n }\n },\n networkQualityConfiguration: {\n enumerable: true,\n value: networkQualityConfiguration\n },\n revision: {\n enumerable: true,\n get: function () {\n return this._revision;\n }\n },\n signalingRegion: {\n enumerable: true,\n get: function () {\n return this._signalingRegion;\n }\n }\n });\n return _this;\n }\n LocalParticipantV2.prototype.toString = function () {\n return \"[LocalParticipantSignaling: \" + this.sid + \"]\";\n };\n /**\n * Set the signalingRegion.\n * @param {string} signalingRegion.\n */\n LocalParticipantV2.prototype.setSignalingRegion = function (signalingRegion) {\n if (!this._signalingRegion) {\n this._signalingRegion = signalingRegion;\n }\n };\n /**\n * Update the {@link BandwidthProfileOptions}.\n * @param {BandwidthProfileOptions} bandwidthProfile\n */\n LocalParticipantV2.prototype.setBandwidthProfile = function (bandwidthProfile) {\n if (!isDeepEqual(this._bandwidthProfile, bandwidthProfile)) {\n // NOTE(mmalavalli): Object.assign() copies the values of only\n // the top level properties. In order to deep copy the object, we\n // stringify and parse the object.\n this._bandwidthProfile = JSON.parse(JSON.stringify(bandwidthProfile));\n this._bandwidthProfileRevision++;\n this.didUpdate();\n }\n };\n /**\n * Sets the AudioProcessors enabled for this room.\n * @param {string[]} audioProcessors\n */\n LocalParticipantV2.prototype.setAudioProcessors = function (audioProcessors) {\n this.audioProcessors = audioProcessors;\n };\n /**\n * returns current {@link EncodingParametersImpl}.\n * @returns {EncodingParametersImpl}\n */\n LocalParticipantV2.prototype.getParameters = function () {\n return this._encodingParameters;\n };\n /**\n * Set the {@link EncodingParameters}.\n * @param {?EncodingParameters} encodingParameters\n * @returns {this}\n */\n LocalParticipantV2.prototype.setParameters = function (encodingParameters) {\n this._encodingParameters.update(encodingParameters);\n return this;\n };\n /**\n * Update the {@link LocalParticipantV2} with the new state.\n * @param {Published} published\n * @returns {this}\n */\n LocalParticipantV2.prototype.update = function (published) {\n if (this._publishedRevision >= published.revision) {\n return this;\n }\n this._publishedRevision = published.revision;\n published.tracks.forEach(function (publicationState) {\n var localTrackPublicationV2 = this.tracks.get(publicationState.id);\n if (localTrackPublicationV2) {\n localTrackPublicationV2.update(publicationState);\n }\n }, this);\n return this;\n };\n LocalParticipantV2.prototype.updateMediaStates = function (mediaStates) {\n if (!mediaStates || !mediaStates.tracks) {\n return this;\n }\n Array.from(this.tracks.values()).forEach(function (publication) {\n var states = mediaStates.tracks[publication.sid];\n if (states) {\n publication.updateMediaStates(states);\n }\n });\n return this;\n };\n /**\n * @protected\n * @param {DataTrackSender|MediaTrackSender} trackSender\n * @param {string} name\n * @param {Track.Priority} priority\n * @param {?NoiseCancellationVendor} noiseCancellationVendor\n * @returns {LocalTrackPublicationV2}\n */\n LocalParticipantV2.prototype._createLocalTrackPublicationSignaling = function (trackSender, name, priority, noiseCancellationVendor) {\n return new this._LocalTrackPublicationV2(trackSender, name, priority, noiseCancellationVendor, { log: this._log });\n };\n /**\n * Add a {@link LocalTrackPublicationV2} for the given {@link DataTrackSender}\n * or {@link MediaTrackSender} to the {@link LocalParticipantV2}.\n * @param {DataTrackSender|MediaTrackSender} trackSender\n * @param {string} name\n * @param {Track.Priority} priority\n * @returns {this}\n */\n LocalParticipantV2.prototype.addTrack = function (trackSender, name, priority, noiseCancellationVendor) {\n var _this = this;\n _super.prototype.addTrack.call(this, trackSender, name, priority, noiseCancellationVendor);\n var publication = this.getPublication(trackSender);\n var isEnabled = publication.isEnabled, updatedPriority = publication.updatedPriority;\n var updated = function () {\n // NOTE(mmalavalli): The LocalParticipantV2's state is only published if\n // the \"updated\" event is emitted due to LocalTrackPublicationV2's\n // .isEnabled or .updatedPriority being changed. We do not publish if it is fired due to the\n // LocalTrackPublicationV2's .sid being set.\n if (isEnabled !== publication.isEnabled || updatedPriority !== publication.updatedPriority) {\n _this.didUpdate();\n isEnabled = publication.isEnabled;\n updatedPriority = publication.updatedPriority;\n }\n };\n publication.on('updated', updated);\n this._removeListener(publication);\n this._removeListeners.set(publication, function () { return publication.removeListener('updated', updated); });\n this.didUpdate();\n return this;\n };\n /**\n * @private\n * @param {LocalTrackPublicationV2} publication\n * @returns {void}\n */\n LocalParticipantV2.prototype._removeListener = function (publication) {\n var removeListener = this._removeListeners.get(publication);\n if (removeListener) {\n removeListener();\n }\n };\n /**\n * Get the current state of the {@link LocalParticipantV2}.\n * @returns {object}\n */\n LocalParticipantV2.prototype.getState = function () {\n return {\n revision: this.revision,\n tracks: Array.from(this.tracks.values()).map(function (track) { return track.getState(); })\n };\n };\n /**\n * Increment the revision for the {@link LocalParticipantV2}.\n * @private\n * @returns {void}\n */\n LocalParticipantV2.prototype.didUpdate = function () {\n this._revision++;\n this.emit('updated');\n };\n /**\n * Remove the {@link LocalTrackPublicationV2} for the given {@link DataTrackSender}\n * or {@link MediaTrackSender} from the {@link LocalParticipantV2}.\n * @param {DataTrackSender|MediaTrackSender} trackSender\n * @returns {?LocalTrackPublicationV2}\n */\n LocalParticipantV2.prototype.removeTrack = function (trackSender) {\n var publication = _super.prototype.removeTrack.call(this, trackSender);\n if (publication) {\n trackSender.removeClone(publication.trackTransceiver);\n this._removeListener(publication);\n this.didUpdate();\n }\n return publication;\n };\n /**\n * Updates the verbosity of network quality information.\n * @param {NetworkQualityConfiguration} networkQualityConfiguration\n * @returns {void}\n */\n LocalParticipantV2.prototype.setNetworkQualityConfiguration = function (networkQualityConfiguration) {\n this.networkQualityConfiguration.update(networkQualityConfiguration);\n };\n /**\n * updates encodings for simulcast layers.\n * @param {Track.SID} trackSid\n * @param {Array<{enabled: boolean, layer_index: number}>} encodings\n * @returns {Promise} string indicating result of the operation. can be one of\n * \"OK\", \"INVALID_HINT\", \"COULD_NOT_APPLY_HINT\", \"UNKNOWN_TRACK\"\n */\n LocalParticipantV2.prototype.setPublisherHint = function (trackSid, encodings) {\n var trackSignaling = Array.from(this.tracks.values()).find(function (trackPub) { return trackPub.sid === trackSid; });\n if (!trackSignaling) {\n this._log.warn(\"track:\" + trackSid + \" not found\");\n return Promise.resolve('UNKNOWN_TRACK');\n }\n return trackSignaling.trackTransceiver.setPublisherHint(encodings);\n };\n return LocalParticipantV2;\n}(LocalParticipantSignaling));\n/**\n * @interface Published\n * @property {number} revision\n * @property {Array} tracks\n */\n/**\n * @typedef {CreatedTrack|ReadyTrack|FailedTrack} PublishedTrack\n */\n/**\n * @interface CreatedTrack\n * @property {Track.ID} id\n * @property {string} state - \"created\"\n */\n/**\n * @interface ReadyTrack\n * @property {Track.ID} id\n * @property {Track.SID} sid\n * @property {string} state - \"ready\"\n */\n/**\n * @interface FailedTrack\n * @property {Track.ID} id\n * @property {TrackError} error\n * @property {string} state - \"failed\"\n */\n/**\n * @interface TrackError\n * @property {number} code\n * @property {string} message\n */\n/**\n * @event LocalParticipantV2#updated\n */\nmodule.exports = LocalParticipantV2;\n//# sourceMappingURL=localparticipant.js.map","/* eslint consistent-return:0 */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar ParticipantSignaling = require('./participant');\nvar RoomSignaling = require('./room');\nvar StateMachine = require('../statemachine');\n/*\nSignaling States\n----------------\n\n +---------+\n | |\n | opening |\n +--->| |\n | +---------+\n +--------+ | | +------+\n | |<--+ +-->| |\n | closed |<----------| open |\n | |<--+ +-->| |\n +--------+ | | +------+\n +---------+ |\n | |<--+\n | closing |\n | |\n +---------+\n\n*/\nvar states = {\n closed: [\n 'opening'\n ],\n opening: [\n 'closed',\n 'open'\n ],\n open: [\n 'closed',\n 'closing'\n ],\n closing: [\n 'closed',\n 'open'\n ]\n};\n/**\n * @extends StateMachine\n * @property {string} state - one of \"closed\", \"opening\", \"open\", or \"closing\"\n */\nvar Signaling = /** @class */ (function (_super) {\n __extends(Signaling, _super);\n /**\n * Construct {@link Signaling}.\n */\n function Signaling() {\n return _super.call(this, 'closed', states) || this;\n }\n /**\n * @private\n */\n // NOTE(mroberts): This is a dummy implementation suitable for testing.\n Signaling.prototype._close = function (key) {\n this.transition('closing', key);\n this.transition('closed', key);\n return Promise.resolve(this);\n };\n /**\n * @private\n */\n // NOTE(mroberts): This is a dummy implementation suitable for testing.\n Signaling.prototype._connect = function (localParticipant, token, encodingParameters, preferredCodecs, options) {\n localParticipant.connect('PA00000000000000000000000000000000', 'test');\n var sid = 'RM00000000000000000000000000000000';\n var promise = Promise.resolve(new RoomSignaling(localParticipant, sid, options));\n promise.cancel = function cancel() { };\n return promise;\n };\n /**\n * @private\n */\n // NOTE(mroberts): This is a dummy implementation suitable for testing.\n Signaling.prototype._open = function (key) {\n this.transition('opening', key);\n this.transition('open', key);\n return Promise.resolve(this);\n };\n /**\n * Close the {@link Signaling}.\n * @returns {Promise}\n */\n Signaling.prototype.close = function () {\n var _this = this;\n return this.bracket('close', function (key) {\n switch (_this.state) {\n case 'closed':\n return _this;\n case 'open':\n return _this._close(key);\n default:\n throw new Error(\"Unexpected Signaling state \\\"\" + _this.state + \"\\\"\");\n }\n });\n };\n /**\n * Connect to a {@link RoomSignaling}.\n * @param {ParticipantSignaling} localParticipant\n * @param {string} token\n * @param {EncodingParametersImpl} encodingParameters\n * @param {PreferredCodecs} preferredCodecs\n * @param {object} options\n * @returns {Promise>}\n */\n Signaling.prototype.connect = function (localParticipant, token, encodingParameters, preferredCodecs, options) {\n var self = this;\n return this.bracket('connect', function transition(key) {\n switch (self.state) {\n case 'closed':\n return self._open(key).then(transition.bind(null, key));\n case 'open':\n // NOTE(mroberts): We don't need to hold the lock in _connect. Instead,\n // we just need to ensure the Signaling remains open.\n self.releaseLockCompletely(key);\n return self._connect(localParticipant, token, encodingParameters, preferredCodecs, options);\n default:\n throw new Error(\"Unexpected Signaling state \\\"\" + self.state + \"\\\"\");\n }\n });\n };\n /**\n * Create a local {@link ParticipantSignaling}.\n * @returns {ParticipantSignaling}\n */\n Signaling.prototype.createLocalParticipantSignaling = function () {\n return new ParticipantSignaling();\n };\n /**\n * Open the {@link Signaling}.\n * @returns {Promise}\n */\n Signaling.prototype.open = function () {\n var _this = this;\n return this.bracket('open', function (key) {\n switch (_this.state) {\n case 'closed':\n return _this._open(key);\n case 'open':\n return _this;\n default:\n throw new Error(\"Unexpected Signaling state \\\"\" + _this.state + \"\\\"\");\n }\n });\n };\n return Signaling;\n}(StateMachine));\nmodule.exports = Signaling;\n//# sourceMappingURL=index.js.map","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar defaultCreateCancelableRoomSignalingPromise = require('./cancelableroomsignalingpromise');\nvar LocalParticipantV2 = require('./localparticipant');\nvar Signaling = require('../');\n/**\n * {@link SignalingV2} implements version 2 of our signaling protocol.\n * @extends Signaling\n */\nvar SignalingV2 = /** @class */ (function (_super) {\n __extends(SignalingV2, _super);\n /**\n * Construct {@link SignalingV2}.\n * @param {string} wsServer\n * @param {?object} [options={}]\n */\n function SignalingV2(wsServer, options) {\n var _this = this;\n /* eslint new-cap:0 */\n options = Object.assign({\n createCancelableRoomSignalingPromise: defaultCreateCancelableRoomSignalingPromise\n }, options);\n _this = _super.call(this) || this;\n Object.defineProperties(_this, {\n _createCancelableRoomSignalingPromise: {\n value: options.createCancelableRoomSignalingPromise\n },\n _options: {\n value: options\n },\n _wsServer: {\n value: wsServer\n }\n });\n return _this;\n }\n /**\n * @private\n */\n SignalingV2.prototype._connect = function (localParticipant, token, encodingParameters, preferredCodecs, options) {\n options = Object.assign({}, this._options, options);\n return this._createCancelableRoomSignalingPromise.bind(null, token, this._wsServer, localParticipant, encodingParameters, preferredCodecs, options);\n };\n SignalingV2.prototype.createLocalParticipantSignaling = function (encodingParameters, networkQualityConfiguration) {\n return new LocalParticipantV2(encodingParameters, networkQualityConfiguration);\n };\n return SignalingV2;\n}(Signaling));\nmodule.exports = SignalingV2;\n//# sourceMappingURL=index.js.map","'use strict';\nvar MediaStreamTrack = require('./webrtc').MediaStreamTrack;\nvar _a = require('./webrtc/util'), guessBrowser = _a.guessBrowser, guessBrowserVersion = _a.guessBrowserVersion, isCodecSupported = _a.isCodecSupported;\nvar createCancelableRoomPromise = require('./cancelableroompromise');\nvar EncodingParametersImpl = require('./encodingparameters');\nvar LocalParticipant = require('./localparticipant');\nvar InsightsPublisher = require('./util/insightspublisher');\nvar NullInsightsPublisher = require('./util/insightspublisher/null');\nvar _b = require('./media/track/es5'), LocalAudioTrack = _b.LocalAudioTrack, LocalDataTrack = _b.LocalDataTrack, LocalVideoTrack = _b.LocalVideoTrack;\nvar NetworkQualityConfigurationImpl = require('./networkqualityconfiguration');\nvar Room = require('./room');\nvar SignalingV2 = require('./signaling/v2');\nvar _c = require('./util'), asLocalTrack = _c.asLocalTrack, buildLogLevels = _c.buildLogLevels, filterObject = _c.filterObject, isNonArrayObject = _c.isNonArrayObject;\nvar _d = require('./util/constants'), DEFAULT_ENVIRONMENT = _d.DEFAULT_ENVIRONMENT, DEFAULT_LOG_LEVEL = _d.DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME = _d.DEFAULT_LOGGER_NAME, DEFAULT_REALM = _d.DEFAULT_REALM, DEFAULT_REGION = _d.DEFAULT_REGION, WS_SERVER = _d.WS_SERVER, SDK_NAME = _d.SDK_NAME, SDK_VERSION = _d.SDK_VERSION, E = _d.typeErrors;\nvar CancelablePromise = require('./util/cancelablepromise');\nvar EventObserver = require('./util/eventobserver');\nvar DefaultLog = require('./util/log');\nvar validateBandwidthProfile = require('./util/validate').validateBandwidthProfile;\nvar safariVersion = guessBrowser() === 'safari' && guessBrowserVersion();\n// This is used to make out which connect() call a particular Log statement\n// belongs to. Each call to connect() increments this counter.\nvar connectCalls = 0;\nvar didPrintSafariWarning = false;\nvar isSafariWithoutVP8Support = false;\nif (safariVersion) {\n var safariMajorVersion = safariVersion.major, safariMinorVersion = safariVersion.minor;\n isSafariWithoutVP8Support = safariMajorVersion < 12 || (safariMajorVersion === 12 && safariMinorVersion < 1);\n}\nvar deprecatedConnectOptionsProps = new Set([\n { didWarn: false, shouldDelete: true, name: 'abortOnIceServersTimeout' },\n { didWarn: false, shouldDelete: true, name: 'dscpTagging', newName: 'enableDscp' },\n { didWarn: false, shouldDelete: true, name: 'iceServersTimeout' },\n { didWarn: false, shouldDelete: false, name: 'eventListener', newName: 'Video.Logger' },\n { didWarn: false, shouldDelete: false, name: 'logLevel', newName: 'Video.Logger' },\n]);\nvar deprecatedBandwidthProfileOptions = new Set([\n { didWarn: false, shouldDelete: false, name: 'maxTracks', newName: 'bandwidthProfile.video.clientTrackSwitchOffControl' },\n { didWarn: false, shouldDelete: false, name: 'renderDimensions', newName: 'bandwidthProfile.video.contentPreferencesMode' },\n]);\n/**\n * Connect to a {@link Room}.\n *

\n * By default, this will automatically acquire an array containing a\n * {@link LocalAudioTrack} and {@link LocalVideoTrack} before connecting to\n * the {@link Room}. These will be stopped when you disconnect from the\n * {@link Room}.\n *

\n * You can override the default behavior by specifying\n * options. For example, rather than acquiring a\n * {@link LocalAudioTrack} and {@link LocalVideoTrack} automatically, you can\n * pass your own array which you can stop yourself. See {@link ConnectOptions}\n * for more information.\n * @alias module:twilio-video.connect\n * @param {string} token - The Access Token string\n * @param {ConnectOptions} [options] - Options to override the default behavior, invalid options are ignored.\n * @returns {CancelablePromise}\n * @throws {RangeError}\n * @throws {TwilioError}\n * @throws {TypeError}\n * @example\n * var Video = require('twilio-video');\n * var token = getAccessToken();\n * Video.connect(token, {\n * name: 'my-cool-room'\n * }).then(function(room) {\n * room.on('participantConnected', function(participant) {\n * console.log(participant.identity + ' has connected');\n * });\n\n * room.once('disconnected', function() {\n * console.log('You left the Room:', room.name);\n * });\n * }).catch(error => {\n * console.log('Could not connect to the Room:', error.message);\n * });\n * @example\n * var Video = require('twilio-video');\n * var token = getAccessToken();\n *\n * // Connect with audio-only\n * Video.connect(token, {\n * name: 'my-cool-room',\n * audio: true\n * }).then(function(room) {\n * room.on('participantConnected', function(participant) {\n * console.log(participant.identity + ' has connected');\n * });\n *\n * room.once('disconnected', function() {\n * console.log('You left the Room:', room.name);\n * });\n * }).catch(error => {\n * console.log('Could not connect to the Room:', error.message);\n * });\n * @example\n * var Video = require('twilio-video');\n * var token = getAccessToken();\n *\n * // Connect with media acquired using getUserMedia()\n * navigator.mediaDevices.getUserMedia({\n * audio: true,\n * video: true\n * }).then(function(mediaStream) {\n * return Video.connect(token, {\n * name: 'my-cool-room',\n * tracks: mediaStream.getTracks()\n * });\n * }).then(function(room) {\n * room.on('participantConnected', function(participant) {\n * console.log(participant.identity + ' has connected');\n * });\n *\n * room.once('disconnected', function() {\n * console.log('You left the Room:', room.name);\n * });\n * }).catch(error => {\n * console.log('Could not connect to the Room:', error.message);\n * });\n * @example\n * var Video = require('twilio-video');\n * var token = getAccessToken();\n *\n * // Connect with custom names for LocalAudioTrack and LocalVideoTrack\n * Video.connect(token, {\n * name: 'my-cool-room'\n * audio: { name: 'microphone' },\n * video: { name: 'camera' }\n * }).then(function(room) {\n * room.localParticipants.trackPublications.forEach(function(publication) {\n * console.log('The LocalTrack \"' + publication.trackName + '\" was successfully published');\n * });\n * }).catch(error => {\n * console.log('Could not connect to the Room:', error.message);\n * });\n * @example\n * // Accessing the SDK logger\n * var { Logger, connect } = require('twilio-video');\n * var token = getAccessToken();\n *\n * var logger = Logger.getLogger('twilio-video');\n *\n * // Listen for logs\n * var originalFactory = logger.methodFactory;\n * logger.methodFactory = function (methodName, logLevel, loggerName) {\n * var method = originalFactory(methodName, logLevel, loggerName);\n *\n * return function (datetime, logLevel, component, message, data) {\n * method(datetime, logLevel, component, message, data);\n * // Send to your own server\n * postDataToServer(arguments);\n * };\n * };\n * logger.setLevel('debug');\n *\n * connect(token, {\n * name: 'my-cool-room'\n * }).then(function(room) {\n * room.on('participantConnected', function(participant) {\n * console.log(participant.identity + ' has connected');\n * });\n * }).catch(error => {\n * console.log('Could not connect to the Room:', error.message);\n * });\n */\nfunction connect(token, options) {\n if (typeof options === 'undefined') {\n options = {};\n }\n if (!isNonArrayObject(options)) {\n return CancelablePromise.reject(E.INVALID_TYPE('options', 'object'));\n }\n var Log = options.Log || DefaultLog;\n var loggerName = options.loggerName || DEFAULT_LOGGER_NAME;\n var logLevel = options.logLevel || DEFAULT_LOG_LEVEL;\n var logLevels = buildLogLevels(logLevel);\n var logComponentName = \"[connect #\" + ++connectCalls + \"]\";\n var log;\n try {\n log = new Log('default', logComponentName, logLevels, loggerName);\n }\n catch (error) {\n return CancelablePromise.reject(error);\n }\n // NOTE(csantos): Log a warning for the deprecated ConnectOptions properties.\n // The warning is displayed only for the first call to connect() per browser session.\n // Additionally, the options that are no longer needed will be removed.\n deprecateOptions(options, log, deprecatedConnectOptionsProps);\n var adaptiveSimulcast = options.preferredVideoCodecs === 'auto';\n if (adaptiveSimulcast) {\n // NOTE(mpatwardhan): enable adaptiveSimulcast.\n options.preferredVideoCodecs = [{ codec: 'VP8', simulcast: true, adaptiveSimulcast: true }];\n }\n if (options.maxVideoBitrate && adaptiveSimulcast) {\n log.error('ConnectOptions \"maxVideoBitrate\" is not compatible with \"preferredVideoCodecs=auto\"');\n return CancelablePromise.reject(E.ILLEGAL_INVOKE('connect', 'ConnectOptions \"maxVideoBitrate\" is not compatible with \"preferredVideoCodecs=auto\"'));\n }\n options = Object.assign({\n automaticSubscription: true,\n dominantSpeaker: false,\n enableDscp: false,\n environment: DEFAULT_ENVIRONMENT,\n eventListener: null,\n insights: true,\n LocalAudioTrack: LocalAudioTrack,\n LocalDataTrack: LocalDataTrack,\n LocalParticipant: LocalParticipant,\n LocalVideoTrack: LocalVideoTrack,\n Log: Log,\n MediaStreamTrack: MediaStreamTrack,\n loggerName: loggerName,\n logLevel: logLevel,\n maxAudioBitrate: null,\n maxVideoBitrate: null,\n name: null,\n networkMonitor: true,\n networkQuality: false,\n preferredAudioCodecs: [],\n preferredVideoCodecs: [],\n realm: DEFAULT_REALM,\n region: DEFAULT_REGION,\n signaling: SignalingV2\n }, filterObject(options));\n /* eslint new-cap:0 */\n var eventPublisherOptions = {};\n if (typeof options.wsServerInsights === 'string') {\n eventPublisherOptions.gateway = options.wsServerInsights;\n }\n var EventPublisher = options.insights ? InsightsPublisher : NullInsightsPublisher;\n var eventPublisher = new EventPublisher(token, SDK_NAME, SDK_VERSION, options.environment, options.realm, eventPublisherOptions);\n var wsServer = WS_SERVER(options.environment, options.region);\n var eventObserver = new EventObserver(eventPublisher, Date.now(), log, options.eventListener);\n options = Object.assign({ eventObserver: eventObserver, wsServer: wsServer }, options);\n options.log = log;\n // NOTE(mroberts): Print the Safari warning once if the log-level is at least\n // \"warn\", i.e. neither \"error\" nor \"off\".\n // NOTE(mmalavalli): Print the Safari warning only for versions 12.0 and below.\n if (isSafariWithoutVP8Support\n && !didPrintSafariWarning\n && (log.logLevel !== 'error' && log.logLevel !== 'off')) {\n didPrintSafariWarning = true;\n log.warn([\n 'Support for Safari 12.0 and below is limited because it does not support VP8.',\n 'This means you may experience codec issues in Group Rooms. You may also',\n 'experience codec issues in Peer-to-Peer (P2P) Rooms containing Android- or',\n 'iOS-based Participants who do not support H.264. However, P2P Rooms',\n 'with browser-based Participants should work. For more information, please',\n 'refer to this guide: https://www.twilio.com/docs/video/javascript-v2-developing-safari-11'\n ].join(' '));\n }\n if (typeof token !== 'string') {\n return CancelablePromise.reject(E.INVALID_TYPE('token', 'string'));\n }\n // NOTE(mmalavalli): The Room \"name\" in \"options\" was being used\n // as the LocalTrack name in asLocalTrack(). So we pass a copy of\n // \"options\" without the \"name\".\n var localTrackOptions = Object.assign({}, options);\n delete localTrackOptions.name;\n if ('tracks' in options) {\n if (!Array.isArray(options.tracks)) {\n return CancelablePromise.reject(E.INVALID_TYPE('options.tracks', 'Array of LocalAudioTrack, LocalVideoTrack or MediaStreamTrack'));\n }\n try {\n options.tracks = options.tracks.map(function (track) { return asLocalTrack(track, localTrackOptions); });\n }\n catch (error) {\n return CancelablePromise.reject(error);\n }\n }\n var error = validateBandwidthProfile(options.bandwidthProfile);\n if (error) {\n return CancelablePromise.reject(error);\n }\n // Note(mpatwardhan): \"clientTrackSwitchOffControl\" allows tracks to be switched off\n // and \"contentPreferencesMode\" allows track dimensions to be specified dynamically.\n // The properties can have one of the three values internally:\n // 1) \"auto\" = sdk will decide and send the hints.\n // 2) \"manual\" - app can use api to send the hints.\n // 3) \"disabled\" = do not enable this feature. (this is internal only value)\n // 'disabled' is needed because clientTrackSwitchOffControl and contentPreferencesMode are incompatible with\n // deprecated properties maxTracks and renderDimensions respectively. once we make @breaking_version_change\n // we can remove 'disabled' state along with maxTracks and renderDimensions.\n options.clientTrackSwitchOffControl = 'disabled'; // should sdk turn off idle tracks automatically?\n options.contentPreferencesMode = 'disabled'; // should sdk use video element dimensions for content hints?\n if (options.bandwidthProfile) {\n options.clientTrackSwitchOffControl = 'auto';\n options.contentPreferencesMode = 'auto';\n if (options.bandwidthProfile.video) {\n // log any warnings about deprecated bwp options\n deprecateOptions(options.bandwidthProfile.video, log, deprecatedBandwidthProfileOptions);\n if ('maxTracks' in options.bandwidthProfile.video) {\n // when deprecated maxTracks is specified. disable clientTrackSwitchOffControl\n options.clientTrackSwitchOffControl = 'disabled';\n }\n else if (options.bandwidthProfile.video.clientTrackSwitchOffControl === 'manual') {\n options.clientTrackSwitchOffControl = 'manual';\n }\n else {\n options.clientTrackSwitchOffControl = 'auto';\n }\n if ('renderDimensions' in options.bandwidthProfile.video) {\n options.contentPreferencesMode = 'disabled';\n }\n else if (options.bandwidthProfile.video.contentPreferencesMode === 'manual') {\n options.contentPreferencesMode = 'manual';\n }\n else {\n options.contentPreferencesMode = 'auto';\n }\n }\n }\n var Signaling = options.signaling;\n var signaling = new Signaling(options.wsServer, options);\n log.info('Connecting to a Room');\n log.debug('Options:', options);\n var encodingParameters = new EncodingParametersImpl({\n maxAudioBitrate: options.maxAudioBitrate,\n maxVideoBitrate: options.maxVideoBitrate\n }, adaptiveSimulcast);\n var preferredCodecs = {\n audio: options.preferredAudioCodecs.map(normalizeCodecSettings),\n video: options.preferredVideoCodecs.map(normalizeCodecSettings)\n };\n var networkQualityConfiguration = new NetworkQualityConfigurationImpl(isNonArrayObject(options.networkQuality) ? options.networkQuality : {});\n // Log warnings for any unsupported preferred codecs.\n ['audio', 'video'].forEach(function (kind) { return preferredCodecs[kind].forEach(function (_a) {\n var codec = _a.codec;\n return isCodecSupported(codec, kind).then(function (isSupported) { return !isSupported && log.warn(\"The preferred \" + kind + \" codec \\\"\" + codec + \"\\\" will be ignored as it is not supported by the browser.\"); });\n }); });\n // Create a CancelableRoomPromise that resolves after these steps:\n // 1 - Get the LocalTracks.\n // 2 - Create the LocalParticipant using options.tracks.\n // 3 - Connect to rtc-room-service and create the RoomSignaling.\n // 4 - Create the Room and then resolve the CancelablePromise.\n var cancelableRoomPromise = createCancelableRoomPromise(getLocalTracks.bind(null, options), createLocalParticipant.bind(null, signaling, log, encodingParameters, networkQualityConfiguration, options), createRoomSignaling.bind(null, token, options, signaling, encodingParameters, preferredCodecs), createRoom.bind(null, options));\n cancelableRoomPromise.then(function (room) {\n eventPublisher.connect(room.sid, room.localParticipant.sid);\n log.info('Connected to Room:', room.toString());\n log.info('Room name:', room.name);\n log.debug('Room:', room);\n room.once('disconnected', function () { return eventPublisher.disconnect(); });\n return room;\n }, function (error) {\n eventPublisher.disconnect();\n if (cancelableRoomPromise._isCanceled) {\n log.info('Attempt to connect to a Room was canceled');\n }\n else {\n log.info('Error while connecting to a Room:', error);\n }\n });\n return cancelableRoomPromise;\n}\n/**\n * You may pass these options to {@link connect} in order to override the\n * default behavior.\n * @typedef {object} ConnectOptions\n * @property {boolean|CreateLocalTracksOptions|CreateLocalAudioTrackOptions} [audio=true] - Whether or not to\n * get local audio with getUserMedia when tracks\n * are not provided.\n * @property {boolean} [automaticSubscription=true] - By default, you will subscribe\n * to all RemoteTracks shared by other Participants in a Room. You can now override this\n * behavior by setting this flag to false. It will make sure that you will\n * not subscribe to any RemoteTrack in a Group or Small Group Room. Setting it to\n * true, or not setting it at all preserves the default behavior. This\n * flag does not have any effect in a Peer-to-Peer Room.\n * @property {BandwidthProfileOptions} [bandwidthProfile] - You can optionally configure\n * how your available downlink bandwidth is shared among the RemoteTracks you have subscribed\n * to in a Group Room. By default, bandwidth is shared equally among the RemoteTracks.\n * This has no effect in Peer-to-Peer Rooms.\n * @property {boolean} [dominantSpeaker=false] - Whether to enable the Dominant\n * Speaker API or not. This only takes effect in Group Rooms.\n * @property {boolean} [dscpTagging=false] - (deprecated: use \"enableDscp\" instead)\n * DSCP tagging allows you to request enhanced QoS treatment for RTP media packets from any\n * firewall that the client may be behind. Setting this option to true will\n * request DSCP tagging for media packets on supported browsers (only Chrome supports this\n * as of now). Audio packets will be sent with DSCP header value set to 0xb8 which corresponds\n * to Expedited Forwarding (EF). Video packets will be sent with DSCP header value set to 0x88\n * which corresponds to Assured Forwarding (AF41).\n * @property {boolean} [enableDscp=false] - DSCP tagging allows you to request enhanced\n * QoS treatment for RTP media packets from any firewall that the client may be behind.\n * Setting this option to true will request DSCP tagging for media packets\n * on supported browsers (only Chrome supports this as of now). Audio packets will be\n * sent with DSCP header value set to 0xb8 which corresponds to Expedited Forwarding (EF).\n * Video packets will be sent with DSCP header value set to 0x88 which corresponds to\n * Assured Forwarding (AF41).\n * @property {EventListener} [eventListener] - (deprecated: use [Video.Logger](module-twilio-video.html)\n * you can listen to fine-grained events related to signaling and media that are\n * not available in the public APIs. These events might be useful for your own reporting\n * and diagnostics.\n * @property {Array} iceServers - Override the STUN and TURN\n * servers used when connecting to {@link Room}s\n * @property {RTCIceTransportPolicy} [iceTransportPolicy=\"all\"] - Override the\n * ICE transport policy to be one of \"relay\" or \"all\"\n * @property {boolean} [insights=true] - Whether publishing events\n * to the Insights gateway is enabled or not\n * @property {?number} [maxAudioBitrate=null] - Max outgoing audio bitrate (bps);\n * A null or a 0 value does not set any bitrate limit;\n * This value is set as a hint for variable bitrate codecs, but will not take\n * effect for fixed bitrate codecs; Based on our tests, Chrome, Firefox and Safari\n * support a bitrate range of 12000 bps to 256000 bps for Opus codec; This parameter\n * has no effect on iSAC, PCMU and PCMA codecs\n * @property {?number} [maxVideoBitrate=null] - Max outgoing video bitrate (bps);\n * A null or 0 value does not set any bitrate limit;\n * This value is set as a hint for variable bitrate codecs, but will not take\n * effect for fixed bitrate codecs; Based on our tests, Chrome, Firefox and Safari\n * all seem to support an average bitrate range of 20000 bps (20 kbps) to\n * 8000000 bps (8 mbps) for a 720p VideoTrack\n * This parameter must not be set when when preferredVideoCodecs is set to `auto`.\n * @property {?string} [name=null] - Set to connect to a {@link Room} by name\n * @property {boolean|NetworkQualityConfiguration} [networkQuality=false] - Whether to enable the Network\n * Quality API or not. This only takes effect in Group Rooms. Pass a {@link NetworkQualityConfiguration}\n * to configure verbosity levels for network quality information for {@link LocalParticipant}\n * and {@link RemoteParticipant}s. A true value will set the {@link NetworkQualityVerbosity}\n * for the {@link LocalParticipant} to {@link NetworkQualityVerbosity}#minimal\n * and the {@link NetworkQualityVerbosity} for {@link RemoteParticipant}s to\n * {@link NetworkQualityVerbosity}#none.\n * @property {Array} [notifyWarnings=[]] - The SDK raises warning events when it\n * detects certain conditions. You can implement callbacks on these events to act on them, or to alert\n * the user of an issue. Subsequently, \"warningsCleared\" event is raised when conditions have returned\n * to normal. You can listen to these events by specifying an array of warning. By default,\n * this array is empty and no warning events will be raised.\n * Possible values include recording-media-lost, which is raised when the media server\n * has not detected any media on the published track that is being recorded in the past 30 seconds.\n * This usually happens when there are network interruptions or when the track has stopped.\n * This warning is raised by {@link LocalTrackPublication}, {@link LocalParticipant}, and {@link Room} object.\n * @property {string} [region='gll'] - Preferred signaling region; By default, you will be connected to the\n * nearest signaling server determined by latency based routing. Setting a value other\n * than gll bypasses routing and guarantees that signaling traffic will be\n * terminated in the region that you prefer. Please refer to this table\n * for the list of supported signaling regions.\n * @property {Array} [preferredAudioCodecs=[]] - Preferred audio codecs;\n * An empty array preserves the current audio codec preference order.\n * @property {Array|VideoEncodingMode} [preferredVideoCodecs=[]] -\n * Preferred video codecs; when set to 'VideoEncodingMode.Auto', SDK manages the video codec,\n * by preferring VP8 simulcast in group rooms. It also enables adaptive simulcast, which allows SDK\n * to turn off simulcast layers that are not needed for efficient bandwidth and CPU usage.\n * An empty array preserves the current video codec.\n * preference order. If you want to set a preferred video codec on a Group Room,\n * you will need to create the Room using the REST API and set the\n * VideoCodecs property.\n * See \n * here for more information.\n * @property {LogLevel|LogLevels} [logLevel='warn'] - (deprecated: use [Video.Logger](module-twilio-video.html) instead.\n * See [examples](module-twilio-video.html#.connect) for details)\n * Set the default log verbosity\n * of logging. Passing a {@link LogLevel} string will use the same\n * level for all components. Pass a {@link LogLevels} to set specific log\n * levels.\n * @property {string} [loggerName='twilio-video'] - The name of the logger. Use this name when accessing the logger used by the SDK.\n * See [examples](module-twilio-video.html#.connect) for details.\n * @property {Array} [tracks] - The\n * {@link LocalTrack}s or MediaStreamTracks with which to join the\n * {@link Room}. These tracks can be obtained either by calling\n * {@link createLocalTracks}, or by constructing them from the MediaStream\n * obtained by calling getUserMedia().\n * @property {boolean|CreateLocalTrackOptions} [video=true] - Whether or not to\n * get local video with getUserMedia when tracks\n * are not provided.\n */\n/**\n * {@link BandwidthProfileOptions} allows you to configure how your available downlink\n * bandwidth is shared among the RemoteTracks you have subscribed to in a Group Room.\n * @typedef {object} BandwidthProfileOptions\n * @property {VideoBandwidthProfileOptions} [video] - Optional parameter to configure\n * how your available downlink bandwidth is shared among the {@link RemoteVideoTrack}s you\n * have subscribed to in a Group Room.\n */\n/**\n * {@link VideoBandwidthProfileOptions} allows you to configure how your available downlink\n * bandwidth is shared among the {@link RemoteVideoTrack}s you have subscribed to in a Group Room.\n * @typedef {object} VideoBandwidthProfileOptions\n * @property {Track.Priority} [dominantSpeakerPriority=\"standard\"] - Optional parameter to\n * specify the minimum subscribe {@link Track.Priority} of the Dominant Speaker's {@link RemoteVideoTrack}s.\n * This means that the Dominant Speaker's {@link RemoteVideoTrack}s that are published with\n * lower {@link Track.Priority} will be subscribed to with the {@link Track.Priority} specified here.\n * This has no effect on {@link RemoteVideoTrack}s published with higher {@link Track.Priority}, which will\n * still be subscribed to with with the same {@link Track.Priority}. If not specified, this defaults to \"standard\".\n * This parameter only applies to a Group Room Participant when {@link ConnectOptions}.dominantSpeaker is set to true.\n * @property {number} [maxSubscriptionBitrate] - Optional parameter to specify the maximum\n * downlink video bandwidth in bits per second (bps). By default, there are no limits on\n * the downlink video bandwidth.\n * @property {ClientTrackSwitchOffControl} [clientTrackSwitchOffControl=\"auto\"] - Optional parameter that determines\n * when to turn the {@link RemoteVideoTrack} on or off. When set to \"auto\", SDK will use the visibility of the\n * attached elements to determine if the {@link RemoteVideoTrack} should be turned off or on. When the attached video elements become invisible the {@link RemoteVideoTrack} will\n * be turned off, and when elements become visible they will be turned on. When set to \"manual\" you can turn the {@link RemoteVideoTrack}\n * on and off using the api {@link RemoteVideoTrack#switchOn} and {@link RemoteVideoTrack#switchOff} respectively.\n * @property {VideoContentPreferencesMode} [contentPreferencesMode=\"auto\"] - This Optional parameter configures\n * the mode for specifying content preferences for the {@link RemoteVideoTrack}. When set to \"auto\" the\n * SDK determines the render dimensions by inspecting the attached video elements. {@link RemoteVideoTrack}s rendered in smaller video elements\n * will receive a lower resolution stream compared to the video rendered in larger video elements. When set to \"manual\" you can set\n * the dimensions programmatically by calling {@link RemoteVideoTrack#setContentPreferences}.\n * @property {number} [maxTracks] - (deprecated: use \"clientTrackSwitchOffControl\" instead). Optional\n * parameter to specify the maximum number of visible {@link RemoteVideoTrack}s, which will be selected based on\n * {@link Track.Priority} and an N-Loudest policy. By default there are no limits on the number of visible {@link RemoteVideoTrack}s.\n * 0 or a negative value will remove any limit on the maximum number of visible {@link RemoteVideoTrack}s.\n * @property {BandwidthProfileMode} [mode=\"grid\"] - Optional parameter to specify how the {@link RemoteVideoTrack}s'\n * TrackPriority values are mapped to bandwidth allocation in Group Rooms. This defaults to \"grid\",\n * which results in equal bandwidth share allocation to all {@link RemoteVideoTrack}s.\n * @property {VideoRenderDimensions} [renderDimensions] - (deprecated: use \"contentPreferencesMode\" instead). Optional\n * parameter to specify the desired render dimensions of {@link RemoteVideoTrack}s.\n * @property {TrackSwitchOffMode} [trackSwitchOffMode=\"predicted\"] - Optional parameter to configure\n * how {@link RemoteVideoTrack}s are switched off in response to bandwidth pressure. Defaults to \"predicted\".\n */\n/**\n * @deprecated\n * {@link VideoRenderDimensions} allows you to specify the desired render dimensions of {@link RemoteVideoTrack}s.\n * You can specify 'auto' for this field - which is also default value - based on {@link Track.Priority}. The bandwidth allocation algorithm will distribute the available downlink bandwidth\n * proportional to the requested render dimensions. This is just an input for calculating the bandwidth to be allocated\n * and does not affect the actual resolution of the {@link RemoteVideoTrack}s.\n * @typedef {object} VideoRenderDimensions\n * @property {VideoTrack.Dimensions} [high] - Optional parameter to specify the desired rendering dimensions of\n * {@link RemoteVideoTrack} whose {@link Track.Priority} is \"high\". 0 or a negative value will result in the lowest\n * possible resolution. This defaults to 1280 x 720 (HD).\n * @property {VideoTrack.Dimensions} [low] - Optional parameter to specify the desired rendering dimensions of\n * {@link RemoteVideoTrack} whose {@link Track.Priority} is \"low\". 0 or a negative value will result in the lowest\n * possible resolution. This defaults to 176 x 144 (QCIF).\n * @property {VideoTrack.Dimensions} [standard] - Optional parameter to specify the desired rendering dimensions of\n * {@link RemoteVideoTrack} whose {@link Track.Priority} is \"standard\". 0 or a negative value will result in the lowest\n * possible resolution. This defaults to 640 x 480 (VGA).\n */\n/**\n * Configure verbosity levels for network quality information for\n * {@link LocalParticipant} and {@link RemoteParticipant}s.\n * @typedef {object} NetworkQualityConfiguration\n * @property {NetworkQualityVerbosity} [local=1] - Verbosity level for {@link LocalParticipant}\n * @property {NetworkQualityVerbosity} [remote=0] - Verbosity level for {@link RemoteParticipant}s\n */\n/**\n * You may pass these levels to {@link ConnectOptions} to override\n * log levels for individual components.\n * @typedef {object} LogLevels\n * @property {LogLevel} [default='warn'] - Log level for 'default' modules.\n * @property {LogLevel} [media='warn'] - Log level for 'media' modules.\n * @property {LogLevel} [signaling='warn'] - Log level for 'signaling' modules.\n * @property {LogLevel} [webrtc='warn'] - Log level for 'webrtc' modules.\n */\n/**\n * Audio codec settings.\n * @typedef {object} AudioCodecSettings\n * @property {AudioCodec} codec - Audio codec name\n */\n/**\n * Opus codec settings.\n * @typedef {AudioCodecSettings} OpusCodecSettings\n * @property {AudioCodec} name - \"opus\"\n * @property {boolean} [dtx=true] - Enable/disable discontinuous transmission (DTX);\n * If enabled all published {@link LocalAudioTrack}s will reduce the outgoing bitrate\n * to near-zero whenever speech is not detected, resulting in bandwidth and CPU savings;\n * It defaults to true.\n */\n/**\n * Video codec settings.\n * @typedef {object} VideoCodecSettings\n * @property {VideoCodec} codec - Video codec name\n */\n/**\n * VP8 codec settings.\n * @typedef {VideoCodecSettings} VP8CodecSettings\n * @property {VideoCodec} name - \"VP8\"\n * @property {boolean} [simulcast=false] - Enable/disable VP8 simulcast; If\n * enabled, Twilio's Video SDK will send three video streams of different\n * qualities\n */\n/**\n * Names of the supported audio codecs.\n * @enum {string}\n */\n// eslint-disable-next-line\nvar AudioCodec = {\n isac: 'isac',\n opus: 'opus',\n PCMA: 'PCMA',\n PCMU: 'PCMU'\n};\n/**\n * Names of the supported VideoEncodingMode.\n * @enum {string}\n */\n// eslint-disable-next-line\nvar VideoEncodingMode = {\n Auto: 'auto',\n};\n/**\n * Names of the supported video codecs.\n * @enum {string}\n */\n// eslint-disable-next-line\nvar VideoCodec = {\n H264: 'H264',\n VP8: 'VP8'\n};\n// VP9 is supported by most browsers, but backend doesn't at the moment.\n// Hide it from public documentation until then.\nVideoCodec.VP9 = 'VP9';\n/**\n * Levels for logging verbosity.\n * @enum {string}\n */\n// eslint-disable-next-line\nvar LogLevel = {\n debug: 'debug',\n info: 'info',\n warn: 'warn',\n error: 'error',\n off: 'off'\n};\n/**\n * The verbosity level of network quality information of a {@link Participant}.\n * @enum {number}\n */\n// eslint-disable-next-line\nvar NetworkQualityVerbosity = {\n /**\n * Nothing is reported for the {@link Participant}. This has no effect and\n * defaults to {@link NetworkQualityVerbosity}#minimal\n * for the {@link LocalParticipant}.\n */\n none: 0,\n /**\n * Reports {@link NetworkQualityLevel} for the {@link Participant}.\n */\n minimal: 1,\n /**\n * Reports {@link NetworkQualityLevel} and {@link NetworkQualityStats} for the {@link Participant}.\n * {@link NetworkQualityStats} is populated with audio and video {@link NetworkQualityLevel}s\n * based on which the {@link Participant}'s {@link NetworkQualityLevel} is calculated.\n */\n moderate: 2,\n /**\n * Reports {@link NetworkQualityLevel} and {@link NetworkQualityStats} for the {@link Participant}.\n * {@link NetworkQualityStats} is populated with audio and Video {@link NetworkQualityLevel}s\n * and their corresponding {@link NetworkQualityMediaStats} based on which the\n * {@link Participant}'s {@link NetworkQualityLevel} is calculated.\n */\n detailed: 3\n};\n/**\n * {@link TrackSwitchOffMode} specifies when {@link RemoteVideoTrack}s' are switched off.\n * @enum {string}\n */\n// eslint-disable-next-line\nvar TrackSwitchOffMode = {\n /**\n * In this mode, {@link RemoteVideoTrack}s are switched off only when network congestion\n * is detected.\n */\n detected: 'detected',\n /**\n * In this mode, {@link RemoteVideoTrack}s are pro-actively switched off when network\n * congestion is predicted by the bandwidth estimation mechanism.\n */\n predicted: 'predicted',\n /**\n * In this mode, {@link RemoteVideoTrack}s are not switched off. Instead in response to network\n * congestion, tracks will be adjusted to lower quality.\n */\n disabled: 'disabled'\n};\n/**\n * {@link BandwidthProfileMode} specifies how {@link RemoteVideoTrack}s' {@link Track.Priority} values\n * are mapped to bandwidth allocation in Group Rooms.\n * @enum {string}\n */\n// eslint-disable-next-line\nvar BandwidthProfileMode = {\n /**\n * This mode is for use cases where all the subscribed {@link RemoteVideoTrack}s are\n * equally important. The bandwidth allocation algorithm will share the available\n * downlink bandwidth equally among the subscribed {@link RemoteVideoTrack}s, irrespective\n * of their {@link Track.Priority}. In case of insufficient downlink bandwidth, the lower\n * priority {@link RemoteVideoTrack}s are switched off.\n */\n grid: 'grid',\n /**\n * This mode is for use cases where some {@link RemoteVideoTrack}s are prioritized more than\n * others. However, the lower priority {@link RemoteVideoTrack}s still need to be visible.\n * The bandwidth allocation algorithm will share the available downlink bandwidth proportional\n * to the requested {@link VideoRenderDimensions} corresponding to their {@link Track.Priority}.\n * In case of insufficient downlink bandwidth, the quality of higher priority {@link RemoteVideoTrack}s\n * may be degraded to avoid switching off lower priority {@link RemoteVideoTrack}s.\n */\n collaboration: 'collaboration',\n /**\n * This mode is for use cases where some {@link RemoteVideoTrack}s are deemed critical and must\n * be preserved at any cost over the other {@link RemoteVideoTrack}s. The bandwidth allocation\n * algorithm will allocate as big a share of the available downlink bandwidth as it possibly\n * can to the higher priority {@link RemoteVideoTrack}s, and only then consider the lower priority\n * {@link RemoteVideoTrack}s. In case of insufficient downlink bandwidth, the lower priority\n * {@link RemoteVideoTrack}s are switched off in order to preserve the quality of the higher\n * priority {@link RemoteVideoTrack}s.\n */\n presentation: 'presentation'\n};\n/**\n * {@link VideoContentPreferencesMode} specifies how {@link RemoteVideoTrack}s' render dimensions are\n * decided by the SDK.\n * @enum {string}\n */\n// eslint-disable-next-line\nvar VideoContentPreferencesMode = {\n /**\n * when set to auto, SDK uses the sizes of the video elements attached to the to the {@link RemoteVideoTrack} dynamically to\n * decide the render dimensions. {@link RemoteVideoTrack}s rendered in smaller video elements will be given smaller bandwidth allocation\n * compared to the tracks rendered in large video elements.\n */\n auto: 'auto',\n /**\n * When set to manual, application can use {@link RemoteVideoTrack#setContentPreference} to set the\n * desired render dimensions for the {@link RemoteVideoTrack}.\n */\n manual: 'manual'\n};\n/**\n * {@link ClientTrackSwitchOffControl} specifies how {@link RemoteVideoTrack}s' turned on and off\n * @enum {string}\n */\n// eslint-disable-next-line\nvar ClientTrackSwitchOffControl = {\n /**\n * when set to auto, SDK uses the visibility of the video elements attached to the to the {@link RemoteVideoTrack} to decide.\n * on turning tracks on or off. The track that are not attached to any video elements or not visible on the screen will be turned\n * off automatically.\n */\n auto: 'auto',\n /**\n * When set to manual, application can use {@link RemoteVideoTrack}s switchOff and switchOn apis to control turn the track on or off.\n */\n manual: 'manual'\n};\n/**\n * Names of the supported levels for {@link EventListenerEvent}s.\n * @enum {string}\n */\n// eslint-disable-next-line\nvar EventListenerLevel = {\n debug: 'debug',\n error: 'error',\n info: 'info',\n warning: 'warning'\n};\n/**\n * Names of the supported groups for {@link EventListenerEvent}s.\n * @enum {string}\n */\n// eslint-disable-next-line\nvar EventListenerGroup = {\n /**\n * Events associated with the connection to Twilio's signaling server\n */\n signaling: 'signaling'\n};\n/**\n * An {@link EventListener} allows you to listen to fine-grained {@link EventListenerEvent}s related\n * to signaling and media that are not available in the public APIs, which might be useful for your own\n * reporting and diagnostics.\n * @typedef {EventEmitter} EventListener\n * @example\n * const { EventEmitter } = require('events');\n * const { connect } = require('twilio-video');\n *\n * const eventListener = new EventEmitter();\n * eventListener.on('event', function(event) {\n * console.log('The SDK raised an event:', event);\n * });\n *\n * connect('token', {\n * eventListener: eventListener\n * });\n */\n/**\n * The SDK raised an {@link EventListenerEvent}.\n * @event EventListener#event\n * @param {EventListenerEvent} event - Context about the event raised by the SDK.\n * This can be one of the following:\n * * {@link EventListenerClosedEvent}\n * * {@link EventListenerConnectingEvent}\n * * {@link EventListenerEarlyEvent}\n * * {@link EventListenerOpenEvent}\n * * {@link EventListenerWaitingEvent}\n */\n/**\n * An {@link EventListenerEvent} provides context about an event raised by the SDK on the\n * {@link EventListener}. Apart from the properties listed here, it may also include some\n * event-specific data within an optional \"payload\" property. The different types of\n * {@link EventListenerEvent}s are listed below:\n * * {@link EventListenerClosedEvent}\n * * {@link EventListenerConnectingEvent}\n * * {@link EventListenerEarlyEvent}\n * * {@link EventListenerOpenEvent}\n * * {@link EventListenerWaitingEvent}\n * @typedef {object} EventListenerEvent\n * @property {number} elapsedTime - The time elapsed in milliseconds since connect() was called\n * @property {EventListenerGroup} group - The group under which the event is classified\n * @property {EventListenerLevel} level - The verbosity level of the event, which can be one of \"debug\", \"error\", \"info\", \"warning\"\n * @property {string} name - The name of the event\n * @property {*} [payload] - Optional event-specific data\n * @property {number} timestamp - The time in milliseconds relative to the Unix Epoch when the event was raised\n */\n/**\n * The connection to Twilio's signaling server was closed.\n * @typedef {EventListenerEvent} EventListenerClosedEvent\n * @property {EventListenerGroup} group='signaling'\n * @property {EventListenerLevel} level - 'info' if the connection was closed by the client, 'error' otherwise\n * @property {string} name='closed'\n * @property {{reason: string}} payload - Reason for the connection being closed. It can be one of\n * 'busy', 'failed', 'local', 'remote' or 'timeout'\n */\n/**\n * The SDK is connecting to Twilio's signaling server.\n * @typedef {EventListenerEvent} EventListenerConnectingEvent\n * @property {EventListenerGroup} group='signaling'\n * @property {EventListenerLevel} level='info'\n * @property {string} name='connecting'\n */\n/**\n * The SDK is about to connect to Twilio's signaling server.\n * @typedef {EventListenerEvent} EventListenerEarlyEvent\n * @property {EventListenerGroup} group='signaling'\n * @property {EventListenerLevel} level='info'\n * @property {string} name='early'\n */\n/**\n * The SDK has established a signaling connection to Twilio's signaling server.\n * @typedef {EventListenerEvent} EventListenerOpenEvent\n * @property {EventListenerGroup} group='signaling'\n * @property {EventListenerLevel} level='info'\n * @property {string} name='open'\n */\n/**\n * The SDK is waiting to retry connecting th Twilio's signaling server. This can\n * happen if the server is busy with too many connection requests.\n * @typedef {EventListenerEvent} EventListenerWaitingEvent\n * @property {EventListenerGroup} group='signaling'\n * @property {EventListenerLevel} level='warning'\n * @property {string} name='waiting'\n */\nfunction deprecateOptions(options, log, deprecationTable) {\n deprecationTable.forEach(function (prop) {\n var didWarn = prop.didWarn, name = prop.name, newName = prop.newName, shouldDelete = prop.shouldDelete;\n if (name in options && typeof options[name] !== 'undefined') {\n if (newName && shouldDelete) {\n options[newName] = options[name];\n }\n if (shouldDelete) {\n delete options[name];\n }\n if (!didWarn && !['error', 'off'].includes(log.level)) {\n log.warn(\"The ConnectOptions \\\"\" + name + \"\\\" is \" + (newName\n ? \"deprecated and scheduled for removal. Please use \\\"\" + newName + \"\\\" instead.\"\n : 'no longer applicable and will be ignored.'));\n prop.didWarn = true;\n }\n }\n });\n}\nfunction createLocalParticipant(signaling, log, encodingParameters, networkQualityConfiguration, options, localTracks) {\n var localParticipantSignaling = signaling.createLocalParticipantSignaling(encodingParameters, networkQualityConfiguration);\n log.debug('Creating a new LocalParticipant:', localParticipantSignaling);\n return new options.LocalParticipant(localParticipantSignaling, localTracks, options);\n}\nfunction createRoom(options, localParticipant, roomSignaling) {\n var room = new Room(localParticipant, roomSignaling, options);\n var log = options.log;\n log.debug('Creating a new Room:', room);\n roomSignaling.on('stateChanged', function stateChanged(state) {\n if (state === 'disconnected') {\n log.info('Disconnected from Room:', room.toString());\n roomSignaling.removeListener('stateChanged', stateChanged);\n }\n });\n return room;\n}\nfunction createRoomSignaling(token, options, signaling, encodingParameters, preferredCodecs, localParticipant) {\n options.log.debug('Creating a new RoomSignaling');\n return signaling.connect(localParticipant._signaling, token, encodingParameters, preferredCodecs, options);\n}\nfunction getLocalTracks(options, handleLocalTracks) {\n var log = options.log;\n options.shouldStopLocalTracks = !options.tracks;\n if (options.shouldStopLocalTracks) {\n log.info('LocalTracks were not provided, so they will be acquired '\n + 'automatically before connecting to the Room. LocalTracks will '\n + 'be released if connecting to the Room fails or if the Room '\n + 'is disconnected');\n }\n else {\n log.info('Getting LocalTracks');\n log.debug('Options:', options);\n }\n return options.createLocalTracks(options).then(function getLocalTracksSucceeded(localTracks) {\n var promise = handleLocalTracks(localTracks);\n promise.catch(function handleLocalTracksFailed() {\n if (options.shouldStopLocalTracks) {\n log.info('The automatically acquired LocalTracks will now be stopped');\n localTracks.forEach(function (track) {\n track.stop();\n });\n }\n });\n return promise;\n });\n}\nfunction normalizeCodecSettings(nameOrSettings) {\n var settings = typeof nameOrSettings === 'string'\n ? { codec: nameOrSettings }\n : nameOrSettings;\n switch (settings.codec.toLowerCase()) {\n case 'opus': {\n return Object.assign({ dtx: true }, settings);\n }\n case 'vp8': {\n return Object.assign({ simulcast: false }, settings);\n }\n default: {\n return settings;\n }\n }\n}\nmodule.exports = connect;\n//# sourceMappingURL=connect.js.map","'use strict';\nvar _a = require('./util/constants'), DEFAULT_LOG_LEVEL = _a.DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME = _a.DEFAULT_LOGGER_NAME;\n/**\n * Request a {@link LocalAudioTrack} or {@link LocalVideoTrack}.\n * @param {Track.Kind} kind - \"audio\" or \"video\"\n * @param {CreateLocalTrackOptions} [options]\n * @returns {Promise}\n * @private\n */\nfunction createLocalTrack(kind, options) {\n options = Object.assign({\n loggerName: DEFAULT_LOGGER_NAME,\n logLevel: DEFAULT_LOG_LEVEL,\n }, options);\n var createOptions = {};\n createOptions.loggerName = options.loggerName;\n createOptions.logLevel = options.logLevel;\n delete options.loggerName;\n delete options.logLevel;\n var createLocalTracks = options.createLocalTracks;\n delete options.createLocalTracks;\n createOptions[kind] = Object.keys(options).length > 0 ? options : true;\n return createLocalTracks(createOptions).then(function (localTracks) { return localTracks[0]; });\n}\n/**\n * Request a {@link LocalAudioTrack}.\n * @alias module:twilio-video.createLocalAudioTrack\n * @param {CreateLocalTracksOptions|CreateLocalAudioTrackOptions} [options] - Options for requesting a {@link LocalAudioTrack}\n * @returns {Promise}\n * @example\n * var Video = require('twilio-video');\n *\n * // Connect to the Room with just video\n * Video.connect('my-token', {\n * name: 'my-cool-room',\n * video: true\n * }).then(function(room) {\n * // Add audio after connecting to the Room\n * Video.createLocalAudioTrack().then(function(localTrack) {\n * room.localParticipant.publishTrack(localTrack);\n * });\n * });\n * @example\n * var Video = require('twilio-video');\n *\n * // Request the LocalAudioTrack with a custom name\n * // and krisp noise cancellation\n * Video.createLocalAudioTrack({\n * name: 'microphone',\n * noiseCancellationOptions: {\n * vendor: 'krisp',\n * sdkAssetsPath: '/twilio-krisp-audio-plugin/1.0.0/dist'\n * }\n * });\n */\nfunction createLocalAudioTrack(options) {\n return createLocalTrack('audio', options);\n}\n/**\n * Request a {@link LocalVideoTrack}. Note that on mobile browsers,\n * the camera can be reserved by only one {@link LocalVideoTrack} at any given\n * time. If you attempt to create a second {@link LocalVideoTrack}, video frames\n * will no longer be supplied to the first {@link LocalVideoTrack}.\n * @alias module:twilio-video.createLocalVideoTrack\n * @param {CreateLocalTrackOptions} [options] - Options for requesting a {@link LocalVideoTrack}\n * @returns {Promise}\n * @example\n * var Video = require('twilio-video');\n *\n * // Connect to the Room with just audio\n * Video.connect('my-token', {\n * name: 'my-cool-room',\n * audio: true\n * }).then(function(room) {\n * // Add video after connecting to the Room\n * Video.createLocalVideoTrack().then(function(localTrack) {\n * room.localParticipant.publishTrack(localTrack);\n * });\n * });\n * @example\n * var Video = require('twilio-video');\n *\n * // Request the default LocalVideoTrack with a custom name\n * Video.createLocalVideoTrack({ name: 'camera' }).then(function(localTrack) {\n * console.log(localTrack.name); // 'camera'\n * });\n */\nfunction createLocalVideoTrack(options) {\n return createLocalTrack('video', options);\n}\n/**\n * {@link NoiseCancellationVendor} specifies the 3rd party plugin to use for noise cancellation.\n * @enum {string}\n */\n// eslint-disable-next-line\nvar NoiseCancellationVendor = {\n /**\n * This plugin can be found by requesting access with this form {@link https://forms.gle/eeFyoGJj1mgMrxN88}\n */\n krisp: 'krisp',\n};\n/**\n * You can use 3rd party noise cancellation plugin when creating {@link LocalAudioTrack}\n * By specifying these options. This is a beta feature.\n * @typedef {object} NoiseCancellationOptions\n * @property {NoiseCancellationVendor} vendor - Specifies the vendor library to use\n * You need to obtain and host the library files on your web server.\n * @property {string} sdkAssetsPath - Specifies path where vendor library files are\n * hosted on your web server.\n */\n/**\n * Create {@link LocalAudioTrack} options.\n * @typedef {CreateLocalTrackOptions} CreateLocalAudioTrackOptions\n * @property {boolean} [workaroundWebKitBug180748=false] - setting this\n * attempts to workaround WebKit Bug 180748, where, in Safari, getUserMedia may return a silent audio\n * MediaStreamTrack.\n * @property {DefaultDeviceCaptureMode} [defaultDeviceCaptureMode=\"auto\"] - This optional property only applies if the\n * {@link LocalAudioTrack} is capturing from the default audio input device connected to a desktop or laptop. When the\n * property is set to \"auto\", the LocalAudioTrack restarts whenever the default audio input device changes, in order to\n * capture audio from the new default audio input device. For example, when a bluetooth audio headset is connected to a\n * Macbook, the LocalAudioTrack will start capturing audio from the headset microphone. When the headset is disconnected,\n * the LocalAudioTrack will start capturing audio from the Macbook microphone. When the property is set to \"manual\", the\n * LocalAudioTrack continues to capture from the same audio input device even after the default audio input device changes.\n * When the property is not specified, it defaults to \"auto\".\n * @property {NoiseCancellationOptions} [noiseCancellationOptions] - This optional property enables using 3rd party plugins\n * for noise cancellation.\n */\n/**\n * Create {@link LocalTrack} options. Apart from the properties listed here, you can\n * also specify any of the MediaTrackConstraints\n * properties.\n * @typedef {MediaTrackConstraints} CreateLocalTrackOptions\n * @property {LogLevel|LogLevels} [logLevel='warn'] - (deprecated: use [Video.Logger](module-twilio-video.html) instead.\n * See [examples](module-twilio-video.html#.connect) for details)\n * Set the default log verbosity\n * of logging. Passing a {@link LogLevel} string will use the same\n * level for all components. Pass a {@link LogLevels} to set specific log\n * levels.\n * @property {string} [loggerName='twilio-video'] - The name of the logger. Use this name when accessing the logger used by the SDK.\n * See [examples](module-twilio-video.html#.connect) for details.\n * @property {string} [name] - The {@link LocalTrack}'s name; by default,\n * it is set to the {@link LocalTrack}'s ID.\n */\nmodule.exports = {\n audio: createLocalAudioTrack,\n video: createLocalVideoTrack\n};\n//# sourceMappingURL=createlocaltrack.js.map","'use strict';\nvar _a = require('../webrtc/util'), guessBrowser = _a.guessBrowser, isWebRTCSupported = _a.support;\nvar getSdpFormat = require('../webrtc/util/sdp').getSdpFormat;\nvar _b = require('./browserdetection'), isAndroid = _b.isAndroid, isMobile = _b.isMobile, isNonChromiumEdge = _b.isNonChromiumEdge, rebrandedChromeBrowser = _b.rebrandedChromeBrowser, mobileWebKitBrowser = _b.mobileWebKitBrowser;\nvar SUPPORTED_CHROME_BASED_BROWSERS = [\n 'crios',\n 'edg',\n 'edge',\n 'electron',\n 'headlesschrome'\n];\nvar SUPPORTED_ANDROID_BROWSERS = [\n 'chrome',\n 'firefox'\n];\nvar SUPPORTED_IOS_BROWSERS = [\n 'chrome',\n 'safari'\n];\n// Currently none. Add 'brave', 'edg', and 'edge' here once we start supporting them\nvar SUPPORTED_MOBILE_WEBKIT_BASED_BROWSERS = [];\n/**\n * Check if the current browser is officially supported by twilio-video.js.\n * @returns {boolean}\n */\nfunction isSupported() {\n var browser = guessBrowser();\n // NOTE (csantos): Return right away if there is no browser detected\n // to prevent unnecessary checks which could lead to errors\n if (!browser) {\n return false;\n }\n var rebrandedChrome = rebrandedChromeBrowser(browser);\n var mobileWebKit = mobileWebKitBrowser(browser);\n var supportedMobileBrowsers = isAndroid() ?\n SUPPORTED_ANDROID_BROWSERS : SUPPORTED_IOS_BROWSERS;\n return !!browser\n && isWebRTCSupported()\n && getSdpFormat() === 'unified'\n && (!rebrandedChrome || SUPPORTED_CHROME_BASED_BROWSERS.includes(rebrandedChrome))\n && !isNonChromiumEdge(browser)\n && (!mobileWebKit || SUPPORTED_MOBILE_WEBKIT_BASED_BROWSERS.includes(mobileWebKit))\n && (!isMobile() || supportedMobileBrowsers.includes(browser));\n}\nmodule.exports = isSupported;\n//# sourceMappingURL=support.js.map","'use strict';\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar createlocaltracks_1 = require(\"./createlocaltracks\");\nvar preflighttest_1 = require(\"./preflight/preflighttest\");\nvar internals = {\n connect: require('./connect'),\n createLocalAudioTrack: require('./createlocaltrack').audio,\n createLocalVideoTrack: require('./createlocaltrack').video,\n isSupported: require('./util/support')(),\n version: require('../package.json').version,\n Logger: require('./vendor/loglevel'),\n LocalAudioTrack: require('./media/track/es5').LocalAudioTrack,\n LocalDataTrack: require('./media/track/es5').LocalDataTrack,\n LocalVideoTrack: require('./media/track/es5').LocalVideoTrack\n};\nfunction connect(token, options) {\n var internalOptions = __assign({ createLocalTracks: createlocaltracks_1.createLocalTracks }, options);\n return internals.connect(token, internalOptions);\n}\nfunction createLocalAudioTrack(options) {\n var internalOptions = __assign({ createLocalTracks: createlocaltracks_1.createLocalTracks }, options);\n return internals.createLocalAudioTrack(internalOptions);\n}\nfunction createLocalVideoTrack(options) {\n var internalOptions = __assign({ createLocalTracks: createlocaltracks_1.createLocalTracks }, options);\n return internals.createLocalVideoTrack(internalOptions);\n}\n/**\n * @module twilio-video\n * @property {boolean} isSupported - true if the current browser is officially\n * supported by twilio-video.js; In this context, \"supported\" means that\n * twilio-video.js has been extensively tested with this browser; This\n * table\n * specifies the list of officially supported browsers.\n *\n * @property {object} Logger - The loglevel\n * module used by the SDK. Use this object to access the internal loggers and perform actions as defined by the\n * loglevel APIs.\n * See [connect](#.connect) for examples.\n *\n * @property {string} version - current version of twilio-video.js.\n */\nvar isSupported = internals.isSupported;\nvar version = internals.version;\nvar Logger = internals.Logger;\nvar LocalAudioTrack = internals.LocalAudioTrack;\nvar LocalVideoTrack = internals.LocalVideoTrack;\nvar LocalDataTrack = internals.LocalDataTrack;\nmodule.exports = {\n connect: connect,\n createLocalAudioTrack: createLocalAudioTrack,\n createLocalVideoTrack: createLocalVideoTrack,\n createLocalTracks: createlocaltracks_1.createLocalTracks,\n runPreflight: preflighttest_1.runPreflight,\n isSupported: isSupported,\n version: version,\n Logger: Logger,\n LocalAudioTrack: LocalAudioTrack,\n LocalVideoTrack: LocalVideoTrack,\n LocalDataTrack: LocalDataTrack,\n};\n//# sourceMappingURL=index.js.map","export function isMobile() {\n return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent)\n}\n","import { Controller } from '@hotwired/stimulus'\nimport { connect, createLocalVideoTrack, createLocalTracks } from 'twilio-video'\nimport { isMobile } from '~js/helpers/mobile'\n\nexport default class extends Controller {\n static targets = [\n 'participants',\n 'participantTemplate',\n 'video',\n ]\n\n static values = {\n name: String,\n token: String,\n facingMode: { type: String, default: 'user' },\n }\n\n async connect() {\n const hasBackCamera = await this.checkBackCameraExistance()\n if (hasBackCamera) this.element.classList.add('-has-back-camera')\n\n await this.createTracks()\n this.attachVideoTrack()\n\n this.room = await connect(this.tokenValue, {\n name: this.nameValue,\n tracks: this.tracks,\n })\n\n if (isMobile()) {\n document.addEventListener('visibilitychange', async () => {\n if (document.visibilityState === 'hidden') {\n this.removeAllTracks()\n } else {\n await this.createTracks()\n await this.room.localParticipant.publishTracks(this.tracks)\n this.attachVideoTrack()\n }\n })\n }\n\n this.syncClassesForLocalParticipant()\n\n this.element.classList.remove('-loading')\n this.element.classList.add('-connected')\n\n this.room.participants.forEach(participant => this.renderParticipant(participant))\n this.room.on('participantConnected', participant => this.renderParticipant(participant))\n this.room.on('participantDisconnected', participant => this.removeParticipant(participant))\n\n window.addEventListener('pagehide', this.leave.bind(this))\n window.addEventListener('beforeunload', this.leave.bind(this))\n }\n\n async checkBackCameraExistance() {\n const devices = await navigator.mediaDevices.enumerateDevices()\n const videoInputDevices = devices.filter(device => device.kind === 'videoinput')\n\n const backCameraDevices = await Promise.all(\n videoInputDevices.map(async device => {\n const capabilities = await device.getCapabilities()\n return capabilities.facingMode?.includes('environment')\n })\n )\n\n return backCameraDevices.includes(true)\n }\n\n async changeVideoDevice() {\n this.facingModeValue = this.facingModeValue === 'user' ? 'environment' : 'user'\n this.cameraTrack.restart({ facingMode: this.facingModeValue })\n }\n\n async createTracks() {\n this.tracks = await createLocalTracks({\n audio: true,\n video: { facingMode: this.facingModeValue }\n })\n }\n\n removeAllTracks() {\n this.tracks.forEach(track => track.stop())\n this.room.localParticipant.unpublishTracks(this.tracks)\n this.dettachVideoTrack()\n }\n\n attachVideoTrack() {\n this.videoTarget.appendChild(this.cameraTrack.attach())\n }\n\n dettachVideoTrack() {\n this.videoTarget.innerHTML = ''\n }\n\n leave() {\n this.room.disconnect()\n this.element.classList.remove('-connected')\n this.element.classList.add('-disconnected')\n }\n\n disconnect() {\n window.removeEventListener('pagehide', this.leave.bind(this))\n window.addEventListener('beforeunload', this.leave.bind(this))\n }\n\n renderParticipant(participant) {\n const cloneNode = this.participantTemplateTarget.content.cloneNode(true)\n cloneNode.firstChild.dataset.twilioRemoteSidValue = participant.sid\n this.participantsTarget.appendChild(cloneNode)\n }\n\n removeParticipant(participant) {\n this.participantsTarget.querySelector(`[data-twilio-remote-sid-value=\"${participant.sid}\"]`).remove()\n }\n\n audioToggle() {\n !this.hasAudio ? this.localAudioTrack.enable() : this.localAudioTrack.disable()\n this.syncClassesForLocalParticipant()\n }\n\n videoToggle() {\n !this.hasVideo ? this.localVideoTrack.enable() : this.localVideoTrack.disable()\n this.syncClassesForLocalParticipant()\n }\n\n syncClassesForLocalParticipant() {\n this.hasAudio ? this.element.classList.add('-audio') : this.element.classList.remove('-audio')\n this.hasVideo ? this.element.classList.add('-video') : this.element.classList.remove('-video')\n }\n\n get cameraTrack() {\n return this.tracks.find(track => track.kind === 'video')\n }\n\n get hasAudio() {\n return this.localAudioTrack.isEnabled\n }\n\n get hasVideo() {\n return this.localVideoTrack.isEnabled\n }\n\n get localParticipant() {\n return this.room.localParticipant\n }\n\n get localVideoTrack() {\n return this.localParticipant.videoTracks.values().next().value.track\n }\n\n get localAudioTrack() {\n return this.localParticipant.audioTracks.values().next().value.track\n }\n}\n"],"names":["Dialog","Controller","turboEvent","__publicField","Existance","Modal","event","dialogContent","clone","dialog","dialogTitle","frame","key","value","dynamicimport","scope","location","URL","api","module","noop","undefinedType","isIE","logMethods","bindMethod","obj","methodName","method","traceForIE","realMethod","replaceLoggingMethods","level","loggerName","i","enableLoggingWhenConsoleArrives","defaultMethodFactory","Logger","name","defaultLevel","factory","self","currentLevel","storageKey","persistLevelIfPossible","levelNum","levelName","getPersistedLevel","storedLevel","cookie","persist","initialLevel","defaultLogger","_loggersByName","logger","_log","loglevel","packageInfo","require$$0","environment","region","article","word","context","type","values","__read","this","o","n","m","r","ar","e","error","__spreadArray","to","from","il","j","defaultGetLogger","constants","require$$1","DEFAULT_LOG_LEVEL","DEFAULT_LOGGER_NAME","E","deprecationWarningsByComponentConstructor","getDeprecationWarnings","componentConstructor","deprecationWarnings","Log","moduleName","component","logLevels","getLogger","validateLogLevels","validateLogLevel","levels","logLevel","messages","LOG_LEVEL_VALUES","prefix","deprecationWarning","warning","customMessage","LOG_LEVELS_SET","LOG_LEVEL_NAMES","log","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","reject","fulfilled","step","rejected","result","__generator","body","_","t","f","y","g","verb","v","op","noisecancellationadapter","dynamicImport","PLUGIN_CONFIG","ensureVersionSupported","_a","supportedVersion","plugin","pluginVersion","supportedVersions","version","pluginVersions","tempContext","isSupported","audioProcessors","createNoiseCancellationAudioProcessor","noiseCancellationOptions","audioProcessor","pluginConfig","pluginFile","rootDir","sdkFilePath","dynamicModule","plugin_1","er_1","enable","sourceTrack","mediaStream","cleanTrack","noisecancellationimpl","noisecancellationadapter_1","NoiseCancellationImpl","processor","originalTrack","reacquire","processorWasEnabled","track","processedTrack","applyNoiseCancellation","mediaStreamTrack","noiseCancellation","ex_1","defer","deferred","delegateMethod","source","wrapper","target","isProperty","propDesc","delegateMethods","difference","list1","list2","item","flatMap","list","mapFn","listArray","flattened","getUserAgent","guessBrowser","userAgent","guessBrowserVersion","regex","match","versions","isIOSChrome","interceptEvent","currentListener","newListener","legacyPromise","promise","onSuccess","onFailure","makeUUID","c","proxyProperties","propertyName","proxyProperty","args","_i","support","createSupportedCodecsSet","kind","mimeType","pc","sdp","line","supportedCodecs","isCodecSupported","codec","codecs","clearCachedSupportedCodecs","util","SID_CHARS","SID_CHAR_LENGTH","createSID","sid","TwilioWarning","twiliowarning","__extends","extendStatics","d","b","p","__","trackPriority","sessionSID","require$$2","require$$3","asLocalTrack","options","asLocalTrackPublication","signaling","unpublish","LocalTrackPublication","capitalize","deprecateEvents","emitter","events","warningsShown","filterObject","object","filterValue","filtered","mapped","getPlatform","_b","_c","entry","platform","oncePerTick","fn","timeout","nextTick","promiseFromEvents","operation","eventEmitter","successEvent","failureEvent","getOrNull","path","output","isDeepEqual","val1","val2","val","val1Keys","val2Keys","isNonArrayObject","buildLogLevels","trackClass","local","trackPublicationClass","publication","hidePrivateProperties","hideProperty","hidePrivateAndCertainPublicPropertiesInClass","klass","props","_super","class_1","_this","hidePublicProperties","descriptor","arrayToJSON","array","valueToJSON","setToJSON","set","mapToJSON","map","json","objectToJSON","createRoomConnectEventPayload","connectOptions","boolToString","payload","prop","eventProp","videoBPOptions_1","createBandwidthProfilePayload","bandwidthProfile","createRSPPayload","createBandwidthProfileVideoPayload","bandwidthProfileVideo","createRenderDimensionsPayload","createMediaSignalingPayload","dominantSpeaker","networkQuality","trackSwitchOff","adaptiveSimulcast","renderHints","transports","createDimensionsPayload","dimensions","renderDimensions","PRIORITY_HIGH","PRIORITY_LOW","PRIORITY_STANDARD","propConversions","payloadProp","_d","transform","x","createSubscribePayload","automaticSubscription","createMediaWarningsPayload","notifyWarnings","mediaWarnings","twilioWarningName","withJitter","jitter","rand","inRange","num","min","max","isChromeScreenShareTrack","waitForSometime","timeoutMS","waitForEvent","eventTarget","onevent","util_1","isSdpSemanticsSupported","checkIfSdpSemanticsIsSupported","chromeSdpFormat","clearChromeCachedSdpFormat","getChromeDefaultSdpFormat","getChromeSdpFormat","sdpSemantics","getSafariSdpFormat","getSdpFormat","getMatches","pattern","lines","matches","results","getTrackIds","getPlanBTrackIds","getUnifiedPlanTrackIds","getPlanBSSRCs","trackId","getMediaSections","direction","mediaSection","kindPattern","directionPattern","getMediaSectionSSRCs","getUnifiedPlanSSRCs","mediaSections","msidAttrRegExp","matchingMediaSections","getTrackIdsToSSRCs","getSSRCs","getPlanBTrackIdsToSSRCs","getUnifiedPlanTrackIdsToSSRCs","updateTrackIdsToSSRCs","trackIdsToSSRCs","newTrackIdsToSSRCs","newSSRCsToOldSSRCs","ssrcs","oldSSRCs","newSSRCs","oldSSRC","newSSRC","replacement","updatePlanBTrackIdsToSSRCs","updateUnifiedPlanTrackIdsToSSRCs","guess","guessVersion","isChrome","isFirefox","isSafari","chromeMajorVersion","CHROME_LEGACY_MAX_AUDIO_LEVEL","getStats","peerConnection","_getStats","localAudioTracks","getTracks","localVideoTracks","remoteAudioTracks","remoteVideoTracks","statsResponse","trackStatsPromises","tracks","statsArrayName","isRemote","getTrackStats","trackStatsArray","trackStats","getActiveIceCandidatePairStats","activeIceCandidatePairStatsReport","standardizeChromeOrSafariActiveIceCandidatePairStats","standardizeFirefoxActiveIceCandidatePairStats","stats","activeCandidatePairStats","nominated","activeLocalCandidateStats","activeRemoteCandidateStats","standardizedCandidateStatsKeys","standardizedLocalCandidateStatsKeys","standatdizedLocalCandidateStatsReport","report","standardizedRemoteCandidateStatsReport","state","fixup","candidateTypes","ffKeys","localStatKey","remoteStatKey","localOrRemote","getSendersOrReceivers","getStreams","stream","chromeOrSafariGetTrackStats","firefoxGetTrackStats","response","standardizeChromeLegacyStats","standardizeChromeOrSafariStats","standardizeFirefoxStats","ssrcReport","standardizedStats","simulateExceptionWhileStandardizingStats","inbound","outbound","remoteInbound","remoteOutbound","localMedia","stat","mainSources","remoteSource","statSources","getStatValue","sourceFound","statSource","ssrc","timestamp","roundTripTime","frameWidth","frameHeight","framesPerSecond","bytesReceived","bytesSent","packetsLost","packetsReceived","packetsSent","audioLevel","totalPacketSendDalay","totalEncodeTime","framesEncoded","estimatedPlayoutTimestamp","totalDecodeTime","framesDecoded","jitterBufferDelay","jitterBufferEmittedCount","remoteId","first","second","frameRateSent","frameRateReceived","getstats","getUserMedia","constraints","getusermedia","mediastreamModule","mediastreamtrackModule","rtcicecandidateModule","ChromeRTCSessionDescription","descriptionInitDict","description","chrome","R","ReflectApply","receiver","ReflectOwnKeys","ProcessEmitWarning","NumberIsNaN","EventEmitter","eventsModule","once","defaultMaxListeners","checkListener","listener","arg","_getMaxListeners","that","doError","er","err","handler","len","listeners","arrayClone","_addListener","prepend","existing","w","onceWrapper","_onceWrap","wrapped","position","originalListener","spliceOne","keys","_listeners","unwrap","evlistener","unwrapListeners","listenerCount","arr","copy","index","ret","errorListener","resolver","eventTargetAgnosticAddListener","addErrorHandlerIfEventEmitter","flags","wrapListener","EventTarget","eventtarget","states","Latch","initialState","_state","whenDeferreds","newState","createUnreachableStateError","latch","RTCRtpSenderShim","rtcrtpsender","MediaStream","require$$4","require$$5","require$$6","isUnifiedPlan","ChromeRTCPeerConnection","configuration","newConfiguration","sdpFormat","shimDataChannel","rest","sender","candidate","answer","arg1","arg2","arg3","hasReceiversForTracksOfKind","offer","label","dataChannelDict","shimDataChannelInit","dataChannel","setDescription","setPendingLocalOffer","clearPendingLocalOffer","pendingLocalOffer","pendingRemoteOffer","intermediateState","setLocalDescription","setRemoteAnswer","previousSignalingState","needsMaxPacketLifeTimeShim","tracksToSSRCs","firefox","FirefoxRTCSessionDescription","updateTracksToSSRCs","FirefoxRTCPeerConnection","overwriteWithInitiallyNegotiatedDtlsRole","saveInitiallyNegotiatedDtlsRole","rollback","onceRolledBack","remote","dtlsRole","SafariRTCPeerConnection","safari","rtcpeerconnectionModule","rtcsessiondescriptionModule","WebRTC","webrtc","inherits","ctor","superCtor","TempCtor","isAndroid","hasTouchScreen","isIpad","isIphone","isIOS","isMobile","isNonChromiumEdge","browser","rebrandedChromeBrowser","parenthesizedSubstrings","getParenthesizedSubstrings","nameAndVersions","substring","nameAndVersion","browserNames","mobileWebKitBrowser","string","openParenthesisPositions","substrings","openParenthesisPosition","browserdetection","delay","detectSilence","audioContext","analyser","samples","timeoutDidFire","doDetectSilence","sample","isSilent","detectsilence","NativeAudioContext","AudioContextFactory","holder","audiocontext","N_ATTEMPTS","ATTEMPT_DURATION_MS","detectSilentAudio","el","attemptsLeft","doCheckSilence","detectsilentaudio","LocalMediaRestartDeferreds","localmediarestartdeferreds","eventemitter","nInstances","Track","id","localMediaRestartDeferreds","MediaTrack","mediaTrackTransceiver","isStarted","_isStarted","onended","onUnintentionallyPaused","playIfPausedAndNotBackgrounded","shimMediaElement","selector","els","elements","shim","tag","origPause","origPlay","pausedIntentionally","onPause","mediatrack","AudioTrack","audiotrack","canvas","N_SAMPLES","SAMPLE_HEIGHT","SAMPLE_INTERVAL_MS","SAMPLE_WIDTH","checkSilence","frameDataWithoutAlpha","ex","detectSilentVideo","samplesLeft","detectsilentvideo","DocumentVisibilityMonitor","nPhases","count","phaseListeners","isVisible","_loop_1","phase","documentvisibilitymonitor","workaround","retry","doWorkaround","isSilentPromise","workaround180748","QueueingEventEmitter","queuedEvent","queue","queueingeventemitter","TrackTransceiver","transceiver","MediaTrackTransceiver","MediaTrackSender","eventsToReemitters","reemitter","clones","senders","publisherHintCallback","encodings","replaceTrackResult","ILLEGAL_INVOKE","documentVisibilityMonitor","require$$7","gUMSilentTrackWorkaround","require$$8","require$$9","mixinLocalMediaTrack","AudioOrVideoTrack","LocalMediaTrack","workaroundWebKitBug1208516","mediaTrackSender","restartWhenInadvertentlyStopped","gUMConstraints","gUMPromise","newMediaStreamTrack","enabled","localMediaTrack","getSourceMediaStreamTrack","trackChangeInProgress","shouldReacquireTrack","_workaroundWebKitBug1208516Cleanup","isStopped","isInadvertentlyStopped","muted","maybeRestart","shouldReacquire","removeMediaStreamTrackListeners","addMediaStreamTrackListeners","onMute","onVisibilityChange","localmediatrack","LocalMediaAudioTrack","LocalAudioTrack","defaultDeviceLabel","defaultDeviceId","defaultGroupId","deviceInfos","defaultDeviceInfo","deviceId","defaultDeviceCaptureMode","isNotEqualToCapturedDeviceIdOrEqualToDefault","requestedDeviceId","isCapturingFromDefaultDevice","checkIfCapturingFromDefaultDevice","deviceIdConstraint","restartConstraints","localaudiotrack","LocalAudioTrackClass","DEFAULT_FRAME_RATE","captureVideoFramesSetInterval","videoEl","processVideoFrame","frameRate","sampleInterval","readable","controller","transformer","captureVideoFramesInsertableStreams","videoFrameType","shouldStop","videoFrame","capturevideoframes","DEFAULT_VIDEO_PROCESSOR_STATS_INTERVAL_MS","VideoProcessorEventObserver","info","data","message","captureHeight","captureWidth","inputFrameRate","isRemoteVideoTrack","inputFrameBufferType","outputFrameBufferContextType","benchmark","now","averages","current","videoprocessoreventobserver","captureVideoFrames","VideoTrack","isPublishing","canCaptureFrames","readyState","process","checkResult","width","height","input","dimensionsChanged","processorOptions","dummyEl","_e","ctx","targetFps","elem","videotrack","LocalMediaVideoTrack","LocalVideoTrack","workaroundSilentLocalVideo","useProcessed","unprocessedTrack","localVideoTrack","doc","onUnmute","localvideotrack","LocalVideoTrackClass","DataTrackTransceiver","maxPacketLifeTime","maxRetransmits","ordered","DataTrackSender","maxRetransmtis","DefaultDataTrackSender","LocalDataTrack","dataTrackSender","localdatatrack","LocalDataTrackClass","es5","__assign","s","createlocaltracks","noisecancellationimpl_1","MediaStreamTrack","INVALID_VALUE","createLocalTrackCalls","createLocalTracks","isAudioVideoAbsent","fullOptions","logComponentName","localTrackOptions","extraLocalTrackOptions","mediaStreamConstraints","workaroundWebKitBug180748","mediaStreamTracks","error_1","mode","timer","Timer","mos","r0","calculateMOS","rtt","fractionLost","effectiveLatency","rFactor","mosToScore","mosValue","score","getCombinedConnectionStats_1","getStatValues","statName","reportTypes","getCombinedConnectionStats","publisher","subscriber","publisherStats","subscriberStats","timestamps","packets","trackRoundTripTime","currentRoundTripTime","selectedIceCandidatePairStats","iceCandidateStats","a","extractSelectedActiveCandidatePair","makeStandardCandidateStats","keyInfo","keysToLookFor","selectedCandidatePairId","candidatePairs","activeCandidatePairStatsFound","pair","StateMachine","lock","transformStates","_lock","reachable","when","transitionFunction","releaseLock","_key","isValidTransition","oldLock","preemptionKey","nameOrKey","key_1","takeLock","makeLock","createUnreachableError","graph","newGraph","reachableFrom","node","newStates","here","there","statemachine","NetworkMonitor","onNetworkChanged","nav","connection","networkChanged","_events","_listener","_target","networkmonitor","Timeout","autoStart","ws","TCMP_VERSION","DEFAULT_MAX_CONSECUTIVE_MISSED_HEARTBEATS","DEFAULT_MAX_CONSECUTIVE_FAILED_HELLOS","DEFAULT_MAX_REQUESTED_HEARTBEAT_TIMEOUT","DEFAULT_OPEN_TIMEOUT","DEFAULT_WELCOME_TIMEOUT","OUTGOING_HEARTBEAT_OFFSET","WS_CLOSE_NORMAL","WS_CLOSE_WELCOME_TIMEOUT","WS_CLOSE_HEARTBEATS_MISSED","WS_CLOSE_HELLO_FAILED","WS_CLOSE_SEND_FAILED","WS_CLOSE_NETWORK_CHANGED","WS_CLOSE_BUSY_WAIT","WS_CLOSE_SERVER_BUSY","WS_CLOSE_OPEN_TIMEOUT","toplevel","WebSocket","CloseReason","wsCloseCodesToCloseReasons","TwilioConnection","serverUrl","networkMonitor","reason","eventsToLevels","code","openTimeout","keepAlive","retryAfter","maxConsecutiveFailedHellos","maxConsecutiveMissedHeartbeats","negotiatedTimeout","heartbeatTimeout","outgoingHeartbeatTimeout","helloBody","hello","sendOrEnqueue","welcomeTimeout","twilioconnection","TwilioError","twilioerror","TwilioErrorByCode","twilioVideoErrors","AccessTokenInvalidError","AccessTokenHeaderInvalidError","AccessTokenIssuerInvalidError","AccessTokenExpiredError","AccessTokenNotYetValidError","AccessTokenGrantsInvalidError","AccessTokenSignatureInvalidError","SignalingConnectionError","SignalingConnectionDisconnectedError","SignalingConnectionTimeoutError","SignalingIncomingMessageInvalidError","SignalingOutgoingMessageInvalidError","SignalingServerBusyError","RoomNameInvalidError","RoomNameTooLongError","RoomNameCharsInvalidError","RoomCreateFailedError","RoomConnectFailedError","RoomMaxParticipantsExceededError","RoomNotFoundError","RoomMaxParticipantsOutOfRangeError","RoomTypeInvalidError","RoomTimeoutOutOfRangeError","RoomStatusCallbackMethodInvalidError","RoomStatusCallbackInvalidError","RoomStatusInvalidError","RoomRoomExistsError","RoomInvalidParametersError","RoomMediaRegionInvalidError","RoomMediaRegionUnavailableError","RoomSubscriptionOperationNotSupportedError","RoomCompletedError","RoomAudioOnlyFlagNotSupportedError","RoomTrackKindNotSupportedError","ParticipantIdentityInvalidError","ParticipantIdentityTooLongError","ParticipantIdentityCharsInvalidError","ParticipantMaxTracksExceededError","ParticipantNotFoundError","ParticipantDuplicateIdentityError","TrackInvalidError","TrackNameInvalidError","TrackNameTooLongError","TrackNameCharsInvalidError","TrackNameIsDuplicatedError","TrackServerTrackCapacityReachedError","MediaClientLocalDescFailedError","MediaServerLocalDescFailedError","MediaClientRemoteDescFailedError","MediaServerRemoteDescFailedError","MediaNoSupportedCodecError","MediaConnectionError","MediaDTLSTransportFailedError","ConfigurationAcquireFailedError","ConfigurationAcquireTurnFailedError","getturncredentials","ICE_VERSION","createTwilioError","events_1","getTurnCredentials","token","wsServer","eventObserver","connectionOptions","twilioConnection","done","messageData","ice_servers","makestat","makeStat","average","total","syntheticaudio","syntheticAudio","audioContextFactory","oscillator","dst","originalStop","syntheticvideo","syntheticVideo","stopped","animate","MovingAverageDelta","denominatorDelta","numeratorDelta","numerator","denominator","movingaveragedelta","VALID_GROUPS","VALID_LEVELS","EventObserver","connectTimestamp","eventListener","group","elapsedTime","publisherPayload","eventobserver","MAX_RECONNECT_ATTEMPTS","RECONNECT_INTERVAL_MS","hardwareDevicePublisheriPad","hardwareDevicePublisheriPhone","InsightsPublisher","sdkName","sdkVersion","realm","createGateway","roomSid","participantSid","maybeReconnect","reconnect","connect","groupName","eventName","publishOrEnqueue","handleConnectResponse","connectRequest","connectInterval","timeToWait","insightspublisher","preflighttest","constants_1","timer_1","mos_1","getturncredentials_1","makestat_1","syntheticaudio_1","syntheticvideo_1","index_1","WS_SERVER","require$$10","require$$11","require$$12","require$$13","require$$14","require$$15","SECOND","DEFAULT_TEST_DURATION","PreflightProgress","notEmpty","PreflightTest","internalOptions","duration","collectedStats","stepName","timeoutError","MAX_STEP_DURATION","stepPromise","timeoutPromise","_resolve","dtlsTransport","transport","eventPublisherOptions","eventPublisher","undefinedValue","jitterStats","rttStats","packetLossStats","mosStats","candidateTypeToProtocols","candidateStats","protocols","insightsReport","localTracks","pcs","reportToInsights","elements_1","iceServers","senderPC_1","receiverPC_1","remoteTracks_1","collectedStats_1","preflightReport","remoteTracksPromise","updatedOffer","remoteTracks","element","initCollectedStats","senderPC","receiverPC","combinedStats","hasLastData","fractionPacketLost","percentPacketsLost","startTime","STAT_INTERVAL","remainingDuration","runPreflight","preflight","CancelablePromise","onCreate","onCancel","cancelablepromise","createCancelableRoomPromise","getLocalTracks","createLocalParticipant","createRoomSignaling","createRoom","cancelableRoomSignalingPromise","cancellationError","isCanceled","localParticipant","getCancelableRoomSignalingPromise","roomSignaling","cancelableroompromise","EncodingParametersImpl","encodingParameters","shouldEmitChanged","maxKindBitrate","encodingparameters","clientTrackSwitchOffControl","videoContentPreferencesMode","subscriptionMode","trackSwitchOffMode","validateBandwidthProfile","validateObject","validateRenderDimensions","validateLocalTrack","propChecks","validate","TrackPublication","trackName","trackSid","trackpublication","priority","priorityValues","localtrackpublication","LocalAudioTrackPublication","localaudiotrackpublication","LocalDataTrackPublication","localdatatrackpublication","LocalVideoTrackPublication","localvideotrackpublication","mixinRemoteMediaTrack","RemoteMediaTrack","mediaTrackReceiver","isEnabled","isSwitchedOff","setPriority","setRenderHint","renderHint","playIfPausedWhileInBackground","remoteMediaTrack","onVisibilityChanged","isInadvertentlyPaused","remotemediatrack","RemoteMediaAudioTrack","RemoteAudioTrack","remoteaudiotrack","RemoteTrackPublication","remotetrackpublication","RemoteAudioTrackPublication","remoteaudiotrackpublication","RemoteDataTrack","dataTrackReceiver","remotedatatrack","RemoteDataTrackPublication","remotedatatrackpublication","NullObserver","callback","visibleEntry","invisibleEntry","videoElement","isIntersecting","NullIntersectionObserver","NullResizeObserver","nullobserver","RemoteMediaVideoTrack","TRACK_TURN_OF_DELAY_MS","RemoteVideoTrack","entries","visibleElementResized","maybeUpdateDimensionHint","shouldSetRenderHint","wasVisible","maybeUpdateEnabledHint","contentPreferences","pipCallbacks","onEnterPip","onLeavePip","onResizePip","pipWindow","setupDocumentVisibilityTurnOff","removeVideoTrack","remoteVideoTrack","visibleElements","pipWindows","pipElements","totalElements","el1","el2","clientHeight","clientWidth","remotevideotrack","RemoteVideoTrackPublication","remotevideotrackpublication","Participant","indexed","indexTracksById","audioTracks","dataTracks","videoTracks","reemitTrackEvents","reemitSignalingStateChangedEvents","tracksByKind","trackPublicationsByKind","reemitTrackPublicationEvents","contentPreferencesMode","participantSignaling","trackSignalingAdded","isSubscribed","trackSignalingSubscribed","trackSignalingUnsubscribed","trackSignalingRemoved","updated","trackTransceiver","RemoteTrack","newPriority","stateChanged","reemitters","indexedTracks","indexedAudioTracks","keyValue","indexedVideoTracks","indexedDataTracks","participant","trackSignaling","trackEventReemitters","eventPair","trackEvent","participantEvent","publicationEventReemitters","publicationEvent","LocalParticipant","tracksToStop","localTrack","addedTrack","vendor","removedTrack","localTrackDisabled","localTrackEnabled","localTrackStopped","localTrackPublication","getTrackPublication","warningHandler","warningsClearedHandler","localTrackOrMediaStreamTrack","trackPublication","allowedAudioProcessors","addedLocalTrack","networkQualityConfiguration","unpublishedTracks","unpublishedTrack","trackPublications","localparticipant","_null","DEFAULT_NQ_LEVEL_LOCAL","DEFAULT_NQ_LEVEL_REMOTE","MAX_NQ_LEVEL","NetworkQualityConfigurationImpl","networkqualityconfiguration","RemoteParticipant","remoteTrack","addedPublication","unsubscribedTrack","removedPublication","remoteparticipant","TrackStats","statsReport","trackstats","LocalTrackStats","prepareForInsights","localtrackstats","LocalAudioTrackStats","localaudiotrackstats","LocalVideoTrackStats","captureDimensions","localvideotrackstats","RemoteTrackStats","remotetrackstats","RemoteAudioTrackStats","remoteaudiotrackstats","RemoteVideoTrackStats","remotevideotrackstats","StatsReport","peerConnectionId","statsreport","Room","participants","handleLocalParticipantEvents","handleRecordingEvents","handleSignalingEvents","verifyNoiseCancellation","responses","rewriteLocalTrackIds","localTrackPublications","localMediaTracks","remoteMediaTracks","mediaTracks","unmuteEvent","isMuted","pauseEvent","attachments","elShims","room","localParticipantSignaling","trackStat","trackSender","connectParticipant","eventListeners","eventOrPair","reemit","recording","started","Backoff","ms","deviation","backoff","createSSRC","ssrcMax","TrackAttributes","streamId","cName","simulcastSSRCs","primarySSRC","isSimSSRC","excludeRtx","rtxPairs","rtxPair","simSSRCs","attrLines","rtxPairLines","simGroupLines","section","getSimulcastSSRCs","simGroupPattern","getSSRCAttribute","attribute","getSSRCRtxPairs","rtxPairPattern","createSSRCAttributeTuples","createTrackIdsToAttributes","ssrcAttrTuples","tuple","trackAttributes","setSimulcastInMediaSection","trackIdsToAttributes","newTrackIdsToAttributes","newTrackIds","trackIds","trackIdsToAdd","trackIdsToIgnore","trackAttributesToAdd","relevantTrackIds","relevantTrackAttributes","relevantSdpLines","sectionLines","xGoogleFlagConference","simulcast","ptToFixedBitrateAudioCodecName","createCodecMapForMediaSection","createPtToCodecName","codecMap","pt","codecName","pts","createMidToMediaSectionMap","midsToMediaSections","mid","getMidForMediaSection","getPayloadTypesInMediaSection","ptToCodecName","rtpmapPattern","getFmtpAttributesForPt","fmtpRegex","attrs","nvPair","midMatches","mLine","getReorderedPayloadTypes","preferredCodecs","preferredPayloadTypes","remainingCodecs","remainingPayloadTypes","setPayloadTypesInMediaSection","payloadTypes","otherLines","setCodecPreferences","preferredAudioCodecs","preferredVideoCodecs","session","newSection","pcmaPayloadTypes","pcmuPayloadTypes","fixedBitratePayloadTypes","setSimulcast","vp8PayloadTypes","hasVP8PayloadType","payloadType","getMatchingPayloadTypes","peerCodec","peerPt","codecsToPts","peerSection","matchingPts","peerFmtpAttrs","matchingPt","fmtpAttrs","attr","filterCodecsInMediaSection","peerMidsToMediaSections","codecsToRemove","peerPtToCodecs","rtxPts","rtxPt","ptMatches","orderedPts","filterLocalCodecs","localSdp","remoteSdp","localMediaSections","localSession","remoteMidsToMediaSections","localSection","revertSimulcast","localSdpWithoutSimulcast","revertForAll","remoteMidToMediaSections","localMidToMediaSectionsWithoutSimulcast","remoteSection","remotePtToCodecs","remotePayloadTypes","isVP8ThePreferredCodec","shouldRevertSimulcast","addOrRewriteNewTrackIds","activeMidsToTrackIds","trackIdsByKind","newMidsToTrackIds","midsToTrackIds","newMids","addOrRewriteTrackIds","attributes","msid","trackIdToRewrite","msidRegex","removeSSRCAttributes","ssrcAttributesToRemove","srcAttribute","disableRtx","rtxSSRCMatches","rtxSSRC","filterRegexes","generateFmtpLineFromPtAndAttributes","serializedFmtpAttrs","enableDtxForOpus","mids","opusPt","opusFmtpAttrs","origOpusFmtpLine","origOpusFmtpRegex","opusFmtpLineWithDtx","Filter","filter","IceBox","iceState","ufrag","ice","oldIceState","oldCandidates","icebox","ICE_ACTIVITY_CHECK_PERIOD_MS","ICE_INACTIVITY_THRESHOLD_MS","IceConnectionMonitor","statsArray","activePairStats","onIceConnectionInactive","iceStats","iceconnectionmonitor","DataTransport","DataTrackReceiver","MediaTrackReceiver","TrackMatcher","sections","trackIdMatches","trackmatcher","RTCSessionDescription","descriptionInit","sdpWorkaround","mediaSectionWorkaround","deleteDuplicateRtxPts","codecNameToPts","createCodecNameToPts","invalidRtxPts","rtxPtToAssociatedPt","createRtxPtToAssociatedPt","associatedPtToRtxPt","createAssociatedPtToRtxPt","unassociatedRtxPts","knownCodecNames","unassociatedPts","deleteFmtpAttributesForRtxPt","addFmtpAttributeForRtxPt","deleteRtpmapAttributesForRtxPt","rtpmapRegex","rtpmap","fmtpmapRegex","fmtpPattern","associatedPtToRtxPts","issue8329","DefaultBackoff","DefaultRTCIceCandidate","DefaultRTCPeerConnection","DefaultRTCSessionDescription","getStatistics","DEFAULT_ICE_GATHERING_TIMEOUT_MS","DEFAULT_SESSION_TIMEOUT_SEC","iceRestartBackoffConfig","DefaultTimeout","DefaultIceConnectionMonitor","workaroundIssue8329","PeerConnectionV2","getConfiguration","RTCPeerConnection","updateEncodingParameters","dtx","effectiveAdaptiveSimulcast","cs","adaptiveSimulcastEntry","trackReplaced","screenShareActiveLayerConfig_1","encoding","activeLayerConfig","pixelsToMaxActiveLayers","trackPixels_1","activeLayersInfo","layer","activeLayers_1","active","scaleResolutionDownBy","candidates","takeRecycledTransceiver","oldTrackId","getUfrag","updatedSdp","sdpWithoutSimulcast","errorToThrow","didReoffer","peerConnectionState","iceConnectionState","isIceConnectedOrComplete","iceGatheringState","isSet","signaledTrackId","trackReceiver","localDescription","shouldReoffer","senders_1","shouldOffer","sendersOfKind","isSenderOfKind","hasDataTrack","hasApplicationMediaSection","needsApplicationMediaSection","offerOptions","transceivers","activeTransceivers","assignedTransceivers","sdp1","unassignedTransceivers","newTrackIdsByKind","sdp2","publishWarning","negotiationCompleted","filterOutMediaStreamIds","sdpWithoutSimulcastForNonVP8MediaSections","revision","queuedHint","parameters","layerIndex","localDescriptionRevision","period","updates","rewriteTrackIds","rewriteLocalTrackId","pcv2","rewriteTrackId","shouldRecycleTransceiver","recycledTransceivers","localCodec","remoteCodecMap","updateLocalCodecs","updateRemoteCodecMaps","matched","updateRecycledTransceivers","maxAudioBitrate","maxVideoBitrate","maxBitrates","promises","maxBitrate","params","removeMaxBitrate","setMaxBitrate","peerconnection","PeerConnectionManager","createDummyAudioMediaStreamTrack","peerConnectionStates","peerConnectionIds","PeerConnectionV2_1","updateConnectionState","updateIceConnectionState","trackSenders","dataTrackSenders","mediaTrackSenders","changes","getTrackSenderChanges","applyTrackSenderChanges","synced","peerConnections","mediaStreamDestination","peerConnectionManager","getDataTrackSenderChanges","dataTrackSendersToAdd","dataTrackSendersToRemove","getMediaTrackSenderChanges","mediaTrackSendersToAdd","mediaTrackSendersToRemove","toRank","fromRank","createFromRank","summarizeIceOrPeerConnectionStates","state1","state2","pcm","peerconnectionmanager","MediaSignaling","getReceiver","channel","receiverPromise","mediasignaling","DominantSpeakerSignaling","loudestParticipantSid","dominantspeakersignaling","IceReport","send","recv","availableSend","olderStats","newerStats","secondsElapsed","deltaBytesSent","deltaBytesReceived","icereport","IceReportFactory","icereportfactory","xs","average_1","SenderOrReceiverReport","bitrate","senderorreceiverreport","sum","sum_1","ReceiverReport","deltaPacketsLost","deltaPacketsReceived","phonyFractionLost","reports","summaries","summary","receiverreport","SenderReport","newerRemoteStats","senderreport","PeerConnectionReport","audio","video","senderReports","receiverReports","peerconnectionreport","SenderOrReceiverReportFactory","initialStats","senderorreceiverreportfactory","ReceiverReportFactory","receiverreportfactory","SenderReportFactory","senderreportfactory","__values","PeerConnectionReportFactory","updatePromise","updateFirefox","updateChrome","audioSenderReportFactories","videoSenderReportFactories","audioReceiverReportFactories","videoReceiverReportFactories","getSenderOrReceiverReports","sendersOrReceivers","senderOrReceiver","e_1","e_1_1","pairs","getOrCreateSenderOrReceiverReportFactory","sendersOrReceiversByMediaType","senderOrReceiverFactory","getSenderReportFactoriesByMediaType","getReceiverReportFactoriesByMediaType","getOrCreateSenderReportFactory","getOrCreateReceiverReportFactory","getSenderReportFactoryIdsByMediaType","getReceiverReportFactoryIdsByMediaType","updateSenderReports","senderReportFactoryIdsToDeleteByMediaType","e_2","senderReportFactoryIdsToDelete","senderReportFactory","remoteInboundStats","e_2_1","updateReceiverReports","receiverReportFactoryIdsToDeleteByMediaType","e_3","receiverReportFactoryIdsToDelete","receiverReportFactory","e_3_1","deleteSenderOrReceiverReportFactories","senderOrReceiverReportFactoriesByMediaType","senderOrReceiverReportFactoryIdsByMediaType","mediaType","senderOrReceiverReportFactories","senderOrReceiverReportFactoryIds","senderOrReceiverReportFactoryId","updateIceReport","e_4","e_5","selectedCandidatePair","e_4_1","_f","e_5_1","receivers","pcReport","senderReportFactoriesByMediaType","receiverReportFactoriesByMediaType","peerconnectionreportfactory","NetworkQualityMonitor","manager","next","monitor","pcv2s","factories","reportsOrNullPromises","reportsOrNull","reportOrNull","networkqualitymonitor","AsyncVar","asyncvar","NETWORK_QUALITY_RESPONSE_TIME_MS","NetworkQualitySignaling","oldObj","networkQualityInputs","createNetworkQualityInputsMessage","networkQualityReportLevels","networkqualitysignaling","RecordingSignaling","RecordingV2","DefaultRecordingSignaling","RoomSignaling","sessionTimeout","maybeUpdateState","dominantSpeakerSid","NetworkQualityBandwidthStats","actual","available","networkqualitybandwidthstats","NetworkQualityFractionLostStats","networkqualityfractionloststats","NetworkQualityLatencyStats","networkqualitylatencystats","NetworkQualitySendOrRecvStats","bandwidth","latency","networkqualitysendorrecvstats","NetworkQualitySendStats","sendOrRecvStats","networkqualitysendstats","NetworkQualityRecvStats","networkqualityrecvstats","NetworkQualityMediaStats","sendStats","recvStats","networkqualitymediastats","NetworkQualityAudioStats","mediaLevels","networkqualityaudiostats","NetworkQualityVideoStats","networkqualityvideostats","NetworkQualityStats","networkqualitystats","ParticipantSignaling","networkQualityLevel","networkQualityLevels","identity","RemoteParticipantSignaling","TrackSignaling","_sid","RemoteTrackPublicationSignaling","RemoteTrackPublicationV2","RemoteParticipantV2","participantState","getInitialTrackSwitchOffState","clearTrackHint","trackState","tracksToKeep","TrackPrioritySignaling","publishOrSubscribe","trackprioritysignaling","TrackSwitchOffSignaling","tracksSwitchedOff","tracksSwitchedOn","trackswitchoffsignaling","RENDER_HINT_RESPONSE_TIME_MS","messageId","RenderHintsSignaling","hintResults","hintResult","hints","mspHint","payLoad","renderhintssignaling","PublisherHintsSignaling","publisherhintsignaling","STATS_PUBLISH_INTERVAL_MS","RoomV2","signalingRegion","getTrackReceiver","handlePeerConnectionEvents","handleTransportEvents","periodicallyPublishStats","trackReceivers","didDisconnect","initiallySwitchedOff","trackSidsToTrackSignalings","hint","update","bandwidthProfileRevision","roomState","subscribedTrackSids_1","participantsToKeep","disconnectedParticipantRevision","handleSubscriptions","mediaSignaling","hintResponses","handleReplaced","tracksOff","tracksOn","trackUpdates_1","isOn","networkQualityMonitor","filterAndAddLocalTrackSids","filterAndAddRemoteTrackSids","filterAndAddTrackSids","idToSid","roomV2","localTrackStats","remoteTrackStats","localParticipantUpdated","renegotiate","trackV2","signalingConnectionState","intervalMs","movingAverageDeltas","oddPublishCount","interval","addAVSyncMetricsToRemoteTrackStats","addAVSyncMetricsToLocalTrackStats","movingAverageDeltaKeysToBeRemoved","activeIceCandidatePair","replaceNullsWithDefaults","onStateChanged","trackResponse","totalPacketSendDelay","augmentedTrackStats","trackMovingAverageDeltas","trackAvgEncodeDelayMovingAverageDelta","trackAvgPacketSendDelayMovingAverageDelta","trackAvgDecodeDelayMovingAverageDelta","trackAvgJitterBufferDelayMovingAverageDelta","reconnectBackoffConfig","SDK_NAME","SDK_VERSION","SDP_FORMAT","RSP_VERSION","TwilioConnectionTransport","accessToken","setupTransport","reducePeerConnections","peerConnectionsById","reduced","reduceUpdates","createOrResetTwilioConnection","handleMessage","_iceServersStatus","_options","_wsServer","disconnect","reconnectTimer","twilioError","onIced","twilioconnectiontransport","DefaultPeerConnectionManager","DefaultRoomV2","DefaultTransport","createCancelableRoomSignalingPromise","Transport","cancelablePromise","transportOptions","connectEventPayload","localParticipantState","cancelableroomsignalingpromise","LocalParticipantSignaling","noiseCancellationVendor","didDelete","LocalTrackPublicationSignaling","clonedTrackSender","setError","LocalTrackPublicationV2","mediaStates","LocalParticipantV2","published","publicationState","localTrackPublicationV2","updatedPriority","removeListener","trackPub","Signaling","transition","defaultCreateCancelableRoomSignalingPromise","SignalingV2","v2","NullInsightsPublisher","DEFAULT_ENVIRONMENT","DEFAULT_REALM","DEFAULT_REGION","DefaultLog","require$$16","safariVersion","connectCalls","didPrintSafariWarning","isSafariWithoutVP8Support","safariMajorVersion","safariMinorVersion","deprecatedConnectOptionsProps","deprecatedBandwidthProfileOptions","deprecateOptions","EventPublisher","normalizeCodecSettings","cancelableRoomPromise","deprecationTable","didWarn","newName","shouldDelete","handleLocalTracks","nameOrSettings","settings","connect_1","createLocalTrack","createOptions","createLocalAudioTrack","createLocalVideoTrack","createlocaltrack","isWebRTCSupported","SUPPORTED_CHROME_BASED_BROWSERS","SUPPORTED_ANDROID_BROWSERS","SUPPORTED_IOS_BROWSERS","SUPPORTED_MOBILE_WEBKIT_BASED_BROWSERS","rebrandedChrome","mobileWebKit","supportedMobileBrowsers","createlocaltracks_1","preflightt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,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177]}