| 1234567891011121314151617181920212223 |
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.UCloudRTC=t():e.UCloudRTC=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=27)}([function(e,t,r){"use strict";var n=r(11),o=r(33),i=Object.prototype.toString;function s(e){return"[object Array]"===i.call(e)}function a(e){return null!==e&&"object"==typeof e}function c(e){return"[object Function]"===i.call(e)}function u(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===i.call(e)},isBuffer:o,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:c,isStream:function(e){return a(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:u,merge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]=r}for(var n=0,o=arguments.length;n<o;n++)u(arguments[n],r);return t},deepMerge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]="object"==typeof r?e({},r):r}for(var n=0,o=arguments.length;n<o;n++)u(arguments[n],r);return t},extend:function(e,t,r){return u(t,(function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t,r){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.debug=0]="debug",e[e.info=1]="info",e[e.warn=2]="warn",e[e.error=3]="error"}(n=t.ENUM_LOG_LEVEL||(t.ENUM_LOG_LEVEL={}));var o=n.error,i=function(){function e(e){this.level=o,null!=e&&(this.level=e)}return e.prototype.setLogLevel=function(e){switch(e){case"debug":this.level=n.debug;break;case"info":this.level=n.info;break;case"warn":this.level=n.warn;break;case"error":default:this.level=n.error}},e.prototype._log=function(){var e=Array.prototype.slice.call(arguments);this.onLog(JSON.stringify(e)),console.info.apply(console,e)},e.prototype._error=function(){var e=Array.prototype.slice.call(arguments);this.onLog(JSON.stringify(e)),console.error.apply(console,e)},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.level<=n.debug&&this._log.apply(this,[new Date+" [DEBUG]: "].concat(e))},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.level<=n.info&&this._log.apply(this,[new Date+" [INFO]: "].concat(e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.level<=n.warn&&this._log.apply(this,[new Date+" [WARN]: "].concat(e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.level<=n.error&&this._error.apply(this,[new Date+" [ERROR]: "].concat(e))},e.prototype.onLog=function(e){},e}();t.Logger=i,t.default=new i},function(e,t,r){"use strict";var n={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},n.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},n.getDescription=function(e){var t=n.splitSections(e);return t&&t[0]},n.getMediaSections=function(e){var t=n.splitSections(e);return t.shift(),t},n.matchPrefix=function(e,t){return n.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},n.parseCandidate=function(e){for(var t,r={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],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:r[t[n]]=t[n+1]}return r},n.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.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&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.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},n.parseIceOptions=function(e){return e.substr(14).split(" ")},n.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},n.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},n.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]}},n.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},n.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),o=0;o<n.length;o++)r[(t=n[o].trim().split("="))[0].trim()]=t[1];return r},n.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},n.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},n.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},n.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},n.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},n.getMid=function(e){var t=n.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},n.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},n.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:n.matchPrefix(e+t,"a=fingerprint:").map(n.parseFingerprint)}},n.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},n.getIceParameters=function(e,t){var r=n.splitLines(e);return{usernameFragment:(r=r.concat(n.splitLines(t))).filter((function(e){return 0===e.indexOf("a=ice-ufrag:")}))[0].substr(12),password:r.filter((function(e){return 0===e.indexOf("a=ice-pwd:")}))[0].substr(10)}},n.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},n.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=n.splitLines(e)[0].split(" "),o=3;o<r.length;o++){var i=r[o],s=n.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(s){var a=n.parseRtpMap(s),c=n.matchPrefix(e,"a=fmtp:"+i+" ");switch(a.parameters=c.length?n.parseFmtp(c[0]):{},a.rtcpFeedback=n.matchPrefix(e,"a=rtcp-fb:"+i+" ").map(n.parseRtcpFb),t.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(a.name.toUpperCase())}}}return n.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(n.parseExtmap(e))})),t},n.writeRtpDescription=function(e,t){var r="";r+="m="+e+" ",r+=t.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){r+=n.writeRtpMap(e),r+=n.writeFmtp(e),r+=n.writeRtcpFb(e)}));var o=0;return t.codecs.forEach((function(e){e.maxptime>o&&(o=e.maxptime)})),o>0&&(r+="a=maxptime:"+o+"\r\n"),r+="a=rtcp-mux\r\n",t.headerExtensions&&t.headerExtensions.forEach((function(e){r+=n.writeExtmap(e)})),r},n.parseRtpEncodingParameters=function(e){var t,r=[],o=n.parseRtpParameters(e),i=-1!==o.fecMechanisms.indexOf("RED"),s=-1!==o.fecMechanisms.indexOf("ULPFEC"),a=n.matchPrefix(e,"a=ssrc:").map((function(e){return n.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=a.length>0&&a[0].ssrc,u=n.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(t=u[0][1]),o.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var n={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&t&&(n.rtx={ssrc:t}),r.push(n),i&&((n=JSON.parse(JSON.stringify(n))).fec={ssrc:c,mechanism:s?"red+ulpfec":"red"},r.push(n))}})),0===r.length&&c&&r.push({ssrc:c});var d=n.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},n.parseRtcpParameters=function(e){var t={},r=n.matchPrefix(e,"a=ssrc:").map((function(e){return n.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var o=n.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=o.length>0,t.compound=0===o.length;var i=n.matchPrefix(e,"a=rtcp-mux");return t.mux=i.length>0,t},n.parseMsid=function(e){var t,r=n.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(t=r[0].substr(7).split(" "))[0],track:t[1]};var o=n.matchPrefix(e,"a=ssrc:").map((function(e){return n.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return o.length>0?{stream:(t=o[0].value.split(" "))[0],track:t[1]}:void 0},n.parseSctpDescription=function(e){var t,r=n.parseMLine(e),o=n.matchPrefix(e,"a=max-message-size:");o.length>0&&(t=parseInt(o[0].substr(19),10)),isNaN(t)&&(t=65536);var i=n.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:parseInt(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};if(n.matchPrefix(e,"a=sctpmap:").length>0){var s=n.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:t}}},n.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},n.generateSessionId=function(){return Math.random().toString().substr(2,21)},n.writeSessionBoilerplate=function(e,t,r){var o=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||n.generateSessionId())+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},n.writeMediaSection=function(e,t,r,o){var i=n.writeRtpDescription(e.kind,t);if(i+=n.writeIceParameters(e.iceGatherer.getLocalParameters()),i+=n.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),i+="a=mid:"+e.mid+"\r\n",e.direction?i+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?i+="a=sendrecv\r\n":e.rtpSender?i+="a=sendonly\r\n":e.rtpReceiver?i+="a=recvonly\r\n":i+="a=inactive\r\n",e.rtpSender){var s="msid:"+o.id+" "+e.rtpSender.track.id+"\r\n";i+="a="+s,i+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(i+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,i+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return i+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+n.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(i+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+n.localCName+"\r\n"),i},n.getDirection=function(e,t){for(var r=n.splitLines(e),o=0;o<r.length;o++)switch(r[o]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[o].substr(2)}return t?n.getDirection(t):"sendrecv"},n.getKind=function(e){return n.splitLines(e)[0].split(" ")[0].substr(2)},n.isRejected=function(e){return"0"===e.split(" ",2)[1]},n.parseMLine=function(e){var t=n.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},n.parseOLine=function(e){var t=n.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]}},n.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=n.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.pushStream=0]="pushStream",e[e.pullStream=1]="pullStream",e[e.allStream=2]="allStream"}(t.ENUM_ROLE_TYPE||(t.ENUM_ROLE_TYPE={})),function(e){e[e.rtc=0]="rtc",e[e.live=1]="live"}(t.ENUM_ROOM_TYPE||(t.ENUM_ROOM_TYPE={})),function(e){e[e.publish=1]="publish",e[e.subscribe=2]="subscribe"}(t.ENUM_STREAM_TYPE||(t.ENUM_STREAM_TYPE={})),function(e){e[e.camera=1]="camera",e[e.desktop=2]="desktop"}(t.ENUM_MEDIA_TYPE||(t.ENUM_MEDIA_TYPE={})),function(e){e[e.userJoin=1]="userJoin",e[e.userLeave=2]="userLeave"}(t.ENUM_USER_CMD_TYPE||(t.ENUM_USER_CMD_TYPE={})),function(e){e[e.add=1]="add",e[e.remove=2]="remove"}(t.ENUM_STREAM_CMD_TYPE||(t.ENUM_STREAM_CMD_TYPE={})),function(e){e[e.audio=1]="audio",e[e.video=2]="video",e[e.data=3]="data"}(t.ENUM_TRACK_TYPE||(t.ENUM_TRACK_TYPE={})),function(e){e[e.audio=1]="audio",e[e.video=2]="video",e[e.audioVideo=3]="audioVideo"}(t.ENUM_RECORD_MIME||(t.ENUM_RECORD_MIME={})),function(e){e[e.lt=1]="lt",e[e.lb=2]="lb",e[e.rt=3]="rt",e[e.rb=4]="rb"}(t.ENUM_WATER_MARK_POS||(t.ENUM_WATER_MARK_POS={})),function(e){e[e.unjoin=1]="unjoin",e[e.joining=2]="joining",e[e.leaving=3]="leaving",e[e.joined=4]="joined"}(t.ENUM_ROOM_STATUS||(t.ENUM_ROOM_STATUS={})),function(e){e[e.unpublish=1]="unpublish",e[e.publishing=2]="publishing",e[e.unpublishing=3]="unpublishing",e[e.published=4]="published"}(t.ENUM_PUBLISH_STATUS||(t.ENUM_PUBLISH_STATUS={})),function(e){e[e.unsubscribe=1]="unsubscribe",e[e.subscribing=2]="subscribing",e[e.unsubscribing=3]="unsubscribing",e[e.subscribed=4]="subscribed"}(t.ENUM_SUBSCRIBE_STATUS||(t.ENUM_SUBSCRIBE_STATUS={})),function(e){e[e.unrecord=1]="unrecord",e[e.starting=2]="starting",e[e.stopping=3]="stopping",e[e.recording=4]="recording"}(t.ENUM_RECORD_STATUS||(t.ENUM_RECORD_STATUS={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(60).getParser(window.navigator.userAgent);t.isMobile=function(){return"mobile"===n.getPlatformType()},t.getBrowserInfo=function(){var e=n.getBrowser(),t=n.getPlatform();return{name:e.name||"unknown",version:e.version||"unknown",isMobile:"mobile"===t.type}},t.getSystemInfo=function(){var e=n.getOS();return{name:e.name||"unknown",version:e.version||"unknown",versionName:e.versionName||"unknown"}},t.getDeviceInfo=function(){var e=n.getOS(),t=n.getBrowser();return{vendor:e.name||"unknown",brand:t.name||"unknown",model:t.version||"unknown"}},t.getNetworkInfo=function(){return{network:""}},t.getCPUInfo=function(){return{brand:"",model:"",core:null!=window.navigator.hardwareConcurrency?window.navigator.hardwareConcurrency:0}},t.getMemInfo=function(){return{capacity:0}}},function(e,t,r){"use strict";var n,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function d(e,t,r,n){var o,i,s,a;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),s=i[t]),void 0===s)s=i[t]=r,++e._eventsCount;else if("function"==typeof s?s=i[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=u(e))>0&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function p(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,i(this.listener,this.target,e))}function f(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=p.bind(n);return o.listener=r,n.wrapFn=o,o}function l(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):m(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function m(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,d=m(c,u);for(r=0;r<u;++r)i(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return d(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return d(this,e,t,!0)},a.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,f(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,f(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,o,i,s;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return l(this,e,!0)},a.prototype.rawListeners=function(e){return l(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},a.prototype.listenerCount=h,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SERVER_CONFIG={api:"https://urtc.com.cn",log:"https://log.urtc.com.cn"},t.setServers=function(e){for(var r in t.SERVER_CONFIG)"string"==typeof e[r]?t.SERVER_CONFIG[r]=e[r]:t.SERVER_CONFIG[r]=t.SERVER_CONFIG[r]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(58);r(67);var o=r(5),i=r(21),s=r(1),a=r(59),c=r(22),u=r(3),d=r(62),p=r(63),f=r(4);t.getDevices=function(e,t){navigator.mediaDevices.enumerateDevices().then((function(t){s.default.debug("GetDevices: ",t),e(t)})).catch((function(e){t(e)}))};var l={offerToReceiveAudio:!0,offerToReceiveVideo:!0};function h(){return"safari"===f.getBrowserInfo().name.toLowerCase()}function m(e,t){s.default.debug("sdp attributes",t);var r,n=e.match(/m=video.*\r\n/);return n&&(r=n[0]+"b=AS:"+t.maxVideoBW+"\r\n",e=e.replace(n[0],r)),e}function v(e,t){return s.default.debug("sdp codec",t),"h264"===t&&h(),e}var g=function(){function e(e,t,r){if(this.resolution=i.getResolution(""),this.isSubscriber=!1,this.currentStatsReports=new d.StatsReports,this.streamId=e,this.mediaType=t,this.emitter=r,this.mediaStream=new MediaStream,"chrome"===f.getBrowserInfo().name.toLowerCase()||h()){this.peerConnection=new RTCPeerConnection({sdpSemantics:"plan-b"})}else this.peerConnection=new RTCPeerConnection;var n=this;this.peerConnection.addEventListener("iceconnectionstatechange",(function(e){switch(s.default.debug("iceconnectionstatechange event ",this.connectionState,e),this.connectionState){case"new":case"connecting":break;case"connected":n.startUploadStats();break;case"disconnected":s.default.warn("peerconnection disconnected"),n.stopUploadStats();break;case"failed":s.default.warn("peerconnection failed"),n.stopUploadStats();break;case"closed":n.stopUploadStats()}})),this.peerConnection.addEventListener("connectionstatechange",(function(e){switch(s.default.debug("connectionstatechange event",this.connectionState,e),this.connectionState){case"new":case"connecting":break;case"connected":n.emitter.emit("stream-connected",n),n.startUploadStats();break;case"disconnected":s.default.warn("peerconnection disconnected"),n.stopUploadStats();break;case"failed":s.default.warn("peerconnection failed"),n.stopUploadStats();break;case"closed":n.stopUploadStats()}}))}return e.prototype.setResolution=function(e){this.resolution=e},e.prototype.answer=function(e,t,r){return n.__awaiter(this,void 0,void 0,(function(){var o,i,a;return n.__generator(this,(function(n){switch(n.label){case 0:s.default.debug("stream worker answer: ",e),o=this.resolution.attributes,v(m(e.sdpcontent,o),this.videoCodec),i=new RTCSessionDescription({type:e.type,sdp:e.sdpcontent}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.peerConnection.setRemoteDescription(i)];case 2:return n.sent(),t(),[3,4];case 3:return a=n.sent(),s.default.error("stream "+this.streamId+" answer error: ",a),r(a),[3,4];case 4:return[2]}}))}))},e.prototype.getVideoTrack=function(){return this.mediaStream.getVideoTracks()[0]},e.prototype.getAudioTrack=function(){return this.mediaStream.getAudioTracks()[0]},e.prototype.muteVideo=function(){var e=this.getVideoTrack();return!!e&&(e.enabled=!1,!0)},e.prototype.unmuteVideo=function(){var e=this.getVideoTrack();return!!e&&(e.enabled=!0,!0)},e.prototype.muteAudio=function(){var e=this.getAudioTrack();return!!e&&(e.enabled=!1,!0)},e.prototype.unmuteAudio=function(){var e=this.getAudioTrack();return!!e&&(e.enabled=!0,!0)},e.prototype.getMediaStream=function(){return this.mediaStream},e.prototype.close=function(){this.mediaStream.getTracks().forEach((function(e){e.stop()})),this.audioHelper&&this.audioHelper.destroy(),this.peerConnection.close()},e.prototype.getAudioVolume=function(){return this.audioHelper?this.audioHelper.getVolume():(s.default.warn("No audio track"),0)},e.prototype.updateStatsReports=function(e,t){var r=this,n=this.lastStatsReports,o=this.currentStatsReports,i=new d.StatsReports;if(i.timestamp-o.timestamp<500){if(n)return void e({last:n,current:o});var a="invoke function too frequently";return s.default.error(a),void t(a)}this.peerConnection.getStats().then((function(t){t.forEach((function(e){i.original.push(e),"inbound-rtp"===e.type&&"audio"===e.mediaType&&(i.inAudioReport.bytesReceived=e.bytesReceived||i.inAudioReport.bytesReceived,i.inAudioReport.jitter=e.jitter||i.inAudioReport.jitter,i.inAudioReport.packetsLost=e.packetsLost||i.inAudioReport.packetsLost,i.inAudioReport.packetsReceived=e.packetsReceived||i.inAudioReport.packetsReceived),"inbound-rtp"===e.type&&"video"===e.mediaType&&(i.inVideoReport.bytesReceived=e.bytesReceived||i.inVideoReport.bytesReceived,i.inVideoReport.packetsLost=e.packetsLost||i.inVideoReport.packetsLost,i.inVideoReport.packetsReceived=e.packetsReceived||i.inVideoReport.packetsReceived,i.inVideoReport.firCount=e.firCount||i.inVideoReport.firCount,i.inVideoReport.nackCount=e.nackCount||i.inVideoReport.nackCount,i.inVideoReport.pliCount=e.pliCount||i.inVideoReport.pliCount,i.inVideoReport.framesDecoded=e.framesDecoded||i.inVideoReport.framesDecoded),"outbound-rtp"===e.type&&"audio"===e.mediaType&&(i.outAudioReport.bytesSent=e.bytesSent||i.outAudioReport.bytesSent,i.outAudioReport.packetsSent=e.packetsSent||i.outAudioReport.packetsSent),"outbound-rtp"===e.type&&"video"===e.mediaType&&(i.outVideoReport.bytesSent=e.bytesSent||i.outVideoReport.bytesSent,i.outVideoReport.packetsSent=e.packetsSent||i.outVideoReport.packetsSent,i.outVideoReport.firCount=e.firCount||i.outVideoReport.firCount,i.outVideoReport.nackCount=e.nackCount||i.outVideoReport.nackCount,i.outVideoReport.pliCount=e.pliCount||i.outVideoReport.pliCount,i.outVideoReport.framesEncoded=e.framesEncoded||i.outVideoReport.framesEncoded),"track"===e.type&&(i.inAudioReport.audioLevel=e.audioLevel||i.inAudioReport.audioLevel,i.inVideoReport.frameHeight=e.frameHeight||i.inVideoReport.frameHeight,i.inVideoReport.frameWidth=e.frameWidth||i.inVideoReport.frameWidth,i.inVideoReport.framesDecoded=e.framesDecoded||i.inVideoReport.framesDecoded,i.inVideoReport.framesDropped=e.framesDropped||i.inVideoReport.framesDropped,i.inVideoReport.framesReceived=e.framesReceived||i.inVideoReport.framesReceived,i.outVideoReport.frameHeight=e.frameHeight||i.outVideoReport.frameHeight,i.outVideoReport.frameWidth=e.frameWidth||i.outVideoReport.frameWidth,i.outVideoReport.framesSent=e.framesSent||i.outVideoReport.framesSent),"track"===e.type&&(i.outAudioReport.audioLevel=e.audioLevel||i.outAudioReport.audioLevel),"media-source"===e.type&&"audio"===e.kind&&(i.outAudioReport.audioLevel=e.audioLevel||i.outAudioReport.audioLevel),"outbound-rtp"===e.type&&"audio"===e.mediaType&&(i.outAudioReport.retransmittedBytesSent=e.retransmittedBytesSent||i.outAudioReport.retransmittedBytesSent,i.outAudioReport.retransmittedPacketsSent=e.retransmittedPacketsSent||i.outAudioReport.retransmittedPacketsSent),"candidate-pair"===e.type&&(i.candidatePairReport.availableIncomingBitrate=e.availableIncomingBitrate||i.candidatePairReport.availableIncomingBitrate,i.candidatePairReport.availableOutgoingBitrate=e.availableOutgoingBitrate||i.candidatePairReport.availableOutgoingBitrate,i.candidatePairReport.bytesReceived=e.bytesReceived||i.candidatePairReport.bytesReceived,i.candidatePairReport.bytesSent=e.bytesSent||i.candidatePairReport.bytesSent,i.candidatePairReport.currentRoundTripTime=e.currentRoundTripTime||i.candidatePairReport.currentRoundTripTime,i.candidatePairReport.totalRoundTripTime=e.totalRoundTripTime||i.candidatePairReport.totalRoundTripTime),"local-candidate"===e.type&&(i.localCandidateReport.ip=e.ip||e.address||i.localCandidateReport.ip,i.localCandidateReport.networkType=e.networkType||i.localCandidateReport.networkType,i.localCandidateReport.port=e.port||i.localCandidateReport.port,i.localCandidateReport.protocol=e.protocol||i.localCandidateReport.protocol),"remote-candidate"===e.type&&(i.remoteCandidateReport.ip=e.ip||e.address||i.remoteCandidateReport.ip,i.remoteCandidateReport.port=e.port||i.remoteCandidateReport.port,i.remoteCandidateReport.protocol=e.protocol||i.remoteCandidateReport.protocol),"transport"===e.type&&(i.transportReport.bytesReceived=e.bytesReceived||i.transportReport.bytesReceived,i.transportReport.bytesSent=e.bytesSent||i.transportReport.bytesSent,i.transportReport.dtlsState=e.dtlsState||i.transportReport.dtlsState)})),i.timestamp=Date.now(),r.lastStatsReports=o,r.currentStatsReports=i,e({last:o,current:i})})).catch((function(e){s.default.error("getStats ",e),t(e)}))},e.prototype.getStats=function(e,t){var r=this;this.updateStatsReports((function(t){var n=t.last,o=t.current,i=Math.round((o.timestamp-n.timestamp)/1e3),s={br:-1,lostpre:-1,vol:-1,mime:r.audioCodec};if(r.isSubscriber){if(o.inAudioReport&&n.inAudioReport){var a=o.inAudioReport.bytesReceived-n.inAudioReport.bytesReceived,c=o.inAudioReport.packetsReceived-n.inAudioReport.packetsReceived,u=o.inAudioReport.packetsLost-n.inAudioReport.packetsLost;s.br=Math.floor(8*a/i)||0,s.lostpre=Math.floor(u/(c+u)/i)||0,s.vol=Math.floor(100*(o.inAudioReport.audioLevel||0))||0}}else if(o.outAudioReport&&n.outAudioReport){var d=o.outAudioReport.bytesSent-n.outAudioReport.bytesSent,p=o.outAudioReport.packetsSent-n.outAudioReport.packetsSent;u=o.outAudioReport.retransmittedPacketsSent-n.outAudioReport.retransmittedPacketsSent;s.br=Math.floor(8*d/i)||0,s.lostpre=Math.floor(u/(p+u)/i)||0,s.vol=Math.floor(100*(o.outAudioReport.audioLevel||0))||0}var f={br:-1,lostpre:-1,frt:-1,w:-1,h:-1,mime:r.videoCodec};if(r.isSubscriber){if(o.inVideoReport&&n.inVideoReport){a=o.inVideoReport.bytesReceived-n.inVideoReport.bytesReceived,c=o.inVideoReport.packetsReceived-n.inVideoReport.packetsReceived,u=o.inVideoReport.packetsLost-n.inVideoReport.packetsLost;var l=o.inVideoReport.framesReceived-n.inVideoReport.framesReceived;f.br=Math.floor(8*a/i)||0,f.lostpre=Math.floor(u/(c+u)/i)||0,f.frt=Math.floor(l/i)||0,f.w=o.inVideoReport.frameWidth||-1,f.h=o.inVideoReport.frameHeight||-1}}else if(o.outVideoReport&&n.outVideoReport){d=o.outVideoReport.bytesSent-n.outVideoReport.bytesSent,p=o.outVideoReport.packetsSent-n.outVideoReport.packetsSent,u=o.outVideoReport.nackCount-n.outVideoReport.nackCount;var h=o.outVideoReport.framesSent-n.outVideoReport.framesSent;f.br=Math.floor(8*d/i)||0,f.lostpre=Math.floor(u/(p+u)/i)||0,f.frt=Math.floor(h/i)||0,f.w=o.outVideoReport.frameWidth||-1,f.h=o.outVideoReport.frameHeight||-1}var m={rtt:-1,delay:-1};r.isSubscriber?o.candidatePairReport&&(m.delay=Math.floor(1e3*o.candidatePairReport.currentRoundTripTime)||0):o.candidatePairReport&&(m.rtt=Math.floor(1e3*o.candidatePairReport.currentRoundTripTime)||0),e({audio:s,video:f,connection:m})}),t)},e.prototype.startUploadStats=function(){var e=this;this.timer||(this.timer=window.setInterval((function(){e.getStats((function(t){e.isSubscriber?e.logReporter.reportSubscribeStatusLog(e.streamSubId,e.streamId,e.userId,e.mediaType,{delay:t.connection.delay,rtt:-1,audio:t.audio,video:t.video,cpu:0,memory:0}):e.logReporter.reportPublishStatusLog(e.streamId,e.mediaType,{delay:-1,rtt:t.connection.rtt,audio:t.audio,video:t.video,cpu:0,memory:0})}),(function(e){s.default.error("upload stats ",e)}))}),3e3))},e.prototype.stopUploadStats=function(){this.timer&&(window.clearInterval(this.timer),this.timer=0)},e}(),b=function(e){function t(t,r,n){var o=e.call(this,t,r,n)||this;return o.peerConnection.addEventListener("track",(function(e){s.default.debug("local - track event ",e)})),o}return n.__extends(t,e),t.prototype.setVideoProfile=function(e){var t=this.getVideoTrack();return null===t?Promise.reject("no video track found"):t.applyConstraints(e.video)},t.prototype.connect=function(e,t,r){return n.__awaiter(this,void 0,void 0,(function(){var o,i,u,d,f,h,g,b=this;return n.__generator(this,(function(n){switch(n.label){case 0:if(o={audio:!1,video:!1},e.audio&&e.microphoneId?o.audio={deviceId:e.microphoneId}:e.audio&&(o.audio=!0),i=this.resolution.video,e.video&&e.cameraId?o.video={deviceId:e.cameraId,width:i.width,height:i.height,frameRate:i.frameRate}:e.video&&(o.video={width:i.width,height:i.height,frameRate:i.frameRate}),!o.audio&&!o.video)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia(o)];case 2:return n.sent().getTracks().forEach((function(e){s.default.debug("local stream - add track ",e),b.mediaStream.addTrack(e),b.peerConnection.addTrack(e,b.mediaStream),"audio"!==e.kind||b.audioHelper||(b.audioHelper=new a.AudioHelper(b.mediaStream))})),[3,4];case 3:return u=n.sent(),s.default.error("local stream - get user media ",u),o.audio&&this.logReporter.reportExceptionLog(c.ENUM_LOG_EXCEPTION_TYPE.getMicrophones),o.video&&this.logReporter.reportExceptionLog(c.ENUM_LOG_EXCEPTION_TYPE.getCameras),r(u),[2];case 4:if(!e.screen)return[3,10];n.label=5;case 5:return n.trys.push([5,9,,10]),p.displayMediaDevices.getDisplayMedia?[4,p.displayMediaDevices.getDisplayMedia()]:[3,7];case 6:return n.sent().getTracks().forEach((function(e){s.default.debug("local stream - add screen track ",e),e.addEventListener("mute",(function(e){s.default.debug("screen track mute ",this.muted,e)})),e.addEventListener("unmute",(function(e){s.default.debug("screen track unmute ",this.muted,e)})),e.addEventListener("ended",(function(e){s.default.debug("screen track ended ",this.onended,e)})),b.mediaStream.addTrack(e),b.peerConnection.addTrack(e,b.mediaStream)})),[3,8];case 7:throw new Error("browser no support screen share");case 8:return[3,10];case 9:return d=n.sent(),s.default.error("local stream - get screen ",d),r(d),[2];case 10:return n.trys.push([10,13,,14]),[4,this.peerConnection.createOffer(l)];case 11:return f=n.sent(),h=this.resolution.attributes,f.sdp&&(f.sdp=m(f.sdp,h),f.sdp=v(f.sdp,this.videoCodec)),[4,this.peerConnection.setLocalDescription(f)];case 12:return n.sent(),t(f),[3,14];case 13:return g=n.sent(),s.default.error("local stream - peer connection error ",g),r(g),[3,14];case 14:return[2]}}))}))},t.prototype.switchMicrophone=function(e,t,r){return n.__awaiter(this,void 0,void 0,(function(){var o,i,a,c=this;return n.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,navigator.mediaDevices.getUserMedia({audio:{deviceId:e}})];case 1:return o=n.sent(),i=o.getAudioTracks()[0],this.mediaStream.getAudioTracks().forEach((function(e){c.peerConnection.getSenders().forEach((function(t){t.track&&t.track.id===e.id&&(s.default.debug("local stream - replace audio track ",i,e),t.replaceTrack(i),c.mediaStream.removeTrack(e),c.mediaStream.addTrack(i),e.stop())}))})),t(),[3,3];case 2:return a=n.sent(),s.default.error("local stream - get microphone ",a),r(a),[3,3];case 3:return[2]}}))}))},t.prototype.switchCamera=function(e,t,r){return n.__awaiter(this,void 0,void 0,(function(){var o,i,a,c,u,d=this;return n.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),o=this.resolution.video,i={video:{deviceId:e,width:o.width,height:o.height,frameRate:o.frameRate}},[4,navigator.mediaDevices.getUserMedia(i)];case 1:return a=n.sent(),c=a.getVideoTracks()[0],this.mediaStream.getVideoTracks().forEach((function(e){d.peerConnection.getSenders().forEach((function(t){t.track&&t.track.id===e.id&&(s.default.debug("local stream - replace video track ",c,e),t.replaceTrack(c),d.mediaStream.removeTrack(e),d.mediaStream.addTrack(c),e.stop())}))})),t(),[3,3];case 2:return u=n.sent(),s.default.error("local stream - get camera ",u),r(u),[3,3];case 3:return[2]}}))}))},t}(g),y=function(e){function t(t,r,n,o){var i=e.call(this,t,r,o)||this,c=i;return i.streamSubId=n,i.isSubscriber=!0,i.peerConnection.addEventListener("track",(function(e){s.default.debug("remote - track event ",e),c.mediaStream.addTrack(e.track),"audio"!==e.track.kind||c.audioHelper||(c.audioHelper=new a.AudioHelper(c.mediaStream))})),i}return n.__extends(t,e),t.prototype.connect=function(e,t){return n.__awaiter(this,void 0,void 0,(function(){var r,o,i;return n.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this.peerConnection.createOffer(l)];case 1:return r=n.sent(),o=this.resolution.attributes,r.sdp&&(r.sdp=m(r.sdp,o),r.sdp=v(r.sdp,this.videoCodec)),[4,this.peerConnection.setLocalDescription(r)];case 2:return n.sent(),e(r),[3,4];case 3:return i=n.sent(),s.default.error("remote stream "+this.streamId+" - peer connection error ",i),t(i),[3,4];case 4:return[2]}}))}))},t}(g),S=function(){function e(e,t){var r=this;this.publishConfig={audio:!0,video:!0,screen:!1,mediaType:u.ENUM_MEDIA_TYPE.camera,data:!1},this.localStreams=[],this.remoteStreams=[],this.innerEmitter=new o.EventEmitter,this.currentResolution=i.getResolution(""),this.audioCodec=e,this.videoCodec=t,this.innerEmitter.on("stream-connected",(function(e){s.default.debug("stream-connected ",e),r.getLocalStream(e.streamId)?r._emitter.emit("mediaStreamPublished",{mediaStream:e.getMediaStream()}):r.getRemoteStream(e.streamId)&&r._emitter.emit("mediaStreamSubscribed",{streamId:e.streamId,mediaStream:e.getMediaStream()})}))}return Object.defineProperty(e.prototype,"emitter",{set:function(e){this._emitter=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logReporter",{set:function(e){this._logReporter=e},enumerable:!0,configurable:!0}),e.prototype.updatePublishConfig=function(e){var t=e.audio,r=e.video,n=e.screen,o=e.microphoneId,i=e.cameraId;this.publishConfig.audio=t,this.publishConfig.video=r,this.publishConfig.screen=n,o&&(this.publishConfig.microphoneId=o),i&&(this.publishConfig.cameraId=i),n&&(this.publishConfig.mediaType=u.ENUM_MEDIA_TYPE.desktop),r&&(this.publishConfig.mediaType=u.ENUM_MEDIA_TYPE.camera)},e.prototype.getPublishConfig=function(){return Object.assign({},this.publishConfig,{video:this.publishConfig.video||this.publishConfig.screen})},e.prototype.getLocalStream=function(e){return e?this.localStreams.find((function(t){return t.streamId===e})):this.localStreams[0]},e.prototype.getRemoteStream=function(e){return this.remoteStreams.find((function(t){return t.streamId===e||t.streamSubId===e}))},e.prototype.getStream=function(e){return e?this.getLocalStream(e)||this.getRemoteStream(e):this.getLocalStream(e)},e.prototype.createLocalStream=function(e,t,r,n,o){var i=this;if(s.default.debug("create local stream ",t),this.getLocalStream(t)){var a="local stream has already created";return s.default.error("create local stream - ",a),void o(a)}var c=new b(t,r,this.innerEmitter);c.userId=e,c.audioCodec=this.audioCodec,c.videoCodec=this.videoCodec,c.logReporter=this._logReporter,c.setResolution(this.currentResolution);c.connect(this.publishConfig,(function(e){i.localStreams.push(c),n(e)}),(function(e){o(e)}))},e.prototype.removeLocalStream=function(e,t,r){try{var n=this.getLocalStream(e);if(n){var o=this.localStreams.indexOf(n);this.localStreams.splice(o,1),n.close()}t()}catch(e){s.default.error("removeLocalStream ",e),r(e)}},e.prototype.createRemoteStream=function(e,t,r,n){var o=this,i=t.stream_id,a=t.streamsub_id;s.default.debug("create remote stream ",i,a);var c=this.getRemoteStream(i);if(c)s.default.debug("create remote stream ",c);else{var u=new y(i,t.media_type,a,this.innerEmitter);u.userId=e,u.audioCodec=this.audioCodec,u.videoCodec=this.videoCodec,u.logReporter=this._logReporter,u.setResolution(this.currentResolution);u.connect((function(e){o.remoteStreams.push(u),r(u.streamId,e)}),(function(e){n(e)}))}},e.prototype.removeRemoteStream=function(e,t,r){try{var n=this.getRemoteStream(e);if(n){var o=this.remoteStreams.indexOf(n);this.remoteStreams.splice(o,1),n.close()}t()}catch(e){s.default.error("removeRemoteStream ",e),r(e)}},e.prototype.answer=function(e,t,r,n){var o=this.getStream(e);if(o){o.answer(t,r,(function(e){n(e)}))}else{var i="answer failed, cannot find the stream";s.default.error("answer - ",i),n(i)}},e.prototype.getMediaStream=function(e){var t=this.getStream(e);return t?t.getMediaStream():new MediaStream},e.prototype.setVideoProfile=function(e){this.currentResolution=i.getResolution(e);var t=this.getLocalStream();return t?(t.setResolution(this.currentResolution),t.setVideoProfile(this.currentResolution)):Promise.resolve()},e.prototype.muteVideo=function(e){var t=this.getStream(e);return!!t&&t.muteVideo()},e.prototype.unmuteVideo=function(e){var t=this.getStream(e);return!!t&&t.unmuteVideo()},e.prototype.muteAudio=function(e){var t=this.getStream(e);return!!t&&t.muteAudio()},e.prototype.unmuteAudio=function(e){var t=this.getStream(e);return!!t&&t.unmuteAudio()},e.prototype.getAudioVolume=function(e){var t=this.getStream(e);return t?t.getAudioVolume():0},e.prototype.getStats=function(e,t,r){var n=this.getStream(e);n&&n.getStats(t,r)},e.prototype.switchMicrophone=function(e,t,r){var n=this.getLocalStream("");if(n)n.switchMicrophone(e,t,r);else{var o="local media stream cannot find";s.default.error("switchMicrophone ",o),r(o)}},e.prototype.switchCamera=function(e,t,r){var n=this.getLocalStream("");if(n)n.switchCamera(e,t,r);else{var o="local media stream cannot find";s.default.error("switchCamera ",o),r(o)}},e}();t.StreamWorker=S},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="1.3.1"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(31),o=r(48),i=r(20),s=r(7),a=function(e){return new i(e).origin!==window.location.origin};function c(e){var t=e.url,r=void 0===t?s.SERVER_CONFIG.api+"/uteach":t,c=e.method,u=void 0===c?"GET":c,d=e.data,p=e.crossOrigin,f=void 0!==p&&p,l=e.needVerifyResponse,h=void 0===l||l;return new Promise((function(e,t){!f&&a(r)?o(r,{param:i.qs.stringify(d)+"&callback"},(function(r,n){return r?t(r):h&&0!==n.err?t(n.msg):void e(n)})):n.default.request({url:r,method:u,responseType:"json",data:d}).then((function(r){var n=r.data;if(h&&0!==n.err)return t(n.msg);e(n)})).catch((function(e){t(e)}))}))}t.query=c,t.get=function(e){return c(Object.assign(e,{method:"GET"}))},t.post=function(e){return c(Object.assign(e,{method:"POST"}))}},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},function(e,t,r){"use strict";var n=r(0);function o(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(n.isURLSearchParams(t))i=t.toString();else{var s=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(o(t)+"="+o(e))})))})),i=s.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";(function(t){var n=r(0),o=r(38),i={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,c={adapter:(void 0!==t&&"[object process]"===Object.prototype.toString.call(t)?a=r(16):"undefined"!=typeof XMLHttpRequest&&(a=r(16)),a),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)?(s(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){c.headers[e]=n.merge(i)})),e.exports=c}).call(this,r(15))},function(e,t){var r,n,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var c,u=[],d=!1,p=-1;function f(){d&&c&&(d=!1,c.length?u=c.concat(u):p=-1,u.length&&l())}function l(){if(!d){var e=a(f);d=!0;for(var t=u.length;t;){for(c=u,u=[];++p<t;)c&&c[p].run();p=-1,t=u.length}c=null,d=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new h(e,t)),1!==u.length||d||a(l)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,r){"use strict";var n=r(0),o=r(39),i=r(12),s=r(41),a=r(42),c=r(17);e.exports=function(e){return new Promise((function(t,u){var d=e.data,p=e.headers;n.isFormData(d)&&delete p["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",h=e.auth.password||"";p.Authorization="Basic "+btoa(l+":"+h)}if(f.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,f.onreadystatechange=function(){if(f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in f?s(f.getAllResponseHeaders()):null,n={data:e.responseType&&"text"!==e.responseType?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:r,config:e,request:f};o(t,u,n),f=null}},f.onabort=function(){f&&(u(c("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){u(c("Network Error",e,null,f)),f=null},f.ontimeout=function(){u(c("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",f)),f=null},n.isStandardBrowserEnv()){var m=r(43),v=(e.withCredentials||a(e.url))&&e.xsrfCookieName?m.read(e.xsrfCookieName):void 0;v&&(p[e.xsrfHeaderName]=v)}if("setRequestHeader"in f&&n.forEach(p,(function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete p[t]:f.setRequestHeader(t,e)})),e.withCredentials&&(f.withCredentials=!0),e.responseType)try{f.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){f&&(f.abort(),u(e),f=null)})),void 0===d&&(d=null),f.send(d)}))}},function(e,t,r){"use strict";var n=r(40);e.exports=function(e,t,r,o,i){var s=new Error(e);return n(s,t,r,o,i)}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e,t){t=t||{};var r={};return n.forEach(["url","method","params","data"],(function(e){void 0!==t[e]&&(r[e]=t[e])})),n.forEach(["headers","auth","proxy"],(function(o){n.isObject(t[o])?r[o]=n.deepMerge(e[o],t[o]):void 0!==t[o]?r[o]=t[o]:n.isObject(e[o])?r[o]=n.deepMerge(e[o]):void 0!==e[o]&&(r[o]=e[o])})),n.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])})),r}},function(e,t,r){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,r){"use strict";(function(t){var n=r(52),o=r(53),i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,s=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,a=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function c(e){return(e||"").toString().replace(a,"")}var u=[["#","hash"],["?","query"],function(e){return e.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],d={hash:1,query:1};function p(e){var r,n=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(e=e||n);if("blob:"===e.protocol)o=new l(unescape(e.pathname),{});else if("string"===s)for(r in o=new l(e,{}),d)delete o[r];else if("object"===s){for(r in e)r in d||(o[r]=e[r]);void 0===o.slashes&&(o.slashes=i.test(e.href))}return o}function f(e){e=c(e);var t=s.exec(e);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!t[2],rest:t[3]}}function l(e,t,r){if(e=c(e),!(this instanceof l))return new l(e,t,r);var i,s,a,d,h,m,v=u.slice(),g=typeof t,b=this,y=0;for("object"!==g&&"string"!==g&&(r=t,t=null),r&&"function"!=typeof r&&(r=o.parse),t=p(t),i=!(s=f(e||"")).protocol&&!s.slashes,b.slashes=s.slashes||i&&t.slashes,b.protocol=s.protocol||t.protocol||"",e=s.rest,s.slashes||(v[3]=[/(.*)/,"pathname"]);y<v.length;y++)"function"!=typeof(d=v[y])?(a=d[0],m=d[1],a!=a?b[m]=e:"string"==typeof a?~(h=e.indexOf(a))&&("number"==typeof d[2]?(b[m]=e.slice(0,h),e=e.slice(h+d[2])):(b[m]=e.slice(h),e=e.slice(0,h))):(h=a.exec(e))&&(b[m]=h[1],e=e.slice(0,h.index)),b[m]=b[m]||i&&d[3]&&t[m]||"",d[4]&&(b[m]=b[m].toLowerCase())):e=d(e);r&&(b.query=r(b.query)),i&&t.slashes&&"/"!==b.pathname.charAt(0)&&(""!==b.pathname||""!==t.pathname)&&(b.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],i=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(b.pathname,t.pathname)),n(b.port,b.protocol)||(b.host=b.hostname,b.port=""),b.username=b.password="",b.auth&&(d=b.auth.split(":"),b.username=d[0]||"",b.password=d[1]||""),b.origin=b.protocol&&b.host&&"file:"!==b.protocol?b.protocol+"//"+b.host:"null",b.href=b.toString()}l.prototype={set:function(e,t,r){var i=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(r||o.parse)(t)),i[e]=t;break;case"port":i[e]=t,n(t,i.protocol)?t&&(i.host=i.hostname+":"+t):(i.host=i.hostname,i[e]="");break;case"hostname":i[e]=t,i.port&&(t+=":"+i.port),i.host=t;break;case"host":i[e]=t,/:\d+$/.test(t)?(t=t.split(":"),i.port=t.pop(),i.hostname=t.join(":")):(i.hostname=t,i.port="");break;case"protocol":i.protocol=t.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(t){var s="pathname"===e?"/":"#";i[e]=t.charAt(0)!==s?s+t:t}else i[e]=t;break;default:i[e]=t}for(var a=0;a<u.length;a++){var c=u[a];c[4]&&(i[c[1]]=i[c[1]].toLowerCase())}return i.origin=i.protocol&&i.host&&"file:"!==i.protocol?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(e){e&&"function"==typeof e||(e=o.stringify);var t,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var i=n+(r.slashes?"//":"");return r.username&&(i+=r.username,r.password&&(i+=":"+r.password),i+="@"),i+=r.host+r.pathname,(t="object"==typeof r.query?e(r.query):r.query)&&(i+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(i+=r.hash),i}},l.extractProtocol=f,l.location=p,l.trimLeft=c,l.qs=o,e.exports=l}).call(this,r(6))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SUPPORT_RESOLUTIONS={"240*180":{width:240,height:180,minFrameRate:20,maxFrameRate:20,minVideoBW:50,maxVideoBW:200},"480*360":{width:480,height:360,minFrameRate:20,maxFrameRate:20,minVideoBW:80,maxVideoBW:300},"640*360":{width:640,height:360,minFrameRate:20,maxFrameRate:20,minVideoBW:80,maxVideoBW:400},"640*480":{width:640,height:480,minFrameRate:20,maxFrameRate:20,minVideoBW:100,maxVideoBW:500},"1280*720":{width:1280,height:720,minFrameRate:20,maxFrameRate:20,minVideoBW:200,maxVideoBW:1e3},"1920*1080":{width:1920,height:1080,minFrameRate:20,maxFrameRate:20,minVideoBW:300,maxVideoBW:1500}};var n="640*480";t.getSupportProfileNames=function(){return Object.keys(t.SUPPORT_RESOLUTIONS)},t.getResolution=function(e){var r=t.SUPPORT_RESOLUTIONS[e];return r||(e=n,r=t.SUPPORT_RESOLUTIONS[e]),{profileName:e,video:{width:r.width,height:r.height,frameRate:{ideal:r.maxFrameRate}},attributes:{minFrameRate:r.minFrameRate,maxFrameRate:r.maxFrameRate,minVideoBW:r.minVideoBW,maxVideoBW:r.maxVideoBW}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o,i,s=r(20),a=r(7),c=r(10),u=r(1),d=r(3),p=r(9),f=r(23),l=r(4);!function(e){e[e.join=1]="join",e[e.stats=2]="stats",e[e.leave=3]="leave",e[e.exception=4]="exception",e[e.operation=5]="operation"}(n||(n={})),function(e){e[e.publish=1]="publish",e[e.subscribe=2]="subscribe",e[e.getCameras=3]="getCameras",e[e.getMicrophones=4]="getMicrophones",e[e.getLoudspeakers=5]="getLoudspeakers",e[e.highCPU=6]="highCPU",e[e.highLoss=7]="highLoss",e[e.highDelay=8]="highDelay",e[e.record=9]="record",e[e.storage=10]="storage",e[e.im=11]="im",e[e.whiteboard=12]="whiteboard",e[e.others=13]="others"}(o=t.ENUM_LOG_EXCEPTION_TYPE||(t.ENUM_LOG_EXCEPTION_TYPE={})),function(e){e[e.joinRoom=1]="joinRoom",e[e.leaveRoom=2]="leaveRoom",e[e.publish=3]="publish",e[e.unpublish=4]="unpublish",e[e.subscribe=5]="subscribe",e[e.unsubscribe=6]="unsubscribe",e[e.unmuteVideo=7]="unmuteVideo",e[e.muteVideo=8]="muteVideo",e[e.unmuteAudio=9]="unmuteAudio",e[e.muteAudio=10]="muteAudio",e[e.startRecord=11]="startRecord",e[e.stopRecord=12]="stopRecord"}(i=t.ENUM_LOG_OPERATION_TYPE||(t.ENUM_LOG_OPERATION_TYPE={}));var h=function(){function e(){}return e.prototype.init=function(e,t,r){this.app_id=e,this.room_id=t,this.user_id=r},e.prototype.reset=function(){this.app_id="",this.room_id="",this.user_id=""},Object.defineProperty(e.prototype,"isValid",{get:function(){return!!(this.app_id&&this.room_id&&this.user_id)},enumerable:!0,configurable:!0}),e.prototype.getCommonHeader=function(e,t){return{version:"1.0",method:"logup",rpc_id:f.getId(),type:e,ts:Math.round(Date.now()/1e3),aid:this.app_id,rid:this.room_id,sid:t&&t.sid||"",uid:this.user_id,streamid:t&&t.streamId||"",stype:t&&t.stype||0,mtype:t&&t.mtype||0}},e.prototype.reportJoinRoomLog=function(){if(this.isValid){var e=this.getCommonHeader(n.join),t=l.getDeviceInfo(),r=l.getSystemInfo(),o=l.getCPUInfo(),i={sdkv:p.version,agent:f.getAgent(),device:t.vendor+"_"+t.brand+"_"+t.model,system:""+r.name+r.version+"_"+r.versionName,network:""+l.getNetworkInfo().network,cpu:o.brand+"_"+o.model+"_"+o.core,mem:l.getMemInfo().capacity,micphone:1,speaker:1,video:1};if(a.SERVER_CONFIG.log){var d=new s(a.SERVER_CONFIG.log).set("pathname","api/rtcJoinLeaveClientLog"),h=Object.assign({},e,{data:i});c.post({url:d.href,data:h,crossOrigin:!0,needVerifyResponse:!1}).catch((function(e){u.default.error("report joinroom log error ",e)}))}}},e.prototype.reportLeaveRoomLog=function(){if(this.isValid){var e=this.getCommonHeader(n.leave);if(a.SERVER_CONFIG.log){var t=new s(a.SERVER_CONFIG.log).set("pathname","api/rtcJoinLeaveClientLog"),r=Object.assign({},e,{data:{sdkv:"",agent:"",device:"",system:"",network:"",cpu:"",mem:0,micphone:0,speaker:0,video:0}});c.post({url:t.href,data:r,crossOrigin:!0,needVerifyResponse:!1}).catch((function(e){u.default.error("report leaveroom log error ",e)}))}}},e.prototype.reportPublishStatusLog=function(e,t,r){if(this.isValid){var o=this.getCommonHeader(n.stats,{streamId:e,stype:d.ENUM_STREAM_TYPE.publish,mtype:t});if(a.SERVER_CONFIG.log){var i=new s(a.SERVER_CONFIG.log).set("pathname","api/rtcClinetLog"),p=Object.assign({userid:"",streamid:""},r),f=Object.assign({},o,{data:p});c.post({url:i.href,data:f,crossOrigin:!0,needVerifyResponse:!1}).catch((function(e){u.default.error("report stats log error ",e)}))}}},e.prototype.reportSubscribeStatusLog=function(e,t,r,o,i){if(this.isValid){var u=this.getCommonHeader(n.stats,{streamId:e,stype:d.ENUM_STREAM_TYPE.subscribe,mtype:o});if(a.SERVER_CONFIG.log){var p=new s(a.SERVER_CONFIG.log).set("pathname","api/rtcClinetLog"),f=Object.assign({userid:r||"",streamid:t||""},i),l=Object.assign({},u,{data:f});c.post({url:p.href,data:l,crossOrigin:!0,needVerifyResponse:!1})}}},e.prototype.reportExceptionLog=function(e,t){if(this.isValid){var r=this.getCommonHeader(n.exception,t);if(a.SERVER_CONFIG.log){var i=new s(a.SERVER_CONFIG.log).set("pathname","api/exceptionLog"),d=Object.assign({},r,{data:{errorType:e,userid:e===o.subscribe&&t&&t.userId||"",streamid:e===o.subscribe&&t&&t.streamId||""}});c.post({url:i.href,data:d,crossOrigin:!0,needVerifyResponse:!1}).catch((function(e){u.default.error("report exception log error ",e)}))}}},e.prototype.reportOperationLog=function(e,t){if(this.isValid){var r=i,o=[r.subscribe,r.unsubscribe,r.unmuteVideo,r.muteVideo,r.unmuteVideo,r.muteAudio],d=[r.subscribe,r.unsubscribe,r.unmuteVideo,r.muteVideo,r.unmuteVideo,r.muteAudio],p=[r.startRecord,r.stopRecord],f=this.getCommonHeader(n.operation,t);if(a.SERVER_CONFIG.log){var l=new s(a.SERVER_CONFIG.log).set("pathname","api/opertionLog"),h=Object.assign({},f,{data:{opertionType:e,userid:o.includes(e)&&t&&t.userId||"",streamid:d.includes(e)&&t&&t.streamId||"",recordid:p.includes(e)&&t&&t.recordId||""}});c.post({url:l.href,data:h,crossOrigin:!0,needVerifyResponse:!1}).catch((function(e){u.default.error("report operation log error ",e)}))}}},e}();t.LogReporter=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4),o=r(61),i=1e7,s="web_"+n.getBrowserInfo().name+n.getBrowserInfo().version,a=i,c=s;t.getAgent=function(){return c},t.setAgent=function(e){c=e},t.resetSeq=function(){a=i},t.getId=function(){return c+"_"+o.formatTime(new Date,"YYYYMMDDHHmmss")+"_"+a++}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(64),o=r(65),i=r(66);function s(e,t,r,s){var a=e,c=t,u=r,d=s,p=n.Base64.encode(JSON.stringify({user_id:d,room_id:u,app_id:a,appkey:c})),f=Math.round(Date.now()/1e3),l=i.randNum(8),h=d+a+f+l+u,m=new o("SHA-1","TEXT");return m.setHMACKey(c,"TEXT"),m.update(h),p+"."+m.getHMAC("HEX")+f+l}function a(e){return JSON.parse(n.Base64.decode(e))}function c(e){return n.Base64.encode(JSON.stringify(e))}t.genToken=s,t.decode=a,t.encode=c;var u={genToken:s,decode:a,encode:c};t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3);t.convertToOuterUser=function(e){return{uid:e.user_id}},t.convertToOuterStream=function(e){return{sid:e.sid,uid:e.uid,type:e.stream_type===n.ENUM_STREAM_TYPE.publish?"publish":"subscribe",audio:e.audio,video:e.video,muteAudio:e.muteaudio,muteVideo:e.mutevideo,mediaStream:e.mediaStream}}},function(e,t,r){"use strict";var n=r(2);function o(e,t,r,o,i){var s=n.writeRtpDescription(e.kind,t);if(s+=n.writeIceParameters(e.iceGatherer.getLocalParameters()),s+=n.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":i||"active"),s+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?s+="a=sendrecv\r\n":e.rtpSender?s+="a=sendonly\r\n":e.rtpReceiver?s+="a=recvonly\r\n":s+="a=inactive\r\n",e.rtpSender){var a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var c="msid:"+(o?o.id:"-")+" "+a+"\r\n";s+="a="+c,s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+c,e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+c,s+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+n.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+n.localCName+"\r\n"),s}function i(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},n=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++)if(t[r].payloadType===e||t[r].preferredPayloadType===e)return t[r]},o=function(e,t,r,o){var i=n(e.parameters.apt,r),s=n(t.parameters.apt,o);return i&&s&&i.name.toLowerCase()===s.name.toLowerCase()};return e.codecs.forEach((function(n){for(var i=0;i<t.codecs.length;i++){var s=t.codecs[i];if(n.name.toLowerCase()===s.name.toLowerCase()&&n.clockRate===s.clockRate){if("rtx"===n.name.toLowerCase()&&n.parameters&&s.parameters.apt&&!o(n,s,e.codecs,t.codecs))continue;(s=JSON.parse(JSON.stringify(s))).numChannels=Math.min(n.numChannels,s.numChannels),r.codecs.push(s),s.rtcpFeedback=s.rtcpFeedback.filter((function(e){for(var t=0;t<n.rtcpFeedback.length;t++)if(n.rtcpFeedback[t].type===e.type&&n.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var n=0;n<t.headerExtensions.length;n++){var o=t.headerExtensions[n];if(e.uri===o.uri){r.headerExtensions.push(o);break}}})),r}function s(e,t,r){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(r)}function a(e,t){var r=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 r||e.addRemoteCandidate(t),!r}function c(e,t){var r=new Error(t);return r.name=e,r.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],r}e.exports=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function u(t,r,n,o){var i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=o,e.setTimeout((function(){t._dispatchEvent("track",i)}))}var d=function(r){var o=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){o[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",r=JSON.parse(JSON.stringify(r||{})),this.usingBundle="max-bundle"===r.bundlePolicy,"negotiate"===r.rtcpMuxPolicy)throw c("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(r.rtcpMuxPolicy||(r.rtcpMuxPolicy="require"),r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all"}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced"}if(r.iceServers=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var o="string"==typeof n;return o&&(n=[n]),n=n.filter((function(e){return 0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")&&-1===e.indexOf("turn:[")&&!r?(r=!0,!0):0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp")})),delete e.url,e.urls=o?n[0]:n,!!n.length}}))}(r.iceServers||[],t),this._iceGatherers=[],r.iceCandidatePoolSize)for(var s=r.iceCandidatePoolSize;s>0;s--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=n.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(d.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(d.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),d.prototype.onicecandidate=null,d.prototype.onaddstream=null,d.prototype.ontrack=null,d.prototype.onremovestream=null,d.prototype.onsignalingstatechange=null,d.prototype.oniceconnectionstatechange=null,d.prototype.onconnectionstatechange=null,d.prototype.onicegatheringstatechange=null,d.prototype.onnegotiationneeded=null,d.prototype.ondatachannel=null,d.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},d.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},d.prototype.getConfiguration=function(){return this._config},d.prototype.getLocalStreams=function(){return this.localStreams},d.prototype.getRemoteStreams=function(){return this.remoteStreams},d.prototype._createTransceiver=function(e,t){var r=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&&r)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var o=this._createIceAndDtlsTransports();n.iceTransport=o.iceTransport,n.dtlsTransport=o.dtlsTransport}return t||this.transceivers.push(n),n},d.prototype.addTrack=function(t,r){if(this._isClosed)throw c("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var n;if(this.transceivers.find((function(e){return e.track===t})))throw c("InvalidAccessError","Track already exists.");for(var o=0;o<this.transceivers.length;o++)this.transceivers[o].track||this.transceivers[o].kind!==t.kind||(n=this.transceivers[o]);return n||(n=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),n.track=t,n.stream=r,n.rtpSender=new e.RTCRtpSender(t,n.dtlsTransport),n.rtpSender},d.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach((function(t){r.addTrack(t,e)}));else{var n=e.clone();e.getTracks().forEach((function(e,t){var r=n.getTracks()[t];e.addEventListener("enabled",(function(e){r.enabled=e.enabled}))})),n.getTracks().forEach((function(e){r.addTrack(e,n)}))}},d.prototype.removeTrack=function(t){if(this._isClosed)throw c("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 r=this.transceivers.find((function(e){return e.rtpSender===t}));if(!r)throw c("InvalidAccessError","Sender was not created by this connection.");var n=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(n)&&this.localStreams.indexOf(n)>-1&&this.localStreams.splice(this.localStreams.indexOf(n),1),this._maybeFireNegotiationNeeded()},d.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var r=t.getSenders().find((function(t){return t.track===e}));r&&t.removeTrack(r)}))},d.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},d.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},d.prototype._createIceGatherer=function(t,r){var n=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var o=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(o,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||0===Object.keys(e.candidate).length;o.state=r?"completed":"gathering",null!==n.transceivers[t].bufferedCandidateEvents&&n.transceivers[t].bufferedCandidateEvents.push(e)},o.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),o},d.prototype._gather=function(t,r){var o=this,i=this.transceivers[r].iceGatherer;if(!i.onlocalcandidate){var s=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),i.onlocalcandidate=function(e){if(!(o.usingBundle&&r>0)){var s=new Event("icecandidate");s.candidate={sdpMid:t,sdpMLineIndex:r};var a=e.candidate,c=!a||0===Object.keys(a).length;if(c)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),a.component=1,a.ufrag=i.getLocalParameters().usernameFragment;var u=n.writeCandidate(a);s.candidate=Object.assign(s.candidate,n.parseCandidate(u)),s.candidate.candidate=u,s.candidate.toJSON=function(){return{candidate:s.candidate.candidate,sdpMid:s.candidate.sdpMid,sdpMLineIndex:s.candidate.sdpMLineIndex,usernameFragment:s.candidate.usernameFragment}}}var d=n.getMediaSections(o._localDescription.sdp);d[s.candidate.sdpMLineIndex]+=c?"a=end-of-candidates\r\n":"a="+s.candidate.candidate+"\r\n",o._localDescription.sdp=n.getDescription(o._localDescription.sdp)+d.join("");var p=o.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==o.iceGatheringState&&(o.iceGatheringState="gathering",o._emitGatheringStateChange()),c||o._dispatchEvent("icecandidate",s),p&&(o._dispatchEvent("icecandidate",new Event("icecandidate")),o.iceGatheringState="complete",o._emitGatheringStateChange())}},e.setTimeout((function(){s.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},d.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var n=new e.RTCDtlsTransport(r);return n.ondtlsstatechange=function(){t._updateConnectionState()},n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:n}},d.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var n=this.transceivers[e].dtlsTransport;n&&(delete n.ondtlsstatechange,delete n.onerror,delete this.transceivers[e].dtlsTransport)},d.prototype._transceive=function(e,r,o){var s=i(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(s.encodings=e.sendEncodingParameters,s.rtcp={cname:n.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(s.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(s)),o&&e.rtpReceiver&&s.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?s.encodings=e.recvEncodingParameters:s.encodings=[{}],s.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(s.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(s.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(s))},d.prototype.setLocalDescription=function(e){var t,r,o=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(c("TypeError",'Unsupported type "'+e.type+'"'));if(!s("setLocalDescription",e.type,o.signalingState)||o._isClosed)return Promise.reject(c("InvalidStateError","Can not set local "+e.type+" in state "+o.signalingState));if("offer"===e.type)t=n.splitSections(e.sdp),r=t.shift(),t.forEach((function(e,t){var r=n.parseRtpParameters(e);o.transceivers[t].localCapabilities=r})),o.transceivers.forEach((function(e,t){o._gather(e.mid,t)}));else if("answer"===e.type){t=n.splitSections(o._remoteDescription.sdp),r=t.shift();var a=n.matchPrefix(r,"a=ice-lite").length>0;t.forEach((function(e,t){var s=o.transceivers[t],c=s.iceGatherer,u=s.iceTransport,d=s.dtlsTransport,p=s.localCapabilities,f=s.remoteCapabilities;if(!(n.isRejected(e)&&0===n.matchPrefix(e,"a=bundle-only").length)&&!s.rejected){var l=n.getIceParameters(e,r),h=n.getDtlsParameters(e,r);a&&(h.role="server"),o.usingBundle&&0!==t||(o._gather(s.mid,t),"new"===u.state&&u.start(c,l,a?"controlling":"controlled"),"new"===d.state&&d.start(h));var m=i(p,f);o._transceive(s,m.codecs.length>0,!1)}}))}return o._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?o._updateSignalingState("have-local-offer"):o._updateSignalingState("stable"),Promise.resolve()},d.prototype.setRemoteDescription=function(o){var d=this;if(-1===["offer","answer"].indexOf(o.type))return Promise.reject(c("TypeError",'Unsupported type "'+o.type+'"'));if(!s("setRemoteDescription",o.type,d.signalingState)||d._isClosed)return Promise.reject(c("InvalidStateError","Can not set remote "+o.type+" in state "+d.signalingState));var p={};d.remoteStreams.forEach((function(e){p[e.id]=e}));var f=[],l=n.splitSections(o.sdp),h=l.shift(),m=n.matchPrefix(h,"a=ice-lite").length>0,v=n.matchPrefix(h,"a=group:BUNDLE ").length>0;d.usingBundle=v;var g=n.matchPrefix(h,"a=ice-options:")[0];return d.canTrickleIceCandidates=!!g&&g.substr(14).split(" ").indexOf("trickle")>=0,l.forEach((function(s,c){var u=n.splitLines(s),l=n.getKind(s),g=n.isRejected(s)&&0===n.matchPrefix(s,"a=bundle-only").length,b=u[0].substr(2).split(" ")[2],y=n.getDirection(s,h),S=n.parseMsid(s),_=n.getMid(s)||n.generateIdentifier();if(g||"application"===l&&("DTLS/SCTP"===b||"UDP/DTLS/SCTP"===b))d.transceivers[c]={mid:_,kind:l,protocol:b,rejected:!0};else{var R,T,E,w,C,P,k,M,A;!g&&d.transceivers[c]&&d.transceivers[c].rejected&&(d.transceivers[c]=d._createTransceiver(l,!0));var O,U,N=n.parseRtpParameters(s);g||(O=n.getIceParameters(s,h),(U=n.getDtlsParameters(s,h)).role="client"),k=n.parseRtpEncodingParameters(s);var x=n.parseRtcpParameters(s),I=n.matchPrefix(s,"a=end-of-candidates",h).length>0,L=n.matchPrefix(s,"a=candidate:").map((function(e){return n.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===o.type||"answer"===o.type)&&!g&&v&&c>0&&d.transceivers[c]&&(d._disposeIceAndDtlsTransports(c),d.transceivers[c].iceGatherer=d.transceivers[0].iceGatherer,d.transceivers[c].iceTransport=d.transceivers[0].iceTransport,d.transceivers[c].dtlsTransport=d.transceivers[0].dtlsTransport,d.transceivers[c].rtpSender&&d.transceivers[c].rtpSender.setTransport(d.transceivers[0].dtlsTransport),d.transceivers[c].rtpReceiver&&d.transceivers[c].rtpReceiver.setTransport(d.transceivers[0].dtlsTransport)),"offer"!==o.type||g){if("answer"===o.type&&!g){T=(R=d.transceivers[c]).iceGatherer,E=R.iceTransport,w=R.dtlsTransport,C=R.rtpReceiver,P=R.sendEncodingParameters,M=R.localCapabilities,d.transceivers[c].recvEncodingParameters=k,d.transceivers[c].remoteCapabilities=N,d.transceivers[c].rtcpParameters=x,L.length&&"new"===E.state&&(!m&&!I||v&&0!==c?L.forEach((function(e){a(R.iceTransport,e)})):E.setRemoteCandidates(L)),v&&0!==c||("new"===E.state&&E.start(T,O,"controlling"),"new"===w.state&&w.start(U)),!i(R.localCapabilities,R.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&R.sendEncodingParameters[0].rtx&&delete R.sendEncodingParameters[0].rtx,d._transceive(R,"sendrecv"===y||"recvonly"===y,"sendrecv"===y||"sendonly"===y),!C||"sendrecv"!==y&&"sendonly"!==y?delete R.rtpReceiver:(A=C.track,S?(p[S.stream]||(p[S.stream]=new e.MediaStream),r(A,p[S.stream]),f.push([A,C,p[S.stream]])):(p.default||(p.default=new e.MediaStream),r(A,p.default),f.push([A,C,p.default])))}}else{(R=d.transceivers[c]||d._createTransceiver(l)).mid=_,R.iceGatherer||(R.iceGatherer=d._createIceGatherer(c,v)),L.length&&"new"===R.iceTransport.state&&(!I||v&&0!==c?L.forEach((function(e){a(R.iceTransport,e)})):R.iceTransport.setRemoteCandidates(L)),M=e.RTCRtpReceiver.getCapabilities(l),t<15019&&(M.codecs=M.codecs.filter((function(e){return"rtx"!==e.name}))),P=R.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var D,j=!1;if("sendrecv"===y||"sendonly"===y){if(j=!R.rtpReceiver,C=R.rtpReceiver||new e.RTCRtpReceiver(R.dtlsTransport,l),j)A=C.track,S&&"-"===S.stream||(S?(p[S.stream]||(p[S.stream]=new e.MediaStream,Object.defineProperty(p[S.stream],"id",{get:function(){return S.stream}})),Object.defineProperty(A,"id",{get:function(){return S.track}}),D=p[S.stream]):(p.default||(p.default=new e.MediaStream),D=p.default)),D&&(r(A,D),R.associatedRemoteMediaStreams.push(D)),f.push([A,C,D])}else R.rtpReceiver&&R.rtpReceiver.track&&(R.associatedRemoteMediaStreams.forEach((function(t){var r=t.getTracks().find((function(e){return e.id===R.rtpReceiver.track.id}));r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)})),R.associatedRemoteMediaStreams=[]);R.localCapabilities=M,R.remoteCapabilities=N,R.rtpReceiver=C,R.rtcpParameters=x,R.sendEncodingParameters=P,R.recvEncodingParameters=k,d._transceive(d.transceivers[c],!1,j)}}})),void 0===d._dtlsRole&&(d._dtlsRole="offer"===o.type?"active":"passive"),d._remoteDescription={type:o.type,sdp:o.sdp},"offer"===o.type?d._updateSignalingState("have-remote-offer"):d._updateSignalingState("stable"),Object.keys(p).forEach((function(t){var r=p[t];if(r.getTracks().length){if(-1===d.remoteStreams.indexOf(r)){d.remoteStreams.push(r);var n=new Event("addstream");n.stream=r,e.setTimeout((function(){d._dispatchEvent("addstream",n)}))}f.forEach((function(e){var t=e[0],n=e[1];r.id===e[2].id&&u(d,t,n,[r])}))}})),f.forEach((function(e){e[2]||u(d,e[0],e[1],[])})),e.setTimeout((function(){d&&d.transceivers&&d.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()},d.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")},d.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},d.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))},d.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},d.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},d.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(c("InvalidStateError","Can not call createOffer after close"));var i=r.transceivers.filter((function(e){return"audio"===e.kind})).length,s=r.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&&(s=!0===a.offerToReceiveVideo?1:!1===a.offerToReceiveVideo?0:a.offerToReceiveVideo)}for(r.transceivers.forEach((function(e){"audio"===e.kind?--i<0&&(e.wantReceive=!1):"video"===e.kind&&--s<0&&(e.wantReceive=!1)}));i>0||s>0;)i>0&&(r._createTransceiver("audio"),i--),s>0&&(r._createTransceiver("video"),s--);var u=n.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach((function(o,i){var s=o.track,a=o.kind,c=o.mid||n.generateIdentifier();o.mid=c,o.iceGatherer||(o.iceGatherer=r._createIceGatherer(i,r.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"),o.remoteCapabilities&&o.remoteCapabilities.codecs&&o.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),u.headerExtensions.forEach((function(e){(o.remoteCapabilities&&o.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var d=o.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];s&&t>=15019&&"video"===a&&!d[0].rtx&&(d[0].rtx={ssrc:d[0].ssrc+1}),o.wantReceive&&(o.rtpReceiver=new e.RTCRtpReceiver(o.dtlsTransport,a)),o.localCapabilities=u,o.sendEncodingParameters=d})),"max-compat"!==r._config.bundlePolicy&&(u+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),u+="a=ice-options:trickle\r\n",r.transceivers.forEach((function(e,t){u+=o(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),u+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==t&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,u+="a="+n.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(u+="a=end-of-candidates\r\n"))}));var d=new e.RTCSessionDescription({type:"offer",sdp:u});return Promise.resolve(d)},d.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(c("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(c("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var s=n.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(s+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),s+="a=ice-options:trickle\r\n";var a=n.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach((function(e,n){if(!(n+1>a)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?s+="m=application 0 DTLS/SCTP 5000\r\n":s+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?s+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(s+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(s+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var c;if(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,s+=o(e,u,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(s+="a=rtcp-rsize\r\n")}}));var u=new e.RTCSessionDescription({type:"answer",sdp:s});return Promise.resolve(u)},d.prototype.addIceCandidate=function(e){var t,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(o,i){if(!r._remoteDescription)return i(c("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var s=e.sdpMLineIndex;if(e.sdpMid)for(var u=0;u<r.transceivers.length;u++)if(r.transceivers[u].mid===e.sdpMid){s=u;break}var d=r.transceivers[s];if(!d)return i(c("OperationError","Can not add ICE candidate"));if(d.rejected)return o();var p=Object.keys(e.candidate).length>0?n.parseCandidate(e.candidate):{};if("tcp"===p.protocol&&(0===p.port||9===p.port))return o();if(p.component&&1!==p.component)return o();if((0===s||s>0&&d.iceTransport!==r.transceivers[0].iceTransport)&&!a(d.iceTransport,p))return i(c("OperationError","Can not add ICE candidate"));var f=e.candidate.trim();0===f.indexOf("a=")&&(f=f.substr(2)),(t=n.getMediaSections(r._remoteDescription.sdp))[s]+="a="+(p.type?f:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=n.getDescription(r._remoteDescription.sdp)+t.join("")}else for(var l=0;l<r.transceivers.length&&(r.transceivers[l].rejected||(r.transceivers[l].iceTransport.addRemoteCandidate({}),(t=n.getMediaSections(r._remoteDescription.sdp))[l]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=n.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));l++);o()}))},d.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var r=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?r=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(r=e.rtpReceiver)})),!r)throw c("InvalidAccessError","Invalid selector.");return r.getStats()}var n=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&n.push(e[t].getStats())}))})),Promise.all(n).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var r=e[t];if(r&&r.prototype&&r.prototype.getStats){var n=r.prototype.getStats;r.prototype.getStats=function(){return n.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(r){var n;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(n=e[r]).type]||n.type,t.set(r,e[r])})),t}))}}}));var p=["createOffer","createAnswer"];return p.forEach((function(e){var t=d.prototype[e];d.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)}})),(p=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=d.prototype[e];d.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=d.prototype[e];d.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)}})),d}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);t.Logger=n.default;var o=r(28);t.Client=o.default;var i=r(7);t.setServers=i.setServers;var s=r(8);t.getDevices=s.getDevices;var a=r(21);t.getSupportProfileNames=a.getSupportProfileNames;var c=r(9);t.version=c.version;var u=r(24);t.genToken=u.genToken;var d={Client:o.default,Logger:n.default,setServers:i.setServers,getDevices:s.getDevices,getSupportProfileNames:a.getSupportProfileNames,version:c.version,generateToken:u.genToken};t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(29),i=r(30),s=r(3),a=r(8),c=r(25),u=["user-added","user-removed","stream-added","stream-removed","stream-published","stream-subscribed","mute-video","unmute-video","mute-audio","unmute-audio"],d=function(){function e(e,t,r){this.eventWorker=new o.EventWorker,this.logger=n.default;var a,c,u=(r=r||{}).type,d=r.role,p=r.codec;switch(this.logger.debug("New Client ",e,t,u,d,p),u){case"live":a=s.ENUM_ROOM_TYPE.live;break;case"rtc":default:a=s.ENUM_ROOM_TYPE.rtc}switch(d){case"push":c=s.ENUM_ROLE_TYPE.pushStream;break;case"pull":c=s.ENUM_ROLE_TYPE.pullStream;break;case"push-and-pull":default:c=s.ENUM_ROLE_TYPE.allStream}a===s.ENUM_ROOM_TYPE.rtc&&(c=s.ENUM_ROLE_TYPE.allStream);var f;if(p)switch(p){case"h264":f="h264";break;case"vp8":default:f="vp8"}else f="vp8";this.sessionWorker=new i.SessionWorker(e,t,a,c,"opus",f),this.eventWorker.init(this.sessionWorker),this.sessionWorker.init()}return e.prototype.getUser=function(){return c.convertToOuterUser(this.sessionWorker.user)},e.prototype.getUsers=function(){return this.sessionWorker.users.map((function(e){return c.convertToOuterUser(e)}))},e.prototype.getStream=function(){return c.convertToOuterStream(this.sessionWorker.stream)},e.prototype.getStreams=function(){return this.sessionWorker.streams.map((function(e){return c.convertToOuterStream(e)}))},e.prototype.on=function(e,t){if(this.logger.debug("Client on ",e),!u.includes(e))throw new Error("not supported event type");this.eventWorker.on(e,t)},e.prototype.off=function(e,t){if(this.logger.debug("Client off ",e),!u.includes(e))throw new Error("not supported event type");this.eventWorker.off(e,t)},e.prototype.joinRoom=function(e,t,r,o){var i=this;if("function"!=typeof r&&(r=function(){}),"function"!=typeof o&&(o=function(){}),"string"!=typeof e){var s="roomId is incorrect";n.default.error("joinRoom ",s),o(s)}if("string"!=typeof t){s="userId is incorrect";n.default.error("joinRoom ",s),o(s)}this.sessionWorker.joinRoom(e,t,(function(){var e=i.sessionWorker.users.map((function(e){return c.convertToOuterUser(e)})),t=i.sessionWorker.streams.map((function(e){return c.convertToOuterStream(e)}));r&&r(e,t)}),o)},e.prototype.leaveRoom=function(e,t){"function"!=typeof e&&(e=function(){}),"function"!=typeof t&&(t=function(){}),this.sessionWorker.leaveRoom((function(t){n.default.debug(t," leave room"),e&&e()}),t)},e.prototype.subscribe=function(e,t){if("function"!=typeof t&&(t=function(){}),"string"!=typeof e){var r="streamId is incorrect";n.default.error("joinRoom ",r),t(r)}this.sessionWorker.subscribe(e,(function(){}),t)},e.prototype.unsubscribe=function(e,t,r){if("function"!=typeof t&&(t=function(){}),"function"!=typeof r&&(r=function(){}),"string"!=typeof e){var o="streamId is incorrect";n.default.error("joinRoom ",o),r(o)}this.sessionWorker.unsubscribe(e,t,r)},e.prototype.publish=function(e,t){var r;if("function"==typeof e)t=e,r={audio:!0,video:!0,screen:!1};else if(void 0===e)r={audio:!0,video:!0,screen:!1};else{if(e.screen&&e.video){var o="Video and screen cannot be true at the same time";return n.default.error("publish ",o),void("function"==typeof t&&t(o))}if(!e.audio&&!e.video&&!e.screen){o="Audio, video and screen cannot be false at the same time";return n.default.error("publish ",o),void("function"==typeof t&&t(o))}r={audio:!!e.audio,video:!!e.video,screen:!!e.screen,microphoneId:e.microphoneId,cameraId:e.cameraId}}"function"!=typeof t&&(t=function(){}),this.sessionWorker.publish(r,(function(){}),t)},e.prototype.unpublish=function(e,t){"function"!=typeof e&&(e=function(){}),"function"!=typeof t&&(t=function(){}),this.sessionWorker.unpublish(e,t)},e.prototype.getCameras=function(e,t){"function"!=typeof e&&(e=function(){}),"function"!=typeof t&&(t=function(){}),a.getDevices((function(t){e&&e(t.filter((function(e){return"videoinput"===e.kind})))}),t)},e.prototype.getMicrophones=function(e,t){"function"!=typeof e&&(e=function(){}),"function"!=typeof t&&(t=function(){}),a.getDevices((function(t){e&&e(t.filter((function(e){return"audioinput"===e.kind})))}),t)},e.prototype.getLoudspeakers=function(e,t){"function"!=typeof e&&(e=function(){}),"function"!=typeof t&&(t=function(){}),a.getDevices((function(t){e&&e(t.filter((function(e){return"audiooutput"===e.kind})))}),t)},e.prototype.getLocalMediaStream=function(){return this.getStream().mediaStream},e.prototype.getRemoteMediaStream=function(e){var t=this.getStreams().find((function(t){return t.sid===e}));return t&&t.mediaStream},e.prototype.startPlayingLocalStream=function(e){var t=null;if("string"==typeof e){var r=document.querySelector("#{player}");r&&"video"===r.tagName&&(t=r)}else t=e;var n=this.getLocalMediaStream();t&&n&&(t.srcObject=n)},e.prototype.startPlayingRemoteStream=function(e,t){var r=null;if("string"==typeof t){var n=document.querySelector("#{player}");n&&"video"===n.tagName&&(r=n)}else r=t;var o=this.getRemoteMediaStream(e);r&&o&&(r.srcObject=o)},e.prototype.stopPlayingStream=function(e){var t=null;if("string"==typeof e){var r=document.querySelector("#{player}");r&&"video"===r.tagName&&(t=r)}else t=e;t&&(t.srcObject=null)},e.prototype.muteVideo=function(){return this.sessionWorker.muteVideo()},e.prototype.unmuteVideo=function(){return this.sessionWorker.unmuteVideo()},e.prototype.muteAudio=function(){return this.sessionWorker.muteAudio()},e.prototype.unmuteAudio=function(){return this.sessionWorker.unmuteAudio()},e.prototype.getAudioVolume=function(e){return Math.floor(100*this.sessionWorker.getAudioVolume(e))},e.prototype.setVideoProfile=function(e,t,r){"function"!=typeof t&&(t=function(){}),"function"!=typeof r&&(r=function(){}),this.sessionWorker.setVideoProfile(e,t,r)},e.prototype.getAudioStats=function(e,t,r){"function"==typeof e&&(r=t,t=e,e=this.getStream().sid),"function"!=typeof t&&(t=function(){}),"function"!=typeof r&&(r=function(){}),"string"!=typeof e&&(e=""),this.sessionWorker.getStats(e,(function(e){t&&t(e.audio)}),r)},e.prototype.getVideoStats=function(e,t,r){"function"==typeof e&&(r=t,t=e,e=this.getStream().sid),"function"!=typeof t&&(t=function(){}),"function"!=typeof r&&(r=function(){}),"string"!=typeof e&&(e=""),this.sessionWorker.getStats(e,(function(e){t&&t(e.video)}),r)},e.prototype.getNetworkStats=function(e,t,r){"function"==typeof e&&(r=t,t=e,e=this.getStream().sid),"function"!=typeof t&&(t=function(){}),"function"!=typeof r&&(r=function(){}),"string"!=typeof e&&(e=""),this.sessionWorker.getStats(e,(function(e){var r={rtt:e.connection.rtt||e.connection.delay};t&&t(r)}),r)},e.prototype.startRecording=function(e,t,r){var o;switch((e=e||{}).waterMarkPosition){case"left-top":o=s.ENUM_WATER_MARK_POS.lt;break;case"left-bottom":o=s.ENUM_WATER_MARK_POS.lb;break;case"right-top":o=s.ENUM_WATER_MARK_POS.rt;break;case"right-bottom":o=s.ENUM_WATER_MARK_POS.rb;break;default:var i="unknown water mark position";return n.default.error("startRecording ",i),void(r&&r(i))}var a={waterMarkPos:o,bucket:e.bucket,region:e.region};"function"!=typeof t&&(t=function(){}),"function"!=typeof r&&(r=function(){}),this.sessionWorker.startRecording(a,t,r)},e.prototype.stopRecording=function(e,t){"function"!=typeof e&&(e=function(){}),"function"!=typeof t&&(t=function(){}),this.sessionWorker.stopRecording(e,t)},e.prototype.switchDevice=function(e,t,r,o){var i=function(e){"function"==typeof r&&r(e)},s=function(e){"function"==typeof o&&o(e)};switch(e){case"audio":this.sessionWorker.switchDevice("audio",t,i,s);break;case"video":this.sessionWorker.switchDevice("video",t,i,s);break;default:var a="device type unknown";n.default.error("switchDevice ",a),s(a)}},e}();t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5),o=function(){function e(){this.emitter=new n.EventEmitter}return e.prototype.init=function(e){this.sessionWorker=e,this.sessionWorker.emitter=this.emitter},e.prototype.on=function(e,t){this.emitter.on(e,t)},e.prototype.off=function(e,t){this.emitter.off(e,t)},e}();t.EventWorker=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5),o=r(10),i=r(54),s=r(8),a=r(22),c=r(9),u=r(24),d=r(1),p=r(23),f=r(4),l=r(3),h=r(25),m=function(){function e(){}return Object.defineProperty(e.prototype,"devinfo",{get:function(){return u.encode(this._devinfo)},enumerable:!0,configurable:!0}),e}(),v=function(){function e(e,t,r,o,u,d){this.session=new m,this.socketWorker=new i.SocketWorker,this.rpcMap={},this.joinStatus=l.ENUM_ROOM_STATUS.unjoin,this.publishId="",this.publishStatus=l.ENUM_PUBLISH_STATUS.unpublish,this.audioMuted=!1,this.videoMuted=!1,this.recordId="",this.recordStatus=l.ENUM_RECORD_STATUS.unrecord,this.users=[],this.streams=[];var h=f.getDeviceInfo(),v=f.getSystemInfo(),g=f.getCPUInfo();this.session.app_id=e,this.session.room_token=t,this.session.room_type=r,this.session.role_type=o;var b={sdkv:c.version,agent:p.getAgent(),device:h.vendor+"_"+h.brand+"_"+h.model,system:""+v.name+v.version+"_"+v.versionName,network:""+f.getNetworkInfo().network,cpu:g.brand+"_"+g.model+"_"+g.core,mem:f.getMemInfo().capacity+"MB"};this.session._devinfo=b,this.innerEmitter=new n.EventEmitter,this.innerEmitter.on("mediaStreamPublished",this.onMediaStreamPublished.bind(this)),this.innerEmitter.on("mediaStreamSubscribed",this.onMediaStreamSubscribed.bind(this)),this.streamWorker=new s.StreamWorker(u,d),this.logReporter=new a.LogReporter,this.streamWorker.emitter=this.innerEmitter,this.streamWorker.logReporter=this.logReporter}return Object.defineProperty(e.prototype,"emitter",{set:function(e){this._emitter=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isJoinedRoom",{get:function(){return this.joinStatus===l.ENUM_ROOM_STATUS.joined},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canPublish",{get:function(){var e=!1;switch(this.session.role_type){case l.ENUM_ROLE_TYPE.pushStream:case l.ENUM_ROLE_TYPE.allStream:e=!0;break;default:e=!1}return e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isPublished",{get:function(){return this.publishStatus===l.ENUM_PUBLISH_STATUS.published},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRecording",{get:function(){return this.recordStatus===l.ENUM_RECORD_STATUS.recording},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"user",{get:function(){return{user_id:this.session.user_id}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stream",{get:function(){var e=this.streamWorker.getPublishConfig();return{sid:this.publishId,uid:this.user.user_id,stream_type:l.ENUM_STREAM_TYPE.publish,media_type:e.mediaType,audio:e.audio,video:e.video,data:e.data,muteaudio:this.audioMuted,mutevideo:this.videoMuted,mediaStream:this.mediaStream,pubStatus:this.publishStatus}},enumerable:!0,configurable:!0}),e.prototype.init=function(){var e=this;this.socketWorker.onmessage=function(t){var r;try{r=JSON.parse(t.data)}catch(e){return void d.default.error("socket onmessage ",e)}var n=(e.rpcMap[r.rpc_id]||{}).req,o=e.rpcMap[r.rpc_id]||{},i=o.onSuccess,s=o.onFailure;if("function"!=typeof i&&(i=function(){}),"function"!=typeof s&&(s=function(){}),d.default.debug("socket request: ",n),d.default.debug("socket response: ",r),n){if(0!==r.err)return e.onError({method:n.method,msg:r.msg}),void s(r.msg);switch(n.method){case"joinroom":e.onJoinRoom(r.data,i);break;case"leaveroom":e.onLeaveRoom(r.data,i);break;case"subscribe":e.onSubscribe({streamsub_id:r.data.streamsub_id,stream_id:r.data.stream_id,media_type:r.data.media_type,user_id:n.data.dst.user_id},i,s);break;case"unsubscribe":e.onUnsubscribe(r.data,i,s);break;case"publish":e.onPublish(r.data,i,s);break;case"unpublish":e.onUnpublish(r.data,i,s);break;case"sdp":r.data.stream_type===l.ENUM_STREAM_TYPE.publish&&e.onSdpPublish(r.data,i,s),r.data.stream_type===l.ENUM_STREAM_TYPE.subscribe&&e.onSdpSubscribe(r.data,i,s);break;case"mute":break;case"startrecord":e.onStartRecord(r.data,i);break;case"stoprecord":e.onStopRecord(r.data,i)}}else switch(r.method){case"userst":r.data.cmdtype===l.ENUM_USER_CMD_TYPE.userJoin&&e.onUserJoin(r.data),r.data.cmdtype===l.ENUM_USER_CMD_TYPE.userLeave&&e.onUserLeave(r.data);break;case"streamst":r.data.cmdtype===l.ENUM_STREAM_CMD_TYPE.add&&e.onAddStream(r.data),r.data.cmdtype===l.ENUM_STREAM_CMD_TYPE.remove&&e.onRemoveStream(r.data);break;case"transportclose":e.onTransportClose(r.data);break;case"transporttimeout":e.onTransportTimeout(r.data);break;case"trackst":switch(r.data.track_type){case l.ENUM_TRACK_TYPE.audio:e.onAudioTrackst(r.data);break;case l.ENUM_TRACK_TYPE.video:e.onVideoTrackst(r.data);break;case l.ENUM_TRACK_TYPE.data:e.onDataTrackst(r.data);break;default:d.default.warn("trackst unknown track type ",r.data.track_type)}break;case"kickoff":e.onKickoff(r.data)}}},e.prototype.getGW=function(e,t){var r=this;o.get({data:{Action:"rsugetrtcgateway",rpc_id:p.getId(),user_id:this.session.user_id,room_id:this.session.room_id,app_id:this.session.app_id,token:this.session.room_token,devinfo:this.session.devinfo}}).then((function(t){var n=u.decode(t.data.access_token);d.default.debug("getGW ",n),r.session.access_token=t.data.access_token,r.session.wsURL="wss://"+n[0].singal+":"+n[0].port+"/ws",e(t.data.access_token)})).catch((function(e){d.default.error("getGW - ",e),t(e)}))},e.prototype.getLiveGW=function(e,t){var r=this;o.get({data:{Action:"rsugetlivegateway",rpc_id:p.getId(),user_id:this.session.user_id,room_id:this.session.room_id,app_id:this.session.app_id,token:this.session.room_token,role:this.session.role_type,devinfo:this.session.devinfo}}).then((function(t){var n=u.decode(t.data.access_token);d.default.debug("getLiveGW ",n),r.session.access_token=t.data.access_token,r.session.wsURL="wss://"+n[0].singal+":"+n[0].port+"/ws",e(t.data.access_token)})).catch((function(e){d.default.error("getLiveGW - ",e),t(e)}))},e.prototype.send=function(e,t,r,n){if(!this.socketWorker.isOpened)return Promise.reject("socket is not open");var o=p.getId(),i={method:e,version:.1,rpc_id:o,data:t};this.rpcMap[o]={req:i,onSuccess:r,onFailure:n};var s=JSON.stringify(i);return this.socketWorker.send(s)},e.prototype.joinRoom=function(e,t,r,n){var o=this,i="";switch(this.joinStatus){case l.ENUM_ROOM_STATUS.joining:return i="you are joining the room",d.default.error("joinRoom - ",i),void n(i);case l.ENUM_ROOM_STATUS.leaving:return i="you are leaving the room",d.default.error("joinRoom - ",i),void n(i);case l.ENUM_ROOM_STATUS.joined:return i="you have already joined the room",d.default.error("joinRoom - ",i),void n(i);case l.ENUM_ROOM_STATUS.unjoin:}this.joinStatus=l.ENUM_ROOM_STATUS.joining,this.session.room_id=e,this.session.user_id=t,this.logReporter.init(this.session.app_id,e,t);var s=function(){d.default.debug("joinRoom success"),o.joinStatus=l.ENUM_ROOM_STATUS.joined,r(h.convertToOuterUser(o.user))},a=function(e){o.logReporter.reset(),o.session.user_id="",o.session.room_id="",o.joinStatus=l.ENUM_ROOM_STATUS.unjoin,o.session.access_token="",o.session.wsURL="",n(e)},c=function(e,t){o.socketWorker.connect(o.session.wsURL).then((function(r){d.default.debug("joinRoom ",r);var n={app_id:o.session.app_id,room_id:o.session.room_id,user_id:o.session.user_id,authtoken:o.session.room_token,devinfo:o.session.devinfo,role_type:o.session.role_type,room_type:o.session.room_type,sessionid:"2"};o.send("joinroom",n,e,t).catch(t)})).catch(t)};this.session.room_type===l.ENUM_ROOM_TYPE.live?this.getLiveGW((function(e){d.default.debug("getLiveGW token ",e),c(s,a)}),a):this.getGW((function(e){d.default.debug("getGW token ",e),c(s,a)}),a)},e.prototype.onJoinRoom=function(e,t){var r=this,n=e.users,o=void 0===n?[]:n,i=e.streams,s=void 0===i?[]:i;d.default.debug("onJoinRoom ",o,s),this.users=o,this.streams=s.map((function(e){return Object.assign({},e,{stream_type:l.ENUM_STREAM_TYPE.subscribe,subStatus:l.ENUM_SUBSCRIBE_STATUS.unsubscribe})})),this.logReporter.reportJoinRoomLog(),this.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.joinRoom),t(),this.keepalive=window.setInterval((function(){r.send("ping",{})}),18e4),o.forEach((function(e){r._emitter.emit("user-added",h.convertToOuterUser(e))})),s.forEach((function(e){r._emitter.emit("stream-added",h.convertToOuterStream(e))}))},e.prototype.leaveRoom=function(e,t){var r=this,n="";switch(this.joinStatus){case l.ENUM_ROOM_STATUS.unjoin:return n="you have not joined the room",d.default.error("leaveRoom - ",n),void t(n);case l.ENUM_ROOM_STATUS.joining:return n="you are joining the room",d.default.error("leaveRoom - ",n),void t(n);case l.ENUM_ROOM_STATUS.leaving:return n="you are leaving the room",d.default.error("leaveRoom - ",n),void t(n);case l.ENUM_ROOM_STATUS.joined:}this.joinStatus=l.ENUM_ROOM_STATUS.leaving,this.isRecording&&this.stopRecording((function(){d.default.debug("leave room - stopRecording ")}),(function(e){d.default.debug("leave room - stopRecording ",e)})),this.isPublished&&this.unpublish((function(e){d.default.debug("leave room - unpublish ",e)}),(function(e){d.default.debug("leave room - unpublish ",e)})),this.streams.forEach((function(e){e.subStatus===l.ENUM_SUBSCRIBE_STATUS.subscribed&&r.unsubscribe(e.sid,(function(e){d.default.debug("leave room - unsubscribe ",e)}),(function(e){d.default.debug("leave room - unsubscribe ",e)}))}));var o=function(e){d.default.error("leaveRoom ",e),r.joinStatus=l.ENUM_ROOM_STATUS.joined,t(e)};this.send("leaveroom",{room_id:this.session.room_id},(function(){d.default.debug("leaveRoom success"),r.joinStatus=l.ENUM_ROOM_STATUS.unjoin,e(h.convertToOuterUser(r.user))}),o).catch(o)},e.prototype.onLeaveRoom=function(e,t){var r=this;d.default.debug("onLeaveRoom ",e),window.clearInterval(this.keepalive);this.logReporter.reportLeaveRoomLog(),this.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.leaveRoom),t(),r.logReporter.reset(),r.session.user_id="",r.session.room_id="",r.joinStatus=l.ENUM_ROOM_STATUS.unjoin,r.session.access_token="",r.session.wsURL="",r.rpcMap={},r.users=[],r.recordId="",r.recordStatus=l.ENUM_RECORD_STATUS.unrecord,r.streamWorker.removeLocalStream(r.publishId,(function(){}),(function(){})),r.publishId="",r.mediaStream=void 0,r.publishStatus=l.ENUM_PUBLISH_STATUS.unpublish,r.streams.forEach((function(e){r.streamWorker.removeRemoteStream(e.sid,(function(){}),(function(){}))})),r.streams=[],this.socketWorker.close(1e3,"leave room").catch((function(e){d.default.error("connect close - ",e),r.socketWorker.close(1e3,"leave room").catch((function(e){d.default.error("connect close - ",e)}))}))},e.prototype.publish=function(e,t,r){var n=this,o="";if(!this.isJoinedRoom)return o="you have not joined the room",d.default.error("publish - ",o),void r(o);switch(this.publishStatus){case l.ENUM_PUBLISH_STATUS.publishing:return o="you are publishing",d.default.error("publish - ",o),void r(o);case l.ENUM_PUBLISH_STATUS.unpublishing:return o="you are unpublishing",d.default.error("publish - ",o),void r(o);case l.ENUM_PUBLISH_STATUS.published:return o="you have already published",d.default.error("publish - ",o),void r(o);case l.ENUM_PUBLISH_STATUS.unpublish:}if(!this.canPublish)return o="role type is pull",d.default.error("publish - ",o),void r(o);this.publishStatus=l.ENUM_PUBLISH_STATUS.publishing,this.streamWorker.updatePublishConfig(e);var i=this.streamWorker.getPublishConfig(),s=function(e){d.default.error("publish ",e),n.publishStatus=l.ENUM_PUBLISH_STATUS.unpublish,n.logReporter.reportExceptionLog(a.ENUM_LOG_EXCEPTION_TYPE.publish,{stype:l.ENUM_STREAM_TYPE.publish,mtype:i.mediaType}),r(e)};this.send("publish",{user_id:this.user.user_id,media_type:i.mediaType,audio:i.audio,video:i.video,data:i.data,payload:this.streamWorker.videoCodec},(function(e){d.default.debug("publish success"),n.publishStatus=l.ENUM_PUBLISH_STATUS.published,t(h.convertToOuterStream(e))}),s).catch(s)},e.prototype.onPublish=function(e,t,r){var n=this,o=e.stream_id,i=e.media_type;d.default.debug("onPublish ",o,i);var s=this.streamWorker.getPublishConfig();this.publishId=o,this.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.publish,{streamId:this.stream.sid,stype:l.ENUM_STREAM_TYPE.publish,mtype:s.mediaType});var c=function(e){d.default.debug("publish rollback ",e),n.publishId="",r(e)};this.streamWorker.createLocalStream(this.user.user_id,this.stream.sid,i,(function(e){n.sdpPublish(e,(function(){d.default.debug("sdpPublish success"),t(n.stream)}),(function(e){n.streamWorker.removeLocalStream(o,(function(){c(e)}),(function(e){d.default.error("publish rollback - ",e)}))}))}),c)},e.prototype.unpublish=function(e,t){var r=this,n="";switch(this.publishStatus){case l.ENUM_PUBLISH_STATUS.unpublish:return n="you have not published",d.default.error("unpublish - ",n),void t(n);case l.ENUM_PUBLISH_STATUS.publishing:return n="you are publishing",d.default.error("unpublish - ",n),void t(n);case l.ENUM_PUBLISH_STATUS.unpublishing:return n="you are unpublishing",d.default.error("unpublish - ",n),void t(n);case l.ENUM_PUBLISH_STATUS.published:}this.publishStatus=l.ENUM_PUBLISH_STATUS.unpublishing;var o=this.streamWorker.getPublishConfig(),i=Object.assign({},this.stream),s=function(e){d.default.error("unpublish ",e),r.publishStatus=l.ENUM_PUBLISH_STATUS.published,t(e)};this.send("unpublish",{user_id:this.user.user_id,stream_id:this.stream.sid,media_type:o.mediaType},(function(){d.default.debug("unpublish success "),i.pubStatus=r.publishStatus=l.ENUM_PUBLISH_STATUS.unpublish,delete i.mediaStream,e(h.convertToOuterStream(i))}),s).catch(s)},e.prototype.onUnpublish=function(e,t,r){var n=this;d.default.debug("onUnpublish ",e);var o=this.streamWorker.getPublishConfig();this.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.unpublish,{streamId:this.stream.sid,stype:l.ENUM_STREAM_TYPE.publish,mtype:o.mediaType}),this.streamWorker.removeLocalStream(this.publishId,(function(){n.mediaStream=void 0,n.publishId="",t()}),(function(e){d.default.error("unpublish - ",e),r(e)}))},e.prototype.subscribe=function(e,t,r){var n=this,o="";if(!this.isJoinedRoom)return o="you have not joined the room",d.default.error("subscribe - ",o),void r(o);var i=this.streams.find((function(t){return t.sid===e}));if(d.default.debug("subscribe - ",e,i),!i)return o="cannot find the stream",d.default.error("subscribe - ",o),void r(o);switch(i.subStatus){case l.ENUM_SUBSCRIBE_STATUS.subscribing:return o="you are subscribing",d.default.error("subscribe - ",o),void r(o);case l.ENUM_SUBSCRIBE_STATUS.unsubscribing:return o="you are unsubscribing",d.default.error("subscribe - ",o),void r(o);case l.ENUM_SUBSCRIBE_STATUS.subscribed:return o="you have already subscribed",d.default.error("subscribe - ",o),void r(o);case l.ENUM_SUBSCRIBE_STATUS.unsubscribe:}i.subStatus=l.ENUM_SUBSCRIBE_STATUS.subscribing;var s=function(e){d.default.error("subscribe ",e),i.subStatus=l.ENUM_SUBSCRIBE_STATUS.unsubscribe,n.logReporter.reportExceptionLog(a.ENUM_LOG_EXCEPTION_TYPE.subscribe,{userId:i.uid,streamId:i.sid,stype:l.ENUM_STREAM_TYPE.subscribe,mtype:i.media_type}),r(e)};this.send("subscribe",{src:{user_id:this.user.user_id,audio:i.audio,video:i.video,data:i.data},dst:{user_id:i.uid,stream_id:i.sid,media_type:i.media_type}},(function(e){d.default.debug("subscribe success "),e.subStatus=l.ENUM_SUBSCRIBE_STATUS.subscribed,t(h.convertToOuterStream(e))}),s).catch(s)},e.prototype.onSubscribe=function(e,t,r){var n=this,o=e.streamsub_id,i=e.stream_id,s=e.media_type,c=e.user_id;d.default.debug("onSubscribe ",o,i,s,c);var u=this.streams.find((function(e){return e.sid===i}));if(!u){var p="cannot find stream in local cache";return d.default.error("onSubscribe - ",p),void r(p)}u.streamsub_id=o,this.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.subscribe,{streamId:u.sid,userId:u.uid,stype:l.ENUM_STREAM_TYPE.subscribe,mtype:u.media_type});var f=function(e){d.default.debug("subscribe rollback ",e),n.send("unsubscribe",{src:{user_id:n.user.user_id,streamsub_id:u.streamsub_id},dst:{user_id:u.uid,stream_id:u.sid,media_type:u.media_type}},(function(){d.default.debug("subscribe rollback success"),n.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.unsubscribe,{streamId:u.sid,userId:u.uid,stype:l.ENUM_STREAM_TYPE.subscribe,mtype:u.media_type}),delete u.streamsub_id,r(e)}),(function(e){d.default.error("subscribe rollback - ",e)})).catch((function(e){d.default.error("subscribe rollback - ",e)}))};this.streamWorker.createRemoteStream(u.uid,e,(function(e,r){n.sdpSubscribe(e,r,(function(){d.default.debug("sdpSubscribe success"),t(u)}),(function(t){n.streamWorker.removeRemoteStream(e,(function(){f(t)}),(function(e){d.default.error("subscribe rollback - ",e)}))}))}),f)},e.prototype.unsubscribe=function(e,t,r){var n="",o=this.streams.find((function(t){return t.sid===e}));if(d.default.debug("unsubscribe ",e,o),!o)return n="cannot find the stream",d.default.error("unsubscribe - ",n),void r(n);switch(o.subStatus){case l.ENUM_SUBSCRIBE_STATUS.subscribing:return n="you are subscribing",d.default.error("unsubscribe - ",n),void r(n);case l.ENUM_SUBSCRIBE_STATUS.unsubscribing:return n="you are unsubscribing",d.default.error("unsubscribe - ",n),void r(n);case l.ENUM_SUBSCRIBE_STATUS.unsubscribe:return n="you have not subscribed",d.default.error("unsubscribe - ",n),void r(n);case l.ENUM_SUBSCRIBE_STATUS.subscribed:}o.subStatus=l.ENUM_SUBSCRIBE_STATUS.unsubscribing;var i=function(e){d.default.error("unsubscribe ",e),o.subStatus=l.ENUM_SUBSCRIBE_STATUS.subscribed,r(e)};this.send("unsubscribe",{src:{user_id:this.user.user_id,streamsub_id:o.streamsub_id},dst:{user_id:o.uid,stream_id:o.sid,media_type:o.media_type}},(function(e){d.default.debug("unsubscribe success"),e.subStatus=l.ENUM_SUBSCRIBE_STATUS.unsubscribe,t(h.convertToOuterStream(e))}),i).catch(i)},e.prototype.onUnsubscribe=function(e,t,r){var n=e.user_id,o=e.media_type,i=this.streams.find((function(e){return e.uid===n}));if(d.default.debug("onUnsubscribe ",n,o,i),!i&&this.isJoinedRoom){var s="cannot find stream in local cache";return d.default.error("onUnsubscribe ",s),void r(s)}i&&(this.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.unsubscribe,{streamId:i.sid,userId:i.uid,stype:l.ENUM_STREAM_TYPE.subscribe,mtype:i.media_type}),this.streamWorker.removeRemoteStream(i.sid,(function(){delete i.streamsub_id,delete i.mediaStream,t(i)}),(function(e){d.default.error("unsubscribe - ",e),r(e)})))},e.prototype.sdpPublish=function(e,t,r){d.default.debug("sdpPublish ",e);var n=function(e){d.default.error("sdpPublish - ",e),r(e)},o=this.streamWorker.getPublishConfig();this.send("sdp",{src:{user_id:this.user.user_id,stream_id:this.publishId,media_type:o.mediaType,stream_type:l.ENUM_STREAM_TYPE.publish},sdp:{type:"offer",sdpcontent:e.sdp}},(function(){d.default.debug("sdpPublish"),t()}),n).catch(n)},e.prototype.onSdpPublish=function(e,t,r){d.default.debug("onSdpPublish ",e);var n=e.stream_id,o=e.sdp;this.streamWorker.answer(n,o,t,r)},e.prototype.sdpSubscribe=function(e,t,r,n){d.default.debug("sdpSubscribe ",e,t);var o=this.streams.find((function(t){return t.sid===e}));if(!o){var i="cannot find stream in local cache";return d.default.error("sdpSubscribe - ",i),void n(i)}var s=function(e){d.default.error("sdpSubscribe - ",e),n(e)};this.send("sdp",{src:{user_id:this.user.user_id,stream_id:o.streamsub_id,media_type:o.media_type,stream_type:l.ENUM_STREAM_TYPE.subscribe},sdp:{type:"offer",sdpcontent:t.sdp}},(function(){d.default.debug("sdpSubscribe"),r()}),s).catch(s)},e.prototype.onSdpSubscribe=function(e,t,r){d.default.debug("onSdpSubscribe ",e);var n=e.stream_id,o=e.sdp,i=n;this.streamWorker.answer(i,o,t,r)},e.prototype.muteVideo=function(){if(!this.isPublished){var e="you have not published";return d.default.error("muteVideo ",e),!1}var t=this.streamWorker.getPublishConfig();if(!t.video&&!t.screen){e="no video track";return d.default.error("muteVideo ",e),!1}return this.send("mute",{user_id:this.user.user_id,stream_id:this.publishId,stream_type:l.ENUM_STREAM_TYPE.publish,track_type:l.ENUM_TRACK_TYPE.video,mute:!0}),this.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.muteVideo,{streamId:this.publishId,userId:this.user.user_id,stype:l.ENUM_STREAM_TYPE.publish,mtype:t.mediaType}),this.streamWorker.muteVideo(this.publishId)},e.prototype.unmuteVideo=function(){if(!this.isPublished){var e="you have not published";return d.default.error("unmuteVideo ",e),!1}var t=this.streamWorker.getPublishConfig();if(!t.video&&!t.screen){e="no video track";return d.default.error("unmuteVideo ",e),!1}return this.send("mute",{user_id:this.user.user_id,stream_id:this.publishId,stream_type:l.ENUM_STREAM_TYPE.publish,track_type:l.ENUM_TRACK_TYPE.video,mute:!1}),this.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.unmuteVideo,{streamId:this.publishId,userId:this.user.user_id,stype:l.ENUM_STREAM_TYPE.publish,mtype:t.mediaType}),this.streamWorker.unmuteVideo(this.publishId)},e.prototype.muteAudio=function(){if(!this.isPublished){return d.default.error("muteAudio ","you have not published"),!1}var e=this.streamWorker.getPublishConfig();return!!e.audio&&(this.send("mute",{user_id:this.user.user_id,stream_id:this.publishId,stream_type:l.ENUM_STREAM_TYPE.publish,track_type:l.ENUM_TRACK_TYPE.audio,mute:!0}),this.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.muteAudio,{streamId:this.publishId,userId:this.user.user_id,stype:l.ENUM_STREAM_TYPE.publish,mtype:e.mediaType}),this.streamWorker.muteAudio(this.publishId))},e.prototype.unmuteAudio=function(){if(!this.isPublished){return d.default.error("unmuteAudio ","you have not published"),!1}var e=this.streamWorker.getPublishConfig();return!!e.audio&&(this.send("mute",{user_id:this.user.user_id,stream_id:this.publishId,stream_type:l.ENUM_STREAM_TYPE.publish,track_type:l.ENUM_TRACK_TYPE.audio,mute:!1}),this.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.unmuteAudio,{streamId:this.publishId,userId:this.user.user_id,stype:l.ENUM_STREAM_TYPE.publish,mtype:e.mediaType}),this.streamWorker.unmuteAudio(this.publishId))},e.prototype.muteData=function(){},e.prototype.unmuteData=function(){},e.prototype.startRecording=function(e,t,r){var n,o=this,i="";if(!this.isPublished)return i="you have not published",d.default.error("startRecording - ",i),void r(i);switch(this.recordStatus){case l.ENUM_RECORD_STATUS.starting:return i="local stream record is starting",d.default.error("startRecording - ",i),void r(i);case l.ENUM_RECORD_STATUS.stopping:return i="local stream record is stopping",d.default.error("startRecording - ",i),void r(i);case l.ENUM_RECORD_STATUS.recording:return i="local stream is recording",d.default.error("startRecording - ",i),void r(i);case l.ENUM_RECORD_STATUS.unrecord:}var s=this.streamWorker.getPublishConfig();if(s.audio&&s.video)n=l.ENUM_RECORD_MIME.audioVideo;else if(s.audio&&s.screen)n=l.ENUM_RECORD_MIME.audioVideo;else if(s.audio)n=l.ENUM_RECORD_MIME.audio;else if(s.video)n=l.ENUM_RECORD_MIME.video;else{if(!s.screen)return i="stream config is incorrect",d.default.error(i),void r(i);n=l.ENUM_RECORD_MIME.video}var c=this.streamWorker.currentResolution.video,u=c.width,p=c.height;this.recordStatus=l.ENUM_RECORD_STATUS.starting;var f=function(e){d.default.error("startRecording ",e),o.recordStatus=l.ENUM_RECORD_STATUS.unrecord,r(e)};this.send("startrecord",{room_id:this.session.room_id,app_id:this.session.app_id,user_id:this.session.user_id,config:{mimetype:n,mainviewuid:this.session.user_id,mainviewtype:s.mediaType,width:u,height:p,watermarkpos:e.waterMarkPos,bucket:e.bucket,region:e.region}},(function(e){d.default.debug("startRecording success",e),o.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.startRecord,{recordId:e.RecordId,stype:l.ENUM_STREAM_TYPE.publish,mtype:s.mediaType}),o.recordStatus=l.ENUM_RECORD_STATUS.recording,t({FileName:e.FileName,RecordId:e.RecordId})}),f).catch(f)},e.prototype.onStartRecord=function(e,t){d.default.debug("onStartRecord ",e);var r=e.RecordId,n=e.FileName;this.recordId=r,t({RecordId:r,FileName:n})},e.prototype.stopRecording=function(e,t){var r=this,n="";switch(this.recordStatus){case l.ENUM_RECORD_STATUS.starting:return n="local stream record is starting",d.default.error("stopRecording - ",n),void t(n);case l.ENUM_RECORD_STATUS.stopping:return n="local stream record is stopping",d.default.error("stopRecording - ",n),void t(n);case l.ENUM_RECORD_STATUS.unrecord:return n="local stream isnot recording",d.default.error("stopRecording - ",n),void t(n);case l.ENUM_RECORD_STATUS.recording:}this.recordStatus=l.ENUM_RECORD_STATUS.stopping;var o=this.recordId,i=this.streamWorker.getPublishConfig(),s=function(e){d.default.error("stopRecording - ",e),r.recordStatus=l.ENUM_RECORD_STATUS.recording,t(e)};this.send("stoprecord",{room_id:this.session.room_id,app_id:this.session.app_id,user_id:this.session.user_id},(function(){d.default.debug("stopRecording success"),r.logReporter.reportOperationLog(a.ENUM_LOG_OPERATION_TYPE.startRecord,{recordId:o,stype:l.ENUM_STREAM_TYPE.publish,mtype:i.mediaType}),r.recordStatus=l.ENUM_RECORD_STATUS.unrecord,e()}),s).catch(s)},e.prototype.onStopRecord=function(e,t){d.default.debug("onStopRecord ",e),this.recordId="",t()},e.prototype.setVideoProfile=function(e,t,r){this.streamWorker.setVideoProfile(e).then((function(e){t(e)})).catch((function(e){r(e)}))},e.prototype.switchDevice=function(e,t,r,n){switch(e){case"audio":this.streamWorker.switchMicrophone(t,r,n);break;case"video":this.streamWorker.switchCamera(t,r,n)}},e.prototype.getAudioVolume=function(e){return e||this.isPublished?e?this.streamWorker.getAudioVolume(e)||0:this.streamWorker.getAudioVolume(this.publishId)||0:0},e.prototype.getStats=function(e,t,r){if(!e&&!this.isPublished){var n="stream Id is required";return d.default.error("getStats ",n),void r(n)}e?this.streamWorker.getStats(e,t,r):this.streamWorker.getStats(this.publishId,t,r)},e.prototype.onError=function(e){d.default.error("onError "+e.method,e.msg)},e.prototype.onUserJoin=function(e){var t=e.user_id,r=e.cmdtype,n=e.reason;if(d.default.debug("onUserJoin ",t,r,n),!this.users.find((function(e){return e.user_id===t}))){var o={user_id:t};this.users.push(o),this._emitter.emit("user-added",h.convertToOuterUser(o))}},e.prototype.onUserLeave=function(e){var t=e.user_id,r=e.cmdtype,n=e.reason;d.default.debug("onUserLeave ",t,r,n),this.onRemoveStream({user_id:t});var o=this.users.findIndex((function(e){return e.user_id===t}));if(o>=0){var i=this.users[o];this.users.splice(o,1),this._emitter.emit("user-removed",h.convertToOuterUser(i))}},e.prototype.onAddStream=function(e){var t=e.user_id,r=e.cmdtype,n=e.stream;d.default.debug("onAddStream ",t,r,n);var o=Object.assign({uid:t},n,{stream_type:l.ENUM_STREAM_TYPE.subscribe,subStatus:l.ENUM_SUBSCRIBE_STATUS.unsubscribe});this.streams.push(o),this._emitter.emit("stream-added",h.convertToOuterStream(o))},e.prototype.onRemoveStream=function(e){var t=e.user_id,r=e.stream;d.default.debug("onRemoveStream ",t,r);var n=r||this.streams.find((function(e){return e.uid===t}));if(n){var o=this.streams.findIndex((function(e){return e.sid===n.sid}));if(o>=0){var i=this.streams.splice(o,1)[0];(i.streamsub_id||i.mediaStream)&&this.streamWorker.removeRemoteStream(i.sid,(function(){delete i.streamsub_id,delete i.mediaStream}),(function(e){d.default.error("onRemoveStream ",e)})),this._emitter.emit("stream-removed",h.convertToOuterStream(i))}}else{d.default.warn("onRemoveStream ","cannot find stream in local cache")}},e.prototype.onTransportClose=function(e){var t=e.user_id,r=e.stream;d.default.debug("onTransportClose ",t,r),t===this.user.user_id||this.onRemoveStream({user_id:t,stream:r})},e.prototype.onTransportTimeout=function(e){d.default.debug("onTransportTimeout",e)},e.prototype.onAudioTrackst=function(e){var t=e.user_id,r=e.stream_id,n=e.mute,o=e.track_type,i=e.media_type;d.default.debug("onAudioTrackst ",t,r,n,o,i);var s=this.streams.find((function(e){return e.sid===r}));if(s){s.muteaudio=n;var a=h.convertToOuterStream(s);n?this._emitter.emit("mute-audio",a):this._emitter.emit("unmute-audio",a)}else{d.default.error("onAudioTrackst ","cannot find stream in local cache")}},e.prototype.onVideoTrackst=function(e){var t=e.user_id,r=e.stream_id,n=e.mute,o=e.track_type,i=e.media_type;d.default.debug("onVideoTrackst ",t,r,n,o,i);var s=this.streams.find((function(e){return e.sid===r}));if(s){s.mutevideo=n;var a=h.convertToOuterStream(s);n?this._emitter.emit("mute-video",a):this._emitter.emit("unmute-video",a)}else{d.default.error("onVideoTrackst ","cannot find stream in local cache")}},e.prototype.onDataTrackst=function(e){var t=e.user_id,r=e.stream_id,n=e.mute,o=e.track_type,i=e.media_type;d.default.debug("onDataTrackst ",t,r,n,o,i);var s=this.streams.find((function(e){return e.sid===r}));if(s)n?this._emitter.emit("mute-data",s):this._emitter.emit("unmute-data",s);else{d.default.error("onDataTrackst ","cannot find stream in local cache")}},e.prototype.onKickoff=function(e){d.default.debug("onKickoff",e)},e.prototype.onMediaStreamPublished=function(e){var t=e.mediaStream;this.mediaStream=t,this._emitter.emit("stream-published",h.convertToOuterStream(this.stream))},e.prototype.onMediaStreamSubscribed=function(e){var t=e.streamId,r=e.mediaStream,n=this.streams.find((function(e){return e.sid===t}));n&&(n.mediaStream=r,this._emitter.emit("stream-subscribed",h.convertToOuterStream(n)))},e}();t.SessionWorker=v},function(e,t,r){e.exports=r(32)},function(e,t,r){"use strict";var n=r(0),o=r(11),i=r(34),s=r(18);function a(e){var t=new i(e),r=o(i.prototype.request,t);return n.extend(r,i.prototype,t),n.extend(r,t),r}var c=a(r(14));c.Axios=i,c.create=function(e){return a(s(c.defaults,e))},c.Cancel=r(19),c.CancelToken=r(46),c.isCancel=r(13),c.all=function(e){return Promise.all(e)},c.spread=r(47),e.exports=c,e.exports.default=c},function(e,t){
- /*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh <https://feross.org>
- * @license MIT
- */
- e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";var n=r(0),o=r(12),i=r(35),s=r(36),a=r(18);function c(e){this.defaults=e,this.interceptors={request:new i,response:new i}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method=e.method?e.method.toLowerCase():"get";var t=[s,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},c.prototype.getUri=function(e){return e=a(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,r){return this.request(n.merge(r||{},{method:e,url:t}))}})),n.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,r,o){return this.request(n.merge(o||{},{method:e,url:t,data:r}))}})),e.exports=c},function(e,t,r){"use strict";var n=r(0);function o(){this.handlers=[]}o.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},function(e,t,r){"use strict";var n=r(0),o=r(37),i=r(13),s=r(14),a=r(44),c=r(45);function u(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return u(e),e.baseURL&&!a(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return u(e),t.data=o(t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(u(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e,t,r){return n.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},function(e,t,r){"use strict";var n=r(17);e.exports=function(e,t,r){var o=r.config.validateStatus;!o||o(r.status)?e(r):t(n("Request failed with status code "+r.status,r.config,null,r.request,r))}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,r){"use strict";var n=r(0),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,i,s={};return e?(n.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=n.trim(e.substr(0,i)).toLowerCase(),r=n.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([r]):s[t]?s[t]+", "+r:r}})),s):s}},function(e,t,r){"use strict";var n=r(0);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(0);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var n=r(19);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){var n=r(49)("jsonp");e.exports=function(e,t,r){"function"==typeof t&&(r=t,t={});t||(t={});var s,a,c=t.prefix||"__jp",u=t.name||c+o++,d=t.param||"callback",p=null!=t.timeout?t.timeout:6e4,f=encodeURIComponent,l=document.getElementsByTagName("script")[0]||document.head;p&&(a=setTimeout((function(){h(),r&&r(new Error("Timeout"))}),p));function h(){s.parentNode&&s.parentNode.removeChild(s),window[u]=i,a&&clearTimeout(a)}return window[u]=function(e){n("jsonp got",e),h(),r&&r(null,e)},e=(e+=(~e.indexOf("?")?"&":"?")+d+"="+f(u)).replace("?&","?"),n('jsonp req "%s"',e),(s=document.createElement("script")).src=e,l.parentNode.insertBefore(s,l),function(){window[u]&&h()}};var o=0;function i(){}},function(e,t,r){(function(n){function o(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}(t=e.exports=r(50)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))})),e.splice(i,0,n)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=o,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(o())}).call(this,r(15))},function(e,t,r){var n;function o(e){function r(){if(r.enabled){var e=r,o=+new Date,i=o-(n||o);e.diff=i,e.prev=n,e.curr=o,n=o;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;c++;var o=t.formatters[n];if("function"==typeof o){var i=s[c];r=o.call(e,i),s.splice(c,1),c--}return r})),t.formatArgs.call(e,s),(r.log||t.log||console.log.bind(console)).apply(e,s)}}return r.namespace=e,r.enabled=t.enabled(e),r.useColors=t.useColors(),r.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),"function"==typeof t.init&&t.init(r),r}(t=e.exports=o.debug=o.default=o).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){t.save(e),t.names=[],t.skips=[];for(var r=("string"==typeof e?e:"").split(/[\s,]+/),n=r.length,o=0;o<n;o++)r[o]&&("-"===(e=r[o].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(51),t.names=[],t.skips=[],t.formatters={}},function(e,t){var r=1e3,n=60*r,o=60*n,i=24*o,s=365.25*i;function a(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}e.exports=function(e,t){t=t||{};var c,u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var a=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*o;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(e);if("number"===u&&!1===isNaN(e))return t.long?a(c=e,i,"day")||a(c,o,"hour")||a(c,n,"minute")||a(c,r,"second")||c+" ms":function(e){if(e>=i)return Math.round(e/i)+"d";if(e>=o)return Math.round(e/o)+"h";if(e>=n)return Math.round(e/n)+"m";if(e>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},function(e,t,r){"use strict";var n,o=Object.prototype.hasOwnProperty;function i(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}t.stringify=function(e,t){t=t||"";var r,i,s=[];for(i in"string"!=typeof t&&(t="?"),e)if(o.call(e,i)){if((r=e[i])||null!==r&&r!==n&&!isNaN(r)||(r=""),i=encodeURIComponent(i),r=encodeURIComponent(r),null===i||null===r)continue;s.push(i+"="+r)}return s.length?t+s.join("&"):""},t.parse=function(e){for(var t,r=/([^=?&]+)=?([^&]*)/g,n={};t=r.exec(e);){var o=i(t[1]),s=i(t[2]);null===o||null===s||o in n||(n[o]=s)}return n}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(55),o=r(1),i=function(){function e(e){this.readyState=n.w3cwebsocket.CLOSED,null!=e&&(this.url=e)}return e.prototype.connect=function(e){var t=this;return o.default.debug("Socket connect ",e),new Promise((function(r,i){try{t._websocket=new n.w3cwebsocket(e||t.url)}catch(e){return o.default.debug("Socket create error ",e),i(new Event("Create Socket Error"))}t.readyState=n.w3cwebsocket.CONNECTING,t._websocket.onopen=function(){t.readyState=n.w3cwebsocket.OPEN,r("opened"),t.onopen("opened"),t._websocket&&(t._websocket.onclose=function(){t.readyState=n.w3cwebsocket.CLOSED,t.onclose("closed"),t._websocket=null},t._websocket.onmessage=function(e){t.onmessage(e)},t._websocket.onerror=function(e){o.default.debug("Socket onerror ",e),t._websocket&&(t.readyState=t._websocket.readyState),t.onerror(e)})}}))},e.prototype.onopen=function(e){},e.prototype.onmessage=function(e){},e.prototype.onclose=function(e){},e.prototype.onerror=function(e){},e.prototype.send=function(e){var t=this;return new Promise((function(r,n){t._websocket?(t._websocket.send(e),r()):n("No Socket Connection")}))},e.prototype.close=function(e,t){var r=this;return void 0===e&&(e=1e3),new Promise((function(n,o){r._websocket?(r._websocket.close(e,t),n()):o("No Socket Connection")}))},Object.defineProperty(e.prototype,"isOpened",{get:function(){return this.readyState===n.w3cwebsocket.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isClosed",{get:function(){return this.readyState===n.w3cwebsocket.CLOSED},enumerable:!0,configurable:!0}),e}();t.SocketWorker=i},function(e,t,r){(function(t){var n=function(){return this||void 0===t?this:t}(),o=n.WebSocket||n.MozWebSocket,i=r(56);function s(e,t){return t?new o(e,t):new o(e)}o&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(s,e,{get:function(){return o[e]}})})),e.exports={w3cwebsocket:o?s:null,version:i}}).call(this,r(6))},function(e,t,r){e.exports=r(57).version},function(e){e.exports=JSON.parse('{"name":"websocket","description":"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.","keywords":["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],"author":"Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)","contributors":["Iñaki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)"],"version":"1.0.30","repository":{"type":"git","url":"https://github.com/theturtle32/WebSocket-Node.git"},"homepage":"https://github.com/theturtle32/WebSocket-Node","engines":{"node":">=0.10.0"},"dependencies":{"debug":"^2.2.0","nan":"^2.14.0","typedarray-to-buffer":"^3.1.5","yaeti":"^0.0.6"},"devDependencies":{"buffer-equal":"^1.0.0","faucet":"^0.0.1","gulp":"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1","jshint":"^2.0.0","tape":"^4.9.1"},"config":{"verbose":false},"scripts":{"install":"(node-gyp rebuild 2> builderror.log) || (exit 0)","test":"faucet test/unit","gulp":"gulp"},"main":"index","directories":{"lib":"./lib"},"browser":"lib/browser.js","license":"Apache-2.0"}')},function(e,t,r){"use strict";r.r(t),r.d(t,"__extends",(function(){return o})),r.d(t,"__assign",(function(){return i})),r.d(t,"__rest",(function(){return s})),r.d(t,"__decorate",(function(){return a})),r.d(t,"__param",(function(){return c})),r.d(t,"__metadata",(function(){return u})),r.d(t,"__awaiter",(function(){return d})),r.d(t,"__generator",(function(){return p})),r.d(t,"__exportStar",(function(){return f})),r.d(t,"__values",(function(){return l})),r.d(t,"__read",(function(){return h})),r.d(t,"__spread",(function(){return m})),r.d(t,"__spreadArrays",(function(){return v})),r.d(t,"__await",(function(){return g})),r.d(t,"__asyncGenerator",(function(){return b})),r.d(t,"__asyncDelegator",(function(){return y})),r.d(t,"__asyncValues",(function(){return S})),r.d(t,"__makeTemplateObject",(function(){return _})),r.d(t,"__importStar",(function(){return R})),r.d(t,"__importDefault",(function(){return T}));
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */
- var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function o(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function s(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function a(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s}function c(e,t){return function(r,n){t(r,n,e)}}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function d(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new r((function(t){t(e.value)})).then(s,a)}c((n=n.apply(e,t||[])).next())}))}function p(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function f(e,t){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}function l(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}function v(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n}function g(e){return this instanceof g?(this.v=e,this):new g(e)}function b(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||a(e,t)}))})}function a(e,t){try{(r=o[e](t)).value instanceof g?Promise.resolve(r.value.v).then(c,u):d(i[0][2],r)}catch(e){d(i[0][3],e)}var r}function c(e){a("next",e)}function u(e){a("throw",e)}function d(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function y(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:g(e[n](t)),done:"return"===n}:o?o(t):t}:o}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=l(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function _(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function R(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function T(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext||window.oAudioContext,i=function(){function e(e){this.mediaStream=e,this.audioContext=new o,this.audioContext?(this.sourceNode=this.audioContext.createMediaStreamSource(this.mediaStream),this.analyser=this.audioContext.createAnalyser(),this.timeDomainData=new Uint8Array(this.analyser.frequencyBinCount),this.sourceNode.connect(this.analyser)):n.default.error("cannot create audioContext")}return e.prototype.destroy=function(){this.audioContext&&this.audioContext.close()},e.prototype.getVolume=function(){var e=0;return this.analyser&&(this.analyser.getByteTimeDomainData(this.timeDomainData),this.timeDomainData.forEach((function(t){e=Math.max(e,Math.abs(t-128))}))),e/128},e}();t.AudioHelper=i},function(e,t,r){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=r(18),o=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=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}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var o=e.getVersionPrecision(t),i=e.getVersionPrecision(r),s=Math.max(o,i),a=0,c=e.map([t,r],(function(t){var r=s-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(a=s-Math.min(o,i)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||""},e}();t.default=o,e.exports=t.default},18:function(e,t,r){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,o=(n=r(91))&&n.__esModule?n:{default:n},i=r(18);function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=function(){function e(){}var t,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new o.default(e,t)},e.parse=function(e){return new o.default(e).getResult()},t=e,(r=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}])&&s(t,r),e}();t.default=a,e.exports=t.default},91:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=c(r(92)),o=c(r(93)),i=c(r(94)),s=c(r(95)),a=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=n.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=o.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=i.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return Object.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,o={},i=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(o[t]=s,i+=1):"object"==typeof s&&(r[t]=s,n+=1)})),n>0){var s=Object.keys(r),a=s.find((function(e){return t.isOS(e)}));if(a){var c=this.satisfies(r[a]);if(void 0!==c)return c}var u=s.find((function(e){return t.isPlatform(e)}));if(u){var d=this.satisfies(r[u]);if(void 0!==d)return d}}if(i>0){var p=Object.keys(o).find((function(e){return t.isBrowser(e,!0)}));if(void 0!==p)return this.compareVersion(o[p])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),o=a.default.getBrowserTypeByAlias(n);return t&&o&&(n=o.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,o=this.getBrowserVersion();if("string"==typeof o)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(a.default.compareVersions(o,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e){return this.isBrowser(e)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=o.default.getFirstMatch(i,e)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=o.default.getFirstMatch(i,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(t,e),version:o.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:i.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:i.OS_MAP.WindowsPhone,version:t}}},{test:[/windows/i],describe:function(e){var t=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=o.default.getWindowsVersionName(t);return{name:i.OS_MAP.Windows,version:t,versionName:r}}},{test:[/macintosh/i],describe:function(e){var t=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=o.default.getMacOSVersionName(t),n={name:i.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=o.default.getAndroidVersionName(t),n={name:i.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:i.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||o.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:i.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:i.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:i.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:i.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=o.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=o.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:i.ENGINE_MAP.Blink};var t=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:i.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:i.ENGINE_MAP.Trident},r=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:i.ENGINE_MAP.Presto},r=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:i.ENGINE_MAP.Gecko},r=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:i.ENGINE_MAP.WebKit},r=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=s,e.exports=t.default}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatTime=function(e,t){void 0===t&&(t="YYYY/MM/DD HH:mm:ss");var r={"M+":e.getMonth()+1,"D+":e.getDate(),"H+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};for(var n in/(y+)/i.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),r)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[n]:("00"+r[n]).substr((""+r[n]).length)));return t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){this.bytesReceived=0,this.jitter=0,this.packetsLost=0,this.packetsReceived=0,this.audioLevel=0},o=function(){this.bytesReceived=0,this.packetsLost=0,this.packetsReceived=0,this.firCount=0,this.nackCount=0,this.pliCount=0,this.framesDecoded=0,this.frameHeight=0,this.frameWidth=0,this.framesDropped=0,this.framesReceived=0},i=function(){this.bytesSent=0,this.packetsSent=0,this.retransmittedBytesSent=0,this.retransmittedPacketsSent=0,this.audioLevel=0},s=function(){this.bytesSent=0,this.packetsSent=0,this.firCount=0,this.nackCount=0,this.pliCount=0,this.framesEncoded=0,this.frameHeight=0,this.frameWidth=0,this.framesSent=0},a=function(){this.availableIncomingBitrate=0,this.availableOutgoingBitrate=0,this.bytesReceived=0,this.bytesSent=0,this.currentRoundTripTime=0,this.totalRoundTripTime=0},c=function(){this.ip="",this.port=0,this.networkType="",this.protocol="udp"},u=function(){this.ip="",this.port=0,this.protocol="udp"},d=function(){this.bytesReceived=0,this.bytesSent=0,this.dtlsState=""},p=function(){this.inAudioReport=new n,this.inVideoReport=new o,this.outAudioReport=new i,this.outVideoReport=new s,this.candidatePairReport=new a,this.localCandidateReport=new c,this.remoteCandidateReport=new u,this.transportReport=new d,this.timestamp=Date.now(),this.original=[]};t.StatsReports=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.displayMediaDevices=navigator.mediaDevices},function(module,exports,__webpack_require__){(function(global){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;!function(e,t){module.exports=t(e)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==global?global:this,(function(global){"use strict";global=global||{};var _Base64=global.Base64,version="2.5.1",buffer;if(module.exports)try{buffer=eval("require('buffer').Buffer")}catch(e){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(e){for(var t={},r=0,n=e.length;r<n;r++)t[e.charAt(r)]=r;return t}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?fromCharCode(192|t>>>6)+fromCharCode(128|63&t):fromCharCode(224|t>>>12&15)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return fromCharCode(240|t>>>18&7)+fromCharCode(128|t>>>12&63)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(e){return e.replace(re_utob,cb_utob)},cb_encode=function(e){var t=[0,2,1][e.length%3],r=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[b64chars.charAt(r>>>18),b64chars.charAt(r>>>12&63),t>=2?"=":b64chars.charAt(r>>>6&63),t>=1?"=":b64chars.charAt(63&r)].join("")},btoa=global.btoa?function(e){return global.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e)).toString("base64")}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e)).toString("base64")}:function(e){return btoa(utob(e))},encode=function(e,t){return t?_encode(String(e)).replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,""):_encode(String(e))},encodeURI=function(e){return encode(e,!0)},re_btou=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),cb_btou=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return fromCharCode(55296+(t>>>10))+fromCharCode(56320+(1023&t));case 3:return fromCharCode((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return fromCharCode((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},btou=function(e){return e.replace(re_btou,cb_btou)},cb_decode=function(e){var t=e.length,r=t%4,n=(t>0?b64tab[e.charAt(0)]<<18:0)|(t>1?b64tab[e.charAt(1)]<<12:0)|(t>2?b64tab[e.charAt(2)]<<6:0)|(t>3?b64tab[e.charAt(3)]:0),o=[fromCharCode(n>>>16),fromCharCode(n>>>8&255),fromCharCode(255&n)];return o.length-=[0,0,2,1][r],o.join("")},_atob=global.atob?function(e){return global.atob(e)}:function(e){return e.replace(/\S{1,4}/g,cb_decode)},atob=function(e){return _atob(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e,"base64")).toString()}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e,"base64")).toString()}:function(e){return btou(_atob(e))},decode=function(e){return _decode(String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var e=global.Base64;return global.Base64=_Base64,e};if(global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,__buffer__:buffer},"function"==typeof Object.defineProperty){var noEnum=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum((function(){return decode(this)}))),Object.defineProperty(String.prototype,"toBase64",noEnum((function(e){return encode(this,e)}))),Object.defineProperty(String.prototype,"toBase64URI",noEnum((function(){return encode(this,!0)})))}}return global.Meteor&&(Base64=global.Base64),module.exports?module.exports.Base64=global.Base64:(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=function(){return global.Base64}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)),{Base64:global.Base64}}))}).call(this,__webpack_require__(6))},function(e,t,r){"use strict";var n;!function(o){function i(e,t,r){var n,o,i,s,l,h,m,v,g,b=0,y=[],S=0,_=!1,R=[],T=[],E=!1,w=!1,C=-1;if(n=(r=r||{}).encoding||"UTF8",(g=r.numRounds||1)!==parseInt(g,10)||1>g)throw Error("numRounds must a integer >= 1");if("SHA-1"===e)l=512,h=j,m=F,s=160,v=function(e){return e.slice()};else if(0===e.lastIndexOf("SHA-",0))if(h=function(t,r){return B(t,r,e)},m=function(t,r,n,o){var i,s;if("SHA-224"===e||"SHA-256"===e)i=15+(r+65>>>9<<4),s=16;else{if("SHA-384"!==e&&"SHA-512"!==e)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),s=32}for(;t.length<=i;)t.push(0);for(t[r>>>5]|=128<<24-r%32,r+=n,t[i]=4294967295&r,t[i-1]=r/4294967296|0,n=t.length,r=0;r<n;r+=s)o=B(t.slice(r,r+s),o,e);if("SHA-224"===e)t=[o[0],o[1],o[2],o[3],o[4],o[5],o[6]];else if("SHA-256"===e)t=o;else if("SHA-384"===e)t=[o[0].a,o[0].b,o[1].a,o[1].b,o[2].a,o[2].b,o[3].a,o[3].b,o[4].a,o[4].b,o[5].a,o[5].b];else{if("SHA-512"!==e)throw Error("Unexpected error in SHA-2 implementation");t=[o[0].a,o[0].b,o[1].a,o[1].b,o[2].a,o[2].b,o[3].a,o[3].b,o[4].a,o[4].b,o[5].a,o[5].b,o[6].a,o[6].b,o[7].a,o[7].b]}return t},v=function(e){return e.slice()},"SHA-224"===e)l=512,s=224;else if("SHA-256"===e)l=512,s=256;else if("SHA-384"===e)l=1024,s=384;else{if("SHA-512"!==e)throw Error("Chosen SHA variant is not supported");l=1024,s=512}else{if(0!==e.lastIndexOf("SHA3-",0)&&0!==e.lastIndexOf("SHAKE",0))throw Error("Chosen SHA variant is not supported");var P=6;if(h=V,v=function(e){var t,r=[];for(t=0;5>t;t+=1)r[t]=e[t].slice();return r},C=1,"SHA3-224"===e)l=1152,s=224;else if("SHA3-256"===e)l=1088,s=256;else if("SHA3-384"===e)l=832,s=384;else if("SHA3-512"===e)l=576,s=512;else if("SHAKE128"===e)l=1344,s=-1,P=31,w=!0;else{if("SHAKE256"!==e)throw Error("Chosen SHA variant is not supported");l=1088,s=-1,P=31,w=!0}m=function(e,t,r,n,o){var i,s=P,a=[],c=(r=l)>>>5,u=0,d=t>>>5;for(i=0;i<d&&t>=r;i+=c)n=V(e.slice(i,i+c),n),t-=r;for(e=e.slice(i),t%=r;e.length<c;)e.push(0);for(e[(i=t>>>3)>>2]^=s<<i%4*8,e[c-1]^=2147483648,n=V(e,n);32*a.length<o&&(e=n[u%5][u/5|0],a.push(e.b),!(32*a.length>=o));)a.push(e.a),0==64*(u+=1)%r&&V(null,n);return a}}i=f(t,n,C),o=D(e),this.setHMACKey=function(t,r,i){var a;if(!0===_)throw Error("HMAC key already set");if(!0===E)throw Error("Cannot set HMAC key after calling update");if(!0===w)throw Error("SHAKE is not supported for HMAC");if(t=(r=f(r,n=(i||{}).encoding||"UTF8",C)(t)).binLen,r=r.value,i=(a=l>>>3)/4-1,a<t/8){for(r=m(r,t,0,D(e),s);r.length<=i;)r.push(0);r[i]&=4294967040}else if(a>t/8){for(;r.length<=i;)r.push(0);r[i]&=4294967040}for(t=0;t<=i;t+=1)R[t]=909522486^r[t],T[t]=1549556828^r[t];o=h(R,o),b=l,_=!0},this.update=function(e){var t,r,n,s=0,a=l>>>5;for(e=(t=i(e,y,S)).binLen,r=t.value,t=e>>>5,n=0;n<t;n+=a)s+l<=e&&(o=h(r.slice(n,n+a),o),s+=l);b+=s,y=r.slice(s>>>5),S=e%l,E=!0},this.getHash=function(t,r){var n,i,f,l;if(!0===_)throw Error("Cannot call getHash after setting HMAC key");if(f=p(r),!0===w){if(-1===f.shakeLen)throw Error("shakeLen must be specified in options");s=f.shakeLen}switch(t){case"HEX":n=function(e){return a(e,s,C,f)};break;case"B64":n=function(e){return c(e,s,C,f)};break;case"BYTES":n=function(e){return u(e,s,C)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}n=function(e){return d(e,s,C)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER")}for(l=m(y.slice(),S,b,v(o),s),i=1;i<g;i+=1)!0===w&&0!=s%32&&(l[l.length-1]&=16777215>>>24-s%32),l=m(l,s,0,D(e),s);return n(l)},this.getHMAC=function(t,r){var n,i,f,g;if(!1===_)throw Error("Cannot call getHMAC without first setting HMAC key");switch(f=p(r),t){case"HEX":n=function(e){return a(e,s,C,f)};break;case"B64":n=function(e){return c(e,s,C,f)};break;case"BYTES":n=function(e){return u(e,s,C)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}n=function(e){return d(e,s,C)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER")}return i=m(y.slice(),S,b,v(o),s),g=h(T,D(e)),n(g=m(i,s,l,g,s))}}function s(e,t){this.a=e,this.b=t}function a(e,t,r,n){var o,i,s,a="";for(t/=8,s=-1===r?3:0,o=0;o<t;o+=1)i=e[o>>>2]>>>8*(s+o%4*r),a+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?a.toUpperCase():a}function c(e,t,r,n){var o,i,s,a,c="",u=t/8;for(a=-1===r?3:0,o=0;o<u;o+=3)for(i=o+1<u?e[o+1>>>2]:0,s=o+2<u?e[o+2>>>2]:0,s=(e[o>>>2]>>>8*(a+o%4*r)&255)<<16|(i>>>8*(a+(o+1)%4*r)&255)<<8|s>>>8*(a+(o+2)%4*r)&255,i=0;4>i;i+=1)c+=8*o+6*i<=t?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(s>>>6*(3-i)&63):n.b64Pad;return c}function u(e,t,r){var n,o,i,s="";for(t/=8,i=-1===r?3:0,n=0;n<t;n+=1)o=e[n>>>2]>>>8*(i+n%4*r)&255,s+=String.fromCharCode(o);return s}function d(e,t,r){t/=8;var n,o,i,s=new ArrayBuffer(t);for(i=new Uint8Array(s),o=-1===r?3:0,n=0;n<t;n+=1)i[n]=e[n>>>2]>>>8*(o+n%4*r)&255;return s}function p(e){var t={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(e=e||{},t.outputUpper=e.outputUpper||!1,!0===e.hasOwnProperty("b64Pad")&&(t.b64Pad=e.b64Pad),!0===e.hasOwnProperty("shakeLen")){if(0!=e.shakeLen%8)throw Error("shakeLen must be a multiple of 8");t.shakeLen=e.shakeLen}if("boolean"!=typeof t.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof t.b64Pad)throw Error("Invalid b64Pad formatting option");return t}function f(e,t,r){switch(t){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(e){case"HEX":e=function(e,t,n){var o,i,s,a,c,u,d=e.length;if(0!=d%2)throw Error("String of HEX type must be in byte increments");for(t=t||[0],c=(n=n||0)>>>3,u=-1===r?3:0,o=0;o<d;o+=2){if(i=parseInt(e.substr(o,2),16),isNaN(i))throw Error("String of HEX type contains invalid characters");for(s=(a=(o>>>1)+c)>>>2;t.length<=s;)t.push(0);t[s]|=i<<8*(u+a%4*r)}return{value:t,binLen:4*d+n}};break;case"TEXT":e=function(e,n,o){var i,s,a,c,u,d,p,f,l=0;if(n=n||[0],u=(o=o||0)>>>3,"UTF8"===t)for(f=-1===r?3:0,a=0;a<e.length;a+=1)for(s=[],128>(i=e.charCodeAt(a))?s.push(i):2048>i?(s.push(192|i>>>6),s.push(128|63&i)):55296>i||57344<=i?s.push(224|i>>>12,128|i>>>6&63,128|63&i):(a+=1,i=65536+((1023&i)<<10|1023&e.charCodeAt(a)),s.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),c=0;c<s.length;c+=1){for(d=(p=l+u)>>>2;n.length<=d;)n.push(0);n[d]|=s[c]<<8*(f+p%4*r),l+=1}else if("UTF16BE"===t||"UTF16LE"===t)for(f=-1===r?2:0,s="UTF16LE"===t&&1!==r||"UTF16LE"!==t&&1===r,a=0;a<e.length;a+=1){for(i=e.charCodeAt(a),!0===s&&(i=(c=255&i)<<8|i>>>8),d=(p=l+u)>>>2;n.length<=d;)n.push(0);n[d]|=i<<8*(f+p%4*r),l+=2}return{value:n,binLen:8*l+o}};break;case"B64":e=function(e,t,n){var o,i,s,a,c,u,d,p,f=0;if(-1===e.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=e.indexOf("="),e=e.replace(/\=/g,""),-1!==i&&i<e.length)throw Error("Invalid '=' found in base-64 string");for(t=t||[0],u=(n=n||0)>>>3,p=-1===r?3:0,i=0;i<e.length;i+=4){for(c=e.substr(i,4),s=a=0;s<c.length;s+=1)a|=(o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(c[s]))<<18-6*s;for(s=0;s<c.length-1;s+=1){for(o=(d=f+u)>>>2;t.length<=o;)t.push(0);t[o]|=(a>>>16-8*s&255)<<8*(p+d%4*r),f+=1}}return{value:t,binLen:8*f+n}};break;case"BYTES":e=function(e,t,n){var o,i,s,a,c,u;for(t=t||[0],s=(n=n||0)>>>3,u=-1===r?3:0,i=0;i<e.length;i+=1)o=e.charCodeAt(i),a=(c=i+s)>>>2,t.length<=a&&t.push(0),t[a]|=o<<8*(u+c%4*r);return{value:t,binLen:8*e.length+n}};break;case"ARRAYBUFFER":try{e=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}e=function(e,t,n){var o,i,s,a,c,u;for(t=t||[0],i=(n=n||0)>>>3,c=-1===r?3:0,u=new Uint8Array(e),o=0;o<e.byteLength;o+=1)s=(a=o+i)>>>2,t.length<=s&&t.push(0),t[s]|=u[o]<<8*(c+a%4*r);return{value:t,binLen:8*e.byteLength+n}};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER")}return e}function l(e,t){return e<<t|e>>>32-t}function h(e,t){return 32<t?(t-=32,new s(e.b<<t|e.a>>>32-t,e.a<<t|e.b>>>32-t)):0!==t?new s(e.a<<t|e.b>>>32-t,e.b<<t|e.a>>>32-t):e}function m(e,t){return e>>>t|e<<32-t}function v(e,t){var r=null;r=new s(e.a,e.b);return 32>=t?new s(r.a>>>t|r.b<<32-t&4294967295,r.b>>>t|r.a<<32-t&4294967295):new s(r.b>>>t-32|r.a<<64-t&4294967295,r.a>>>t-32|r.b<<64-t&4294967295)}function g(e,t){return 32>=t?new s(e.a>>>t,e.b>>>t|e.a<<32-t&4294967295):new s(0,e.a>>>t-32)}function b(e,t,r){return e&t^~e&r}function y(e,t,r){return new s(e.a&t.a^~e.a&r.a,e.b&t.b^~e.b&r.b)}function S(e,t,r){return e&t^e&r^t&r}function _(e,t,r){return new s(e.a&t.a^e.a&r.a^t.a&r.a,e.b&t.b^e.b&r.b^t.b&r.b)}function R(e){return m(e,2)^m(e,13)^m(e,22)}function T(e){var t=v(e,28),r=v(e,34);return e=v(e,39),new s(t.a^r.a^e.a,t.b^r.b^e.b)}function E(e){return m(e,6)^m(e,11)^m(e,25)}function w(e){var t=v(e,14),r=v(e,18);return e=v(e,41),new s(t.a^r.a^e.a,t.b^r.b^e.b)}function C(e){return m(e,7)^m(e,18)^e>>>3}function P(e){var t=v(e,1),r=v(e,8);return e=g(e,7),new s(t.a^r.a^e.a,t.b^r.b^e.b)}function k(e){return m(e,17)^m(e,19)^e>>>10}function M(e){var t=v(e,19),r=v(e,61);return e=g(e,6),new s(t.a^r.a^e.a,t.b^r.b^e.b)}function A(e,t){var r=(65535&e)+(65535&t);return((e>>>16)+(t>>>16)+(r>>>16)&65535)<<16|65535&r}function O(e,t,r,n){var o=(65535&e)+(65535&t)+(65535&r)+(65535&n);return((e>>>16)+(t>>>16)+(r>>>16)+(n>>>16)+(o>>>16)&65535)<<16|65535&o}function U(e,t,r,n,o){var i=(65535&e)+(65535&t)+(65535&r)+(65535&n)+(65535&o);return((e>>>16)+(t>>>16)+(r>>>16)+(n>>>16)+(o>>>16)+(i>>>16)&65535)<<16|65535&i}function N(e,t){var r,n,o;return r=(65535&e.b)+(65535&t.b),o=(65535&(n=(e.b>>>16)+(t.b>>>16)+(r>>>16)))<<16|65535&r,r=(65535&e.a)+(65535&t.a)+(n>>>16),new s((65535&(n=(e.a>>>16)+(t.a>>>16)+(r>>>16)))<<16|65535&r,o)}function x(e,t,r,n){var o,i,a;return o=(65535&e.b)+(65535&t.b)+(65535&r.b)+(65535&n.b),a=(65535&(i=(e.b>>>16)+(t.b>>>16)+(r.b>>>16)+(n.b>>>16)+(o>>>16)))<<16|65535&o,o=(65535&e.a)+(65535&t.a)+(65535&r.a)+(65535&n.a)+(i>>>16),new s((65535&(i=(e.a>>>16)+(t.a>>>16)+(r.a>>>16)+(n.a>>>16)+(o>>>16)))<<16|65535&o,a)}function I(e,t,r,n,o){var i,a,c;return i=(65535&e.b)+(65535&t.b)+(65535&r.b)+(65535&n.b)+(65535&o.b),c=(65535&(a=(e.b>>>16)+(t.b>>>16)+(r.b>>>16)+(n.b>>>16)+(o.b>>>16)+(i>>>16)))<<16|65535&i,i=(65535&e.a)+(65535&t.a)+(65535&r.a)+(65535&n.a)+(65535&o.a)+(a>>>16),new s((65535&(a=(e.a>>>16)+(t.a>>>16)+(r.a>>>16)+(n.a>>>16)+(o.a>>>16)+(i>>>16)))<<16|65535&i,c)}function L(e,t){return new s(e.a^t.a,e.b^t.b)}function D(e){var t,r=[];if("SHA-1"===e)r=[1732584193,4023233417,2562383102,271733878,3285377520];else if(0===e.lastIndexOf("SHA-",0))switch(r=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],t=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e){case"SHA-224":break;case"SHA-256":r=t;break;case"SHA-384":r=[new s(3418070365,r[0]),new s(1654270250,r[1]),new s(2438529370,r[2]),new s(355462360,r[3]),new s(1731405415,r[4]),new s(41048885895,r[5]),new s(3675008525,r[6]),new s(1203062813,r[7])];break;case"SHA-512":r=[new s(t[0],4089235720),new s(t[1],2227873595),new s(t[2],4271175723),new s(t[3],1595750129),new s(t[4],2917565137),new s(t[5],725511199),new s(t[6],4215389547),new s(t[7],327033209)];break;default:throw Error("Unknown SHA variant")}else{if(0!==e.lastIndexOf("SHA3-",0)&&0!==e.lastIndexOf("SHAKE",0))throw Error("No SHA variants supported");for(e=0;5>e;e+=1)r[e]=[new s(0,0),new s(0,0),new s(0,0),new s(0,0),new s(0,0)]}return r}function j(e,t){var r,n,o,i,s,a,c,u=[];for(r=t[0],n=t[1],o=t[2],i=t[3],s=t[4],c=0;80>c;c+=1)u[c]=16>c?e[c]:l(u[c-3]^u[c-8]^u[c-14]^u[c-16],1),a=20>c?U(l(r,5),n&o^~n&i,s,1518500249,u[c]):40>c?U(l(r,5),n^o^i,s,1859775393,u[c]):60>c?U(l(r,5),S(n,o,i),s,2400959708,u[c]):U(l(r,5),n^o^i,s,3395469782,u[c]),s=i,i=o,o=l(n,30),n=r,r=a;return t[0]=A(r,t[0]),t[1]=A(n,t[1]),t[2]=A(o,t[2]),t[3]=A(i,t[3]),t[4]=A(s,t[4]),t}function F(e,t,r,n){var o;for(o=15+(t+65>>>9<<4);e.length<=o;)e.push(0);for(e[t>>>5]|=128<<24-t%32,t+=r,e[o]=4294967295&t,e[o-1]=t/4294967296|0,t=e.length,o=0;o<t;o+=16)n=j(e.slice(o,o+16),n);return n}function B(e,t,r){var n,o,i,a,c,u,d,p,f,l,h,m,v,g,L,D,j,F,B,V,H,Y,z,q=[];if("SHA-224"===r||"SHA-256"===r)l=64,m=1,Y=Number,v=A,g=O,L=U,D=C,j=k,F=R,B=E,H=S,V=b,z=W;else{if("SHA-384"!==r&&"SHA-512"!==r)throw Error("Unexpected error in SHA-2 implementation");l=80,m=2,Y=s,v=N,g=x,L=I,D=P,j=M,F=T,B=w,H=_,V=y,z=G}for(r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],c=t[5],u=t[6],d=t[7],h=0;h<l;h+=1)16>h?(f=h*m,p=e.length<=f?0:e[f],f=e.length<=f+1?0:e[f+1],q[h]=new Y(p,f)):q[h]=g(j(q[h-2]),q[h-7],D(q[h-15]),q[h-16]),p=L(d,B(a),V(a,c,u),z[h],q[h]),f=v(F(r),H(r,n,o)),d=u,u=c,c=a,a=v(i,p),i=o,o=n,n=r,r=v(p,f);return t[0]=v(r,t[0]),t[1]=v(n,t[1]),t[2]=v(o,t[2]),t[3]=v(i,t[3]),t[4]=v(a,t[4]),t[5]=v(c,t[5]),t[6]=v(u,t[6]),t[7]=v(d,t[7]),t}function V(e,t){var r,n,o,i,a=[],c=[];if(null!==e)for(n=0;n<e.length;n+=2)t[(n>>>1)%5][(n>>>1)/5|0]=L(t[(n>>>1)%5][(n>>>1)/5|0],new s(e[n+1],e[n]));for(r=0;24>r;r+=1){for(i=D("SHA3-"),n=0;5>n;n+=1){o=t[n][0];var u=t[n][1],d=t[n][2],p=t[n][3],f=t[n][4];a[n]=new s(o.a^u.a^d.a^p.a^f.a,o.b^u.b^d.b^p.b^f.b)}for(n=0;5>n;n+=1)c[n]=L(a[(n+4)%5],h(a[(n+1)%5],1));for(n=0;5>n;n+=1)for(o=0;5>o;o+=1)t[n][o]=L(t[n][o],c[n]);for(n=0;5>n;n+=1)for(o=0;5>o;o+=1)i[o][(2*n+3*o)%5]=h(t[n][o],H[n][o]);for(n=0;5>n;n+=1)for(o=0;5>o;o+=1)t[n][o]=L(i[n][o],new s(~i[(n+1)%5][o].a&i[(n+2)%5][o].a,~i[(n+1)%5][o].b&i[(n+2)%5][o].b));t[0][0]=L(t[0][0],Y[r])}return t}var W,G,H,Y;G=[new s((W=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298])[0],3609767458),new s(W[1],602891725),new s(W[2],3964484399),new s(W[3],2173295548),new s(W[4],4081628472),new s(W[5],3053834265),new s(W[6],2937671579),new s(W[7],3664609560),new s(W[8],2734883394),new s(W[9],1164996542),new s(W[10],1323610764),new s(W[11],3590304994),new s(W[12],4068182383),new s(W[13],991336113),new s(W[14],633803317),new s(W[15],3479774868),new s(W[16],2666613458),new s(W[17],944711139),new s(W[18],2341262773),new s(W[19],2007800933),new s(W[20],1495990901),new s(W[21],1856431235),new s(W[22],3175218132),new s(W[23],2198950837),new s(W[24],3999719339),new s(W[25],766784016),new s(W[26],2566594879),new s(W[27],3203337956),new s(W[28],1034457026),new s(W[29],2466948901),new s(W[30],3758326383),new s(W[31],168717936),new s(W[32],1188179964),new s(W[33],1546045734),new s(W[34],1522805485),new s(W[35],2643833823),new s(W[36],2343527390),new s(W[37],1014477480),new s(W[38],1206759142),new s(W[39],344077627),new s(W[40],1290863460),new s(W[41],3158454273),new s(W[42],3505952657),new s(W[43],106217008),new s(W[44],3606008344),new s(W[45],1432725776),new s(W[46],1467031594),new s(W[47],851169720),new s(W[48],3100823752),new s(W[49],1363258195),new s(W[50],3750685593),new s(W[51],3785050280),new s(W[52],3318307427),new s(W[53],3812723403),new s(W[54],2003034995),new s(W[55],3602036899),new s(W[56],1575990012),new s(W[57],1125592928),new s(W[58],2716904306),new s(W[59],442776044),new s(W[60],593698344),new s(W[61],3733110249),new s(W[62],2999351573),new s(W[63],3815920427),new s(3391569614,3928383900),new s(3515267271,566280711),new s(3940187606,3454069534),new s(4118630271,4000239992),new s(116418474,1914138554),new s(174292421,2731055270),new s(289380356,3203993006),new s(460393269,320620315),new s(685471733,587496836),new s(852142971,1086792851),new s(1017036298,365543100),new s(1126000580,2618297676),new s(1288033470,3409855158),new s(1501505948,4234509866),new s(1607167915,987167468),new s(1816402316,1246189591)],Y=[new s(0,1),new s(0,32898),new s(2147483648,32906),new s(2147483648,2147516416),new s(0,32907),new s(0,2147483649),new s(2147483648,2147516545),new s(2147483648,32777),new s(0,138),new s(0,136),new s(0,2147516425),new s(0,2147483658),new s(0,2147516555),new s(2147483648,139),new s(2147483648,32905),new s(2147483648,32771),new s(2147483648,32770),new s(2147483648,128),new s(0,32778),new s(2147483648,2147483658),new s(2147483648,2147516545),new s(2147483648,32896),new s(0,2147483649),new s(2147483648,2147516424)],H=[[0,36,3,41,18],[1,44,10,45,2],[62,6,43,15,61],[28,55,25,21,56],[27,20,39,8,14]],void 0===(n=function(){return i}.call(t,r,t,e))||(e.exports=n)}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randNum=function(e){for(var t="",r=0;r<e;++r)t+="0123456789".charAt(Math.floor(100*Math.random()%10));return t}},function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"shimGetUserMedia",(function(){return _})),r.d(n,"shimGetDisplayMedia",(function(){return R})),r.d(n,"shimMediaStream",(function(){return T})),r.d(n,"shimOnTrack",(function(){return E})),r.d(n,"shimGetSendersWithDtmf",(function(){return w})),r.d(n,"shimGetStats",(function(){return C})),r.d(n,"shimSenderReceiverGetStats",(function(){return P})),r.d(n,"shimAddTrackRemoveTrackWithNative",(function(){return k})),r.d(n,"shimAddTrackRemoveTrack",(function(){return M})),r.d(n,"shimPeerConnection",(function(){return A})),r.d(n,"fixNegotiationNeeded",(function(){return O}));var o={};r.r(o),r.d(o,"shimGetUserMedia",(function(){return x})),r.d(o,"shimGetDisplayMedia",(function(){return I})),r.d(o,"shimPeerConnection",(function(){return L})),r.d(o,"shimReplaceTrack",(function(){return D}));var i={};r.r(i),r.d(i,"shimGetUserMedia",(function(){return j})),r.d(i,"shimGetDisplayMedia",(function(){return F})),r.d(i,"shimOnTrack",(function(){return B})),r.d(i,"shimPeerConnection",(function(){return V})),r.d(i,"shimSenderGetStats",(function(){return W})),r.d(i,"shimReceiverGetStats",(function(){return G})),r.d(i,"shimRemoveStream",(function(){return H})),r.d(i,"shimRTCDataChannel",(function(){return Y})),r.d(i,"shimAddTransceiver",(function(){return z})),r.d(i,"shimCreateOffer",(function(){return q})),r.d(i,"shimCreateAnswer",(function(){return J}));var s={};r.r(s),r.d(s,"shimLocalStreamsAPI",(function(){return K})),r.d(s,"shimRemoteStreamsAPI",(function(){return X})),r.d(s,"shimCallbacksAPI",(function(){return Q})),r.d(s,"shimGetUserMedia",(function(){return Z})),r.d(s,"shimConstraints",(function(){return $})),r.d(s,"shimRTCIceServerUrls",(function(){return ee})),r.d(s,"shimTrackEventTransceiver",(function(){return te})),r.d(s,"shimCreateOfferLegacy",(function(){return re}));var a={};r.r(a),r.d(a,"shimRTCIceCandidate",(function(){return ie})),r.d(a,"shimMaxMessageSize",(function(){return se})),r.d(a,"shimSendThrowTypeError",(function(){return ae})),r.d(a,"shimConnectionState",(function(){return ce})),r.d(a,"removeAllowExtmapMixed",(function(){return ue}));let c=!0,u=!0;function d(e,t,r){const n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function p(e,t,r){if(!e.RTCPeerConnection)return;const n=e.RTCPeerConnection.prototype,o=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return o.apply(this,arguments);const i=e=>{const t=r(e);t&&n(t)};return this._eventMap=this._eventMap||{},this._eventMap[n]=i,o.apply(this,[e,i])};const i=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[r])return i.apply(this,arguments);const n=this._eventMap[r];return delete this._eventMap[r],i.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function f(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(c=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function l(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(u=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function h(){if("object"==typeof window){if(c)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function m(e,t){u&&console.warn(e+" is deprecated, please use "+t+" instead.")}function v(e){const{navigator:t}=e,r={browser:null,version:null};if(void 0===e||!e.navigator)return r.browser="Not a browser.",r;if(t.mozGetUserMedia)r.browser="firefox",r.version=d(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)r.browser="chrome",r.version=d(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))r.browser="edge",r.version=d(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!t.userAgent.match(/AppleWebKit\/(\d+)\./))return r.browser="Not a supported browser.",r;r.browser="safari",r.version=d(t.userAgent,/AppleWebKit\/(\d+)\./,1),r.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return r}function g(e){return"[object Object]"===Object.prototype.toString.call(e)}function b(e){return g(e)?Object.keys(e).reduce((function(t,r){const n=g(e[r]),o=n?b(e[r]):e[r],i=n&&!Object.keys(o).length;return void 0===o||i?t:Object.assign(t,{[r]:o})}),{}):e}function y(e,t,r){const n=r?"outbound-rtp":"inbound-rtp",o=new Map;if(null===t)return o;const i=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&i.push(e)}),i.forEach(t=>{e.forEach(r=>{r.type===n&&r.trackId===t.id&&function e(t,r,n){r&&!n.has(r.id)&&(n.set(r.id,r),Object.keys(r).forEach(o=>{o.endsWith("Id")?e(t,t.get(r[o]),n):o.endsWith("Ids")&&r[o].forEach(r=>{e(t,t.get(r),n)})}))}(e,r,o)})}),o}const S=h;function _(e){const t=e&&e.navigator;if(!t.mediaDevices)return;const r=v(e),n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[o("min",r)]=n.ideal,t.optional.push(e),(e={})[o("max",r)]=n.ideal,t.optional.push(e)):(e[o("",r)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[o("",r)]=n.exact):["min","max"].forEach(e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[o(e,r)]=n[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},o=function(e,o){if(r.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){let i=e.video.facingMode;i=i&&("object"==typeof i?i:{ideal:i});const s=r.version<66;if(i&&("user"===i.exact||"environment"===i.exact||"user"===i.ideal||"environment"===i.ideal)&&(!t.mediaDevices.getSupportedConstraints||!t.mediaDevices.getSupportedConstraints().facingMode||s)){let r;if(delete e.video.facingMode,"environment"===i.exact||"environment"===i.ideal?r=["back","rear"]:"user"!==i.exact&&"user"!==i.ideal||(r=["front"]),r)return t.mediaDevices.enumerateDevices().then(t=>{let s=(t=t.filter(e=>"videoinput"===e.kind)).find(e=>r.some(t=>e.label.toLowerCase().includes(t)));return!s&&t.length&&r.includes("back")&&(s=t[t.length-1]),s&&(e.video.deviceId=i.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=n(e.video),S("chrome: "+JSON.stringify(e)),o(e)})}e.video=n(e.video)}return S("chrome: "+JSON.stringify(e)),o(e)},i=function(e){return r.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(t.getUserMedia=function(e,r,n){o(e,e=>{t.webkitGetUserMedia(e,r,e=>{n&&n(i(e))})})}.bind(t),t.mediaDevices.getUserMedia){const e=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(t){return o(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(i(e))))}}}function R(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then(t=>{const n=r.video&&r.video.width,o=r.video&&r.video.height,i=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:i||3}},n&&(r.video.mandatory.maxWidth=n),o&&(r.video.mandatory.maxHeight=o),e.navigator.mediaDevices.getUserMedia(r)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function T(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function E(e){if("object"!=typeof e||!e.RTCPeerConnection||"ontrack"in e.RTCPeerConnection.prototype)p(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e));else{Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.track.id):{track:r.track};const o=new Event("track");o.track=r.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[t.stream],this.dispatchEvent(o)}),t.stream.getTracks().forEach(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.id):{track:r};const o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=[t.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}}function w(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const 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()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let o=r.apply(this,arguments);return o||(o=t(this,e),this._senders.push(o)),o};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),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)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function C(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const o=function(e){const t={};return e.result().forEach(e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{r[t]=e.stat(t)}),t[r.id]=r}),t},i=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const n=function(e){r(i(o(e)))};return t.apply(this,[n,e])}return new Promise((e,r)=>{t.apply(this,[function(t){e(i(o(t)))},r])}).then(r,n)}}function P(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>y(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),p(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>y(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,n;return this.getSenders().forEach(r=>{r.track===e&&(t?n=!0:t=r)}),this.getReceivers().forEach(t=>(t.track===e&&(r?n=!0:r=t),t.track===e)),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function k(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();r.apply(this,arguments);const n=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const o=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),o.apply(this,arguments)}}function M(e){if(!e.RTCPeerConnection)return;const t=v(e);if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return k(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};const o=e.RTCPeerConnection.prototype.removeStream;function i(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const n=e._reverseStreams[t],o=e._streams[n.id];r=r.replace(new RegExp(o.id,"g"),n.id)}),new RTCSessionDescription({type:t.type,sdp:r})}function s(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const n=e._reverseStreams[t],o=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),o.id)}),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},o.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const o=this.getSenders().find(e=>e.track===t);if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[r.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=i(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then(e=>i(this,e))}};e.RTCPeerConnection.prototype[t]=n[t]}));const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=s(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=c.get.apply(this);return""===e.type?e:i(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.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===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(r=>{this._streams[r].getTracks().find(t=>e.track===t)&&(t=this._streams[r])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function A(e){const t=v(e);if(!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),!e.RTCPeerConnection)return;t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));const r=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?t.version<78&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}function O(e){p(e,"negotiationneeded",e=>{if("stable"===e.target.signalingState)return e})}var U=r(26),N=r.n(U);function x(e){const t=e&&e.navigator,r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e).catch(e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e)))}}function I(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function L(e){const t=v(e);if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const r=new Event("enabled");r.enabled=e,this.dispatchEvent(r)}})}!e.RTCRtpSender||"dtmf"in e.RTCRtpSender.prototype||Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){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.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const r=N()(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e,t){let r=!1;return(e=JSON.parse(JSON.stringify(e))).filter(e=>{if(e&&(e.urls||e.url)){var t=e.urls||e.url;e.url&&!e.urls&&m("RTCIceServer.url","RTCIceServer.urls");const n="string"==typeof t;return n&&(t=[t]),t=t.filter(e=>{if(0===e.indexOf("stun:"))return!1;const t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!r?(r=!0,!0):t&&!r}),delete e.url,e.urls=n?t[0]:t,!!t.length}})}(e.iceServers,t.version),h("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function D(e){!e.RTCRtpSender||"replaceTrack"in e.RTCRtpSender.prototype||(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}function j(e){const t=v(e),r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){m("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},n&&n.prototype.getSettings){const t=n.prototype.getSettings;n.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(n&&n.prototype.applyConstraints){const t=n.prototype.applyConstraints;n.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function F(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}function B(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function V(e){const t=v(e);if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;if(!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]})),t.version<68){const t=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?arguments[0]&&""===arguments[0].candidate?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,o,i]=arguments;return n.apply(this,[e||null]).then(e=>{if(t.version<53&&!o)try{e.forEach(e=>{e.type=r[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))})}return e}).then(o,i)}}function W(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function G(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),p(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function H(e){!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){m("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Y(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function z(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach(e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const n=t.apply(this,arguments);if(r){const{sender:t}=n,r=t.getParameters();"encodings"in r||(r.encodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(r).catch(()=>{})))}return n})}function q(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function J(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function K(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}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(r=>t.call(this,r,e)),e.getVideoTracks().forEach(r=>t.call(this,r,e))},e.RTCPeerConnection.prototype.addTrack=function(e){const r=arguments[1];return r&&(this._localStreams?this._localStreams.includes(r)||this._localStreams.push(r):this._localStreams=[r]),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach(e=>{r.includes(e.track)&&this.removeTrack(e)})})}}function X(e){if("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(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)})}),t.apply(e,arguments)}}}function Q(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,o=t.setLocalDescription,i=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],o=r.apply(this,[n]);return t?(o.then(e,t),Promise.resolve()):o},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],o=n.apply(this,[r]);return t?(o.then(e,t),Promise.resolve()):o};let a=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=a,a=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=a,a=function(e,t,r){const n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=a}function Z(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r($(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function $(e){return e&&void 0!==e.video?Object.assign({},e,{video:b(e.video)}):e}function ee(e){const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let n=e.iceServers[r];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(m("RTCIceServer.url","RTCIceServer.urls"),(n=JSON.parse(JSON.stringify(n))).urls=n.url,delete n.url,t.push(n)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in e.RTCPeerConnection&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function te(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function re(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}var ne=r(2),oe=r.n(ne);function ie(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),n=oe.a.parseCandidate(e.candidate),o=Object.assign(r,n);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,p(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function se(e){if(!e.RTCPeerConnection)return;const t=v(e);"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=function(e){if(!e||!e.sdp)return!1;const t=oe.a.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=oe.a.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})},n=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r},o=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},i=function(e,r){let n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);const o=oe.a.matchPrefix(e.sdp,"a=max-message-size:");return o.length>0?n=parseInt(o[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const e=n(arguments[0]),t=o(e),r=i(arguments[0],e);let s;s=0===t&&0===r?Number.POSITIVE_INFINITY:0===t||0===r?Math.max(t,r):Math.min(t,r);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>s}),this._sctp=a}return s.apply(this,arguments)}}function ae(e){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const n=arguments[0],o=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&o>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},p(e,"datachannel",e=>(t(e.channel,e.target),e))}function ce(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function ue(e){if(!e.RTCPeerConnection)return;const t=v(e);if("chrome"===t.browser&&t.version>=71)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(e){return e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")&&(e.sdp=e.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n")),r.apply(this,arguments)}}const de=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const r=h,c=v(e),u={browserDetails:c,commonShim:a,extractVersion:d,disableLog:f,disableWarnings:l};switch(c.browser){case"chrome":if(!n||!A||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),u;r("adapter.js shimming chrome."),u.browserShim=n,_(e),T(e),A(e),E(e),M(e),w(e),C(e),P(e),O(e),ie(e),ce(e),se(e),ae(e),ue(e);break;case"firefox":if(!i||!V||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),u;r("adapter.js shimming firefox."),u.browserShim=i,j(e),V(e),B(e),H(e),W(e),G(e),Y(e),z(e),q(e),J(e),ie(e),ce(e),se(e),ae(e);break;case"edge":if(!o||!L||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),u;r("adapter.js shimming edge."),u.browserShim=o,x(e),I(e),L(e),D(e),se(e),ae(e);break;case"safari":if(!s||!t.shimSafari)return r("Safari shim is not included in this adapter release."),u;r("adapter.js shimming safari."),u.browserShim=s,ee(e),re(e),Q(e),K(e),X(e),te(e),Z(e),ie(e),se(e),ae(e),ue(e);break;default:r("Unsupported browser!")}return u}({window:window});t.default=de}])}));
|