forked from soareschen-cosmo/lib-jitsi-meet-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib-jitsi-meet.min.js
3 lines (3 loc) · 915 KB
/
lib-jitsi-meet.min.js
1
2
3
/*! For license information please see lib-jitsi-meet.min.js.LICENSE */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.JitsiMeetJS=t():e.JitsiMeetJS=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=61)}([function(e,t,n){var r=n(38),i=n(67),o={},a=[],s=r.levels.TRACE;e.exports={addGlobalTransport:function(e){r.addGlobalTransport(e)},removeGlobalTransport:function(e){r.removeGlobalTransport(e)},getLogger:function(e,t,n){var i=new r(s,e,t,n);return e?(o[e]=o[e]||[],o[e].push(i)):a.push(i),i},setLogLevelById:function(e,t){for(var n=t?o[t]||[]:a,r=0;r<n.length;r++)n[r].setLevel(e)},setLogLevel:function(e){s=e;for(var t=0;t<a.length;t++)a[t].setLevel(e);for(var n in o){var r=o[n]||[];for(t=0;t<r.length;t++)r[t].setLevel(e)}},levels:r.levels,LogCollector:i}},function(e,t,n){"use strict";var r=n(68);t.a=new r.a},function(e,t,n){var r,i,o;i=[],void 0===(o="function"==typeof(r=function(){var t,n,r,i,o,a,s;return function(e){function i(e,t){return b.call(e,t)}function o(e,t){var n,r,i,o,a,s,c,u,l,d,p,h=t&&t.split("/"),f=g.map,m=f&&f["*"]||{};if(e){for(a=(e=e.split("/")).length-1,g.nodeIdCompat&&_.test(e[a])&&(e[a]=e[a].replace(_,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),l=0;l<e.length;l++)if("."===(p=e[l]))e.splice(l,1),l-=1;else if(".."===p){if(0===l||1===l&&".."===e[2]||".."===e[l-1])continue;l>0&&(e.splice(l-1,2),l-=2)}e=e.join("/")}if((h||m)&&f){for(l=(n=e.split("/")).length;l>0;l-=1){if(r=n.slice(0,l).join("/"),h)for(d=h.length;d>0;d-=1)if((i=f[h.slice(0,d).join("/")])&&(i=i[r])){o=i,s=l;break}if(o)break;!c&&m&&m[r]&&(c=m[r],u=l)}!o&&c&&(o=c,s=u),o&&(n.splice(0,s,o),e=n.join("/"))}return e}function a(t,n){return function(){var r=S.call(arguments,0);return"string"!=typeof r[0]&&1===r.length&&r.push(null),p.apply(e,r.concat([t,n]))}}function s(e){return function(t){m[e]=t}}function c(t){if(i(v,t)){var n=v[t];delete v[t],y[t]=!0,d.apply(e,n)}if(!i(m,t)&&!i(y,t))throw new Error("No "+t);return m[t]}function u(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function l(e){return e?u(e):[]}var d,p,h,f,m={},v={},g={},y={},b=Object.prototype.hasOwnProperty,S=[].slice,_=/\.js$/;h=function(e,t){var n,r,i=u(e),a=i[0],s=t[1];return e=i[1],a&&(n=c(a=o(a,s))),a?e=n&&n.normalize?n.normalize(e,(r=s,function(e){return o(e,r)})):o(e,s):(a=(i=u(e=o(e,s)))[0],e=i[1],a&&(n=c(a))),{f:a?a+"!"+e:e,n:e,pr:a,p:n}},f={require:function(e){return a(e)},exports:function(e){var t=m[e];return void 0!==t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:(t=e,function(){return g&&g.config&&g.config[t]||{}})};var t}},d=function(t,n,r,o){var u,d,p,g,b,S,_,T=[],C=typeof r;if(S=l(o=o||t),"undefined"===C||"function"===C){for(n=!n.length&&r.length?["require","exports","module"]:n,b=0;b<n.length;b+=1)if("require"===(d=(g=h(n[b],S)).f))T[b]=f.require(t);else if("exports"===d)T[b]=f.exports(t),_=!0;else if("module"===d)u=T[b]=f.module(t);else if(i(m,d)||i(v,d)||i(y,d))T[b]=c(d);else{if(!g.p)throw new Error(t+" missing "+d);g.p.load(g.n,a(o,!0),s(d),{}),T[b]=m[d]}p=r?r.apply(m[t],T):void 0,t&&(u&&u.exports!==e&&u.exports!==m[t]?m[t]=u.exports:p===e&&_||(m[t]=p))}else t&&(m[t]=r)},t=n=p=function(t,n,r,i,o){if("string"==typeof t)return f[t]?f[t](n):c(h(t,l(n)).f);if(!t.splice){if((g=t).deps&&p(g.deps,g.callback),!n)return;n.splice?(t=n,n=r,r=null):t=e}return n=n||function(){},"function"==typeof r&&(r=i,i=o),i?d(e,t,n,r):setTimeout(function(){d(e,t,n,r)},4),p},p.config=function(e){return p(e)},t._defined=m,(r=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),i(m,e)||i(v,e)||(v[e]=[e,t,n])}).amd={jQuery:!0}}(),r("node_modules/almond/almond.js",function(){}),function(e,t){if("function"!=typeof r||!r.amd)return t(e);r("strophe-polyfill",[],function(){return t(e)})}(this,function(e){Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,n=Array.prototype.slice,r=Array.prototype.concat,i=n.call(arguments,1);return function(){return t.apply(e||this,r.call(i,n.call(arguments,0)))}}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){var t=this.length,n=Number(arguments[1])||0;for((n=n<0?Math.ceil(n):Math.floor(n))<0&&(n+=t);n<t;n++)if(n in this&&this[n]===e)return n;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){var n,r;if(null===this)throw new TypeError(" this is null or not defined");var i=Object(this),o=i.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=0;r<o;){var a;r in i&&(a=i[r],e.call(n,a,r,i)),r++}});var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.btoa||(e.btoa=function(e){var n,r,i,o,a,s,c,u="",l=0;do{o=(n=e.charCodeAt(l++))>>2,a=(3&n)<<4|(r=e.charCodeAt(l++))>>4,s=(15&r)<<2|(i=e.charCodeAt(l++))>>6,c=63&i,isNaN(r)?(a=(3&n)<<4,s=c=64):isNaN(i)&&(c=64),u=u+t.charAt(o)+t.charAt(a)+t.charAt(s)+t.charAt(c)}while(l<e.length);return u}),e.atob||(e.atob=function(e){var n,r,i,o,a,s,c="",u=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{n=t.indexOf(e.charAt(u++))<<2|(o=t.indexOf(e.charAt(u++)))>>4,r=(15&o)<<4|(a=t.indexOf(e.charAt(u++)))>>2,i=(3&a)<<6|(s=t.indexOf(e.charAt(u++))),c+=String.fromCharCode(n),64!==a&&(c+=String.fromCharCode(r)),64!==s&&(c+=String.fromCharCode(i))}while(u<e.length);return c})}),i=function(){function e(e,n){e[n>>5]|=128<<24-n%32,e[15+(n+64>>9<<4)]=n;var o,a,s,c,u,l,d,p,h,f=new Array(80),m=1732584193,v=-271733879,g=-1732584194,y=271733878,b=-1009589776;for(o=0;o<e.length;o+=16){for(c=m,u=v,l=g,d=y,p=b,a=0;a<80;a++)f[a]=a<16?e[o+a]:i(f[a-3]^f[a-8]^f[a-14]^f[a-16],1),s=r(r(i(m,5),t(a,v,g,y)),r(r(b,f[a]),(h=a)<20?1518500249:h<40?1859775393:h<60?-1894007588:-899497514)),b=y,y=g,g=i(v,30),v=m,m=s;m=r(m,c),v=r(v,u),g=r(g,l),y=r(y,d),b=r(b,p)}return[m,v,g,y,b]}function t(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function n(t,n){var r=o(t);r.length>16&&(r=e(r,8*t.length));for(var i=new Array(16),a=new Array(16),s=0;s<16;s++)i[s]=909522486^r[s],a[s]=1549556828^r[s];var c=e(i.concat(o(n)),512+8*n.length);return e(a.concat(c),672)}function r(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function i(e,t){return e<<t|e>>>32-t}function o(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}function a(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}function s(e){for(var t,n,r="",i=0;i<4*e.length;i+=3)for(t=(e[i>>2]>>8*(3-i%4)&255)<<16|(e[i+1>>2]>>8*(3-(i+1)%4)&255)<<8|e[i+2>>2]>>8*(3-(i+2)%4)&255,n=0;n<4;n++)8*i+6*n>32*e.length?r+="=":r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t>>6*(3-n)&63);return r}return{b64_hmac_sha1:function(e,t){return s(n(e,t))},b64_sha1:function(t){return s(e(o(t),8*t.length))},binb2str:a,core_hmac_sha1:n,str_hmac_sha1:function(e,t){return a(n(e,t))},str_sha1:function(t){return a(e(o(t),8*t.length))}}},"function"==typeof r&&r.amd?r("strophe-sha1",[],function(){return i()}):e.exports=i(),o=function(){var e=function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},t=function(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<n%32;return t},n=function(t,n,r,i,o,a){return e((s=e(e(n,t),e(i,a)))<<(c=o)|s>>>32-c,r);var s,c},r=function(e,t,r,i,o,a,s){return n(t&r|~t&i,e,t,o,a,s)},i=function(e,t,r,i,o,a,s){return n(t&i|r&~i,e,t,o,a,s)},o=function(e,t,r,i,o,a,s){return n(t^r^i,e,t,o,a,s)},a=function(e,t,r,i,o,a,s){return n(r^(t|~i),e,t,o,a,s)},s=function(t,n){t[n>>5]|=128<<n%32,t[14+(n+64>>>9<<4)]=n;for(var s,c,u,l,d=1732584193,p=-271733879,h=-1732584194,f=271733878,m=0;m<t.length;m+=16)s=d,c=p,u=h,l=f,d=r(d,p,h,f,t[m+0],7,-680876936),f=r(f,d,p,h,t[m+1],12,-389564586),h=r(h,f,d,p,t[m+2],17,606105819),p=r(p,h,f,d,t[m+3],22,-1044525330),d=r(d,p,h,f,t[m+4],7,-176418897),f=r(f,d,p,h,t[m+5],12,1200080426),h=r(h,f,d,p,t[m+6],17,-1473231341),p=r(p,h,f,d,t[m+7],22,-45705983),d=r(d,p,h,f,t[m+8],7,1770035416),f=r(f,d,p,h,t[m+9],12,-1958414417),h=r(h,f,d,p,t[m+10],17,-42063),p=r(p,h,f,d,t[m+11],22,-1990404162),d=r(d,p,h,f,t[m+12],7,1804603682),f=r(f,d,p,h,t[m+13],12,-40341101),h=r(h,f,d,p,t[m+14],17,-1502002290),p=r(p,h,f,d,t[m+15],22,1236535329),d=i(d,p,h,f,t[m+1],5,-165796510),f=i(f,d,p,h,t[m+6],9,-1069501632),h=i(h,f,d,p,t[m+11],14,643717713),p=i(p,h,f,d,t[m+0],20,-373897302),d=i(d,p,h,f,t[m+5],5,-701558691),f=i(f,d,p,h,t[m+10],9,38016083),h=i(h,f,d,p,t[m+15],14,-660478335),p=i(p,h,f,d,t[m+4],20,-405537848),d=i(d,p,h,f,t[m+9],5,568446438),f=i(f,d,p,h,t[m+14],9,-1019803690),h=i(h,f,d,p,t[m+3],14,-187363961),p=i(p,h,f,d,t[m+8],20,1163531501),d=i(d,p,h,f,t[m+13],5,-1444681467),f=i(f,d,p,h,t[m+2],9,-51403784),h=i(h,f,d,p,t[m+7],14,1735328473),p=i(p,h,f,d,t[m+12],20,-1926607734),d=o(d,p,h,f,t[m+5],4,-378558),f=o(f,d,p,h,t[m+8],11,-2022574463),h=o(h,f,d,p,t[m+11],16,1839030562),p=o(p,h,f,d,t[m+14],23,-35309556),d=o(d,p,h,f,t[m+1],4,-1530992060),f=o(f,d,p,h,t[m+4],11,1272893353),h=o(h,f,d,p,t[m+7],16,-155497632),p=o(p,h,f,d,t[m+10],23,-1094730640),d=o(d,p,h,f,t[m+13],4,681279174),f=o(f,d,p,h,t[m+0],11,-358537222),h=o(h,f,d,p,t[m+3],16,-722521979),p=o(p,h,f,d,t[m+6],23,76029189),d=o(d,p,h,f,t[m+9],4,-640364487),f=o(f,d,p,h,t[m+12],11,-421815835),h=o(h,f,d,p,t[m+15],16,530742520),p=o(p,h,f,d,t[m+2],23,-995338651),d=a(d,p,h,f,t[m+0],6,-198630844),f=a(f,d,p,h,t[m+7],10,1126891415),h=a(h,f,d,p,t[m+14],15,-1416354905),p=a(p,h,f,d,t[m+5],21,-57434055),d=a(d,p,h,f,t[m+12],6,1700485571),f=a(f,d,p,h,t[m+3],10,-1894986606),h=a(h,f,d,p,t[m+10],15,-1051523),p=a(p,h,f,d,t[m+1],21,-2054922799),d=a(d,p,h,f,t[m+8],6,1873313359),f=a(f,d,p,h,t[m+15],10,-30611744),h=a(h,f,d,p,t[m+6],15,-1560198380),p=a(p,h,f,d,t[m+13],21,1309151649),d=a(d,p,h,f,t[m+4],6,-145523070),f=a(f,d,p,h,t[m+11],10,-1120210379),h=a(h,f,d,p,t[m+2],15,718787259),p=a(p,h,f,d,t[m+9],21,-343485551),d=e(d,s),p=e(p,c),h=e(h,u),f=e(f,l);return[d,p,h,f]};return{hexdigest:function(e){return function(e){for(var t="0123456789abcdef",n="",r=0;r<4*e.length;r++)n+=t.charAt(e[r>>2]>>r%4*8+4&15)+t.charAt(e[r>>2]>>r%4*8&15);return n}(s(t(e),8*e.length))},hash:function(e){return function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}(s(t(e),8*e.length))}}},"function"==typeof r&&r.amd?r("strophe-md5",[],function(){return o()}):e.exports=o(),a=function(){return{utf16to8:function(e){var t,n,r="",i=e.length;for(t=0;t<i;t++)(n=e.charCodeAt(t))>=0&&n<=127?r+=e.charAt(t):n>2047?(r+=String.fromCharCode(224|n>>12&15),r+=String.fromCharCode(128|n>>6&63),r+=String.fromCharCode(128|n>>0&63)):(r+=String.fromCharCode(192|n>>6&31),r+=String.fromCharCode(128|n>>0&63));return r},addCookies:function(e){var t,n,r,i,o,a,s;for(t in e||{})o="",a="",s="",r="object"==typeof(n=e[t]),i=escape(unescape(r?n.value:n)),r&&(o=n.expires?";expires="+n.expires:"",a=n.domain?";domain="+n.domain:"",s=n.path?";path="+n.path:""),document.cookie=t+"="+i+o+a+s}}},"function"==typeof r&&r.amd?r("strophe-utils",[],function(){return a()}):e.exports=a(),s=function(e,t,n){function r(e,t){return new a.Builder(e,t)}function i(e){return new a.Builder("iq",e)}function o(e){return new a.Builder("presence",e)}var a;return(a={VERSION:"1.2.14-1",NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",FRAMING:"urn:ietf:params:xml:ns:xmpp-framing",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas",XHTML_IM:"http://jabber.org/protocol/xhtml-im",XHTML:"http://www.w3.org/1999/xhtml"},XHTML:{tags:["a","blockquote","br","cite","em","img","li","ol","p","span","strong","ul","body"],attributes:{a:["href"],blockquote:["style"],br:[],cite:["style"],em:[],img:["src","alt","style","height","width"],li:["style"],ol:["style"],p:["style"],span:["style"],strong:[],ul:["style"],body:[]},css:["background-color","color","font-family","font-size","font-style","font-weight","margin-left","margin-right","text-align","text-decoration"],validTag:function(e){for(var t=0;t<a.XHTML.tags.length;t++)if(e===a.XHTML.tags[t])return!0;return!1},validAttribute:function(e,t){if(void 0!==a.XHTML.attributes[e]&&a.XHTML.attributes[e].length>0)for(var n=0;n<a.XHTML.attributes[e].length;n++)if(t===a.XHTML.attributes[e][n])return!0;return!1},validCSS:function(e){for(var t=0;t<a.XHTML.css.length;t++)if(e===a.XHTML.css[t])return!0;return!1}},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8,REDIRECT:9,CONNTIMEOUT:10},ErrorCondition:{BAD_FORMAT:"bad-format",CONFLICT:"conflict",MISSING_JID_NODE:"x-strophe-bad-non-anon-jid",NO_AUTH_MECH:"no-auth-mech",UNKNOWN_REASON:"unknown"},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3,CDATA:4,FRAGMENT:11},TIMEOUT:1.1,SECONDARY_TIMEOUT:.1,addNamespace:function(e,t){a.NS[e]=t},forEachChild:function(e,t,n){var r,i;for(r=0;r<e.childNodes.length;r++)(i=e.childNodes[r]).nodeType!==a.ElementType.NORMAL||t&&!this.isTagEqual(i,t)||n(i)},isTagEqual:function(e,t){return e.tagName===t},_xmlGenerator:null,_makeGenerator:function(){var e;return void 0===document.implementation.createDocument||document.implementation.createDocument&&document.documentMode&&document.documentMode<10?(e=this._getIEXmlDom()).appendChild(e.createElement("strophe")):e=document.implementation.createDocument("jabber:client","strophe",null),e},xmlGenerator:function(){return a._xmlGenerator||(a._xmlGenerator=a._makeGenerator()),a._xmlGenerator},_getIEXmlDom:function(){for(var e=null,t=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"],n=0;n<t.length&&null===e;n++)try{e=new ActiveXObject(t[n])}catch(t){e=null}return e},xmlElement:function(e){if(!e)return null;var t,n,r,i=a.xmlGenerator().createElement(e);for(t=1;t<arguments.length;t++){var o=arguments[t];if(o)if("string"==typeof o||"number"==typeof o)i.appendChild(a.xmlTextNode(o));else if("object"==typeof o&&"function"==typeof o.sort)for(n=0;n<o.length;n++){var s=o[n];"object"==typeof s&&"function"==typeof s.sort&&void 0!==s[1]&&null!==s[1]&&i.setAttribute(s[0],s[1])}else if("object"==typeof o)for(r in o)o.hasOwnProperty(r)&&void 0!==o[r]&&null!==o[r]&&i.setAttribute(r,o[r])}return i},xmlescape:function(e){return e=(e=(e=(e=(e=e.replace(/\&/g,"&")).replace(/</g,"<")).replace(/>/g,">")).replace(/'/g,"'")).replace(/"/g,""")},xmlunescape:function(e){return e=(e=(e=(e=(e=e.replace(/\&/g,"&")).replace(/</g,"<")).replace(/>/g,">")).replace(/'/g,"'")).replace(/"/g,'"')},xmlTextNode:function(e){return a.xmlGenerator().createTextNode(e)},xmlHtmlNode:function(e){var t;return DOMParser?t=(new DOMParser).parseFromString(e,"text/xml"):((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)),t},getText:function(e){if(!e)return null;var t="";0===e.childNodes.length&&e.nodeType===a.ElementType.TEXT&&(t+=e.nodeValue);for(var n=0;n<e.childNodes.length;n++)e.childNodes[n].nodeType===a.ElementType.TEXT&&(t+=e.childNodes[n].nodeValue);return a.xmlescape(t)},copyElement:function(e){var t,n;if(e.nodeType===a.ElementType.NORMAL){for(n=a.xmlElement(e.tagName),t=0;t<e.attributes.length;t++)n.setAttribute(e.attributes[t].nodeName,e.attributes[t].value);for(t=0;t<e.childNodes.length;t++)n.appendChild(a.copyElement(e.childNodes[t]))}else e.nodeType===a.ElementType.TEXT&&(n=a.xmlGenerator().createTextNode(e.nodeValue));return n},createHtml:function(e){var t,n,r,i,o,s,c,u,l,d,p;if(e.nodeType===a.ElementType.NORMAL)if(i=e.nodeName.toLowerCase(),a.XHTML.validTag(i))try{for(n=a.xmlElement(i),t=0;t<a.XHTML.attributes[i].length;t++)if(o=a.XHTML.attributes[i][t],void 0!==(s=e.getAttribute(o))&&null!==s&&""!==s&&!1!==s&&0!==s)if("style"===o&&"object"==typeof s&&void 0!==s.cssText&&(s=s.cssText),"style"===o){for(c=[],u=s.split(";"),r=0;r<u.length;r++)d=(l=u[r].split(":"))[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase(),a.XHTML.validCSS(d)&&(p=l[1].replace(/^\s*/,"").replace(/\s*$/,""),c.push(d+": "+p));c.length>0&&(s=c.join("; "),n.setAttribute(o,s))}else n.setAttribute(o,s);for(t=0;t<e.childNodes.length;t++)n.appendChild(a.createHtml(e.childNodes[t]))}catch(e){n=a.xmlTextNode("")}else for(n=a.xmlGenerator().createDocumentFragment(),t=0;t<e.childNodes.length;t++)n.appendChild(a.createHtml(e.childNodes[t]));else if(e.nodeType===a.ElementType.FRAGMENT)for(n=a.xmlGenerator().createDocumentFragment(),t=0;t<e.childNodes.length;t++)n.appendChild(a.createHtml(e.childNodes[t]));else e.nodeType===a.ElementType.TEXT&&(n=a.xmlTextNode(e.nodeValue));return n},escapeNode:function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(e){return"string"!=typeof e?e:e.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(e){return e.indexOf("@")<0?null:e.split("@")[0]},getDomainFromJid:function(e){var t=a.getBareJidFromJid(e);if(t.indexOf("@")<0)return t;var n=t.split("@");return n.splice(0,1),n.join("@")},getResourceFromJid:function(e){var t=e.split("/");return t.length<2?null:(t.splice(0,1),t.join("/"))},getBareJidFromJid:function(e){return e?e.split("/")[0]:null},_handleError:function(e){void 0!==e.stack&&a.fatal(e.stack),e.sourceURL?a.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?a.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):a.fatal("error: "+e.message)},log:function(e,t){},debug:function(e){this.log(this.LogLevel.DEBUG,e)},info:function(e){this.log(this.LogLevel.INFO,e)},warn:function(e){this.log(this.LogLevel.WARN,e)},error:function(e){this.log(this.LogLevel.ERROR,e)},fatal:function(e){this.log(this.LogLevel.FATAL,e)},serialize:function(e){var t;if(!e)return null;"function"==typeof e.tree&&(e=e.tree());var n,r,i=e.nodeName;for(e.getAttribute("_realname")&&(i=e.getAttribute("_realname")),t="<"+i,n=0;n<e.attributes.length;n++)"_realname"!==e.attributes[n].nodeName&&(t+=" "+e.attributes[n].nodeName+"='"+a.xmlescape(e.attributes[n].value)+"'");if(e.childNodes.length>0){for(t+=">",n=0;n<e.childNodes.length;n++)switch((r=e.childNodes[n]).nodeType){case a.ElementType.NORMAL:t+=a.serialize(r);break;case a.ElementType.TEXT:t+=a.xmlescape(r.nodeValue);break;case a.ElementType.CDATA:t+="<![CDATA["+r.nodeValue+"]]>"}t+="</"+i+">"}else t+="/>";return t},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(e,t){a._connectionPlugins[e]=t}}).Builder=function(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=a.NS.CLIENT:t||(t={xmlns:a.NS.CLIENT})),this.nodeTree=a.xmlElement(e,t),this.node=this.nodeTree},a.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return a.serialize(this.nodeTree)},up:function(){return this.node=this.node.parentNode,this},root:function(){return this.node=this.nodeTree,this},attrs:function(e){for(var t in e)e.hasOwnProperty(t)&&(void 0===e[t]?this.node.removeAttribute(t):this.node.setAttribute(t,e[t]));return this},c:function(e,t,n){var r=a.xmlElement(e,t,n);return this.node.appendChild(r),"string"!=typeof n&&"number"!=typeof n&&(this.node=r),this},cnode:function(e){var t,n=a.xmlGenerator();try{t=void 0!==n.importNode}catch(e){t=!1}var r=t?n.importNode(e,!0):a.copyElement(e);return this.node.appendChild(r),this.node=r,this},t:function(e){var t=a.xmlTextNode(e);return this.node.appendChild(t),this},h:function(e){var t=document.createElement("body");t.innerHTML=e;for(var n=a.createHtml(t);n.childNodes.length>0;)this.node.appendChild(n.childNodes[0]);return this}},a.Handler=function(e,t,n,r,i,o,s){this.handler=e,this.ns=t,this.name=n,this.type=r,this.id=i,this.options=s||{matchBareFromJid:!1,ignoreNamespaceFragment:!1},this.options.matchBare&&(a.warn('The "matchBare" option is deprecated, use "matchBareFromJid" instead.'),this.options.matchBareFromJid=this.options.matchBare,delete this.options.matchBare),this.options.matchBareFromJid?this.from=o?a.getBareJidFromJid(o):null:this.from=o,this.user=!0},a.Handler.prototype={getNamespace:function(e){var t=e.getAttribute("xmlns");return t&&this.options.ignoreNamespaceFragment&&(t=t.split("#")[0]),t},namespaceMatch:function(e){var t=!1;if(!this.ns)return!0;var n=this;return a.forEachChild(e,null,function(e){n.getNamespace(e)===n.ns&&(t=!0)}),t=t||this.getNamespace(e)===this.ns},isMatch:function(e){var t=e.getAttribute("from");this.options.matchBareFromJid&&(t=a.getBareJidFromJid(t));var n=e.getAttribute("type");return!(!this.namespaceMatch(e)||this.name&&!a.isTagEqual(e,this.name)||this.type&&(Array.isArray(this.type)?-1===this.type.indexOf(n):n!==this.type)||this.id&&e.getAttribute("id")!==this.id||this.from&&t!==this.from)},run:function(e){var t=null;try{t=this.handler(e)}catch(e){throw a._handleError(e),e}return t},toString:function(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},a.TimedHandler=function(e,t){this.period=e,this.handler=t,this.lastCalled=(new Date).getTime(),this.user=!0},a.TimedHandler.prototype={run:function(){return this.lastCalled=(new Date).getTime(),this.handler()},reset:function(){this.lastCalled=(new Date).getTime()},toString:function(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}},a.Connection=function(e,t){this.service=e,this.options=t||{};var r=this.options.protocol||"";0===e.indexOf("ws:")||0===e.indexOf("wss:")||0===r.indexOf("ws")?this._proto=new a.Websocket(this):this._proto=new a.Bosh(this),this.jid="",this.domain=null,this.features=null,this._sasl_data={},this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this.protocolErrorHandlers={HTTP:{},websocket:{}},this._idleTimeout=null,this._disconnectTimeout=null,this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.do_authentication=!0,this.paused=!1,this.restored=!1,this._data=[],this._uniqueId=0,this._sasl_success_handler=null,this._sasl_failure_handler=null,this._sasl_challenge_handler=null,this.maxRetries=5,this._idleTimeout=setTimeout(function(){this._onIdle()}.bind(this),100),n.addCookies(this.options.cookies),this.registerSASLMechanisms(this.options.mechanisms);for(var i in a._connectionPlugins)if(a._connectionPlugins.hasOwnProperty(i)){var o=a._connectionPlugins[i],s=function(){};s.prototype=o,this[i]=new s,this[i].init(this)}},a.Connection.prototype={reset:function(){this._proto._reset(),this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.restored=!1,this._data=[],this._requests=[],this._uniqueId=0},pause:function(){this.paused=!0},resume:function(){this.paused=!1},getUniqueId:function(e){var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});return"string"==typeof e||"number"==typeof e?t+":"+e:t+""},addProtocolErrorHandler:function(e,t,n){this.protocolErrorHandlers[e][t]=n},connect:function(e,t,n,r,i,o,s){this.jid=e,this.authzid=a.getBareJidFromJid(this.jid),this.authcid=s||a.getNodeFromJid(this.jid),this.pass=t,this.servtype="xmpp",this.connect_callback=n,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.domain=a.getDomainFromJid(this.jid),this._changeConnectStatus(a.Status.CONNECTING,null),this._proto._connect(r,i,o)},attach:function(e,t,n,r,i,o,s){if(!(this._proto instanceof a.Bosh))throw{name:"StropheSessionError",message:'The "attach" method can only be used with a BOSH connection.'};this._proto._attach(e,t,n,r,i,o,s)},restore:function(e,t,n,r,i){if(!this._sessionCachingSupported())throw{name:"StropheSessionError",message:'The "restore" method can only be used with a BOSH connection.'};this._proto._restore(e,t,n,r,i)},_sessionCachingSupported:function(){if(this._proto instanceof a.Bosh){if(!JSON)return!1;try{sessionStorage.setItem("_strophe_","_strophe_"),sessionStorage.removeItem("_strophe_")}catch(e){return!1}return!0}return!1},xmlInput:function(e){},xmlOutput:function(e){},rawInput:function(e){},rawOutput:function(e){},nextValidRid:function(e){},send:function(e){if(null!==e){if("function"==typeof e.sort)for(var t=0;t<e.length;t++)this._queueData(e[t]);else"function"==typeof e.tree?this._queueData(e.tree()):this._queueData(e);this._proto._send()}},flush:function(){clearTimeout(this._idleTimeout),this._onIdle()},sendPresence:function(e,t,n,r){var i=null,o=this;"function"==typeof e.tree&&(e=e.tree());var a=e.getAttribute("id");if(a||(a=this.getUniqueId("sendPresence"),e.setAttribute("id",a)),"function"==typeof t||"function"==typeof n){var s=this.addHandler(function(e){i&&o.deleteTimedHandler(i),"error"===e.getAttribute("type")?n&&n(e):t&&t(e)},null,"presence",null,a);r&&(i=this.addTimedHandler(r,function(){return o.deleteHandler(s),n&&n(null),!1}))}return this.send(e),a},sendIQ:function(e,t,n,r){var i=null,o=this;"function"==typeof e.tree&&(e=e.tree());var a=e.getAttribute("id");if(a||(a=this.getUniqueId("sendIQ"),e.setAttribute("id",a)),"function"==typeof t||"function"==typeof n){var s=this.addHandler(function(e){i&&o.deleteTimedHandler(i);var r=e.getAttribute("type");if("result"===r)t&&t(e);else{if("error"!==r)throw{name:"StropheError",message:"Got bad IQ type of "+r};n&&n(e)}},null,"iq",["error","result"],a);r&&(i=this.addTimedHandler(r,function(){return o.deleteHandler(s),n&&n(null),!1}))}return this.send(e),a},_queueData:function(e){if(null===e||!e.tagName||!e.childNodes)throw{name:"StropheError",message:"Cannot queue non-DOMElement."};this._data.push(e)},_sendRestart:function(){this._data.push("restart"),this._proto._sendRestart(),this._idleTimeout=setTimeout(function(){this._onIdle()}.bind(this),100)},addTimedHandler:function(e,t){var n=new a.TimedHandler(e,t);return this.addTimeds.push(n),n},deleteTimedHandler:function(e){this.removeTimeds.push(e)},addHandler:function(e,t,n,r,i,o,s){var c=new a.Handler(e,t,n,r,i,o,s);return this.addHandlers.push(c),c},deleteHandler:function(e){this.removeHandlers.push(e);var t=this.addHandlers.indexOf(e);t>=0&&this.addHandlers.splice(t,1)},registerSASLMechanisms:function(e){this.mechanisms={},(e=e||[a.SASLAnonymous,a.SASLExternal,a.SASLMD5,a.SASLOAuthBearer,a.SASLXOAuth2,a.SASLPlain,a.SASLSHA1]).forEach(this.registerSASLMechanism.bind(this))},registerSASLMechanism:function(e){this.mechanisms[e.prototype.name]=e},disconnect:function(e){if(this._changeConnectStatus(a.Status.DISCONNECTING,e),a.info("Disconnect was called because: "+e),this.connected){var t=!1;this.disconnecting=!0,this.authenticated&&(t=o({xmlns:a.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(t)}else a.info("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests(),this._doDisconnect()},_changeConnectStatus:function(e,t,n){for(var r in a._connectionPlugins)if(a._connectionPlugins.hasOwnProperty(r)){var i=this[r];if(i.statusChanged)try{i.statusChanged(e,t)}catch(e){a.error(r+" plugin caused an exception changing status: "+e)}}if(this.connect_callback)try{this.connect_callback(e,t,n)}catch(e){a._handleError(e),a.error("User connection callback caused an exception: "+e)}},_doDisconnect:function(e){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),a.info("_doDisconnect was called"),this._proto._doDisconnect(),this.authenticated=!1,this.disconnecting=!1,this.restored=!1,this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._changeConnectStatus(a.Status.DISCONNECTED,e),this.connected=!1},_dataRecv:function(e,t){a.info("_dataRecv called");var n=this._proto._reqToData(e);if(null!==n){var r,i;for(this.xmlInput!==a.Connection.prototype.xmlInput&&(n.nodeName===this._proto.strip&&n.childNodes.length?this.xmlInput(n.childNodes[0]):this.xmlInput(n)),this.rawInput!==a.Connection.prototype.rawInput&&(t?this.rawInput(t):this.rawInput(a.serialize(n)));this.removeHandlers.length>0;)i=this.removeHandlers.pop(),(r=this.handlers.indexOf(i))>=0&&this.handlers.splice(r,1);for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue())this._doDisconnect();else{var o,s,c=n.getAttribute("type");if(null!==c&&"terminate"===c){if(this.disconnecting)return;return o=n.getAttribute("condition"),s=n.getElementsByTagName("conflict"),null!==o?("remote-stream-error"===o&&s.length>0&&(o="conflict"),this._changeConnectStatus(a.Status.CONNFAIL,o)):this._changeConnectStatus(a.Status.CONNFAIL,a.ErrorCondition.UNKOWN_REASON),void this._doDisconnect(o)}var u=this;a.forEachChild(n,null,function(e){var t,n;for(n=u.handlers,u.handlers=[],t=0;t<n.length;t++){var r=n[t];try{!r.isMatch(e)||!u.authenticated&&r.user?u.handlers.push(r):r.run(e)&&u.handlers.push(r)}catch(e){a.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}}})}}},mechanisms:{},_no_auth_received:function(e){a.error("Server did not offer a supported authentication mechanism"),this._changeConnectStatus(a.Status.CONNFAIL,a.ErrorCondition.NO_AUTH_MECH),e&&e.call(this),this._doDisconnect()},_connect_cb:function(e,t,n){var r;a.info("_connect_cb was called"),this.connected=!0;try{r=this._proto._reqToData(e)}catch(e){if("badformat"!==e)throw e;this._changeConnectStatus(a.Status.CONNFAIL,a.ErrorCondition.BAD_FORMAT),this._doDisconnect(a.ErrorCondition.BAD_FORMAT)}if(r&&(this.xmlInput!==a.Connection.prototype.xmlInput&&(r.nodeName===this._proto.strip&&r.childNodes.length?this.xmlInput(r.childNodes[0]):this.xmlInput(r)),this.rawInput!==a.Connection.prototype.rawInput&&(n?this.rawInput(n):this.rawInput(a.serialize(r))),this._proto._connect_cb(r)!==a.Status.CONNFAIL))if(r.getElementsByTagNameNS?r.getElementsByTagNameNS(a.NS.STREAM,"features").length>0:r.getElementsByTagName("stream:features").length>0||r.getElementsByTagName("features").length>0){var i,o,s=[],c=r.getElementsByTagName("mechanism");if(c.length>0)for(i=0;i<c.length;i++)o=a.getText(c[i]),this.mechanisms[o]&&s.push(this.mechanisms[o]);0!==s.length||0!==r.getElementsByTagName("auth").length?!1!==this.do_authentication&&this.authenticate(s):this._no_auth_received(t)}else this._no_auth_received(t)},sortMechanismsByPriority:function(e){var t,n,r,i;for(t=0;t<e.length-1;++t){for(r=t,n=t+1;n<e.length;++n)e[n].prototype.priority>e[r].prototype.priority&&(r=n);r!==t&&(i=e[t],e[t]=e[r],e[r]=i)}return e},_attemptSASLAuth:function(e){e=this.sortMechanismsByPriority(e||[]);var t=0,n=!1;for(t=0;t<e.length;++t)if(e[t].prototype.test(this)){this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge_cb.bind(this),null,"challenge",null,null),this._sasl_mechanism=new e[t],this._sasl_mechanism.onStart(this);var i=r("auth",{xmlns:a.NS.SASL,mechanism:this._sasl_mechanism.name});if(this._sasl_mechanism.isClientFirst){var o=this._sasl_mechanism.onChallenge(this,null);i.t(btoa(o))}this.send(i.tree()),n=!0;break}return n},_attemptLegacyAuth:function(){null===a.getNodeFromJid(this.jid)?(this._changeConnectStatus(a.Status.CONNFAIL,a.ErrorCondition.MISSING_JID_NODE),this.disconnect(a.ErrorCondition.MISSING_JID_NODE)):(this._changeConnectStatus(a.Status.AUTHENTICATING,null),this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1"),this.send(i({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:a.NS.AUTH}).c("username",{}).t(a.getNodeFromJid(this.jid)).tree()))},authenticate:function(e){this._attemptSASLAuth(e)||this._attemptLegacyAuth()},_sasl_challenge_cb:function(e){var t=atob(a.getText(e)),n=this._sasl_mechanism.onChallenge(this,t),i=r("response",{xmlns:a.NS.SASL});return""!==n&&i.t(btoa(n)),this.send(i.tree()),!0},_auth1_cb:function(e){var t=i({type:"set",id:"_auth_2"}).c("query",{xmlns:a.NS.AUTH}).c("username",{}).t(a.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return a.getResourceFromJid(this.jid)||(this.jid=a.getBareJidFromJid(this.jid)+"/strophe"),t.up().c("resource",{}).t(a.getResourceFromJid(this.jid)),this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2"),this.send(t.tree()),!1},_sasl_success_cb:function(e){if(this._sasl_data["server-signature"]){var t,n=atob(a.getText(e)).match(/([a-z]+)=([^,]+)(,|$)/);if("v"===n[1]&&(t=n[2]),t!==this._sasl_data["server-signature"])return this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_data={},this._sasl_failure_cb(null)}a.info("SASL authentication succeeded."),this._sasl_mechanism&&this._sasl_mechanism.onSuccess(),this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null);var r=[],i=function(e,t){for(;e.length;)this.deleteHandler(e.pop());return this._sasl_auth1_cb.bind(this)(t),!1};return r.push(this._addSysHandler(function(e){i.bind(this)(r,e)}.bind(this),null,"stream:features",null,null)),r.push(this._addSysHandler(function(e){i.bind(this)(r,e)}.bind(this),a.NS.STREAM,"features",null,null)),this._sendRestart(),!1},_sasl_auth1_cb:function(e){var t,n;for(this.features=e,t=0;t<e.childNodes.length;t++)"bind"===(n=e.childNodes[t]).nodeName&&(this.do_bind=!0),"session"===n.nodeName&&(this.do_session=!0);if(!this.do_bind)return this._changeConnectStatus(a.Status.AUTHFAIL,null),!1;this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");var r=a.getResourceFromJid(this.jid);return r?this.send(i({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:a.NS.BIND}).c("resource",{}).t(r).tree()):this.send(i({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:a.NS.BIND}).tree()),!1},_sasl_bind_cb:function(e){var t;if("error"===e.getAttribute("type"))return a.info("SASL binding failed."),e.getElementsByTagName("conflict").length>0&&(t=a.ErrorCondition.CONFLICT),this._changeConnectStatus(a.Status.AUTHFAIL,t,e),!1;var n,r=e.getElementsByTagName("bind");if(!(r.length>0))return a.info("SASL binding failed."),this._changeConnectStatus(a.Status.AUTHFAIL,null,e),!1;(n=r[0].getElementsByTagName("jid")).length>0&&(this.jid=a.getText(n[0]),this.do_session?(this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2"),this.send(i({type:"set",id:"_session_auth_2"}).c("session",{xmlns:a.NS.SESSION}).tree())):(this.authenticated=!0,this._changeConnectStatus(a.Status.CONNECTED,null)))},_sasl_session_cb:function(e){if("result"===e.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(a.Status.CONNECTED,null);else if("error"===e.getAttribute("type"))return a.info("Session creation failed."),this._changeConnectStatus(a.Status.AUTHFAIL,null,e),!1;return!1},_sasl_failure_cb:function(e){return this._sasl_success_handler&&(this.deleteHandler(this._sasl_success_handler),this._sasl_success_handler=null),this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_mechanism&&this._sasl_mechanism.onFailure(),this._changeConnectStatus(a.Status.AUTHFAIL,null,e),!1},_auth2_cb:function(e){return"result"===e.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(a.Status.CONNECTED,null)):"error"===e.getAttribute("type")&&(this._changeConnectStatus(a.Status.AUTHFAIL,null,e),this.disconnect("authentication failed")),!1},_addSysTimedHandler:function(e,t){var n=new a.TimedHandler(e,t);return n.user=!1,this.addTimeds.push(n),n},_addSysHandler:function(e,t,n,r,i){var o=new a.Handler(e,t,n,r,i);return o.user=!1,this.addHandlers.push(o),o},_onDisconnectTimeout:function(){return a.info("_onDisconnectTimeout was called"),this._changeConnectStatus(a.Status.CONNTIMEOUT,null),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1},_onIdle:function(){for(var e,t,n;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;)t=this.removeTimeds.pop(),(e=this.timedHandlers.indexOf(t))>=0&&this.timedHandlers.splice(e,1);var r=(new Date).getTime();for(n=[],e=0;e<this.timedHandlers.length;e++)t=this.timedHandlers[e],!this.authenticated&&t.user||(t.lastCalled+t.period-r<=0?t.run()&&n.push(t):n.push(t));this.timedHandlers=n,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout(function(){this._onIdle()}.bind(this),100))}},a.SASLMechanism=function(e,t,n){this.name=e,this.isClientFirst=t,this.priority=n},a.SASLMechanism.prototype={test:function(e){return!0},onStart:function(e){this._connection=e},onChallenge:function(e,t){throw new Error("You should implement challenge handling!")},onFailure:function(){this._connection=null},onSuccess:function(){this._connection=null}},a.SASLAnonymous=function(){},a.SASLAnonymous.prototype=new a.SASLMechanism("ANONYMOUS",!1,20),a.SASLAnonymous.prototype.test=function(e){return null===e.authcid},a.SASLPlain=function(){},a.SASLPlain.prototype=new a.SASLMechanism("PLAIN",!0,30),a.SASLPlain.prototype.test=function(e){return null!==e.authcid},a.SASLPlain.prototype.onChallenge=function(e){var t=e.authzid;return t+="\0",t+=e.authcid,t+="\0",t+=e.pass,n.utf16to8(t)},a.SASLSHA1=function(){},a.SASLSHA1.prototype=new a.SASLMechanism("SCRAM-SHA-1",!0,50),a.SASLSHA1.prototype.test=function(e){return null!==e.authcid},a.SASLSHA1.prototype.onChallenge=function(r,i,o){var a=o||t.hexdigest(1234567890*Math.random()),s="n="+n.utf16to8(r.authcid);return s+=",r=",s+=a,r._sasl_data.cnonce=a,r._sasl_data["client-first-message-bare"]=s,s="n,,"+s,this.onChallenge=function(t,r){for(var i,o,a,s,c,u,l,d,p,h,f,m,v="c=biws,",g=t._sasl_data["client-first-message-bare"]+","+r+",",y=t._sasl_data.cnonce,b=/([a-z]+)=([^,]+)(,|$)/;r.match(b);){var S=r.match(b);switch(r=r.replace(S[0],""),S[1]){case"r":i=S[2];break;case"s":o=S[2];break;case"i":a=S[2]}}if(i.substr(0,y.length)!==y)return t._sasl_data={},t._sasl_failure_cb();for(g+=v+="r="+i,o=atob(o),o+="\0\0\0",p=n.utf16to8(t.pass),s=u=e.core_hmac_sha1(p,o),l=1;l<a;l++){for(c=e.core_hmac_sha1(p,e.binb2str(u)),d=0;d<5;d++)s[d]^=c[d];u=c}for(s=e.binb2str(s),h=e.core_hmac_sha1(s,"Client Key"),f=e.str_hmac_sha1(s,"Server Key"),m=e.core_hmac_sha1(e.str_sha1(e.binb2str(h)),g),t._sasl_data["server-signature"]=e.b64_hmac_sha1(f,g),d=0;d<5;d++)h[d]^=m[d];return v+=",p="+btoa(e.binb2str(h))}.bind(this),s},a.SASLMD5=function(){},a.SASLMD5.prototype=new a.SASLMechanism("DIGEST-MD5",!1,40),a.SASLMD5.prototype.test=function(e){return null!==e.authcid},a.SASLMD5.prototype._quote=function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'},a.SASLMD5.prototype.onChallenge=function(e,r,i){for(var o,a=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/,s=i||t.hexdigest(""+1234567890*Math.random()),c="",u=null,l="";r.match(a);)switch(o=r.match(a),r=r.replace(o[0],""),o[2]=o[2].replace(/^"(.+)"$/,"$1"),o[1]){case"realm":c=o[2];break;case"nonce":l=o[2];break;case"qop":o[2];break;case"host":u=o[2]}var d=e.servtype+"/"+e.domain;null!==u&&(d=d+"/"+u);var p=n.utf16to8(e.authcid+":"+c+":"+this._connection.pass),h=t.hash(p)+":"+l+":"+s,f="AUTHENTICATE:"+d,m="";return m+="charset=utf-8,",m+="username="+this._quote(n.utf16to8(e.authcid))+",",m+="realm="+this._quote(c)+",",m+="nonce="+this._quote(l)+",",m+="nc=00000001,",m+="cnonce="+this._quote(s)+",",m+="digest-uri="+this._quote(d)+",",m+="response="+t.hexdigest(t.hexdigest(h)+":"+l+":00000001:"+s+":auth:"+t.hexdigest(f))+",",m+="qop=auth",this.onChallenge=function(){return""},m},a.SASLOAuthBearer=function(){},a.SASLOAuthBearer.prototype=new a.SASLMechanism("OAUTHBEARER",!0,60),a.SASLOAuthBearer.prototype.test=function(e){return null!==e.pass},a.SASLOAuthBearer.prototype.onChallenge=function(e){var t="n,";return null!==e.authcid&&(t=t+"a="+e.authzid),t+=",",t+="",t+="auth=Bearer ",t+=e.pass,t+="",t+="",n.utf16to8(t)},a.SASLExternal=function(){},a.SASLExternal.prototype=new a.SASLMechanism("EXTERNAL",!0,10),a.SASLExternal.prototype.onChallenge=function(e){return e.authcid===e.authzid?"":e.authzid},a.SASLXOAuth2=function(){},a.SASLXOAuth2.prototype=new a.SASLMechanism("X-OAUTH2",!0,70),a.SASLXOAuth2.prototype.test=function(e){return null!==e.pass},a.SASLXOAuth2.prototype.onChallenge=function(e){var t="\0";return null!==e.authcid&&(t+=e.authzid),t+="\0",t+=e.pass,n.utf16to8(t)},{Strophe:a,$build:r,$iq:i,$msg:function(e){return new a.Builder("message",e)},$pres:o,SHA1:e,MD5:t,b64_hmac_sha1:e.b64_hmac_sha1,b64_sha1:e.b64_sha1,str_hmac_sha1:e.str_hmac_sha1,str_sha1:e.str_sha1}},"function"==typeof r&&r.amd?r("strophe-core",["strophe-sha1","strophe-md5","strophe-utils"],function(){return s.apply(this,arguments)}):e.exports=s(n("./sha1"),n("./md5"),n("./utils")),function(t,i){if("function"==typeof r&&r.amd)r("strophe-bosh",["strophe-core"],function(e){return i(e.Strophe,e.$build)});else{var o=n("./core");e.exports=i(o.Strophe,o.$build)}}(0,function(e,t){return e.Request=function(t,n,r,i){this.id=++e._requestId,this.xmlData=t,this.data=e.serialize(t),this.origFunc=n,this.func=n,this.rid=r,this.date=NaN,this.sends=i||0,this.abort=!1,this.dead=null,this.age=function(){return this.date?(new Date-this.date)/1e3:0},this.timeDead=function(){return this.dead?(new Date-this.dead)/1e3:0},this.xhr=this._newXHR()},e.Request.prototype={getResponse:function(){var t=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){if("parsererror"===(t=this.xhr.responseXML.documentElement).tagName)throw e.error("invalid response received"),e.error("responseText: "+this.xhr.responseText),e.error("responseXML: "+e.serialize(this.xhr.responseXML)),"parsererror"}else if(this.xhr.responseText)throw e.error("invalid response received"),e.error("responseText: "+this.xhr.responseText),"badformat";return t},_newXHR:function(){var e=null;return window.XMLHttpRequest?(e=new XMLHttpRequest).overrideMimeType&&e.overrideMimeType("text/xml; charset=utf-8"):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLHTTP")),e.onreadystatechange=this.func.bind(null,this),e}},e.Bosh=function(e){this._conn=e,this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.hold=1,this.wait=60,this.window=5,this.errors=0,this.inactivity=null,this.lastResponseHeaders=null,this._requests=[]},e.Bosh.prototype={strip:null,_buildBody:function(){var n=t("body",{rid:this.rid++,xmlns:e.NS.HTTPBIND});return null!==this.sid&&n.attrs({sid:this.sid}),this._conn.options.keepalive&&this._conn._sessionCachingSupported()&&this._cacheSession(),n},_reset:function(){this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.errors=0,this._conn._sessionCachingSupported()&&window.sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)},_connect:function(t,n,r){this.wait=t||this.wait,this.hold=n||this.hold,this.errors=0;var i=this._buildBody().attrs({to:this._conn.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":e.NS.BOSH});r&&i.attrs({route:r});var o=this._conn._connect_cb;this._requests.push(new e.Request(i.tree(),this._onRequestStateChange.bind(this,o.bind(this._conn)),i.tree().getAttribute("rid"))),this._throttledRequestHandler()},_attach:function(t,n,r,i,o,a,s){this._conn.jid=t,this.sid=n,this.rid=r,this._conn.connect_callback=i,this._conn.domain=e.getDomainFromJid(this._conn.jid),this._conn.authenticated=!0,this._conn.connected=!0,this.wait=o||this.wait,this.hold=a||this.hold,this.window=s||this.window,this._conn._changeConnectStatus(e.Status.ATTACHED,null)},_restore:function(t,n,r,i,o){var a=JSON.parse(window.sessionStorage.getItem("strophe-bosh-session"));if(!(void 0!==a&&null!==a&&a.rid&&a.sid&&a.jid&&(void 0===t||null===t||e.getBareJidFromJid(a.jid)===e.getBareJidFromJid(t)||null===e.getNodeFromJid(t)&&e.getDomainFromJid(a.jid)===t)))throw{name:"StropheSessionError",message:"_restore: no restoreable session."};this._conn.restored=!0,this._attach(a.jid,a.sid,a.rid,n,r,i,o)},_cacheSession:function(){this._conn.authenticated?this._conn.jid&&this.rid&&this.sid&&window.sessionStorage.setItem("strophe-bosh-session",JSON.stringify({jid:this._conn.jid,rid:this.rid,sid:this.sid})):window.sessionStorage.removeItem("strophe-bosh-session")},_connect_cb:function(t){var n,r,i=t.getAttribute("type");if(null!==i&&"terminate"===i)return n=t.getAttribute("condition"),e.error("BOSH-Connection failed: "+n),r=t.getElementsByTagName("conflict"),null!==n?("remote-stream-error"===n&&r.length>0&&(n="conflict"),this._conn._changeConnectStatus(e.Status.CONNFAIL,n)):this._conn._changeConnectStatus(e.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(n),e.Status.CONNFAIL;this.sid||(this.sid=t.getAttribute("sid"));var o=t.getAttribute("requests");o&&(this.window=parseInt(o,10));var a=t.getAttribute("hold");a&&(this.hold=parseInt(a,10));var s=t.getAttribute("wait");s&&(this.wait=parseInt(s,10));var c=t.getAttribute("inactivity");c&&(this.inactivity=parseInt(c,10))},_disconnect:function(e){this._sendTerminate(e)},_doDisconnect:function(){this.sid=null,this.rid=Math.floor(4294967295*Math.random()),this._conn._sessionCachingSupported()&&window.sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)},_emptyQueue:function(){return 0===this._requests.length},_callProtocolErrorHandlers:function(e){var t,n=this._getRequestStatus(e);(t=this._conn.protocolErrorHandlers.HTTP[n])&&t.call(this,n)},_hitError:function(t){this.errors++,e.warn("request errored, status: "+t+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()},_onDisconnectTimeout:function(){this._abortAllRequests()},_abortAllRequests:function(){for(var e;this._requests.length>0;)(e=this._requests.pop()).abort=!0,e.xhr.abort(),e.xhr.onreadystatechange=function(){}},_onIdle:function(){var t=this._conn._data;if(this._conn.authenticated&&0===this._requests.length&&0===t.length&&!this._conn.disconnecting&&(e.info("no requests during idle cycle, sending blank request"),t.push(null)),!this._conn.paused){if(this._requests.length<2&&t.length>0){for(var n=this._buildBody(),r=0;r<t.length;r++)null!==t[r]&&("restart"===t[r]?n.attrs({to:this._conn.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":e.NS.BOSH}):n.cnode(t[r]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new e.Request(n.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),n.tree().getAttribute("rid"))),this._throttledRequestHandler()}if(this._requests.length>0){var i=this._requests[0].age();null!==this._requests[0].dead&&this._requests[0].timeDead()>Math.floor(e.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),i>Math.floor(e.TIMEOUT*this.wait)&&(e.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(e.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())}}},_getRequestStatus:function(t,n){var r;if(4===t.xhr.readyState)try{r=t.xhr.status}catch(t){e.error("Caught an error while retrieving a request's status, reqStatus: "+r)}return void 0===r&&(r="number"==typeof n?n:0),r},_onRequestStateChange:function(t,n){if(e.debug("request id "+n.id+"."+n.sends+" state changed to "+n.xhr.readyState),n.abort)n.abort=!1;else if(4===n.xhr.readyState){var r=this._getRequestStatus(n);if(this.lastResponseHeaders=n.xhr.getAllResponseHeaders(),this.disconnecting&&r>=400)return this._hitError(r),void this._callProtocolErrorHandlers(n);var i=r>0&&r<500,o=n.sends>this._conn.maxRetries;if((i||o)&&(this._removeRequest(n),e.debug("request id "+n.id+" should now be removed")),200===r){var a=this._requests[0]===n;(this._requests[1]===n||a&&this._requests.length>0&&this._requests[0].age()>Math.floor(e.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(n.rid)+1),e.debug("request id "+n.id+"."+n.sends+" got 200"),t(n),this.errors=0}else 0===r||r>=400&&r<600||r>=12e3?(e.error("request id "+n.id+"."+n.sends+" error "+r+" happened"),this._hitError(r),this._callProtocolErrorHandlers(n),r>=400&&r<500&&(this._conn._changeConnectStatus(e.Status.DISCONNECTING,null),this._conn._doDisconnect())):e.error("request id "+n.id+"."+n.sends+" error "+r+" happened");i||o?o&&!this._conn.connected&&this._conn._changeConnectStatus(e.Status.CONNFAIL,"giving-up"):this._throttledRequestHandler()}},_processRequest:function(t){var n=this,r=this._requests[t],i=this._getRequestStatus(r,-1);if(r.sends>this._conn.maxRetries)this._conn._onDisconnectTimeout();else{var o=r.age(),a=!isNaN(o)&&o>Math.floor(e.TIMEOUT*this.wait),s=null!==r.dead&&r.timeDead()>Math.floor(e.SECONDARY_TIMEOUT*this.wait),c=4===r.xhr.readyState&&(i<1||i>=500);if((a||s||c)&&(s&&e.error("Request "+this._requests[t].id+" timed out (secondary), restarting"),r.abort=!0,r.xhr.abort(),r.xhr.onreadystatechange=function(){},this._requests[t]=new e.Request(r.xmlData,r.origFunc,r.rid,r.sends),r=this._requests[t]),0===r.xhr.readyState){e.debug("request id "+r.id+"."+r.sends+" posting");try{var u=this._conn.options.contentType||"text/xml; charset=utf-8";r.xhr.open("POST",this._conn.service,!this._conn.options.sync),void 0!==r.xhr.setRequestHeader&&r.xhr.setRequestHeader("Content-Type",u),this._conn.options.withCredentials&&(r.xhr.withCredentials=!0)}catch(t){return e.error("XHR open failed: "+t.toString()),this._conn.connected||this._conn._changeConnectStatus(e.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}var l=function(){if(r.date=new Date,n._conn.options.customHeaders){var e=n._conn.options.customHeaders;for(var t in e)e.hasOwnProperty(t)&&r.xhr.setRequestHeader(t,e[t])}r.xhr.send(r.data)};if(r.sends>1){var d=1e3*Math.min(Math.floor(e.TIMEOUT*this.wait),Math.pow(r.sends,3));setTimeout(function(){l()},d)}else l();r.sends++,this._conn.xmlOutput!==e.Connection.prototype.xmlOutput&&(r.xmlData.nodeName===this.strip&&r.xmlData.childNodes.length?this._conn.xmlOutput(r.xmlData.childNodes[0]):this._conn.xmlOutput(r.xmlData)),this._conn.rawOutput!==e.Connection.prototype.rawOutput&&this._conn.rawOutput(r.data)}else e.debug("_processRequest: "+(0===t?"first":"second")+" request has readyState of "+r.xhr.readyState)}},_removeRequest:function(t){var n;for(e.debug("removing request"),n=this._requests.length-1;n>=0;n--)t===this._requests[n]&&this._requests.splice(n,1);t.xhr.onreadystatechange=function(){},this._throttledRequestHandler()},_restartRequest:function(e){var t=this._requests[e];null===t.dead&&(t.dead=new Date),this._processRequest(e)},_reqToData:function(e){try{return e.getResponse()}catch(e){if("parsererror"!==e)throw e;this._conn.disconnect("strophe-parsererror")}},_sendTerminate:function(t){e.info("_sendTerminate was called");var n=this._buildBody().attrs({type:"terminate"});t&&n.cnode(t.tree());var r=new e.Request(n.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),n.tree().getAttribute("rid"));this._requests.push(r),this._throttledRequestHandler()},_send:function(){clearTimeout(this._conn._idleTimeout),this._throttledRequestHandler(),this._conn._idleTimeout=setTimeout(function(){this._onIdle()}.bind(this._conn),100)},_sendRestart:function(){this._throttledRequestHandler(),clearTimeout(this._conn._idleTimeout)},_throttledRequestHandler:function(){this._requests?e.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):e.debug("_throttledRequestHandler called with undefined requests"),this._requests&&0!==this._requests.length&&(this._requests.length>0&&this._processRequest(0),this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window&&this._processRequest(1))}},e}),function(t,i){if("function"==typeof r&&r.amd)r("strophe-websocket",["strophe-core"],function(e){return i(e.Strophe,e.$build)});else{var o=n("./core");e.exports=i(o.Strophe,o.$build)}}(0,function(e,t){return e.Websocket=function(e){this._conn=e,this.strip="wrapper";var t=e.service;if(0!==t.indexOf("ws:")&&0!==t.indexOf("wss:")){var n="";"ws"===e.options.protocol&&"https:"!==window.location.protocol?n+="ws":n+="wss",n+="://"+window.location.host,0!==t.indexOf("/")?n+=window.location.pathname+t:n+=t,e.service=n}},e.Websocket.prototype={_buildStream:function(){return t("open",{xmlns:e.NS.FRAMING,to:this._conn.domain,version:"1.0"})},_check_streamerror:function(t,n){var r;if(0===(r=t.getElementsByTagNameNS?t.getElementsByTagNameNS(e.NS.STREAM,"error"):t.getElementsByTagName("stream:error")).length)return!1;for(var i=r[0],o="",a="",s=0;s<i.childNodes.length;s++){var c=i.childNodes[s];if("urn:ietf:params:xml:ns:xmpp-streams"!==c.getAttribute("xmlns"))break;"text"===c.nodeName?a=c.textContent:o=c.nodeName}var u="WebSocket stream error: ";return u+=o||"unknown",a&&(u+=" - "+a),e.error(u),this._conn._changeConnectStatus(n,o),this._conn._doDisconnect(),!0},_reset:function(){},_connect:function(){this._closeSocket(),this.socket=new WebSocket(this._conn.service,"xmpp"),this.socket.onopen=this._onOpen.bind(this),this.socket.onerror=this._onError.bind(this),this.socket.onclose=this._onClose.bind(this),this.socket.onmessage=this._connect_cb_wrapper.bind(this)},_connect_cb:function(t){if(this._check_streamerror(t,e.Status.CONNFAIL))return e.Status.CONNFAIL},_handleStreamStart:function(t){var n=!1,r=t.getAttribute("xmlns");"string"!=typeof r?n="Missing xmlns in <open />":r!==e.NS.FRAMING&&(n="Wrong xmlns in <open />: "+r);var i=t.getAttribute("version");return"string"!=typeof i?n="Missing version in <open />":"1.0"!==i&&(n="Wrong version in <open />: "+i),!n||(this._conn._changeConnectStatus(e.Status.CONNFAIL,n),this._conn._doDisconnect(),!1)},_connect_cb_wrapper:function(t){if(0===t.data.indexOf("<open ")||0===t.data.indexOf("<?xml")){var n=t.data.replace(/^(<\?.*?\?>\s*)*/,"");if(""===n)return;var r=(new DOMParser).parseFromString(n,"text/xml").documentElement;this._conn.xmlInput(r),this._conn.rawInput(t.data),this._handleStreamStart(r)&&this._connect_cb(r)}else if(0===t.data.indexOf("<close ")){this._conn.rawInput(t.data),this._conn.xmlInput(t);var i=t.getAttribute("see-other-uri");i?(this._conn._changeConnectStatus(e.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=i,this._connect()):(this._conn._changeConnectStatus(e.Status.CONNFAIL,"Received closing stream"),this._conn._doDisconnect())}else{var o=this._streamWrap(t.data),a=(new DOMParser).parseFromString(o,"text/xml").documentElement;this.socket.onmessage=this._onMessage.bind(this),this._conn._connect_cb(a,null,t.data)}},_disconnect:function(n){if(this.socket&&this.socket.readyState!==WebSocket.CLOSED){n&&this._conn.send(n);var r=t("close",{xmlns:e.NS.FRAMING});this._conn.xmlOutput(r.tree());var i=e.serialize(r);this._conn.rawOutput(i);try{this.socket.send(i)}catch(t){e.info("Couldn't send <close /> tag.")}}this._conn._doDisconnect()},_doDisconnect:function(){e.info("WebSockets _doDisconnect was called"),this._closeSocket()},_streamWrap:function(e){return"<wrapper>"+e+"</wrapper>"},_closeSocket:function(){if(this.socket)try{this.socket.onerror=null,this.socket.close()}catch(e){}this.socket=null},_emptyQueue:function(){return!0},_onClose:function(t){this._conn.connected&&!this._conn.disconnecting?(e.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):t&&1006===t.code&&!this._conn.connected&&this.socket?(e.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(e.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):e.info("Websocket closed")},_onDisconnectTimeout:function(){},_abortAllRequests:function(){},_onError:function(t){e.error("Websocket error "+t),this._conn._changeConnectStatus(e.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._disconnect()},_onIdle:function(){var t=this._conn._data;if(t.length>0&&!this._conn.paused){for(var n=0;n<t.length;n++){var r,i;null!==t[n]&&(r="restart"===t[n]?this._buildStream().tree():t[n],i=e.serialize(r),this._conn.xmlOutput(r),this._conn.rawOutput(i),this.socket.send(i))}this._conn._data=[]}},_onMessage:function(t){var n,r,i='<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />';if(t.data===i)return this._conn.rawInput(i),this._conn.xmlInput(t),void(this._conn.disconnecting||this._conn._doDisconnect());if(0===t.data.search("<open ")){if(n=(new DOMParser).parseFromString(t.data,"text/xml").documentElement,!this._handleStreamStart(n))return}else r=this._streamWrap(t.data),n=(new DOMParser).parseFromString(r,"text/xml").documentElement;return this._check_streamerror(n,e.Status.ERROR)?void 0:this._conn.disconnecting&&"presence"===n.firstChild.nodeName&&"unavailable"===n.firstChild.getAttribute("type")?(this._conn.xmlInput(n),void this._conn.rawInput(e.serialize(n))):void this._conn._dataRecv(n,t.data)},_onOpen:function(){e.info("Websocket open");var t=this._buildStream();this._conn.xmlOutput(t.tree());var n=e.serialize(t);this._conn.rawOutput(n),this.socket.send(n)},_reqToData:function(e){return e},_send:function(){this._conn.flush()},_sendRestart:function(){clearTimeout(this._conn._idleTimeout),this._conn._onIdle.bind(this._conn)()}},e}),function(t){if("function"==typeof r&&r.amd)r("strophe",["strophe-core","strophe-bosh","strophe-websocket"],function(e){return e});else{var i=n("./core");n("./bosh"),n("./websocket"),e.exports=i}}(),n(["strophe-polyfill"]),n("strophe")})?r.apply(t,i):r)||(e.exports=o)},function(e,t){var n=[],r=window.onerror,i=window.onunhandledrejection;window.onerror=function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];n.forEach(function(e){return e.apply(void 0,t)}),r&&r.apply(void 0,t)},window.onunhandledrejection=function(e){n.forEach(function(t){return t(null,null,null,null,e.reason)}),i&&i(e)};var o={addHandler:function(e){n.push(e)},callErrorHandler:function(e){var t=window.onerror;t&&t(null,null,null,null,e)},callUnhandledRejectionHandler:function(e){var t=window.onunhandledrejection;t&&t(e)}};e.exports=o},function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return i});var r="audio",i="video"},function(e,t,n){"use strict";(function(e){function r(e){if(!u.a.isBackendInitialized()){var t=h.a.callStatsUserName;u.a.initBackend({callStatsID:e.callStatsID,callStatsSecret:e.callStatsSecret,userName:e.swapUserNameAndAlias?e.callStatsAliasName:t,aliasName:e.swapUserNameAndAlias?t:e.callStatsAliasName,applicationName:e.applicationName,getWiFiStatsMethod:e.getWiFiStatsMethod})||b.error("CallStats Backend initialization failed bad")}}function i(e,t){var n;this.rtpStatsMap=new Map,this.eventEmitter=new a.a,this.xmpp=e,this.options=t||{},this.callStatsIntegrationEnabled=this.options.callStatsID&&this.options.callStatsSecret&&!0!==i.disableThirdPartyRequests,this.callStatsIntegrationEnabled&&(p.a.isReactNative()?r(this.options):(n=this.options,_||(m.a.loadScript(n.customScriptUrl||"https://api.callstats.io/static/callstats-ws.min.js",!0,!0,void 0,function(){return r(n)}),_=!0)),this.options.callStatsConfIDNamespace||b.warn('"callStatsConfIDNamespace" is not defined')),this.callsStatsInstances=new Map,i.instances.add(this)}t.a=i;var o=n(16),a=n.n(o),s=n(6),c=n(71),u=n(73),l=n(43),d=n(94),p=n(1),h=n(23),f=n(45),m=n.n(f),v=n(12),g=n(44),y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b=n(0).getLogger(e),S=void 0,_=!1;i.init=function(e){i.audioLevelsEnabled=!e.disableAudioLevels,"number"==typeof e.audioLevelsInterval&&(i.audioLevelsInterval=e.audioLevelsInterval),i.disableThirdPartyRequests=e.disableThirdPartyRequests},i.audioLevelsEnabled=!1,i.audioLevelsInterval=200,i.disableThirdPartyRequests=!1,i.analytics=c.a,Object.defineProperty(i,"instances",{get:function(){return S||(S=new Set),S}}),i.prototype.startRemoteStats=function(e){this.stopRemoteStats(e);try{var t=new d.a(e,i.audioLevelsInterval,2e3,this.eventEmitter);t.start(i.audioLevelsEnabled),this.rtpStatsMap.set(e.id,t)}catch(e){b.error("Failed to start collecting remote statistics: "+e)}},i.localStats=[],i.startLocalStats=function(e,t){if(i.audioLevelsEnabled){var n=new l.a(e,i.audioLevelsInterval,t);this.localStats.push(n),n.start()}},i.prototype.addAudioLevelListener=function(e){i.audioLevelsEnabled&&this.eventEmitter.on(g.a,e)},i.prototype.removeAudioLevelListener=function(e){i.audioLevelsEnabled&&this.eventEmitter.removeListener(g.a,e)},i.prototype.addBeforeDisposedListener=function(e){this.eventEmitter.on(g.b,e)},i.prototype.removeBeforeDisposedListener=function(e){this.eventEmitter.removeListener(g.b,e)},i.prototype.addConnectionStatsListener=function(e){this.eventEmitter.on(g.d,e)},i.prototype.removeConnectionStatsListener=function(e){this.eventEmitter.removeListener(g.d,e)},i.prototype.addByteSentStatsListener=function(e){this.eventEmitter.on(g.c,e)},i.prototype.removeByteSentStatsListener=function(e){this.eventEmitter.removeListener(g.c,e)},i.prototype.dispose=function(){try{this.callsStatsInstances.size||this.eventEmitter.emit(g.b);var e=!0,t=!1,n=void 0;try{for(var r,o=this.callsStatsInstances.values()[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){var a=r.value;this.stopCallStats(a.tpc)}}catch(e){t=!0,n=e}finally{try{!e&&o.return&&o.return()}finally{if(t)throw n}}var s=!0,c=!1,u=void 0;try{for(var l,d=this.rtpStatsMap.keys()[Symbol.iterator]();!(s=(l=d.next()).done);s=!0){var p=l.value;this._stopRemoteStats(p)}}catch(e){c=!0,u=e}finally{try{!s&&d.return&&d.return()}finally{if(c)throw u}}this.eventEmitter&&this.eventEmitter.removeAllListeners()}finally{i.instances.delete(this)}},i.stopLocalStats=function(e){if(i.audioLevelsEnabled)for(var t=0;t<i.localStats.length;t++)if(i.localStats[t].stream===e){i.localStats.splice(t,1)[0].stop();break}},i.prototype._stopRemoteStats=function(e){var t=this.rtpStatsMap.get(e);t&&(t.stop(),this.rtpStatsMap.delete(e))},i.prototype.stopRemoteStats=function(e){this._stopRemoteStats(e.id)},i.prototype.startCallStats=function(e,t){if(this.callStatsIntegrationEnabled)if(this.callsStatsInstances.has(e.id))b.error("CallStats instance for ${tpc} exists already");else{b.info("Starting CallStats for "+e+"...");var n=new u.a(e,{confID:this._getCallStatsConfID(),remoteUserID:t});this.callsStatsInstances.set(e.id,n)}},i._getAllCallStatsInstances=function(){var e=new Set,t=!0,n=!1,r=void 0;try{for(var o,a=i.instances[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var s=o.value,c=!0,u=!1,l=void 0;try{for(var d,p=s.callsStatsInstances.values()[Symbol.iterator]();!(c=(d=p.next()).done);c=!0){var h=d.value;e.add(h)}}catch(e){u=!0,l=e}finally{try{!c&&p.return&&p.return()}finally{if(u)throw l}}}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}return e},i.prototype._getCallStatsConfID=function(){return this.options.callStatsConfIDNamespace?this.options.callStatsConfIDNamespace+"/"+this.options.roomName:this.options.roomName},i.prototype.stopCallStats=function(e){var t=this.callsStatsInstances.get(e.id);t&&(1===this.callsStatsInstances.size&&this.eventEmitter.emit(g.b),this.callsStatsInstances.delete(e.id),t.sendTerminateEvent())},i.prototype.isCallstatsEnabled=function(){return this.callStatsIntegrationEnabled},i.prototype.sendConnectionResumeOrHoldEvent=function(e,t){var n=this.callsStatsInstances.get(e.id);n&&n.sendResumeOrHoldEvent(t)},i.prototype.sendIceConnectionFailedEvent=function(e){var t=this.callsStatsInstances.get(e.id);t&&t.sendIceConnectionFailedEvent()},i.prototype.sendMuteEvent=function(e,t,n){var r=e&&this.callsStatsInstances.get(e.id);u.a.sendMuteEvent(t,n,r)},i.prototype.sendScreenSharingEvent=function(e,t){var n=!0,r=!1,i=void 0;try{for(var o,a=this.callsStatsInstances.values()[Symbol.iterator]();!(n=(o=a.next()).done);n=!0)o.value.sendScreenSharingEvent(e,t)}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}},i.prototype.sendDominantSpeakerEvent=function(){var e=!0,t=!1,n=void 0;try{for(var r,i=this.callsStatsInstances.values()[Symbol.iterator]();!(e=(r=i.next()).done);e=!0)r.value.sendDominantSpeakerEvent()}catch(e){t=!0,n=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw n}}},i.sendActiveDeviceListEvent=function(e){var t=i._getAllCallStatsInstances();if(t.size){var n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;u.a.sendActiveDeviceListEvent(e,c)}}catch(e){r=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(r)throw o}}}else u.a.sendActiveDeviceListEvent(e,null)},i.prototype.associateStreamWithVideoTag=function(e,t,n,r,i,o){var a=this.callsStatsInstances.get(e.id);a&&a.associateStreamWithVideoTag(t,n,r,i,o)},i.sendGetUserMediaFailed=function(e){var t,n,r=e instanceof v.a?(t=e,(n=new Error).stack=t.stack,n.name=(t.name||"Unknown error")+(t.gum&&t.gum.error&&t.gum.error.name?" - "+t.gum.error.name:""),n.constraintName=t.gum&&t.gum.constraints?JSON.stringify(t.gum.constraints):"",n.message=t.message,n):e,o=i._getAllCallStatsInstances();if(o.size){var a=!0,s=!1,c=void 0;try{for(var l,d=o[Symbol.iterator]();!(a=(l=d.next()).done);a=!0){var p=l.value;u.a.sendGetUserMediaFailed(r,p)}}catch(e){s=!0,c=e}finally{try{!a&&d.return&&d.return()}finally{if(s)throw c}}}else u.a.sendGetUserMediaFailed(r,null)},i.prototype.sendCreateOfferFailed=function(e,t){var n=this.callsStatsInstances.get(t.id);n&&n.sendCreateOfferFailed(e)},i.prototype.sendCreateAnswerFailed=function(e,t){var n=this.callsStatsInstances.get(t.id);n&&n.sendCreateAnswerFailed(e)},i.prototype.sendSetLocalDescFailed=function(e,t){var n=this.callsStatsInstances.get(t.id);n&&n.sendSetLocalDescFailed(e)},i.prototype.sendSetRemoteDescFailed=function(e,t){var n=this.callsStatsInstances.get(t.id);n&&n.sendSetRemoteDescFailed(e)},i.prototype.sendAddIceCandidateFailed=function(e,t){var n=this.callsStatsInstances.get(t.id);n&&n.sendAddIceCandidateFailed(e)},i.sendLog=function(e){var t=new Set,n=!0,r=!1,o=void 0;try{for(var a,s=i.instances[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;c.callsStatsInstances.size&&t.add(c.callsStatsInstances.values().next().value)}}catch(e){r=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(r)throw o}}if(t.size){var l=!0,d=!1,p=void 0;try{for(var h,f=t[Symbol.iterator]();!(l=(h=f.next()).done);l=!0){var m=h.value;u.a.sendApplicationLog(e,m)}}catch(e){d=!0,p=e}finally{try{!l&&f.return&&f.return()}finally{if(d)throw p}}}else u.a.sendApplicationLog(e,null)},i.prototype.sendFeedback=function(e,t){u.a.sendFeedback(this._getCallStatsConfID(),e,t),i.analytics.sendEvent(s.l,{rating:e,comment:t})},i.LOCAL_JID=n(96).LOCAL_JID,i.reportGlobalError=function(e){e instanceof v.a&&e.gum?i.sendGetUserMediaFailed(e):i.sendLog(e)},i.sendAnalyticsAndLog=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var n=void 0;n="object"===(void 0===e?"undefined":y(e))?e:{name:e,properties:t},b.log(JSON.stringify(n)),this.analytics.sendEvent(e,t)}else b.warn("No event or event name given.")},i.sendAnalytics=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.analytics.sendEvent(e,t)}}).call(t,"modules/statistics/statistics.js")},function(e,t,n){"use strict";n.d(t,"q",function(){return i}),n.d(t,"r",function(){return o}),n.d(t,"s",function(){return a}),n.d(t,"t",function(){return s}),n.d(t,"a",function(){return c}),n.d(t,"b",function(){return u}),n.d(t,"c",function(){return l}),n.d(t,"d",function(){return d}),n.d(t,"e",function(){return p}),n.d(t,"f",function(){return h}),n.d(t,"g",function(){return f}),n.d(t,"h",function(){return m}),n.d(t,"i",function(){return v}),n.d(t,"j",function(){return g}),n.d(t,"k",function(){return y}),n.d(t,"l",function(){return b}),n.d(t,"m",function(){return S}),n.d(t,"n",function(){return _}),n.d(t,"o",function(){return T}),n.d(t,"p",function(){return C}),n.d(t,"u",function(){return E}),n.d(t,"v",function(){return w}),n.d(t,"w",function(){return R}),n.d(t,"x",function(){return k}),n.d(t,"y",function(){return I}),n.d(t,"z",function(){return P}),n.d(t,"A",function(){return A}),n.d(t,"B",function(){return O}),n.d(t,"C",function(){return D}),n.d(t,"D",function(){return x}),n.d(t,"E",function(){return N});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i="operational",o="page",a="track",s="ui",c="restart",u="session-accept.timeout",l="session-initiate.received",d="terminate",p="transport-replace.received",h="transport-replace.success",f="established",m="failed",v="switch.to.jvb",g="available.device",y="connection.disconnected",b="feedback",S="ice.duration",_="ice.establishment.duration.diff",T="ice.state.changed",C="track.unmuted",E=function(){var e="bridge.down";return{action:e,actionSubject:e,type:i}},w=function(e,t,n){return{type:i,action:"connection.failed",attributes:r({error_type:e,error_message:t},n)}},R=function(e,t){var n="connection.stage.reached";return{action:n,actionSubject:e,attributes:t,source:n,type:i}},k=function(){var e="focus.left";return{action:e,actionSubject:e,type:i}},I=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{type:i,source:"get.user.media",action:e,attributes:t}},P=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{type:i,action:e,source:"jingle",attributes:t}},A=function(e){return{attributes:{media_type:e},action:"track.no.data.from.source",type:i}},O=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{type:i,action:e,source:"p2p",attributes:t}},D=function(){return{type:i,action:"remotely.muted"}},x=function(e){return{type:i,action:"rtp.stats",attributes:e}},N=function(e){return R("ttfm",e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"AUTH_STATUS_CHANGED",function(){return r}),n.d(t,"AVAILABLE_DEVICES_CHANGED",function(){return i}),n.d(t,"AVATAR_CHANGED",function(){return o}),n.d(t,"BEFORE_STATISTICS_DISPOSED",function(){return a}),n.d(t,"CONFERENCE_ERROR",function(){return s}),n.d(t,"CONFERENCE_FAILED",function(){return c}),n.d(t,"CONFERENCE_JOINED",function(){return u}),n.d(t,"CONFERENCE_LEFT",function(){return l}),n.d(t,"CONNECTION_INTERRUPTED",function(){return d}),n.d(t,"CONNECTION_RESTORED",function(){return p}),n.d(t,"DATA_CHANNEL_OPENED",function(){return h}),n.d(t,"DISPLAY_NAME_CHANGED",function(){return f}),n.d(t,"DOMINANT_SPEAKER_CHANGED",function(){return m}),n.d(t,"DTMF_SUPPORT_CHANGED",function(){return v}),n.d(t,"ENDPOINT_MESSAGE_RECEIVED",function(){return g}),n.d(t,"JVB121_STATUS",function(){return y}),n.d(t,"KICKED",function(){return b}),n.d(t,"LAST_N_ENDPOINTS_CHANGED",function(){return S}),n.d(t,"LOCK_STATE_CHANGED",function(){return _}),n.d(t,"MESSAGE_RECEIVED",function(){return T}),n.d(t,"PRIVATE_MESSAGE_RECEIVED",function(){return C}),n.d(t,"PARTICIPANT_CONN_STATUS_CHANGED",function(){return E}),n.d(t,"PARTCIPANT_FEATURES_CHANGED",function(){return w}),n.d(t,"PARTICIPANT_PROPERTY_CHANGED",function(){return R}),n.d(t,"P2P_STATUS",function(){return k}),n.d(t,"PHONE_NUMBER_CHANGED",function(){return I}),n.d(t,"RECORDER_STATE_CHANGED",function(){return P}),n.d(t,"VIDEO_SIP_GW_AVAILABILITY_CHANGED",function(){return A}),n.d(t,"VIDEO_SIP_GW_SESSION_STATE_CHANGED",function(){return O}),n.d(t,"START_MUTED_POLICY_CHANGED",function(){return D}),n.d(t,"STARTED_MUTED",function(){return x}),n.d(t,"SUBJECT_CHANGED",function(){return N}),n.d(t,"SUSPEND_DETECTED",function(){return L}),n.d(t,"TALK_WHILE_MUTED",function(){return M}),n.d(t,"TRACK_ADDED",function(){return j}),n.d(t,"TRACK_AUDIO_LEVEL_CHANGED",function(){return F}),n.d(t,"TRACK_MUTE_CHANGED",function(){return U}),n.d(t,"TRACK_REMOVED",function(){return H}),n.d(t,"TRANSCRIPTION_STATUS_CHANGED",function(){return B}),n.d(t,"USER_JOINED",function(){return G}),n.d(t,"USER_LEFT",function(){return J}),n.d(t,"USER_ROLE_CHANGED",function(){return V}),n.d(t,"USER_STATUS_CHANGED",function(){return W});var r="conference.auth_status_changed",i="conference.availableDevicesChanged",o="conference.avatarChanged",a="conference.beforeStatisticsDisposed",s="conference.error",c="conference.failed",u="conference.joined",l="conference.left",d="conference.connectionInterrupted",p="conference.connectionRestored",h="conference.dataChannelOpened",f="conference.displayNameChanged",m="conference.dominantSpeaker",v="conference.dtmfSupportChanged",g="conference.endpoint_message_received",y="conference.jvb121Status",b="conferenece.kicked",S="conference.lastNEndpointsChanged",_="conference.lock_state_changed",T="conference.messageReceived",C="conference.privateMessageReceived",E="conference.participant_conn_status_changed",w="conference.partcipant_features_changed",R="conference.participant_property_changed",k="conference.p2pStatus",I="conference.phoneNumberChanged",P="conference.recorderStateChanged",A="conference.videoSIPGWAvailabilityChanged",O="conference.videoSIPGWSessionStateChanged",D="conference.start_muted_policy_changed",x="conference.started_muted",N="conference.subjectChanged",L="conference.suspendDetected",M="conference.talk_while_muted",j="conference.trackAdded",F="conference.audioLevelsChanged",U="conference.trackMuteChanged",H="conference.trackRemoved",B="conference.transcriptionStatusChanged",G="conference.userJoined",J="conference.userLeft",V="conference.roleChanged",W="conference.statusChanged"},function(e,t){e.exports={ADD_ICE_CANDIDATE_FAILED:"xmpp.add_ice_candidate_failed",AUDIO_MUTED_BY_FOCUS:"xmpp.audio_muted_by_focus",AUTHENTICATION_REQUIRED:"xmpp.authentication_required",BRIDGE_DOWN:"xmpp.bridge_down",CALL_ACCEPTED:"xmpp.callaccepted.jingle",CALL_INCOMING:"xmpp.callincoming.jingle",CALL_ENDED:"xmpp.callended.jingle",CHAT_ERROR_RECEIVED:"xmpp.chat_error_received",CONFERENCE_SETUP_FAILED:"xmpp.conference_setup_failed",CONNECTION_ESTABLISHED:"xmpp.connection.connected",CONNECTION_FAILED:"xmpp.connection.failed",CONNECTION_INTERRUPTED:"xmpp.connection.interrupted",CONNECTION_RESTORED:"xmpp.connection.restored",CONNECTION_ICE_FAILED:"xmpp.connection.ice.failed",DISPLAY_NAME_CHANGED:"xmpp.display_name_changed",EMUC_ROOM_ADDED:"xmpp.emuc_room_added",EMUC_ROOM_REMOVED:"xmpp.emuc_room_removed",ETHERPAD:"xmpp.etherpad",FOCUS_DISCONNECTED:"xmpp.focus_disconnected",FOCUS_LEFT:"xmpp.focus_left",GRACEFUL_SHUTDOWN:"xmpp.graceful_shutdown",ICE_RESTARTING:"rtc.ice_restarting",JINGLE_ERROR:"xmpp.jingle_error",JINGLE_FATAL_ERROR:"xmpp.jingle_fatal_error",KICKED:"xmpp.kicked",LOCAL_ROLE_CHANGED:"xmpp.localrole_changed",MESSAGE_RECEIVED:"xmpp.message_received",PRIVATE_MESSAGE_RECEIVED:"xmpp.private_message_received",MUC_DESTROYED:"xmpp.muc_destroyed",MUC_JOINED:"xmpp.muc_joined",MUC_MEMBER_JOINED:"xmpp.muc_member_joined",MUC_MEMBER_LEFT:"xmpp.muc_member_left",MUC_LEFT:"xmpp.muc_left",MUC_ROLE_CHANGED:"xmpp.muc_role_changed",MUC_LOCK_CHANGED:"xmpp.muc_lock_changed",PARTICIPANT_AUDIO_MUTED:"xmpp.audio_muted",PARTICIPANT_VIDEO_MUTED:"xmpp.video_muted",PARTICIPANT_VIDEO_TYPE_CHANGED:"xmpp.video_type",PARTCIPANT_FEATURES_CHANGED:"xmpp.partcipant_features_changed",PASSWORD_REQUIRED:"xmpp.password_required",PEERCONNECTION_READY:"xmpp.peerconnection_ready",PHONE_NUMBER_CHANGED:"conference.phoneNumberChanged",PRESENCE_STATUS:"xmpp.presence_status",PROMPT_FOR_LOGIN:"xmpp.prompt_for_login",READY_TO_JOIN:"xmpp.ready_to_join",RECORDER_STATE_CHANGED:"xmpp.recorderStateChanged",REMOTE_STATS:"xmpp.remote_stats",RESERVATION_ERROR:"xmpp.room_reservation_error",ROOM_CONNECT_ERROR:"xmpp.room_connect_error",ROOM_CONNECT_NOT_ALLOWED_ERROR:"xmpp.room_connect_error.not_allowed",ROOM_JOIN_ERROR:"xmpp.room_join_error",ROOM_MAX_USERS_ERROR:"xmpp.room_max_users_error",SENDING_CHAT_MESSAGE:"xmpp.sending_chat_message",SENDING_PRIVATE_CHAT_MESSAGE:"xmpp.sending_private_chat_message",SESSION_ACCEPT_TIMEOUT:"xmpp.session_accept_timeout",START_MUTED_FROM_FOCUS:"xmpp.start_muted_from_focus",SUBJECT_CHANGED:"xmpp.subject_changed",SUSPEND_DETECTED:"xmpp.suspend_detected",TRANSCRIPTION_STATUS_CHANGED:"xmpp.transcription_status_changed",TRANSPORT_INFO:"xmpp.transportinfo.jingle",VIDEO_SIP_GW_AVAILABILITY_CHANGED:"xmpp.videoSIPGWAvailabilityChanged",VIDEO_SIP_GW_SESSION_STATE_CHANGED:"xmpp.videoSIPGWSessionStateChanged",ICE_CONNECTION_STATE_CHANGED:"xmpp.ice_connection_state_changed",JSON_MESSAGE_RECEIVED:"xmmp.json_message_received"}},function(e,t){e.exports={CREATE_ANSWER_FAILED:"rtc.create_answer_failed",CREATE_OFFER_FAILED:"rtc.create_offer_failed",RTC_READY:"rtc.ready",DATA_CHANNEL_OPEN:"rtc.data_channel_open",ENDPOINT_CONN_STATUS_CHANGED:"rtc.endpoint_conn_status_changed",DOMINANT_SPEAKER_CHANGED:"rtc.dominant_speaker_changed",LASTN_ENDPOINT_CHANGED:"rtc.lastn_endpoint_changed",LASTN_VALUE_CHANGED:"rtc.lastn_value_changed",LOCAL_TRACK_SSRC_UPDATED:"rtc.local_track_ssrc_updated",AVAILABLE_DEVICES_CHANGED:"rtc.available_devices_changed",TRACK_ATTACHED:"rtc.track_attached",REMOTE_TRACK_ADDED:"rtc.remote_track_added",REMOTE_TRACK_MUTE:"rtc.remote_track_mute",REMOTE_TRACK_REMOVED:"rtc.remote_track_removed",REMOTE_TRACK_UNMUTE:"rtc.remote_track_unmute",SET_LOCAL_DESCRIPTION_FAILED:"rtc.set_local_description_failed",SET_REMOTE_DESCRIPTION_FAILED:"rtc.set_remote_description_failed",AUDIO_OUTPUT_DEVICE_CHANGED:"rtc.audio_output_device_changed",DEVICE_LIST_CHANGED:"rtc.device_list_changed",DEVICE_LIST_AVAILABLE:"rtc.device_list_available",ENDPOINT_MESSAGE_RECEIVED:"rtc.endpoint_message_received",LOCAL_UFRAG_CHANGED:"rtc.local_ufrag_changed",REMOTE_UFRAG_CHANGED:"rtc.remote_ufrag_changed"}},function(e,t,n){"use strict";var r=n(16),i=n.n(r),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new i.a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eventEmitter=t,this.addEventListener=this.on=this.addListener,this.removeEventListener=this.off=this.removeListener}return o(e,[{key:"addListener",value:function(e,t){this.eventEmitter.addListener(e,t)}},{key:"removeListener",value:function(e,t){this.eventEmitter.removeListener(e,t)}}]),e}();t.a=a},function(e,t,n){"use strict";var r=!0,i=!0,o={disableLog:function(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(r=e,e?"adapter.js logging disabled":"adapter.js logging enabled")},disableWarnings:function(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(i=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))},log:function(){if("object"==typeof window){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},deprecated:function(e,t){i&&console.warn(e+" is deprecated, please use "+t+" instead.")},extractVersion:function(e,t,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)},detectBrowser:function(e){var t=e&&e.navigator,n={};if(n.browser=null,n.version=null,void 0===e||!e.navigator)return n.browser="Not a browser.",n;if(t.mozGetUserMedia)n.browser="firefox",n.version=this.extractVersion(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia)if(e.webkitRTCPeerConnection)n.browser="chrome",n.version=this.extractVersion(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.userAgent.match(/Version\/(\d+).(\d+)/))return n.browser="Unsupported webkit-based browser with GUM support but no WebRTC support.",n;n.browser="safari",n.version=this.extractVersion(t.userAgent,/AppleWebKit\/(\d+)\./,1)}else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))n.browser="edge",n.version=this.extractVersion(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!t.mediaDevices||!t.userAgent.match(/AppleWebKit\/(\d+)\./))return n.browser="Not a supported browser.",n;n.browser="safari",n.version=this.extractVersion(t.userAgent,/AppleWebKit\/(\d+)\./,1)}return n}};e.exports={log:o.log,deprecated:o.deprecated,disableLog:o.disableLog,disableWarnings:o.disableWarnings,extractVersion:o.extractVersion,shimCreateObjectURL:o.shimCreateObjectURL,detectBrowser:o.detectBrowser.bind(o)}},function(e,t,n){"use strict";function r(e,t,n){if("object"===(void 0===e?"undefined":o(e))&&void 0!==e.name)switch(this.gum={error:e,constraints:t,devices:n&&Array.isArray(n)?n.slice(0):void 0},e.name){case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":this.name=i.PERMISSION_DENIED,this.message=a[this.name]+(this.gum.devices||[]).join(", ");break;case"DevicesNotFoundError":case"NotFoundError":this.name=i.NOT_FOUND,this.message=a[this.name]+(this.gum.devices||[]).join(", ");break;case"ConstraintNotSatisfiedError":case"OverconstrainedError":var r=e.constraintName||e.constraint;t&&t.video&&(!n||n.indexOf("video")>-1)&&("minWidth"===r||"maxWidth"===r||"minHeight"===r||"maxHeight"===r||"width"===r||"height"===r)?(this.name=i.UNSUPPORTED_RESOLUTION,this.message=a[this.name]+function(e,t){if(t&&t.video&&t.video.mandatory)switch(e){case"width":return t.video.mandatory.minWidth;case"height":return t.video.mandatory.minHeight;default:return t.video.mandatory[e]||""}return""}(r,t)):(this.name=i.CONSTRAINT_FAILED,this.message=a[this.name]+e.constraintName);break;default:this.name=i.GENERAL,this.message=e.message||a[this.name]}else{if("string"!=typeof e)throw new Error("Invalid arguments");a[e]?(this.name=e,this.message=t||a[e]):this.message=e}this.stack=e.stack||(new Error).stack}var i=n(17),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a={};a[i.UNSUPPORTED_RESOLUTION]="Video resolution is not supported: ",a[i.FIREFOX_EXTENSION_NEEDED]="Firefox extension is not installed",a[i.CHROME_EXTENSION_INSTALLATION_ERROR]="Failed to install Chrome extension",a[i.CHROME_EXTENSION_USER_GESTURE_REQUIRED]="Failed to install Chrome extension - installations can only be initiated by a user gesture.",a[i.CHROME_EXTENSION_USER_CANCELED]="User canceled Chrome's screen sharing prompt",a[i.CHROME_EXTENSION_GENERIC_ERROR]="Unknown error from Chrome extension",a[i.ELECTRON_DESKTOP_PICKER_ERROR]="Unkown error from desktop picker",a[i.ELECTRON_DESKTOP_PICKER_NOT_FOUND]="Failed to detect desktop picker",a[i.GENERAL]="Generic getUserMedia error",a[i.PERMISSION_DENIED]="User denied permission to use device(s): ",a[i.NOT_FOUND]="Requested device(s) was/were not found: ",a[i.CONSTRAINT_FAILED]="Constraint could not be satisfied: ",a[i.TRACK_IS_DISPOSED]="Track has been already disposed",a[i.TRACK_NO_STREAM_FOUND]="Track does not have an associated Media Stream",a[i.NO_DATA_FROM_SOURCE]="The track has stopped receiving data from it's source",r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,t.a=r},function(e,t){e.exports={CAMERA:"camera",DESKTOP:"desktop"}},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(19)),o=n.n(i),a=n(1),s=Object(r.getLogger)(e),c={filterSpecialChars:function(e){return e?e.replace(/[\\\/\{,\}\+]/g,""):e},iceparams:function(e,t){var n,r=null,i=void 0;return(n=c.findLine(e,"a=ice-ufrag:",t))&&(i=c.findLine(e,"a=ice-pwd:",t))&&(r={ufrag:c.parseICEUfrag(n),pwd:c.parseICEPwd(i)}),r},parseICEUfrag:function(e){return e.substring(12)},buildICEUfrag:function(e){return"a=ice-ufrag:"+e},parseICEPwd:function(e){return e.substring(10)},buildICEPwd:function(e){return"a=ice-pwd:"+e},parseMID:function(e){return e.substring(6)},parseMLine:function(e){var t={},n=e.substring(2).split(" ");return t.media=n.shift(),t.port=n.shift(),t.proto=n.shift(),""===n[n.length-1]&&n.pop(),t.fmt=n,t},buildMLine:function(e){return"m="+e.media+" "+e.port+" "+e.proto+" "+e.fmt.join(" ")},parseRTPMap:function(e){var t={},n=e.substring(9).split(" ");return t.id=n.shift(),n=n[0].split("/"),t.name=n.shift(),t.clockrate=n.shift(),t.channels=n.length?n.shift():"1",t},parseSCTPMap:function(e){var t=e.substring(10).split(" ");return[t[0],t[1],t.length>2?t[2]:null]},buildRTPMap:function(e){var t="a=rtpmap:"+e.getAttribute("id")+" "+e.getAttribute("name")+"/"+e.getAttribute("clockrate");return e.getAttribute("channels")&&"1"!==e.getAttribute("channels")&&(t+="/"+e.getAttribute("channels")),t},parseCrypto:function(e){var t={},n=e.substring(9).split(" ");return t.tag=n.shift(),t["crypto-suite"]=n.shift(),t["key-params"]=n.shift(),n.length&&(t["session-params"]=n.join(" ")),t},parseFingerprint:function(e){var t={},n=e.substring(14).split(" ");return t.hash=n.shift(),t.fingerprint=n.shift(),t},parseFmtp:function(e){var t=[],n=e.split(" ");n.shift(),n=n.join(" ").split(";");for(var r=0;r<n.length;r++){for(var i=n[r].split("=")[0];i.length&&" "===i[0];)i=i.substring(1);var o=n[r].split("=")[1];i&&o?t.push({name:i,value:o}):i&&t.push({name:"",value:i})}return t},parseICECandidate:function(e){var t={},n=e.split(" ");t.foundation=n[0].substring(12),t.component=n[1],t.protocol=n[2].toLowerCase(),t.priority=n[3],t.ip=n[4],t.port=n[5],t.type=n[7],t.generation=0;for(var r=8;r<n.length;r+=2)switch(n[r]){case"raddr":t["rel-addr"]=n[r+1];break;case"rport":t["rel-port"]=n[r+1];break;case"generation":t.generation=n[r+1];break;case"tcptype":t.tcptype=n[r+1];break;default:s.log('parseICECandidate not translating "'+n[r]+'" = "'+n[r+1]+'"')}return t.network="1",t.id=Math.random().toString(36).substr(2,10),t},buildICECandidate:function(e){var t=["a=candidate:"+e.foundation,e.component,e.protocol,e.priority,e.ip,e.port,"typ",e.type].join(" ");switch(t+=" ",e.type){case"srflx":case"prflx":case"relay":e.hasOwnAttribute("rel-addr")&&e.hasOwnAttribute("rel-port")&&(t+="raddr",t+=" ",t+=e["rel-addr"],t+=" ",t+="rport",t+=" ",t+=e["rel-port"],t+=" ")}return e.hasOwnAttribute("tcptype")&&(t+="tcptype",t+=" ",t+=e.tcptype,t+=" "),t+="generation",t+=" ",t+=e.hasOwnAttribute("generation")?e.generation:"0"},parseSSRC:function(e){for(var t=new Map,n=e.split("\r\n"),r=0;r<n.length;r++)if("a=ssrc:"===n[r].substring(0,7)){var i=n[r].split("a=ssrc:")[1].split(" ")[0];t.get(i)||t.set(i,[]),t.get(i).push(n[r])}return t},parseRTCPFB:function(e){var t=e.substr(10).split(" "),n={};return n.pt=t.shift(),n.type=t.shift(),n.params=t,n},parseExtmap:function(e){var t=e.substr(9).split(" "),n={};return n.value=t.shift(),-1===n.value.indexOf("/")?n.direction="both":(n.direction=n.value.substr(n.value.indexOf("/")+1),n.value=n.value.substr(0,n.value.indexOf("/"))),n.uri=t.shift(),n.params=t,n},findLine:function(e,t,n){for(var r=e.split("\r\n"),i=0;i<r.length;i++)if(r[i].substring(0,t.length)===t)return r[i];if(!n)return!1;r=n.split("\r\n");for(var o=0;o<r.length;o++)if(r[o].substring(0,t.length)===t)return r[o];return!1},findLines:function(e,t,n){for(var r=e.split("\r\n"),i=[],o=0;o<r.length;o++)r[o].substring(0,t.length)===t&&i.push(r[o]);if(i.length||!n)return i;r=n.split("\r\n");for(var a=0;a<r.length;a++)r[a].substring(0,t.length)===t&&i.push(r[a]);return i},candidateToJingle:function(e){if(0===e.indexOf("candidate:"))e="a="+e;else if("a=candidate:"!==e.substring(0,12))return s.log("parseCandidate called with a line that is not a candidate line"),s.log(e),null;"\r\n"===e.substring(e.length-2)&&(e=e.substring(0,e.length-2));var t={},n=e.split(" ");if("typ"!==n[6])return s.log("did not find typ in the right place"),s.log(e),null;t.foundation=n[0].substring(12),t.component=n[1],t.protocol=n[2].toLowerCase(),t.priority=n[3],t.ip=n[4],t.port=n[5],t.type=n[7],t.generation="0";for(var r=8;r<n.length;r+=2)switch(n[r]){case"raddr":t["rel-addr"]=n[r+1];break;case"rport":t["rel-port"]=n[r+1];break;case"generation":t.generation=n[r+1];break;case"tcptype":t.tcptype=n[r+1];break;default:s.log('not translating "'+n[r]+'" = "'+n[r+1]+'"')}return t.network="1",t.id=Math.random().toString(36).substr(2,10),t},candidateFromJingle:function(e){var t="a=candidate:";t+=e.getAttribute("foundation"),t+=" ",t+=e.getAttribute("component"),t+=" ";var n=e.getAttribute("protocol");switch(a.a.isFirefox()&&"ssltcp"===n.toLowerCase()&&(n="tcp"),t+=n,t+=" ",t+=e.getAttribute("priority"),t+=" ",t+=e.getAttribute("ip"),t+=" ",t+=e.getAttribute("port"),t+=" ",t+="typ",t+=" "+e.getAttribute("type"),t+=" ",e.getAttribute("type")){case"srflx":case"prflx":case"relay":e.getAttribute("rel-addr")&&e.getAttribute("rel-port")&&(t+="raddr",t+=" ",t+=e.getAttribute("rel-addr"),t+=" ",t+="rport",t+=" ",t+=e.getAttribute("rel-port"),t+=" ")}return"tcp"===n.toLowerCase()&&(t+="tcptype",t+=" ",t+=e.getAttribute("tcptype"),t+=" "),t+="generation",t+=" ",(t+=e.getAttribute("generation")||"0")+"\r\n"},parsePrimaryVideoSsrc:function(e){var t=e.ssrcs.map(function(e){return e.id}).filter(function(e,t,n){return n.indexOf(e)===t}).length,n=e.ssrcGroups&&e.ssrcGroups.length||0;if(!(t>1&&0===n)){var r=null;if(1===t)r=e.ssrcs[0].id;else if(2===t){var i=e.ssrcGroups.find(function(e){return"FID"===e.semantics});i&&(r=i.ssrcs.split(" ")[0])}else if(t>=3){var o=e.ssrcGroups.find(function(e){return"SIM"===e.semantics});o&&(r=o.ssrcs.split(" ")[0])}return r}},generateSsrc:function(){return o.a.randomInt(1,4294967295)},getSsrcAttribute:function(e,t,n){for(var r=0;r<e.ssrcs.length;++r){var i=e.ssrcs[r];if(i.id===t&&i.attribute===n)return i.value}},parseGroupSsrcs:function(e){return e.ssrcs.split(" ").map(function(e){return parseInt(e,10)})},getMedia:function(e,t){return e.media.find(function(e){return e.type===t})},getUfrag:function(e){var t=e.split("\n").filter(function(e){return e.startsWith("a=ice-ufrag:")});if(t.length>0)return t[0].substr("a=ice-ufrag:".length)},preferVideoCodec:function(e,t){var n=null;if(e&&t){for(var r=0;r<e.rtp.length;++r){var i=e.rtp[r];if(i.codec&&i.codec.toLowerCase()===t.toLowerCase()){n=i.payload;break}}if(n){var o=e.payloads.toString().split(" ").map(function(e){return parseInt(e,10)}),a=o.indexOf(n);o.splice(a,1),o.unshift(n),e.payloads=o.join(" ")}}},stripVideoCodec:function(e,t){if(e&&t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e.rtp[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var c=a.value;c.codec&&c.codec.toLowerCase()===t.toLowerCase()&&n.push(c.payload)}}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}if(n.length>0){var u=n.map(function(e){return"apt="+e}),l=e.fmtp.filter(function(e){return-1!==u.indexOf(e.config)});n.push.apply(n,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(l.map(function(e){return e.payload})));var d=e.payloads.toString().split(" ").map(Number).filter(function(e){return-1===n.indexOf(e)});0===d.length?(e.port=0,e.direction="inactive",e.payloads="*"):e.payloads=d.join(" "),e.rtp=e.rtp.filter(function(e){return-1!==d.indexOf(e.payload)}),e.fmtp=e.fmtp.filter(function(e){return-1!==d.indexOf(e.payload)}),e.rtcpFb&&(e.rtcpFb=e.rtcpFb.filter(function(e){return-1!==d.indexOf(e.payload)}))}}}};t.a=c}).call(t,"modules/xmpp/SDPUtil.js")},function(e,t,n){var r=n(130),i=n(131);t.write=i,t.parse=r.parse,t.parseFmtpConfig=r.parseFmtpConfig,t.parseParams=r.parseParams,t.parsePayloads=r.parsePayloads,t.parseRemoteCandidates=r.parseRemoteCandidates,t.parseImageAttributes=r.parseImageAttributes,t.parseSimulcastStreamList=r.parseSimulcastStreamList},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,a,s,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(o(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),a=(u=n.slice()).length,c=0;c<a;c++)u[c].apply(this,s);return!0},n.prototype.addListener=function(e,t){var a;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(a=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(n=this._events[e]).length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"CHROME_EXTENSION_GENERIC_ERROR",function(){return r}),n.d(t,"CHROME_EXTENSION_INSTALLATION_ERROR",function(){return i}),n.d(t,"CHROME_EXTENSION_USER_GESTURE_REQUIRED",function(){return o}),n.d(t,"CHROME_EXTENSION_USER_CANCELED",function(){return a}),n.d(t,"CONSTRAINT_FAILED",function(){return s}),n.d(t,"ELECTRON_DESKTOP_PICKER_ERROR",function(){return c}),n.d(t,"ELECTRON_DESKTOP_PICKER_NOT_FOUND",function(){return u}),n.d(t,"FIREFOX_EXTENSION_NEEDED",function(){return l}),n.d(t,"GENERAL",function(){return d}),n.d(t,"NOT_FOUND",function(){return p}),n.d(t,"PERMISSION_DENIED",function(){return h}),n.d(t,"TRACK_IS_DISPOSED",function(){return f}),n.d(t,"TRACK_NO_STREAM_FOUND",function(){return m}),n.d(t,"UNSUPPORTED_RESOLUTION",function(){return v}),n.d(t,"NO_DATA_FROM_SOURCE",function(){return g});var r="gum.chrome_extension_generic_error",i="gum.chrome_extension_installation_error",o="gum.chrome_extension_user_gesture_required",a="gum.chrome_extension_user_canceled",s="gum.constraint_failed",c="gum.electron_desktop_picker_error",u="gum.electron_desktop_picker_not_found",l="gum.firefox_extension_needed",d="gum.general",p="gum.not_found",h="gum.permission_denied",f="track.track_is_disposed",m="track.no_stream_found",v="gum.unsupported_resolution",g="track.no_data_from_source"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"LOCAL_TRACK_STOPPED",function(){return r}),n.d(t,"TRACK_AUDIO_LEVEL_CHANGED",function(){return i}),n.d(t,"TRACK_AUDIO_OUTPUT_CHANGED",function(){return o}),n.d(t,"TRACK_MUTE_CHANGED",function(){return a}),n.d(t,"TRACK_VIDEOTYPE_CHANGED",function(){return s}),n.d(t,"NO_DATA_FROM_SOURCE",function(){return c});var r="track.stopped",i="track.audioLevelsChanged",o="track.audioOutputChanged",a="track.trackMuteChanged",s="track.videoTypeChanged",c="track.no_data_from_source"},function(e,t){function n(e,t){return Math.floor(Math.random()*(t-e+1))+e}function r(e){return e[n(0,e.length-1)]}var i={randomHexDigit:function(){return r("0123456789abcdef")},randomHexString:function(e){for(var t="";e--;)t+=this.randomHexDigit();return t},randomElement:r,randomAlphanumStr:function(e){for(var t="",n=0;n<e;n+=1)t+=r("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");return t},randomInt:n};e.exports=i},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCurrent=function(){return window&&window.performance&&window.performance.now&&window.performance.timing&&window.performance.timing.navigationStart?window.performance.now()+window.performance.timing.navigationStart:Date.now()}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return function e(){r(this,e)}}();return function(t){function n(){var e;r(this,n);for(var t=arguments.length,i=Array(t),o=0;o<t;o++)i[o]=arguments[o];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=n.__proto__||Object.getPrototypeOf(n)).call.apply(e,[this].concat(i)));return a.connection=null,a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(n,e),a(n,[{key:"init",value:function(e){this.connection=e}}]),n}()}n.d(t,"a",function(){return s});var o=n(10),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.b=i();var s=i(o.a)},function(e,t,n){"use strict";(function(e){function r(){var e=void 0;try{e=(window||this).localStorage}catch(e){c.error(e)}return e}function i(){return(Math.random().toString(16)+"000000000").substr(2,8)}var o=n(0),a=(n.n(o),n(72)),s=n.n(a),c=Object(o.getLogger)(e),u=void 0,l=void 0;t.a={get callStatsUserName(){if(!u){var e=r();e&&(u=e.getItem("callStatsUserName")),u||(t=s.a.generateUsername(),c.log("generated callstats uid",t),u=t,e&&e.setItem("callStatsUserName",u))}var t;return u},get machineId(){if(!l){var e=r();e&&(l=e.getItem("jitsiMeetId")),l||(t=i()+i()+i()+i(),c.log("generated id",t),l=t,e&&e.setItem("jitsiMeetId",l))}var t;return l},get sessionId(){var e=r();return e?e.getItem("sessionId"):void 0},set sessionId(e){var t=r();t&&(e?t.setItem("sessionId",e):t.removeItem("sessionId"))}}}).call(t,"modules/settings/Settings.js")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.detect=function(){var e=r.browserName.chrome,t=null,n=null,i=null,o=r.codeBaseType.chrome;if(window&&(!window.navigator||!window.navigator.userAgent||window.csioReactNative))return window&&window.csioGetOsName&&(t=window.csioGetOsName()),window&&window.csioGetOsVer&&(n=window.csioGetOsVer()),window&&window.csioReactNative&&(i="react-native"),{browserName:e,codeBase:o,os:t,osVersion:n,userAgent:i};var a=(i=navigator.userAgent).toLowerCase(),s=navigator.appVersion,c=""+parseFloat(navigator.appVersion),u=void 0;-1!==(u=a.indexOf("opera"))?(e=r.browserName.opera,c=a.substring(u+6),-1!==(u=a.indexOf("Version"))&&(c=a.substring(u+8)),o=r.codeBaseType.chrome):-1!==(u=a.indexOf("opr"))?(e=r.browserName.opera,c=a.substring(u+4),-1!==(u=a.indexOf("Version"))&&(c=a.substring(u+8)),o=r.codeBaseType.chrome):-1!==(u=a.indexOf("msie"))?(e=r.browserName.msie,c=a.substring(u+5),o=r.codeBaseType.chrome):-1!==(u=a.indexOf("edge"))?(e=r.browserName.edge,c=a.substring(u+5),o=r.codeBaseType.edge):-1!==(u=a.indexOf("chrome"))?(e=r.browserName.chrome,c=a.substring(u+7),o=r.codeBaseType.chrome):-1!==(u=a.indexOf("safari"))?(e=r.browserName.safari,c=a.substring(u+7),-1!==(u=a.indexOf("Version"))&&(c=a.substring(u+8)),o=r.codeBaseType.chrome):-1!==(u=a.indexOf("firefox"))?(e=r.browserName.firefox,c=a.substring(u+8),o=r.codeBaseType.firefox):-1!==(u=a.indexOf("trident"))&&(e=r.browserName.msie,u=a.indexOf("rv"),c=a.substring(u+3,u+7),o=r.codeBaseType.chrome);var l=[{s:"Windows 3.11",r:/win16/},{s:"Windows 95",r:/(windows 95|win95|windows_95)/},{s:"Windows ME",r:/(win 9x 4.90|windows me)/},{s:"Windows 98",r:/(windows 98|win98)/},{s:"Windows CE",r:/windows ce/},{s:"Windows 2000",r:/(windows nt 5.0|windows 2000)/},{s:"Windows XP",r:/(windows nt 5.1|windows xp)/},{s:"Windows Server 2003",r:/windows nt 5.2/},{s:"Windows Vista",r:/windows nt 6.0/},{s:"Windows 7",r:/(windows 7|windows nt 6.1)/},{s:"Windows 8.1",r:/(windows 8.1|windows nt 6.3)/},{s:"Windows 8",r:/(windows 8|windows nt 6.2)/},{s:"Windows 10",r:/(windows 10|windows nt 10.0)/},{s:"Windows NT 4.0",r:/(windows nt 4.0|winnt4.0|winnt|windows nt)/},{s:"Windows ME",r:/windows me/},{s:"Android",r:/android/},{s:"Open BSD",r:/openbsd/},{s:"Sun OS",r:/sunos/},{s:"Linux",r:/(linux|x11)/},{s:"iOS",r:/(iphone|ipad|ipod)/},{s:"Mac OS X",r:/mac os x/},{s:"Mac OS",r:/(macppc|macintel|mac_powerpc|macintosh)/},{s:"QNX",r:/qnx/},{s:"UNIX",r:/unix/},{s:"BeOS",r:/beos/},{s:"OS/2",r:/os\/2/},{s:"Search Bot",r:/(nuhk|googlebot|yammybot|openbot|slurp|msnbot|ask jeeves\/teoma|ia_archiver)/}],d=void 0,p=void 0;for(d in l)if(l.hasOwnProperty(d)&&(p=l[d]).r.test(a)){t=p.s;break}switch(t&&/Windows/.test(t)&&(n=/Windows (.*)/.exec(t)[1],t=r.osName.windows),t){case r.osName.mac:n=/mac os x (10[\.\_\d]+)/.exec(a)[1];break;case r.osName.android:n=/android ([\.\_\d]+)/.exec(a)[1];break;case r.osName.ios:n=(n=/os (\d+)_(\d+)_?(\d+)?/.exec(s))[1]+"."+n[2]+"."+(0|n[3])}return{browserName:e,browserVersion:c.toString(),os:t,osVersion:n,codeBase:o,userAgent:i}};var r=t.Constants={codeBaseType:{chrome:"Chrome",firefox:"Firefox",edge:"Edge",plugin:"Plugin"},browserName:{chrome:"Chrome",firefox:"Firefox",edge:"Edge",msie:"Microsoft Internet Explorer",safari:"Safari"},osName:{windows:"Windows",mac:"Mac OS X",android:"Android",ios:"iOS"}}},function(e,t,n){(function(t,n,r){var i;i=function(){return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var c="function"==typeof _dereq_&&_dereq_;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){return i(t[a][1][e]||e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof _dereq_&&_dereq_,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";t.exports=function(e){function t(e){var t=new n(e),r=t.promise();return t.setHowMany(1),t.setUnwrap(),t.init(),r}var n=e._SomePromiseArray;e.any=function(e){return t(e)},e.prototype.any=function(){return t(this)}}},{}],2:[function(e,n,r){"use strict";function i(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new l(16),this._normalQueue=new l(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var e=this;this.drainQueues=function(){e._drainQueues()},this._schedule=u}function o(e,t,n){this._lateQueue.push(e,t,n),this._queueTick()}function a(e,t,n){this._normalQueue.push(e,t,n),this._queueTick()}function s(e){this._normalQueue._pushOne(e),this._queueTick()}var c;try{throw new Error}catch(e){c=e}var u=e("./schedule"),l=e("./queue"),d=e("./util");i.prototype.setScheduler=function(e){var t=this._schedule;return this._schedule=e,this._customScheduler=!0,t},i.prototype.hasCustomScheduler=function(){return this._customScheduler},i.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},i.prototype.disableTrampolineIfNecessary=function(){d.hasDevTools&&(this._trampolineEnabled=!1)},i.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},i.prototype.fatalError=function(e,n){n?(t.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),t.exit(2)):this.throwLater(e)},i.prototype.throwLater=function(e,t){if(1===arguments.length&&(t=e,e=function(){throw t}),"undefined"!=typeof setTimeout)setTimeout(function(){e(t)},0);else try{this._schedule(function(){e(t)})}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},d.hasDevTools?(i.prototype.invokeLater=function(e,t,n){this._trampolineEnabled?o.call(this,e,t,n):this._schedule(function(){setTimeout(function(){e.call(t,n)},100)})},i.prototype.invoke=function(e,t,n){this._trampolineEnabled?a.call(this,e,t,n):this._schedule(function(){e.call(t,n)})},i.prototype.settlePromises=function(e){this._trampolineEnabled?s.call(this,e):this._schedule(function(){e._settlePromises()})}):(i.prototype.invokeLater=o,i.prototype.invoke=a,i.prototype.settlePromises=s),i.prototype._drainQueue=function(e){for(;e.length()>0;){var t=e.shift();if("function"==typeof t){var n=e.shift(),r=e.shift();t.call(n,r)}else t._settlePromises()}},i.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},i.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},i.prototype._reset=function(){this._isTickUsed=!1},n.exports=i,n.exports.firstLineError=c},{"./queue":26,"./schedule":29,"./util":36}],3:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){var i=!1,o=function(e,t){this._reject(t)},a=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(o,o,null,this,e)},s=function(e,t){0==(50397184&this._bitField)&&this._resolveCallback(t.target)},c=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(o){i||(i=!0,e.prototype._propagateFrom=r.propagateFromFunction(),e.prototype._boundValue=r.boundValueFunction());var u=n(o),l=new e(t);l._propagateFrom(this,1);var d=this._target();if(l._setBoundTo(u),u instanceof e){var p={promiseRejectionQueued:!1,promise:l,target:d,bindingPromise:u};d._then(t,a,void 0,l,p),u._then(s,c,void 0,l,p),l._setOnCancel(u)}else l._resolveCallback(d);return l},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=2097152|this._bitField,this._boundTo=e):this._bitField=-2097153&this._bitField},e.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},e.bind=function(t,n){return e.resolve(n).bind(t)}}},{}],4:[function(e,t,n){"use strict";var r;"undefined"!=typeof Promise&&(r=Promise);var i=e("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=r)}catch(e){}return i},t.exports=i},{"./promise":22}],5:[function(e,t,n){"use strict";var r=Object.create;if(r){var i=r(null),o=r(null);i[" size"]=o[" size"]=0}t.exports=function(t){function n(e,n){var r;if(null!=e&&(r=e[n]),"function"!=typeof r){var i="Object "+s.classString(e)+" has no method '"+s.toString(n)+"'";throw new t.TypeError(i)}return r}function r(e){return n(e,this.pop()).apply(e,this)}function i(e){return e[this]}function o(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}var a,s=e("./util"),c=s.canEvaluate;s.isIdentifier,t.prototype.call=function(e){var t=[].slice.call(arguments,1);return t.push(e),this._then(r,void 0,void 0,t,void 0)},t.prototype.get=function(e){var t;if("number"==typeof e)t=o;else if(c){var n=a(e);t=null!==n?n:i}else t=i;return this._then(t,void 0,void 0,e,void 0)}}},{"./util":36}],6:[function(e,t,n){"use strict";t.exports=function(t,n,r,i){var o=e("./util"),a=o.tryCatch,s=o.errorObj,c=t._async;t.prototype.break=t.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var e=this,t=e;e._isCancellable();){if(!e._cancelBy(t)){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}var n=e._cancellationParent;if(null==n||!n._isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),e._setWillBeCancelled(),t=e,e=n}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(e){return e===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(e,t){if(o.isArray(e))for(var n=0;n<e.length;++n)this._doInvokeOnCancel(e[n],t);else if(void 0!==e)if("function"==typeof e){if(!t){var r=a(e).call(this._boundValue());r===s&&(this._attachExtraTrace(r.e),c.throwLater(r.e))}}else e._resultCancelled(this)},t.prototype._invokeOnCancel=function(){var e=this._onCancel();this._unsetOnCancel(),c.invoke(this._doInvokeOnCancel,this,e)},t.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},t.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(e,t,n){"use strict";t.exports=function(t){var n=e("./util"),r=e("./es5").keys,i=n.tryCatch,o=n.errorObj;return function(e,a,s){return function(c){var u=s._boundValue();e:for(var l=0;l<e.length;++l){var d=e[l];if(d===Error||null!=d&&d.prototype instanceof Error){if(c instanceof d)return i(a).call(u,c)}else if("function"==typeof d){var p=i(d).call(u,c);if(p===o)return p;if(p)return i(a).call(u,c)}else if(n.isObject(c)){for(var h=r(d),f=0;f<h.length;++f){var m=h[f];if(d[m]!=c[m])continue e}return i(a).call(u,c)}}return t}}}},{"./es5":13,"./util":36}],8:[function(e,t,n){"use strict";t.exports=function(e){function t(){this._trace=new t.CapturedTrace(n())}function n(){var e=i.length-1;if(e>=0)return i[e]}var r=!1,i=[];return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},t.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,i.push(this._trace))},t.prototype._popContext=function(){if(void 0!==this._trace){var e=i.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},t.CapturedTrace=null,t.create=function(){if(r)return new t},t.deactivateLongStackTraces=function(){},t.activateLongStackTraces=function(){var i=e.prototype._pushContext,o=e.prototype._popContext,a=e._peekContext,s=e.prototype._peekContext,c=e.prototype._promiseCreated;t.deactivateLongStackTraces=function(){e.prototype._pushContext=i,e.prototype._popContext=o,e._peekContext=a,e.prototype._peekContext=s,e.prototype._promiseCreated=c,r=!1},r=!0,e.prototype._pushContext=t.prototype._pushContext,e.prototype._popContext=t.prototype._popContext,e._peekContext=e.prototype._peekContext=n,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},t}},{}],9:[function(e,n,r){"use strict";n.exports=function(n,r){function i(e,t){return{promise:t}}function o(){return!1}function a(e,t,n){var r=this;try{e(t,n,function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+A.toString(e));r._attachCancellationCallback(e)})}catch(e){return e}}function s(e){if(!this._isCancellable())return this;var t=this._onCancel();void 0!==t?A.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function c(){return this._onCancelField}function u(e){this._onCancelField=e}function l(){this._cancellationParent=void 0,this._onCancelField=void 0}function d(e,t){if(0!=(1&t)){this._cancellationParent=e;var n=e._branchesRemainingToCancel;void 0===n&&(n=0),e._branchesRemainingToCancel=n+1}0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function p(){var e=this._boundTo;return void 0!==e&&e instanceof n?e.isFulfilled()?e.value():void 0:e}function h(){this._trace=new C(this._peekContext())}function f(e,t){if(O(e)){var n=this._trace;if(void 0!==n&&t&&(n=n._parent),void 0!==n)n.attachExtraTrace(e);else if(!e.__stackCleaned__){var r=g(e);A.notEnumerableProp(e,"stack",r.message+"\n"+r.stack.join("\n")),A.notEnumerableProp(e,"__stackCleaned__",!0)}}}function m(e,t,r){if(X.warnings){var i,o=new P(e);if(t)r._attachExtraTrace(o);else if(X.longStackTraces&&(i=n._peekContext()))i.attachExtraTrace(o);else{var a=g(o);o.stack=a.message+"\n"+a.stack.join("\n")}q("warning",o)||y(o,"",!0)}}function v(e){for(var t=[],n=0;n<e.length;++n){var r=e[n],i=" (No stack trace)"===r||L.test(r),o=i&&z(r);i&&!o&&(j&&" "!==r.charAt(0)&&(r=" "+r),t.push(r))}return t}function g(e){var t=e.stack,n=e.toString();return t="string"==typeof t&&t.length>0?function(e){for(var t=e.stack.replace(/\s+$/g,"").split("\n"),n=0;n<t.length;++n){var r=t[n];if(" (No stack trace)"===r||L.test(r))break}return n>0&&"SyntaxError"!=e.name&&(t=t.slice(n)),t}(e):[" (No stack trace)"],{message:n,stack:"SyntaxError"==e.name?t:v(t)}}function y(e,t,n){if("undefined"!=typeof console){var r;if(A.isObject(e)){var i=e.stack;r=t+M(i,e)}else r=t+String(e);"function"==typeof R?R(r,n):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(r)}}function b(e,t,n,r){var i=!1;try{"function"==typeof t&&(i=!0,"rejectionHandled"===e?t(r):t(n,r))}catch(e){I.throwLater(e)}"unhandledRejection"===e?q(e,n,r)||i||y(n,"Unhandled rejection "):q(e,r)}function S(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{if(t=e&&"function"==typeof e.toString?e.toString():A.toString(e),/\[object [a-zA-Z0-9$_]+\]/.test(t))try{t=JSON.stringify(e)}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+function(e){return e.length<41?e:e.substr(0,38)+"..."}(t)+">, no stack trace)"}function _(){return"function"==typeof $}function T(e){var t=e.match(Q);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}function C(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);$(this,C),t>32&&this.uncycle()}var E,w,R,k=n._getDomain,I=n._async,P=e("./errors").Warning,A=e("./util"),O=A.canAttachTrace,D=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,x=/\((?:timers\.js):\d+:\d+\)/,N=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,L=null,M=null,j=!1,F=!(0==A.env("BLUEBIRD_DEBUG")),U=!(0==A.env("BLUEBIRD_WARNINGS")||!F&&!A.env("BLUEBIRD_WARNINGS")),H=!(0==A.env("BLUEBIRD_LONG_STACK_TRACES")||!F&&!A.env("BLUEBIRD_LONG_STACK_TRACES")),B=0!=A.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(U||!!A.env("BLUEBIRD_W_FORGOTTEN_RETURN"));n.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=-1048577&e._bitField|524288},n.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var e=this;setTimeout(function(){e._notifyUnhandledRejection()},1)}},n.prototype._notifyUnhandledRejectionIsHandled=function(){b("rejectionHandled",E,void 0,this)},n.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},n.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),b("unhandledRejection",w,e,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},n.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},n.prototype._warn=function(e,t,n){return m(e,t,n||this)},n.onPossiblyUnhandledRejection=function(e){var t=k();w="function"==typeof e?null===t?e:A.domainBind(t,e):void 0},n.onUnhandledRejectionHandled=function(e){var t=k();E="function"==typeof e?null===t?e:A.domainBind(t,e):void 0};var G=function(){};n.longStackTraces=function(){if(I.haveItemsQueued()&&!X.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!X.longStackTraces&&_()){var e=n.prototype._captureStackTrace,t=n.prototype._attachExtraTrace;X.longStackTraces=!0,G=function(){if(I.haveItemsQueued()&&!X.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");n.prototype._captureStackTrace=e,n.prototype._attachExtraTrace=t,r.deactivateLongStackTraces(),I.enableTrampoline(),X.longStackTraces=!1},n.prototype._captureStackTrace=h,n.prototype._attachExtraTrace=f,r.activateLongStackTraces(),I.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return X.longStackTraces&&_()};var J=function(){try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return A.global.dispatchEvent(e),function(e,t){var n=new CustomEvent(e.toLowerCase(),{detail:t,cancelable:!0});return!A.global.dispatchEvent(n)}}return"function"==typeof Event?(e=new Event("CustomEvent"),A.global.dispatchEvent(e),function(e,t){var n=new Event(e.toLowerCase(),{cancelable:!0});return n.detail=t,!A.global.dispatchEvent(n)}):((e=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),A.global.dispatchEvent(e),function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e.toLowerCase(),!1,!0,t),!A.global.dispatchEvent(n)})}catch(e){}return function(){return!1}}(),V=A.isNode?function(){return t.emit.apply(t,arguments)}:A.global?function(e){var t="on"+e.toLowerCase(),n=A.global[t];return!!n&&(n.apply(A.global,[].slice.call(arguments,1)),!0)}:function(){return!1},W={promiseCreated:i,promiseFulfilled:i,promiseRejected:i,promiseResolved:i,promiseCancelled:i,promiseChained:function(e,t,n){return{promise:t,child:n}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,n){return{reason:t,promise:n}},rejectionHandled:i},q=function(e){var t=!1;try{t=V.apply(null,arguments)}catch(e){I.throwLater(e),t=!0}var n=!1;try{n=J(e,W[e].apply(null,arguments))}catch(e){I.throwLater(e),n=!0}return n||t};n.config=function(e){if("longStackTraces"in(e=Object(e))&&(e.longStackTraces?n.longStackTraces():!e.longStackTraces&&n.hasLongStackTraces()&&G()),"warnings"in e){var t=e.warnings;X.warnings=!!t,B=X.warnings,A.isObject(t)&&"wForgottenReturn"in t&&(B=!!t.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!X.cancellation){if(I.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");n.prototype._clearCancellationData=l,n.prototype._propagateFrom=d,n.prototype._onCancel=c,n.prototype._setOnCancel=u,n.prototype._attachCancellationCallback=s,n.prototype._execute=a,K=d,X.cancellation=!0}return"monitoring"in e&&(e.monitoring&&!X.monitoring?(X.monitoring=!0,n.prototype._fireEvent=q):!e.monitoring&&X.monitoring&&(X.monitoring=!1,n.prototype._fireEvent=o)),n},n.prototype._fireEvent=o,n.prototype._execute=function(e,t,n){try{e(t,n)}catch(e){return e}},n.prototype._onCancel=function(){},n.prototype._setOnCancel=function(e){},n.prototype._attachCancellationCallback=function(e){},n.prototype._captureStackTrace=function(){},n.prototype._attachExtraTrace=function(){},n.prototype._clearCancellationData=function(){},n.prototype._propagateFrom=function(e,t){};var K=function(e,t){0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)},z=function(){return!1},Q=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;A.inherits(C,Error),r.CapturedTrace=C,C.prototype.uncycle=function(){var e=this._length;if(!(e<2)){for(var t=[],n={},r=0,i=this;void 0!==i;++r)t.push(i),i=i._parent;for(r=(e=this._length=r)-1;r>=0;--r){var o=t[r].stack;void 0===n[o]&&(n[o]=r)}for(r=0;r<e;++r){var a=n[t[r].stack];if(void 0!==a&&a!==r){a>0&&(t[a-1]._parent=void 0,t[a-1]._length=1),t[r]._parent=void 0,t[r]._length=1;var s=r>0?t[r-1]:this;a<e-1?(s._parent=t[a+1],s._parent.uncycle(),s._length=s._parent._length+1):(s._parent=void 0,s._length=1);for(var c=s._length+1,u=r-2;u>=0;--u)t[u]._length=c,c++;return}}}},C.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=g(e),n=t.message,r=[t.stack],i=this;void 0!==i;)r.push(v(i.stack.split("\n"))),i=i._parent;!function(e){for(var t=e[0],n=1;n<e.length;++n){for(var r=e[n],i=t.length-1,o=t[i],a=-1,s=r.length-1;s>=0;--s)if(r[s]===o){a=s;break}for(s=a;s>=0;--s){var c=r[s];if(t[i]!==c)break;t.pop(),i--}t=r}}(r),function(e){for(var t=0;t<e.length;++t)(0===e[t].length||t+1<e.length&&e[t][0]===e[t+1][0])&&(e.splice(t,1),t--)}(r),A.notEnumerableProp(e,"stack",function(e,t){for(var n=0;n<t.length-1;++n)t[n].push("From previous event:"),t[n]=t[n].join("\n");return n<t.length&&(t[n]=t[n].join("\n")),e+"\n"+t.join("\n")}(n,r)),A.notEnumerableProp(e,"__stackCleaned__",!0)}};var $=function(){var e=/^\s*at\s*/,t=function(e,t){return"string"==typeof e?e:void 0!==t.name&&void 0!==t.message?t.toString():S(t)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,L=e,M=t;var n=Error.captureStackTrace;return z=function(e){return D.test(e)},function(e,t){Error.stackTraceLimit+=6,n(e,t),Error.stackTraceLimit-=6}}var r,i=new Error;if("string"==typeof i.stack&&i.stack.split("\n")[0].indexOf("stackDetection@")>=0)return L=/@/,M=t,j=!0,function(e){e.stack=(new Error).stack};try{throw new Error}catch(e){r="stack"in e}return"stack"in i||!r||"number"!=typeof Error.stackTraceLimit?(M=function(e,t){return"string"==typeof e?e:"object"!=typeof t&&"function"!=typeof t||void 0===t.name||void 0===t.message?S(t):t.toString()},null):(L=e,M=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(R=function(e){console.warn(e)},A.isNode&&t.stderr.isTTY?R=function(e,t){var n=t?"[33m":"[31m";console.warn(n+e+"[0m\n")}:A.isNode||"string"!=typeof(new Error).stack||(R=function(e,t){console.warn("%c"+e,t?"color: darkorange":"color: red")}));var X={warnings:U,longStackTraces:!1,cancellation:!1,monitoring:!1};return H&&n.longStackTraces(),{longStackTraces:function(){return X.longStackTraces},warnings:function(){return X.warnings},cancellation:function(){return X.cancellation},monitoring:function(){return X.monitoring},propagateFromFunction:function(){return K},boundValueFunction:function(){return p},checkForgottenReturns:function(e,t,n,r,i){if(void 0===e&&null!==t&&B){if(void 0!==i&&i._returnedNonUndefined())return;if(0==(65535&r._bitField))return;n&&(n+=" ");var o="",a="";if(t._trace){for(var s=t._trace.stack.split("\n"),c=v(s),u=c.length-1;u>=0;--u){var l=c[u];if(!x.test(l)){var d=l.match(N);d&&(o="at "+d[1]+":"+d[2]+":"+d[3]+" ");break}}if(c.length>0){var p=c[0];for(u=0;u<s.length;++u)if(s[u]===p){u>0&&(a="\n"+s[u-1]);break}}}var h="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(h,!0,t)}},setBounds:function(e,t){if(_()){for(var n,r,i=e.stack.split("\n"),o=t.stack.split("\n"),a=-1,s=-1,c=0;c<i.length;++c)if(u=T(i[c])){n=u.fileName,a=u.line;break}for(c=0;c<o.length;++c){var u;if(u=T(o[c])){r=u.fileName,s=u.line;break}}a<0||s<0||!n||!r||n!==r||a>=s||(z=function(e){if(D.test(e))return!0;var t=T(e);return!!(t&&t.fileName===n&&a<=t.line&&t.line<=s)})}},warn:m,deprecated:function(e,t){var n=e+" is deprecated and will be removed in a future version.";return t&&(n+=" Use "+t+" instead."),m(n)},CapturedTrace:C,fireDomEvent:J,fireGlobalEvent:V}}},{"./errors":12,"./util":36}],10:[function(e,t,n){"use strict";t.exports=function(e){function t(){return this.value}function n(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(n){return n instanceof e&&n.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:n},void 0)},e.prototype.throw=e.prototype.thenThrow=function(e){return this._then(n,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:e},void 0);var t=arguments[1];return this.caught(e,function(){throw t})},e.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof e&&n.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:n},void 0);var r=arguments[1];return r instanceof e&&r.suppressUnhandledRejections(),this.caught(n,function(){return r})}}},{}],11:[function(e,t,n){"use strict";t.exports=function(e,t){function n(){return i(this)}var r=e.reduce,i=e.all;e.prototype.each=function(e){return r(this,e,t,0)._then(n,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return r(this,e,t,t)},e.each=function(e,i){return r(e,i,t,0)._then(n,void 0,void 0,e,void 0)},e.mapSeries=function(e,n){return r(e,n,t,t)}}},{}],12:[function(e,t,n){"use strict";function r(e,t){function n(r){if(!(this instanceof n))return new n(r);d(this,"message","string"==typeof r?r:t),d(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return l(n,Error),n}function i(e){if(!(this instanceof i))return new i(e);d(this,"name","OperationalError"),d(this,"message",e),this.cause=e,this.isOperational=!0,e instanceof Error?(d(this,"message",e.message),d(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}var o,a,s=e("./es5"),c=s.freeze,u=e("./util"),l=u.inherits,d=u.notEnumerableProp,p=r("Warning","warning"),h=r("CancellationError","cancellation error"),f=r("TimeoutError","timeout error"),m=r("AggregateError","aggregate error");try{o=TypeError,a=RangeError}catch(e){o=r("TypeError","type error"),a=r("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g<v.length;++g)"function"==typeof Array.prototype[v[g]]&&(m.prototype[v[g]]=Array.prototype[v[g]]);s.defineProperty(m.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),m.prototype.isOperational=!0;var y=0;m.prototype.toString=function(){var e=Array(4*y+1).join(" "),t="\n"+e+"AggregateError of:\n";y++,e=Array(4*y+1).join(" ");for(var n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",i=r.split("\n"),o=0;o<i.length;++o)i[o]=e+i[o];t+=(r=i.join("\n"))+"\n"}return y--,t},l(i,Error);var b=Error.__BluebirdErrorTypes__;b||(b=c({CancellationError:h,TimeoutError:f,OperationalError:i,RejectionError:i,AggregateError:m}),s.defineProperty(Error,"__BluebirdErrorTypes__",{value:b,writable:!1,enumerable:!1,configurable:!1})),t.exports={Error:Error,TypeError:o,RangeError:a,CancellationError:b.CancellationError,OperationalError:b.OperationalError,TimeoutError:b.TimeoutError,AggregateError:b.AggregateError,Warning:p}},{"./es5":13,"./util":36}],13:[function(e,t,n){var r=function(){"use strict";return void 0===this}();if(r)t.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!(n&&!n.writable&&!n.set)}};else{var i={}.hasOwnProperty,o={}.toString,a={}.constructor.prototype,s=function(e){var t=[];for(var n in e)i.call(e,n)&&t.push(n);return t};t.exports={isArray:function(e){try{return"[object Array]"===o.call(e)}catch(e){return!1}},keys:s,names:s,defineProperty:function(e,t,n){return e[t]=n.value,e},getDescriptor:function(e,t){return{value:e[t]}},freeze:function(e){return e},getPrototypeOf:function(e){try{return Object(e).constructor.prototype}catch(e){return a}},isES5:r,propertyIsWritable:function(){return!0}}}},{}],14:[function(e,t,n){"use strict";t.exports=function(e,t){var n=e.map;e.prototype.filter=function(e,r){return n(this,e,r,t)},e.filter=function(e,r,i){return n(e,r,i,t)}}},{}],15:[function(e,t,n){"use strict";t.exports=function(t,n,r){function i(e,t,n){this.promise=e,this.type=t,this.handler=n,this.called=!1,this.cancelPromise=null}function o(e){this.finallyHandler=e}function a(e,t){return null!=e.cancelPromise&&(arguments.length>1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function s(){return u.call(this,this.promise._target()._settledValue())}function c(e){if(!a(this,e))return p.e=e,p}function u(e){var i=this.promise,u=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?u.call(i._boundValue()):u.call(i._boundValue(),e);if(l===r)return l;if(void 0!==l){i._setReturnedNonUndefined();var h=n(l,i);if(h instanceof t){if(null!=this.cancelPromise){if(h._isCancelled()){var f=new d("late cancellation observer");return i._attachExtraTrace(f),p.e=f,p}h.isPending()&&h._attachCancellationCallback(new o(this))}return h._then(s,c,void 0,this,void 0)}}}return i.isRejected()?(a(this),p.e=e,p):(a(this),e)}var l=e("./util"),d=t.CancellationError,p=l.errorObj,h=e("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){a(this.finallyHandler)},t.prototype._passThrough=function(e,t,n,r){return"function"!=typeof e?this.then():this._then(n,r,void 0,new i(this,t,e),void 0)},t.prototype.lastly=t.prototype.finally=function(e){return this._passThrough(e,0,u,u)},t.prototype.tap=function(e){return this._passThrough(e,1,u)},t.prototype.tapCatch=function(e){var n=arguments.length;if(1===n)return this._passThrough(e,1,void 0,u);var r,i=new Array(n-1),o=0;for(r=0;r<n-1;++r){var a=arguments[r];if(!l.isObject(a))return t.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+l.classString(a)));i[o++]=a}i.length=o;var s=arguments[r];return this._passThrough(h(i,s,this),1,void 0,u)},i}},{"./catch_filter":7,"./util":36}],16:[function(e,t,n){"use strict";t.exports=function(t,n,r,i,o,a){function s(e,n,i,o){if(a.cancellation()){var s=new t(r),c=this._finallyPromise=new t(r);this._promise=s.lastly(function(){return c}),s._captureStackTrace(),s._setOnCancel(this)}else(this._promise=new t(r))._captureStackTrace();this._stack=o,this._generatorFunction=e,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(p):p,this._yieldedPromise=null,this._cancellationPhase=!1}var c=e("./errors").TypeError,u=e("./util"),l=u.errorObj,d=u.tryCatch,p=[];u.inherits(s,o),s.prototype._isResolved=function(){return null===this._promise},s.prototype._cleanup=function(){this._promise=this._generator=null,a.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},s.prototype._promiseCancelled=function(){if(!this._isResolved()){var e;if(void 0!==this._generator.return)this._promise._pushContext(),e=d(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var n=new t.CancellationError("generator .return() sentinel");t.coroutine.returnSentinel=n,this._promise._attachExtraTrace(n),this._promise._pushContext(),e=d(this._generator.throw).call(this._generator,n),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(e)}},s.prototype._promiseFulfilled=function(e){this._yieldedPromise=null,this._promise._pushContext();var t=d(this._generator.next).call(this._generator,e);this._promise._popContext(),this._continue(t)},s.prototype._promiseRejected=function(e){this._yieldedPromise=null,this._promise._attachExtraTrace(e),this._promise._pushContext();var t=d(this._generator.throw).call(this._generator,e);this._promise._popContext(),this._continue(t)},s.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof t){var e=this._yieldedPromise;this._yieldedPromise=null,e.cancel()}},s.prototype.promise=function(){return this._promise},s.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},s.prototype._continue=function(e){var n=this._promise;if(e===l)return this._cleanup(),this._cancellationPhase?n.cancel():n._rejectCallback(e.e,!1);var r=e.value;if(!0===e.done)return this._cleanup(),this._cancellationPhase?n.cancel():n._resolveCallback(r);var o=i(r,this._promise);if(o instanceof t||null!==(o=function(e,n,r){for(var o=0;o<n.length;++o){r._pushContext();var a=d(n[o])(e);if(r._popContext(),a===l){r._pushContext();var s=t.reject(l.e);return r._popContext(),s}var c=i(a,r);if(c instanceof t)return c}return null}(o,this._yieldHandlers,this._promise))){var a=(o=o._target())._bitField;0==(50397184&a)?(this._yieldedPromise=o,o._proxy(this,null)):0!=(33554432&a)?t._async.invoke(this._promiseFulfilled,this,o._value()):0!=(16777216&a)?t._async.invoke(this._promiseRejected,this,o._reason()):this._promiseCancelled()}else this._promiseRejected(new c("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",String(r))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")))},t.coroutine=function(e,t){if("function"!=typeof e)throw new c("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var n=Object(t).yieldHandler,r=s,i=(new Error).stack;return function(){var t=e.apply(this,arguments),o=new r(void 0,void 0,n,i),a=o.promise();return o._generator=t,o._promiseFulfilled(void 0),a}},t.coroutine.addYieldHandler=function(e){if("function"!=typeof e)throw new c("expecting a function but got "+u.classString(e));p.push(e)},t.spawn=function(e){if(a.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof e)return n("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var r=new s(e,this),i=r.promise();return r._run(t.spawn),i}}},{"./errors":12,"./util":36}],17:[function(e,t,n){"use strict";t.exports=function(t,n,r,i,o,a){var s=e("./util");s.canEvaluate,s.tryCatch,s.errorObj,t.join=function(){var e,t=arguments.length-1;t>0&&"function"==typeof arguments[t]&&(e=arguments[t]);var r=[].slice.call(arguments);e&&r.pop();var i=new n(r).promise();return void 0!==e?i.spread(e):i}}},{"./util":36}],18:[function(e,t,n){"use strict";t.exports=function(t,n,r,i,o,a){function s(e,t,n,r){this.constructor$(e),this._promise._captureStackTrace();var i=u();this._callback=null===i?t:l.domainBind(i,t),this._preservedValues=r===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],h.invoke(this._asyncInit,this,void 0)}function c(e,n,i,o){if("function"!=typeof n)return r("expecting a function but got "+l.classString(n));var a=0;if(void 0!==i){if("object"!=typeof i||null===i)return t.reject(new TypeError("options argument must be an object but it is "+l.classString(i)));if("number"!=typeof i.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+l.classString(i.concurrency)));a=i.concurrency}return new s(e,n,a="number"==typeof a&&isFinite(a)&&a>=1?a:0,o).promise()}var u=t._getDomain,l=e("./util"),d=l.tryCatch,p=l.errorObj,h=t._async;l.inherits(s,n),s.prototype._asyncInit=function(){this._init$(void 0,-2)},s.prototype._init=function(){},s.prototype._promiseFulfilled=function(e,n){var r=this._values,o=this.length(),s=this._preservedValues,c=this._limit;if(n<0){if(r[n=-1*n-1]=e,c>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(c>=1&&this._inFlight>=c)return r[n]=e,this._queue.push(n),!1;null!==s&&(s[n]=e);var u=this._promise,l=this._callback,h=u._boundValue();u._pushContext();var f=d(l).call(h,e,n,o),m=u._popContext();if(a.checkForgottenReturns(f,m,null!==s?"Promise.filter":"Promise.map",u),f===p)return this._reject(f.e),!0;var v=i(f,this._promise);if(v instanceof t){var g=(v=v._target())._bitField;if(0==(50397184&g))return c>=1&&this._inFlight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0==(33554432&g))return 0!=(16777216&g)?(this._reject(v._reason()),!0):(this._cancel(),!0);f=v._value()}r[n]=f}return++this._totalResolved>=o&&(null!==s?this._filter(r,s):this._resolve(r),!0)},s.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,n=this._values;e.length>0&&this._inFlight<t;){if(this._isResolved())return;var r=e.pop();this._promiseFulfilled(n[r],r)}},s.prototype._filter=function(e,t){for(var n=t.length,r=new Array(n),i=0,o=0;o<n;++o)e[o]&&(r[i++]=t[o]);r.length=i,this._resolve(r)},s.prototype.preservedValues=function(){return this._preservedValues},t.prototype.map=function(e,t){return c(this,e,t,null)},t.map=function(e,t,n,r){return c(e,t,n,r)}}},{"./util":36}],19:[function(e,t,n){"use strict";t.exports=function(t,n,r,i,o){var a=e("./util"),s=a.tryCatch;t.method=function(e){if("function"!=typeof e)throw new t.TypeError("expecting a function but got "+a.classString(e));return function(){var r=new t(n);r._captureStackTrace(),r._pushContext();var i=s(e).apply(this,arguments),a=r._popContext();return o.checkForgottenReturns(i,a,"Promise.method",r),r._resolveFromSyncValue(i),r}},t.attempt=t.try=function(e){if("function"!=typeof e)return i("expecting a function but got "+a.classString(e));var r,c=new t(n);if(c._captureStackTrace(),c._pushContext(),arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var u=arguments[1],l=arguments[2];r=a.isArray(u)?s(e).apply(l,u):s(e).call(l,u)}else r=s(e)();var d=c._popContext();return o.checkForgottenReturns(r,d,"Promise.try",c),c._resolveFromSyncValue(r),c},t.prototype._resolveFromSyncValue=function(e){e===a.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}},{"./util":36}],20:[function(e,t,n){"use strict";function r(e){var t,n;if((n=e)instanceof Error&&s.getPrototypeOf(n)===Error.prototype){(t=new a(e)).name=e.name,t.message=e.message,t.stack=e.stack;for(var r=s.keys(e),o=0;o<r.length;++o){var u=r[o];c.test(u)||(t[u]=e[u])}return t}return i.markAsOriginatingFromRejection(e),e}var i=e("./util"),o=i.maybeWrapAsError,a=e("./errors").OperationalError,s=e("./es5"),c=/^(?:name|message|stack|cause)$/;t.exports=function(e,t){return function(n,i){if(null!==e){if(n){var a=r(o(n));e._attachExtraTrace(a),e._reject(a)}else if(t){var s=[].slice.call(arguments,1);e._fulfill(s)}else e._fulfill(i);e=null}}}},{"./errors":12,"./es5":13,"./util":36}],21:[function(e,t,n){"use strict";t.exports=function(t){function n(e,t){if(!o.isArray(e))return r.call(this,e,t);var n=s(t).apply(this._boundValue(),[null].concat(e));n===c&&a.throwLater(n.e)}function r(e,t){var n=this._boundValue(),r=void 0===e?s(t).call(n,null):s(t).call(n,null,e);r===c&&a.throwLater(r.e)}function i(e,t){if(!e){var n=new Error(e+"");n.cause=e,e=n}var r=s(t).call(this._boundValue(),e);r===c&&a.throwLater(r.e)}var o=e("./util"),a=t._async,s=o.tryCatch,c=o.errorObj;t.prototype.asCallback=t.prototype.nodeify=function(e,t){if("function"==typeof e){var o=r;void 0!==t&&Object(t).spread&&(o=n),this._then(o,i,void 0,this,e)}return this}}},{"./util":36}],22:[function(e,n,r){"use strict";n.exports=function(){function r(){}function i(e){e!==S&&function(e,t){if(null==e||e.constructor!==i)throw new y("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof t)throw new y("expecting a function but got "+h.classString(t))}(this,e),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(e),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function o(e){this.promise._resolveCallback(e)}function a(e){this.promise._rejectCallback(e,!1)}function s(e){var t=new i(S);t._fulfillmentHandler0=e,t._rejectionHandler0=e,t._promise0=e,t._receiver0=e}var c,u=function(){return new y("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},l=function(){return new i.PromiseInspection(this._target())},d=function(e){return i.reject(new y(e))},p={},h=e("./util");c=h.isNode?function(){var e=t.domain;return void 0===e&&(e=null),e}:function(){return null},h.notEnumerableProp(i,"_getDomain",c);var f=e("./es5"),m=e("./async"),v=new m;f.defineProperty(i,"_async",{value:v});var g=e("./errors"),y=i.TypeError=g.TypeError;i.RangeError=g.RangeError;var b=i.CancellationError=g.CancellationError;i.TimeoutError=g.TimeoutError,i.OperationalError=g.OperationalError,i.RejectionError=g.OperationalError,i.AggregateError=g.AggregateError;var S=function(){},_={},T={},C=e("./thenables")(i,S),E=e("./promise_array")(i,S,C,d,r),w=e("./context")(i),R=w.create,k=e("./debuggability")(i,w),I=(k.CapturedTrace,e("./finally")(i,C,T)),P=e("./catch_filter")(T),A=e("./nodeback"),O=h.errorObj,D=h.tryCatch;return i.prototype.toString=function(){return"[object Promise]"},i.prototype.caught=i.prototype.catch=function(e){var t=arguments.length;if(t>1){var n,r=new Array(t-1),i=0;for(n=0;n<t-1;++n){var o=arguments[n];if(!h.isObject(o))return d("Catch statement predicate: expecting an object but got "+h.classString(o));r[i++]=o}return r.length=i,e=arguments[n],this.then(void 0,P(r,e,this))}return this.then(void 0,e)},i.prototype.reflect=function(){return this._then(l,l,void 0,this,void 0)},i.prototype.then=function(e,t){if(k.warnings()&&arguments.length>0&&"function"!=typeof e&&"function"!=typeof t){var n=".then() only accepts functions but was passed: "+h.classString(e);arguments.length>1&&(n+=", "+h.classString(t)),this._warn(n)}return this._then(e,t,void 0,void 0,void 0)},i.prototype.done=function(e,t){this._then(e,t,void 0,void 0,void 0)._setIsFinal()},i.prototype.spread=function(e){return"function"!=typeof e?d("expecting a function but got "+h.classString(e)):this.all()._then(e,void 0,void 0,_,void 0)},i.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new E(this).promise()},i.prototype.error=function(e){return this.caught(h.originatesFromRejection,e)},i.getNewLibraryCopy=n.exports,i.is=function(e){return e instanceof i},i.fromNode=i.fromCallback=function(e){var t=new i(S);t._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,r=D(e)(A(t,n));return r===O&&t._rejectCallback(r.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},i.all=function(e){return new E(e).promise()},i.cast=function(e){var t=C(e);return t instanceof i||((t=new i(S))._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(e){var t=new i(S);return t._captureStackTrace(),t._rejectCallback(e,!0),t},i.setScheduler=function(e){if("function"!=typeof e)throw new y("expecting a function but got "+h.classString(e));return v.setScheduler(e)},i.prototype._then=function(e,t,n,r,o){var a=void 0!==o,s=a?o:new i(S),u=this._target(),l=u._bitField;a||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===r&&0!=(2097152&this._bitField)&&(r=0!=(50397184&l)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var d=c();if(0!=(50397184&l)){var p,f,m=u._settlePromiseCtx;0!=(33554432&l)?(f=u._rejectionHandler0,p=e):0!=(16777216&l)?(f=u._fulfillmentHandler0,p=t,u._unsetRejectionIsUnhandled()):(m=u._settlePromiseLateCancellationObserver,f=new b("late cancellation observer"),u._attachExtraTrace(f),p=t),v.invoke(m,u,{handler:null===d?p:"function"==typeof p&&h.domainBind(d,p),promise:s,receiver:r,value:f})}else u._addCallbacks(e,t,s,r,d);return s},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},i.prototype._setLength=function(e){this._bitField=-65536&this._bitField|65535&e},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){v.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==p)return void 0===t&&this._isBound()?this._boundValue():t},i.prototype._promiseAt=function(e){return this[4*e-4+2]},i.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},i.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(e){e._bitField;var t=e._fulfillmentHandler0,n=e._rejectionHandler0,r=e._promise0,i=e._receiverAt(0);void 0===i&&(i=p),this._addCallbacks(t,n,r,i,null)},i.prototype._migrateCallbackAt=function(e,t){var n=e._fulfillmentHandlerAt(t),r=e._rejectionHandlerAt(t),i=e._promiseAt(t),o=e._receiverAt(t);void 0===o&&(o=p),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(e,t,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof e&&(this._fulfillmentHandler0=null===i?e:h.domainBind(i,e)),"function"==typeof t&&(this._rejectionHandler0=null===i?t:h.domainBind(i,t));else{var a=4*o-4;this[a+2]=n,this[a+3]=r,"function"==typeof e&&(this[a+0]=null===i?e:h.domainBind(i,e)),"function"==typeof t&&(this[a+1]=null===i?t:h.domainBind(i,t))}return this._setLength(o+1),o},i.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},i.prototype._resolveCallback=function(e,t){if(0==(117506048&this._bitField)){if(e===this)return this._rejectCallback(u(),!1);var n=C(e,this);if(!(n instanceof i))return this._fulfill(e);t&&this._propagateFrom(n,2);var r=n._target();if(r!==this){var o=r._bitField;if(0==(50397184&o)){var a=this._length();a>0&&r._migrateCallback0(this);for(var s=1;s<a;++s)r._migrateCallbackAt(this,s);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else if(0!=(33554432&o))this._fulfill(r._value());else if(0!=(16777216&o))this._reject(r._reason());else{var c=new b("late cancellation observer");r._attachExtraTrace(c),this._reject(c)}}else this._reject(u())}},i.prototype._rejectCallback=function(e,t,n){var r=h.ensureErrorObject(e),i=r===e;if(!i&&!n&&k.warnings()){var o="a promise was rejected with a non-error: "+h.classString(e);this._warn(o,!0)}this._attachExtraTrace(r,!!t&&i),this._reject(e)},i.prototype._resolveFromExecutor=function(e){if(e!==S){var t=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(e,function(e){t._resolveCallback(e)},function(e){t._rejectCallback(e,n)});n=!1,this._popContext(),void 0!==r&&t._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(e,t,n,r){var i=r._bitField;if(0==(65536&i)){var o;r._pushContext(),t===_?n&&"number"==typeof n.length?o=D(e).apply(this._boundValue(),n):(o=O).e=new y("cannot .spread() a non-array: "+h.classString(n)):o=D(e).call(t,n);var a=r._popContext();0==(65536&(i=r._bitField))&&(o===T?r._reject(n):o===O?r._rejectCallback(o.e,!1):(k.checkForgottenReturns(o,a,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var e=this;e._isFollowing();)e=e._followee();return e},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(e){this._rejectionHandler0=e},i.prototype._settlePromise=function(e,t,n,o){var a=e instanceof i,s=this._bitField,c=0!=(134217728&s);0!=(65536&s)?(a&&e._invokeInternalOnCancel(),n instanceof I&&n.isFinallyHandler()?(n.cancelPromise=e,D(t).call(n,o)===O&&e._reject(O.e)):t===l?e._fulfill(l.call(n)):n instanceof r?n._promiseCancelled(e):a||e instanceof E?e._cancel():n.cancel()):"function"==typeof t?a?(c&&e._setAsyncGuaranteed(),this._settlePromiseFromHandler(t,n,o,e)):t.call(n,o,e):n instanceof r?n._isResolved()||(0!=(33554432&s)?n._promiseFulfilled(o,e):n._promiseRejected(o,e)):a&&(c&&e._setAsyncGuaranteed(),0!=(33554432&s)?e._fulfill(o):e._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(e){var t=e.handler,n=e.promise,r=e.receiver,o=e.value;"function"==typeof t?n instanceof i?this._settlePromiseFromHandler(t,r,o,n):t.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(e){this._settlePromise(e.promise,e.handler,e.receiver,e.value)},i.prototype._settlePromise0=function(e,t,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,e,i,t)},i.prototype._clearCallbackDataAtIndex=function(e){var t=4*e-4;this[t+2]=this[t+3]=this[t+0]=this[t+1]=void 0},i.prototype._fulfill=function(e){var t=this._bitField;if(!((117506048&t)>>>16)){if(e===this){var n=u();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=e,(65535&t)>0&&(0!=(134217728&t)?this._settlePromises():v.settlePromises(this))}},i.prototype._reject=function(e){var t=this._bitField;if(!((117506048&t)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=e,this._isFinal())return v.fatalError(e,h.isNode);(65535&t)>0?v.settlePromises(this):this._ensurePossibleRejectionHandled()}},i.prototype._fulfillPromises=function(e,t){for(var n=1;n<e;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,t)}},i.prototype._rejectPromises=function(e,t){for(var n=1;n<e;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,t)}},i.prototype._settlePromises=function(){var e=this._bitField,t=65535&e;if(t>0){if(0!=(16842752&e)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,e),this._rejectPromises(t,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,e),this._fulfillPromises(t,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var e=this._bitField;return 0!=(33554432&e)?this._rejectionHandler0:0!=(16777216&e)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){return k.deprecated("Promise.defer","new Promise"),{promise:new i(S),resolve:o,reject:a}},h.notEnumerableProp(i,"_makeSelfResolutionError",u),e("./method")(i,S,C,d,k),e("./bind")(i,S,C,k),e("./cancel")(i,E,d,k),e("./direct_resolve")(i),e("./synchronous_inspection")(i),e("./join")(i,E,C,S,v,c),i.Promise=i,i.version="3.5.1",e("./map.js")(i,E,d,C,S,k),e("./call_get.js")(i),e("./using.js")(i,d,C,R,S,k),e("./timers.js")(i,S,k),e("./generators.js")(i,d,S,C,r,k),e("./nodeify.js")(i),e("./promisify.js")(i,S),e("./props.js")(i,E,C,d),e("./race.js")(i,S,C,d),e("./reduce.js")(i,E,d,C,S,k),e("./settle.js")(i,E,k),e("./some.js")(i,E,d),e("./filter.js")(i,S),e("./each.js")(i,S),e("./any.js")(i),h.toFastProperties(i),h.toFastProperties(i.prototype),s({a:1}),s({b:2}),s({c:3}),s(1),s(function(){}),s(void 0),s(!1),s(new i(S)),k.setBounds(m.firstLineError,h.lastLineError),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(e,t,n){"use strict";t.exports=function(t,n,r,i,o){function a(e){var r=this._promise=new t(n);e instanceof t&&r._propagateFrom(e,3),r._setOnCancel(this),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var s=e("./util");return s.isArray,s.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function e(n,o){var a=r(this._values,this._promise);if(a instanceof t){var c=(a=a._target())._bitField;if(this._values=a,0==(50397184&c))return this._promise._setAsyncGuaranteed(),a._then(e,this._reject,void 0,this,o);if(0==(33554432&c))return 0!=(16777216&c)?this._reject(a._reason()):this._cancel();a=a._value()}if(null!==(a=s.asArray(a)))0!==a.length?this._iterate(a):-5===o?this._resolveEmptyArray():this._resolve(function(e){switch(e){case-2:return[];case-3:return{};case-6:return new Map}}(o));else{var u=i("expecting an array or an iterable object but got "+s.classString(a)).reason();this._promise._rejectCallback(u,!1)}},a.prototype._iterate=function(e){var n=this.getActualLength(e.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,a=null,s=0;s<n;++s){var c=r(e[s],i);a=c instanceof t?(c=c._target())._bitField:null,o?null!==a&&c.suppressUnhandledRejections():null!==a?0==(50397184&a)?(c._proxy(this,s),this._values[s]=c):o=0!=(33554432&a)?this._promiseFulfilled(c._value(),s):0!=(16777216&a)?this._promiseRejected(c._reason(),s):this._promiseCancelled(s):o=this._promiseFulfilled(c,s)}o||i._setAsyncGuaranteed()},a.prototype._isResolved=function(){return null===this._values},a.prototype._resolve=function(e){this._values=null,this._promise._fulfill(e)},a.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},a.prototype._reject=function(e){this._values=null,this._promise._rejectCallback(e,!1)},a.prototype._promiseFulfilled=function(e,t){return this._values[t]=e,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(e){return this._totalResolved++,this._reject(e),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var e=this._values;if(this._cancel(),e instanceof t)e.cancel();else for(var n=0;n<e.length;++n)e[n]instanceof t&&e[n].cancel()}},a.prototype.shouldCopyValues=function(){return!0},a.prototype.getActualLength=function(e){return e},a}},{"./util":36}],24:[function(e,t,n){"use strict";t.exports=function(t,n){function r(e){return!m.test(e)}function i(e){try{return!0===e.__isPromisified__}catch(e){return!1}}function o(e,t,n,r){for(var o,a,s,u,l=c.inheritedDataKeys(e),d=[],p=0;p<l.length;++p){var m=l[p],g=e[m],y=r===v||v(m,g,e);"function"!=typeof g||i(g)||(o=e,a=m,s=t,(u=c.getDataPropertyOrDefault(o,a+s,f))&&i(u))||!r(m,g,e,y)||d.push(m,g)}return function(e,t,n){for(var r=0;r<e.length;r+=2){var i=e[r];if(n.test(i))for(var o=i.replace(n,""),a=0;a<e.length;a+=2)if(e[a]===o)throw new h("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s",t))}}(d,t,n),d}function a(e,t,n,r,i){for(var a=new RegExp(g(t)+"$"),u=o(e,t,a,n),l=0,d=u.length;l<d;l+=2){var p=u[l],h=u[l+1],f=p+t;if(r===y)e[f]=y(p,s,p,h,t,i);else{var m=r(h,function(){return y(p,s,p,h,t,i)});c.notEnumerableProp(m,"__isPromisified__",!0),e[f]=m}}return c.toFastProperties(e),e}var s={},c=e("./util"),u=e("./nodeback"),l=c.withAppended,d=c.maybeWrapAsError,p=c.canEvaluate,h=e("./errors").TypeError,f={__isPromisified__:!0},m=new RegExp("^(?:"+["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"].join("|")+")$"),v=function(e){return c.isIdentifier(e)&&"_"!==e.charAt(0)&&"constructor"!==e},g=function(e){return e.replace(/([$])/,"\\$")},y=p?void 0:function(e,r,i,o,a,p){function h(){var i=r;r===s&&(i=this);var o=new t(n);o._captureStackTrace();var a="string"==typeof m&&this!==f?this[m]:e,c=u(o,p);try{a.apply(i,l(arguments,c))}catch(e){o._rejectCallback(d(e),!0,!0)}return o._isFateSealed()||o._setAsyncGuaranteed(),o}var f=function(){return this}(),m=e;return"string"==typeof m&&(e=o),c.notEnumerableProp(h,"__isPromisified__",!0),h};t.promisify=function(e,t){if("function"!=typeof e)throw new h("expecting a function but got "+c.classString(e));if(i(e))return e;var n,o=void 0===(t=Object(t)).context?s:t.context,a=!!t.multiArgs,u=y(n=e,o,void 0,n,null,a);return c.copyDescriptors(e,u,r),u},t.promisifyAll=function(e,t){if("function"!=typeof e&&"object"!=typeof e)throw new h("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");var n=!!(t=Object(t)).multiArgs,r=t.suffix;"string"!=typeof r&&(r="Async");var i=t.filter;"function"!=typeof i&&(i=v);var o=t.promisifier;if("function"!=typeof o&&(o=y),!c.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=c.inheritedDataKeys(e),u=0;u<s.length;++u){var l=e[s[u]];"constructor"!==s[u]&&c.isClass(l)&&(a(l.prototype,r,i,o,n),a(l,r,i,o,n))}return a(e,r,i,o,n)}}},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(e,t,n){"use strict";t.exports=function(t,n,r,i){function o(e){var t,n=!1;if(void 0!==s&&e instanceof s)t=d(e),n=!0;else{var r=l.keys(e),i=r.length;t=new Array(2*i);for(var o=0;o<i;++o){var a=r[o];t[o]=e[a],t[o+i]=a}}this.constructor$(t),this._isMap=n,this._init$(void 0,n?-6:-3)}function a(e){var n,a=r(e);return u(a)?(n=a instanceof t?a._then(t.props,void 0,void 0,void 0,void 0):new o(a).promise(),a instanceof t&&n._propagateFrom(a,2),n):i("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}var s,c=e("./util"),u=c.isObject,l=e("./es5");"function"==typeof Map&&(s=Map);var d=function(){function e(e,r){this[t]=e,this[t+n]=r,t++}var t=0,n=0;return function(r){n=r.size,t=0;var i=new Array(2*r.size);return r.forEach(e,i),i}}();c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(e,t){if(this._values[t]=e,++this._totalResolved>=this._length){var n;if(this._isMap)n=function(e){for(var t=new s,n=e.length/2|0,r=0;r<n;++r){var i=e[n+r],o=e[r];t.set(i,o)}return t}(this._values);else{n={};for(var r=this.length(),i=0,o=this.length();i<o;++i)n[this._values[i+r]]=this._values[i]}return this._resolve(n),!0}return!1},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(e){return e>>1},t.prototype.props=function(){return a(this)},t.props=function(e){return a(e)}}},{"./es5":13,"./util":36}],26:[function(e,t,n){"use strict";function r(e){this._capacity=e,this._length=0,this._front=0}r.prototype._willBeOverCapacity=function(e){return this._capacity<e},r.prototype._pushOne=function(e){var t=this.length();this._checkCapacity(t+1),this[this._front+t&this._capacity-1]=e,this._length=t+1},r.prototype.push=function(e,t,n){var r=this.length()+3;if(this._willBeOverCapacity(r))return this._pushOne(e),this._pushOne(t),void this._pushOne(n);var i=this._front+r-3;this._checkCapacity(r);var o=this._capacity-1;this[i+0&o]=e,this[i+1&o]=t,this[i+2&o]=n,this._length=r},r.prototype.shift=function(){var e=this._front,t=this[e];return this[e]=void 0,this._front=e+1&this._capacity-1,this._length--,t},r.prototype.length=function(){return this._length},r.prototype._checkCapacity=function(e){this._capacity<e&&this._resizeTo(this._capacity<<1)},r.prototype._resizeTo=function(e){var t=this._capacity;this._capacity=e,function(e,t,n,r,i){for(var o=0;o<i;++o)n[o+r]=e[o+0],e[o+0]=void 0}(this,0,this,t,this._front+this._length&t-1)},t.exports=r},{}],27:[function(e,t,n){"use strict";t.exports=function(t,n,r,i){function o(e,o){var c=r(e);if(c instanceof t)return s(c);if(null===(e=a.asArray(e)))return i("expecting an array or an iterable object but got "+a.classString(e));var u=new t(n);void 0!==o&&u._propagateFrom(o,3);for(var l=u._fulfill,d=u._reject,p=0,h=e.length;p<h;++p){var f=e[p];(void 0!==f||p in e)&&t.cast(f)._then(l,d,void 0,u,null)}return u}var a=e("./util"),s=function(e){return e.then(function(t){return o(t,e)})};t.race=function(e){return o(e,void 0)},t.prototype.race=function(){return o(this,void 0)}}},{"./util":36}],28:[function(e,t,n){"use strict";t.exports=function(t,n,r,i,o,a){function s(e,n,r,i){this.constructor$(e);var a=p();this._fn=null===a?n:h.domainBind(a,n),void 0!==r&&(r=t.resolve(r))._attachCancellationCallback(this),this._initialValue=r,this._currentCancellable=null,this._eachValues=i===o?Array(this._length):0===i?null:void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function c(e,t){this.isFulfilled()?t._resolve(e):t._reject(e)}function u(e,t,n,i){return"function"!=typeof t?r("expecting a function but got "+h.classString(t)):new s(e,t,n,i).promise()}function l(e){this.accum=e,this.array._gotAccum(e);var n=i(this.value,this.array._promise);return n instanceof t?(this.array._currentCancellable=n,n._then(d,void 0,void 0,this,void 0)):d.call(this,n)}function d(e){var n,r=this.array,i=r._promise,o=f(r._fn);i._pushContext(),(n=void 0!==r._eachValues?o.call(i._boundValue(),e,this.index,this.length):o.call(i._boundValue(),this.accum,e,this.index,this.length))instanceof t&&(r._currentCancellable=n);var s=i._popContext();return a.checkForgottenReturns(n,s,void 0!==r._eachValues?"Promise.each":"Promise.reduce",i),n}var p=t._getDomain,h=e("./util"),f=h.tryCatch;h.inherits(s,n),s.prototype._gotAccum=function(e){void 0!==this._eachValues&&null!==this._eachValues&&e!==o&&this._eachValues.push(e)},s.prototype._eachComplete=function(e){return null!==this._eachValues&&this._eachValues.push(e),this._eachValues},s.prototype._init=function(){},s.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},s.prototype.shouldCopyValues=function(){return!1},s.prototype._resolve=function(e){this._promise._resolveCallback(e),this._values=null},s.prototype._resultCancelled=function(e){if(e===this._initialValue)return this._cancel();this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof t&&this._currentCancellable.cancel(),this._initialValue instanceof t&&this._initialValue.cancel())},s.prototype._iterate=function(e){var n,r;this._values=e;var i=e.length;if(void 0!==this._initialValue?(n=this._initialValue,r=0):(n=t.resolve(e[0]),r=1),this._currentCancellable=n,!n.isRejected())for(;r<i;++r){var o={accum:null,value:e[r],index:r,length:i,array:this};n=n._then(l,void 0,void 0,o,void 0)}void 0!==this._eachValues&&(n=n._then(this._eachComplete,void 0,void 0,this,void 0)),n._then(c,c,void 0,n,this)},t.prototype.reduce=function(e,t){return u(this,e,t,null)},t.reduce=function(e,t,n,r){return u(e,t,n,r)}}},{"./util":36}],29:[function(e,i,o){"use strict";var a,s=e("./util"),c=s.getNativePromise();if(s.isNode&&"undefined"==typeof MutationObserver){var u=n.setImmediate,l=t.nextTick;a=s.isRecentNode?function(e){u.call(n,e)}:function(e){l.call(t,e)}}else if("function"==typeof c&&"function"==typeof c.resolve){var d=c.resolve();a=function(e){d.then(e)}}else a="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)?void 0!==r?function(e){r(e)}:"undefined"!=typeof setTimeout?function(e){setTimeout(e,0)}:function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}:function(){var e=document.createElement("div"),t={attributes:!0},n=!1,r=document.createElement("div");return new MutationObserver(function(){e.classList.toggle("foo"),n=!1}).observe(r,t),function(i){var o=new MutationObserver(function(){o.disconnect(),i()});o.observe(e,t),n||(n=!0,r.classList.toggle("foo"))}}();i.exports=a},{"./util":36}],30:[function(e,t,n){"use strict";t.exports=function(t,n,r){function i(e){this.constructor$(e)}var o=t.PromiseInspection;e("./util").inherits(i,n),i.prototype._promiseResolved=function(e,t){return this._values[e]=t,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},i.prototype._promiseFulfilled=function(e,t){var n=new o;return n._bitField=33554432,n._settledValueField=e,this._promiseResolved(t,n)},i.prototype._promiseRejected=function(e,t){var n=new o;return n._bitField=16777216,n._settledValueField=e,this._promiseResolved(t,n)},t.settle=function(e){return r.deprecated(".settle()",".reflect()"),new i(e).promise()},t.prototype.settle=function(){return t.settle(this)}}},{"./util":36}],31:[function(e,t,n){"use strict";t.exports=function(t,n,r){function i(e){this.constructor$(e),this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(e,t){if((0|t)!==t||t<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new i(e),o=n.promise();return n.setHowMany(t),n.init(),o}var a=e("./util"),s=e("./errors").RangeError,c=e("./errors").AggregateError,u=a.isArray,l={};a.inherits(i,n),i.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var e=u(this._values);!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(e){this._howMany=e},i.prototype._promiseFulfilled=function(e){return this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},i.prototype._promiseRejected=function(e){return this._addRejected(e),this._checkOutcome()},i.prototype._promiseCancelled=function(){return this._values instanceof t||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},i.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var e=new c,t=this.length();t<this._values.length;++t)this._values[t]!==l&&e.push(this._values[t]);return e.length>0?this._reject(e):this._cancel(),!0}return!1},i.prototype._fulfilled=function(){return this._totalResolved},i.prototype._rejected=function(){return this._values.length-this.length()},i.prototype._addRejected=function(e){this._values.push(e)},i.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},i.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},i.prototype._getRangeError=function(e){var t="Input array must contain at least "+this._howMany+" items but contains only "+e+" items";return new s(t)},i.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},t.some=function(e,t){return o(e,t)},t.prototype.some=function(e){return o(this,e)},t._SomePromiseArray=i}},{"./errors":12,"./util":36}],32:[function(e,t,n){"use strict";t.exports=function(e){function t(e){void 0!==e?(e=e._target(),this._bitField=e._bitField,this._settledValueField=e._isFateSealed()?e._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}t.prototype._settledValue=function(){return this._settledValueField};var n=t.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=t.prototype.error=t.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=t.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},o=t.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},a=t.prototype.isPending=function(){return 0==(50397184&this._bitField)},s=t.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};t.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},e.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},e.prototype._isCancelled=function(){return this._target().__isCancelled()},e.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},e.prototype.isPending=function(){return a.call(this._target())},e.prototype.isRejected=function(){return o.call(this._target())},e.prototype.isFulfilled=function(){return i.call(this._target())},e.prototype.isResolved=function(){return s.call(this._target())},e.prototype.value=function(){return n.call(this._target())},e.prototype.reason=function(){var e=this._target();return e._unsetRejectionIsUnhandled(),r.call(e)},e.prototype._value=function(){return this._settledValue()},e.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},e.PromiseInspection=t}},{}],33:[function(e,t,n){"use strict";t.exports=function(t,n){var r=e("./util"),i=r.errorObj,o=r.isObject,a={}.hasOwnProperty;return function(e,s){if(o(e)){if(e instanceof t)return e;var c=function(e){try{return e.then}catch(e){return i.e=e,i}}(e);if(c===i){s&&s._pushContext();var u=t.reject(c.e);return s&&s._popContext(),u}if("function"==typeof c)return function(e){try{return a.call(e,"_promise0")}catch(e){return!1}}(e)?(u=new t(n),e._then(u._fulfill,u._reject,void 0,u,null),u):function(e,o,a){var s=new t(n),c=s;a&&a._pushContext(),s._captureStackTrace(),a&&a._popContext();var u=!0,l=r.tryCatch(o).call(e,function(e){s&&(s._resolveCallback(e),s=null)},function(e){s&&(s._rejectCallback(e,u,!0),s=null)});return u=!1,s&&l===i&&(s._rejectCallback(l.e,!0,!0),s=null),c}(e,c,s)}return e}}},{"./util":36}],34:[function(e,t,n){"use strict";t.exports=function(t,n,r){function i(e){this.handle=e}function o(e){return clearTimeout(this.handle),e}function a(e){throw clearTimeout(this.handle),e}var s=e("./util"),c=t.TimeoutError;i.prototype._resultCancelled=function(){clearTimeout(this.handle)};var u=function(e){return l(+this).thenReturn(e)},l=t.delay=function(e,o){var a,s;return void 0!==o?(a=t.resolve(o)._then(u,null,null,e,void 0),r.cancellation()&&o instanceof t&&a._setOnCancel(o)):(a=new t(n),s=setTimeout(function(){a._fulfill()},+e),r.cancellation()&&a._setOnCancel(new i(s)),a._captureStackTrace()),a._setAsyncGuaranteed(),a};t.prototype.delay=function(e){return l(e,this)},t.prototype.timeout=function(e,t){var n,u;e=+e;var l=new i(setTimeout(function(){var e,r,i,o;n.isPending()&&(e=n,i=u,o="string"!=typeof(r=t)?r instanceof Error?r:new c("operation timed out"):new c(r),s.markAsOriginatingFromRejection(o),e._attachExtraTrace(o),e._reject(o),null!=i&&i.cancel())},e));return r.cancellation()?(u=this.then(),(n=u._then(o,a,void 0,l,void 0))._setOnCancel(l)):n=this._then(o,a,void 0,l,void 0),n}}},{"./util":36}],35:[function(e,t,n){"use strict";t.exports=function(t,n,r,i,o,a){function s(e){setTimeout(function(){throw e},0)}function c(e,n){var i=0,a=e.length,c=new t(o);return function o(){if(i>=a)return c._fulfill();var u,l,d=(u=e[i++],(l=r(u))!==u&&"function"==typeof u._isDisposable&&"function"==typeof u._getDisposer&&u._isDisposable()&&l._setDisposable(u._getDisposer()),l);if(d instanceof t&&d._isDisposable()){try{d=r(d._getDisposer().tryDispose(n),e.promise)}catch(e){return s(e)}if(d instanceof t)return d._then(o,s,null,null,null)}o()}(),c}function u(e,t,n){this._data=e,this._promise=t,this._context=n}function l(e,t,n){this.constructor$(e,t,n)}function d(e){return u.isDisposer(e)?(this.resources[this.index]._setDisposable(e),e.promise()):e}function p(e){this.length=e,this.promise=null,this[e-1]=null}var h=e("./util"),f=e("./errors").TypeError,m=e("./util").inherits,v=h.errorObj,g=h.tryCatch,y={};u.prototype.data=function(){return this._data},u.prototype.promise=function(){return this._promise},u.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():y},u.prototype.tryDispose=function(e){var t=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=t!==y?this.doDispose(t,e):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},u.isDisposer=function(e){return null!=e&&"function"==typeof e.resource&&"function"==typeof e.tryDispose},m(l,u),l.prototype.doDispose=function(e,t){return this.data().call(e,e,t)},p.prototype._resultCancelled=function(){for(var e=this.length,n=0;n<e;++n){var r=this[n];r instanceof t&&r.cancel()}},t.using=function(){var e=arguments.length;if(e<2)return n("you must pass at least 2 arguments to Promise.using");var i,o=arguments[e-1];if("function"!=typeof o)return n("expecting a function but got "+h.classString(o));var s=!0;2===e&&Array.isArray(arguments[0])?(e=(i=arguments[0]).length,s=!1):(i=arguments,e--);for(var l=new p(e),f=0;f<e;++f){var m=i[f];if(u.isDisposer(m)){var y=m;(m=m.promise())._setDisposable(y)}else{var b=r(m);b instanceof t&&(m=b._then(d,null,null,{resources:l,index:f},void 0))}l[f]=m}var S=new Array(l.length);for(f=0;f<S.length;++f)S[f]=t.resolve(l[f]).reflect();var _=t.all(S).then(function(e){for(var t=0;t<e.length;++t){var n=e[t];if(n.isRejected())return v.e=n.error(),v;if(!n.isFulfilled())return void _.cancel();e[t]=n.value()}T._pushContext(),o=g(o);var r=s?o.apply(void 0,e):o(e),i=T._popContext();return a.checkForgottenReturns(r,i,"Promise.using",T),r}),T=_.lastly(function(){var e=new t.PromiseInspection(_);return c(l,e)});return l.promise=T,T._setOnCancel(l),T},t.prototype._setDisposable=function(e){this._bitField=131072|this._bitField,this._disposer=e},t.prototype._isDisposable=function(){return(131072&this._bitField)>0},t.prototype._getDisposer=function(){return this._disposer},t.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},t.prototype.disposer=function(e){if("function"==typeof e)return new l(e,this,i());throw new f}}},{"./errors":12,"./util":36}],36:[function(e,r,i){"use strict";function o(){try{var e=I;return I=null,e.apply(this,arguments)}catch(e){return O.e=e,O}}function a(e){return I=e,o}function s(e){return null==e||!0===e||!1===e||"string"==typeof e||"number"==typeof e}function c(e){return"function"==typeof e||"object"==typeof e&&null!==e}function u(e){return s(e)?new Error(y(e)):e}function l(e,t){var n,r=e.length,i=new Array(r+1);for(n=0;n<r;++n)i[n]=e[n];return i[n]=t,i}function d(e,t,n){if(!P.isES5)return{}.hasOwnProperty.call(e,t)?e[t]:void 0;var r=Object.getOwnPropertyDescriptor(e,t);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function p(e,t,n){if(s(e))return e;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return P.defineProperty(e,t,r),e}function h(e){throw e}function f(e){try{if("function"==typeof e){var t=P.names(e.prototype),n=P.isES5&&t.length>1,r=t.length>0&&!(1===t.length&&"constructor"===t[0]),i=L.test(e+"")&&P.names(e).length>0;if(n||r||i)return!0}return!1}catch(e){return!1}}function m(e){function t(){}t.prototype=e;for(var n=8;n--;)new t;return e}function v(e){return M.test(e)}function g(e,t,n){for(var r=new Array(e),i=0;i<e;++i)r[i]=t+i+n;return r}function y(e){try{return e+""}catch(e){return"[no string representation]"}}function b(e){return e instanceof Error||null!==e&&"object"==typeof e&&"string"==typeof e.message&&"string"==typeof e.name}function S(e){try{p(e,"isOperational",!0)}catch(e){}}function _(e){return null!=e&&(e instanceof Error.__BluebirdErrorTypes__.OperationalError||!0===e.isOperational)}function T(e){return b(e)&&P.propertyIsWritable(e,"stack")}function C(e){return{}.toString.call(e)}function E(e,t,n){for(var r=P.names(e),i=0;i<r.length;++i){var o=r[i];if(n(o))try{P.defineProperty(t,o,P.getDescriptor(e,o))}catch(e){}}}function w(e){return G?t.env[e]:void 0}function R(){if("function"==typeof Promise)try{var e=new Promise(function(){});if("[object Promise]"==={}.toString.call(e))return Promise}catch(e){}}function k(e,t){return e.bind(t)}var I,P=e("./es5"),A="undefined"==typeof navigator,O={e:{}},D="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n?n:void 0!==this?this:null,x=function(e,t){function n(){this.constructor=e,this.constructor$=t;for(var n in t.prototype)r.call(t.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=t.prototype[n])}var r={}.hasOwnProperty;return n.prototype=t.prototype,e.prototype=new n,e.prototype},N=function(){var e=[Array.prototype,Object.prototype,Function.prototype],t=function(t){for(var n=0;n<e.length;++n)if(e[n]===t)return!0;return!1};if(P.isES5){var n=Object.getOwnPropertyNames;return function(e){for(var r=[],i=Object.create(null);null!=e&&!t(e);){var o;try{o=n(e)}catch(e){return r}for(var a=0;a<o.length;++a){var s=o[a];if(!i[s]){i[s]=!0;var c=Object.getOwnPropertyDescriptor(e,s);null!=c&&null==c.get&&null==c.set&&r.push(s)}}e=P.getPrototypeOf(e)}return r}}var r={}.hasOwnProperty;return function(n){if(t(n))return[];var i=[];e:for(var o in n)if(r.call(n,o))i.push(o);else{for(var a=0;a<e.length;++a)if(r.call(e[a],o))continue e;i.push(o)}return i}}(),L=/this\s*\.\s*\S+\s*=/,M=/^[a-z$_][a-z$_0-9]*$/i,j="stack"in new Error?function(e){return T(e)?e:new Error(y(e))}:function(e){if(T(e))return e;try{throw new Error(y(e))}catch(e){return e}},F=function(e){return P.isArray(e)?e:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var U="function"==typeof Array.from?function(e){return Array.from(e)}:function(e){for(var t,n=[],r=e[Symbol.iterator]();!(t=r.next()).done;)n.push(t.value);return n};F=function(e){return P.isArray(e)?e:null!=e&&"function"==typeof e[Symbol.iterator]?U(e):null}}var H,B=void 0!==t&&"[object process]"===C(t).toLowerCase(),G=void 0!==t&&void 0!==t.env,J={isClass:f,isIdentifier:v,inheritedDataKeys:N,getDataPropertyOrDefault:d,thrower:h,isArray:P.isArray,asArray:F,notEnumerableProp:p,isPrimitive:s,isObject:c,isError:b,canEvaluate:A,errorObj:O,tryCatch:a,inherits:x,withAppended:l,maybeWrapAsError:u,toFastProperties:m,filledRange:g,toString:y,canAttachTrace:T,ensureErrorObject:j,originatesFromRejection:_,markAsOriginatingFromRejection:S,classString:C,copyDescriptors:E,hasDevTools:"undefined"!=typeof chrome&&chrome&&"function"==typeof chrome.loadTimes,isNode:B,hasEnvVariables:G,env:w,global:D,getNativePromise:R,domainBind:k};J.isRecentNode=J.isNode&&(H=t.versions.node.split(".").map(Number),0===H[0]&&H[1]>10||H[0]>0),J.isNode&&J.toFastProperties(t);try{throw new Error}catch(e){J.lastLineError=e}r.exports=J},{"./es5":13}]},{},[4])(4)},e.exports=i(),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(t,n(34),n(20),n(40).setImmediate)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"CONNECTION_DISCONNECTED",function(){return r}),n.d(t,"CONNECTION_ESTABLISHED",function(){return i}),n.d(t,"CONNECTION_FAILED",function(){return o}),n.d(t,"WRONG_STATE",function(){return a});var r="connection.connectionDisconnected",i="connection.connectionEstablished",o="connection.connectionFailed",a="connection.wrongState"},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(123)),o=n(3),a=n.n(o),s=n(7),c=n(124),u=n(12),l=n(17),d=n(10),p=n(146),h=n(4),f=n(1),m=n(9),v=n.n(m),g=n(28),y=n(5),b=n(147),S=n(13),_=n.n(S),T=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},E=Object(r.getLogger)(e),w=0,R=0,k=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.conference=e,r.peerConnections=new Map,r.localTracks=[],r.options=n,r._channel=null,r._channelOpen=!1,r._lastN=-1,r._lastNEndpoints=null,r._pinnedEndpoint=null,r._selectedEndpoint=null,r._lastNChangeListener=r._onLastNChanged.bind(r),g.a.isDeviceChangeAvailable("output")&&(g.a.addListener(v.a.AUDIO_OUTPUT_DEVICE_CHANGED,function(e){return r._updateAudioOutputForAudioTracks(e)}),g.a.addListener(v.a.DEVICE_LIST_CHANGED,function(){return r._updateAudioOutputForAudioTracks(g.a.getAudioOutputDevice())})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,d.a),T(t,[{key:"initializeBridgeChannel",value:function(e,t){var n=this;this._channel=new i.a(e,t,this.eventEmitter),this._channelOpenListener=function(){n._channelOpen=!0;try{n._channel.sendPinnedEndpointMessage(n._pinnedEndpoint),n._channel.sendSelectedEndpointMessage(n._selectedEndpoint)}catch(e){a.a.callErrorHandler(e),E.error("Cannot send selected("+n._selectedEndpoint+")pinned("+n._pinnedEndpoint+") endpoint message.",e)}n.removeListener(v.a.DATA_CHANNEL_OPEN,n._channelOpenListener),n._channelOpenListener=null,-1!==n._lastN&&n._channel.sendSetLastNMessage(n._lastN)},this.addListener(v.a.DATA_CHANNEL_OPEN,this._channelOpenListener),this.addListener(v.a.LASTN_ENDPOINT_CHANGED,this._lastNChangeListener)}},{key:"_onLastNChanged",value:function(){var e,t,n=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=this._lastNEndpoints||[];this._lastNEndpoints=r,e=i.filter(function(e){return!n.isInLastN(e)}),t=r.filter(function(e){return-1===i.indexOf(e)}),this.conference.eventEmitter.emit(s.LAST_N_ENDPOINTS_CHANGED,e,t)}},{key:"onCallEnded",value:function(){this._channel&&(this._channel&&"websocket"===this._channel.mode&&this._channel.close(),this._channel=null,this._channelOpen=!1)}},{key:"setReceiverVideoConstraint",value:function(e){this._channel&&this._channel.sendReceiverVideoConstraintMessage(e)}},{key:"selectEndpoint",value:function(e){this._selectedEndpoint=e,this._channel&&this._channelOpen&&this._channel.sendSelectedEndpointMessage(e)}},{key:"pinEndpoint",value:function(e){this._pinnedEndpoint=e,this._channel&&this._channelOpen&&this._channel.sendPinnedEndpointMessage(e)}},{key:"createPeerConnection",value:function(e,n,r,i){var o=t.getPCConstraints(r);void 0!==i.abtestSuspendVideo&&(g.a.setSuspendVideo(o,i.abtestSuspendVideo),y.a.analytics.addPermanentProperties({abtestSuspendVideo:i.abtestSuspendVideo})),w=Object(p.a)(w);var a=new b.a(this,w,e,n,o,r,i);return this.peerConnections.set(a.id,a),a}},{key:"_removePeerConnection",value:function(e){var t=e.id;return!!this.peerConnections.has(t)&&(this.peerConnections.delete(t),!0)}},{key:"addLocalTrack",value:function(e){if(!e)throw new Error("track must not be null nor undefined");this.localTracks.push(e),e.conference=this.conference}},{key:"getLastN",value:function(){return this._lastN}},{key:"getLocalVideoTrack",value:function(){var e=this.getLocalTracks(h.b);return e.length?e[0]:void 0}},{key:"getLocalAudioTrack",value:function(){var e=this.getLocalTracks(h.a);return e.length?e[0]:void 0}},{key:"getLocalTracks",value:function(e){var t=this.localTracks.slice();return void 0!==e&&(t=t.filter(function(t){return t.getType()===e})),t}},{key:"getRemoteTracks",value:function(e){var t=[],n=!0,r=!1,i=void 0;try{for(var o,a=this.peerConnections.values()[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value.getRemoteTracks(void 0,e);s&&(t=t.concat(s))}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}return t}},{key:"setAudioMute",value:function(e){var t=[];return this.getLocalTracks(h.a).forEach(function(n){t.push(e?n.mute():n.unmute())}),Promise.all(t)}},{key:"removeLocalTrack",value:function(e){var t=this.localTracks.indexOf(e);-1!==t&&this.localTracks.splice(t,1)}},{key:"removeRemoteTracks",value:function(e){var t=[],n=!0,r=!1,i=void 0;try{for(var o,a=this.peerConnections.values()[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value.removeRemoteTracks(e);t=t.concat(s)}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}return E.debug("Removed remote tracks for "+e+" count: "+t.length),t}},{key:"closeBridgeChannel",value:function(){this._channel&&(this._channel.close(),this._channelOpen=!1,this.removeListener(v.a.LASTN_ENDPOINT_CHANGED,this._lastNChangeListener))}},{key:"setAudioLevel",value:function(e,t,n,r){var i=e.getTrackBySSRC(t);i&&(i.isAudioTrack()?(i.isLocal()!==r&&E.error(i+" was expected to "+(r?"be":"not be")+" local"),i.setAudioLevel(n,e)):E.warn("Received audio level for non-audio track: "+t))}},{key:"sendChannelMessage",value:function(e,t){if(!this._channel)throw new Error("Channel support is disabled!");this._channel.sendMessage(e,t)}},{key:"setLastN",value:function(e){this._lastN!==e&&(this._lastN=e,this._channel&&this._channelOpen&&this._channel.sendSetLastNMessage(e),this.eventEmitter.emit(v.a.LASTN_VALUE_CHANGED,e))}},{key:"isInLastN",value:function(e){return!this._lastNEndpoints||this._lastNEndpoints.indexOf(e)>-1}},{key:"_updateAudioOutputForAudioTracks",value:function(e){var t=this.getRemoteTracks(h.a),n=!0,r=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(n=(o=a.next()).done);n=!0)o.value.setAudioOutput(e)}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}}}],[{key:"obtainAudioAndVideoPermissions",value:function(e){var t=f.a.usesNewGumFlow();return(t?g.a.newObtainAudioAndVideoPermissions(e):g.a.obtainAudioAndVideoPermissions(e)).then(function(n){var r,i,o,a=t?function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(function(e){var t=e.sourceId,n=e.sourceType,r=e.stream,i=e.track,o=e.videoType,a=i.getSettings(),s=a.deviceId,u=a.facingMode;return R=Object(p.a)(R),new c.a({deviceId:s,facingMode:u,mediaType:i.kind,rtcId:R,sourceId:t,sourceType:n,stream:r,track:i,videoType:o||null})})}(n):(r=e,i=[],o=null,n.forEach(function(e){e.mediaType===h.a?o=r.micDeviceId:e.videoType===_.a.CAMERA&&(o=r.cameraDeviceId),R=Object(p.a)(R);var t=new c.a(C({},e,{deviceId:o,facingMode:r.facingMode,rtcId:R}));i.push(t)}),i);return a.some(function(e){return!e._isReceivingData()})?Promise.reject(new u.a(l.NO_DATA_FROM_SOURCE)):a})}},{key:"addListener",value:function(e,t){g.a.addListener(e,t)}},{key:"removeListener",value:function(e,t){g.a.removeListener(e,t)}},{key:"isRTCReady",value:function(){return g.a.isRTCReady()}},{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.options=e,g.a.init(this.options)}},{key:"getDeviceAvailability",value:function(){return g.a.getDeviceAvailability()}},{key:"getPCConstraints",value:function(e){var t=e?g.a.p2pPcConstraints:g.a.pcConstraints;return t?JSON.parse(JSON.stringify(t)):{}}},{key:"attachMediaStream",value:function(e,t){return g.a.attachMediaStream(e,t)}},{key:"getStreamID",value:function(e){return g.a.getStreamID(e)}},{key:"getTrackID",value:function(e){return g.a.getTrackID(e)}},{key:"isDeviceListAvailable",value:function(){return g.a.isDeviceListAvailable()}},{key:"isDeviceChangeAvailable",value:function(e){return g.a.isDeviceChangeAvailable(e)}},{key:"getAudioOutputDevice",value:function(){return g.a.getAudioOutputDevice()}},{key:"getCurrentlyAvailableMediaDevices",value:function(){return g.a.getCurrentlyAvailableMediaDevices()}},{key:"getEventDataForActiveDevice",value:function(e){return g.a.getEventDataForActiveDevice(e)}},{key:"setAudioOutputDevice",value:function(e){return g.a.setAudioOutputDevice(e)}},{key:"isUserStream",value:function(e){return t.isUserStreamById(g.a.getStreamID(e))}},{key:"isUserStreamById",value:function(e){return e&&"mixedmslabel"!==e&&"default"!==e}},{key:"enumerateDevices",value:function(e){g.a.enumerateDevices(e)}},{key:"stopMediaStream",value:function(e){g.a.stopMediaStream(e)}},{key:"isDesktopSharingEnabled",value:function(){return g.a.isDesktopSharingEnabled()}}]),t}();t.a=k}).call(t,"modules/RTC/RTC.js")},function(e,t,n){"use strict";(function(e){function r(e,t){var n,r,i,o={audio:!1,video:!1},a=I.a.isFirefox()||I.a.isEdge()||I.a.isReactNative()||I.a.isTemasysPluginUsed();if(e.indexOf("video")>=0){if(o.video={mandatory:{},optional:[]},t.cameraDeviceId)a&&(o.video.deviceId=t.cameraDeviceId),o.video.optional.push({sourceId:t.cameraDeviceId});else{var s=t.facingMode||g.a.USER;a&&(o.video.facingMode=s),o.video.optional.push({facingMode:s})}(t.minFps||t.maxFps||t.fps)&&((t.minFps||t.fps)&&(t.minFps=t.minFps||t.fps,o.video.mandatory.minFrameRate=t.minFps),t.maxFps&&(o.video.mandatory.maxFrameRate=t.maxFps)),n=o,r=a,i=t.resolution,k.a[i]&&(r&&(n.video.width={ideal:k.a[i].width},n.video.height={ideal:k.a[i].height}),n.video.mandatory.minWidth=k.a[i].width,n.video.mandatory.minHeight=k.a[i].height),n.video.mandatory.minWidth&&(n.video.mandatory.maxWidth=n.video.mandatory.minWidth),n.video.mandatory.minHeight&&(n.video.mandatory.maxHeight=n.video.mandatory.minHeight)}if(e.indexOf("audio")>=0&&(I.a.isReactNative()?o.audio=!0:I.a.isFirefox()?t.micDeviceId?o.audio={mandatory:{},deviceId:t.micDeviceId,optional:[{sourceId:t.micDeviceId}]}:o.audio=!0:(o.audio={mandatory:{},optional:[]},t.micDeviceId&&(a&&(o.audio.deviceId=t.micDeviceId),o.audio.optional.push({sourceId:t.micDeviceId})),o.audio.optional.push({echoCancellation:!Q&&!z},{googEchoCancellation:!Q&&!z},{googAutoGainControl:!Y&&!z},{googNoiseSuppression:!X&&!z},{googHighpassFilter:!Z&&!z},{googNoiseSuppression2:!X&&!z},{googEchoCancellation2:!Q&&!z},{googAutoGainControl2:!Y&&!z}))),e.indexOf("screen")>=0)if(I.a.isChrome())o.video={mandatory:{chromeMediaSource:"screen",maxWidth:window.screen.width,maxHeight:window.screen.height,maxFrameRate:3},optional:[]};else if(I.a.isTemasysPluginUsed())o.video={optional:[{sourceId:H.WebRTCPlugin.plugin.screensharingKey}]};else if(I.a.isFirefox())o.video={mozMediaSource:"window",mediaSource:"window"};else{var c="'screen' WebRTC media source is supported only in Chrome and with Temasys plugin";T.a.callErrorHandler(new Error(c)),U.error(c)}return e.indexOf("desktop")>=0&&(o.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t.desktopStream,maxWidth:window.screen.width,maxHeight:window.screen.height,maxFrameRate:3},optional:[]}),t.bandwidth&&(o.video||(o.video={mandatory:{},optional:[]}),o.video.optional.push({bandwidth:t.bandwidth})),I.a.isFirefox()&&t.firefox_fake_device&&(o.fake=!0),o}function i(e,t){var n=t&&t.getAudioTracks().length>0,r=t&&t.getVideoTracks().length>0;-1!==e.indexOf("video")&&(W.video=r),-1!==e.indexOf("audio")&&(W.audio=n),B.emit(A.a.AVAILABLE_DEVICES_CHANGED,W)}function o(){re&&re(function(e){void 0===ne?ne=e.slice(0):function(e){function t(e){return JSON.stringify({kind:e.kind,deviceId:e.deviceId,groupId:e.groupId,label:e.label,facing:e.facing})}return e.length!==ne.length||e.map(t).sort().join("")!==ne.map(t).sort().join("")}(e)&&s(e),window.setTimeout(o,G)})}function a(e){var t=e.filter(function(e){return"audioinput"===e.kind}).length,n=e.filter(function(e){return"audiooutput"===e.kind}).length,r=e.filter(function(e){return"videoinput"===e.kind}).length,i=e.filter(function(e){return"videooutput"===e.kind}).length;e.forEach(function(e){var o={audio_input_device_count:t,audio_output_device_count:n,video_input_device_count:r,video_output_device_count:i,device_id:e.deviceId,device_group_id:e.groupId,device_kind:e.kind,device_label:e.label};N.a.sendAnalytics(m.j,o)})}function s(e){ne=e.slice(0),U.info("list of media devices has changed:",ne),a(ne);var t=ne.filter(function(e){return"videoinput"===e.kind}),n=ne.filter(function(e){return"audioinput"===e.kind}),r=t.filter(function(e){return""===e.label}),i=n.filter(function(e){return""===e.label});t.length&&t.length===r.length&&(W.video=!1),n.length&&n.length===i.length&&(W.audio=!1),B.emit(A.a.DEVICE_LIST_CHANGED,e)}function c(e,t){e&&e.apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))}function u(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?function(t,n,r){return e(t).then(function(e){return c(n,[e]),e}).catch(function(e){throw c(r,[e]),e})}:function(t,n,r){e(t,function(e){c(n,[e])},function(e){c(r,[e])})}}function l(e){MediaStreamTrack.getSources(function(t){return e(t.map(d))})}function d(e){var t=(e.kind||"").toLowerCase();return{facing:e.facing||null,label:e.label,kind:t?"audiooutput"===t?t:t+"input":null,deviceId:e.id,groupId:e.groupId||null}}function p(e,t){var n="srcObject";if(n in e||(n="mozSrcObject")in e||(n=null),n)e[n]=t;else{var r=void 0;t&&((r=t.jitsiObjectURL)||(t.jitsiObjectURL=r=(URL||webkitURL).createObjectURL(t))),e.src=r||""}}function h(e,t){oe=!0,B.emit(A.a.RTC_READY,!0),D.a.init(e,t),ae.isDeviceListAvailable()&&re&&re(function(e){ne=e.splice(0),U.info("Available devices: ",ne),a(ne),B.emit(A.a.DEVICE_LIST_AVAILABLE,ne),ie?navigator.mediaDevices.addEventListener("devicechange",function(){return ae.enumerateDevices(s)}):o()})}function f(e){return function(t,n){var r=e.apply(ae,arguments);return n&&ae.isDeviceChangeAvailable("output")&&n.getAudioTracks&&n.getAudioTracks().length&&K&&t.setSinkId(ae.getAudioOutputDevice()).catch(function(e){var n=new C.a(e,null,["audiooutput"]);T.a.callUnhandledRejectionHandler({promise:this,reason:n}),U.warn("Failed to set audio output device for the element. Default audio output device will be used instead",t,n)}),r}}var m=n(6),v=n(56),g=n.n(v),y=n(16),b=n.n(y),S=n(0),_=(n.n(S),n(3)),T=n.n(_),C=n(12),E=n(10),w=n(4),R=n(35),k=n.n(R),I=n(1),P=n(9),A=n.n(P),O=n(125),D=n(134),x=n(14),N=n(5),L=n(13),M=n.n(L),j=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},F=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),U=Object(S.getLogger)(e),H=I.a.isTemasysPluginUsed()?n(37):void 0;I.a.usesNewGumFlow()&&n(135);var B=new b.a,G=3e3,J=["audio","video"],V={video:{aspectRatio:16/9,height:{ideal:1080,max:1080,min:240}}},W={audio:!1,video:!1},q="default",K=!1,z=!1,Q=!1,X=!1,Y=!1,Z=!1,ee=document.createElement("audio"),te=void 0!==ee.setSinkId,ne=void 0,re=void 0,ie=!1,oe=!1,ae=new(function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,B))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,E.a),F(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"boolean"==typeof t.disableAEC&&(Q=t.disableAEC,U.info("Disable AEC: "+Q)),"boolean"==typeof t.disableNS&&(X=t.disableNS,U.info("Disable NS: "+X)),"boolean"==typeof t.disableAP&&(z=t.disableAP,U.info("Disable AP: "+z)),"boolean"==typeof t.disableAGC&&(Y=t.disableAGC,U.info("Disable AGC: "+Y)),"boolean"==typeof t.disableHPF&&(Z=t.disableHPF,U.info("Disable HPF: "+Z)),re=navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices?function(e){navigator.mediaDevices.enumerateDevices().then(e,function(){return e([])})}:MediaStreamTrack&&MediaStreamTrack.getSources?function(e){MediaStreamTrack.getSources(function(t){return e(t.map(d))})}:void 0,new Promise(function(n,r){if(I.a.usesNewGumFlow())e.RTCPeerConnectionType=window.RTCPeerConnection,e.getUserMedia=function(e,t,n){return window.navigator.mediaDevices.getUserMedia(e).then(function(e){return t&&t(e),e}).catch(function(e){return n&&n(e),Promise.reject(e)})},e.enumerateDevices=function(e){return window.navigator.mediaDevices.enumerateDevices().then(function(t){return e(t),t}).catch(function(t){return U.error("Error enumerating devices: "+t),e([]),[]})},e.attachMediaStream=f(function(e,t){return e&&(e.srcObject=t),e}),e.getStreamID=function(e){return e.id},e.getTrackID=function(e){return e.id};else if(I.a.isChrome()||I.a.isOpera()||I.a.isNWJS()||I.a.isElectron()||I.a.isReactNative()){e.RTCPeerConnectionType=webkitRTCPeerConnection;var i=navigator.webkitGetUserMedia.bind(navigator);e.getUserMedia=u(i),e.enumerateDevices=re,e.attachMediaStream=f(function(e,t){return p(e,t),e}),e.getStreamID=function(e){var t=e.id;return"number"==typeof t?t:x.a.filterSpecialChars(t)},e.getTrackID=function(e){return e.id},webkitMediaStream.prototype.getVideoTracks||(webkitMediaStream.prototype.getVideoTracks=function(){return this.videoTracks}),webkitMediaStream.prototype.getAudioTracks||(webkitMediaStream.prototype.getAudioTracks=function(){return this.audioTracks})}else if(I.a.isEdge())e.RTCPeerConnectionType=O.a,e.getUserMedia=u(navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices),!0),e.enumerateDevices=re,e.attachMediaStream=f(function(e,t){return p(e,t),e}),e.getStreamID=function(e){var t=e.jitsiRemoteId||e.id;return x.a.filterSpecialChars(t)},e.getTrackID=function(e){return e.jitsiRemoteId||e.id};else{if(!I.a.isTemasysPluginUsed())return a="Browser does not appear to be WebRTC-capable",s=r,(c=new Error(a)).name="WEBRTC_NOT_SUPPORTED",U.error(a),void s(c);var o=new Promise(function(e){return H.webRTCReady(e)});H.WebRTCPlugin.isPluginInstalled(H.WebRTCPlugin.pluginInfo.prefix,H.WebRTCPlugin.pluginInfo.plugName,H.WebRTCPlugin.pluginInfo.type,function(){o.then(function(){e.RTCPeerConnectionType=RTCPeerConnection,e.getUserMedia=window.getUserMedia,e.enumerateDevices=l,e.attachMediaStream=f(function(e,t){if(t){if("dummyAudio"===t.id||"dummyVideo"===t.id)return;var n=$(e);if(I.a.isTemasysPluginUsed()&&!n.is(":visible")&&n.show(),t.getVideoTracks().length>0&&!$(e).is(":visible"))throw new Error("video element must be visible to attach video stream")}return attachMediaStream(e,t)}),e.getStreamID=function(e){return x.a.filterSpecialChars(e.label)},e.getTrackID=function(e){return e.id},h(t,e.getUserMediaWithConstraints.bind(e)),n()})},function(){var e=new Error("Temasys plugin is not installed");e.name="WEBRTC_NOT_READY",e.webRTCReadyPromise=o,r(e)})}var a,s,c;e._initPCConstraints(t),I.a.isTemasysPluginUsed()||(h(t,e.getUserMediaWithConstraints.bind(e)),n())})}},{key:"_initPCConstraints",value:function(e){I.a.isFirefox()?this.pcConstraints={}:(I.a.isChrome()||I.a.isOpera()||I.a.isNWJS()||I.a.isElectron()||I.a.isReactNative())&&(this.pcConstraints={optional:[{googHighStartBitrate:0},{googPayloadPadding:!0},{googScreencastMinBitrate:400},{googCpuOveruseDetection:!0},{googCpuOveruseEncodeUsage:!0},{googCpuUnderuseThreshold:55},{googCpuOveruseThreshold:85}]},e.useIPv6&&this.pcConstraints.optional.push({googIPv6:!0}),this.p2pPcConstraints=JSON.parse(JSON.stringify(this.pcConstraints)),e.disableSuspendVideo||this.pcConstraints.optional.push({googSuspendBelowMinBitrate:!0}),this.p2pPcConstraints.optional.push({googSuspendBelowMinBitrate:!0})),this.p2pPcConstraints=this.p2pPcConstraints||this.pcConstraints}},{key:"getUserMediaWithConstraints",value:function(e,t,n){var o=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=r(e,a);return U.info("Get media constraints",s),new Promise(function(r,a){try{o.getUserMedia(s,function(n){U.log("onUserMediaSuccess"),i(e,n),t&&t(n),r(n)},function(t){i(e,void 0),U.warn("Failed to get access to local media. Error ",t,s);var r=new C.a(t,s,e);n&&n(r),a(r)})}catch(t){U.error("GUM failed: ",t);var c=new C.a(t,s,e);n&&n(c),a(c)}})}},{key:"_newGetUserMediaWithConstraints",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(r,o){try{t.getUserMedia(n).then(function(t){U.log("onUserMediaSuccess"),i(e,t),r(t)}).catch(function(t){U.warn("Failed to get access to local media. "+t+" "+n+" "),i(e,void 0),o(new C.a(t,n,e))})}catch(t){U.error("GUM failed: "+t),o(new C.a(t,n,e))}})}},{key:"_newGetDesktopMedia",value:function(e,t){if(!D.a.isSupported()||!I.a.supportsVideo())return Promise.reject(new Error("Desktop sharing is not supported!"));var n=j({},e,{desktopSharingSources:t});return new Promise(function(e,t){D.a.obtainStream(n,function(t){e(t)},function(e){t(e)})})}},{key:"obtainAudioAndVideoPermissions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.devices=e.devices||[].concat(J),e.resolution=e.resolution||720,e.devices.includes("desktop")&&!D.a.isSupported()?Promise.reject(new Error("Desktop sharing is not supported!")):(I.a.supportsMediaStreamConstructor()?this._getAudioAndVideoStreams(e):this._getAudioAndVideoStreamsSeparately(e)).then(function(t){return function(e,t){var n=void 0,r=void 0,i=void 0,o=[];if(e){var a=e.audioVideo;if(a){var s=window.webkitMediaStream||window.MediaStream,c=a.getAudioTracks();if(c.length){n=new s;for(var u=0;u<c.length;u++)n.addTrack(c[u])}var l=a.getVideoTracks();if(l.length){i=new s;for(var d=0;d<l.length;d++)i.addTrack(l[d])}}else n=e.audio,i=e.video;r=e.desktop}if(r){var p=r,h=p.stream,f=p.sourceId,m=p.sourceType;o.push({stream:h,sourceId:f,sourceType:m,track:h.getVideoTracks()[0],mediaType:w.b,videoType:M.a.DESKTOP})}return n&&o.push({stream:n,track:n.getAudioTracks()[0],mediaType:w.a,videoType:null}),i&&o.push({stream:i,track:i.getVideoTracks()[0],mediaType:w.b,videoType:M.a.CAMERA,resolution:t}),o}(t,e.resolution)})}},{key:"_getAudioAndVideoStreams",value:function(e){var t=this,n=e.devices.includes("desktop");return e.devices=e.devices.filter(function(e){return"desktop"!==e}),(e.devices.length?this.getUserMediaWithConstraints(e.devices,null,null,e):Promise.resolve(null)).then(function(n){var i=t._getMissingTracks(e.devices,n);return i.length?(t.stopMediaStream(n),t.getUserMediaWithConstraints(i,e).then(function(){return Promise.reject(new C.a({name:"UnknownError"},r(e.devices,e),i))})):n}).then(function(r){return n?new Promise(function(n,i){D.a.obtainStream(t._parseDesktopSharingOptions(e),function(e){return n({audioVideo:r,desktop:e})},function(e){r&&t.stopMediaStream(r),i(e)})}):{audioVideo:r}})}},{key:"_getMissingTracks",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1],n=[],r=e.includes("audio"),i=t&&t.getAudioTracks().length>0;r&&!i&&n.push("audio");var o=e.includes("video"),a=t&&t.getVideoTracks().length>0;return o&&!a&&n.push("video"),n}},{key:"_getAudioAndVideoStreamsSeparately",value:function(e){var t=this;return new Promise(function(n,r){var i={audio:function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.getUserMediaWithConstraints.apply(t,[["audio"]].concat(n))},video:function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.getUserMediaWithConstraints.apply(t,[["video"]].concat(n))},desktop:function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];return D.a.obtainStream.apply(D.a,[t._parseDesktopSharingOptions(e)].concat(r))}};!function e(t){if(!t.devices||0===t.devices.length)return t.successCallback(t.streams||{});var n=t.devices.splice(0,1);t.deviceGUM[n](function(r){t.streams=t.streams||{},t.streams[n]=r,e(t)},function(e){Object.keys(t.streams).forEach(function(e){return ae.stopMediaStream(t.streams[e])}),U.error("failed to obtain "+n+" stream - stop",e),t.errorCallback(e)})}({devices:e.devices,streams:[],successCallback:n,errorCallback:r,deviceGUM:i})})}},{key:"_parseDesktopSharingOptions",value:function(e){return j({},e.desktopSharingExtensionExternalInstallation,{desktopSharingSources:e.desktopSharingSources})}},{key:"newObtainAudioAndVideoPermissions",value:function(e){U.info("Using the new gUM flow");var t=[],n=function(){return-1!==(e.devices||[]).indexOf("desktop")?this._newGetDesktopMedia(e.desktopSharingExtensionExternalInstallation,e.desktopSharingSources):Promise.resolve()}.bind(this),r=function(){var t=(e.devices||["audio","video"]).filter(function(e){return"audio"===e||"video"===e&&I.a.supportsVideo()});if(!t.length)return Promise.resolve();var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=JSON.parse(JSON.stringify(t.constraints||V));if(e.indexOf("video")>=0)if(n.video||(n.video={}),t.cameraDeviceId)n.video.deviceId=t.cameraDeviceId;else{var r=t.facingMode||g.a.USER;n.video.facingMode=r}else n.video=!1;return e.indexOf("audio")>=0?(n.audio&&"boolean"!=typeof n.audio||(n.audio={}),n.audio.optional||(n.audio.optional=[]),n.audio.optional.push({sourceId:t.micDeviceId},{echoCancellation:!Q&&!z},{googEchoCancellation:!Q&&!z},{googAutoGainControl:!Y&&!z},{googNoiseSuppression:!X&&!z},{googHighpassFilter:!Z&&!z},{googNoiseSuppression2:!X&&!z},{googEchoCancellation2:!Q&&!z},{googAutoGainControl2:!Y&&!z})):n.audio=!1,e.indexOf("desktop")>=0&&(n.video&&"boolean"!=typeof n.video||(n.video={}),n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t.desktopStream,maxWidth:window.screen.width,maxHeight:window.screen.height,maxFrameRate:3}}),n}(t,e);return U.info("Got media constraints: ",n),this._newGetUserMediaWithConstraints(t,n)}.bind(this);return n().then(function(e){if(e){var n=e.stream,r=e.sourceId,i=e.sourceType;t.push({stream:n,sourceId:r,sourceType:i,track:n.getVideoTracks()[0],videoType:M.a.DESKTOP})}}).then(r).then(function(e){if(e){var n=e.getAudioTracks();if(n.length){var r=new MediaStream(n);t.push({stream:r,track:r.getAudioTracks()[0]})}var i=e.getVideoTracks();if(i.length){var o=new MediaStream(i);t.push({stream:o,track:o.getVideoTracks()[0],videoType:M.a.CAMERA})}}}).then(function(){return t})}},{key:"getDeviceAvailability",value:function(){return W}},{key:"isRTCReady",value:function(){return oe}},{key:"_isDeviceListAvailable",value:function(){if(!oe)throw new Error("WebRTC not ready yet");return Boolean(navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices||"undefined"!=typeof MediaStreamTrack&&MediaStreamTrack.getSources)}},{key:"onRTCReady",value:function(){return oe?Promise.resolve():new Promise(function(e){B.addListener(A.a.RTC_READY,function t(){B.removeListener(A.a.RTC_READY,t),e()})})}},{key:"isDeviceListAvailable",value:function(){return this.onRTCReady().then(this._isDeviceListAvailable.bind(this))}},{key:"isDeviceChangeAvailable",value:function(e){return"output"===e||"audiooutput"===e?te:I.a.isChrome()||I.a.isFirefox()||I.a.isOpera()||I.a.isTemasysPluginUsed()||I.a.isNWJS()||I.a.isElectron()||I.a.isEdge()}},{key:"stopMediaStream",value:function(e){e.getTracks().forEach(function(e){!I.a.isTemasysPluginUsed()&&e.stop&&e.stop()}),e.stop&&e.stop(),e.release&&e.release();var t=e.jitsiObjectURL;t&&(delete e.jitsiObjectURL,(URL||webkitURL).revokeObjectURL(t))}},{key:"isDesktopSharingEnabled",value:function(){return D.a.isSupported()}},{key:"setAudioOutputDevice",value:function(e){return this.isDeviceChangeAvailable("output")||Promise.reject(new Error("Audio output device change is not supported")),ee.setSinkId(e).then(function(){q=e,K=!0,U.log("Audio output device set to "+e),B.emit(A.a.AUDIO_OUTPUT_DEVICE_CHANGED,e)})}},{key:"getAudioOutputDevice",value:function(){return q}},{key:"getCurrentlyAvailableMediaDevices",value:function(){return ne}},{key:"getEventDataForActiveDevice",value:function(e){var t=[],n={deviceId:e.deviceId,kind:e.kind,label:e.label,groupId:e.groupId};return t.push(n),{deviceList:t}}},{key:"setSuspendVideo",value:function(e,t){e.optional||(e.optional=[]),e.optional=e.optional.filter(function(e){return!e.hasOwnProperty("googSuspendBelowMinBitrate")}),t&&e.optional.push({googSuspendBelowMinBitrate:"true"})}}]),t}());t.a=ae}).call(t,"modules/RTC/RTCUtils.js")},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return parseInt(e.ssrcs.split(" ")[0],10)}function o(e){return parseInt(e.ssrcs.split(" ")[1],10)}function a(e){return e.ssrcs?e.ssrcs.map(function(e){return e.id}).filter(function(e,t,n){return n.indexOf(e)===t}).length:0}t.b=i,t.c=o,n.d(t,"a",function(){return l});var s=n(15),c=(n.n(s),function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()),u=function(){function e(t){if(r(this,e),!t)throw new Error("mLine is undefined");this.mLine=t}return c(e,[{key:"getSSRCAttrValue",value:function(e,t){var n=this.ssrcs.find(function(n){return n.id===e&&n.attribute===t});return n&&n.value}},{key:"removeSSRC",value:function(e){this.mLine.ssrcs&&this.mLine.ssrcs.length&&(this.mLine.ssrcs=this.mLine.ssrcs.filter(function(t){return t.id!==e}))}},{key:"addSSRCAttribute",value:function(e){this.ssrcs.push(e)}},{key:"findGroup",value:function(e,t){return this.ssrcGroups.find(function(n){return n.semantics===e&&(!t||t===n.ssrcs)})}},{key:"findGroups",value:function(e){return this.ssrcGroups.filter(function(t){return t.semantics===e})}},{key:"findGroupByPrimarySSRC",value:function(e,t){return this.ssrcGroups.find(function(n){return n.semantics===e&&i(n)===t})}},{key:"findSSRCByMSID",value:function(e){return this.ssrcs.find(function(t){return"msid"===t.attribute&&(null===e||t.value===e)})}},{key:"getSSRCCount",value:function(){return a(this.mLine)}},{key:"containsAnySSRCGroups",value:function(){return void 0!==this.mLine.ssrcGroups}},{key:"getPrimaryVideoSsrc",value:function(){var e=this.mLine.type;if("video"!==e)throw new Error("getPrimarySsrc doesn't work with '"+e+"'");if(1===a(this.mLine))return this.mLine.ssrcs[0].id;if(this.mLine.ssrcGroups){var t=this.findGroup("SIM");if(t)return i(t);var n=this.findGroup("FID");if(n)return i(n);var r=this.findGroup("FEC-FR");if(r)return i(r)}}},{key:"getRtxSSRC",value:function(e){var t=this.findGroupByPrimarySSRC("FID",e);return t&&o(t)}},{key:"getSSRCs",value:function(){return this.ssrcs.map(function(e){return e.id}).filter(function(e,t,n){return n.indexOf(e)===t})}},{key:"getPrimaryVideoSSRCs",value:function(){var e=this.mLine.type;if("video"!==e)throw new Error("getPrimaryVideoSSRCs doesn't work with "+e);var t=this.getSSRCs(),n=!0,r=!1,i=void 0;try{for(var a,s=this.ssrcGroups[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;if("FID"===c.semantics||"FEC-FR"===c.semantics){var u=o(c);t.splice(t.indexOf(u),1)}}}catch(e){r=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(r)throw i}}return t}},{key:"dumpSSRCGroups",value:function(){return JSON.stringify(this.mLine.ssrcGroups)}},{key:"removeGroupsWithSSRC",value:function(e){this.mLine.ssrcGroups&&(this.mLine.ssrcGroups=this.mLine.ssrcGroups.filter(function(t){return-1===t.ssrcs.indexOf(""+e)}))}},{key:"removeGroupsBySemantics",value:function(e){this.mLine.ssrcGroups&&(this.mLine.ssrcGroups=this.mLine.ssrcGroups.filter(function(t){return t.semantics!==e}))}},{key:"replaceSSRC",value:function(e,t){this.mLine.ssrcs&&this.mLine.ssrcs.forEach(function(n){n.id===e&&(n.id=t)})}},{key:"addSSRCGroup",value:function(e){this.ssrcGroups.push(e)}},{key:"ssrcs",get:function(){return this.mLine.ssrcs||(this.mLine.ssrcs=[]),this.mLine.ssrcs},set:function(e){this.mLine.ssrcs=e}},{key:"direction",get:function(){return this.mLine.direction},set:function(e){this.mLine.direction=e}},{key:"ssrcGroups",get:function(){return this.mLine.ssrcGroups||(this.mLine.ssrcGroups=[]),this.mLine.ssrcGroups},set:function(e){this.mLine.ssrcGroups=e}}]),e}(),l=function(){function e(t){r(this,e),this.parsedSDP=s.parse(t)}return c(e,[{key:"selectMedia",value:function(e){var t=this.parsedSDP.media.find(function(t){return t.type===e});return t?new u(t):null}},{key:"toRawSDP",value:function(){return s.write(this.parsedSDP)}}]),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"STATUS_AVAILABLE",function(){return r}),n.d(t,"STATUS_UNDEFINED",function(){return i}),n.d(t,"STATUS_BUSY",function(){return o}),n.d(t,"STATE_ON",function(){return a}),n.d(t,"STATE_OFF",function(){return s}),n.d(t,"STATE_PENDING",function(){return c}),n.d(t,"STATE_RETRYING",function(){return u}),n.d(t,"STATE_FAILED",function(){return l}),n.d(t,"ERROR_NO_CONNECTION",function(){return d}),n.d(t,"ERROR_SESSION_EXISTS",function(){return p});var r="available",i="undefined",o="busy",a="on",s="off",c="pending",u="retrying",l="failed",d="error_no_connection",p="error_session_already_exists"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"LOCAL_STATS_UPDATED",function(){return r}),n.d(t,"REMOTE_STATS_UPDATED",function(){return i});var r="cq.local_stats_updated",i="cq.remote_stats_updated"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"AUTHENTICATION_REQUIRED",function(){return r}),n.d(t,"CHAT_ERROR",function(){return i}),n.d(t,"CONFERENCE_DESTROYED",function(){return o}),n.d(t,"CONFERENCE_MAX_USERS",function(){return a}),n.d(t,"CONNECTION_ERROR",function(){return s}),n.d(t,"NOT_ALLOWED_ERROR",function(){return c}),n.d(t,"FOCUS_DISCONNECTED",function(){return u}),n.d(t,"FOCUS_LEFT",function(){return l}),n.d(t,"GRACEFUL_SHUTDOWN",function(){return d}),n.d(t,"INCOMPATIBLE_SERVER_VERSIONS",function(){return p}),n.d(t,"JINGLE_FATAL_ERROR",function(){return h}),n.d(t,"PASSWORD_NOT_SUPPORTED",function(){return f}),n.d(t,"PASSWORD_REQUIRED",function(){return m}),n.d(t,"RESERVATION_ERROR",function(){return v}),n.d(t,"SETUP_FAILED",function(){return g}),n.d(t,"VIDEOBRIDGE_NOT_AVAILABLE",function(){return y});var r="conference.authenticationRequired",i="conference.chatError",o="conference.destroyed",a="conference.max_users",s="conference.connectionError",c="conference.connectionError.notAllowed",u="conference.focusDisconnected",l="conference.focusLeft",d="conference.gracefulShutdown",p="conference.incompatible_server_versions",h="conference.jingleFatalError",f="conference.passwordNotSupported",m="conference.passwordRequired",v="conference.reservationError",g="conference.setup_failed",y="conference.videobridgeNotAvailable"},function(e,t){function n(){this.attaches=[],this.signalListeners=[],this.mapFnc=null}n.prototype={constructor:n,add:function(e){console.log("Abstract method is called width value: "+e)},remove:function(e){console.log("Abstract method is called with value: "+e)},attach:function(e,t){this.attaches.push({cb:e,that:void 0===t?null:t})},notify:function(e){for(var t=0;t<this.attaches.length;++t){var n=this.attaches[t];n.cb?n.cb.call(n.that,e):n.cb(e)}},addMapFnc:function(e){this.mapFnc=e},map:function(){},mapping:function(e,t){null!==this.mapFnc&&this.mapFnc(e,t)},addSignalListener:function(e,t,n){this.signalListeners.push({signalName:e,cb:t,that:void 0===n?null:n})},signalize:function(e,t){for(var n=0;n<this.signalListeners.length;++n){var r=this.signalListeners[n];r.signalName===e&&null!==r.cb&&void 0!==r.cb&&(r.that?r.cb.call(r.that,t):r.cb(t))}}},e.exports=n},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(u===setTimeout)return setTimeout(e,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function o(){f&&p&&(f=!1,p.length?h=p.concat(h):m=-1,h.length&&a())}function a(){if(!f){var e=i(o);f=!0;for(var t=h.length;t;){for(p=h,h=[];++m<t;)p&&p[m].run();m=-1,t=h.length}p=null,f=!1,function(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var u,l,d=e.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(e){u=n}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(e){l=r}}();var p,h=[],f=!1,m=-1;d.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];h.push(new s(e,t)),1!==h.length||f||i(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(e){return[]},d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t){e.exports={1080:{width:1920,height:1080,order:7},fullhd:{width:1920,height:1080,order:7},720:{width:1280,height:720,order:6},hd:{width:1280,height:720,order:6},960:{width:960,height:720,order:5},360:{width:640,height:360,order:4},640:{width:640,height:480,order:3},vga:{width:640,height:480,order:3},180:{width:320,height:180,order:2},320:{width:320,height:240,order:1}}},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return m});var r=n(0),i=(n.n(r),n(7)),o=n(18),a=n(4),s=n(1),c=n(9),u=n.n(c),l=n(5),d=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),p=Object(r.getLogger)(e),h=500,f=2e3,m={ACTIVE:"active",INACTIVE:"inactive",INTERRUPTED:"interrupted",RESTORING:"restoring"},v=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.rtc=t,this.conference=n,this.trackTimers={},this.connStatusFromJvb={},this.outOfLastNTimeout="number"==typeof r.outOfLastNTimeout?r.outOfLastNTimeout:h,this.rtcMuteTimeout="number"==typeof r.rtcMuteTimeout?r.rtcMuteTimeout:f,this.rtcMutedTimestamp={},p.info("RtcMuteTimeout set to: "+this.rtcMuteTimeout),this.enteredLastNTimestamp=new Map,this.restoringTimers=new Map}return d(e,null,[{key:"_getNewStateForJvbMode",value:function(e,t,n,r,i){return e?r?m.ACTIVE:s.a.supportsVideoMuteOnConnInterrupted()?i?t?n?m.INTERRUPTED:m.RESTORING:m.INACTIVE:m.ACTIVE:t?m.ACTIVE:m.INACTIVE:m.INTERRUPTED}},{key:"_getNewStateForP2PMode",value:function(e,t){return s.a.supportsVideoMuteOnConnInterrupted()?e||!t?m.ACTIVE:m.INTERRUPTED:m.ACTIVE}}]),d(e,[{key:"_getVideoFrozenTimeout",value:function(e){return this.rtc.isInLastN(e)?this.rtcMuteTimeout:this.outOfLastNTimeout}},{key:"init",value:function(){this._onEndpointConnStatusChanged=this.onEndpointConnStatusChanged.bind(this),this.rtc.addListener(u.a.ENDPOINT_CONN_STATUS_CHANGED,this._onEndpointConnStatusChanged),this._onP2PStatus=this.refreshConnectionStatusForAll.bind(this),this.conference.on(i.P2P_STATUS,this._onP2PStatus),s.a.supportsVideoMuteOnConnInterrupted()&&(this._onTrackRtcMuted=this.onTrackRtcMuted.bind(this),this.rtc.addListener(u.a.REMOTE_TRACK_MUTE,this._onTrackRtcMuted),this._onTrackRtcUnmuted=this.onTrackRtcUnmuted.bind(this),this.rtc.addListener(u.a.REMOTE_TRACK_UNMUTE,this._onTrackRtcUnmuted),this._onRemoteTrackAdded=this.onRemoteTrackAdded.bind(this),this.conference.on(i.TRACK_ADDED,this._onRemoteTrackAdded),this._onRemoteTrackRemoved=this.onRemoteTrackRemoved.bind(this),this.conference.on(i.TRACK_REMOVED,this._onRemoteTrackRemoved),this._onSignallingMuteChanged=this.onSignallingMuteChanged.bind(this)),this._onLastNChanged=this._onLastNChanged.bind(this),this.conference.on(i.LAST_N_ENDPOINTS_CHANGED,this._onLastNChanged),this._onLastNValueChanged=this.refreshConnectionStatusForAll.bind(this),this.rtc.on(u.a.LASTN_VALUE_CHANGED,this._onLastNValueChanged)}},{key:"dispose",value:function(){this.rtc.removeListener(u.a.ENDPOINT_CONN_STATUS_CHANGED,this._onEndpointConnStatusChanged),s.a.supportsVideoMuteOnConnInterrupted()&&(this.rtc.removeListener(u.a.REMOTE_TRACK_MUTE,this._onTrackRtcMuted),this.rtc.removeListener(u.a.REMOTE_TRACK_UNMUTE,this._onTrackRtcUnmuted),this.conference.off(i.TRACK_ADDED,this._onRemoteTrackAdded),this.conference.off(i.TRACK_REMOVED,this._onRemoteTrackRemoved)),this.conference.off(i.LAST_N_ENDPOINTS_CHANGED,this._onLastNChanged),this.rtc.removeListener(u.a.LASTN_VALUE_CHANGED,this._onLastNValueChanged),this.conference.off(i.P2P_STATUS,this._onP2PStatus);var e=Object.keys(this.trackTimers),t=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var c=o.value;this.clearTimeout(c),this.clearRtcMutedTimestamp(c)}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}this.connStatusFromJvb={}}},{key:"onEndpointConnStatusChanged",value:function(e,t){p.debug("Detector RTCEvents.ENDPOINT_CONN_STATUS_CHANGED("+Date.now()+"): "+e+": "+t),e!==this.conference.myUserId()&&(this.connStatusFromJvb[e]=t,this.figureOutConnectionStatus(e))}},{key:"_changeConnectionStatus",value:function(e,t){if(e.getConnectionStatus()!==t){var n=e.getId();e._setConnectionStatus(t),p.debug("Emit endpoint conn status("+Date.now()+") "+n+": "+t),l.a.sendLog(JSON.stringify({id:"peer.conn.status",participant:n,status:t})),this.conference.eventEmitter.emit(i.PARTICIPANT_CONN_STATUS_CHANGED,n,t)}}},{key:"clearTimeout",value:function(e){this.trackTimers[e]&&(window.clearTimeout(this.trackTimers[e]),this.trackTimers[e]=null)}},{key:"clearRtcMutedTimestamp",value:function(e){this.rtcMutedTimestamp[e]=null}},{key:"onRemoteTrackAdded",value:function(e){e.isLocal()||e.getType()!==a.b||(p.debug("Detector on remote track added for: "+e.getParticipantId()),e.on(o.TRACK_MUTE_CHANGED,this._onSignallingMuteChanged))}},{key:"onRemoteTrackRemoved",value:function(e){if(!e.isLocal()&&e.getType()===a.b){var t=e.getParticipantId();p.debug("Detector on remote track removed: "+t),e.off(o.TRACK_MUTE_CHANGED,this._onSignallingMuteChanged),this.clearTimeout(t),this.clearRtcMutedTimestamp(t),this.figureOutConnectionStatus(t)}}},{key:"isVideoTrackFrozen",value:function(e){if(!s.a.supportsVideoMuteOnConnInterrupted())return!1;var t=e.getId(),n=e.hasAnyVideoTrackWebRTCMuted(),r=this.rtcMutedTimestamp[t],i=this._getVideoFrozenTimeout(t);return n&&"number"==typeof r&&Date.now()-r>=i}},{key:"refreshConnectionStatusForAll",value:function(){var e=this.conference.getParticipants(),t=!0,n=!1,r=void 0;try{for(var i,o=e[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var a=i.value;this.figureOutConnectionStatus(a.getId())}}catch(e){n=!0,r=e}finally{try{!t&&o.return&&o.return()}finally{if(n)throw r}}}},{key:"figureOutConnectionStatus",value:function(t){var n=this.conference.getParticipantById(t);if(n){var r=this.conference.isP2PActive(),i=this._isRestoringTimedout(t),o=0===this.rtc.getLastN(),a=n.isVideoMuted()||o,s=this.isVideoTrackFrozen(n),c=this.rtc.isInLastN(t),u=this.connStatusFromJvb[t];"boolean"!=typeof u&&(p.debug("Assuming connection active by JVB - no notification"),u=!0);var l=r?e._getNewStateForP2PMode(a,s):e._getNewStateForJvbMode(u,c,i,a,s);l!==m.RESTORING&&this._clearRestoringTimer(t),p.debug("Figure out conn status for "+t+", is video muted: "+a+" is active(jvb): "+u+" video track frozen: "+s+" p2p mode: "+r+" is in last N: "+c+" currentStatus => newStatus: "+n.getConnectionStatus()+" => "+l),this._changeConnectionStatus(n,l)}else p.warn("figure out conn status - no participant for: "+t)}},{key:"_onLastNChanged",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=Date.now();p.debug("leaving/entering lastN",e,t,n);var r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var c=a.value;this.enteredLastNTimestamp.delete(c),this._clearRestoringTimer(c),this.figureOutConnectionStatus(c)}}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}var u=!0,l=!1,d=void 0;try{for(var h,f=t[Symbol.iterator]();!(u=(h=f.next()).done);u=!0){var m=h.value;this.enteredLastNTimestamp.set(m,n),this.figureOutConnectionStatus(m)}}catch(e){l=!0,d=e}finally{try{!u&&f.return&&f.return()}finally{if(l)throw d}}}},{key:"_clearRestoringTimer",value:function(e){var t=this.restoringTimers.get(e);t&&(clearTimeout(t),this.restoringTimers.delete(e))}},{key:"_isRestoringTimedout",value:function(e){var t=this,n=this.enteredLastNTimestamp.get(e);return!!(n&&Date.now()-n>=5e3)||(this.restoringTimers.get(e)||this.restoringTimers.set(e,setTimeout(function(){return t.figureOutConnectionStatus(e)},5e3)),!1)}},{key:"onTrackRtcMuted",value:function(e){var t=this,n=e.getParticipantId(),r=this.conference.getParticipantById(n);if(p.debug("Detector track RTC muted: "+n,Date.now()),r){if(this.rtcMutedTimestamp[n]=Date.now(),!r.isVideoMuted()){this.clearTimeout(n);var i=this._getVideoFrozenTimeout(n);this.trackTimers[n]=window.setTimeout(function(){p.debug("Set RTC mute timeout for: "+n+" of "+i+" ms"),t.clearTimeout(n),t.figureOutConnectionStatus(n)},i)}}else p.error("No participant for id: "+n)}},{key:"onTrackRtcUnmuted",value:function(e){var t=e.getParticipantId();p.debug("Detector track RTC unmuted: "+t,Date.now()),this.clearTimeout(t),this.clearRtcMutedTimestamp(t),this.figureOutConnectionStatus(t)}},{key:"onSignallingMuteChanged",value:function(e){var t=e.getParticipantId();p.debug("Detector on track signalling mute changed: "+t,e.isMuted()),this.figureOutConnectionStatus(t)}}]),e}();t.b=v}).call(t,"modules/connectivity/ParticipantConnectionStatus.js")},function(e,t,n){(function(t){var r,o,a=n(0).getLogger(t),s=s||{};e.exports=s,s.options=s.options||{},s.VERSION="0.14.0",s.onwebrtcready=s.onwebrtcready||function(e){},s._onwebrtcreadies=[],s.webRTCReady=function(e){if("function"!=typeof e)throw new Error("Callback provided is not a function");!0===s.onwebrtcreadyDone?e(null!==s.WebRTCPlugin.plugin):s._onwebrtcreadies.push(e)},s.WebRTCPlugin=s.WebRTCPlugin||{},s.WebRTCPlugin.pluginInfo=s.WebRTCPlugin.pluginInfo||{prefix:"Tem",plugName:"TemWebRTCPlugin",pluginId:"plugin0",type:"application/x-temwebrtcplugin",onload:"__TemWebRTCReady0",portalLink:"http://skylink.io/plugin/",downloadLink:null,companyName:"Temasys",downloadLinks:{mac:"http://bit.ly/webrtcpluginpkg",win:"http://bit.ly/webrtcpluginmsi"}},void 0!==s.WebRTCPlugin.pluginInfo.downloadLinks&&null!==s.WebRTCPlugin.pluginInfo.downloadLinks&&(navigator.platform.match(/^Mac/i)?s.WebRTCPlugin.pluginInfo.downloadLink=s.WebRTCPlugin.pluginInfo.downloadLinks.mac:navigator.platform.match(/^Win/i)&&(s.WebRTCPlugin.pluginInfo.downloadLink=s.WebRTCPlugin.pluginInfo.downloadLinks.win)),s.WebRTCPlugin.TAGS={NONE:"none",AUDIO:"audio",VIDEO:"video"},s.WebRTCPlugin.pageId=Math.random().toString(36).slice(2),s.WebRTCPlugin.plugin=null,s.WebRTCPlugin.setLogLevel=null,s.WebRTCPlugin.defineWebRTCInterface=null,s.WebRTCPlugin.isPluginInstalled=null,s.WebRTCPlugin.pluginInjectionInterval=null,s.WebRTCPlugin.injectPlugin=null,s.WebRTCPlugin.PLUGIN_STATES={NONE:0,INITIALIZING:1,INJECTING:2,INJECTED:3,READY:4},s.WebRTCPlugin.pluginState=s.WebRTCPlugin.PLUGIN_STATES.NONE,s.onwebrtcreadyDone=!1,s.WebRTCPlugin.PLUGIN_LOG_LEVELS={NONE:"NONE",ERROR:"ERROR",WARNING:"WARNING",INFO:"INFO",VERBOSE:"VERBOSE",SENSITIVE:"SENSITIVE"},s.WebRTCPlugin.WaitForPluginReady=null,s.WebRTCPlugin.callWhenPluginReady=null,__TemWebRTCReady0=function(){if("complete"===document.readyState)s.WebRTCPlugin.pluginState=s.WebRTCPlugin.PLUGIN_STATES.READY,s.maybeThroughWebRTCReady();else var e=setInterval(function(){"complete"===document.readyState&&(clearInterval(e),s.WebRTCPlugin.pluginState=s.WebRTCPlugin.PLUGIN_STATES.READY,s.maybeThroughWebRTCReady())},100)},s.maybeThroughWebRTCReady=function(){s.onwebrtcreadyDone||(s.onwebrtcreadyDone=!0,s._onwebrtcreadies.length?s._onwebrtcreadies.forEach(function(e){"function"==typeof e&&e(null!==s.WebRTCPlugin.plugin)}):"function"==typeof s.onwebrtcready&&s.onwebrtcready(null!==s.WebRTCPlugin.plugin))},s.TEXT={PLUGIN:{REQUIRE_INSTALLATION:"This website requires you to install a WebRTC-enabling plugin to work on this browser.",NOT_SUPPORTED:"Your browser does not support WebRTC.",BUTTON:"Install Now"},REFRESH:{REQUIRE_REFRESH:"Please refresh page",BUTTON:"Refresh Page"}},s._iceConnectionStates={starting:"starting",checking:"checking",connected:"connected",completed:"connected",done:"completed",disconnected:"disconnected",failed:"failed",closed:"closed"},s._iceConnectionFiredStates=[],s.isDefined=null,s.parseWebrtcDetectedBrowser=function(){var e=null;if(window.opr&&opr.addons||window.opera||navigator.userAgent.indexOf(" OPR/")>=0)e=navigator.userAgent.match(/OPR\/(\d+)/i)||[],webrtcDetectedBrowser="opera",webrtcDetectedVersion=parseInt(e[1]||"0",10),webrtcMinimumVersion=26,webrtcDetectedType="webkit",webrtcDetectedDCSupport="SCTP";else if(navigator.userAgent.match(/Bowser\/[0-9.]*/g)){e=navigator.userAgent.match(/Bowser\/[0-9.]*/g)||[];var t=parseInt((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./i)||[])[2]||"0",10);webrtcDetectedBrowser="bowser",webrtcDetectedVersion=parseFloat((e[0]||"0/0").split("/")[1],10),webrtcMinimumVersion=0,webrtcDetectedType="webkit",webrtcDetectedDCSupport=t>30?"SCTP":"RTP"}else if(navigator.userAgent.indexOf("OPiOS")>0)e=navigator.userAgent.match(/OPiOS\/([0-9]+)\./),webrtcDetectedBrowser="opera",webrtcDetectedVersion=parseInt(e[1]||"0",10),webrtcMinimumVersion=0,webrtcDetectedType=null,webrtcDetectedDCSupport=null;else if(navigator.userAgent.indexOf("CriOS")>0)e=navigator.userAgent.match(/CriOS\/([0-9]+)\./)||[],webrtcDetectedBrowser="chrome",webrtcDetectedVersion=parseInt(e[1]||"0",10),webrtcMinimumVersion=0,webrtcDetectedType=null,webrtcDetectedDCSupport=null;else if(navigator.userAgent.indexOf("FxiOS")>0)e=navigator.userAgent.match(/FxiOS\/([0-9]+)\./)||[],webrtcDetectedBrowser="firefox",webrtcDetectedVersion=parseInt(e[1]||"0",10),webrtcMinimumVersion=0,webrtcDetectedType=null,webrtcDetectedDCSupport=null;else if(document.documentMode)e=/\brv[ :]+(\d+)/g.exec(navigator.userAgent)||[],webrtcDetectedBrowser="IE",webrtcDetectedVersion=parseInt(e[1],10),webrtcMinimumVersion=9,webrtcDetectedType="plugin",webrtcDetectedDCSupport="SCTP",webrtcDetectedVersion||(e=/\bMSIE[ :]+(\d+)/g.exec(navigator.userAgent)||[],webrtcDetectedVersion=parseInt(e[1]||"0",10));else if(window.StyleMedia||navigator.userAgent.match(/Edge\/(\d+).(\d+)$/))e=navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)||[],webrtcDetectedBrowser="edge",webrtcDetectedVersion=parseFloat((e[0]||"0/0").split("/")[1],10),webrtcMinimumVersion=13.10547,webrtcDetectedType="ms",webrtcDetectedDCSupport=null;else if("undefined"!=typeof InstallTrigger||navigator.userAgent.indexOf("irefox")>0)e=navigator.userAgent.match(/Firefox\/([0-9]+)\./)||[],webrtcDetectedBrowser="firefox",webrtcDetectedVersion=parseInt(e[1]||"0",10),webrtcMinimumVersion=31,webrtcDetectedType="moz",webrtcDetectedDCSupport="SCTP";else if(window.chrome&&window.chrome.webstore||navigator.userAgent.indexOf("Chrom")>0)e=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./i)||[],webrtcDetectedBrowser="chrome",webrtcDetectedVersion=parseInt(e[2]||"0",10),webrtcMinimumVersion=38,webrtcDetectedType="webkit",webrtcDetectedDCSupport=webrtcDetectedVersion>30?"SCTP":"RTP";else if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)){e=navigator.userAgent.match(/version\/(\d+)/i)||[];var n=navigator.userAgent.match(/(iPhone|iPad)/gi)||[];webrtcDetectedBrowser="safari",webrtcDetectedVersion=parseInt(e[1]||"0",10),webrtcMinimumVersion=7,webrtcDetectedType=0===n.length?"plugin":null,webrtcDetectedDCSupport=0===n.length?"SCTP":null}else/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)&&(e=navigator.userAgent.match(/AppleWebKit\/([0-9]+)\./)||[],webrtcDetectedBrowser="safari",webrtcDetectedVersion=parseInt(e[1]||"0",10),webrtcMinimumVersion=0,webrtcDetectedType=null,webrtcDetectedDCSupport=null);window.webrtcDetectedBrowser=webrtcDetectedBrowser,window.webrtcDetectedVersion=webrtcDetectedVersion,window.webrtcMinimumVersion=webrtcMinimumVersion,window.webrtcDetectedType=webrtcDetectedType,window.webrtcDetectedDCSupport=webrtcDetectedDCSupport},s.addEvent=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e[t]=n},s.renderNotificationBar=function(e,t,n,r,i){if("complete"===document.readyState){var o=window,a=document.createElement("iframe");a.name="adapterjs-alert",a.style.position="fixed",a.style.top="-41px",a.style.left=0,a.style.right=0,a.style.width="100%",a.style.height="40px",a.style.backgroundColor="#ffffe1",a.style.border="none",a.style.borderBottom="1px solid #888888",a.style.zIndex="9999999","string"==typeof a.style.webkitTransition?a.style.webkitTransition="all .5s ease-out":"string"==typeof a.style.transition&&(a.style.transition="all .5s ease-out"),document.body.appendChild(a);var c=a.contentWindow?a.contentWindow:a.contentDocument.document?a.contentDocument.document:a.contentDocument;c.document.open(),c.document.write('<span style="display: inline-block; font-family: Helvetica, Arial,sans-serif; font-size: .9rem; padding: 4px; vertical-align: middle; cursor: default;">'+e+"</span>"),t&&n?(c.document.write('<button id="okay">'+t+'</button><button id="cancel">Cancel</button>'),c.document.close(),s.addEvent(c.document.getElementById("okay"),"click",function(e){i&&s.renderNotificationBar(s.TEXT.EXTENSION?s.TEXT.EXTENSION.REQUIRE_REFRESH:s.TEXT.REFRESH.REQUIRE_REFRESH,s.TEXT.REFRESH.BUTTON,"javascript:location.reload()"),window.open(n,r?"_blank":"_top"),e.preventDefault();try{e.cancelBubble=!0}catch(e){}var t=setInterval(function(){isIE||navigator.plugins.refresh(!1),s.WebRTCPlugin.isPluginInstalled(s.WebRTCPlugin.pluginInfo.prefix,s.WebRTCPlugin.pluginInfo.plugName,s.WebRTCPlugin.pluginInfo.type,function(){clearInterval(t),s.WebRTCPlugin.defineWebRTCInterface()},function(){})},500)}),s.addEvent(c.document.getElementById("cancel"),"click",function(e){o.document.body.removeChild(a)})):c.document.close(),setTimeout(function(){"string"==typeof a.style.webkitTransform?a.style.webkitTransform="translateY(40px)":"string"==typeof a.style.transform?a.style.transform="translateY(40px)":a.style.top="0px"},300)}},webrtcDetectedType=null,checkMediaDataChannelSettings=function(e,t,n,r){if("function"==typeof n){var i=!0,o="firefox"===webrtcDetectedBrowser,s="moz"===webrtcDetectedType&&webrtcDetectedVersion>30,c="firefox"===e;if(o&&c||s)try{delete r.mandatory.MozDontOfferDataChannel}catch(e){a.error("Failed deleting MozDontOfferDataChannel"),a.error(e)}else o&&!c&&(r.mandatory.MozDontOfferDataChannel=!0);if(!o)for(var u in r.mandatory)r.mandatory.hasOwnProperty(u)&&-1!==u.indexOf("Moz")&&delete r.mandatory[u];!o||c||s||(i=!1),n(i,r)}},checkIceConnectionState=function(e,t,n){"function"==typeof n?(e=e||"peer",s._iceConnectionFiredStates[e]&&t!==s._iceConnectionStates.disconnected&&t!==s._iceConnectionStates.failed&&t!==s._iceConnectionStates.closed||(s._iceConnectionFiredStates[e]=[]),t=s._iceConnectionStates[t],s._iceConnectionFiredStates[e].indexOf(t)<0&&(s._iceConnectionFiredStates[e].push(t),t===s._iceConnectionStates.connected&&setTimeout(function(){s._iceConnectionFiredStates[e].push(s._iceConnectionStates.done),n(s._iceConnectionStates.done)},1e3),n(t))):a.warn("No callback specified in checkIceConnectionState. Aborted.")},createIceServer=null,createIceServers=null,RTCPeerConnection=null,RTCSessionDescription="function"==typeof RTCSessionDescription?RTCSessionDescription:null,RTCIceCandidate="function"==typeof RTCIceCandidate?RTCIceCandidate:null,getUserMedia=null,attachMediaStream=null,reattachMediaStream=null,webrtcDetectedBrowser=null,webrtcDetectedVersion=null,webrtcMinimumVersion=null,!(navigator.mozGetUserMedia||navigator.webkitGetUserMedia||navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/))||0===(navigator.userAgent.match(/android/gi)||[]).length&&0===(navigator.userAgent.match(/chrome/gi)||[]).length&&navigator.userAgent.indexOf("Safari/")>0?("object"==typeof a&&"function"==typeof a.log||((a={}||a).log=function(e){},a.info=function(e){},a.error=function(e){},a.dir=function(e){},a.exception=function(e){},a.trace=function(e){},a.warn=function(e){},a.count=function(e){},a.debug=function(e){},a.count=function(e){},a.time=function(e){},a.timeEnd=function(e){},a.group=function(e){},a.groupCollapsed=function(e){},a.groupEnd=function(e){}),s.parseWebrtcDetectedBrowser(),isIE="IE"===webrtcDetectedBrowser,s.WebRTCPlugin.WaitForPluginReady=function(){for(;s.WebRTCPlugin.pluginState!==s.WebRTCPlugin.PLUGIN_STATES.READY;);},s.WebRTCPlugin.callWhenPluginReady=function(e){if(s.WebRTCPlugin.pluginState===s.WebRTCPlugin.PLUGIN_STATES.READY)e();else var t=setInterval(function(){s.WebRTCPlugin.pluginState===s.WebRTCPlugin.PLUGIN_STATES.READY&&(clearInterval(t),e())},100)},s.WebRTCPlugin.setLogLevel=function(e){s.WebRTCPlugin.callWhenPluginReady(function(){s.WebRTCPlugin.plugin.setLogLevel(e)})},s.WebRTCPlugin.injectPlugin=function(){if("complete"===document.readyState&&s.WebRTCPlugin.pluginState===s.WebRTCPlugin.PLUGIN_STATES.INITIALIZING){if(s.WebRTCPlugin.pluginState=s.WebRTCPlugin.PLUGIN_STATES.INJECTING,"IE"===webrtcDetectedBrowser&&webrtcDetectedVersion<=10){var e=document.createDocumentFragment();for(s.WebRTCPlugin.plugin=document.createElement("div"),s.WebRTCPlugin.plugin.innerHTML='<object id="'+s.WebRTCPlugin.pluginInfo.pluginId+'" type="'+s.WebRTCPlugin.pluginInfo.type+'" width="1" height="1"><param name="pluginId" value="'+s.WebRTCPlugin.pluginInfo.pluginId+'" /> <param name="windowless" value="false" /> <param name="pageId" value="'+s.WebRTCPlugin.pageId+'" /> <param name="onload" value="'+s.WebRTCPlugin.pluginInfo.onload+'" /><param name="tag" value="'+s.WebRTCPlugin.TAGS.NONE+'" />'+(s.options.getAllCams?'<param name="forceGetAllCams" value="True" />':"")+"</object>";s.WebRTCPlugin.plugin.firstChild;)e.appendChild(s.WebRTCPlugin.plugin.firstChild);document.body.appendChild(e),s.WebRTCPlugin.plugin=document.getElementById(s.WebRTCPlugin.pluginInfo.pluginId)}else s.WebRTCPlugin.plugin=document.createElement("object"),s.WebRTCPlugin.plugin.id=s.WebRTCPlugin.pluginInfo.pluginId,isIE?(s.WebRTCPlugin.plugin.width="1px",s.WebRTCPlugin.plugin.height="1px"):(s.WebRTCPlugin.plugin.width="0px",s.WebRTCPlugin.plugin.height="0px"),s.WebRTCPlugin.plugin.type=s.WebRTCPlugin.pluginInfo.type,s.WebRTCPlugin.plugin.innerHTML='<param name="onload" value="'+s.WebRTCPlugin.pluginInfo.onload+'"><param name="pluginId" value="'+s.WebRTCPlugin.pluginInfo.pluginId+'"><param name="windowless" value="false" /> '+(s.options.getAllCams?'<param name="forceGetAllCams" value="True" />':"")+'<param name="pageId" value="'+s.WebRTCPlugin.pageId+'"><param name="tag" value="'+s.WebRTCPlugin.TAGS.NONE+'" />',document.body.appendChild(s.WebRTCPlugin.plugin);s.WebRTCPlugin.pluginState=s.WebRTCPlugin.PLUGIN_STATES.INJECTED}},s.WebRTCPlugin.isPluginInstalled=function(e,t,n,r,i){if(isIE){try{new ActiveXObject(e+"."+t)}catch(e){return void i()}r()}else{for(var o=navigator.mimeTypes,a=0;a<o.length;a++)if(o[a].type.indexOf(n)>=0)return void r();i()}},s.WebRTCPlugin.defineWebRTCInterface=function(){if(s.WebRTCPlugin.pluginState!==s.WebRTCPlugin.PLUGIN_STATES.READY){s.WebRTCPlugin.pluginState=s.WebRTCPlugin.PLUGIN_STATES.INITIALIZING,s.isDefined=function(e){return null!==e&&void 0!==e},createIceServer=function(e,t,n){var r=null,i=e.split(":");return 0===i[0].indexOf("stun")?r={url:e,hasCredentials:!1}:0===i[0].indexOf("turn")&&(r={url:e,hasCredentials:!0,credential:n,username:t}),r},createIceServers=function(e,t,n){for(var r=[],i=0;i<e.length;++i)r.push(createIceServer(e[i],t,n));return r},RTCSessionDescription=function(e){return s.WebRTCPlugin.WaitForPluginReady(),s.WebRTCPlugin.plugin.ConstructSessionDescription(e.type,e.sdp)},RTCPeerConnection=function(e,t){if(void 0!==e&&null!==e&&!Array.isArray(e.iceServers))throw new Error("Failed to construct 'RTCPeerConnection': Malformed RTCConfiguration");if(void 0!==t&&null!==t){var n=!1;if(n|="object"!=typeof t,n|=t.hasOwnProperty("mandatory")&&void 0!==t.mandatory&&null!==t.mandatory&&t.mandatory.constructor!==Object,n|=t.hasOwnProperty("optional")&&void 0!==t.optional&&null!==t.optional&&!Array.isArray(t.optional))throw new Error("Failed to construct 'RTCPeerConnection': Malformed constraints object")}s.WebRTCPlugin.WaitForPluginReady();var r=null;if(e&&Array.isArray(e.iceServers)){r=e.iceServers;for(var i=0;i<r.length;i++)r[i].urls&&!r[i].url&&(r[i].url=r[i].urls),r[i].hasCredentials=s.isDefined(r[i].username)&&s.isDefined(r[i].credential)}if(s.WebRTCPlugin.plugin.PEER_CONNECTION_VERSION&&s.WebRTCPlugin.plugin.PEER_CONNECTION_VERSION>1)return r&&(e.iceServers=r),s.WebRTCPlugin.plugin.PeerConnection(e);var o=t&&t.mandatory?t.mandatory:null,a=t&&t.optional?t.optional:null;return s.WebRTCPlugin.plugin.PeerConnection(s.WebRTCPlugin.pageId,r,o,a)},MediaStreamTrack=function(){},MediaStreamTrack.getSources=function(e){s.WebRTCPlugin.callWhenPluginReady(function(){s.WebRTCPlugin.plugin.GetSources(e)})};var e=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var o={};"number"==typeof r.ideal?(o[i("min",n)]=r.ideal,t.optional.push(o),(o={})[i("max",n)]=r.ideal,t.optional.push(o)):(o[i("",n)]=r.ideal,t.optional.push(o))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t};getUserMedia=function(t,n,r){var i={};i.audio=!!t.audio&&e(t.audio),i.video=!!t.video&&e(t.video),s.WebRTCPlugin.callWhenPluginReady(function(){s.WebRTCPlugin.plugin.getUserMedia(i,n,r)})},window.navigator.getUserMedia=getUserMedia,navigator.mediaDevices||"undefined"==typeof Promise||(requestUserMedia=function(e){return new Promise(function(t,n){getUserMedia(e,t,n)})},navigator.mediaDevices={getUserMedia:requestUserMedia,enumerateDevices:function(){return new Promise(function(e){var t={audio:"audioinput",video:"videoinput"};return MediaStreamTrack.getSources(function(n){e(n.map(function(e){return{label:e.label,kind:t[e.kind],id:e.id,deviceId:e.id,groupId:""}}))})})}}),attachMediaStream=function(e,t){if(e&&e.parentNode){var n;null===t?n="":(void 0!==t.enableSoundTracks&&t.enableSoundTracks(!0),n=t.id);var r=0===e.id.length?Math.random().toString(36).slice(2):e.id,i=e.nodeName.toLowerCase();if("object"!==i){var o;switch(i){case"audio":o=s.WebRTCPlugin.TAGS.AUDIO;break;case"video":o=s.WebRTCPlugin.TAGS.VIDEO;break;default:o=s.WebRTCPlugin.TAGS.NONE}var a=document.createDocumentFragment(),c=document.createElement("div"),u="";for(e.className?u='class="'+e.className+'" ':e.attributes&&e.attributes.class&&(u='class="'+e.attributes.class.value+'" '),c.innerHTML='<object id="'+r+'" '+u+'type="'+s.WebRTCPlugin.pluginInfo.type+'"><param name="pluginId" value="'+r+'" /> <param name="pageId" value="'+s.WebRTCPlugin.pageId+'" /> <param name="windowless" value="true" /> <param name="streamId" value="'+n+'" /> <param name="tag" value="'+o+'" /> </object>';c.firstChild;)a.appendChild(c.firstChild);var l="",d="";e.clientWidth||e.clientHeight?(d=e.clientWidth,l=e.clientHeight):(e.width||e.height)&&(d=e.width,l=e.height),e.parentNode.insertBefore(a,e),(a=document.getElementById(r)).width=d,a.height=l,e.parentNode.removeChild(e)}else{for(var p=e.children,h=0;h!==p.length;++h)if("streamId"===p[h].name){p[h].value=n;break}e.setStreamId(n)}var f=document.getElementById(r);return s.forwardEventHandlers(f,e,Object.getPrototypeOf(e)),f}},reattachMediaStream=function(e,t){for(var n=null,r=t.children,i=0;i!==r.length;++i)if("streamId"===r[i].name){s.WebRTCPlugin.WaitForPluginReady(),n=s.WebRTCPlugin.plugin.getStreamWithId(s.WebRTCPlugin.pageId,r[i].value);break}if(null!==n)return attachMediaStream(e,n);a.log("Could not find the stream associated with this element")},window.attachMediaStream=attachMediaStream,window.reattachMediaStream=reattachMediaStream,window.getUserMedia=getUserMedia,s.attachMediaStream=attachMediaStream,s.reattachMediaStream=reattachMediaStream,s.getUserMedia=getUserMedia,s.forwardEventHandlers=function(e,t,n){properties=Object.getOwnPropertyNames(n);for(var r in properties)r&&(propName=properties[r],"function"==typeof propName.slice&&"on"===propName.slice(0,2)&&"function"==typeof t[propName]&&s.addEvent(e,propName.slice(2),t[propName]));var i=Object.getPrototypeOf(n);i&&s.forwardEventHandlers(e,t,i)},RTCIceCandidate=function(e){return e.sdpMid||(e.sdpMid=""),s.WebRTCPlugin.WaitForPluginReady(),s.WebRTCPlugin.plugin.ConstructIceCandidate(e.sdpMid,e.sdpMLineIndex,e.candidate)},s.addEvent(document,"readystatechange",s.WebRTCPlugin.injectPlugin),s.WebRTCPlugin.injectPlugin()}else a.error("AdapterJS - WebRTC interface has already been defined")},s.WebRTCPlugin.pluginNeededButNotInstalledCb=s.WebRTCPlugin.pluginNeededButNotInstalledCb||function(){s.addEvent(document,"readystatechange",s.WebRTCPlugin.pluginNeededButNotInstalledCbPriv),s.WebRTCPlugin.pluginNeededButNotInstalledCbPriv()},s.WebRTCPlugin.pluginNeededButNotInstalledCbPriv=function(){if(!s.options.hidePluginInstallPrompt){var e,t=s.WebRTCPlugin.pluginInfo.downloadLink;t?(e=s.WebRTCPlugin.pluginInfo.portalLink?'This website requires you to install the <a href="'+s.WebRTCPlugin.pluginInfo.portalLink+'" target="_blank">'+s.WebRTCPlugin.pluginInfo.companyName+" WebRTC Plugin</a> to work on this browser.":s.TEXT.PLUGIN.REQUIRE_INSTALLATION,s.renderNotificationBar(e,s.TEXT.PLUGIN.BUTTON,t)):s.renderNotificationBar(s.TEXT.PLUGIN.NOT_SUPPORTED)}},s.WebRTCPlugin.isPluginInstalled(s.WebRTCPlugin.pluginInfo.prefix,s.WebRTCPlugin.pluginInfo.plugName,s.WebRTCPlugin.pluginInfo.type,s.WebRTCPlugin.defineWebRTCInterface,s.WebRTCPlugin.pluginNeededButNotInstalledCb)):(o=function(){return function e(t,n,i){function o(s,c){if(!n[s]){if(!t[s]){if(!c&&"function"==typeof r&&r)return r(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){return o(t[s][1][e]||e)},l,l.exports,e,t,n,i)}return n[s].exports}for(var a="function"==typeof r&&r,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(e,t,n){"use strict";var r={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},r.splitSections=function(e){return e.split("\nm=").map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})},r.matchPrefix=function(e,t){return r.splitLines(e).filter(function(e){return 0===e.indexOf(t)})},r.parseCandidate=function(e){for(var t,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1]}return n},r.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),"candidate:"+t.join(" ")},r.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.numChannels=3===t.length?parseInt(t[2],10):1,n},r.writeRtpMap=function(e){var t=e.payloadType;return void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType),"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==e.numChannels?"/"+e.numChannels:"")+"\r\n"},r.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),uri:t[1]}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+" "+e.uri+"\r\n"},r.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},r.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach(function(t){r.push(t+"="+e.parameters[t])}),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},r.writeRtcpFb=function(e){var t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},r.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},r.getDtlsParameters=function(e,t){var n=r.splitLines(e),i=(n=n.concat(r.splitLines(t))).filter(function(e){return 0===e.indexOf("a=fingerprint:")})[0].substr(14);return{role:"auto",fingerprints:[{algorithm:i.split(" ")[0],value:i.split(" ")[1]}]}},r.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},r.getIceParameters=function(e,t){var n=r.splitLines(e);return{usernameFragment:(n=n.concat(r.splitLines(t))).filter(function(e){return 0===e.indexOf("a=ice-ufrag:")})[0].substr(12),password:n.filter(function(e){return 0===e.indexOf("a=ice-pwd:")})[0].substr(10)}},r.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},r.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=r.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=r.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=r.parseRtpMap(a),c=r.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?r.parseFmtp(c[0]):{},s.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(r.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return r.matchPrefix(e,"a=extmap:").forEach(function(e){t.headerExtensions.push(r.parseExtmap(e))}),t},r.writeRtpDescription=function(e,t){var n="";return n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=t.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(function(e){n+=r.writeRtpMap(e),n+=r.writeFmtp(e),n+=r.writeRtcpFb(e)}),n+="a=rtcp-mux\r\n"},r.parseRtpEncodingParameters=function(e){var t,n=[],i=r.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),c=s.length>0&&s[0].ssrc,u=r.matchPrefix(e,"a=ssrc-group:FID").map(function(e){var t=e.split(" ");return t.shift(),t.map(function(e){return parseInt(e,10)})});u.length>0&&u[0].length>1&&u[0][0]===c&&(t=u[0][1]),i.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var r={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10),rtx:{payloadType:e.payloadType,ssrc:t}};n.push(r),o&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:t,mechanism:a?"red+ulpfec":"red"},n.push(r))}}),0===n.length&&c&&n.push({ssrc:c});var l=r.matchPrefix(e,"b=");return l.length&&(0===l[0].indexOf("b=TIAS:")?l=parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")&&(l=parseInt(l[0].substr(5),10)),n.forEach(function(e){e.maxBitrate=l})),n},r.writeSessionBoilerplate=function(){return"v=0\r\no=thisisadapterortc 8169639915646943137 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.writeMediaSection=function(e,t,n,i){var o=r.writeRtpDescription(e.kind,t);if(o+=r.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+r.localCName+"\r\n"},r.getDirection=function(e,t){for(var n=r.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return t?r.getDirection(t):"sendrecv"},t.exports=r},{}],2:[function(e,t,n){"use strict";!function(){var n=e("./utils").log,r=e("./utils").browserDetails;t.exports.browserDetails=r,t.exports.extractVersion=e("./utils").extractVersion,t.exports.disableLog=e("./utils").disableLog;var i=e("./chrome/chrome_shim")||null,o=e("./edge/edge_shim")||null,a=e("./firefox/firefox_shim")||null,s=e("./safari/safari_shim")||null;switch(r.browser){case"opera":case"chrome":if(!i||!i.shimPeerConnection)return void n("Chrome shim is not included in this adapter release.");n("adapter.js shimming chrome."),t.exports.browserShim=i,i.shimGetUserMedia(),i.shimMediaStream(),i.shimSourceObject(),i.shimPeerConnection(),i.shimOnTrack();break;case"firefox":if(!a||!a.shimPeerConnection)return void n("Firefox shim is not included in this adapter release.");n("adapter.js shimming firefox."),t.exports.browserShim=a,a.shimGetUserMedia(),a.shimSourceObject(),a.shimPeerConnection(),a.shimOnTrack();break;case"edge":if(!o||!o.shimPeerConnection)return void n("MS edge shim is not included in this adapter release.");n("adapter.js shimming edge."),t.exports.browserShim=o,o.shimGetUserMedia(),o.shimPeerConnection();break;case"safari":if(!s)return void n("Safari shim is not included in this adapter release.");n("adapter.js shimming safari."),t.exports.browserShim=s,s.shimGetUserMedia();break;default:n("Unsupported browser!")}}()},{"./chrome/chrome_shim":3,"./edge/edge_shim":5,"./firefox/firefox_shim":7,"./safari/safari_shim":9,"./utils":10}],3:[function(e,t,n){"use strict";var r=e("../utils.js").log,i=e("../utils.js").browserDetails,o={shimMediaStream:function(){window.MediaStream=window.MediaStream||window.webkitMediaStream},shimOnTrack:function(){"object"!=typeof window||!window.RTCPeerConnection||"ontrack"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){var t=this;this._ontrack&&(this.removeEventListener("track",this._ontrack),this.removeEventListener("addstream",this._ontrackpoly)),this.addEventListener("track",this._ontrack=e),this.addEventListener("addstream",this._ontrackpoly=function(e){e.stream.addEventListener("addtrack",function(n){var r=new Event("track");r.track=n.track,r.receiver={track:n.track},r.streams=[e.stream],t.dispatchEvent(r)}),e.stream.getTracks().forEach(function(t){var n=new Event("track");n.track=t,n.receiver={track:t},n.streams=[e.stream],this.dispatchEvent(n)}.bind(this))}.bind(this))}})},shimSourceObject:function(){"object"==typeof window&&(!window.HTMLMediaElement||"srcObject"in window.HTMLMediaElement.prototype||Object.defineProperty(window.HTMLMediaElement.prototype,"srcObject",{get:function(){return this._srcObject},set:function(e){var t=this;this._srcObject=e,this.src&&URL.revokeObjectURL(this.src),e?(this.src=URL.createObjectURL(e),e.addEventListener("addtrack",function(){t.src&&URL.revokeObjectURL(t.src),t.src=URL.createObjectURL(e)}),e.addEventListener("removetrack",function(){t.src&&URL.revokeObjectURL(t.src),t.src=URL.createObjectURL(e)})):this.src=""}}))},shimPeerConnection:function(){window.RTCPeerConnection=function(e,t){r("PeerConnection"),e&&e.iceTransportPolicy&&(e.iceTransports=e.iceTransportPolicy);var n=new webkitRTCPeerConnection(e,t),i=n.getStats.bind(n);return n.getStats=function(e,t,n){var r=this,o=arguments;if(arguments.length>0&&"function"==typeof e)return i(e,t);var a=function(e){var t={};return e.result().forEach(function(e){var n={id:e.id,timestamp:e.timestamp,type:e.type};e.names().forEach(function(t){n[t]=e.stat(t)}),t[n.id]=n}),t},s=function(e,t){var n=new Map(Object.keys(e).map(function(t){return[t,e[t]]}));return t=t||e,Object.keys(t).forEach(function(e){n[e]=t[e]}),n};return arguments.length>=2?i.apply(this,[function(e){o[1](s(a(e)))},arguments[0]]):new Promise(function(t,n){1===o.length&&"object"==typeof e?i.apply(r,[function(e){t(s(a(e)))},n]):i.apply(r,[function(e){t(s(a(e),e.result()))},n])}).then(t,n)},n},window.RTCPeerConnection.prototype=webkitRTCPeerConnection.prototype,webkitRTCPeerConnection.generateCertificate&&Object.defineProperty(window.RTCPeerConnection,"generateCertificate",{get:function(){return webkitRTCPeerConnection.generateCertificate}}),["createOffer","createAnswer"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){var e=this;if(arguments.length<1||1===arguments.length&&"object"==typeof arguments[0]){var n=1===arguments.length?arguments[0]:void 0;return new Promise(function(r,i){t.apply(e,[r,i,n])})}return t.apply(this,arguments)}}),i.version<51&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){var e=arguments,n=this,r=new Promise(function(r,i){t.apply(n,[e[0],r,i])});return e.length<2?r:r.then(function(){e[1].apply(null,[])},function(t){e.length>=3&&e[2].apply(null,[t])})}}),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=webkitRTCPeerConnection.prototype[e];webkitRTCPeerConnection.prototype[e]=function(){return arguments[0]=new("addIceCandidate"===e?RTCIceCandidate:RTCSessionDescription)(arguments[0]),t.apply(this,arguments)}});var e=RTCPeerConnection.prototype.addIceCandidate;RTCPeerConnection.prototype.addIceCandidate=function(){return null===arguments[0]?Promise.resolve():e.apply(this,arguments)}}};t.exports={shimMediaStream:o.shimMediaStream,shimOnTrack:o.shimOnTrack,shimSourceObject:o.shimSourceObject,shimPeerConnection:o.shimPeerConnection,shimGetUserMedia:e("./getusermedia")}},{"../utils.js":10,"./getusermedia":4}],4:[function(e,t,n){"use strict";var r=e("../utils.js").log;t.exports=function(){var e=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var o={};"number"==typeof r.ideal?(o[i("min",n)]=r.ideal,t.optional.push(o),(o={})[i("max",n)]=r.ideal,t.optional.push(o)):(o[i("",n)]=r.ideal,t.optional.push(o))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},t=function(t,n){if((t=JSON.parse(JSON.stringify(t)))&&t.audio&&(t.audio=e(t.audio)),t&&"object"==typeof t.video){var i=t.video.facingMode;if((i=i&&("object"==typeof i?i:{ideal:i}))&&("user"===i.exact||"environment"===i.exact||"user"===i.ideal||"environment"===i.ideal)&&(!navigator.mediaDevices.getSupportedConstraints||!navigator.mediaDevices.getSupportedConstraints().facingMode)&&(delete t.video.facingMode,"environment"===i.exact||"environment"===i.ideal))return navigator.mediaDevices.enumerateDevices().then(function(o){var a=(o=o.filter(function(e){return"videoinput"===e.kind})).find(function(e){return-1!==e.label.toLowerCase().indexOf("back")})||o.length&&o[o.length-1];return a&&(t.video.deviceId=i.exact?{exact:a.deviceId}:{ideal:a.deviceId}),t.video=e(t.video),r("chrome: "+JSON.stringify(t)),n(t)});t.video=e(t.video)}return r("chrome: "+JSON.stringify(t)),n(t)},n=function(e){return{name:{PermissionDeniedError:"NotAllowedError",ConstraintNotSatisfiedError:"OverconstrainedError"}[e.name]||e.name,message:e.message,constraint:e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};navigator.getUserMedia=function(e,r,i){t(e,function(e){navigator.webkitGetUserMedia(e,r,function(e){i(n(e))})})};var i=function(e){return new Promise(function(t,n){navigator.getUserMedia(e,t,n)})};if(navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:i,enumerateDevices:function(){return new Promise(function(e){var t={audio:"audioinput",video:"videoinput"};return MediaStreamTrack.getSources(function(n){e(n.map(function(e){return{label:e.label,kind:t[e.kind],deviceId:e.id,groupId:""}}))})})}}),navigator.mediaDevices.getUserMedia){var o=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(e){return t(e,function(e){return o(e).catch(function(e){return Promise.reject(n(e))})})}}else navigator.mediaDevices.getUserMedia=function(e){return i(e)};void 0===navigator.mediaDevices.addEventListener&&(navigator.mediaDevices.addEventListener=function(){r("Dummy mediaDevices.addEventListener called.")}),void 0===navigator.mediaDevices.removeEventListener&&(navigator.mediaDevices.removeEventListener=function(){r("Dummy mediaDevices.removeEventListener called.")})}},{"../utils.js":10}],5:[function(e,t,n){"use strict";var r=e("sdp"),i=e("../utils").browserDetails,o={shimPeerConnection:function(){window.RTCIceGatherer&&(window.RTCIceCandidate||(window.RTCIceCandidate=function(e){return e}),window.RTCSessionDescription||(window.RTCSessionDescription=function(e){return e})),window.RTCPeerConnection=function(e){var t=this,n=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){t[e]=n[e].bind(n)}),this.onicecandidate=null,this.onaddstream=null,this.ontrack=null,this.onremovestream=null,this.onsignalingstatechange=null,this.oniceconnectionstatechange=null,this.onnegotiationneeded=null,this.ondatachannel=null,this.localStreams=[],this.remoteStreams=[],this.getLocalStreams=function(){return t.localStreams},this.getRemoteStreams=function(){return t.remoteStreams},this.localDescription=new RTCSessionDescription({type:"",sdp:""}),this.remoteDescription=new RTCSessionDescription({type:"",sdp:""}),this.signalingState="stable",this.iceConnectionState="new",this.iceGatheringState="new",this.iceOptions={gatherPolicy:"all",iceServers:[]},e&&e.iceTransportPolicy)switch(e.iceTransportPolicy){case"all":case"relay":this.iceOptions.gatherPolicy=e.iceTransportPolicy;break;case"none":throw new TypeError('iceTransportPolicy "none" not supported')}if(this.usingBundle=e&&"max-bundle"===e.bundlePolicy,e&&e.iceServers){var r=JSON.parse(JSON.stringify(e.iceServers));this.iceOptions.iceServers=r.filter(function(e){if(e&&e.urls){var t=e.urls;return"string"==typeof t&&(t=[t]),!!(t=t.filter(function(e){return 0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")&&-1===e.indexOf("turn:[")||0===e.indexOf("stun:")&&i.version>=14393})[0])}return!1})}this.transceivers=[],this._localIceCandidatesBuffer=[]},window.RTCPeerConnection.prototype._emitBufferedCandidates=function(){var e=this,t=r.splitSections(e.localDescription.sdp);this._localIceCandidatesBuffer.forEach(function(n){if(n.candidate&&0!==Object.keys(n.candidate).length)-1===n.candidate.candidate.indexOf("typ endOfCandidates")&&(t[n.candidate.sdpMLineIndex+1]+="a="+n.candidate.candidate+"\r\n");else for(var r=1;r<t.length;r++)-1===t[r].indexOf("\r\na=end-of-candidates\r\n")&&(t[r]+="a=end-of-candidates\r\n");e.localDescription.sdp=t.join(""),e.dispatchEvent(n),null!==e.onicecandidate&&e.onicecandidate(n),n.candidate||"complete"===e.iceGatheringState||e.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state})&&(e.iceGatheringState="complete")}),this._localIceCandidatesBuffer=[]},window.RTCPeerConnection.prototype.addStream=function(e){this.localStreams.push(e.clone()),this._maybeFireNegotiationNeeded()},window.RTCPeerConnection.prototype.removeStream=function(e){var t=this.localStreams.indexOf(e);t>-1&&(this.localStreams.splice(t,1),this._maybeFireNegotiationNeeded())},window.RTCPeerConnection.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},window.RTCPeerConnection.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},window.RTCPeerConnection.prototype._getCommonCapabilities=function(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]};return e.codecs.forEach(function(e){for(var r=0;r<t.codecs.length;r++){var i=t.codecs[r];if(e.name.toLowerCase()===i.name.toLowerCase()&&e.clockRate===i.clockRate&&e.numChannels===i.numChannels){n.codecs.push(i),i.rtcpFeedback=i.rtcpFeedback.filter(function(t){for(var n=0;n<e.rtcpFeedback.length;n++)if(e.rtcpFeedback[n].type===t.type&&e.rtcpFeedback[n].parameter===t.parameter)return!0;return!1});break}}}),e.headerExtensions.forEach(function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}}),n},window.RTCPeerConnection.prototype._createIceAndDtlsTransports=function(e,t){var n=this,i=new RTCIceGatherer(n.iceOptions),o=new RTCIceTransport(i);i.onlocalcandidate=function(a){var s=new Event("icecandidate");s.candidate={sdpMid:e,sdpMLineIndex:t};var c=a.candidate,u=!c||0===Object.keys(c).length;u?(void 0===i.state&&(i.state="completed"),s.candidate.candidate="candidate:1 1 udp 1 0.0.0.0 9 typ endOfCandidates"):(c.component="RTCP"===o.component?2:1,s.candidate.candidate=r.writeCandidate(c));var l=r.splitSections(n.localDescription.sdp);-1===s.candidate.candidate.indexOf("typ endOfCandidates")?l[s.candidate.sdpMLineIndex+1]+="a="+s.candidate.candidate+"\r\n":l[s.candidate.sdpMLineIndex+1]+="a=end-of-candidates\r\n",n.localDescription.sdp=l.join("");var d=n.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});switch(n.iceGatheringState){case"new":n._localIceCandidatesBuffer.push(s),u&&d&&n._localIceCandidatesBuffer.push(new Event("icecandidate"));break;case"gathering":n._emitBufferedCandidates(),n.dispatchEvent(s),null!==n.onicecandidate&&n.onicecandidate(s),d&&(n.dispatchEvent(new Event("icecandidate")),null!==n.onicecandidate&&n.onicecandidate(new Event("icecandidate")),n.iceGatheringState="complete")}},o.onicestatechange=function(){n._updateConnectionState()};var a=new RTCDtlsTransport(o);return a.ondtlsstatechange=function(){n._updateConnectionState()},a.onerror=function(){a.state="failed",n._updateConnectionState()},{iceGatherer:i,iceTransport:o,dtlsTransport:a}},window.RTCPeerConnection.prototype._transceive=function(e,t,n){var i=this._getCommonCapabilities(e.localCapabilities,e.remoteCapabilities);t&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:r.localCName},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),n&&e.rtpReceiver&&(i.encodings=e.recvEncodingParameters,i.rtcp={cname:e.cname},e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},window.RTCPeerConnection.prototype.setLocalDescription=function(e){var t,n,i=this;if("offer"===e.type)this._pendingOffer&&(t=r.splitSections(e.sdp),n=t.shift(),t.forEach(function(e,t){var n=r.parseRtpParameters(e);i._pendingOffer[t].localCapabilities=n}),this.transceivers=this._pendingOffer,delete this._pendingOffer);else if("answer"===e.type){t=r.splitSections(i.remoteDescription.sdp),n=t.shift();var o=r.matchPrefix(n,"a=ice-lite").length>0;t.forEach(function(e,t){var a=i.transceivers[t],s=a.iceGatherer,c=a.iceTransport,u=a.dtlsTransport,l=a.localCapabilities,d=a.remoteCapabilities;if("0"!==e.split("\n",1)[0].split(" ",2)[1]&&!a.isDatachannel){var p=r.getIceParameters(e,n);if(o){var h=r.matchPrefix(e,"a=candidate:").map(function(e){return r.parseCandidate(e)}).filter(function(e){return"1"===e.component});h.length&&c.setRemoteCandidates(h)}var f=r.getDtlsParameters(e,n);o&&(f.role="server"),i.usingBundle&&0!==t||(c.start(s,p,o?"controlling":"controlled"),u.start(f));var m=i._getCommonCapabilities(l,d);i._transceive(a,m.codecs.length>0,!1)}})}switch(this.localDescription={type:e.type,sdp:e.sdp},e.type){case"offer":this._updateSignalingState("have-local-offer");break;case"answer":this._updateSignalingState("stable");break;default:throw new TypeError('unsupported type "'+e.type+'"')}var a=arguments.length>1&&"function"==typeof arguments[1];if(a){var s=arguments[1];window.setTimeout(function(){s(),"new"===i.iceGatheringState&&(i.iceGatheringState="gathering"),i._emitBufferedCandidates()},0)}var c=Promise.resolve();return c.then(function(){a||("new"===i.iceGatheringState&&(i.iceGatheringState="gathering"),window.setTimeout(i._emitBufferedCandidates.bind(i),500))}),c},window.RTCPeerConnection.prototype.setRemoteDescription=function(e){var t=this,n=new MediaStream,i=[],o=r.splitSections(e.sdp),a=o.shift(),s=r.matchPrefix(a,"a=ice-lite").length>0;switch(this.usingBundle=r.matchPrefix(a,"a=group:BUNDLE ").length>0,o.forEach(function(o,c){var u=r.splitLines(o)[0].substr(2).split(" "),l=u[0],d="0"===u[1],p=r.getDirection(o,a),h=r.matchPrefix(o,"a=mid:");if(h=h.length?h[0].substr(6):r.generateIdentifier(),"application"!==l||"DTLS/SCTP"!==u[2]){var f,m,v,g,y,b,S,_,T,C,E,w,R,k=r.parseRtpParameters(o);d||(E=r.getIceParameters(o,a),(w=r.getDtlsParameters(o,a)).role="client"),_=r.parseRtpEncodingParameters(o);var I=r.matchPrefix(o,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];I&&(R=I.value);var P=r.matchPrefix(o,"a=end-of-candidates",a).length>0,A=r.matchPrefix(o,"a=candidate:").map(function(e){return r.parseCandidate(e)}).filter(function(e){return"1"===e.component});if("offer"!==e.type||d)"answer"!==e.type||d||(m=(f=t.transceivers[c]).iceGatherer,v=f.iceTransport,g=f.dtlsTransport,y=f.rtpSender,b=f.rtpReceiver,S=f.sendEncodingParameters,T=f.localCapabilities,t.transceivers[c].recvEncodingParameters=_,t.transceivers[c].remoteCapabilities=k,t.transceivers[c].cname=R,(s||P)&&A.length&&v.setRemoteCandidates(A),t.usingBundle&&0!==c||(v.start(m,E,"controlling"),g.start(w)),t._transceive(f,"sendrecv"===p||"recvonly"===p,"sendrecv"===p||"sendonly"===p),!b||"sendrecv"!==p&&"sendonly"!==p?delete f.rtpReceiver:(C=b.track,i.push([C,b]),n.addTrack(C)));else{var O,D=t.usingBundle&&c>0?{iceGatherer:t.transceivers[0].iceGatherer,iceTransport:t.transceivers[0].iceTransport,dtlsTransport:t.transceivers[0].dtlsTransport}:t._createIceAndDtlsTransports(h,c);P&&D.iceTransport.setRemoteCandidates(A),T=RTCRtpReceiver.getCapabilities(l),S=[{ssrc:1001*(2*c+2)}],C=(b=new RTCRtpReceiver(D.dtlsTransport,l)).track,i.push([C,b]),n.addTrack(C),t.localStreams.length>0&&t.localStreams[0].getTracks().length>=c&&("audio"===l?O=t.localStreams[0].getAudioTracks()[0]:"video"===l&&(O=t.localStreams[0].getVideoTracks()[0]),O&&(y=new RTCRtpSender(O,D.dtlsTransport))),t.transceivers[c]={iceGatherer:D.iceGatherer,iceTransport:D.iceTransport,dtlsTransport:D.dtlsTransport,localCapabilities:T,remoteCapabilities:k,rtpSender:y,rtpReceiver:b,kind:l,mid:h,cname:R,sendEncodingParameters:S,recvEncodingParameters:_},t._transceive(t.transceivers[c],!1,"sendrecv"===p||"sendonly"===p)}}else t.transceivers[c]={mid:h,isDatachannel:!0}}),this.remoteDescription={type:e.type,sdp:e.sdp},e.type){case"offer":this._updateSignalingState("have-remote-offer");break;case"answer":this._updateSignalingState("stable");break;default:throw new TypeError('unsupported type "'+e.type+'"')}return n.getTracks().length&&(t.remoteStreams.push(n),window.setTimeout(function(){var e=new Event("addstream");e.stream=n,t.dispatchEvent(e),null!==t.onaddstream&&window.setTimeout(function(){t.onaddstream(e)},0),i.forEach(function(r){var i=r[0],o=r[1],a=new Event("track");a.track=i,a.receiver=o,a.streams=[n],t.dispatchEvent(e),null!==t.ontrack&&window.setTimeout(function(){t.ontrack(a)},0)})},0)),arguments.length>1&&"function"==typeof arguments[1]&&window.setTimeout(arguments[1],0),Promise.resolve()},window.RTCPeerConnection.prototype.close=function(){this.transceivers.forEach(function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()}),this._updateSignalingState("closed")},window.RTCPeerConnection.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this.dispatchEvent(t),null!==this.onsignalingstatechange&&this.onsignalingstatechange(t)},window.RTCPeerConnection.prototype._maybeFireNegotiationNeeded=function(){var e=new Event("negotiationneeded");this.dispatchEvent(e),null!==this.onnegotiationneeded&&this.onnegotiationneeded(e)},window.RTCPeerConnection.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,checking:0,connected:0,completed:0,failed:0};if(this.transceivers.forEach(function(e){t[e.iceTransport.state]++,t[e.dtlsTransport.state]++}),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0||t.checking>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":(t.connected>0||t.completed>0)&&(e="connected"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this.dispatchEvent(n),null!==this.oniceconnectionstatechange&&this.oniceconnectionstatechange(n)}},window.RTCPeerConnection.prototype.createOffer=function(){var e,t=this;if(this._pendingOffer)throw new Error("createOffer called while there is a pending offer.");1===arguments.length&&"function"!=typeof arguments[0]?e=arguments[0]:3===arguments.length&&(e=arguments[2]);var n=[],i=0,o=0;if(this.localStreams.length&&(i=this.localStreams[0].getAudioTracks().length,o=this.localStreams[0].getVideoTracks().length),e){if(e.mandatory||e.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==e.offerToReceiveAudio&&(i=e.offerToReceiveAudio),void 0!==e.offerToReceiveVideo&&(o=e.offerToReceiveVideo)}for(this.localStreams.length&&this.localStreams[0].getTracks().forEach(function(e){n.push({kind:e.kind,track:e,wantReceive:"audio"===e.kind?i>0:o>0}),"audio"===e.kind?i--:"video"===e.kind&&o--});i>0||o>0;)i>0&&(n.push({kind:"audio",wantReceive:!0}),i--),o>0&&(n.push({kind:"video",wantReceive:!0}),o--);var a=r.writeSessionBoilerplate(),s=[];n.forEach(function(e,n){var i,o,a=e.track,c=e.kind,u=r.generateIdentifier(),l=t.usingBundle&&n>0?{iceGatherer:s[0].iceGatherer,iceTransport:s[0].iceTransport,dtlsTransport:s[0].dtlsTransport}:t._createIceAndDtlsTransports(u,n),d=RTCRtpSender.getCapabilities(c),p=[{ssrc:1001*(2*n+1)}];a&&(i=new RTCRtpSender(a,l.dtlsTransport)),e.wantReceive&&(o=new RTCRtpReceiver(l.dtlsTransport,c)),s[n]={iceGatherer:l.iceGatherer,iceTransport:l.iceTransport,dtlsTransport:l.dtlsTransport,localCapabilities:d,remoteCapabilities:null,rtpSender:i,rtpReceiver:o,kind:c,mid:u,sendEncodingParameters:p,recvEncodingParameters:null}}),this.usingBundle&&(a+="a=group:BUNDLE "+s.map(function(e){return e.mid}).join(" ")+"\r\n"),n.forEach(function(e,n){var i=s[n];a+=r.writeMediaSection(i,i.localCapabilities,"offer",t.localStreams[0])}),this._pendingOffer=s;var c=new RTCSessionDescription({type:"offer",sdp:a});return arguments.length&&"function"==typeof arguments[0]&&window.setTimeout(arguments[0],0,c),Promise.resolve(c)},window.RTCPeerConnection.prototype.createAnswer=function(){var e=this,t=r.writeSessionBoilerplate();this.usingBundle&&(t+="a=group:BUNDLE "+this.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),this.transceivers.forEach(function(n){if(n.isDatachannel)t+="m=application 0 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=mid:"+n.mid+"\r\n";else{var i=e._getCommonCapabilities(n.localCapabilities,n.remoteCapabilities);t+=r.writeMediaSection(n,i,"answer",e.localStreams[0])}});var n=new RTCSessionDescription({type:"answer",sdp:t});return arguments.length&&"function"==typeof arguments[0]&&window.setTimeout(arguments[0],0,n),Promise.resolve(n)},window.RTCPeerConnection.prototype.addIceCandidate=function(e){if(null===e)this.transceivers.forEach(function(e){e.iceTransport.addRemoteCandidate({})});else{var t=e.sdpMLineIndex;if(e.sdpMid)for(var n=0;n<this.transceivers.length;n++)if(this.transceivers[n].mid===e.sdpMid){t=n;break}var i=this.transceivers[t];if(i){var o=Object.keys(e.candidate).length>0?r.parseCandidate(e.candidate):{};if("tcp"===o.protocol&&(0===o.port||9===o.port))return;if("1"!==o.component)return;"endOfCandidates"===o.type&&(o={}),i.iceTransport.addRemoteCandidate(o);var a=r.splitSections(this.remoteDescription.sdp);a[t+1]+=(o.type?e.candidate.trim():"a=end-of-candidates")+"\r\n",this.remoteDescription.sdp=a.join("")}}return arguments.length>1&&"function"==typeof arguments[1]&&window.setTimeout(arguments[1],0),Promise.resolve()},window.RTCPeerConnection.prototype.getStats=function(){var e=[];this.transceivers.forEach(function(t){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(n){t[n]&&e.push(t[n].getStats())})});var t=arguments.length>1&&"function"==typeof arguments[1]&&arguments[1];return new Promise(function(n){var r=new Map;Promise.all(e).then(function(e){e.forEach(function(e){Object.keys(e).forEach(function(t){r.set(t,e[t]),r[t]=e[t]})}),t&&window.setTimeout(t,0,r),n(r)})})}}};t.exports={shimPeerConnection:o.shimPeerConnection,shimGetUserMedia:e("./getusermedia")}},{"../utils":10,"./getusermedia":6,sdp:1}],6:[function(e,t,n){"use strict";t.exports=function(){var e=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(t){return e(t).catch(function(e){return Promise.reject({name:{PermissionDeniedError:"NotAllowedError"}[(t=e).name]||t.name,message:t.message,constraint:t.constraint,toString:function(){return this.name}});var t})}}},{}],7:[function(e,t,n){"use strict";var r=e("../utils").browserDetails,i={shimOnTrack:function(){"object"!=typeof window||!window.RTCPeerConnection||"ontrack"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&(this.removeEventListener("track",this._ontrack),this.removeEventListener("addstream",this._ontrackpoly)),this.addEventListener("track",this._ontrack=e),this.addEventListener("addstream",this._ontrackpoly=function(e){e.stream.getTracks().forEach(function(t){var n=new Event("track");n.track=t,n.receiver={track:t},n.streams=[e.stream],this.dispatchEvent(n)}.bind(this))}.bind(this))}})},shimSourceObject:function(){"object"==typeof window&&(!window.HTMLMediaElement||"srcObject"in window.HTMLMediaElement.prototype||Object.defineProperty(window.HTMLMediaElement.prototype,"srcObject",{get:function(){return this.mozSrcObject},set:function(e){this.mozSrcObject=e}}))},shimPeerConnection:function(){if("object"==typeof window&&(window.RTCPeerConnection||window.mozRTCPeerConnection)){window.RTCPeerConnection||(window.RTCPeerConnection=function(e,t){if(r.version<38&&e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];if(o.hasOwnProperty("urls"))for(var a=0;a<o.urls.length;a++){var s={url:o.urls[a]};0===o.urls[a].indexOf("turn")&&(s.username=o.username,s.credential=o.credential),n.push(s)}else n.push(e.iceServers[i])}e.iceServers=n}return new mozRTCPeerConnection(e,t)},window.RTCPeerConnection.prototype=mozRTCPeerConnection.prototype,mozRTCPeerConnection.generateCertificate&&Object.defineProperty(window.RTCPeerConnection,"generateCertificate",{get:function(){return mozRTCPeerConnection.generateCertificate}}),window.RTCSessionDescription=mozRTCSessionDescription,window.RTCIceCandidate=mozRTCIceCandidate),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=RTCPeerConnection.prototype[e];RTCPeerConnection.prototype[e]=function(){return arguments[0]=new("addIceCandidate"===e?RTCIceCandidate:RTCSessionDescription)(arguments[0]),t.apply(this,arguments)}});var e=RTCPeerConnection.prototype.addIceCandidate;RTCPeerConnection.prototype.addIceCandidate=function(){return null===arguments[0]?Promise.resolve():e.apply(this,arguments)};var t=RTCPeerConnection.prototype.getStats;RTCPeerConnection.prototype.getStats=function(e,n,r){return t.apply(this,[e||null]).then(function(e){return t=e,n=new Map,Object.keys(t).forEach(function(e){n.set(e,t[e]),n[e]=t[e]}),n;var t,n}).then(n,r)}}}};t.exports={shimOnTrack:i.shimOnTrack,shimSourceObject:i.shimSourceObject,shimPeerConnection:i.shimPeerConnection,shimGetUserMedia:e("./getusermedia")}},{"../utils":10,"./getusermedia":8}],8:[function(e,t,n){"use strict";var r=e("../utils").log,i=e("../utils").browserDetails;t.exports=function(){var e=function(e){return{name:{SecurityError:"NotAllowedError",PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:{"The operation is insecure.":"The request is not allowed by the user agent or the platform in the current context."}[e.message]||e.message,constraint:e.constraint,toString:function(){return this.name+(this.message&&": ")+this.message}}},t=function(t,n,o){var a=function(e){if("object"!=typeof e||e.require)return e;var t=[];return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r=e[n]="object"==typeof e[n]?e[n]:{ideal:e[n]};if(void 0===r.min&&void 0===r.max&&void 0===r.exact||t.push(n),void 0!==r.exact&&("number"==typeof r.exact?r.min=r.max=r.exact:e[n]=r.exact,delete r.exact),void 0!==r.ideal){e.advanced=e.advanced||[];var i={};"number"==typeof r.ideal?i[n]={min:r.ideal,max:r.ideal}:i[n]=r.ideal,e.advanced.push(i),delete r.ideal,Object.keys(r).length||delete e[n]}}}),t.length&&(e.require=t),e};return t=JSON.parse(JSON.stringify(t)),i.version<38&&(r("spec: "+JSON.stringify(t)),t.audio&&(t.audio=a(t.audio)),t.video&&(t.video=a(t.video)),r("ff37: "+JSON.stringify(t))),navigator.mozGetUserMedia(t,n,function(t){o(e(t))})};if(navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:function(e){return new Promise(function(n,r){t(e,n,r)})},addEventListener:function(){},removeEventListener:function(){}}),navigator.mediaDevices.enumerateDevices=navigator.mediaDevices.enumerateDevices||function(){return new Promise(function(e){e([{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}])})},i.version<41){var n=navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);navigator.mediaDevices.enumerateDevices=function(){return n().then(void 0,function(e){if("NotFoundError"===e.name)return[];throw e})}}if(i.version<49){var o=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(t){return o(t).catch(function(t){return Promise.reject(e(t))})}}navigator.getUserMedia=function(e,n,r){if(i.version<44)return t(e,n,r);a.warn("navigator.getUserMedia has been replaced by navigator.mediaDevices.getUserMedia"),navigator.mediaDevices.getUserMedia(e).then(n,r)}}},{"../utils":10}],9:[function(e,t,n){"use strict";var r={shimGetUserMedia:function(){navigator.getUserMedia=navigator.webkitGetUserMedia}};t.exports={shimGetUserMedia:r.shimGetUserMedia}},{}],10:[function(e,t,n){"use strict";var r=!0,i={disableLog:function(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(r=e,e?"adapter.js logging disabled":"adapter.js logging enabled")},log:function(){if("object"==typeof window){if(r)return;void 0!==a&&"function"==typeof a.log&&a.log.apply(a,arguments)}},extractVersion:function(e,t,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)},detectBrowser:function(){var e={};if(e.browser=null,e.version=null,"undefined"==typeof window||!window.navigator)return e.browser="Not a browser.",e;if(navigator.mozGetUserMedia)e.browser="firefox",e.version=this.extractVersion(navigator.userAgent,/Firefox\/([0-9]+)\./,1);else if(navigator.webkitGetUserMedia)if(window.webkitRTCPeerConnection)e.browser="chrome",e.version=this.extractVersion(navigator.userAgent,/Chrom(e|ium)\/([0-9]+)\./,2);else{if(!navigator.userAgent.match(/Version\/(\d+).(\d+)/))return e.browser="Unsupported webkit-based browser with GUM support but no WebRTC support.",e;e.browser="safari",e.version=this.extractVersion(navigator.userAgent,/AppleWebKit\/([0-9]+)\./,1)}else{if(!navigator.mediaDevices||!navigator.userAgent.match(/Edge\/(\d+).(\d+)$/))return e.browser="Not a supported browser.",e;e.browser="edge",e.version=this.extractVersion(navigator.userAgent,/Edge\/(\d+).(\d+)$/,2)}return e}};t.exports={log:i.log,disableLog:i.disableLog,browserDetails:i.detectBrowser(),extractVersion:i.extractVersion}},{}]},{},[2])(2)},e.exports=o(),s.parseWebrtcDetectedBrowser(),navigator.mozGetUserMedia?(MediaStreamTrack.getSources=function(e){setTimeout(function(){e([{kind:"audio",id:"default",label:"",facing:""},{kind:"video",id:"default",label:"",facing:""}])},0)},attachMediaStream=function(e,t){return e.srcObject=t,e},reattachMediaStream=function(e,t){return e.srcObject=t.srcObject,e},createIceServer=function(e,t,n){a.warn("createIceServer is deprecated. It should be replaced with an application level implementation.");var r=null,i=e.split(":");if(0===i[0].indexOf("stun"))r={urls:[e]};else if(0===i[0].indexOf("turn"))if(webrtcDetectedVersion<27){var o=e.split("?");1!==o.length&&0!==o[1].indexOf("transport=udp")||(r={urls:[o[0]],credential:n,username:t})}else r={urls:[e],credential:n,username:t};return r},createIceServers=function(e,t,n){a.warn("createIceServers is deprecated. It should be replaced with an application level implementation.");var r=[];for(i=0;i<e.length;i++){var o=createIceServer(e[i],t,n);null!==o&&r.push(o)}return r}):navigator.webkitGetUserMedia?(attachMediaStream=function(e,t){return webrtcDetectedVersion>=43?e.srcObject=t:void 0!==e.src?e.src=URL.createObjectURL(t):a.error("Error attaching stream to element."),e},reattachMediaStream=function(e,t){return webrtcDetectedVersion>=43?e.srcObject=t.srcObject:e.src=t.src,e},createIceServer=function(e,t,n){a.warn("createIceServer is deprecated. It should be replaced with an application level implementation.");var r=null,i=e.split(":");return 0===i[0].indexOf("stun")?r={url:e}:0===i[0].indexOf("turn")&&(r={url:e,credential:n,username:t}),r},createIceServers=function(e,t,n){a.warn("createIceServers is deprecated. It should be replaced with an application level implementation.");var r=[];if(webrtcDetectedVersion>=34)r={urls:e,credential:n,username:t};else for(i=0;i<e.length;i++){var o=createIceServer(e[i],t,n);null!==o&&r.push(o)}return r}):navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)&&(attachMediaStream=function(e,t){return e.srcObject=t,e},reattachMediaStream=function(e,t){return e.srcObject=t.srcObject,e}),attachMediaStream_base=attachMediaStream,"opera"===webrtcDetectedBrowser&&(attachMediaStream_base=function(e,t){webrtcDetectedVersion>38?e.srcObject=t:void 0!==e.src&&(e.src=URL.createObjectURL(t))}),attachMediaStream=function(e,t){return"chrome"!==webrtcDetectedBrowser&&"opera"!==webrtcDetectedBrowser||t?attachMediaStream_base(e,t):e.src="",e},reattachMediaStream_base=reattachMediaStream,reattachMediaStream=function(e,t){return reattachMediaStream_base(e,t),e},window.attachMediaStream=attachMediaStream,window.reattachMediaStream=reattachMediaStream,window.getUserMedia=function(e,t,n){navigator.getUserMedia(e,t,n)},s.attachMediaStream=attachMediaStream,s.reattachMediaStream=reattachMediaStream,s.getUserMedia=getUserMedia,"undefined"==typeof Promise&&(requestUserMedia=null),s.maybeThroughWebRTCReady()),function(){"use strict";var e=null;s.TEXT.EXTENSION={REQUIRE_INSTALLATION_FF:"To enable screensharing you need to install the Skylink WebRTC tools Firefox Add-on.",REQUIRE_INSTALLATION_CHROME:"To enable screensharing you need to install the Skylink WebRTC tools Chrome Extension.",REQUIRE_REFRESH:"Please refresh this page after the Skylink WebRTC tools extension has been installed.",BUTTON_FF:"Install Now",BUTTON_CHROME:"Go to Chrome Web Store"};var t=function(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t};if(window.navigator.mozGetUserMedia?(e=window.navigator.getUserMedia,navigator.getUserMedia=function(n,r,i){if(n&&n.video&&n.video.mediaSource){if("screen"!==n.video.mediaSource&&"window"!==n.video.mediaSource)return void i(new Error('GetUserMedia: Only "screen" and "window" are supported as mediaSource constraints'));var o=t(n);o.video.mozMediaSource=o.video.mediaSource;var a=setInterval(function(){"complete"===document.readyState&&(clearInterval(a),e(o,r,function(e){["PermissionDeniedError","SecurityError"].indexOf(e.name)>-1&&"https:"===window.parent.location.protocol?s.renderNotificationBar(s.TEXT.EXTENSION.REQUIRE_INSTALLATION_FF,s.TEXT.EXTENSION.BUTTON_FF,"https://addons.mozilla.org/en-US/firefox/addon/skylink-webrtc-tools/",!0,!0):i(e)}))},1)}else e(n,r,i)},s.getUserMedia=window.getUserMedia=navigator.getUserMedia):window.navigator.webkitGetUserMedia&&"safari"!==window.webrtcDetectedBrowser?(e=window.navigator.getUserMedia,navigator.getUserMedia=function(n,i,o){if(n&&n.video&&n.video.mediaSource){if("chrome"!==window.webrtcDetectedBrowser)return void o(new Error("Current browser does not support screensharing"));var a=t(n),c=function(t,n){t?o("permission-denied"===t?new Error("Permission denied for screen retrieval"):new Error("Failed retrieving selected screen")):(a.video.mandatory=a.video.mandatory||{},a.video.mandatory.chromeMediaSource="desktop",a.video.mandatory.maxWidth=window.screen.width>1920?window.screen.width:1920,a.video.mandatory.maxHeight=window.screen.height>1080?window.screen.height:1080,n&&(a.video.mandatory.chromeMediaSourceId=n),delete a.video.mediaSource,e(a,i,o))},u=function(e){e.data&&(e.data.chromeMediaSourceId&&("PermissionDeniedError"===e.data.chromeMediaSourceId?c("permission-denied"):c(null,e.data.chromeMediaSourceId)),e.data.chromeExtensionStatus&&("not-installed"===e.data.chromeExtensionStatus?s.renderNotificationBar(s.TEXT.EXTENSION.REQUIRE_INSTALLATION_CHROME,s.TEXT.EXTENSION.BUTTON_CHROME,e.data.data,!0,!0):c(e.data.chromeExtensionStatus,null)),window.removeEventListener("message",u))};window.addEventListener("message",u),r({captureSourceId:!0})}else e(n,i,o)},s.getUserMedia=window.getUserMedia=navigator.getUserMedia,navigator.mediaDevices.getUserMedia=function(e){return new Promise(function(t,n){window.getUserMedia(e,t,n)})}):navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?a.warn("Edge does not support screensharing feature in getUserMedia"):(e=window.navigator.getUserMedia,navigator.getUserMedia=function(n,r,i){if(n&&n.video&&n.video.mediaSource){var o=t(n);s.WebRTCPlugin.callWhenPluginReady(function(){s.WebRTCPlugin.plugin.HasScreensharingFeature&&s.WebRTCPlugin.plugin.isScreensharingAvailable?(o.video.optional=o.video.optional||[],o.video.optional.push({sourceId:s.WebRTCPlugin.plugin.screensharingKey||"Screensharing"}),delete o.video.mediaSource,e(o,r,i)):i(new Error("Your version of the WebRTC plugin does not support screensharing"))})}else e(n,r,i)},s.getUserMedia=getUserMedia=window.getUserMedia=navigator.getUserMedia,navigator.mediaDevices&&"undefined"!=typeof Promise&&(navigator.mediaDevices.getUserMedia="undefined"==typeof requestUserMedia?void 0:requestUserMedia)),"chrome"===window.webrtcDetectedBrowser){var n=document.createElement("iframe");n.onload=function(){n.isLoaded=!0},n.src="https://cdn.temasys.com.sg/skylink/extensions/detectRTC.html",n.style.display="none",(document.body||document.documentElement).appendChild(n);var r=function(e){e=e||{},n.isLoaded?n.contentWindow.postMessage(e,"*"):setTimeout(function(){n.contentWindow.postMessage(e,"*")},100)}}else"opera"===window.webrtcDetectedBrowser&&a.warn("Opera does not support screensharing feature in getUserMedia")}()}).call(t,"modules/RTC/adapter.screenshare.js")},function(e,t){function n(){var e=arguments[0],t=arguments[1],n=Array.prototype.slice.call(arguments,2);if(!(i[t]<e.level))for(var r=function(){var e={methodName:"",fileLocation:"",line:null,column:null},t=new Error,n=t.stack?t.stack.split("\n"):[];if(!n||n.length<1)return e;var r=null;return n[3]&&(r=n[3].match(/\s*at\s*(.+?)\s*\((\S*)\s*:(\d*)\s*:(\d*)\)/)),!r||r.length<=4?(0===n[2].indexOf("log@")?e.methodName=n[3].substr(0,n[3].indexOf("@")):e.methodName=n[2].substr(0,n[2].indexOf("@")),e):(e.methodName=r[1],e.fileLocation=r[2],e.line=r[3],e.column=r[4],e)}(),a=o.concat(e.transports),s=0;s<a.length;s++){var c=a[s],u=c[t];u&&"function"==typeof u&&u.bind(c,e.id?"["+e.id+"]":"","<"+r.methodName+">: ").apply(c,n)}}function r(e,t,r,o){this.id=t,this.format=o,this.transports=r,this.transports||(this.transports=[]),this.level=i[e];for(var a=Object.keys(i),s=0;s<a.length;s++)this[a[s]]=n.bind(null,this,a[s])}var i={trace:0,debug:1,info:2,log:3,warn:4,error:5};r.consoleTransport=console;var o=[r.consoleTransport];r.addGlobalTransport=function(e){-1===o.indexOf(e)&&o.push(e)},r.removeGlobalTransport=function(e){var t=o.indexOf(e);-1!==t&&o.splice(t,1)},r.prototype.setLevel=function(e){this.level=i[e]},e.exports=r,r.levels={TRACE:"trace",DEBUG:"debug",INFO:"info",LOG:"log",WARN:"warn",ERROR:"error"}},function(e,t,n){"use strict";function r(){var e=navigator.userAgent;if(e.match(/Electron/)){var t=e.match(/Electron\/([\d.]+)/)[1];return{name:v,version:t}}}function i(){var e=navigator.userAgent;if(e.match(/JitsiMeetNW/)){var t=e.match(/JitsiMeetNW\/([\d.]+)/)[1];return{name:m,version:t}}}function o(){var e=navigator.userAgent.match(/\b(react[ \t_-]*native)(?:\/(\S+))?/i),t=void 0;if(e||"ReactNative"===navigator.product){var n=void 0;return e&&e.length>2&&(n=e[1],t=e[2]),n||(n="react-native"),t||(t="unknown"),{name:g,version:t}}}var a={};n.d(a,"CHROME",function(){return u}),n.d(a,"OPERA",function(){return l}),n.d(a,"FIREFOX",function(){return d}),n.d(a,"INTERNET_EXPLORER",function(){return p}),n.d(a,"EDGE",function(){return h}),n.d(a,"SAFARI",function(){return f}),n.d(a,"NWJS",function(){return m}),n.d(a,"ELECTRON",function(){return v}),n.d(a,"REACT_NATIVE",function(){return g}),n.d(a,"UNKNOWN",function(){return y});var s=n(69),c=n.n(s),u="chrome",l="opera",d="firefox",p="iexplorer",h="edge",f="safari",m="nwjs",v="electron",g="react-native",y="unknown",b=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),S={Chrome:u,Chromium:u,Opera:l,Firefox:d,"Internet Explorer":p,"Microsoft Edge":h,Safari:f},_=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=void 0,a=void 0;if(void 0===t){var s=function(){for(var e=void 0,t=[o,r,i],n=0;n<t.length;n++)if(e=t[n]())return e;var a=c.a.name,s=c.a.version;return a in S?{name:S[a],version:s}:{name:y,version:void 0}}();n=s.name,a=s.version}else t.name in S?(n=S[t.name],a=t.version):(n=y,a=void 0);this._name=n,this._version=a}return b(e,[{key:"getName",value:function(){return this._name}},{key:"isChrome",value:function(){return this._name===u}},{key:"isOpera",value:function(){return this._name===l}},{key:"isFirefox",value:function(){return this._name===d}},{key:"isIExplorer",value:function(){return this._name===p}},{key:"isEdge",value:function(){return this._name===h}},{key:"isSafari",value:function(){return this._name===f}},{key:"isNWJS",value:function(){return this._name===m}},{key:"isElectron",value:function(){return this._name===v}},{key:"isReactNative",value:function(){return this._name===g}},{key:"getVersion",value:function(){return this._version}},{key:"compareVersion",value:function(e){if(this._version)return c.a.compareVersions([e,this._version])}},{key:"isVersionGreaterThan",value:function(e){return-1===this.compareVersion(e)}},{key:"isVersionLessThan",value:function(e){return 1===this.compareVersion(e)}},{key:"isVersionEqualTo",value:function(e){return 0===this.compareVersion(e)}}]),e}();_.compareVersions=c.a.compareVersions;var T=_,C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),R=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments[2];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var i=new T(r),o=void 0;if("object"===(void 0===t?"undefined":E(t))&&"string"==typeof i.getVersion())for(var a=t[i.getName()]||[],s=0;s<a.length;s++){var c=a[s];if("object"===(void 0===c?"undefined":E(c))){var u=c.version;if(!u||!i.isVersionGreaterThan(u)){o=c;break}}}o&&o.capabilities?this._capabilities=n?C({},o.capabilities,o.iframeCapabilities):o.capabilities:this._capabilities={isSupported:!1},void 0===this._capabilities.isSupported?this._capabilities.isSupported=!0:!1===this._capabilities.isSupported&&(this._capabilities={isSupported:!1})}return w(e,[{key:"isSupported",value:function(){return this._capabilities.isSupported}},{key:"supportsAudioIn",value:function(){return this._capabilities.audioIn||!1}},{key:"supportsAudioOut",value:function(){return this._capabilities.audioOut||!1}},{key:"supportsScreenSharing",value:function(){return this._capabilities.screenSharing||!1}},{key:"supportsVideoIn",value:function(){return this._capabilities.videoIn||!1}},{key:"supportsVideoOut",value:function(){return this._capabilities.videoOut||!1}}]),e}();n.d(t,!1,function(){return R}),n.d(t,"a",function(){return T}),n.d(t,"b",function(){return a})},function(e,t,n){function r(e,t){this._id=e,this._clearFn=t}var i=Function.prototype.apply;t.setTimeout=function(){return new r(i.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new r(i.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(89),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(25),o=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.connection=t,this.active=!1,this.results={}}return r(e,[{key:"getResults",value:function(){return this.results}},{key:"start",value:function(){var e=this,t=new i(function(t,n){e.resolveCb=t,e.rejectCb=n});return this.connection.setMessageCallback(this.handleMessage.bind(this)),this.connection.setErrorCallback(this.handleError.bind(this)),this.active=!0,this.forceStopped=!1,this.initiate(),t}},{key:"stop",value:function(){this.active=!1}},{key:"forceStop",value:function(){this.forceStopped=!0,this.stop(),this.finished()}},{key:"isActive",value:function(){return this.active}},{key:"initiate",value:function(){}},{key:"handleMessage",value:function(e){}},{key:"handleError",value:function(e){}},{key:"send",value:function(e){this.connection.send(e)}},{key:"finished",value:function(){this.active=!1,this.resolveCb&&(this.resolveCb(),this.resolveCb=null)}},{key:"failed",value:function(e){this.active=!1,this.rejectCb&&(this.rejectCb(e),this.rejectCb=null)}}]),e}();t.TurnTest=o},function(e,t,n){"use strict";function r(e){for(var t="",n=0;n<e;n++)t+=String.fromCharCode(35+58*Math.random());return t}Object.defineProperty(t,"__esModule",{value:!0}),t.randomAsciiString=t.MessageMaker=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(21)),a=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1200;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.message={timestamp:"",sentBytes:1e4,padding:""};var n=r(t-o.getCurrent().toString().length-JSON.stringify(this.message).length);this.message.padding=n}return i(e,[{key:"make",value:function(e){return this.message.timestamp=o.getCurrent(),this.message.sentBytes=e,JSON.stringify(this.message)}}]),e}();t.MessageMaker=a,t.randomAsciiString=r},function(e,t,n){"use strict";function r(e,t,n){this.stream=e,this.intervalId=null,this.intervalMilis=t,this.audioLevel=0,this.callback=n}t.a=r;var i=n(1);window.AudioContext=window.AudioContext||window.webkitAudioContext;var o=null;window.AudioContext&&(o=new AudioContext).suspend&&o.suspend(),r.prototype.start=function(){if(r.isLocalStatsSupported()){o.resume();var e=o.createAnalyser();e.smoothingTimeConstant=.8,e.fftSize=2048,o.createMediaStreamSource(this.stream).connect(e);var t=this;this.intervalId=setInterval(function(){var n=new Uint8Array(e.frequencyBinCount);e.getByteTimeDomainData(n);var r,i,o,a,s=function(e){for(var t=0,n=e.length,r=0;r<n;r++)t<e[r]&&(t=e[r]);return parseFloat(((t-127)/128).toFixed(3))}(n);s!==t.audioLevel&&(t.audioLevel=(r=s,i=t.audioLevel,o=0,o=(a=i-r)>.2?i-.2:a<-.4?i+.4:r,parseFloat(o.toFixed(3))),t.callback(t.audioLevel))},this.intervalMilis)}},r.prototype.stop=function(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)},r.isLocalStatsSupported=function(){return Boolean(o&&!i.a.isTemasysPluginUsed())}},function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return i}),n.d(t,"c",function(){return o}),n.d(t,"d",function(){return a});var r="statistics.audioLevel",i="statistics.before_disposed",o="statistics.byte_sent_stats",a="statistics.connectionstats"},function(e,t,n){var r=n(95),i={loadScript:function(e,t,n,i,o,a){var s=document,c=s.createElement("script"),u=s.getElementsByTagName("script")[0];if(c.async=t,i){var l=r();if(l){var d=l.src,p=d.substring(0,d.lastIndexOf("/")+1);d&&p&&(e=p+e)}}o&&(c.onload=o),a&&(c.onerror=a),c.src=e,n?u.parentNode.insertBefore(c,u):u.parentNode.appendChild(c)}};e.exports=i},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(2)),o=(n.n(i),n(100)),a=(n.n(o),n(19)),s=n.n(a),c=n(47),u=n(26),l=n(1),d=n(101),p=n(104),h=n(112),f=n(113),m=n(114),v=n(115),g=n(10),y=n(116),b=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),S=Object(r.getLogger)(e),_=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.connection=null,r.disconnectInProgress=!1,r.connectionTimes={},r.options=e,r.token=n,r.authenticatedUser=!1,r._initStrophePlugins(r),r.connection=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/http-bind";e&&(t+=(-1===t.indexOf("?")?"?":"&")+"token="+e);var n=new i.Strophe.Connection(t);return n.maxRetries=3,n}(n,e.bosh),r.caps=new y.a(r.connection,r.options.clientNode),r.initFeaturesList(),$(window).on("beforeunload unload",r.disconnect.bind(r)),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,g.a),b(t,[{key:"initFeaturesList",value:function(){this.caps.addFeature("urn:xmpp:jingle:1"),this.caps.addFeature("urn:xmpp:jingle:apps:rtp:1"),this.caps.addFeature("urn:xmpp:jingle:transports:ice-udp:1"),this.caps.addFeature("urn:xmpp:jingle:apps:dtls:0"),this.caps.addFeature("urn:xmpp:jingle:transports:dtls-sctp:1"),this.caps.addFeature("urn:xmpp:jingle:apps:rtp:audio"),this.caps.addFeature("urn:xmpp:jingle:apps:rtp:video"),!this.options.disableRtx&&l.a.supportsRtx()&&this.caps.addFeature("urn:ietf:rfc:4588"),this.caps.addFeature("urn:ietf:rfc:5761"),this.caps.addFeature("urn:ietf:rfc:5888"),l.a.isChrome()&&!1!==this.options.enableLipSync&&(S.info("Lip-sync enabled !"),this.caps.addFeature("http://jitsi.org/meet/lipsync")),this.connection.rayo&&this.caps.addFeature("urn:xmpp:rayo:client:1")}},{key:"getConnection",value:function(){return this.connection}},{key:"connectionHandler",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this,n=arguments[1],r=arguments[2],o=window.performance.now(),a=i.Strophe.getStatusString(n).toLowerCase();if(this.connectionTimes[a]=o,S.log("(TIME) Strophe "+a+(r?"["+r+"]":"")+":\t",o),n===i.Strophe.Status.CONNECTED||n===i.Strophe.Status.ATTACHED){(this.options.useStunTurn||this.options.p2p&&this.options.p2p.useStunTurn)&&this.connection.jingle.getStunAndTurnCredentials(),S.info("My Jabber ID: "+this.connection.jid);var s=this.connection.domain;this.connection.ping.hasPingSupport(s,function(e){e?t.connection.ping.startInterval(s):S.warn("Ping NOT supported by "+s)}),e.password&&(this.authenticatedUser=!0),this.connection&&this.connection.connected&&i.Strophe.getResourceFromJid(this.connection.jid)&&this.eventEmitter.emit(u.CONNECTION_ESTABLISHED,i.Strophe.getResourceFromJid(this.connection.jid))}else if(n===i.Strophe.Status.CONNFAIL)"x-strophe-bad-non-anon-jid"===r?this.anonymousConnectionFailed=!0:this.connectionFailed=!0,this.lastErrorMsg=r,"giving-up"===r&&this.eventEmitter.emit(u.CONNECTION_FAILED,c.OTHER_ERROR,r);else if(n===i.Strophe.Status.DISCONNECTED){this.connection.ping.stopInterval();var l=this.disconnectInProgress,d=r||this.lastErrorMsg;if(this.disconnectInProgress=!1,this.anonymousConnectionFailed)this.eventEmitter.emit(u.CONNECTION_FAILED,c.PASSWORD_REQUIRED);else if(this.connectionFailed)this.eventEmitter.emit(u.CONNECTION_FAILED,c.OTHER_ERROR,d,void 0,this._getConnectionFailedReasonDetails());else if(l)this.eventEmitter.emit(u.CONNECTION_DISCONNECTED,d);else{S.error("XMPP connection dropped!");var p=i.Strophe.getLastErrorStatus();p>=500&&p<600?this.eventEmitter.emit(u.CONNECTION_FAILED,c.SERVER_ERROR,d||"server-error"):this.eventEmitter.emit(u.CONNECTION_FAILED,c.CONNECTION_DROPPED_ERROR,d||"connection-dropped-error")}}else n===i.Strophe.Status.AUTHFAIL&&this.eventEmitter.emit(u.CONNECTION_FAILED,c.PASSWORD_REQUIRED,r,e)}},{key:"_connect",value:function(e,t){this.anonymousConnectionFailed=!1,this.connectionFailed=!1,this.lastErrorMsg=void 0,this.connection.connect(e,t,this.connectionHandler.bind(this,{jid:e,password:t}))}},{key:"attach",value:function(e){var t=this.connectionTimes.attaching=window.performance.now();S.log("(TIME) Strophe Attaching\t:"+t),this.connection.attach(e.jid,e.sid,parseInt(e.rid,10)+1,this.connectionHandler.bind(this,{jid:e.jid,password:e.password}))}},{key:"connect",value:function(e,t){if(!e){var n=this.options.hosts,r=n.anonymousdomain,i=n.domain,o=r||i,a=window.location;if(r){var s=a&&a.search;(s&&-1!==s.indexOf("login=true")||this.token)&&(o=i)}e=o||a&&a.hostname}return this._connect(e,t)}},{key:"createRoom",value:function(e,t){var n=i.Strophe.getNodeFromJid(this.connection.jid),r=e+"@"+this.options.hosts.muc+"/",o=t.useNicks&&t.nick?t.nick:null;return o?n=t.nick:this.authenticatedUser||(n=n.substr(0,8)),(this.authenticatedUser||null!==o)&&(n+="-"+s.a.randomHexString(6)),r+=n,this.connection.emuc.createRoom(r,null,t)}},{key:"getJingleLog",value:function(){var e=this.connection.jingle;return e?e.getLog():{}}},{key:"getXmppLog",value:function(){return(this.connection.logger||{}).log||null}},{key:"dial",value:function(){var e;(e=this.connection.rayo).dial.apply(e,arguments)}},{key:"setMute",value:function(e,t){this.connection.moderate.setMute(e,t)}},{key:"eject",value:function(e){this.connection.moderate.eject(e)}},{key:"getSessions",value:function(){return this.connection.jingle.sessions}},{key:"disconnect",value:function(e){if(!this.disconnectInProgress&&this.connection&&this.connection.connected){if(this.disconnectInProgress=!0,this.connection.flush(),null!==e&&void 0!==e){var t=e.type;"beforeunload"!==t&&"unload"!==t||(this.connection.options.sync=!0)}this.connection.disconnect(),!0!==this.connection.options.sync&&this.connection.flush()}else this.eventEmitter.emit(u.WRONG_STATE)}},{key:"_initStrophePlugins",value:function(){var e={jvb:{iceServers:[]},p2p:{iceServers:[]}},t=this.options.p2p&&this.options.p2p.stunServers||[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"},{urls:"stun:stun2.l.google.com:19302"}];Array.isArray(t)&&(S.info("P2P STUN servers: ",t),e.p2p.iceServers=t),this.options.p2p&&this.options.p2p.iceTransportPolicy&&(S.info("P2P ICE transport policy: ",this.options.p2p.iceTransportPolicy),e.p2p.iceTransportPolicy=this.options.p2p.iceTransportPolicy),Object(d.a)(this),Object(p.a)(this,this.eventEmitter,e),Object(h.a)(),Object(f.a)(this),Object(m.a)(),Object(v.a)()}},{key:"_getConnectionFailedReasonDetails",value:function(){var e={};if(this.options.deploymentInfo&&this.options.deploymentInfo.shard&&this.connection._proto&&this.connection._proto.lastResponseHeaders){var t={};this.connection._proto.lastResponseHeaders.trim().split(/[\r\n]+/).forEach(function(e){var n=e.split(": "),r=n.shift(),i=n.join(": ");t[r]=i}),e.shard_changed=this.options.deploymentInfo.shard!==t["x-jitsi-shard"]}return e.suspend_time=this.connection.ping.getPingSuspendTime(),e}}]),t}();t.a=_}).call(t,"modules/xmpp/xmpp.js")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"CONNECTION_DROPPED_ERROR",function(){return r}),n.d(t,"OTHER_ERROR",function(){return i}),n.d(t,"PASSWORD_REQUIRED",function(){return o}),n.d(t,"SERVER_ERROR",function(){return a});var r="connection.droppedError",i="connection.otherError",o="connection.passwordRequired",a="connection.serverError"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"ON",function(){return r}),n.d(t,"OFF",function(){return i});var r="on",i="off"},function(e,t){e.exports={IDENTITY_UPDATED:"authentication.identity_updated"}},function(e,t,n){"use strict";(function(e){function r(e){if("function"==typeof e.querySelector){var t=e.querySelector("error"),n=t&&t.querySelector("text");return t&&{code:t.attributes.code&&t.attributes.code.value,type:t.attributes.type&&t.attributes.type.value,message:n&&n.textContent}}var r=null,i=!0,o=!1,a=void 0;try{for(var s,c=e.children[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;if("error"===u.tagName){r=u;break}}}catch(e){o=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw a}}if(!r)return null;var l=null,d=!0,p=!1,h=void 0;try{for(var f,m=r.children[Symbol.iterator]();!(d=(f=m.next()).done);d=!0){var v=f.value;if("text"===v.tagName){l=v.value;break}}}catch(e){p=!0,h=e}finally{try{!d&&m.return&&m.return()}finally{if(p)throw h}}return{code:r.attributes.code,type:r.attributes.type,message:l}}function i(e,t,n,r,o,a){this.eventEmitter=t,this.connection=n,this.state=null,this.focusMucJid=r,this.jirecon=o,this.url=null,this.type=e,this._isSupported=!(e===i.types.JIRECON&&!this.jirecon||e!==i.types.JIBRI&&e!==i.types.JIBRI_FILE&&e!==i.types.COLIBRI),this.jireconRid=null,this.roomjid=a}t.a=i;var o=n(0),a=(n.n(o),n(2)),s=(n.n(a),n(8)),c=n(51),u=n(3),l=Object(o.getLogger)(e);i.types={COLIBRI:"colibri",JIRECON:"jirecon",JIBRI:"jibri",JIBRI_FILE:"jibri_file"},i.status={ON:"on",OFF:"off",AVAILABLE:"available",UNAVAILABLE:"unavailable",PENDING:"pending",RETRYING:"retrying",ERROR:"error",BUSY:"busy",FAILED:"failed"},i.action={START:"start",STOP:"stop"},i.prototype.handleJibriPresence=function(e){var t=e.attributes;if(t){var n=t.status,o=r(e);l.log("Handle Jibri presence : "+n,o),n!==this.state&&("undefined"===n?this.state=i.status.UNAVAILABLE:n===i.status.OFF?this.state&&"undefined"!==this.state&&this.state!==i.status.UNAVAILABLE?this.state=i.status.OFF:this.state=i.status.AVAILABLE:this.state=n,this.eventEmitter.emit(s.RECORDER_STATE_CHANGED,this.state))}},i.prototype.setRecordingJibri=function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};e===this.state&&n(c.INVALID_STATE);var s=Object(a.$iq)({to:this.focusMucJid,type:"set"}).c("jibri",{xmlns:"http://jitsi.org/protocol/jibri",action:e===i.status.ON?i.action.START:i.action.STOP,recording_mode:this.type===i.types.JIBRI_FILE?"file":"stream",streamid:this.type===i.types.JIBRI?o.streamId:void 0}).up();l.log("Set jibri recording: "+e,s.nodeTree),l.log(s.nodeTree),this.connection.sendIQ(s,function(e){l.log("Result",e);var n=$(e).find("jibri");t(n.attr("state"),n.attr("url"))},function(e){l.log("Failed to start recording, error: ",r(e)),n(e)})},i.prototype.setRecordingJirecon=function(e,t,n){e===this.state&&n(new Error("Invalid state!"));var r=Object(a.$iq)({to:this.jirecon,type:"set"}).c("recording",{xmlns:"http://jitsi.org/protocol/jirecon",action:e===i.status.ON?i.action.START:i.action.STOP,mucjid:this.roomjid});e===i.status.OFF&&r.attrs({rid:this.jireconRid}),l.log("Start recording");var o=this;this.connection.sendIQ(r,function(n){o.jireconRid=$(n).find("recording").attr("rid");var r=e===i.status.ON?"started":"stopped";l.log("Recording "+r+"(jirecon)"+n),o.state=e,e===i.status.OFF&&(o.jireconRid=null),t(e)},function(e){l.log("Failed to start recording, error: ",e),n(e)})},i.prototype.setRecordingColibri=function(e,t,n,r){var i=Object(a.$iq)({to:this.focusMucJid,type:"set"});i.c("conference",{xmlns:"http://jitsi.org/protocol/colibri"}),i.c("recording",{state:e,token:r.token});var o=this;this.connection.sendIQ(i,function(n){l.log('Set recording "',e,'". Result:',n);var r=$(n).find(">conference>recording").attr("state");o.state=r,t(r),"pending"===r&&o.connection.addHandler(function(e){var n=$(e).find("recording").attr("state");n&&(o.state=r,t(n))},"http://jitsi.org/protocol/colibri","iq",null,null,null)},function(e){l.warn(e),n(e)})},i.prototype.setRecording=function(){switch(this.type){case i.types.JIRECON:this.setRecordingJirecon.apply(this,arguments);break;case i.types.COLIBRI:this.setRecordingColibri.apply(this,arguments);break;case i.types.JIBRI:case i.types.JIBRI_FILE:this.setRecordingJibri.apply(this,arguments);break;default:var e="Unknown recording type!";u.callErrorHandler(new Error(e)),l.error(e)}},i.prototype.toggleRecording=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n=this.state;if(n===i.status.UNAVAILABLE||n===i.status.FAILED?t(i.status.FAILED,c.RECORDER_UNAVAILABLE):n===i.status.BUSY&&t(i.status.BUSY,c.RECORDER_BUSY),(n===i.status.OFF||n===i.status.AVAILABLE)&&(!e.token&&this.type===i.types.COLIBRI||!e.streamId&&this.type===i.types.JIBRI))return t(i.status.FAILED,c.NO_TOKEN),void l.error("No token passed!");var r=n===i.status.AVAILABLE||n===i.status.OFF?i.status.ON:i.status.OFF,o=this;l.log("Toggle recording (old state, new state): ",n,r),this.setRecording(r,function(e,r){e&&e!==n&&(o.state=e,o.url=r,t(e))},function(e){return t(i.status.FAILED,e)},e)},i.prototype.isSupported=function(){return this._isSupported},i.prototype.getState=function(){return this.state},i.prototype.getURL=function(){return this.url}}).call(t,"modules/xmpp/recording.js")},function(e,t){e.exports={RECORDER_UNAVAILABLE:"recorder.unavailable",RECORDER_BUSY:"recorder.busy",NO_TOKEN:"recorder.noToken",STATE_CHANGE_FAILED:"recorder.stateChangeFailed",INVALID_STATE:"recorder.invalidState"}},function(e,t,n){"use strict";n.d(t,"c",function(){return r}),n.d(t,"a",function(){return i}),n.d(t,"b",function(){return o});var r="pending",i="active",o="ended"},function(e,t,n){"use strict";function r(e){for(var t=e.split("\r\nm="),n=1,r=t.length;n<r;n++){var i="m="+t[n];n!==r-1&&(i+="\r\n"),t[n]=i}var o=t.shift()+"\r\n";this.media=t,this.raw=o+t.join(""),this.session=o}t.a=r;var i=n(14),o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();r.prototype.failICE=!1,r.prototype.removeTcpCandidates=!1,r.prototype.removeUdpCandidates=!1,r.prototype.getMediaSsrcMap=function(){for(var e=this,t={},n=void 0,r=0;r<e.media.length;r++)!function(r){n=i.a.findLines(e.media[r],"a=ssrc:");var o={mediaindex:r,mid:i.a.parseMID(i.a.findLine(e.media[r],"a=mid:")),ssrcs:{},ssrcGroups:[]};t[r]=o,n.forEach(function(e){var t=e.substring(7).split(" ")[0];o.ssrcs[t]||(o.ssrcs[t]={ssrc:t,lines:[]}),o.ssrcs[t].lines.push(e)}),(n=i.a.findLines(e.media[r],"a=ssrc-group:")).forEach(function(e){var t=e.indexOf(" "),n=e.substr(0,t).substr(13),r=e.substr(14+n.length).split(" ");r.length&&o.ssrcGroups.push({semantics:n,ssrcs:r})})}(r);return t},r.prototype.containsSSRC=function(e){var t=this.getMediaSsrcMap(),n=!1;return Object.keys(t).forEach(function(r){n||t[r].ssrcs[e]&&(n=!0)}),n},r.prototype.mangle=function(){var e=void 0,t=void 0,n=void 0,r=void 0,o=void 0,a=void 0;for(e=0;e<this.media.length;e++)if((n=this.media[e].split("\r\n")).pop(),"audio"===(r=i.a.parseMLine(n.shift())).media){for(o="",r.fmt.length=0,t=0;t<n.length;t++){if("a=rtpmap:"===n[t].substr(0,9)){if("CN"===(a=i.a.parseRTPMap(n[t])).name||"ISAC"===a.name)continue;r.fmt.push(a.id)}o+=n[t]+"\r\n"}this.media[e]=i.a.buildMLine(r)+"\r\n"+o}this.raw=this.session+this.media.join("")},r.prototype.removeSessionLines=function(e){var t=this,n=i.a.findLines(this.session,e);return n.forEach(function(e){t.session=t.session.replace(e+"\r\n","")}),this.raw=this.session+this.media.join(""),n},r.prototype.removeMediaLines=function(e,t){var n=this,r=i.a.findLines(this.media[e],t);return r.forEach(function(t){n.media[e]=n.media[e].replace(t+"\r\n","")}),this.raw=this.session+this.media.join(""),r},r.prototype.toJingle=function(e,t){var n=void 0,r=void 0,a=void 0,s=void 0,c=void 0,u=void 0,l=void 0,d=void 0;if((s=i.a.findLines(this.session,"a=group:")).length)for(n=0;n<s.length;n++){var p=(d=s[n].split(" ")).shift().substr(8);for(e.c("group",{xmlns:"urn:xmpp:jingle:apps:grouping:0",semantics:p}),r=0;r<d.length;r++)e.c("content",{name:d[r]}).up();e.up()}for(n=0;n<this.media.length;n++)if("audio"===(c=i.a.parseMLine(this.media[n].split("\r\n")[0])).media||"video"===c.media||"application"===c.media){var h=i.a.findLine(this.media[n],"a=ssrc:");l=!!h&&h.substring(7).split(" ")[0],e.c("content",{creator:t,name:c.media});var f=i.a.findLine(this.media[n],"a=mid:");if(f){var m=i.a.parseMID(f);e.attrs({name:m})}if(i.a.findLine(this.media[n],"a=rtpmap:").length){for(e.c("description",{xmlns:"urn:xmpp:jingle:apps:rtp:1",media:c.media}),l&&e.attrs({ssrc:l}),r=0;r<c.fmt.length;r++){u=i.a.findLine(this.media[n],"a=rtpmap:"+c.fmt[r]),e.c("payload-type",i.a.parseRTPMap(u));var v=i.a.findLine(this.media[n],"a=fmtp:"+c.fmt[r]);if(v)for(d=i.a.parseFmtp(v),a=0;a<d.length;a++)e.c("parameter",d[a]).up();this.rtcpFbToJingle(n,e,c.fmt[r]),e.up()}var g=i.a.findLines(this.media[n],"a=crypto:",this.session);if(g.length&&(e.c("encryption",{required:1}),g.forEach(function(t){return e.c("crypto",i.a.parseCrypto(t)).up()}),e.up()),l){var y=i.a.parseSSRC(this.media[n]),b=!0,S=!1,_=void 0;try{for(var T,C=y[Symbol.iterator]();!(b=(T=C.next()).done);b=!0){var E=T.value,w=o(E,2),R=w[0],k=w[1];e.c("source",{ssrc:R,xmlns:"urn:xmpp:jingle:apps:rtp:ssma:0"}),k.forEach(function(t){var n=t.indexOf(" "),r=t.substr(n+1);if(e.c("parameter"),-1===r.indexOf(":"))e.attrs({name:r});else{var o=r.split(":",2)[0];e.attrs({name:o});var a=r.split(":",2)[1];a=i.a.filterSpecialChars(a),e.attrs({value:a})}e.up()}),e.up()}}catch(e){S=!0,_=e}finally{try{!b&&C.return&&C.return()}finally{if(S)throw _}}i.a.findLines(this.media[n],"a=ssrc-group:").forEach(function(t){var n=t.indexOf(" "),r=t.substr(0,n).substr(13),i=t.substr(14+r.length).split(" ");i.length&&(e.c("ssrc-group",{semantics:r,xmlns:"urn:xmpp:jingle:apps:rtp:ssma:0"}),i.forEach(function(t){return e.c("source",{ssrc:t}).up()}),e.up())})}var I=i.a.findLines(this.media[n],"a=rid");if(I.length){var P=I.map(function(e){return e.split(":")[1]}).map(function(e){return e.split(" ")[0]});P.forEach(function(t){e.c("source",{rid:t,xmlns:"urn:xmpp:jingle:apps:rtp:ssma:0"}),e.up()}),i.a.findLine(this.media[n],"a=simulcast")&&(e.c("rid-group",{semantics:"SIM",xmlns:"urn:xmpp:jingle:apps:rtp:ssma:0"}),P.forEach(function(t){e.c("source",{rid:t}).up()}),e.up())}if(i.a.findLine(this.media[n],"a=rtcp-mux")&&e.c("rtcp-mux").up(),this.rtcpFbToJingle(n,e,"*"),(s=i.a.findLines(this.media[n],"a=extmap:")).length)for(r=0;r<s.length;r++){if(d=i.a.parseExtmap(s[r]),e.c("rtp-hdrext",{xmlns:"urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",uri:d.uri,id:d.value}),d.hasOwnProperty("direction"))switch(d.direction){case"sendonly":e.attrs({senders:"responder"});break;case"recvonly":e.attrs({senders:"initiator"});break;case"sendrecv":e.attrs({senders:"both"});break;case"inactive":e.attrs({senders:"none"})}e.up()}e.up()}this.transportToJingle(n,e);var A=this.media[n];i.a.findLine(A,"a=sendrecv",this.session)?e.attrs({senders:"both"}):i.a.findLine(A,"a=sendonly",this.session)?e.attrs({senders:"initiator"}):i.a.findLine(A,"a=recvonly",this.session)?e.attrs({senders:"responder"}):i.a.findLine(A,"a=inactive",this.session)&&e.attrs({senders:"none"}),"0"===c.port&&e.attrs({senders:"rejected"}),e.up()}return e.up(),e},r.prototype.transportToJingle=function(e,t){var n=void 0,r=this;t.c("transport");var o=i.a.findLine(this.media[e],"a=sctpmap:",r.session);if(o){var a=i.a.parseSCTPMap(o);t.c("sctpmap",{xmlns:"urn:xmpp:jingle:transports:dtls-sctp:1",number:a[0],protocol:a[1]}),a.length>2&&t.attrs({streams:a[2]}),t.up()}if(i.a.findLines(this.media[e],"a=fingerprint:",this.session).forEach(function(o){(n=i.a.parseFingerprint(o)).xmlns="urn:xmpp:jingle:apps:dtls:0",t.c("fingerprint").t(n.fingerprint),delete n.fingerprint,(o=i.a.findLine(r.media[e],"a=setup:",r.session))&&(n.setup=o.substr(8)),t.attrs(n),t.up()}),n=i.a.iceparams(this.media[e],this.session)){n.xmlns="urn:xmpp:jingle:transports:ice-udp:1",t.attrs(n);var s=i.a.findLines(this.media[e],"a=candidate:",this.session);s.length&&s.forEach(function(e){var n=i.a.candidateToJingle(e);r.failICE&&(n.ip="1.1.1.1");var o=n&&"string"==typeof n.protocol?n.protocol.toLowerCase():"";r.removeTcpCandidates&&("tcp"===o||"ssltcp"===o)||r.removeUdpCandidates&&"udp"===o||t.c("candidate",n).up()})}t.up()},r.prototype.rtcpFbToJingle=function(e,t,n){i.a.findLines(this.media[e],"a=rtcp-fb:"+n).forEach(function(e){var n=i.a.parseRTCPFB(e);"trr-int"===n.type?(t.c("rtcp-fb-trr-int",{xmlns:"urn:xmpp:jingle:apps:rtp:rtcp-fb:0",value:n.params[0]}),t.up()):(t.c("rtcp-fb",{xmlns:"urn:xmpp:jingle:apps:rtp:rtcp-fb:0",type:n.type}),n.params.length>0&&t.attrs({subtype:n.params[0]}),t.up())})},r.prototype.rtcpFbFromJingle=function(e,t){var n="",r=e.find('>rtcp-fb-trr-int[xmlns="urn:xmpp:jingle:apps:rtp:rtcp-fb:0"]');return r.length&&(n+="a=rtcp-fb:* trr-int ",r.attr("value")?n+=r.attr("value"):n+="0",n+="\r\n"),(r=e.find('>rtcp-fb[xmlns="urn:xmpp:jingle:apps:rtp:rtcp-fb:0"]')).each(function(){n+="a=rtcp-fb:"+t+" "+$(this).attr("type"),$(this).attr("subtype")&&(n+=" "+$(this).attr("subtype")),n+="\r\n"}),n},r.prototype.fromJingle=function(e){var t=this;this.raw="v=0\r\no=- 1923518516 2 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\n";var n=$(e).find('>group[xmlns="urn:xmpp:jingle:apps:grouping:0"]');n.length&&n.each(function(e,n){var r=$(n).find(">content").map(function(e,t){return t.getAttribute("name")}).get();r.length>0&&(t.raw+="a=group:"+(n.getAttribute("semantics")||n.getAttribute("type"))+" "+r.join(" ")+"\r\n")}),this.session=this.raw,e.find(">content").each(function(){var e=t.jingle2media($(this));t.media.push(e)}),this.raw=this.session+this.media.join("")},r.prototype.jingle2media=function(e){var t=e.find("description"),n="",r=this,o=e.find('>transport>sctpmap[xmlns="urn:xmpp:jingle:transports:dtls-sctp:1"]'),a={media:t.attr("media")};if(a.port="1","rejected"===e.attr("senders")&&(a.port="0"),e.find(">transport>fingerprint").length||t.find("encryption").length?a.proto=o.length?"DTLS/SCTP":"RTP/SAVPF":a.proto="RTP/AVPF",o.length){n+="m=application 1 DTLS/SCTP "+o.attr("number")+"\r\n",n+="a=sctpmap:"+o.attr("number")+" "+o.attr("protocol");var s=o.attr("streams");n+=s?" "+s+"\r\n":"\r\n"}else a.fmt=t.find("payload-type").map(function(){return this.getAttribute("id")}).get(),n+=i.a.buildMLine(a)+"\r\n";switch(n+="c=IN IP4 0.0.0.0\r\n",o.length||(n+="a=rtcp:1 IN IP4 0.0.0.0\r\n"),(a=e.find('>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]')).length&&(a.attr("ufrag")&&(n+=i.a.buildICEUfrag(a.attr("ufrag"))+"\r\n"),a.attr("pwd")&&(n+=i.a.buildICEPwd(a.attr("pwd"))+"\r\n"),a.find(">fingerprint").each(function(){n+="a=fingerprint:"+this.getAttribute("hash"),n+=" "+$(this).text(),n+="\r\n",this.getAttribute("setup")&&(n+="a=setup:"+this.getAttribute("setup")+"\r\n")})),e.attr("senders")){case"initiator":n+="a=sendonly\r\n";break;case"responder":n+="a=recvonly\r\n";break;case"none":n+="a=inactive\r\n";break;case"both":n+="a=sendrecv\r\n"}return n+="a=mid:"+e.attr("name")+"\r\n",t.find("rtcp-mux").length&&(n+="a=rtcp-mux\r\n"),t.find("encryption").length&&t.find("encryption>crypto").each(function(){n+="a=crypto:"+this.getAttribute("tag"),n+=" "+this.getAttribute("crypto-suite"),n+=" "+this.getAttribute("key-params"),this.getAttribute("session-params")&&(n+=" "+this.getAttribute("session-params")),n+="\r\n"}),t.find("payload-type").each(function(){n+=i.a.buildRTPMap(this)+"\r\n",$(this).find(">parameter").length&&(n+="a=fmtp:"+this.getAttribute("id")+" ",n+=$(this).find("parameter").map(function(){var e=this.getAttribute("name");return(e?e+"=":"")+this.getAttribute("value")}).get().join("; "),n+="\r\n"),n+=r.rtcpFbFromJingle($(this),this.getAttribute("id"))}),n+=r.rtcpFbFromJingle(t,"*"),(a=t.find('>rtp-hdrext[xmlns="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0"]')).each(function(){n+="a=extmap:"+this.getAttribute("id")+" "+this.getAttribute("uri")+"\r\n"}),e.find('>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]>candidate').each(function(){var e=this.getAttribute("protocol");e="string"==typeof e?e.toLowerCase():"",r.removeTcpCandidates&&("tcp"===e||"ssltcp"===e)||r.removeUdpCandidates&&"udp"===e||(r.failICE&&this.setAttribute("ip","1.1.1.1"),n+=i.a.candidateFromJingle(this))}),e.find('description>ssrc-group[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]').each(function(){var e=this.getAttribute("semantics"),t=$(this).find(">source").map(function(){return this.getAttribute("ssrc")}).get();t.length&&(n+="a=ssrc-group:"+e+" "+t.join(" ")+"\r\n")}),(a=e.find('description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]')).each(function(){var e=this.getAttribute("ssrc");$(this).find(">parameter").each(function(){var t=this.getAttribute("name"),r=this.getAttribute("value");r=i.a.filterSpecialChars(r),n+="a=ssrc:"+e+" "+t,r&&r.length&&(n+=":"+r),n+="\r\n"})}),n}},function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return i});var r="signaling.peerMuted",i="signaling.peerVideoType"},function(e,t,n){"use strict";(function(e){function r(e,t){void 0===e.active?e.onended=t:e.oninactive=t}var i=n(16),o=n.n(i),a=n(0),s=(n.n(a),n(18)),c=n(4),u=n(28),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=Object(a.getLogger)(e),p={track_mute:"onmute",track_unmute:"onunmute",track_ended:"onended"},h=function(e){function t(e,n,r,i,o,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return s.addEventListener=s.addListener,s.removeEventListener=s.off=s.removeListener,s.containers=[],s.conference=e,s.audioLevel=-1,s.type=o,s.track=r,s.videoType=a,s.handlers=new Map,s.disposed=!1,s._streamInactiveHandler=i,s._setStream(n),s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.a),l(t,[{key:"_setHandler",value:function(e,t){if(p.hasOwnProperty(e)){if(t?this.handlers.set(e,t):this.handlers.delete(e),this.stream){var n=!0,r=!1,i=void 0;try{for(var o,a=this.stream.getVideoTracks()[Symbol.iterator]();!(n=(o=a.next()).done);n=!0)o.value[p[e]]=t}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}}}else d.error("Invalid handler type "+e)}},{key:"_unregisterHandlers",value:function(){if(this.stream){var e=!0,t=!1,n=void 0;try{for(var i,o=this.handlers.keys()[Symbol.iterator]();!(e=(i=o.next()).done);e=!0){var a=i.value,s=!0,c=!1,u=void 0;try{for(var l,h=this.stream.getVideoTracks()[Symbol.iterator]();!(s=(l=h.next()).done);s=!0)l.value[p[a]]=void 0}catch(e){c=!0,u=e}finally{try{!s&&h.return&&h.return()}finally{if(c)throw u}}}}catch(e){t=!0,n=e}finally{try{!e&&o.return&&o.return()}finally{if(t)throw n}}this._streamInactiveHandler&&r(this.stream,void 0)}else d.warn(this+": unable to unregister handlers - no stream object")}},{key:"_setStream",value:function(e){if(this.stream!==e&&(this.stream=e,this.stream)){var t=!0,n=!1,i=void 0;try{for(var o,a=this.handlers.keys()[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var s=o.value;this._setHandler(s,this.handlers.get(s))}}catch(e){n=!0,i=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw i}}this._streamInactiveHandler&&r(this.stream,this._streamInactiveHandler)}}},{key:"getType",value:function(){return this.type}},{key:"isAudioTrack",value:function(){return this.getType()===c.a}},{key:"isWebRTCTrackMuted",value:function(){return this.track&&this.track.muted}},{key:"isVideoTrack",value:function(){return this.getType()===c.b}},{key:"isLocal",value:function(){throw new Error("Not implemented by subclass")}},{key:"getOriginalStream",value:function(){return this.stream}},{key:"getStreamId",value:function(){return this.stream?this.stream.id:null}},{key:"getTrack",value:function(){return this.track}},{key:"getTrackId",value:function(){return this.track?this.track.id:null}},{key:"getUsageLabel",value:function(){return this.isAudioTrack()?"mic":this.videoType?this.videoType:"default"}},{key:"_maybeFireTrackAttached",value:function(e){this.conference&&e&&this.conference._onTrackAttach(this,e)}},{key:"attach",value:function(e){var t=e;return this.stream&&(t=u.a.attachMediaStream(e,this.stream)),this.containers.push(t),this._maybeFireTrackAttached(t),this._attachTTFMTracker(t),t}},{key:"detach",value:function(e){for(var t=this.containers,n=t.length-1;n>=0;--n){var r=t[n];e||u.a.attachMediaStream(r,null),e&&r!==e||t.splice(n,1)}e&&u.a.attachMediaStream(e,null)}},{key:"_attachTTFMTracker",value:function(e){}},{key:"dispose",value:function(){return this.removeAllListeners(),this.disposed=!0,Promise.resolve()}},{key:"isScreenSharing",value:function(){}},{key:"getId",value:function(){return this.stream?u.a.getStreamID(this.stream):null}},{key:"isActive",value:function(){return void 0===this.stream.active||this.stream.active}},{key:"setAudioLevel",value:function(e,t){this.audioLevel!==e&&(this.audioLevel=e,this.emit(s.TRACK_AUDIO_LEVEL_CHANGED,e,t))}},{key:"getMSID",value:function(){var e=this.getStreamId(),t=this.getTrackId();return e&&t?e+" "+t:null}},{key:"setAudioOutput",value:function(e){var t=this;return u.a.isDeviceChangeAvailable("output")?this.isVideoTrack()?Promise.resolve():Promise.all(this.containers.map(function(t){return t.setSinkId(e).catch(function(e){throw d.warn("Failed to change audio output device on element. Default or previously set audio output device will be used.",t,e),e})})).then(function(){t.emit(s.TRACK_AUDIO_OUTPUT_CHANGED,e)}):Promise.reject(new Error("Audio output device change is not supported"))}}]),t}();t.a=h}).call(t,"modules/RTC/JitsiTrack.js")},function(e,t){e.exports={ENVIRONMENT:"environment",USER:"user"}},function(e,t){var n=e.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:%d 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+))? (\S*)(?: (\S*))?/,names:["value","direction","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+" %s"+(e.config?" %s":"")}},{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:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\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"},{push:"invalid",names:["value"]}]};Object.keys(n).forEach(function(e){n[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})},function(e,t,n){"use strict";var r={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},r.splitSections=function(e){return e.split("\nm=").map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})},r.getDescription=function(e){var t=r.splitSections(e);return t&&t[0]},r.getMediaSections=function(e){var t=r.splitSections(e);return t.shift(),t},r.matchPrefix=function(e,t){return r.splitLines(e).filter(function(e){return 0===e.indexOf(t)})},r.parseCandidate=function(e){for(var t,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;case"ufrag":n.ufrag=t[r+1],n.usernameFragment=t[r+1];break;default:n[t[r]]=t[r+1]}return n},r.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),e.ufrag&&(t.push("ufrag"),t.push(e.ufrag)),"candidate:"+t.join(" ")},r.parseIceOptions=function(e){return e.substr(14).split(" ")},r.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.numChannels=3===t.length?parseInt(t[2],10):1,n},r.writeRtpMap=function(e){var t=e.payloadType;return void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType),"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==e.numChannels?"/"+e.numChannels:"")+"\r\n"},r.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},r.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},r.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach(function(t){r.push(t+"="+e.parameters[t])}),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},r.writeRtcpFb=function(e){var t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},r.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},r.getMid=function(e){var t=r.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},r.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},r.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:r.matchPrefix(e+t,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},r.getIceParameters=function(e,t){var n=r.splitLines(e);return{usernameFragment:(n=n.concat(r.splitLines(t))).filter(function(e){return 0===e.indexOf("a=ice-ufrag:")})[0].substr(12),password:n.filter(function(e){return 0===e.indexOf("a=ice-pwd:")})[0].substr(10)}},r.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},r.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=r.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=r.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=r.parseRtpMap(a),c=r.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?r.parseFmtp(c[0]):{},s.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(r.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return r.matchPrefix(e,"a=extmap:").forEach(function(e){t.headerExtensions.push(r.parseExtmap(e))}),t},r.writeRtpDescription=function(e,t){var n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=t.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(function(e){n+=r.writeRtpMap(e),n+=r.writeFmtp(e),n+=r.writeRtcpFb(e)});var i=0;return t.codecs.forEach(function(e){e.maxptime>i&&(i=e.maxptime)}),i>0&&(n+="a=maxptime:"+i+"\r\n"),n+="a=rtcp-mux\r\n",t.headerExtensions.forEach(function(e){n+=r.writeExtmap(e)}),n},r.parseRtpEncodingParameters=function(e){var t,n=[],i=r.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),c=s.length>0&&s[0].ssrc,u=r.matchPrefix(e,"a=ssrc-group:FID").map(function(e){var t=e.split(" ");return t.shift(),t.map(function(e){return parseInt(e,10)})});u.length>0&&u[0].length>1&&u[0][0]===c&&(t=u[0][1]),i.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var r={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10),rtx:{ssrc:t}};n.push(r),o&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:t,mechanism:a?"red+ulpfec":"red"},n.push(r))}}),0===n.length&&c&&n.push({ssrc:c});var l=r.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,n.forEach(function(e){e.maxBitrate=l})),n},r.parseRtcpParameters=function(e){var t={},n=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);var i=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=i.length>0,t.compound=0===i.length;var o=r.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},r.parseMsid=function(e){var t,n=r.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(t=n[0].substr(7).split(" "))[0],track:t[1]};var i=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return i.length>0?{stream:(t=i[0].value.split(" "))[0],track:t[1]}:void 0},r.generateSessionId=function(){return Math.random().toString().substr(2,21)},r.writeSessionBoilerplate=function(e,t){var n=void 0!==t?t:2;return"v=0\r\no=thisisadapterortc "+(e||r.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.writeMediaSection=function(e,t,n,i){var o=r.writeRtpDescription(e.kind,t);if(o+=r.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+r.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+r.localCName+"\r\n"),o},r.getDirection=function(e,t){for(var n=r.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return t?r.getDirection(t):"sendrecv"},r.getKind=function(e){return r.splitLines(e)[0].split(" ")[0].substr(2)},r.isRejected=function(e){return"0"===e.split(" ",2)[1]},r.parseMLine=function(e){var t=r.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},r.parseOLine=function(e){var t=r.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},e.exports=r},function(e,t,n){function r(e){if(void 0===e.recorder)throw new Error("Passed an object to startRecorder which is not a TrackRecorder object");e.recorder.start(),e.startTime=new Date}function i(e){if(void 0===e.recorder)throw new Error("Passed an object to stopRecorder which is not a TrackRecorder object");e.recorder.stop()}function o(){if(MediaRecorder.isTypeSupported(c))return c;if(MediaRecorder.isTypeSupported(u))return u;throw new Error("unable to create a MediaRecorder with the right mimetype!")}function a(e){this.recorders=[],this.fileType=o(),this.isRecording=!1,this.jitsiConference=e}var s=n(160),c="audio/webm",u="audio/ogg";a.determineCorrectFileType=o,a.prototype.addTrack=function(e){if(e.isAudioTrack()){var t=this.instantiateTrackRecorder(e);this.recorders.push(t),this.updateNames(),this.isRecording&&r(t)}},a.prototype.instantiateTrackRecorder=function(e){var t=new function(e){this.track=e,this.recorder=null,this.data=null,this.name=null,this.startTime=null}(e),n=t.track.getOriginalStream(),r=function(){if("undefined"!=typeof MediaStream)return new MediaStream;if("undefined"!=typeof webkitMediaStream)return new webkitMediaStream;throw new Error("cannot create a clean mediaStream")}();return n.getAudioTracks().forEach(function(e){return r.addTrack(e)}),t.recorder=new MediaRecorder(r,{mimeType:this.fileType}),t.data=[],t.recorder.ondataavailable=function(e){e.data.size>0&&t.data.push(e.data)},t},a.prototype.removeTrack=function(e){if(!e.isVideoTrack()){var t=this.recorders,n=void 0;for(n=0;n<t.length;n++)if(t[n].track.getParticipantId()===e.getParticipantId()){var r=t[n];this.isRecording?i(r):t.splice(n,1)}this.updateNames()}},a.prototype.updateNames=function(){var e=this.jitsiConference;this.recorders.forEach(function(t){if(t.track.isLocal())t.name="the transcriber";else{var n=t.track.getParticipantId(),r=e.getParticipantById(n).getDisplayName();"undefined"!==r&&(t.name=r)}})},a.prototype.start=function(){if(this.isRecording)throw new Error("audiorecorder is already recording");this.isRecording=!0,this.recorders.forEach(function(e){return r(e)}),console.log("Started the recording of the audio. There are currently "+this.recorders.length+" recorders active.")},a.prototype.stop=function(){this.isRecording=!1,this.recorders.forEach(function(e){return i(e)}),console.log("stopped recording")},a.prototype.download=function(){var e=this;this.recorders.forEach(function(t){var n=new Blob(t.data,{type:e.fileType}),r=URL.createObjectURL(n),i=document.createElement("a");document.body.appendChild(i),i.style="display: none",i.href=r,i.download="test."+e.fileType.split("/")[1],i.click(),window.URL.revokeObjectURL(r)})},a.prototype.getRecordingResults=function(){var e=this;if(this.isRecording)throw new Error("cannot get blobs because the AudioRecorder is still recording!");this.updateNames();var t=[];return this.recorders.forEach(function(n){return t.push(new s(new Blob(n.data,{type:e.fileType}),n.name,n.startTime))}),t},a.prototype.getFileType=function(){return this.fileType},e.exports=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"DEVICE_LIST_CHANGED",function(){return r}),n.d(t,"PERMISSION_PROMPT_IS_SHOWN",function(){return i});var r="mediaDevices.devicechange",i="mediaDevices.permissionPromptIsShown"},function(e,t,n){e.exports=n(62).default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){function r(e){var t={audio_requested:e.devices.includes("audio"),video_requested:e.devices.includes("video"),screen_sharing_requested:e.devices.includes("desktop")};return t.video_requested&&(t.resolution=e.resolution),t}var i=n(6),o=n(63),a=n.n(o),s=n(31),c=n(3),u=n.n(c),l=n(32),d=n(7),p=n(64),h=n(47),f=n(26),m=n(168),v=n(60),g=n(51),y=n.n(g),b=n(12),S=n(17),_=n(18),T=n(48),C=n(43),E=n(50),w=n(0),R=n.n(w),k=n(4),I=n(35),P=n.n(I),A=n(36),O=n(27),D=n(1),x=n(169),N=n(45),L=n.n(N),M=n(5),j=n(30),F=R.a.getLogger(e);t.default={version:"development",JitsiConnection:p.a,constants:{participantConnectionStatus:A.a,recordingStatus:E.a.status,recordingTypes:E.a.types,sipVideoGW:j,transcriptionStatus:T},events:{conference:d,connection:f,track:_,mediaDevices:v,connectionQuality:s},errors:{conference:l,connection:h,recorder:y.a,track:S},errorTypes:{JitsiTrackError:b.a},logLevels:R.a.levels,mediaDevices:m.a,analytics:M.a.analytics,init:function(e){M.a.init(e),window.connectionTimes||(window.connectionTimes={}),!0!==e.enableAnalyticsLogging&&(F.warn("Analytics disabled, disposing."),this.analytics.dispose()),e.enableWindowOnErrorHandler&&u.a.addHandler(this.getGlobalOnErrorHandler.bind(this));var t=e.deploymentInfo;if(t&&Object.keys(t).length>0){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);n.id="deployment_info",M.a.sendLog(JSON.stringify(n))}if(this.version){var i={id:"component_version",component:"lib-jitsi-meet",version:this.version};M.a.sendLog(JSON.stringify(i))}return O.a.init(e||{})},isDesktopSharingEnabled:function(){return O.a.isDesktopSharingEnabled()},setLogLevel:function(e){R.a.setLogLevel(e)},setLogLevelById:function(e,t){R.a.setLogLevelById(e,t)},addGlobalLogTransport:function(e){R.a.addGlobalTransport(e)},removeGlobalLogTransport:function(e){R.a.removeGlobalTransport(e)},createLocalTracks:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1;return!0===arguments[1]&&window.setTimeout(function(){n||m.a.emitEvent(v.PERMISSION_PROMPT_IS_SHOWN,D.a.getName())},1e3),window.connectionTimes||(window.connectionTimes={}),window.connectionTimes["obtainPermissions.start"]=window.performance.now(),O.a.obtainAudioAndVideoPermissions(t).then(function(e){if(n=!0,window.connectionTimes["obtainPermissions.end"]=window.performance.now(),M.a.sendAnalytics(Object(i.y)("success",r(t))),!O.a.options.disableAudioLevels)for(var o=0;o<e.length;o++)!function(t){var n=e[t],r=n.getOriginalStream();n.getType()===k.a&&(M.a.startLocalStats(r,n.setAudioLevel.bind(n)),n.addEventListener(_.LOCAL_TRACK_STOPPED,function(){M.a.stopLocalStats(r)}))}(o);var a=O.a.getCurrentlyAvailableMediaDevices();if(a)for(o=0;o<e.length;o++)e[o]._setRealDeviceIdFromDeviceList(a);return e}).catch(function(o){if(n=!0,o.name===S.UNSUPPORTED_RESOLUTION&&!D.a.usesNewGumFlow()){var a=t.resolution||"720",s=function(e){if(!P.a[e])return null;var t=P.a[e].order,n=null,r=null;return Object.keys(P.a).forEach(function(e){var i=P.a[e];(!n||n.order<i.order&&i.order<t)&&(r=e,n=i)}),r}(a);if(null!==s)return t.resolution=s,F.debug("Retry createLocalTracks with resolution",s),M.a.sendAnalytics(Object(i.y)("warning",{old_resolution:a,new_resolution:s,reason:"unsupported resolution"})),e.createLocalTracks(t)}if(o.name===S.CHROME_EXTENSION_USER_CANCELED){var c={id:"chrome_extension_user_canceled",message:o.message};M.a.sendLog(JSON.stringify(c)),M.a.sendAnalytics(Object(i.y)("warning",{reason:"extension install user canceled"}))}else if(o.name===S.NOT_FOUND){var u={id:"usermedia_missing_device",status:o.gum.devices};M.a.sendLog(JSON.stringify(u));var l=r(t);l.reason="device not found",l.devices=o.gum.devices.join("."),M.a.sendAnalytics(Object(i.y)("error",l))}else{M.a.sendGetUserMediaFailed(o);var d=r(t);d.reason=o.name,M.a.sendAnalytics(Object(i.y)("error",d))}return window.connectionTimes["obtainPermissions.end"]=window.performance.now(),Promise.reject(o)})},isDeviceListAvailable:function(){return F.warn("This method is deprecated, use JitsiMeetJS.mediaDevices.isDeviceListAvailable instead"),this.mediaDevices.isDeviceListAvailable()},isDeviceChangeAvailable:function(e){return F.warn("This method is deprecated, use JitsiMeetJS.mediaDevices.isDeviceChangeAvailable instead"),this.mediaDevices.isDeviceChangeAvailable(e)},isMultipleAudioInputSupported:function(){return this.mediaDevices.isMultipleAudioInputSupported()},isCollectingLocalStats:function(){return M.a.audioLevelsEnabled&&C.a.isLocalStatsSupported()},enumerateDevices:function(e){F.warn("This method is deprecated, use JitsiMeetJS.mediaDevices.enumerateDevices instead"),this.mediaDevices.enumerateDevices(e)},getGlobalOnErrorHandler:function(e,t,n,r,i){F.error("UnhandledError: "+e,"Script: "+t,"Line: "+n,"Column: "+r,"StackTrace: ",i),M.a.reportGlobalError(i)},util:{AuthUtil:a.a,RTCUIHelper:x.a,ScriptUtil:L.a,browser:D.a}}}.call(t,"JitsiMeetJS.js")},function(e,t){e.exports={getTokenAuthUrl:function(e,t,n){return"string"!=typeof e?null:e.replace("{room}",t).replace("{roleUpgrade}",!0===n)}}},function(e,t,n){"use strict";function r(e,t,n){this.appID=e,this.token=t,this.options=n,this.xmpp=new c.a(n,t),this.addEventListener(a.CONNECTION_FAILED,function(e,t,n,r){s.a.sendAnalyticsAndLog(Object(i.v)(e,t,r))}),this.addEventListener(a.CONNECTION_DISCONNECTED,function(e){e&&s.a.sendAnalytics(i.k,{message:e}),s.a.sendLog(JSON.stringify({id:i.k,msg:e}))})}t.a=r;var i=n(6),o=n(65),a=n(26),s=n(5),c=n(46);r.prototype.connect=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.xmpp.connect(e.id,e.password)},r.prototype.attach=function(e){this.xmpp.attach(e)},r.prototype.disconnect=function(){var e;(e=this.xmpp).disconnect.apply(e,arguments)},r.prototype.setToken=function(e){this.token=e},r.prototype.initJitsiConference=function(e,t){return new o.a({name:e,config:t,connection:this})},r.prototype.addEventListener=function(e,t){this.xmpp.addListener(e,t)},r.prototype.removeEventListener=function(e,t){this.xmpp.removeListener(e,t)},r.prototype.getConnectionTimes=function(){return this.xmpp.connectionTimes},r.prototype.addFeature=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.xmpp.caps.addFeature(e,t)},r.prototype.removeFeature=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.xmpp.caps.removeFeature(e,t)}},function(e,t,n){"use strict";(function(e){function r(e){if(!e.name||e.name.toLowerCase()!==e.name){var t="Invalid conference name (no conference name passed or it contains invalid characters like capital letters)!";throw B.error(t),new Error(t)}this.eventEmitter=new h.a,this.options=e,this.eventManager=new v.a(this),this.participants={},this._init(e),this.componentsVersions=new s.a(this),this.jvbJingleSession=null,this.lastDominantSpeaker=null,this.dtmfManager=null,this.somebodySupportsDTMF=!1,this.authEnabled=!1,this.startAudioMuted=!1,this.startVideoMuted=!1,this.startMutedPolicy={audio:!1,video:!1},this.availableDevices={audio:void 0,video:void 0},this.isMutedByFocus=!1,this.wasStopped=!1,this.connectionQuality=new c.a(this,this.eventEmitter,e),this.avgRtpStatsReporter=new a.a(this,e.config.avgRtpStatsN||15),this.isJvbConnectionInterrupted=!1,this.speakerStatsCollector=new H.a(this),this.deferredStartP2PTask=null;var n=parseInt(e.config.p2p&&e.config.p2p.backToP2PDelay,10);this.backToP2PDelay=isNaN(n)?5:n,B.info("backToP2PDelay: "+this.backToP2PDelay),this.isP2PConnectionInterrupted=!1,this.p2p=!1,this.p2pJingleSession=null,this.videoSIPGWHandler=new j.a(this.room)}t.a=r;var i=n(2),o=(n.n(i),n(6)),a=n(66),s=n(97),c=n(98),u=n(0),l=(n.n(u),n(3)),d=n.n(l),p=n(16),h=n.n(p),f=n(99),m=n(32),v=n(117),g=n(7),y=n(119),b=n.n(y),S=n(120),_=n(12),T=n(17),C=n(18),E=n(121),w=n(4),R=n(36),k=n(122),I=n(27),P=n(1),A=n(9),O=(n.n(A),n(5)),D=n(158),x=n(159),N=n.n(x),L=n(13),M=n.n(L),j=n(164),F=n(30),U=n(8),H=(n.n(U),n(166)),B=Object(u.getLogger)(e);r.prototype.constructor=r,r.prototype._init=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.connection&&(this.connection=t.connection,this.xmpp=this.connection.xmpp,this.eventManager.setupXMPPListeners());var n=this.options.config;if(this.room=this.xmpp.createRoom(this.options.name,n),this._onIceConnectionInterrupted=this._onIceConnectionInterrupted.bind(this),this.room.addListener(U.CONNECTION_INTERRUPTED,this._onIceConnectionInterrupted),this._onIceConnectionRestored=this._onIceConnectionRestored.bind(this),this.room.addListener(U.CONNECTION_RESTORED,this._onIceConnectionRestored),this._onIceConnectionEstablished=this._onIceConnectionEstablished.bind(this),this.room.addListener(U.CONNECTION_ESTABLISHED,this._onIceConnectionEstablished),this.room.updateDeviceAvailability(I.a.getDeviceAvailability()),this.rtc||(this.rtc=new I.a(this,t),this.eventManager.setupRTCListeners()),this.participantConnectionStatus=new R.b(this.rtc,this,{rtcMuteTimeout:n._peerConnStatusRtcMuteTimeout,outOfLastNTimeout:n._peerConnStatusOutOfLastNTimeout}),this.participantConnectionStatus.init(),!this.statistics){var r=window.location,i=this.myUserId();n.enableDisplayNameInStats&&n.displayName&&(i=n.displayName),this.statistics=new O.a(this.xmpp,{callStatsAliasName:i,callStatsConfIDNamespace:n.callStatsConfIDNamespace||r&&r.hostname||n.hosts&&n.hosts.domain,callStatsCustomScriptUrl:n.callStatsCustomScriptUrl,callStatsID:n.callStatsID,callStatsSecret:n.callStatsSecret,roomName:this.options.name,swapUserNameAndAlias:n.enableStatsID,applicationName:n.applicationName,getWiFiStatsMethod:n.getWiFiStatsMethod})}this.eventManager.setupChatRoomListeners(),this.eventManager.setupStatisticsListeners(),n.enableTalkWhileMuted&&new D.a(this,function(){return e.eventEmitter.emit(g.TALK_WHILE_MUTED)}),"channelLastN"in n&&this.setLastN(n.channelLastN),this.jvb121Status=new E.a(this),this.p2pDominantSpeakerDetection=new k.a(this)},r.prototype.join=function(e){this.room&&this.room.join(e)},r.prototype.authenticateAndUpgradeRole=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.a.apply(this,t)},r.prototype.isJoined=function(){return this.room&&this.room.joined},r.prototype.isP2PEnabled=function(){return Boolean(this.options.config.p2p&&this.options.config.p2p.enabled)||void 0===this.options.config.p2p},r.prototype.isP2PTestModeEnabled=function(){return Boolean(this.options.config.testing&&this.options.config.testing.p2pTestMode)},r.prototype.leave=function(){var e=this;if(this.participantConnectionStatus&&(this.participantConnectionStatus.dispose(),this.participantConnectionStatus=null),this.avgRtpStatsReporter&&(this.avgRtpStatsReporter.dispose(),this.avgRtpStatsReporter=null),this.getLocalTracks().forEach(function(t){return e.onLocalTrackRemoved(t)}),this.rtc.closeBridgeChannel(),this.statistics&&this.statistics.dispose(),this.jvbJingleSession&&(this.jvbJingleSession.close(),this.jvbJingleSession=null),this.p2pJingleSession&&(this.p2pJingleSession.close(),this.p2pJingleSession=null),this.room){var t=this.room;return t.removeListener(U.CONNECTION_INTERRUPTED,this._onIceConnectionInterrupted),t.removeListener(U.CONNECTION_RESTORED,this._onIceConnectionRestored),t.removeListener(U.CONNECTION_ESTABLISHED,this._onIceConnectionEstablished),this.room=null,t.leave().catch(function(){e.getParticipants().forEach(function(t){return e.onMemberLeft(t.getJid())})})}return Promise.reject(new Error("The conference is has been already left"))},r.prototype.getName=function(){return this.options.name},r.prototype.isAuthEnabled=function(){return this.authEnabled},r.prototype.isLoggedIn=function(){return Boolean(this.authIdentity)},r.prototype.getAuthLogin=function(){return this.authIdentity},r.prototype.isExternalAuthEnabled=function(){return this.room&&this.room.moderator.isExternalAuthEnabled()},r.prototype.getExternalAuthUrl=function(e){var t=this;return new Promise(function(n,r){t.isExternalAuthEnabled()?e?t.room.moderator.getPopupLoginUrl(n,r):t.room.moderator.getLoginUrl(n,r):r()})},r.prototype.getLocalTracks=function(e){var t=[];return this.rtc&&(t=this.rtc.getLocalTracks(e)),t},r.prototype.getLocalAudioTrack=function(){return this.rtc?this.rtc.getLocalAudioTrack():null},r.prototype.getLocalVideoTrack=function(){return this.rtc?this.rtc.getLocalVideoTrack():null},r.prototype.on=function(e,t){this.eventEmitter&&this.eventEmitter.on(e,t)},r.prototype.off=function(e,t){this.eventEmitter&&this.eventEmitter.removeListener(e,t)},r.prototype.addEventListener=r.prototype.on,r.prototype.removeEventListener=r.prototype.off,r.prototype.addCommandListener=function(e,t){this.room&&this.room.addPresenceListener(e,t)},r.prototype.removeCommandListener=function(e){this.room&&this.room.removePresenceListener(e)},r.prototype.sendTextMessage=function(e){this.room&&this.room.sendMessage(e)},r.prototype.sendPrivateTextMessage=function(e,t){this.room&&this.room.sendPrivateMessage(e,t)},r.prototype.sendCommand=function(e,t){this.room&&(this.room.addToPresence(e,t),this.room.sendPresence())},r.prototype.sendCommandOnce=function(e,t){this.sendCommand(e,t),this.removeCommand(e)},r.prototype.removeCommand=function(e){this.room&&this.room.removeFromPresence(e)},r.prototype.setDisplayName=function(e){this.room&&(this.room.removeFromPresence("nick"),this.room.addToPresence("nick",{attributes:{xmlns:"http://jabber.org/protocol/nick"},value:e}),this.room.sendPresence())},r.prototype.setSubject=function(e){this.room&&this.isModerator()&&this.room.setSubject(e)},r.prototype.getTranscriber=function(){if(void 0===this.transcriber){this.transcriber=new N.a;var e=this.getLocalTracks(w.a),t=!0,n=!1,r=void 0;try{for(var i,o=e[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var a=i.value;this.transcriber.addTrack(a)}}catch(e){n=!0,r=e}finally{try{!t&&o.return&&o.return()}finally{if(n)throw r}}var s=this.rtc.getRemoteTracks(w.a),c=!0,u=!1,l=void 0;try{for(var d,p=s[Symbol.iterator]();!(c=(d=p.next()).done);c=!0){var h=d.value;this.transcriber.addTrack(h)}}catch(e){u=!0,l=e}finally{try{!c&&p.return&&p.return()}finally{if(u)throw l}}}return this.transcriber},r.prototype.getTranscriptionStatus=function(){return this.room.transcriptionStatus},r.prototype.addTrack=function(e){if(e.isVideoTrack()){var t=this.rtc.getLocalVideoTrack();if(t)return e===t?Promise.resolve(e):Promise.reject(new Error("cannot add second video track to the conference"))}return this.replaceTrack(null,e)},r.prototype._fireAudioLevelChangeEvent=function(e,t){var n=this.getActivePeerConnection();t&&n!==t||this.eventEmitter.emit(g.TRACK_AUDIO_LEVEL_CHANGED,this.myUserId(),e)},r.prototype._fireMuteChangeEvent=function(e){this.isMutedByFocus&&e.isAudioTrack()&&!e.isMuted()&&(this.isMutedByFocus=!1,this.room.muteParticipant(this.room.myroomjid,!1)),this.eventEmitter.emit(g.TRACK_MUTE_CHANGED,e)},r.prototype.onLocalTrackRemoved=function(e){e._setConference(null),this.rtc.removeLocalTrack(e),e.removeEventListener(C.TRACK_MUTE_CHANGED,e.muteHandler),e.removeEventListener(C.TRACK_AUDIO_LEVEL_CHANGED,e.audioLevelHandler),e.isVideoTrack()&&e.videoType===M.a.DESKTOP&&this.statistics.sendScreenSharingEvent(!1),this.eventEmitter.emit(g.TRACK_REMOVED,e)},r.prototype.removeTrack=function(e){return this.replaceTrack(e,null)},r.prototype.replaceTrack=function(e,t){var n=this;return e&&e.disposed?Promise.reject(new _.a(T.TRACK_IS_DISPOSED)):t&&t.disposed?Promise.reject(new _.a(T.TRACK_IS_DISPOSED)):this._doReplaceTrack(e,t).then(function(){return e&&n.onLocalTrackRemoved(e),t&&n._setupNewTrack(t),Promise.resolve()},function(e){return Promise.reject(new Error(e))})},r.prototype._doReplaceTrack=function(e,t){var n=[];return this.jvbJingleSession?n.push(this.jvbJingleSession.replaceTrack(e,t)):B.info("_doReplaceTrack - no JVB JingleSession"),this.p2pJingleSession?n.push(this.p2pJingleSession.replaceTrack(e,t)):B.info("_doReplaceTrack - no P2P JingleSession"),Promise.all(n)},r.prototype._setupNewTrack=function(e){if(e.isAudioTrack()||e.isVideoTrack()&&e.videoType!==M.a.DESKTOP){var t=I.a.getCurrentlyAvailableMediaDevices().find(function(t){return t.kind===e.getTrack().kind+"input"&&t.label===e.getTrack().label});t&&O.a.sendActiveDeviceListEvent(I.a.getEventDataForActiveDevice(t))}e.isVideoTrack()&&(this.removeCommand("videoType"),this.sendCommand("videoType",{value:e.videoType,attributes:{xmlns:"http://jitsi.org/jitmeet/video"}})),this.rtc.addLocalTrack(e),e.isAudioTrack()?this.room.setAudioMute(e.isMuted()):this.room.setVideoMute(e.isMuted()),e.muteHandler=this._fireMuteChangeEvent.bind(this,e),e.audioLevelHandler=this._fireAudioLevelChangeEvent.bind(this),e.addEventListener(C.TRACK_MUTE_CHANGED,e.muteHandler),e.addEventListener(C.TRACK_AUDIO_LEVEL_CHANGED,e.audioLevelHandler),e._setConference(this),this.eventEmitter.emit(g.TRACK_ADDED,e)},r.prototype._addLocalTrackAsUnmute=function(e){var t=[];return this.jvbJingleSession?t.push(this.jvbJingleSession.addTrackAsUnmute(e)):B.info("Add local MediaStream as unmute - no JVB Jingle session started yet"),this.p2pJingleSession?t.push(this.p2pJingleSession.addTrackAsUnmute(e)):B.info("Add local MediaStream as unmute - no P2P Jingle session started yet"),Promise.all(t)},r.prototype._removeLocalTrackAsMute=function(e){var t=[];return this.jvbJingleSession?t.push(this.jvbJingleSession.removeTrackAsMute(e)):B.info("Remove local MediaStream - no JVB JingleSession started yet"),this.p2pJingleSession?t.push(this.p2pJingleSession.removeTrackAsMute(e)):B.info("Remove local MediaStream - no P2P JingleSession started yet"),Promise.all(t)},r.prototype.getRole=function(){return this.room.role},r.prototype.isModerator=function(){return this.room?this.room.isModerator():null},r.prototype.lock=function(e){var t=this;return this.isModerator()?new Promise(function(n,r){t.room.lockRoom(e||"",function(){return n()},function(e){return r(e)},function(){return r(m.PASSWORD_NOT_SUPPORTED)})}):Promise.reject()},r.prototype.unlock=function(){return this.lock()},r.prototype.selectParticipant=function(e){this.rtc.selectEndpoint(e)},r.prototype.pinParticipant=function(e){this.rtc.pinEndpoint(e)},r.prototype.getLastN=function(){return this.rtc.getLastN()},r.prototype.setLastN=function(e){if(!Number.isInteger(e)&&!Number.parseInt(e,10))throw new Error("Invalid value for lastN: "+e);var t=Number(e);if(t<-1)throw new RangeError("lastN cannot be smaller than -1");if(this.rtc.setLastN(t),this.p2pJingleSession){var n=0!==t;this.p2pJingleSession.setMediaTransferActive(!0,n).catch(function(e){B.error("Failed to adjust video transfer status ("+n+")",e)})}},r.prototype.isInLastN=function(e){return this.rtc.isInLastN(e)},r.prototype.getParticipants=function(){return Object.keys(this.participants).map(function(e){return this.participants[e]},this)},r.prototype.getParticipantCount=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getParticipants();return e||(t=t.filter(function(e){return!e.isHidden()})),t.length+1},r.prototype.getParticipantById=function(e){return this.participants[e]},r.prototype.kickParticipant=function(e){var t=this.getParticipantById(e);t&&this.room.kick(t.getJid())},r.prototype.muteParticipant=function(e){var t=this.getParticipantById(e);t&&this.room.muteParticipant(t.getJid(),!0)},r.prototype.onMemberJoined=function(e,t,n,r,o,a){var s=this,c=i.Strophe.getResourceFromJid(e);if("focus"!==c&&this.myUserId()!==c){var u=new S.a(e,this,t,r,o,a);u._role=n,this.participants[c]=u,this.eventEmitter.emit(g.USER_JOINED,c,u),this.xmpp.caps.getFeatures(e).then(function(e){u._supportsDTMF=e.has("urn:xmpp:jingle:dtmf:0"),s.updateDTMFSupport()},function(t){return B.warn("Failed to discover features of "+e,t)}),this._maybeStartOrStopP2P()}},r.prototype.onMemberLeft=function(e){var t=this,n=i.Strophe.getResourceFromJid(e);if("focus"!==n&&this.myUserId()!==n){var r=this.participants[n];delete this.participants[n],this.rtc.removeRemoteTracks(n).forEach(function(e){return t.eventEmitter.emit(g.TRACK_REMOVED,e)}),r&&this.eventEmitter.emit(g.USER_LEFT,n,r),this._maybeStartOrStopP2P(!0)}},r.prototype.onLocalRoleChanged=function(e){this.eventEmitter.emit(g.USER_ROLE_CHANGED,this.myUserId(),e),this._maybeStartOrStopP2P()},r.prototype.onUserRoleChanged=function(e,t){var n=i.Strophe.getResourceFromJid(e),r=this.getParticipantById(n);r&&(r._role=t,this.eventEmitter.emit(g.USER_ROLE_CHANGED,n,t))},r.prototype.onDisplayNameChanged=function(e,t){var n=i.Strophe.getResourceFromJid(e),r=this.getParticipantById(n);r&&r._displayName!==t&&(r._displayName=t,this.eventEmitter.emit(g.DISPLAY_NAME_CHANGED,n,t))},r.prototype.onRemoteTrackAdded=function(e){var t=this;if(!e.isP2P||this.isP2PActive())if(e.isP2P||!this.isP2PActive()){var n=e.getParticipantId(),r=this.getParticipantById(n);if(r){r._tracks.push(e),this.transcriber&&this.transcriber.addTrack(e);var i=this.eventEmitter;e.addEventListener(C.TRACK_MUTE_CHANGED,function(){return i.emit(g.TRACK_MUTE_CHANGED,e)}),e.addEventListener(C.TRACK_AUDIO_LEVEL_CHANGED,function(e,r){t.getActivePeerConnection()===r&&i.emit(g.TRACK_AUDIO_LEVEL_CHANGED,n,e)}),i.emit(g.TRACK_ADDED,e)}else B.error("No participant found for id: "+n)}else B.info("Trying to add remote JVB track, when in P2P - IGNORED");else B.info("Trying to add remote P2P track, when not in P2P - IGNORED")},r.prototype.onCallAccepted=function(e,t){this.p2pJingleSession===e&&(B.info("P2P setAnswer"),this.p2pJingleSession.setAnswer(t))},r.prototype.onTransportInfo=function(e,t){this.p2pJingleSession===e&&(B.info("P2P addIceCandidates"),this.p2pJingleSession.addIceCandidates(t))},r.prototype.onRemoteTrackRemoved=function(e){var t=this;this.getParticipants().forEach(function(n){for(var r=n.getTracks(),i=0;i<r.length;i++)if(r[i]===e){n._tracks.splice(i,1),t.eventEmitter.emit(g.TRACK_REMOVED,e),t.transcriber&&t.transcriber.removeTrack(e);break}},this)},r.prototype._onIncomingCallP2P=function(e,t){var n=void 0;"moderator"!==this.room.getMemberRole(e.remoteJid)?n={reason:"security-error",reasonDescription:"Only focus can start new sessions",errorMsg:"Rejecting session-initiate from non-focus andnon-moderator user: "+e.remoteJid}:P.a.supportsP2P()?this.isP2PEnabled()||this.isP2PTestModeEnabled()?this.p2pJingleSession&&(n={reason:"busy",reasonDescription:"P2P already in progress",errorMsg:'Duplicated P2P "session-initiate"'}):n={reason:"decline",reasonDescription:"P2P disabled",errorMsg:"P2P mode disabled in the configuration"}:n={reason:"unsupported-applications",reasonDescription:"P2P not supported",errorMsg:"This client does not support P2P connections"},n?this._rejectIncomingCall(e,n):this._acceptP2PIncomingCall(e,t)},r.prototype.onIncomingCall=function(e,t,n){if(e.isP2P)this._onIncomingCallP2P(e,t);else{if(!this.room.isFocus(e.remoteJid)){var r="Rejecting session-initiate from non-focus.";return void this._rejectIncomingCall(e,{reason:"security-error",reasonDescription:r,errorMsg:r})}this._acceptJvbIncomingCall(e,t,n)}},r.prototype._acceptJvbIncomingCall=function(e,t,n){var r=this;this.jvbJingleSession=e,this.room.connectionTimes["session.initiate"]=n,this.wasStopped&&O.a.sendAnalyticsAndLog(Object(o.z)(o.a,{p2p:!1})),O.a.sendAnalytics(Object(o.z)(o.c,{p2p:!1,value:n}));try{e.initialize(!1,this.room,this.rtc)}catch(e){d.a.callErrorHandler(e)}this._setBridgeChannel(t,e.peerconnection);try{e.acceptOffer(t,function(){r.isP2PActive()&&r.jvbJingleSession&&r._suspendMediaTransferForJvbConnection()},function(e){d.a.callErrorHandler(e),B.error("Failed to accept incoming Jingle session",e)},this.getLocalTracks()),B.info("Starting CallStats for JVB connection..."),this.statistics.startCallStats(this.jvbJingleSession.peerconnection,"jitsi"),this.statistics.startRemoteStats(this.jvbJingleSession.peerconnection)}catch(e){d.a.callErrorHandler(e),B.error(e)}},r.prototype._setBridgeChannel=function(e,t){var n=null,r=$(e).find(">content>transport>web-socket").first();1===r.length&&(n=r[0].getAttribute("url"));var i=void 0;switch(this.options.config.openBridgeChannel){case"datachannel":case!0:case void 0:i="datachannel";break;case"websocket":i="websocket"}"datachannel"!==i||P.a.supportsDataChannels()||(i="websocket"),"datachannel"===i?this.rtc.initializeBridgeChannel(t,null):"websocket"===i&&n&&this.rtc.initializeBridgeChannel(null,n)},r.prototype._rejectIncomingCall=function(e,t){t&&t.errorMsg&&d.a.callErrorHandler(new Error(t.errorMsg)),e.terminate(null,function(e){B.warn("An error occurred while trying to terminate invalid Jingle session",e)},{reason:t&&t.reason,reasonDescription:t&&t.reasonDescription,sendSessionTerminate:!0})},r.prototype.onCallEnded=function(e,t,n){B.info("Call ended: "+t+" - "+n+" P2P ?"+e.isP2P),e===this.jvbJingleSession?(this.wasStopped=!0,O.a.sendAnalytics(Object(o.z)(o.d,{p2p:!1})),this.statistics&&(this.statistics.stopRemoteStats(this.jvbJingleSession.peerconnection),B.info("Stopping JVB CallStats"),this.statistics.stopCallStats(this.jvbJingleSession.peerconnection)),this.jvbJingleSession=null,this.rtc.onCallEnded()):e===this.p2pJingleSession?("decline"===t&&"force JVB121"===n?(B.info("In forced JVB 121 mode..."),O.a.analytics.addPermanentProperties({forceJvb121:!0})):"connectivity-error"===t&&"ICE FAILED"===n&&O.a.analytics.addPermanentProperties({p2pFailed:!0}),this._stopP2PSession()):B.error("Received onCallEnded for invalid session",e.sid,e.remoteJid,t,n)},r.prototype.onSuspendDetected=function(e){e.isP2P||(this.leave(),this.eventEmitter.emit(g.SUSPEND_DETECTED))},r.prototype.updateDTMFSupport=function(){for(var e=!1,t=this.getParticipants(),n=0;n<t.length;n+=1)if(t[n].supportsDTMF()){e=!0;break}e!==this.somebodySupportsDTMF&&(this.somebodySupportsDTMF=e,this.eventEmitter.emit(g.DTMF_SUPPORT_CHANGED,e))},r.prototype.isDTMFSupported=function(){return this.somebodySupportsDTMF},r.prototype.myUserId=function(){return this.room&&this.room.myroomjid?i.Strophe.getResourceFromJid(this.room.myroomjid):null},r.prototype.sendTones=function(e,t,n){if(!this.dtmfManager){var r=this.getActivePeerConnection();if(!r)return void B.warn("cannot sendTones: no peer connection");var i=this.getLocalAudioTrack();if(!i)return void B.warn("cannot sendTones: no local audio stream");this.dtmfManager=new b.a(i,r)}this.dtmfManager.sendTones(e,t,n)},r.prototype.isRecordingSupported=function(){return!!this.room&&this.room.isRecordingSupported()},r.prototype.getRecordingState=function(){return this.room?this.room.getRecordingState():void 0},r.prototype.getRecordingURL=function(){return this.room?this.room.getRecordingURL():null},r.prototype.toggleRecording=function(e){var t=this;if(this.room)return this.room.toggleRecording(e,function(e,n){t.eventEmitter.emit(g.RECORDER_STATE_CHANGED,e,n)});this.eventEmitter.emit(g.RECORDER_STATE_CHANGED,"error",new Error("The conference is not created yet!"))},r.prototype.isSIPCallingSupported=function(){return!!this.room&&this.room.isSIPCallingSupported()},r.prototype.dial=function(e){return this.room?this.room.dial(e):new Promise(function(e,t){t(new Error("The conference is not created yet!"))})},r.prototype.hangup=function(){return this.room?this.room.hangup():new Promise(function(e,t){t(new Error("The conference is not created yet!"))})},r.prototype.startTranscriber=function(){return this.dial("jitsi_meet_transcribe")},r.prototype.stopTranscriber=r.prototype.hangup,r.prototype.getPhoneNumber=function(){return this.room?this.room.getPhoneNumber():null},r.prototype.getPhonePin=function(){return this.room?this.room.getPhonePin():null},r.prototype.getActivePeerConnection=function(){return this.isP2PActive()?this.p2pJingleSession.peerconnection:this.jvbJingleSession?this.jvbJingleSession.peerconnection:null},r.prototype.getConnectionState=function(){var e=this.getActivePeerConnection();return e?e.getConnectionState():null},r.prototype.setStartMutedPolicy=function(e){this.isModerator()&&(this.startMutedPolicy=e,this.room.removeFromPresence("startmuted"),this.room.addToPresence("startmuted",{attributes:{audio:e.audio,video:e.video,xmlns:"http://jitsi.org/jitmeet/start-muted"}}),this.room.sendPresence())},r.prototype.getStartMutedPolicy=function(){return this.startMutedPolicy},r.prototype.isStartAudioMuted=function(){return this.startAudioMuted},r.prototype.isStartVideoMuted=function(){return this.startVideoMuted},r.prototype.getLogs=function(){var e=this.xmpp.getJingleLog(),t={};t.time=new Date,t.url=window.location.href,t.ua=navigator.userAgent;var n=this.xmpp.getXmppLog();return n&&(t.xmpp=n),e.metadata=t,e},r.prototype.getConnectionTimes=function(){return this.room.connectionTimes},r.prototype.setLocalParticipantProperty=function(e,t){this.sendCommand("jitsi_participant_"+e,{value:t})},r.prototype.sendFeedback=function(e,t){this.statistics.sendFeedback(e,t)},r.prototype.isCallstatsEnabled=function(){return this.statistics.isCallstatsEnabled()},r.prototype._onTrackAttach=function(e,t){var n=e.isLocal(),r=null,i=e.isP2P,o=i?e.getParticipantId():"jitsi",a=i?this.p2pJingleSession&&this.p2pJingleSession.peerconnection:this.jvbJingleSession&&this.jvbJingleSession.peerconnection;n?a&&(r=a.getLocalSSRC(e)):r=e.getSSRC(),t.id&&r&&a&&this.statistics.associateStreamWithVideoTag(a,r,n,o,e.getUsageLabel(),t.id)},r.prototype.sendApplicationLog=function(e){O.a.sendLog(e)},r.prototype._isFocus=function(e){return this.room?this.room.isFocus(e):null},r.prototype._fireIncompatibleVersionsEvent=function(){this.eventEmitter.emit(g.CONFERENCE_FAILED,m.INCOMPATIBLE_SERVER_VERSIONS)},r.prototype.sendEndpointMessage=function(e,t){this.rtc.sendChannelMessage(e,t)},r.prototype.broadcastEndpointMessage=function(e){this.sendEndpointMessage("",e)},r.prototype.isConnectionInterrupted=function(){return this.isP2PActive()?this.isP2PConnectionInterrupted:this.isJvbConnectionInterrupted},r.prototype._onIceConnectionInterrupted=function(e){e.isP2P?this.isP2PConnectionInterrupted=!0:this.isJvbConnectionInterrupted=!0,e.isP2P===this.isP2PActive()&&this.eventEmitter.emit(g.CONNECTION_INTERRUPTED)},r.prototype._onIceConnectionFailed=function(e){e.isP2P&&(O.a.analytics.addPermanentProperties({p2pFailed:!0}),this.p2pJingleSession&&O.a.sendAnalyticsAndLog(Object(o.B)(o.h,{initiator:this.p2pJingleSession.isInitiator})),this._stopP2PSession("connectivity-error","ICE FAILED"))},r.prototype._onIceConnectionRestored=function(e){e.isP2P?this.isP2PConnectionInterrupted=!1:this.isJvbConnectionInterrupted=!1,e.isP2P===this.isP2PActive()&&this.eventEmitter.emit(g.CONNECTION_RESTORED)},r.prototype._acceptP2PIncomingCall=function(e,t){this.isP2PConnectionInterrupted=!1,this.p2pJingleSession=e,this.p2pJingleSession.initialize(!1,this.room,this.rtc),B.info("Starting CallStats for P2P connection...");var n=i.Strophe.getResourceFromJid(this.p2pJingleSession.remoteJid);if(this.options.config.enableStatsID){var r=this.participants[n];r&&(n=r.getStatsID()||n)}this.statistics.startCallStats(this.p2pJingleSession.peerconnection,n);var o=this.getLocalTracks();this.p2pJingleSession.acceptOffer(t,function(){B.debug('Got RESULT for P2P "session-accept"')},function(e){B.error("Failed to accept incoming P2P Jingle session",e)},o)},r.prototype._addRemoteJVBTracks=function(){this._addRemoteTracks("JVB",this.jvbJingleSession.peerconnection.getRemoteTracks())},r.prototype._addRemoteP2PTracks=function(){this._addRemoteTracks("P2P",this.p2pJingleSession.peerconnection.getRemoteTracks())},r.prototype._addRemoteTracks=function(e,t){var n=!0,r=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value;B.info("Adding remote "+e+" track: "+s),this.rtc.eventEmitter.emit(A.REMOTE_TRACK_ADDED,s)}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}},r.prototype._onIceConnectionEstablished=function(e){null!==this.p2pJingleSession&&(this.p2pEstablishmentDuration=this.p2pJingleSession.establishmentDuration),null!==this.jvbJingleSession&&(this.jvbEstablishmentDuration=this.jvbJingleSession.establishmentDuration);var t=!1,n=this.options.config.forceJVB121Ratio;if(e.isP2P?this.p2pJingleSession!==e?(B.error("CONNECTION_ESTABLISHED - wrong P2P session instance ?!"),t=!0):!e.isInitiator&&"number"==typeof n&&Math.random()<n&&(B.info("Forcing JVB 121 mode (ratio="+n+")..."),O.a.analytics.addPermanentProperties({forceJvb121:!0}),this._stopP2PSession("decline","force JVB121"),t=!0):t=!0,!isNaN(this.p2pEstablishmentDuration)&&!isNaN(this.jvbEstablishmentDuration)){var r=this.p2pEstablishmentDuration-this.jvbEstablishmentDuration;O.a.sendAnalytics(o.n,{value:r})}t||(this._setP2PStatus(!0),this.jvbJingleSession?this._removeRemoteJVBTracks():B.info("Not removing remote JVB tracks - no session yet"),this._addRemoteP2PTracks(),this.jvbJingleSession&&this._suspendMediaTransferForJvbConnection(),B.info("Starting remote stats with p2p connection"),this.statistics.startRemoteStats(this.p2pJingleSession.peerconnection),O.a.sendAnalyticsAndLog(Object(o.B)(o.g,{initiator:this.p2pJingleSession.isInitiator})))},r.prototype._maybeClearDeferredStartP2P=function(){this.deferredStartP2PTask&&(B.info("Cleared deferred start P2P task"),clearTimeout(this.deferredStartP2PTask),this.deferredStartP2PTask=null)},r.prototype._removeRemoteJVBTracks=function(){this._removeRemoteTracks("JVB",this.jvbJingleSession.peerconnection.getRemoteTracks())},r.prototype._removeRemoteP2PTracks=function(){this._removeRemoteTracks("P2P",this.p2pJingleSession.peerconnection.getRemoteTracks())},r.prototype._removeRemoteTracks=function(e,t){var n=!0,r=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value;B.info("Removing remote "+e+" track: "+s),this.rtc.eventEmitter.emit(A.REMOTE_TRACK_REMOVED,s)}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}},r.prototype._resumeMediaTransferForJvbConnection=function(){B.info("Resuming media transfer over the JVB connection..."),this.jvbJingleSession.setMediaTransferActive(!0,!0).then(function(){B.info("Resumed media transfer over the JVB connection!")},function(e){B.error("Failed to resume media transfer over the JVB connection:",e)})},r.prototype._setP2PStatus=function(e){if(this.p2p!==e){if(this.p2p=e,e){B.info("Peer to peer connection established!"),O.a.analytics.addPermanentProperties({p2pFailed:!1,forceJvb121:!1});var t=0!==this.rtc.getLastN();this.p2pJingleSession.setMediaTransferActive(!0,t).catch(function(e){B.error("Failed to sync up P2P video transfer status("+t+")",e)})}else B.info("Peer to peer connection closed!");this.jvbJingleSession&&this.statistics.sendConnectionResumeOrHoldEvent(this.jvbJingleSession.peerconnection,!e),this.dtmfManager=null,this.eventEmitter.emit(g.P2P_STATUS,this,this.p2p),this.eventEmitter.emit(this.isConnectionInterrupted()?g.CONNECTION_INTERRUPTED:g.CONNECTION_RESTORED)}else B.debug("Called _setP2PStatus with the same status: "+e)},r.prototype._startP2PSession=function(e){if(this._maybeClearDeferredStartP2P(),this.p2pJingleSession)B.error("P2P session already started!");else{this.isP2PConnectionInterrupted=!1,this.p2pJingleSession=this.xmpp.connection.jingle.newP2PJingleSession(this.room.myroomjid,e),B.info("Created new P2P JingleSession",this.room.myroomjid,e),this.p2pJingleSession.initialize(!0,this.room,this.rtc),B.info("Starting CallStats for P2P connection...");var t=i.Strophe.getResourceFromJid(this.p2pJingleSession.remoteJid);if(this.options.config.enableStatsID){var n=this.participants[t];n&&(t=n.getStatsID()||t)}this.statistics.startCallStats(this.p2pJingleSession.peerconnection,t);var r=this.getLocalTracks();this.p2pJingleSession.invite(r)}},r.prototype._suspendMediaTransferForJvbConnection=function(){B.info("Suspending media transfer over the JVB connection..."),this.jvbJingleSession.setMediaTransferActive(!1,!1).then(function(){B.info("Suspended media transfer over the JVB connection !")},function(e){B.error("Failed to suspend media transfer over the JVB connection:",e)})},r.prototype._maybeStartOrStopP2P=function(e){if(P.a.supportsP2P()&&this.isP2PEnabled()&&!this.isP2PTestModeEnabled()){var t=this.getParticipants(),n=t.length,r=this.isModerator(),i=1===n;if(B.debug("P2P? isModerator: "+r+", peerCount: "+n+" => "+i),!i&&this.deferredStartP2PTask&&this._maybeClearDeferredStartP2P(),r&&!this.p2pJingleSession&&i){var a=n&&t[0];if(r&&"moderator"===a.getRole()){var s=this.myUserId(),c=a.getId();if(s>c)return void B.debug("Everyone's a moderator - the other peer should start P2P",s,c);if(s===c)return void B.error("The same IDs ? ",s,c)}var u=a.getJid();if(e){if(this.deferredStartP2PTask)return void B.error("Deferred start P2P task's been set already!");B.info("Will start P2P with: "+u+" after "+this.backToP2PDelay+" seconds..."),this.deferredStartP2PTask=setTimeout(this._startP2PSession.bind(this,u),1e3*this.backToP2PDelay)}else B.info("Will start P2P with: "+u),this._startP2PSession(u)}else this.p2pJingleSession&&!i&&(B.info("Will stop P2P with: "+this.p2pJingleSession.remoteJid),this.p2pJingleSession.isInitiator&&n>1&&O.a.sendAnalyticsAndLog(Object(o.B)(o.i)),this._stopP2PSession())}else B.info("Auto P2P disabled")},r.prototype._stopP2PSession=function(e,t){if(this.p2pJingleSession){var n=this.isP2PActive();n&&(this.jvbJingleSession&&this._resumeMediaTransferForJvbConnection(),this._removeRemoteP2PTracks()),B.info("Stopping remote stats for P2P connection"),this.statistics.stopRemoteStats(this.p2pJingleSession.peerconnection),B.info("Stopping CallStats for P2P connection"),this.statistics.stopCallStats(this.p2pJingleSession.peerconnection),this.p2pJingleSession.terminate(function(){B.info("P2P session terminate RESULT")},function(t){e&&B.error("An error occurred while trying to terminate P2P Jingle session",t)},{reason:e||"success",reasonDescription:t||"Turing off P2P session",sendSessionTerminate:this.room&&this.getParticipantById(i.Strophe.getResourceFromJid(this.p2pJingleSession.remoteJid))}),this.p2pJingleSession=null,this._setP2PStatus(!1),n&&(this.jvbJingleSession?this._addRemoteJVBTracks():B.info("Not adding remote JVB tracks - no session yet"))}else B.error("No P2P session to be stopped!")},r.prototype.isP2PActive=function(){return this.p2p},r.prototype.getP2PConnectionState=function(){return this.isP2PActive()?this.p2pJingleSession.peerconnection.getConnectionState():null},r.prototype.startP2PSession=function(){var e=this.getParticipants();if(1!==e.length)throw new Error("There must be exactly 1 participant to start the P2P session !");var t=e[0].getJid();this._startP2PSession(t)},r.prototype.stopP2PSession=function(){this._stopP2PSession()},r.prototype.getSpeakerStats=function(){return this.speakerStatsCollector.getStats()},r.prototype.setReceiverVideoConstraint=function(e){this.rtc.setReceiverVideoConstraint(e)},r.prototype.createVideoSIPGWSession=function(e,t){return this.room?this.videoSIPGWHandler.createVideoSIPGWSession(e,t):new Error(F.ERROR_NO_CONNECTION)}}).call(t,"JitsiConference.js")},function(e,t,n){"use strict";(function(e){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(6),o=n(0),a=(n.n(o),n(31)),s=n(7),c=n(4),u=n(1),l=n(5),d=n(13),p=(n.n(d),function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()),h=Object(o.getLogger)(e),f=function(){function e(t){r(this,e),this.name=t,this.count=0,this.sum=0,this.samples=[]}return p(e,[{key:"addNext",value:function(e){"number"!=typeof e?h.error(this.name+" - invalid value for idx: "+this.count,e):isNaN(e)||(this.sum+=e,this.samples.push(e),this.count+=1)}},{key:"calculate",value:function(){return this.sum/this.count}},{key:"appendReport",value:function(e){e[this.name+"_avg"]=this.calculate(),e[this.name+"_samples"]=JSON.stringify(this.samples)}},{key:"reset",value:function(){this.samples=[],this.sum=0,this.count=0}}]),e}(),m=function(){function e(t,n,i){var o=this;r(this,e),this.isP2P=n,this._n=i,this._sampleIdx=0,this._avgRTT=new f("rtt"),this._avgRemoteRTTMap=new Map,this._avgRtpStatsReporter=t,this._avgEnd2EndRTT=void 0,this._onConnectionStats=function(e,t){o.isP2P===e.isP2P&&o._calculateAvgStats(t)};var c=t._conference;c.statistics.addConnectionStatsListener(this._onConnectionStats),this.isP2P||(this._onUserLeft=function(e){return o._avgRemoteRTTMap.delete(e)},c.on(s.USER_LEFT,this._onUserLeft),this._onRemoteStatsUpdated=function(e,t){return o._processRemoteStats(e,t)},c.on(a.REMOTE_STATS_UPDATED,this._onRemoteStatsUpdated))}return p(e,[{key:"_calculateAvgStats",value:function(e){if(e){if(u.a.supportsRTTStatistics()&&e.transport&&e.transport.length&&this._avgRTT.addNext(e.transport[0].rtt),this._sampleIdx+=1,this._sampleIdx>=this._n){if(u.a.supportsRTTStatistics()){var t=this._avgRtpStatsReporter._conference,n={p2p:this.isP2P,conference_size:t.getParticipantCount()};if(e.transport&&e.transport.length&&Object.assign(n,{local_candidate_type:e.transport[0].localCandidateType,remote_candidate_type:e.transport[0].remoteCandidateType,transport_type:e.transport[0].type}),this._avgRTT.appendReport(n),this.isP2P){var r=this._avgRtpStatsReporter.jvbStatsMonitor._avgEnd2EndRTT;isNaN(r)||(n.rtt_diff=this._avgRTT.calculate()-r)}else{var o=this._calculateAvgRemoteRTT(),a=this._avgRTT.calculate();this._avgEnd2EndRTT=a+o,isNaN(a)||isNaN(o)||(n.end2end_rtt_avg=this._avgEnd2EndRTT)}l.a.sendAnalytics(Object(i.D)(n))}this._resetAvgStats()}}else h.error("No stats")}},{key:"_calculateAvgRemoteRTT",value:function(){var e=0,t=0,n=!0,r=!1,i=void 0;try{for(var o,a=this._avgRemoteRTTMap.values()[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value,c=s.calculate();isNaN(c)||(t+=c,e+=1,s.reset())}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}return t/e}},{key:"_processRemoteStats",value:function(e,t){var n="number"==typeof t.jvbRTT,r=this._avgRemoteRTTMap.get(e);!r&&n&&(r=new f(e+"_stat_rtt"),this._avgRemoteRTTMap.set(e,r)),n?r.addNext(t.jvbRTT):r&&this._avgRemoteRTTMap.delete(e)}},{key:"_resetAvgStats",value:function(){this._avgRTT.reset(),this._avgRemoteRTTMap&&this._avgRemoteRTTMap.clear(),this._sampleIdx=0}},{key:"dispose",value:function(){var e=this._avgRtpStatsReporter._conference;e.statistics.removeConnectionStatsListener(this._onConnectionStats),this.isP2P||(e.off(a.REMOTE_STATS_UPDATED,this._onRemoteStatsUpdated),e.off(s.USER_LEFT,this._onUserLeft))}}]),e}(),v=function(){function e(t,n){var i=this;r(this,e),this._n=n,n>0?(h.info("Avg RTP stats will be calculated every "+n+" samples"),this._sampleIdx=0,this._conference=t,this._avgAudioBitrateUp=new f("bitrate_audio_upload"),this._avgAudioBitrateDown=new f("bitrate_audio_download"),this._avgVideoBitrateUp=new f("bitrate_video_upload"),this._avgVideoBitrateDown=new f("bitrate_video_download"),this._avgBandwidthUp=new f("bandwidth_upload"),this._avgBandwidthDown=new f("bandwidth_download"),this._avgPacketLossTotal=new f("packet_loss_total"),this._avgPacketLossUp=new f("packet_loss_upload"),this._avgPacketLossDown=new f("packet_loss_download"),this._avgRemoteFPS=new f("framerate_remote"),this._avgRemoteScreenFPS=new f("framerate_screen_remote"),this._avgLocalFPS=new f("framerate_local"),this._avgLocalScreenFPS=new f("framerate_screen_local"),this._avgRemoteCameraPixels=new f("pixels_remote"),this._avgRemoteScreenPixels=new f("pixels_screen_remote"),this._avgLocalCameraPixels=new f("pixels_local"),this._avgLocalScreenPixels=new f("pixels_screen_local"),this._avgCQ=new f("connection_quality"),this._onLocalStatsUpdated=function(e){return i._calculateAvgStats(e)},t.on(a.LOCAL_STATS_UPDATED,this._onLocalStatsUpdated),this._onP2PStatusChanged=function(){h.debug("Resetting average stats calculation"),i._resetAvgStats(),i.jvbStatsMonitor._resetAvgStats(),i.p2pStatsMonitor._resetAvgStats()},t.on(s.P2P_STATUS,this._onP2PStatusChanged),this._onJvb121StatusChanged=function(e,t){!0===t&&(h.info("Resetting JVB avg RTP stats"),i._resetAvgJvbStats())},t.on(s.JVB121_STATUS,this._onJvb121StatusChanged),this.jvbStatsMonitor=new m(this,!1,n),this.p2pStatsMonitor=new m(this,!0,n)):h.info("Avg RTP stats reports are disabled.")}return p(e,[{key:"_calculateAvgStats",value:function(e){if(e){var t=this._conference.isP2PActive(),n=this._conference.getParticipantCount();if(t||!(n<2)){var r=e.bitrate,o=e.bandwidth,a=e.packetLoss,s=e.framerate,c=e.resolution;if(r)if(o)if(a)if(s)if(c){if(this._avgAudioBitrateUp.addNext(r.audio.upload),this._avgAudioBitrateDown.addNext(r.audio.download),this._avgVideoBitrateUp.addNext(r.video.upload),this._avgVideoBitrateDown.addNext(r.video.download),u.a.supportsBandwidthStatistics()&&(this._avgBandwidthUp.addNext(o.upload),this._avgBandwidthDown.addNext(o.download)),this._avgPacketLossUp.addNext(a.upload),this._avgPacketLossDown.addNext(a.download),this._avgPacketLossTotal.addNext(a.total),this._avgCQ.addNext(e.connectionQuality),s&&(this._avgRemoteFPS.addNext(this._calculateAvgVideoFps(s,!1,d.CAMERA)),this._avgRemoteScreenFPS.addNext(this._calculateAvgVideoFps(s,!1,d.DESKTOP)),this._avgLocalFPS.addNext(this._calculateAvgVideoFps(s,!0,d.CAMERA)),this._avgLocalScreenFPS.addNext(this._calculateAvgVideoFps(s,!0,d.DESKTOP))),c&&(this._avgRemoteCameraPixels.addNext(this._calculateAvgVideoPixels(c,!1,d.CAMERA)),this._avgRemoteScreenPixels.addNext(this._calculateAvgVideoPixels(c,!1,d.DESKTOP)),this._avgLocalCameraPixels.addNext(this._calculateAvgVideoPixels(c,!0,d.CAMERA)),this._avgLocalScreenPixels.addNext(this._calculateAvgVideoPixels(c,!0,d.DESKTOP))),this._sampleIdx+=1,this._sampleIdx>=this._n){var p={p2p:t,conference_size:n};e.transport&&e.transport.length&&Object.assign(p,{local_candidate_type:e.transport[0].localCandidateType,remote_candidate_type:e.transport[0].remoteCandidateType,transport_type:e.transport[0].type}),this._avgAudioBitrateUp.appendReport(p),this._avgAudioBitrateDown.appendReport(p),this._avgVideoBitrateUp.appendReport(p),this._avgVideoBitrateDown.appendReport(p),u.a.supportsBandwidthStatistics()&&(this._avgBandwidthUp.appendReport(p),this._avgBandwidthDown.appendReport(p)),this._avgPacketLossUp.appendReport(p),this._avgPacketLossDown.appendReport(p),this._avgPacketLossTotal.appendReport(p),this._avgRemoteFPS.appendReport(p),isNaN(this._avgRemoteScreenFPS.calculate())||this._avgRemoteScreenFPS.appendReport(p),this._avgLocalFPS.appendReport(p),isNaN(this._avgLocalScreenFPS.calculate())||this._avgLocalScreenFPS.appendReport(p),this._avgRemoteCameraPixels.appendReport(p),isNaN(this._avgRemoteScreenPixels.calculate())||this._avgRemoteScreenPixels.appendReport(p),this._avgLocalCameraPixels.appendReport(p),isNaN(this._avgLocalScreenPixels.calculate())||this._avgLocalScreenPixels.appendReport(p),this._avgCQ.appendReport(p),l.a.sendAnalytics(Object(i.D)(p)),this._resetAvgStats()}}else h.error("No resolution");else h.error('No "framerate"');else h.error('No "packetloss"');else h.error('No "bandwidth"');else h.error('No "bitrate"')}}else h.error("No stats")}},{key:"_calculateAvgVideoPixels",value:function(e,t,n){var r=0,i=0,o=this._conference.myUserId(),a=!0,s=!1,c=void 0;try{for(var u,l=Object.keys(e)[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){var d=u.value;if(t?d===o:d!==o){var p=t?null:this._conference.getParticipantById(d),h=e[d];if((t||p)&&h){var f=this._calculatePeerAvgVideoPixels(h,p,n);isNaN(f)||(r+=f,i+=1)}}}}catch(e){s=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(s)throw c}}return r/i}},{key:"_calculatePeerAvgVideoPixels",value:function(e,t,n){var r=Object.keys(e).map(function(e){return Number(e)}),i=null,o=this._conference.getActivePeerConnection();t?(i=t.getTracksByMediaType(c.b))&&(r=r.filter(function(e){return i.find(function(t){return!t.isMuted()&&t.getSSRC()===e&&t.videoType===n})})):(i=this._conference.getLocalTracks(c.b),r=r.filter(function(e){return i.find(function(t){return!t.isMuted()&&o.getLocalSSRC(t)===e&&t.videoType===n})}));var a=0,s=0,u=!0,l=!1,d=void 0;try{for(var p,h=r[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){var f=p.value,m=Number(e[f].height)*Number(e[f].width);!isNaN(m)&&m>0&&(a+=m,s+=1)}}catch(e){l=!0,d=e}finally{try{!u&&h.return&&h.return()}finally{if(l)throw d}}return a/s}},{key:"_calculateAvgVideoFps",value:function(e,t,n){var r=0,i=0,o=this._conference.myUserId(),a=!0,s=!1,c=void 0;try{for(var u,l=Object.keys(e)[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){var d=u.value;if(t?d===o:d!==o){var p=t?null:this._conference.getParticipantById(d),h=e[d];if((t||p)&&h){var f=this._calculatePeerAvgVideoFps(h,p,n);isNaN(f)||(r+=f,i+=1)}}}}catch(e){s=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(s)throw c}}return r/i}},{key:"_calculatePeerAvgVideoFps",value:function(e,t,n){var r=Object.keys(e).map(function(e){return Number(e)}),i=null,o=this._conference.getActivePeerConnection();t?(i=t.getTracksByMediaType(c.b))&&(r=r.filter(function(e){return i.find(function(t){return!t.isMuted()&&t.getSSRC()===e&&t.videoType===n})})):(i=this._conference.getLocalTracks(c.b),r=r.filter(function(e){return i.find(function(t){return!t.isMuted()&&o.getLocalSSRC(t)===e&&t.videoType===n})}));var a=0,s=0,u=!0,l=!1,d=void 0;try{for(var p,h=r[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){var f=p.value,m=Number(e[f]);!isNaN(m)&&m>0&&(a+=m,s+=1)}}catch(e){l=!0,d=e}finally{try{!u&&h.return&&h.return()}finally{if(l)throw d}}return a/s}},{key:"_resetAvgJvbStats",value:function(){this._resetAvgStats(),this.jvbStatsMonitor._resetAvgStats()}},{key:"_resetAvgStats",value:function(){this._avgAudioBitrateUp.reset(),this._avgAudioBitrateDown.reset(),this._avgVideoBitrateUp.reset(),this._avgVideoBitrateDown.reset(),this._avgBandwidthUp.reset(),this._avgBandwidthDown.reset(),this._avgPacketLossUp.reset(),this._avgPacketLossDown.reset(),this._avgPacketLossTotal.reset(),this._avgRemoteFPS.reset(),this._avgRemoteScreenFPS.reset(),this._avgLocalFPS.reset(),this._avgLocalScreenFPS.reset(),this._avgRemoteCameraPixels.reset(),this._avgRemoteScreenPixels.reset(),this._avgLocalCameraPixels.reset(),this._avgLocalScreenPixels.reset(),this._avgCQ.reset(),this._sampleIdx=0}},{key:"dispose",value:function(){this._conference.off(s.P2P_STATUS,this._onP2PStatusChanged),this._conference.off(a.LOCAL_STATS_UPDATED,this._onLocalStatsUpdated),this._conference.off(s.JVB121_STATUS,this._onJvb121StatusChanged),this.jvbStatsMonitor.dispose(),this.p2pStatsMonitor.dispose()}}]),e}();t.a=v}).call(t,"modules/statistics/AvgRTPStatsReporter.js")},function(e,t,n){function r(e,t){this.logStorage=e,this.stringifyObjects=!(!t||!t.stringifyObjects)&&t.stringifyObjects,this.storeInterval=t&&t.storeInterval?t.storeInterval:3e4,this.maxEntryLength=t&&t.maxEntryLength?t.maxEntryLength:1e4,Object.keys(i.levels).forEach(function(e){this[i.levels[e]]=function(e){this._log.apply(this,arguments)}.bind(this,e)}.bind(this)),this.storeLogsIntervalID=null,this.queue=[],this.totalLen=0,this.outputCache=[]}var i=n(38);r.prototype.stringify=function(e){try{return JSON.stringify(e)}catch(e){return"[object with circular refs?]"}},r.prototype.formatLogMessage=function(e){for(var t="",n=1,r=arguments.length;n<r;n++){var o=arguments[n];!this.stringifyObjects&&e!==i.levels.ERROR||"object"!=typeof o||(o=this.stringify(o)),t+=o,n!=r-1&&(t+=" ")}return t.length?t:null},r.prototype._log=function(){var e=this.formatLogMessage.apply(this,arguments);if(e){var t=this.queue.length?this.queue[this.queue.length-1]:void 0;("object"==typeof t?t.text:t)==e?"object"==typeof t?t.count+=1:this.queue[this.queue.length-1]={text:e,count:2}:(this.queue.push(e),this.totalLen+=e.length)}this.totalLen>=this.maxEntryLength&&this._flush(!0,!0)},r.prototype.start=function(){this._reschedulePublishInterval()},r.prototype._reschedulePublishInterval=function(){this.storeLogsIntervalID&&(window.clearTimeout(this.storeLogsIntervalID),this.storeLogsIntervalID=null),this.storeLogsIntervalID=window.setTimeout(this._flush.bind(this,!1,!0),this.storeInterval)},r.prototype.flush=function(){this._flush(!1,!0)},r.prototype._flush=function(e,t){this.totalLen>0&&(this.logStorage.isReady()||e)&&(this.logStorage.isReady()?(this.outputCache.length&&(this.outputCache.forEach(function(e){this.logStorage.storeLogs(e)}.bind(this)),this.outputCache=[]),this.logStorage.storeLogs(this.queue)):this.outputCache.push(this.queue),this.queue=[],this.totalLen=0),t&&this._reschedulePublishInterval()},r.prototype.stop=function(){this._flush(!1,!1)},e.exports=r},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(39)),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=Object(r.getLogger)(e),s=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.info("This appears to be "+e.getName()+", ver: "+e.getVersion()),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.a),o(t,[{key:"doesVideoMuteByStreamRemove",value:function(){return!(this.isFirefox()||this.isEdge()||this.isSafariWithWebrtc())}},{key:"supportsP2P",value:function(){return!this.isEdge()}},{key:"isSafariWithWebrtc",value:function(){return this.isSafari()&&!this.isVersionLessThan("11")}},{key:"isTemasysPluginUsed",value:function(){return this.isSafari()&&!this.isSafariWithWebrtc()||this.isIExplorer()&&this.isVersionLessThan("12")}},{key:"supportsVideoMuteOnConnInterrupted",value:function(){return this.isChrome()||this.isElectron()}},{key:"supportsBandwidthStatistics",value:function(){return!this.isFirefox()&&!this.isEdge()}},{key:"supportsDataChannels",value:function(){return!this.isEdge()}},{key:"supportsMediaStreamConstructor",value:function(){return!this.isReactNative()&&!this.isTemasysPluginUsed()}},{key:"supportsRTTStatistics",value:function(){return!this.isFirefox()&&!this.isEdge()}},{key:"supportsRtpSender",value:function(){return this.isFirefox()}},{key:"supportsRtx",value:function(){return!this.isFirefox()}},{key:"supportsSimulcast",value:function(){return this.isChrome()||this.isFirefox()||this.isElectron()||this.isNWJS()||this.isReactNative()}},{key:"supportsVideo",value:function(){return!this.isSafariWithWebrtc()}},{key:"usesPlanB",value:function(){return!this.usesUnifiedPlan()}},{key:"usesUnifiedPlan",value:function(){return this.isFirefox()}},{key:"usesNewGumFlow",value:function(){return this.isChrome()&&!this.isVersionLessThan("61")||this.isFirefox()||this.isSafariWithWebrtc()}}]),t}();t.a=s}).call(t,"modules/browser/BrowserCapabilities.js")},function(e,t,n){var r;r=function(){function e(e){function t(t){var n=e.match(t);return n&&n.length>1&&n[1]||""}function n(t){var n=e.match(t);return n&&n.length>1&&n[2]||""}var r,i=t(/(ipod|iphone|ipad)/i).toLowerCase(),a=!/like android/i.test(e)&&/android/i.test(e),s=/nexus\s*[0-6]\s*/i.test(e),c=!s&&/nexus\s*[0-9]+/i.test(e),u=/CrOS/.test(e),l=/silk/i.test(e),d=/sailfish/i.test(e),p=/tizen/i.test(e),h=/(web|hpw)os/i.test(e),f=/windows phone/i.test(e),m=(/SamsungBrowser/i.test(e),!f&&/windows/i.test(e)),v=!i&&!l&&/macintosh/i.test(e),g=!a&&!d&&!p&&!h&&/linux/i.test(e),y=n(/edg([ea]|ios)\/(\d+(\.\d+)?)/i),b=t(/version\/(\d+(\.\d+)?)/i),S=/tablet/i.test(e)&&!/tablet pc/i.test(e),_=!S&&/[^-]mobi/i.test(e),T=/xbox/i.test(e);/opera/i.test(e)?r={name:"Opera",opera:o,version:b||t(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(e)?r={name:"Opera",opera:o,version:t(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||b}:/SamsungBrowser/i.test(e)?r={name:"Samsung Internet for Android",samsungBrowser:o,version:b||t(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/coast/i.test(e)?r={name:"Opera Coast",coast:o,version:b||t(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(e)?r={name:"Yandex Browser",yandexbrowser:o,version:b||t(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(e)?r={name:"UC Browser",ucbrowser:o,version:t(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(e)?r={name:"Maxthon",maxthon:o,version:t(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(e)?r={name:"Epiphany",epiphany:o,version:t(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(e)?r={name:"Puffin",puffin:o,version:t(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(e)?r={name:"Sleipnir",sleipnir:o,version:t(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(e)?r={name:"K-Meleon",kMeleon:o,version:t(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:f?(r={name:"Windows Phone",osname:"Windows Phone",windowsphone:o},y?(r.msedge=o,r.version=y):(r.msie=o,r.version=t(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(e)?r={name:"Internet Explorer",msie:o,version:t(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:u?r={name:"Chrome",osname:"Chrome OS",chromeos:o,chromeBook:o,chrome:o,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/edg([ea]|ios)/i.test(e)?r={name:"Microsoft Edge",msedge:o,version:y}:/vivaldi/i.test(e)?r={name:"Vivaldi",vivaldi:o,version:t(/vivaldi\/(\d+(\.\d+)?)/i)||b}:d?r={name:"Sailfish",osname:"Sailfish OS",sailfish:o,version:t(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(e)?r={name:"SeaMonkey",seamonkey:o,version:t(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(e)?(r={name:"Firefox",firefox:o,version:t(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(e)&&(r.firefoxos=o,r.osname="Firefox OS")):l?r={name:"Amazon Silk",silk:o,version:t(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(e)?r={name:"PhantomJS",phantom:o,version:t(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(e)?r={name:"SlimerJS",slimer:o,version:t(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(e)||/rim\stablet/i.test(e)?r={name:"BlackBerry",osname:"BlackBerry OS",blackberry:o,version:b||t(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:h?(r={name:"WebOS",osname:"WebOS",webos:o,version:b||t(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(e)&&(r.touchpad=o)):/bada/i.test(e)?r={name:"Bada",osname:"Bada",bada:o,version:t(/dolfin\/(\d+(\.\d+)?)/i)}:p?r={name:"Tizen",osname:"Tizen",tizen:o,version:t(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||b}:/qupzilla/i.test(e)?r={name:"QupZilla",qupzilla:o,version:t(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||b}:/chromium/i.test(e)?r={name:"Chromium",chromium:o,version:t(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||b}:/chrome|crios|crmo/i.test(e)?r={name:"Chrome",chrome:o,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:a?r={name:"Android",version:b}:/safari|applewebkit/i.test(e)?(r={name:"Safari",safari:o},b&&(r.version=b)):i?(r={name:"iphone"==i?"iPhone":"ipad"==i?"iPad":"iPod"},b&&(r.version=b)):r=/googlebot/i.test(e)?{name:"Googlebot",googlebot:o,version:t(/googlebot\/(\d+(\.\d+))/i)||b}:{name:t(/^(.*)\/(.*) /),version:n(/^(.*)\/(.*) /)},!r.msedge&&/(apple)?webkit/i.test(e)?(/(apple)?webkit\/537\.36/i.test(e)?(r.name=r.name||"Blink",r.blink=o):(r.name=r.name||"Webkit",r.webkit=o),!r.version&&b&&(r.version=b)):!r.opera&&/gecko\//i.test(e)&&(r.name=r.name||"Gecko",r.gecko=o,r.version=r.version||t(/gecko\/(\d+(\.\d+)?)/i)),r.windowsphone||!a&&!r.silk?!r.windowsphone&&i?(r[i]=o,r.ios=o,r.osname="iOS"):v?(r.mac=o,r.osname="macOS"):T?(r.xbox=o,r.osname="Xbox"):m?(r.windows=o,r.osname="Windows"):g&&(r.linux=o,r.osname="Linux"):(r.android=o,r.osname="Android");var C="";r.windows?C=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}(t(/Windows ((NT|XP)( \d\d?.\d)?)/i)):r.windowsphone?C=t(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):r.mac?C=(C=t(/Mac OS X (\d+([_\.\s]\d+)*)/i)).replace(/[_\s]/g,"."):i?C=(C=t(/os (\d+([_\s]\d+)*) like mac os x/i)).replace(/[_\s]/g,"."):a?C=t(/android[ \/-](\d+(\.\d+)*)/i):r.webos?C=t(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):r.blackberry?C=t(/rim\stablet\sos\s(\d+(\.\d+)*)/i):r.bada?C=t(/bada\/(\d+(\.\d+)*)/i):r.tizen&&(C=t(/tizen[\/\s](\d+(\.\d+)*)/i)),C&&(r.osversion=C);var E=!r.windows&&C.split(".")[0];return S||c||"ipad"==i||a&&(3==E||E>=4&&!_)||r.silk?r.tablet=o:(_||"iphone"==i||"ipod"==i||a||s||r.blackberry||r.webos||r.bada)&&(r.mobile=o),r.msedge||r.msie&&r.version>=10||r.yandexbrowser&&r.version>=15||r.vivaldi&&r.version>=1||r.chrome&&r.version>=20||r.samsungBrowser&&r.version>=4||r.firefox&&r.version>=20||r.safari&&r.version>=6||r.opera&&r.version>=10||r.ios&&r.osversion&&r.osversion.split(".")[0]>=6||r.blackberry&&r.version>=10.1||r.chromium&&r.version>=20?r.a=o:r.msie&&r.version<10||r.chrome&&r.version<20||r.firefox&&r.version<20||r.safari&&r.version<6||r.opera&&r.version<10||r.ios&&r.osversion&&r.osversion.split(".")[0]<6||r.chromium&&r.version<20?r.c=o:r.x=o,r}function t(e){return e.split(".").length}function n(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n++)r.push(t(e[n]));return r}function r(e){for(var r=Math.max(t(e[0]),t(e[1])),i=n(e,function(e){var i=r-t(e);return n((e+=new Array(i+1).join(".0")).split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});--r>=0;){if(i[0][r]>i[1][r])return 1;if(i[0][r]!==i[1][r])return-1;if(0===r)return 0}}function i(t,n,i){var o=a;"string"==typeof n&&(i=n,n=void 0),void 0===n&&(n=!1),i&&(o=e(i));var s=""+o.version;for(var c in t)if(t.hasOwnProperty(c)&&o[c]){if("string"!=typeof t[c])throw new Error("Browser version in the minVersion map should be a string: "+c+": "+String(t));return r([s,t[c]])<0}return n}var o=!0,a=e("undefined"!=typeof navigator&&navigator.userAgent||"");return a.test=function(e){for(var t=0;t<e.length;++t){var n=e[t];if("string"==typeof n&&n in a)return!0}return!1},a.isUnsupportedBrowser=i,a.compareVersions=r,a.check=function(e,t,n){return!i(e,t,n)},a._detect=e,a.detect=e,a},void 0!==e&&e.exports?e.exports=r():n(70)("bowser",r)},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t,n){"use strict";(function(e){var r=n(6),i=n(0),o=(n.n(i),n(1)),a=n(23),s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=Object(i.getLogger)(e),l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.disposed=!1,this.analyticsHandlers=new Set,this.cache=[],this.permanentProperties={},this.conferenceName="",this.addPermanentProperties({callstats_name:a.a.callStatsUserName,user_agent:navigator.userAgent,browser_name:o.a.getName()})}return c(e,[{key:"dispose",value:function(){u.warn("Disposing of analytics adapter."),this.setAnalyticsHandlers([]),this.disposed=!0}},{key:"setAnalyticsHandlers",value:function(e){var t=this;if(!this.disposed){this.analyticsHandlers=new Set(e);var n=this.cache;this.cache=null,n&&n.forEach(function(e){return t._sendEvent(e)})}}},{key:"addPermanentProperties",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(this.permanentProperties["permanent_"+t]=e[t])}},{key:"setConferenceName",value:function(e){this.conferenceName=e,this.addPermanentProperties({conference_name:e})}},{key:"sendEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.disposed)u.warn("Not sending an event, disposed.");else{var n=null;"string"==typeof e?n={type:r.q,action:e,actionSubject:e,source:e,attributes:t}:"object"===(void 0===e?"undefined":s(e))&&(n=e),this._verifyRequiredFields(n)?this._sendEvent(n):u.error("Dropping a mis-formatted event: "+JSON.stringify(n))}}},{key:"_verifyRequiredFields",value:function(e){if(!e)return!1;e.type||(e.type=r.q);var t=e.type;return t!==r.q&&t!==r.r&&t!==r.t&&t!==r.s?(u.error("Unknown event type: "+t),!1):t===r.r?Boolean(e.name):(e.action=e.action||e.name||e.actionSubject,e.actionSubject=e.actionSubject||e.name||e.action,e.source=e.source||e.name||e.action||e.actionSubject,e.action&&e.actionSubject&&e.source?!!(t!==r.s||(e.objectType=e.objectType||"generic-object-type",e.containerType=e.containerType||"conference","conference"!==e.containerType||e.containerId||(e.containerId=this.conferenceName),e.objectType&&e.objectId&&e.containerType&&e.containerId))||(u.error("Required field missing (containerId, containerType, objectId or objectType)"),!1):(u.error("Required field missing (action, actionSubject or source)"),!1))}},{key:"_maybeCacheEvent",value:function(e){return!!this.cache&&(this.cache.push(e),this.cache.length>100&&this.cache.splice(0,1),!0)}},{key:"_sendEvent",value:function(e){if(this._maybeCacheEvent(e));else{this._appendPermanentProperties(e);var t=!0,n=!1,r=void 0;try{for(var i,o=this.analyticsHandlers[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var a=i.value;try{a.sendEvent(e)}catch(e){u.warn("Error sending analytics event: "+e)}}}catch(e){n=!0,r=e}finally{try{!t&&o.return&&o.return()}finally{if(n)throw r}}}}},{key:"_appendPermanentProperties",value:function(e){e.attributes||(e.attributes={}),e.attributes=Object.assign(e.attributes,this.permanentProperties)}}]),e}();t.a=new l}).call(t,"modules/statistics/AnalyticsAdapter.js")},function(e,t,n){var r=n(19),i=["Aaliyah","Aaron","Abagail","Abbey","Abbie","Abbigail","Abby","Abdiel","Abdul","Abdullah","Abe","Abel","Abelardo","Abigail","Abigale","Abigayle","Abner","Abraham","Ada","Adah","Adalberto","Adaline","Adam","Adan","Addie","Addison","Adela","Adelbert","Adele","Adelia","Adeline","Adell","Adella","Adelle","Aditya","Adolf","Adolfo","Adolph","Adolphus","Adonis","Adrain","Adrian","Adriana","Adrianna","Adriel","Adrien","Adrienne","Afton","Aglae","Agnes","Agustin","Agustina","Ahmad","Ahmed","Aida","Aidan","Aiden","Aileen","Aisha","Aiyana","Akeem","Al","Alaina","Alan","Alana","Alanis","Alanna","Alayna","Alba","Albert","Alberta","Albertha","Alberto","Albin","Albina","Alda","Alden","Alec","Aleen","Alejandra","Alejandrin","Alek","Alena","Alene","Alessandra","Alessandro","Alessia","Aletha","Alex","Alexa","Alexander","Alexandra","Alexandre","Alexandrea","Alexandria","Alexandrine","Alexandro","Alexane","Alexanne","Alexie","Alexis","Alexys","Alexzander","Alf","Alfonso","Alfonzo","Alford","Alfred","Alfreda","Alfredo","Ali","Alia","Alice","Alicia","Alisa","Alisha","Alison","Alivia","Aliya","Aliyah","Aliza","Alize","Allan","Allen","Allene","Allie","Allison","Ally","Alphonso","Alta","Althea","Alva","Alvah","Alvena","Alvera","Alverta","Alvina","Alvis","Alyce","Alycia","Alysa","Alysha","Alyson","Alysson","Amalia","Amanda","Amani","Amara","Amari","Amaya","Amber","Ambrose","Amelia","Amelie","Amely","America","Americo","Amie","Amina","Amir","Amira","Amiya","Amos","Amparo","Amy","Amya","Ana","Anabel","Anabelle","Anahi","Anais","Anastacio","Anastasia","Anderson","Andre","Andreane","Andreanne","Andres","Andrew","Andy","Angel","Angela","Angelica","Angelina","Angeline","Angelita","Angelo","Angie","Angus","Anibal","Anika","Anissa","Anita","Aniya","Aniyah","Anjali","Anna","Annabel","Annabell","Annabelle","Annalise","Annamae","Annamarie","Anne","Annetta","Annette","Annie","Ansel","Ansley","Anthony","Antoinette","Antone","Antonetta","Antonette","Antonia","Antonietta","Antonina","Antonio","Antwan","Antwon","Anya","April","Ara","Araceli","Aracely","Arch","Archibald","Ardella","Arden","Ardith","Arely","Ari","Ariane","Arianna","Aric","Ariel","Arielle","Arjun","Arlene","Arlie","Arlo","Armand","Armando","Armani","Arnaldo","Arne","Arno","Arnold","Arnoldo","Arnulfo","Aron","Art","Arthur","Arturo","Arvel","Arvid","Arvilla","Aryanna","Asa","Asha","Ashlee","Ashleigh","Ashley","Ashly","Ashlynn","Ashton","Ashtyn","Asia","Assunta","Astrid","Athena","Aubree","Aubrey","Audie","Audra","Audreanne","Audrey","August","Augusta","Augustine","Augustus","Aurelia","Aurelie","Aurelio","Aurore","Austen","Austin","Austyn","Autumn","Ava","Avery","Avis","Axel","Ayana","Ayden","Ayla","Aylin","Baby","Bailee","Bailey","Barbara","Barney","Baron","Barrett","Barry","Bart","Bartholome","Barton","Baylee","Beatrice","Beau","Beaulah","Bell","Bella","Belle","Ben","Benedict","Benjamin","Bennett","Bennie","Benny","Benton","Berenice","Bernadette","Bernadine","Bernard","Bernardo","Berneice","Bernhard","Bernice","Bernie","Berniece","Bernita","Berry","Bert","Berta","Bertha","Bertram","Bertrand","Beryl","Bessie","Beth","Bethany","Bethel","Betsy","Bette","Bettie","Betty","Bettye","Beulah","Beverly","Bianka","Bill","Billie","Billy","Birdie","Blair","Blaise","Blake","Blanca","Blanche","Blaze","Bo","Bobbie","Bobby","Bonita","Bonnie","Boris","Boyd","Brad","Braden","Bradford","Bradley","Bradly","Brady","Braeden","Brain","Brandi","Brando","Brandon","Brandt","Brandy","Brandyn","Brannon","Branson","Brant","Braulio","Braxton","Brayan","Breana","Breanna","Breanne","Brenda","Brendan","Brenden","Brendon","Brenna","Brennan","Brennon","Brent","Bret","Brett","Bria","Brian","Briana","Brianne","Brice","Bridget","Bridgette","Bridie","Brielle","Brigitte","Brionna","Brisa","Britney","Brittany","Brock","Broderick","Brody","Brook","Brooke","Brooklyn","Brooks","Brown","Bruce","Bryana","Bryce","Brycen","Bryon","Buck","Bud","Buddy","Buford","Bulah","Burdette","Burley","Burnice","Buster","Cade","Caden","Caesar","Caitlyn","Cale","Caleb","Caleigh","Cali","Calista","Callie","Camden","Cameron","Camila","Camilla","Camille","Camren","Camron","Camryn","Camylle","Candace","Candelario","Candice","Candida","Candido","Cara","Carey","Carissa","Carlee","Carleton","Carley","Carli","Carlie","Carlo","Carlos","Carlotta","Carmel","Carmela","Carmella","Carmelo","Carmen","Carmine","Carol","Carolanne","Carole","Carolina","Caroline","Carolyn","Carolyne","Carrie","Carroll","Carson","Carter","Cary","Casandra","Casey","Casimer","Casimir","Casper","Cassandra","Cassandre","Cassidy","Cassie","Catalina","Caterina","Catharine","Catherine","Cathrine","Cathryn","Cathy","Cayla","Ceasar","Cecelia","Cecil","Cecile","Cecilia","Cedrick","Celestine","Celestino","Celia","Celine","Cesar","Chad","Chadd","Chadrick","Chaim","Chance","Chandler","Chanel","Chanelle","Charity","Charlene","Charles","Charley","Charlie","Charlotte","Chase","Chasity","Chauncey","Chaya","Chaz","Chelsea","Chelsey","Chelsie","Chesley","Chester","Chet","Cheyanne","Cheyenne","Chloe","Chris","Christ","Christa","Christelle","Christian","Christiana","Christina","Christine","Christop","Christophe","Christopher","Christy","Chyna","Ciara","Cicero","Cielo","Cierra","Cindy","Citlalli","Clair","Claire","Clara","Clarabelle","Clare","Clarissa","Clark","Claud","Claude","Claudia","Claudie","Claudine","Clay","Clemens","Clement","Clementina","Clementine","Clemmie","Cleo","Cleora","Cleta","Cletus","Cleve","Cleveland","Clifford","Clifton","Clint","Clinton","Clotilde","Clovis","Cloyd","Clyde","Coby","Cody","Colby","Cole","Coleman","Colin","Colleen","Collin","Colt","Colten","Colton","Columbus","Concepcion","Conner","Connie","Connor","Conor","Conrad","Constance","Constantin","Consuelo","Cooper","Cora","Coralie","Corbin","Cordelia","Cordell","Cordia","Cordie","Corene","Corine","Cornelius","Cornell","Corrine","Cortez","Cortney","Cory","Coty","Courtney","Coy","Craig","Crawford","Creola","Cristal","Cristian","Cristina","Cristobal","Cristopher","Cruz","Crystal","Crystel","Cullen","Curt","Curtis","Cydney","Cynthia","Cyril","Cyrus","Dagmar","Dahlia","Daija","Daisha","Daisy","Dakota","Dale","Dallas","Dallin","Dalton","Damaris","Dameon","Damian","Damien","Damion","Damon","Dan","Dana","Dandre","Dane","D'angelo","Dangelo","Danial","Daniela","Daniella","Danielle","Danika","Dannie","Danny","Dante","Danyka","Daphne","Daphnee","Daphney","Darby","Daren","Darian","Dariana","Darien","Dario","Darion","Darius","Darlene","Daron","Darrel","Darrell","Darren","Darrick","Darrin","Darrion","Darron","Darryl","Darwin","Daryl","Dashawn","Dasia","Dave","David","Davin","Davion","Davon","Davonte","Dawn","Dawson","Dax","Dayana","Dayna","Dayne","Dayton","Dean","Deangelo","Deanna","Deborah","Declan","Dedric","Dedrick","Dee","Deion","Deja","Dejah","Dejon","Dejuan","Delaney","Delbert","Delfina","Delia","Delilah","Dell","Della","Delmer","Delores","Delpha","Delphia","Delphine","Delta","Demarco","Demarcus","Demario","Demetris","Demetrius","Demond","Dena","Denis","Dennis","Deon","Deondre","Deontae","Deonte","Dereck","Derek","Derick","Deron","Derrick","Deshaun","Deshawn","Desiree","Desmond","Dessie","Destany","Destin","Destinee","Destiney","Destini","Destiny","Devan","Devante","Deven","Devin","Devon","Devonte","Devyn","Dewayne","Dewitt","Dexter","Diamond","Diana","Dianna","Diego","Dillan","Dillon","Dimitri","Dina","Dino","Dion","Dixie","Dock","Dolly","Dolores","Domenic","Domenica","Domenick","Domenico","Domingo","Dominic","Dominique","Don","Donald","Donato","Donavon","Donna","Donnell","Donnie","Donny","Dora","Dorcas","Dorian","Doris","Dorothea","Dorothy","Dorris","Dortha","Dorthy","Doug","Douglas","Dovie","Doyle","Drake","Drew","Duane","Dudley","Dulce","Duncan","Durward","Dustin","Dusty","Dwight","Dylan","Earl","Earlene","Earline","Earnest","Earnestine","Easter","Easton","Ebba","Ebony","Ed","Eda","Edd","Eddie","Eden","Edgar","Edgardo","Edison","Edmond","Edmund","Edna","Eduardo","Edward","Edwardo","Edwin","Edwina","Edyth","Edythe","Effie","Efrain","Efren","Eileen","Einar","Eino","Eladio","Elaina","Elbert","Elda","Eldon","Eldora","Eldred","Eldridge","Eleanora","Eleanore","Eleazar","Electa","Elena","Elenor","Elenora","Eleonore","Elfrieda","Eli","Elian","Eliane","Elias","Eliezer","Elijah","Elinor","Elinore","Elisa","Elisabeth","Elise","Eliseo","Elisha","Elissa","Eliza","Elizabeth","Ella","Ellen","Ellie","Elliot","Elliott","Ellis","Ellsworth","Elmer","Elmira","Elmo","Elmore","Elna","Elnora","Elody","Eloisa","Eloise","Elouise","Eloy","Elroy","Elsa","Else","Elsie","Elta","Elton","Elva","Elvera","Elvie","Elvis","Elwin","Elwyn","Elyse","Elyssa","Elza","Emanuel","Emelia","Emelie","Emely","Emerald","Emerson","Emery","Emie","Emil","Emile","Emilia","Emiliano","Emilie","Emilio","Emily","Emma","Emmalee","Emmanuel","Emmanuelle","Emmet","Emmett","Emmie","Emmitt","Emmy","Emory","Ena","Enid","Enoch","Enola","Enos","Enrico","Enrique","Ephraim","Era","Eriberto","Eric","Erica","Erich","Erick","Ericka","Erik","Erika","Erin","Erling","Erna","Ernest","Ernestina","Ernestine","Ernesto","Ernie","Ervin","Erwin","Eryn","Esmeralda","Esperanza","Esta","Esteban","Estefania","Estel","Estell","Estella","Estelle","Estevan","Esther","Estrella","Etha","Ethan","Ethel","Ethelyn","Ethyl","Ettie","Eudora","Eugene","Eugenia","Eula","Eulah","Eulalia","Euna","Eunice","Eusebio","Eva","Evalyn","Evan","Evangeline","Evans","Eve","Eveline","Evelyn","Everardo","Everett","Everette","Evert","Evie","Ewald","Ewell","Ezekiel","Ezequiel","Ezra","Fabian","Fabiola","Fae","Fannie","Fanny","Fatima","Faustino","Fausto","Favian","Fay","Faye","Federico","Felicia","Felicita","Felicity","Felipa","Felipe","Felix","Felton","Fermin","Fern","Fernando","Ferne","Fidel","Filiberto","Filomena","Finn","Fiona","Flavie","Flavio","Fleta","Fletcher","Flo","Florence","Florencio","Florian","Florida","Florine","Flossie","Floy","Floyd","Ford","Forest","Forrest","Foster","Frances","Francesca","Francesco","Francis","Francisca","Francisco","Franco","Frank","Frankie","Franz","Fred","Freda","Freddie","Freddy","Frederic","Frederick","Frederik","Frederique","Fredrick","Fredy","Freeda","Freeman","Freida","Frida","Frieda","Friedrich","Fritz","Furman","Gabe","Gabriel","Gabriella","Gabrielle","Gaetano","Gage","Gail","Gardner","Garett","Garfield","Garland","Garnet","Garnett","Garret","Garrett","Garrick","Garrison","Garry","Garth","Gaston","Gavin","Gay","Gayle","Gaylord","Gene","General","Genesis","Genevieve","Gennaro","Genoveva","Geo","Geoffrey","George","Georgette","Georgiana","Georgianna","Geovanni","Geovanny","Geovany","Gerald","Geraldine","Gerard","Gerardo","Gerda","Gerhard","Germaine","German","Gerry","Gerson","Gertrude","Gia","Gianni","Gideon","Gilbert","Gilberto","Gilda","Giles","Gillian","Gina","Gino","Giovani","Giovanna","Giovanni","Giovanny","Gisselle","Giuseppe","Gladyce","Gladys","Glen","Glenda","Glenna","Glennie","Gloria","Godfrey","Golda","Golden","Gonzalo","Gordon","Grace","Gracie","Graciela","Grady","Graham","Grant","Granville","Grayce","Grayson","Green","Greg","Gregg","Gregoria","Gregorio","Gregory","Greta","Gretchen","Greyson","Griffin","Grover","Guadalupe","Gudrun","Guido","Guillermo","Guiseppe","Gunnar","Gunner","Gus","Gussie","Gust","Gustave","Guy","Gwen","Gwendolyn","Hadley","Hailee","Hailey","Hailie","Hal","Haleigh","Haley","Halie","Halle","Hallie","Hank","Hanna","Hannah","Hans","Hardy","Harley","Harmon","Harmony","Harold","Harrison","Harry","Harvey","Haskell","Hassan","Hassie","Hattie","Haven","Hayden","Haylee","Hayley","Haylie","Hazel","Hazle","Heath","Heather","Heaven","Heber","Hector","Heidi","Helen","Helena","Helene","Helga","Hellen","Helmer","Heloise","Henderson","Henri","Henriette","Henry","Herbert","Herman","Hermann","Hermina","Herminia","Herminio","Hershel","Herta","Hertha","Hester","Hettie","Hilario","Hilbert","Hilda","Hildegard","Hillard","Hillary","Hilma","Hilton","Hipolito","Hiram","Hobart","Holden","Hollie","Hollis","Holly","Hope","Horace","Horacio","Hortense","Hosea","Houston","Howard","Howell","Hoyt","Hubert","Hudson","Hugh","Hulda","Humberto","Hunter","Hyman","Ian","Ibrahim","Icie","Ida","Idell","Idella","Ignacio","Ignatius","Ike","Ila","Ilene","Iliana","Ima","Imani","Imelda","Immanuel","Imogene","Ines","Irma","Irving","Irwin","Isaac","Isabel","Isabell","Isabella","Isabelle","Isac","Isadore","Isai","Isaiah","Isaias","Isidro","Ismael","Isobel","Isom","Israel","Issac","Itzel","Iva","Ivah","Ivory","Ivy","Izabella","Izaiah","Jabari","Jace","Jacey","Jacinthe","Jacinto","Jack","Jackeline","Jackie","Jacklyn","Jackson","Jacky","Jaclyn","Jacquelyn","Jacques","Jacynthe","Jada","Jade","Jaden","Jadon","Jadyn","Jaeden","Jaida","Jaiden","Jailyn","Jaime","Jairo","Jakayla","Jake","Jakob","Jaleel","Jalen","Jalon","Jalyn","Jamaal","Jamal","Jamar","Jamarcus","Jamel","Jameson","Jamey","Jamie","Jamil","Jamir","Jamison","Jammie","Jan","Jana","Janae","Jane","Janelle","Janessa","Janet","Janice","Janick","Janie","Janis","Janiya","Jannie","Jany","Jaquan","Jaquelin","Jaqueline","Jared","Jaren","Jarod","Jaron","Jarred","Jarrell","Jarret","Jarrett","Jarrod","Jarvis","Jasen","Jasmin","Jason","Jasper","Jaunita","Javier","Javon","Javonte","Jay","Jayce","Jaycee","Jayda","Jayde","Jayden","Jaydon","Jaylan","Jaylen","Jaylin","Jaylon","Jayme","Jayne","Jayson","Jazlyn","Jazmin","Jazmyn","Jazmyne","Jean","Jeanette","Jeanie","Jeanne","Jed","Jedediah","Jedidiah","Jeff","Jefferey","Jeffery","Jeffrey","Jeffry","Jena","Jenifer","Jennie","Jennifer","Jennings","Jennyfer","Jensen","Jerad","Jerald","Jeramie","Jeramy","Jerel","Jeremie","Jeremy","Jermain","Jermaine","Jermey","Jerod","Jerome","Jeromy","Jerrell","Jerrod","Jerrold","Jerry","Jess","Jesse","Jessica","Jessie","Jessika","Jessy","Jessyca","Jesus","Jett","Jettie","Jevon","Jewel","Jewell","Jillian","Jimmie","Jimmy","Jo","Joan","Joana","Joanie","Joanne","Joannie","Joanny","Joany","Joaquin","Jocelyn","Jodie","Jody","Joe","Joel","Joelle","Joesph","Joey","Johan","Johann","Johanna","Johathan","John","Johnathan","Johnathon","Johnnie","Johnny","Johnpaul","Johnson","Jolie","Jon","Jonas","Jonatan","Jonathan","Jonathon","Jordan","Jordane","Jordi","Jordon","Jordy","Jordyn","Jorge","Jose","Josefa","Josefina","Joseph","Josephine","Josh","Joshua","Joshuah","Josiah","Josiane","Josianne","Josie","Josue","Jovan","Jovani","Jovanny","Jovany","Joy","Joyce","Juana","Juanita","Judah","Judd","Jude","Judge","Judson","Judy","Jules","Julia","Julian","Juliana","Julianne","Julie","Julien","Juliet","Julio","Julius","June","Junior","Junius","Justen","Justice","Justina","Justine","Juston","Justus","Justyn","Juvenal","Juwan","Kacey","Kaci","Kacie","Kade","Kaden","Kadin","Kaela","Kaelyn","Kaia","Kailee","Kailey","Kailyn","Kaitlin","Kaitlyn","Kale","Kaleb","Kaleigh","Kaley","Kali","Kallie","Kameron","Kamille","Kamren","Kamron","Kamryn","Kane","Kara","Kareem","Karelle","Karen","Kari","Kariane","Karianne","Karina","Karine","Karl","Karlee","Karley","Karli","Karlie","Karolann","Karson","Kasandra","Kasey","Kassandra","Katarina","Katelin","Katelyn","Katelynn","Katharina","Katherine","Katheryn","Kathleen","Kathlyn","Kathryn","Kathryne","Katlyn","Katlynn","Katrina","Katrine","Kattie","Kavon","Kay","Kaya","Kaycee","Kayden","Kayla","Kaylah","Kaylee","Kayleigh","Kayley","Kayli","Kaylie","Kaylin","Keagan","Keanu","Keara","Keaton","Keegan","Keeley","Keely","Keenan","Keira","Keith","Kellen","Kelley","Kelli","Kellie","Kelly","Kelsi","Kelsie","Kelton","Kelvin","Ken","Kendall","Kendra","Kendrick","Kenna","Kennedi","Kennedy","Kenneth","Kennith","Kenny","Kenton","Kenya","Kenyatta","Kenyon","Keon","Keshaun","Keshawn","Keven","Kevin","Kevon","Keyon","Keyshawn","Khalid","Khalil","Kian","Kiana","Kianna","Kiara","Kiarra","Kiel","Kiera","Kieran","Kiley","Kim","Kimberly","King","Kip","Kira","Kirk","Kirsten","Kirstin","Kitty","Kobe","Koby","Kody","Kolby","Kole","Korbin","Korey","Kory","Kraig","Kris","Krista","Kristian","Kristin","Kristina","Kristofer","Kristoffer","Kristopher","Kristy","Krystal","Krystel","Krystina","Kurt","Kurtis","Kyla","Kyle","Kylee","Kyleigh","Kyler","Kylie","Kyra","Lacey","Lacy","Ladarius","Lafayette","Laila","Laisha","Lamar","Lambert","Lamont","Lance","Landen","Lane","Laney","Larissa","Laron","Larry","Larue","Laura","Laurel","Lauren","Laurence","Lauretta","Lauriane","Laurianne","Laurie","Laurine","Laury","Lauryn","Lavada","Lavern","Laverna","Laverne","Lavina","Lavinia","Lavon","Lavonne","Lawrence","Lawson","Layla","Layne","Lazaro","Lea","Leann","Leanna","Leanne","Leatha","Leda","Lee","Leif","Leila","Leilani","Lela","Lelah","Leland","Lelia","Lempi","Lemuel","Lenna","Lennie","Lenny","Lenora","Lenore","Leo","Leola","Leon","Leonard","Leonardo","Leone","Leonel","Leonie","Leonor","Leonora","Leopold","Leopoldo","Leora","Lera","Lesley","Leslie","Lesly","Lessie","Lester","Leta","Letha","Letitia","Levi","Lew","Lewis","Lexi","Lexie","Lexus","Lia","Liam","Liana","Libbie","Libby","Lila","Lilian","Liliana","Liliane","Lilla","Lillian","Lilliana","Lillie","Lilly","Lily","Lilyan","Lina","Lincoln","Linda","Lindsay","Lindsey","Linnea","Linnie","Linwood","Lionel","Lisa","Lisandro","Lisette","Litzy","Liza","Lizeth","Lizzie","Llewellyn","Lloyd","Logan","Lois","Lola","Lolita","Loma","Lon","London","Lonie","Lonnie","Lonny","Lonzo","Lora","Loraine","Loren","Lorena","Lorenz","Lorenza","Lorenzo","Lori","Lorine","Lorna","Lottie","Lou","Louie","Louisa","Lourdes","Louvenia","Lowell","Loy","Loyal","Loyce","Lucas","Luciano","Lucie","Lucienne","Lucile","Lucinda","Lucio","Lucious","Lucius","Lucy","Ludie","Ludwig","Lue","Luella","Luigi","Luis","Luisa","Lukas","Lula","Lulu","Luna","Lupe","Lura","Lurline","Luther","Luz","Lyda","Lydia","Lyla","Lynn","Lyric","Lysanne","Mabel","Mabelle","Mable","Mac","Macey","Maci","Macie","Mack","Mackenzie","Macy","Madaline","Madalyn","Maddison","Madeline","Madelyn","Madelynn","Madge","Madie","Madilyn","Madisen","Madison","Madisyn","Madonna","Madyson","Mae","Maegan","Maeve","Mafalda","Magali","Magdalen","Magdalena","Maggie","Magnolia","Magnus","Maia","Maida","Maiya","Major","Makayla","Makenna","Makenzie","Malachi","Malcolm","Malika","Malinda","Mallie","Mallory","Malvina","Mandy","Manley","Manuel","Manuela","Mara","Marc","Marcel","Marcelina","Marcelino","Marcella","Marcelle","Marcellus","Marcelo","Marcia","Marco","Marcos","Marcus","Margaret","Margarete","Margarett","Margaretta","Margarette","Margarita","Marge","Margie","Margot","Margret","Marguerite","Maria","Mariah","Mariam","Marian","Mariana","Mariane","Marianna","Marianne","Mariano","Maribel","Marie","Mariela","Marielle","Marietta","Marilie","Marilou","Marilyne","Marina","Mario","Marion","Marisa","Marisol","Maritza","Marjolaine","Marjorie","Marjory","Mark","Markus","Marlee","Marlen","Marlene","Marley","Marlin","Marlon","Marques","Marquis","Marquise","Marshall","Marta","Martin","Martina","Martine","Marty","Marvin","Mary","Maryam","Maryjane","Maryse","Mason","Mateo","Mathew","Mathias","Mathilde","Matilda","Matilde","Matt","Matteo","Mattie","Maud","Maude","Maudie","Maureen","Maurice","Mauricio","Maurine","Maverick","Mavis","Max","Maxie","Maxime","Maximilian","Maximillia","Maximillian","Maximo","Maximus","Maxine","Maxwell","May","Maya","Maybell","Maybelle","Maye","Maymie","Maynard","Mayra","Mazie","Mckayla","Mckenna","Mckenzie","Meagan","Meaghan","Meda","Megane","Meggie","Meghan","Mekhi","Melany","Melba","Melisa","Melissa","Mellie","Melody","Melvin","Melvina","Melyna","Melyssa","Mercedes","Meredith","Merl","Merle","Merlin","Merritt","Mertie","Mervin","Meta","Mia","Micaela","Micah","Michael","Michaela","Michale","Micheal","Michel","Michele","Michelle","Miguel","Mikayla","Mike","Mikel","Milan","Miles","Milford","Miller","Millie","Milo","Milton","Mina","Minerva","Minnie","Miracle","Mireille","Mireya","Misael","Missouri","Misty","Mitchel","Mitchell","Mittie","Modesta","Modesto","Mohamed","Mohammad","Mohammed","Moises","Mollie","Molly","Mona","Monica","Monique","Monroe","Monserrat","Monserrate","Montana","Monte","Monty","Morgan","Moriah","Morris","Mortimer","Morton","Mose","Moses","Moshe","Mossie","Mozell","Mozelle","Muhammad","Muriel","Murl","Murphy","Murray","Mustafa","Mya","Myah","Mylene","Myles","Myra","Myriam","Myrl","Myrna","Myron","Myrtice","Myrtie","Myrtis","Myrtle","Nadia","Nakia","Name","Nannie","Naomi","Naomie","Napoleon","Narciso","Nash","Nasir","Nat","Natalia","Natalie","Natasha","Nathan","Nathanael","Nathanial","Nathaniel","Nathen","Nayeli","Neal","Ned","Nedra","Neha","Neil","Nelda","Nella","Nelle","Nellie","Nels","Nelson","Neoma","Nestor","Nettie","Neva","Newell","Newton","Nia","Nicholas","Nicholaus","Nichole","Nick","Nicklaus","Nickolas","Nico","Nicola","Nicolas","Nicole","Nicolette","Nigel","Nikita","Nikki","Nikko","Niko","Nikolas","Nils","Nina","Noah","Noble","Noe","Noel","Noelia","Noemi","Noemie","Noemy","Nola","Nolan","Nona","Nora","Norbert","Norberto","Norene","Norma","Norris","Norval","Norwood","Nova","Novella","Nya","Nyah","Nyasia","Obie","Oceane","Ocie","Octavia","Oda","Odell","Odessa","Odie","Ofelia","Okey","Ola","Olaf","Ole","Olen","Oleta","Olga","Olin","Oliver","Ollie","Oma","Omari","Omer","Ona","Onie","Opal","Ophelia","Ora","Oral","Oran","Oren","Orie","Orin","Orion","Orland","Orlando","Orlo","Orpha","Orrin","Orval","Orville","Osbaldo","Osborne","Oscar","Osvaldo","Oswald","Oswaldo","Otha","Otho","Otilia","Otis","Ottilie","Ottis","Otto","Ova","Owen","Ozella","Pablo","Paige","Palma","Pamela","Pansy","Paolo","Paris","Parker","Pascale","Pasquale","Pat","Patience","Patricia","Patrick","Patsy","Pattie","Paul","Paula","Pauline","Paxton","Payton","Pearl","Pearlie","Pearline","Pedro","Peggie","Penelope","Percival","Percy","Perry","Pete","Peter","Petra","Peyton","Philip","Phoebe","Phyllis","Pierce","Pierre","Pietro","Pink","Pinkie","Piper","Polly","Porter","Precious","Presley","Preston","Price","Prince","Princess","Priscilla","Providenci","Prudence","Queen","Queenie","Quentin","Quincy","Quinn","Quinten","Quinton","Rachael","Rachel","Rachelle","Rae","Raegan","Rafael","Rafaela","Raheem","Rahsaan","Rahul","Raina","Raleigh","Ralph","Ramiro","Ramon","Ramona","Randal","Randall","Randi","Randy","Ransom","Raoul","Raphael","Raphaelle","Raquel","Rashad","Rashawn","Rasheed","Raul","Raven","Ray","Raymond","Raymundo","Reagan","Reanna","Reba","Rebeca","Rebecca","Rebeka","Rebekah","Reece","Reed","Reese","Regan","Reggie","Reginald","Reid","Reilly","Reina","Reinhold","Remington","Rene","Renee","Ressie","Reta","Retha","Retta","Reuben","Reva","Rex","Rey","Reyes","Reymundo","Reyna","Reynold","Rhea","Rhett","Rhianna","Rhiannon","Rhoda","Ricardo","Richard","Richie","Richmond","Rick","Rickey","Rickie","Ricky","Rico","Rigoberto","Riley","Rita","River","Robb","Robbie","Robert","Roberta","Roberto","Robin","Robyn","Rocio","Rocky","Rod","Roderick","Rodger","Rodolfo","Rodrick","Rodrigo","Roel","Rogelio","Roger","Rogers","Rolando","Rollin","Roma","Romaine","Roman","Ron","Ronaldo","Ronny","Roosevelt","Rory","Rosa","Rosalee","Rosalia","Rosalind","Rosalinda","Rosalyn","Rosamond","Rosanna","Rosario","Roscoe","Rose","Rosella","Roselyn","Rosemarie","Rosemary","Rosendo","Rosetta","Rosie","Rosina","Roslyn","Ross","Rossie","Rowan","Rowena","Rowland","Roxane","Roxanne","Roy","Royal","Royce","Rozella","Ruben","Rubie","Ruby","Rubye","Rudolph","Rudy","Rupert","Russ","Russel","Russell","Rusty","Ruth","Ruthe","Ruthie","Ryan","Ryann","Ryder","Rylan","Rylee","Ryleigh","Ryley","Sabina","Sabrina","Sabryna","Sadie","Sadye","Sage","Saige","Sallie","Sally","Salma","Salvador","Salvatore","Sam","Samanta","Samantha","Samara","Samir","Sammie","Sammy","Samson","Sandra","Sandrine","Sandy","Sanford","Santa","Santiago","Santina","Santino","Santos","Sarah","Sarai","Sarina","Sasha","Saul","Savanah","Savanna","Savannah","Savion","Scarlett","Schuyler","Scot","Scottie","Scotty","Seamus","Sean","Sebastian","Sedrick","Selena","Selina","Selmer","Serena","Serenity","Seth","Shad","Shaina","Shakira","Shana","Shane","Shanel","Shanelle","Shania","Shanie","Shaniya","Shanna","Shannon","Shanny","Shanon","Shany","Sharon","Shaun","Shawn","Shawna","Shaylee","Shayna","Shayne","Shea","Sheila","Sheldon","Shemar","Sheridan","Sherman","Sherwood","Shirley","Shyann","Shyanne","Sibyl","Sid","Sidney","Sienna","Sierra","Sigmund","Sigrid","Sigurd","Silas","Sim","Simeon","Simone","Sincere","Sister","Skye","Skyla","Skylar","Sofia","Soledad","Solon","Sonia","Sonny","Sonya","Sophia","Sophie","Spencer","Stacey","Stacy","Stan","Stanford","Stanley","Stanton","Stefan","Stefanie","Stella","Stephan","Stephania","Stephanie","Stephany","Stephen","Stephon","Sterling","Steve","Stevie","Stewart","Stone","Stuart","Summer","Sunny","Susan","Susana","Susanna","Susie","Suzanne","Sven","Syble","Sydnee","Sydney","Sydni","Sydnie","Sylvan","Sylvester","Sylvia","Tabitha","Tad","Talia","Talon","Tamara","Tamia","Tania","Tanner","Tanya","Tara","Taryn","Tate","Tatum","Tatyana","Taurean","Tavares","Taya","Taylor","Teagan","Ted","Telly","Terence","Teresa","Terrance","Terrell","Terrence","Terrill","Terry","Tess","Tessie","Tevin","Thad","Thaddeus","Thalia","Thea","Thelma","Theo","Theodora","Theodore","Theresa","Therese","Theresia","Theron","Thomas","Thora","Thurman","Tia","Tiana","Tianna","Tiara","Tierra","Tiffany","Tillman","Timmothy","Timmy","Timothy","Tina","Tito","Titus","Tobin","Toby","Tod","Tom","Tomas","Tomasa","Tommie","Toney","Toni","Tony","Torey","Torrance","Torrey","Toy","Trace","Tracey","Tracy","Travis","Travon","Tre","Tremaine","Tremayne","Trent","Trenton","Tressa","Tressie","Treva","Trever","Trevion","Trevor","Trey","Trinity","Trisha","Tristian","Tristin","Triston","Troy","Trudie","Trycia","Trystan","Turner","Twila","Tyler","Tyra","Tyree","Tyreek","Tyrel","Tyrell","Tyrese","Tyrique","Tyshawn","Tyson","Ubaldo","Ulices","Ulises","Una","Unique","Urban","Uriah","Uriel","Ursula","Vada","Valentin","Valentina","Valentine","Valerie","Vallie","Van","Vance","Vanessa","Vaughn","Veda","Velda","Vella","Velma","Velva","Vena","Verda","Verdie","Vergie","Verla","Verlie","Vern","Verna","Verner","Vernice","Vernie","Vernon","Verona","Veronica","Vesta","Vicenta","Vicente","Vickie","Vicky","Victor","Victoria","Vida","Vidal","Vilma","Vince","Vincent","Vincenza","Vincenzo","Vinnie","Viola","Violet","Violette","Virgie","Virgil","Virginia","Virginie","Vita","Vito","Viva","Vivian","Viviane","Vivianne","Vivien","Vivienne","Vladimir","Wade","Waino","Waldo","Walker","Wallace","Walter","Walton","Wanda","Ward","Warren","Watson","Wava","Waylon","Wayne","Webster","Weldon","Wellington","Wendell","Wendy","Werner","Westley","Weston","Whitney","Wilber","Wilbert","Wilburn","Wiley","Wilford","Wilfred","Wilfredo","Wilfrid","Wilhelm","Wilhelmine","Will","Willa","Willard","William","Willie","Willis","Willow","Willy","Wilma","Wilmer","Wilson","Wilton","Winfield","Winifred","Winnifred","Winona","Winston","Woodrow","Wyatt","Wyman","Xander","Xavier","Xzavier","Yadira","Yasmeen","Yasmin","Yasmine","Yazmin","Yesenia","Yessenia","Yolanda","Yoshiko","Yvette","Yvonne","Zachariah","Zachary","Zachery","Zack","Zackary","Zackery","Zakary","Zander","Zane","Zaria","Zechariah","Zelda","Zella","Zelma","Zena","Zetta","Zion","Zita","Zoe","Zoey","Zoie","Zoila","Zola","Zora","Zula"];e.exports={generateUsername:function(){return r.randomElement(i)+"-"+r.randomAlphanumStr(3)}}},function(e,t,n){"use strict";(function(e){var r=n(1),i=n(3),o=n.n(i),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0).getLogger(e),c="applicationLog",u="jitsi",l="error",d="event",p="mstWithUserID",h=void 0,f=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.confID=n.confID,this.tpc=t,this.peerconnection=t.peerconnection,this.remoteUserID=n.remoteUserID||u,this.hasFabric=!1,e.fabrics.add(this),e.backendInitialized&&(this._addNewFabric(),1===e.fabrics.size&&e._emptyReportQueue(this))}return a(e,null,[{key:"_addNewFabricCallback",value:function(t,n){e.backend&&"success"!==t&&s.error("Monitoring status: "+t+" msg: "+n)}},{key:"_initCallback",value:function(t,n){if(s.log("CallStats Status: err="+t+" msg="+n),"success"===t){e.backendInitialized=!0;var r=!1,i=null,o=!0,a=!1,c=void 0;try{for(var u,l=e.fabrics.values()[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var d=u.value;d.hasFabric||(s.debug("addNewFabric - initCallback"),d._addNewFabric()&&(r=!0,i||(i=d)))}}catch(e){a=!0,c=e}finally{try{!o&&l.return&&l.return()}finally{if(a)throw c}}r&&e._emptyReportQueue(i)}}},{key:"_emptyReportQueue",value:function(t){var n=t.confID,r=t.peerconnection,i=!0,o=!1,a=void 0;try{for(var s,c=e.reportsQueue[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;if(u.type===l){var h=u.data;e._reportError(t,h.type,h.error,h.pc||r)}else if(u.type===d){var f=u.data;e.backend.sendFabricEvent(u.pc||r,f.event,n,f.eventData)}else if(u.type===p){var m=u.data;e.backend.associateMstWithUserID(u.pc||r,m.callStatsId,n,m.ssrc,m.usageLabel,m.containerId)}}}catch(e){o=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw a}}e.reportsQueue.length=0}},{key:"_reportError",value:function(t,n,r,i){var o=r;o||(s.warn("No error is passed!"),o=new Error("Unknown error")),e.backendInitialized&&t?e.backend.reportError(i,t.confID,n,o):e.reportsQueue.push({type:l,data:{error:o,pc:i,type:n}})}},{key:"_reportEvent",value:function(t,n,r){var i=t&&t.peerconnection,o=t&&t.confID;e.backendInitialized&&t?e.backend.sendFabricEvent(i,n,o,r):e.reportsQueue.push({confID:o,pc:i,type:d,data:{event:n,eventData:r}})}},{key:"_traceAndCatchBackendCalls",value:function(e){var t=!0,n=!1,i=void 0;try{for(var a,u=["associateMstWithUserID","sendFabricEvent","sendUserFeedback"][Symbol.iterator]();!(t=(a=u.next()).done);t=!0)!function(t){var n=e[t];e[t]=function(){try{for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];return n.apply(e,r)}catch(e){o.a.callErrorHandler(e)}}}(a.value)}catch(e){n=!0,i=e}finally{try{!t&&u.return&&u.return()}finally{if(n)throw i}}var l=!0,d=!1,p=void 0;try{for(var h,f=["associateMstWithUserID","sendFabricEvent","sendUserFeedback"][Symbol.iterator]();!(l=(h=f.next()).done);l=!0)!function(t){var n=e[t];e[t]=function(){for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];s.debug(t,i),n.apply(e,i)}}(h.value)}catch(e){d=!0,p=e}finally{try{!l&&f.return&&f.return()}finally{if(d)throw p}}var m=e.reportError;e.reportError=function(t,n,i){for(var a=arguments.length,u=Array(a>3?a-3:0),l=3;l<a;l++)u[l-3]=arguments[l];i===c?r.a.isReactNative()||console&&console.debug("reportError",t,n,i):s.debug.apply(s,["reportError",t,n,i].concat(u));try{m.call.apply(m,[e,t,n,i].concat(u))}catch(e){i===c?console&&console.error("reportError",e):o.a.callErrorHandler(e)}}}},{key:"initBackend",value:function(t){if(e.backend)throw new Error("CallStats backend has been initialized already!");try{var i=r.a.isReactNative()?n(74):callstats;e.backend=new i,e._traceAndCatchBackendCalls(e.backend),e.userID={aliasName:t.aliasName,userName:t.userName},e.callStatsID=t.callStatsID,e.callStatsSecret=t.callStatsSecret;var a=void 0;t.applicationName&&(a={applicationVersion:t.applicationName+" ("+r.a.getName()+")"}),e.backend.initialize(e.callStatsID,e.callStatsSecret,e.userID,e._initCallback,void 0,a);var c=t.getWiFiStatsMethod;return c&&(e.backend.attachWifiStatsHandler(c),c().then(function(e){e&&s.info("Reported wifi addresses:",JSON.parse(e).addresses)}).catch(function(){})),!0}catch(t){return o.a.callErrorHandler(t),e.backend=null,s.error(t),!1}}},{key:"isBackendInitialized",value:function(){return Boolean(e.backend)}},{key:"sendActiveDeviceListEvent",value:function(t,n){e._reportEvent(n,"activeDeviceList",t)}},{key:"sendApplicationLog",value:function(t,n){try{e._reportError(n,c,t,n&&n.peerconnection)}catch(e){console&&"function"==typeof console.error&&console.error("sendApplicationLog failed",e)}}},{key:"sendFeedback",value:function(t,n,r){e.backend?e.backend.sendUserFeedback(t,{userID:e.userID,overall:n,comment:r}):s.error("Failed to submit feedback to CallStats - no backend")}},{key:"sendGetUserMediaFailed",value:function(t,n){e._reportError(n,"getUserMedia",t,null)}},{key:"sendMuteEvent",value:function(t,n,r){var i=void 0;i="video"===n?t?"videoPause":"videoResume":t?"audioMute":"audioUnmute",e._reportEvent(r,i)}},{key:"fabrics",get:function(){return h||(h=new Set),h}}]),a(e,[{key:"_addNewFabric",value:function(){s.info("addNewFabric",this.remoteUserID);try{var t={remoteEndpointType:this.tpc.isP2P?e.backend.endpointType.peer:e.backend.endpointType.server},n=e.backend.addNewFabric(this.peerconnection,this.remoteUserID,e.backend.fabricUsage.multiplex,this.confID,t,e._addNewFabricCallback);this.hasFabric=!0;var r="success"===n.status;return r||s.error("callstats fabric not initilized",n.message),r}catch(e){return o.a.callErrorHandler(e),!1}}},{key:"associateStreamWithVideoTag",value:function(t,n,r,i,o){if(e.backend){var a=n?e.userID:r;e.backendInitialized?e.backend.associateMstWithUserID(this.peerconnection,a,this.confID,t,i,o):e.reportsQueue.push({type:p,pc:this.peerconnection,data:{callStatsId:a,containerId:o,ssrc:t,usageLabel:i}})}}},{key:"sendDominantSpeakerEvent",value:function(){e._reportEvent(this,"dominantSpeaker")}},{key:"sendTerminateEvent",value:function(){e.backendInitialized&&e.backend.sendFabricEvent(this.peerconnection,e.backend.fabricEvent.fabricTerminated,this.confID),e.fabrics.delete(this)}},{key:"sendIceConnectionFailedEvent",value:function(){e._reportError(this,"iceConnectionFailure",null,this.peerconnection)}},{key:"sendCreateOfferFailed",value:function(t){e._reportError(this,"createOffer",t,this.peerconnection)}},{key:"sendCreateAnswerFailed",value:function(t){e._reportError(this,"createAnswer",t,this.peerconnection)}},{key:"sendResumeOrHoldEvent",value:function(t){e._reportEvent(this,t?"fabricResume":"fabricHold")}},{key:"sendScreenSharingEvent",value:function(t,n){var r=void 0;n&&(r={ssrc:n}),e._reportEvent(this,t?"screenShareStart":"screenShareStop",r)}},{key:"sendSetLocalDescFailed",value:function(t){e._reportError(this,"setLocalDescription",t,this.peerconnection)}},{key:"sendSetRemoteDescFailed",value:function(t){e._reportError(this,"setRemoteDescription",t,this.peerconnection)}},{key:"sendAddIceCandidateFailed",value:function(t){e._reportError(this,"addIceCandidate",t,this.peerconnection)}}]),e}();t.a=f,f.backend=null,f.reportsQueue=[],f.backendInitialized=!1,f.callStatsID=null,f.callStatsSecret=null,f.userID=null}).call(t,"modules/statistics/CallStats.js")},function(e,t,n){"use strict";(function(r){var i,o,a;!function(){function r(){function e(){var e=(Math.random()+1).toString(36);return e.substring(2,e.length)}function t(){return window.performance.now?window.performance.now()+window.performance.timing.navigationStart:Date.now()}function r(){return t()+de.currentOffset}function i(e){if(ce&&ce.rtc_rtp_parameters&&ce.rtc_rtp_parameters.encodings){var t=function(e){return Xe[e]?Xe[e]:(Xe[e]={total:0,above:0,ccDriven:0,sumMaxBitrateDiff:0,sumThroughputDiff:0,prevCsioAvgBRKbps:0},Xe[e])},n=0;ce.rtc_rtp_parameters.encodings.forEach(function(e){e&&(n=Math.max(n,e.maxBitrate))});var r=0;if(ue){ue.encodings.forEach(function(e){r=Math.max(r,e.maxBitrate)});var i=0,o=0,a=null,s=null;e.streams.forEach(function(e){var c,u,l,d,p,h,f=e.data,m=t(f.ssrc);"video"===f.mediaType&&e.streamType===Pe.outbound&&(0<r&&.9*r<1e3*f.csioAvgBRKbps?(i=n-r,s=!1):(i=n-1e3*f.csioAvgBRKbps,s=!0),a=0<i,o=f.csioAvgBRKbps-m.prevCsioAvgBRKbps,m.prevCsioAvgBRKbps=f.csioAvgBRKbps,u=i,l=o,d=a,p=s,h=t((c=f).ssrc),c.csioSCSValidationSampleCount=++h.total,h.sumMaxBitrateDiff+=u,c.csioAvgMaxBitrateDiff=h.sumMaxBitrateDiff/h.total,h.sumThroughputDiff+=l,c.csioAvgDeltaThroughput=h.sumThroughputDiff/h.total,d&&(h.above+=1),c.csioMaxBitrateAboveRatio=h.above/h.total,p&&(h.ccDriven+=1),c.csioCCDrivenRatio=h.ccDriven/h.total)})}}else e.streams.forEach(function(e){var t=e.data;"video"===t.mediaType&&e.streamType===Pe.outbound&&(t.csioSCSValidationSampleCount=null,t.csioAvgMaxBitrateDiff=null,t.csioAvgDeltaThroughput=null,t.csioMaxBitrateAboveRatio=null,t.csioCCDrivenRatio=null)})}function o(){return window.performance.now?window.performance.now():null}function a(e,t,n,r){var i,a=document.getElementById(t);a&&(a.oncanplay=function(){i=le[e].ucID;var t,a,s,c,u,l,d=ht(e,n);d&&(t=i,a=d.remoteUserID,c=r,u=ft(s=e,n),l=null,u&&(l=o(),nt(be.mediaPlaybackStartEvent,a,s,t,{ssrc:c,highResTs:l},u,null)))},a.onsuspend=function(){i=le[e].ucID;var t,a,s,c,u,l,d=ht(e,n);d&&(t=i,a=d.remoteUserID,c=r,u=ft(s=e,n),l=null,u&&(l=o(),nt(be.mediaSuspendedEvent,a,s,t,{ssrc:c,highResTs:l},u,null)))})}function s(e){var t=W.codebase,n=!1;if(null===e)n=!1;else if(t===He.firefox){var r=typeof mozRTCPeerConnection,i=typeof RTCPeerConnection;"undefined"!==r&&e instanceof mozRTCPeerConnection?n=!0:"undefined"!==i&&e instanceof RTCPeerConnection&&(n=!0)}else null!==ge&&e instanceof ge&&(n=!0),"function"!=typeof e&&t!==He.edge||(n=!0),void 0!==typeof e.createOffer&&(n=!0);return n}function c(e,t,n,r){var i=[];return n===He.firefox?i=t:t&&(i=function(e,t,n){var r,i,o,a,s,c,u,l,d=[];if(void 0!==e.lastStatsSent&&void 0!==e.lastStatsSent.statistics.Transport)for(o=e.lastStatsSent.statistics.Transport,a=e.latestEventSent,s=void 0,r=0;r<t.length;r++){for(s=void 0,i=0;i<o.length;i++)if(t[r].hash===o[i].hash){s=o[i];break}void 0!==s&&(c=parseInt(s.bytesReceived,10),u=parseInt(s.bytesSent,10),(l=n-a)>0&&(t[r].csioReceivedBwKbps=8*(parseInt(t[r].bytesReceived,10)-c)/l,t[r].csioSentBwKbps=8*(parseInt(t[r].bytesSent,10)-u)/l,t[r].csioIntBytesReceived=parseInt(t[r].bytesReceived,10)-c,t[r].csioIntBytesSent=parseInt(t[r].bytesSent,10)-u,void 0!==s.packetsSent&&void 0!==t[r].packetsSent&&(t[r].csioSentPacketRate=(parseInt(t[r].packetsSent,10)-parseInt(s.packetsSent,10))/(l/1e3),t[r].csioIntPacketsSent=parseInt(t[r].packetsSent,10)-parseInt(s.packetsSent,10)),void 0!==s.packetsReceived&&void 0!==t[r].packetsReceived&&(t[r].csioReceivedPacketRate=(parseInt(t[r].packetsReceived,10)-parseInt(s.packetsReceived,10))/(l/1e3),t[r].csioIntPacketsReceived=parseInt(t[r].packetsReceived,10)-parseInt(s.packetsReceived,10))),d.push(t[r]))}return d}(e,t,r)),i}function u(e,t){for(var n in t)t.hasOwnProperty(n)&&"id"!==n&&"type"!==n&&"timestamp"!==n&&(e[n]=t[n]);return e}function l(e,n,o,a,s){return function(u){if(u){var l=r(),f=t();void 0===a.lastRawStatsSentInterval||null===a.lastRawStatsSentInterval?a.lastRawStatsSentInterval=f-a.statsPollingStart:a.lastRawStatsSentInterval=f-a.rawstatsTS+a.lastRawStatsSentInterval,void 0===a.lastProcessedStatsSentInterval||null===a.lastProcessedStatsSentInterval?a.lastProcessedStatsSentInterval=$+1:a.lastProcessedStatsSentInterval=f-a.rawstatsTS+a.lastProcessedStatsSentInterval,a.rawstatsTS=f;var m={},v=W.codebase,y=a.conferenceID,b=a.remoteUserID;m.version=R,m.appID=N,m.conferenceID=encodeURIComponent(y),m.apiTS=l,m.timeShift=0,m.fabricState=a.pcState,m.pcID=a.pcHash,void 0!==o&&(m.ucID=o),re.authToken&&(m.token=re.authToken),m.localID=encodeURIComponent(n),m.remoteID=b?encodeURIComponent(b):null,m.deviceID=j;var S,_,T,C,E,w,k,I={streams:[]},P=!1,A=!1,x={},L={};for(k=vt(u),S=0;S<k.length;++S)if(_=p(k[S]),T=d(_),!h(T))if(T.hasOwnProperty("Transport"))C="Transport",I.hasOwnProperty(C)||(I[C]=[]),v!==He.firefox?(parseInt(T[C].bytesReceived,10)>0||parseInt(T[C].bytesSent,10)>0)&&(I[C].push(T[C]),"true"!==T[C].googActiveConnection&&!0!==T[C].googActiveConnection||(m.activeConnectionIndex=I[C].length)):(I[C].push(T[C]),"true"!==T[C].selected&&!0!==T[C].selected||(m.activeConnectionIndex=I[C].length));else if(T.localCandidate)x[T.localCandidate.id]=T.localCandidate;else if(T.remoteCandidate)L[T.remoteCandidate.id]=T.remoteCandidate;else if(T.bwe)I.bwe=T.bwe;else if(T.trackStats)I.trackStats||(I.trackStats=[]),I.trackStats.push(T.trackStats);else if(T.codec)I.codec||(I.codec=[]),I.codec.push(T.codec);else if(T.candidatePair)I.candidatePair||(I.candidatePair=[]),I.candidatePair.push(T.candidatePair);else{void 0!==(w=Ze(a,T.ssrc))&&w.localStartTime||(tt(b,y,o,a,s,null)&&(A=!0),w=Ze(a,T.ssrc)),w&&(E=w.remoteUserID),void 0===E&&(E=b);var M={userID:E,data:T.data,reportType:T.reportType,streamType:T.streamType,ssrc:T.ssrc};void 0!==w&&(M.cname=w.cname,M.msid=w.msid,M.associatedVideoTag=w.associatedVideoTag,M.usage=w.usageLabel),I.streams.push(M)}if(m.statistics=I,I.Transport&&(P=function(e,t){var n,r,i,o,a,s,c,u,l,d=!1,p="None",h=!1,f=W.codebase,m=function(e){if(e.typePreference){var t=e.typePreference>>24;return"rtp"===e.protocol&&e.address===n&&(t>=0&&t<=2&&(p=function(e){var t="None";switch(e){case 0:t="TURN/TLS";break;case 1:t="TURN/TCP";break;case 2:t="TURN/UDP"}return t}(t)),!0)}return!1};for(c=0;c<e.length;c++)if(u=e[c],f!==He.firefox||"candidatepair"!==u.type||"true"!==u.selected&&!0!==u.selected?"googCandidatePair"!==u.type||"true"!==u.googActiveConnection&&!0!==u.googActiveConnection?"transport"===u.type&&(h=!0,u.selectedCandidatePairId&&(l=u.selectedCandidatePairId)):(h=!0,n=u.googLocalAddress,r=u.googRemoteAddress,i=u.googLocalCandidateType,o=u.googRemoteCandidateType,a=u.googTransportType):(h=!0,n=u.localAddr,r=u.remoteAddr,i=u.localAddrType,o=u.remoteAddrType,a=u.transportType),h){n&&(s=0===n.indexOf("[")),t.iceCandidates.some(m);break}if(!h)return d;var v=t.transportData;return void 0!==v&&v.localAddr===n&&v.remoteAddr===r&&v.transportType===a&&v.selectedCandidatePairId===l||(t.transportData={localAddr:n,remoteAddr:r,localAddrType:i,remoteAddrType:o,transportType:a,ipv6:s,relayType:p,selectedCandidatePairId:l},d=!0),d}(I.Transport,a)),P&&Ft(s,be.fabricTransportSwitch,y),I.Transport||v!==He.firefox||(I.Transport=I.candidatePair.filter(function(e){return!(!e.selected&&"true"!==e.selected)})),I.Transport)for(var F=0;F<I.Transport.length;F++)I.Transport[F].hash=(ge=I.Transport[F],ye=v,_e=void 0,ge&&(ye===He.chrome?ge.googLocalAddress?(_e=ge.googLocalAddress).concat(":",ge.googRemoteAddress):ge.selectedCandidatePairId&&(_e=ge.selectedCandidatePairId):ye===He.firefox&&(ge.localAddr?(_e=ge.localAddr).concat(":",ge.remoteAddr):ge.selectedCandidatePairId&&(_e=ge.selectedCandidatePairId))),ut(_e));a.pcState===De.disrupted&&function(e){var t,n=e.statistics.outbound;if(void 0!==n)for(t in n)n.hasOwnProperty(t)&&(n[t].data.mozRtt?n[t].data.mozRtt=0:n[t].data.googRtt?n[t].data.googRtt=0:n[t].data.rtt?n[t].data.rtt=0:n[t].data.roundTripTime&&(n[t].data.roundTripTime=0))}(m),I.trackStats&&(I=Jt(I)),I.Transport&&I.candidatePair&&(I=Gt(I)),A&&nt(be.ssrcMap,b,y,o,et(a),a.pcHash),se&&(nt(Se.senderConfiguration,b,y,o,ce,a.pcHash),se=!1);var U={},H={response:null},B={response:null},G={response:null},J=null;if(O.fire(O.events.OnPolling,{streams:I.streams,codeBase:v}),O.fire(O.events.OnOneWayAudioDisruptionsRequest,B),null!==B.response&&B.response.forEach(function(e){J={mediaType:e.mediaType,ssrc:e.ssrc,disruptionType:e.type},nt(be.oneWayMedia,b,y,o,J,a.pcHash)}),O.fire(O.events.OnSendingThroughputObservationsRequest,G),null!==G.response&&(J=G.response,nt(Se.sendingThroughputObservations,b,y,o,J,a.pcHash)),O.fire(O.events.OnStatsRequest,H),null!==H.response){if(H.response.streams)for(S=0;S<H.response.streams.length;S++)fe=H.response.streams[S],me=a,ve=void 0,ve=null,me.ssrcMap.hasOwnProperty(fe.data.ssrc)&&(me.ssrcMap[fe.data.ssrc].mediaType=fe.data.mediaType,fe.data.googCodecName?ve=fe.data.googCodecName:fe.data.codec&&(ve=fe.data.codec),me.ssrcMap[fe.data.ssrc].codec=ve,fe.data.codecImplementationName&&(me.ssrcMap[fe.data.ssrc].codecImplementationName=fe.data.codecImplementationName));U.streams=H.response.streams;for(var V=0<Z.length,q=0,K=function(e){e.data.ssrc===q&&(V|="audio"===e.mediaType&&e.streamType===Pe.inbound)};0<Z.length;)q=Z.shift(),U.streams.forEach(K);if(V){var z={mediaType:"audio",ssrc:null,disruptionType:Ae.noInboundAudioOnlyFabric};nt(be.oneWayMedia,b,y,o,z,a.pcHash)}if(U.fabricState=a.pcState,U.connectionState=!0===navigator.onLine?"online":"offline",I.Transport&&(U.Transport=c(a,I.Transport,v,l)),I.bwe&&(U.bwe=I.bwe),void 0===a.processedStatsTupleArray&&(a.processedStatsTupleArray=[]),Q.stats){var X=(le=U,de={},he=Qt.getConferenceURL(),le.connectionState&&(de.connectionState=le.connectionState),le.fabricState&&(de.fabricState=le.fabricState),he&&(de.conferenceURL=he),de.streams={},null===le.streams?de:(le.streams.forEach(function(e){var t={cname:e.cname,ssrc:e.ssrc,msid:e.msid,remoteUserID:e.userID,usageLabel:e.usage,associatedVideoTag:e.associatedVideoTag};e.data.hasOwnProperty("csioIntFL")&&(t.fractionLoss=e.data.csioIntFL),e.data.hasOwnProperty("csioIntBRKbps")&&(t.bitrate=e.data.csioIntBRKbps),e.data.hasOwnProperty("csioMark")&&(t.quality=e.data.csioMark),e.data.hasOwnProperty("csioMediaType")&&(t.mediaType=e.data.csioMediaType),e.data.hasOwnProperty("googRtt")&&(t.rtt=e.data.googRtt),e.data.hasOwnProperty("mozRtt")&&(t.rtt=e.data.mozRtt),e.data.hasOwnProperty("roundTripTime")&&(t.rtt=e.data.roundTripTime),e.data.hasOwnProperty("jitter")&&(t.jitter=e.data.jitter),e.data.hasOwnProperty("googJitterReceived")&&(t.jitter=e.data.googJitterReceived),e.data.hasOwnProperty("audioOutputLevel")&&(t.audioOutputLevel=e.data.audioOutputLevel),e.data.hasOwnProperty("audioInputLevel")&&(t.audioInputLevel=e.data.audioInputLevel),e.data.hasOwnProperty("audioLevel")&&(t.audioLevel=e.data.audioLevel),e.data.hasOwnProperty("csioAvgRtt")&&(t.averageRTT=e.data.csioAvgRtt),e.data.hasOwnProperty("csioAvgJitter")&&(t.averageJitter=e.data.csioAvgJitter),e.data.hasOwnProperty("csioPktLossPercentage")&&(t.packetLossPercentage=e.data.csioPktLossPercentage),e.reportType&&"local"===e.reportType?e.streamType&&(t.statsType=e.streamType+"-rtp"):e.reportType&&"remote"===e.reportType&&e.streamType&&(t.statsType="remote-"+e.streamType+"-rtp"),de.streams[e.ssrc]=t}),de));Q.stats(X)}U.apiTS=l,U.batteryStatus={},U.batteryStatus.batteryLevel=function(){if(oe)return oe.level}(),U.batteryStatus.isBatteryCharging=function(){if(oe)return oe.charging}(),U.wifiStats=D,i(U=function(e){var t,n,r;for(t in e.streams)if(e.streams.hasOwnProperty(t)){if(e.streams[t].inbound)for(r in e.streams[t].inbound)e.streams[t].inbound.hasOwnProperty(r)&&(n=e.streams[t].inbound[r].mark,n===Oe.bad?e.streams[t].inbound[r].mark=2:n===Oe.fair?e.streams[t].inbound[r].mark=1:e.streams[t].inbound[r].mark=0);if(e.streams[t].outbound)for(r in e.streams[t].outbound)e.streams[t].outbound.hasOwnProperty(r)&&(n=e.streams[t].outbound[r].mark,n===Oe.bad?e.streams[t].outbound[r].mark=2:n===Oe.fair?e.streams[t].outbound[r].mark=1:e.streams[t].outbound[r].mark=0)}return e}(U)),a.processedStatsTupleArray.push(U),m.processedStatistics=a.processedStatsTupleArray,a.lastStatsSent=m;var Y=function e(t){var n;if(null===t||"object"!=typeof t)return t;if(t instanceof Array){n=[];for(var r=0,i=t.length;r<i;r++)n[r]=e(t[r]);return n}if(t instanceof Object){n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=e(t[o]));return n}}(m);delete Y.statistics,a.lastProcessedStatsSentInterval>=$&&(a.processedStatsTupleArray=[],te.add(Y,Y.processedStatistics.length),Y.msgStat=te.getStat(),ne=Y,ie=a,ae=e,ue=r(),ne.hasOwnProperty("token")&&ne.hasOwnProperty("ucID")&&!pe?(g(Se.processedStats,ne,ae),ie.latestEventSent=ue,ie.lastFabricState=ie.pcState):(ne.clockUnsynced=pe,ee.cacheEvent({channel:Se.processedStats,data:ne})),a.lastProcessedStatsSentInterval=0)}}var ne,ie,ae,ue,le,de,he,fe,me,ve,ge,ye,_e}}function d(e){var t={};if("inboundrtp"===e.type||"outboundrtp"===e.type||"inbound-rtp"===e.type||"outbound-rtp"===e.type){if(t.ssrc=e.ssrc,t.streamType="inboundrtp"===e.type||"inbound-rtp"===e.type?"inbound":"outbound","Safari"===W.name&&!e.mediaType){e.id.includes("Audio")?e.mediaType="audio":e.id.includes("Video")&&(e.mediaType="video");var n=e.id.split("_");if(n[1])try{e.ssrc=parseInt(n[1]),t.ssrc=e.ssrc}catch(e){}}t.data=e,void 0!==e.isRemote?t.reportType="true"===e.isRemote||!0===e.isRemote?"remote":"local":t.reportType="local",e.trackId&&(t.trackId=e.trackId),e.mediaType&&(t.mediaType=e.mediaType)}else"candidatepair"===e.type&&e.selected?t.Transport=e:"localcandidate"===e.type||"local-candidate"===e.type?t.localCandidate=e:"remotecandidate"===e.type||"remote-candidate"===e.type?t.remoteCandidate=e:"transport"===e.type||"googCandidatePair"===e.type?t.Transport=e:"VideoBwe"===e.type?t.bwe=e:"track"===e.type?t.trackStats=e:"candidate-pair"===e.type?t.candidatePair=e:"codec"===e.type?t.codec=e:"ssrc"===e.type&&(t.reportType="local",e.bytesSent?t.streamType="outbound":t.streamType="inbound",t.ssrc=e.ssrc,t.data=e);return t}function p(e){var t,n={};e.timestamp instanceof Date&&(n.timestamp=e.timestamp.getTime().toString()),e.type&&(n.type=e.type);var r=0;if(e.names){var i=e.names();for(r=0;r<i.length;++r)n[i[r]]=e.stat(i[r])}else for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);if(n.values){for(r=0;r<n.values.length;++r){e=n.values[r];for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t])}delete n.values}return n}function h(e){if(null===e)return!0;if(e.length>0)return!1;if(0===e.length)return!0;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}function f(e){return clearInterval(e),null}function m(){de.syncHandler||(Ke(N,L,"log",{msg:"start clockSync"}),de.offsetResults=[],Kt(),de.syncHandler=!0)}function v(e){try{if(window&&window.sessionStorage){var t=JSON.parse(window.sessionStorage.getItem("csio_ucid_data"));if(t&&t[e])return t[e].ucID}}catch(e){return null}return null}function g(e,t,n){var r=t.action,i=t.remoteID,o=t.ucID;t.channel=e,re._isTokenValid(re.authToken,N,L)?(o&&!pe&&i||-1!==Be.indexOf(r))&&t.conferenceID!==A?(t.token=re.authToken,$t(e,t,n),n&&r&&n(Ee.success,r+" sent to the backend.")):(t.clockUnsynced=pe,ee.cacheEvent({channel:e,data:t,callback:n})):re.sendAuthenticationRequest(N,L,function(a,s){a!==Ee.success?(a===we.authOngoing&&(t.clockUnsynced=pe,ee.cacheEvent({channel:e,data:t,callback:n})),n&&a!==we.authOngoing&&n(a,s)):a===Ee.success&&"SDK authentication successful."===s&&((o&&!pe&&i||-1!==Be.indexOf(r))&&t.conferenceID!==A?(t.token=re.authToken,$t(e,t,n),n&&r&&n(Ee.success,r+" sent to the backend.")):(t.clockUnsynced=pe,ee.cacheEvent({channel:e,data:t,callback:n})))})}function y(){fe||(fe=setInterval(function(){!function(){var e={};Object.keys(le).forEach(function(t){var n=le[t];if(!n)return!0;var r,i,o={ucID:n.ucID,userJoinedSent:n.userJoinedSent},a=[];if(n.participants){var s,c=n.participants;for(r=0;r<c.length;r++)i={},s=c[r],i={pcID:s.pcHash,pcState:s.pcState,iceConnectionState:s.iceConnectionState,iceGatheringState:s.iceGatheringState,iceCandidatesNumber:s.iceCandidates.length,remoteUserID:s.remoteUserID},a.push(i)}o.participants=a,e[t]=o});var t={authStatus:!!re.tokenData,clockSync:!pe,stateMachine:e,pageURL:window.location.href,eventType:"warn",version:R};t.wsStatus=Qt.getWSConnectionState(),Ke(N,L,"stateMachine",t)}()},me))}function b(){f(fe),fe=null}var S,_=n(75),T=n(76),C=n(83),E="https://collector.callstats.io:443/",w="https://auth.callstats.io/",R="3.27.0",k="wss://collector.callstats.io:443/csiows/collectCallStats",I="https://dashboard.callstats.io/api-internal/v1/qmodelthresholds",P="https://appsettings.callstats.io/v1/apps/",A="csio-conf-id-tmp",O=new T.Reporter,D=null;window&&(window.csioChromeLegacyGetStats=!0);var x,N=null,L=null,M=null,j=null,F=!1,U=!1,H="",B=function(e,t){var n="precalltest error ("+e+"): "+t;console.warn(n),Ke&&Ke(N,L,"log",{msg:n}),H+="(error)"},G=n(84),J=null;try{J=new G.PreCallTest}catch(e){B("initializing",e)}var V,W,q,K=[],z={create:Date.now()},Q={stats:null,defaultConfig:null,recommendedConfig:null,preCallTest:null},$=15e3,X=!1,Y=!0,Z=[],ee=new function(){function e(e,t){setTimeout(function(){var t=r()-e.data.apiTS;e.data.timeShift=t,g(e.channel,e.data,e.callback)},t)}this.eventCache=[],this.updateRemoteUserID=function(e,t){for(var n,r=0;r<this.eventCache.length;r++)n=this.eventCache[r],n.data.pcID===t&&(n.data.remoteID=e)},this.sendCachedEvents=function(t,n,i,o,a,s){if(0!==this.eventCache.length){if(!t.authToken)return void t.sendAuthenticationRequest(N,L);if(!n){var c,u,l,d,p=r(),h=[],f=Math.max($/this.eventCache.length,ve);for(c=0;c<this.eventCache.length;c++)if(l=this.eventCache[c],!l.data.remoteID&&l.data.pcID||l.data.conferenceID===A)h.push(this.eventCache[c]);else if(l.data.action!==be.userJoined){if(l.data.token=t.authToken,i&&l.data.apiTS>=p-o||!l.data.ucID)if(d=decodeURIComponent(l.data.conferenceID),le[d]&&le[d].ucID)l.data.ucID=le[d].ucID;else{if(d!==a){h.push(this.eventCache[c]);continue}l.data.ucID=s}if(l.data.clockUnsynced&&(l.data.apiTS+=de.currentOffset),l.channel===Se.processedStats&&l.data.clockUnsynced&&l.data.processedStatistics&&l.data.processedStatistics.length>0)for(u=0;u<l.data.processedStatistics.length;u++)l.data.processedStatistics[u].apiTS+=de.currentOffset;delete l.data.clockUnsynced,e(l,f*(c+1))}else h.push(this.eventCache[c]);this.eventCache=h}}},this.sendCachedUserJoinedEvents=function(t){if(0!==this.eventCache.length){if(!t.authToken)return void t.sendAuthenticationRequest(N,L);var n,r,i=[],o=Math.max($/this.eventCache.length,ve);for(n=0;n<this.eventCache.length;n++)r=this.eventCache[n],!r.data.remoteID&&r.data.pcID||r.data.conferenceID===A?i.push(this.eventCache[n]):r.data.action===be.userJoined||r.data.action===ye.fabricSetupFailed?(r.data.token=t.authToken,r.data.clockUnsynced&&(r.data.apiTS=r.data.apiTS+de.currentOffset),r.data.value&&(r.data.value.statsSubmissionInterval=$),e(r,o*(n+1))):i.push(this.eventCache[n]);this.eventCache=i}},this.updateConferenceId=function(e){for(var t,n=0;n<this.eventCache.length;n++)t=this.eventCache[n],t.data.conferenceID===A&&(t.data.conferenceID=e)},this.cacheEvent=function(e){this.eventCache.push(e)},this.sendCachedFeedback=function(){var e=Je("feedback"),t=JSON.parse(Je("csio_auth_data"));if(e&&t){var n=JSON.parse(e),r=t===n.token;r||L!==n.userID||(n.token=t,r=!0),r?g(Se.userFeedback,n):Ve("feedback")}}},te=new function(){this.stat=new function(){this.size_max=0,this.size_ewma=0,this.statNum_max=0,this.statNum_ewma=0,this.msg_num=0,this.maxInterval=0,this.minInterval=0,this.avgInterval=0,this.stdInterval=0},this.lastTime=null,this.samplesCount=0,this.add=function(e,n){var r=this.memorySizeOf(e);if(this.stat.size_ewma=.5*this.stat.size_ewma+.5*r,this.stat.size_max<r&&(this.stat.size_max=r),this.stat.statNum_ewma=.5*this.stat.statNum_ewma+.5*n,this.stat.statNum_max<n&&(this.stat.statNum_max=n),this.stat.msg_num+=1,null!==this.lastTime){var i=t()-this.lastTime;this.lastTime=t(),(0===this.stat.maxInterval||this.stat.maxInterval<i)&&(this.maxInterval=i),(0===this.stat.minInterval||i<this.stat.minInterval)&&(this.minInterval=i),this.stat.avgInterval=(this.stat.avgInterval*this.samplesCount+i)/(this.samplesCount+n),this.samplesCount+=n,this.stat.stdInterval=(31*this.stat.stdInterval+Math.abs(this.stat.avgInterval-i))/32}else this.lastTime=t()},this.getStat=function(){return this.stat},this.memorySizeOf=function(e){var t=0;return function e(n){if(null!==n&&void 0!==n)switch(typeof n){case"number":t+=8;break;case"string":t+=2*n.length;break;case"boolean":t+=4;break;case"object":var r=Object.prototype.toString.call(n).slice(8,-1);if("Object"===r||"Array"===r)for(var i in n)n.hasOwnProperty(i)&&e(n[i]);else t+=2*n.toString().length}return t}(e)}},ne="appSecret",re=new function(){var e=this,t="urn:x-callstats:auth:errorActions";this.authInProgress=!1,this.tokenData=null,this.authToken=null,this.type=ne,this.tokenGenerator=function(e,t){t("Token generator not set")};var n=null,i=null,o=!1,a=window.atob,s=window.btoa,c=["Authentication Internal Error","Invalid Credentials","Invalid Credentials","Invalid Credentials","Invalid Credentials","Origin URL missmatch","Invalid Credentials","Authentication Protocol Error"],u=function(e){return s(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,"")},l=function(e){return(t=e,s(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,"");var t},d={cryptotype:null};window.crypto&&window.crypto.subtle?(d.cryptotype="standard",d.subtlecrypto=window.crypto.subtle):window.crypto&&!window.crypto.subtle&&window.crypto.webkitSubtle?(d.cryptotype="webkit",d.subtlecrypto=window.crypto.webkitSubtle):window.msCrypto&&window.msCrypto.subtle?(d.cryptotype="ie",d.subtlecrypto=window.msCrypto.subtle):(d.subtlecrypto=null,console.info("WebCryptography API not supported in this browser.")),d.sign=function(e,t,n,r){if("HS256"!==e.alg)return r("Use header.alg=HS256");e=JSON.stringify(e),"string"!=typeof t&&(t=JSON.stringify(t));var i=l(e)+"."+l(t);if(window.csioReactNative)window.csiosign(i,n,function(e,t){return e?(console.log("Token sign error",e),r(e)):r(null,t)});else{for(var o=new ArrayBuffer(i.length),a=new Uint8Array(o),s=i.length-1;s>=0;s--)a[s]=i.charCodeAt(s);var c=function(e){for(var t="",n=new Uint8Array(e),o=n.byteLength,a=0;a<o;a++)t+=String.fromCharCode(n[a]);return i+="."+u(t),r(null,i)},p=function(e){return r(e)},h={name:"HMAC"};"ie"!==d.cryptotype&&"webkit"!==d.cryptotype||(h.hash={name:"sha-256"});var f=d.subtlecrypto.sign(h,n,a);"ie"===d.cryptotype?(f.onerror=p,f.oncomplete=function(e){c(e.target.result)}):f.then(c).catch(p)}},d.decode=function(e){try{return JSON.parse(a(e.split(".")[1]))}catch(e){return console.error("Couldn't decode token. ",e),null}},d.importKey=function(e,t,n){if(window.csioReactNative)t(e);else{if("webkit"===d.cryptotype)for(;e.length<32;)e+="\0";var r={kty:"oct",k:u(e),alg:"HS256"},i={name:"HMAC",hash:{name:"SHA-256"}};if("ie"===d.cryptotype?r.extractable=!1:r.ext=!1,"webkit"===d.cryptotype&&(i=null,r.use="sig"),"ie"===d.cryptotype||"webkit"===d.cryptotype){var o=JSON.stringify(r);r=new Uint8Array(o.length);for(var a=0;a<o.length;a++)r[a]=o.charCodeAt(a)}var s=d.subtlecrypto.importKey("jwk",r,i,!1,["sign"]);"ie"===d.cryptotype?(s.onerror=n,s.oncomplete=function(e){t(e.target.result)}):s.then(t).catch(n)}},this.setAuthType=function(e){this.type=e},this._isTokenValid=function(e,t,n){var i=!1,o=W.codebase;if(null===e)return!1;try{var a=d.decode(e);if(null!==a&&a.appID===t&&a.userID===encodeURIComponent(n)){var s=null;if(o===He.firefox){var c=a.expiry.split(" ").join("T");s=Date.parse(c)}else s=new Date(a.expiry);new Date(r())<s&&(i=!0)}return i}catch(e){}return!1},this.setupAuthToken=function(e){Ge("csio_auth_data",JSON.stringify(e)),this.authToken=e,this.tokenData=d.decode(e),$=parseInt(this.tokenData.submissionInterval,10),O.setSubmissionInterval($),O.setReportingMode(this.tokenData.adaptiveInterval),X=this.tokenData.collectSDP},this.sendAuthenticationRequest=function(r,i,a){if(r&&i){if(e.authInProgress)return void((s=a)&&s(we.authOngoing,"Authentication Ongoing"));null!==n&&(clearTimeout(n),n=null),p(),e.authInProgress=!0,e.tokenGenerator(o,function(s,c){if(null!==s)return e.authInProgress=!1,void(a&&a(Ee.tokenGenerationError,s.toString()));Wt(w+"authenticate",{client_id:i+"@"+N,code:c,grant_type:"authorization_code"},function(s,c){var u=null;e.authInProgress=!1,z.auth=c;try{u=JSON.parse(s.response)}catch(e){console.error("Authentication response parse error")}if(u)if(200===s.status){if("bearer"!==u.token_type)return console.error("Authentication was successful, but token type was not bearer. Scheduling retry."),void(n=setTimeout(e.sendAuthenticationRequest,5e3,r,i,a));e.setupAuthToken(u.access_token);var l=parseInt(1e3*parseInt(u.expires_in)*.9);if(h(l,r,i,a),o=!1,a&&a(Ee.success,"SDK authentication successful."),u.iceServers&&!U&&J)try{H=u.iceServers[0].username+" ",J.start(u.iceServers,dt.bind(this)),Ke(N,L,"log",{msg:"precalltest started "+H}),H+="(started)"}catch(e){B("start",e),J.crashDisconnect()}U&&(Ke(N,L,"log",{msg:"precalltest disabled "+H}),H+="(disabled)"),pt(),Qt._isChannelReady()?(ee.sendCachedUserJoinedEvents(re),a&&a(Ee.success,"WebSocket establishment successful.")):Qt._setupWebSocketConnection(function(e,t){a&&a(e,t)})}else{if(u[t]&&u[t].length>0)return f(r,i,a,u[t],e.type);console.error("Authentication failed, but no error actions were defined in response."),n=setTimeout(e.sendAuthenticationRequest,5e3,r,i,a)}else n=setTimeout(e.sendAuthenticationRequest,5e3,r,i,a)})})}var s};var p=function(){null!==i&&(clearTimeout(i),i=null)},h=function(t,n,r,o){p(),i=setTimeout(function(){e.sendAuthenticationRequest(n,r,o)},t)},f=function(e,t,n,r,i){if(0!==r.length){var a=r.shift();if(a.action===Qe.RETRY)return"jwt"===i&&h(a.params.timeout,e,t,n),f(e,t,n,r);if(a.action===Qe.GET_NEW_TOKEN)return o=!0,f(e,t,n,r);if(a.action===Qe.REPORT_ERROR){var s="Authentication Error";return a.params&&a.params.errorCode>=0&&(s=c[a.params.errorCode]),n&&n(Ee.authError,s),f(e,t,n,r)}}};this.appSecretTokenGenerator=function(t){var n=null,r=null,i=!1,o=null;return t.indexOf(":")>-1&&(o=function(e){for(var t=a(e.replace(/[ \r\n]+$/,"")),n=[],r=0;r<t.length;++r){var i=t.charCodeAt(r).toString(16);1===i.length&&(i="0"+i),n.push(i)}return n.join("")}(t.split(":")[0]),t=t.split(":")[1]),d.importKey(t,function(e){t=null,n=e},function(e){i=!0,t=null,console.error("Couldn't import key",e)}),function(t,a){if(i)return a("appsecret based token generation failed");if(!t&&null!==r)return a(null,r);if(null===n)return setTimeout(function(){e.tokenGenerator(t,a)},100);var s={userID:L,appID:N};o&&(s.keyID=o),d.sign({alg:"HS256"},s,n,function(e,t){return e?a(e):(r=t,a(null,t))})}}},ie=new _;try{W=ie.detectBrowserInfo()}catch(e){console.log("detectBrowserInfo: Error",e)}window.csioReactNative||(q=ie.measureAppLoadingPerformance(W),z.loading=q);var oe,ae={type:"browser",name:W.name,ver:W.ver,os:W.os,osVersion:W.osVersion,userAgent:W.userAgent},se=!1,ce=null,ue=null,le={},de={currentOffset:0,offsetResults:[],syncStartTime:null,syncAttempts:5,syncHandler:null,maxAllowedLatency:6e4},pe=!0,he=null,fe=null,me=2e4,ve=100,ge=null;"Firefox"===W.name?ge=mozRTCPeerConnection:"Chrome"===W.name||"Opera"===W.name?ge=webkitRTCPeerConnection:"Safari"===W.name?console.log("Browser type Safari"):"Edge"===W.name&&(ge=window.RTCPeerConnection);var ye={fabricSetupFailed:"fabricSetupFailed",fabricHold:"fabricHold",fabricResume:"fabricResume",audioMute:"audioMute",audioUnmute:"audioUnmute",videoPause:"videoPause",videoResume:"videoResume",fabricUsageEvent:"fabricUsageEvent",fabricTerminated:"fabricTerminated",screenShareStart:"screenShareStart",screenShareStop:"screenShareStop",dominantSpeaker:"dominantSpeaker",userIDChangedEvent:"userIDChangedEvent",activeDeviceList:"activeDeviceList",applicationErrorLog:"applicationErrorLog"},be={autoFabricSetup:"autoFabricSetup",userJoined:"userJoined",userLeft:"userLeft",refreshPresence:"userAlive",ssrcMap:"ssrcMap",mediaPlaybackStartEvent:"mediaPlaybackStartEvent",mediaSuspendedEvent:"mediaSuspendedEvent",oneWayMedia:"oneWayMedia",fabricStateChange:"fabricStateChange",iceDisruptionStart:"iceDisruptionStart",iceDisruptionEnd:"iceDisruptionEnd",fabricTransportSwitch:"fabricTransportSwitch",iceConnectionDisruptionStart:"iceConnectionDisruptionStart",iceConnectionDisruptionEnd:"iceConnectionDisruptionEnd",iceAborted:"iceAborted",iceTerminated:"iceTerminated",iceFailed:"iceFailed",iceRestarted:"iceRestarted",fabricDropped:"fabricDropped",connectedDevices:"connectedDevices",iceCompleted:"iceCompleted",iceCandidateFound:"iceCandidateFound"},Se={sdpSubmission:"sdpSubmissionEvent",rtpStats:"rtpStats",processedStats:"processedStats",callStatsEvent:"callStatsEvent",userFeedback:"userFeedbackEvent",clockSync:"clockSync",preCallTest:"preCallTest",senderConfiguration:"senderConfiguration",sendingThroughputObservations:"sendingThroughputObservations"},_e="preCallTestResults",Te="preCallTestAssociate",Ce={success:"success",failure:"failure"},Ee={httpError:"httpError",authError:"authError",wsChannelFailure:"wsChannelFailure",success:"success",csProtoError:"csProtoError",appConnectivityError:"appConnectivityError",tokenGenerationError:"tokenGenerationError",ok:"OK"},we={authOngoing:"authOngoing"},Re={peer:"peer",server:"server"},ke={sendonly:"sendonly",receiveonly:"receiveonly",sendrecv:"sendrecv",inactive:"inactive"},Ie={audio:"audio",video:"video",data:"data",screen:"screen",multiplex:"multiplex",unbundled:"unbundled"},Pe={local:"local",remote:"remote",inbound:"inbound",outbound:"outbound"},Ae={noAudioInMultiplexFabric:"noAudioInMultiplexFabric",noOutboundAudioOnlyFabric:"noOutboundAudioOnlyFabric",noInboundAudioOnlyFabric:"noInboundAudioOnlyFabric"},Oe={excellent:"excellent",fair:"fair",bad:"bad"},De={established:"established",initializing:"initializing",failed:"failed",disrupted:"disrupted",checkingDisrupted:"checkingDisrupted"},xe={createOffer:"createOffer",createAnswer:"createAnswer",setLocalDescription:"setLocalDescription",setRemoteDescription:"setRemoteDescription",addIceCandidate:"addIceCandidate",getUserMedia:"getUserMedia",iceConnectionFailure:"iceConnectionFailure",signalingError:"signalingError",applicationError:"applicationError",applicationLog:"applicationLog"},Ne={mediaConfigError:"MediaConfigError",negotiationFailure:"NegotiationFailure",sdpError:"SDPGenerationError",iceFailure:"IceConnectionFailure",transportFailure:"TransportFailure",signalingError:"SignalingError",applicationError:"ApplicationError",applicationLog:"ApplicationLog"},Le={video:{gThreshold:1024,rThreshold:256},audio:{gThreshold:30,rThreshold:8}},Me={video:{gThreshold:.8,rThreshold:.3}},je={video:{gThreshold:400,rThreshold:1e3}},Fe={video:{gThreshold:10,rThreshold:50},audio:{gThreshold:15,rThreshold:30}},Ue={audio:{gThreshold:240,rThreshold:400}},He={chrome:"Chrome",firefox:"Firefox",edge:"Edge"},Be=[be.userJoined,be.refreshPresence,ye.fabricSetupFailed],Ge=function(e,t){try{window&&window.localStorage&&window.localStorage.setItem(e,t)}catch(e){return}},Je=function(e){try{if(window&&window.localStorage)return window.localStorage.getItem(e)}catch(e){return null}return null},Ve=function(e){try{window&&window.localStorage&&window.localStorage.removeItem(e)}catch(e){return}},We=function(e,n,r,i,o){var a=null,s=null,c=new XMLHttpRequest;if("Microsoft Internet Explorer"!==W.name&&(c.timeout=r),c){c.open("GET",encodeURI(e));for(var u in n)c.setRequestHeader(u,n[u]);a=t(),c.onload=function(){s=t(),i(c,s-a)},c.ontimeout=o,c.send()}},qe=function(e,t,n,r){var i=new XMLHttpRequest;if(i){if(i.open("POST",encodeURI(e)),i.setRequestHeader("Content-Type","application/json"),r)for(var o in r)i.setRequestHeader(o,r[o]);i.onload=function(){n(i)},i.send(t)}},Ke=function(e,n,r,i){if(e){var o=E+"generics",a={appID:e,timestamp:t(),userID:encodeURIComponent(n),version:R,eventType:r,data:i},s=JSON.stringify(a);V!==s&&(V=s,qe(o,s,function(e){200===e.status?console.log("Got generic response: %o",e.response):200!==e.status&&console.log("Got error for generic request %o, %s",e,e.status)}))}};window&&window.addEventListener&&window.addEventListener("error",function(e){if(e&&e.filename&&e.filename.indexOf("callstats")>-1){var t,n=!1,r={fileName:e.filename,line:e.lineno,col:e.colno,jsVersion:R,eventType:"error",message:e.message,pageURL:window.location.href};for(t in le)le.hasOwnProperty(t)&&(r.conferenceID=t,Ke(N,L,"onErrorLog",r),n=!0);n||Ke(N,L,"onErrorLog",r)}});var ze={invalidWebRTCFunctionName:"Invalid WebRTC function name"},Qe={RETRY:0,GET_NEW_TOKEN:1,REPORT_ERROR:2},$e=e(),Xe=Object.create(null),Ye=function(e,n,i){var o=RegExp.prototype.test.bind(/^([a-z])=(.*)/),a=/^ssrc:(\d*) ([\w_]*):(.*)/,s=/^ssrc-group:SIM (\d*)/;n.split(/(\r\n|\r|\n)/).filter(o).forEach(function(n){var o=n[0],c=n.slice(2);if("a"===o){if(a.test(c)){var u=c.match(a),l=u[1];void 0===e.ssrcMap[l]&&(e.ssrcMap[l]={}),e.ssrcMap[l][u[2]]=u[3],e.ssrcMap[l].localStartTime=t(),e.ssrcMap[l].syncedStartTime=r(),e.ssrcMap[l].streamType=i}s.test(c)&&(void 0===e.ssrcMap.ssrcGroup&&(e.ssrcMap.ssrcGroup={},e.ssrcMap.ssrcGroup[i]={}),e.ssrcMap.ssrcGroup[i].simulcastGroup=c.match(/\d+/g))}})},Ze=function(e,t){return e.ssrcMap[t]},et=function(e){return e.ssrcMap},tt=function(e,t,n,r,i,o){if(!i.localDescription||!i.remoteDescription)return!1;var a=i.localDescription.sdp,s=i.remoteDescription.sdp;if(!a||!s||a===r.localSDP&&s===r.remoteSDP)return!1;if(Ye(r,a,Pe.outbound),Ye(r,s,Pe.inbound),X){var c={sdp:{}};c.sdp.localSDP=a!==r.localSDP?a:-1,c.sdp.remoteSDP=s!==r.remoteSDP?s:-1,it(e,t,n,c,r.pcHash,o)}return r.localSDP=a,r.remoteSDP=s,!0},nt=function(e,t,n,i,o,a,s){if(e){var c=r(),u={version:R,apiTS:c,action:e,localID:encodeURIComponent(L),remoteID:t?encodeURIComponent(t):null,conferenceID:encodeURIComponent(n),timeShift:0,appID:N,ucID:i,pcID:a,deviceID:j,value:o};return null===n?void Ke(N,L,"log",{msg:"conferenceID is null in sendEvent for "+e}):void g(Se.callStatsEvent,u,s)}console.error("sendEvent: Invalid eventType ")},rt=function(e,t,n,i){if(e){var o=r(),a={version:R,channel:Se.preCallTest,timestamp:o,apiTS:o,action:e,eventType:e,localID:encodeURIComponent(L),remoteID:encodeURIComponent(L),conferenceID:encodeURIComponent(t),timeShift:0,appID:N,ucID:n,deviceID:j,token:re.authToken};return e===_e&&(a.results=i,null==t)?void $t(Se.preCallTest,a):(e===Te&&(a.ids=i),void(n&&!pe?g(Se.preCallTest,a):(a.clockUnsynced=pe,ee.cacheEvent({channel:Se.preCallTest,data:a,callback:null}))))}console.error("sendEvent: Invalid eventType ")},it=function(e,t,n,i,o,a){var s=r(),c={version:R,appID:N,conferenceID:encodeURIComponent(t),ucID:n,apiTS:s,localID:encodeURIComponent(L),remoteID:encodeURIComponent(e),pcID:o,deviceID:j,sdpPayload:i,action:Se.sdpSubmission};re.authToken&&n&&!pe?(c.token=re.authToken,g(Se.sdpSubmission,c,a)):(c.clockUnsynced=pe,ee.cacheEvent({channel:Se.sdpSubmission,data:c,callback:a}),re.authToken||re.sendAuthenticationRequest(N,L))},ot=function(e,t,n,r,i,o,a){_t(e,function(e){t.localCandidates=e.localCandidates,t.remoteCandidates=e.remoteCandidates,t.iceCandidatePairs=e.iceCandidatePairs,t.activeIceCandidatePair=Pt(t.iceCandidatePairs),a.currPair=t.activeIceCandidatePair,nt(be.fabricStateChange,i,n,r,a,o)})},at=function(e,t,n){var r={connectedDevices:x},i=le[e]?le[e].ucID:null;nt(be.connectedDevices,t,e,i,r,n)},st=function(e){var t={ucID:le[e].ucID,endpoint:ae,magicKey:$e};nt(be.refreshPresence,null,e,le[e].ucID,t,null)},ct=function(e,t){var n={};return n.status=e,t&&(n.message=t),n},ut=function(e,t){var n,r,i,o=0;if(!e)return o;for(n=0,i=e.length;n<i;n++)r=e.charCodeAt(n),o=(o<<5)-o+r,o|=0;return t&&t(o),o},lt=function(){z.sent||(z.remoteofferSinceCreate&&z.config&&z.senderConfig||z.errorSinceCreate)&&(console.log("Send generic event for timing"),Ke(N,L,"timing",z),z.sent=!0)},dt=function(e){Ke(N,L,"log",{msg:"precalltest finished "+H}),H+="(finished)",Q.preCallTest&&Q.preCallTest(e);try{K.push(e.id);var t=null,n=null;for(var r in le)if(le.hasOwnProperty(r)){t=r,le[r].ucID&&(n=le[r].ucID);break}rt(_e,t,n,e)}catch(e){B("send results",e)}},pt=function(){var e=P+N,t={Authorization:"Bearer "+re.authToken},n=function(e,t){200!==e.status&&setTimeout(function(){i()},100),z.config=t,lt();var n=JSON.parse(e.response);if(console.log("internal config:",n),n.submissionInterval&&($=parseInt(n.submissionInterval,10),O.setSubmissionInterval($)),n.adaptiveStats&&O.setReportingMode(n.adaptiveStats),n.collectSDP&&(X=n.collectSDP),n.qmodelThresholdsAPI){var r=n.qmodelThresholdsAPI;Vt("eModelThreshold",r,Ue),Vt("throughputThreshold",r,Le),Vt("fractionalLossThreshold",r,Fe),Vt("rttThreshold",r,je),Vt("currOverPrevFrameRateThreshold",r,Me)}},r=function(e){200!==e.status&&setTimeout(function(){o()},100);var t=JSON.parse(e.response),n=function(e,t){var n={};return t&&(n={peerConnection:null,media:null}),e.peerConnection&&(n.peerConnection=e.peerConnection),e.media&&(n.media=e.media),e.sender&&(n.sender=e.sender),e.confidence&&(n.confidence=e.confidence),n};if(Q.defaultConfig&&t.default){var r=n(t.default,!0);r!=={}&&Q.defaultConfig(r)}if(Q.recommendedConfig&&t.recommended){var i=n(t.recommended,!1);i!=={}&&Q.recommendedConfig(i)}},i=function(){We(e+"/configurations/internal",t,2e3,n,i)},o=function(){We(e+"/configurations",t,2e3,r,o)};i(),o()},ht=function(e,t){var n,r=null;return le[e]&&le[e].participants&&(r=le[e].participants.filter((n=t,function(e){return e.pc===n||!(!n.callstatsID||e.pcHash!==n.callstatsID)||void 0}))),r&&r.length>0?r[0]:null},ft=function(e,t){var n,r=null;return(n=ht(e,t))&&(r=n.pcHash),r},mt=function(e){var t=null,n=null,r=null;for(t in le)if(le.hasOwnProperty(t)&&(r=ht(t,e))){n={fabric:r,conferenceID:t};break}return n},vt=function(e){if(e){var t=[],n=0;if(e&&e.result)t=e.result();else if(e&&e.forEach)e.forEach(function(e){t.push(e)});else for(n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}},gt=function(e){var t,n,r=null,i=null,o=[],a=[],s=[],c=0;if(!(n=vt(e)))return{localCandidates:o,remoteCandidates:a};for(c=0;c<n.length;++c)if(r=p(n[c]),i=d(r),i.localCandidate)o.push(i.localCandidate);else if(i.remoteCandidate)a.push(i.remoteCandidate);else if(i.Transport){if("transport"===i.Transport.type){t=i.Transport.selectedCandidatePairId;continue}s.push(i.Transport)}else i.candidatePair&&s.push(i.candidatePair);if(t)for(c=0;c<s.length;c++)s[c].id===t&&(s[c].googActiveConnection="true");return{localCandidates:o,remoteCandidates:a,iceCandidatePairs:s}},yt=function(e){return function(t){var n;n=gt(t),e(n)}},bt=function(e){var t=null;return e&&(t=e.message+" : "+e.stack),t},St=function(e,t,n,r,i,o){var a=W.codebase,s=W.name;if(a===He.firefox)if(Y)try{e.getStats().then(n(t,r,i,o,e)).catch(function(s){Y=!1,Ke(N,r,"log",{msg:"### "+a+" getStats reports error "+bt(s)}),e.getStats(null,n(t,r,i,o,e))})}catch(s){Y=!1,Ke(N,r,"log",{msg:"### "+a+" getStats reports error "+bt(s)}),e.getStats(null,n(t,r,i,o,e))}else e.getStats(null,n(t,r,i,o,e),function(e){console.log("getstats error ",e)});else if("Safari"===s)e.getStats().then(n(t,r,i,o,e)).catch(function(e){Ke(N,r,"log",{msg:"### "+a+" getStats reports error "+bt(e)})});else if(a===He.chrome)if(window&&window.csioReactNative)e.getStats(null,n(t,r,i,o,e),function(e){Ke(N,r,"log",{msg:"### "+a+" getStats reports error "+bt(e)})});else if(Y)try{e.getStats().then(n(t,r,i,o,e)).catch(function(s){Y=!1,Ke(N,r,"log",{msg:"### "+a+" getStats reports error "+bt(s)}),e.getStats(n(t,r,i,o,e))})}catch(s){Y=!1,Ke(N,r,"log",{msg:"### "+a+" getStats reports error "+bt(s)}),e.getStats(n(t,r,i,o,e))}else e.getStats(n(t,r,i,o,e));else a===He.edge&&e.getStats().then(n(t,r,i,o,e)).catch(function(e){Ke(N,r,"log",{msg:"### "+a+" getStats reports error "+bt(e)})})},_t=function(e,t){try{St(e,t,yt)}catch(e){console.log("csioGetStats: Error",e)}},Tt=function(e,t,n,r){if(n||(n=A),!e||!t)return console.error("sendFabricEvent: Arguments missing/Invalid"),ct(Ce.failure,"sendFabricEvent: Arguments missing/Invalid");if(!N||!L||!le[n])return console.error("sendFabricEvent: SDK is not initialized or no Fabrics added."),ct(Ce.failure,"sendFabricEvent: SDK is not initialized or no Fabrics added.");if(t===ye.fabricSetupFailed)return console.error("sendFabricEvent: Unsupported fabricEvent fabricSetupFailed"),ct(Ce.failure,"sendFabricEvent: Unsupported fabricEvent fabricSetupFailed");if(!s(e))return console.error("sendFabricEvent: Invalid PeerConnection object passed"),ct(Ce.failure,"sendFabricEvent: Invalid PeerConnection object passed");if(!ye.hasOwnProperty(t)&&!be.hasOwnProperty(t))return console.error("sendFabricEvent: Invalid fabricEvents value: ",t),ct(Ce.failure,"sendFabricEvent: Invalid fabricEvents value: "+t);var i,o,a,c={},u=le[n],l=null;if(void 0===u)return console.error("sendFabricEvent: Conference ID not found!"),ct(Ce.failure,"sendFabricEvent: Conference ID not found!");if(null===(l=ht(n,e)))return console.error("sendFabricEvent: fabricData is null"),ct(Ce.failure,"sendFabricEvent: fabricData is null");if(i=l.remoteUserID,t===ye.activeDeviceList){if(!r||!r.deviceList)return console.error("sendFabricEvent: Arguments missing/Invalid"),ct(Ce.failure,"sendFabricEvent: Arguments missing/Invalid");if(!(r.deviceList instanceof Array))return console.error("sendFabricEvent: DeviceList Invalid"),ct(Ce.failure,"sendFabricEvent: DeviceList Invalid");c={magicKey:$e,endpoint:ae,activeDevicelist:r.deviceList}}if(t!==ye.screenShareStart&&t!==ye.screenShareStop||(c={magicKey:$e,endpoint:ae},r&&(c.ssrc=r.ssrc)),nt(t,i,n,u.ucID,c,l.pcHash,l.pcCallback),t===ye.fabricTerminated){if(le[n].participants){l&&(l.statsInterval=f(l.statsInterval),function(e,t){var n=0;if(e&&le[t].participants)for(n=0;n<le[t].participants.length;n++)if(le[t].participants[n].pcHash===e.pcHash){le[t].participants.splice(n,1);break}}(l,n));var d=function(e){var t=!1;if(!le[e])return{conferenceFinished:t,ucID:null};var n=le[e].ucID;return 0===le[e].participants.length&&(f(le[e].refreshPresence),y(),ee.sendCachedEvents(re,pe),delete le[e],t=!0),{conferenceFinished:t,ucID:n}}(n);d.conferenceFinished&&(o=n,a=d.ucID,nt(be.userLeft,null,o,a,null,null,null),y(),he=$e,$e=null)}}else t===ye.fabricHold?(l.statsInterval=f(l.statsInterval),l.onHold=!0):t===ye.fabricResume&&(l.onHold=!1,Ot(l,e,n,i));return ct(Ce.success)},Ct=function(e,t){return e&&"string"==typeof e?(e.length>t&&(e=e.substring(0,t)),e):null},Et=function(e,t,n){return t||(e&&e[n]?e[n].sdp:-1)},wt=function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t[t.length]=r:r>127&&r<2048?(t[t.length]=r>>6|192,t[t.length]=63&r|128):(t[t.length]=r>>12|224,t[t.length]=r>>6&63|128,t[t.length]=63&r|128)}return new Uint8Array(t).buffer},Rt=function(e){for(var t,n=new DataView(e),r="",i=0;i<n.byteLength;i++)t=n.getUint8(i).toString(16),t.length<2&&(t="0"+t),r+=t;return r},kt=function(e,t){var n={name:"SHA-256"};if(window.crypto){var r=window.crypto.subtle||window.crypto.webkitSubtle;if(!r)return void ut(e,t);r.digest(n,wt(e)).then(function(e){t(Rt(e))}).catch(function(){ut(e,t)})}else if(window.msCrypto){if(!window.msCrypto.subtle)return void ut(e,t);var i=window.msCrypto.subtle.digest(n,wt(e));i.oncomplete=function(e){e.target&&t(Rt(e.target.result))},i.onerror=function(){ut(e,t)}}else ut(e,t)},It=function(){ee.sendCachedUserJoinedEvents(re),ee.sendCachedEvents(re,pe)},Pt=function(e){var t=null;if(e&&e.length>0){var n=e.filter(function(e){return"true"===e.selected||"true"===e.googActiveConnection||!0===e.selected||!0===e.googActiveConnection});n.length>0&&(t=n[0])}return t},At=function(e,n){if(e){var r,i=null;if(void 0!==n){var o=n.signalingState;if((i=mt(n))&&i.fabric){r=i.fabric.signalingState,i.fabric.signalingState=o;var a=i.conferenceID,s=i.fabric,c=s.remoteUserID,u=le[a].ucID,l={changedState:"signalingState",prevState:r,newState:o};ot(n,s,a,u,c,s.pcHash,l),"closed"===o&&Tt(n,ye.fabricTerminated,i.conferenceID),"have-local-offer"!==o&&"have-local-pranswer"!==o&&"stable"!==o||i.sentSenderConfigRequest||(console.log(o,".. requesting sender config.",i.sentSenderConfigRequest),i.sentSenderConfigRequest=!0,function(e){var n=t(),r=function(){z.senderConfig=-1,z.senderExists=!1,lt()},i=function(e){var r,i=JSON.parse(e.response);console.log("Sender config response:",e.status,i),i.recommended&&i.recommended.sender&&(r=i.recommended.sender,console.log("ConfigService, recommended SENDER info:",r)),r&&(ce=r,se=!0),z.senderConfig=t()-n,z.senderExists=!!r,lt()},o=function(e){ue=e;var t=P+N+"/configurations",n={Authorization:"Bearer "+re.authToken},r={app_id:N,local_id:L,rtc_rtp_parameters:e},o=JSON.stringify(r);qe(t,o,i,n)},a=function(){o({encodings:[{maxBitrate:0}]})};if(Object.keys(le).length>1)return console.warn("Multiple PCs found, skipping"),void r();if(!e.getSenders||"function"!=typeof e.getSenders)return console.warn("Get senders error"),void a();var s,c=e.getSenders();for(var u in c){var l=c[u];if("object"!=typeof l||!l.track||"object"!=typeof l.track||!l.track.kind)return console.warn("Access senders error"),void r();if("video"===l.track.kind){if(s)return console.warn("Multiple video sender, skipping"),void r();s=l}}if(!s)return console.warn("No video sender found"),void r();if(!s.getParameters||"function"!=typeof s.getParameters)return console.warn("Sender getParameters error"),void a();var d=s.getParameters();"object"!=typeof d?r():("encodings"in d||(d.encodings=[]),0===d.encodings.length&&d.encodings.push({maxBitrate:0}),o(d))}(n))}if("closed"===o&&J)try{J.callFinished()}catch(e){B("callFinished",e),J.crashDisconnect()}if("have-remote-offer"===o||"stable"===o){if(z.remoteofferSinceCreate=t()-z.create,lt(),J)try{J.callStarts()}catch(e){B("callStarts",e),J.crashDisconnect()}Ke(N,L,"log",{msg:"precalltest told to stop "+H}),H+="(stopped)"}}}},Ot=function(e,n,r){if(!e.onHold){var i=n,o=r;null===e.statsInterval&&(e.statsPollingStart=t(),Mt(i,o),e.statsInterval=setInterval(function(){Mt(i,o)},1e3))}},Dt=function(e,t,n,r,i,o){o.localCandidates=t.localCandidates,o.remoteCandidates=t.remoteCandidates,o.iceCandidatePairs=t.iceCandidatePairs,nt(be.iceFailed,n,r,i,o,t.pcHash,t.pcCallback)},xt=function(e,t){if(e&&void 0!==t){var n=null;(n=mt(t))&&n.fabric&&n.fabric.numNegotiationNeededCalls++}},Nt=function(e,n){if(e&&void 0!==n){var r,i,o,a,s,c=null;if((s=mt(n))&&s.fabric){c=s.fabric,r=s.conferenceID,i=t()-c.startTime,o=c.iceConnectionState,a=c.iceGatheringState;var u=c.remoteUserID,l=le[r].ucID,d={changedState:"iceConnectionState",prevState:o,newState:n.iceConnectionState};if(ot(n,c,r,l,u,c.pcHash,d),a!==n.iceGatheringState){var p={changedState:"iceGatheringState",prevState:a,newState:n.iceGatheringState};ot(n,c,r,l,u,c.pcHash,p)}"complete"===n.iceGatheringState&&"checking"===n.iceConnectionState&&(te=n,re=r,ie=i,oe=(ne=c).iceConnectionState,ae=ne.remoteUserID,se=le[re],ce=t(),ue={prevIceConnectionState:oe,currIceConnectionState:te.iceConnectionState},ne.gatheringIceCandidatesDelay=ie,"disconnected"===oe&&ne.pcState===De.checkingDisrupted&&(ue.disruptionDelay=ce-ne.disruptedTS,nt(be.iceConnectionDisruptionEnd,ae,re,se.ucID,ue,ne.pcHash,ne.pcCallback))),"connected"===n.iceConnectionState||"completed"===n.iceConnectionState?(V=n,q=r,K=i,z=(W=c).iceConnectionState,Q=W.remoteUserID,$=le[q],X=t(),Y={prevIceConnectionState:z,currIceConnectionState:V.iceConnectionState,prevPair:W.activeIceCandidatePair},Z=W.pcState===De.disrupted,ee="completed"===V.iceConnectionState,W.connectivityIceStatusDelay=K,W.established=!0,_t(V,function(e){if(W.localCandidates=e.localCandidates,W.remoteCandidates=e.remoteCandidates,W.iceCandidatePairs=e.iceCandidatePairs,W.activeIceCandidatePair=Pt(W.iceCandidatePairs),Y.currPair=W.activeIceCandidatePair,Y.disruptionDelay=X-W.disruptedTS,Z)nt(be.iceDisruptionEnd,Q,q,$.ucID,Y,W.pcHash);else if(ee){var t={};t.iceCandidatePairs=e.iceCandidatePairs,nt(be.iceCompleted,Q,q,$.ucID,t,W.pcHash)}}),jt(W.pc,be.autoFabricSetup,q),W.pcState=De.established,Ot(W,V,q,Q)):"failed"===n.iceConnectionState?(M=n,F=r,U=i,H=(j=c).iceConnectionState,B=j.remoteUserID,G=le[F],J={prevIceConnectionState:H,currIceConnectionState:M.iceConnectionState,currPair:j.activeIceCandidatePair,failureDelay:U},j.pcState=De.failed,"checking"===H?Dt(0,j,B,F,G.ucID,J):"completed"===H||"connected"===H?nt(be.fabricDropped,B,F,G.ucID,J,j.pcHash,j.pcCallback):"disconnected"===H&&j.established?nt(be.fabricDropped,B,F,G.ucID,J,j.pcHash,j.pcCallback):"disconnected"===H&&Dt(0,j,B,F,G.ucID,J)):"disconnected"===n.iceConnectionState?(I=n,A=r,O=(P=c).iceConnectionState,D=P.remoteUserID,x=le[A],N=t(),L={prevIceConnectionState:O,currIceConnectionState:I.iceConnectionState,prevIceConnectionStateTs:P.iceConnectionStateTS,currPair:P.activeIceCandidatePair},P.startTime=N,"connected"===O||"completed"===O?(P.pcState=De.disrupted,P.disruptedTS=N,nt(be.iceDisruptionStart,D,A,x.ucID,L,P.pcHash,P.pcCallback),P.pcCallback&&P.pcCallback(Ee.appConnectivityError,"Connectivity check for PC object to "+D+" failed.")):"checking"===O&&(P.pcState=De.checkingDisrupted,P.disruptedTS=N,nt(be.iceConnectionDisruptionStart,D,A,x.ucID,L,P.pcHash,P.pcCallback),P.pcCallback&&P.pcCallback(Ee.appConnectivityError,"Connectivity check for PC object to "+D+" failed."))):"closed"===n.iceConnectionState?(S=n,T=r,C=i,E=(_=c).iceConnectionState,w=_.remoteUserID,R=le[T],k={prevIceConnectionState:E,currIceConnectionState:S.iceConnectionState},"new"===E||"checking"===E?(k.failureDelay=C,nt(be.iceAborted,w,T,R.ucID,k,_.pcHash,_.pcCallback)):(k.currPair=_.activeIceCandidatePair,nt(be.iceTerminated,w,T,R.ucID,k,_.pcHash,_.pcCallback))):"new"===n.iceConnectionState&&(v=f.iceConnectionState,g=f.remoteUserID,y=le[m],b={prevIceConnectionState:v,currIceConnectionState:h.iceConnectionState,prevPair:f.activeIceCandidatePair},"new"!==v&&(f.established=!1,nt(be.iceRestarted,g,m,y.ucID,b,f.pcHash,f.pcCallback))),c.iceConnectionState=n.iceConnectionState,c.iceGatheringState=n.iceGatheringState,c.iceConnectionStateTS=t()}}var h,f,m,v,g,y,b,S,_,T,C,E,w,R,k,I,P,A,O,D,x,N,L,M,j,F,U,H,B,G,J,V,W,q,K,z,Q,$,X,Y,Z,ee,te,ne,re,ie,oe,ae,se,ce,ue},Lt=function(e,t){var n,r,i;if(void 0!==t){if(null!==e.candidate){var o="1"===(r=e.candidate.candidate.split(" "))[1]?"rtp":"rtcp";"0"!==r[5]&&(i=-1!==r[4].indexOf(":"),n={transport:r[2],protocol:o,typePreference:r[3],address:i?"["+r[4]+"]:"+r[5]:r[4]+":"+r[5],type:r[7],media:e.candidate.sdpMid})}var a=null;a=mt(t),_t(t,function(e){a.localCandidates=e.localCandidates,a.remoteCandidates=e.remoteCandidates,a.iceCandidatePairs=e.iceCandidatePairs,a.activeIceCandidatePair=Pt(a.iceCandidatePairs)}),a&&a.fabric&&(void 0!==n&&-1===a.fabric.iceCandidates.indexOf(n)&&a.fabric.iceCandidates.push(n),n&&a.fabric.fabricSetupSent&&function(e,t){var n=mt(e);if(n&&n.fabric){var r=n.fabric,i=r.remoteUserID,o=n.conferenceID,a=le[o].ucID;nt(be.iceCandidateFound,i,o,a,t,r.pcHash)}}(t,n))}},Mt=function(e,t){if(le.hasOwnProperty(t)){if("closed"===e.signalingState)return Tt(e,ye.fabricTerminated,t),!0;var n=ht(t,e);if(n.pcState!==De.established&&n.lastFabricState===n.pcState&&"connected"!==e.iceConnectionState&&"completed"!==e.iceConnectionState)return!0;var r=le[t].ucID;try{St(e,n.pcCallback,l,L,r,n)}catch(e){console.log("csioGetStats: Error",e)}}else console.error("ConferenceID %o doesn't exist. Can't call getStats for it.",t)},jt=function(e,n,r){var i=null,o=le[r],a=null,s=t();if(void 0===o&&console.error("sendAutoFabricSetupEvent: Conference ID not found!"),null===(a=ht(r,e))&&console.error("sendAutoFabricSetupEvent: fabricData is null"),!a.fabricSetupSent){i=a.remoteUserID;var c={setupDelay:s-a.startTime,iceGatheringDelay:a.gatheringIceCandidatesDelay,iceConnectivityDelay:a.connectivityIceStatusDelay,remoteEndpointType:a.remoteEndpointType,fabricTransmissionDirection:a.fabricTransmissionDirection};pe||(c.clockSyncOffset=de.currentOffset),_t(e,function(e){c.localCandidates=e.localCandidates,c.remoteCandidates=e.remoteCandidates,c.iceCandidatePairs=e.iceCandidatePairs,a.localCandidates=e.localCandidates,a.remoteCandidates=e.remoteCandidates,a.iceCandidatePairs=e.iceCandidatePairs,a.pcState=De.established,a.activeIceCandidatePair=Pt(a.iceCandidatePairs),a.fabricSetupSent||(nt(n,i,r,o.ucID,c,a.pcHash,a.pcCallback),a.fabricSetupSent=!0)})}},Ft=function(e,t,n){var r,i={},o=le[n],a=null;void 0===o&&console.error("sendFabricTransportSwitchEvent: Conference ID not found!"),null===(a=ht(n,e))&&console.error("sendFabricTransportSwitchEvent: fabricData is null"),r=a.remoteUserID,i.prevPair=a.activeIceCandidatePair,_t(e,function(e){i.currPair=Pt(e.iceCandidatePairs),a.activeIceCandidatePair=i.currPair,i.switchDelay=null,i.relayType=a.transportData.relayType,nt(t,r,n,o.ucID,i,a.pcHash,a.pcCallback)})},Ut=function(e,t){if(e.trackStats){var n=e.trackStats.filter(function(e){return e.id===t});if(n.length>0)return n[0]}},Ht=function(e,t){if(e.codec){var n=e.codec.filter(function(e){return e.id===t});if(n.length>0)return n[0]}},Bt=function(e,t){if(e.candidatePair){var n=e.candidatePair.filter(function(e){return e.id===t});if(n.length>0)return n[0]}},Gt=function(e){for(var t,n,r=e.Transport.length,i=0;i<r;i++)n=e.Transport[i],n.selectedCandidatePairId&&(t=Bt(e,n.selectedCandidatePairId))&&(e.Transport[i]=u(e.Transport[i],t));return e},Jt=function(e){for(var t,n,r,i=e.streams.length,o=0;o<i;o++)t=e.streams[o],t.data.trackId&&(n=Ut(e,t.data.trackId))&&(e.streams[o].data=u(e.streams[o].data,n)),t.data.codecId&&(r=Ht(e,t.data.codecId))&&(e.streams[o].data=u(e.streams[o].data,r));return e},Vt=function(e,t,n){t.hasOwnProperty(e)&&(t[e].hasOwnProperty("video")&&(t[e].video.isGreaterBetter?(n.video.gThreshold=t[e].video.upperThreshold,n.video.rThreshold=t[e].video.lowerThreshold):(n.video.gThreshold=t[e].video.lowerThreshold,n.video.rThreshold=t[e].video.upperThreshold)),t[e].hasOwnProperty("audio")&&(t[e].audio.isGreaterBetter?(n.audio.gThreshold=t[e].audio.upperThreshold,n.audio.rThreshold=t[e].audio.lowerThreshold):(n.audio.gThreshold=t[e].audio.lowerThreshold,n.audio.rThreshold=t[e].audio.upperThreshold)))},Wt=function(e,n,r){var i,o=[],a=null;for(var s in n)n.hasOwnProperty(s)&&o.push(encodeURIComponent(s)+"="+encodeURIComponent(n[s]));var c=o.join("&"),u=new XMLHttpRequest;u.open("POST",e),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i=t(),u.onload=function(){a=t(),r(u,a-i)},u.send(c)},qt=function(){We(I,null,5e3,function(e){if(200===e.status)try{var t=JSON.parse(e.responseText);Vt("eModelThreshold",t,Ue),Vt("throughputThreshold",t,Le),Vt("fractionalLossThreshold",t,Fe),Vt("rttThreshold",t,je),Vt("currOverPrevFrameRateThreshold",t,Me)}catch(e){return e}},function(){pe&&qt()})},Kt=function(){var e=null,n=null;We(E+"clockSync",null,5e3,function(r,i){200===r.status?(e=JSON.parse(r.response),n=t(),zt(e,i,n)):pe&&setTimeout(function(){Kt()},100)},function(){pe&&Kt()})},zt=function(e,t,n){if(pe){var r=t/2;if(r>de.maxAllowedLatency)de.offsetResults=[],Ke(N,L,"log",{msg:"clockSync restarting"});else{var i=e.now+r,o=i-n;de.offsetResults.push(o),Ke(N,L,"log",{msg:"clockSync Info serverTime "+i+" responseRecvTs "+n+" requestExecutionTime "+t})}if(de.offsetResults.length>=de.syncAttempts){var a=de.offsetResults.reduce(function(e,t){return e+t});de.currentOffset=a/de.offsetResults.length,Ke(N,L,"log",{msg:"clockSync Done "+de.currentOffset+"Length "+de.offsetResults.length}),de.offsetResults=[],pe=!1,ee.sendCachedUserJoinedEvents(re),ee.sendCachedEvents(re,pe)}else pe&&setTimeout(function(){Kt()},100)}},Qt=new function(){var e=this,n=null,r=!1,i=!1,o={},a="initiated",s="connected",c="closed";this._wsConnectionState=c;var u=function(e,t){try{if(window&&window.sessionStorage){var n=JSON.parse(window.sessionStorage.getItem("csio_ucid_data"));n||(n={}),n[e]||(n[e]={}),n[e].ucID=t,window.sessionStorage.setItem("csio_ucid_data",JSON.stringify(n))}}catch(e){return}o[e]="https://dashboard.callstats.io/apps/"+N+"/conferences/"+encodeURIComponent(e)+"/"+t+"/general"};this.getConferenceURL=function(){return o},this._setupWebSocketConnection=function(o){return e._wsConnectionState===a||e._wsConnectionState===s?(Ke(N,L,"log",{msg:"### _setupWebSocketConnection is called when already connected!"}),console.log("### _setupWebSocketConnection is called when already connected!"),void(o&&o(Ee.success,"WebSocket establishment successful."))):(e._wsConnectionState=a,(n=new WebSocket(k,"echo-protocol")).onopen=function(){console.log("**** Successfully connected to the backend ",i,L),Ke(N,L,"log",{msg:"Successfully connected to the backend"}),e._wsConnectionState=s,r?i=!0:r=!0,ee.sendCachedUserJoinedEvents(re),i&&(function(){var e;for(e in le)if(le.hasOwnProperty(e)){if(e===A)return;st(e),le[e].refreshPresence=function(e){return setInterval(function(){st(e)},1e4)}(e)}b()}(),ee.sendCachedEvents(re,pe)),i=!1},n.onclose=function(){e._wsConnectionState=c,console.log("**** Connection to the server closed."),Ke(N,L,"log",{msg:"Connection to the server closed."}),function(){var e;for(e in le)le.hasOwnProperty(e)&&(le[e].refreshPresence=f(le[e].refreshPresence),delete le[e].refreshPresence);y()}(),n&&(n=null),o&&o(Ee.httpError,"Connection to the server closed.")},n.onerror=function(t){e._wsConnectionState=c,Ke(N,L,"log",{msg:"WebSocket establishment failed."}),console.log("WebSocket establishment failed.",t),o&&o(Ee.wsChannelFailure,"WebSocket establishment failed.",t)},void(n.onmessage=function(e){var n,r,i=e.data,a=t(),s=JSON.parse(i);if("Error"===s.status)"Invalid client token."===s.reason&&(re.tokenData=null,re.authToken=null,re.sendAuthenticationRequest(N,L)),o&&o(Ee.csProtoError,i.reason);else if("200 OK"===s.status)if("feedback"===s.event)Ve("feedback");else if(s.event===be.userJoined||s.event===be.refreshPresence){var c=!1,l=null;n=decodeURIComponent(s.conferenceID),le.hasOwnProperty(n)&&(le[n].ucID!==s.ucID&&(c=!0,u(n,s.ucID),l=s.conferenceCreationTS?s.conferenceCreationTS:s.conferenceDuration),s.event!==be.userJoined||le[n].refreshPresence||(le[n].refreshPresence=(r=n,setInterval(function(){st(r)},1e4)),b()),le[n].ucID=s.ucID),ee.sendCachedFeedback(),ee.sendCachedEvents(re,pe,c,l,n,s.ucID)}else s.event===Se.clockSync?zt(s,a):s.event===ye.fabricSetupFailed&&(n=decodeURIComponent(s.conferenceID),s.ucID&&(u(n,s.ucID),ee.sendCachedFeedback(),ee.sendCachedEvents(re,pe,!0,0,n,s.ucID)))}))},this._isChannelReady=function(){return!(!n||1!==n.readyState)},this.getWSConnectionState=function(){return n?n.readyState:-1},this.send=function(e){n.send(JSON.stringify(e))}},$t=function(e,t,n){if(Qt._isChannelReady())try{Qt.send(t)}catch(r){r&&"InvalidStateError"===r.name&&ee.cacheEvent({channel:e,data:t,callback:n})}else ee.cacheEvent({channel:e,data:t,callback:n}),Qt._setupWebSocketConnection()};return navigator&&"function"==typeof navigator.getBattery&&navigator.getBattery().then(function(e){oe=e}),function(){if(null===(j=Je("endpointID"))){var e=t(),n=Math.random()*e;kt(n.toString(),function(e){Ge("endpointID",j=e)})}}(),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t,n=Object(this),r=n.length>>>0,i=arguments[1],o=0;o<r;o++)if(t=n[o],e.call(i,t,o,n))return t}}),window&&!window.csioproxy&&(qt(),m()),window&&window.csioChromeLegacyGetStats&&(Y=!1),{version:R,initialize:function(e,n,r,i,o,a){if(!e||!r||!n)return console.error("initialize: Argument missing/invalid"),ct(Ce.failure,"initialize: Argument missing/invalid");if(i&&"function"!=typeof i)return console.error("initialize: Argument missing/invalid"),ct(Ce.failure,"initialize: Argument missing/invalid");if(o&&"function"!=typeof o)return console.error("initialize: Argument missing/invalid"),ct(Ce.failure,"initialize: Argument missing/invalid");if(re.setAuthType("jwt"),"function"!=typeof n){if(re.setAuthType(ne),!(window.crypto&&(window.crypto.subtle||window.crypto.webkitSubtle)||window.msCrypto&&window.msCrypto.subtle||window.csioReactNative))return console.error("Browser does not support Web Cryptography API. App secret based authentication requires Web Cryptography API"),i&&i(Ee.tokenGenerationError,"Browser does not support Web Cryptography API. App secret based authentication requires Web Cryptography API"),ct(Ce.failure,"Browser does not support Web Cryptography API. App secret based authentication requires Web Cryptography API");n=re.appSecretTokenGenerator(n)}if("string"==typeof e&&(e=parseInt(e,10)),N=e,isNaN(N))return ct(Ce.failure,"Invalid Credentials");if("object"==typeof r?(L=r.aliasName,M=r):L=r,z.initializeSinceCreate=t()-z.create,Ke(N,L,"log",{msg:"callstats initialize in progress"}),a&&(!0===a.disableBeforeUnloadHandler&&(F=!0),null!==a.applicationVersion&&void 0!==a.applicationVersion&&(ae.appVer=Ct(a.applicationVersion,30)),!0===a.disablePrecalltest&&(U=!0)),re.tokenGenerator=n,Je("csio_auth_data"))try{var s=JSON.parse(Je("csio_auth_data"));re._isTokenValid(s,N,L)&&(i&&i(Ee.success,"SDK authentication successful."),re.setupAuthToken(s),pt(),Qt._isChannelReady()||Qt._setupWebSocketConnection(i))}catch(e){console.log("initialize: Error",e)}F||window&&window.addEventListener&&window.addEventListener("beforeunload",function(e){var t;for(t in le)le.hasOwnProperty(t)&&nt(be.userLeft,null,t,le[t].ucID,null,null,null);return pe&&(de.offsetResults=[],de.syncHandler=null,pe=!1),"Are you sure you want to close the call?"}),o&&(Q.stats=o);try{re.sendAuthenticationRequest(N,L,i)}catch(e){console.log("initialize: Error",e)}return ct(Ce.success)},on:function(e,t){"function"==typeof t&&Q.hasOwnProperty(e)&&(Q[e]=t)},fabricEvent:ye,addNewFabric:function(n,r,i,o,a,c){var u,l,d=Re.peer,p=ke.sendrecv,h={authStatus:!!re.tokenData,clockSync:!pe,msg:"addNewFabric called",eventType:"warn",pageURL:window.location.href,conferenceID:o,version:R};if(y(),Ke(N,L,"stateMachine",h),l=r&&"object"==typeof r?r.aliasName:r,o||(o=A),!n||!i)return console.error("addNewFabric: Arguments missing/Invalid"),ct(Ce.error,"addNewFabric: Arguments missing/Invalid");if(!N||!L)return console.error("addNewFabric: SDK not initialized."),ct(Ce.error,"addNewFabric: SDK not initialized");if(!s(n))return console.error("addNewFabric: Invalid PeerConnection object passed"),ct(Ce.error,"addNewFabric: Invalid PeerConnection object passed");if(!Ie.hasOwnProperty(i)||i instanceof Function)return console.error("addNewFabric: Invalid fabricUsage value"),ct(Ce.error,"addNewFabric: Invalid fabricUsage value");if(a&&"function"!=typeof a){if(a.remoteEndpointType){if(!Re.hasOwnProperty(a.remoteEndpointType))return console.error("addNewFabric: Invalid remoteEndpointType value"),ct(Ce.error,"addNewFabric: Invalid remoteEndpointType value");d=a.remoteEndpointType}if(a.fabricTransmissionDirection){if(!ke.hasOwnProperty(a.fabricTransmissionDirection))return console.error("addNewFabric: Invalid fabricTransmissionDirection value"),ct(Ce.error,"addNewFabric: Invalid fabricTransmissionDirection value");p=a.fabricTransmissionDirection}}var f=t();z.addnewfabricSinceCreate=f-z.create,lt(),null===$e&&($e=e());var m,v,g,b=!1;if(!function(e){var t=!1;if(!e)return t;var n=le[e];return void 0!==n&&n.participants&&n.participants.length>0&&(t=!0),t}(o)){var S={magicKey:$e,statsSubmissionInterval:$,endpoint:ae,localUserIDObject:M};nt(be.userJoined,null,o,null,S,null,null),b=!0,h={authStatus:!!re.tokenData,clockSync:!pe,msg:"userJoined sent",pageURL:window.location.href,eventType:"warn",conferenceID:o,version:R},Ke(N,L,"stateMachine",h)}if(v=null,g=b,void 0===le[m=o]&&(le[m]={},le[m].participants=null,g&&(le[m].userJoinedSent=!0),v&&(le[m].refreshPresence=v)),!ht(o,n)){n&&new C(n,Lt,Nt,At,xt),u=e();var _={pc:n,remoteUserID:l,fabricUsage:i,magicKey:$e,startTime:f,pcCallback:c,pcState:De.initializing,fabricSetupSent:!1,iceCandidates:[],iceConnectionState:n.iceConnectionState,latestEventSent:f,pcHash:u,localSDP:-1,remoteSDP:-1,statsInterval:null,intervalAdaptionPhase:!0,gatheringIceCandidatesDelay:0,connectivityIceStatusDelay:0,numNegotiationNeededCalls:0,currentActivePhaseIndex:0,onHold:!1,ssrcMap:{},conferenceID:o,remoteEndpointType:d,fabricTransmissionDirection:p};se&&(nt(Se.senderConfiguration,r,o,null,ce,_.pcHash),se=!1),"function"!=typeof n||n.callstatsID||(n.callstatsID=u),"connected"!==n.iceConnectionState&&"completed"!==n.iceConnectionState||(_.pcState=De.established),function(e,t){var n=le[e],r=[];if(void 0===n)r.push(t),le[e]={},le[e].participants=r;else{var i=n.participants;null===i?(r.push(t),n.participants=r):i.push(t)}}(o,_),_.pcState===De.established&&(jt(n,be.autoFabricSetup,o),Ot(_,n,o));var T=function(e){var t=0;return Object.keys(e).forEach(function(e){e&&e.mediaType&&(t+="audio"===e.mediaType?1:0)}),0<t},E=null;if(i===Ie.multiplex&&_.ssrcMap&&T(_.ssrcMap)?E={mediaType:"audio",ssrc:null,disruptionType:Ae.noAudioInMultiplexFabric}:i===Ie.audio&&_.ssrcMap&&p===ke.sendonly&&T(_.ssrcMap)?E={mediaType:"audio",ssrc:null,disruptionType:Ae.noOutboundAudioOnlyFabric}:i===Ie.audio&&p===ke.receiveonly&&!!_.ssrcMap&&Object.keys(_.ssrcMap).forEach(function(e){Z.push(e)}),E){var w=le[o]?le[o].ucID:null;nt(be.oneWayMedia,l,o,w,E,_.pcHash)}}if(u||(u=ht(o,n).pcHash),function e(t,n,r){navigator&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices&&navigator.mediaDevices.enumerateDevices().then(function(i){var o;x?(o=i,x.sort().toString()===o.sort().toString()||(x=i,at(t,n,r))):(x=i,at(t,n,r)),setTimeout(function(){e(t,n,r)},1e4)}).catch(function(){setTimeout(function(){e(t,n,r)},1e4)})}(o,l,u),J)try{var k,I=K;if(K=[],(k=J.getId())&&I.push(k),I.length>0){var P=le[o].ucID;rt(Te,o,P,I)}}catch(e){B("send associate",e)}return ct(Ce.success)},sendFabricEvent:Tt,sendUserFeedback:function(e,t,n){var r;if(!t||!e)return console.error("sendUserFeedback: Arguments missing/Invalid"),ct(Ce.error,"sendUserFeedback: Arguments missing/Invalid");if("object"!=typeof t)return console.error("sendUserFeedback: Invalid feedback object."),ct(Ce.error,"sendUserFeedback: Invalid feedback object.");if(0===Object.keys(t).length)return console.error("sendUserFeedback: Feedback data object must not be empty."),ct(Ce.error,"sendUserFeedback: Feedback data object must not be empty.");var i=le[e],o=null;void 0!==i&&void 0!==i.ucID&&(o=i.ucID);var a;if(a=null===$e?he:$e,null===o&&(o=v(e)),null===o)return console.error("sendUserFeedback: ucID unavailable"),ct(Ce.error,"sendUserFeedback: ucID unavailable");r="object"==typeof t.userID?t.userID.aliasName:t.userID,t&&t.overall<=0&&(t.overall=null);var s={conferenceID:encodeURIComponent(e),magicKey:a,appID:N,version:R,ucID:o,remoteID:encodeURIComponent(r),userID:encodeURIComponent(r),userQoe:{overall:t.overall}};return t.video&&(s.userQoe.video=t.video),t.audio&&(s.userQoe.audio=t.audio),t.screen&&(s.userQoe.screen=t.screen),t.comment&&(s.userQoe.comment=t.comment),re.authToken&&!pe?(s.token=re.authToken,Ge("feedback",JSON.stringify(s)),g(Se.userFeedback,s,n)):(s.clockUnsynced=pe,ee.cacheEvent({channel:Se.userFeedback,data:s,callback:n}),re.sendAuthenticationRequest(N,r)),ct(Ce.success)},associateMstWithUserID:function(e,t,n,r,i,o){var c;if(c="object"==typeof t?t.aliasName:t,n||(n=A),!(e&&r&&i&&c))return console.error("associateMstWithUserID: Arguments missing"),ct(Ce.error,"associateMstWithUserID: Arguments missing");if(!s(e))return console.error("associateMstWithUserID: Invalid PeerConnection object passed"),ct(Ce.error,"associateMstWithUserID: Invalid PeerConnection object passed");if(void 0===le[n])return console.error("associateMstWithUserID: conferenceID doesn't exist"),ct(Ce.error,"associateMstWithUserID: conferenceID doesn't exist");var u=null;if(null===(u=ht(n,e)))return console.error("associateMstWithUserID: Unknown pcObject passed"),ct(Ce.error,"associateMstWithUserID: Unknown pcObject passed");var l=Ze(u,r);return void 0===l&&(u.ssrcMap[r]={},l=Ze(u,r)),l.remoteUserID=c,l.ssrc=r,l.associatedVideoTag=o,l.usageLabel=i,o&&c!==L&&a(n,o,e,r),ct(Ce.success)},attachWifiStatsHandler:function(e){return e?"function"!=typeof e?(console.error("attachWifiStatsHandler: Arguments Invalid"),ct(Ce.error,"attachWifiStatsHandler: Arguments Invalid")):(S=e,void function e(){S&&S().then(function(t){D=JSON.parse(t),setTimeout(function(){e()},1e4)}).catch(function(){setTimeout(function(){e()},1e4)})}()):(console.error("attachWifiStatsHandler: Arguments missing"),ct(Ce.error,"attachWifiStatsHandler: Arguments missing"))},csError:Ee,fabricUsage:Ie,qualityRating:{excellent:5,good:4,fair:3,poor:2,bad:1},webRTCFunctions:xe,reportError:function(n,r,i,o,a,c){if(r||(r=A),void 0===n||!i)return console.error("reportError: Arguments missing/invalid"),ct(Ce.error,"reportError: Arguments missing/invalid");if(!N||!L)return console.error("reportError: SDK is not initialized"),ct(Ce.error,"reportError: SDK is not initialized");if(!xe.hasOwnProperty(i))return console.error("reportError: Invalid webRTC functionName value: %o",i),ct(Ce.error,"reportError: Invalid webRTC functionName value: "+i);void 0===o&&console.warn("reportError: Missing dom error parameter");var u,l,d,p,h,f,m=null,g=t(),y=le[r],b=null,S=g,_=null,T=null,C=null,E=null;if(C=v(r),p=i,xe.hasOwnProperty(p)?p===xe.createOffer||p===xe.createAnswer||p===xe.setRemoteDescription?h=Ne.negotiationFailure:p===xe.setLocalDescription?h=Ne.sdpError:p===xe.addIceCandidate?h=Ne.sdpError:p===xe.getUserMedia?h=Ne.mediaConfigError:p===xe.iceConnectionFailure?h=Ne.iceFailure:p===xe.signalingError?h=Ne.signalingError:(p===xe.applicationLog||xe.applicationError)&&(h=Ne.applicationLog):h=ze.invalidWebRTCFunctionName,l=h,i!==xe.getUserMedia&&(E=e()),o)if(window.DOMException&&o instanceof window.DOMException)o={message:o.message,name:o.name};else if("object"==typeof o){var w={};o.message&&(w.message=o.message),o.name&&(w.name=o.name),o.constraintName&&(w.constraintName=o.constraintName),o.stack&&(w.stack=o.stack),o=w}if((f=o)&&"string"==typeof f?f=Ct(f,2e4):f&&"object"==typeof f&&f.message&&(f.message=Ct(f.message,2e4)),o=f,s(n)){if(y&&(C=y.ucID),(b=ht(r,n))?(u=b.remoteUserID,S=b.startTime,_=b.pcState,T=b.pc.iceConnectionState,E=b.pcHash,d=b.pcCallback):u=L,m={failureDelay:g-S,reason:l,domError:o,fabricState:_,iceConnectionState:T,function:i,magicKey:$e,endpoint:ae},i===xe.applicationLog||i===xe.applicationError?nt(ye.applicationErrorLog,u,r,C,m,E,d):(nt(ye.fabricSetupFailed,u,r,C,m,E,d),z.errorSinceCreate=t()-z.create,lt()),a||c||n&&n.localDescription||n&&n.remoteDescription){var R={sdp:{}};R.sdp.localSDP=Et(n,a,"localDescription"),R.sdp.remoteSDP=Et(n,c,"remoteDescription"),it(u,r,C,R,E)}}else null===$e&&($e=e()),u=L,m={failureDelay:0,reason:l,domError:o,function:i,magicKey:$e,endpoint:ae},i===xe.applicationLog||i===xe.applicationError?nt(ye.applicationErrorLog,u,r,C,m,null,null):nt(ye.fabricSetupFailed,u,r,C,m,E,null);return ct(Ce.success)},reportUserIDChange:function(e,t,n,r){if(!(e&&n&&r&&t))return console.error("reportUserIDChange: Arguments missing/Invalid"),ct(Ce.error,"reportUserIDChange: Arguments missing/Invalid");if(!N||!L)return console.error("reportUserIDChange: SDK not initialized."),ct(Ce.error,"reportUserIDChange: SDK not initialized");if(""===n||""===t)return console.error("reportUserIDChange: id or conferenceID MUST not be empty"),ct(Ce.error,"reportUserIDChange: id or conferenceID MUST not be empty");if(!s(e))return console.error("reportUserIDChange: Invalid PeerConnection object passed"),ct(Ce.error,"reportUserIDChange: Invalid PeerConnection object passed");var i,o=le[t];if(void 0===o)return console.error("reportUserIDChange: Conference ID not found!"),ct(Ce.error,"reportUserIDChange: Conference ID not found!");var a;if(void 0===o.ucID)return console.error("reportUserIDChange: addNewFabric was not called"),Ke(N,L,"log",{msg:"### reportUserIDChange: addNewFabric was not called"}),ct(Ce.error,"reportUserIDChange: addNewFabric was not called");if(a=o.ucID,null===(i=ht(t,e)))return console.error("reportUserIDChange: Invalid pcObject passed as argument"),ct(Ce.error,"reportUserIDChange: Invalid pcObject passed as argument");var c={id:n,idType:r};return nt(ye.userIDChangedEvent,void 0,t,a,c,null,i.pcCallback),ct(Ce.success)},userIDType:{local:"local",remote:"remote"},setProxyConfig:function(e){return window&&!window.csioproxy?(console.error("setCallstatsURLs: cannot be called if window.csioproxy is false"),ct(Ce.error,"setCallstatsURLs: cannot be called if window.csioproxy is false")):e?(e.collectorURL&&(E=e.collectorURL),e.authServiceURL&&(w=e.authServiceURL),e.csioInternalAPIURL&&(I=e.csioInternalAPIURL),e.wsURL&&(k=e.wsURL),qt(),m(),y(),ct(Ce.success)):(console.error("setCallstatsURLs: Arguments missing/Invalid"),ct(Ce.error,"setCallstatsURLs: Arguments missing/Invalid"))},callStatsAPIReturnStatus:Ce,setIdentifiers:function(e,t){return e?(e.conferenceID&&(function(e){if(le[A]){var t=le[A].participants;if(t)for(var n=0;n<t.length;n++)t[n].conferenceID=e}}(e.conferenceID),le[e.conferenceID]=le[A],a=e.conferenceID,ee.updateConferenceId(encodeURIComponent(a)),It()),e.remoteUserID&&t&&(i=e.remoteUserID,(o=mt(t))&&ee.updateRemoteUserID(i,o.fabric.pcHash),n=e.remoteUserID,r=null,(r=mt(t))&&(r.fabric.remoteUserID=n),It()),ct(Ce.success)):(console.error("setIdentifiers: Arguments missing/Invalid"),ct(Ce.error,"_setIdentifiers: Arguments missing/Invalid"));var n,r,i,o,a},transmissionDirection:ke,endpointType:Re}}o=[],void 0!==(a="function"==typeof(i=r)?i.apply(t,o):i)&&(e.exports=a),e.exports=r}("undefined"!=typeof window&&window)}).call(t,n(20))},function(e,t,n){"use strict";function r(){}r.prototype.measureAppLoadingPerformance=function(e){var t=0,n=Number.MAX_VALUE,r=0,i="",o="",a=window.performance;if(!("performance"in window&&"timing"in window.performance&&"navigation"in window.performance))return{support:"none",total:void 0};var s=a.timing.loadEventEnd-a.timing.navigationStart;if("Chrome"===e.name||"Opera"===e.name){var c,u=a.getEntriesByType("resource");for(c=0;c<u.length;c++)u[c].duration>r&&(o=u[c].name.substr(u[c].name.lastIndexOf("/")+1),r=u[c].duration),u[c].duration<n&&(i=u[c].name.substr(u[c].name.lastIndexOf("/")+1),n=u[c].duration),u[c].name.indexOf("CALLSTATS_SRC_URLstatic/callstats")>-1&&(t=u[c].duration);return{support:"full",callstats:t,min:{name:i,time:n},max:{name:o,time:r},total:s}}return"Firefox"===e.name?{support:"limited",total:s}:void 0},r.prototype.detectBrowserInfo=function(){var e="Chrome",t=null,n=null,r=null,i="Chrome",o="Edge",a=i;if(!window.navigator.userAgent||window.csioReactNative)return console.log("Invalid userAgent"),window&&window.csioGetOsName&&(t=window.csioGetOsName()),window&&window.csioGetOsVer&&(n=window.csioGetOsVer()),window&&window.csioReactNative&&(r="react-native"),{name:e,codebase:a,os:t,osVersion:n,userAgent:r};var s,c=(r=navigator.userAgent).toLowerCase(),u=navigator.appVersion,l=""+parseFloat(navigator.appVersion);-1!==(s=c.indexOf("opera"))?(e="Opera",l=c.substring(s+6),-1!==(s=c.indexOf("Version"))&&(l=c.substring(s+8)),a=i):-1!==(s=c.indexOf("opr"))?(e="Opera",l=c.substring(s+4),-1!==(s=c.indexOf("Version"))&&(l=c.substring(s+8)),a=i):-1!==(s=c.indexOf("msie"))?(e="Microsoft Internet Explorer",l=c.substring(s+5),a=i):-1!==(s=c.indexOf("edge"))?(e=o,l=c.substring(s+5),a=o):-1!==(s=c.indexOf("chrome"))?(e=i,l=c.substring(s+7),a=i):-1!==(s=c.indexOf("safari"))?(e="Safari",l=c.substring(s+7),-1!==(s=c.indexOf("version"))&&(l=c.substring(s+8)),a=i):-1!==(s=c.indexOf("firefox"))?(e="Firefox",l=c.substring(s+8),a="Firefox"):-1!==(s=c.indexOf("trident"))&&(e="Microsoft Internet Explorer",s=c.indexOf("rv"),l=c.substring(s+3,s+7),a=i);var d,p,h=[{s:"Windows 3.11",r:/win16/},{s:"Windows 95",r:/(windows 95|win95|windows_95)/},{s:"Windows ME",r:/(win 9x 4.90|windows me)/},{s:"Windows 98",r:/(windows 98|win98)/},{s:"Windows CE",r:/windows ce/},{s:"Windows 2000",r:/(windows nt 5.0|windows 2000)/},{s:"Windows XP",r:/(windows nt 5.1|windows xp)/},{s:"Windows Server 2003",r:/windows nt 5.2/},{s:"Windows Vista",r:/windows nt 6.0/},{s:"Windows 7",r:/(windows 7|windows nt 6.1)/},{s:"Windows 8.1",r:/(windows 8.1|windows nt 6.3)/},{s:"Windows 8",r:/(windows 8|windows nt 6.2)/},{s:"Windows 10",r:/(windows 10|windows nt 10.0)/},{s:"Windows NT 4.0",r:/(windows nt 4.0|winnt4.0|winnt|windows nt)/},{s:"Windows ME",r:/windows me/},{s:"Android",r:/android/},{s:"Open BSD",r:/openbsd/},{s:"Sun OS",r:/sunos/},{s:"Linux",r:/(linux|x11)/},{s:"iOS",r:/(iphone|ipad|ipod)/},{s:"Mac OS X",r:/mac os x/},{s:"Mac OS",r:/(macppc|macintel|mac_powerpc|macintosh)/},{s:"QNX",r:/qnx/},{s:"UNIX",r:/unix/},{s:"BeOS",r:/beos/},{s:"OS/2",r:/os\/2/},{s:"Search Bot",r:/(nuhk|googlebot|yammybot|openbot|slurp|msnbot|ask jeeves\/teoma|ia_archiver)/}];for(d in h)if(p=h[d],p.r.test(c)){t=p.s;break}switch(t&&/Windows/.test(t)&&(n=/Windows (.*)/.exec(t)[1],t="Windows"),t){case"Mac OS X":n=/mac os x (10[\.\_\d]+)/.exec(c)[1];break;case"Android":n=/android ([\.\_\d]+)/.exec(c)[1];break;case"iOS":n=(n=/os (\d+)_(\d+)_?(\d+)?/.exec(u))[1]+"."+n[2]+"."+(0|n[3])}return{name:e,ver:l.toString(),os:t,osVersion:n,codebase:a,userAgent:r}},e.exports=r},function(e,t,n){function r(){this.invoker=null,this.receiver=null}function i(){this.listeners=[]}function o(e){this.stats=null,this.lastResponsed=(new Date).getTime(),this.onDataSent=e}function a(e){this.ssrc=null,this.direction=void 0,this.mediaType=null,this.resolution=null,this.frameRateReceived=null,this.frameWidth=null,this.rtt=null,this.droppedFramesNum=null,this.packetLosts=null,this.jitter=null,this.bytesReceived=-1,this.packetsReceived=-1,this.packetsDiscarded=-1,this.bytesSent=-1,this.packetsSent=-1,this.stream=e}function s(e,t){var n="number"==typeof e?e:parseInt(e),r="number"==typeof t?t:parseInt(t);return n===r?0:n<r?-1:1}function c(e,t){return s(e.rtt,t.rtt)}function u(e,t){return s(e.frameHeight,t.frameHeight)}function l(e,t){return s(e.frameWidth,t.frameWidth)}function d(e,t){return s(e.jitter,t.jitter)}function p(e,t){var n=parseInt(e.frameRateReceived),r=parseInt(t.frameRateReceived);return n===r?0:n<r?-1:1}function h(e,t){return e}function f(){this.codeBase=null,this.mediaType={unknown:"unknown",audio:"audio",video:"video"},this.codeBaseType={chrome:"Chrome",firefox:"Firefox",edge:"Edge"}}function m(e){O.call(this),this.extractorFnc=e,this.prev=0,this.delta=0,this.first=0,this.actual=0,this.addSignalListener(P.Signals.onDataSent,this.onDataSent,this)}function v(e){O.call(this),this.extractorFnc=e,this.prev=null}function g(e,t){this.intervalPacketsRecv=t,this.intervalLoss=e}function y(e,t){var n=e.getValue(),r=t.getValue();return n===r?0:n<r?-1:1}function b(e,t){return new g((e.getIntervalLoss()+t.getIntervalLoss())/2,(e.getIntervalPacketsRecv()+t.getIntervalPacketsRecv())/2)}function S(){this.measurements=new A(P.maxItemsNum,P.timeoutInMs),this.packetLostTracker=new m(function(e){return e.packetLosts}),this.measurements.addPlugin(this.packetLostTracker),this.packetsDiscardedTracker=new m(function(e){return e.packetsDiscarded}),this.measurements.addPlugin(this.packetsDiscardedTracker),this.resolutionTracker=new v(function(e){return e.resolution}),this.measurements.addPlugin(this.resolutionTracker),this.jitter95PercentileTracker=new D(d,95,h),this.measurements.addPlugin(this.jitter95PercentileTracker),this.jitter95PercentileTracker.addFilter(function(e){return void 0!==e.jitter&&null!==e.jitter}),this.rtt95PercentileTracker=new D(c,95,h),this.measurements.addPlugin(this.rtt95PercentileTracker),this.rtt95PercentileTracker.addFilter(function(e){return void 0!==e.rtt&&null!==e.rtt&&0<e.rtt}),this.frameHeight50PercentileTracker=new D(u,50,h),this.measurements.addPlugin(this.frameHeight50PercentileTracker),this.frameHeight50PercentileTracker.addFilter(function(e){return void 0!==e.frameHeight&&null!==e.frameHeight&&0<e.frameHeight}),this.frameHeight95PercentileTracker=new D(u,95,h),this.measurements.addPlugin(this.frameHeight95PercentileTracker),this.frameHeight95PercentileTracker.addFilter(function(e){return void 0!==e.frameHeight&&null!==e.frameHeight&&0<e.frameHeight}),this.frameRate50PercentileTracker=new D(p,50,h),this.measurements.addPlugin(this.frameRate50PercentileTracker),this.frameRate50PercentileTracker.addFilter(function(e){return void 0!==e.frameRateReceived&&null!==e.frameRateReceived}),this.frameRate95PercentileTracker=new D(p,95,h),this.measurements.addPlugin(this.frameRate95PercentileTracker),this.frameRate95PercentileTracker.addFilter(function(e){return void 0!==e.frameRateReceived&&null!==e.frameRateReceived}),this.frameWidth50PercentileTracker=new D(l,50,h),this.measurements.addPlugin(this.frameWidth50PercentileTracker),this.frameWidth50PercentileTracker.addFilter(function(e){return void 0!==e.frameWidth&&null!==e.frameWidth&&0<e.frameWidth}),this.frameWidth95PercentileTracker=new D(l,95,h),this.measurements.addPlugin(this.frameWidth95PercentileTracker),this.frameWidth95PercentileTracker.addFilter(function(e){return void 0!==e.frameWidth&&null!==e.frameWidth&&0<e.frameWidth}),this.rttAvgRTTracker=new x(function(e){return e.rtt}),this.measurements.addPlugin(this.rttAvgRTTracker),this.rttAvgRTTracker.addFilter(function(e){return void 0!==e.rtt&&null!==e.rtt&&0<e.rtt}),this.frameRateMeanTracker=new x(function(e){return e.frameRateReceived}),this.measurements.addPlugin(this.frameRateMeanTracker),this.frameRateMeanTracker.addFilter(function(e){return void 0!==e.frameRateReceived&&null!==e.frameRateReceived&&0<e.frameRateReceived}),this.frameHeightMeanTracker=new x(function(e){return e.frameHeight}),this.measurements.addPlugin(this.frameHeightMeanTracker),this.frameHeightMeanTracker.addFilter(function(e){return void 0!==e.frameHeight&&null!==e.frameHeight&&0<e.frameHeight}),this.frameWidthMeanTracker=new x(function(e){return e.frameWidth}),this.measurements.addPlugin(this.frameWidthMeanTracker),this.frameWidthMeanTracker.addFilter(function(e){return void 0!==e.frameHeight&&null!==e.frameWidth&&0<e.frameWidth}),this.jitterAvgTracker=new x(function(e){return e.jitter}),this.measurements.addPlugin(this.jitterAvgTracker),this.jitterAvgTracker.addFilter(function(e){return void 0!==e.jitter&&null!==e.jitter&&0<e.jitter}),this.intervalFractionLosts=new A(P.maxItemsNum,P.timeoutInMs),this.FLPercentileTracker=new D(y,95,b),this.intervalFractionLosts.addPlugin(this.FLPercentileTracker),this.lastSent=0,this.firstAdded=0,this.lastAdded=0,this.doSending=!1,this.mediaType=null,this.direction=null,this.lastTraffic=0,this.ssrc=0}function _(){S.call(this),this.bytesReceivedTracker=new m(function(e){return e.bytesReceived}),this.packetsReceivedTracker=new m(function(e){return e.packetsReceived}),this.addPlugin(this.bytesReceivedTracker),this.addPlugin(this.packetsReceivedTracker),this.csioIntBRKbpsCount=0,this.csioIntPRCount=0}function T(){_.call(this),this.quality={eModel:0,bandwidth:0},this.direction=a.Direction.inbound,this.mediaType=a.MediaTypes.audio}function C(){_.call(this),this.frameRateReceivedTracker=new m(function(e){return e.frameRateReceived}),this.frameRatePercTracker=new D(p,10,h),this.frameRatePercTracker.addFilter(function(e){return void 0!==e.frameRateReceived&&null!==e.frameRateReceived}),this.frameRatePercTracker.attach(this.setFrameRateReceived10,this),this.frameRateReceived10=null,this.addPlugin(this.frameRatePercTracker),this.addPlugin(this.frameRateReceivedTracker),this.quality={eModel:0,bandwidth:0,frameRate:0},this.direction=a.Direction.inbound,this.mediaType=a.MediaTypes.video}function E(){S.call(this),this.bytesSentTracker=new m(function(e){return e.bytesSent}),this.packetsSentTracker=new m(function(e){return e.packetsSent}),this.addPlugin(this.bytesSentTracker),this.addPlugin(this.packetsSentTracker),this.csioIntBRKbpsCount=0,this.csioIntPRCount=0}function w(){E.call(this),this.frameRateReceivedTracker=new m(function(e){return e.frameRateReceived}),this.frameRatePercTracker=new D(p,10,h),this.frameRatePercTracker.addFilter(function(e){return void 0!==e.frameRateReceived&&null!==e.frameRateReceived}),this.frameRatePercTracker.attach(this.setFrameRateReceived10,this),this.frameRateReceived10=null,this.addPlugin(this.frameRatePercTracker),this.addPlugin(this.frameRateReceivedTracker),this.quality={eModel:0,bandwidth:0,frameRate:0},this.sendingThroughputObservations={ssrc:0,started:0,max:0,maxTs:0,stable:0,stableTs:0,ready:!1,maxVerified:!1,stableVerified:!1},this.direction=a.Direction.outbound,this.mediaType=a.MediaTypes.video}function R(){E.call(this),this.quality={eModel:0,bandwidth:0},this.direction=a.Direction.outbound,this.mediaType=a.MediaTypes.audio}function k(){this.monitors={},this.assembler=new f,this.sendable=!1,this.inbOneWayAudioDisruption={sent:!1,started:0,hasTrafficTs:0},this.outbOneWayAudioDisruption={sent:!1,started:0,hasTrafficTs:0}}function I(e){this.monitors=new k,this.output=new r,this.lastForwarded=(new Date).getTime(),this.lastInterval=0,this.sentCounter=0,this.nextInterval=0,e.addListener(this.monitors.onDataSent,this.monitors),e.addListener(this.onDataSent,this)}function P(){this.states={Idle:"Idle",Run:"Run"},this.events={OnPolling:"OnPolling",OnStatsRequest:"OnStatsRequest",OnStop:"OnStop",OnStart:"OnStart",OnOneWayAudioDisruptionsRequest:"OnOneWayAudioDisruptionsRequest",OnSendingThroughputObservationsRequest:"OnSendingThroughputObservationsRequest"},this.onDataSent=new i,this.analyzer=new I(this.onDataSent),this.senderGate=new o(this.onDataSent),this.sendingThroughputObservationsSent=!1,this.analyzer.output.connect(this.senderGate.receiver,this.senderGate),this.currentState=this.states.Run}var A=n(77),O=n(33),D=n(79),x=n(82);P.disruptions=[],P.adaptiveSending=!0,P.minMeasurementsNum=20,P.SendingTimeTresholds={max:3e4,min:1e3,regular:5e3},P.minDeltaTimeInMs=1e3,P.maxItemsNum=1e3,P.timeoutInMs=3e5,P.Signals={onDataSent:"onDataSent"},r.prototype={constructor:r,connect:function(e,t){this.invoker=void 0===t?null:t,this.receiver=e},send:function(e){return null===this.receiver?void console.warn("There is no receiver to call"):null===this.invoker?void this.receiver(e):void this.receiver.call(this.invoker,e)}},i.prototype={constructor:i,addListener:function(e,t){this.listeners.push({callback:e,that:t})},notify:function(){for(var e=0;e<this.listeners.length;++e){var t=this.listeners[e];void 0!==t.callback&&null!==t.callback&&(null===t.that?t.callback():t.callback.call(t.that))}}},o.prototype={constructor:o,receiver:function(e){this.stats=e,this.initiate=!1},requestStats:function(){var e,t=(new Date).getTime();if(null===this.stats)return null;if(this.initiate&&t-P.SendingTimeTresholds.min<this.lastResponsed)return console.warn("Reporter : Too small interval between two sampling to response"),null;var n=t-this.lastResponsed;return console.log("Elapsed time since last report: "+n),e={streams:this.stats},this.stats=null,this.lastResponsed=t,this.onDataSent.notify(),this.initiate=!0,e}},a.MediaTypes={audio:"audio",video:"video"},a.Direction={inbound:"inbound",outbound:"outbound"},a.prototype={constructor:a,toString:function(){return"Measurement {RTT: "+this.RTT+"; }"}},f.prototype={constructor:f,do:function(e,t){var n=new a(e);if(n.ssrc=e.ssrc,n.mediaType=this.getMediaType(e),n.resolution=this.getResolution(e),n.frameRateReceived=this.getFrameRate(e),n.frameWidth=this.getFrameWidth(e),n.frameHeight=this.getFrameHeight(e),n.rtt=this.getLatencyData(e),n.droppedFramesNum=this.getDroppedFramesNum(e),n.packetLosts=this.getPacketLosts(e),n.jitter=this.getJitter(e),e.streamType===a.Direction.inbound?(n.direction=a.Direction.inbound,n.bytesReceived=this.getBytesReceived(e),n.packetsReceived=this.getPacketsReceived(e),n.packetsDiscarded=this.getPacketsDiscarded(e)):e.streamType===a.Direction.outbound&&(n.direction=a.Direction.outbound,n.bytesSent=this.getBytesSent(e),n.packetsSent=this.getPacketsSent(e)),void 0!==t&&!0===t){n.rawdats={};for(var r in e.data)e.data.hasOwnProperty(r)&&(n.rawdats[r]=e.data[r])}return n},setupCodeBase:function(e){this.codeBase=e},getBytesSent:function(e){if(void 0===e.data.bytesSent)return 0;var t=this.checkForNan(parseInt(e.data.bytesSent,10));return null!==t?t:0},getBytesReceived:function(e){if(void 0===e.data.bytesReceived)return 0;var t=this.checkForNan(parseInt(e.data.bytesReceived,10));return null!==t?t:0},getPacketsReceived:function(e){if(void 0===e.data.packetsReceived)return 0;var t=this.checkForNegativeValue(parseInt(e.data.packetsReceived,10));return null!==t?t:0},getPacketsSent:function(e){if(void 0===e.data.packetsSent)return 0;var t=this.checkForNegativeValue(parseInt(e.data.packetsSent,10));return null!==t?t:0},getPacketsDiscarded:function(e){if(void 0===e.data.discardedPackets)return 0;var t=this.checkForNan(parseInt(e.data.discardedPackets,10));return null!==t?t:0},getPacketLosts:function(e){if(void 0===e.data.packetsLost)return 0;var t=this.checkForNegativeValue(parseInt(e.data.packetsLost,10));return null!==t?t:0},getDroppedFramesNum:function(e){if(void 0===e.data.droppedFrames)return 0;var t=this.checkForNegativeValue(parseInt(e.data.droppedFrames,10));return null!==t?t:0},getFrameRate:function(e){var t;return void 0!==e.data.googFrameRateOutput?t=parseInt(e.data.googFrameRateOutput,10):void 0!==e.data.googFrameRateDecoded?t=parseInt(e.data.googFrameRateDecoded,10):void 0!==e.data.googFrameRateReceived?t=parseInt(e.data.googFrameRateReceived,10):void 0!==e.data.googFrameRateSent?t=parseInt(e.data.googFrameRateSent,10):void 0!==e.data.framerateMean&&(t=parseInt(e.data.framerateMean,10)),void 0!==t&&(t=isNaN(t)||t<0?null:t),t},getFrameHeight:function(e){var t;return void 0!==e.data.googFrameHeightReceived?t=e.data.googFrameHeightReceived:void 0!==e.data.googFrameHeightSent?t=e.data.googFrameHeightSent:void 0!==e.data.frameHeight&&(t=e.data.frameHeight),t},getJitter:function(e){var t;if(void 0!==e)return void 0!==e.data.googJitterReceived?(t=this.checkForNan(parseInt(e.data.googJitterReceived,10)))?t/1e3:t:this.codeBase===this.codeBaseType.chrome&&void 0!==e.data.jitter?(t=this.checkForNan(parseInt(e.data.jitter,10)))?t/1e3:t:this.codeBase===this.codeBaseType.firefox&&void 0!==e.data.jitter?this.checkForNan(parseInt(e.data.jitter,10)):void 0},getResolution:function(e){var t,n,r,i="unavailable";return t=this.getFrameRate(e),r=this.getFrameWidth(e),n=this.getFrameHeight(e),void 0!==t&&void 0!==r&&void 0!==n&&r>0&&n>0&&(i=r.concat("x",n,"@",t)),i},getFrameWidth:function(e){var t;return void 0!==e.data.googFrameWidthReceived?t=e.data.googFrameWidthReceived:void 0!==e.data.googFrameWidthSent?t=e.data.googFrameWidthSent:void 0!==e.data.frameWidth&&(t=e.data.frameWidth),t},validateRTT:function(e){return isNaN(e)||e<0?null:e},getLatencyData:function(e){return void 0===e?null:void 0!==e.data.googRtt?this.validateRTT(parseInt(e.data.googRtt,10)):void 0!==e.data.roundTripTime?this.validateRTT(parseInt(e.data.roundTripTime,10)):void 0!==e.data.mozRtt?this.validateRTT(parseInt(e.data.mozRtt,10)):null},getMediaType:function(e){var t=this.mediaType.unknown;if(void 0!==e)return e.data&&void 0!==e.data.mediaType?e.data.mediaType:(e.data.mediaType?t=e.data.mediaType:void 0!==e.data.googFrameRateReceived||void 0!==e.data.googFrameRateSent?t=this.mediaType.video:void 0!==e.data.audioInputLevel||void 0!==e.data.audioOutputLevel||void 0!==e.data.audioLevel?t=this.mediaType.audio:void 0!==e.data.framerateMean&&(t=this.mediaType.video),t)},checkForNan:function(e){return isNaN(e)?null:e},checkForNegativeValue:function(e){if(null!==(e=this.checkForNan(e)))return e<0?null:e},toString:function(){return"ToString function is not defined. for this object"}},m.prototype=Object.create(O.prototype),m.prototype.constructor=m,m.prototype.onDataSent=function(){this.prev=this.actual},m.prototype.getActual=function(){return this.actual},m.prototype.getFirst=function(){return this.first},m.prototype.getDelta=function(){return this.delta=this.actual-this.prev,this.delta},m.prototype.getPrevious=function(){return this.prev},m.prototype.add=function(e){var t=this.extractorFnc(e);if(void 0!==t&&null!==t){if(0===this.first)return this.first=t,void(this.actual=t);this.actual=t,this.notify({last:this.prev,delta:this.delta})}},m.prototype.remove=function(){},v.prototype=Object.create(O.prototype),v.prototype.constructor=v,v.prototype.add=function(e){void 0!==e&&null!==e&&(this.prev=this.extractorFnc(e))},v.prototype.remove=function(){},v.prototype.getPrevious=function(){return this.prev},g.prototype={constructor:g,getIntervalLoss:function(){return this.intervalLoss},getIntervalPacketsRecv:function(){return this.intervalPacketsRecv},getValue:function(){return void 0===this.intervalPacketsRecv||void 0===this.intervalLoss?null:null===this.intervalPacketsRecv||null===this.intervalLoss?null:0===this.intervalLoss&&0===this.intervalPacketsRecv?0:this.intervalLoss/(this.intervalPacketsRecv+this.intervalLoss)}},S.VideoThroughputThresholds={green:1024,red:256},S.AudioThroughputThresholds={green:30,red:8},S.FrameRateRatioTresholds={green:.8,red:.3},S.VideoRTTThresholds={green:400,red:1e3},S.VideoFractionLostTreshdolds={green:10,red:50},S.AudioFractionLostTresholds={green:15,red:30},S.AudioEModelTresholds={green:240,red:400},S.avQualityRating={excellent:3,fair:2,bad:1},S.avQualityRatingString={excellent:"excellent",fair:"fair",bad:"bad"},S.prototype={constructor:S,doStart:function(){return!0},getStartTime:function(){return this.firstAdded},hasTraffic:function(){var e=this.getLastMeasurement();return this.direction===a.Direction.inbound?0<e.bytesReceived:this.direction===a.Direction.outbound&&0<e.bytesSent},getTotalTimeInMs:function(){return 0===this.firstAdded?0:this.lastAdded-this.firstAdded},getDeltaTimeInMs:function(){return 0===this.lastSent?this.lastAdded-this.firstAdded:this.lastAdded-this.lastSent},getLastMeasurement:function(){return this.measurements.getLast()},setSSRC:function(e){this.ssrc=e},getSSRC:function(){return this.ssrc},add:function(e){var t=(new Date).getTime();if(0===this.firstAdded){if(!this.doStart(e))return;this.firstAdded=t}this.lastAdded=t,this.measurements.add(e)},requestSending:function(){this.doSending=!0},setIntBRAndPR:function(e,t,n){var r=this.getDeltaTimeInMs(),i=Math.max(P.minDeltaTimeInMs,r),o=8*e.getDelta()/i,a=t.getDelta()/(i/1e3);n.data.csioIntBRKbps=o,n.data.csioIntPR=a,0<o?this.csioIntBRKbpsCount=10:0<this.csioIntBRKbpsCount&&(--this.csioIntBRKbpsCount,this.requestSendingIf(1e3<r&&this.csioIntPRCount<5,"OutboundMonitor csioIntBRKbps is 0 and this is the reason for sending")),0<a?this.csioIntPRCount=10:0<this.csioIntPRCount&&(--this.csioIntPRCount,this.requestSendingIf(1e3<r&&this.csioIntPRCount<5,"OutboundMonitor csioIntPR is 0 and this is the reason for sending: "))},requestSendingIf:function(e,t){this.doSending=this.doSending||e},getAvgRTT:function(){return this.rttAvgRTTracker.getResult()},getResolution:function(){return this.resolutionTracker.getPrevious()},percentileTrackerExtractor:function(e,t,n){var r=null,i=e.getResult();return null===i?n:null===(r=t(i.actual))?n:r},getRTT95:function(){var e=this.percentileTrackerExtractor(this.rtt95PercentileTracker,function(e){return e.rtt},null),t=this.getLastMeasurement();if(null!==t&&null!==e){var n=Math.max(.1*e,50);this.requestSendingIf(e+n<t.rtt,"RTT95 the reason of sending "+e+" < "+t.rtt)}return e},getJitter95:function(){var e=this.percentileTrackerExtractor(this.jitter95PercentileTracker,function(e){return e.jitter},null),t=this.getLastMeasurement();if(null!==t){var n=Math.max(.1*e,10);this.requestSendingIf(e+n<t.jitter,"Jitter95 the reason of sending "+e+" < "+t.jitter)}return this.result},getFrameRateMean:function(){return this.frameRateMeanTracker.getResult()},getFrameWidth50Percentile:function(){return this.percentileTrackerExtractor(this.frameWidth50PercentileTracker,function(e){return e.frameWidth},null)},getFrameWidth95Percentile:function(){return this.percentileTrackerExtractor(this.frameWidth95PercentileTracker,function(e){return e.frameWidth},null)},getFrameHeight50Percentile:function(){return this.percentileTrackerExtractor(this.frameHeight50PercentileTracker,function(e){return e.frameHeight},null)},getFrameHeight95Percentile:function(){return this.percentileTrackerExtractor(this.frameHeight95PercentileTracker,function(e){return e.frameHeight},null)},getFrameRate50Percentile:function(){return this.percentileTrackerExtractor(this.frameRate50PercentileTracker,function(e){return e.frameRateReceived},null)},getFrameRate95Percentile:function(){return this.percentileTrackerExtractor(this.frameRate95PercentileTracker,function(e){return e.frameRateReceived},null)},getFrameHeightMean:function(){return this.frameHeightMeanTracker.getResult()},getFrameWidthMean:function(){return this.frameWidthMeanTracker.getResult()},getAvgJitter:function(){return this.jitterAvgTracker.getResult()},getQualityEvaluation:function(e,t){if(void 0!==e&&void 0!==t)return null===e||null===e?null:t.green<=e?S.avQualityRating.excellent:t.red<e&&e<t.green?S.avQualityRating.fair:S.avQualityRating.bad},getQualityReverseEvaluation:function(e,t){if(void 0!==e&&void 0!==t)return null===e||null===e?null:t.red<e?S.avQualityRating.bad:t.green<=e&&e<=t.red?S.avQualityRating.fair:S.avQualityRating.excellent},hasData:function(){return this.measurements.refresh(),1<this.measurements.getItemsNum()},addPlugin:function(e){this.measurements.addPlugin(e)},setup:function(e){e.data.csioIntBRKbps=0,e.data.csioAvgBRKbps=0,e.data.csioIntFL=void 0,e.data.csioIntMs=Math.max(P.SendingTimeTresholds.regular,this.getDeltaTimeInMs()),e.data.csioIntPR=void 0,e.data.csioPercentileFl=void 0,e.data.csioIntPktLoss=void 0,e.data.csioAvgJitter=this.getAvgJitter(),e.data.csioAvgRtt=this.getAvgRTT(),e.data.csioPercentileJitter=this.getJitter95(),e.data.csioSig2Latency=this.getRTT95(),e.data.csioTimeElapseMs=this.getTotalTimeInMs(),e.data.csioeM=(null!==this.getRTT95()?this.getRTT95():0)+40,e.data.csiores=this.getResolution(),e.data.csioFrameWidth95Percentile=this.getFrameWidth95Percentile(),e.data.csioFrameWidth50Percentile=this.getFrameWidth50Percentile(),e.data.csioFrameHeight95Percentile=this.getFrameHeight95Percentile(),e.data.csioFrameHeight50Percentile=this.getFrameHeight50Percentile(),e.data.csioFrameRate95Percentile=this.getFrameRate95Percentile(),e.data.csioFrameRate50Percentile=this.getFrameRate50Percentile(),e.data.csioFrameWidthMean=this.getFrameWidthMean(),e.data.csioFrameHeightMean=this.getFrameHeightMean(),e.data.csioFrameRateMean=this.getFrameRateMean()},addIntervalFractionLost:function(e){this.intervalFractionLosts.add(e)},getLastFractionLost:function(){return this.intervalFractionLosts.getLast()},getIntervalFractionLost95:function(){var e,t=this.FLPercentileTracker.getResult();if(null===t)return 0;e=t.actual.getValue();var n=this.getLastFractionLost();if(null!==n&&null!==e){var r=Math.max(.05,n.getValue());this.requestSendingIf(n.getValue()+r<e,"Fraction lost is the reason for sending "+n.getValue()+" "+e)}return e},onDataSent:function(){var e=(new Date).getTime();this.measurements.signalize(P.Signals.onDataSent,null),this.lastSent=e},isValid:function(){for(var e=0;e<arguments.length;e++)if(null===arguments[e]||void 0===arguments[e])return!1;return!0},doSend:function(){if(!1===this.hasData())return!0;var e=this.doSending;return this.doSending=!1,e},getMediaType:function(){return this.mediaType},getDirection:function(){return this.direction}},_.prototype=Object.create(S.prototype),_.prototype.constructor=_,_.prototype.setRTT95=function(e){S.prototype.setRTT95(e)},_.prototype.setup=function(e){S.prototype.setup.call(this,e);var t=new g(this.packetLostTracker.getDelta(),this.packetsReceivedTracker.getDelta());this.addIntervalFractionLost(t),e.data.csioIntPktRcv=this.packetsReceivedTracker.getDelta(),this.setIntBRAndPR(this.bytesReceivedTracker,this.packetsReceivedTracker,e),this.getTotalTimeInMs()>0&&(e.data.csioAvgBRKbps=8*this.bytesReceivedTracker.getActual()/this.getTotalTimeInMs()),e.data.csioIntFL=t.getValue(),e.data.csioPercentileFl=this.getIntervalFractionLost95(),e.data.csioeM=(null!==this.getRTT95()?this.getRTT95():0)+40,e.data.csioIntPktLoss=this.packetLostTracker.getDelta(),void 0!==e.data.csioAvgBRKbps&&null!==e.data.csioAvgBRKbps?e.data.csioAvgPacketSize=this.bytesReceivedTracker.getDelta()/this.packetsReceivedTracker.getDelta():e.data.csioAvgPacketSize=null,e.data.csioPktLossPercentage=this.packetLostTracker.getDelta()/this.packetsReceivedTracker.getDelta()*100},T.prototype=Object.create(_.prototype),T.prototype.constructor=T,T.prototype.setup=function(e){_.prototype.setup.call(this,e),e.data.csioMediaType=a.MediaTypes.audio,this.quality.eModel=this.getQualityReverseEvaluation(e.data.csioeM,S.AudioEModelTresholds),this.quality.bandwidth=this.getQualityEvaluation(e.data.csioIntBRKbps,S.AudioThroughputThresholds),e.data.csioMark=this.getQuality()},T.prototype.getQuality=function(){var e=0,t=.5*this.quality.bandwidth+.5*this.quality.eModel;return(t=Math.floor(t))===S.avQualityRating.excellent?e=S.avQualityRatingString.excellent:t===S.avQualityRating.fair?e=S.avQualityRatingString.fair:t===S.avQualityRating.bad&&(e=S.avQualityRatingString.bad),e},C.prototype=Object.create(_.prototype),C.prototype.constructor=C,C.prototype.setFrameRatioQuality=function(){var e=this.frameRateReceivedTracker.getActual(),t=this.frameRateReceivedTracker.getPrevious(),n=0;this.quality.frameRate=0,void 0!==e&&void 0!==t&&null!==e&&null!==t&&0!==t&&(n=e/t,this.quality.frameRate=this.getQualityEvaluation(n,S.FrameRateRatioTresholds))},C.prototype.setFrameRateReceived10=function(e){return null===e?void(this.frameRateReceived10=null):void(this.frameRateReceived10=e.actual)},C.prototype.setup=function(e){_.prototype.setup.call(this,e),e.data.csioMediaType=a.MediaTypes.video,this.setFrameRatioQuality(),this.quality.eModel=this.getQualityReverseEvaluation(e.data.csioeM,S.AudioEModelTresholds),this.quality.bandwidth=this.getQualityEvaluation(e.data.csioIntBRKbps,S.VideoThroughputThresholds),e.data.csioMark=this.getQuality()},C.prototype.getQuality=function(){var e=0,t=.33*this.quality.bandwidth+.33*this.quality.eModel+.33*this.quality.frameRate;return(t=Math.floor(t))===S.avQualityRating.excellent?e=S.avQualityRatingString.excellent:t===S.avQualityRating.fair?e=S.avQualityRatingString.fair:t===S.avQualityRating.bad&&(e=S.avQualityRatingString.bad),e},E.prototype=Object.create(S.prototype),E.prototype.constructor=E,E.prototype.setup=function(e){S.prototype.setup.call(this,e);var t=new g(this.packetLostTracker.getDelta(),this.packetsSentTracker.getDelta());this.addIntervalFractionLost(t),this.setIntBRAndPR(this.bytesSentTracker,this.packetsSentTracker,e),this.getTotalTimeInMs()>0&&(e.data.csioAvgBRKbps=8*this.bytesSentTracker.getActual()/this.getTotalTimeInMs()),e.data.csioIntFL=t.getValue(),e.data.csioIntPktRcv=this.packetsSentTracker.getDelta(),e.data.csioPercentileFl=this.getIntervalFractionLost95(),e.data.csioeM=(null!==this.getRTT95()?this.getRTT95():0)+40,e.data.csioIntPktLoss=this.packetLostTracker.getDelta(),void 0!==e.data.csioAvgBRKbps&&null!==e.data.csioAvgBRKbps?e.data.csioAvgPacketSize=this.bytesSentTracker.getDelta()/this.packetsSentTracker.getDelta():e.data.csioAvgPacketSize=null,e.data.csioPktLossPercentage=this.packetLostTracker.getDelta()/this.packetsSentTracker.getDelta()*100},w.verificationElapsedThreshold=1e4,w.initialElapsedThreshold=15e3,w.minStableKBpsSlack=50,w.prototype=Object.create(E.prototype),w.prototype.constructor=w,w.prototype.setFrameRatioQuality=function(){var e=this.frameRateReceivedTracker.getActual(),t=this.frameRateReceivedTracker.getPrevious(),n=0;this.quality.frameRate=0,void 0!==e&&void 0!==t&&null!==e&&null!==t&&0!==t&&(n=e/t,this.quality.frameRate=this.getQualityEvaluation(n,S.FrameRateRatioTresholds))},w.prototype.setFrameRateReceived10=function(e){return null===e?void(this.frameRateReceived10=null):void(this.frameRateReceived10=e.actual)},w.prototype.getSendingKBitrateObservations=function(){var e=this.sendingThroughputObservations;return e.ready?{ssrc:e.ssrc,maxsendingKBitrate:e.max,timeToMaxSendingKBitrate:e.maxTs-e.started,stablesendingKBitrate:e.stable,timeToStableSendingKBitrate:e.stableTs-e.started}:null},w.prototype.checkSendingKBitrateObservations=function(e){var t=this.sendingThroughputObservations,n=(new Date).getTime();if(!0!==t.ready){if(0===t.started)return t.ssrc=this.getSSRC(),void(t.started=n);var r=e.data.csioIntBRKbps,i=Math.min(w.minStableKBpsSlack,.05*r);t.max<r?(t.max=r,t.maxTs=n):w.verificationElapsedThreshold<n-t.maxTs&&(t.maxVerified=!0),n-t.started<w.initialElapsedThreshold||(r-i<e.data.csioAvgBRKbps&&e.data.csioAvgBRKbps<r+i&&(t.stableTs=n,t.stable=r,t.stableVerified=!0),t.stableVerified&&t.maxVerified&&(t.ready=!0))}},w.prototype.setup=function(e){E.prototype.setup.call(this,e),e.data.csioMediaType=a.MediaTypes.video,this.setFrameRatioQuality(),this.quality.eModel=this.getQualityReverseEvaluation(e.data.csioeM,S.AudioEModelTresholds),this.quality.bandwidth=this.getQualityEvaluation(e.data.csioIntBRKbps,S.VideoThroughputThresholds),e.data.csioMark=this.getQuality(),this.checkSendingKBitrateObservations(e)},w.prototype.getQuality=function(){var e=0,t=.33*this.quality.bandwidth+.33*this.quality.eModel+.33*this.quality.frameRate;return(t=Math.floor(t))===S.avQualityRating.excellent?e=S.avQualityRatingString.excellent:t===S.avQualityRating.fair?e=S.avQualityRatingString.fair:t===S.avQualityRating.bad&&(e=S.avQualityRatingString.bad),e},R.prototype=Object.create(E.prototype),R.prototype.constructor=R,R.prototype.setEModelQuality=function(e){e<S.AudioEModelTresholds.green?this.quality.eModel=S.avQualityRating.excellent:e>S.AudioEModelTresholds.green&&e<S.AudioEModelTresholds.red?this.quality.eModel=S.avQualityRating.fair:e>S.AudioEModelTresholds.red&&(this.quality.eModel=S.avQualityRating.bad)},R.prototype.setThroughputQuality=function(e){null!==e&&void 0!==e&&(e>S.AudioThroughputThresholds.green?this.quality.bandwidth=S.avQualityRating.excellent:e>S.AudioThroughputThresholds.red&&e<S.AudioThroughputThresholds.green?this.quality.bandwidth=S.avQualityRating.fair:e<S.AudioThroughputThresholds.red&&(this.quality.bandwidth=S.avQualityRating.bad))},R.prototype.setup=function(e){E.prototype.setup.call(this,e),this.setThroughputQuality(e.data.csioIntBRKbps),this.setEModelQuality(e.data.csioeM),e.data.csioMediaType=a.MediaTypes.audio,e.data.csioMark=this.getQuality()},R.prototype.doSend=function(){return this.hasData(),!1},R.prototype.getQuality=function(){var e=0,t=.5*this.quality.bandwidth+.5*this.quality.eModel;return(t=Math.floor(t))===S.avQualityRating.excellent?e=S.avQualityRatingString.excellent:t===S.avQualityRating.fair?e=S.avQualityRatingString.fair:t===S.avQualityRating.bad&&(e=S.avQualityRatingString.bad),e},k.OneWayAudioDisruptionTimeout=5e3,k.DisruptionsMediaType={audio:"audio",video:"video",screen:"screen"},k.DisruptionsType={inbOneWayAudioDisruption:"inbOneWayAudioDisruption",outbOneWayAudioDisruption:"outbOneWayAudioDisruption"},k.prototype={constructor:k,getMonitor:function(e){var t;if(this.monitors[e.direction]&&(t=this.monitors[e.direction][e.ssrc]),void 0!==t)return this.monitors[e.direction][e.ssrc];var n=e.direction===a.Direction.inbound,r=e.direction===a.Direction.outbound,i=e.mediaType===a.MediaTypes.audio,o=e.mediaType===a.MediaTypes.video;return(t=n&&i?new T:r&&i?new R:n&&o?new C:r&&o?new w:null).setSSRC(e.ssrc),this.monitors[e.direction]||(this.monitors[e.direction]={}),this.monitors[e.direction][e.ssrc]=t,t},setupCodeBase:function(e){this.assembler.setupCodeBase(e)},isSendable:function(){var e=this.sendable;return this.sendable=!1,e},process:function(e){var t=this.assembler.do(e),n=this.getMonitor(t);return null===n||void 0===n?void console.warn("For ssrc "+t.ssrc+"we do not have monitor"):(n.doSend(t)&&(this.sendable=!0),n.add(t),void n.setup(e))},checkDistortions:function(){var e,t=[],n=[],r=this.monitors[a.Direction.inbound];r&&Object.keys(r).forEach(function(n){(e=r[n]).getMediaType()===a.MediaTypes.audio&&t.push(e)}),(r=this.monitors[a.Direction.outbound])&&Object.keys(r).forEach(function(t){(e=r[t]).getMediaType()===a.MediaTypes.audio&&n.push(e)}),[this.getInbOneWayAudioDisruption(t,n),this.getOutbOneWayAudioDisruption(t,n)].forEach(function(e){e&&P.disruptions.push(e)})},getSendingThroughputObservations:function(){var e=[],t=null,n=this.monitors[a.Direction.outbound];return n?(Object.keys(n).forEach(function(r){(t=n[r]).getMediaType()===a.MediaTypes.video&&e.push(t.getSendingKBitrateObservations())}),e):null},getInbOneWayAudioDisruption:function(e,t){var n=this.inbOneWayAudioDisruption,r=(new Date).getTime();if(n.sent)return null;var i=t.filter(function(e){return 0===e.getStartTime()}).length<1,o=t.filter(function(e){return!e.hasTraffic()}).length<1;if(!i||o)return null;if(!e.length)return null;var a=e.filter(function(e){return!e.hasTraffic()});if(a.length<1)return n.started=0,null;if(0===n.started)return n.started=r,null;if(r-k.OneWayAudioDisruptionTimeout<n.started)return null;var s=a[0].getSSRC();return n.sent=!0,{mediaType:k.DisruptionsMediaType.audio,type:k.DisruptionsType.inbOneWayAudioDisruption,ssrc:s}},getOutbOneWayAudioDisruption:function(e,t){var n=this.outbOneWayAudioDisruption,r=(new Date).getTime();if(n.sent)return null;var i=e.filter(function(e){return 0===e.getStartTime()}).length<1,o=e.filter(function(e){return!e.hasTraffic()}).length<1;if(!i||!o)return null;if(!t.length)return null;var a=t.filter(function(e){return!e.hasTraffic()});if(a.length<1)return n.started=0,null;if(0===n.started)return n.started=r,null;if(r-k.OneWayAudioDisruptionTimeout<n.started)return null;var s=a[0].getSSRC();return n.sent=!0,{mediaType:k.DisruptionsMediaType.audio,type:k.DisruptionsType.outbOneWayAudioDisruption,ssrc:s}},toString:function(){return"ToString function is not defined. for this object"},onDataSent:function(){for(var e in this.monitors)if(this.monitors.hasOwnProperty(e))for(var t in this.monitors[e])if(this.monitors[e].hasOwnProperty(t)){var n=this.monitors[e][t];null!==n?n.onDataSent():console.warn("A Monitor with ssrc: "+t+" should not be null but it is!")}}},I.prototype={constructor:I,onDataSent:function(){++this.sentCounter},getSendingThroughputObservations:function(){var e=this.monitors.getSendingThroughputObservations();return e&&e.filter(function(e){return null===e}).length<1?e:null},receive:function(e){var t=(new Date).getTime(),n=e.streams,r=e.codeBase;this.monitors.setupCodeBase(r);for(var i=0;i<n.length;++i){var o=n[i];this.monitors.process(o)}this.monitors.checkDistortions();var a=!1;if(!1===P.adaptiveSending)(a=this.lastForwarded+P.SendingTimeTresholds.regular<t)&&(this.output.send(n),this.lastInterval=t-this.lastForwarded,this.lastForwarded=t);else{var s=this.monitors.isSendable();if(0===this.sentCounter?a=!0:this.sentCounter<5?(a=this.lastForwarded+P.SendingTimeTresholds.regular<t,s=!1):a=this.lastForwarded+Math.min(P.SendingTimeTresholds.max,this.nextInterval)<t,a||s)if(this.output.send(n),this.lastInterval=t-this.lastForwarded,this.lastForwarded=t,s)this.lastInterval=Math.max(P.SendingTimeTresholds.min,this.lastInterval/2);else if(a){var c=Math.random()+1;this.nextInterval=Math.min(P.SendingTimeTresholds.max,this.lastInterval*c)}}}},P.prototype={constructor:P,fire:function(e){var t;switch(this.currentState){case this.states.Idle:switch(e){case this.events.OnStart:this.currentState=this.states.Run;break;default:console.warn("Unhandled event "+e+" in "+this.currentState+" mode")}break;case this.states.Run:switch(e){case this.events.OnStop:this.currentState=this.states.Idle;break;case this.events.OnPolling:var n=arguments[1];this.analyzer.receive(n);break;case this.events.OnOneWayAudioDisruptionsRequest:if(void 0===(t=arguments[1])){console.warn("OnStatsRequest event required a parameter to store the response");break}0<P.disruptions.length&&(t.response=P.disruptions,P.disruptions=[]);break;case this.events.OnSendingThroughputObservationsRequest:if(void 0===(t=arguments[1])){console.warn("OnSendingThroughputObservationsRequest event required a parameter to store the response");break}!1===this.sendingThroughputObservationsSent&&(t.response=this.analyzer.getSendingThroughputObservations(),this.sendingThroughputObservationsSent=null!==t.response);break;case this.events.OnStatsRequest:if(void 0===(t=arguments[1])){console.warn("OnStatsRequest event required a parameter to store the response");break}t.response=this.senderGate.requestStats();break;default:console.warn("Unhandled event "+e+" in "+this.currentState+" mode")}break;default:console.error("The Reporter machine is in an unkown state: "+this.currentState)}},toString:function(){return"Reporter is in "+this.currentState},setReportingMode:function(e){P.adaptiveSending=!0===e},setSubmissionInterval:function(e){P.SendingTimeTresholds.regular=e,P.adaptiveSending?(P.SendingTimeTresholds.min=1e3,P.SendingTimeTresholds.max=3e4):(P.SendingTimeTresholds.min=e,P.SendingTimeTresholds.max=e)}},e.exports.Reporter=P},function(e,t,n){function r(e,t){this.items=[],this.plugins=[],this.timeoutInMs=t,this.maxItemsNum=e,this.minItemsNum=0,this.last=null}var i=n(78);r.prototype={constructor:r,signalize:function(e,t){for(var n=0;n<this.plugins.length;++n){var r=this.plugins[n];null!==r.signalize&&void 0!==r.signalize?r.signalize.call(r,e,t):console.warn(r)}},toString:function(){return""}},r.prototype.getLast=function(){return this.last},r.prototype.setMaxItemsNum=function(e){this.maxItemsNum=e},r.prototype.setTimeoutInMs=function(e){this.timeoutInMs=e},r.prototype.setMinItemsNum=function(e){this.minItemsNum=e},r.prototype.refresh=function(){if(!(this.items.length<=this.minItemsNum)){for(;0<this.maxItemsNum&&this.maxItemsNum<=this.items.length;)this.remove();0<this.timeoutInMs&&this.timeoutInMs<this.items[0].getElapsed()&&(this.remove(),this.refresh())}},r.prototype.getItemsNum=function(){return this.items.length},r.prototype.add=function(e){this.refresh(),this.items.push(new i(e));for(var t=0;t<this.plugins.length;t++)this.plugins[t].add(e);this.last=e},r.prototype.map=function(e){for(var t=0;t<this.plugins.length;t++)this.plugins[t].map(e)},r.prototype.remove=function(){for(var e=this.items.shift(),t=0;t<this.plugins.length;t++)this.plugins[t].remove(e.value)},r.prototype.foreach=function(e,t){var n=this.items;void 0!==t&&(n=t(n));for(var r=0;r<n.length;r++)e(n[r].value)},r.prototype.addPlugin=function(e){this.plugins.push(e)},e.exports=r},function(e,t){function n(e){this.value=e,this.created=(new Date).getTime()}n.prototype={constructor:n,getElapsed:function(){return(new Date).getTime()-this.created},toString:function(){return""}},e.exports=n},function(e,t,n){function r(e,t,n){if(a.call(this),99<t||t<1)throw new RangeError("Percentile parameter must be between 1 and 99");this.comparator=e,this.percentile=t,this.meanCalcer=void 0===n?function(e,t){return(e+t)/2}:n,this.ratio=t/(100-t),this.maxtree=new o(e),this.mintree=new o(e),this.ratio<1?this.required=1/this.ratio+1:1<this.ratio?this.required=this.ratio+1:this.required=2,this.maxcounter=this.mincounter=0,this.result=null,this.filter=null}var i=n(80),o=n(81),a=n(33);r.prototype=Object.create(a.prototype),r.prototype.constructor=r,r.prototype.addFilter=function(e,t){this.filter={callback:e,that:t}},r.prototype.doFilter=function(e){return null===this.filter||(void 0===this.filter.that||null===this.filter.that?this.filter.callback(e):this.filter.callback.call(this.filter.that,e))},r.prototype.getResult=function(){return this.result},r.prototype.add=function(e){if(this.doFilter(e)){if(this.maxcounter<1)return this.maxtree.insert(e),void++this.maxcounter;this.comparator(e,this.maxtree.getTopValue())<=0?(this.maxtree.insert(e),++this.maxcounter):(this.mintree.insert(e),++this.mincounter),this.balancing(),this.calculate()}},r.prototype.remove=function(e){if(this.doFilter(e)){if(this.maxtree.delete(e))--this.maxcounter;else{if(!this.mintree.delete(e))throw new ReferenceError("The requested value "+e+" is not found in trees");--this.mincounter}this.balancing(),this.calculate()}},r.prototype.balancing=function(){var e=function(){for(var e=(this.maxcounter+1)/(this.mincounter-1);;e=(this.maxcounter+1)/(this.mincounter-1)){if(this.ratio<e||this.mincounter<1)return;this.maxtree.insertByTop(this.mintree.deleteBottomValue()),++this.maxcounter,--this.mincounter}},t=function(){for(var e=(this.maxcounter-1)/(this.mincounter+1);;e=(this.maxcounter-1)/(this.mincounter+1)){if(e<this.ratio||this.maxcounter<1)return;this.mintree.insertByBottom(this.maxtree.deleteTopValue()),++this.mincounter,--this.maxcounter}};if(!(this.maxcounter+this.mincounter<this.required)){if(this.mincounter<1)return void t.call(this);if(this.maxcounter<1)return void e.call(this);var n=this.maxcounter/this.mincounter;this.ratio<n?t.call(this):e.call(this)}},r.prototype.calculate=function(){var e,t,n=new i,r=null,o=this.mincounter+this.maxcounter;if(!(o<1)){if(this.mincounter<1?(t=this.maxtree.getTopValue(),e=this.maxtree.getBottomValue()):this.maxcounter<1?(t=this.mintree.getTopValue(),e=this.mintree.getBottomValue()):(t=this.mintree.getTopValue(),e=this.maxtree.getBottomValue()),n.min=e,n.max=t,n.tracked=o,o<this.required||this.mincounter<1)return r=this.ratio<1?e:1<this.ratio?t:this.meanCalcer(e,t),n.actual=r,n.estimated=!0,this.result=n,void this.notify(this.result);var a=this.maxcounter/this.mincounter;r=this.ratio<a?this.maxtree.getTopValue():a<this.ratio?this.mintree.getBottomValue():this.meanCalcer(this.mintree.getBottomValue(),this.maxtree.getTopValue()),n.actual=r,this.result=n,this.notify(this.result)}},r.prototype.map=function(e){this.mapping(this.result.actual,e)},e.exports=r},function(e,t){function n(){this.estimated=!1,this.tracked=0,this.max=this.min=this.actual=null}n.prototype={constructor:n,toString:function(){return"Tracked: "+this.tracked+" Estimated: "+this.estimated+" Min: "+this.min+" Max: "+this.max+" Actual: "+this.actual}},e.exports=n},function(e,t){function n(e){this.value=[],this.value.push(e),this.left=null,this.right=null}function r(e){this.root=null,this.top=null,this.bottom=null,this.comparator=e,this.node_counter=0,this.duplicate_counter=0}n.prototype={constructor:n,toString:function(){return this.value.toString()}},r.prototype={constructor:r},r.prototype.getTop=function(){return this.top},r.prototype.getTopValue=function(){return null===this.top?null:this.top.value[0]},r.prototype.getBottomValue=function(){return null===this.bottom?null:this.bottom.value[0]},r.prototype.getBottom=function(){return this.bottom},r.prototype.getDuplicatedCounter=function(){return this.duplicate_counter},r.prototype.getNodeCounter=function(){return this.node_counter},r.prototype.getSize=function(){return this.duplicate_counter+this.node_counter},r.prototype.logTree=function(){return null===this.root?void console.log("This tree is empty"):(console.log("Size of the tree: "+this.getSize()+" Node: "+this.getNodeCounter()+" Duplicates: "+this.getDuplicatedCounter()+" Top: "+this.getTop().toString()+" Bottom: "+this.getBottom().toString()),void function e(t,n,r){if(null!==t){for(var i="-",o=0;o<n;++o)i+="--";console.log(i+"> ("+r+") values: ["+t.value.toString()+"]"),null!==t.left&&e(t.left,n+1,"Left"),null!==t.right&&e(t.right,n+1,"Right")}}(this.root,0,"Root"))},r.prototype.insertByTop=function(e){this.inserting(e,this.top)},r.prototype.insertByBottom=function(e){this.inserting(e,this.bottom)},r.prototype.insert=function(e){this.inserting(e,this.root)},r.prototype.inserting=function(e,t){var r=function(){var t=new n(e);return(null===this.top||this.comparator(this.top.value[0],t.value[0])<0)&&(this.top=t),(null===this.bottom||this.comparator(t.value[0],this.bottom.value[0])<0)&&(this.bottom=t),t};if(null===this.root)return this.root=r.call(this),void(this.node_counter=1);for(var i=null,o=t,a=0,s=function(t){return t===e};null!==o;){if(0===(a=this.comparator(e,o.value[0])))return void(o.value.find(s)||(o.value.push(e),++this.duplicate_counter));i=o,o=a<0?o.left:o.right}++this.node_counter,a<0?i.left=r.call(this):i.right=r.call(this)},r.prototype.search=function(e){for(var t,n=this.root,r=null,i=function(t){return t===e};null!==n;){if(0===(t=this.comparator(e,n.value[0])))return n.value.find(i)?(n.parent=r,n):null;r=n,n=t<0?n.left:n.right}return null},r.prototype.getRightist=function(e){for(var t=null;null!==e.right;)t=e,e=e.right;return e.parent=t,e},r.prototype.getLeftist=function(e){for(var t=null;null!==e.left;)t=e,e=e.left;return e.parent=t,e},r.prototype.deleteBottomValue=function(){for(;null===this.bottom;)return null;var e=this.bottom.value[0];return this.delete(e),e},r.prototype.deleteTopValue=function(){for(;null===this.top;)return null;var e=this.top.value[0];return this.delete(e),e},r.prototype.delete=function(e){var t=null,n=function(e,t,n){null!==t?t.left===e?t.left=n:t.right=n:this.root=n};if(null===(t=this.search(e)))return!1;if(1<t.value.length)return t.value.splice(t.value.indexOf(e),1),--this.duplicate_counter,!0;if(--this.node_counter,null===t.left&&null===t.right)n.call(this,t,t.parent,null);else if(null===t.left)n.call(this,t,t.parent,t.right);else if(null===t.right)n.call(this,t,t.parent,t.left);else{for(var r=t.left,i=t;null!==r.right;i=r,r=r.right);i===t?i.left=r.left:i.right=r.left,t.value.shift(),t.value=t.value.concat(r.value)}return function(e){return null===this.root?void(this.bottom=this.top=null):(0===this.comparator(this.top.value[0],e.value[0])&&(this.top=this.getRightist(this.root)),void(0===this.comparator(this.bottom.value[0],e.value[0])&&(this.bottom=this.getLeftist(this.root))))}.call(this,t),!0},e.exports=r},function(e,t,n){function r(e){i.call(this),this.avg=0,this.sum=0,this.count=0,this.filter=null,this.extractor=void 0===e?function(e){return e}:e}var i=n(33);r.prototype=Object.create(i.prototype),r.prototype.constructor=r,r.prototype.add=function(e){(null===this.filter||void 0===this.filter||this.filter(e))&&(this.sum+=parseInt(this.extractor(e)),++this.count,this.calc(this))},r.prototype.addFilter=function(e){this.filter=e},r.prototype.remove=function(e){(null===this.filter||void 0===this.filter||this.filter(e))&&(this.sum-=parseInt(this.extractor(e)),--this.count,this.calc(this))},r.prototype.calc=function(){this.count<1||(this.avg=this.sum/this.count,this.notify(this.avg))},r.prototype.getResult=function(){return this.avg},e.exports=r},function(e,t){function n(e,t,n,r,i){this.pc=e,this.onIceCandidateCallback=t,this.onIceConnectionStateChangeCallback=n,this.onPcSignalingStateChangeCallback=r,this.onPcNegotiationNeededCallback=i,e.addEventListener?(this.pc.addEventListener("icecandidate",this.iceCandidateCallback.bind(this),!1),this.pc.addEventListener("iceconnectionstatechange",this.iceConnectionStateChangeCallback.bind(this),!1),this.pc.addEventListener("signalingstatechange",this.pcSignalingStateChangeCallback.bind(this),!1),this.pc.addEventListener("negotiationneeded",this.pcNegotiationNeededCallback.bind(this),!1)):e.attachEvent&&(this.pc.attachEvent("onicecandidate",this.iceCandidateCallback.bind(this)),this.pc.attachEvent("oniceconnectionstatechange",this.iceConnectionStateChangeCallback.bind(this)),this.pc.attachEvent("onsignalingstatechange",this.pcSignalingStateChangeCallback.bind(this)),this.pc.attachEvent("onnegotiationneeded",this.pcNegotiationNeededCallback.bind(this)))}n.prototype.iceCandidateCallback=function(e){try{this.onIceCandidateCallback(e,this.pc)}catch(e){console.log("onIceCandidateCallback: Error",e)}},n.prototype.iceConnectionStateChangeCallback=function(e){try{this.onIceConnectionStateChangeCallback(e,this.pc)}catch(e){console.log("onIceConnectionStateChangeCallback: Error",e)}},n.prototype.pcSignalingStateChangeCallback=function(e){try{this.onPcSignalingStateChangeCallback(e,this.pc)}catch(e){console.log("onPcSignalingStateChangeCallback: Error",e)}},n.prototype.pcNegotiationNeededCallback=function(e){try{this.onPcNegotiationNeededCallback(e,this.pc)}catch(e){console.log("onPcNegotiationNeededCallback: Error",e)}},e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PreCallTest=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(85),o=n(90),a=n(91),s=n(92),c=n(93),u=n(24),l=n(25),d={RTT:"rtt",THROUGHPUT:"throughput"},p=function(){function e(){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.browserInfo=(0,u.detect)(),this.turnConnection=new i.TurnConnection(this.browserInfo),this.onlineCheck=new c.OnlineCheck,this.callsInProgress=0,this.turnTests=[d.RTT,d.THROUGHPUT],this.active=!1,this.rtt=null,this.resultsHandler=null}return r(e,[{key:"start",value:function(e,t){if(this.browserInfo.browserName!==u.Constants.browserName.msie&&(!window||!window.csioReactNative)&&(this.iceServers=e,this.callback=t,!this.active&&!(this.callsInProgress>0)&&e)){this.turnTestCounter=0,this.resultsHandler=new s.ResultsHandler;var n={type:"browser",os:this.browserInfo.os,osVersion:this.browserInfo.osVersion,buildName:this.browserInfo.browserName,buildVersion:this.browserInfo.browserVersion};this.resultsHandler.add("endpointInfo",n),this.onlineCheck.start(),this.active=!0,this._start()}}},{key:"_start",value:function(){var e=this;this.active&&this.turnConnection.connect(this.iceServers).then(function(){e.active&&e.startTurnTests().then(function(){e.stop()},function(t){e.stop()})},function(t){e.resultsHandler.failure(t),e.resultsHandler.getFailureNumber()>=10?e.stop():(e.turnConnection.disconnect(),setTimeout(function(){e._start()},0))})}},{key:"stop",value:function(){var e=this;if(this.browserInfo.browserName!==u.Constants.browserName.msie&&this.active){this.active=!1,this.activeTurnTest&&this.activeTurnTest.forceStop();var t=this.onlineCheck.stop();this.resultsHandler.add("onlineStatus",t),this.turnConnection.getIceResults().then(function(t){e.resultsHandler.add("ice",t),e.turnConnection.disconnect(),e.sendResults()},function(t){e.resultsHandler.failure(t),e.turnConnection.disconnect(),e.sendResults()})}}},{key:"sendResults",value:function(){var e=this.resultsHandler.getResults();this.callback&&this.callback(e),this.resultsHandler=null}},{key:"callStarts",value:function(){this.callsInProgress+=1,this.stop()}},{key:"callFinished",value:function(){this.callsInProgress-=1}},{key:"getId",value:function(){return this.resultsHandler?this.resultsHandler.getId():null}},{key:"crashDisconnect",value:function(){try{this.turnConnection.disconnect()}catch(e){}}},{key:"startTurnTests",value:function(){var e=this;if(this.turnTestCounter>=this.turnTests.length)return new l(function(e,t){e()});var t=this.turnTests[this.turnTestCounter],n=null;switch(t){case d.RTT:n=new o.RttTest(this.turnConnection);break;case d.THROUGHPUT:n=new a.ThroughputTest(this.turnConnection,this.rtt);break;default:return new l(function(e,n){n(new Error("Unknown test: "+t))})}return this.activeTurnTest=n,this.active?n.start().then(function(){return e.handleTestResults(t,n.getResults()),e.turnTestCounter+=1,e.activeTurnTest=null,e.startTurnTests()},function(r){return e.handleTestResults(t,n.getResults(),r),e.turnTestCounter+=1,e.activeTurnTest=null,e.startTurnTests()}):new l(function(e,t){t(new Error("Test trying to start while testing is not active"))})}},{key:"handleTestResults",value:function(e,t){null==(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)&&e==d.RTT&&(this.rtt=t.median),this.resultsHandler&&this.resultsHandler.add(e,t)}}]),e}();t.PreCallTest=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TurnConnection=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(86),o=n(87),a=n(24),s=n(25),c=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.reset(),this.statshandler=new o.GetStatsHandler(t)}return r(e,[{key:"reset",value:function(){this.iceServers=null,this.pctpc1=null,this.pctpc2=null,this.sendChannel=null,this.messageCallback=null,this.errorCallback=null,this.parsedIceResults={}}},{key:"setMessageCallback",value:function(e){this.messageCallback=e}},{key:"setErrorCallback",value:function(e){this.errorCallback=e}},{key:"send",value:function(e){if(this.sendChannel)try{this.sendChannel.send(e)}catch(e){this.raiseSendError(e)}else this.raiseSendError(new Error("No send channel"))}},{key:"raiseSendError",value:function(e){this.errorCallback&&this.errorCallback(e)}},{key:"assignEvent",value:function(e,t,n){e.addEventListener?e.addEventListener(t,n.bind(this),!1):e.attachEvent&&(t="on"+t,e.attachEvent(t,n.bind(this)))}},{key:"connect",value:function(e){var t=this;this.reset();var n=new s(function(e,n){t.resolveCb=e,t.rejectCb=n});this.iceServers=e;var r=null;try{if(RTCPeerConnection?r=RTCPeerConnection:webkitRTCPeerConnection?r=webkitRTCPeerConnection:mozRTCPeerConnection?r=mozRTCPeerConnection:window&&window.RTCPeerConnection&&(r=window.RTCPeerConnection),!r)return this.rejectCb(new Error("RTCPeerConnection not found")),n}catch(e){return this.rejectCb(e),n}var i={iceTransportPolicy:"all",iceServers:this.iceServers};try{this.pctpc1=new r(i),this.pctpc2=new r(i)}catch(e){return this.rejectDisconnect(e),n}return this.connectionTimer=setTimeout(function(){delete t.connectionTimer,t.rejectDisconnect(new Error("Connection timeout"))},3e4),this.sendChannel=this.pctpc1.createDataChannel("precalltest",{ordered:!1,maxRetransmits:0}),this.sendChannel.binaryType="arraybuffer",this.assignEvent(this.sendChannel,"error",function(e){t.raiseSendError(e),t.rejectDisconnect(e)}),this.assignEvent(this.pctpc2,"datachannel",function(e){var n=e.channel;t.assignEvent(n,"open",function(e){t.resolveCb&&(t.resolveCb(),t.resolveCb=null)}),t.assignEvent(n,"close",function(e){t&&t.disconnect&&t.disconnect()}),t.assignEvent(n,"message",function(e){t.messageCallback&&t.messageCallback(e.data)}),t.assignEvent(n,"error",function(e){t.errorCallback&&t.errorCallback(e),t.rejectDisconnect(e)})}),this.assignEvent(this.pctpc1,"icecandidate",function(e){t.onIceCandidate(t.pctpc1,e)}),this.assignEvent(this.pctpc1,"iceconnectionstatechange",function(e){t.onIceStateChange(t.pctpc1,e)}),this.assignEvent(this.pctpc2,"icecandidate",function(e){t.onIceCandidate(t.pctpc2,e)}),this.assignEvent(this.pctpc2,"iceconnectionstatechange",function(e){t.onIceStateChange(t.pctpc2,e)}),this.pctpc1.createOffer().then(function(e,n){t.onCreateOfferSuccess(e)},function(e){t.onCreateOfferError(t.pctpc1,e)}),n}},{key:"rejectDisconnect",value:function(e){this.rejectCb&&(this.rejectCb(e),this.disconnect())}},{key:"disconnect",value:function(){if(clearTimeout(this.connectionTimer),clearTimeout(this.iceTimer),this.pctpc1)try{this.pctpc1.close()}catch(e){}if(this.pctpc1=null,this.pctpc2)try{this.pctpc2.close()}catch(e){}this.pctpc2=null,this.resolveCb=null,this.rejectCb=null}},{key:"getName",value:function(e){return e===this.pctpc1?"pctpc1":"pctpc2"}},{key:"getOtherPc",value:function(e){return e===this.pctpc1?this.pctpc2:this.pctpc1}},{key:"onCreateOfferError",value:function(e,t){this.rejectDisconnect(t)}},{key:"onCreateAnswerError",value:function(e,t){this.rejectDisconnect(t)}},{key:"onCreateOfferSuccess",value:function(e){var t=this;this.pctpc1.setLocalDescription(e).then(function(){t.onSetLocalSuccess(t.pctpc1)},function(e){t.onSetSessionDescriptionError(t.pctpc1,e)}),this.pctpc2.setRemoteDescription(e).then(function(){t.onSetRemoteSuccess(t.pctpc2)},function(e){t.onSetRemoteSessionDescriptionError(t.pctpc2,e)}),this.pctpc2.createAnswer().then(function(e){t.onCreateAnswerSuccess(e)},function(e){t.onCreateAnswerError(t.pctpc2,e)})}},{key:"onSetLocalSuccess",value:function(e){}},{key:"onSetRemoteSuccess",value:function(e){}},{key:"onSetSessionDescriptionError",value:function(e,t){this.rejectDisconnect(t)}},{key:"onSetRemoteSessionDescriptionError",value:function(e,t){this.rejectDisconnect(t)}},{key:"onCreateAnswerSuccess",value:function(e){var t=this;this.pctpc2.setLocalDescription(e).then(function(){t.onSetLocalSuccess(t.pctpc2)},function(e){t.onSetSessionDescriptionError(t.pctpc2,e)}),this.pctpc1.setRemoteDescription(e).then(function(){t.onSetRemoteSuccess(t.pctpc1)},function(e){t.onSetRemoteSessionDescriptionError(t.pctpc1,e)})}},{key:"onIceCandidate",value:function(e,t){var n=this;if(t.candidate){var r=new i.ParsedIceCandidate(t.candidate);e==this.pctpc1&&this.statshandler.codeBase==a.Constants.codeBaseType.chrome&&(r.isRelay()&&(r.isTypeTransportUdp()&&(this.parsedIceResults.relayUdpGathered=!0),r.isTypeTransportTcp()&&(this.parsedIceResults.relayTcpGathered=!0),r.isTypeTransportTls()&&(this.parsedIceResults.relayTlsGathered=!0)),r.isServerReflexive()&&(this.parsedIceResults.srflxGathered=!0)),r.isRelay()&&this.getOtherPc(e).addIceCandidate(t.candidate).then(function(){n.onAddIceCandidateSuccess(e)},function(t){n.onAddIceCandidateError(e,t,r.isRelay())})}}},{key:"onAddIceCandidateSuccess",value:function(e){}},{key:"onAddIceCandidateError",value:function(e,t,n){n&&this.rejectDisconnect(t)}},{key:"onIceStateChange",value:function(e,t){var n=this,r="(?)";e&&(r=e.iceConnectionState),"failed"===r&&this.rejectDisconnect(new Error("ICE failure")),"checking"!==r||this.iceTimer||(this.iceTimer=setTimeout(function(){delete n.iceTimer,n.rejectDisconnect(new Error("ICE timeout"))},1e4)),"completed"!==r&&"connected"!==r||(clearTimeout(this.iceTimer),delete this.iceTimer)}},{key:"getIceResults",value:function(){var e=this;return new s(function(t,n){var r=e.iceServers,i=!0,o=!1,a=void 0;try{for(var s,c=r[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;r.hasOwnProperty(u)||delete u.credential}}catch(e){o=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw a}}var l={turnIpAddress:"",turnIpVersion:"",turnTransport:"",iceServers:r,ipv6Supported:!1,ipv4Supported:!1,relayTlsGathered:!1,relayTcpGathered:!1,relayUdpGathered:!1,srflxGathered:!1,relayTlsSuccess:!1,relayTcpSuccess:!1,relayUdpSuccess:!1,srflxSuccess:!1};for(var d in e.parsedIceResults)e.parsedIceResults.hasOwnProperty(d)&&(l[d]=e.parsedIceResults[d]);e.pctpc1?e.statshandler.getIceCandidates(e.pctpc1).then(function(e){var n=!0,r=!1,i=void 0;try{for(var o,a=e.iceCandidatePairs[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value;if(s.googActiveConnection||s.selected){var c=!0,u=!1,d=void 0;try{for(var p,h=e.localCandidates[Symbol.iterator]();!(c=(p=h.next()).done);c=!0){var f=p.value,m=null;if(m=f.ip?f.ip:f.ipAddress,f.id==s.localCandidateId){l.turnIpAddress=m;var v=-1!==m.indexOf(":");l.turnIpVersion=v?"ipv6":"ipv4",l.turnTransport=f.mozLocalTransport}"relay"!==f.candidateType&&"relayed"!==f.candidateType||("udp"===f.mozLocalTransport&&(l.relayUdpSuccess=!0),"tcp"===f.mozLocalTransport&&(l.relayTcpSuccess=!0),"tls"===f.mozLocalTransport&&(l.relayTlsSuccess=!0)),-1!==m.indexOf(":")?l.ipv6Supported=!0:l.ipv4Supported=!0}}catch(e){u=!0,d=e}finally{try{!c&&h.return&&h.return()}finally{if(u)throw d}}}}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}var g=!0,y=!1,b=void 0;try{for(var S,_=e.localCandidates[Symbol.iterator]();!(g=(S=_.next()).done);g=!0){var T=S.value;"relay"!==T.candidateType&&"relayed"!==T.candidateType||("udp"===T.mozLocalTransport&&(l.relayUdpGathered=!0),"tcp"===T.mozLocalTransport&&(l.relayTcpGathered=!0),"tls"===T.mozLocalTransport&&(l.relayTlsGathered=!0)),"srflx"!==T.candidateType&&"serverreflexive"!==T.candidateType||(l.srflxGathered=!0)}}catch(e){y=!0,b=e}finally{try{!g&&_.return&&_.return()}finally{if(y)throw b}}var C=!0,E=!1,w=void 0;try{for(var R,k=e.iceCandidatePairs[Symbol.iterator]();!(C=(R=k.next()).done);C=!0){var I=R.value;if("succeeded"===I.state){var P=!0,A=!1,O=void 0;try{for(var D,x=e.localCandidates[Symbol.iterator]();!(P=(D=x.next()).done);P=!0){var N=D.value;N.id==I.localCandidateId&&("relay"!==N.candidateType&&"relayed"!==N.candidateType||("udp"===N.mozLocalTransport&&(l.relayUdpSuccess=!0),"tcp"===N.mozLocalTransport&&(l.relayTcpSuccess=!0),"tls"===N.mozLocalTransport&&(l.relayTlsSuccess=!0)),"srflx"!==N.candidateType&&"serverreflexive"!==N.candidateType||(l.srflxSuccess=!0))}}catch(e){A=!0,O=e}finally{try{!P&&x.return&&x.return()}finally{if(A)throw O}}}}}catch(e){E=!0,w=e}finally{try{!C&&k.return&&k.return()}finally{if(E)throw w}}t(l)},function(e){n(e)}):n(new Error("PC not available for stats"))},function(e){reject(e)})}}]),e}();t.TurnConnection=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.iceCandidateStr=t.candidate,this.parse()}return r(e,[{key:"parse",value:function(){var e=this.iceCandidateStr.split(" ");e.length<8||(this.protocol="1"===e[1]?"rtp":"rtcp",this.transport=e[2],this.typeTransport=this.extractTypeTransport(e[3]),this.ipv6=-1!==e[4].indexOf(":"),this.ipAddress=e[4],this.port=e[5],this.type=e[7])}},{key:"extractTypeTransport",value:function(e){var t="None",n=e>>24;if("rtp"===this.protocol&&n>=0&&n<=2)switch(n){case 0:t="TLS";break;case 1:t="TCP";break;case 2:t="UDP"}return t}},{key:"getString",value:function(){return this.iceCandidateStr}},{key:"getType",value:function(){return this.type}},{key:"isHost",value:function(){return"host"===this.type.toLowerCase()}},{key:"isServerReflexive",value:function(){return"srflx"===this.type.toLowerCase()}},{key:"isPeerReflexive",value:function(){return"prflx"===this.type.toLowerCase()}},{key:"isRelay",value:function(){return"relay"===this.type.toLowerCase()||"relayed"===this.type.toLowerCase()}},{key:"getTypeTransport",value:function(){return this.typeTransport}},{key:"isTypeTransportUdp",value:function(){return"UDP"===this.typeTransport}},{key:"isTypeTransportTcp",value:function(){return"TCP"===this.typeTransport}},{key:"isTypeTransportTls",value:function(){return"TLS"===this.typeTransport}},{key:"getTransport",value:function(){return this.transport}},{key:"isUdp",value:function(){return"udp"===this.transport.toLowerCase()}},{key:"isTcp",value:function(){return"tcp"===this.transport.toLowerCase()}},{key:"getProtocol",value:function(){return this.protocol}},{key:"isRtp",value:function(){return"rtp"===this.protocol}},{key:"isRtcp",value:function(){return"rtcp"===this.protocol}},{key:"isIpv6",value:function(){return this.ipv6}},{key:"getIpAddress",value:function(){return this.ipAddress}},{key:"getPort",value:function(){return this.port}}]),e}();t.ParsedIceCandidate=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GetStatsHandler=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(24),o=n(88),a=n(25),s=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.codeBase=t.codeBase,this.browserName=t.browserName,this.adapter=new o.StatsAdapter(this.codeBase,this.browserName),this.isPromiseBased=!0}return r(e,[{key:"getIceCandidates",value:function(e){var t=this;return new a(function(n,r){t.csioGetStats(t.iceCandidatesHandler.bind(t),e,function(e){n(e)})})}},{key:"iceCandidatesHandler",value:function(e,t){t(this.adapter.getIceCandidates(e))}},{key:"csioGetStats",value:function(e,t,n){var r=i.Constants.codeBaseType.firefox,o=i.Constants.codeBaseType.chrome,a=i.Constants.codeBaseType.edge,s=i.Constants.browserName.safari;t&&(this.codeBase===r?this.getStatsFirefox(e,t,n):this.browserName===s?this.getStatsSafari(e,t,n):this.codeBase===o?this.getStatsChrome(e,t,n):this.codeBase===a&&this.getStatsEdge(e,t,n))}},{key:"getStatsFirefox",value:function(e,t,n){var r=this;if(r.isPromiseBased)try{t.getStats().then(function(t){e(t,n)}).catch(function(i){r.isPromiseBased=!1,t.getStats(null,function(t){e(t,n)},function(){})})}catch(i){r.isPromiseBased=!1,t.getStats(null,function(t){e(t,n)},function(){})}else t.getStats(null,function(t){e(t,n)},function(){})}},{key:"getStatsChrome",value:function(e,t,n){var r=this;if(window&&window.csioReactNative)t.getStats(null,function(t){e(t,n)},function(e){});else if(r.isPromiseBased)try{t.getStats().then(function(t){e(t,n)}).catch(function(i){r.isPromiseBased=!1,t.getStats(function(t){e(t,n)})})}catch(r){isPromiseBased=!1,t.getStats(function(t){e(t,n)})}else t.getStats(function(t){e(t,n)})}},{key:"getStatsEdge",value:function(e,t,n){t.getStats().then(function(t){e(t,n)}).catch(function(e){})}},{key:"getStatsSafari",value:function(e,t,n){t.getStats().then(function(t){e(t,n)}).catch(function(e){})}}]),e}();t.GetStatsHandler=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatsAdapter=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(24),o=function(){function e(t,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.codeBase=t,this.browser=n}return r(e,[{key:"getIceCandidates",value:function(e){if(!e)return null;var t=this.extractRawStats(e);return this.processRawStatsForIceInfo(t)}},{key:"extractRawStats",value:function(e){var t=[],n=void 0,r=i.Constants.codeBaseType.firefox,o=i.Constants.codeBaseType.chrome,a=i.Constants.browserName.safari;if(this.codeBase===r&&this.browser!==a)e.forEach(function(e){t.push(e)});else if(this.codeBase===o&&this.browser!==a)e&&e.result?t=e.result():e&&e.forEach&&(t=[],e.forEach(function(e){t.push(e)}));else for(n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}},{key:"processRawStatsForIceInfo",value:function(e){var t=[],n=[],r=[],i=void 0;if(!e)return null;for(var o=0;o<e.length;++o){var a=this.getParsedStats(e[o]),s=this.statsClassifier(a);if(s.candidatePair)r.push(s.candidatePair);else if(s.transportStats){if("transport"===s.transportStats.type){i=s.transportStats.selectedCandidatePairId;continue}r.push(s.transportStats)}else if(s.localCandidate){var c=s.localCandidate;if("relay"==c.candidateType||"relayed"==c.candidateType){if(!c.mozLocalTransport){var u=c.priority>>24;c.mozLocalTransport=this.formatRelayType(u)}c.mozLocalTransport=c.mozLocalTransport.toLowerCase()}t.push(c)}else s.remoteCandidate&&n.push(s.remoteCandidate)}if(i)for(var l=0;l<r.length;++l)r[l].id===i&&(r[l].googActiveConnection="true");return{localCandidates:t,remoteCandidates:n,iceCandidatePairs:r}}},{key:"getParsedStats",value:function(e){var t={};if(e.timestamp instanceof Date&&(t.timestamp=e.timestamp.getTime().toString()),e.type&&(t.type=e.type),e.names)for(var n=e.names(),r=0;r<n.length;++r)t[n[r]]=e.stat(n[r]);else Object.assign(t,e);if(t.values){var i=!0,o=!1,a=void 0;try{for(var s,c=t.values[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;Object.assign(t,u)}}catch(e){o=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw a}}delete t.values}return t}},{key:"statsClassifier",value:function(e){var t={},n=function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=!0,o=!1,a=void 0;try{for(var s,c=n[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;if(e.type===u)return!0}}catch(e){o=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw a}}return!1},r=n("inbound-rtp","inboundrtp"),i="true"===e.isRemote||!0===e.isRemote;return r||n("outbound-rtp","outboundrtp")?(t.tracks={},t.tracks.data=e,t.tracks.ssrc=e.ssrc,t.tracks.streamType=r?"inbound":"outbound",t.tracks.reportType="local",void 0!==e.isRemote&&(t.tracks.reportType=i?"remote":"local")):n("candidatepair")&&e.selected?t.transportStats=e:n("localcandidate","local-candidate")?t.localCandidate=e:n("remotecandidate","remote-candidate")?t.remoteCandidate=e:n("transport","googCandidatePair")?t.transportStats=e:n("VideoBwe")?t.bwe=e:n("track")?t.trackStats=e:n("candidate-pair")?t.candidatePair=e:n("codec")?t.codec=e:n("ssrc")&&(t.tracks={},t.tracks.data=e,t.tracks.ssrc=e.ssrc,t.tracks.reportType="local",t.tracks.streamType=e.bytesSent?"outbound":"inbound"),t}},{key:"formatRelayType",value:function(e){var t="none";switch(e){case 0:t="tls";break;case 1:t="tcp";break;case 2:t="udp"}return t}}]),e}();t.StatsAdapter=o},function(e,t,n){(function(e,t){!function(e,n){"use strict";function r(e){delete d[e]}function i(e){if(p)setTimeout(i,0,e);else{var t=d[e];if(t){p=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}(t)}finally{r(e),p=!1}}}}if(!e.setImmediate){var o,a,s,c,u,l=1,d={},p=!1,h=e.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(e);f=f&&f.setTimeout?f:e,"[object process]"==={}.toString.call(e.process)?o=function(e){t.nextTick(function(){i(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(c="setImmediate$"+Math.random()+"$",u=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(c)&&i(+t.data.slice(c.length))},e.addEventListener?e.addEventListener("message",u,!1):e.attachEvent("onmessage",u),o=function(t){e.postMessage(c+t,"*")}):e.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){i(e.data)},o=function(e){s.port2.postMessage(e)}):h&&"onreadystatechange"in h.createElement("script")?(a=h.documentElement,o=function(e){var t=h.createElement("script");t.onreadystatechange=function(){i(e),t.onreadystatechange=null,a.removeChild(t),t=null},a.appendChild(t)}):o=function(e){setTimeout(i,0,e)},f.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var r={callback:e,args:t};return d[l]=r,o(l),l++},f.clearImmediate=r}}("undefined"==typeof self?void 0===e?this:e:self)}).call(t,n(20),n(34))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RttTest=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(21)),o=n(41),a=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.sendTimer=null,n.countSent=0,n.rtts=[],n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.TurnTest),r(t,[{key:"initiate",value:function(){this.results.startTimestamp=i.getCurrent(),this.sendPing()}},{key:"handleMessage",value:function(e){if(this.isActive()){var t=parseInt(e,10),n=this.calculateRtt(t);this.rtts.push(n),this.countSent<10?this.sendPing():this.calculateMetrics()}}},{key:"handleError",value:function(e){this.fillResults(),this.failed(e)}},{key:"sendPing",value:function(){if(this.isActive()){var e=i.getCurrent();this.send(e.toString()),this.countSent+=1,this.sendTimer&&(clearTimeout(this.sendTimer),this.sendTimer=null),this.countSent<10?this.sendTimer=setTimeout(this.sendPing.bind(this),100):this.sendTimer=setTimeout(this.calculateMetrics.bind(this),500)}}},{key:"calculateRtt",value:function(e){return i.getCurrent()-e}},{key:"calculateMetrics",value:function(){this.sendTimer&&(clearTimeout(this.sendTimer),this.sendTimer=null),this.fillResults(),this.finished()}},{key:"fillResults",value:function(){this.results.sentMessages=this.countSent,this.results.unAckedMessages=this.countSent-this.rtts.length,this.results.maxMessages=10,this.results.forceStopped=this.forceStopped,this.results.median=this.median(),this.results.variance=this.variance(),this.results.endTimestamp=i.getCurrent()}},{key:"median",value:function(){if(0==this.rtts.length)return null;this.rtts.sort();var e=Math.floor(this.rtts.length/2);return this.rtts[e]}},{key:"variance",value:function(){if(0==this.rtts.length)return null;var e=0,t=this.median(),n=!0,r=!1,i=void 0;try{for(var o,a=this.rtts[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value;e+=Math.abs(s-t)}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}return e/this.rtts.length}},{key:"stop",value:function(){this.isActive()&&(function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"stop",this).call(this),this.fillResults())}}]),t}();t.RttTest=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ThroughputTest=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(21)),o=n(42),a=n(41),s=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(r.sentBytes=0,r.receivedBytes=0,r.secondHalfBytes=0,r.secondHalfStart=null,r.bufferEmpty=0,r.chunkSize=1200,r.messageMaker=new o.MessageMaker(r.chunkSize),r.duration=5e3,null!=n){var i=50*n;r.duration=Math.max(Math.min(i,1e4),1e3)}return r.sendTimer=null,r.lastMessage=null,r.intervals=[],r.intervalStart=0,r.intervalLength=100,r.intervalBytes=0,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.TurnTest),r(t,[{key:"initiate",value:function(){this.startSend()}},{key:"handleMessage",value:function(e){var t=this;if(this.isActive()){this.lastMessage=e,this.receivedBytes+=e.length;var n=i.getCurrent();if(this.sendTimer||(this.results.startTimestamp=n,this.sendTimer=setTimeout(function(){t.stop(),t.finished()},this.duration)),0==this.intervalStart&&(this.intervalStart=n),this.intervalBytes+=e.length,n-this.intervalStart>=this.intervalLength){var r=n-this.intervalStart,o=this.averageThroughput(this.intervalBytes,r),a=null;try{a=n-JSON.parse(this.lastMessage).timestamp}catch(e){}this.intervals.push({startTimestamp:this.intervalStart,endTimestamp:n,bytesReceived:this.intervalBytes,average:o,rtt:a}),this.intervalStart=n,this.intervalBytes=0}this.results.startTimestamp&&n-this.results.startTimestamp>this.duration/2&&(this.secondHalfStart||(this.secondHalfStart=n),this.secondHalfBytes+=e.length)}}},{key:"handleError",value:function(e){this.stop(),this.failed(e)}},{key:"averageThroughput",value:function(e,t){return e/(t/1e3)*8/1024}},{key:"bufferListener",value:function(){this.sendChannel.removeEventListener("bufferedamountlow",this.bufferListener.bind(this)),this.fillBuffer()}},{key:"fillBuffer",value:function(){for(0==this.sendChannel.bufferedAmount&&(this.bufferEmpty+=1);this.isActive();){if(this.sendChannel.bufferedAmount>this.bufferFullThreshold)return void(this.usePolling?setTimeout(this.fillBuffer.bind(this),250):this.sendChannel.addEventListener("bufferedamountlow",this.bufferListener.bind(this)));var e=this.messageMaker.make(this.sentBytes);this.sentBytes+=e.length,this.send(e)}this.sendChannel.removeEventListener("bufferedamountlow",this.bufferListener.bind(this))}},{key:"startSend",value:function(){this.isActive()&&(this.bufferFullThreshold=1e3*this.chunkSize,this.sendChannel=this.connection.sendChannel,this.usePolling=!0,"number"==typeof this.sendChannel.bufferedAmountLowThreshold&&(this.usePolling=!1,this.sendChannel.bufferedAmountLowThreshold=this.bufferFullThreshold/10),setTimeout(this.fillBuffer.bind(this),0))}},{key:"fillResults",value:function(){this.results.endTimestamp=i.getCurrent(),this.results.maxDuration=this.duration,this.results.forceStopped=this.forceStopped,this.results.bufferEmpty=this.bufferEmpty,this.results.intervals=this.intervals,this.results.bytesPrepared=this.sentBytes,this.results.bytesReceived=this.receivedBytes;var e=0,t=0;this.secondHalfStart&&(e=this.results.endTimestamp-this.secondHalfStart,t=this.averageThroughput(this.secondHalfBytes,e));var n=this.results.endTimestamp-this.results.startTimestamp,r=this.averageThroughput(this.receivedBytes,n);r>t&&(t=r),this.results.average=t;var o=null;try{o=JSON.parse(this.lastMessage)}catch(e){return}if(o){var a=o.sentBytes+this.lastMessage.length;this.results.bytesSent=a,this.results.fractionLostBytes=1-this.receivedBytes/a}else this.results.bytesSent=-1,this.results.fractionLostBytes=-1}},{key:"stop",value:function(){this.isActive()&&(clearTimeout(this.sendTimer),this.sendTimer=null,function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"stop",this).call(this),this.fillResults())}}]),t}();t.ThroughputTest=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResultsHandler=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(21)),a=n(42),s=function(){function e(){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.start=o.getCurrent(),this.id=Math.trunc(this.start)+"-"+(0,a.randomAsciiString)(20),this.version="1.1.5",this.failures=[],this.results={},this.forceStopped=!1}return i(e,[{key:"getResults",value:function(){return{id:this.id,version:this.version,forceStopped:this.forceStopped,startTimestamp:this.start,endTimestamp:o.getCurrent(),failures:this.failures,tests:this.results}}},{key:"getFailureNumber",value:function(){return this.failures.length}},{key:"getId",value:function(){return this.id}},{key:"add",value:function(e,t){this.results[e]=t,t.forceStopped&&!0===t.forceStopped&&(this.forceStopped=!0)}},{key:"failure",value:function(e){"object"===(void 0===e?"undefined":r(e))&&(e=e.toString());var t={timestamp:o.getCurrent(),reason:e};this.failures.push(t)}}]),e}();t.ResultsHandler=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OnlineCheck=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(21)),o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"start",value:function(){var e=this;this.onlineCheck=[],window&&window.addEventListener&&"function"==typeof window.addEventListener&&(window.addEventListener("offline",function(){e.addEntry()}),window.addEventListener("online",function(){e.addEntry()}),this.addEntry())}},{key:"addEntry",value:function(){var e=i.getCurrent();if(navigator&&navigator.onLine){var t=navigator.onLine;this.onlineCheck.push({timestamp:e,online:t})}}},{key:"stop",value:function(){var e=this;return window.removeEventListener("offline",function(){e.addEntry()}),window.removeEventListener("online",function(){e.addEntry()}),this.onlineCheck}}]),e}();t.OnlineCheck=o},function(e,t,n){"use strict";(function(e){function r(e,t){return!t||t<=0||!e||e<=0?0:Math.round(e/t*100)}function i(){this.loss={},this.bitrate={download:0,upload:0},this.resolution={},this.framerate=0}function o(e,t,n,r){this._browserType=a.a.getName();var i=h[this._browserType];if(!i)throw"The browser type '"+this._browserType+"' isn't supported!";this._getStatValue=this._defineGetStatValueMethod(i),this.peerconnection=e,this.baselineAudioLevelsReport=null,this.currentAudioLevelsReport=null,this.currentStatsReport=null,this.previousStatsReport=null,this.audioLevelsIntervalId=null,this.eventEmitter=r,this.conferenceStats=new function(){this.bandwidth={},this.bitrate={},this.packetLoss=null,this.transport=[]},this.audioLevelsIntervalMilis=t,this.statsIntervalId=null,this.statsIntervalMilis=n,this.ssrc2stats=new Map}t.a=o;var a=n(1),s=n(39),c=n(44),u=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=n(3),d=n(0).getLogger(e),p=a.a.isChrome()||a.a.isOpera()||a.a.isFirefox()||a.a.isNWJS()||a.a.isElectron()||a.a.isTemasysPluginUsed()||a.a.isEdge(),h={};h[s.b.FIREFOX]={ssrc:"ssrc",packetsReceived:"packetsReceived",packetsLost:"packetsLost",packetsSent:"packetsSent",bytesReceived:"bytesReceived",bytesSent:"bytesSent",framerateMean:"framerateMean"},h[s.b.CHROME]={receiveBandwidth:"googAvailableReceiveBandwidth",sendBandwidth:"googAvailableSendBandwidth",remoteAddress:"googRemoteAddress",transportType:"googTransportType",localAddress:"googLocalAddress",activeConnection:"googActiveConnection",ssrc:"ssrc",packetsReceived:"packetsReceived",packetsSent:"packetsSent",packetsLost:"packetsLost",bytesReceived:"bytesReceived",bytesSent:"bytesSent",googFrameHeightReceived:"googFrameHeightReceived",googFrameWidthReceived:"googFrameWidthReceived",googFrameHeightSent:"googFrameHeightSent",googFrameWidthSent:"googFrameWidthSent",googFrameRateReceived:"googFrameRateReceived",googFrameRateSent:"googFrameRateSent",audioInputLevel:"audioInputLevel",audioOutputLevel:"audioOutputLevel",currentRoundTripTime:"googRtt",remoteCandidateType:"googRemoteCandidateType",localCandidateType:"googLocalCandidateType"},h[s.b.EDGE]={sendBandwidth:"googAvailableSendBandwidth",remoteAddress:"remoteAddress",transportType:"protocol",localAddress:"localAddress",activeConnection:"activeConnection",ssrc:"ssrc",packetsReceived:"packetsReceived",packetsSent:"packetsSent",packetsLost:"packetsLost",bytesReceived:"bytesReceived",bytesSent:"bytesSent",googFrameHeightReceived:"frameHeight",googFrameWidthReceived:"frameWidth",googFrameHeightSent:"frameHeight",googFrameWidthSent:"frameWidth",googFrameRateReceived:"framesPerSecond",googFrameRateSent:"framesPerSecond",audioInputLevel:"audioLevel",audioOutputLevel:"audioLevel",currentRoundTripTime:"roundTripTime"},h[s.b.OPERA]=h[s.b.CHROME],h[s.b.NWJS]=h[s.b.CHROME],h[s.b.ELECTRON]=h[s.b.CHROME],h[s.b.IEXPLORER]=h[s.b.CHROME],h[s.b.SAFARI]=h[s.b.CHROME],h[s.b.REACT_NATIVE]=h[s.b.CHROME],i.prototype.setLoss=function(e){this.loss=e||{}},i.prototype.setResolution=function(e){this.resolution=e||{}},i.prototype.addBitrate=function(e){this.bitrate.download+=e.download,this.bitrate.upload+=e.upload},i.prototype.resetBitrate=function(){this.bitrate.download=0,this.bitrate.upload=0},i.prototype.setFramerate=function(e){this.framerate=e||0},o.prototype.stop=function(){this.audioLevelsIntervalId&&(clearInterval(this.audioLevelsIntervalId),this.audioLevelsIntervalId=null),this.statsIntervalId&&(clearInterval(this.statsIntervalId),this.statsIntervalId=null)},o.prototype.errorCallback=function(e){l.callErrorHandler(e),d.error("Get stats error",e),this.stop()},o.prototype.start=function(e){var t=this;e&&(this.audioLevelsIntervalId=setInterval(function(){t.peerconnection.getStats(function(e){var n=null;n=e&&e.result&&"function"==typeof e.result?e.result():e,t.currentAudioLevelsReport=n,t.processAudioLevelReport(),t.baselineAudioLevelsReport=t.currentAudioLevelsReport},t.errorCallback)},t.audioLevelsIntervalMilis)),p&&(this.statsIntervalId=setInterval(function(){t.peerconnection.getStats(function(e){var n=null;n=e&&e.result&&"function"==typeof e.result?e.result():e,t.currentStatsReport=n;try{t.processStatsReport()}catch(e){l.callErrorHandler(e),d.error("Unsupported key:"+e,e)}t.previousStatsReport=t.currentStatsReport},t.errorCallback)},t.statsIntervalMilis))},o.prototype._defineGetStatValueMethod=function(e){var t=void 0;switch(this._browserType){case s.b.CHROME:case s.b.OPERA:case s.b.NWJS:case s.b.ELECTRON:t=function(e,t){return e.stat(t)};break;case s.b.REACT_NATIVE:t=function(e,t){var n=void 0;return e.values.some(function(e){return!!e.hasOwnProperty(t)&&(n=e[t],!0)}),n};break;case s.b.EDGE:t=function(e,t){return e[t]};break;default:t=function(e,t){return e[t]}}return function(n,r){return t(n,function(t){var n=e[t];if(n)return n;throw"The property '"+t+"' isn't supported!"}(r))}},o.prototype.getNonNegativeStat=function(e,t){var n=this._getStatValue(e,t);return"number"!=typeof n&&(n=Number(n)),isNaN(n)?0:Math.max(0,n)},o.prototype.processStatsReport=function(){var e=this;if(this.previousStatsReport){var t=this._getStatValue,n={};for(var o in this.currentStatsReport)if(this.currentStatsReport.hasOwnProperty(o)){var s=this.currentStatsReport[o];if(s){try{var l=t(s,"receiveBandwidth"),p=t(s,"sendBandwidth");(l||p)&&(this.conferenceStats.bandwidth={download:Math.round(l/1e3),upload:Math.round(p/1e3)})}catch(e){}if("googCandidatePair"===s.type&&"continue"===function(){var n=void 0,r=void 0,i=void 0,o=void 0,a=void 0,c=void 0,u=void 0;try{if(!(n=t(s,"activeConnection")))return"continue";r=t(s,"remoteAddress"),u=t(s,"transportType"),o=t(s,"localAddress"),i=t(s,"localCandidateType"),a=t(s,"remoteCandidateType"),c=e.getNonNegativeStat(s,"currentRoundTripTime")}catch(e){}if(!r||!u||!o||"true"!==n)return"continue";var l=e.conferenceStats.transport;return l.some(function(e){return e.ip===r&&e.type===u&&e.localip===o})||l.push({ip:r,type:u,localip:o,p2p:e.peerconnection.isP2P,localCandidateType:i,remoteCandidateType:a,rtt:c}),"continue"}())continue;if("candidatepair"===s.type){if("succeeded"!==s.state||!s.selected)continue;var h=this.currentStatsReport[s.localCandidateId],f=this.currentStatsReport[s.remoteCandidateId];this.conferenceStats.transport.push({ip:f.ipAddress+":"+f.portNumber,type:h.transport,localip:h.ipAddress+":"+h.portNumber,p2p:this.peerconnection.isP2P,localCandidateType:h.candidateType,remoteCandidateType:f.candidateType})}if("transportdiagnostics"===s.msType&&this.conferenceStats.transport.push({ip:s.remoteAddress,type:s.protocol,localip:s.localAddress,p2p:this.peerconnection.isP2P}),("ssrc"===s.type||"outboundrtp"===s.type||"inboundrtp"===s.type||"track"===s.type)&&(!a.a.isEdge()||"inboundrtp"!==s.type&&"outboundrtp"!==s.type)){var m=this.previousStatsReport[o],v=this.getNonNegativeStat(s,"ssrc");if("track"===s.type&&Array.isArray(s.ssrcIds)&&(v=Number(s.ssrcIds[0])),m&&v&&(a.a.isEdge()||!0!==s.isRemote&&!0!==s.remoteSource)){var g=this.ssrc2stats.get(v);g||(g=new i,this.ssrc2stats.set(v,g));var y=!0,b="packetsReceived",S=t(s,b);void 0!==S&&null!==S&&""!==S||(y=!1,void 0!==(S=t(s,b="packetsSent"))&&null!==S||d.warn("No packetsReceived nor packetsSent stat found")),(!S||S<0)&&(S=0);var _=this.getNonNegativeStat(m,b),T=Math.max(0,S-_),C=this.getNonNegativeStat(s,"packetsLost"),E=this.getNonNegativeStat(m,"packetsLost"),w=Math.max(0,C-E);g.setLoss({packetsTotal:T+w,packetsLost:w,isDownloadStream:y});var R=this.getNonNegativeStat(s,"bytesReceived"),k=this.getNonNegativeStat(m,"bytesReceived"),I=Math.max(0,R-k),P=0,A=t(s,"bytesSent");"number"!=typeof A&&"string"!=typeof A||(A=Number(A),isNaN(A)||(n[v]=A,A>0&&(P=A-t(m,"bytesSent")))),P=Math.max(0,P);var O=s.timestamp-m.timestamp,D=0,x=0;O>0&&(D=Math.round(8*I/O),x=Math.round(8*P/O)),g.addBitrate({download:D,upload:x});var N={height:null,width:null};try{var L=void 0,M=void 0;(L=t(s,"googFrameHeightReceived"))&&(M=t(s,"googFrameWidthReceived"))?(N.height=L,N.width=M):(L=t(s,"googFrameHeightSent"))&&(M=t(s,"googFrameWidthSent"))&&(N.height=L,N.width=M)}catch(e){}var j=void 0;try{j=t(s,"googFrameRateReceived")||t(s,"googFrameRateSent")||0}catch(e){try{j=this.getNonNegativeStat(s,"framerateMean")}catch(e){}}g.setFramerate(Math.round(j||0)),N.height&&N.width?g.setResolution(N):g.setResolution(null)}}}}var F={download:0,upload:0},U={download:0,upload:0},H=0,B=0,G={},J={},V=0,W=0,q=0,K=0,z=!0,Q=!1,$=void 0;try{for(var X,Y=this.ssrc2stats[Symbol.iterator]();!(z=(X=Y.next()).done);z=!0){var Z=X.value,ee=u(Z,2),te=ee[0],ne=ee[1],re=ne.loss,ie=re.isDownloadStream?"download":"upload";F[ie]+=re.packetsTotal,U[ie]+=re.packetsLost,H+=ne.bitrate.download,B+=ne.bitrate.upload;var oe=this.peerconnection.getTrackBySSRC(te);if(oe){oe.isAudioTrack()?(V+=ne.bitrate.download,W+=ne.bitrate.upload):(q+=ne.bitrate.download,K+=ne.bitrate.upload);var ae=oe.getParticipantId();if(ae){var se=ne.resolution;if(se.width&&se.height&&-1!==se.width&&-1!==se.height){var ce=G[ae]||{};ce[te]=se,G[ae]=ce}if(0!==ne.framerate){var ue=J[ae]||{};ue[te]=ne.framerate,J[ae]=ue}}else d.error("No participant ID returned by "+oe)}else this.peerconnection.isP2P&&d.error("JitsiTrack not found for SSRC "+te+" in "+this.peerconnection);ne.resetBitrate()}}catch(e){Q=!0,$=e}finally{try{!z&&Y.return&&Y.return()}finally{if(Q)throw $}}this.eventEmitter.emit(c.c,this.peerconnection,n),this.conferenceStats.bitrate={upload:B,download:H},this.conferenceStats.bitrate.audio={upload:W,download:V},this.conferenceStats.bitrate.video={upload:K,download:q},this.conferenceStats.packetLoss={total:r(U.download+U.upload,F.download+F.upload),download:r(U.download,F.download),upload:r(U.upload,F.upload)},this.eventEmitter.emit(c.d,this.peerconnection,{bandwidth:this.conferenceStats.bandwidth,bitrate:this.conferenceStats.bitrate,packetLoss:this.conferenceStats.packetLoss,resolution:G,framerate:J,transport:this.conferenceStats.transport}),this.conferenceStats.transport=[]}},o.prototype.processAudioLevelReport=function(){if(this.baselineAudioLevelsReport){var e=this._getStatValue;for(var t in this.currentAudioLevelsReport)if(this.currentAudioLevelsReport.hasOwnProperty(t)){var n=this.currentAudioLevelsReport[t];if("ssrc"===n.type||"track"===n.type){var r=this.baselineAudioLevelsReport[t],i=this.getNonNegativeStat(n,"ssrc");if(!i&&Array.isArray(n.ssrcIds)&&(i=Number(n.ssrcIds[0])),r)if(i){var o=void 0;try{o=e(n,"audioInputLevel")||e(n,"audioOutputLevel")}catch(e){return d.warn("Audio Levels are not available in the statistics."),void clearInterval(this.audioLevelsIntervalId)}if(o){var s=void 0;s="ssrc"===n.type?!e(n,"packetsReceived"):!n.remoteSource,a.a.isEdge()?o=o<0?Math.pow(10,o/20):0:o/=32767,this.eventEmitter.emit(c.a,this.peerconnection,i,o,s)}}else Date.now()-n.timestamp<3e3&&d.warn("No ssrc: ");else d.warn(i+" not enough data")}}}}}).call(t,"modules/statistics/RTPStatsCollector.js")},function(e,t,n){var r,i,o;this||window,i=[],void 0===(o="function"==typeof(r=function(){function e(){if(0===i.length)return null;var n,l,d,p,h,f=[],m=e.skipStackDepth||1;for(n=0;n<i.length;n++)a&&o?t.test(i[n].readyState)&&f.push(i[n]):f.push(i[n]);if(l=new Error,c&&(d=l.stack),!d&&u)try{throw l}catch(e){d=e.stack}if(d&&!(h=function(e,t){var n,r=null;if(t=t||i,"string"==typeof e&&e)for(n=t.length;n--;)if(t[n].src===e){r=t[n];break}return r}(p=function e(t,n){var r,i=null,o="number"==typeof n;return n=o?Math.round(n):0,"string"==typeof t&&t&&(o?r=t.match(/(data:text\/javascript(?:;[^,]+)?,.+?|(?:|blob:)(?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/):(r=t.match(/^(?:|[^:@]*@|.+\)@(?=data:text\/javascript|blob|http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)(data:text\/javascript(?:;[^,]+)?,.+?|(?:|blob:)(?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/))&&r[1]||(r=t.match(/\)@(data:text\/javascript(?:;[^,]+)?,.+?|(?:|blob:)(?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/)),r&&r[1]&&(i=n>0?e(t.slice(t.indexOf(r[0])+r[0].length),n-1):r[1])),i}(d,m),f))&&r&&p===r&&(h=function(e){var t,n,r=null;for(t=0,n=(e=e||i).length;t<n;t++)if(!e[t].hasAttribute("src")){if(r){r=null;break}r=e[t]}return r}(f)),h||1===f.length&&(h=f[0]),h||s&&(h=document.currentScript),!h&&a&&o)for(n=f.length;n--;)if("interactive"===f[n].readyState){h=f[n];break}return h||(h=f[f.length-1]||null),h}var t=/^(interactive|loaded|complete)$/,n=window.location?window.location.href:null,r=n&&n.replace(/#.*$/,"").replace(/\?.*$/,"")||null,i=document.getElementsByTagName("script"),o="readyState"in(i[0]||document.createElement("script")),a=!window.opera||"[object Opera]"!==window.opera.toString(),s="currentScript"in document;"stackTraceLimit"in Error&&Error.stackTraceLimit!==1/0&&(Error.stackTraceLimit,Error.stackTraceLimit=1/0);var c=!1,u=!1;!function(){try{var e=new Error;throw c="string"==typeof e.stack&&!!e.stack,e}catch(e){u="string"==typeof e.stack&&!!e.stack}}(),e.skipStackDepth=1;var l=e;return l.near=e,l.far=function(){return null},l.origin=function(){return null},l})?r.apply(t,i):r)||(e.exports=o)},function(e,t){e.exports={LOCAL_JID:"local"}},function(e,t,n){"use strict";(function(e){function r(e){this.versions={},this.conference=e,this.conference.addCommandListener("versions",this.processPresence.bind(this))}t.a=r;var i=n(5),o=n(0).getLogger(e);r.FOCUS_COMPONENT="focus",r.VIDEOBRIDGE_COMPONENT="videobridge",r.XMPP_SERVER_COMPONENT="xmpp",r.prototype.processPresence=function(e,t,n){var a=this;if("http://jitsi.org/jitmeet"===e.attributes.xmlns)if(this.conference._isFocus(n)){var s=[];e.children.forEach(function(e){var t=e.attributes.name;if(t===r.FOCUS_COMPONENT||t===r.XMPP_SERVER_COMPONENT||t===r.VIDEOBRIDGE_COMPONENT){var n=e.value;a.versions[t]!==n&&(a.versions[t]=n,o.info("Got "+t+" version: "+n),s.push({id:"component_version",component:t,version:n}))}else o.warn("Received version for not supported component name: "+t)}),s.length>0&&i.a.sendLog(JSON.stringify(s))}else o.warn("Received versions not from the focus user: "+e,n);else o.warn("Ignored presence versions node - invalid xmlns",e)},r.prototype.getComponentVersion=function(e){return this.versions[e]}}).call(t,"modules/version/ComponentsVersions.js")},function(e,t,n){"use strict";(function(e){function r(e,t,n){if(n<5e3)return 1;var r=0,i=Math.min(t.height,t.width);if(e){var o=h.find(function(e){return e.height<=i});if(o){for(i=o.height;i>=180&&"break"!==function(){var e=i;if(!(o=h.find(function(t){return t.height===e})))return"break";r+=o.target}();i/=2);}}else{var a=t.width*t.height;r=a<=76800?600:a<=307200?1700:a<=518400?2e3:2500}return Math.min(r,function(e){return e>6e4?Number.MAX_SAFE_INTEGER:f*Math.pow(1.08,e/1e3)}(Math.max(0,n-1e3)))}var i=n(31),o=n(7),a=n(0),s=(n.n(a),function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()),c=n(8),u=n(13),l=n(35),d=Object(a.getLogger)(e),p="stats",h=[{width:1920,height:1080,layers:3,max:5e3,target:4e3,min:800},{width:1280,height:720,layers:3,max:2500,target:2500,min:600},{width:960,height:540,layers:3,max:900,target:900,min:450},{width:640,height:360,layers:2,max:700,target:500,min:150},{width:480,height:270,layers:2,max:450,target:350,min:150},{width:320,height:180,layers:1,max:200,target:150,min:30}],f=800,m=function(){function e(t,n,r){var a=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eventEmitter=n,this._conference=t,this._localStats={connectionQuality:100,jvbRTT:void 0},this._lastConnectionQualityUpdate=-1,this._remoteStats={},this._timeIceConnected=-1,this._timeVideoUnmuted=-1,r.startBitrate&&r.startBitrate>0&&(f=r.startBitrate),t.on(o.CONNECTION_INTERRUPTED,function(){a._updateLocalConnectionQuality(0),a.eventEmitter.emit(i.LOCAL_STATS_UPDATED,a._localStats),a._broadcastLocalStats()}),t.room.addListener(c.ICE_CONNECTION_STATE_CHANGED,function(e,t){e.isP2P||"connected"!==t||(a._timeIceConnected=window.performance.now())}),t.on(o.ENDPOINT_MESSAGE_RECEIVED,function(e,t){t.type===p&&a._updateRemoteStats(e.getId(),t.values)}),t.statistics.addConnectionStatsListener(this._updateLocalStats.bind(this)),t.on(o.TRACK_MUTE_CHANGED,function(e){e.isVideoTrack()&&(e.isMuted()?a._timeVideoUnmuted=-1:a._maybeUpdateUnmuteTime())}),t.on(o.TRACK_ADDED,function(e){e.isVideoTrack()&&!e.isMuted()&&a._maybeUpdateUnmuteTime()})}return s(e,[{key:"_maybeUpdateUnmuteTime",value:function(){this._timeVideoUnmuted<0&&(this._timeVideoUnmuted=window.performance.now())}},{key:"_calculateConnectionQuality",value:function(e,t,n){var i=l[n],o=100,a=void 0,s=void 0,c=void 0,p=void 0;if(this._localStats.packetLoss&&(c=this._localStats.packetLoss.upload,t&&(c*=.5)),t||!i||e===u.DESKTOP||this._timeIceConnected<0||this._timeVideoUnmuted<0)void 0===c?(d.error("Cannot calculate connection quality, unknown packet loss."),o=100):o=c<=2?100:c<=4?70:c<=6?50:c<=8?30:c<=12?10:0;else{s=window.performance.now()-Math.max(this._timeVideoUnmuted,this._timeIceConnected);var h=this._conference.getActivePeerConnection();p=r(a=Boolean(h&&h.isSimulcastOn()),i,s),p=Math.min(.9*p,2500),o=100*this._localStats.bitrate.upload/p,c&&c>=10&&(o=Math.min(o,30))}if(this._lastConnectionQualityUpdate>0){var f=this._localStats.connectionQuality,m=(window.performance.now()-this._lastConnectionQualityUpdate)/1e3;o=Math.min(o,f+2*m)}var v=Math.min(100,o);return console.debug("calculated connection quality",JSON.stringify({connectionQuality:v,isMuted:t,isSimulcastOn:a,lastUpdate:this._lastConnectionQualityUpdate,millisSinceStart:s,packetLoss:c,resolution:i,target:p,upload:this._localStats.bitrate&&this._localStats.bitrate.upload})),v}},{key:"_updateLocalConnectionQuality",value:function(e){this._localStats.connectionQuality=e,this._lastConnectionQualityUpdate=window.performance.now()}},{key:"_broadcastLocalStats",value:function(){var e={bitrate:this._localStats.bitrate,packetLoss:this._localStats.packetLoss,connectionQuality:this._localStats.connectionQuality,jvbRTT:this._localStats.jvbRTT};try{this._conference.broadcastEndpointMessage({type:p,values:e})}catch(e){}}},{key:"_updateLocalStats",value:function(e,t){if(!e.isP2P){var n=t.transport&&t.transport.length&&t.transport[0].rtt;this._localStats.jvbRTT=n||void 0}if(e===this._conference.getActivePeerConnection()){var r=void 0,o=!this._conference.isConnectionInterrupted(),a=this._conference.getLocalVideoTrack(),s=a?a.videoType:void 0,c=!a||a.isMuted(),u=a?a.resolution:null;c||this._maybeUpdateUnmuteTime();for(r in t)t.hasOwnProperty(r)&&(this._localStats[r]=t[r]);o&&this._updateLocalConnectionQuality(this._calculateConnectionQuality(s,c,u)),this.eventEmitter.emit(i.LOCAL_STATS_UPDATED,this._localStats),this._broadcastLocalStats()}}},{key:"_updateRemoteStats",value:function(e,t){this._remoteStats[e]={bitrate:t.bitrate,packetLoss:t.packetLoss,connectionQuality:t.connectionQuality,jvbRTT:t.jvbRTT},this.eventEmitter.emit(i.REMOTE_STATS_UPDATED,e,this._remoteStats[e])}},{key:"getStats",value:function(){return this._localStats}}]),e}();t.a=m}).call(t,"modules/connectivity/ConnectionQuality.js")},function(e,t,n){"use strict";t.a=function(e){var t=this,n=e.id,o=e.password,a=e.onLoginSuccessful,s=e.roomPassword,c=!1,u=void 0,l=new i.a(this.connection.options),d=new Promise(function(e,i){u=i,l.addListener(r.CONNECTION_DISCONNECTED,function(){l=void 0}),l.addListener(r.CONNECTION_ESTABLISHED,function(){if(!c){a&&a();l.createRoom(t.options.name,t.options.config).moderator.authenticate().then(function(){l&&l.disconnect(),c||(t.join(s),e())}).catch(function(e){var t=e.error,n=e.message;l.disconnect(),i({authenticationError:t,message:n})})}}),l.addListener(r.CONNECTION_FAILED,function(e,t,n){i({connectionError:e,credentials:n,message:t}),l=void 0}),c||l.connect(n,o)});return d.cancel=function(){c=!0,u({}),l&&l.disconnect()},d};var r=n(26),i=n(46)},function(e,t,n){!function(e){"use strict";e.Strophe.addConnectionPlugin("disco",{_connection:null,_identities:[],_features:[],_items:[],init:function(t){this._connection=t,this._identities=[],this._features=[],this._items=[],t.addHandler(this._onDiscoInfo.bind(this),e.Strophe.NS.DISCO_INFO,"iq","get",null,null),t.addHandler(this._onDiscoItems.bind(this),e.Strophe.NS.DISCO_ITEMS,"iq","get",null,null)},addIdentity:function(e,t,n,r){for(var i=0;i<this._identities.length;i++)if(this._identities[i].category==e&&this._identities[i].type==t&&this._identities[i].name==n&&this._identities[i].lang==r)return!1;return this._identities.push({category:e,type:t,name:n,lang:r}),!0},addFeature:function(e){for(var t=0;t<this._features.length;t++)if(this._features[t]==e)return!1;return this._features.push(e),!0},removeFeature:function(e){for(var t=0;t<this._features.length;t++)if(this._features[t]===e)return this._features.splice(t,1),!0;return!1},addItem:function(e,t,n,r){return!(n&&!r||(this._items.push({jid:e,name:t,node:n,call_back:r}),0))},info:function(t,n,r,i,o){var a={xmlns:e.Strophe.NS.DISCO_INFO};n&&(a.node=n);var s=e.$iq({from:this._connection.jid,to:t,type:"get"}).c("query",a);this._connection.sendIQ(s,r,i,o)},items:function(t,n,r,i,o){var a={xmlns:e.Strophe.NS.DISCO_ITEMS};n&&(a.node=n);var s=e.$iq({from:this._connection.jid,to:t,type:"get"}).c("query",a);this._connection.sendIQ(s,r,i,o)},_buildIQResult:function(t,n){var r=t.getAttribute("id"),i=t.getAttribute("from"),o=e.$iq({type:"result",id:r});return null!==i&&o.attrs({to:i}),o.c("query",n)},_onDiscoInfo:function(t){var n,r=t.getElementsByTagName("query")[0].getAttribute("node"),i={xmlns:e.Strophe.NS.DISCO_INFO};r&&(i.node=r);var o=this._buildIQResult(t,i);for(n=0;n<this._identities.length;n++)i={category:this._identities[n].category,type:this._identities[n].type},this._identities[n].name&&(i.name=this._identities[n].name),this._identities[n].lang&&(i["xml:lang"]=this._identities[n].lang),o.c("identity",i).up();for(n=0;n<this._features.length;n++)o.c("feature",{var:this._features[n]}).up();return this._connection.send(o.tree()),!0},_onDiscoItems:function(t){var n,r,i={xmlns:e.Strophe.NS.DISCO_ITEMS},o=t.getElementsByTagName("query")[0].getAttribute("node");if(o){for(i.node=o,n=[],r=0;r<this._items.length;r++)if(this._items[r].node==o){n=this._items[r].call_back(t);break}}else n=this._items;var a=this._buildIQResult(t,i);for(r=0;r<n.length;r++){var s={jid:n[r].jid};n[r].name&&(s.name=n[r].name),n[r].node&&(s.node=n[r].node),a.c("item",s).up()}return this._connection.send(a.tree()),!0}})}(n(2))},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(2)),o=(n.n(i),n(102)),a=n(22),s=n(8),c=n.n(s),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=Object(r.getLogger)(e),d=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.xmpp=e,n.rooms={},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.a),u(t,[{key:"init",value:function(e){(function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"init",this).call(this,e),this.connection.addHandler(this.onPresence.bind(this),null,"presence",null,null,null,null),this.connection.addHandler(this.onPresenceUnavailable.bind(this),null,"presence","unavailable",null),this.connection.addHandler(this.onPresenceError.bind(this),null,"presence","error",null),this.connection.addHandler(this.onMessage.bind(this),null,"message",null,null),this.connection.addHandler(this.onMute.bind(this),"http://jitsi.org/jitmeet/audio","iq","set",null,null)}},{key:"createRoom",value:function(e,t,n){var r=i.Strophe.getBareJidFromJid(e);if(this.rooms[r]){var a="You are already in the room!";throw l.error(a),new Error(a)}return this.rooms[r]=new o.a(this.connection,e,t,this.xmpp,n),this.eventEmitter.emit(c.a.EMUC_ROOM_ADDED,this.rooms[r]),this.rooms[r]}},{key:"doLeave",value:function(e){this.eventEmitter.emit(c.a.EMUC_ROOM_REMOVED,this.rooms[e]),delete this.rooms[e]}},{key:"onPresence",value:function(e){var t=e.getAttribute("from");if(e.getAttribute("type"))return!0;var n=this.rooms[i.Strophe.getBareJidFromJid(t)];return n?($(e).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="201"]').length&&n.createNonAnonymousRoom(),n.onPresence(e),!0):void 0}},{key:"onPresenceUnavailable",value:function(e){var t=e.getAttribute("from"),n=this.rooms[i.Strophe.getBareJidFromJid(t)];if(n)return n.onPresenceUnavailable(e,t),!0}},{key:"onPresenceError",value:function(e){var t=e.getAttribute("from"),n=this.rooms[i.Strophe.getBareJidFromJid(t)];if(n)return n.onPresenceError(e,t),!0}},{key:"onMessage",value:function(e){var t=e.getAttribute("from"),n=this.rooms[i.Strophe.getBareJidFromJid(t)];if(n)return n.onMessage(e,t),!0}},{key:"onMute",value:function(e){var t=e.getAttribute("from"),n=this.rooms[i.Strophe.getBareJidFromJid(t)];if(n)return n.onMute(e),!0}}]),t}();t.a=function(e){i.Strophe.addConnectionPlugin("emuc",new d(e))}}).call(t,"modules/xmpp/strophe.emuc.js")},function(e,t,n){"use strict";(function(e){function r(e,t){for(var n=[],r=0;r<e.length;r++)e[r].tagName===t&&n.push(e[r]);return n}var i=n(0),o=(n.n(i),n(2)),a=(n.n(o),n(3)),s=n.n(a),c=n(48),u=n(10),l=n(23),d=n(4),p=n(8),h=n.n(p),f=n(103),m=n(50),v=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y=Object(i.getLogger)(e),b={packet2JSON:function(e,t){var n=this;$(e).children().each(function(){var e={tagName:$(this).prop("tagName"),attributes:{}};$($(this)[0].attributes).each(function(t,n){e.attributes[n.name]=n.value});var r=o.Strophe.getText($(this)[0]);r&&(e.value=r),e.children=[],t.push(e),n.packet2JSON($(this),e.children)})},json2packet:function(e,t){for(var n=0;n<e.length;n++){var r=e[n];r&&(t.c(r.tagName,r.attributes),r.value&&t.t(r.value),r.children&&this.json2packet(r.children,t),t.up())}}},S=["jitsi-meet-muc-msg-topic","payload"],_=function(e){function t(e,n,r,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return s.xmpp=i,s.connection=e,s.roomjid=o.Strophe.getBareJidFromJid(n),s.myroomjid=n,s.password=r,y.info("Joined MUC as "+s.myroomjid),s.members={},s.presMap={},s.presHandlers={},s.joined=!1,s.role=null,s.focusMucJid=null,s.noBridgeAvailable=!1,s.options=a||{},s.moderator=new f.a(s.roomjid,s.xmpp,s.eventEmitter,{connection:s.xmpp.options,conference:s.options}),s.initPresenceMap(a),s.lastPresences={},s.phoneNumber=null,s.phonePin=null,s.connectionTimes={},s.participantPropertyListener=null,s.locked=!1,s.transcriptionStatus=c.OFF,s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.a),v(t,[{key:"initPresenceMap",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.presMap.to=this.myroomjid,this.presMap.xns="http://jabber.org/protocol/muc",this.presMap.nodes=[],this.presMap.nodes.push({tagName:"user-agent",value:navigator.userAgent,attributes:{xmlns:"http://jitsi.org/jitmeet/user-agent"}}),e.enableStatsID&&this.presMap.nodes.push({tagName:"stats-id",value:l.a.callStatsUserName}),this.addVideoInfoToPresence(!1),e.deploymentInfo&&e.deploymentInfo.userRegion&&this.presMap.nodes.push({tagName:"region",attributes:{id:e.deploymentInfo.userRegion,xmlns:"http://jitsi.org/jitsi-meet"}})}},{key:"updateDeviceAvailability",value:function(e){this.presMap.nodes.push({tagName:"devices",children:[{tagName:"audio",value:e.audio},{tagName:"video",value:e.video}]})}},{key:"join",value:function(e){var t=this;this.password=e,this.moderator.allocateConferenceFocus(function(){return t.sendPresence(!0)})}},{key:"sendPresence",value:function(e){var t=this.presMap.to;if(t&&(this.joined||e)){var n=Object(o.$pres)({to:t});e&&(n.c("x",{xmlns:this.presMap.xns}),this.password&&n.c("password").t(this.password).up(),n.up()),b.json2packet(this.presMap.nodes,n),this.connection.send(n),e&&this.connection.flush()}}},{key:"doLeave",value:function(){y.log("do leave",this.myroomjid);var e=Object(o.$pres)({to:this.myroomjid,type:"unavailable"});this.presMap.length=0,this.connection.flush(),this.connection.send(e),this.connection.flush()}},{key:"discoRoomInfo",value:function(){var e=this,t=Object(o.$iq)({type:"get",to:this.roomjid}).c("query",{xmlns:o.Strophe.NS.DISCO_INFO});this.connection.sendIQ(t,function(t){var n=1===$(t).find('>query>feature[var="muc_passwordprotected"]').length;n!==e.locked&&(e.eventEmitter.emit(h.a.MUC_LOCK_CHANGED,n),e.locked=n)},function(e){s.a.callErrorHandler(e),y.error("Error getting room info: ",e)})}},{key:"createNonAnonymousRoom",value:function(){var e=Object(o.$iq)({type:"get",to:this.roomjid}).c("query",{xmlns:"http://jabber.org/protocol/muc#owner"}).c("x",{xmlns:"jabber:x:data",type:"submit"}),t=this;this.connection.sendIQ(e,function(e){if(!$(e).find('>query>x[xmlns="jabber:x:data"]>field[var="muc#roomconfig_whois"]').length){var n="non-anonymous rooms not supported";return s.a.callErrorHandler(new Error(n)),void y.error(n)}var r=Object(o.$iq)({to:t.roomjid,type:"set"}).c("query",{xmlns:"http://jabber.org/protocol/muc#owner"});r.c("x",{xmlns:"jabber:x:data",type:"submit"}),r.c("field",{var:"FORM_TYPE"}).c("value").t("http://jabber.org/protocol/muc#roomconfig").up().up(),r.c("field",{var:"muc#roomconfig_whois"}).c("value").t("anyone").up().up(),t.connection.sendIQ(r)},function(e){s.a.callErrorHandler(e),y.error("Error getting room configuration form: ",e)})}},{key:"onPresence",value:function(e){var t=e.getAttribute("from"),n={};n.show=$(e).find(">show").text();var r=$(e).find(">status");r.length&&(n.status=r.text());var i=!1,a=$(e).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>item');n.affiliation=a.attr("affiliation"),n.role=a.attr("role");var s=a.attr("jid");n.jid=s,n.isFocus=s&&0===s.indexOf(this.moderator.getFocusUserJid()+"/"),n.isHiddenDomain=s&&s.indexOf("@")>0&&this.options.hiddenDomain===s.substring(s.indexOf("@")+1,s.indexOf("/")),$(e).find(">x").remove();var c=[];b.packet2JSON(e,c),this.lastPresences[t]=c;for(var u=null,l=0;l<c.length;l++){var d=c[l];switch(d.tagName){case"nick":n.nick=d.value;break;case"userId":n.id=d.value;break;case"stats-id":n.statsID=d.value}}if(t===this.myroomjid){var p="owner"===n.affiliation?n.role:"none";if(this.role!==p&&(this.role=p,this.eventEmitter.emit(h.a.LOCAL_ROLE_CHANGED,this.role)),!this.joined){this.joined=!0;var f=this.connectionTimes["muc.joined"]=window.performance.now();y.log("(TIME) MUC joined:\t",f),this.password&&(this.locked=!0),this.eventEmitter.emit(h.a.MUC_JOINED)}}else if(void 0===this.members[t])this.members[t]=n,y.log("entered",t,n),i=void 0!==n.status,n.isFocus?this._initFocus(t,s):(this.eventEmitter.emit(h.a.MUC_MEMBER_JOINED,t,n.nick,n.role,n.isHiddenDomain,n.statsID,n.status),i=!1);else{var m=this.members[t];m.role!==n.role&&(m.role=n.role,this.eventEmitter.emit(h.a.MUC_ROLE_CHANGED,t,n.role)),n.isFocus&&(m.isFocus=!0,this._initFocus(t,s)),n.displayName&&(m.displayName=n.displayName),m.status!==n.status&&(i=!0,m.status=n.status)}for(var v=0;v<c.length;v++){var g=c[v];switch(g.tagName){case"nick":if(!n.isFocus){var S=this.xmpp.options.displayJids?o.Strophe.getResourceFromJid(t):n.nick;S&&S.length>0&&this.eventEmitter.emit(h.a.DISPLAY_NAME_CHANGED,t,S)}break;case"bridgeNotAvailable":n.isFocus&&!this.noBridgeAvailable&&(this.noBridgeAvailable=!0,this.eventEmitter.emit(h.a.BRIDGE_DOWN));break;case"jibri-recording-status":u=g;break;case"transcription-status":var _=g.attributes;if(!_)break;var T=_.status;T&&T!==this.transcriptionStatus&&(this.transcriptionStatus=T,this.eventEmitter.emit(h.a.TRANSCRIPTION_STATUS_CHANGED,T));break;case"call-control":var C=g.attributes;if(!C)break;this.phoneNumber=C.phone||null,this.phonePin=C.pin||null,this.eventEmitter.emit(h.a.PHONE_NUMBER_CHANGED);break;default:this.processNode(g,t)}}i&&this.eventEmitter.emit(h.a.PRESENCE_STATUS,t,n.status),u&&(this.lastJibri=u,this.recording&&this.recording.handleJibriPresence(u))}},{key:"_initFocus",value:function(e,t){this.focusMucJid=e,this.recording||(this.recording=new m.a(this.options.recordingType,this.eventEmitter,this.connection,this.focusMucJid,this.options.jirecon,this.roomjid),this.lastJibri&&this.recording.handleJibriPresence(this.lastJibri)),y.info("Ignore focus: "+e+", real JID: "+t)}},{key:"setParticipantPropertyListener",value:function(e){this.participantPropertyListener=e}},{key:"processNode",value:function(e,t){try{var n=this.presHandlers[e.tagName];e.tagName.startsWith("jitsi_participant_")&&(n=[this.participantPropertyListener]),n&&n.forEach(function(n){n(e,o.Strophe.getResourceFromJid(t),t)})}catch(t){s.a.callErrorHandler(t),y.error("Error processing:"+e.tagName+" node.",t)}}},{key:"sendMessage",value:function(e,t){var n=Object(o.$msg)({to:this.roomjid,type:"groupchat"});n.c("body",e).up(),t&&n.c("nick",{xmlns:"http://jabber.org/protocol/nick"}).t(t).up().up(),this.connection.send(n),this.eventEmitter.emit(h.a.SENDING_CHAT_MESSAGE,e)}},{key:"sendPrivateMessage",value:function(e,t,n){var r=Object(o.$msg)({to:this.roomjid+"/"+e,type:"chat"});r.c("body",t).up(),n&&r.c("nick",{xmlns:"http://jabber.org/protocol/nick"}).t(n).up().up(),this.connection.send(r),this.eventEmitter.emit(h.a.SENDING_PRIVATE_CHAT_MESSAGE,t)}},{key:"setSubject",value:function(e){var t=Object(o.$msg)({to:this.roomjid,type:"groupchat"});t.c("subject",e),this.connection.send(t)}},{key:"onParticipantLeft",value:function(e,t){delete this.lastPresences[e],t||(this.eventEmitter.emit(h.a.MUC_MEMBER_LEFT,e),this.moderator.onMucMemberLeft(e))}},{key:"onPresenceUnavailable",value:function(e,t){var n=this;if($(e).find('>ignore[xmlns="http://jitsi.org/jitmeet/"]').length)return!0;if($(e).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>destroy').length){var r=void 0,i=$(e).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>destroy>reason');return i.length&&(r=i.text()),this.eventEmitter.emit(h.a.MUC_DESTROYED,r),this.connection.emuc.doLeave(this.roomjid),!0}var o=$(e).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length,a=$(e).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]').length,s=Object.keys(this.members);o?s.length>0&&(s.forEach(function(e){var t=n.members[e];delete n.members[e],n.onParticipantLeft(e,t.isFocus)}),this.connection.emuc.doLeave(this.roomjid),a||this.eventEmitter.emit(h.a.MUC_LEFT)):(delete this.members[t],this.onParticipantLeft(t,!1)),a&&this.myroomjid===t&&this.eventEmitter.emit(h.a.KICKED)}},{key:"onMessage",value:function(e,t){var n=$(e).find('>nick[xmlns="http://jabber.org/protocol/nick"]').text()||o.Strophe.getResourceFromJid(t),r=$(e).find(">body").text(),i=e.getAttribute("type");if("error"===i)return this.eventEmitter.emit(h.a.CHAT_ERROR_RECEIVED,$(e).find(">text").text(),r),!0;var a=$(e).find(">subject");if(a.length){var s=a.text();(s||""===s)&&(this.eventEmitter.emit(h.a.SUBJECT_CHANGED,s),y.log("Subject is changed to "+s))}var c=$(e).find(">delay").attr("stamp");if(!c&&(c=$(e).find('>[xmlns="jabber:x:delay"]').attr("stamp"))){var u=c.match(/(\d{4})(\d{2})(\d{2}T\d{2}:\d{2}:\d{2})/);c=u[1]+"-"+u[2]+"-"+u[3]+"Z"}t===this.roomjid&&$(e).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="104"]').length&&this.discoRoomInfo();var l=function(e){try{var t=JSON.parse(e);if(t&&"object"===(void 0===t?"undefined":g(t))){var n=t[S[0]],r=t[S[1]];if(("string"==typeof n||n instanceof String)&&r)return t;y.debug("parsing valid json but does not have correct structure","topic: ",n,"payload: ",r)}}catch(e){return!1}return!1}(r);l?this.eventEmitter.emit(h.a.JSON_MESSAGE_RECEIVED,t,l):r&&("chat"===i&&(y.log("privatechat",n,r),this.eventEmitter.emit(h.a.PRIVATE_MESSAGE_RECEIVED,t,n,r,this.myroomjid,c)),"groupchat"===i&&(y.log("chat",n,r),this.eventEmitter.emit(h.a.MESSAGE_RECEIVED,t,n,r,this.myroomjid,c)))}},{key:"onPresenceError",value:function(e,t){$(e).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length?(y.log("on password required",t),this.eventEmitter.emit(h.a.PASSWORD_REQUIRED)):$(e).find('>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length?o.Strophe.getDomainFromJid(e.getAttribute("to"))===this.xmpp.options.hosts.anonymousdomain?this.eventEmitter.emit(h.a.ROOM_JOIN_ERROR):(y.warn("onPresError ",e),this.eventEmitter.emit(h.a.ROOM_CONNECT_NOT_ALLOWED_ERROR)):$(e).find(">error>service-unavailable").length?(y.warn("Maximum users limit for the room has been reached",e),this.eventEmitter.emit(h.a.ROOM_MAX_USERS_ERROR)):(y.warn("onPresError ",e),this.eventEmitter.emit(h.a.ROOM_CONNECT_ERROR))}},{key:"kick",value:function(e){var t=Object(o.$iq)({to:this.roomjid,type:"set"}).c("query",{xmlns:"http://jabber.org/protocol/muc#admin"}).c("item",{nick:o.Strophe.getResourceFromJid(e),role:"none"}).c("reason").t("You have been kicked.").up().up().up();this.connection.sendIQ(t,function(t){return y.log("Kick participant with jid: ",e,t)},function(e){return y.log("Kick participant error: ",e)})}},{key:"lockRoom",value:function(e,t,n,r){var i=this;this.connection.sendIQ(Object(o.$iq)({to:this.roomjid,type:"get"}).c("query",{xmlns:"http://jabber.org/protocol/muc#owner"}),function(a){if($(a).find('>query>x[xmlns="jabber:x:data"]>field[var="muc#roomconfig_roomsecret"]').length){var s=Object(o.$iq)({to:i.roomjid,type:"set"}).c("query",{xmlns:"http://jabber.org/protocol/muc#owner"});s.c("x",{xmlns:"jabber:x:data",type:"submit"}),s.c("field",{var:"FORM_TYPE"}).c("value").t("http://jabber.org/protocol/muc#roomconfig").up().up(),s.c("field",{var:"muc#roomconfig_roomsecret"}).c("value").t(e).up().up(),s.c("field",{var:"muc#roomconfig_whois"}).c("value").t("anyone").up().up(),i.connection.sendIQ(s,t,n)}else r()},n)}},{key:"addToPresence",value:function(e,t){t.tagName=e,this.removeFromPresence(e),this.presMap.nodes.push(t)}},{key:"removeFromPresence",value:function(e){var t=this.presMap.nodes.filter(function(t){return e!==t.tagName});this.presMap.nodes=t}},{key:"addPresenceListener",value:function(e,t){if("function"!=typeof t)throw new Error('"handler" is not a function');var n=this.presHandlers[e];n||(this.presHandlers[e]=n=[]),-1===n.indexOf(t)?n.push(t):y.warn("Trying to add the same handler more than once for: "+e)}},{key:"removePresenceListener",value:function(e,t){var n=this.presHandlers[e],r=n?n.indexOf(t):-1;-1!==r?n.splice(r,1):y.warn("Handler for: "+e+" was not registered")}},{key:"isFocus",value:function(e){var t=this.members[e];return t?t.isFocus:null}},{key:"isModerator",value:function(){return"moderator"===this.role}},{key:"getMemberRole",value:function(e){return this.members[e]?this.members[e].role:null}},{key:"setVideoMute",value:function(e,t){this.sendVideoInfoPresence(e),t&&t(e)}},{key:"setAudioMute",value:function(e,t){return this.sendAudioInfoPresence(e,t)}},{key:"addAudioInfoToPresence",value:function(e){this.removeFromPresence("audiomuted"),this.addToPresence("audiomuted",{attributes:{xmlns:"http://jitsi.org/jitmeet/audio"},value:e.toString()})}},{key:"sendAudioInfoPresence",value:function(e,t){this.addAudioInfoToPresence(e),this.connection&&this.sendPresence(),t&&t()}},{key:"addVideoInfoToPresence",value:function(e){this.removeFromPresence("videomuted"),this.addToPresence("videomuted",{attributes:{xmlns:"http://jitsi.org/jitmeet/video"},value:e.toString()})}},{key:"sendVideoInfoPresence",value:function(e){this.addVideoInfoToPresence(e),this.connection&&this.sendPresence()}},{key:"getMediaPresenceInfo",value:function(e,t){var n=this.lastPresences[this.roomjid+"/"+e];if(!n)return null;var i={muted:!1,videoType:void 0},o=null;if(t===d.a)o=r(n,"audiomuted");else{if(t!==d.b)return y.error("Unsupported media type: "+t),null;o=r(n,"videomuted");var a=r(n,"videoType");a.length>0&&(i.videoType=a[0].value)}return i.muted=o.length>0&&"true"===o[0].value,i}},{key:"isRecordingSupported",value:function(){return!!this.recording&&this.recording.isSupported()}},{key:"getRecordingState",value:function(){return this.recording?this.recording.getState():void 0}},{key:"getRecordingURL",value:function(){return this.recording?this.recording.getURL():null}},{key:"toggleRecording",value:function(e,t){return this.recording?this.recording.toggleRecording(e,t):t("error",new Error("The conference is not created yet!"))}},{key:"isSIPCallingSupported",value:function(){return!!this.moderator&&this.moderator.isSipGatewayEnabled()}},{key:"dial",value:function(e){return this.connection.rayo.dial(e,"fromnumber",o.Strophe.getBareJidFromJid(this.myroomjid),this.password,this.focusMucJid)}},{key:"hangup",value:function(){return this.connection.rayo.hangup()}},{key:"getPhoneNumber",value:function(){return this.phoneNumber}},{key:"getPhonePin",value:function(){return this.phonePin}},{key:"muteParticipant",value:function(e,t){y.info("set mute",t);var n=Object(o.$iq)({to:this.focusMucJid,type:"set"}).c("mute",{xmlns:"http://jitsi.org/jitmeet/audio",jid:e}).t(t.toString()).up();this.connection.sendIQ(n,function(e){return y.log("set mute",e)},function(e){return y.log("set mute error",e)})}},{key:"onMute",value:function(e){if(e.getAttribute("from")===this.focusMucJid){var t=$(e).find("mute");t.length&&"true"===t.text()?this.eventEmitter.emit(h.a.AUDIO_MUTED_BY_FOCUS):y.warn("Ignoring a mute request which does not explicitly specify a positive mute command.")}else y.warn("Ignored mute from non focus peer")}},{key:"leave",value:function(){var e=this;return new Promise(function(t,n){function r(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];o.removeListener(h.a.MUC_LEFT,r),clearTimeout(i),e?n(new Error("The timeout for the confirmation about leaving the room expired.")):t()}var i=setTimeout(function(){return r(!0)},5e3),o=e.eventEmitter;o.on(h.a.MUC_LEFT,r),e.doLeave()})}}]),t}();t.a=_}).call(t,"modules/xmpp/ChatRoom.js")},function(e,t,n){"use strict";(function(e){function r(e){var t=1;return function(n){if(!n){var r=Math.pow(2,t-1);return t+=1,r*e}t=1}}function i(e,t,n,i){function o(e){if(e.data&&e.data.sessionId){if(e.origin!==window.location.origin)return void c.warn("Ignoring sessionId from different origin: "+e.origin);s.a.sessionId=e.data.sessionId}}this.roomName=e,this.xmppService=t,this.getNextTimeout=r(1e3),this.getNextErrorTimeout=r(1e3),this.externalAuthEnabled=!1,this.options=i,this.sipGatewayEnabled=this.options.connection.hosts&&void 0!==this.options.connection.hosts.call_control,this.eventEmitter=n,this.connection=this.xmppService.connection,window.addEventListener?window.addEventListener("message",o,!1):window.attachEvent("onmessage",o)}t.a=i;var o=n(2),a=(n.n(o),n(1)),s=n(23),c=n(0).getLogger(e),u=n(8),l=n(49),d=n(3);i.prototype.isExternalAuthEnabled=function(){return this.externalAuthEnabled},i.prototype.isSipGatewayEnabled=function(){return this.sipGatewayEnabled},i.prototype.onMucMemberLeft=function(e){c.info("Someone left is it focus ? "+e),"focus"===o.Strophe.getResourceFromJid(e)&&(c.info("Focus has left the room - leaving conference"),this.eventEmitter.emit(u.FOCUS_LEFT))},i.prototype.setFocusUserJid=function(e){this.focusUserJid||(this.focusUserJid=e,c.info("Focus jid set to: "+this.focusUserJid))},i.prototype.getFocusUserJid=function(){return this.focusUserJid},i.prototype.getFocusComponent=function(){var e=this.options.connection.hosts.focus;return e||(e="focus."+this.options.connection.hosts.domain),e},i.prototype.createConferenceIq=function(){var e=Object(o.$iq)({to:this.getFocusComponent(),type:"set"}),t=s.a.sessionId,n=s.a.machineId;c.info("Session ID: "+t+" machine UID: "+n),e.c("conference",{xmlns:"http://jitsi.org/protocol/focus",room:this.roomName,"machine-uid":n}),t&&e.attrs({"session-id":t}),void 0!==this.options.connection.enforcedBridge&&e.c("property",{name:"enforcedBridge",value:this.options.connection.enforcedBridge}).up(),void 0!==this.options.connection.hosts&&void 0!==this.options.connection.hosts.call_control&&e.c("property",{name:"call_control",value:this.options.connection.hosts.call_control}).up(),void 0!==this.options.conference.channelLastN&&e.c("property",{name:"channelLastN",value:this.options.conference.channelLastN}).up(),e.c("property",{name:"disableRtx",value:Boolean(this.options.conference.disableRtx)}).up(),e.c("property",{name:"enableLipSync",value:!1!==this.options.connection.enableLipSync}).up(),void 0!==this.options.conference.audioPacketDelay&&e.c("property",{name:"audioPacketDelay",value:this.options.conference.audioPacketDelay}).up(),this.options.conference.startBitrate&&e.c("property",{name:"startBitrate",value:this.options.conference.startBitrate}).up(),this.options.conference.minBitrate&&e.c("property",{name:"minBitrate",value:this.options.conference.minBitrate}).up();var r=void 0;switch(this.options.conference.openBridgeChannel){case"datachannel":case!0:case void 0:r=!0;break;case"websocket":r=!1}return r&&!a.a.supportsDataChannels()&&(r=!1),e.c("property",{name:"openSctp",value:r}).up(),void 0!==this.options.conference.startAudioMuted&&e.c("property",{name:"startAudioMuted",value:this.options.conference.startAudioMuted}).up(),void 0!==this.options.conference.startVideoMuted&&e.c("property",{name:"startVideoMuted",value:this.options.conference.startVideoMuted}).up(),void 0!==this.options.conference.stereo&&e.c("property",{name:"stereo",value:this.options.conference.stereo}).up(),void 0!==this.options.conference.useRoomAsSharedDocumentName&&e.c("property",{name:"useRoomAsSharedDocumentName",value:this.options.conference.useRoomAsSharedDocumentName}).up(),e.up(),e},i.prototype.parseSessionId=function(e){var t=$(e).find("conference").attr("session-id");t&&(c.info("Received sessionId: "+t),s.a.sessionId=t)},i.prototype.parseConfigOptions=function(e){this.setFocusUserJid($(e).find("conference").attr("focusjid"));var t=$(e).find(">conference>property[name='authentication'][value='true']").length>0;c.info("Authentication enabled: "+t),this.externalAuthEnabled=$(e).find(">conference>property[name='externalAuth'][value='true']").length>0,c.info("External authentication enabled: "+this.externalAuthEnabled),this.externalAuthEnabled||this.parseSessionId(e);var n=$(e).find(">conference").attr("identity");this.eventEmitter.emit(l.IDENTITY_UPDATED,t,n),$(e).find(">conference>property[name='sipGatewayEnabled'][value='true']").length&&(this.sipGatewayEnabled=!0),c.info("Sip gateway enabled: "+this.sipGatewayEnabled)},i.prototype.allocateConferenceFocus=function(e){var t=this;this.setFocusUserJid(this.options.connection.focusUserJid),this.connection.sendIQ(this.createConferenceIq(),function(n){return t._allocateConferenceFocusSuccess(n,e)},function(n){return t._allocateConferenceFocusError(n,e)}),this.connection.flush()},i.prototype._allocateConferenceFocusError=function(e,t){var n=this,r=$(e).find(">error>session-invalid").length||$(e).find(">error>not-acceptable").length;if(r&&(c.info("Session expired! - removing"),s.a.sessionId=void 0),$(e).find(">error>graceful-shutdown").length)this.eventEmitter.emit(u.GRACEFUL_SHUTDOWN);else{var i=$(e).find(">error>reservation-error");if(i.length){var a=i.attr("error-code"),l=$(e).find(">error>text"),p=void 0;return l&&(p=l.text()),void this.eventEmitter.emit(u.RESERVATION_ERROR,a,p)}if($(e).find(">error>not-authorized").length)return c.warn("Unauthorized to start the conference",e),o.Strophe.getDomainFromJid(e.getAttribute("to"))!==this.options.connection.hosts.anonymousdomain&&(this.externalAuthEnabled=!0),void this.eventEmitter.emit(u.AUTHENTICATION_REQUIRED);var h=this.getNextErrorTimeout(),f="Focus error, retry after "+h;d.callErrorHandler(new Error(f)),c.error(f,e);var m=this.getFocusComponent(),v=h/1e3;r||this.eventEmitter.emit(u.FOCUS_DISCONNECTED,m,v),this.getNextTimeout(!0),window.setTimeout(function(){return n.allocateConferenceFocus(t)},h)}},i.prototype._allocateConferenceFocusSuccess=function(e,t){var n=this;if(this.parseConfigOptions(e),this.getNextErrorTimeout(!0),"true"===$(e).find("conference").attr("ready"))this.getNextTimeout(!0),t();else{var r=this.getNextTimeout();c.info("Waiting for the focus... "+r),window.setTimeout(function(){return n.allocateConferenceFocus(t)},r)}},i.prototype.authenticate=function(){var e=this;return new Promise(function(t,n){e.connection.sendIQ(e.createConferenceIq(),function(n){e.parseSessionId(n),t()},function(e){return n({error:$(e).find("iq>error :first").prop("tagName"),message:$(e).find("iq>error>text").text()})})})},i.prototype.getLoginUrl=function(e,t){this._getLoginUrl(!1,e,t)},i.prototype._getLoginUrl=function(e,t,n){function r(e,t){d.callErrorHandler(new Error(e)),c.error(e,t),n(t)}var i=Object(o.$iq)({to:this.getFocusComponent(),type:"get"}),a={xmlns:"http://jitsi.org/protocol/focus",room:this.roomName,"machine-uid":s.a.machineId},u="auth url";e&&(a.popup=!0,u="POPUP "+u),i.c("login-url",a),this.connection.sendIQ(i,function(e){var n=$(e).find("login-url").attr("url");(n=decodeURIComponent(n))?(c.info("Got "+u+": "+n),t(n)):r("Failed to get "+u+" from the focus",e)},r.bind(void 0,"Get "+u+" error"))},i.prototype.getPopupLoginUrl=function(e,t){this._getLoginUrl(!0,e,t)},i.prototype.logout=function(e){var t=Object(o.$iq)({to:this.getFocusComponent(),type:"set"}),n=s.a.sessionId;n?(t.c("logout",{xmlns:"http://jitsi.org/protocol/focus","session-id":n}),this.connection.sendIQ(t,function(t){var n=$(t).find("logout").attr("logout-url");n&&(n=decodeURIComponent(n)),c.info("Log out OK, url: "+n,t),s.a.sessionId=void 0,e(n)},function(e){var t="Logout error";d.callErrorHandler(new Error(t)),c.error(t,e)})):e()}}).call(t,"modules/xmpp/moderator.js")},function(e,t,n){"use strict";(function(e){t.a=function(e,t,n){o.Strophe.addConnectionPlugin("jingle",new g(e,t,n))};var r=n(6),i=n(0),o=(n.n(i),n(2)),a=(n.n(o),n(8)),s=n.n(a),c=n(3),u=n.n(c),l=n(19),d=n.n(l),p=n(5),h=n(105),f=n(22),m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),v=Object(i.getLogger)(e),g=function(e){function t(e,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return i.xmpp=e,i.eventEmitter=n,i.sessions={},i.jvbIceConfig=r.jvb,i.p2pIceConfig=r.p2p,i.mediaConstraints={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,f.b),m(t,[{key:"init",value:function(e){(function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"init",this).call(this,e),this.connection.addHandler(this.onJingle.bind(this),"urn:xmpp:jingle:1","iq","set",null,null)}},{key:"onJingle",value:function(e){var t=$(e).find("jingle").attr("sid"),n=$(e).find("jingle").attr("action"),i=e.getAttribute("from"),a=Object(o.$iq)({type:"result",to:i,id:e.getAttribute("id")});v.log("on jingle "+n+" from "+i,e);var c=this.sessions[t];if("session-initiate"!==n){if(!c)return a.attrs({type:"error"}),a.c("error",{type:"cancel"}).c("item-not-found",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).up().c("unknown-session",{xmlns:"urn:xmpp:jingle:errors:1"}),v.warn("invalid session id",e),this.connection.send(a),!0;if(i!==c.remoteJid)return v.warn("jid mismatch for session id",t,c.remoteJid,e),a.attrs({type:"error"}),a.c("error",{type:"cancel"}).c("item-not-found",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).up().c("unknown-session",{xmlns:"urn:xmpp:jingle:errors:1"}),this.connection.send(a),!0}else if(void 0!==c)return a.attrs({type:"error"}),a.c("error",{type:"cancel"}).c("service-unavailable",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).up(),v.warn("duplicate session id",t,e),this.connection.send(a),!0;var l=window.performance.now(),d="focus"!==o.Strophe.getResourceFromJid(i);switch(n){case"session-initiate":v.log("(TIME) received session-initiate:\t",l);var f=$(e).find("jingle>startmuted");if(f&&f.length>0){var m=f.attr("audio"),g=f.attr("video");this.eventEmitter.emit(s.a.START_MUTED_FROM_FOCUS,"true"===m,"true"===g)}v.info("Marking session from "+i+" as "+(d?"":"*not*")+" P2P"),c=new h.a($(e).find("jingle").attr("sid"),$(e).attr("to"),i,this.connection,this.mediaConstraints,d?this.p2pIceConfig:this.jvbIceConfig,d,!1,this.xmpp.options),this.sessions[c.sid]=c,this.eventEmitter.emit(s.a.CALL_INCOMING,c,$(e).find(">jingle"),l);break;case"session-accept":this.eventEmitter.emit(s.a.CALL_ACCEPTED,c,$(e).find(">jingle"));break;case"content-modify":c.modifyContents($(e).find(">jingle"));break;case"transport-info":this.eventEmitter.emit(s.a.TRANSPORT_INFO,c,$(e).find(">jingle"));break;case"session-terminate":v.log("terminating...",c.sid);var y=null,b=null;$(e).find(">jingle>reason").length&&(y=$(e).find(">jingle>reason>:first")[0].tagName,b=$(e).find(">jingle>reason>text").text()),this.terminate(c.sid,y,b),this.eventEmitter.emit(s.a.CALL_ENDED,c,y,b);break;case"transport-replace":v.info("(TIME) Start transport replace",l),p.a.sendAnalytics(Object(r.z)(r.e,{p2p:d,value:l})),c.replaceTransport($(e).find(">jingle"),function(){var e=window.performance.now();v.info("(TIME) Transport replace success!",e),p.a.sendAnalytics(Object(r.z)(r.f,{p2p:d,value:e}))},function(e){u.a.callErrorHandler(e),v.error("Transport replace failed",e),c.sendTransportReject()});break;case"addsource":case"source-add":c.addRemoteStream($(e).find(">jingle>content"));break;case"removesource":case"source-remove":c.removeRemoteStream($(e).find(">jingle>content"));break;default:v.warn("jingle action not implemented",n),a.attrs({type:"error"}),a.c("error",{type:"cancel"}).c("bad-request",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).up()}return this.connection.send(a),!0}},{key:"newP2PJingleSession",value:function(e,t){var n=new h.a(d.a.randomHexString(12),e,t,this.connection,this.mediaConstraints,this.p2pIceConfig,!0,!0,this.xmpp.options);return this.sessions[n.sid]=n,n}},{key:"terminate",value:function(e,t,n){this.sessions.hasOwnProperty(e)&&("ended"!==this.sessions[e].state&&this.sessions[e].onTerminated(t,n),delete this.sessions[e])}},{key:"getStunAndTurnCredentials",value:function(){var e=this;this.connection.sendIQ(Object(o.$iq)({type:"get",to:this.connection.domain}).c("services",{xmlns:"urn:xmpp:extdisco:1"}).c("service",{host:"turn."+this.connection.domain}),function(t){var n=[];$(t).find(">services>service").each(function(e,t){var r={},i=(t=$(t)).attr("type");switch(i){case"stun":r.url="stun:"+t.attr("host"),t.attr("port")&&(r.url+=":"+t.attr("port")),n.push(r);break;case"turn":case"turns":r.url=i+":";var o=t.attr("username");if(o){var a=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);a&&parseInt(a[2],10)<28?r.url+=o+"@":r.username=o}r.url+=t.attr("host");var s=t.attr("port");s&&"3478"!==s&&(r.url+=":"+t.attr("port"));var c=t.attr("transport");c&&"udp"!==c&&(r.url+="?transport="+c),r.credential=t.attr("password")||r.credential,n.push(r)}});var r=e.xmpp.options;r.useStunTurn&&(e.jvbIceConfig.iceServers=n),r.p2p&&r.p2p.useStunTurn&&(e.p2pIceConfig.iceServers=n)},function(e){v.warn("getting turn credentials failed",e),v.warn("is mod_turncredentials or similar installed?")})}},{key:"getLog",value:function(){var e=this,t={};return Object.keys(this.sessions).forEach(function(n){var r=e.sessions[n].peerconnection;r&&r.updateLog&&(t["jingle_"+n]={updateLog:r.updateLog,stats:r.stats,url:window.location.href})}),t}}]),t}()}).call(t,"modules/xmpp/strophe.jingle.js")},function(e,t,n){"use strict";(function(e){var r=n(6),i=n(106),o=n.n(i),a=n(0),s=(n.n(a),n(2)),c=(n.n(s),n(107)),u=(n.n(c),n(108)),l=n(52),d=n(53),p=n(109),h=n(14),f=n(110),m=n(5),v=n(8),g=n.n(v),y=n(3),b=n.n(y),S=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_=Object(a.getLogger)(e),T=function(e){function t(e,n,r,i,a,s,c,u,l){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var d=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r,i,a,s));return d._iceCheckingStartedTimestamp=null,d._gatheringStartedTimestamp=null,d._localVideoActive=!0,d._remoteVideoActive=!0,d._gatheringReported=!1,d.lasticecandidate=!1,d.closed=!1,d.isInitiator=u,d.isP2P=c,d.signalingLayer=new f.a,d.webrtcIceUdpDisable=Boolean(l.webrtcIceUdpDisable),d.webrtcIceTcpDisable=Boolean(l.webrtcIceTcpDisable),d.failICE=Boolean(l.failICE),d.modificationQueue=o.a.queue(d._processQueueTasks.bind(d),1),d.wasConnected=!1,d.establishmentDuration=void 0,d}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.a),S(t,null,[{key:"parseVideoSenders",value:function(e){var t=e.find('>content[name="video"]');if(t.length){var n=t[0].getAttribute("senders");if("both"===n||"initiator"===n||"responder"===n||"none"===n)return n}return null}}]),S(t,[{key:"_assertNotEnded",value:function(e){return this.state!==l.b||(_.log("The session has ended - cancelling action: "+e),!1)}},{key:"doInitialize",value:function(){var e=this;this.lasticecandidate=!1,this.isReconnect=!1,this.wasstable=!1;var t={disableRtx:this.room.options.disableRtx};if(this.isP2P){t.disableSimulcast=!0,t.disableH264=this.room.options.p2p&&this.room.options.p2p.disableH264,t.preferH264=this.room.options.p2p&&this.room.options.p2p.preferH264;var n=this._abtestSuspendVideoEnabled();void 0!==n&&(t.abtestSuspendVideo=n)}else t.disableSimulcast=this.room.options.disableSimulcast||this.room.options.preferH264&&!this.room.options.disableH264,t.preferH264=this.room.options.preferH264,t.enableFirefoxSimulcast=this.room.options.testing&&this.room.options.testing.enableFirefoxSimulcast;this.peerconnection=this.rtc.createPeerConnection(this.signalingLayer,this.iceConfig,this.isP2P,t),this.peerconnection.onicecandidate=function(t){if(t){var n=t.candidate,i=window.performance.now();if(n){null===e._gatheringStartedTimestamp&&(e._gatheringStartedTimestamp=i);var o=n.protocol;if("string"==typeof o)if("tcp"===(o=o.toLowerCase())||"ssltcp"===o){if(e.webrtcIceTcpDisable)return}else if("udp"===o&&e.webrtcIceUdpDisable)return}else e._gatheringReported||(m.a.sendAnalytics(r.m,{phase:"gathering",value:i-e._gatheringStartedTimestamp,p2p:e.isP2P,initiator:e.isInitiator}),e._gatheringReported=!0);e.sendIceCandidate(n)}},this.peerconnection.onsignalingstatechange=function(){e.peerconnection&&("stable"===e.peerconnection.signalingState?e.wasstable=!0:"closed"!==e.peerconnection.signalingState&&"closed"!==e.peerconnection.connectionState||e.closed||e.room.eventEmitter.emit(g.a.SUSPEND_DETECTED,e))},this.peerconnection.oniceconnectionstatechange=function(){if(e.peerconnection&&e._assertNotEnded("oniceconnectionstatechange")){var t=window.performance.now();switch(e.isP2P||(e.room.connectionTimes["ice.state."+e.peerconnection.iceConnectionState]=t),_.log("(TIME) ICE "+e.peerconnection.iceConnectionState+" P2P? "+e.isP2P+":\t",t),m.a.sendAnalytics(r.o,{p2p:e.isP2P,state:e.peerconnection.iceConnectionState,signaling_state:e.peerconnection.signalingState,reconnect:e.isReconnect,value:t}),e.room.eventEmitter.emit(g.a.ICE_CONNECTION_STATE_CHANGED,e,e.peerconnection.iceConnectionState),e.peerconnection.iceConnectionState){case"checking":e._iceCheckingStartedTimestamp=t;break;case"connected":if("stable"===e.peerconnection.signalingState&&e.isReconnect&&e.room.eventEmitter.emit(g.a.CONNECTION_RESTORED,e),!e.wasConnected&&e.wasstable){m.a.sendAnalytics(r.m,{phase:"checking",value:t-e._iceCheckingStartedTimestamp,p2p:e.isP2P,initiator:e.isInitiator});var n=Math.min(e._iceCheckingStartedTimestamp,e._gatheringStartedTimestamp);e.establishmentDuration=t-n,m.a.sendAnalytics(r.m,{phase:"establishment",value:e.establishmentDuration,p2p:e.isP2P,initiator:e.isInitiator}),e.wasConnected=!0,e.room.eventEmitter.emit(g.a.CONNECTION_ESTABLISHED,e)}e.isReconnect=!1;break;case"disconnected":if(e.closed)break;e.isReconnect=!0,e.wasstable&&e.room.eventEmitter.emit(g.a.CONNECTION_INTERRUPTED,e);break;case"failed":e.room.eventEmitter.emit(g.a.CONNECTION_ICE_FAILED,e),e.room.eventEmitter.emit(g.a.CONFERENCE_SETUP_FAILED,e,new Error("ICE fail"))}}},this.peerconnection.onnegotiationneeded=function(){e.room.eventEmitter.emit(g.a.PEERCONNECTION_READY,e)},this.signalingLayer.setChatRoom(this.room)}},{key:"sendIceCandidate",value:function(e){var t=this,n=new d.a(this.peerconnection.localDescription.sdp);if(e&&!this.lasticecandidate){var r=h.a.iceparams(n.media[e.sdpMLineIndex],n.session),i=h.a.candidateToJingle(e.candidate);if(!r||!i){var o="failed to get ice && jcand";return b.a.callErrorHandler(new Error(o)),void _.error(o)}r.xmlns="urn:xmpp:jingle:transports:ice-udp:1",this.usedrip?(0===this.dripContainer.length&&setTimeout(function(){0!==t.dripContainer.length&&(t.sendIceCandidates(t.dripContainer),t.dripContainer=[])},20),this.dripContainer.push(e)):this.sendIceCandidates([e])}else _.log("sendIceCandidate: last candidate."),this.lasticecandidate=!0}},{key:"sendIceCandidates",value:function(e){var t=this;if(this._assertNotEnded("sendIceCandidates")){_.log("sendIceCandidates",e);for(var n=Object(s.$iq)({to:this.remoteJid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"transport-info",initiator:this.initiator,sid:this.sid}),r=new d.a(this.peerconnection.localDescription.sdp),i=0;i<r.media.length;i++)!function(i){var o=e.filter(function(e){return e.sdpMLineIndex===i}),a=h.a.parseMLine(r.media[i].split("\r\n")[0]);if(o.length>0){var s=h.a.iceparams(r.media[i],r.session);s.xmlns="urn:xmpp:jingle:transports:ice-udp:1",n.c("content",{creator:t.initiator===t.localJid?"initiator":"responder",name:o[0].sdpMid?o[0].sdpMid:a.media}).c("transport",s);for(var c=0;c<o.length;c++){var u=h.a.candidateToJingle(o[c].candidate);t.failICE&&(u.ip="1.1.1.1"),n.c("candidate",u).up()}var l=h.a.findLine(r.media[i],"a=fingerprint:",r.session);if(l){var d=h.a.parseFingerprint(l);d.required=!0,n.c("fingerprint",{xmlns:"urn:xmpp:jingle:apps:dtls:0"}).t(d.fingerprint),delete d.fingerprint,n.attrs(d),n.up()}n.up(),n.up()}}(i);this.connection.sendIQ(n,null,this.newJingleErrorHandler(n),1e4)}}},{key:"addIceCandidates",value:function(e){var t=this;if("closed"!==this.peerconnection.signalingState){var n=[];e.find(">content>transport>candidate").each(function(e,t){var r=h.a.candidateFromJingle(t);r=r.replace("\r\n","").replace("a=","");var i=new RTCIceCandidate({sdpMLineIndex:0,sdpMid:"",candidate:r});n.push(i)}),n.length?(_.debug("Queued add ("+n.length+") ICE candidates task..."),this.modificationQueue.push(function(e){var r=!0,i=!1,o=void 0;try{for(var a,s=n[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var c=a.value;t.peerconnection.addIceCandidate(c,function(){_.debug("addIceCandidate ok!")},function(e){_.error("addIceCandidate failed!",e)})}}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}e()})):_.error("No ICE candidates to add ?",e[0]&&e[0].outerHTML)}else _.warn("Ignored add ICE candidate when in closed state")}},{key:"readSsrcInfo",value:function(e){var t=this;$(e).find('>description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]').each(function(e,n){var r=Number(n.getAttribute("ssrc"));t.isP2P?t.signalingLayer.setSSRCOwner(r,s.Strophe.getResourceFromJid(t.remoteJid)):$(n).find('>ssrc-info[xmlns="http://jitsi.org/jitmeet"]').each(function(e,n){var i=n.getAttribute("owner");i&&i.length&&(isNaN(r)||r<0?_.warn("Invalid SSRC "+r+" value received for "+i):t.signalingLayer.setSSRCOwner(r,s.Strophe.getResourceFromJid(i)))})})}},{key:"generateRecvonlySsrc",value:function(){this.peerconnection?this.peerconnection.generateRecvonlySsrc():_.error("Unable to generate recvonly SSRC - no peerconnection")}},{key:"acceptOffer",value:function(e,t,n,r){var i=this;this.setOfferAnswerCycle(e,function(){i.sendSessionAccept(t,n)},n,r)}},{key:"invite",value:function(e){var t=this;if(!this.isInitiator)throw new Error("Trying to invite from the responder session");this.modificationQueue.push(function(n){var r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var c=a.value;t.peerconnection.addTrack(c)}}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}t.peerconnection.createOffer(function(e){t.peerconnection.setLocalDescription(e,function(){t.sendSessionInitiate(t.peerconnection.localDescription.sdp),n()},function(t){_.error("Failed to set local SDP",t,e),n(t)})},function(e){_.error("Failed to create an offer",e,t.mediaConstraints),n(e)},t.mediaConstraints)},function(e){e?_.error("invite error",e):_.debug("invite executed - OK")})}},{key:"sendSessionInitiate",value:function(e){var t=Object(s.$iq)({to:this.remoteJid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"session-initiate",initiator:this.initiator,sid:this.sid});new d.a(e).toJingle(t,this.initiator===this.me?"initiator":"responder"),t=t.tree(),_.info("Session-initiate: ",t),this.connection.sendIQ(t,function(){_.info('Got RESULT for "session-initiate"')},function(e){_.error('"session-initiate" error',e)},1e4)}},{key:"setAnswer",value:function(e){if(!this.isInitiator)throw new Error("Trying to set an answer on the responder session");this.setOfferAnswerCycle(e,function(){_.info("setAnswer - succeeded")},function(e){_.error("setAnswer failed: ",e)})}},{key:"setOfferAnswerCycle",value:function(e,n,r,i){var o=this;this.modificationQueue.push(function(n){if(i){var r=!0,a=!1,s=void 0;try{for(var c,u=i[Symbol.iterator]();!(r=(c=u.next()).done);r=!0){var p=c.value;o.peerconnection.addTrack(p)}}catch(e){a=!0,s=e}finally{try{!r&&u.return&&u.return()}finally{if(a)throw s}}}var h=o._processNewJingleOfferIq(e),f=o.peerconnection.localDescription.sdp;o._renegotiate(h.raw).then(function(){if(o.state===l.c&&(o.state=l.a,o.isP2P&&!o._localVideoActive&&o.sendContentModify(o._localVideoActive)),f){var e=new d.a(o.peerconnection.localDescription.sdp);o.notifyMySSRCUpdate(new d.a(f),e)}n()},function(e){_.error("Error renegotiating after setting new remote "+(o.isInitiator?"answer: ":"offer: ")+e,h),t.onJingleFatalError(o,e),n(e)})},function(e){e?r(e):n()})}},{key:"replaceTransport",value:function(e,t,n){var r=this;this.room.eventEmitter.emit(g.a.ICE_RESTARTING,this);var i=e.clone();e.find(">content[name='data']").remove(),this.setOfferAnswerCycle(e,function(){r.setOfferAnswerCycle(i,function(){var e=new d.a(r.peerconnection.localDescription.sdp);r.sendTransportAccept(e,t,n)},n)},n)}},{key:"sendSessionAccept",value:function(e,t){var n=this,r=new d.a(this.peerconnection.localDescription.sdp),i=Object(s.$iq)({to:this.remoteJid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"session-accept",initiator:this.initiator,responder:this.responder,sid:this.sid});this.webrtcIceTcpDisable&&(r.removeTcpCandidates=!0),this.webrtcIceUdpDisable&&(r.removeUdpCandidates=!0),this.failICE&&(r.failICE=!0),r.toJingle(i,this.initiator===this.localJid?"initiator":"responder",null),i=i.tree(),_.info("Sending session-accept",i),this.connection.sendIQ(i,e,this.newJingleErrorHandler(i,function(e){t(e),n.room.eventEmitter.emit(g.a.SESSION_ACCEPT_TIMEOUT,n)}),1e4)}},{key:"sendContentModify",value:function(e){var t=e?"both":"none",n=Object(s.$iq)({to:this.remoteJid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"content-modify",initiator:this.initiator,sid:this.sid}).c("content",{name:"video",senders:t});_.info("Sending content-modify, video senders: "+t),this.connection.sendIQ(n,null,this.newJingleErrorHandler(n),1e4)}},{key:"sendTransportAccept",value:function(e,t,n){var r=this,i=Object(s.$iq)({to:this.remoteJid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"transport-accept",initiator:this.initiator,sid:this.sid});e.media.forEach(function(t,n){var o=h.a.parseMLine(t.split("\r\n")[0]);i.c("content",{creator:r.initiator===r.localJid?"initiator":"responder",name:o.media}),e.transportToJingle(n,i),i.up()}),i=i.tree(),_.info("Sending transport-accept: ",i),this.connection.sendIQ(i,t,this.newJingleErrorHandler(i,n),1e4)}},{key:"sendTransportReject",value:function(e,t){var n=Object(s.$iq)({to:this.remoteJid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"transport-reject",initiator:this.initiator,sid:this.sid});n=n.tree(),_.info("Sending 'transport-reject",n),this.connection.sendIQ(n,e,this.newJingleErrorHandler(n,t),1e4)}},{key:"terminate",value:function(e,t,n){if(this.state!==l.b){if(!n||Boolean(n.sendSessionTerminate)){var r=Object(s.$iq)({to:this.remoteJid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"session-terminate",initiator:this.initiator,sid:this.sid}).c("reason").c(n&&n.reason||"success");n&&n.reasonDescription&&r.up().c("text").t(n.reasonDescription),r=r.tree(),_.info("Sending session-terminate",r),this.connection.sendIQ(r,e,this.newJingleErrorHandler(r,t),1e4)}else _.info("Skipped sending session-terminate for "+this);this.connection.jingle.terminate(this.sid)}}},{key:"onTerminated",value:function(e,t){this.state=l.b,this.establishmentDuration=void 0,_.info("Session terminated "+this,e,t),this.close()}},{key:"_parseSsrcInfoFromSourceAdd",value:function(e,t){var n=[];return $(e).each(function(e,r){var i=$(r).attr("name"),o="";$(r).find('ssrc-group[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]').each(function(){var e=this.getAttribute("semantics"),t=$(this).find(">source").map(function(){return this.getAttribute("ssrc")}).get();t.length&&(o+="a=ssrc-group:"+e+" "+t.join(" ")+"\r\n")}),$(r).find('source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]').each(function(){var e=$(this).attr("ssrc");t.containsSSRC(e)?_.warn("Source-add request for existing SSRC: "+e):$(this).find(">parameter").each(function(){o+="a=ssrc:"+e+" "+$(this).attr("name"),$(this).attr("value")&&$(this).attr("value").length&&(o+=":"+$(this).attr("value")),o+="\r\n"})}),t.media.forEach(function(e,t){h.a.findLine(e,"a=mid:"+i)&&(n[t]||(n[t]=""),n[t]+=o)})}),n}},{key:"addRemoteStream",value:function(e){this._addOrRemoveRemoteStream(!0,e)}},{key:"removeRemoteStream",value:function(e){this._addOrRemoveRemoteStream(!1,e)}},{key:"_addOrRemoveRemoteStream",value:function(e,t){var n=this,r=e?"addRemoteStream":"removeRemoteStream";e&&this.readSsrcInfo(t),this.modificationQueue.push(function(i){if(!n.peerconnection.localDescription||!n.peerconnection.localDescription.sdp){var o=r+" - localDescription not ready yet";return _.error(o),void i(o)}_.log("Processing "+r),_.log("ICE connection state: ",n.peerconnection.iceConnectionState);var a=new d.a(n.peerconnection.localDescription.sdp),s=new d.a(n.peerconnection.remoteDescription.sdp),c=e?n._parseSsrcInfoFromSourceAdd(t,s):n._parseSsrcInfoFromSourceRemove(t,s),u=e?n._processRemoteAddSource(c):n._processRemoteRemoveSource(c);n._renegotiate(u.raw).then(function(){var e=new d.a(n.peerconnection.localDescription.sdp);_.log(r+" - OK, SDPs: ",a,e),n.notifyMySSRCUpdate(a,e),i()},function(e){_.error(r+" failed:",e),i(e)})})}},{key:"_processQueueTasks",value:function(e,t){e(t)}},{key:"_processNewJingleOfferIq",value:function(e){var t=new d.a("");return this.webrtcIceTcpDisable&&(t.removeTcpCandidates=!0),this.webrtcIceUdpDisable&&(t.removeUdpCandidates=!0),this.failICE&&(t.failICE=!0),t.fromJingle(e),this.readSsrcInfo($(e).find(">content")),t}},{key:"_processRemoteRemoveSource",value:function(e){var t=new d.a(this.peerconnection.remoteDescription.sdp);return e.forEach(function(e,n){(e=e.split("\r\n")).pop(),e.forEach(function(e){t.media[n]=t.media[n].replace(e+"\r\n","")})}),t.raw=t.session+t.media.join(""),t}},{key:"_processRemoteAddSource",value:function(e){var t=new d.a(this.peerconnection.remoteDescription.sdp);return e.forEach(function(e,n){t.media[n]+=e}),t.raw=t.session+t.media.join(""),t}},{key:"_renegotiate",value:function(e){var t=this,n=e||this.peerconnection.remoteDescription.sdp;if(!n)return Promise.reject("Can not renegotiate without remote description,- current state: "+this.state);var r=new RTCSessionDescription({type:this.isInitiator?"answer":"offer",sdp:n});return new Promise(function(e,n){"closed"!==t.peerconnection.signalingState?t.isInitiator?t._initiatorRenegotiate(r,e,n):t._responderRenegotiate(r,e,n):n("Attempted to renegotiate in state closed")})}},{key:"_responderRenegotiate",value:function(e,t,n){var r=this;_.debug("Renegotiate: setting remote description"),this.peerconnection.setRemoteDescription(e,function(){_.debug("Renegotiate: creating answer"),r.peerconnection.createAnswer(function(e){_.debug("Renegotiate: setting local description"),r.peerconnection.setLocalDescription(e,function(){t()},function(e){n("setLocalDescription failed: "+e)})},function(e){return n("createAnswer failed: "+e)},r.mediaConstraints)},function(e){return n("setRemoteDescription failed: "+e)})}},{key:"_initiatorRenegotiate",value:function(e,t,n){var r=this;"have-local-offer"===this.peerconnection.signalingState?(_.debug("Renegotiate: setting remote description"),this.peerconnection.setRemoteDescription(e,function(){r._initiatorRenegotiate(e,t,n)},function(e){return n("setRemoteDescription failed: "+e)})):(_.debug("Renegotiate: creating offer"),this.peerconnection.createOffer(function(i){_.debug("Renegotiate: setting local description"),r.peerconnection.setLocalDescription(i,function(){_.debug("Renegotiate: setting remote description"),r.peerconnection.setRemoteDescription(e,function(){t()},function(e){return n("setRemoteDescription failed: "+e)})},function(e){n("setLocalDescription failed: ",e)})},function(e){return n("createOffer failed: "+e)},this.mediaConstraints))}},{key:"replaceTrack",value:function(e,t){var n=this;this.modificationQueue.push(function(r){if("closed"===n.peerconnection.signalingState||"closed"===n.peerconnection.connectionState||n.closed)r();else{var i=n.peerconnection.localDescription.sdp;!e&&t&&t.isVideoTrack()?n.peerconnection.clearRecvonlySsrc():e&&e.isVideoTrack()&&!t&&(n.peerconnection.clearRecvonlySsrc(),n.peerconnection.generateRecvonlySsrc()),e&&n.peerconnection.removeTrack(e),t&&n.peerconnection.addTrack(t),(e||t)&&n.state===l.a?n._renegotiate().then(function(){var e=new d.a(n.peerconnection.localDescription.sdp);n.notifyMySSRCUpdate(new d.a(i),e),r()},r):r()}},function(e){e?_.error("Replace track error:",e):_.info("Replace track done!")})}},{key:"_parseSsrcInfoFromSourceRemove",value:function(e,t){var n=[];return $(e).each(function(e,r){var i=$(r).attr("name"),o="";$(r).find('ssrc-group[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]').each(function(){var e=this.getAttribute("semantics"),t=$(this).find(">source").map(function(){return this.getAttribute("ssrc")}).get();t.length&&(o+="a=ssrc-group:"+e+" "+t.join(" ")+"\r\n")});var a=[];$(r).find('source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]').each(function(){var e=$(this).attr("ssrc");a.push(e)}),t.media.forEach(function(e,t){h.a.findLine(e,"a=mid:"+i)&&(n[t]||(n[t]=""),a.forEach(function(r){var i=h.a.findLines(e,"a=ssrc:"+r);i.length&&(n[t]+=i.join("\r\n")+"\r\n")}),n[t]+=o)})}),n}},{key:"_verifyNoSSRCChanged",value:function(e,t){var n=new d.a(this.peerconnection.localDescription.sdp),r=new p.a(t,n),i=r.getNewMedia();if(Object.keys(i).length)return _.error(this+" - some SSRC were added on "+e,i),!1;var o=(r=new p.a(n,t)).getNewMedia();return!Object.keys(o).length||(_.error(this+" - some SSRCs were removed on "+e,o),!1)}},{key:"addTrackAsUnmute",value:function(e){return this._addRemoveTrackAsMuteUnmute(!1,e)}},{key:"removeTrackAsMute",value:function(e){return this._addRemoveTrackAsMuteUnmute(!0,e)}},{key:"_addRemoveTrackAsMuteUnmute",value:function(e,t){var n=this;if(!t)return Promise.reject('invalid "track" argument value');var r=e?"removeTrackMute":"addTrackUnmute",i=function(i){var o=n.peerconnection;if(o){var a=o.localDescription.sdp;(e?o.removeTrackMute.bind(o,t):o.addTrackUnmute.bind(o,t))()?a&&o.remoteDescription.sdp?n._renegotiate().then(function(){n._verifyNoSSRCChanged(r,new d.a(a)),i()},i):i():i(r+" failed!")}else i("Error: tried "+r+" track with no active peerconnection")};return new Promise(function(e,t){n.modificationQueue.push(i,function(n){n?t(n):e()})})}},{key:"setMediaTransferActive",value:function(e,t){var n=this;if(!this.peerconnection)return Promise.reject('Can not modify transfer active state, before "initialize" is called');var r=e?"audio active":"audio inactive",i=t?"video active":"video inactive";_.info("Queued make "+i+", "+r+" task...");var o=function(r){var i=n.state===l.a,o=n.peerconnection.setAudioTransferActive(e);n._localVideoActive!==t&&(n._localVideoActive=t,n.isP2P&&i&&n.sendContentModify(t));var a=n.peerconnection.setVideoTransferActive(n._localVideoActive&&n._remoteVideoActive);i&&(o||a)?n._renegotiate().then(r,r):r()};return new Promise(function(e,t){n.modificationQueue.push(o,function(n){n?t(n):e()})})}},{key:"modifyContents",value:function(e){var n=this,r=t.parseVideoSenders(e);null!==r?(_.debug(this+' queued "content-modify" task(video senders="'+r+'")'),this.modificationQueue.push(function(e){n._assertNotEnded("content-modify")&&n._modifyRemoteVideoActive(r)?n._renegotiate().then(e,e):e()},function(e){e&&_.error('"content-modify" failed',e)})):_.error(this+' - failed to parse video "senders" attribute in"content-modify" action')}},{key:"_modifyRemoteVideoActive",value:function(e){var t="both"===e||"initiator"===e&&this.isInitiator||"responder"===e&&!this.isInitiator;return t!==this._remoteVideoActive&&(_.debug(this+" new remote video active: "+t),this._remoteVideoActive=t),this.peerconnection.setVideoTransferActive(this._localVideoActive&&this._remoteVideoActive)}},{key:"notifyMySSRCUpdate",value:function(e,t){if(this.state===l.a){var n=new p.a(t,e),r=Object(s.$iq)({to:this.remoteJid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"source-remove",initiator:this.initiator,sid:this.sid});n.toJingle(r)?(_.info("Sending source-remove",r.tree()),this.connection.sendIQ(r,null,this.newJingleErrorHandler(r),1e4)):_.log("removal not necessary"),n=new p.a(e,t);var i=Object(s.$iq)({to:this.remoteJid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"source-add",initiator:this.initiator,sid:this.sid});n.toJingle(i)?(_.info("Sending source-add",i.tree()),this.connection.sendIQ(i,null,this.newJingleErrorHandler(i),1e4)):_.log("addition not necessary")}else _.warn("Skipping SSRC update in '"+this.state+" ' state.")}},{key:"newJingleErrorHandler",value:function(e,t){var n=this;return function(e){var r={},i=$(e).find("error");if(i.length){r.code=i.attr("code");var o=$(e).find("error :first");o.length&&(r.reason=o[0].tagName);var a=i.find(">text");a.length&&(r.msg=a.text())}e||(r.reason="timeout"),r.session=n.toString(),t?t(r):n.state===l.b&&"item-not-found"===r.reason?_.debug("Jingle error: "+JSON.stringify(r)):b.a.callErrorHandler(new Error("Jingle error: "+JSON.stringify(r)))}}},{key:"getIceConnectionState",value:function(){return this.peerconnection.iceConnectionState}},{key:"close",value:function(){this.closed=!0,this.signalingLayer.setChatRoom(null),this.peerconnection&&(this.peerconnection.signalingState&&"closed"!==this.peerconnection.signalingState||this.peerconnection.connectionState&&"closed"!==this.peerconnection.connectionState)&&this.peerconnection.close()}},{key:"toString",value:function(){return"JingleSessionPC[p2p="+this.isP2P+",initiator="+this.isInitiator+",sid="+this.sid+"]"}},{key:"_abtestSuspendVideoEnabled",value:function(){if(this.room.options.abTesting&&this.room.options.abTesting.enableSuspendVideoTest){var e=this._getInitiatorJid();return Object(c.integerHash)(e)%2==0}}}],[{key:"onJingleFatalError",value:function(e,t){this.room&&(this.room.eventEmitter.emit(g.a.CONFERENCE_SETUP_FAILED,e,t),this.room.eventEmitter.emit(g.a.JINGLE_FATAL_ERROR,e,t))}}]),t}();t.a=T}).call(t,"modules/xmpp/JingleSessionPC.js")},function(e,t,n){(function(n,r){var i;!function(){function o(e){var t=!1;return function(){if(t)throw new Error("Callback was already called.");t=!0,e.apply(a,arguments)}}var a,s,c={};null!=(a=this)&&(s=a.async),c.noConflict=function(){return a.async=s,c};var u=Object.prototype.toString,l=Array.isArray||function(e){return"[object Array]"===u.call(e)},d=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n+=1)t(e[n],n,e)},p=function(e,t){if(e.map)return e.map(t);var n=[];return d(e,function(e,r,i){n.push(t(e,r,i))}),n},h=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t};void 0!==n&&n.nextTick?(c.nextTick=n.nextTick,c.setImmediate=void 0!==r?function(e){r(e)}:c.nextTick):"function"==typeof r?(c.nextTick=function(e){r(e)},c.setImmediate=c.nextTick):(c.nextTick=function(e){setTimeout(e,0)},c.setImmediate=c.nextTick),c.each=function(e,t,n){function r(t){t?(n(t),n=function(){}):(i+=1)>=e.length&&n()}if(n=n||function(){},!e.length)return n();var i=0;d(e,function(e){t(e,o(r))})},c.forEach=c.each,c.eachSeries=function(e,t,n){if(n=n||function(){},!e.length)return n();var r=0,i=function(){t(e[r],function(t){t?(n(t),n=function(){}):(r+=1)>=e.length?n():i()})};i()},c.forEachSeries=c.eachSeries,c.eachLimit=function(e,t,n,r){f(t).apply(null,[e,n,r])},c.forEachLimit=c.eachLimit;var f=function(e){return function(t,n,r){if(r=r||function(){},!t.length||e<=0)return r();var i=0,o=0,a=0;!function s(){if(i>=t.length)return r();for(;a<e&&o<t.length;)a+=1,n(t[(o+=1)-1],function(e){e?(r(e),r=function(){}):(a-=1,(i+=1)>=t.length?r():s())})}()}},m=function(e){return function(){var t=Array.prototype.slice.call(arguments);return e.apply(null,[c.each].concat(t))}},v=function(e){return function(){var t=Array.prototype.slice.call(arguments);return e.apply(null,[c.eachSeries].concat(t))}},g=function(e,t,n,r){if(t=p(t,function(e,t){return{index:t,value:e}}),r){var i=[];e(t,function(e,t){n(e.value,function(n,r){i[e.index]=r,t(n)})},function(e){r(e,i)})}else e(t,function(e,t){n(e.value,function(e){t(e)})})};c.map=m(g),c.mapSeries=v(g),c.mapLimit=function(e,t,n,r){return y(t)(e,n,r)};var y=function(e){return t=e,n=g,function(){var e=Array.prototype.slice.call(arguments);return n.apply(null,[f(t)].concat(e))};var t,n};c.reduce=function(e,t,n,r){c.eachSeries(e,function(e,r){n(t,e,function(e,n){t=n,r(e)})},function(e){r(e,t)})},c.inject=c.reduce,c.foldl=c.reduce,c.reduceRight=function(e,t,n,r){var i=p(e,function(e){return e}).reverse();c.reduce(i,t,n,r)},c.foldr=c.reduceRight;var b=function(e,t,n,r){var i=[];e(t=p(t,function(e,t){return{index:t,value:e}}),function(e,t){n(e.value,function(n){n&&i.push(e),t()})},function(e){r(p(i.sort(function(e,t){return e.index-t.index}),function(e){return e.value}))})};c.filter=m(b),c.filterSeries=v(b),c.select=c.filter,c.selectSeries=c.filterSeries;var S=function(e,t,n,r){var i=[];e(t=p(t,function(e,t){return{index:t,value:e}}),function(e,t){n(e.value,function(n){n||i.push(e),t()})},function(e){r(p(i.sort(function(e,t){return e.index-t.index}),function(e){return e.value}))})};c.reject=m(S),c.rejectSeries=v(S);var _=function(e,t,n,r){e(t,function(e,t){n(e,function(n){n?(r(e),r=function(){}):t()})},function(e){r()})};c.detect=m(_),c.detectSeries=v(_),c.some=function(e,t,n){c.each(e,function(e,r){t(e,function(e){e&&(n(!0),n=function(){}),r()})},function(e){n(!1)})},c.any=c.some,c.every=function(e,t,n){c.each(e,function(e,r){t(e,function(e){e||(n(!1),n=function(){}),r()})},function(e){n(!0)})},c.all=c.every,c.sortBy=function(e,t,n){c.map(e,function(e,n){t(e,function(t,r){t?n(t):n(null,{value:e,criteria:r})})},function(e,t){if(e)return n(e);n(null,p(t.sort(function(e,t){var n=e.criteria,r=t.criteria;return n<r?-1:n>r?1:0}),function(e){return e.value}))})},c.auto=function(e,t){t=t||function(){};var n=h(e),r=n.length;if(!r)return t();var i={},o=[],a=function(e){o.unshift(e)},s=function(){r--,d(o.slice(0),function(e){e()})};a(function(){if(!r){var e=t;t=function(){},e(null,i)}}),d(n,function(n){var r=l(e[n])?e[n]:[e[n]],u=function(e){var r=Array.prototype.slice.call(arguments,1);if(r.length<=1&&(r=r[0]),e){var o={};d(h(i),function(e){o[e]=i[e]}),o[n]=r,t(e,o),t=function(){}}else i[n]=r,c.setImmediate(s)},p=r.slice(0,Math.abs(r.length-1))||[],f=function(){return t=function(e,t){return e&&i.hasOwnProperty(t)},r=!0,((e=p).reduce?e.reduce(t,r):(d(e,function(e,n,i){r=t(r,e,n,i)}),r))&&!i.hasOwnProperty(n);var e,t,r};if(f())r[r.length-1](u,i);else{var m=function(){f()&&(function(e){for(var t=0;t<o.length;t+=1)if(o[t]===e)return void o.splice(t,1)}(m),r[r.length-1](u,i))};a(m)}})},c.retry=function(e,t,n){var r=[];"function"==typeof e&&(n=t,t=e,e=5),e=parseInt(e,10)||5;var i=function(i,o){for(;e;)r.push(function(e,t){return function(n){e(function(e,r){n(!e||t,{err:e,result:r})},o)}}(t,!(e-=1)));c.series(r,function(e,t){t=t[t.length-1],(i||n)(t.err,t.result)})};return n?i():i},c.waterfall=function(e,t){if(t=t||function(){},!l(e)){var n=new Error("First argument to waterfall must be an array of functions");return t(n)}if(!e.length)return t();var r=function(e){return function(n){if(n)t.apply(null,arguments),t=function(){};else{var i=Array.prototype.slice.call(arguments,1),o=e.next();o?i.push(r(o)):i.push(t),c.setImmediate(function(){e.apply(null,i)})}}};r(c.iterator(e))()};var T=function(e,t,n){if(n=n||function(){},l(t))e.map(t,function(e,t){e&&e(function(e){var n=Array.prototype.slice.call(arguments,1);n.length<=1&&(n=n[0]),t.call(null,e,n)})},n);else{var r={};e.each(h(t),function(e,n){t[e](function(t){var i=Array.prototype.slice.call(arguments,1);i.length<=1&&(i=i[0]),r[e]=i,n(t)})},function(e){n(e,r)})}};c.parallel=function(e,t){T({map:c.map,each:c.each},e,t)},c.parallelLimit=function(e,t,n){T({map:y(t),each:f(t)},e,n)},c.series=function(e,t){if(t=t||function(){},l(e))c.mapSeries(e,function(e,t){e&&e(function(e){var n=Array.prototype.slice.call(arguments,1);n.length<=1&&(n=n[0]),t.call(null,e,n)})},t);else{var n={};c.eachSeries(h(e),function(t,r){e[t](function(e){var i=Array.prototype.slice.call(arguments,1);i.length<=1&&(i=i[0]),n[t]=i,r(e)})},function(e){t(e,n)})}},c.iterator=function(e){var t=function(n){var r=function(){return e.length&&e[n].apply(null,arguments),r.next()};return r.next=function(){return n<e.length-1?t(n+1):null},r};return t(0)},c.apply=function(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t.concat(Array.prototype.slice.call(arguments)))}};var C=function(e,t,n,r){var i=[];e(t,function(e,t){n(e,function(e,n){i=i.concat(n||[]),t(e)})},function(e){r(e,i)})};c.concat=m(C),c.concatSeries=v(C),c.whilst=function(e,t,n){e()?t(function(r){if(r)return n(r);c.whilst(e,t,n)}):n()},c.doWhilst=function(e,t,n){e(function(r){if(r)return n(r);var i=Array.prototype.slice.call(arguments,1);t.apply(null,i)?c.doWhilst(e,t,n):n()})},c.until=function(e,t,n){e()?n():t(function(r){if(r)return n(r);c.until(e,t,n)})},c.doUntil=function(e,t,n){e(function(r){if(r)return n(r);var i=Array.prototype.slice.call(arguments,1);t.apply(null,i)?n():c.doUntil(e,t,n)})},c.queue=function(e,t){function n(e,t,n,r){if(e.started||(e.started=!0),l(t)||(t=[t]),0==t.length)return c.setImmediate(function(){e.drain&&e.drain()});d(t,function(t){var i={data:t,callback:"function"==typeof r?r:null};n?e.tasks.unshift(i):e.tasks.push(i),e.saturated&&e.tasks.length===e.concurrency&&e.saturated(),c.setImmediate(e.process)})}void 0===t&&(t=1);var r=0,i={tasks:[],concurrency:t,saturated:null,empty:null,drain:null,started:!1,paused:!1,push:function(e,t){n(i,e,!1,t)},kill:function(){i.drain=null,i.tasks=[]},unshift:function(e,t){n(i,e,!0,t)},process:function(){if(!i.paused&&r<i.concurrency&&i.tasks.length){var t=i.tasks.shift();i.empty&&0===i.tasks.length&&i.empty(),r+=1;var n=o(function(){r-=1,t.callback&&t.callback.apply(t,arguments),i.drain&&i.tasks.length+r===0&&i.drain(),i.process()});e(t.data,n)}},length:function(){return i.tasks.length},running:function(){return r},idle:function(){return i.tasks.length+r===0},pause:function(){!0!==i.paused&&(i.paused=!0,i.process())},resume:function(){!1!==i.paused&&(i.paused=!1,i.process())}};return i},c.priorityQueue=function(e,t){function n(e,t){return e.priority-t.priority}var r=c.queue(e,t);return r.push=function(e,t,i){!function(e,t,r,i){if(e.started||(e.started=!0),l(t)||(t=[t]),0==t.length)return c.setImmediate(function(){e.drain&&e.drain()});d(t,function(t){var o={data:t,priority:r,callback:"function"==typeof i?i:null};e.tasks.splice(function(e,t,n){for(var r=-1,i=e.length-1;r<i;){var o=r+(i-r+1>>>1);n(t,e[o])>=0?r=o:i=o-1}return r}(e.tasks,o,n)+1,0,o),e.saturated&&e.tasks.length===e.concurrency&&e.saturated(),c.setImmediate(e.process)})}(r,e,t,i)},delete r.unshift,r},c.cargo=function(e,t){var n=!1,r=[],i={tasks:r,payload:t,saturated:null,empty:null,drain:null,drained:!0,push:function(e,n){l(e)||(e=[e]),d(e,function(e){r.push({data:e,callback:"function"==typeof n?n:null}),i.drained=!1,i.saturated&&r.length===t&&i.saturated()}),c.setImmediate(i.process)},process:function o(){if(!n){if(0===r.length)return i.drain&&!i.drained&&i.drain(),void(i.drained=!0);var a="number"==typeof t?r.splice(0,t):r.splice(0,r.length),s=p(a,function(e){return e.data});i.empty&&i.empty(),n=!0,e(s,function(){n=!1;var e=arguments;d(a,function(t){t.callback&&t.callback.apply(null,e)}),o()})}},length:function(){return r.length},running:function(){return n}};return i};var E=function(e){return function(t){var n=Array.prototype.slice.call(arguments,1);t.apply(null,n.concat([function(t){var n=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(t?console.error&&console.error(t):console[e]&&d(n,function(t){console[e](t)}))}]))}};c.log=E("log"),c.dir=E("dir"),c.memoize=function(e,t){var n={},r={};t=t||function(e){return e};var i=function(){var i=Array.prototype.slice.call(arguments),o=i.pop(),a=t.apply(null,i);a in n?c.nextTick(function(){o.apply(null,n[a])}):a in r?r[a].push(o):(r[a]=[o],e.apply(null,i.concat([function(){n[a]=arguments;var e=r[a];delete r[a];for(var t=0,i=e.length;t<i;t++)e[t].apply(null,arguments)}])))};return i.memo=n,i.unmemoized=e,i},c.unmemoize=function(e){return function(){return(e.unmemoized||e).apply(null,arguments)}},c.times=function(e,t,n){for(var r=[],i=0;i<e;i++)r.push(i);return c.map(r,t,n)},c.timesSeries=function(e,t,n){for(var r=[],i=0;i<e;i++)r.push(i);return c.mapSeries(r,t,n)},c.seq=function(){var e=arguments;return function(){var t=this,n=Array.prototype.slice.call(arguments),r=n.pop();c.reduce(e,n,function(e,n,r){n.apply(t,e.concat([function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);r(e,t)}]))},function(e,n){r.apply(t,[e].concat(n))})}},c.compose=function(){return c.seq.apply(null,Array.prototype.reverse.call(arguments))};var w=function(e,t){var n=function(){var n=this,r=Array.prototype.slice.call(arguments),i=r.pop();return e(t,function(e,t){e.apply(n,r.concat([t]))},i)};if(arguments.length>2){return n.apply(this,Array.prototype.slice.call(arguments,2))}return n};c.applyEach=m(w),c.applyEachSeries=v(w),c.forever=function(e,t){!function n(r){if(r){if(t)return t(r);throw r}e(n)}()},void 0!==e&&e.exports?e.exports=c:void 0===(i=function(){return c}.apply(t,[]))||(e.exports=i)}()}).call(t,n(34),n(40).setImmediate)},function(e,t){e.exports={integerHash:function(e){if(!e)return 0;var t=0,n=void 0;for(n=0;n<e.length;n++)t+=e.charCodeAt(n)*Math.pow(31,e.length-1-n),t=Math.abs(0|t);return t}}},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(52)),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=Object(r.getLogger)(e),s=function(){function e(t,n,r,i,o,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sid=t,this.localJid=n,this.remoteJid=r,this.connection=i,this.mediaConstraints=o,this.iceConfig=a,this.usedrip=!0,this.dripContainer=[],this.room=null,this.state=null,this.rtc=null}return o(e,[{key:"initialize",value:function(e,t,n){if(null!==this.state){var r="attempt to initiate on session "+this.sid+"\n in state "+this.state;throw a.error(r),new Error(r)}this.room=t,this.rtc=n,this.state=i.c,this.initiator=e?this.localJid:this.remoteJid,this.responder=e?this.remoteJid:this.localJid,this.doInitialize()}},{key:"doInitialize",value:function(){}},{key:"addIceCandidates",value:function(e){}},{key:"getState",value:function(){return this.state}},{key:"addSources",value:function(e){}},{key:"removeSources",value:function(e){}},{key:"terminate",value:function(e,t,n){}},{key:"acceptOffer",value:function(e,t,n){}},{key:"_getInitiatorJid",value:function(){return this.isInitiator?this.localJid:this.remoteJid}}]),e}();t.a=s}).call(t,"modules/xmpp/JingleSession.js")},function(e,t,n){"use strict";function r(e,t){if(!t)return!1;if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]instanceof Array&&t[n]instanceof Array){if(!e[n].equals(t[n]))return!1}else if(e[n]!==t[n])return!1;return!0}function i(e,t){if(this.mySDP=e,this.otherSDP=t,!e)throw new Error('"mySDP" is undefined!');if(!t)throw new Error('"otherSDP" is undefined!')}t.a=i;var o=n(14);i.prototype.getNewMedia=function(){var e=this.mySDP.getMediaSsrcMap(),t=this.otherSDP.getMediaSsrcMap(),n={};return Object.keys(t).forEach(function(i){var o=e[i],a=t[i];o||!a?(Object.keys(a.ssrcs).forEach(function(e){-1===Object.keys(o.ssrcs).indexOf(e)&&(n[i]||(n[i]={mediaindex:a.mediaindex,mid:a.mid,ssrcs:{},ssrcGroups:[]}),n[i].ssrcs[e]=a.ssrcs[e])}),a.ssrcGroups.forEach(function(e){for(var t=!1,s=0;s<o.ssrcGroups.length;s++){var c=o.ssrcGroups[s];if(e.semantics===c.semantics&&r(e.ssrcs,c.ssrcs)){t=!0;break}}t||(n[i]||(n[i]={mediaindex:a.mediaindex,mid:a.mid,ssrcs:{},ssrcGroups:[]}),n[i].ssrcGroups.push(e))})):n[i]=a}),n},i.prototype.toJingle=function(e){var t=this.getNewMedia(),n=!1;return Object.keys(t).forEach(function(r){n=!0;var i=t[r];e.c("content",{name:i.mid}),e.c("description",{xmlns:"urn:xmpp:jingle:apps:rtp:1",media:i.mid}),Object.keys(i.ssrcs).forEach(function(t){var n=i.ssrcs[t];e.c("source",{xmlns:"urn:xmpp:jingle:apps:rtp:ssma:0"}),e.attrs({ssrc:n.ssrc}),n.lines.forEach(function(t){var n=t.indexOf(" "),r=t.substr(n+1);if(e.c("parameter"),-1===r.indexOf(":"))e.attrs({name:r});else{var i=r.split(":",2),a=i[0],s=o.a.filterSpecialChars(i[1]);e.attrs({name:a}),e.attrs({value:s})}e.up()}),e.up()}),i.ssrcGroups.forEach(function(t){t.ssrcs.length&&(e.c("ssrc-group",{semantics:t.semantics,xmlns:"urn:xmpp:jingle:apps:rtp:ssma:0"}),t.ssrcs.forEach(function(t){e.c("source",{ssrc:t}).up()}),e.up())}),e.up(),e.up()}),n}},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(4)),o=n(54),a=n(111),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=Object(r.getLogger)(e),u=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.ssrcOwners=new Map,e.chatRoom=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.a),s(t,[{key:"setChatRoom",value:function(e){var t=this,n=this.chatRoom;this.chatRoom=e,n&&(n.removePresenceListener("audiomuted",this._audioMuteHandler),n.removePresenceListener("videomuted",this._videoMuteHandler),n.removePresenceListener("videoType",this._videoTypeHandler)),e&&(this._audioMuteHandler=function(e,n){t.eventEmitter.emit(o.a,n,i.a,"true"===e.value)},e.addPresenceListener("audiomuted",this._audioMuteHandler),this._videoMuteHandler=function(e,n){t.eventEmitter.emit(o.a,n,i.b,"true"===e.value)},e.addPresenceListener("videomuted",this._videoMuteHandler),this._videoTypeHandler=function(e,n){t.eventEmitter.emit(o.b,n,e.value)},e.addPresenceListener("videoType",this._videoTypeHandler))}},{key:"getPeerMediaInfo",value:function(e,t){if(this.chatRoom)return this.chatRoom.getMediaPresenceInfo(e,t);c.error("Requested peer media info, before room was set")}},{key:"getSSRCOwner",value:function(e){return this.ssrcOwners.get(e)}},{key:"setSSRCOwner",value:function(e,t){if("number"!=typeof e)throw new TypeError("SSRC("+e+") must be a number");this.ssrcOwners.set(e,t)}}]),t}();t.a=u}).call(t,"modules/xmpp/SignalingLayerImpl.js")},function(e,t,n){"use strict";var r=n(10),i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.a),i(t,[{key:"getSSRCOwner",value:function(e){throw new Error("not implemented")}},{key:"getPeerMediaInfo",value:function(e,t){throw new Error("not implemented")}}]),t}();t.a=o},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(2)),o=(n.n(i),n(3)),a=n.n(o),s=Object(r.getLogger)(e),c=-1,u=/request id \d+.\d+ got 200/,l=/request errored, status: (\d+), number of errors: \d+/;t.a=function(){i.Strophe.log=function(e,t){switch(s.trace("Strophe",e,t),"string"==typeof t&&-1!==t.indexOf("Request ")&&-1!==t.indexOf("timed out (secondary), restarting")&&(e=i.Strophe.LogLevel.WARN),e){case i.Strophe.LogLevel.DEBUG:-1!==c&&u.test(t)&&(s.debug("Reset lastErrorStatus"),c=-1);break;case i.Strophe.LogLevel.WARN:s.warn("Strophe: "+t);var n=l.exec(t);n&&2===n.length&&(c=parseInt(n[1],10),s.debug("lastErrorStatus set to: "+c));break;case i.Strophe.LogLevel.ERROR:case i.Strophe.LogLevel.FATAL:t="Strophe: "+t,a.a.callErrorHandler(new Error(t)),s.error(t)}},i.Strophe.getLastErrorStatus=function(){return c},i.Strophe.getStatusString=function(e){switch(e){case i.Strophe.Status.ERROR:return"ERROR";case i.Strophe.Status.CONNECTING:return"CONNECTING";case i.Strophe.Status.CONNFAIL:return"CONNFAIL";case i.Strophe.Status.AUTHENTICATING:return"AUTHENTICATING";case i.Strophe.Status.AUTHFAIL:return"AUTHFAIL";case i.Strophe.Status.CONNECTED:return"CONNECTED";case i.Strophe.Status.DISCONNECTED:return"DISCONNECTED";case i.Strophe.Status.DISCONNECTING:return"DISCONNECTING";case i.Strophe.Status.ATTACHED:return"ATTACHED";default:return"unknown"}}}}).call(t,"modules/xmpp/strophe.util.js")},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(2)),o=(n.n(i),n(3)),a=n.n(o),s=n(22),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=Object(r.getLogger)(e),l=12,d=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.failedPings=0,n.xmpp=e,n.pingExecIntervals=new Array(l),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.b),c(t,[{key:"init",value:function(e){(function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"init",this).call(this,e),i.Strophe.addNamespace("PING","urn:xmpp:ping")}},{key:"ping",value:function(e,t,n,r){this._addPingExecutionTimestamp();var o=Object(i.$iq)({type:"get",to:e});o.c("ping",{xmlns:i.Strophe.NS.PING}),this.connection.sendIQ(o,t,n,r)}},{key:"hasPingSupport",value:function(e,t){this.xmpp.caps.getFeatures(e).then(function(e){return t(e.has("urn:xmpp:ping"))},function(e){var n="Ping feature discovery error";a.a.callErrorHandler(new Error(n+": "+e)),u.error(n,e),t(!1)})}},{key:"startInterval",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4;if(this.intervalId){var r="Ping task scheduled already";return a.a.callErrorHandler(new Error(r)),void u.error(r)}this.intervalId=window.setInterval(function(){t.ping(e,function(){t.failedPings=0},function(e){t.failedPings+=1;var n="Ping "+(e?"error":"timeout");t.failedPings>=3?(a.a.callErrorHandler(new Error(n)),u.error(n,e)):u.warn(n,e)},15e3)},n),u.info("XMPP pings will be sent every "+n+" ms")}},{key:"stopInterval",value:function(){this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null,this.failedPings=0,u.info("Ping interval cleared"))}},{key:"_addPingExecutionTimestamp",value:function(){this.pingExecIntervals.push((new Date).getTime()),this.pingExecIntervals.length>l&&this.pingExecIntervals.shift()}},{key:"getPingSuspendTime",value:function(){var e=this.pingExecIntervals.slice();e.push((new Date).getTime());var t=0,n=e[0];return e.forEach(function(e){var r=e-n;r>t&&(t=r),n=e}),t-=1e4,Math.max(t,0)}}]),t}();t.a=function(e){i.Strophe.addConnectionPlugin("ping",new d(e))}}).call(t,"modules/xmpp/strophe.ping.js")},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(2)),o=(n.n(i),n(22)),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=Object(r.getLogger)(e),c="urn:xmpp:rayo:1",u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.b),a(t,[{key:"init",value:function(e){(function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"init",this).call(this,e),this.connection.addHandler(this.onRayo.bind(this),c,"iq","set",null,null)}},{key:"onRayo",value:function(e){s.info("Rayo IQ",e)}},{key:"dial",value:function(e,t,n,r,o){var a=this;return new Promise(function(u,l){if(o){var d=Object(i.$iq)({type:"set",to:o});d.c("dial",{xmlns:c,to:e,from:t}),d.c("header",{name:"JvbRoomName",value:n}).up(),r&&r.length&&d.c("header",{name:"JvbRoomPassword",value:r}).up(),a.connection.sendIQ(d,function(e){s.info("Dial result ",e);var t=$(e).find("ref").attr("uri");a.callResource=t.substr("xmpp:".length),s.info("Received call resource: "+a.callResource),u()},function(e){s.info("Dial error ",e),l(e)})}else l(new Error("Internal error!"))})}},{key:"hangup",value:function(){var e=this;return new Promise(function(t,n){if(!e.callResource)return n(new Error("No call in progress")),void s.warn("No call in progress");var r=Object(i.$iq)({type:"set",to:e.callResource});r.c("hangup",{xmlns:c}),e.connection.sendIQ(r,function(n){s.info("Hangup result ",n),e.callResource=null,t()},function(t){s.info("Hangup error ",t),e.callResource=null,n(new Error("Hangup error "))})})}}]),t}();t.a=function(){i.Strophe.addConnectionPlugin("rayo",new u)}}).call(t,"modules/xmpp/strophe.rayo.js")},function(e,t,n){"use strict";var r=n(2),i=(n.n(r),n(22)),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.log=[],e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.b),o(t,[{key:"init",value:function(e){(function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"init",this).call(this,e),this.connection.rawInput=this.logIncoming.bind(this),this.connection.rawOutput=this.logOutgoing.bind(this)}},{key:"logIncoming",value:function(e){this.log.push([(new Date).getTime(),"incoming",e])}},{key:"logOutgoing",value:function(e){this.log.push([(new Date).getTime(),"outgoing",e])}}]),t}();t.a=function(){r.Strophe.addConnectionPlugin("logger",new a)}},function(e,t,n){"use strict";function r(e,t){var n=0;return l.some(function(r){return 0!==(n=e[r]>t[r]?1:e[r]<t[r]&&-1)}),n}var i=n(2),o=(n.n(i),n(8)),a=n.n(o),s=n(10),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=["category","type","lang","name"],l=["category","type","lang"],d=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"http://jitsi.org/jitsimeet";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(r.node=n,r.disco=e.disco,!r.disco)throw new Error("Missing strophe-plugins (disco plugin is required)!");r.versionToCapabilities=Object.create(null),r.jidToVersion=Object.create(null),r.version="",r.rooms=new Set;var o=e.emuc;return o.addListener(a.a.EMUC_ROOM_ADDED,function(e){return r._addChatRoom(e)}),o.addListener(a.a.EMUC_ROOM_REMOVED,function(e){return r._removeChatRoom(e)}),Object.keys(o.rooms).forEach(function(e){r._addChatRoom(o.rooms[e])}),i.Strophe.addNamespace("CAPS","http://jabber.org/protocol/caps"),r.disco.addFeature(i.Strophe.NS.CAPS),e.addHandler(r._handleCaps.bind(r),i.Strophe.NS.CAPS),r._onMucMemberLeft=r._removeJidToVersionEntry.bind(r),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a),c(t,[{key:"addFeature",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.disco.addFeature(e),this._generateVersion(),t&&this.submit()}},{key:"removeFeature",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.disco.removeFeature(e),this._generateVersion(),t&&this.submit()}},{key:"submit",value:function(){this.rooms.forEach(function(e){return e.sendPresence()})}},{key:"getFeatures",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,r=e in this.jidToVersion?this.jidToVersion[e]:null;if(!(r&&r.version in this.versionToCapabilities)){var i=r?r.node+"#"+r.version:null;return new Promise(function(o,a){return t.disco.info(e,i,function(e){var n=new Set;$(e).find(">query>feature").each(function(e,t){return n.add(t.getAttribute("var"))}),r&&(t.versionToCapabilities[r.version]=n),o(n)},a,n)})}return Promise.resolve(this.versionToCapabilities[r.version])}},{key:"_addChatRoom",value:function(e){this.rooms.add(e),e.addListener(a.a.MUC_MEMBER_LEFT,this._onMucMemberLeft),this._fixChatRoomPresenceMap(e)}},{key:"_removeChatRoom",value:function(e){this.rooms.delete(e),e.removeListener(a.a.MUC_MEMBER_LEFT,this._onMucMemberLeft)}},{key:"_fixChatRoomPresenceMap",value:function(e){e.addToPresence("c",{attributes:{xmlns:i.Strophe.NS.CAPS,hash:"sha-1",node:this.node,ver:this.version}})}},{key:"_notifyVersionChanged",value:function(){var e=this;this.rooms.forEach(function(t){return e._fixChatRoomPresenceMap(t)}),this.submit()}},{key:"_generateVersion",value:function(){var e=this.disco._identities.sort(r).reduce(function(e,t){return u.reduce(function(e,n,r){return e+(0===r?"":"/")+t[n]},"")+"<"},""),t=this.disco._features.sort().reduce(function(e,t){return e+t+"<"},"");this.version=Object(i.b64_sha1)(e+t),this._notifyVersionChanged()}},{key:"_handleCaps",value:function(e){var t=e.getAttribute("from"),n=e.querySelector("c"),r=n.getAttribute("ver"),i=n.getAttribute("node"),o=this.jidToVersion[t];return this.jidToVersion[t]={version:r,node:i},o&&o.version!==r&&this.eventEmitter.emit(a.a.PARTCIPANT_FEATURES_CHANGED,t),!0}},{key:"_removeJidToVersionEntry",value:function(e){e in this.jidToVersion&&delete this.jidToVersion[e]}}]),t}();t.a=d},function(e,t,n){"use strict";(function(e){function r(e){this.conference=e,e.on(p.TRACK_MUTE_CHANGED,function(t){if(t.isLocal()&&e.statistics){var n=t.isP2P?e.p2pJingleSession:e.jvbJingleSession,r=n&&n.peerconnection||null;e.statistics.sendMuteEvent(r,t.isMuted(),t.getType())}})}t.a=r;var i=n(2),o=(n.n(i),n(6)),a=n(49),s=n.n(a),c=n(118),u=n.n(c),l=n(0),d=(n.n(l),n(32)),p=n(7),h=n(4),f=n(9),m=n.n(f),v=n(13),g=n.n(v),y=n(5),b=n(8),S=n.n(b),_=Object(l.getLogger)(e);r.prototype.setupChatRoomListeners=function(){var e=this,t=this.conference,n=t.room;this.chatRoomForwarder=new u.a(n,this.conference.eventEmitter),n.addListener(S.a.ICE_RESTARTING,function(e){e.isP2P||t.rtc.closeBridgeChannel()}),n.addListener(S.a.AUDIO_MUTED_BY_FOCUS,function(){y.a.sendAnalytics(Object(o.C)()),t.rtc.setAudioMute(!0).then(function(){t.isMutedByFocus=!0},function(){return _.warn("Error while audio muting due to focus request")})}),this.chatRoomForwarder.forward(S.a.SUBJECT_CHANGED,p.SUBJECT_CHANGED),this.chatRoomForwarder.forward(S.a.MUC_JOINED,p.CONFERENCE_JOINED),n.addListener(S.a.MUC_JOINED,function(){e.conference.isJvbConnectionInterrupted=!1,Object.keys(n.connectionTimes).forEach(function(e){var t=Object(o.w)("conference_"+e,{value:n.connectionTimes[e]});y.a.sendAnalytics(t)}),Object.keys(n.xmpp.connectionTimes).forEach(function(e){var t=Object(o.w)("xmpp_"+e,{value:n.xmpp.connectionTimes[e]});y.a.sendAnalytics(t)})}),this.chatRoomForwarder.forward(S.a.ROOM_JOIN_ERROR,p.CONFERENCE_FAILED,d.CONNECTION_ERROR),this.chatRoomForwarder.forward(S.a.ROOM_CONNECT_ERROR,p.CONFERENCE_FAILED,d.CONNECTION_ERROR),this.chatRoomForwarder.forward(S.a.ROOM_CONNECT_NOT_ALLOWED_ERROR,p.CONFERENCE_FAILED,d.NOT_ALLOWED_ERROR),this.chatRoomForwarder.forward(S.a.ROOM_MAX_USERS_ERROR,p.CONFERENCE_FAILED,d.CONFERENCE_MAX_USERS),this.chatRoomForwarder.forward(S.a.PASSWORD_REQUIRED,p.CONFERENCE_FAILED,d.PASSWORD_REQUIRED),this.chatRoomForwarder.forward(S.a.AUTHENTICATION_REQUIRED,p.CONFERENCE_FAILED,d.AUTHENTICATION_REQUIRED),this.chatRoomForwarder.forward(S.a.BRIDGE_DOWN,p.CONFERENCE_FAILED,d.VIDEOBRIDGE_NOT_AVAILABLE),n.addListener(S.a.BRIDGE_DOWN,function(){return y.a.sendAnalytics(Object(o.u)())}),this.chatRoomForwarder.forward(S.a.RESERVATION_ERROR,p.CONFERENCE_FAILED,d.RESERVATION_ERROR),this.chatRoomForwarder.forward(S.a.GRACEFUL_SHUTDOWN,p.CONFERENCE_FAILED,d.GRACEFUL_SHUTDOWN),n.addListener(S.a.JINGLE_FATAL_ERROR,function(e,n){e.isP2P||t.eventEmitter.emit(p.CONFERENCE_FAILED,d.JINGLE_FATAL_ERROR,n)}),n.addListener(S.a.CONNECTION_ICE_FAILED,function(e){t._onIceConnectionFailed(e)}),this.chatRoomForwarder.forward(S.a.MUC_DESTROYED,p.CONFERENCE_FAILED,d.CONFERENCE_DESTROYED),this.chatRoomForwarder.forward(S.a.CHAT_ERROR_RECEIVED,p.CONFERENCE_ERROR,d.CHAT_ERROR),this.chatRoomForwarder.forward(S.a.FOCUS_DISCONNECTED,p.CONFERENCE_FAILED,d.FOCUS_DISCONNECTED),n.addListener(S.a.FOCUS_LEFT,function(){y.a.sendAnalytics(Object(o.x)()),t.eventEmitter.emit(p.CONFERENCE_FAILED,d.FOCUS_LEFT)}),n.addListener(S.a.SESSION_ACCEPT_TIMEOUT,function(e){y.a.sendAnalyticsAndLog(Object(o.z)(o.b,{p2p:e.isP2P}))}),this.chatRoomForwarder.forward(S.a.RECORDER_STATE_CHANGED,p.RECORDER_STATE_CHANGED),this.chatRoomForwarder.forward(S.a.TRANSCRIPTION_STATUS_CHANGED,p.TRANSCRIPTION_STATUS_CHANGED),this.chatRoomForwarder.forward(S.a.VIDEO_SIP_GW_AVAILABILITY_CHANGED,p.VIDEO_SIP_GW_AVAILABILITY_CHANGED),this.chatRoomForwarder.forward(S.a.VIDEO_SIP_GW_SESSION_STATE_CHANGED,p.VIDEO_SIP_GW_SESSION_STATE_CHANGED),this.chatRoomForwarder.forward(S.a.PHONE_NUMBER_CHANGED,p.PHONE_NUMBER_CHANGED),n.addListener(S.a.CONFERENCE_SETUP_FAILED,function(e,n){e.isP2P||t.eventEmitter.emit(p.CONFERENCE_FAILED,d.SETUP_FAILED,n)}),n.setParticipantPropertyListener(function(e,n){var r=t.getParticipantById(n);r&&r.setProperty(e.tagName.substring("jitsi_participant_".length),e.value)}),this.chatRoomForwarder.forward(S.a.KICKED,p.KICKED),n.addListener(S.a.KICKED,function(){t.room=null,t.leave()}),n.addListener(S.a.SUSPEND_DETECTED,t.onSuspendDetected.bind(t)),this.chatRoomForwarder.forward(S.a.MUC_LOCK_CHANGED,p.LOCK_STATE_CHANGED),n.addListener(S.a.MUC_MEMBER_JOINED,t.onMemberJoined.bind(t)),n.addListener(S.a.MUC_MEMBER_LEFT,t.onMemberLeft.bind(t)),this.chatRoomForwarder.forward(S.a.MUC_LEFT,p.CONFERENCE_LEFT),n.addListener(S.a.DISPLAY_NAME_CHANGED,t.onDisplayNameChanged.bind(t)),n.addListener(S.a.LOCAL_ROLE_CHANGED,function(e){t.onLocalRoleChanged(e),t.statistics&&t.isModerator()&&t.on(p.RECORDER_STATE_CHANGED,function(e,t){var n={id:"recorder_status",status:e};t&&(n.error=t),y.a.sendLog(JSON.stringify(n))})}),n.addListener(S.a.MUC_ROLE_CHANGED,t.onUserRoleChanged.bind(t)),n.addListener(s.a.IDENTITY_UPDATED,function(e,n){t.authEnabled=e,t.authIdentity=n,t.eventEmitter.emit(p.AUTH_STATUS_CHANGED,e,n)}),n.addListener(S.a.MESSAGE_RECEIVED,function(e,n,r,o,a){var s=i.Strophe.getResourceFromJid(e);t.eventEmitter.emit(p.MESSAGE_RECEIVED,s,r,a)}),n.addListener(S.a.PRIVATE_MESSAGE_RECEIVED,function(e,n,r,o,a){var s=i.Strophe.getResourceFromJid(e);t.eventEmitter.emit(p.PRIVATE_MESSAGE_RECEIVED,s,r,a)}),n.addListener(S.a.PRESENCE_STATUS,function(e,n){var r=i.Strophe.getResourceFromJid(e),o=t.getParticipantById(r);o&&o._status!==n&&(o._status=n,t.eventEmitter.emit(p.USER_STATUS_CHANGED,r,n))}),n.addListener(S.a.JSON_MESSAGE_RECEIVED,function(e,n){var r=i.Strophe.getResourceFromJid(e),o=t.getParticipantById(r);o?t.eventEmitter.emit(p.ENDPOINT_MESSAGE_RECEIVED,o,n):_.warn("Ignored XMPPEvents.JSON_MESSAGE_RECEIVED for not existing participant: "+e,n)}),n.addPresenceListener("startmuted",function(e,n){var r=!1;if(t.myUserId()===n&&t.isModerator())r=!0;else{var i=t.getParticipantById(n);i&&i.isModerator()&&(r=!0)}if(r){var o="true"===e.attributes.audio,a="true"===e.attributes.video,s=!1;o!==t.startMutedPolicy.audio&&(t.startMutedPolicy.audio=o,s=!0),a!==t.startMutedPolicy.video&&(t.startMutedPolicy.video=a,s=!0),s&&t.eventEmitter.emit(p.START_MUTED_POLICY_CHANGED,t.startMutedPolicy)}}),n.addPresenceListener("devices",function(e,n){var r=!1,i=!1;e.children.forEach(function(e){"audio"===e.tagName&&(r="true"===e.value),"video"===e.tagName&&(i="true"===e.value)});var o=void 0;if(t.myUserId()===n)o=t.availableDevices;else{var a=t.getParticipantById(n);if(!a)return;o=a._availableDevices}var s=!1;o.audio!==r&&(s=!0,o.audio=r),o.video!==i&&(s=!0,o.video=i),s&&t.eventEmitter.emit(p.AVAILABLE_DEVICES_CHANGED,n,o)}),t.statistics&&(n.addListener(S.a.CONNECTION_ICE_FAILED,function(e){t.statistics.sendIceConnectionFailedEvent(e.peerconnection)}),n.addListener(S.a.ADD_ICE_CANDIDATE_FAILED,function(e,n){t.statistics.sendAddIceCandidateFailed(e,n)}))},r.prototype.setupRTCListeners=function(){var e=this.conference,t=e.rtc;t.addListener(m.a.REMOTE_TRACK_ADDED,e.onRemoteTrackAdded.bind(e)),t.addListener(m.a.REMOTE_TRACK_REMOVED,e.onRemoteTrackRemoved.bind(e)),t.addListener(m.a.DOMINANT_SPEAKER_CHANGED,function(t){e.lastDominantSpeaker!==t&&e.room&&(e.lastDominantSpeaker=t,e.eventEmitter.emit(p.DOMINANT_SPEAKER_CHANGED,t)),e.statistics&&e.myUserId()===t&&e.statistics.sendDominantSpeakerEvent()}),t.addListener(m.a.DATA_CHANNEL_OPEN,function(){var t=window.performance.now(),n="data.channel.opened";_.log("(TIME) "+n,t),e.room.connectionTimes[n]=t,y.a.sendAnalytics(Object(o.w)(n,{value:t})),e.eventEmitter.emit(p.DATA_CHANNEL_OPENED)}),t.addListener(m.a.AVAILABLE_DEVICES_CHANGED,function(t){return e.room.updateDeviceAvailability(t)}),t.addListener(m.a.ENDPOINT_MESSAGE_RECEIVED,function(t,n){var r=e.getParticipantById(t);r?e.eventEmitter.emit(p.ENDPOINT_MESSAGE_RECEIVED,r,n):_.warn("Ignored ENDPOINT_MESSAGE_RECEIVED for not existing participant: "+t,n)}),t.addListener(m.a.LOCAL_UFRAG_CHANGED,function(e,t){e.isP2P||y.a.sendLog(JSON.stringify({id:"local_ufrag",value:t}))}),t.addListener(m.a.REMOTE_UFRAG_CHANGED,function(e,t){e.isP2P||y.a.sendLog(JSON.stringify({id:"remote_ufrag",value:t}))}),t.addListener(m.a.CREATE_ANSWER_FAILED,function(t,n){e.statistics.sendCreateAnswerFailed(t,n)}),t.addListener(m.a.CREATE_OFFER_FAILED,function(t,n){e.statistics.sendCreateOfferFailed(t,n)}),t.addListener(m.a.SET_LOCAL_DESCRIPTION_FAILED,function(t,n){e.statistics.sendSetLocalDescFailed(t,n)}),t.addListener(m.a.SET_REMOTE_DESCRIPTION_FAILED,function(t,n){e.statistics.sendSetRemoteDescFailed(t,n)}),t.addListener(m.a.LOCAL_TRACK_SSRC_UPDATED,function(t,n){t.isVideoTrack()&&t.videoType===g.a.DESKTOP&&e.statistics.sendScreenSharingEvent(!0,n)})},r.prototype.setupXMPPListeners=function(){var e=this.conference;e.xmpp.caps.addListener(S.a.PARTCIPANT_FEATURES_CHANGED,function(t){var n=e.getParticipantById(i.Strophe.getResourceFromJid(t));n&&e.eventEmitter.emit(p.PARTCIPANT_FEATURES_CHANGED,n)}),e.xmpp.addListener(S.a.CALL_INCOMING,e.onIncomingCall.bind(e)),e.xmpp.addListener(S.a.CALL_ACCEPTED,e.onCallAccepted.bind(e)),e.xmpp.addListener(S.a.TRANSPORT_INFO,e.onTransportInfo.bind(e)),e.xmpp.addListener(S.a.CALL_ENDED,e.onCallEnded.bind(e)),e.xmpp.addListener(S.a.START_MUTED_FROM_FOCUS,function(t,n){e.options.config.ignoreStartMuted||(e.startAudioMuted=t,e.startVideoMuted=n,e.getLocalTracks().forEach(function(t){switch(t.getType()){case h.a:e.startAudioMuted&&t.mute();break;case h.b:e.startVideoMuted&&t.mute()}}),e.eventEmitter.emit(p.STARTED_MUTED))})},r.prototype.setupStatisticsListeners=function(){var e=this.conference;e.statistics&&(e.statistics.addAudioLevelListener(function(t,n,r,i){e.rtc.setAudioLevel(t,n,r,i)}),e.statistics.addBeforeDisposedListener(function(){e.eventEmitter.emit(p.BEFORE_STATISTICS_DISPOSED)}),e.statistics.addByteSentStatsListener(function(t,n){e.getLocalTracks(h.a).forEach(function(e){var r=t.getLocalSSRC(e);r&&n.hasOwnProperty(r)&&e._onByteSentStatsReceived(t,n[r])})}))}}).call(t,"JitsiConferenceEventManager.js")},function(e,t){function n(e,t){if(!e||!t||"function"!=typeof e.addListener||"function"!=typeof t.emit)throw new Error("Invalid arguments passed to EventEmitterForwarder");this.src=e,this.dest=t}n.prototype.forward=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0];t[0]=this.dest,this.src.addListener(r,Function.prototype.bind.apply(this.dest.emit,t))},e.exports=n},function(e,t,n){(function(e){n(0).getLogger(e)}).call(t,"modules/DTMF/JitsiDTMFManager.js")},function(e,t,n){"use strict";var r=n(2),i=(n.n(r),n(7)),o=n(36),a=n(4),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=function(){function e(t,n,i,a,s,c){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._jid=t,this._id=r.Strophe.getResourceFromJid(t),this._conference=n,this._displayName=i,this._supportsDTMF=!1,this._tracks=[],this._role="none",this._status=c,this._availableDevices={audio:void 0,video:void 0},this._hidden=a,this._statsID=s,this._connectionStatus=o.a.ACTIVE,this._properties={}}return s(e,[{key:"getConference",value:function(){return this._conference}},{key:"getProperty",value:function(e){return this._properties[e]}},{key:"hasAnyVideoTrackWebRTCMuted",value:function(){return this.getTracks().some(function(e){return e.getType()===a.b&&e.isWebRTCTrackMuted()})}},{key:"_setConnectionStatus",value:function(e){this._connectionStatus=e}},{key:"getConnectionStatus",value:function(){return this._connectionStatus}},{key:"setProperty",value:function(e,t){var n=this._properties[e];t!==n&&(this._properties[e]=t,this._conference.eventEmitter.emit(i.PARTICIPANT_PROPERTY_CHANGED,this,e,n,t))}},{key:"getTracks",value:function(){return this._tracks.slice()}},{key:"getTracksByMediaType",value:function(e){return this.getTracks().filter(function(t){return t.getType()===e})}},{key:"getId",value:function(){return this._id}},{key:"getJid",value:function(){return this._jid}},{key:"getDisplayName",value:function(){return this._displayName}},{key:"getStatsID",value:function(){return this._statsID}},{key:"getStatus",value:function(){return this._status}},{key:"isModerator",value:function(){return"moderator"===this._role}},{key:"isHidden",value:function(){return this._hidden}},{key:"isAudioMuted",value:function(){return this._isMediaTypeMuted(a.a)}},{key:"_isMediaTypeMuted",value:function(e){return this.getTracks().reduce(function(t,n){return t&&(n.getType()!==e||n.isMuted())},!0)}},{key:"isVideoMuted",value:function(){return this._isMediaTypeMuted(a.b)}},{key:"getRole",value:function(){return this._role}},{key:"supportsDTMF",value:function(){return this._supportsDTMF}},{key:"getFeatures",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5e3;return this._conference.xmpp.caps.getFeatures(this._jid,e)}}]),e}();t.a=c},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(7)),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=Object(r.getLogger)(e),s=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._conference=t,this._jvb121=!0,this._conference.addEventListener(i.USER_JOINED,function(){return n.evaluateStatus()}),this._conference.addEventListener(i.USER_LEFT,function(){return n.evaluateStatus()}),this._conference.addEventListener(i.P2P_STATUS,function(){return n.evaluateStatus()})}return o(e,[{key:"evaluateStatus",value:function(){var e=this._jvb121,t=!this._conference.isP2PActive()&&this._conference.getParticipantCount()<=2;e!==t&&(this._jvb121=t,a.debug("JVB121 status "+e+" => "+t),this._conference.eventEmitter.emit(i.JVB121_STATUS,e,t))}}]),e}();t.a=s}).call(t,"modules/event/Jvb121EventGenerator.js")},function(e,t,n){"use strict";var r=n(7),i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.conference=t,t.addEventListener(r.TRACK_AUDIO_LEVEL_CHANGED,this._audioLevel.bind(this)),this.myUserID=this.conference.myUserId()}return i(e,[{key:"_audioLevel",value:function(e,t){!this.conference.isP2PActive()||t<=.6||e===this.myUserID&&this.conference.getLocalAudioTrack().isMuted()||this.conference.eventEmitter.emit(r.DOMINANT_SPEAKER_CHANGED,e)}}]),e}();t.a=o},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(9)),o=n.n(i),a=n(3),s=n.n(a),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=Object(r.getLogger)(e),l=function(){function e(t,n,r){var i=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t&&!n)throw new TypeError("At least peerconnection or wsUrl must be given");if(t&&n)throw new TypeError("Just one of peerconnection or wsUrl must be given");if(t?u.debug("constructor() with peerconnection"):u.debug('constructor() with wsUrl:"'+n+'"'),this._channel=null,this._eventEmitter=r,this._mode=null,t)t.ondatachannel=function(e){var t=e.channel;i._handleChannel(t),i._mode="datachannel"};else if(n){var o=new WebSocket(n);this._handleChannel(o),this._mode="websocket"}}return c(e,[{key:"close",value:function(){if(this._channel){try{this._channel.close()}catch(e){}this._channel=null}}},{key:"isOpen",value:function(){return this._channel&&("open"===this._channel.readyState||this._channel.readyState===WebSocket.OPEN)}},{key:"sendMessage",value:function(e,t){this._send({colibriClass:"EndpointMessage",msgPayload:t,to:e})}},{key:"sendSetLastNMessage",value:function(e){var t={colibriClass:"LastNChangedEvent",lastN:e};this._send(t),u.log("Channel lastN set to: "+e)}},{key:"sendPinnedEndpointMessage",value:function(e){u.log("sending pinned changed notification to the bridge for endpoint ",e),this._send({colibriClass:"PinnedEndpointChangedEvent",pinnedEndpoint:e||null})}},{key:"sendSelectedEndpointMessage",value:function(e){u.log("sending selected changed notification to the bridge for endpoint ",e),this._send({colibriClass:"SelectedEndpointChangedEvent",selectedEndpoint:e||null})}},{key:"sendReceiverVideoConstraintMessage",value:function(e){u.log("sending a ReceiverVideoConstraint message with a maxFrameHeight of "+e+" pixels"),this._send({colibriClass:"ReceiverVideoConstraint",maxFrameHeight:e})}},{key:"_handleChannel",value:function(e){var t=this,n=this._eventEmitter;e.onopen=function(){u.info(t._mode+" channel opened"),n.emit(o.a.DATA_CHANNEL_OPEN)},e.onerror=function(e){u.error("Channel error:",e)},e.onmessage=function(e){var t=e.data,r=void 0;try{r=JSON.parse(t)}catch(e){return s.a.callErrorHandler(e),void u.error("Failed to parse channel message as JSON: ",t,e)}var i=r.colibriClass;switch(i){case"DominantSpeakerEndpointChangeEvent":var a=r.dominantSpeakerEndpoint;u.info("Channel new dominant speaker event: ",a),n.emit(o.a.DOMINANT_SPEAKER_CHANGED,a);break;case"EndpointConnectivityStatusChangeEvent":var c=r.endpoint,l="true"===r.active;u.info("Endpoint connection status changed: "+c+" active ? "+l),n.emit(o.a.ENDPOINT_CONN_STATUS_CHANGED,c,l);break;case"EndpointMessage":n.emit(o.a.ENDPOINT_MESSAGE_RECEIVED,r.from,r.msgPayload);break;case"LastNEndpointsChangeEvent":var d=r.lastNEndpoints;u.info("Channel new last-n event: ",d,r),n.emit(o.a.LASTN_ENDPOINT_CHANGED,d,r);break;default:u.debug("Channel JSON-formatted message: ",r),n.emit("rtc.datachannel."+i,r)}},e.onclose=function(){u.info("Channel closed"),t._channel=null},this._channel=e}},{key:"_send",value:function(e){var t=this._channel;if(!this.isOpen())throw new Error("No opened channel");t.send(JSON.stringify(e))}},{key:"mode",get:function(){return this._mode}}]),e}();t.a=l}).call(t,"modules/RTC/BridgeChannel.js")},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(55)),o=n(12),a=n(17),s=n(18),c=n(1),u=n(28),l=n(56),d=n.n(l),p=n(4),h=n(9),f=n.n(h),m=n(13),v=n.n(m),g=n(6),y=n(5),b=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),S=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0},_=Object(r.getLogger)(e),T=function(e){function t(e){var n=e.deviceId,r=e.facingMode,i=e.mediaType,o=e.resolution,a=e.rtcId,l=e.sourceId,d=e.sourceType,p=e.stream,h=e.track,m=e.videoType;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var v=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,null,p,h,function(){return v.emit(s.LOCAL_TRACK_STOPPED)},i,m));return v.rtcId=a,v.sourceId=l,v.sourceType=d,c.a.usesNewGumFlow()?(v.resolution=h.getSettings().height,v._constraints=h.getConstraints()):v.resolution=c.a.isFirefox()?null:o,v.deviceId=n,v._prevSetMuted=Promise.resolve(),v._facingMode=r,v._trackEnded=!1,v._hasSentData=!1,v._testDataSent=!0,v._realDeviceId=""===v.deviceId?void 0:v.deviceId,v._noDataFromSourceTimeout=null,v._onDeviceListChanged=function(e){v._setRealDeviceIdFromDeviceList(e),void 0!==v.getTrack().readyState||void 0===v._realDeviceId||e.find(function(e){return e.deviceId===v._realDeviceId})||(v._trackEnded=!0)},v.isAudioTrack()&&u.a.isDeviceChangeAvailable("output")&&(v._onAudioOutputDeviceChanged=v.setAudioOutput.bind(v),u.a.addListener(f.a.AUDIO_OUTPUT_DEVICE_CHANGED,v._onAudioOutputDeviceChanged)),u.a.addListener(f.a.DEVICE_LIST_CHANGED,v._onDeviceListChanged),v._initNoDataFromSourceHandlers(),v}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.a),b(t,[{key:"isEnded",value:function(){return"ended"===this.getTrack().readyState||this._trackEnded}},{key:"_initNoDataFromSourceHandlers",value:function(){var e=this;if(this.isVideoTrack()&&this.videoType===v.a.CAMERA){var t=this._onNoDataFromSourceError.bind(this);this._setHandler("track_mute",function(){if(e._checkForCameraIssues()){var n=window.performance.now();e._noDataFromSourceTimeout=setTimeout(t,3e3),e._setHandler("track_unmute",function(){e._clearNoDataFromSourceMuteResources(),y.a.sendAnalyticsAndLog(g.p,{media_type:e.getType(),track_type:"local",value:window.performance.now()-n})})}}),this._setHandler("track_ended",t)}}},{key:"_clearNoDataFromSourceMuteResources",value:function(){this._noDataFromSourceTimeout&&(clearTimeout(this._noDataFromSourceTimeout),this._noDataFromSourceTimeout=null),this._setHandler("track_unmute",void 0)}},{key:"_onNoDataFromSourceError",value:function(){this._clearNoDataFromSourceMuteResources(),this._checkForCameraIssues()&&this._fireNoDataFromSourceEvent()}},{key:"_fireNoDataFromSourceEvent",value:function(){this.emit(s.NO_DATA_FROM_SOURCE),y.a.sendAnalytics(Object(g.A)(this.getType()));var e={name:s.NO_DATA_FROM_SOURCE};this.isAudioTrack()&&(e.isReceivingData=this._isReceivingData()),y.a.sendLog(JSON.stringify(e))}},{key:"_setRealDeviceIdFromDeviceList",value:function(e){var t=this.getTrack(),n=e.find(function(e){return e.kind===t.kind+"input"&&e.label===t.label});n&&(this._realDeviceId=n.deviceId)}},{key:"_setStream",value:function(e){S(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_setStream",this).call(this,e),e?(this.storedMSID=this.getMSID(),_.debug("Setting new MSID: "+this.storedMSID+" on "+this)):_.debug("Setting 'null' stream on "+this)}},{key:"mute",value:function(){return this._queueSetMuted(!0)}},{key:"unmute",value:function(){return this._queueSetMuted(!1)}},{key:"_queueSetMuted",value:function(e){var t=this._setMuted.bind(this,e);return this._prevSetMuted=this._prevSetMuted.then(t,t),this._prevSetMuted}},{key:"_setMuted",value:function(e){var t=this;if(this.isMuted()===e)return Promise.resolve();if(this.disposed)return Promise.reject(new o.a(a.TRACK_IS_DISPOSED));var n=Promise.resolve(),r=function(){return _.info("Mute "+t+": "+e)};if(this.isAudioTrack()||this.videoType===v.a.DESKTOP||!c.a.doesVideoMuteByStreamRemove())r(),this.track&&(this.track.enabled=!e);else if(e)n=new Promise(function(e,n){r(),t._removeStreamFromConferenceAsMute(function(){t._unregisterHandlers(),t._stopStream(),t._setStream(null),e()},n)});else{r();var i={cameraDeviceId:this.getDeviceId(),devices:[p.b],facingMode:this.getCameraFacingMode()};c.a.usesNewGumFlow()?n=u.a.newObtainAudioAndVideoPermissions(Object.assign({},i,{constraints:{video:this._constraints}})):(this.resolution&&(i.resolution=this.resolution),n=u.a.obtainAudioAndVideoPermissions(i)),n.then(function(e){var n=t.getType(),r=c.a.usesNewGumFlow()?e.find(function(e){return e.track.kind===n}):e.find(function(e){return e.mediaType===n});if(!r)throw new o.a(a.TRACK_NO_STREAM_FOUND);return t._setStream(r.stream),t.track=r.track,t.videoType!==r.videoType&&(_.warn(t+": video type has changed after unmute!",t.videoType,r.videoType),t.videoType=r.videoType),t.containers=t.containers.map(function(e){return u.a.attachMediaStream(e,t.stream)}),t._addStreamToConferenceAsUnmute()})}return n.then(function(){return t._sendMuteStatus(e)}).then(function(){return t.emit(s.TRACK_MUTE_CHANGED,t)})}},{key:"_addStreamToConferenceAsUnmute",value:function(){var e=this;return this.conference?new Promise(function(t,n){e.conference._addLocalTrackAsUnmute(e).then(t,function(e){return n(new Error(e))})}):Promise.resolve()}},{key:"_removeStreamFromConferenceAsMute",value:function(e,t){this.conference?this.conference._removeLocalTrackAsMute(this).then(e,function(e){return t(new Error(e))}):e()}},{key:"_sendMuteStatus",value:function(e){var t=this;return this.conference&&this.conference.room?new Promise(function(n){t.conference.room[t.isAudioTrack()?"setAudioMute":"setVideoMute"](e,n)}):Promise.resolve()}},{key:"dispose",value:function(){var e=this,n=Promise.resolve();return this.conference&&(n=this.conference.removeTrack(this)),this.stream&&(this._stopStream(),this.detach()),u.a.removeListener(f.a.DEVICE_LIST_CHANGED,this._onDeviceListChanged),this._onAudioOutputDeviceChanged&&u.a.removeListener(f.a.AUDIO_OUTPUT_DEVICE_CHANGED,this._onAudioOutputDeviceChanged),n.then(function(){return S(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"dispose",e).call(e)})}},{key:"isMuted",value:function(){return!(this.stream&&(!this.isVideoTrack()||this.isActive())&&this.track&&this.track.enabled)}},{key:"_setConference",value:function(e){this.conference=e;for(var t=0;t<this.containers.length;t++)this._maybeFireTrackAttached(this.containers[t])}},{key:"isLocal",value:function(){return!0}},{key:"getDeviceId",value:function(){return this._realDeviceId||this.deviceId}},{key:"getParticipantId",value:function(){return this.conference&&this.conference.myUserId()}},{key:"_onByteSentStatsReceived",value:function(e,t){var n=this;t>0&&(this._hasSentData=!0);var r=e.getConnectionState();this._testDataSent&&"connected"===r&&(setTimeout(function(){n._hasSentData||(_.warn(n+" 'bytes sent' <= 0: "+n._bytesSent),n._fireNoDataFromSourceEvent())},3e3),this._testDataSent=!1)}},{key:"getCameraFacingMode",value:function(){if(this.isVideoTrack()&&this.videoType===v.a.CAMERA){var e=void 0;try{e=this.track.getSettings()}catch(e){}return e&&"facingMode"in e?e.facingMode:void 0!==this._facingMode?this._facingMode:d.a.USER}}},{key:"_stopStream",value:function(){this._stopStreamInProgress=!0;try{u.a.stopMediaStream(this.stream)}finally{this._stopStreamInProgress=!1}}},{key:"_switchCamera",value:function(){this.isVideoTrack()&&this.videoType===v.a.CAMERA&&"function"==typeof this.track._switchCamera&&(this.track._switchCamera(),this._facingMode=this._facingMode===d.a.ENVIRONMENT?d.a.USER:d.a.ENVIRONMENT)}},{key:"_checkForCameraIssues",value:function(){return!(!this.isVideoTrack()||this._stopStreamInProgress||this.videoType===v.a.DESKTOP||this._isReceivingData())}},{key:"_isReceivingData",value:function(){return!!this.stream&&this.stream.getTracks().some(function(e){return!("readyState"in e&&"live"!==e.readyState||"muted"in e&&!0===e.muted)})}},{key:"toString",value:function(){return"LocalTrack["+this.rtcId+","+this.getType()+"]"}}]),t}();t.a=T}).call(t,"modules/RTC/JitsiLocalTrack.js")},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(126)),o=n.n(i),a=n(129),s=n(132),c=n(133),u=n(19),l=n.n(u),d=n(14),p=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=Object(r.getLogger)(e),m={stable:"stable",haveLocalOffer:"have-local-offer",haveRemoteOffer:"have-remote-offer",closed:"closed"},v={new:"new",gathering:"gathering",complete:"complete"},g="jitsi-ortc-cname-"+l.a.randomInt(1e4,99999),y=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return f.debug("constructor() pcConfig:",e),n._bufferedIceCandidates=[],n._closed=!1,n._dtlsTransport=null,n._iceGatherer=null,n._iceGatheringState=v.new,n._iceTransport=null,n._localCapabilities=null,n._localDescription=null,n._localTrackInfos=new Map,n._mids=new Map,n._remoteDescription=null,n._remoteStreams=new Map,n._remoteTrackInfos=new Map,n._sdpGlobalFields={id:d.a.generateSsrc(),version:0},n._signalingState=m.stable,n._setIceGatherer(e),n._setIceTransport(n._iceGatherer),n._setDtlsTransport(n._iceTransport),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.a.EventTarget),h(t,[{key:"addIceCandidate",value:function(e){var t=void 0,n=void 0,r=void 0;if(!e)throw new TypeError("candidate missing");if(0==(arguments.length<=1?0:arguments.length-1))t=!0;else{if(t=!1,n=arguments.length<=1?void 0:arguments[1],r=arguments.length<=2?void 0:arguments[2],"function"!=typeof n)throw new TypeError("callback missing");if("function"!=typeof r)throw new TypeError("errback missing")}if(f.debug("addIceCandidate() candidate:",e),t)return this._addIceCandidate(e);this._addIceCandidate(e).then(function(){return n()}).catch(function(e){return r(e)})}},{key:"addStream",value:function(e){f.debug("addStream()"),this._addStream(e)}},{key:"close",value:function(){if(!this._closed){this._closed=!0,f.debug("close()"),this._updateAndEmitSignalingStateChange(m.closed);try{this._iceGatherer.close()}catch(e){f.warn("iceGatherer.close() failed:"+e)}try{this._iceTransport.stop()}catch(e){f.warn("iceTransport.stop() failed:"+e)}try{this._dtlsTransport.stop()}catch(e){f.warn("dtlsTransport.stop() failed:"+e)}var e=!0,t=!1,n=void 0;try{for(var r,i=this._localTrackInfos.values()[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var o=r.value.rtpSender;try{o.stop()}catch(e){f.warn("rtpSender.stop() failed:"+e)}}}catch(e){t=!0,n=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw n}}this._localTrackInfos.clear();var a=!0,s=!1,c=void 0;try{for(var u,l=this._remoteTrackInfos.values()[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){var d=u.value.rtpReceiver;try{d.stop()}catch(e){f.warn("rtpReceiver.stop() failed:"+e)}}}catch(e){s=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(s)throw c}}this._remoteTrackInfos.clear(),this._remoteStreams.clear()}}},{key:"createAnswer",value:function(){var e=void 0,t=void 0,n=void 0,r=void 0;if(arguments.length<=1)e=!0,t=arguments.length<=0?void 0:arguments[0];else{if(e=!1,n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],t=arguments.length<=2?void 0:arguments[2],"function"!=typeof n)throw new TypeError("callback missing");if("function"!=typeof r)throw new TypeError("errback missing")}if(f.debug("createAnswer() options:",t),e)return this._createAnswer(t);this._createAnswer(t).then(function(e){return n(e)}).catch(function(e){return r(e)})}},{key:"createDataChannel",value:function(){throw f.debug("createDataChannel()"),new Error("createDataChannel() not supported in Edge")}},{key:"createOffer",value:function(){var e=void 0,t=void 0,n=void 0,r=void 0;if(arguments.length<=1)e=!0,t=arguments.length<=0?void 0:arguments[0];else{if(e=!1,n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],t=arguments.length<=2?void 0:arguments[2],"function"!=typeof n)throw new TypeError("callback missing");if("function"!=typeof r)throw new TypeError("errback missing")}if(f.debug("createOffer() options:",t),e)return this._createOffer(t);this._createOffer(t).then(function(e){return n(e)}).catch(function(e){return r(e)})}},{key:"getLocalStreams",value:function(){return Array.from(this._localTrackInfos.values()).map(function(e){return e.stream}).filter(function(e,t,n){return n.indexOf(e)===t})}},{key:"getRemoteStreams",value:function(){return Array.from(this._remoteStreams.values())}},{key:"getStats",value:function(){var e=void 0,t=void 0,n=void 0,r=void 0;if("function"==typeof(arguments.length<=0?void 0:arguments[0])?(e=!1,n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1]):"function"==typeof(arguments.length<=1?void 0:arguments[1])?(e=!1,t=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1],r=arguments.length<=2?void 0:arguments[2]):(e=!0,t=arguments.length<=0?void 0:arguments[0]),e||r||(r=function(e){f.error("getStats() failed: "+e),f.error(e.stack)}),e)return this._getStats(t);this._getStats(t).then(function(e){return n(e)}).catch(function(e){return r(e)})}},{key:"removeStream",value:function(e){f.debug("removeStream()"),this._removeStream(e)}},{key:"setLocalDescription",value:function(e){var t=void 0,n=void 0,r=void 0;if(!e)throw new TypeError("description missing");if(0==(arguments.length<=1?0:arguments.length-1))t=!0;else{if(t=!1,n=arguments.length<=1?void 0:arguments[1],r=arguments.length<=2?void 0:arguments[2],"function"!=typeof n)throw new TypeError("callback missing");if("function"!=typeof r)throw new TypeError("errback missing")}if(f.debug("setLocalDescription() desc:",e),t)return this._setLocalDescription(e);this._setLocalDescription(e).then(function(){return n()}).catch(function(e){return r(e)})}},{key:"setRemoteDescription",value:function(e){var t=void 0,n=void 0,r=void 0;if(!e)throw new TypeError("description missing");if(0==(arguments.length<=1?0:arguments.length-1))t=!0;else{if(t=!1,n=arguments.length<=1?void 0:arguments[1],r=arguments.length<=2?void 0:arguments[2],"function"!=typeof n)throw new TypeError("callback missing");if("function"!=typeof r)throw new TypeError("errback missing")}if(f.debug("setRemoteDescription() desc:",e),t)return this._setRemoteDescription(e);this._setRemoteDescription(e).then(function(){return n()}).catch(function(e){return r(e)})}},{key:"_addIceCandidate",value:function(e){return this._closed?Promise.reject(new c.a("RTCPeerConnection closed")):Promise.reject(new Error("addIceCandidate() not supported"))}},{key:"_addStream",value:function(e){if(this._closed)throw new c.a("RTCPeerConnection closed");var t=!0,n=!1,r=void 0;try{for(var i,o=e.getTracks()[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var a=i.value;if("ended"!==a.readyState)if(this._localTrackInfos.has(a.id))f.warn("ignoring already handled MediaStreamTrack");else{var s=new RTCRtpSender(a,this._dtlsTransport);this._localTrackInfos.set(a.id,{rtpSender:s,stream:e})}else f.warn("ignoring ended MediaStreamTrack")}}catch(e){n=!0,r=e}finally{try{!t&&o.return&&o.return()}finally{if(n)throw r}}var u=!0,l=!1,d=void 0;try{for(var h,m=this._localTrackInfos[Symbol.iterator]();!(u=(h=m.next()).done);u=!0){var v=h.value,g=p(v,2),y=g[0],b=g[1],S=b.rtpSender.track;if("ended"===S.readyState){f.warn("_addStream() an already handled track was stopped, track.id:"+S.id);try{b.rtpSender.stop()}catch(e){f.warn("rtpSender.stop() failed:"+e)}this._localTrackInfos.delete(S.id)}else if(b.stream===e&&!e.getTrackById(y)){f.warn("_addStream() a track in this stream was removed, track.id:"+y);try{b.rtpSender.stop()}catch(e){f.warn("rtpSender.stop() failed:"+e)}this._localTrackInfos.delete(S.id)}}}catch(e){l=!0,d=e}finally{try{!u&&m.return&&m.return()}finally{if(l)throw d}}this._emitNegotiationNeeded()}},{key:"_createAnswer",value:function(e){if(this._closed)return Promise.reject(new c.a("RTCPeerConnection closed"));if(this.signalingState!==m.haveRemoteOffer)return Promise.reject(new c.a('invalid signalingState "'+this.signalingState+'"'));var t=this._createLocalDescription("answer");return Promise.resolve(t)}},{key:"_createLocalDescription",value:function(e){function t(t,o){var a={};switch(a.type=o,o){case"audio":case"video":a.protocol="RTP/SAVPF",a.port=9,a.direction="sendrecv";break;case"application":a.protocol="DTLS/SCTP",a.port=0,a.payloads="0",a.direction="inactive"}a.connection={ip:"127.0.0.1",version:4},a.mid=t,a.iceUfrag=r.usernameFragment,a.icePwd=r.password,a.candidates=[];var p=!0,h=!1,f=void 0;try{for(var m,v=i[Symbol.iterator]();!(p=(m=v.next()).done);p=!0){var y=m.value,b={component:1};b.foundation=y.foundation,b.ip=y.ip,b.port=y.port,b.priority=y.priority,b.transport=y.protocol.toLowerCase(),b.type=y.type,"tcp"===b.transport&&(b.tcptype=y.tcpType),a.candidates.push(b)}}catch(e){h=!0,f=e}finally{try{!p&&v.return&&v.return()}finally{if(h)throw f}}if(a.endOfCandidates="end-of-candidates",a.setup="offer"===e?"actpass":"server"===s.role?"active":"passive","audio"===o||"video"===o){a.rtp=[],a.rtcpFb=[],a.fmtp=[];var S=[],_=!0,T=!1,C=void 0;try{for(var E,w=c.codecs[Symbol.iterator]();!(_=(E=w.next()).done);_=!0){var R=E.value;if(!R.kind||R.kind===o){S.push(R.preferredPayloadType);var k={codec:R.name,payload:R.preferredPayloadType,rate:R.clockRate};if(R.numChannels>1&&(k.encoding=R.numChannels),a.rtp.push(k),R.parameters){var I={config:"",payload:R.preferredPayloadType},P=!0,A=!1,O=void 0;try{for(var D,x=Object.keys(R.parameters)[Symbol.iterator]();!(P=(D=x.next()).done);P=!0){var N=D.value;I.config&&(I.config+=";"),I.config+=N+"="+R.parameters[N]}}catch(e){A=!0,O=e}finally{try{!P&&x.return&&x.return()}finally{if(A)throw O}}I.config&&a.fmtp.push(I)}var L=!0,M=!1,j=void 0;try{for(var F,U=(R.rtcpFeedback||[])[Symbol.iterator]();!(L=(F=U.next()).done);L=!0){var H=F.value;a.rtcpFb.push({payload:R.preferredPayloadType,subtype:H.parameter||void 0,type:H.type})}}catch(e){M=!0,j=e}finally{try{!L&&U.return&&U.return()}finally{if(M)throw j}}}}}catch(e){T=!0,C=e}finally{try{!_&&w.return&&w.return()}finally{if(T)throw C}}0===S.length?(a.payloads="9",a.port=0,a.direction="inactive"):a.payloads=S.join(" "),a.ssrcs=[],a.ssrcGroups=[];var B=!0,G=!1,J=void 0;try{for(var V,W=u.values()[Symbol.iterator]();!(B=(V=W.next()).done);B=!0){var q=V.value,K=q.rtpSender,z=q.stream.id,Q=K.track;if("ended"!==Q.readyState&&Q.kind===o){q.ssrc||(q.ssrc=d.a.generateSsrc());var $=l&&"video"===Q.kind;$&&!q.rtxSsrc&&(q.rtxSsrc=q.ssrc+1),a.ssrcs.push({attribute:"cname",id:q.ssrc,value:g}),a.ssrcs.push({attribute:"msid",id:q.ssrc,value:z+" "+Q.id}),a.ssrcs.push({attribute:"mslabel",id:q.ssrc,value:z}),a.ssrcs.push({attribute:"label",id:q.ssrc,value:Q.id}),$&&(a.ssrcs.push({attribute:"cname",id:q.rtxSsrc,value:g}),a.ssrcs.push({attribute:"msid",id:q.rtxSsrc,value:z+" "+Q.id}),a.ssrcs.push({attribute:"mslabel",id:q.rtxSsrc,value:z}),a.ssrcs.push({attribute:"label",id:q.rtxSsrc,value:Q.id}),a.ssrcGroups.push({semantics:"FID",ssrcs:q.ssrc+" "+q.rtxSsrc}))}}}catch(e){G=!0,J=e}finally{try{!B&&W.return&&W.return()}finally{if(G)throw J}}a.ext=[];var X=!0,Y=!1,Z=void 0;try{for(var ee,te=c.headerExtensions[Symbol.iterator]();!(X=(ee=te.next()).done);X=!0){var ne=ee.value;ne.kind&&ne.kind!==o||a.ext.push({value:ne.preferredId,uri:ne.uri})}}catch(e){Y=!0,Z=e}finally{try{!X&&te.return&&te.return()}finally{if(Y)throw Z}}a.rtcpMux="rtcp-mux",a.rtcpRsize="rtcp-rsize"}n.media.push(a)}var n={},r=this._iceGatherer.getLocalParameters(),i=this._iceGatherer.getLocalCandidates(),o=this._dtlsTransport.getLocalParameters(),s=this._dtlsTransport.getRemoteParameters(),c=this._localCapabilities,u=this._localTrackInfos;"offer"===e&&this._sdpGlobalFields.version++,n.version=0,n.origin={address:"127.0.0.1",ipVer:4,netType:"IN",sessionId:this._sdpGlobalFields.id,sessionVersion:this._sdpGlobalFields.version,username:"jitsi-ortc-webrtc-shim"},n.name="-",n.timing={start:0,stop:0},n.msidSemantic={semantic:"WMS",token:"*"},n.groups=[{mids:Array.from(this._mids.keys()).join(" "),type:"BUNDLE"}],n.media=[],n.fingerprint={hash:o.fingerprints[0].value,type:o.fingerprints[0].algorithm};var l=!1,h=!0,m=!1,v=void 0;try{for(var y,b=c.codecs[Symbol.iterator]();!(h=(y=b.next()).done);h=!0){var S=y.value;if("video"===S.kind&&"rtx"===S.name){l=!0;break}}}catch(e){m=!0,v=e}finally{try{!h&&b.return&&b.return()}finally{if(m)throw v}}var _=!0,T=!1,C=void 0;try{for(var E,w=this._mids[Symbol.iterator]();!(_=(E=w.next()).done);_=!0){var R=E.value,k=p(R,2),I=k[0],P=k[1];t.call(this,I,P)}}catch(e){T=!0,C=e}finally{try{!_&&w.return&&w.return()}finally{if(T)throw C}}var A=new a.a({type:e,_sdpObject:n});return f.debug("_createLocalDescription():",A),A}},{key:"_createOffer",value:function(e){return this._closed?Promise.reject(new c.a("RTCPeerConnection closed")):this.signalingState!==m.stable?Promise.reject(new c.a('invalid signalingState "'+this.signalingState+'"')):Promise.reject(new Error("createoOffer() not yet supported"))}},{key:"_emitAddStream",value:function(e){if(!this._closed){f.debug('emitting "addstream"');var t=new o.a.Event("addstream");t.stream=e,this.dispatchEvent(t)}}},{key:"_emitBufferedIceCandidates",value:function(){if(!this._closed){var e=!0,t=!1,n=void 0;try{for(var r,i=this._bufferedIceCandidates[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var a=r.value;if(a){a.sdpMIndex=this._mids.keys().next().value,f.debug('emitting buffered "icecandidate", candidate:',a);var s=new o.a.Event("icecandidate");s.candidate=a,this.dispatchEvent(s)}}}catch(e){t=!0,n=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw n}}this._bufferedIceCandidates=[]}}},{key:"_emitConnectionStateChange",value:function(){if(!this._closed||"closed"===this.connectionState){f.debug('emitting "connectionstatechange", connectionState:',this.connectionState);var e=new o.a.Event("connectionstatechange");this.dispatchEvent(e)}}},{key:"_emitIceCandidate",value:function(e){if(!this._closed){var t=null;if(e){var n=this._mids.keys().next().value,r="candidate:"+e.foundation+" 1 "+e.protocol+" "+e.priority+" "+e.ip+" "+e.port+" typ "+e.type;e.relatedAddress&&(r+=" raddr "+e.relatedAddress),e.relatedPort&&(r+=" rport "+e.relatedPort),"tcp"===e.protocol&&(r+=" tcptype "+e.tcpType),t={candidate:r,component:1,foundation:e.foundation,ip:e.ip,port:e.port,priority:e.priority,protocol:e.protocol,type:e.type,sdpMIndex:n,sdpMLineIndex:0},"tcp"===e.protocol&&(t.tcptype=e.tcpType),e.relatedAddress&&(t.relatedAddress=e.relatedAddress),e.relatedPort&&(t.relatedPort=e.relatedPort)}if(this._localDescription){f.debug('emitting "icecandidate", candidate:',t);var i=new o.a.Event("icecandidate");i.candidate=t,this.dispatchEvent(i)}else f.debug("buffering gathered ICE candidate:",t),this._bufferedIceCandidates.push(t)}}},{key:"_emitIceConnectionStateChange",value:function(){if(!this._closed||"closed"===this.iceConnectionState){f.debug('emitting "iceconnectionstatechange", iceConnectionState:',this.iceConnectionState);var e=new o.a.Event("iceconnectionstatechange");this.dispatchEvent(e)}}},{key:"_emitNegotiationNeeded",value:function(){if(this.signalingState===m.stable){f.debug('emitting "negotiationneeded"');var e=new o.a.Event("negotiationneeded");this.dispatchEvent(e)}}},{key:"_emitRemoveStream",value:function(e){if(!this._closed){f.debug('emitting "removestream"');var t=new o.a.Event("removestream");t.stream=e,this.dispatchEvent(t)}}},{key:"_getParametersForRtpReceiver",value:function(e,t){var n=t.ssrc,r=t.rtxSsrc,i=t.cname,o=this._localCapabilities,a={codecs:[],degradationPreference:"balanced",encodings:[],headerExtensions:[],muxId:"",rtcp:{cname:i,compound:!0,mux:!0,reducedSize:!0}},s=[],c=void 0,u=!0,l=!1,d=void 0;try{for(var p,h=o.codecs[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){var f=p.value;if(f.kind===e&&"rtx"!==f.name){c=f.preferredPayloadType,s.push({clockRate:f.clockRate,maxptime:f.maxptime,mimeType:f.mimeType,name:f.name,numChannels:f.numChannels,parameters:f.parameters,payloadType:f.preferredPayloadType,ptime:f.ptime,rtcpFeedback:f.rtcpFeedback});break}}}catch(e){l=!0,d=e}finally{try{!u&&h.return&&h.return()}finally{if(l)throw d}}if(r){var m=!0,v=!1,g=void 0;try{for(var y,b=o.codecs[Symbol.iterator]();!(m=(y=b.next()).done);m=!0){var S=y.value;if(S.kind===e&&"rtx"===S.name){s.push({clockRate:S.clockRate,mimeType:S.mimeType,name:"rtx",parameters:S.parameters,payloadType:S.preferredPayloadType,rtcpFeedback:S.rtcpFeedback});break}}}catch(e){v=!0,g=e}finally{try{!m&&b.return&&b.return()}finally{if(v)throw g}}}a.codecs=s;var _={active:!0,codecPayloadType:c,ssrc:n};r&&(_.rtx={ssrc:r}),a.encodings.push(_);var T=!0,C=!1,E=void 0;try{for(var w,R=o.headerExtensions[Symbol.iterator]();!(T=(w=R.next()).done);T=!0){var k=w.value;k.kind===e&&a.headerExtensions.push({encrypt:k.preferredEncrypt,id:k.preferredId,uri:k.uri})}}catch(e){C=!0,E=e}finally{try{!T&&R.return&&R.return()}finally{if(C)throw E}}return a}},{key:"_getParametersForRtpSender",value:function(e,t){var n=t.ssrc,r=t.rtxSsrc,i=g,o=this._localCapabilities,a={codecs:[],degradationPreference:"balanced",encodings:[],headerExtensions:[],muxId:"",rtcp:{cname:i,compound:!0,mux:!0,reducedSize:!0}},s=[],c=void 0,u=!0,l=!1,d=void 0;try{for(var p,h=o.codecs[Symbol.iterator]();!(u=(p=h.next()).done);u=!0){var f=p.value;if(f.kind===e&&"rtx"!==f.name){c=f.preferredPayloadType,s.push({clockRate:f.clockRate,maxptime:f.maxptime,mimeType:f.mimeType,name:f.name,numChannels:f.numChannels,parameters:f.parameters,payloadType:f.preferredPayloadType,ptime:f.ptime,rtcpFeedback:f.rtcpFeedback});break}}}catch(e){l=!0,d=e}finally{try{!u&&h.return&&h.return()}finally{if(l)throw d}}if(r){var m=!0,v=!1,y=void 0;try{for(var b,S=o.codecs[Symbol.iterator]();!(m=(b=S.next()).done);m=!0){var _=b.value;if(_.kind===e&&"rtx"===_.name){s.push({clockRate:_.clockRate,mimeType:_.mimeType,name:"rtx",parameters:_.parameters,payloadType:_.preferredPayloadType,rtcpFeedback:_.rtcpFeedback});break}}}catch(e){v=!0,y=e}finally{try{!m&&S.return&&S.return()}finally{if(v)throw y}}}a.codecs=s;var T={active:!0,codecPayloadType:c,ssrc:n};r&&(T.rtx={ssrc:r}),a.encodings.push(T);var C=!0,E=!1,w=void 0;try{for(var R,k=o.headerExtensions[Symbol.iterator]();!(C=(R=k.next()).done);C=!0){var I=R.value;I.kind===e&&a.headerExtensions.push({encrypt:I.preferredEncrypt,id:I.preferredId,uri:I.uri})}}catch(e){E=!0,w=e}finally{try{!C&&k.return&&k.return()}finally{if(E)throw w}}return a}},{key:"_getStats",value:function(e){if(this._closed)return Promise.reject(new c.a("RTCPeerConnection closed"));var t=this._iceGatherer,n=this._iceTransport,r=[],i=[],o=[],a=!0,s=!1,u=void 0;try{for(var l,d=this._localTrackInfos.values()[Symbol.iterator]();!(a=(l=d.next()).done);a=!0){var p=l.value,h=p.rtpSender;p.sending&&r.push(h)}}catch(e){s=!0,u=e}finally{try{!a&&d.return&&d.return()}finally{if(s)throw u}}var f=!0,m=!1,v=void 0;try{for(var g,y=this._remoteTrackInfos.values()[Symbol.iterator]();!(f=(g=y.next()).done);f=!0){var b=g.value.rtpReceiver;i.push(b)}}catch(e){m=!0,v=e}finally{try{!f&&y.return&&y.return()}finally{if(m)throw v}}t&&o.push(t.getStats().catch(function(){return null})),n&&(o.push(n.getStats().catch(function(){return null})),"function"==typeof n.msGetStats&&o.push(n.msGetStats().catch(function(){return null})));var S=!0,_=!1,T=void 0;try{for(var C,E=r[Symbol.iterator]();!(S=(C=E.next()).done);S=!0)!function(e){var t="audio"===e.track.kind;o.push(e.getStats().then(function(e){if(!t){var n=!0,r=!1,i=void 0;try{for(var o,a=Object.keys(e)[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=e[o.value];"track"===s.type&&delete s.audioLevel}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}}return e}).catch(function(){return null}))}(h=C.value)}catch(e){_=!0,T=e}finally{try{!S&&E.return&&E.return()}finally{if(_)throw T}}var w=!0,R=!1,k=void 0;try{for(var I,P=i[Symbol.iterator]();!(w=(I=P.next()).done);w=!0)!function(e){var t="audio"===e.track.kind;o.push(e.getStats().then(function(e){if(!t){var n=!0,r=!1,i=void 0;try{for(var o,a=Object.keys(e)[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=e[o.value];"track"===s.type&&delete s.audioLevel}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}}return e}).catch(function(){return null}))}(b=I.value)}catch(e){R=!0,k=e}finally{try{!w&&P.return&&P.return()}finally{if(R)throw k}}return Promise.all(o).then(function(e){var t={},n=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value;if(s){var c=!0,u=!1,l=void 0;try{for(var d,p=Object.keys(s)[Symbol.iterator]();!(c=(d=p.next()).done);c=!0){var h=d.value;t[h]=s[h]}}catch(e){u=!0,l=e}finally{try{!c&&p.return&&p.return()}finally{if(u)throw l}}}}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}return t})}},{key:"_handleLocalInitialAnswer",value:function(e){f.debug("_handleLocalInitialAnswer(), desc:",e);var t=e.sdpObject;this._localCapabilities=s.a(t),f.debug("local capabilities:",this._localCapabilities)}},{key:"_handleLocalReAnswer",value:function(e){f.debug("_handleLocalReAnswer(), desc:",e);var t=e.sdpObject;this._localCapabilities=s.a(t),f.debug("local capabilities:",this._localCapabilities)}},{key:"_handleRemoteInitialOffer",value:function(e){f.debug("_handleRemoteInitialOffer(), desc:",e);var t=e.sdpObject;this._mids=s.e(t);var n=s.a(t);f.debug("remote capabilities:",n),this._localCapabilities=s.g(n),this._startIceAndDtls(e)}},{key:"_handleRemoteReOffer",value:function(e){f.debug("_handleRemoteReOffer(), desc:",e);var t=e.sdpObject;this._mids=s.e(t);var n=s.a(t);f.debug("remote capabilities:",n),this._localCapabilities=s.g(n)}},{key:"_receiveMedia",value:function(){f.debug("_receiveMedia()");var e=new Set(this._remoteTrackInfos.keys()),t=s.f(this._remoteDescription.sdpObject),n=new Map,r=new Map,i=new Map;f.debug("_receiveMedia() remote track infos:",t);var o=!0,a=!1,c=void 0;try{for(var u,l=t[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var d=u.value,h=p(d,2),m=h[0],v=h[1];if(!e.has(m)){f.debug("_receiveMedia() new remote track, ssrc:"+m),this._remoteTrackInfos.set(m,v);var g=v.kind,y=v.rtxSsrc,b=v.streamId,S=v.trackId,_=v.cname,T=void 0;this._remoteStreams.has(b)?T=this._remoteStreams.get(b):(f.debug("_receiveMedia() new remote stream, id:"+b),(T=new MediaStream).jitsiRemoteId=b,n.set(b,T),this._remoteStreams.set(b,T));var C=new RTCRtpReceiver(this._dtlsTransport,g),E=this._getParametersForRtpReceiver(g,{ssrc:m,rtxSsrc:y,cname:_});v.track=C.track,C.onerror=function(e){f.error('rtpReceiver "error" event, event:'),f.error(e)},v.stream=T,v.rtpReceiver=C,f.debug("calling rtpReceiver.receive(), parameters:",E);try{C.receive(E);var w=v.track;w.jitsiRemoteId=S,T.addTrack(w),n.has(b)||r.set(w,T)}catch(e){f.error("rtpReceiver.receive() failed:"+e.message),f.error(e)}}}}catch(e){a=!0,c=e}finally{try{!o&&l.return&&l.return()}finally{if(a)throw c}}var R=!0,k=!1,I=void 0;try{for(var P,A=e[Symbol.iterator]();!(R=(P=A.next()).done);R=!0){var O=P.value;if(!t.has(O)){f.debug("_receiveMedia() remote track removed, ssrc:"+O);var D=this._remoteTrackInfos.get(O),x=(T=D.stream,D.track);C=D.rtpReceiver;try{C.stop()}catch(e){f.warn("rtpReceiver.stop() failed:"+e)}i.set(x,T),T.removeTrack(x),this._remoteTrackInfos.delete(O)}}}catch(e){k=!0,I=e}finally{try{!R&&A.return&&A.return()}finally{if(k)throw I}}var N=!0,L=!1,M=void 0;try{for(var j,F=r[Symbol.iterator]();!(N=(j=F.next()).done);N=!0){var U=j.value,H=p(U,2);x=H[0],T=H[1],(q=new Event("addtrack")).track=x,T.dispatchEvent(q)}}catch(e){L=!0,M=e}finally{try{!N&&F.return&&F.return()}finally{if(L)throw M}}var B=!0,G=!1,J=void 0;try{for(var V,W=i[Symbol.iterator]();!(B=(V=W.next()).done);B=!0){var q,K=V.value,z=p(K,2),Q=z[0],$=z[1];(q=new Event("removetrack")).track=Q,$.dispatchEvent(q)}}catch(e){G=!0,J=e}finally{try{!B&&W.return&&W.return()}finally{if(G)throw J}}var X=!0,Y=!1,Z=void 0;try{for(var ee,te=n.values()[Symbol.iterator]();!(X=(ee=te.next()).done);X=!0){var ne=ee.value;0===ne.getTracks().length?(f.warn("ignoring new stream for which no track could be added"),n.delete(ne.jitsiRemoteId),this._remoteStreams.delete(ne.jitsiRemoteId)):this._emitAddStream(ne)}}catch(e){Y=!0,Z=e}finally{try{!X&&te.return&&te.return()}finally{if(Y)throw Z}}var re=!0,ie=!1,oe=void 0;try{for(var ae,se=this._remoteStreams[Symbol.iterator]();!(re=(ae=se.next()).done);re=!0){var ce=ae.value,ue=p(ce,2),le=(b=ue[0],ue[1]);le.getTracks().length>0||(this._remoteStreams.delete(b),this._emitRemoveStream(le))}}catch(e){ie=!0,oe=e}finally{try{!re&&se.return&&se.return()}finally{if(ie)throw oe}}}},{key:"_removeStream",value:function(e){if(this._closed)throw new c.a("RTCPeerConnection closed");var t=!0,n=!1,r=void 0;try{for(var i,o=e.getTracks()[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var a=i.value;if(this._localTrackInfos.has(a.id)){var s=this._localTrackInfos.get(a.id).rtpSender;try{s.stop()}catch(e){f.warn("rtpSender.stop() failed:"+e)}this._localTrackInfos.delete(a.id)}}}catch(e){n=!0,r=e}finally{try{!t&&o.return&&o.return()}finally{if(n)throw r}}this._emitNegotiationNeeded()}},{key:"_sendMedia",value:function(){f.debug("_sendMedia()");var e=!0,t=!1,n=void 0;try{for(var r,i=this._localTrackInfos.values()[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var o=r.value;if(!o.sending){var a=o.rtpSender,s=o.ssrc,c=o.rtxSsrc,u=a.track.kind,l=this._getParametersForRtpSender(u,{ssrc:s,rtxSsrc:c});f.debug("calling rtpSender.send(), parameters:",l);try{a.send(l),o.sending=!0}catch(e){f.error("rtpSender.send() failed:"+e.message),f.error(e)}}}}catch(e){t=!0,n=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw n}}}},{key:"_setDtlsTransport",value:function(e){var t=this,n=new RTCDtlsTransport(e);n.onstatechange=function(){f.debug('dtlsTransport "statechange" event, state:'+n.state),t._emitConnectionStateChange()},n.ondtlsstatechange=function(){f.debug('dtlsTransport "dtlsstatechange" event, state:'+n.state),t._emitConnectionStateChange()},n.onerror=function(e){var n=void 0;e.message?n=e.message:e.error&&(n=e.error.message),f.error('dtlsTransport "error" event, message:'+n),t._emitConnectionStateChange()},this._dtlsTransport=n}},{key:"_setIceGatherer",value:function(e){var t=this,n={gatherPolicy:e.iceTransportPolicy||"all",iceServers:e.iceServers||[]},r=new RTCIceGatherer(n);r.onstatechange=function(){f.debug('iceGatherer "statechange" event, state:'+r.state),t._updateAndEmitIceGatheringStateChange(r.state)},r.onlocalcandidate=function(e){var n=e.candidate,r=e.complete;f.debug('iceGatherer "localcandidate" event, candidate:',n),r||!n||0===Object.keys(n).length?(n=null,t._updateAndEmitIceGatheringStateChange(v.complete),t._emitIceCandidate(null)):t._emitIceCandidate(n)},r.onerror=function(e){var t=e.errorCode,n=e.errorText;f.error('iceGatherer "error" event, errorCode:'+t+", errorText:"+n)};try{r.gather()}catch(e){f.warn("iceGatherer.gather() failed:"+e)}this._iceGatherer=r}},{key:"_setIceTransport",value:function(e){var t=this,n=new RTCIceTransport(e);n.onstatechange=function(){f.debug('iceTransport "statechange" event, state:'+n.state),t._emitIceConnectionStateChange()},n.onicestatechange=function(){f.debug('iceTransport "icestatechange" event, state:'+n.state),"completed"===n.state&&f.debug("nominated candidate pair:",n.getNominatedCandidatePair()),t._emitIceConnectionStateChange()},n.oncandidatepairchange=function(e){f.debug('iceTransport "candidatepairchange" event, pair:'+e.pair)},this._iceTransport=n}},{key:"_setLocalDescription",value:function(e){var t=this;if(this._closed)return Promise.reject(new c.a("RTCPeerConnection closed"));var n=void 0;try{n=new a.a(e)}catch(e){return Promise.reject(new TypeError("invalid RTCSessionDescriptionInit: "+e))}switch(e.type){case"offer":return this.signalingState!==m.stable?Promise.reject(new c.a('invalid signalingState "'+this.signalingState+'"')):Promise.reject(new TypeError('setLocalDescription() with type "offer" not supported'));case"answer":if(this.signalingState!==m.haveRemoteOffer)return Promise.reject(new c.a('invalid signalingState "'+this.signalingState+'"'));var r=Boolean(!this._localDescription);return Promise.resolve().then(function(){return r?t._handleLocalInitialAnswer(n):t._handleLocalReAnswer(n)}).then(function(){f.debug("setLocalDescription() succeed"),t._localDescription=n,t._updateAndEmitSignalingStateChange(m.stable),r&&t._emitBufferedIceCandidates(),t._sendMedia(),t._receiveMedia()}).catch(function(e){throw f.error("setLocalDescription() failed: "+e.message),f.error(e),e});default:return Promise.reject(new TypeError('unsupported description.type "'+e.type+'"'))}}},{key:"_setRemoteDescription",value:function(e){var t=this;if(this._closed)return Promise.reject(new c.a("RTCPeerConnection closed"));var n=void 0;try{n=new a.a(e)}catch(e){return Promise.reject(new TypeError("invalid RTCSessionDescriptionInit: "+e))}switch(e.type){case"offer":if(this.signalingState!==m.stable)return Promise.reject(new c.a('invalid signalingState "'+this.signalingState+'"'));var r=Boolean(!this._remoteDescription);return Promise.resolve().then(function(){return r?t._handleRemoteInitialOffer(n):t._handleRemoteReOffer(n)}).then(function(){f.debug("setRemoteDescription() succeed"),t._remoteDescription=n,t._updateAndEmitSignalingStateChange(m.haveRemoteOffer)}).catch(function(e){throw f.error("setRemoteDescription() failed: "+e),e});case"answer":return this.signalingState!==m.haveLocalOffer?Promise.reject(new c.a('invalid signalingState "'+this.signalingState+'"')):Promise.reject(new TypeError('setRemoteDescription() with type "answer" not supported'));default:return Promise.reject(new TypeError('unsupported description.type "'+e.type+'"'))}}},{key:"_startIceAndDtls",value:function(e){var t=e.sdpObject,n=s.d(t),r=s.c(t),i=s.b(t);switch(e.type){case"offer":this._iceTransport.start(this._iceGatherer,n,"controlled");break;case"answer":this._iceTransport.start(this._iceGatherer,n,"controlling")}var o=!0,a=!1,c=void 0;try{for(var u,l=r[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var d=u.value;0!==d.port&&9!==d.port&&this._iceTransport.addRemoteCandidate(d)}}catch(e){a=!0,c=e}finally{try{!o&&l.return&&l.return()}finally{if(a)throw c}}switch(this._iceTransport.addRemoteCandidate({}),e.type){case"offer":i.role="server";break;case"answer":i.role="client"}this._dtlsTransport.start(i)}},{key:"_updateAndEmitIceGatheringStateChange",value:function(e){if(!this._closed&&e!==this.iceGatheringState){this._iceGatheringState=e,f.debug('emitting "icegatheringstatechange", iceGatheringState:',this.iceGatheringState);var t=new o.a.Event("icegatheringstatechange");this.dispatchEvent(t)}}},{key:"_updateAndEmitSignalingStateChange",value:function(e){if(e!==this.signalingState){this._signalingState=e,f.debug('emitting "signalingstatechange", signalingState:',this.signalingState);var t=new o.a.Event("signalingstatechange");this.dispatchEvent(t)}}},{key:"connectionState",get:function(){return this._dtlsTransport.state}},{key:"iceConnectionState",get:function(){return this._iceTransport.state}},{key:"iceGatheringState",get:function(){return this._iceGatheringState}},{key:"localDescription",get:function(){return this._localDescription}},{key:"remoteDescription",get:function(){return this._remoteDescription}},{key:"signalingState",get:function(){return this._signalingState}}]),t}();t.a=y}).call(t,"modules/RTC/ortc/RTCPeerConnection.js")},function(e,t,n){e.exports={EventTarget:n(127),Event:n(128)}},function(e,t){function n(){this._listeners={}}Object.defineProperties(n.prototype,{listeners:{get:function(){return this._listeners}}}),n.prototype.addEventListener=function(e,t){var n,r,i;if(e&&t){for(void 0===(n=this._listeners[e])&&(this._listeners[e]=n=[]),r=0;i=n[r];r++)if(i===t)return;n.push(t)}},n.prototype.removeEventListener=function(e,t){var n,r,i;if(e&&t&&void 0!==(n=this._listeners[e])){for(r=0;i=n[r];r++)if(i===t){n.splice(r,1);break}0===n.length&&delete this._listeners[e]}},n.prototype.dispatchEvent=function(e){var t,n,r,i,o,a=!1;if(!e||"string"!=typeof e.type)throw new Error("`event` must have a valid `type` property");e._yaeti&&(e.target=this,e.cancelable=!0);try{e.stopImmediatePropagation=function(){a=!0}}catch(e){}if(t=e.type,n=this._listeners[t]||[],"function"==typeof(r=this["on"+t]))try{r.call(this,e)}catch(e){console.error(e)}for(i=0;(o=n[i])&&!a;i++)try{o.call(this,e)}catch(e){console.error(e)}return!e.defaultPrevented},e.exports=n},function(e,t,n){(function(t){e.exports=t.Event}).call(t,n(20))},function(e,t,n){"use strict";var r=n(15),i=n.n(r),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(){function e(t){switch(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._sdp=null,this._sdpObject=null,this._type=null,t.type){case"offer":case"answer":break;default:throw new TypeError('invalid type "'+t.type+'"')}if(this._type=t.type,"string"==typeof t.sdp){this._sdp=t.sdp;try{this._sdpObject=i.a.parse(t.sdp)}catch(e){throw new Error("invalid sdp: "+e)}}else{if("object"!==o(t._sdpObject))throw new TypeError("invalid sdp or _sdpObject");this._sdpObject=t._sdpObject;try{this._sdp=i.a.write(t._sdpObject)}catch(e){throw new Error("invalid sdp object: "+e)}}}return a(e,[{key:"toJSON",value:function(){return{sdp:this._sdp,type:this._type}}},{key:"sdp",get:function(){return this._sdp},set:function(e){try{this._sdpObject=i.a.parse(e)}catch(e){throw new Error("invalid sdp: "+e)}this._sdp=e}},{key:"sdpObject",get:function(){return this._sdpObject}},{key:"type",get:function(){return this._type}}]),e}();t.a=s},function(e,t,n){var r=function(e){return String(Number(e))===e?Number(e):e},i=function(e,t,n){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var o=e.push?{}:i?t[e.name]:t;!function(e,t,n,i){if(i&&!n)t[i]=r(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(t[n[o]]=r(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},o=n(57),a=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},n=[],r=t;return e.split(/(\r\n|\r|\n)/).filter(a).forEach(function(e){var t=e[0],a=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),r=n[n.length-1]);for(var s=0;s<(o[t]||[]).length;s+=1){var c=o[t][s];if(c.reg.test(a))return i(c,r,a)}}),t.media=n,t};var s=function(e,t){var n=t.split(/=(.+)/,2);return 2===n.length&&(e[n[0]]=r(n[1])),e};t.parseParams=function(e){return e.split(/\;\s?/).reduce(s,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],n=e.split(" ").map(r),i=0;i<n.length;i+=3)t.push({component:n[i],ip:n[i+1],port:n[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(s,{})})},t.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var t,n=!1;return"~"!==e[0]?t=r(e):(t=r(e.substring(1,e.length)),n=!0),{scid:t,paused:n}})})}},function(e,t,n){var r=n(57),i=/%[sdv%]/g,o=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 o=0;o<t.names.length;o+=1){var a=t.names[o];t.name?r.push(n[t.name][a]):r.push(n[t.names[o]])}else r.push(n[t.name]);return function(e){var t=1,n=arguments,r=n.length;return e.replace(i,function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}})}.apply(null,r)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];e.exports=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||a,i=t.innerOrder||s,c=[];return n.forEach(function(t){r[t].forEach(function(n){n.name in e&&null!=e[n.name]?c.push(o(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach(function(e){c.push(o(t,n,e))})})}),e.media.forEach(function(e){c.push(o("m",r.m[0],e)),i.forEach(function(t){r[t].forEach(function(n){n.name in e&&null!=e[n.name]?c.push(o(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach(function(e){c.push(o(t,n,e))})})})}),c.join("\r\n")+"\r\n"}},function(e,t,n){"use strict";function r(e){return e.media.find(function(e){return e.iceUfrag&&0!==e.port})}t.a=function(e){var t=new Map,n=[],r=!0,i=!1,a=void 0;try{for(var s,c=e.media[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var u=s.value,l=u.type;if("audio"===l||"video"===l){var d=!0,p=!1,h=void 0;try{for(var f,m=u.rtp[Symbol.iterator]();!(d=(f=m.next()).done);d=!0){var v=f.value,g={clockRate:v.rate,kind:l,mimeType:l+"/"+v.codec,name:v.codec,numChannels:v.encoding||1,parameters:{},preferredPayloadType:v.payload,rtcpFeedback:[]};t.set(g.preferredPayloadType,g)}}catch(e){p=!0,h=e}finally{try{!d&&m.return&&m.return()}finally{if(p)throw h}}var y=!0,b=!1,S=void 0;try{for(var _,T=(u.fmtp||[])[Symbol.iterator]();!(y=(_=T.next()).done);y=!0){var C=_.value,E=o.a.parseFmtpConfig(C.config),g=t.get(C.payload);g&&(g.parameters=E)}}catch(e){b=!0,S=e}finally{try{!y&&T.return&&T.return()}finally{if(b)throw S}}var w=!0,R=!1,k=void 0;try{for(var I,P=(u.rtcpFb||[])[Symbol.iterator]();!(w=(I=P.next()).done);w=!0){var A=I.value,g=t.get(A.payload);g&&g.rtcpFeedback.push({parameter:A.subtype||"",type:A.type})}}catch(e){R=!0,k=e}finally{try{!w&&P.return&&P.return()}finally{if(R)throw k}}var O=!0,D=!1,x=void 0;try{for(var N,L=(u.ext||[])[Symbol.iterator]();!(O=(N=L.next()).done);O=!0){var M=N.value;!function(e){var t=e.value,r=e.uri,i={kind:l,uri:r,preferredId:t};n.find(function(e){return i.kind===e.kind&&i.uri===e.uri})||n.push(i)}(M)}}catch(e){D=!0,x=e}finally{try{!O&&L.return&&L.return()}finally{if(D)throw x}}}}}catch(e){i=!0,a=e}finally{try{!r&&c.return&&c.return()}finally{if(i)throw a}}return{codecs:Array.from(t.values()),fecMechanisms:[],headerExtensions:n}},t.b=function(e){var t=r(e),n=t.fingerprint||e.fingerprint,i=void 0;switch(t.setup){case"active":i="client";break;case"passive":i="server";break;case"actpass":i="auto"}return{role:i,fingerprints:[{algorithm:n.type,value:n.hash}]}},t.c=function(e){var t=r(e),n=[],i=!0,o=!1,a=void 0;try{for(var s,c=t.candidates[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;if(1===u.component){var l={foundation:u.foundation,ip:u.ip,port:u.port,priority:u.priority,protocol:u.transport.toLowerCase(),type:u.type};n.push(l)}}}catch(e){o=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw a}}return n},t.d=function(e){var t=r(e),n=t.iceUfrag,i=t.icePwd;return{icelite:"ice-lite"===e.icelite,password:i,usernameFragment:n}},t.e=function(e){var t=new Map,n=!0,r=!1,i=void 0;try{for(var o,a=e.media[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value;t.set(s.mid,s.type)}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}return t},t.f=function(e){var t=new Map,n=new Map,r=new Set,i=!0,o=!1,a=void 0;try{for(var s,c=e.media[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value,l=u.type;if("audio"===l||"video"===l){var d=!0,p=!1,h=void 0;try{for(var f,m=(u.ssrcGroups||[])[Symbol.iterator]();!(d=(f=m.next()).done);d=!0){var v=f.value;if("FID"===v.semantics){var g=v.ssrcs.split(" ").map(function(e){return Number(e)}),y=g[0],b=g[1];n.set(y,b),r.add(b)}}}catch(e){p=!0,h=e}finally{try{!d&&m.return&&m.return()}finally{if(p)throw h}}var S=!0,_=!1,T=void 0;try{for(var C,E=(u.ssrcs||[])[Symbol.iterator]();!(S=(C=E.next()).done);S=!0){var w=C.value,y=w.id;if(!r.has(y)){var R=t.get(y);switch(R||(R={kind:l,rtxSsrc:n.get(y),ssrc:y},t.set(y,R)),w.attribute){case"cname":R.cname=w.value;break;case"msid":var k=w.value.split(" "),I=k[0],P=k[1];R.streamId=I,R.trackId=P;break;case"mslabel":var A=w.value;R.streamId=A;break;case"label":var O=w.value;R.trackId=O}}}}catch(e){_=!0,T=e}finally{try{!S&&E.return&&E.return()}finally{if(_)throw T}}}}}catch(e){o=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw a}}return t},t.g=function(e){var t=RTCRtpReceiver.getCapabilities(),n={codecs:[],fecMechanisms:[],headerExtensions:[]},r=new Map,i=!0,o=!1,a=void 0;try{for(var s,c=e.codecs[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;!function(e){var i=e.name.toLowerCase();if("rtx"===i)return r.set(e.parameters.apt,e.preferredPayloadType),"continue";var o=t.codecs.find(function(t){return t.name.toLowerCase()===i&&t.kind===e.kind&&t.clockRate===e.clockRate});if(!o)return"continue";var a={clockRate:o.clockRate,kind:o.kind,mimeType:o.kind+"/"+o.name,name:o.name,numChannels:o.numChannels||1,parameters:{},preferredPayloadType:e.preferredPayloadType,rtcpFeedback:[]},s=!0,c=!1,u=void 0;try{for(var l,d=Object.keys(e.parameters)[Symbol.iterator]();!(s=(l=d.next()).done);s=!0){var p=l.value,h=e.parameters[p],f=!0,m=!1,v=void 0;try{for(var g,y=Object.keys(o.parameters)[Symbol.iterator]();!(f=(g=y.next()).done);f=!0){var b=g.value,S=o.parameters[b];if(b===p&&S===h){a.parameters[b]=S;break}}}catch(e){m=!0,v=e}finally{try{!f&&y.return&&y.return()}finally{if(m)throw v}}}}catch(e){c=!0,u=e}finally{try{!s&&d.return&&d.return()}finally{if(c)throw u}}var _=!0,T=!1,C=void 0;try{for(var E,w=e.rtcpFeedback[Symbol.iterator]();!(_=(E=w.next()).done);_=!0){var R=E.value;!function(e){var t=o.rtcpFeedback.find(function(t){return t.type===e.type&&t.parameter===e.parameter});t&&a.rtcpFeedback.push(t)}(R)}}catch(e){T=!0,C=e}finally{try{!_&&w.return&&w.return()}finally{if(T)throw C}}n.codecs.push(a)}(u)}}catch(e){o=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw a}}var l=!0,d=!1,p=void 0;try{for(var h,f=n.codecs[Symbol.iterator]();!(l=(h=f.next()).done);l=!0){var m=h.value,v=m.preferredPayloadType;if(r.has(v)){var g={clockRate:m.clockRate,kind:m.kind,mimeType:m.kind+"/rtx",name:"rtx",parameters:{apt:v},preferredPayloadType:r.get(v),rtcpFeedback:[]};n.codecs.push(g)}}}catch(e){d=!0,p=e}finally{try{!l&&f.return&&f.return()}finally{if(d)throw p}}var y=!0,b=!1,S=void 0;try{for(var _,T=e.headerExtensions[Symbol.iterator]();!(y=(_=T.next()).done);y=!0){var C=_.value;!function(e){var r=t.headerExtensions.find(function(t){return t.kind===e.kind&&t.uri===e.uri});if(r){var i={kind:r.kind,preferredEncrypt:Boolean(e.preferredEncrypt),preferredId:e.preferredId,uri:r.uri};n.headerExtensions.push(i)}}(C)}}catch(e){b=!0,S=e}finally{try{!y&&T.return&&T.return()}finally{if(b)throw S}}var E=!0,w=!1,R=void 0;try{for(var k,I=e.fecMechanisms[Symbol.iterator]();!(E=(k=I.next()).done);E=!0){var P=k.value;!function(e){var r=t.fecMechanisms.find(function(t){return t===e});r&&n.fecMechanisms.push(r)}(P)}}catch(e){w=!0,R=e}finally{try{!E&&I.return&&I.return()}finally{if(w)throw R}}return n};var i=n(15),o=n.n(i)},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r,i=(r="InvalidStateError",function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return Object.defineProperty(n,"name",{value:r}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),t}())},function(e,t,n){"use strict";(function(e){function r(e,t,n){b(["screen"],function(e){return t({stream:e})},n)}function i(e){return"https://chrome.google.com/webstore/detail/"+e.desktopSharingChromeExtId}function o(e,t){"undefined"!=typeof chrome&&chrome&&chrome.runtime?chrome.runtime.sendMessage(t.desktopSharingChromeExtId,{getVersion:!0},function(n){if(!n||!n.version)return h.warn("Extension not installed?: ",chrome.runtime.lastError),void e(!1,!1);var r=n.version;h.log("Extension version is: "+r);var i=function(e,t){try{for(var n=e.split("."),r=t.split("."),i=Math.max(n.length,r.length),o=0;o<i;o++){var a=0,s=0;if(o<n.length&&(a=parseInt(n[o],10)),o<r.length&&(s=parseInt(r[o],10)),isNaN(a)||isNaN(s))return!0;if(a!==s)return a>s}return!1}catch(e){return f.callErrorHandler(e),h.error("Failed to parse extension version",e),!0}}(t.desktopSharingChromeMinExtVersion,r);e(!i,i)}):e(!1,!1)}function a(e,t,n){chrome.runtime.sendMessage(e.desktopSharingChromeExtId,{getStream:!0,sources:e.desktopSharingChromeSources},function(e){if(e)h.log("Response from extension: ",e),c(e,t,n);else{var r=chrome.runtime.lastError;n(r instanceof Error?r:new l.a(d.CHROME_EXTENSION_GENERIC_ERROR,r))}})}function s(e,t,n){return 0===n?Promise.reject():new Promise(function(r,i){var a=n,s=window.setInterval(function(){o(function(e){e?(window.clearInterval(s),r()):0==--a&&(i(),window.clearInterval(s))},e)},t)})}function c(e,t,n){var r=e.streamId,i=e.streamType,o=e.error;if(r)b(["desktop"],function(e){return t({stream:e,sourceId:r,sourceType:i})},n,{desktopStream:r});else{if(""===r)return void n(new l.a(d.CHROME_EXTENSION_USER_CANCELED));n(new l.a(d.CHROME_EXTENSION_GENERIC_ERROR,o))}}function u(e){if(!e.desktopSharingFirefoxDisabled&&!1!==g&&!0!==g)if(e.desktopSharingFirefoxExtId){var t=document.createElement("img");t.onload=function(){h.log("Detected firefox screen sharing extension."),g=!0},t.onerror=function(){h.log("Detected lack of firefox screen sharing extension."),g=!1};var n="chrome://"+e.desktopSharingFirefoxExtId.replace("@",".")+"/content/"+document.location.hostname+".png";t.setAttribute("src",n)}else g=!1}var l=n(12),d=n(17),p=n(1),h=n(0).getLogger(e),f=n(3),m=!1,v=!1,g=null,y=!1,b=null,S={intChromeExtPromise:null,obtainStream:null,init:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{disableDesktopSharing:!1,desktopSharingChromeDisabled:!1,desktopSharingChromeExtId:null,desktopSharingFirefoxDisabled:!1,desktopSharingFirefoxExtId:null},t=arguments[1];this.options=e=e||{},b=t,this.obtainStream=this.options.disableDesktopSharing?null:this._createObtainStreamMethod(e),this.obtainStream||h.info("Desktop sharing disabled")},_createObtainStreamMethod:function(e){var t,a,s=this;if(p.a.isNWJS())return function(e,t,n){window.JitsiMeetNW.obtainDesktopStream(t,function(e,t){var r=void 0;r=e&&"InvalidStateError"===e.name?new l.a(d.CHROME_EXTENSION_USER_CANCELED):new l.a(e,t,["desktop"]),"function"==typeof n&&n(r)})};if(p.a.isElectron())return this.obtainScreenOnElectron;if(p.a.isTemasysPluginUsed()){var c=n(37).WebRTCPlugin.plugin;return c.HasScreensharingFeature?c.isScreensharingAvailable?(h.info("Using Temasys plugin for desktop sharing"),r):(h.warn("Screensharing not available with Temasys plugin on this site"),null):(h.warn("Screensharing not supported by this plugin version"),null)}return p.a.isChrome()||p.a.isOpera()?p.a.isVersionLessThan("34")?(h.info("Chrome extension not supported until ver 34"),null):e.desktopSharingChromeDisabled||!1===e.desktopSharingChromeMethod||!e.desktopSharingChromeExtId?null:(h.info("Using Chrome extension for desktop sharing"),this.intChromeExtPromise=(t=e,a=t,0===$("link[rel=chrome-webstore-item]").length&&$("head").append('<link rel="chrome-webstore-item">'),$("link[rel=chrome-webstore-item]").attr("href",i(a)),new Promise(function(e){o(function(t,n){m=t,v=n,h.info("Chrome extension installed: "+m+" updateRequired: "+v),e()},t)})).then(function(){s.intChromeExtPromise=null}),this.obtainScreenFromExtension):p.a.isFirefox()?e.desktopSharingFirefoxDisabled?null:"http:"===window.location.protocol?(h.log("Screen sharing is not supported over HTTP. Use of HTTPS is required."),null):(u(e),this.obtainScreenOnFirefox):(h.log("Screen sharing not supported by the current browser: ",p.a.getName()),null)},isSupported:function(){return null!==this.obtainStream},obtainScreenOnFirefox:function(e,t,n){var i=this,o=!1,a=this.options.desktopSharingFirefoxMaxVersionExtRequired;if("number"==typeof a&&(o=-1===a,a>=0&&(a=String(a))),"string"==typeof a&&(o=!p.a.isVersionGreaterThan(a)),o&&h.log("Jidesha extension required on firefox version "+p.a.getVersion()),o&&!0!==g){if(y&&(y=!1,u(this.options)),null===g)return window.setTimeout(function(){null===g&&(g=!1),i.obtainScreenOnFirefox(e,t,n)},300),void h.log("Waiting for detection of jidesha on firefox to finish.");g=null,y=!0,n(new l.a(d.FIREFOX_EXTENSION_NEEDED))}else r(e,t,n)},obtainScreenOnElectron:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n=arguments[2];window.JitsiMeetScreenObtainer&&window.JitsiMeetScreenObtainer.openDesktopPicker?window.JitsiMeetScreenObtainer.openDesktopPicker({desktopSharingSources:e.desktopSharingSources||this.options.desktopSharingChromeSources},function(e,r){return c({streamId:e,streamType:r},t,n)},function(e){return n(new l.a(d.ELECTRON_DESKTOP_PICKER_ERROR,e))}):n(new l.a(d.ELECTRON_DESKTOP_PICKER_NOT_FOUND))},obtainScreenFromExtension:function(e,t,n){var r=this;if(null===this.intChromeExtPromise){var o=this.options,c=o.desktopSharingChromeExtId,u=o.desktopSharingChromeSources,l={desktopSharingChromeExtId:c,desktopSharingChromeSources:e.desktopSharingSources||u};if(m)a(l,t,n);else{if(v&&alert("Jitsi Desktop Streamer requires update. Changes will take effect after next Chrome restart."),p.a.isOpera())return void this.handleExternalInstall(e,t,n);try{chrome.webstore.install(i(this.options),function(i){h.log("Extension installed successfully",i),m=!0,s(r.options,200,10).then(function(){a(l,t,n)}).catch(function(){r.handleExtensionInstallationError(e,t,n)})},this.handleExtensionInstallationError.bind(this,e,t,n))}catch(r){this.handleExtensionInstallationError(e,t,n,r)}}}else this.intChromeExtPromise.then(function(){r.obtainScreenFromExtension(e,t,n)})},handleExternalInstall:function(e,t,n,r){var o=i(this.options);e.listener("waitingForExtension",o),this.checkForChromeExtensionOnInterval(e,t,n,r)},handleExtensionInstallationError:function(e,t,n,r){var o=i(this.options);if(("Inline installs can not be initiated from pop-up windows."===r||"Chrome Web Store installations can only be started by the top frame."===r||"Installs can only be initiated by one of the Chrome Web Store item's verified sites."===r||"Inline installation is not supported for this item. The user will be redirected to the Chrome Web Store."===r)&&e.interval>0&&"function"==typeof e.checkAgain&&"function"==typeof e.listener)this.handleExternalInstall(e,t,n,r);else{var a="Failed to install the extension from "+o;h.log(a,r);var s="Chrome Web Store installations can only be initated by a user gesture."===r?d.CHROME_EXTENSION_USER_GESTURE_REQUIRED:d.CHROME_EXTENSION_INSTALLATION_ERROR;n(new l.a(s,a))}},checkForChromeExtensionOnInterval:function(e,t,n){var r=this;!1!==e.checkAgain()?s(this.options,e.interval,1).then(function(){m=!0,e.listener("extensionFound"),r.obtainScreenFromExtension(e,t,n)}).catch(function(){r.checkForChromeExtensionOnInterval(e,t,n)}):n(new l.a(d.CHROME_EXTENSION_INSTALLATION_ERROR))}};t.a=S}).call(t,"modules/RTC/ScreenObtainer.js")},function(e,t,n){"use strict";(function(t){var r=n(136);e.exports=r({window:t.window})}).call(t,n(20))},function(e,t,n){"use strict";var r=n(11);e.exports=function(e,t){var i=e&&e.window,o={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0};for(var a in t)hasOwnProperty.call(t,a)&&(o[a]=t[a]);var s=r.log,c=r.detectBrowser(i),u={browserDetails:c,extractVersion:r.extractVersion,disableLog:r.disableLog,disableWarnings:r.disableWarnings},l=n(137)||null,d=n(139)||null,p=n(142)||null,h=n(144)||null,f=n(145)||null;switch(c.browser){case"chrome":if(!l||!l.shimPeerConnection||!o.shimChrome)return s("Chrome shim is not included in this adapter release."),u;s("adapter.js shimming chrome."),u.browserShim=l,f.shimCreateObjectURL(i),l.shimGetUserMedia(i),l.shimMediaStream(i),l.shimSourceObject(i),l.shimPeerConnection(i),l.shimOnTrack(i),l.shimAddTrackRemoveTrack(i),l.shimGetSendersWithDtmf(i),f.shimRTCIceCandidate(i);break;case"firefox":if(!p||!p.shimPeerConnection||!o.shimFirefox)return s("Firefox shim is not included in this adapter release."),u;s("adapter.js shimming firefox."),u.browserShim=p,f.shimCreateObjectURL(i),p.shimGetUserMedia(i),p.shimSourceObject(i),p.shimPeerConnection(i),p.shimOnTrack(i),f.shimRTCIceCandidate(i);break;case"edge":if(!d||!d.shimPeerConnection||!o.shimEdge)return s("MS edge shim is not included in this adapter release."),u;s("adapter.js shimming edge."),u.browserShim=d,f.shimCreateObjectURL(i),d.shimGetUserMedia(i),d.shimPeerConnection(i),d.shimReplaceTrack(i);break;case"safari":if(!h||!o.shimSafari)return s("Safari shim is not included in this adapter release."),u;s("adapter.js shimming safari."),u.browserShim=h,f.shimCreateObjectURL(i),h.shimRTCIceServerUrls(i),h.shimCallbacksAPI(i),h.shimLocalStreamsAPI(i),h.shimRemoteStreamsAPI(i),h.shimTrackEventTransceiver(i),h.shimGetUserMedia(i),h.shimCreateOfferLegacy(i),f.shimRTCIceCandidate(i);break;default:s("Unsupported browser!")}return u}},function(e,t,n){"use strict";var r=n(11),i=r.log,o={shimMediaStream:function(e){e.MediaStream=e.MediaStream||e.webkitMediaStream},shimOnTrack:function(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var n=this;return n._ontrackpoly||(n._ontrackpoly=function(t){t.stream.addEventListener("addtrack",function(r){var i;i=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find(function(e){return e.track&&e.track.id===r.track.id}):{track:r.track};var o=new Event("track");o.track=r.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],n.dispatchEvent(o)}),t.stream.getTracks().forEach(function(r){var i;i=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find(function(e){return e.track&&e.track.id===r.id}):{track:r};var o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],n.dispatchEvent(o)})},n.addEventListener("addstream",n._ontrackpoly)),t.apply(n,arguments)}}},shimGetSendersWithDtmf:function(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;n._senders=n._senders||[],i.apply(n,[e]),e.getTracks().forEach(function(e){n._senders.push(t(n,e))})};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;t._senders=t._senders||[],o.apply(t,[e]),e.getTracks().forEach(function(e){var n=t._senders.find(function(t){return t.track===e});n&&t._senders.splice(t._senders.indexOf(n),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(e,[]);return t.forEach(function(t){t._pc=e}),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}},shimSourceObject:function(e){var t=e&&e.URL;"object"==typeof e&&(!e.HTMLMediaElement||"srcObject"in e.HTMLMediaElement.prototype||Object.defineProperty(e.HTMLMediaElement.prototype,"srcObject",{get:function(){return this._srcObject},set:function(e){var n=this;this._srcObject=e,this.src&&t.revokeObjectURL(this.src),e?(this.src=t.createObjectURL(e),e.addEventListener("addtrack",function(){n.src&&t.revokeObjectURL(n.src),n.src=t.createObjectURL(e)}),e.addEventListener("removetrack",function(){n.src&&t.revokeObjectURL(n.src),n.src=t.createObjectURL(e)})):this.src=""}}))},shimAddTrackRemoveTrack:function(e){function t(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(t){var r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}var n=r.detectBrowser(e);if(!(e.RTCPeerConnection.prototype.addTrack&&n.version>=63)){var i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=i.apply(this);return e._reverseStreams=e._reverseStreams||{},t.map(function(t){return e._reverseStreams[t.id]})};var o=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var n=this;if(n._streams=n._streams||{},n._reverseStreams=n._reverseStreams||{},t.getTracks().forEach(function(e){if(n.getSenders().find(function(t){return t.track===e}))throw new DOMException("Track already exists.","InvalidAccessError")}),!n._reverseStreams[t.id]){var r=new e.MediaStream(t.getTracks());n._streams[t.id]=r,n._reverseStreams[r.id]=t,t=r}o.apply(n,[t])};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;t._streams=t._streams||{},t._reverseStreams=t._reverseStreams||{},a.apply(t,[t._streams[e.id]||e]),delete t._reverseStreams[t._streams[e.id]?t._streams[e.id].id:e.id],delete t._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){var r=this;if("closed"===r.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find(function(e){return e===t}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(r.getSenders().find(function(e){return e.track===t}))throw new DOMException("Track already exists.","InvalidAccessError");r._streams=r._streams||{},r._reverseStreams=r._reverseStreams||{};var o=r._streams[n.id];if(o)o.addTrack(t),Promise.resolve().then(function(){r.dispatchEvent(new Event("negotiationneeded"))});else{var a=new e.MediaStream([t]);r._streams[n.id]=a,r._reverseStreams[a.id]=n,r.addStream(a)}return r.getSenders().find(function(e){return e.track===t})},["createOffer","createAnswer"].forEach(function(n){var r=e.RTCPeerConnection.prototype[n];e.RTCPeerConnection.prototype[n]=function(){var e=this,n=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(e,[function(r){var i=t(e,r);n[0].apply(null,[i])},function(e){n[1]&&n[1].apply(null,e)},arguments[2]]):r.apply(e,arguments).then(function(n){return t(e,n)})}});var s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){var e,t,n;return arguments.length&&arguments[0].type?(arguments[0]=(e=this,t=arguments[0],n=t.sdp,Object.keys(e._reverseStreams||[]).forEach(function(t){var r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})),s.apply(this,arguments)):s.apply(this,arguments)};var c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=c.get.apply(this);return""===e.type?e:t(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,n=this;if("closed"===n.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==n)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");n._streams=n._streams||{},Object.keys(n._streams).forEach(function(r){n._streams[r].getTracks().find(function(t){return e.track===t})&&(t=n._streams[r])}),t&&(1===t.getTracks().length?n.removeStream(n._reverseStreams[t.id]):t.removeTrack(e.track),n.dispatchEvent(new Event("negotiationneeded")))}}},shimPeerConnection:function(e){var t=r.detectBrowser(e);if(e.RTCPeerConnection){var n=e.RTCPeerConnection;e.RTCPeerConnection=function(e,t){if(e&&e.iceServers){for(var i=[],o=0;o<e.iceServers.length;o++){var a=e.iceServers[o];!a.hasOwnProperty("urls")&&a.hasOwnProperty("url")?(r.deprecated("RTCIceServer.url","RTCIceServer.urls"),(a=JSON.parse(JSON.stringify(a))).urls=a.url,i.push(a)):i.push(e.iceServers[o])}e.iceServers=i}return new n(e,t)},e.RTCPeerConnection.prototype=n.prototype,Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return n.generateCertificate}})}else e.RTCPeerConnection=function(t,n){return i("PeerConnection"),t&&t.iceTransportPolicy&&(t.iceTransports=t.iceTransportPolicy),new e.webkitRTCPeerConnection(t,n)},e.RTCPeerConnection.prototype=e.webkitRTCPeerConnection.prototype,e.webkitRTCPeerConnection.generateCertificate&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return e.webkitRTCPeerConnection.generateCertificate}});var o=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(e,t,n){var r=this,i=arguments;if(arguments.length>0&&"function"==typeof e)return o.apply(this,arguments);if(0===o.length&&(0===arguments.length||"function"!=typeof arguments[0]))return o.apply(this,[]);var a=function(e){var t={};return e.result().forEach(function(e){var n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(function(t){n[t]=e.stat(t)}),t[n.id]=n}),t},s=function(e){return new Map(Object.keys(e).map(function(t){return[t,e[t]]}))};return arguments.length>=2?o.apply(this,[function(e){i[1](s(a(e)))},arguments[0]]):new Promise(function(e,t){o.apply(r,[function(t){e(s(a(t)))},t])}).then(t,n)},t.version<51&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=arguments,t=this,r=new Promise(function(r,i){n.apply(t,[e[0],r,i])});return e.length<2?r:r.then(function(){e[1].apply(null,[])},function(t){e.length>=3&&e[2].apply(null,[t])})}}),t.version<52&&["createOffer","createAnswer"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=this;if(arguments.length<1||1===arguments.length&&"object"==typeof arguments[0]){var t=1===arguments.length?arguments[0]:void 0;return new Promise(function(r,i){n.apply(e,[r,i,t])})}return n.apply(this,arguments)}}),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}});var a=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?a.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}};e.exports={shimMediaStream:o.shimMediaStream,shimOnTrack:o.shimOnTrack,shimAddTrackRemoveTrack:o.shimAddTrackRemoveTrack,shimGetSendersWithDtmf:o.shimGetSendersWithDtmf,shimSourceObject:o.shimSourceObject,shimPeerConnection:o.shimPeerConnection,shimGetUserMedia:n(138)}},function(e,t,n){"use strict";var r=n(11),i=r.log;e.exports=function(e){var t=r.detectBrowser(e),n=e&&e.navigator,o=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var o={};"number"==typeof r.ideal?(o[i("min",n)]=r.ideal,t.optional.push(o),(o={})[i("max",n)]=r.ideal,t.optional.push(o)):(o[i("",n)]=r.ideal,t.optional.push(o))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},a=function(e,r){if(t.version>=61)return r(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){var a=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=o(e.audio)}if(e&&"object"==typeof e.video){var s=e.video.facingMode;s=s&&("object"==typeof s?s:{ideal:s});var c,u=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||u)&&(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?c=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(c=["front"]),c))return n.mediaDevices.enumerateDevices().then(function(t){var n=(t=t.filter(function(e){return"videoinput"===e.kind})).find(function(e){return c.some(function(t){return-1!==e.label.toLowerCase().indexOf(t)})});return!n&&t.length&&-1!==c.indexOf("back")&&(n=t[t.length-1]),n&&(e.video.deviceId=s.exact?{exact:n.deviceId}:{ideal:n.deviceId}),e.video=o(e.video),i("chrome: "+JSON.stringify(e)),r(e)});e.video=o(e.video)}return i("chrome: "+JSON.stringify(e)),r(e)},s=function(e){return{name:{PermissionDeniedError:"NotAllowedError",InvalidStateError:"NotReadableError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotReadableError",MediaDeviceKillSwitchOn:"NotReadableError"}[e.name]||e.name,message:e.message,constraint:e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};n.getUserMedia=function(e,t,r){a(e,function(e){n.webkitGetUserMedia(e,t,function(e){r&&r(s(e))})})};var c=function(e){return new Promise(function(t,r){n.getUserMedia(e,t,r)})};if(n.mediaDevices||(n.mediaDevices={getUserMedia:c,enumerateDevices:function(){return new Promise(function(t){var n={audio:"audioinput",video:"videoinput"};return e.MediaStreamTrack.getSources(function(e){t(e.map(function(e){return{label:e.label,kind:n[e.kind],deviceId:e.id,groupId:""}}))})})},getSupportedConstraints:function(){return{deviceId:!0,echoCancellation:!0,facingMode:!0,frameRate:!0,height:!0,width:!0}}}),n.mediaDevices.getUserMedia){var u=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return a(e,function(e){return u(e).then(function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(function(e){e.stop()}),new DOMException("","NotFoundError");return t},function(e){return Promise.reject(s(e))})})}}else n.mediaDevices.getUserMedia=function(e){return c(e)};void 0===n.mediaDevices.addEventListener&&(n.mediaDevices.addEventListener=function(){i("Dummy mediaDevices.addEventListener called.")}),void 0===n.mediaDevices.removeEventListener&&(n.mediaDevices.removeEventListener=function(){i("Dummy mediaDevices.removeEventListener called.")})}},function(e,t,n){"use strict";var r=n(11),i=n(140);e.exports={shimGetUserMedia:n(141),shimPeerConnection:function(e){var t=r.detectBrowser(e);if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){var n=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){n.set.call(this,e);var t=new Event("enabled");t.enabled=e,this.dispatchEvent(t)}})}!e.RTCRtpSender||"dtmf"in e.RTCRtpSender.prototype||Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCPeerConnection=i(e,t.version)},shimReplaceTrack:function(e){!e.RTCRtpSender||"replaceTrack"in e.RTCRtpSender.prototype||(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}}},function(e,t,n){"use strict";function r(e,t,n,r,i){var o=c.writeRtpDescription(e.kind,t);if(o+=c.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=c.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":i||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+(r?r.id:"-")+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+c.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+c.localCName+"\r\n"),o}function i(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]};return e.codecs.forEach(function(i){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(i.name.toLowerCase()===a.name.toLowerCase()&&i.clockRate===a.clockRate){if("rtx"===i.name.toLowerCase()&&i.parameters&&a.parameters.apt&&(s=i,c=a,u=e.codecs,l=t.codecs,d=void 0,p=void 0,d=r(s.parameters.apt,u),p=r(c.parameters.apt,l),!d||!p||d.name.toLowerCase()!==p.name.toLowerCase()))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(i.numChannels,a.numChannels),n.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter(function(e){for(var t=0;t<i.rtcpFeedback.length;t++)if(i.rtcpFeedback[t].type===e.type&&i.rtcpFeedback[t].parameter===e.parameter)return!0;return!1});break}}var s,c,u,l,d,p}),e.headerExtensions.forEach(function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}}),n}function o(e,t,n){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(n)}function a(e,t){var n=e.getRemoteCandidates().find(function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type});return n||e.addRemoteCandidate(t),!n}function s(e,t){var n=new Error(t);return n.name=e,n}var c=n(58);e.exports=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function u(t,n,r,i){var o=new Event("track");o.track=n,o.receiver=r,o.transceiver={receiver:r},o.streams=i,e.setTimeout(function(){t._dispatchEvent("track",o)})}var l=function(n){var r,i,o,a=this,u=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){a[e]=u[e].bind(u)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this.localDescription=null,this.remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.iceGatheringState="new",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw s("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=(r=n.iceServers||[],i=t,o=!1,(r=JSON.parse(JSON.stringify(r))).filter(function(e){if(e&&(e.urls||e.url)){var t=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var n="string"==typeof t;return n&&(t=[t]),t=t.filter(function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||o?0===e.indexOf("stun:")&&i>=14393&&-1===e.indexOf("?transport=udp"):(o=!0,!0)}),delete e.url,e.urls=n?t[0]:t,!!t.length}})),this._iceGatherers=[],n.iceCandidatePoolSize)for(var l=n.iceCandidatePoolSize;l>0;l--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=c.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};l.prototype.onicecandidate=null,l.prototype.onaddstream=null,l.prototype.ontrack=null,l.prototype.onremovestream=null,l.prototype.onsignalingstatechange=null,l.prototype.oniceconnectionstatechange=null,l.prototype.onicegatheringstatechange=null,l.prototype.onnegotiationneeded=null,l.prototype.ondatachannel=null,l.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},l.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},l.prototype.getConfiguration=function(){return this._config},l.prototype.getLocalStreams=function(){return this.localStreams},l.prototype.getRemoteStreams=function(){return this.remoteStreams},l.prototype._createTransceiver=function(e){var t=this.transceivers.length>0,n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&t)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var r=this._createIceAndDtlsTransports();n.iceTransport=r.iceTransport,n.dtlsTransport=r.dtlsTransport}return this.transceivers.push(n),n},l.prototype.addTrack=function(t,n){if(this._isClosed)throw s("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find(function(e){return e.track===t}))throw s("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(r=this.transceivers[i]);return r||(r=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(n)&&this.localStreams.push(n),r.track=t,r.stream=n,r.rtpSender=new e.RTCRtpSender(t,r.dtlsTransport),r.rtpSender},l.prototype.addStream=function(e){var n=this;if(t>=15025)e.getTracks().forEach(function(t){n.addTrack(t,e)});else{var r=e.clone();e.getTracks().forEach(function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",function(e){n.enabled=e.enabled})}),r.getTracks().forEach(function(e){n.addTrack(e,r)})}},l.prototype.removeTrack=function(t){if(this._isClosed)throw s("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find(function(e){return e.rtpSender===t});if(!n)throw s("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map(function(e){return e.stream}).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},l.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(e){var n=t.getSenders().find(function(t){return t.track===e});n&&t.removeTrack(n)})},l.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},l.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},l.prototype._createIceGatherer=function(t,n){var r=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var n=!e.candidate||0===Object.keys(e.candidate).length;i.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},l.prototype._gather=function(t,n){var r=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:n};var a=e.candidate,s=!a||0===Object.keys(a).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),a.component=1;var u=c.writeCandidate(a);o.candidate=Object.assign(o.candidate,c.parseCandidate(u)),o.candidate.candidate=u}var l=c.splitSections(r.localDescription.sdp);l[o.candidate.sdpMLineIndex+1]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",r.localDescription.sdp=l.join("");var d=r.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),s||r._dispatchEvent("icecandidate",o),d&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout(function(){o.forEach(function(e){i.onlocalcandidate(e)})},0)}},l.prototype._createIceAndDtlsTransports=function(){var t=this,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateConnectionState()};var r=new e.RTCDtlsTransport(n);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:r}},l.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},l.prototype._transceive=function(e,n,r){var o=i(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(o.encodings=e.sendEncodingParameters,o.rtcp={cname:c.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(o.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(o)),r&&e.rtpReceiver&&o.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach(function(e){delete e.rtx}),e.recvEncodingParameters.length&&(o.encodings=e.recvEncodingParameters),o.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(o.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(o.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(o))},l.prototype.setLocalDescription=function(e){var t,n,r=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(s("TypeError",'Unsupported type "'+e.type+'"'));if(!o("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(s("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=c.splitSections(e.sdp),n=t.shift(),t.forEach(function(e,t){var n=c.parseRtpParameters(e);r.transceivers[t].localCapabilities=n}),r.transceivers.forEach(function(e,t){r._gather(e.mid,t)});else if("answer"===e.type){t=c.splitSections(r.remoteDescription.sdp),n=t.shift();var a=c.matchPrefix(n,"a=ice-lite").length>0;t.forEach(function(e,t){var o=r.transceivers[t],s=o.iceGatherer,u=o.iceTransport,l=o.dtlsTransport,d=o.localCapabilities,p=o.remoteCapabilities;if(!(c.isRejected(e)&&0===c.matchPrefix(e,"a=bundle-only").length||o.isDatachannel)){var h=c.getIceParameters(e,n),f=c.getDtlsParameters(e,n);a&&(f.role="server"),r.usingBundle&&0!==t||(r._gather(o.mid,t),"new"===u.state&&u.start(s,h,a?"controlling":"controlled"),"new"===l.state&&l.start(f));var m=i(d,p);r._transceive(o,m.codecs.length>0,!1)}})}return r.localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?r._updateSignalingState("have-local-offer"):r._updateSignalingState("stable"),Promise.resolve()},l.prototype.setRemoteDescription=function(r){var i=this;if(-1===["offer","answer"].indexOf(r.type))return Promise.reject(s("TypeError",'Unsupported type "'+r.type+'"'));if(!o("setRemoteDescription",r.type,i.signalingState)||i._isClosed)return Promise.reject(s("InvalidStateError","Can not set remote "+r.type+" in state "+i.signalingState));var l={};i.remoteStreams.forEach(function(e){l[e.id]=e});var d=[],p=c.splitSections(r.sdp),h=p.shift(),f=c.matchPrefix(h,"a=ice-lite").length>0,m=c.matchPrefix(h,"a=group:BUNDLE ").length>0;i.usingBundle=m;var v=c.matchPrefix(h,"a=ice-options:")[0];return i.canTrickleIceCandidates=!!v&&v.substr(14).split(" ").indexOf("trickle")>=0,p.forEach(function(o,s){var u=c.splitLines(o),p=c.getKind(o),v=c.isRejected(o)&&0===c.matchPrefix(o,"a=bundle-only").length,g=u[0].substr(2).split(" ")[2],y=c.getDirection(o,h),b=c.parseMsid(o),S=c.getMid(o)||c.generateIdentifier();if("application"!==p||"DTLS/SCTP"!==g){var _,T,C,E,w,R,k,I,P,A,O,D=c.parseRtpParameters(o);v||(A=c.getIceParameters(o,h),(O=c.getDtlsParameters(o,h)).role="client"),k=c.parseRtpEncodingParameters(o);var x=c.parseRtcpParameters(o),N=c.matchPrefix(o,"a=end-of-candidates",h).length>0,L=c.matchPrefix(o,"a=candidate:").map(function(e){return c.parseCandidate(e)}).filter(function(e){return 1===e.component});if(("offer"===r.type||"answer"===r.type)&&!v&&m&&s>0&&i.transceivers[s]&&(i._disposeIceAndDtlsTransports(s),i.transceivers[s].iceGatherer=i.transceivers[0].iceGatherer,i.transceivers[s].iceTransport=i.transceivers[0].iceTransport,i.transceivers[s].dtlsTransport=i.transceivers[0].dtlsTransport,i.transceivers[s].rtpSender&&i.transceivers[s].rtpSender.setTransport(i.transceivers[0].dtlsTransport),i.transceivers[s].rtpReceiver&&i.transceivers[s].rtpReceiver.setTransport(i.transceivers[0].dtlsTransport)),"offer"!==r.type||v)"answer"!==r.type||v||(T=(_=i.transceivers[s]).iceGatherer,C=_.iceTransport,E=_.dtlsTransport,w=_.rtpReceiver,R=_.sendEncodingParameters,I=_.localCapabilities,i.transceivers[s].recvEncodingParameters=k,i.transceivers[s].remoteCapabilities=D,i.transceivers[s].rtcpParameters=x,L.length&&"new"===C.state&&(!f&&!N||m&&0!==s?L.forEach(function(e){a(_.iceTransport,e)}):C.setRemoteCandidates(L)),m&&0!==s||("new"===C.state&&C.start(T,A,"controlling"),"new"===E.state&&E.start(O)),i._transceive(_,"sendrecv"===y||"recvonly"===y,"sendrecv"===y||"sendonly"===y),!w||"sendrecv"!==y&&"sendonly"!==y?delete _.rtpReceiver:(P=w.track,b?(l[b.stream]||(l[b.stream]=new e.MediaStream),n(P,l[b.stream]),d.push([P,w,l[b.stream]])):(l.default||(l.default=new e.MediaStream),n(P,l.default),d.push([P,w,l.default]))));else{(_=i.transceivers[s]||i._createTransceiver(p)).mid=S,_.iceGatherer||(_.iceGatherer=i._createIceGatherer(s,m)),L.length&&"new"===_.iceTransport.state&&(!N||m&&0!==s?L.forEach(function(e){a(_.iceTransport,e)}):_.iceTransport.setRemoteCandidates(L)),I=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(I.codecs=I.codecs.filter(function(e){return"rtx"!==e.name})),R=_.sendEncodingParameters||[{ssrc:1001*(2*s+2)}];var M,j=!1;"sendrecv"===y||"sendonly"===y?(j=!_.rtpReceiver,w=_.rtpReceiver||new e.RTCRtpReceiver(_.dtlsTransport,p),j&&(P=w.track,b&&"-"===b.stream||(b?(l[b.stream]||(l[b.stream]=new e.MediaStream,Object.defineProperty(l[b.stream],"id",{get:function(){return b.stream}})),Object.defineProperty(P,"id",{get:function(){return b.track}}),M=l[b.stream]):(l.default||(l.default=new e.MediaStream),M=l.default)),M&&(n(P,M),_.associatedRemoteMediaStreams.push(M)),d.push([P,w,M]))):_.rtpReceiver&&_.rtpReceiver.track&&(_.associatedRemoteMediaStreams.forEach(function(t){var n,r,i=t.getTracks().find(function(e){return e.id===_.rtpReceiver.track.id});i&&(n=i,(r=t).removeTrack(n),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:n})))}),_.associatedRemoteMediaStreams=[]),_.localCapabilities=I,_.remoteCapabilities=D,_.rtpReceiver=w,_.rtcpParameters=x,_.sendEncodingParameters=R,_.recvEncodingParameters=k,i._transceive(i.transceivers[s],!1,j)}}else i.transceivers[s]={mid:S,isDatachannel:!0}}),void 0===i._dtlsRole&&(i._dtlsRole="offer"===r.type?"active":"passive"),i.remoteDescription={type:r.type,sdp:r.sdp},"offer"===r.type?i._updateSignalingState("have-remote-offer"):i._updateSignalingState("stable"),Object.keys(l).forEach(function(t){var n=l[t];if(n.getTracks().length){if(-1===i.remoteStreams.indexOf(n)){i.remoteStreams.push(n);var r=new Event("addstream");r.stream=n,e.setTimeout(function(){i._dispatchEvent("addstream",r)})}d.forEach(function(e){var t=e[0],r=e[1];n.id===e[2].id&&u(i,t,r,[n])})}}),d.forEach(function(e){e[2]||u(i,e[0],e[1],[])}),e.setTimeout(function(){i&&i.transceivers&&i.transceivers.forEach(function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},l.prototype.close=function(){this.transceivers.forEach(function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},l.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},l.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}},0))},l.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){t[e.iceTransport.state]++,t[e.dtlsTransport.state]++}),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0||t.checking>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":(t.connected>0||t.completed>0)&&(e="connected"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},l.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(s("InvalidStateError","Can not call createOffer after close"));var i=n.transceivers.filter(function(e){return"audio"===e.kind}).length,o=n.transceivers.filter(function(e){return"video"===e.kind}).length,a=arguments[0];if(a){if(a.mandatory||a.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==a.offerToReceiveAudio&&(i=!0===a.offerToReceiveAudio?1:!1===a.offerToReceiveAudio?0:a.offerToReceiveAudio),void 0!==a.offerToReceiveVideo&&(o=!0===a.offerToReceiveVideo?1:!1===a.offerToReceiveVideo?0:a.offerToReceiveVideo)}for(n.transceivers.forEach(function(e){"audio"===e.kind?--i<0&&(e.wantReceive=!1):"video"===e.kind&&--o<0&&(e.wantReceive=!1)});i>0||o>0;)i>0&&(n._createTransceiver("audio"),i--),o>0&&(n._createTransceiver("video"),o--);var u=c.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach(function(r,i){var o=r.track,a=r.kind,s=r.mid||c.generateIdentifier();r.mid=s,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.usingBundle));var u=e.RTCRtpSender.getCapabilities(a);t<15019&&(u.codecs=u.codecs.filter(function(e){return"rtx"!==e.name})),u.codecs.forEach(function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1")});var l=r.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===a&&!l[0].rtx&&(l[0].rtx={ssrc:l[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,a)),r.localCapabilities=u,r.sendEncodingParameters=l}),"max-compat"!==n._config.bundlePolicy&&(u+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),u+="a=ice-options:trickle\r\n",n.transceivers.forEach(function(e,t){u+=r(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),u+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,u+="a="+c.writeCandidate(e)+"\r\n"}),"completed"===e.iceGatherer.state&&(u+="a=end-of-candidates\r\n"))});var l=new e.RTCSessionDescription({type:"offer",sdp:u});return Promise.resolve(l)},l.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(s("InvalidStateError","Can not call createAnswer after close"));var o=c.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(o+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n");var a=c.splitSections(n.remoteDescription.sdp).length-1;n.transceivers.forEach(function(e,s){if(!(s+1>a))if(e.isDatachannel)o+="m=application 0 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=mid:"+e.mid+"\r\n";else{var c;e.stream&&("audio"===e.kind?c=e.stream.getAudioTracks()[0]:"video"===e.kind&&(c=e.stream.getVideoTracks()[0]),c&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1}));var u=i(e.localCapabilities,e.remoteCapabilities);!u.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,o+=r(e,u,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(o+="a=rtcp-rsize\r\n")}});var u=new e.RTCSessionDescription({type:"answer",sdp:o});return Promise.resolve(u)},l.prototype.addIceCandidate=function(e){var t,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(r,i){if(!n.remoteDescription)return i(s("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var u=0;u<n.transceivers.length;u++)if(n.transceivers[u].mid===e.sdpMid){o=u;break}var l=n.transceivers[o];if(!l)return i(s("OperationError","Can not add ICE candidate"));if(l.isDatachannel)return r();var d=Object.keys(e.candidate).length>0?c.parseCandidate(e.candidate):{};if("tcp"===d.protocol&&(0===d.port||9===d.port))return r();if(d.component&&1!==d.component)return r();if((0===o||o>0&&l.iceTransport!==n.transceivers[0].iceTransport)&&!a(l.iceTransport,d))return i(s("OperationError","Can not add ICE candidate"));var p=e.candidate.trim();0===p.indexOf("a=")&&(p=p.substr(2)),(t=c.splitSections(n.remoteDescription.sdp))[o+1]+="a="+(d.type?p:"end-of-candidates")+"\r\n",n.remoteDescription.sdp=t.join("")}else for(var h=0;h<n.transceivers.length&&(n.transceivers[h].isDatachannel||(n.transceivers[h].iceTransport.addRemoteCandidate({}),(t=c.splitSections(n.remoteDescription.sdp))[h+1]+="a=end-of-candidates\r\n",n.remoteDescription.sdp=t.join(""),!n.usingBundle));h++);r()})},l.prototype.getStats=function(){var e=[];return this.transceivers.forEach(function(t){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(n){t[n]&&e.push(t[n].getStats())})}),new Promise(function(t){var n=new Map;Promise.all(e).then(function(e){e.forEach(function(e){Object.keys(e).forEach(function(t){var r;e[t].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(r=e[t]).type]||r.type,n.set(t,e[t])})}),t(n)})})};var d=["createOffer","createAnswer"];return d.forEach(function(e){var t=l.prototype[e];l.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then(function(t){"function"==typeof e[0]&&e[0].apply(null,[t])},function(t){"function"==typeof e[1]&&e[1].apply(null,[t])}):t.apply(this,arguments)}}),(d=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(e){var t=l.prototype[e];l.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)},function(t){"function"==typeof e[2]&&e[2].apply(null,[t])}):t.apply(this,arguments)}}),["getStats"].forEach(function(e){var t=l.prototype[e];l.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)}):t.apply(this,arguments)}}),l}},function(e,t,n){"use strict";e.exports=function(e){var t=e&&e.navigator,n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(e).catch(function(e){return Promise.reject({name:{PermissionDeniedError:"NotAllowedError"}[(t=e).name]||t.name,message:t.message,constraint:t.constraint,toString:function(){return this.name}});var t})}}},function(e,t,n){"use strict";var r=n(11),i={shimOnTrack:function(e){"object"!=typeof e||!e.RTCPeerConnection||"ontrack"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&(this.removeEventListener("track",this._ontrack),this.removeEventListener("addstream",this._ontrackpoly)),this.addEventListener("track",this._ontrack=e),this.addEventListener("addstream",this._ontrackpoly=function(e){e.stream.getTracks().forEach(function(t){var n=new Event("track");n.track=t,n.receiver={track:t},n.transceiver={receiver:n.receiver},n.streams=[e.stream],this.dispatchEvent(n)}.bind(this))}.bind(this))}}),"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},shimSourceObject:function(e){"object"==typeof e&&(!e.HTMLMediaElement||"srcObject"in e.HTMLMediaElement.prototype||Object.defineProperty(e.HTMLMediaElement.prototype,"srcObject",{get:function(){return this.mozSrcObject},set:function(e){this.mozSrcObject=e}}))},shimPeerConnection:function(e){var t=r.detectBrowser(e);if("object"==typeof e&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){e.RTCPeerConnection||(e.RTCPeerConnection=function(n,r){if(t.version<38&&n&&n.iceServers){for(var i=[],o=0;o<n.iceServers.length;o++){var a=n.iceServers[o];if(a.hasOwnProperty("urls"))for(var s=0;s<a.urls.length;s++){var c={url:a.urls[s]};0===a.urls[s].indexOf("turn")&&(c.username=a.username,c.credential=a.credential),i.push(c)}else i.push(n.iceServers[o])}n.iceServers=i}return new e.mozRTCPeerConnection(n,r)},e.RTCPeerConnection.prototype=e.mozRTCPeerConnection.prototype,e.mozRTCPeerConnection.generateCertificate&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return e.mozRTCPeerConnection.generateCertificate}}),e.RTCSessionDescription=e.mozRTCSessionDescription,e.RTCIceCandidate=e.mozRTCIceCandidate),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}});var n=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())};var i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},o=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(e,n,r){return o.apply(this,[e||null]).then(function(e){var r,o;if(t.version<48&&(r=e,o=new Map,Object.keys(r).forEach(function(e){o.set(e,r[e]),o[e]=r[e]}),e=o),t.version<53&&!n)try{e.forEach(function(e){e.type=i[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach(function(t,n){e.set(n,Object.assign({},t,{type:i[t.type]||t.type}))})}return e}).then(n,r)}}}};e.exports={shimOnTrack:i.shimOnTrack,shimSourceObject:i.shimSourceObject,shimPeerConnection:i.shimPeerConnection,shimGetUserMedia:n(143)}},function(e,t,n){"use strict";var r=n(11),i=r.log;e.exports=function(e){var t=r.detectBrowser(e),n=e&&e.navigator,o=e&&e.MediaStreamTrack,a=function(e){return{name:{InternalError:"NotReadableError",NotSupportedError:"TypeError",PermissionDeniedError:"NotAllowedError",SecurityError:"NotAllowedError"}[e.name]||e.name,message:{"The operation is insecure.":"The request is not allowed by the user agent or the platform in the current context."}[e.message]||e.message,constraint:e.constraint,toString:function(){return this.name+(this.message&&": ")+this.message}}},s=function(e,r,o){var s=function(e){if("object"!=typeof e||e.require)return e;var t=[];return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r=e[n]="object"==typeof e[n]?e[n]:{ideal:e[n]};if(void 0===r.min&&void 0===r.max&&void 0===r.exact||t.push(n),void 0!==r.exact&&("number"==typeof r.exact?r.min=r.max=r.exact:e[n]=r.exact,delete r.exact),void 0!==r.ideal){e.advanced=e.advanced||[];var i={};"number"==typeof r.ideal?i[n]={min:r.ideal,max:r.ideal}:i[n]=r.ideal,e.advanced.push(i),delete r.ideal,Object.keys(r).length||delete e[n]}}}),t.length&&(e.require=t),e};return e=JSON.parse(JSON.stringify(e)),t.version<38&&(i("spec: "+JSON.stringify(e)),e.audio&&(e.audio=s(e.audio)),e.video&&(e.video=s(e.video)),i("ff37: "+JSON.stringify(e))),n.mozGetUserMedia(e,r,function(e){o(a(e))})};if(n.mediaDevices||(n.mediaDevices={getUserMedia:function(e){return new Promise(function(t,n){s(e,t,n)})},addEventListener:function(){},removeEventListener:function(){}}),n.mediaDevices.enumerateDevices=n.mediaDevices.enumerateDevices||function(){return new Promise(function(e){e([{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}])})},t.version<41){var c=n.mediaDevices.enumerateDevices.bind(n.mediaDevices);n.mediaDevices.enumerateDevices=function(){return c().then(void 0,function(e){if("NotFoundError"===e.name)return[];throw e})}}if(t.version<49){var u=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return u(e).then(function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(function(e){e.stop()}),new DOMException("The object can not be found here.","NotFoundError");return t},function(e){return Promise.reject(a(e))})}}if(!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var l=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},d=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(e){return"object"==typeof e&&"object"==typeof e.audio&&(e=JSON.parse(JSON.stringify(e)),l(e.audio,"autoGainControl","mozAutoGainControl"),l(e.audio,"noiseSuppression","mozNoiseSuppression")),d(e)},o&&o.prototype.getSettings){var p=o.prototype.getSettings;o.prototype.getSettings=function(){var e=p.apply(this,arguments);return l(e,"mozAutoGainControl","autoGainControl"),l(e,"mozNoiseSuppression","noiseSuppression"),e}}if(o&&o.prototype.applyConstraints){var h=o.prototype.applyConstraints;o.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==typeof e&&(e=JSON.parse(JSON.stringify(e)),l(e,"autoGainControl","mozAutoGainControl"),l(e,"noiseSuppression","mozNoiseSuppression")),h.apply(this,[e])}}}n.getUserMedia=function(e,i,o){if(t.version<44)return s(e,i,o);r.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(i,o)}}},function(e,t,n){"use strict";var r=n(11),i={shimLocalStreamsAPI:function(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),"getStreamById"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getStreamById=function(e){var t=null;return this._localStreams&&this._localStreams.forEach(function(n){n.id===e&&(t=n)}),this._remoteStreams&&this._remoteStreams.forEach(function(n){n.id===e&&(t=n)}),t}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),-1===this._localStreams.indexOf(e)&&this._localStreams.push(e);var n=this;e.getTracks().forEach(function(r){t.call(n,r,e)})},e.RTCPeerConnection.prototype.addTrack=function(e,n){n&&(this._localStreams?-1===this._localStreams.indexOf(n)&&this._localStreams.push(n):this._localStreams=[n]),t.call(this,e,n)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);var t=this._localStreams.indexOf(e);if(-1!==t){this._localStreams.splice(t,1);var n=this,r=e.getTracks();this.getSenders().forEach(function(e){-1!==r.indexOf(e.track)&&n.removeTrack(e)})}})}},shimRemoteStreamsAPI:function(e){"object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),"onaddstream"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){var t=e.streams[0];if(this._remoteStreams||(this._remoteStreams=[]),!(this._remoteStreams.indexOf(t)>=0)){this._remoteStreams.push(t);var n=new Event("addstream");n.stream=e.streams[0],this.dispatchEvent(n)}}.bind(this))}}))},shimCallbacksAPI:function(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};var s=function(e,t,n){var r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){var r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){var r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}},shimGetUserMedia:function(e){var t=e&&e.navigator;t.getUserMedia||(t.webkitGetUserMedia?t.getUserMedia=t.webkitGetUserMedia.bind(t):t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t)))},shimRTCIceServerUrls:function(e){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){for(var i=[],o=0;o<e.iceServers.length;o++){var a=e.iceServers[o];!a.hasOwnProperty("urls")&&a.hasOwnProperty("url")?(r.deprecated("RTCIceServer.url","RTCIceServer.urls"),(a=JSON.parse(JSON.stringify(a))).urls=a.url,delete a.url,i.push(a)):i.push(e.iceServers[o])}e.iceServers=i}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in e.RTCPeerConnection&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})},shimTrackEventTransceiver:function(e){"object"==typeof e&&e.RTCPeerConnection&&"receiver"in e.RTCTrackEvent.prototype&&!e.RTCTransceiver&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},shimCreateOfferLegacy:function(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){var n=this.getTransceivers().find(function(e){return e.sender.track&&"audio"===e.sender.track.kind});!1===e.offerToReceiveAudio&&n?"sendrecv"===n.direction?n.setDirection("sendonly"):"recvonly"===n.direction&&n.setDirection("inactive"):!0!==e.offerToReceiveAudio||n||this.addTransceiver("audio");var r=this.getTransceivers().find(function(e){return e.sender.track&&"video"===e.sender.track.kind});!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection("sendonly"):"recvonly"===r.direction&&r.setDirection("inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}};e.exports={shimCallbacksAPI:i.shimCallbacksAPI,shimLocalStreamsAPI:i.shimLocalStreamsAPI,shimRemoteStreamsAPI:i.shimRemoteStreamsAPI,shimGetUserMedia:i.shimGetUserMedia,shimRTCIceServerUrls:i.shimRTCIceServerUrls,shimTrackEventTransceiver:i.shimTrackEventTransceiver,shimCreateOfferLegacy:i.shimCreateOfferLegacy}},function(e,t,n){"use strict";var r=n(58),i=n(11);e.exports={shimRTCIceCandidate:function(e){if(!(e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){"object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2));var n=new t(e),i=r.parseCandidate(e.candidate),o=Object.assign(n,i);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o},function(e,t,n){if(e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);var o=function(e){r(n(e))};return this._eventMap=this._eventMap||{},this._eventMap[r]=o,i.apply(this,[e,o])};var o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[n])return o.apply(this,arguments);var r=this._eventMap[n];return delete this._eventMap[n],o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)}})}}(e,"icecandidate",function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t})}},shimCreateObjectURL:function(e){var t=e&&e.URL;if("object"==typeof e&&e.HTMLMediaElement&&"srcObject"in e.HTMLMediaElement.prototype&&t.createObjectURL&&t.revokeObjectURL){var n=t.createObjectURL.bind(t),r=t.revokeObjectURL.bind(t),o=new Map,a=0;t.createObjectURL=function(e){if("getTracks"in e){var t="polyblob:"+ ++a;return o.set(t,e),i.deprecated("URL.createObjectURL(stream)","elem.srcObject = stream"),t}return n(e)},t.revokeObjectURL=function(e){r(e),o.delete(e)};var s=Object.getOwnPropertyDescriptor(e.HTMLMediaElement.prototype,"src");Object.defineProperty(e.HTMLMediaElement.prototype,"src",{get:function(){return s.get.apply(this)},set:function(e){return this.srcObject=o.get(e)||null,s.set.apply(this,[e])}});var c=e.HTMLMediaElement.prototype.setAttribute;e.HTMLMediaElement.prototype.setAttribute=function(){return 2===arguments.length&&"src"===(""+arguments[0]).toLowerCase()&&(this.srcObject=o.get(arguments[1])||null),c.apply(this,arguments)}}}}},function(e,t,n){"use strict";t.a=function(e){var t=e;return e>=Number.MAX_SAFE_INTEGER&&(t=0),t+1}},function(e,t,n){"use strict";(function(e){function r(e,t,r,i,o,a,s){var c=this;this.audioTransferActive=!0,this.videoTransferActive=!0,this.rtc=e,this.id=t,this.isP2P=a,this.remoteTracks=new Map,this.localTracks=new Map,this._addedStreams=[],this.localSSRCs=new Map,this.localUfrag=null,this.remoteUfrag=null,this.signalingLayer=r,this._peerVideoTypeChanged=this._peerVideoTypeChanged.bind(this),this.signalingLayer.on(T.b,this._peerVideoTypeChanged),this._peerMutedChanged=this._peerMutedChanged.bind(this),this.signalingLayer.on(T.a,this._peerMutedChanged),this.options=s,this.peerconnection=new h.a.RTCPeerConnectionType(i,o),this.updateLog=[],this.stats={},this.statsinterval=null,this.maxstats=0;var u=n(152).Interop;this.interop=new u;var l=n(156);this.simulcast=new l({numOfLayers:w,explodeRemoteSimulcast:!1}),this.sdpConsistency=new b.a(this.toString()),this.localSdpMunger=new d.a(this),this.eventEmitter=e.eventEmitter,this.rtxModifier=new g.a,this.trace=function(e,t){E.debug(e,t),c.updateLog.push({time:new Date,type:e,value:t||""})},this.onicecandidate=null,this.peerconnection.onicecandidate=function(e){f.a.isTemasysPluginUsed()||c.trace("onicecandidate",JSON.stringify(e.candidate,null," ")),null!==c.onicecandidate&&c.onicecandidate(e)},this.peerconnection.onaddstream=function(e){return c._remoteStreamAdded(e.stream)},this.peerconnection.onremovestream=function(e){return c._remoteStreamRemoved(e.stream)},this.onsignalingstatechange=null,this.peerconnection.onsignalingstatechange=function(e){c.trace("onsignalingstatechange",c.signalingState),null!==c.onsignalingstatechange&&c.onsignalingstatechange(e)},this.oniceconnectionstatechange=null,this.peerconnection.oniceconnectionstatechange=function(e){c.trace("oniceconnectionstatechange",c.iceConnectionState),null!==c.oniceconnectionstatechange&&c.oniceconnectionstatechange(e)},this.onnegotiationneeded=null,this.peerconnection.onnegotiationneeded=function(e){c.trace("onnegotiationneeded"),null!==c.onnegotiationneeded&&c.onnegotiationneeded(e)},this.ondatachannel=null,this.peerconnection.ondatachannel=function(e){c.trace("ondatachannel"),null!==c.ondatachannel&&c.ondatachannel(e)},!f.a.isFirefox()&&this.maxstats&&(this.statsinterval=window.setInterval(function(){c.peerconnection.getStats(function(e){for(var t=e.result(),n=new Date,r=0;r<t.length;++r)!function(e){t[e].names().forEach(function(r){var i=t[e].id+"-"+r,o=c.stats[i];o||(c.stats[i]=o={startTime:n,endTime:n,values:[],times:[]}),o.values.push(t[e].stat(r)),o.times.push(n.getTime()),o.values.length>c.maxstats&&(o.values.shift(),o.times.shift()),o.endTime=n})}(r)})},1e3)),E.info("Create new "+this)}function i(e){return e&&e.groups&&e.groups.length?e.groups[0].ssrcs[0]:e&&e.ssrcs&&e.ssrcs.length?e.ssrcs[0]:null}t.a=r;var o=n(0),a=(n.n(o),n(15)),s=n.n(a),c=n(3),u=(n.n(c),n(148)),l=n(4),d=n(149),p=n(27),h=n(28),f=n(1),m=n(9),v=n.n(m),g=n(150),y=n(53),b=n(151),S=n(29),_=n(14),T=n(54),C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E=Object(o.getLogger)(e),w=3,R=["1","2","3"],k=function(e){return void 0===e||null===e?"":"type: "+e.type+"\r\n"+e.sdp};r.prototype.getConnectionState=function(){var e=this.peerconnection.iceConnectionState;return"completed"===e?"connected":e},r.prototype._getDesiredMediaDirection=function(e){var t=!0;return e===l.a?t=this.audioTransferActive:e===l.b&&(t=this.videoTransferActive),t?this.hasAnyTracksOfType(e)?"sendrecv":"recvonly":"inactive"},r.prototype.isSimulcastOn=function(){return!this.options.disableSimulcast&&f.a.supportsSimulcast()&&(!f.a.isFirefox()||this.options.enableFirefoxSimulcast)},r.prototype._peerVideoTypeChanged=function(e,t){if(e){var n=this.getRemoteTracks(e,l.b);n.length&&n[0]._setVideoType(t)}else E.error("No endpointID on peerVideoTypeChanged "+this)},r.prototype._peerMutedChanged=function(e,t,n){if(e){var r=this.getRemoteTracks(e,t);r.length&&r[0].setMute(n)}else E.error("On peerMuteChanged - no endpoint ID")},r.prototype.getLocalTracks=function(e){var t=Array.from(this.localTracks.values());return void 0!==e&&(t=t.filter(function(t){return t.getType()===e})),t},r.prototype.hasAnyTracksOfType=function(e){if(!e)throw new Error('"mediaType" is required');return this.getLocalTracks(e).length>0},r.prototype.getRemoteTracks=function(e,t){var n=[],r=e?[e]:this.remoteTracks.keys(),i=!0,o=!1,a=void 0;try{for(var s,c=r[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value,l=this.remoteTracks.get(u);if(l){var d=!0,p=!1,h=void 0;try{for(var f,m=l.keys()[Symbol.iterator]();!(d=(f=m.next()).done);d=!0){var v=f.value;if(!t||t===v){var g=l.get(v);g&&n.push(g)}}}catch(e){p=!0,h=e}finally{try{!d&&m.return&&m.return()}finally{if(p)throw h}}}}}catch(e){o=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw a}}return n},r.prototype.getTrackBySSRC=function(e){if("number"!=typeof e)throw new Error("SSRC "+e+" is not a number");var t=!0,n=!1,r=void 0;try{for(var i,o=this.localTracks.values()[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var a=i.value;if(this.getLocalSSRC(a)===e)return a}}catch(e){n=!0,r=e}finally{try{!t&&o.return&&o.return()}finally{if(n)throw r}}var s=!0,c=!1,u=void 0;try{for(var l,d=this.getRemoteTracks()[Symbol.iterator]();!(s=(l=d.next()).done);s=!0){var p=l.value;if(p.getSSRC()===e)return p}}catch(e){c=!0,u=e}finally{try{!s&&d.return&&d.return()}finally{if(c)throw u}}return null},r.prototype._remoteStreamAdded=function(e){var t=this,n=p.a.getStreamID(e);if(p.a.isUserStreamById(n)){(f.a.isChrome()||f.a.isNWJS()||f.a.isElectron()||f.a.isEdge())&&(e.onaddtrack=function(n){t._remoteTrackAdded(e,n.track)},e.onremovetrack=function(n){t._remoteTrackRemoved(e,n.track)});var r=e.getAudioTracks(),i=!0,o=!1,a=void 0;try{for(var s,c=r[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;this._remoteTrackAdded(e,u)}}catch(e){o=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(o)throw a}}var l=e.getVideoTracks(),d=!0,h=!1,m=void 0;try{for(var v,g=l[Symbol.iterator]();!(d=(v=g.next()).done);d=!0){var y=v.value;this._remoteTrackAdded(e,y)}}catch(e){h=!0,m=e}finally{try{!d&&g.return&&g.return()}finally{if(h)throw m}}}else E.info(this+" ignored remote 'stream added' event for non-user streamid: "+n)},r.prototype._remoteTrackAdded=function(e,t){var n=p.a.getStreamID(e),r=t.kind;if(E.info(this+" remote track added:",n,r),r){var i=new y.a(this.remoteDescription.sdp).media.filter(function(e){return e.startsWith("m="+r)});if(i.length){var o=_.a.findLines(i[0],"a=ssrc:");if((o=o.filter(function(e){var t=f.a.isTemasysPluginUsed()?"mslabel":"msid";return-1!==e.indexOf(t+":"+n)})).length){var a=o[0].substring(7).split(" ")[0],s=Number(a),u=this.signalingLayer.getSSRCOwner(s);if(isNaN(s)||s<0)c.callErrorHandler(new Error("Invalid SSRC: "+a+" for remote track, msid: "+n+" media type: "+r));else if(u){E.log(this+" associated ssrc",u,s);var l=this.signalingLayer.getPeerMediaInfo(u,r);if(l){var d=l.muted,h=l.videoType;this._createRemoteTrack(u,e,t,r,h,s,d)}else c.callErrorHandler(new Error(this+": no peer media info available for "+u))}else c.callErrorHandler(new Error("No SSRC owner known for: "+s+" for remote track, msid: "+n+" media type: "+r))}else c.callErrorHandler(new Error("No SSRC lines for streamId "+n+" for remote track, media type: "+r))}else c.callErrorHandler(new Error("No media lines for type "+r+" found in remote SDP for remote track: "+n))}else c.callErrorHandler(new Error("MediaType undefined for remote track, stream id: "+n))},r.prototype._createRemoteTrack=function(e,t,n,r,i,o,a){var s=new u.a(this.rtc,this.rtc.conference,e,t,n,r,i,o,a,this.isP2P),c=this.remoteTracks.get(e);c||(c=new Map,this.remoteTracks.set(e,c)),c.has(r)&&E.error(this+" overwriting remote track! "+s,e,r),c.set(r,s),this.eventEmitter.emit(v.a.REMOTE_TRACK_ADDED,s)},r.prototype._remoteStreamRemoved=function(e){if(p.a.isUserStream(e)){var t=e.getVideoTracks(),n=!0,r=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value;this._remoteTrackRemoved(e,s)}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}var c=e.getAudioTracks(),u=!0,l=!1,d=void 0;try{for(var h,f=c[Symbol.iterator]();!(u=(h=f.next()).done);u=!0){var m=h.value;this._remoteTrackRemoved(e,m)}}catch(e){l=!0,d=e}finally{try{!u&&f.return&&f.return()}finally{if(l)throw d}}}else{var v=p.a.getStreamID(e);E.info("Ignored remote 'stream removed' event for non-user stream "+v)}},r.prototype._remoteTrackRemoved=function(e,t){var n=p.a.getStreamID(e),r=t&&p.a.getTrackID(t);E.info(this+" - remote track removed: "+n+", "+r),n?r?this._removeRemoteTrackById(n,r)||E.warn(this+" Removed track not found for msid: "+n+",\n track id: "+r):c.callErrorHandler(new Error(this+" remote track removal failed - no track ID")):c.callErrorHandler(new Error(this+" remote track removal failed - no stream ID"))},r.prototype._getRemoteTrackById=function(e,t){var n=!0,r=!1,i=void 0;try{for(var o,a=this.remoteTracks.values()[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value,c=!0,u=!1,l=void 0;try{for(var d,p=s.values()[Symbol.iterator]();!(c=(d=p.next()).done);c=!0){var h=d.value;if(h.getStreamId()==e&&h.getTrackId()==t)return h}}catch(e){u=!0,l=e}finally{try{!c&&p.return&&p.return()}finally{if(u)throw l}}}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}},r.prototype.removeRemoteTracks=function(e){var t=[],n=this.remoteTracks.get(e);if(n){var r=n.get(l.a),i=n.get(l.b);r&&t.push(r),i&&t.push(i),this.remoteTracks.delete(e)}return E.debug(this+" removed remote tracks for "+e+" count: "+t.length),t},r.prototype._removeRemoteTrack=function(e){e.dispose();var t=e.getParticipantId(),n=this.remoteTracks.get(t);n?n.delete(e.getType())||E.error("Failed to remove "+e+" - type mapping messed up ?"):E.error("removeRemoteTrack: no remote tracks map for "+t),this.eventEmitter.emit(v.a.REMOTE_TRACK_REMOVED,e)},r.prototype._removeRemoteTrackById=function(e,t){var n=this._getRemoteTrackById(e,t);return n&&this._removeRemoteTrack(n),n},r.prototype.getLocalSSRC=function(e){var t=this._getSSRC(e.rtcId);return t&&t.ssrcs[0]},r.prototype._injectSsrcGroupForUnifiedSimulcast=function(e){var t=s.a.parse(e.sdp),n=t.media.find(function(e){return"video"===e.type});if(n.simulcast_03){var r=[];if(n.ssrcs.forEach(function(e){"msid"===e.attribute&&r.push(e.id)}),n.ssrcGroups=n.ssrcGroups||[],n.ssrcGroups.find(function(e){return"SIM"===e.semantics}))return e;n.ssrcGroups.push({semantics:"SIM",ssrcs:r.join(" ")})}return new RTCSessionDescription({type:e.type,sdp:s.a.write(t)})};var I={signalingState:function(){return this.peerconnection.signalingState},iceConnectionState:function(){return this.peerconnection.iceConnectionState},localDescription:function(){var e=this.peerconnection.localDescription;return e?(this.trace("getLocalDescription::preTransform",k(e)),f.a.usesUnifiedPlan()&&(e=this.interop.toPlanB(e),this.trace("getLocalDescription::postTransform (Plan B)",k(e)),e=this._injectSsrcGroupForUnifiedSimulcast(e),this.trace("getLocalDescription::postTransform (inject ssrc group)",k(e))),f.a.doesVideoMuteByStreamRemove()&&(e=this.localSdpMunger.maybeAddMutedLocalVideoTracksToSDP(e),E.debug("getLocalDescription::postTransform (munge local SDP)",e)),e=function(e){if(!e)throw new Error("No local description passed in.");var t=new S.a(e.sdp),n=t.selectMedia("audio"),r=!1;n&&"sendrecv"!==n.direction&&(n.direction="sendrecv",r=!0);var i=t.selectMedia("video");return i&&"sendrecv"!==i.direction&&(i.direction="sendrecv",r=!0),r?new RTCSessionDescription({type:e.type,sdp:t.toRawSDP()}):e}(e),e=this.localSdpMunger.transformStreamIdentifiers(e)):(E.debug("getLocalDescription no localDescription found"),{})},remoteDescription:function(){var e=this.peerconnection.remoteDescription;return this.trace("getRemoteDescription::preTransform",k(e)),f.a.usesUnifiedPlan()&&(e=this.interop.toPlanB(e),this.trace("getRemoteDescription::postTransform (Plan B)",k(e))),e||{}}};Object.keys(I).forEach(function(e){Object.defineProperty(r.prototype,e,{get:I[e]})}),r.prototype._getSSRC=function(e){return this.localSSRCs.get(e)},r.prototype.addTrack=function(e){var t=e.rtcId;if(E.info("add "+e+" to: "+this),this.localTracks.has(t))E.error(e+" is already in "+this);else{this.localTracks.set(t,e);var n=e.getOriginalStream();if(n?this._addStream(n):(!f.a.doesVideoMuteByStreamRemove()||e.isAudioTrack()||e.isVideoTrack()&&!e.isMuted())&&E.error(this+" no WebRTC stream for: "+e),f.a.doesVideoMuteByStreamRemove()&&e.isVideoTrack()&&e.isMuted()){var r=this.generateNewStreamSSRCInfo(e);this.sdpConsistency.setPrimarySsrc(r.ssrcs[0]);var i=r.groups.find(function(e){return"SIM"===e.semantics});i&&this.simulcast.setSsrcCache(i.ssrcs);var o=r.groups.filter(function(e){return"FID"===e.semantics});if(o){var a=new Map;o.forEach(function(e){var t=e.ssrcs[0],n=e.ssrcs[1];a.set(t,n)}),this.rtxModifier.setSsrcCache(a)}}}},r.prototype.addTrackUnmute=function(e){if(!this._assertTrackBelongs("addTrackUnmute",e))return!1;E.info("Adding "+e+" as unmute to "+this);var t=e.getOriginalStream();return t?(this._addStream(t),!0):(E.error("Unable to add "+e+" as unmute to "+this+" - no WebRTC stream"),!1)},r.prototype._addStream=function(e){this.peerconnection.addStream(e),this._addedStreams.push(e)},r.prototype._removeStream=function(e){f.a.isFirefox()?this._handleFirefoxRemoveStream(e):this.peerconnection.removeStream(e),this._addedStreams=this._addedStreams.filter(function(t){return t!==e})},r.prototype._assertTrackBelongs=function(e,t){var n=this.localTracks.has(t.rtcId);return n||E.error(e+": "+t+" does not belong to "+this),n},r.prototype.isMediaStreamInPc=function(e){return this._addedStreams.indexOf(e)>-1},r.prototype.removeTrack=function(e){var t=e.getOriginalStream();this.trace("removeStream",e.rtcId,t?t.id:void 0),this._assertTrackBelongs("removeStream",e)&&(this.localTracks.delete(e.rtcId),this.localSSRCs.delete(e.rtcId),t&&(f.a.isFirefox()?this._handleFirefoxRemoveStream(t):this.peerconnection.removeStream(t)))},r.prototype.removeTrackMute=function(e){var t=e.getOriginalStream();return this.trace("removeStreamMute",e.rtcId,t?t.id:null),!!this._assertTrackBelongs("removeStreamMute",e)&&(t?(E.info("Removing "+e+" as mute from "+this),this._removeStream(t),!0):(E.error("removeStreamMute - no WebRTC stream for "+e),!1))},r.prototype._handleFirefoxRemoveStream=function(e){if(e){var t=null,n=null;e.getAudioTracks()&&e.getAudioTracks().length?n=e.getAudioTracks()[0]:e.getVideoTracks()&&e.getVideoTracks().length&&(n=e.getVideoTracks()[0]),n?(this.peerconnection.getSenders().some(function(e){return e.track===n&&(t=e,!0)}),t?this.peerconnection.removeTrack(t):E.log("Cannot remove tracks: no RTPSender.")):E.error("Cannot remove tracks: no tracks.")}},r.prototype.createDataChannel=function(e,t){return this.trace("createDataChannel",e,t),this.peerconnection.createDataChannel(e,t)},r.prototype._ensureSimulcastGroupIsLast=function(e){var t=e.sdp,n=t.indexOf("m=video"),r=t.indexOf("a=ssrc-group:SIM",n),i=t.lastIndexOf("a=ssrc-group");if(-1===r||-1===i||i===r)return e;var o=t.indexOf("\r\n",r),a=t.substring(r,o+2);i=(t=t.replace(a,"")).lastIndexOf("a=ssrc-group");var s=t.indexOf("\r\n",i);return t=t.slice(0,s)+"\r\n"+a.trim()+t.slice(s),new RTCSessionDescription({type:e.type,sdp:t})},r.prototype._adjustLocalMediaDirection=function(e){var t=new S.a(e.sdp),n=!1,r=t.selectMedia("audio");if(r){var i=this._getDesiredMediaDirection(l.a);r.direction!==i&&(r.direction=i,E.info("Adjusted local audio direction to "+i),n=!0)}else E.warn('No "audio" media found int the local description');var o=t.selectMedia("video");if(o){var a=this._getDesiredMediaDirection(l.b);o.direction!==a&&(o.direction=a,E.info("Adjusted local video direction to "+a),n=!0)}else E.warn('No "video" media found in the local description');return n?new RTCSessionDescription({type:e.type,sdp:t.toRawSDP()}):e},r.prototype.setLocalDescription=function(e,t,n){var r=this,i=e;if(this.trace("setLocalDescription::preTransform",k(i)),this.options.disableH264||this.options.preferH264){var o=s.a.parse(i.sdp),a=o.media.find(function(e){return"video"===e.type});this.options.disableH264?_.a.stripVideoCodec(a,"h264"):_.a.preferVideoCodec(a,"h264"),i=new RTCSessionDescription({type:i.type,sdp:s.a.write(o)}),this.trace("setLocalDescription::postTransform (H264)",k(i))}i=this._adjustLocalMediaDirection(i),i=this._ensureSimulcastGroupIsLast(i),f.a.usesUnifiedPlan()&&(i=this.interop.toUnifiedPlan(i),this.trace("setLocalDescription::postTransform (Unified Plan)",k(i))),this.peerconnection.setLocalDescription(i,function(){r.trace("setLocalDescriptionOnSuccess");var e=_.a.getUfrag(i.sdp);e!==r.localUfrag&&(r.localUfrag=e,r.eventEmitter.emit(v.a.LOCAL_UFRAG_CHANGED,r,e)),t()},function(e){r.trace("setLocalDescriptionOnFailure",e),r.eventEmitter.emit(v.a.SET_LOCAL_DESCRIPTION_FAILED,e,r),n(e)})},r.prototype.setAudioTransferActive=function(e){E.debug(this+" audio transfer active: "+e);var t=this.audioTransferActive!==e;return this.audioTransferActive=e,t},r.prototype._insertUnifiedPlanSimulcastReceive=function(e){var t=s.a.parse(e.sdp),n=t.media.find(function(e){return"video"===e.type});return n.rids=[{id:"1",direction:"recv"},{id:"2",direction:"recv"},{id:"3",direction:"recv"}],n.simulcast_03={value:"recv rid="+R.join(";")},new RTCSessionDescription({type:e.type,sdp:s.a.write(t)})},r.prototype.setRemoteDescription=function(e,t,r){var i=this;if(this.trace("setRemoteDescription::preTransform",k(e)),e=this.simulcast.mungeRemoteDescription(e),this.trace("setRemoteDescription::postTransform (simulcast)",k(e)),this.options.preferH264){var o=s.a.parse(e.sdp),a=o.media.find(function(e){return"video"===e.type});_.a.preferVideoCodec(a,"h264"),e=new RTCSessionDescription({type:e.type,sdp:s.a.write(o)})}f.a.usesUnifiedPlan()?(e=new RTCSessionDescription({type:e.type,sdp:this.rtxModifier.stripRtx(e.sdp)}),this.trace("setRemoteDescription::postTransform (stripRtx)",k(e)),e=this.interop.toUnifiedPlan(e),this.trace("setRemoteDescription::postTransform (Plan A)",k(e)),this.isSimulcastOn()&&(e=this._insertUnifiedPlanSimulcastReceive(e),this.trace("setRemoteDescription::postTransform (sim receive)",k(e)))):e=function(e){if("object"!==(void 0===e?"undefined":C(e))||null===e||"string"!=typeof e.sdp)return E.warn("An empty description was passed as an argument."),e;var t=n(15),r=t.parse(e.sdp);void 0!==r&&void 0!==r.media&&Array.isArray(r.media)&&r.media.forEach(function(e){var t=[],n=[];if(void 0!==e.ssrcGroups&&Array.isArray(e.ssrcGroups)&&e.ssrcGroups.forEach(function(e){void 0!==e.semantics&&"FID"===e.semantics&&void 0!==e.ssrcs&&t.push(Number(e.ssrcs.split(" ")[0]))}),Array.isArray(e.ssrcs)){var r=void 0;for(r=0;r<e.ssrcs.length;r++)"object"===C(e.ssrcs[r])&&void 0!==e.ssrcs[r].id&&t.indexOf(e.ssrcs[r].id)>=0&&(n.push(e.ssrcs[r]),delete e.ssrcs[r]);for(r=0;r<e.ssrcs.length;r++)void 0!==e.ssrcs[r]&&n.push(e.ssrcs[r]);e.ssrcs=n}});var i=t.write(r);return new RTCSessionDescription({type:e.type,sdp:i})}(e),f.a.isSafariWithWebrtc()&&(E.debug("Maybe injecting H264 into the remote description"),e=this._injectH264IfNotPresent(e)),this.peerconnection.setRemoteDescription(e,function(){i.trace("setRemoteDescriptionOnSuccess");var n=_.a.getUfrag(e.sdp);n!==i.remoteUfrag&&(i.remoteUfrag=n,i.eventEmitter.emit(v.a.REMOTE_UFRAG_CHANGED,i,n)),t()},function(e){i.trace("setRemoteDescriptionOnFailure",e),i.eventEmitter.emit(v.a.SET_REMOTE_DESCRIPTION_FAILED,e,i),r(e)})},r.prototype._injectH264IfNotPresent=function(e){var t=s.a.parse(e.sdp),n=t.media.find(function(e){return"video"===e.type});if(!n)return E.debug("No videoMLine found, no need to inject H264."),e;if(n.rtp.some(function(e){return"h264"===e.codec.toLowerCase()}))return E.debug("H264 codec found in video mLine, no need to inject."),e;for(var r=n.fmtp,i=n.payloads,o=n.rtp,a=i.toString().split(" "),c=void 0,u=127;u>=96;u--)if(!a.includes(u)){c=u,a.push(u),n.payloads=a.join(" ");break}return void 0===c?(E.error("Could not find valid payload type to inject."),e):(o.push({codec:"H264",payload:c,rate:9e4}),r.push({config:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f",payload:c}),E.debug("Injecting H264 payload type "+c+" into video mLine."),new RTCSessionDescription({type:e.type,sdp:s.a.write(t)}))},r.prototype.setVideoTransferActive=function(e){E.debug(this+" video transfer active: "+e);var t=this.videoTransferActive!==e;return this.videoTransferActive=e,t},r.prototype.generateRecvonlySsrc=function(){var e=_.a.generateSsrc();E.info(this+" generated new recvonly SSRC: "+e),this.sdpConsistency.setPrimarySsrc(e)},r.prototype.clearRecvonlySsrc=function(){E.info("Clearing primary video SSRC!"),this.sdpConsistency.clearVideoSsrcCache()},r.prototype.close=function(){this.trace("stop"),this.signalingLayer.off(T.a,this._peerMutedChanged),this.signalingLayer.off(T.b,this._peerVideoTypeChanged);var e=!0,t=!1,n=void 0;try{for(var r,i=this.remoteTracks.values()[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var o=r.value,a=!0,s=!1,c=void 0;try{for(var u,l=o.values()[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){var d=u.value;this._removeRemoteTrack(d)}}catch(e){s=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(s)throw c}}}}catch(e){t=!0,n=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw n}}this.remoteTracks.clear(),this._addedStreams=[],this.rtc._removePeerConnection(this)||E.error("RTC._removePeerConnection returned false"),null!==this.statsinterval&&(window.clearInterval(this.statsinterval),this.statsinterval=null),E.info("Closing "+this+"..."),this.peerconnection.close()},r.prototype.createAnswer=function(e,t,n){if(f.a.supportsRtpSender()&&this.isSimulcastOn()){var r={encodings:[{rid:"1",scaleResolutionDownBy:4},{rid:"2",scaleResolutionDownBy:2},{rid:"3"}]};this.peerconnection.getSenders().find(function(e){return"video"===e.track.kind}).setParameters(r)}this._createOfferOrAnswer(!1,e,t,n)},r.prototype.createOffer=function(e,t,n){this._createOfferOrAnswer(!0,e,t,n)},r.prototype._createOfferOrAnswer=function(e,t,n,r){var i=this,o=e?"Offer":"Answer";this.trace("create"+o,JSON.stringify(r,null," "));var a=function(r){try{if(i.trace("create"+o+"OnSuccess::preTransform",k(r)),f.a.usesUnifiedPlan()&&(r=i.interop.toPlanB(r),i.trace("create"+o+"OnSuccess::postTransform (Plan B)",k(r)),i.isSimulcastOn()&&(r=i._injectSsrcGroupForUnifiedSimulcast(r),i.trace("create"+o+"OnSuccess::postTransform(inject ssrc group)",k(r)))),f.a.isFirefox()||(i.hasAnyTracksOfType(l.b)||i.sdpConsistency.hasPrimarySsrcCached()||i.generateRecvonlySsrc(),r=new RTCSessionDescription({type:r.type,sdp:i.sdpConsistency.makeVideoPrimarySsrcsConsistent(r.sdp)}),i.trace("create"+o+"OnSuccess::postTransform (make primary audio/video ssrcs consistent)",k(r))),i.isSimulcastOn()&&(r=i.simulcast.mungeLocalDescription(r),i.trace("create"+o+"OnSuccess::postTransform (simulcast)",k(r))),!i.options.disableRtx&&f.a.supportsRtx()&&(r=new RTCSessionDescription({type:r.type,sdp:i.rtxModifier.modifyRtxSsrcs(r.sdp)}),i.trace("create"+o+"OnSuccess::postTransform (rtx modifier)",k(r))),!e){var a=new y.a(i.remoteDescription.sdp),c=new y.a(r.sdp);d=a,p=c,f.a.isChrome()&&d&&p&&d.media&&p.media&&d.media.length===p.media.length&&(p.media.forEach(function(e,t){_.a.findLine(d.media[t],"a=setup:actpass",d.session)&&(p.media[t]=e.replace(/a=setup:active/g,"a=setup:passive"))}),p.raw=p.session+p.media.join("")),r=new RTCSessionDescription({type:r.type,sdp:c.raw})}var u=function(e){var t=new Map,n=new Map;if("object"!==(void 0===e?"undefined":C(e))||null===e||"string"!=typeof e.sdp)return E.warn("An empty description was passed as an argument."),t;var r=s.a.parse(e.sdp);if(!Array.isArray(r.media))return t;var i=!0,o=!1,a=void 0;try{for(var c,u=r.media[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var l=c.value;if(Array.isArray(l.ssrcs)){if(Array.isArray(l.ssrcGroups)){var d=!0,p=!1,h=void 0;try{for(var f,m=l.ssrcGroups[Symbol.iterator]();!(d=(f=m.next()).done);d=!0){var v=f.value;if(void 0!==v.semantics&&void 0!==v.ssrcs){var g=v.ssrcs.split(" ").map(function(e){return parseInt(e,10)}),y=g[0];v.ssrcs=g,n.has(y)||n.set(y,[]),n.get(y).push(v)}}}catch(e){p=!0,h=e}finally{try{!d&&m.return&&m.return()}finally{if(p)throw h}}}var b=!0,S=!1,_=void 0;try{for(var T,w=l.ssrcs[Symbol.iterator]();!(b=(T=w.next()).done);b=!0){var R=T.value;if("msid"===R.attribute){var k=R.value,I=t.get(k);I||(I={ssrcs:[],groups:[],msid:k},t.set(k,I));var P=R.id;if(I.ssrcs.push(P),n.has(P)){var A=n.get(P),O=!0,D=!1,x=void 0;try{for(var N,L=A[Symbol.iterator]();!(O=(N=L.next()).done);O=!0){var M=N.value;I.groups.push(M)}}catch(e){D=!0,x=e}finally{try{!O&&L.return&&L.return()}finally{if(D)throw x}}}}}}catch(e){S=!0,_=e}finally{try{!b&&w.return&&w.return()}finally{if(S)throw _}}}}}catch(e){o=!0,a=e}finally{try{!i&&u.return&&u.return()}finally{if(o)throw a}}return t}(r);E.debug("Got local SSRCs MAP: ",u),i._processLocalSSRCsMap(u),t(r)}catch(e){i.trace("create"+o+"OnError",e),i.trace("create"+o+"OnError",k(r)),E.error("create"+o+"OnError",e,k(r)),n(e)}var d,p},c=function(t){i.trace("create"+o+"OnFailure",t);var r=e?v.a.CREATE_OFFER_FAILED:v.a.CREATE_ANSWER_FAILED;i.eventEmitter.emit(r,t,i),n(t)};e?this.peerconnection.createOffer(a,c,r):this.peerconnection.createAnswer(a,c,r)},r.prototype._processLocalSSRCsMap=function(e){var t=!0,n=!1,r=void 0;try{for(var o,a=this.localTracks.values()[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var s=o.value,c=s.getMSID();if(e.has(c)){var u=e.get(c);if(!u)return void E.error("No SSRC found for: "+c+" in "+this);var l=this.localSSRCs.get(s.rtcId),d=i(u),p=i(l);d!==p?(null===p?E.info("Storing new local SSRC for "+s+" in "+this,u):E.error("Overwriting SSRC for "+s+" "+c+" in "+this+" with: ",u),this.localSSRCs.set(s.rtcId,u),this.eventEmitter.emit(v.a.LOCAL_TRACK_SSRC_UPDATED,s,d)):E.debug("The local SSRC("+d+") for "+s+" "+c+"is still up to date in "+this)}else E.warn("No local track matched with: "+c+" in "+this)}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}},r.prototype.addIceCandidate=function(e,t,n){this.trace("addIceCandidate",JSON.stringify({candidate:e.candidate,sdpMid:e.sdpMid,sdpMLineIndex:e.sdpMLineIndex,usernameFragment:e.usernameFragment},null," ")),this.peerconnection.addIceCandidate(e,t,n)},r.prototype.getStats=function(e,t){f.a.isFirefox()||f.a.isTemasysPluginUsed()||f.a.isReactNative()?this.peerconnection.getStats(null,e,t||function(){}):f.a.isSafariWithWebrtc()||this.peerconnection.getStats(e)},r.prototype.generateNewStreamSSRCInfo=function(e){var t=e.rtcId,n=this._getSSRC(t);if(n&&E.error("Will overwrite local SSRCs for track ID: "+t),this.isSimulcastOn()){n={ssrcs:[],groups:[]};for(var r=0;r<w;r++)n.ssrcs.push(_.a.generateSsrc());n.groups.push({ssrcs:n.ssrcs.slice(),semantics:"SIM"})}else n={ssrcs:[_.a.generateSsrc()],groups:[]};if(!this.options.disableRtx&&f.a.supportsRtx())for(var i=n.ssrcs.length,o=0;o<i;++o){var a=n.ssrcs[o],s=_.a.generateSsrc();n.ssrcs.push(s),n.groups.push({ssrcs:[a,s],semantics:"FID"})}return n.msid=e.storedMSID,this.localSSRCs.set(t,n),n},r.prototype.toString=function(){return"TPC["+this.id+",p2p:"+this.isP2P+"]"}}).call(t,"modules/RTC/TraceablePeerConnection.js")},function(e,t,n){"use strict";(function(e){var r=n(6),i=n(55),o=n(18),a=n(1),s=n(5),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0).getLogger(e),l=n(9),d=!1,p=!1,h=function(e){function t(e,n,r,i,o,a,s,c,u,l){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var d=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,n,i,o,function(){},a,s));if(d.rtc=e,"number"!=typeof c)throw new TypeError("SSRC "+c+" is not a number");return d.ssrc=c,d.ownerEndpointId=r,d.muted=u,d.isP2P=l,d.hasBeenMuted=u,d.rtc&&d.track&&d._bindMuteHandlers(),d}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.a),c(t,[{key:"_bindMuteHandlers",value:function(){var e=this;this.track.addEventListener?(this.track.addEventListener("mute",function(){return e._onTrackMute()}),this.track.addEventListener("unmute",function(){return e._onTrackUnmute()})):this.track.attachEvent&&(this.track.attachEvent("onmute",function(){return e._onTrackMute()}),this.track.attachEvent("onunmute",function(){return e._onTrackUnmute()}))}},{key:"_onTrackMute",value:function(){u.debug('"onmute" event('+Date.now()+"): ",this.getParticipantId(),this.getType(),this.getSSRC()),this.rtc.eventEmitter.emit(l.REMOTE_TRACK_MUTE,this)}},{key:"_onTrackUnmute",value:function(){u.debug('"onunmute" event('+Date.now()+"): ",this.getParticipantId(),this.getType(),this.getSSRC()),this.rtc.eventEmitter.emit(l.REMOTE_TRACK_UNMUTE,this)}},{key:"setMute",value:function(e){this.muted!==e&&(e&&(this.hasBeenMuted=!0),this.stream&&(this.stream.muted=e),this.muted=e,this.emit(o.TRACK_MUTE_CHANGED,this))}},{key:"isMuted",value:function(){return this.muted}},{key:"getParticipantId",value:function(){return this.ownerEndpointId}},{key:"isLocal",value:function(){return!1}},{key:"getSSRC",value:function(){return this.ssrc}},{key:"_setVideoType",value:function(e){this.videoType!==e&&(this.videoType=e,this.emit(o.TRACK_VIDEOTYPE_CHANGED,e))}},{key:"_playCallback",value:function(){var e=this.isVideoTrack()?"video":"audio",t=window.performance.now();console.log("(TIME) Render "+e+":\t",t),this.conference.getConnectionTimes()[e+".render"]=t;var n=window.connectionTimes["obtainPermissions.start"],i=window.connectionTimes["obtainPermissions.end"],o=isNaN(i)||isNaN(n)?0:i-n,a=t-(this.conference.getConnectionTimes()["session.initiate"]-this.conference.getConnectionTimes()["muc.joined"])-o;this.conference.getConnectionTimes()[e+".ttfm"]=a,console.log("(TIME) TTFM "+e+":\t",a),s.a.sendAnalytics(Object(r.E)({media_type:e,muted:this.hasBeenMuted,value:a}))}},{key:"_attachTTFMTracker",value:function(e){d&&this.isAudioTrack()||p&&this.isVideoTrack()||(this.isAudioTrack()&&(d=!0),this.isVideoTrack()&&(p=!0),a.a.isTemasysPluginUsed()?n(37).addEvent(e,"play",this._playCallback.bind(this)):e.addEventListener("canplay",this._playCallback.bind(this)))}},{key:"toString",value:function(){return"RemoteTrack["+this.ownerEndpointId+", "+this.getType()+", p2p: "+this.isP2P+"]"}}]),t}();t.a=h}).call(t,"modules/RTC/JitsiRemoteTrack.js")},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(4)),o=n(29),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=Object(r.getLogger)(e),c=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tpc=t}return a(e,[{key:"_addMutedLocalVideoTracksToSDP",value:function(e){var t=this.tpc.getLocalTracks(i.b);if(!t.length)return!1;1!==t.length&&s.error(this.tpc+" there is more than 1 video track ! Strange things may happen !",t);var n=e.selectMedia("video");if(!n)return s.debug(this.tpc+' unable to hack local video track SDP- no "video" media'),!1;var r=!1,o=!0,a=!1,c=void 0;try{for(var u,l=t[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var d=u.value,p=d.isMuted(),h=d.getOriginalStream(),f=h&&this.tpc.isMediaStreamInPc(h),m=p||!f;if(s.debug(this.tpc+" "+d+" muted: "+p+", is in PeerConnection: "+f+" => should fake sdp ? : "+m),m){var v=this.tpc.isSimulcastOn()?this.tpc.simulcast.ssrcCache:[this.tpc.sdpConsistency.cachedPrimarySsrc];if(v.length){r=!0,n.direction="sendrecv";var g="injected-"+v[0],y=!0,b=!1,S=void 0;try{for(var _,T=v[Symbol.iterator]();!(y=(_=T.next()).done);y=!0){var C=_.value;n.removeSSRC(C),s.debug(this.tpc+" injecting video SSRC: "+C+" for "+d),n.addSSRCAttribute({id:C,attribute:"cname",value:g}),n.addSSRCAttribute({id:C,attribute:"msid",value:d.storedMSID})}}catch(e){b=!0,S=e}finally{try{!y&&T.return&&T.return()}finally{if(b)throw S}}if(v.length>1){var E={ssrcs:v.join(" "),semantics:"SIM"};n.findGroup(E.semantics,E.ssrcs)||(s.debug(this.tpc+" injecting SIM group for "+d,E),n.addSSRCGroup(E))}this.tpc.options.disableRtx||this.tpc.rtxModifier.modifyRtxSsrcs2(n)}else s.error("No SSRCs stored for: "+d+" in "+this.tpc)}}}catch(e){a=!0,c=e}finally{try{!o&&l.return&&l.return()}finally{if(a)throw c}}return r}},{key:"_transformMediaIdentifiers",value:function(e){var t=this.tpc.id,n=!0,r=!1,i=void 0;try{for(var o,a=e.ssrcs[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var c=o.value;switch(c.attribute){case"cname":case"label":case"mslabel":c.value=c.value&&c.value+"-"+t;break;case"msid":if(c.value){var u=c.value.split(" ");if(2===u.length){var l=u[0],d=u[1];c.value=l+"-"+t+" "+d+"-"+t}else s.warn("Unable to munge local MSID- weird format detected: "+c.value)}}}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}}},{key:"maybeAddMutedLocalVideoTracksToSDP",value:function(e){if(!e)throw new Error("No local description passed in.");var t=new o.a(e.sdp);return this._addMutedLocalVideoTracksToSDP(t)?new RTCSessionDescription({type:e.type,sdp:t.toRawSDP()}):e}},{key:"transformStreamIdentifiers",value:function(e){if(!e||!e.sdp||!e.type)return e;var t=new o.a(e.sdp),n=t.selectMedia("audio");n&&this._transformMediaIdentifiers(n);var r=t.selectMedia("video");return r&&this._transformMediaIdentifiers(r),new RTCSessionDescription({type:e.type,sdp:t.toRawSDP()})}}]),e}();t.a=c}).call(t,"modules/RTC/LocalSdpMunger.js")},function(e,t,n){"use strict";(function(e){function r(e,t,n){c.debug("Updating mline to associate "+n+"rtx ssrc with primary stream, "+t.id);var r=t.id,i=t.msid,o=t.cname,a=e.getRtxSSRC(r);a!==n?(a&&(c.debug(r+" was previously associated with rtx"+a+", removing all references to it"),e.removeSSRC(a),c.debug("groups before filtering for "+a),c.debug(e.dumpSSRCGroups()),e.removeGroupsWithSSRC(a)),e.addSSRCAttribute({id:n,attribute:"cname",value:o}),e.addSSRCAttribute({id:n,attribute:"msid",value:i}),e.addSSRCGroup({semantics:"FID",ssrcs:r+" "+n})):c.debug(n+" was already associated with "+r)}var i=n(0),o=(n.n(i),n(29)),a=n(14),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=Object(i.getLogger)(e),u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.correspondingRtxSsrcs=new Map}return s(e,[{key:"clearSsrcCache",value:function(){this.correspondingRtxSsrcs.clear()}},{key:"setSsrcCache",value:function(e){c.debug("Setting ssrc cache to ",e),this.correspondingRtxSsrcs=e}},{key:"modifyRtxSsrcs",value:function(e){var t=new o.a(e),n=t.selectMedia("video");return n?this.modifyRtxSsrcs2(n)?t.toRawSDP():e:(c.debug("No 'video' media found in the sdp: "+e),e)}},{key:"modifyRtxSsrcs2",value:function(e){if("recvonly"===e.direction)return c.debug("RtxModifier doing nothing, video m line is recvonly"),!1;if(e.getSSRCCount()<1)return c.debug("RtxModifier doing nothing, no video ssrcs present"),!1;c.debug("Current ssrc mapping: ",this.correspondingRtxSsrcs);var t=e.getPrimaryVideoSSRCs();c.debug("Parsed primary video ssrcs ",t," making sure all have rtx streams");var n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done);n=!0){var l=s.value,d=e.getSSRCAttrValue(l,"msid"),p=e.getSSRCAttrValue(l,"cname"),h=this.correspondingRtxSsrcs.get(l);if(h)c.debug("Already have an associated rtx ssrc forvideo ssrc "+l+": "+h);else{c.debug("No previously associated rtx ssrc for video ssrc "+l);var f=e.getRtxSSRC(l);f?(c.debug("Rtx stream "+f+" already existed in the sdp as an rtx stream for "+l),h=f):(h=a.a.generateSsrc(),c.debug("Generated rtx ssrc "+h+" for ssrc "+l)),c.debug("Caching rtx ssrc "+h+" for video ssrc "+l),this.correspondingRtxSsrcs.set(l,h)}r(e,{id:l,cname:p,msid:d},h)}}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return!0}},{key:"stripRtx",value:function(e){var t=new o.a(e),n=t.selectMedia("video");if(!n)return c.debug("No 'video' media found in the sdp: "+e),e;if("recvonly"===n.direction)return c.debug("RtxModifier doing nothing, video m line is recvonly"),e;if(n.getSSRCCount()<1)return c.debug("RtxModifier doing nothing, no video ssrcs present"),e;if(!n.containsAnySSRCGroups())return c.debug("RtxModifier doing nothing, no video ssrcGroups present"),e;var r=n.findGroups("FID");n.removeGroupsBySemantics("FID");var i=!0,a=!1,s=void 0;try{for(var u,l=r[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var d=u.value,p=Object(o.c)(d);n.removeSSRC(p)}}catch(e){a=!0,s=e}finally{try{!i&&l.return&&l.return()}finally{if(a)throw s}}return t.toRawSDP()}}]),e}();t.a=u}).call(t,"modules/xmpp/RtxModifier.js")},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(29)),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=Object(r.getLogger)(e),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.clearVideoSsrcCache(),this.logPrefix=t}return o(e,[{key:"clearVideoSsrcCache",value:function(){this.cachedPrimarySsrc=null,this.injectRecvOnly=!1}},{key:"setPrimarySsrc",value:function(e){if("number"!=typeof e)throw new Error("Primary SSRC must be a number!");this.cachedPrimarySsrc=e}},{key:"hasPrimarySsrcCached",value:function(){return Boolean(this.cachedPrimarySsrc)}},{key:"makeVideoPrimarySsrcsConsistent",value:function(e){var t=new i.a(e),n=t.selectMedia("video");if(!n)return a.debug(this.logPrefix+" no 'video' media found in the sdp: "+e),e;if("recvonly"===n.direction)this.cachedPrimarySsrc&&this.injectRecvOnly?n.addSSRCAttribute({id:this.cachedPrimarySsrc,attribute:"cname",value:"recvonly-"+this.cachedPrimarySsrc}):a.info(this.logPrefix+" no SSRC found for the recvonly videostream!");else{var r=n.getPrimaryVideoSsrc();if(!r)return a.info(this.logPrefix+" sdp-consistency couldn't parse new primary ssrc"),e;if(this.cachedPrimarySsrc){a.info(this.logPrefix+" sdp-consistency replacing new ssrc"+r+" with cached "+this.cachedPrimarySsrc),n.replaceSSRC(r,this.cachedPrimarySsrc);var o=!0,s=!1,c=void 0;try{for(var u,l=n.ssrcGroups[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var d=u.value;if("FID"===d.semantics){var p=Object(i.b)(d),h=Object(i.c)(d);p===r&&(d.ssrcs=this.cachedPrimarySsrc+" "+h)}}}catch(e){s=!0,c=e}finally{try{!o&&l.return&&l.return()}finally{if(s)throw c}}}else this.cachedPrimarySsrc=r,a.info(this.logPrefix+" sdp-consistency caching primary ssrc"+this.cachedPrimarySsrc);this.injectRecvOnly=!0}return t.toRawSDP()}}]),e}();t.a=s}).call(t,"modules/xmpp/SdpConsistency.js")},function(e,t,n){t.Interop=n(153)},function(e,t,n){"use strict";function r(){this.cache={mlB2UMap:{},mlU2BMap:{}}}var i=n(154),o=n(155);e.exports=r,r.prototype.candidateToUnifiedPlan=function(e){var t=new RTCIceCandidate(e);return t.sdpMLineIndex=this.cache.mlB2UMap[t.sdpMLineIndex],t},r.prototype.candidateToPlanB=function(e){var t=new RTCIceCandidate(e);if(0===t.sdpMid.indexOf("audio"))t.sdpMid="audio";else{if(0!==t.sdpMid.indexOf("video"))throw new Error("candidate with "+t.sdpMid+" not allowed");t.sdpMid="video"}return t.sdpMLineIndex=this.cache.mlU2BMap[t.sdpMLineIndex],t},r.prototype.getFirstSendingIndexFromAnswer=function(e){if(!this.cache.answer)return null;var t=i.parse(this.cache.answer);if(t&&t.media&&Array.isArray(t.media))for(var n=0;n<t.media.length;n++)if(t.media[n].type==e&&(!t.media[n].direction||"sendrecv"===t.media[n].direction||"sendonly"===t.media[n].direction))return n;return null},r.prototype.toPlanB=function(e){var t=this;if("object"!=typeof e||null===e||"string"!=typeof e.sdp)return console.warn("An empty description was passed as an argument."),e;var n=i.parse(e.sdp);if(void 0===n.media||!Array.isArray(n.media)||0===n.media.length)return console.warn("The description has no media."),e;if(n.media.length<=3&&n.media.every(function(e){return-1!==["video","audio","data"].indexOf(e.mid)}))return console.warn("This description does not look like Unified Plan."),e;for(var r=e.sdp,o=!1,a=0;a<n.media.length;a++)n.media[a].rtp.forEach(function(e){if("NULL"===e.codec){o=!0;var n=i.parse(t.cache.offer);e.codec=n.media[a].rtp[0].codec}});o&&(r=i.write(n)),this.cache[e.type]=r;var s=n.media;n.media=[];var c={},u=[];s.forEach(function(e){if(("string"!=typeof e.rtcpMux||"rtcp-mux"!==e.rtcpMux)&&"inactive"!==e.direction)throw new Error("Cannot convert to Plan B because m-lines without the rtcp-mux attribute were found.");void 0!==c[e.type]&&"inactive"!==c[e.type].direction||(c[e.type]=e)}),s.forEach(function(e){if("application"===e.type)return n.media.push(e),void u.push(e.mid);"object"==typeof e.sources&&Object.keys(e.sources).forEach(function(t){"object"!=typeof c[e.type].sources&&(c[e.type].sources={}),c[e.type].sources[t]=e.sources[t],void 0!==e.msid&&(c[e.type].sources[t].msid=e.msid)}),void 0!==e.ssrcGroups&&Array.isArray(e.ssrcGroups)&&(void 0!==c[e.type].ssrcGroups&&Array.isArray(c[e.type].ssrcGroups)||(c[e.type].ssrcGroups=[]),c[e.type].ssrcGroups=c[e.type].ssrcGroups.concat(e.ssrcGroups)),c[e.type]===e&&(e.mid=e.type,delete e.bundleOnly,delete e.msid,"inactive"!==e.direction&&u.push(e.type),n.media.push(e))}),n.groups.some(function(e){if("BUNDLE"===e.type)return e.mids=u.join(" "),!0}),n.msidSemantic={semantic:"WMS",token:"*"};var l=i.write(n);return new RTCSessionDescription({type:e.type,sdp:l})},r.prototype.toUnifiedPlan=function(e){var t=this;if("object"!=typeof e||null===e||"string"!=typeof e.sdp)return console.warn("An empty description was passed as an argument."),e;var n=i.parse(e.sdp);if(void 0===n.media||!Array.isArray(n.media)||0===n.media.length)return console.warn("The description has no media."),e;if(n.media.length>3||!n.media.every(function(e){return-1!==["video","audio","data"].indexOf(e.mid)}))return console.warn("This description does not look like Plan B."),e;var r=[];n.media.forEach(function(e){r.push(e.mid)});var a,s=!1;if(void 0!==n.groups&&Array.isArray(n.groups)&&(s=n.groups.every(function(e){return"BUNDLE"!==e.type||o.apply(e.mids.sort(),[r.sort()])})),!s)throw new Error("Cannot convert to Unified Plan because m-lines that are not bundled were found.");void 0!==this.cache[e.type]&&(a=i.parse(this.cache[e.type]));var c={audio:{},video:{}},u={},l=0,d=0;if(n.media.forEach(function(n){if(("string"!=typeof n.rtcpMux||"rtcp-mux"!==n.rtcpMux)&&"inactive"!==n.direction)throw new Error("Cannot convert to Unified Plan because m-lines without the rtcp-mux attribute were found.");if("application"!==n.type){var r=n.sources,i=n.ssrcGroups,o=n.candidates,s=n.iceUfrag,p=n.icePwd,h=n.fingerprint,f=n.port;delete n.sources,delete n.ssrcGroups,delete n.candidates,delete n.iceUfrag,delete n.icePwd,delete n.fingerprint,delete n.port,delete n.mid;var m={};void 0!==i&&Array.isArray(i)&&i.forEach(function(e){"SIM"!==e.semantics&&void 0!==e.ssrcs&&Array.isArray(e.ssrcs)&&e.ssrcs.forEach(function(t){void 0===m[t]&&(m[t]=[]),m[t].push(e)})});var v={};"object"==typeof r&&Object.keys(r).forEach(function(i){var g;if("offer"!==e.type||r[i].msid)if(void 0!==m[i]&&Array.isArray(m[i])&&m[i].some(function(e){return e.ssrcs.some(function(e){if("object"==typeof v[e])return g=v[e],!0})}),"object"==typeof g)g.sources[i]=r[i],delete r[i].msid;else{if(g=Object.create(n),v[i]=g,void 0!==r[i].msid&&(g.msid=r[i].msid,delete r[i].msid),g.sources={},g.sources[i]=r[i],g.ssrcGroups=m[i],void 0!==a&&void 0!==a.media&&Array.isArray(a.media)&&a.media.forEach(function(e){"object"==typeof e.sources&&Object.keys(e.sources).forEach(function(t){t===i&&(g.mid=e.mid)})}),void 0===g.mid){if("answer"===e.type)throw new Error("An unmapped SSRC was found.");g.mid=[n.type,"-",i].join("")}g.candidates=o,g.iceUfrag=s,g.icePwd=p,g.fingerprint=h,g.port=f,u[g.mid]=g,t.cache.mlU2BMap[d]=l,void 0===t.cache.mlB2UMap[l]&&(t.cache.mlB2UMap[l]=d),d++}else c[n.type][i]=r[i]}),l++}else u[n.mid]=n}),n.media=[],r=[],"answer"===e.type)for(var p=0;p<a.media.length;p++){var h=a.media[p];void 0===u[h.mid]&&(delete h.msid,delete h.sources,delete h.ssrcGroups,h.direction&&"sendrecv"!==h.direction?"sendonly"===h.direction&&(h.direction="inactive"):h.direction="recvonly"),n.media.push(h),"string"==typeof h.mid&&r.push(h.mid)}else void 0!==a&&void 0!==a.media&&Array.isArray(a.media)&&a.media.forEach(function(e){r.push(e.mid),void 0!==u[e.mid]?n.media.push(u[e.mid]):(delete e.msid,delete e.sources,delete e.ssrcGroups,e.direction&&"sendrecv"!==e.direction||(e.direction="recvonly"),e.direction&&"sendonly"!==e.direction||(e.direction="inactive"),n.media.push(e))}),Object.keys(u).forEach(function(e){-1===r.indexOf(e)&&(r.push(e),"recvonly"===u[e].direction?n.media.some(function(t){if(("sendrecv"===t.direction||"sendonly"===t.direction)&&t.type===u[e].type)return Object.keys(u[e].sources).forEach(function(n){t.sources[n]=u[e].sources[n]}),!0}):n.media.push(u[e]))});["audio","video"].forEach(function(e){if(n&&n.media&&Array.isArray(n.media)){var r=null;if(Object.keys(c[e]).length>0&&null===(r=t.getFirstSendingIndexFromAnswer(e)))for(var i=0;i<n.media.length;i++)if(n.media[i].type===e){r=i;break}if(r&&n.media.length>r){var o=n.media[r];Object.keys(c[e]).forEach(function(t){o.sources&&o.sources[t]&&console.warn("Replacing an existing SSRC."),o.sources||(o.sources={}),o.sources[t]=c[e][t]})}}}),n.groups.some(function(e){if("BUNDLE"===e.type)return e.mids=r.join(" "),!0}),n.msidSemantic={semantic:"WMS",token:"*"};var f=i.write(n);return this.cache[e.type]=f,new RTCSessionDescription({type:e.type,sdp:f})}},function(e,t,n){var r=n(15);t.write=function(e,t){return void 0!==e&&void 0!==e.media&&Array.isArray(e.media)&&e.media.forEach(function(e){void 0!==e.sources&&0!==Object.keys(e.sources).length&&(e.ssrcs=[],Object.keys(e.sources).forEach(function(t){var n=e.sources[t];Object.keys(n).forEach(function(r){e.ssrcs.push({id:t,attribute:r,value:n[r]})})}),delete e.sources),void 0!==e.ssrcGroups&&Array.isArray(e.ssrcGroups)&&e.ssrcGroups.forEach(function(e){void 0!==e.ssrcs&&Array.isArray(e.ssrcs)&&(e.ssrcs=e.ssrcs.join(" "))})}),void 0!==e&&void 0!==e.groups&&Array.isArray(e.groups)&&e.groups.forEach(function(e){void 0!==e.mids&&Array.isArray(e.mids)&&(e.mids=e.mids.join(" "))}),r.write(e,t)},t.parse=function(e){var t=r.parse(e);return void 0!==t&&void 0!==t.media&&Array.isArray(t.media)&&t.media.forEach(function(e){void 0!==e.ssrcs&&Array.isArray(e.ssrcs)&&(e.sources={},e.ssrcs.forEach(function(t){e.sources[t.id]||(e.sources[t.id]={}),e.sources[t.id][t.attribute]=t.value}),delete e.ssrcs),void 0!==e.ssrcGroups&&Array.isArray(e.ssrcGroups)&&e.ssrcGroups.forEach(function(e){"string"==typeof e.ssrcs&&(e.ssrcs=e.ssrcs.split(" "))})}),void 0!==t&&void 0!==t.groups&&Array.isArray(t.groups)&&t.groups.forEach(function(e){"string"==typeof e.mids&&(e.mids=e.mids.split(" "))}),t}},function(e,t){e.exports=function e(t){if(!t)return!1;if(this.length!=t.length)return!1;for(var n=0,r=this.length;n<r;n++)if(this[n]instanceof Array&&t[n]instanceof Array){if(!e.apply(this[n],[t[n]]))return!1}else if(this[n]!=t[n])return!1;return!0}},function(e,t,n){function r(e,t,n){return e.ssrcs.filter(function(e){return e.id===t}).filter(function(e){return e.attribute===n}).map(function(e){return e.value})[0]}function i(e){this.options=e||{},this.options.numOfLayers||(this.options.numOfLayers=d),console.log("SdpSimulcast: using "+this.options.numOfLayers+" layers"),this.ssrcCache=[]}function o(e,t){null!=e&&Array.isArray(e.media)&&e.media.forEach(function(e){"video"===e.type&&t(e)})}function a(e){return e&&null!=e&&e.type&&""!=e.type&&e.sdp&&""!=e.sdp}var s=n(15),c=n(157),u=c.parseSsrcs,l=c.writeSsrcs,d=3;i.prototype.clearSsrcCache=function(){this.ssrcCache=[]},i.prototype.setSsrcCache=function(e){this.ssrcCache=e},i.prototype._parseSimLayers=function(e){var t=e.ssrcGroups&&e.ssrcGroups.find(function(e){return"SIM"===e.semantics});return t?t.ssrcs.split(" ").map(function(e){return parseInt(e)}):[e.ssrcs[0].id]},i.prototype._buildNewToOldSsrcMap=function(e,t){for(var n={},r=0;r<e.length;++r){var i=e[r],o=t[r]||null;n[i]=o}return n},i.prototype._fillInSourceDataFromCache=function(e){console.log("SdpSimulcast restoring from cache: ",this.ssrcCache);var t=this._parseSimLayers(e);console.log("SdpSimulcast Parsed new sim ssrcs: ",t);var n=r(e,t[0],"msid"),i=r(e,t[0],"cname"),o=this._buildNewToOldSsrcMap(t,this.ssrcCache);console.log("SdpSimulcast built replacement map: ",o);var a=this.ssrcCache.filter(function(e){return-1===Object.values(o).indexOf(e)});return console.log("SdpSimulcast built ssrcs to add: ",a),e.ssrcs.forEach(function(e){o[e.id]&&(e.id=o[e.id])}),a.forEach(function(t){e.ssrcs.push({id:t,attribute:"msid",value:n}),e.ssrcs.push({id:t,attribute:"cname",value:i})}),e.ssrcGroups=e.ssrcGroups||[],e.ssrcGroups.push({semantics:"SIM",ssrcs:this.ssrcCache.join(" ")}),e},i.prototype._generateSourceData=function(e,t){for(var n,i,o=r(e,t,"msid"),a=r(e,t,"cname"),s=[],c=0;c<this.options.numOfLayers-1;++c){var u=Math.floor(4294967295*Math.random())+0;i=u,(n=e).ssrcs.push({id:i,attribute:"cname",value:a}),n.ssrcs.push({id:i,attribute:"msid",value:o}),s.push(u)}return e.ssrcGroups=e.ssrcGroups||[],e.ssrcGroups.push({semantics:"SIM",ssrcs:t+" "+s.join(" ")}),e},i.prototype._restoreSimulcast=function(e){var t,n=e.ssrcs&&e.ssrcs.map(function(e){return e.id}).filter(function(e,t,n){return n.indexOf(e)===t}).length||0,r=e.ssrcGroups&&e.ssrcGroups.length||0;if(0===n||n>2)return e;if(2==n&&0===r)return e;if(1===n)t=e.ssrcs[0].id;else{var i=e.ssrcGroups.filter(function(e){return"FID"===e.semantics})[0];if(!i)return e;t=parseInt(i.ssrcs.split(" ")[0])}return console.log("SdpSimulcast: current ssrc cache: ",this.ssrcCache),console.log("SdpSimulcast: parsed primary ssrc "+t),-1!==this.ssrcCache.indexOf(t)?(console.log("SdpSimulcast: Have seen primary ssrc before, filling in data from cache"),e=this._fillInSourceDataFromCache(e)):(console.log("SdpSimulcast: Have not seen primary ssrc before, generating source data"),e=this._generateSourceData(e,t)),this.ssrcCache=this._parseSimLayers(e),e},i.prototype.mungeRemoteDescription=function(e){if(!a(e))return e;var t=s.parse(e.sdp),n=this;return o(t,function(e){var t;n.options.explodeRemoteSimulcast?function(e){if(e&&Array.isArray(e.ssrcGroups))for(var t=u(e),n=[],r=e.ssrcGroups.length;r--;)if("SIM"===e.ssrcGroups[r].semantics){for(var i=e.ssrcGroups[r].ssrcs.split(" "),o=0;o<i.length;o++){var a=i[o];n.push(a);var s=t[a].msid.split(" ");t[a].msid=[s[0],"/",o," ",s[1],"/",o].join(""),t[a].cname=[t[a].cname,"/",o].join(""),e.ssrcGroups.forEach(function(e){if("SIM"!==e.semantics){var r=e.ssrcs.split(" ");-1!==r.indexOf(a)&&r.forEach(function(e){t[e].msid=t[a].msid,t[e].cname=t[a].cname,e!==a&&n.push(e)})}})}e.ssrcs=l(t,n),e.ssrcGroups.splice(r,1)}}(e):function(e){if(e&&Array.isArray(e.ssrcGroups)){var t=u(e);e.ssrcGroups.forEach(function(n){if("SIM"===n.semantics){console.info("Imploding SIM group: "+n.ssrcs),n.nuke=!0;for(var r=n.ssrcs.split(" "),i=1;i<r.length;i++){var o=r[i];delete t[o],e.ssrcGroups.forEach(function(e){if("SIM"!==e.semantics){var n=e.ssrcs.split(" ");-1!==n.indexOf(o)&&(n.forEach(function(e){delete t[e]}),e.nuke=!0)}})}}}),e.ssrcs=l(t);for(var n=e.ssrcGroups.length;n--;)e.ssrcGroups[n].nuke&&e.ssrcGroups.splice(n,1)}else console.info("Halt: There are no SSRC groups in the remote description.")}(e),n.ssrcCache.length<1?function(e){if(e&&Array.isArray(e.invalid))for(var t=e.invalid.length;t--;)"x-google-flag:conference"==e.invalid[t].value&&e.invalid.splice(t,1)}(e):(t=e)&&(Array.isArray(t.invalid)||(t.invalid=[]),t.invalid.some(function(e){return"x-google-flag:conference"===e.value})||t.invalid.push({value:"x-google-flag:conference"}))}),new RTCSessionDescription({type:e.type,sdp:s.write(t)})},i.prototype.mungeLocalDescription=function(e){if(!a(e))return e;var t=s.parse(e.sdp),n=this;return o(t,function(e){"recvonly"!=e.direction&&"inactive"!=e.direction&&n._restoreSimulcast(e)}),new RTCSessionDescription({type:e.type,sdp:s.write(t)})},e.exports=i},function(e,t){t.writeSsrcs=function(e,t){var n=[];if(void 0!==e&&0!==Object.keys(e).length){Array.isArray(t)||(t=[]);for(var r=0;r<t.length;r++){var i=t[r],o=e[i];Object.keys(o).forEach(function(e){n.push({id:i,attribute:e,value:o[e]})})}Object.keys(e).forEach(function(r){if(r=parseInt(r),!(t.indexOf(r)>=0)){var i=e[r];Object.keys(i).forEach(function(e){n.push({id:r,attribute:e,value:i[e]})})}})}return n},t.parseSsrcs=function(e){var t={};return void 0!==e.ssrcs&&Array.isArray(e.ssrcs)&&e.ssrcs.forEach(function(e){t[e.id]||(t[e.id]={}),t[e.id][e.attribute]=e.value}),t}},function(e,t,n){"use strict";var r=n(7),i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._callback=n,this._eventFired=!1,t.statistics.addAudioLevelListener(this._audioLevel.bind(this)),t.on(r.TRACK_MUTE_CHANGED,this._trackMuteChanged.bind(this)),t.on(r.TRACK_ADDED,this._trackAdded.bind(this))}return i(e,[{key:"_audioLevel",value:function(e,t,n,r){r&&this.audioTrack&&!this._eventFired&&this.audioTrack.isMuted()&&n>.6&&(this._eventFired=!0,this._callback())}},{key:"_isLocalAudioTrack",value:function(e){return e.isAudioTrack()&&e.isLocal()}},{key:"_trackAdded",value:function(e){this._isLocalAudioTrack(e)&&(this.audioTrack=e)}},{key:"_trackMuteChanged",value:function(e){this._isLocalAudioTrack(e)&&e.isMuted()&&(this._eventFired=!1)}}]),e}();t.a=o},function(e,t,n){function r(){this.audioRecorder=new o,this.transcriptionService=new a,this.counter=null,this.startTime=null,this.transcription=null,this.callback=null,this.results=[],this.state=s,this.lineLength=0}function i(e){for(var t=0;t<e.length;t++)0===e[t].length&&e.splice(t,1);return e.length>0}var o=n(59),a=n(161),s="before",c="recording",u="transcribing",l="finished";r.prototype.start=function(){if(this.state!==s)throw new Error("The transcription can only start when it's in the \""+s+'" state. It\'s currently in the "'+this.state+'" state');this.state=c,this.audioRecorder.start(),this.startTime=new Date},r.prototype.stop=function(e){var t=this;if(this.state!==c)throw new Error("The transcription can only stop when it's in the \""+c+'" state. It\'s currently in the "'+this.state+'" state');console.log("stopping recording and sending audio files"),this.audioRecorder.stop();var n=function(e,t){if(console.log("retrieved an answer from the transcription service. The answer has an array of length: "+t.wordArray.length),t.wordArray.length>0){var n=t.startTime.getUTCMilliseconds()-e.startTime.getUTCMilliseconds();n<0&&(n=0);var r="[";t.wordArray.forEach(function(e){e.begin+=n,e.end+=n,r+=e.word+","}),r+="]",console.log(r),t.wordArray.name=t.name}e.results.push(t.wordArray),e.counter--,console.log("current counter: "+e.counter),e.maybeMerge()}.bind(null,this);this.audioRecorder.getRecordingResults().forEach(function(e){t.transcriptionService.send(e,n),t.counter++}),this.state=u,this.callback=e},r.prototype.maybeMerge=function(){this.state===u&&0===this.counter&&this.merge()},r.prototype.merge=function(){var e=this;console.log("starting merge process!\n The length of the array: "+this.results.length),this.transcription="";var t=this.results,n=[];i(t),t.forEach(function(e){return function(e,t){if(0===e.length)e.push(t);else{if(e[e.length-1].begin<=t.begin)return void e.push(t);for(var n=0;n<e.length;n++)if(t.begin<e[n].begin)return void e.splice(n,0,t);e.push(t)}}(n,e)});for(;i(t);)!function(){var n=t[0];t.forEach(function(e){e[0].begin<n[0].begin&&(n=e)});var r=n.shift();e.updateTranscription(r,n.name);for(;n.length>0&&"break"!==function(){var i=!1,o=n[0].begin;if(t.forEach(function(e){e[0].begin<o&&(i=!0)}),i)return"break";r=n.shift(),e.updateTranscription(r,null)}(););}();this.state=l,this.callback&&this.callback(this.transcription)},r.prototype.updateTranscription=function(e,t){void 0!==t&&null!==t&&(this.transcription+="\n"+t+":",this.lineLength=t.length+1),this.lineLength+e.word.length>80&&(this.transcription+="\n ",this.lineLength=4),this.transcription+=" "+e.word,this.lineLength+=e.word.length+1},r.prototype.addTrack=function(e){this.audioRecorder.addTrack(e)},r.prototype.removeTrack=function(e){this.audioRecorder.removeTrack(e)},r.prototype.getTranscription=function(){if(this.state!==l)throw new Error("The transcription can only be retrieved when it's in the \""+l+'" state. It\'s currently in the "'+this.state+'" state');return this.transcription},r.prototype.getState=function(){return this.state},r.prototype.reset=function(){this.state=s,this.counter=null,this.transcription=null,this.startTime=null,this.callback=null,this.results=[],this.lineLength=0},e.exports=r},function(e,t){e.exports=function(e,t,n,r){this.blob=e,this.name=t,this.startTime=n,this.wordArray=r}},function(e,t,n){var r=n(162),i=n(163),o=n(59),a=function(){this.url=function(){var e="config does not contain an url to a Sphinx4 https server";if(void 0===config.sphinxURL)console.log(e);else{var t=config.sphinxURL;if(void 0!==t.includes&&t.includes("https://"))return t;console.log(e)}}()};a.prototype=Object.create(r.prototype),a.constructor=a,a.prototype.sendRequest=function(e,t){console.log("sending an audio file to "+this.url),console.log("the audio file being sent: "+e);var n=new XMLHttpRequest;n.onreadystatechange=function(){if(n.readyState===XMLHttpRequest.DONE&&200===n.status)t(n.responseText);else if(n.readyState===XMLHttpRequest.DONE)throw new Error("unable to accept response from sphinx server. status: "+n.status)},n.open("POST",this.url),n.setRequestHeader("Content-Type",o.determineCorrectFileType()),n.send(e),console.log("send "+e)},a.prototype.formatResponse=function(e){var t=JSON.parse(e).objects;t.shift();var n=[];return t.forEach(function(e){return e.filler||n.push(new i(e.word,e.start,e.end))}),n},a.prototype.verify=function(e){if(console.log("response from server:"+e.toString()),"string"!=typeof e)return!1;var t=void 0;try{t=JSON.parse(e)}catch(e){return console.log(e),!1}if(void 0===t.objects)return!1;var n=t.objects;return!(!n[0]||!n[0]["session-id"])},e.exports=a},function(e,t){var n=function(){throw new Error("TranscriptionService is abstract and cannot becreated")};n.prototype.send=function(e,t){var n=this;this.sendRequest(e.blob,function(r){n.verify(r)?e.wordArray=n.formatResponse(r):(console.log("the retrieved response from the server is not valid!"),e.wordArray=[]),t(e)})},n.prototype.sendRequest=function(e,t){throw new Error("TranscriptionService.sendRequest is abstract")},n.prototype.formatResponse=function(e){throw new Error("TranscriptionService.format is abstract")},n.prototype.verify=function(e){throw new Error("TranscriptionService.verify is abstract")},e.exports=n},function(e,t){var n=function(e,t,n){this.word=e,this.begin=t,this.end=n};n.prototype.getWord=function(){return this.word},n.prototype.getBeginTime=function(){return this.begin},n.prototype.getEndTime=function(){return this.end},e.exports=n},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(165)),o=n(30),a=n(8),s=n.n(a),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=Object(r.getLogger)(e),l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.chatRoom=t,this.eventEmitter=t.eventEmitter,u.debug("creating VideoSIPGW"),this.sessions={},this.sessionStateChangeListener=this.sessionStateChanged.bind(this),t.addPresenceListener("jibri-sip-status",this.handleJibriSIPStatus.bind(this)),t.addPresenceListener("jibri-sip-call-state",this.handleJibriSIPState.bind(this))}return c(e,[{key:"handleJibriSIPStatus",value:function(e){var t=e.attributes;if(t){u.debug("Handle video sip gw status : ",t);var n=t.status;n===this.status||n!==o.STATUS_UNDEFINED&&n!==o.STATUS_AVAILABLE&&n!==o.STATUS_BUSY||(this.status=n,this.eventEmitter.emit(s.a.VIDEO_SIP_GW_AVAILABILITY_CHANGED,this.status))}}},{key:"handleJibriSIPState",value:function(e){var t=e.attributes;if(t){u.debug("Handle video sip gw state : ",t);var n=t.state;if(n!==this.state)switch(n){case o.STATE_ON:case o.STATE_OFF:case o.STATE_PENDING:case o.STATE_RETRYING:case o.STATE_FAILED:var r=t.sipaddress;if(!r)return;var i=this.sessions[r];i?i.setState(n):u.warn("Video SIP GW session not found:",r)}}}},{key:"createVideoSIPGWSession",value:function(e,t){if(this.sessions[e])return u.warn("There was already a Video SIP GW session for address",e),new Error(o.ERROR_SESSION_EXISTS);var n=new i.a(e,t,this.chatRoom);return n.addStateListener(this.sessionStateChangeListener),this.sessions[e]=n,n}},{key:"sessionStateChanged",value:function(e){var t=e.address;if(e.newState===o.STATE_OFF||e.newState===o.STATE_FAILED){var n=this.sessions[t];if(!n)return void u.error("Missing Video SIP GW session with address:",t);n.removeStateListener(this.sessionStateChangeListener),delete this.sessions[t]}this.eventEmitter.emit(s.a.VIDEO_SIP_GW_SESSION_STATE_CHANGED,e)}}]),e}();t.a=l}).call(t,"modules/videosipgw/VideoSIPGW.js")},function(e,t,n){"use strict";(function(e){var r=n(0),i=(n.n(r),n(2)),o=(n.n(i),n(10)),a=n(30),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=Object(r.getLogger)(e),u="STATE_CHANGED",l=function(e){function t(e,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return i.sipAddress=e,i.displayName=n,i.chatRoom=r,i.state=void 0,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.a),s(t,[{key:"stop",value:function(){this.state!==a.STATE_OFF&&this.state!==a.STATE_FAILED?this._sendJibriIQ("stop"):c.warn("Video SIP GW session already stopped or failed!")}},{key:"start",value:function(){this.state!==a.STATE_ON&&this.state!==a.STATE_OFF&&this.state!==a.STATE_PENDING&&this.state!==a.STATE_RETRYING?this._sendJibriIQ("start"):c.warn("Video SIP GW session already started!")}},{key:"setState",value:function(e){if(e!==this.state){var t=this.state;this.state=e,this.eventEmitter.emit(u,{address:this.sipAddress,oldState:t,newState:this.state,displayName:this.displayName})}}},{key:"addStateListener",value:function(e){this.addListener(u,e)}},{key:"removeStateListener",value:function(e){this.removeListener(u,e)}},{key:"_sendJibriIQ",value:function(e){var t=this,n={xmlns:"http://jitsi.org/protocol/jibri",action:e,sipaddress:this.sipAddress};n.displayname=this.displayName;var r=Object(i.$iq)({to:this.chatRoom.focusMucJid,type:"set"}).c("jibri",n).up();c.debug(e+" video SIP GW session",r.nodeTree),this.chatRoom.connection.sendIQ(r,function(){},function(n){c.error("Failed to "+e+" video SIP GW session, error: ",n),t.setState(a.STATE_FAILED)})}}]),t}();t.a=l}).call(t,"modules/videosipgw/JitsiVideoSIPGWSession.js")},function(e,t,n){"use strict";var r=n(7),i=n(167),o=n.n(i),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.stats={users:{},dominantSpeakerId:null};var n=t.myUserId();this.stats.users[n]=new o.a(n,null,!0),t.addEventListener(r.DOMINANT_SPEAKER_CHANGED,this._onDominantSpeaker.bind(this)),t.addEventListener(r.USER_JOINED,this._onUserJoin.bind(this)),t.addEventListener(r.USER_LEFT,this._onUserLeave.bind(this)),t.addEventListener(r.DISPLAY_NAME_CHANGED,this._onDisplayNameChange.bind(this))}return a(e,[{key:"_onDominantSpeaker",value:function(e){var t=this.stats.users[this.stats.dominantSpeakerId],n=this.stats.users[e];t&&t.setIsDominantSpeaker(!1),n&&n.setIsDominantSpeaker(!0),this.stats.dominantSpeakerId=e}},{key:"_onUserJoin",value:function(e,t){var n=this.stats.users[e];n||(n=this.stats.users[e]=new o.a(e,t.getDisplayName()))}},{key:"_onUserLeave",value:function(e){var t=this.stats.users[e];t&&t.markAsHasLeft()}},{key:"_onDisplayNameChange",value:function(e,t){var n=this.stats.users[e];n&&n.setDisplayName(t)}},{key:"getStats",value:function(){return this.stats.users}}]),e}();t.a=s},function(e,t){var n=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._userId=t,this.setDisplayName(n),this._isLocalStats=r||!1,this.setIsDominantSpeaker(!1),this.totalDominantSpeakerTime=0,this._dominantSpeakerStart=null,this._hasLeft=!1}return n(e,[{key:"getUserId",value:function(){return this._userId}},{key:"getDisplayName",value:function(){return this.displayName}},{key:"setDisplayName",value:function(e){this.displayName=e}},{key:"isLocalStats",value:function(){return this._isLocalStats}},{key:"isDominantSpeaker",value:function(){return this._isDominantSpeaker}},{key:"setIsDominantSpeaker",value:function(e){if(!this._isDominantSpeaker&&e)this._dominantSpeakerStart=Date.now();else if(this._isDominantSpeaker&&!e){var t=Date.now()-(this._dominantSpeakerStart||0);this.totalDominantSpeakerTime+=t,this._dominantSpeakerStart=null}this._isDominantSpeaker=e}},{key:"getTotalDominantSpeakerTime",value:function(){var e=this.totalDominantSpeakerTime;return this._isDominantSpeaker&&(e+=Date.now()-this._dominantSpeakerStart),e}},{key:"hasLeft",value:function(){return this._hasLeft}},{key:"markAsHasLeft",value:function(){this._hasLeft=!0,this.setIsDominantSpeaker(!1)}}]),e}();e.exports=r},function(e,t,n){"use strict";function r(e,t){var n=t.find(function(t){return"audiooutput"===t.kind&&t.deviceId===e});n&&d.a.sendActiveDeviceListEvent(c.a.getEventDataForActiveDevice(n))}var i=n(16),o=n.n(i),a=n(4),s=n(1),c=n(27),u=n(9),l=n.n(u),d=n(5),p=n(60),h=new o.a,f={enumerateDevices:function(e){c.a.enumerateDevices(e)},isDeviceListAvailable:function(){return c.a.isDeviceListAvailable()},isDeviceChangeAvailable:function(e){return c.a.isDeviceChangeAvailable(e)},isDevicePermissionGranted:function(e){var t=c.a.getDeviceAvailability();switch(e){case a.b:return!0===t.video;case a.a:return!0===t.audio;default:return!0===t.video&&!0===t.audio}},isMultipleAudioInputSupported:function(){return!s.a.isFirefox()},getAudioOutputDevice:function(){return c.a.getAudioOutputDevice()},setAudioOutputDevice:function(e){var t=c.a.getCurrentlyAvailableMediaDevices();return t&&t.length>0&&r(e,c.a.getCurrentlyAvailableMediaDevices()),c.a.setAudioOutputDevice(e)},addEventListener:function(e,t){h.addListener(e,t)},removeEventListener:function(e,t){h.removeListener(e,t)},emitEvent:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];h.emit.apply(h,[e].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(n)))},supportsVideo:function(){return s.a.supportsVideo()}};c.a.addListener(l.a.DEVICE_LIST_CHANGED,function(e){return h.emit(p.DEVICE_LIST_CHANGED,e)}),c.a.addListener(l.a.DEVICE_LIST_AVAILABLE,function(e){return r(f.getAudioOutputDevice(),e)}),t.a=f},function(e,t,n){"use strict";(function(e){var r=n(1),i=n(0).getLogger(e),o={getVideoElementName:function(){return r.a.isTemasysPluginUsed()?"object":"video"},findVideoElement:function(e){var t=o.getVideoElementName();if(!r.a.isTemasysPluginUsed())return $(e).find(t)[0];var n=$(e).find(" "+t+'>param[value="video"]');return n.length?(n.length>1&&i.warn("Container with more than one video elements: ",e),n.parent()[0]):void 0},isResizeEventSupported:function(){return!r.a.isTemasysPluginUsed()},setVolume:function(e,t){r.a.isIExplorer()||(e.volume=t)},setAutoPlay:function(e,t){r.a.isIExplorer()||(e.autoplay=t)}};t.a=o}).call(t,"modules/RTC/RTCUIHelper.js")}])});
//# sourceMappingURL=lib-jitsi-meet.min.map