@opentok/client
Version:
The OpenTok.js library lets you use OpenTok-powered video sessions on the web
17 lines • 2.8 MB
JavaScript
/**
* @license OpenTok.js 2.30.5 ee13e838e
*
* Copyright (c) 2010-2025 TokBox, Inc.
* Subject to the applicable Software Development Kit (SDK) License Agreement:
* https://www.vonage.com/legal/communications-apis/terms-of-use/
*
* Date: Mon, 21 Jul 2025 17:56:59 GMT
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OT=t():e.OT=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=366)}([function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";var r=n(0);t.__esModule=!0,t.default=void 0;var i=r(n(421)),o=r(n(129)),a=r(n(130));const l=(0,o.default)(e=>{const t={};return Object.keys(a.default).forEach(n=>{const r=a.default[n].method,o=(0,i.default)(`OpenTok:${e}:${n.toLowerCase()}`);o.log=console[r].bind(console),t[n.toLowerCase()]=o}),t});l.setLogLevel=e=>{let t;try{t=(void 0!==typeof window?window:global).localStorage.debug}catch(e){t=""}const n=[...Object.keys(a.default).map(t=>`${e>=a.default[t].priority?"":"-"}(autogen)?OpenTok:*:${t.toLowerCase()}`),...(t||"").split(/[\s,]/).filter(e=>-1===e.indexOf("(autogen)?"))].filter(e=>e).join(",");i.default.enable(n)};var c=l;t.default=c},function(e,t,n){(function(t){
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.8+1e68dce6
*/var n;n=function(){"use strict";function e(e){return"function"==typeof e}var n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,i=void 0,o=void 0,a=function(e,t){h[r]=e,h[r+1]=t,2===(r+=2)&&(o?o(g):m())},l="undefined"!=typeof window?window:void 0,c=l||{},s=c.MutationObserver||c.WebKitMutationObserver,d="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),u="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function A(){var e=setTimeout;return function(){return e(g,1)}}var h=new Array(1e3);function g(){for(var e=0;e<r;e+=2)(0,h[e])(h[e+1]),h[e]=void 0,h[e+1]=void 0;r=0}var Q,F,p,U,m=void 0;function b(e,t){var n=this,r=new this.constructor(f);void 0===r[Z]&&J(r);var i=n._state;if(i){var o=arguments[i-1];a((function(){return S(i,r,o,n._result)}))}else W(n,r,e,t);return r}function B(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(f);return I(t,e),t}d?m=function(){return t.nextTick(g)}:s?(F=0,p=new s(g),U=document.createTextNode(""),p.observe(U,{characterData:!0}),m=function(){U.data=F=++F%2}):u?((Q=new MessageChannel).port1.onmessage=g,m=function(){return Q.port2.postMessage(0)}):m=void 0===l?function(){try{var e=Function("return this")().require("vertx");return void 0!==(i=e.runOnLoop||e.runOnContext)?function(){i(g)}:A()}catch(e){return A()}}():A();var Z=Math.random().toString(36).substring(2);function f(){}function R(t,n,r){n.constructor===t.constructor&&r===b&&n.constructor.resolve===B?function(e,t){1===t._state?V(e,t._result):2===t._state?C(e,t._result):W(t,void 0,(function(t){return I(e,t)}),(function(t){return C(e,t)}))}(t,n):void 0===r?V(t,n):e(r)?function(e,t,n){a((function(e){var r=!1,i=function(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}(n,t,(function(n){r||(r=!0,t!==n?I(e,n):V(e,n))}),(function(t){r||(r=!0,C(e,t))}),e._label);!r&&i&&(r=!0,C(e,i))}),e)}(t,n,r):V(t,n)}function I(e,t){if(e===t)C(e,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(r=t),null===r||"object"!==i&&"function"!==i)V(e,t);else{var n=void 0;try{n=t.then}catch(t){return void C(e,t)}R(e,t,n)}var r,i}function y(e){e._onerror&&e._onerror(e._result),E(e)}function V(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&a(E,e))}function C(e,t){void 0===e._state&&(e._state=2,e._result=t,a(y,e))}function W(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+1]=n,i[o+2]=r,0===o&&e._state&&a(E,e)}function E(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=void 0,i=void 0,o=e._result,a=0;a<t.length;a+=3)r=t[a],i=t[a+n],r?S(n,r,i,o):i(o);e._subscribers.length=0}}function S(t,n,r,i){var o=e(r),a=void 0,l=void 0,c=!0;if(o){try{a=r(i)}catch(e){c=!1,l=e}if(n===a)return void C(n,new TypeError("A promises callback cannot return that same promise."))}else a=i;void 0!==n._state||(o&&c?I(n,a):!1===c?C(n,l):1===t?V(n,a):2===t&&C(n,a))}var v=0;function J(e){e[Z]=v++,e._state=void 0,e._result=void 0,e._subscribers=[]}var N=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(f),this.promise[Z]||J(this.promise),n(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?V(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&V(this.promise,this._result))):C(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===B){var i=void 0,o=void 0,a=!1;try{i=e.then}catch(e){a=!0,o=e}if(i===b&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===G){var l=new n(f);a?C(l,o):R(l,e,i),this._willSettleAt(l,t)}else this._willSettleAt(new n((function(t){return t(e)})),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,n){var r=this.promise;void 0===r._state&&(this._remaining--,2===e?C(r,n):this._result[t]=n),0===this._remaining&&V(r,this._result)},e.prototype._willSettleAt=function(e,t){var n=this;W(e,void 0,(function(e){return n._settledAt(1,t,e)}),(function(e){return n._settledAt(2,t,e)}))},e}(),G=function(){function t(e){this[Z]=v++,this._result=this._state=void 0,this._subscribers=[],f!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){I(e,t)}),(function(t){C(e,t)}))}catch(t){C(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var n=this.constructor;return e(t)?this.then((function(e){return n.resolve(t()).then((function(){return e}))}),(function(e){return n.resolve(t()).then((function(){throw e}))})):this.then(t,t)},t}();return G.prototype.then=b,G.all=function(e){return new N(this,e).promise},G.race=function(e){var t=this;return n(e)?new t((function(n,r){for(var i=e.length,o=0;o<i;o++)t.resolve(e[o]).then(n,r)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))},G.resolve=B,G.reject=function(e){var t=new this(f);return C(t,e),t},G._setScheduler=function(e){o=e},G._setAsap=function(e){a=e},G._asap=a,G.polyfill=function(){var e=void 0;if(void 0!==(void 0!==typeof window?window:global))e=void 0!==typeof window?window:global;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=G},G.Promise=G,G},e.exports=n()}).call(this,n(24))},function(e,t,n){"use strict";var r=n(0);t.__esModule=!0,t.default=void 0;var i=r(n(477)).default.parse();t.default=i},function(e,t,n){e.exports=n(417)},function(e,t,n){(function(t){function n(e,n,r,i,o,a,l){try{var c=e[a](l),s=c.value}catch(e){return void r(e)}c.done?n(s):t.resolve(s).then(i,o)}e.exports=function(e){return function(){var r=this,i=arguments;return new t((function(t,o){var a=e.apply(r,i);function l(e){n(a,t,o,l,c,"next",e)}function c(e){n(a,t,o,l,c,"throw",e)}l(void 0)}))}}}).call(this,n(2))},function(e,t,n){"use strict";var r=n(0);t.__esModule=!0,t.default=function(e){const t=new a.default;t.on("newListener",e=>{t.emit(e+":added")}),t.on("removeListener",e=>{t.emit(e+":removed")});const n={eventsDispatched:{},on(e,n,r){return"string"==typeof e&&n?e.split(" ").forEach(e=>{t.on(e,(0,c.default)(n,r))}):Object.keys(e).forEach(r=>{t.on(r,(0,c.default)(e[r],n))}),this},off(e,n,r){return"string"==typeof e?this.off(e.split(" "),n,r):Array.isArray(e)?e.forEach(e=>{n&&(0,o.default)(n)?t.removeListener(e,(0,c.default)(n,r)):t.removeAllListeners(e)}):e?Object.keys(e).forEach(r=>{t.removeListener(r,(0,c.default)(e[r],n))}):t.removeAllListeners(),this},once(e,n,r){return"string"==typeof e&&n?e.split(" ").forEach(e=>{t.once(e,(0,c.default)(n,r))}):Object.keys(e).forEach(r=>{t.once(r,(0,c.default)(e[r],n))}),this},dispatchEvent(e){if(!e.type)throw new Error("dispatchEvent: Event has no type");return e.target||(e.target=this),this.trigger(e.type,e),this},dispatchEventOnce(e,t){this.isEventDispatched(e.type,t)||(this.dispatchEvent(e),this.eventsDispatched[e.type]?this.eventsDispatched[e.type].push(t):this.eventsDispatched[e.type]=[t])},isEventDispatched(e,t){var n;return null==(n=this.eventsDispatched[e])?void 0:n.includes(t)},trigger(e){try{for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];t.emit(e,...r)}catch(e){s.error("An error occurred in an event handler",e)}return this},emit(){return e.trigger(...arguments)},addEventListener:(t,n,r)=>(s.warn("The addEventListener() method is deprecated. Use on() or once() instead."),e.on(t,n,r)),removeEventListener:(t,n,r)=>(s.warn("The removeEventListener() method is deprecated. Use off() instead."),e.off(t,n,r)),listenerCount:e=>t.listenerCount(e)};return(0,i.default)(e,n)};var i=r(n(9)),o=r(n(20)),a=r(n(12)),l=r(n(1)),c=r(n(424));const s=(0,l.default)("Events")},function(e,t,n){"use strict";var r=n(0);t.__esModule=!0,t.default=void 0;var i=r(n(147)),o=r(n(262)),a=r(n(6)),l=r(n(1)),c=r(n(3)),s=r(n(264)),d=r(n(263)),u=r(n(265)),A=r(n(575)),h=r(n(267)),g=r(n(270)),Q=r(n(589)),F=r(n(272));o.default.logging=(0,l.default)("OT.$"),o.default.env=c.default,o.default.ElementCollection=d.default,o.default.ajax=u.default,o.default.statable=A.default,o.default.Analytics=h.default,o.default.Collection=g.default,o.default.domExtras=Q.default,o.default.Error=F.default,(0,s.default)(o.default,"useLogHelpers",{value(e){const t=(0,l.default)("useLogHelpersDeprecatedMixin");return Object.keys(t).forEach(n=>{e[n]=t[n]}),e},name:"OT.useLogHelpers",getWarning:"Please use an external library for your debugging needs"}),o.default.defaults=i.default,(0,s.default)(o.default,"eventing",{value:a.default,name:"OT.$.eventing",getWarning:"Please use an external library to create an event emitter."}),Object.keys(o.default).forEach(e=>{const t=o.default[e]._attachToOTHelpers||{};Object.keys(t).forEach(n=>{!Object.hasOwnProperty.call(o.default,n)||"util"===e&&"bind"===n||console.warn(`More than one module is trying to define ${n} on OTHelpers.`),o.default[n]=t[n]})});var p=o.default;t.default=p},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;t.default={AUTHENTICATION_ERROR:"OT_AUTHENTICATION_ERROR",BADLY_FORMED_RESPONSE:"OT_BADLY_FORMED_RESPONSE",CHROME_MICROPHONE_ACQUISITION_ERROR:"OT_CHROME_MICROPHONE_ACQUISITION_ERROR",CONNECT_FAILED:"OT_CONNECT_FAILED",CONNECTION_LIMIT_EXCEEDED:"OT_CONNECTION_LIMIT_EXCEEDED",CONSTRAINTS_NOT_SATISFIED:"OT_CONSTRAINTS_NOT_SATISFIED",CREATE_PEER_CONNECTION_FAILED:"OT_CREATE_PEER_CONNECTION_FAILED",DISCONNECTED:"OT_DISCONNECTED",EMPTY_RESPONSE_BODY:"OT_EMPTY_RESPONSE_BODY",GET_RTC_STATS_REPORT_NOT_SUPPORTED:"OT_GET_RTC_STATS_REPORT_NOT_SUPPORTED",HARDWARE_UNAVAILABLE:"OT_HARDWARE_UNAVAILABLE",ICE_WORKFLOW_FAILED:"OT_ICE_WORKFLOW_FAILED",INVALID_HTTP_STATUS:"OT_INVALID_HTTP_STATUS",INVALID_PARAMETER:"OT_INVALID_PARAMETER",INVALID_SESSION_ID:"OT_INVALID_SESSION_ID",MEDIA_ERR_ABORTED:"OT_MEDIA_ERR_ABORTED",MEDIA_ERR_DECODE:"OT_MEDIA_ERR_DECODE",MEDIA_ERR_NETWORK:"OT_MEDIA_ERR_NETWORK",MEDIA_ERR_SRC_NOT_SUPPORTED:"OT_MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ENDED:"OT_MEDIA_ENDED",NO_DEVICES_FOUND:"OT_NO_DEVICES_FOUND",NO_VALID_CONSTRAINTS:"OT_NO_VALID_CONSTRAINTS",NOT_CONNECTED:"OT_NOT_CONNECTED",NOT_FOUND:"OT_NOT_FOUND",NOT_SUPPORTED:"OT_NOT_SUPPORTED",PEER_CONNECTION_NOT_CONNECTED:"OT_PEER_CONNECTION_NOT_CONNECTED",PERMISSION_DENIED:"OT_PERMISSION_DENIED",RATE_LIMIT_EXCEEDED:"OT_RATE_LIMIT_EXCEEDED",REPORT_ISSUE_FAILED:"OT_REPORT_ISSUE_FAILED",SCREEN_SHARING_EXTENSION_NOT_INSTALLED:"OT_SCREEN_SHARING_EXTENSION_NOT_INSTALLED",SCREEN_SHARING_EXTENSION_NOT_REGISTERED:"OT_SCREEN_SHARING_EXTENSION_NOT_REGISTERED",SCREEN_SHARING_NOT_SUPPORTED:"OT_SCREEN_SHARING_NOT_SUPPORTED",SET_REMOTE_DESCRIPTION_FAILED:"OT_SET_REMOTE_DESCRIPTION_FAILED",FAILED_SET_CONFIGURATION:"OT_FAILED_SET_CONFIGURATION",SOCKET_ALREADY_CONNECTED_CONNECTING:"OT_SOCKET_ALREADY_CONNECTED_CONNECTING",SOCKET_CLOSE_ABNORMAL:"OT_SOCKET_CLOSE_ABNORMAL",SOCKET_CLOSE_CONNECT_EXCEPTION:"OT_SOCKET_CLOSE_CONNECT_EXCEPTION",SOCKET_CLOSE_CONNECTIVITY_LOSS:"OT_SOCKET_CLOSE_CONNECTIVITY_LOSS",SOCKET_CLOSE_FALLBACK_CODE:"OT_SOCKET_CLOSE_FALLBACK_CODE",SOCKET_CLOSE_INCONSISTENT_DATA:"OT_SOCKET_CLOSE_INCONSISTENT_DATA",SOCKET_CLOSE_NO_STATUS:"OT_SOCKET_CLOSE_NO_STATUS",SOCKET_CLOSE_POLICY_VIOLATION:"OT_SOCKET_CLOSE_POLICY_VIOLATION",SOCKET_CLOSE_GOING_AWAY:"OT_SOCKET_CLOSE_GOING_AWAY",SOCKET_CLOSE_PROTOCOL_ERROR:"OT_SOCKET_CLOSE_PROTOCOL_ERROR",SOCKET_CLOSE_TIMEOUT:"OT_SOCKET_CLOSE_TIMEOUT",SOCKET_CLOSE_TOO_LARGE:"OT_SOCKET_CLOSE_TOO_LARGE",SOCKET_CLOSE_UNEXPECTED_CONDITION:"OT_SOCKET_CLOSE_UNEXPECTED_CONDITION",SOCKET_CLOSE_UNSUPPORTED:"OT_SOCKET_CLOSE_UNSUPPORTED",STREAM_CREATE_FAILED:"OT_STREAM_CREATE_FAILED",STREAM_DESTROYED:"OT_STREAM_DESTROYED",STREAM_LIMIT_EXCEEDED:"OT_STREAM_LIMIT_EXCEEDED",STREAM_NOT_FOUND:"OT_STREAM_NOT_FOUND",UNABLE_TO_SUBSCRIBE:"OT_UNABLE_TO_SUBSCRIBE",TERMS_OF_SERVICE_FAILURE:"OT_TERMS_OF_SERVICE_FAILURE",TIMEOUT:"OT_TIMEOUT",CANCEL:"OT_CANCEL",UNABLE_TO_CAPTURE_MEDIA:"OT_UNABLE_TO_CAPTURE_MEDIA",UNABLE_TO_CAPTURE_SCREEN:"OT_UNABLE_TO_CAPTURE_SCREEN",UNEXPECTED_ERROR_CODE:"OT_UNEXPECTED_ERROR_CODE",UNEXPECTED_HTTP_STATUS:"OT_UNEXPECTED_HTTP_STATUS",UNEXPECTED_SERVER_RESPONSE:"OT_UNEXPECTED_SERVER_RESPONSE",UNKNOWN_HTTP_ERROR:"OT_UNKNOWN_HTTP_ERROR",UNSUPPORTED_BROWSER:"OT_UNSUPPORTED_BROWSER",USER_MEDIA_ACCESS_DENIED:"OT_USER_MEDIA_ACCESS_DENIED",XDOMAIN_OR_PARSING_ERROR:"OT_XDOMAIN_OR_PARSING_ERROR",API_KEY_DISABLED:"OT_API_KEY_DISABLED",UNABLE_TO_ACCESS_MEDIA_ENGINE:"OT_UNABLE_TO_ACCESS_MEDIA_ENGINE",SET_PROXY_URL_TIMING_ERROR:"OT_SET_PROXY_URL_TIMING_ERROR",PROXY_URL_ALREADY_SET_ERROR:"OT_PROXY_URL_ALREADY_SET_ERROR",SET_VIDEO_SOURCE_FAILURE:"OT_SET_VIDEO_SOURCE_FAILURE",INVALID_VIDEO_SOURCE:"OT_INVALID_VIDEO_SOURCE",REQUESTED_DEVICE_PERMISSION_DENIED:"OT_REQUESTED_DEVICE_PERMISSION_DENIED",INVALID_AUDIO_OUTPUT_SOURCE:"OT_INVALID_AUDIO_OUTPUT_SOURCE",INVALID_ENCRYPTION_SECRET:"OT_INVALID_ENCRYPTION_SECRET"}},function(e,t,n){var r=n(86),i=n(44),o=n(207),a=n(29),l=n(69),c=n(34),s=Object.prototype.hasOwnProperty,d=o((function(e,t){if(l(t)||a(t))i(t,c(t),e);else for(var n in t)s.call(t,n)&&r(e,n,t[n])}));e.exports=d},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r={JS_EXCEPTION:2e3,AUTHENTICATION_ERROR:1004,INVALID_SESSION_ID:1005,CONNECT_FAILED:1006,CONNECT_REJECTED:1007,CONNECTION_TIMEOUT:1008,NOT_CONNECTED:1010,INVALID_PARAMETER:1011,P2P_CONNECTION_FAILED:1013,API_RESPONSE_FAILURE:1014,PEER_CONNECTION_NOT_CONNECTED:1015,TERMS_OF_SERVICE_FAILURE:1026,CONNECTION_LIMIT_EXCEEDED:1027,UNABLE_TO_PUBLISH:1500,UNABLE_TO_SUBSCRIBE:1501,UNSUPPORTED_VIDEO_CODEC:1502,UNABLE_TO_FORCE_DISCONNECT:1520,UNABLE_TO_FORCE_UNPUBLISH:1530,UNABLE_TO_FORCE_MUTE:1540,PUBLISHER_ICE_WORKFLOW_FAILED:1553,SUBSCRIBER_ICE_WORKFLOW_FAILED:1554,STREAM_LIMIT_EXCEEDED:1605,UNEXPECTED_SERVER_RESPONSE:2001,REPORT_ISSUE_ERROR:2011,SET_PROXY_URL_TIMING_ERROR:2021,PROXY_URL_ALREADY_SET_ERROR:2022,GET_RTC_STATS_REPORT_NOT_SUPPORTED:2031,ANVIL_BADLY_FORMED_RESPONSE:3001,ANVIL_INVALID_HTTP_STATUS:3002,ANVIL_XDOMAIN_OR_PARSING_ERROR:3003,ANVIL_UNKNOWN_HTTP_ERROR:3004,ANVIL_UNEXPECTED_ERROR_CODE:3005,ANVIL_EMPTY_RESPONSE_BODY:3006,ANVIL_CONNECT_FAILED:3007,UNABLE_TO_ACCESS_MEDIA_ENGINE:5001};t.default=r},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){"use strict";(function(t){var n,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};n=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,n){return new t((function(t,r){function i(t){e.removeListener(n,o),r(t)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),t([].slice.call(arguments))}F(e,n,o,{once:!0}),"error"!==n&&function(e,t,n){"function"==typeof e.on&&F(e,"error",t,n)}(e,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var l=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var i,o,a,l;if(c(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=s(e))>0&&a.length>i&&!a.warned){a.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=a.length,l=d,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function A(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=u.bind(r);return i.listener=n,r.wrapFn=i,i}function h(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):Q(i,i.length)}function g(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function Q(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function F(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");l=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return s(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var l=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw l.context=a,l}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var s=c.length,d=Q(c,s);for(n=0;n<s;++n)i(d[n],this,t)}return!0},a.prototype.addListener=function(e,t){return d(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return d(this,e,t,!0)},a.prototype.once=function(e,t){return c(t),this.on(e,A(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,A(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,i,o,a;if(c(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return h(this,e,!0)},a.prototype.rawListeners=function(e){return h(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}}).call(this,n(2))},function(e,t,n){"use strict";var r,i=n(222),o=Object.prototype.toString,a=(r=Object.create(null),function(e){var t=o.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())});function l(e){return e=e.toLowerCase(),function(t){return a(t)===e}}function c(e){return Array.isArray(e)}function s(e){return void 0===e}var d=l("ArrayBuffer");function u(e){return"number"==typeof e}function A(e){return null!==e&&"object"==typeof e}function h(e){if("object"!==a(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var g=l("Date"),Q=l("File"),F=l("Blob"),p=l("FileList");function U(e){return"[object Function]"===o.call(e)}var m=l("URLSearchParams");function b(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),c(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var B,Z=(B="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return B&&e instanceof B});var f,R=l("HTMLFormElement"),I=(f=Object.prototype.hasOwnProperty,function(e,t){return f.call(e,t)});e.exports={isArray:c,isArrayBuffer:d,isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return e&&("function"==typeof FormData&&e instanceof FormData||"[object FormData]"===o.call(e)||U(e.toString)&&"[object FormData]"===e.toString())},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&d(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:u,isObject:A,isPlainObject:h,isEmptyObject:function(e){return e&&0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype},isUndefined:s,isDate:g,isFile:Q,isBlob:F,isFunction:U,isStream:function(e){return A(e)&&U(e.pipe)},isURLSearchParams:m,isStandardBrowserEnv:function(){var e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:b,merge:function e(){var t={};function n(n,r){h(t[r])&&h(n)?t[r]=e(t[r],n):h(n)?t[r]=e({},n):c(n)?t[r]=n.slice():t[r]=n}for(var r=0,i=arguments.length;r<i;r++)b(arguments[r],n);return t},extend:function(e,t,n){return b(t,(function(t,r){e[r]=n&&"function"==typeof t?i(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,n,r){e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,n&&Object.assign(e.prototype,n)},toFlatObject:function(e,t,n,r){var i,o,a,l={};if(t=t||{},null==e)return t;do{for(o=(i=Object.getOwnPropertyNames(e)).length;o-- >0;)a=i[o],r&&!r(a,e,t)||l[a]||(t[a]=e[a],l[a]=!0);e=!1!==n&&Object.getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:a,kindOfTest:l,endsWith:function(e,t,n){e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return-1!==r&&r===n},toArray:function(e){if(!e)return null;if(c(e))return e;var t=e.length;if(!u(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n},isTypedArray:Z,isFileList:p,forEachEntry:function(e,t){for(var n,r=(e&&e[Symbol.iterator]).call(e);(n=r.next())&&!n.done;){var i=n.value;t.call(e,i[0],i[1])}},matchAll:function(e,t){for(var n,r=[];null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:R,hasOwnProperty:I}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){"use strict";var r=n(0);t.__esModule=!0,t.default=function(e){void 0===e&&(e={});const t=e.Errors||o.default,n=e.OTErrorClass||i.default,r=Object.keys(t).map(e=>t[e]);return function(e,t,i){if(-1===r.indexOf(e))return new Error(`Attempt to use invalid error name (${e}). Original message: ${t.message}`);if(!(t instanceof Error||/^\[object .*Error\]$/.test(Object.prototype.toString.call(t))))return new Error("Did not pass Error as second argument: "+t);const o=new n(void 0,t.message);if(o.name=e,!t.stack)try{throw t}catch(e){}return o.stack=t.stack,i&&(o.code=i),o}};var i=r(n(26)),o=r(n(8))},function(e,t,n){var r=n(189),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t,n){var r=n(576),i=n(577),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";var r=n(0);t.__esModule=!0,t.default=function(e){void 0===e&&(e={});const t=e.logging||(0,a.default)("Events"),n={ExceptionEvent:function(e,t,n,r,i,o,a){return new l.default(e,!1,{error:a,message:t,title:n,code:r,component:i,target:o})},IssueReportedEvent:function(e,t){return new l.default(e,!1,{issueId:t})},EnvLoadedEvent:function(e){return new l.default(e,!1)}};let r=!1;n.ConnectionEvent=function(e){function n(t,n,r){return e.call(this,t,!1,{connection:n,reason:r})||this}return(0,o.default)(n,e),(0,i.default)(n,[{key:"connections",get:function(){return r||(t.warn("OT.ConnectionEvent connections property is deprecated, use connection instead."),r=!0),[this.connection]}}]),n}(l.default);let s=!1;n.StreamEvent=function(e){function n(t,n,r,i){return e.call(this,t,i,{stream:n,reason:r})||this}return(0,o.default)(n,e),(0,i.default)(n,[{key:"streams",get:function(){return s||(t.warn("OT.StreamEvent streams property is deprecated, use stream instead."),s=!0),[this.stream]}}]),n}(l.default);let d=!1,u=!1,A=!1;return n.SessionConnectEvent=function(e){function n(t){return e.call(this,t,!1)||this}return(0,o.default)(n,e),(0,i.default)(n,[{key:"connections",get:function(){return d||(t.warn("OT.SessionConnectedEvent no longer includes connections. Listen for connectionCreated events instead."),d=!0),[]}},{key:"streams",get:function(){return u||(t.warn("OT.SessionConnectedEvent no longer includes streams. Listen for streamCreated events instead."),u=!0),[]}},{key:"archives",get:function(){return A||(t.warn("OT.SessionConnectedEvent no longer includes archives. Listen for archiveStarted events instead."),A=!0),[]}}]),n}(l.default),n.SessionReconnectingEvent=function(){return new l.default(c.default.SESSION_RECONNECTING,!1)},n.SessionReconnectedEvent=function(){return new l.default(c.default.SESSION_RECONNECTED)},n.SessionDisconnectEvent=function(e,t,n){return new l.default(e,n,{reason:t})},n.StreamPropertyChangedEvent=function(e,t,n,r,i){return new l.default(e,!1,{stream:t,changedProperty:n,oldValue:r,newValue:i})},n.VideoDimensionsChangedEvent=function(e,t,n){return new l.default("videoDimensionsChanged",!1,{target:e,oldValue:t,newValue:n})},n.ArchiveEvent=function(e,t){return new l.default(e,!1,{id:t.id,name:t.name,status:t.status,archive:t})},n.ArchiveUpdatedEvent=function(e,t,n,r){return new l.default("updated",!1,{target:e,changedProperty:t,oldValue:n,newValue:r})},n.SignalEvent=function(e,t,n){return new l.default(e?"signal:"+e:c.default.SIGNAL,!1,{data:t,from:n})},n.CpuPerformanceChangedEvent=function(e){return new l.default("cpuPerformanceChanged",!1,{cpuPerformanceState:e})},n.QualityScoreChangedEvent=function(e){return new l.default("qualityScoreChanged",!1,{qualityScore:e})},n.CaptionReceivedEvent=function(e,t,n){return new l.default("caption",!1,{caption:e,streamId:t,isFinal:n})},n.PublisherCaptionsEnabled=function(e){return new l.default("publisherCaptionsEnabled",!1,{captionsEnabled:e})},n.MediaStreamAvailableEvent=function(e){return new l.default("mediaStreamAvailable",!1,{mediaStream:e})},n.StreamUpdatedEvent=function(e,t,n,r){return new l.default("updated",!1,{target:e,changedProperty:t,oldValue:n,newValue:r})},n.DestroyedEvent=function(e,t,n){return new l.default(e,!1,{target:t,reason:n})},n.ConnectionStateChangedEvent=function(e,t,n){return new l.default(e,!1,{target:t,mediaMode:n})},n.VideoEnabledChangedEvent=function(e,t){return new l.default(e,!1,{reason:t.reason})},n.VideoDisableWarningEvent=function(e){return new l.default(e,!1)},n.AudioLevelUpdatedEvent=function(e){return new l.default(c.default.AUDIO_LEVEL_UPDATED,!1,{audioLevel:e})},n.AudioInputDeviceChangedEvent=function(e){return new l.default(c.default.AUDIO_INPUT_DEVICE_CHANGED,!1,{device:e})},n.MediaStoppedEvent=function(e,t){return new l.default(c.default.MEDIA_STOPPED,!0,{target:e,track:t})},n.MuteForcedEvent=function(e){return new l.default(c.default.MUTE_FORCED,!1,e)},n.VideoElementCreatedEvent=function(e){return new l.default(c.default.VIDEO_ELEMENT_CREATED,!1,{element:e})},n};var i=r(n(25)),o=r(n(23)),a=r(n(1)),l=r(n(148)),c=r(n(30))},function(e,t,n){"use strict";var r=n(0);t.__esModule=!0,t.default=void 0;var i=r(n(9)),o=r(n(63)),a=r(n(298)),l=r(n(149)),c=r(n(299)),s=r(n(1)),d=r(n(300));function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const h=(0,s.default)("SDPHelpers"),g={getSections:e=>e.split(/\r\n|\r|\n/).reduce((e,t)=>{const n=t.match(/^m=(\w+) \d+/);return n&&(e.sections[e.section=n[1]]=[]),e.sections[e.section].push(t),e},{sections:{header:[]},section:"header"}).sections,getCodecsFromSection:e=>({codecs:e[0].match(/m=\w+ \d+ [A-Z/]+ ([\d ]+)$/)[1].split(" "),codecMap:(0,i.default)(...e.filter(e=>e.match(/^a=rtpmap:\d+/)).map(e=>e.match(/^a=rtpmap:(\d+) ([\w-]+)/).splice(1)).map(e=>({[e[0]]:e[1]})))}),getCodecsAndCodecMap(e,t){const n=g.getSections(e)[t];if(!n)throw new Error("no mediaType "+t);return g.getCodecsFromSection(n)},getCodecs(e,t){const n=g.getCodecsAndCodecMap(e,t);return n.codecs.map(e=>n.codecMap[e]||"Unknown codec")},MediaDirection:d.default,iceCredentials:{ufrag:"a=ice-ufrag:",pwd:"a=ice-pwd:"},getMLineIndex:function(e,t){const n="m="+t;return(0,a.default)(e,e=>-1!==e.indexOf(n))},getMLine:function(e,t){const n=g.getMLineIndex(e,t);return n>-1?e[n]:void 0},hasMediaType:(e,t)=>{const n=new RegExp("^m="+t),r=e.split("\r\n");return(0,a.default)(r,e=>n.test(e))>=0},hasMLinePayloadType:function(e,t,n){const r=g.getMLine(e,t);return g.getMLinePayloadTypes(r,t).indexOf(n)>-1},getMLinePayloadTypes:function(e,t){const n=new RegExp(`^m=${t} \\d+(/\\d+)? [a-zA-Z0-9/]+(( [a-zA-Z0-9/]+)+)$`,"i"),r=e.match(n);return!r||r.length<2?[]:r[2].trim().split(" ")},splitSections:function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},getLinesPerSection:e=>g.splitSections(e).map(e=>g.getSDPLines(e)),replaceDirectionInSdpLines:(e,t,n)=>{const r=e.join("\r\n");return g.replaceDirection(r,t,n).split("\r\n")},replaceDirection:(e,t,n)=>{const r=new RegExp("a="+t,"g");return e.replace(r,"a="+n)},setSubscriberMediaSectionToInactive:e=>{const t=d.default.SENDONLY,n=d.default.INACTIVE;return g.replaceDirectionInSdpLines(e,t,n)},changeMediaDirection:function(e,t){const n=g.splitSections(e);let r=n.shift();const i=d.default.RECVONLY,o=d.default.INACTIVE,a=t===i?o:i;return n.forEach(e=>{const n=e.includes("m=video")?g.replaceDirection(e,a,t):e;r+=n}),r},removeTypesFromMLine:function(e,t){const n=/[0-9 ]*$/.exec(e)[0],r=n.split(" ").filter(e=>""!==e&&-1===t.indexOf(e));return e.replace(n," "+r.join(" "))},removeMediaEncoding:function(e,t,n){let r,i,o,a,l=e.split("\r\n");const c=g.getMLineIndex(l,t),s=c>-1?l[c]:void 0,d=[];if(-1===c)return l.join("\r\n");if(r=g.getMLinePayloadTypes(s,t),0===r.length)return l.join("\r\n");for(i=c;i<l.length;i++){const e=new RegExp(n,"i");0===l[i].indexOf("a=rtpmap:")&&(a=l[i].split(" "),2===a.length&&e.test(a[1])&&d.push(a[0].substr(9)))}if(!d.length)return l.join("\r\n");for(i=c;i<l.length;i++)if(0===l[i].indexOf("a=fmtp:"))for(a=l[i].split(" "),o=0;o<d.length;o++)2===a.length&&a[1]==="apt="+d[o]&&d.push(a[0].substr(7));return l=l.filter(e=>{for(let t=0;t<d.length;t++)if(0===e.indexOf(`a=rtpmap:${d[t]} `)||0===e.indexOf(`a=fmtp:${d[t]} `)||0===e.indexOf(`a=rtcp-fb:${d[t]} `))return!1;return!0}),d.length>0&&c>-1&&(l[c]=g.removeTypesFromMLine(s,d)),l.join("\r\n")},disableMediaType:function(e,t){const n=e.split("\r\n"),r=[];let i;n.forEach(e=>{let t=e;/^m=/.test(t)&&(i=void 0),i||(i=[],r.push(i)),i.push(t)});const o=new RegExp(`^m=${t} \\d+ ([^ ]+) [0-9 ]+$`),a=r.map(e=>{const n=e[0].match(o);return n?[`m=${t} 0 ${n[1]} 0`,"a=inactive",...e.filter(e=>/^c=/.test(e)||/^a=mid:/.test(e)||""===e)]:e});return[].concat(...a).join("\r\n")},removeVideoCodec:function(e,t){return g.removeMediaEncoding(e,"video",t)}},Q=function(e,t){let n=t.filterByName("ssrc-group:FID");switch(n=0===n.length?[]:n[0].value.split(" "),n.length){case 0:case 1:var r=t.find(e=>0===e.name.indexOf("rtpmap:")&&e.value.indexOf("rtx/90000")>-1);if(!r)return!1;var i=r.name.split(":")[1];return i.indexOf("/")>-1&&(i=i.split("/")[0]),g.hasMLinePayloadType(e,"video",i);default:return h.debug("SDP Helpers: There are more than two FIDs, RTX is definitely enabled"),!0}};g.getAttributesForMediaType=function(e,t){let n,r,i,a,l,c,s,d,u,A;const h=g.getMLineIndex(e,t),F=new RegExp(`m=(?!${t}).+ `,"i"),p=new RegExp("a=ssrc:\\d+ .*","i"),U=new RegExp("a=ssrc-group:(SIM|FID) (\\d+).*?","i"),m=new RegExp("a=([a-z0-9:/-]+) (.*)","i"),b=[];for(let t=h+1;t<e.length;t++){if(F.test(e[t])){void 0!==n&&(r=t-1);break}l=e[t].match(U),c=e[t].match(p),void 0===n&&(l||c)&&(n=t,l&&(a=/^(FID|SIM)$/.test(l[1])?l[2]:l[1])),s=e[t].match(`a=ssrc:${a} msid:(.+)`),s&&(d=s[1]);const o=p.test(e[t]),h=U.test(e[t]);void 0!==n&&(void 0!==r||o||h?t===e.length-1&&(r=t):r=t-1);const g=e[t].match(/a=mid:(.+)/);g&&(u=g[1],A=t),i=m.exec(e[t]),i&&3===i.length&&b.push({lineIndex:t,name:i[1],value:i[2]})}return b.ssrcStartIndex=n,b.ssrcEndIndex=r,b.msid=d,b.mid=u,b.midIndex=A,b.isUsingRTX=Q.bind(null,e,b),b.filterByName=function(e){return this.filter(t=>t.name===e)},b.getRtpNumber=e=>{const t=new RegExp("rtpmap:(.+)");return(0,o.default)(b.map(n=>{const r=n.name.match(t);return r&&n.value.indexOf(e)>=0?r[1]:null}),e=>null!==e)},b},g.modifyDtx=(e,t)=>{const n=e.split("\r\n");if(!g.getMLine(n,"audio"))return h.debug("No audio m-line, not enabling dtx."),e;const r=g.getAttributesForMediaType(n,"audio"),i=r.getRtpNumber("opus");if(!i)return h.debug("Could not find rtp number for opus, not enabling dtx."),e;const o=r.find(e=>e.name==="fmtp:"+i);if(!o)return h.debug("Could not find a=fmtp line for opus, not enabling dtx."),e;let a=n[o.lineIndex];const l=/usedtx=\d+([\s;]*)/;return l.test(o.value)?a=a.replace(l,t?"usedtx=1$1":""):t&&(a+="; usedtx=1"),a=a.replace(/[;\s]*$/,""),n[o.lineIndex]=a,n.join("\r\n")};const F=(e,t,n)=>{const r=t.split("\r\n");if(!g.getMLine(r,"audio"))return h.debug("No audio m-line, not enabling stereo."),t;const i=g.getAttributesForMediaType(r,"audio"),o=i.getRtpNumber("opus");if(!o)return h.debug("Could not find rtp number for opus, not enabling stereo."),t;const a=i.find(e=>e.name==="fmtp:"+o);if(!a)return h.debug("Could not find a=fmtp line for opus, not enabling stereo."),t;let l,c=r[a.lineIndex];switch(e){case"send":l=/sprop-stereo=\d+([\s;]*)/,l.test(a.value)?c=c.replace(l,n?"sprop-stereo=1$1":""):n&&(c+="; sprop-stereo=1");break;case"receive":l=/([^-])stereo=\d+([\s;]*)/,l.test(a.value)?c=c.replace(l,n?"$1stereo=1$2":"$1"):n&&(c+="; stereo=1");break;default:throw new Error(`Invalid type ${e} passed into enableStereo`)}return c=c.replace(/[;\s]*$/,""),r[a.lineIndex]=c,r.join("\r\n")};g.modifySendStereo=F.bind(null,"send"),g.modifyReceiveStereo=F.bind(null,"receive"),g.setAudioBitrate=(e,t)=>{const n=g.getAudioBitrate(e);if(void 0!==n)return h.debug(`Audio bitrate already set to ${n}, not setting audio bitrate`),e;const r=e.split("\r\n");if(!g.getMLine(r,"audio"))return h.debug("No audio m-line, not setting audio bitrate"),e;const i=g.getAttributesForMediaType(r,"audio"),o=i.getRtpNumber("opus");if(!o)return h.debug("Could not find rtp number for opus, not setting audio bitrate."),e;const a=i.find(e=>e.name==="fmtp:"+o);if(!a)return h.debug("Could not find a=fmtp line for opus, not setting audio bitrate."),e;let l=r[a.lineIndex];return l+="; maxaveragebitrate="+t,l=l.replace(/[;\s]*$/,""),r[a.lineIndex]=l,r.join("\r\n")},g.removeVideoOrientation=e=>{let t=e.split("\r\n");return t=t.filter(e=>!e.includes("urn:3gpp:video-orientation")),t.join("\r\n")},g.hasSendStereo=e=>/[\s;]sprop-stereo=1/.test(e),g.hasSendDtx=e=>/[\s;]usedtx=1/.test(e),g.hasOpusFec=e=>/[\s;]useinbandfec=1/.test(e),g.getAudioBitrate=e=>{const t=e.match(/[\s;]maxaveragebitrate=(\d+)/);if(t)return Number(t[1])},g.MAX_SSRCS=10,g.getSSRCGroupType=e=>["SIM","FID"].find(t=>e.filterByName("ssrc-group:"+t)[0]),g.getSSRCGroup=e=>{const t=g.getSSRCGroupType(e);return e.filterByName("ssrc-group:"+t)[0]},g.getSSRCGroupSSRCs=e=>{const t=g.getSSRCGroup(e);return t?t.value.split(" ").slice(0,g.MAX_SSRCS):[]},g.getAllowedSSRCs=(e,t)=>{const n=t.slice();return e.filterByName("ssrc-group:FID").forEach(e=>{const t=e.value.split(" ");(0,l.default)(n,t).length&&Array.prototype.push.apply(n,t)}),(0,c.default)(n)},g.filterExcessSSRCs=e=>{const t=e.split("\r\n"),n=g.getAttributesForMediaType(t,"video"),r=g.getSSRCGroupType(n),i=n.ssrcStartIndex;if(void 0===i)return e;let o;const a=e=>{let t=null;return e.match(/^a=ssrc:(\d+)/)&&(t=RegExp.$1),t};if(r){const e=g.getSSRCGroupSSRCs(n),i=["a=ssrc-group:"+r,...e].join(" ");t[n.find(e=>e.name.startsWith("ssrc-group:")).lineIndex]=i,o=g.getAllowedSSRCs(n,e)}else{o=[];n.ssrcStartIndex&&o.push(a(t[n.ssrcStartIndex]))}return t.filter((e,t)=>{if(t<i||t>n.ssrcEndIndex)return!0;if(t===i){if(!r){const t=a(e);return t?o.includes(t):!/^a=ssrc:(\d+)/.test(e)}return!0}const l=a(e);if(l)return o.includes(l);if(e.match(/^a=ssrc-group:FID (\d+)/)){const e=RegExp.$1;return o.includes(e)}return!e.match(/^a=ssrc-group:SIM /)}).join("\r\n")},g.enableSimulcast=function(e,t){let n,r;const i=e.split("\r\n");if(!g.getMLine(i,"video"))return h.debug("No video m-line, not enabling simulcast."),e;const o=g.getAttributesForMediaType(i,"video");if(o.filterByName("ssrc-group:SIM").length>0)return h.debug("Simulcast is already enabled in this SDP, not attempting to enable again."),g.filterExcessSSRCs(e);if(!o.msid)return h.debug("No local stream attached, not enabling simulcast."),e;const a=o.isUsingRTX(),l=[],c=[];for(r=0;r<t;++r)l.push(1e4+r),a&&c.push(2e4+r);if(n=["a=ssrc-group:SIM "+l.join(" ")],a)for(r=0;r<t;++r)n.push(`a=ssrc-group:FID ${l[r]} ${c[r]}`);for(r=0;r<t;++r)n.push(`a=ssrc:${l[r]} cname:localCname`,`a=ssrc:${l[r]} msid:${o.msid}`);if(a)for(r=0;r<t;++r)n.push(`a=ssrc:${c[r]} cname:localCname`,`a=ssrc:${c[r]} msid:${o.msid}`);return n.unshift(o.ssrcStartIndex,o.ssrcEndIndex-o.ssrcStartIndex+1),i.splice(...n),i.join("\r\n")},g.reprioritizeVideoCodec=function(e,t,n){const r=e.split("\r\n"),i=g.getMLineIndex(r,"video");if(-1===i)return e;const o=g.getMLinePayloadTypes(r[i],"video"),a=new RegExp("^a=rtpmap:(\\d+).* "+t,"i"),l=r.map(e=>e.match(a)).filter(e=>null!==e);if(0===l.length)return e;const c=l.map(e=>e[1]);let s=o.filter(e=>-1===c.indexOf(e));"top"===n?s.unshift(...c):"bottom"===n?s.push(...c):(h.error(`Unexpected location param: ${n}; not changing ${t} priority`),s=o);const d=r[i].replace(o.join(" "),s.join(" "));return r[i]=d,r.join("\r\n")},g.getSetupRole=e=>{for(var t,n=u(e.split(/\r\n|\r|\n/));!(t=n()).done;){const e=t.value.match(/^a=setup:(\w+)/);if(e)return e[1]}return""},g.setSetupRole=(e,t)=>e.split(/\r\n|\r|\n/).map(e=>e.match(/^a=setup:(\w+)/)?"a=setup:"+t:e).join("\r\n"),g.changeSetupRole=(e,t,n)=>e.split(/\r\n|\r|\n/).map(e=>e.includes("a=setup:"+t)?"a=setup:"+n:e).join("\r\n"),g.patterns={bundle:"a=group:BUNDLE",address:"c=IN IP4",rtcp:"a=rtcp:",direction:["a=inactive","a=sendonly","a=recvonly","a=sendrecv"],rsize:"a=rtcp-rsize",ssrc:"a=ssrc:",msid:"a=msid:"},g.getIndexStartingWith=(e,t,n)=>{const r=e.slice(n),i=t.map(e=>r.findIndex(t=>t.includes(e))).filter(e=>e>-1);return i.length?n+Math.min(...i):e.length},g.getLastIndexPriorTo=(e,t,n)=>e.slice(0,n).map(e=>e.includes(t)).lastIndexOf(!0),g.includesAny=(e,t)=>{for(let n=0;n<t.length;n++)if(e.includes(t[n]))return!0;return!1},g.isVersionLine=e=>/^o=/.test(e),g.getVersionLine=e=>e.find(g.isVersionLine),g.getVersion=e=>{const t=g.getVersionLine(e);if(void 0===t)return;const n=Number(t.match(/ (\d+) IN /)[1]);return Number.isInteger(n)?n:void 0},g.updateVersion=(e,t,n)=>{const r=[...e],i=r.findIndex(e=>g.isVersionLine(e));return i>=0&&(r[i]=r[i].replace(` ${t} `,` ${n} `)),r},g.isBundleLine=e=>e.includes(g.patterns.bundle),g.getBundleLine=e=>e.find(g.isBundleLine),g.createBundleLine=e=>`${g.patterns.bundle} ${e.join(" ")}`,g.updateBundleLine=(e,t)=>{const n=[...e],r=g.createBundleLine(t),i=n.findIndex(e=>g.isBundleLine(e));return i>=0&&(n[i]=r),n},g.parseMLine=e=>{const t=e.match(/^(m=(?:audio|video)) (\d+) (.+)/),n=t[1];return{port:t[2],transport:t[3],mediaType:n}},g.disableTrack=e=>{const t=g.parseMLine(e);return`${t.mediaType} 0 ${t.transport}`},g.setMediaDirection=(e,t)=>{if(!Object.values(d.default).includes(t))return e;const n=e.slice(),r=n.findIndex(e=>g.includesAny(e,g.patterns.direction));return-1===r||(n[r]="a="+t),n},g.disableTrackSection=e=>{const t=e.mid,n=e.sdp;let r=n.filter(e=>{const t=g.patterns,n=t.address,r=t.rtcp,i=t.rsize,o=t.ssrc,a=t.msid;return!g.includesAny(e,[n,r,i,o,a])});return r[0]=g.disableTrack(n[0]),r=g.setMediaDirection(r,d.default.INACTIVE),{mid:t,sdp:r}},g.isDisabledMediaSection=e=>{let t=e[0];return/^m=(?:video|audio) 0 RTP\/SAVPF 0/.test(t)},g.getDisabledSectionForMid=e=>[`m=${e.includes("a")?"audio":"video"} 0 RTP/SAVPF 0`],g.disableTrackSections=(e,t)=>t.map(t=>{const n=g.getTrackMids(t)[0];return!n||e.includes(n)?t:g.getDisabledSectionForMid(n)}),g.getEnabledTracks=e=>g.getBundleLine(e).match(new RegExp(`^${g.patterns.bundle} (.+)$`))[1].split(" "),g.getDisabledTracks=(e,t)=>e.filter(e=>!t.includes(e)),g.getTrackSection=(e,t)=>{const n=e.findIndex(e=>e.includes("a=mid:"+t)),r=t.includes("a")?"audio":"video",i=g.getLastIndexPriorTo(e,"m="+r,n),o=g.getIndexStartingWith(e,["m=audio","m=video"],n),a=e.slice(i,o);return{mid:t,sdp:a}},g.getHeaders=e=>{const t=e.findIndex(e=>e.includes("m=audio")||e.includes("m=video"));return e.slice(0,t)},g.getSDPLines=e=>e.split("\r\n").filter(e=>e),g.getTrackMids=e=>e.filter(e=>e.match(new RegExp("^a=mid:\\d+"))).map(e=>e.substring("a=mid:".length)),g.getTrackSections=e=>g.getTrackMids(e).map(t=>g.getTrackSection(e,t)),g.parseMantisSDP=e=>{const t=g.changeSetupRole(e,"actpass","passive");return g.parseSDP(t)},g.isMediaSectionDisabled=e=>{const t=g.parseMLine(e[0]).port;return 0===parseInt(t,10)},g.getSectionMid=e=>g.isMediaSectionDisabled(e)?null:g.getTrackMids(e)[0],g.parseSDP=e=>{const t=g.getLinesPerSection(e),n=t[0],r=t.slice(1);return{bundle:g.getBundleLine(n),version:g.getVersion(n),iceCredentials:g.getIceCredentials(n),tracks:g.getEnabledTracks(n),mediaSections:r,mids:r.map(g.getSectionMid),headers:n}},g.createSDP=(e,t)=>{const n=[...e];return t.forEach(e=>n.push(...e)),n.push(""),n.join("\r\n")},g.removePayloadTypeFromSection=(e,t)=>e.filter(e=>!e.includes(`a=rtpmap:${t} `)&&!e.includes(`a=fmtp:${t} `)&&!e.includes(`a=rtcp-fb:${t} `)),g.getRtxPayloadType=(e,t)=>{const n=e.filter(e=>e.includes("apt="+t))[0];return null==n?void 0:n.match(/^a=fmtp:(\d+) /)[1]},g.removeRtxPayloadTypeFromSection=(e,t)=>{let n=[...e];const r=g.getRtxPayloadType(n,t);return r&&(n=g.removePayloadTypeFromSection(n,r)),n},g.trimUnusedCodecs=(e,t)=>{const n=e[0].split(" "),r=n.slice(3),i=n.slice(0,3),o=g.getCodecsFromSection(e);let a=[...e],l=[];r.forEach(e=>{const n=o.codecMap[e];if(t.includes(n)){l.push(e);const t=g.getRtxPayloadType(a,e);t&&l.push(t)}else a=g.removePayloadTypeFromSection(a,e),a=g.removeRtxPayloadTypeFromSection(a,e)});const c=l.length?l:[0];return a[0]=[...i,...c].join(" "),a},g.removeUnusedCodecs=(e,t)=>{if(!t)return e;const n=g.parseSDP(e),r=n.headers,i=n.mediaSections,o=g.parseSDP(t),a=o.mids,l=o.mediaSections,c=i.map(e=>{const t=a.findIndex(t=>t===g.getTrackMids(e)[0]);if(t<0)return e;const n=Object.values(g.getCodecsFromSection(l[t]).codecMap);return g.trimUnusedCodecs(e,n)}),s=[...r];return c.forEach(e=>s.push(...e)),s.push(""),s.join("\r\n")},g.updateSDPWithNewOffer=(e,t)=>{const n=e.headers,r=e.version,i=e.mediaSections,o=g.getSDPLines(t),a=g.getVersion(o),l=g.getEnabledTracks(o),c={version:a,tracks:l,headers:g.updateBundleLine(g.updateVersion(n,r,a),l),mediaSections:g.disableTrackSections(l,i)};return c.mids=c.mediaSections.map(g.getSectionMid),c},g.isUfragLine=e=>e.includes(g.iceCredentials.ufrag),g.isPwdLine=e=>e.includes(g.iceCredentials.pwd),g.getIceCredentials=e=>{const t={};return e.forEach(e=>{g.isUfragLine(e)?t.ufrag=e:g.isPwdLine(e)&&(t.pwd=e)}),t},g.updateIceCredentials=(e,t)=>e.map(e=>g.isUfragLine(e)?t.ufrag:g.isPwdLine(e)?t.pwd:e),g.addIceCredentialsToSection=(e,t)=>{let n=t.ufrag,r=t.pwd;const i=[...e],o=i.findIndex(e=>e.startsWith("a=mid:"));return o>=0&&i.splice(o,0,n,r),i},g.addIceCandidatesToSection=(e,t)=>{const n=[...e],r=t.filter(e=>e.startsWith("a=candidate:")||"a=end-of-candidates"===e),i=n.findIndex(e=>e.startsWith("a=mid:"));return i>=0&&r.length&&n.splice(i,0,...r),n},g.addIceConfig=(e,t,n)=>{const r=[...e],i=e[0];if(!g.getIceCredentials(i).ufrag){const e=g.addIceCredentialsToSection(i,n);r[0]=g.addIceCandidatesToSection(e,t)}return r},g.updateHeadersInPartialSdp=(e,t,n)=>{if(!e.headers.length)return g.updateBundleLine(t.headers,n);let r=g.updateBundleLine(e.headers,n);return r=g.updateVersion(r,e.version,t.version),e.iceCredentials.ufrag!==t.iceCredentials.ufrag&&(r=g.updateIceCredentials(r,t.iceCredentials)),r},g.updateFirstEnabledMediaSection=(e,t)=>{const n=[...e.mediaSections],r=e.mids.findIndex(e=>null!==e);return r>=0&&(n[r]=g.updateIceCredentials(n[r],t)),n};var p=g;t.default=p},function(e,t,n){var r=n(33),i=n(11);e.exports=function(e){if(!i(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t){e.expor