@flowplayer/player
Version:
video player for the future
7 lines • 498 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.rts=t())}(this,(function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function t(e,t){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),r=(r,...s)=>{try{const i=(null==t?void 0:t.debug)||n;i&&e.match(i)&&console.log(`flowplayer/${e} -- ${r}`,...s)}catch(e){console.warn(e)}};return r.log=r,r}const n="fullscreenenter",r="fullscreenexit",s="loadedmetadata",i="loadeddata",o="progress",a="loadstart",c="pause",l="playing",u="waiting",d="canplay",p="ended",f="seeked",h="seeking",m="reap",g="content:loadstart";var y=Object.freeze({__proto__:null,MOUNT:"mount",RETRY:"retry",ERROR:"error",CONTEXT_MENU:"contextmenu",CLICK:"click",DBL_CLICK:"dblclick",KEYUP:"keyup",KEYDOWN:"keydown",LOAD:"load",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:"touchend",TOUCH_CANCEL:"touchcancel",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_ENTER:n,FULLSCREEN_EXIT:r,FULLSCREEN_CHANGE:"fullscreenchange",METADATA:s,DATA:i,PROGRESS:o,TIME_UPDATE:"timeupdate",LOAD_START:a,VOLUME_CHANGE:"volumechange",PAUSE:c,PLAYING:l,PLAY:"play",WAITING:u,CAN_PLAY:d,ENDED:p,SEEKED:f,SEEKING:h,DURATION_CHANGE:"durationchange",VIEW_ENTER:"viewenter",VIEW_LEAVE:"viewleave",SOURCE:"src",REAP:m,QUALITIES:"qualities",QUALITY_CHANGE:"qualitychange",VIDEO_TRACKS:"videoTracks",SET_QUALITY:"quality:set",VIDEO_TRACK_SELECT:"tracks:video:select",RECOMMENDATIONS_READY:"recommendationsready",LANDSCAPE:"landscape",PORTRAIT:"portrait",DVR:"dvr",LIVE:"live",RECOVER:"recover",SEEK_QUEUED:"seek:queued",SEEK_CANCEL:"seek:cancel",PLUGIN_REGISTERED:"plugin:registered",REMOTE_SESSION_STARTED:"remotesession:started",REMOTE_SESSION_ENDED:"remotesession:ended",INTERSECTIONCHANGE:"intersectionchange",WEBKIT_NEEDKEY:"webkitneedkey",RENDER_PLUGIN:"renderplugin",AUDIO_ONLY_SOURCE:"audioonlysource",NON_RECOVERABLE_ERROR:"error:fatal",CONFIG:"config",STATE:"state",BEFORE_PLAY:"beforeplay",BEFORE_PAUSE:"beforepause",CONTENT_REAL_LOAD_START:g,CUEPOINTS:"cuepoints",CUEPOINT_START:"cuepointstart",CUEPOINT_END:"cuepointend",STANDARD_ERROR:"flowplayer:error"});function v(){throw new Error("setTimeout has not been defined")}function w(){throw new Error("clearTimeout has not been defined")}var _=v,R=w;function E(e){if(_===setTimeout)return setTimeout(e,0);if((_===v||!_)&&setTimeout)return _=setTimeout,setTimeout(e,0);try{return _(e,0)}catch(t){try{return _.call(null,e,0)}catch(t){return _.call(this,e,0)}}}"function"==typeof e.setTimeout&&(_=setTimeout),"function"==typeof e.clearTimeout&&(R=clearTimeout);var k,I=[],T=!1,A=-1;function L(){T&&k&&(T=!1,k.length?I=k.concat(I):A=-1,I.length&&O())}function O(){if(!T){var e=E(L);T=!0;for(var t=I.length;t;){for(k=I,I=[];++A<t;)k&&k[A].run();A=-1,t=I.length}k=null,T=!1,function(e){if(R===clearTimeout)return clearTimeout(e);if((R===w||!R)&&clearTimeout)return R=clearTimeout,clearTimeout(e);try{R(e)}catch(t){try{return R.call(null,e)}catch(t){return R.call(this,e)}}}(e)}}function N(e,t){this.fun=e,this.array=t}N.prototype.run=function(){this.fun.apply(null,this.array)};function M(){}var D=M,U=M,j=M,V=M,W=M,Z=M,G=M;var B=e.performance||{},Y=B.now||B.mozNow||B.msNow||B.oNow||B.webkitNow||function(){return(new Date).getTime()};var z=new Date;var K={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];I.push(new N(e,t)),1!==I.length||T||E(O)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:D,addListener:U,once:j,off:V,removeListener:W,removeAllListeners:Z,emit:G,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Y.call(B),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-z)/1e3}},H=Object.defineProperty,J=Object.defineProperties,Q=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,ne=(e,t,n)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,re=(e,t)=>{for(var n in t||(t={}))ee.call(t,n)&&ne(e,n,t[n]);if(q)for(var n of q(t))te.call(t,n)&&ne(e,n,t[n]);return e},se=(e,t)=>J(e,Q(t)),ie=(e,t)=>{var n={};for(var r in e)ee.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&q)for(var r of q(e))t.indexOf(r)<0&&te.call(e,r)&&(n[r]=e[r]);return n},oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof e<"u"?e:typeof self<"u"?self:{};function ae(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var le={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(e){!function(t){var n,r={VERSION:"1.6.1"},s={},i=function(e,t){return function(){return t.apply(e,arguments)}},o=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,o({level:e},this.context))}};var l=new c({filterLevel:r.OFF});(function(){var e=r;e.enabledFor=i(l,l.enabledFor),e.trace=i(l,l.trace),e.debug=i(l,l.debug),e.time=i(l,l.time),e.timeEnd=i(l,l.timeEnd),e.info=i(l,l.info),e.warn=i(l,l.warn),e.error=i(l,l.error),e.log=e.info})(),r.setHandler=function(e){n=e},r.setLevel=function(e){for(var t in l.setLevel(e),s)s.hasOwnProperty(t)&&s[t].setLevel(e)},r.getLevel=function(){return l.getLevel()},r.get=function(e){return s[e]||(s[e]=new c(o({name:e},l.context)))},r.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(s,i){s=Array.prototype.slice.call(s);var o,a=console.log;i.level===r.TIME?(o=(i.name?"["+i.name+"] ":"")+s[0],"start"===s[1]?console.time?console.time(o):t[o]=(new Date).getTime():console.timeEnd?console.timeEnd(o):n(a,[o+": "+((new Date).getTime()-t[o])+"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(s,i),n(a,s))}},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)}(oe)}(le);const ue=ae(le.exports);var de;const pe=(null==(de=null==window?void 0:window.navigator)?void 0:de.userAgent)||"No user agent available";let fe="",he="",me="",ge="",ye="",ve="",be="",we=0;const Se=[];const _e=e=>{fe=""===fe?e:fe},Re=e=>{he=""===he?e:he},Ee=e=>{me=""===me?e:me},ke=e=>{ge=""===ge?e:ge},Ie=e=>{ye=""===ye?e:ye},Ce=e=>{we=0===we?e:we},xe=e=>{ve=e},Te=e=>{be=""===be?e:be},Ae=e=>{60===Se.length&&Se.shift(),Se.push(e)},Le=(e=60,t="JSON")=>{let n;n=!Number.isInteger(e)||e>60||e<=0?60:e;const r={client:"@millicast/millicast-sdk",version:"0.3.2",timestamp:(new Date).toISOString(),userAgent:pe,clusterId:be,accountId:fe,streamName:he,subscriberId:me,connection:ve,stats:Se.slice(-n),connectionDurationMs:(new Date).getTime()-we};return""!==ye?r.feedId=ye:""!==ge&&(r.streamViewId=ge),"CMCD"===t?function(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)),s=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,...s])},[]),e}(r):r};ue.useDefaults({defaultLevel:ue.TRACE});const Pe=["TRACE","DEBUG","INFO","WARN","ERROR"],Oe=(e,t)=>{e.unshift("[".concat(t.name||"Global","] ").concat((new Date).toISOString()," - ").concat(t.level.name," -"))},Ne=(e,t)=>t?e.value>=Ve[t].value:e.value>=je.value,Me=ue.createDefaultHandler({formatter:Oe});ue.setHandler((e,t)=>{((e,t)=>{e=(e=Array.prototype.slice.call(e)).map(e=>"object"==typeof e?JSON.stringify(e):e),Oe(e,t),0!==Fe?(Ue.push(e.join(" ")),Ue.length>=Fe&&(Ue=Ue.slice(-Fe))):Ue=[]})(e,t),Ne(t.level,t.name)&&Me(e,t);for(const{handler:n,level:r}of We)t.level.value>=r.value&&n(e,t)});let Fe=1e4,Ue=[],je=ue.OFF;const Ve={},We=[],Ze=se(re({},ue),{enabledFor:Ne,getHistory:()=>Ue,getHistoryMaxSize:()=>Fe,setHistoryMaxSize:e=>{Fe=e},setLevel:e=>{je=e;for(const t in Ve)Ve[t]=e},getLevel:()=>je,get:e=>{Ve[e]||(Ve[e]=je);const t=ue.get(e);return t.setLevel=t=>{Ve[e]=t},t.getLevel=()=>Ve[e],t},setHandler:(e,t)=>{We.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=re(re({},n),e);const{statsCount:r,historySize:s,minLogLevel:i,statsFormat:o}=t,a=Le(r,o),c=Ze.getHistory();if(!Number.isInteger(s)||s<=0)throw new Error("Invalid Argument Exception : historySize must be a positive integer.");if(!Pe.includes(i.toUpperCase()))throw new Error('Invalid Argument Exception : the minLogLevel parameter only excepts "trace", "debug", "info", "warn", and "error" as arguments.');if(Pe.includes(i.toUpperCase())){const e=Pe.slice(Pe.indexOf(i.toUpperCase())),t=c.filter(t=>e.some(e=>t.includes(e)));a.history=t.slice(-s)}return a},JSON:"JSON",CMCD:"CMCD",VERSION:"0.3.2"});var Ge,Be={exports:{}},Ye="object"==typeof Reflect?Reflect:null,ze=Ye&&"function"==typeof Ye.apply?Ye.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};Ge=Ye&&"function"==typeof Ye.ownKeys?Ye.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Xe=Number.isNaN||function(e){return e!=e};function Ke(){Ke.init.call(this)}Be.exports=Ke,Be.exports.once=function(e,t){return new Promise((function(n,r){function s(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",s),n([].slice.call(arguments))}ot(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&ot(e,"error",t,n)}(e,s,{once:!0})}))},Ke.EventEmitter=Ke,Ke.prototype._events=void 0,Ke.prototype._eventsCount=0,Ke.prototype._maxListeners=void 0;var $e=10;function He(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Je(e){return void 0===e._maxListeners?Ke.defaultMaxListeners:e._maxListeners}function Qe(e,t,n,r){var s,i,o;if(He(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),o=i[t]),void 0===o)o=i[t]=n,++e._eventsCount;else if("function"==typeof o?o=i[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(s=Je(e))>0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,function(e){console&&console.warn&&console.warn(e)}(a)}return e}function qe(){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 et(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},s=qe.bind(r);return s.listener=n,r.wrapFn=s,s}function nt(e,t,n){var r=e._events;if(void 0===r)return[];var s=r[t];return void 0===s?[]:"function"==typeof s?n?[s.listener||s]:[s]: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}(s):it(s,s.length)}function st(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 it(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function ot(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 s(i){r.once&&e.removeEventListener(t,s),n(i)}))}}Object.defineProperty(Ke,"defaultMaxListeners",{enumerable:!0,get:function(){return $e},set:function(e){if("number"!=typeof e||e<0||Xe(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");$e=e}}),Ke.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},Ke.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Xe(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},Ke.prototype.getMaxListeners=function(){return Je(this)},Ke.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var a=s[e];if(void 0===a)return!1;if("function"==typeof a)ze(a,this,t);else{var c=a.length,l=it(a,c);for(n=0;n<c;++n)ze(l[n],this,t)}return!0},Ke.prototype.addListener=function(e,t){return Qe(this,e,t,!1)},Ke.prototype.on=Ke.prototype.addListener,Ke.prototype.prependListener=function(e,t){return Qe(this,e,t,!0)},Ke.prototype.once=function(e,t){return He(t),this.on(e,et(this,e,t)),this},Ke.prototype.prependOnceListener=function(e,t){return He(t),this.prependListener(e,et(this,e,t)),this},Ke.prototype.removeListener=function(e,t){var n,r,s,i,o;if(He(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(s=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){o=n[i].listener,s=i;break}if(s<0)return this;0===s?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,s),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},Ke.prototype.off=Ke.prototype.removeListener,Ke.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 s,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(s=i[r])&&this.removeAllListeners(s);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},Ke.prototype.listeners=function(e){return nt(this,e,!0)},Ke.prototype.rawListeners=function(e){return nt(this,e,!1)},Ke.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):st.call(e,t)},Ke.prototype.listenerCount=st,Ke.prototype.eventNames=function(){return this._eventsCount>0?Ge(this._events):[]};var at=Be.exports;const ct=ae(at);var lt={exports:{}};lt.exports=dt,lt.exports.filter=function(e,t){var n=new ut;return dt(e,n,t),n};var ut=at.EventEmitter;function dt(e,t,n){Array.isArray(n)||(n=[n]);var r=[];return n.forEach((function(n){var s=function(){var e=[].slice.call(arguments);e.unshift(n),t.emit.apply(t,e)};r.push(s),e.on(n,s)})),function(){n.forEach((function(t,n){e.removeListener(t,r[n])}))}}const pt=ae(lt.exports);var ft={exports:{}};
/*! For license information please see webrtc-stats.js.LICENSE.txt */!function(e,t){!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 s=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 s(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",s),n([].slice.call(arguments))}m(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,s)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=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 l(e,t,n,r){var s,i,o,l;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),o=i[t]),void 0===o)o=i[t]=n,++e._eventsCount;else if("function"==typeof o?o=i[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(s=c(e))>0&&o.length>s&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,l=u,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 d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},s=u.bind(r);return s.listener=n,r.wrapFn=s,s}function p(e,t,n){var r=e._events;if(void 0===r)return[];var s=r[t];return void 0===s?[]:"function"==typeof s?n?[s.listener||s]:[s]: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}(s):h(s,s.length)}function f(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 s(i){r.once&&e.removeEventListener(t,s),n(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=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||s(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 s="error"===e,i=this._events;if(void 0!==i)s=s&&void 0===i.error;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var l=c.length,u=h(c,l);for(n=0;n<l;++n)r(u[n],this,t)}return!0},i.prototype.addListener=function(e,t){return l(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return l(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,s,i,o;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(s=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){o=n[i].listener,s=i;break}if(s<0)return this;0===s?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,s),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||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 s,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(s=i[r])&&this.removeAllListeners(s);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 p(this,e,!0)},i.prototype.rawListeners=function(e){return p(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},i.prototype.listenerCount=f,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},586:function(e,t,n){var r,s;!function(i){var o,a={VERSION:"1.6.1"},c={},l=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},d=function(e,t){return{value:e,name:t}};a.TRACE=d(1,"TRACE"),a.DEBUG=d(2,"DEBUG"),a.INFO=d(3,"INFO"),a.TIME=d(4,"TIME"),a.WARN=d(5,"WARN"),a.ERROR=d(8,"ERROR"),a.OFF=d(99,"OFF");var p=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};p.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(a.TRACE,arguments)},debug:function(){this.invoke(a.DEBUG,arguments)},info:function(){this.invoke(a.INFO,arguments)},warn:function(){this.invoke(a.WARN,arguments)},error:function(){this.invoke(a.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(a.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(a.TIME,[e,"end"])},invoke:function(e,t){o&&this.enabledFor(e)&&o(t,u({level:e},this.context))}};var f,h=new p({filterLevel:a.OFF});(f=a).enabledFor=l(h,h.enabledFor),f.trace=l(h,h.trace),f.debug=l(h,h.debug),f.time=l(h,h.time),f.timeEnd=l(h,h.timeEnd),f.info=l(h,h.info),f.warn=l(h,h.warn),f.error=l(h,h.error),f.log=f.info,a.setHandler=function(e){o=e},a.setLevel=function(e){for(var t in h.setLevel(e),c)c.hasOwnProperty(t)&&c[t].setLevel(e)},a.getLevel=function(){return h.getLevel()},a.get=function(e){return c[e]||(c[e]=new p(u({name:e},h.context)))},a.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,s){r=Array.prototype.slice.call(r);var i,o=console.log;s.level===a.TIME?(i=(s.name?"["+s.name+"] ":"")+r[0],"start"===r[1]?console.time?console.time(i):t[i]=(new Date).getTime():console.timeEnd?console.timeEnd(i):n(o,[i+": "+((new Date).getTime()-t[i])+"ms"])):(s.level===a.WARN&&console.warn?o=console.warn:s.level===a.ERROR&&console.error?o=console.error:s.level===a.INFO&&console.info?o=console.info:s.level===a.DEBUG&&console.debug?o=console.debug:s.level===a.TRACE&&console.trace&&(o=console.trace),e.formatter(r,s),n(o,r))}},a.useDefaults=function(e){a.setLevel(e&&e.defaultLevel||a.DEBUG),a.setHandler(a.createDefaultHandler(e))},a.setDefaults=a.useDefaults,void 0===(s="function"==typeof(r=a)?r.call(t,n,t,e):r)||(e.exports=s)}()},156:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=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 o=n(586);Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return i(o).default}}),s(n(284),t),s(n(280),t),s(n(738),t),s(n(767),t)},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={}))},280:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},767:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},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)=>0==t?0:(e-(null!=n?n:0))/(t-(null!=r?r:0))},284:function(e,t,n){var r,s,i,o,a,c,l,u,d,p,f,h,m,g,y,v,w=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},_=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},R=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 k=n(7),I=E(n(586)),T=n(738),A=n(185);class X extends k.EventEmitter{constructor(e){super(),r.add(this),s.set(this,void 0),i.set(this,void 0),o.set(this,void 0),a.set(this,null),c.set(this,void 0),l.set(this,null),this.start=()=>{R(this,c,"f").info("WebRTC statistics collection is starting..."),_(this,l,null,"f"),_(this,a,setInterval(R(this,u,"f"),R(this,i,"f")),"f")},this.stop=()=>{R(this,a,"f")&&(clearInterval(R(this,a,"f")),_(this,a,null,"f"),R(this,c,"f").info("WebRTC statistics collection has stopped."))},u.set(this,()=>w(this,void 0,void 0,(function*(){let e,t;try{R(this,c,"f").trace("Requesting WebRTC statistics..."),e=yield R(this,s,"f").call(this),t=(new Date).toISOString()}catch(e){return R(this,c,"f").error("Problem collecting the WebRTC statistics.",e),void this.emit("error","Problem collecting the WebRTC statistics - ".concat(e))}const n=Array.from(e.values()),i={timestamp:t,input:{audio:[],video:[]},output:{audio:[],video:[]}};R(this,o,"f")&&(i.rawStats=e);for(let t=0;t<Object.keys(n).length;t++){const s=n[t];switch(s.type){case"outbound-rtp":const t=s,n=(0,A.getMediaKind)(t);"audio"===n?yield R(this,r,"m",f).call(this,e,t,i):"video"===n&&(yield R(this,r,"m",h).call(this,e,t,i));break;case"inbound-rtp":const o=s;let a=(0,A.getMediaKind)(o);"audio"===a?yield R(this,r,"m",g).call(this,e,o,i):"video"===a&&(yield R(this,r,"m",y).call(this,e,o,i));break;case"candidate-pair":const c=s;c.nominated&&R(this,r,"m",v).call(this,c,i)}}_(this,l,i,"f"),this.emit("stats",i)}))),_(this,c,I.default.get("WebRTCStats"),"f"),_(this,s,e.getStats,"f"),_(this,i,e.getStatsInterval||1e3,"f"),_(this,o,!!e.includeRawStats,"f")}}t.WebRTCStats=X,s=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,r=new WeakSet,d=function(e,t){if(t){const n=e.get(t);if(n)return{mimeType:n.mimeType}}return{}},p=function(e,t,n){return w(this,void 0,void 0,(function*(){var s,i,o,a;const c=(0,A.calculateRate)(t.timestamp,t.bytesSent,null==n?void 0:n.timestamp,null==n?void 0:n.totalBytesSent),l=(0,A.calculateRate)(t.timestamp,t.packetsSent,null==n?void 0:n.timestamp,null==n?void 0:n.totalPacketsSent),u=R(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!==(s=null==n?void 0:n.totalBytesSent)&&void 0!==s?s:0),totalPacketsSent:t.packetsSent,packetsSentDelta:t.packetsSent-(null!==(i=null==n?void 0:n.totalPacketsSent)&&void 0!==i?i:0),bitrate:c,packetRate:l,targetBitrate:t.targetBitrate,retransmittedPacketsSent:t.retransmittedPacketsSent,retransmittedPacketsSentDelta:t.retransmittedPacketsSent-(null!==(o=null==n?void 0:n.retransmittedPacketsSent)&&void 0!==o?o:0),retransmittedBytesSent:t.retransmittedBytesSent,retransmittedBytesSentDelta:t.retransmittedBytesSent-(null!==(a=null==n?void 0:n.retransmittedBytesSent)&&void 0!==a?a:0)},u)}))},f=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.output.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",p).call(this,e,t,i),a=Object.assign({},o);n.output.audio.push(a)}))},h=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.output.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",p).call(this,e,t,i);let a=T.QualityLimitationReason.none;t.qualityLimitationReason&&(a=t.qualityLimitationReason);const c=Object.assign(Object.assign({},o),{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 s,i;const o=(0,A.calculateRate)(t.timestamp,t.bytesReceived,null==n?void 0:n.timestamp,null==n?void 0:n.totalBytesReceived),a=(0,A.calculateRate)(t.timestamp,t.packetsReceived,null==n?void 0:n.timestamp,null==n?void 0:n.totalPacketsReceived),c=(0,A.calculatePacketsLostRatio)(t.packetsReceived,t.packetsLost,null==n?void 0:n.totalPacketsReceived,null==n?void 0:n.totalPacketsLost),l=(null!==(s=t.packetsLost)&&void 0!==s?s:0)-(null!==(i=null==n?void 0:n.totalPacketsLost)&&void 0!==i?i:0),u=R(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:o,packetRate:a,packetLossRatio:c,packetLossDelta:l},u)}))},g=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.input.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",m).call(this,e,t,i);n.input.audio.push(o)}))},y=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.input.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",m).call(this,e,t,i),a=Object.assign(Object.assign({},o),{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)}))},v=function(e,t){t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.responsesReceived=e.responsesReceived,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.availableIncomingBitrate=e.availableIncomingBitrate}}},t={},function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(156);var e,t})}(ft);var ht=ft.exports;const mt=Ze.get("PeerConnectionStats"),gt="stats";class Ji extends ct{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 mt.warn("PeerConnectionStats.init() has already been called. Automatic initialization occurs when the PeerConnectionStats object is constructed.");mt.info("Initializing peer connection stats");const t=this.peer;try{this.collection=new ht.WebRTCStats({getStatsInterval:e,getStats:()=>t.getStats(),includeRawStats:!0}),this.collection.on("stats",e=>{const t=(e=>{const t=ie(e,["input","output","rawStats"]);return se(re({},t),{audio:{inbounds:e.input.audio.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:s}=t,i=ie(t,["packetLossRatio","packetLossDelta","bitrate"]);return re({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*s,bitrate:s},i)}),outbounds:e.output.audio.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:s}=t,i=ie(t,["packetLossRatio","packetLossDelta","bitrate"]);return re({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*s,bitrate:s},i)})},video:{inbounds:e.input.video.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:s}=t,i=ie(t,["packetLossRatio","packetLossDelta","bitrate"]);return re({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*s,bitrate:s},i)}),outbounds:e.output.video.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:s}=t,i=ie(t,["packetLossRatio","packetLossDelta","bitrate"]);return re({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*s,bitrate:s},i)})},raw:e.rawStats})})(e);Ae(t),this.emit(gt,t)}),this.collection.start(),this.initialized=!0}catch(e){mt.error(e)}}parseStats(e){return mt.warn("The parseStats method is deprecated and will be removed in future releases."),null}stop(){mt.info("Stopping peer connection stats"),this.collection.stop()}}var yt={},vt={},bt={},wt={exports:{}},St=wt.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"}},{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":""}},{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"]}]};Object.keys(St).forEach((function(e){St[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}));var _t=wt.exports;!function(e){var t=function(e){return String(Number(e))===e?Number(e):e},n=function(e,n,r){var s=e.name&&e.names;e.push&&!n[e.push]?n[e.push]=[]:s&&!n[e.name]&&(n[e.name]={});var i=e.push?{}:s?n[e.name]:n;(function(e,n,r,s){if(s&&!r)n[s]=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.match(e.reg),i,e.names,e.name),e.push&&n[e.push].push(i)},r=_t,s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},i=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach((function(e){var t=e[0],s=e.slice(2);"m"===t&&(i.push({rtp:[],fmtp:[]}),o=i[i.length-1]);for(var a=0;a<(r[t]||[]).length;a+=1){var c=r[t][a];if(c.reg.test(s))return n(c,o,s)}})),t.media=i,t};var i=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(i,{})},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),s=0;s<r.length;s+=3)n.push({component:r[s],ip:r[s+1],port:r[s+2]});return n},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(i,{})}))},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}}))}))}}(bt);var Rt=_t,Et=/%[sdv%]/g,kt=function(e){var t=1,n=arguments,r=n.length;return e.replace(Et,(function(e){if(t>=r)return e;var s=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(s);case"%d":return Number(s);case"%v":return""}}))},It=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var s=0;s<t.names.length;s+=1){var i=t.names[s];t.name?r.push(n[t.name][i]):r.push(n[t.names[s]])}else r.push(n[t.name]);return kt.apply(null,r)},Ct=["v","o","s","i","u","e","p","c","b","t","r","z","a"],xt=["i","c","b","a"],Tt=bt,At=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var n=t.outerOrder||Ct,r=t.innerOrder||xt,s=[];return n.forEach((function(t){Rt[t].forEach((function(n){n.name in e&&null!=e[n.name]?s.push(It(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){s.push(It(t,n,e))}))}))})),e.media.forEach((function(e){s.push(It("m",Rt.m[0],e)),r.forEach((function(t){Rt[t].forEach((function(n){n.name in e&&null!=e[n.name]?s.push(It(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){s.push(It(t,n,e))}))}))}))})),s.join("\r\n")+"\r\n"};vt.write=At,vt.parse=Tt.parse,vt.parseParams=Tt.parseParams,vt.parseFmtpConfig=Tt.parseFmtpConfig,vt.parsePayloads=Tt.parsePayloads,vt.parseRemoteCandidates=Tt.parseRemoteCandidates,vt.parseImageAttributes=Tt.parseImageAttributes,vt.parseSimulcastStreamList=Tt.parseSimulcastStreamList;let Lt=class Us{constructor(e,t,n,r,s,i,o,a,c){this.foundation=e,this.componentId=t,this.transport=n,this.priority=r,this.address=s,this.port=i,this.type=o,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 Us(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}};Lt.expand=function(e){return"CandidateInfo"===e.constructor.name?e:new Lt((e=e).foundation,e.componentId,e.transport,e.priority,e.address,e.port,e.type,e.relAddr,e.relPort)},Lt.clone=function(e){return"CandidateInfo"===e.constructor.name?e.clone():Lt.expand(e)};var Pt=Lt;let Ot=class $s{constructor(e,t){this.id=e,this.params=t||[]}clone(){return new $s(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}};Ot.expand=function(e){return"RTCPFeedbackInfo"===e.constructor.name?e:new Ot((e=e).id,e.params)},Ot.clone=function(e){return"RTCPFeedbackInfo"===e.constructor.name?e.clone():Ot.expand(e)};var Nt=Ot;const Mt=Nt;let Dt=class Bs{constructor(e,t,n){this.codec=e,this.type=t,this.params={},this.rtcpfbs=new Set,n&&this.addParams(n)}clone(){const e=new Bs(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,