UNPKG

@millicast/vue-viewer-plugin

Version:

Vue.js plugin to embed viewer of a Millicast stream. This plugin allows developers to simplify Millicast services integration into their own Vue.js apps.

6 lines 513 kB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["millicast-vue-viewer-plugin"]=t(require("vue")):e["millicast-vue-viewer-plugin"]=t(e["Vue"])})("undefined"!==typeof self?self:this,function(e){return function(){var t={4055:function(e,t,n){(function(e,n){n(t)})(0,function(e){"use strict";var t,r=Object.defineProperty,o=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable,u=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t||(t={}))a.call(t,n)&&u(e,n,t[n]);if(s)for(var n of s(t))c.call(t,n)&&u(e,n,t[n]);return e},d=(e,t)=>o(e,i(t)),f=(e,t)=>{var n={};for(var r in e)a.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&s)for(var r of s(e))t.indexOf(r)<0&&c.call(e,r)&&(n[r]=e[r]);return n},p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof n.g<"u"?n.g:typeof self<"u"?self:{};function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var m,v={exports:{}},g=v.exports; /*! * js-logger - http://github.com/jonnyreeves/js-logger * Jonny Reeves, http://jonnyreeves.co.uk/ * js-logger may be freely distributed under the MIT license. */function y(){return m||(m=1,function(e){(function(t){var n,r={VERSION:"1.6.1"},o={},i=function(e,t){return function(){return t.apply(e,arguments)}},s=function(){var e,t,n=arguments,r=n[0];for(t=1;t<n.length;t++)for(e in n[t])!(e in r)&&n[t].hasOwnProperty(e)&&(r[e]=n[t][e]);return r},a=function(e,t){return{value:e,name:t}};r.TRACE=a(1,"TRACE"),r.DEBUG=a(2,"DEBUG"),r.INFO=a(3,"INFO"),r.TIME=a(4,"TIME"),r.WARN=a(5,"WARN"),r.ERROR=a(8,"ERROR"),r.OFF=a(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(r.TRACE,arguments)},debug:function(){this.invoke(r.DEBUG,arguments)},info:function(){this.invoke(r.INFO,arguments)},warn:function(){this.invoke(r.WARN,arguments)},error:function(){this.invoke(r.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(r.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(r.TIME,[e,"end"])},invoke:function(e,t){n&&this.enabledFor(e)&&n(t,s({level:e},this.context))}};var u=new c({filterLevel:r.OFF});(function(){var e=r;e.enabledFor=i(u,u.enabledFor),e.trace=i(u,u.trace),e.debug=i(u,u.debug),e.time=i(u,u.time),e.timeEnd=i(u,u.timeEnd),e.info=i(u,u.info),e.warn=i(u,u.warn),e.error=i(u,u.error),e.log=e.info})(),r.setHandler=function(e){n=e},r.setLevel=function(e){for(var t in u.setLevel(e),o)o.hasOwnProperty(t)&&o[t].setLevel(e)},r.getLevel=function(){return u.getLevel()},r.get=function(e){return o[e]||(o[e]=new c(s({name:e},u.context)))},r.createDefaultHandler=function(e){e=e||{},e.formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},n=function(e,t){Function.prototype.apply.call(e,console,t)};return typeof console>"u"?function(){}:function(o,i){o=Array.prototype.slice.call(o);var s,a=console.log;i.level===r.TIME?(s=(i.name?"["+i.name+"] ":"")+o[0],"start"===o[1]?console.time?console.time(s):t[s]=(new Date).getTime():console.timeEnd?console.timeEnd(s):n(a,[s+": "+((new Date).getTime()-t[s])+"ms"])):(i.level===r.WARN&&console.warn?a=console.warn:i.level===r.ERROR&&console.error?a=console.error:i.level===r.INFO&&console.info?a=console.info:i.level===r.DEBUG&&console.debug?a=console.debug:i.level===r.TRACE&&console.trace&&(a=console.trace),e.formatter(o,i),n(a,o))}},r.useDefaults=function(e){r.setLevel(e&&e.defaultLevel||r.DEBUG),r.setHandler(r.createDefaultHandler(e))},r.setDefaults=r.useDefaults,e.exports?e.exports=r:(r._prevLogger=t.Logger,r.noConflict=function(){return t.Logger=r._prevLogger,r},t.Logger=r)})(g)}(v)),v.exports}var w=y();const b=h(w),S="0.6.1",E=60,C=(null==(t=null==window?void 0:window.navigator)?void 0:t.userAgent)||"No user agent available";let k="",I="",x="",T="",P="",R="",A="",O=0;const V=[];function M(e){function t(e,t){return{ts:Math.round(t.timestamp)||"",ot:"audio"===e?"a":"v",bl:t.jitterBufferDelay||0,br:Math.round(t.bitrateBitsPerSecond||0),pld:t.packetsLostDeltaPerSecond||0,j:t.jitter||0,mtp:t.packetRate||0,mid:t.mid||"",mimeType:t.mimeType||""}}return e.stats=e.stats.reduce((e,n)=>{const r=0!==n.audio.inbounds.length?n.audio.inbounds.map(e=>t("audio",e)):n.audio.outbounds.map(e=>t("audio",e)),o=0!==n.video.inbounds.length?n.video.inbounds.map(e=>t("video",e)):n.video.outbounds.map(e=>t("video",e));return e.concat([...r,...o])},[]),e}const L={initAccountId:e=>{k=""===k?e:k},initStreamName:e=>{I=""===I?e:I},initSubscriberId:e=>{x=""===x?e:x},initStreamViewId:e=>{T=""===T?e:T},initFeedId:e=>{P=""===P?e:P},setConnectionTime:e=>{O=0===O?e:O},setConnectionState:e=>{R=e},setClusterId:e=>{A=""===A?e:A},addStats:e=>{V.length===E&&V.shift(),V.push(e)},get:(e=E,t="JSON")=>{let n;n=!Number.isInteger(e)||e>E||e<=0?E:e;const r={client:"@millicast/millicast-sdk",version:S,timestamp:(new Date).toISOString(),userAgent:C,clusterId:A,accountId:k,streamName:I,subscriberId:x,connection:R,stats:V.slice(-n),connectionDurationMs:(new Date).getTime()-O};return""!==P?r.feedId=P:""!==T&&(r.streamViewId=T),"CMCD"===t?M(r):r}};b.useDefaults({defaultLevel:b.TRACE});const D=["TRACE","DEBUG","INFO","WARN","ERROR"],B=(e,t)=>{e.unshift("[".concat(t.name||"Global","] ").concat((new Date).toISOString()," - ").concat(t.level.name," -"))},N=(e,t)=>t?e.value>=G[t].value:e.value>=z.value,_=(e,t)=>{e=Array.prototype.slice.call(e),e=e.map(e=>"object"==typeof e?JSON.stringify(e):e),B(e,t),0!==U?(F.push(e.join(" ")),F.length>=U&&(F=F.slice(-U))):F=[]},j=b.createDefaultHandler({formatter:B});b.setHandler((e,t)=>{_(e,t),N(t.level,t.name)&&j(e,t);for(const{handler:n,level:r}of H)t.level.value>=r.value&&n(e,t)});let U=1e4,F=[],z=b.OFF;const G={},H=[],W=d(l({},b),{enabledFor:N,getHistory:()=>F,getHistoryMaxSize:()=>U,setHistoryMaxSize:e=>{U=e},setLevel:e=>{z=e;for(const t in G)G[t]=e},getLevel:()=>z,get:e=>{G[e]||(G[e]=z);const t=b.get(e);return t.setLevel=t=>{G[e]=t},t.getLevel=()=>G[e],t},setHandler:(e,t)=>{H.push({handler:e,level:t})},diagnose:(e={})=>{let t;const n={statsCount:60,historySize:1e3,minLogLevel:"TRACE",statsFormat:"JSON"};"number"==typeof e?(n.statsCount=e,t=n):t=l(l({},n),e);const{statsCount:r,historySize:o,minLogLevel:i,statsFormat:s}=t,a=L.get(r,s),c=W.getHistory();if(!Number.isInteger(o)||o<=0)throw new Error("Invalid Argument Exception : historySize must be a positive integer.");if(!D.includes(i.toUpperCase()))throw new Error('Invalid Argument Exception : the minLogLevel parameter only excepts "trace", "debug", "info", "warn", and "error" as arguments.');if(D.includes(i.toUpperCase())){const e=D.slice(D.indexOf(i.toUpperCase())),t=c.filter(t=>e.some(e=>t.includes(e)));a.history=t.slice(-o)}return a},JSON:"JSON",CMCD:"CMCD",VERSION:S});var q,Q={exports:{}};function K(){if(q)return Q.exports;q=1;var e,t="object"==typeof Reflect?Reflect:null,n=t&&"function"==typeof t.apply?t.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};function r(e){console&&console.warn&&console.warn(e)}e=t&&"function"==typeof t.ownKeys?t.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 i(){i.init.call(this)}Q.exports=i,Q.exports.once=g,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function u(e,t,n,o){var i,s,u;if(a(n),s=e._events,void 0===s?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),u=s[t]),void 0===u)u=s[t]=n,++e._eventsCount;else if("function"==typeof u?u=s[t]=o?[n,u]:[u,n]:o?u.unshift(n):u.push(n),i=c(e),i>0&&u.length>i&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=u.length,r(l)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=l.bind(r);return o.listener=n,r.wrapFn=o,o}function f(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?v(o):h(o,o.length)}function p(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 h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function m(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function g(e,t){return new Promise(function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}w(e,t,i,{once:!0}),"error"!==t&&y(e,o,{once:!0})})}function y(e,t,n){"function"==typeof e.on&&w(e,"error",t,n)}function w(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 o(i){r.once&&e.removeEventListener(t,o),n(i)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},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+".");s=e}}),i.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},i.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},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=h(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},i.prototype.addListener=function(e,t){return u(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return u(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},i.prototype.removeListener=function(e,t){var n,r,o,i,s;if(a(t),r=this._events,void 0===r)return this;if(n=r[e],void 0===n)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(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():m(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,n,r;if(n=this._events,void 0===n)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 o,i=Object.keys(n);for(r=0;r<i.length;++r)o=i[r],"removeListener"!==o&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],"function"==typeof t)this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return f(this,e,!0)},i.prototype.rawListeners=function(e){return f(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},Q.exports}var X=K();const J=h(X);var Y,Z={exports:{}};function ee(){if(Y)return Z.exports;Y=1,Z.exports=t,Z.exports.filter=n;var e=K().EventEmitter;function t(e,t,n){Array.isArray(n)||(n=[n]);var r=[];return n.forEach(function(n){var o=function(){var e=[].slice.call(arguments);e.unshift(n),t.emit.apply(t,e)};r.push(o),e.on(n,o)}),function(){n.forEach(function(t,n){e.removeListener(t,r[n])})}}function n(n,r){var o=new e;return t(n,o,r),o}return Z.exports}var te=ee();const ne=h(te);var re,oe={exports:{}};/*! For license information please see webrtc-stats.js.LICENSE.txt */function ie(){return re||(re=1,function(e){(function(t,n){e.exports=n()})(self,()=>{return e={7:e=>{var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.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 i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise(function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}m(e,t,i,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,o)})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function u(e,t,n,r){var o,i,s,u;if(a(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),void 0===s)s=i[t]=n,++e._eventsCount;else if("function"==typeof s?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(o=c(e))>0&&s.length>o&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=l.bind(r);return o.listener=n,r.wrapFn=o,o}function f(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]: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}(o):h(o,o.length)}function p(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 h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function m(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function o(i){r.once&&e.removeEventListener(t,o),n(i)})}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},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+".");s=e}}),i.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},i.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},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var u=c.length,l=h(c,u);for(n=0;n<u;++n)r(l[n],this,t)}return!0},i.prototype.addListener=function(e,t){return u(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return u(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},i.prototype.removeListener=function(e,t){var n,r,o,i,s;if(a(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(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.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 o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);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},i.prototype.listeners=function(e){return f(this,e,!0)},i.prototype.rawListeners=function(e){return f(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},156:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;var s=n(586);Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return i(s).default}}),o(n(284),t),o(n(280),t),o(n(738),t),o(n(767),t)},185:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.calculatePacketsLostRatio=t.calculateRate=t.getMediaKind=void 0,t.getMediaKind=e=>{let t=e.kind||e.mediaType;return["audio","video"].includes(t)||"inbound-rtp"!==e.type||(t=e.id.toLocaleLowerCase().includes("video")?"video":"audio"),t},t.calculateRate=(e,t,n,r)=>n&&r?(t-r)/((e-n)/1e3):0,t.calculatePacketsLostRatio=(e,t,n,r)=>{const o=e-(null!=n?n:0),i=o+(t-(null!=r?r:0));return 0===i?0:o/i}},280:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},284:function(e,t,n){var r,o,i,s,a,c,u,l,d,f,p,h,m,v,g,y,w=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})},b=this&&this.__classPrivateFieldSet||function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},S=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},E=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRTCStats=void 0;const C=n(7),k=E(n(586)),I=n(738),x=n(185);class T extends C.EventEmitter{constructor(e){super(),r.add(this),o.set(this,void 0),i.set(this,void 0),s.set(this,void 0),a.set(this,null),c.set(this,void 0),u.set(this,null),this.start=()=>{S(this,c,"f").info("WebRTC statistics collection is starting..."),b(this,u,null,"f"),b(this,a,setInterval(S(this,l,"f"),S(this,i,"f")),"f")},this.stop=()=>{S(this,a,"f")&&(clearInterval(S(this,a,"f")),b(this,a,null,"f"),S(this,c,"f").info("WebRTC statistics collection has stopped."))},l.set(this,()=>w(this,void 0,void 0,function*(){let e,t;try{S(this,c,"f").trace("Requesting WebRTC statistics..."),e=yield S(this,o,"f").call(this),t=(new Date).toISOString()}catch(a){return S(this,c,"f").error("Problem collecting the WebRTC statistics.",a),void this.emit("error","Problem collecting the WebRTC statistics - ".concat(a))}const n=Array.from(e.values()),i={timestamp:t,input:{audio:[],video:[]},output:{audio:[],video:[]}};S(this,s,"f")&&(i.rawStats=e);for(let o=0;o<Object.keys(n).length;o++){const t=n[o];switch(t.type){case"outbound-rtp":const n=t,o=(0,x.getMediaKind)(n);"audio"===o?yield S(this,r,"m",p).call(this,e,n,i):"video"===o&&(yield S(this,r,"m",h).call(this,e,n,i));break;case"inbound-rtp":const s=t;let a=(0,x.getMediaKind)(s);"audio"===a?yield S(this,r,"m",v).call(this,e,s,i):"video"===a&&(yield S(this,r,"m",g).call(this,e,s,i));break;case"candidate-pair":const c=t;c.nominated&&S(this,r,"m",y).call(this,c,i)}}b(this,u,i,"f"),this.emit("stats",i)})),b(this,c,k.default.get("WebRTCStats"),"f"),b(this,o,e.getStats,"f"),b(this,i,e.getStatsInterval||1e3,"f"),b(this,s,!!e.includeRawStats,"f")}}t.WebRTCStats=T,o=new WeakMap,i=new WeakMap,s=new WeakMap,a=new WeakMap,c=new WeakMap,u=new WeakMap,l=new WeakMap,r=new WeakSet,d=function(e,t){if(t){const n=e.get(t);if(n)return{mimeType:n.mimeType}}return{}},f=function(e,t,n){return w(this,void 0,void 0,function*(){var o,i,s,a;const c=(0,x.calculateRate)(t.timestamp,t.bytesSent,null==n?void 0:n.timestamp,null==n?void 0:n.totalBytesSent),u=(0,x.calculateRate)(t.timestamp,t.packetsSent,null==n?void 0:n.timestamp,null==n?void 0:n.totalPacketsSent),l=S(this,r,"m",d).call(this,e,t.codecId);return Object.assign({id:t.id,timestamp:t.timestamp,mid:t.mid,totalBytesSent:t.bytesSent,bytesSentDelta:t.bytesSent-(null!==(o=null==n?void 0:n.totalBytesSent)&&void 0!==o?o:0),totalPacketsSent:t.packetsSent,packetsSentDelta:t.packetsSent-(null!==(i=null==n?void 0:n.totalPacketsSent)&&void 0!==i?i:0),bitrate:c,packetRate:u,targetBitrate:t.targetBitrate,retransmittedPacketsSent:t.retransmittedPacketsSent,retransmittedPacketsSentDelta:t.retransmittedPacketsSent-(null!==(s=null==n?void 0:n.retransmittedPacketsSent)&&void 0!==s?s:0),retransmittedBytesSent:t.retransmittedBytesSent,retransmittedBytesSentDelta:t.retransmittedBytesSent-(null!==(a=null==n?void 0:n.retransmittedBytesSent)&&void 0!==a?a:0)},l)})},p=function(e,t,n){return w(this,void 0,void 0,function*(){var o;const i=null===(o=S(this,u,"f"))||void 0===o?void 0:o.output.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const s=yield S(this,r,"m",f).call(this,e,t,i),a=Object.assign({},s);n.output.audio.push(a)})},h=function(e,t,n){return w(this,void 0,void 0,function*(){var o;const i=null===(o=S(this,u,"f"))||void 0===o?void 0:o.output.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const s=yield S(this,r,"m",f).call(this,e,t,i);let a=I.QualityLimitationReason.none;t.qualityLimitationReason&&(a=t.qualityLimitationReason);const c=Object.assign(Object.assign({},s),{frameWidth:t.frameWidth,frameHeight:t.frameHeight,framesPerSecond:t.framesPerSecond,framesSent:t.framesSent,qualityLimitationReason:a,qualityLimitationDurations:t.qualityLimitationDurations});n.output.video.push(c)})},m=function(e,t,n){return w(this,void 0,void 0,function*(){var o,i;const s=(0,x.calculateRate)(t.timestamp,t.bytesReceived,null==n?void 0:n.timestamp,null==n?void 0:n.totalBytesReceived),a=(0,x.calculateRate)(t.timestamp,t.packetsReceived,null==n?void 0:n.timestamp,null==n?void 0:n.totalPacketsReceived),c=(0,x.calculatePacketsLostRatio)(t.packetsLost,t.packetsReceived,null==n?void 0:n.totalPacketsLost,null==n?void 0:n.totalPacketsReceived),u=(null!==(o=t.packetsLost)&&void 0!==o?o:0)-(null!==(i=null==n?void 0:n.totalPacketsLost)&&void 0!==i?i:0),l=S(this,r,"m",d).call(this,e,t.codecId);return Object.assign({id:t.id,timestamp:t.timestamp,mid:t.mid,trackIdentifier:t.trackIdentifier,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,jitterBufferEmittedCount:t.jitterBufferEmittedCount,totalBytesReceived:t.bytesReceived,totalPacketsReceived:t.packetsReceived,totalPacketsLost:t.packetsLost,bitrate:s,packetRate:a,packetLossRatio:c,packetLossDelta:u},l)})},v=function(e,t,n){return w(this,void 0,void 0,function*(){var o;const i=null===(o=S(this,u,"f"))||void 0===o?void 0:o.input.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const s=yield S(this,r,"m",m).call(this,e,t,i);n.input.audio.push(s)})},g=function(e,t,n){return w(this,void 0,void 0,function*(){var o;const i=null===(o=S(this,u,"f"))||void 0===o?void 0:o.input.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const s=yield S(this,r,"m",m).call(this,e,t,i),a=Object.assign(Object.assign({},s),{keyFramesDecoded:t.keyFramesDecoded,frameHeight:t.frameHeight,frameWidth:t.frameWidth,framesDecoded:t.framesDecoded,framesDropped:t.framesDropped,framesPerSecond:t.framesPerSecond,framesReceived:t.framesReceived});n.input.video.push(a)})},y=function(e,t){t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.responsesReceived=e.responsesReceived,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.availableIncomingBitrate=e.availableIncomingBitrate}},586:function(e,t,n){var r,o;(function(){var i,s={VERSION:"1.6.1"},a={},c=function(e,t){return function(){return t.apply(e,arguments)}},u=function(){var e,t,n=arguments,r=n[0];for(t=1;t<n.length;t++)for(e in n[t])!(e in r)&&n[t].hasOwnProperty(e)&&(r[e]=n[t][e]);return r},l=function(e,t){return{value:e,name:t}};s.TRACE=l(1,"TRACE"),s.DEBUG=l(2,"DEBUG"),s.INFO=l(3,"INFO"),s.TIME=l(4,"TIME"),s.WARN=l(5,"WARN"),s.ERROR=l(8,"ERROR"),s.OFF=l(99,"OFF");var d=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};d.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(s.TRACE,arguments)},debug:function(){this.invoke(s.DEBUG,arguments)},info:function(){this.invoke(s.INFO,arguments)},warn:function(){this.invoke(s.WARN,arguments)},error:function(){this.invoke(s.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(s.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(s.TIME,[e,"end"])},invoke:function(e,t){i&&this.enabledFor(e)&&i(t,u({level:e},this.context))}};var f,p=new d({filterLevel:s.OFF});(f=s).enabledFor=c(p,p.enabledFor),f.trace=c(p,p.trace),f.debug=c(p,p.debug),f.time=c(p,p.time),f.timeEnd=c(p,p.timeEnd),f.info=c(p,p.info),f.warn=c(p,p.warn),f.error=c(p,p.error),f.log=f.info,s.setHandler=function(e){i=e},s.setLevel=function(e){for(var t in p.setLevel(e),a)a.hasOwnProperty(t)&&a[t].setLevel(e)},s.getLevel=function(){return p.getLevel()},s.get=function(e){return a[e]||(a[e]=new d(u({name:e},p.context)))},s.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},n=function(e,t){Function.prototype.apply.call(e,console,t)};return typeof console>"u"?function(){}:function(r,o){r=Array.prototype.slice.call(r);var i,a=console.log;o.level===s.TIME?(i=(o.name?"["+o.name+"] ":"")+r[0],"start"===r[1]?console.time?console.time(i):t[i]=(new Date).getTime():console.timeEnd?console.timeEnd(i):n(a,[i+": "+((new Date).getTime()-t[i])+"ms"])):(o.level===s.WARN&&console.warn?a=console.warn:o.level===s.ERROR&&console.error?a=console.error:o.level===s.INFO&&console.info?a=console.info:o.level===s.DEBUG&&console.debug?a=console.debug:o.level===s.TRACE&&console.trace&&(a=console.trace),e.formatter(r,o),n(a,r))}},s.useDefaults=function(e){s.setLevel(e&&e.defaultLevel||s.DEBUG),s.setHandler(s.createDefaultHandler(e))},s.setDefaults=s.useDefaults,void 0===(o="function"==typeof(r=s)?r.call(t,n,t,e):r)||(e.exports=o)})()},738:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.QualityLimitationReason=void 0,function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(n||(t.QualityLimitationReason=n={}))},767:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})}},t={},function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(156);var e,t})}(oe)),oe.exports}var se=ie();const ae=W.get("PeerConnectionStats"),ce={stats:"stats"},ue=e=>{const t=e,{input:n,output:r,rawStats:o}=t,i=f(t,["input","output","rawStats"]);return d(l({},i),{audio:{inbounds:e.input.audio.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:o}=t,i=f(t,["packetLossRatio","packetLossDelta","bitrate"]);return l({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*o,bitrate:o},i)}),outbounds:e.output.audio.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:o}=t,i=f(t,["packetLossRatio","packetLossDelta","bitrate"]);return l({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*o,bitrate:o},i)})},video:{inbounds:e.input.video.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:o}=t,i=f(t,["packetLossRatio","packetLossDelta","bitrate"]);return l({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*o,bitrate:o},i)}),outbounds:e.output.video.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:o}=t,i=f(t,["packetLossRatio","packetLossDelta","bitrate"]);return l({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*o,bitrate:o},i)})},raw:e.rawStats})};class le extends J{constructor(e,t={statsIntervalMs:1e3,autoInitStats:!0}){super(),this.peer=e,this.collection=null,this.initialized=!1,t.autoInitStats&&this.init(t.statsIntervalMs)}init(e){if(this.initialized)return void ae.warn("PeerConnectionStats.init() has already been called. Automatic initialization occurs when the PeerConnectionStats object is constructed.");ae.info("Initializing peer connection stats");const t=this.peer;try{this.collection=new se.WebRTCStats({getStatsInterval:e,getStats:()=>t.getStats(),includeRawStats:!0}),this.collection.on("stats",e=>{const t=ue(e);L.addStats(t),this.emit(ce.stats,t)}),this.collection.start(),this.initialized=!0}catch(n){ae.error(n)}}parseStats(e){return ae.warn("The parseStats method is deprecated and will be removed in future releases."),null}stop(){ae.info("Stopping peer connection stats"),this.collection.stop()}}var de,fe,pe,he,me,ve,ge,ye,we,be,Se,Ee,Ce,ke,Ie,xe,Te,Pe,Re,Ae,Oe,Ve={},Me={},Le={},De={exports:{}};function Be(){if(de)return De.exports;de=1;var e=De.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v",t}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":"",t}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(e).forEach(function(t){var n=e[t];n.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})}),De.exports}function Ne(){return fe||(fe=1,function(e){var t=function(e){return String(Number(e))===e?Number(e):e},n=function(e,n,r,o){if(o&&!r)n[o]=t(e[1]);else for(var i=0;i<r.length;i+=1)null!=e[i+1]&&(n[r[i]]=t(e[i+1]))},r=function(e,t,r){var o=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:o&&!t[e.name]&&(t[e.name]={});var i=e.push?{}:o?t[e.name]:t;n(r.match(e.reg),i,e.names,e.name),e.push&&t[e.push].push(i)},o=Be(),i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},n=[],s=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach(function(e){var t=e[0],i=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),s=n[n.length-1]);for(var a=0;a<(o[t]||[]).length;a+=1){var c=o[t][a];if(c.reg.test(i))return r(c,s,i)}}),t.media=n,t};var s=function(e,n){var r=n.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&n.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(s,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var n=[],r=e.split(" ").map(t),o=0;o<r.length;o+=3)n.push({component:r[o],ip:r[o+1],port:r[o+2]});return n},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(s,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var n,r=!1;return"~"!==e[0]?n=t(e):(n=t(e.substring(1,e.length)),r=!0),{scid:n,paused:r}})})}}(Le)),Le}function _e(){if(he)return pe;he=1;var e=Be(),t=/%[sdv%]/g,n=function(e){var n=1,r=arguments,o=r.length;return e.replace(t,function(e){if(n>=o)return e;var t=r[n];switch(n+=1,e){case"%%":return"%";case"%s":return String(t);case"%d":return Number(t);case"%v":return""}})},r=function(e,t,r){var o=t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format,i=[e+"="+o];if(t.names)for(var s=0;s<t.names.length;s+=1){var a=t.names[s];t.name?i.push(r[t.name][a]):i.push(r[t.names[s]])}else i.push(r[t.name]);return n.apply(null,i)},o=["v","o","s","i","u","e","p","c","b","t","r","z","a"],i=["i","c","b","a"];return pe=function(t,n){n=n||{},null==t.version&&(t.version=0),null==t.name&&(t.name=" "),t.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var s=n.outerOrder||o,a=n.innerOrder||i,c=[];return s.forEach(function(n){e[n].forEach(function(e){e.name in t&&null!=t[e.name]?c.push(r(n,e,t)):e.push in t&&null!=t[e.push]&&t[e.push].forEach(function(t){c.push(r(n,e,t))})})}),t.media.forEach(function(t){c.push(r("m",e.m[0],t)),a.forEach(function(n){e[n].forEach(function(e){e.name in t&&null!=t[e.name]?c.push(r(n,e,t)):e.push in t&&null!=t[e.push]&&t[e.push].forEach(function(t){c.push(r(n,e,t))})})})}),c.join("\r\n")+"\r\n"},pe}function je(){if(me)return Me;me=1;var e=Ne(),t=_e();return Me.write=t,Me.parse=e.parse,Me.parseParams=e.parseParams,Me.parseFmtpConfig=e.parseFmtpConfig,Me.parsePayloads=e.parsePayloads,Me.parseRemoteCandidates=e.parseRemoteCandidates,Me.parseImageAttributes=e.parseImageAttributes,Me.parseSimulcastStreamList=e.parseSimulcastStreamList,Me}function Ue(){return ge||(ge=1,ve=function(e){const t=new Intl.Collator(e,{sensitivity:"base"});return(e,n)=>0==t.compare(e,n)}),ve}function Fe(){if(we)return ye;we=1;class e{constructor(e,t,n,r,o,i,s,a,c){this.foundation=e,this.componentId=t,this.transport=n,this.priority=r,this.address=o,this.port=i,this.type=s,this.relAddr=a,this.relPort=c}equals(e){return e.foundation===this.foundation&&e.componentId===this.componentId&&e.transport===this.transport&&e.priority===this.priority&&e.address===this.address&&e.port===this.port&&e.type===this.type&&e.relAddr===this.relAddr&&e.relPort===this.relPort}clone(){return new e(this.foundation,this.componentId,this.transport,this.priority,this.address,this.port,this.type,this.relAddr,this.relPort)}plain(){const e={foundation:this.foundation,componentId:this.componentId,transport:this.transport,priority:this.priority,address:this.address,port:this.port,type:this.type};return this.relAddr&&(e.relAddr=this.relAddr),this.relPort&&(e.relPort=this.relPort),e}getFoundation(){return this.foundation}getComponentId(){return this.componentId}getTransport(){return this.transport}getPriority(){return this.priority}getAddress(){return this.address}getPort(){return this.port}getType(){return this.type}getRelAddr(){return this.relAddr}getRelPort(){return this.relPort}}return e.expand=function(t){return"CandidateInfo"===t.constructor.name?t:new e(t.foundation,t.componentId,t.transport,t.priority,t.address,t.port,t.type,t.relAddr,t.relPort)},e.clone=function(t){return"CandidateInfo"===t.constructor.name?t.clone():e.expand(t)},ye=e,ye}function ze(){if(Se)return be;Se=1;class e{constructor(e,t){this.id=e,this.params=t||[]}clone(){return new e(this.id,this.params)}plain(){return this.params.length?{id:this.id,params:this.params}:{id:this.id}}getId(){return this.id}getParams(){return this.params}}return e.expand=function(t){return"RTCPFeedbackInfo"===t.constructor.name?t:new e(t.id,t.params)},e.clone=function(t){return"RTCPFeedbackInfo"===t.constructor.name?t.clone():e.expand(t)},be=e,be}function Ge(){if(Ce)return Ee;Ce=1;const e=ze();class t{constructor(e,t,n){this.codec=e,this.type=t,this.params={},this.rtcpfbs=new Set,n&&this.addParams(n)}clone(){const e=new t(this.codec,this.type,this.params);this.hasRTX()&&e.setRTX(this.getRTX());for(const t of this.rtcpfbs)e.addRTCPFeedback(t.clone());return this.hasChannels()&&e.setChannels(this.getChannels()),e}plain(){const e={codec:this.codec,type:this.type};this.rtx&&(e.rtx=this.rtx),this.channels&&(e.channels=this.channels),Object.keys(this.params).length&&(e.params=this.params);for(const t of this.rtcpfbs)e.rtcpfbs||(e.rtcpfbs=[]),e.rtcpfbs.push(t.plain());return e}setRTX(e){this.rtx=e}getType(){return this.type}setType(e){this.type=e}getCodec(){return this.codec}getParams(){return this.params}addParams(e){for(const t in e)this.params[t]=e[t]}addParam(e,t){this.params[e]=t}hasParam(e){return Object.hasOwnProperty.call(this.params,e)}getParam(e,t=void 0){if(this.hasParam(e))return this.params[e];if(void 0===t)throw new Error("param ".concat(e," not found and no default value provided"));return""+t}hasRTX(){return this.rtx}getRTX(){return this.rtx}hasChannels(){return this.channels}getChannels(){return this.channels}setChannels(e){this.channels=e}addRTCPFeedback(e){this.rtcpfbs.add(e)}getRTCPFeedbacks(){return this.rtcpfbs}}return t.expand=function(n){if("CodecInfo"===n.constructor.name)return n;const r=new t(n.codec,n.type,n.params);n.rtx&&r.setRTX(n.rtx),n.channels&&r.setChannels(n.channels);for(const t of n.rtcpfbs||[]){const n=e.expand(t);r.addRTCPFeedback(n)}return r},t.clone=function(e){return"CodecInfo"===e.constructor.name?e.clone():t.expand(e)},t.MapFromNames=function(n,r,o){var i;const s=new Map;let a=96;for(const c of n){let n;const u=c.split(";"),l=u.shift().toLowerCase().trim();n="pcmu"===l?0:"pcma"===l?8:++a;const d=new t(l,n);"opus"===l?d.setChannels(2):"multiopus"===l&&d.setChannels(6),r&&"ulpfec"!==l&&"flexfec-03"!==l&&"red"!==l&&d.setRTX(++a);for(const t of o||[])d.addRTCPFeedback(new e(t.id,t.params));for(const e of u){let t=e.split("=");d.addParam(t[0].trim(),null===(i=t[1])||void 0===i?void 0:i.trim())}s.set(n,d)}return s},Ee=t,Ee}function He(){if(Ie)return ke;function e(){var t=this;if(!(this instanceof e))return new(Function.prototype.bind.apply(e,[null].concat(Array.prototype.slice.call(arguments))));Array.from(arguments).forEach(function(e){t[e]=Symbol.for("MEDOOZE_SEMANTIC_SDP_"+e)})}return Ie=1,ke=e,ke}function We(){if(Te)return xe;Te=1;const e=He()("ACTIVE","PASSIVE","ACTPASS","INACTIVE");return e.byValue=function(t){switch(t){case e.ACTIVE:case e.PASSIVE:case e.ACTPASS:case e.INACTIVE:return t}return e[t.toUpperCase()]},e.toString=function(t){switch(t){case e.ACTIVE:return"active";case e.PASSIVE:return"passive";case e.ACTPASS:return"actpass";case e.INACTIVE:return"inactive"}},e.reverse=function(t,n){switch(t){case e.ACTIVE:return e.PASSIVE;case e.PASSIVE:return e.ACTIVE;case e.ACTPASS:return n?e.ACTIVE:e.PASSIVE;case e.INACTIVE:return e.INACTIVE}},xe=e,xe}function qe(){if(Re)return Pe;Re=1;const e=We();class t{constructor(e,t,n){this.setup=e,this.hash=t,this.fingerprint=n}clone(){return new t(this.setup,this.hash,this.fingerprint)}plain(){return{setup:e.toString(this.setup),hash:this.hash,fingerprint:this.fingerprint}}getFingerprint(){return this.fingerprint}getHash(){return this.hash}getSetup(){return this.setup}setSetup(e){this.setup=e}}return t.expand=function(n){return"DTLSInfo"===n.constructor.name?n:new t(n.setup?e.byValue(n.setup):e.ACTPASS,n.hash,n.fingerprint)},t.clone=function(e){return"DTLSInfo"===e.constructor.name?e.clone():t.expand(e)},Pe=t,Pe}function $e(){if(Oe)return Ae;Oe=1;class e{constructor(e,t,n,r){this.tag=e,this.suite=t,this.keyParams=n,this.sessionParams=r}clone(){return new e(this.tag,this.suite,this.keyParams,this.sessionParams)}plain(){return{tag:this.tag,suite:this.suite,keyParams:this.keyParams,sessionParams:this.sessionParams}}getSessionParams(){return this.sessionParams}getKeyParams(){return this.keyParams}getSuite(){return this.suite}getTag(){return this.tag}}return e.expand=function(t){return"CryptoInfo"===t.constructor.name?t:new e(t.tag,t.suite,t.keyParams,t.sessionParams)},e.clone=function(t){return"CryptoInfo"===t.constructor.name?t.clone():e.expand(t)},Ae=e,Ae}var Qe,