!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("trtc-js-sdk"),require("tim-js-sdk"),require("tsignaling")):"function"==typeof define&&define.amd?define(["trtc-js-sdk","tim-js-sdk","tsignaling"],e):"object"==typeof exports?exports.TRTCCalling=e(require("trtc-js-sdk"),require("tim-js-sdk"),require("tsignaling")):t.TRTCCalling=e(t.TRTC,t.TIM,t.TSignaling)}(window,(function(t,e,n){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=23)}([function(t,e,n){"use strict";n.r(e),n.d(e,"isMap",(function(){return r})),n.d(e,"isSet",(function(){return s})),n.d(e,"isFile",(function(){return o})),n.d(e,"isNumber",(function(){return a})),n.d(e,"isString",(function(){return l})),n.d(e,"isObject",(function(){return u})),n.d(e,"isPlainObject",(function(){return c})),n.d(e,"isArray",(function(){return d})),n.d(e,"isUndefined",(function(){return h})),n.d(e,"isNativeClass",(function(){return p})),n.d(e,"isArrayOrObject",(function(){return _})),n.d(e,"isFunction",(function(){return g})),n.d(e,"isInstanceOfError",(function(){return I})),n.d(e,"getType",(function(){return C})),n.d(e,"TimeUtil",(function(){return v})),n.d(e,"stringifyError",(function(){return E})),n.d(e,"map2String",(function(){return T})),n.d(e,"randomString",(function(){return L})),n.d(e,"isValidType",(function(){return A})),n.d(e,"mapKeys",(function(){return D})),n.d(e,"mapValues",(function(){return b})),n.d(e,"generateRandomRoomID",(function(){return O})),n.d(e,"formatDuration",(function(){return N})),n.d(e,"compareVersion",(function(){return U})),n.d(e,"date2ISOString",(function(){return R})),n.d(e,"getHostType",(function(){return V}));var i=n(5);const r=function(t){return"map"===C(t)},s=function(t){return"set"===C(t)},o=function(t){return"file"===C(t)},a=function(t){return null!==t&&("number"==typeof t&&!isNaN(t-0)||"object"==typeof t&&t.constructor===Number)},l=function(t){return"string"==typeof t},u=function(t){return null!==t&&"object"==typeof t},c=function(t){if("object"!=typeof t||null===t)return!1;const e=Object.getPrototypeOf(t);if(null===e)return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return e===n},d=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"array"===C(t)},h=function(t){return void 0===t},f=/^class\s/,p=function(t){return"function"==typeof t&&f.test(t.toString())},_=function(t){return d(t)||u(t)},g=function(t){return"function"==typeof t},I=function(t){return t instanceof Error},C=function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()};let m=0;Date.now||(Date.now=function(){return(new Date).getTime()});const v={now(){0===m&&(m=Date.now()-1);const t=Date.now()-m;return t>4294967295?(m+=4294967295,Date.now()-m):t},utc:()=>Math.round(Date.now()/1e3)},E=function(t){return JSON.stringify(t,["message","code"])},T=function(t){if(!r(t))return"not a map!!!";let e="";for(const[n,i]of t.entries()){if(r(i))return`[k=${n} -> ${T(i)}`;e+=`[k=${n} v=${i}] `}return e},y="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",S=y.length,L=function(){let t="";for(let e=32;e>0;--e)t+=y[Math.floor(Math.random()*S)];return t},A=function(t,e){for(const n in t)if(t[n]===e)return!0;return!1};function D(t,e){const n={};return Object.keys(t).forEach(i=>{n[e(t[i],i)]=t[i]}),n}function b(t,e){const n={};return Object.keys(t).forEach(i=>{n[i]=e(t[i],i)}),n}function O(){return Math.round(1e8*Math.random())}function w(t){return t<10?"0"+t:t}function N(t){if(t<60)return"00:00:"+w(t);if(t<3600){const e=parseInt(t/60),n=t-60*e;return`00:${w(e)}:${w(n)}`}const e=parseInt(t/3600),n=t-3600*e,i=parseInt(n/60),r=n-60*i;return`${w(e)}:${w(i)}:${w(r)}`}function U(t,e){t=t.split("."),e=e.split(".");const n=Math.max(t.length,e.length);for(;t.lengthr)return 1;if(n-10?"+0"+Math.abs(100*n):"+"+Math.abs(100*n):n>=10?"-"+100*n:"-0"+100*n,e.replace("Z",i)};function V(){let t="unknown";return i.IS_MAC&&(t="mac"),i.IS_WIN&&(t="windows"),i.IS_IOS&&(t="ios"),i.IS_ANDROID&&(t="android"),t}},function(t,e,n){"use strict";n.r(e);var i=n(3),r=n(0);let s=0;const o=new Map;function a(){const t=new Date;return`TRTCCalling ${t.toLocaleTimeString("en-US",{hour12:!1})}.${function(t){let e;switch(t.toString().length){case 1:e="00"+t;break;case 2:e="0"+t;break;default:e=t}return e}(t.getMilliseconds())}:`}const l={_data:[],_length:0,_visible:!1,arguments2String(t){let e;if(1===t.length)e=a()+t[0];else{e=a();for(let n=0,{length:i}=t;ns,record(t,e){1100===l._length&&(l._data.splice(0,100),l._length=1e3),l._length++,l._data.push(`${t} [${e}] \n`)},getLog:()=>l._data};e.default=l},function(t,e,n){"use strict";var i=n(12),r=Object.prototype.toString;function s(t){return"[object Array]"===r.call(t)}function o(t){return void 0===t}function a(t){return null!==t&&"object"==typeof t}function l(t){if("[object Object]"!==r.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function u(t){return"[object Function]"===r.call(t)}function c(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),s(t))for(var n=0,i=t.length;n{this._eventStatController.pushIn(this)},0)}setError(t,e,n){return this.setNetworkType(n),e?(t.code&&this.setCode(t.code),t.message&&this.setMessage(t.message)):(this.setCode(o.a.NO_NETWORK),this.setMessage(l.a.NO_NETWORK)),this}setCode(t){return"ECONNABORTED"===t&&(this.codeint=103),Object(i.isNumber)(t)?this.codeint=t:r.default.warn("SSOLogData.setCode value not a number, please check!",t,typeof t),this}setMessage(t){return Object(i.isString)(t)?(this.message=t,this):this}setText(t){return Object(i.isNumber)(t)?this.text=t.toString():Object(i.isString)(t)&&(this.text=t),this}setTalkTime(t){return this.talktime=t,this}setMessageType(t){return this.msgType=t,this}setCallType(t){return this.calltype=t,this}setNetworkType(t){return Object(i.isUndefined)(t)?r.default.warn("SSOLogData.setNetworkType value is undefined, please check!"):this.networktype=t,this}}e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MODE_TYPE=e.VALID_VIDEO_PROFILE_LIST=e.BUSINESS_ID=e.ACTION_TYPE=e.CALL_STATUS=e.CMD_TYPE_LIST=e.CALL_TYPE=void 0,function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.AUDIO_CALL=1]="AUDIO_CALL",t[t.VIDEO_CALL=2]="VIDEO_CALL"}(e.CALL_TYPE||(e.CALL_TYPE={})),e.CMD_TYPE_LIST=["","audioCall","videoCall"],function(t){t.IDLE="idle",t.CALLING="calling",t.CONNECTED="connected"}(e.CALL_STATUS||(e.CALL_STATUS={})),function(t){t[t.INVITE=1]="INVITE",t[t.CANCEL_INVITE=2]="CANCEL_INVITE",t[t.ACCEPT_INVITE=3]="ACCEPT_INVITE",t[t.REJECT_INVITE=4]="REJECT_INVITE",t[t.INVITE_TIMEOUT=5]="INVITE_TIMEOUT"}(e.ACTION_TYPE||(e.ACTION_TYPE={})),function(t){t[t.SIGNAL=1]="SIGNAL"}(e.BUSINESS_ID||(e.BUSINESS_ID={})),e.VALID_VIDEO_PROFILE_LIST=["480p","720p","1080p"],function(t){t.AUDIO="audio",t.VIDEO="video"}(e.MODE_TYPE||(e.MODE_TYPE={}))},function(t,e,n){"use strict";n.r(e);e.default={SDK_CONSTRUCT:"sdkConstruct",SDK_READY:"sdkReady",SDK_NOT_READY:"sdkNotReady",LOGIN:"login",LOGOUT:"logout",CALL:"call",GROUP_CALL:"groupCall",ACCEPT:"accept",REJECT:"reject",HANGUP:"hangup",START_REMOTE_VIEW:"startRemoteView",STOP_REMOTE_VIEW:"stopRemoteView",START_LOCAL_VIEW:"startLocalView",STOP_LOCAL_VIEW:"stopLocalView",OPEN_CAMERA:"openCamera",CLOSE_CAMERA:"closeCamera",SET_MIC_MUTE:"setMicMute",SET_VIDEO_QUALITY:"setVideoQuality",SWITCH_TO_AUDIO_CALL:"switchToAudioCall",SWITCH_TO_VIDEO_CALL:"switchToVideoCall",KICKED_OUT:"kickedOut",CHANGE_CALL_STATUS:"changeCallStatus",TALK_TIME:"talktime",ERROR:"error",INVITED:"invited",GROUP_CALL_INVITEE_LIST_UPDATE:"group_call_invitee_list_update",USER_ENTER:"user_enter",USER_LEAVE:"user_leave",REJECT:"reject",NO_RESP:"no_resp",LINE_BUSY:"line_busy",CALLING_CANCEL:"calling_cancel",KICKED_OUT:"kicked_out",CALLING_TIMEOUT:"calling_timeout",CALLING_END:"calling_end",USER_VIDEO_AVAILABLE:"user_video_available",USER_AUDIO_AVAILABLE:"user_audio_available",USER_VOICE_VOLUME:"user_voice_volume",GROUP_CALL_INVITEE_LIST_UPDATE:"group_call_invitee_list_update"}},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return p}));var i=n(1),r=n(0);class s{constructor(){this._table="timweb-trtccalling",this._report=[]}pushIn(t){i.default.debug("SSOLogBody.pushIn",this._report.length,t),this._report.push(t)}backfill(t){Object(r.isArray)(t)&&0!==t.length&&(i.default.debug("SSOLogBody.backfill",this._report.length,t.length),this._report.unshift(...t))}getLogsNumInMemory(){return this._report.length}isEmpty(){return 0===this._report.length}_reset(){this._report.length=0,this._report=[]}getTable(){return this._table}getLogsInMemory(){const t=this._report.slice();return this._reset(),t}}var o=n(6),a=n(10),l=n(22),u=n.n(l);const c={CURRENT:{COMMON:"https://webim.tim.qq.com"},PRODUCTION:{COMMON:"https://webim.tim.qq.com"},OVERSEA_PRODUCTION:{COMMON:"https://api.im.qcloud.com"},SANDBOX:{COMMON:"https://events.tim.qq.com"},TEST:{COMMON:"https://test.tim.qq.com"}},d={IM_OPEN_STAT:"imopenstat"},h={TIM_WEB_TRTCCALLING_REPORT:"tweb_trtccalling_report"},f={imopenstat:"v4"};class p{constructor(){this.TAG="trtccalling-ssolog-event",this._reportBody=new s,this._version=a.version||"",this.MIN_THRESHOLD=20,this.MAX_THRESHOLD=100,this.WAITING_TIME=6e4,this.INTERVAL=2e4,this._timerID=0,this._resetLastReportTime(),this._startReportTimer(),this._retryCount=0,this.MAX_RETRY_COUNT=3}reportAtOnce(){i.default.debug("EventStatController.reportAtOnce"),this._report()}pushIn(t){t instanceof o.default&&(t.setCommonInfo({SDKAppID:Number(sessionStorage.getItem("sdkAppId")),version:this._version,userID:sessionStorage.getItem("userId")}),this._reportBody.pushIn(t),this._report())}_resetLastReportTime(){this._lastReportTime=Date.now()}_startReportTimer(){this._timerID=setInterval(()=>{Date.now()0&&(clearInterval(this._timerID),this._timerID=0)}_report(){if(this._reportBody.isEmpty())return;const t=Math.ceil(+new Date/1e3),e=sessionStorage.getItem("sdkAppId"),n=this._reportBody.getLogsInMemory(),s={table:this._reportBody.getTable(),report:n},o=`${c.CURRENT.COMMON}/${f.imopenstat}/${d.IM_OPEN_STAT}/${h.TIM_WEB_TRTCCALLING_REPORT}/?sdkappid=${e}&reqtime=${t}`;u.a.post(o,JSON.stringify(s)).then(()=>{this._resetLastReportTime(),this._retryCount>0&&(i.default.debug("EventStatController.report retry success"),this._retryCount=0)}).catch(t=>{i.default.warn("EventStatController.report, error:"+Object(r.stringifyError)(t)),this._reportBody.backfill(n);this._reportBody.getLogsNumInMemory()>this.MAX_THRESHOLD||this._retryCount===this.MAX_RETRY_COUNT||0===this._timerID?this._retryCount=0:this._retryCount+=1})}reset(){i.default.log("EventStatController.reset"),this._stopReportTimer(),this._report()}}},function(t){t.exports=JSON.parse('{"name":"trtc-calling-js","version":"1.0.1","description":"腾讯云 TRTC CALLING SDK","main":"index","dependencies":{"axios":"^0.21.0","EventEmitter":"^1.0.0","tim-js-sdk":"^2.13.1","trtc-js-sdk":"^4.11.5","tsignaling":"^0.7.0"},"devDependencies":{"@babel/preset-typescript":"^7.12.7","@typescript-eslint/eslint-plugin":"^4.26.0","@typescript-eslint/parser":"^4.26.0","docdash-blue":"^1.1.3","eslint":"^7.27.0","eslint-config-google":"^0.14.0","fs-extra":"^9.0.1","jsdoc":"^3.6.5","pretty":"^2.0.0","replace":"^1.2.0","ts-loader":"^8.0.2","typescript":"^3.9.7","webpack":"^4.44.1","webpack-cli":"^3.3.12"},"scripts":{"build":"webpack --config webpack.config.js","build_withcopy":"npm run build && cp dist/npm/trtc-calling-js.js ../TIM-demo-web/node_modules/trtc-calling-js/trtc-calling-js.js","build_withcopy2":"npm run build && cp dist/npm/trtc-calling-js.js ../trtc-calling-webrtc-demo/node_modules/trtc-calling-js/trtc-calling-js.js","build:package":"node build/package-bundle.js","lint":"./node_modules/.bin/eslint ./src; exit 0","fix":"./node_modules/.bin/eslint --fix ./src; exit 0","prerelease":"npm run lint && npm run build && npm run doc && npm run build:package","ts2js":"tsc src/index.ts --outDir build/ts2js --lib es2015,DOM","doc":"npm run ts2js && npm run doc:clean && npm run doc:build","doc:build":"./node_modules/.bin/jsdoc -c build/jsdoc/jsdoc.json && node ./build/jsdoc/fix-doc.js","doc:clean":"node ./build/jsdoc/clean-doc.js","changelog":"cp CHANGELOG.md build/jsdoc/tutorials/CHANGELOG.md"},"repository":{"type":"git","url":"git@git.code.oa.com:TRDCWeb/trtc-calling-webrtc.git"},"author":"Tencent Cloud Terminal R&D Center","license":"ISC"}')},function(e,n){e.exports=t},function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),i=0;i=200&&t<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],(function(t){l.headers[t]={}})),i.forEach(["post","put","patch"],(function(t){l.headers[t]=i.merge(s)})),t.exports=l}).call(this,n(32))},function(t,e,n){"use strict";var i=n(2),r=n(34),s=n(36),o=n(13),a=n(37),l=n(40),u=n(41),c=n(17);t.exports=function(t){return new Promise((function(e,n){var d=t.data,h=t.headers;i.isFormData(d)&&delete h["Content-Type"];var f=new XMLHttpRequest;if(t.auth){var p=t.auth.username||"",_=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";h.Authorization="Basic "+btoa(p+":"+_)}var g=a(t.baseURL,t.url);if(f.open(t.method.toUpperCase(),o(g,t.params,t.paramsSerializer),!0),f.timeout=t.timeout,f.onreadystatechange=function(){if(f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))){var i="getAllResponseHeaders"in f?l(f.getAllResponseHeaders()):null,s={data:t.responseType&&"text"!==t.responseType?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:i,config:t,request:f};r(e,n,s),f=null}},f.onabort=function(){f&&(n(c("Request aborted",t,"ECONNABORTED",f)),f=null)},f.onerror=function(){n(c("Network Error",t,null,f)),f=null},f.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(c(e,t,"ECONNABORTED",f)),f=null},i.isStandardBrowserEnv()){var I=(t.withCredentials||u(g))&&t.xsrfCookieName?s.read(t.xsrfCookieName):void 0;I&&(h[t.xsrfHeaderName]=I)}if("setRequestHeader"in f&&i.forEach(h,(function(t,e){void 0===d&&"content-type"===e.toLowerCase()?delete h[e]:f.setRequestHeader(e,t)})),i.isUndefined(t.withCredentials)||(f.withCredentials=!!t.withCredentials),t.responseType)try{f.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&f.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){f&&(f.abort(),n(t),f=null)})),d||(d=null),f.send(d)}))}},function(t,e,n){"use strict";var i=n(35);t.exports=function(t,e,n,r,s){var o=new Error(t);return i(o,e,n,r,s)}},function(t,e,n){"use strict";var i=n(2);t.exports=function(t,e){e=e||{};var n={},r=["url","method","data"],s=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function l(t,e){return i.isPlainObject(t)&&i.isPlainObject(e)?i.merge(t,e):i.isPlainObject(e)?i.merge({},e):i.isArray(e)?e.slice():e}function u(r){i.isUndefined(e[r])?i.isUndefined(t[r])||(n[r]=l(void 0,t[r])):n[r]=l(t[r],e[r])}i.forEach(r,(function(t){i.isUndefined(e[t])||(n[t]=l(void 0,e[t]))})),i.forEach(s,u),i.forEach(o,(function(r){i.isUndefined(e[r])?i.isUndefined(t[r])||(n[r]=l(void 0,t[r])):n[r]=l(void 0,e[r])})),i.forEach(a,(function(i){i in e?n[i]=l(t[i],e[i]):i in t&&(n[i]=l(void 0,t[i]))}));var c=r.concat(s).concat(o).concat(a),d=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===c.indexOf(t)}));return i.forEach(d,u),n}},function(t,e,n){"use strict";function i(t){this.message=t}i.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},i.prototype.__CANCEL__=!0,t.exports=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EVENT=void 0,e.EVENT={ERROR:"onError",SDK_READY:"sdkReady",INVITED:"onInvited",USER_ACCEPT:"onUserAccept",USER_ENTER:"onUserEnter",USER_LEAVE:"onUserLeave",REJECT:"onReject",NO_RESP:"onNoResp",LINE_BUSY:"onLineBusy",CALLING_CANCEL:"onCallingCancel",KICKED_OUT:"onKickedOut",CALLING_TIMEOUT:"onCallingTimeout",CALL_END:"onCallEnd",CALLING_END:"onCallEnd",USER_VIDEO_AVAILABLE:"onUserVideoAvailable",USER_AUDIO_AVAILABLE:"onUserAudioAvailable",USER_VOICE_VOLUME:"onUserVoiceVolume",GROUP_CALL_INVITEE_LIST_UPDATE:"onGroupCallInviteeListUpdate"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={NO_SDK_APPID:"无 SDKAppID",NO_ACCOUNT_TYPE:"无 accountType",NO_IDENTIFIER:"无 userID",NO_USER_SIG:"无 userSig",NO_NETWORK:"未连接到网络"}},function(t,e,n){t.exports=n(27)},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]0},t.prototype.getRemoteStreamCount=function(){return this._trtcClient?this._trtcClient.getRemoteStreams().length:0},t.prototype.setLogLevel=function(t){v.default.setLevel(t),this._tsignalingClient.setLogLevel(t),c.Logger.setLogLevel(t+1)},t.prototype.on=function(t,e,n){this._outerEmitter.on(t,e,n||this)},t.prototype.off=function(t,e,n){this._outerEmitter.off(t,e,n||this)},t.prototype.login=function(t){return r(this,void 0,void 0,(function(){var e,n,i;return s(this,(function(r){switch(r.label){case 0:v.default.debug(A+".login - params:",t),this._netMonitor.start(),e=t.userID,n=t.userSig,this._userID=e,this._userSig=n,this._trtcClient=new u.default({sdkAppID:this._sdkAppID,userID:e,userSig:n,trtcCalling:this}),sessionStorage.setItem("userId",""+this._userID),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._tsignalingClient.login({userID:e,userSig:n})];case 2:return r.sent(),this._setInterfaceUpLoad(g.default.LOGIN).setText("userId: "+this._userID+" login succeeded").setEnd(),[3,4];case 3:return i=r.sent(),console.log(i),this._setInterfaceUpLoad(g.default.LOGIN).setText("userId: "+this._userID+" login failed, error: "+i).setEnd(),[3,4];case 4:return[2]}}))}))},t.prototype.logout=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){return v.default.debug(A+".logout"),this._setInterfaceUpLoad(g.default.LOGOUT).setText("userId: "+this._userID+" logout").setEnd(),this._userID="",this._userSig="",this._resetTRTCClient(),this._trtcClient=null,[2,this._tsignalingClient.logout()]}))}))},t.prototype.call=function(t){return r(this,void 0,void 0,(function(){var e,n,i,r,o,a,u;return s(this,(function(s){switch(s.label){case 0:if(this._callStatus!==E.CALL_STATUS.IDLE)throw new Error(A+".call - CALL_STATUS: "+this._callStatus);this._callStatus=E.CALL_STATUS.CALLING,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:t.type===E.CALL_TYPE.VIDEO_CALL})];case 2:return e=s.sent(),this._trtcClient.releaseStream(e),[3,4];case 3:throw n=s.sent(),this._callStatus=E.CALL_STATUS.IDLE,this._delegate.onError(S.default.NOT_MEDIA_ACCESS,JSON.stringify(n)),new Error(A+".call - 获取用户设备权限失败");case 4:return v.default.log(A+".call - params:",t),i=t.userID,r=t.type,o=t.offlinePushInfo,this._callType=r,this._isInviter=!0,this._inviterID=this._userID,this._inviteeID=i,this._isGroupCall=!1,this._groupID="",this._roomID=l.generateRandomRoomID(),[4,this._tsignalingClient.invite({userID:i,type:r,roomID:this._roomID,timeout:this._callTimeout,offlinePushInfo:o})];case 5:return a=s.sent(),u="callType: "+(r+1)+", \n conversationType: "+a.data.message.conversationType+", \n userId:{ "+a.data.message.from+" } invite userId:{ "+a.data.message.to+" }",0===a.code?(this.setInviterInviteID(a.inviteID),this._setInterfaceUpLoad(g.default.CALL).setCallType(r+1).setText(u+" succeeded").setEnd()):this._setInterfaceUpLoad(g.default.CALL).setCallType(r+1).setText(u+" failed").setEnd(),[2,a]}}))}))},t.prototype.setInviterInviteID=function(t){this._inviterInviteID.push(t),this._inviterInviteID=Array.from(new Set(this._inviterInviteID))},t.prototype.getInviterInviteID=function(){return this._inviterInviteID},t.prototype.delInviterInviteID=function(t){this._inviterInviteID=this._inviterInviteID.filter((function(e){return e!==t}))},t.prototype._setInterfaceUpLoad=function(t){return v.default.time(t),new _.default(t)},t.prototype.getInviterID=function(){return this._inviterID},t.prototype.setInviterID=function(t){this._inviterID=t},t.prototype.groupCall=function(t){return r(this,void 0,void 0,(function(){var e,n,i,r,o,a,u,c,d=this;return s(this,(function(s){switch(s.label){case 0:if(this._groupCallStatus)throw new Error(A+".call - CALL_STATUS: "+this._callStatus);s.label=1;case 1:return s.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:t.type===E.CALL_TYPE.VIDEO_CALL})];case 2:return e=s.sent(),this._trtcClient.releaseStream(e),[3,4];case 3:throw n=s.sent(),this._delegate.onError(S.default.NOT_MEDIA_ACCESS,JSON.stringify(n)),new Error(A+".call - 获取用户设备权限失败");case 4:return this._groupCallStatus=!0,v.default.debug(A+".groupCall - params:",t),i=t.userIDList,r=t.type,o=t.groupID,a=t.offlinePushInfo,this._callType=r,this._isInviter=!0,this._isGroupCall=!0,this._inviterID=this._userID,this._groupID=o||"",this.setInviteeList(i),this.setUnHandledInviteeList(i),this._roomID||(this._roomID=l.generateRandomRoomID(),this._callStatus=E.CALL_STATUS.CALLING),[4,this._tsignalingClient.inviteInGroup({groupID:this._groupID,userIDList:i,type:r,roomID:this._roomID,timeout:this._callTimeout,offlinePushInfo:a})];case 5:return u=s.sent(),v.default.log("groupCall res",u),o?(c="callType: "+(r+1)+",\n conversationType: "+u.data.message.conversationType+",\n userId:{ "+u.data.message.from+" } invite { "+u.data.message.to+": "+i+" }",0===u.code?(this.setInviterInviteID(u.inviteID),this._setInterfaceUpLoad(g.default.GROUP_CALL).setCallType(r+1).setText(c+" succeeded").setEnd()):this._setInterfaceUpLoad(g.default.GROUP_CALL).setCallType(r+1).setText(c+" failed").setEnd()):(c="callType: "+(r+1)+",\n result: "+JSON.stringify(u),0===u.code?(u.data.map((function(t){d.setInviterInviteID(t.inviteID)})),this._setInterfaceUpLoad(g.default.GROUP_CALL).setCallType(r+1).setText(c+" succeeded").setEnd()):this._setInterfaceUpLoad(g.default.GROUP_CALL).setCallType(r+1).setText(c+" failed").setEnd()),this._groupCallStatus=!1,[2,u]}}))}))},t.prototype.accept=function(){return r(this,void 0,void 0,(function(){var t,e,n,i,r,o,a,l,u,c=this;return s(this,(function(s){switch(s.label){case 0:if(v.default.debug(A+".accept"),!this._tsignalingClient.getInviteData())return v.default.warn(A+".accept - there are no calls to accept"),[2];t=this._tsignalingClient.getInviteData(),e=t.inviteID,n=t.inviteData,i=n.roomID,r=n.callType,v.default.debug(A+".accept - params","inviteID: "+e+",callType: "+r+",roomID: "+i+"."),this._callType=r,this._callStatus=E.CALL_STATUS.CALLING,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._trtcClient.join(i)];case 2:return s.sent(),this._roomID=i,this._tsignalingClient.setInviteData(null),this.changeCallStatus(E.CALL_STATUS.CONNECTED),[3,4];case 3:throw s.sent(),this._resetTRTCClient(),new Error(A+".accept - join room failed");case 4:return s.trys.push([4,6,,7]),[4,this._tsignalingClient.accept({inviteID:e,callType:r})];case 5:return o=s.sent(),u="callType: "+(r+1)+",\n conversationType: "+o.data.message.conversationType+",\n userId:{ "+this._userID+" } accept userId:{ "+o.data.message.to+" } succeeded",this._setInterfaceUpLoad(g.default.ACCEPT).setCallType(r+1).setText(""+u).setEnd(),[3,7];case 6:return a=s.sent(),v.default.error(a),u="callType: "+(r+1)+",\n conversationType: "+o.data.message.conversationType+",\n userId:{ "+this._userID+" } accept userId:{ "+o.data.message.to+" } failed",this._setInterfaceUpLoad(g.default.ACCEPT).setCallType(r+1).setText(""+u).setEnd(),[2];case 7:return this.isGroupCall()&&(l=this._unHandledInviteeList.filter((function(t){return t!==c._userID})),this.setUnHandledInviteeList(l),u="callType: "+(r+1)+",\n conversationType: "+o.data.message.conversationType+",\n userId:{ "+this._userID+" } accept userId:{ "+o.data.message.to+" } succeeded",this._setInterfaceUpLoad(g.default.ACCEPT).setCallType(r+1).setText(u).setEnd()),[2,o]}}))}))},t.prototype.reject=function(){return r(this,void 0,void 0,(function(){var t,e,n,i,r,o,a;return s(this,(function(s){switch(s.label){case 0:return v.default.debug(A+".reject"),this._tsignalingClient.getInviteData()?(t=this._callStatus===E.CALL_STATUS.CONNECTED,v.default.log(A+".reject - status:"+t),e=this._tsignalingClient.getInviteData(),n=e.inviteID,i=e.inviteData,r=i.callType,v.default.debug(A+".reject - params","inviteID: "+n+",callType: "+r+",isBusy: "+t+"."),[4,this._tsignalingClient.reject({inviteID:n,callType:r,isBusy:t})]):(v.default.warn(A+".reject - there are no calls to reject"),[2]);case 1:return o=s.sent(),a="callType: "+(r+1)+",\n conversationType: "+o.data.message.conversationType+",\n userId:{ "+this._userID+" } reject userId:{ "+o.data.message.to+" } succeeded",this._setInterfaceUpLoad(g.default.REJECT).setCallType(r+1).setText(a).setEnd(),t||this._resetTRTCClient(),[2,o]}}))}))},t.prototype.hangup=function(){return r(this,void 0,void 0,(function(){var t,e,n;return s(this,(function(i){switch(i.label){case 0:if(v.default.log(A+". - callStatus:"+this._callStatus+" inviteID:"+this._inviterInviteID),this._callStatus===E.CALL_STATUS.CALLING&&0===this._inviterInviteID.length)throw new Error(A+".call/groupCall incomplete。please wait cancel");i.label=1;case 1:return i.trys.push([1,3,,5]),[4,this._cancel()];case 2:return t=i.sent(),[3,5];case 3:return e=i.sent(),[4,this._resetTRTCClient()];case 4:throw i.sent(),v.default.error("leave _cancel",e),new Error(e);case 5:if(this._callStatus!==E.CALL_STATUS.CONNECTED)return[3,11];i.label=6;case 6:return i.trys.push([6,8,,10]),[4,this._trtcClient.leave()];case 7:return t=i.sent(),[3,10];case 8:return n=i.sent(),[4,this._resetTRTCClient()];case 9:throw i.sent(),console.error("hangup leave error",n),new Error(n);case 10:this._setInterfaceUpLoad(g.default.REJECT).setText("userId: "+this._userID+" hangup succeeded").setEnd(),i.label=11;case 11:return[4,this._resetTRTCClient()];case 12:return i.sent(),[2,t]}}))}))},t.prototype._cancel=function(){return r(this,void 0,void 0,(function(){var t,e,n,i,r,o;return s(this,(function(s){switch(s.label){case 0:if(v.default.log("_cancel _inviterInviteID",this._inviterInviteID),0===this._inviterInviteID.length)return[2];t=[],s.label=1;case 1:s.trys.push([1,6,,7]),e=0,s.label=2;case 2:return e0?"结束通话,通话时长:"+l.formatDuration(n.call_end):0!==n.call_end&&n.room_id?"发起通话":"结束群聊";case E.ACTION_TYPE.CANCEL_INVITE:return"取消通话";case E.ACTION_TYPE.ACCEPT_INVITE:return"已接听";case E.ACTION_TYPE.REJECT_INVITE:return"拒绝通话";case E.ACTION_TYPE.INVITE_TIMEOUT:return"无应答";default:return""}},t.EVENT=p.EVENT,t.CALL_TYPE=E.CALL_TYPE,t}();e.default=D},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return o}));const i=Function.prototype.apply,r=new WeakMap;function s(t){return r.has(t)||r.set(t,{}),r.get(t)}class o{constructor(t=null,e=console){const n=s(this);return n._events=new Set,n._callbacks={},n._console=e,n._maxListeners=null===t?null:parseInt(t,10),this}_addCallback(t,e,n,i){return this._getCallbacks(t).push({callback:e,context:n,weight:i}),this._getCallbacks(t).sort((t,e)=>t.weight>e.weight),this}_getCallbacks(t){return s(this)._callbacks[t]}_getCallbackIndex(t,e){return this._has(t)?this._getCallbacks(t).findIndex(t=>t.callback===e):null}_achieveMaxListener(t){return null!==s(this)._maxListeners&&s(this)._maxListeners<=this.listenersNumber(t)}_callbackIsExists(t,e,n){const i=this._getCallbackIndex(t,e),r=-1!==i?this._getCallbacks(t)[i]:void 0;return-1!==i&&r&&r.context===n}_has(t){return s(this)._events.has(t)}on(t,e,n=null,i=1){const r=s(this);if("function"!=typeof e)throw new TypeError(e+" is not a function");return this._has(t)?(this._achieveMaxListener(t)&&r._console.warn(`Max listeners (${r._maxListeners}) for event "${t}" is reached!`),this._callbackIsExists(...arguments)&&r._console.warn(`Event "${t}" already has the callback ${e}.`)):(r._events.add(t),r._callbacks[t]=[]),this._addCallback(...arguments),this}once(t,e,n=null,r=1){const s=(...r)=>(this.off(t,s),i.call(e,n,r));return this.on(t,s,n,r)}off(t,e=null){const n=s(this);let i;return this._has(t)&&(null===e?(n._events.delete(t),n._callbacks[t]=null):(i=this._getCallbackIndex(t,e),-1!==i&&(n._callbacks[t].splice(i,1),this.off(...arguments)))),this}emit(t,...e){return this._has(t)&&this._getCallbacks(t).forEach(t=>i.call(t.callback,t.context,e)),this}clear(){const t=s(this);return t._events.clear(),t._callbacks={},this}listenersNumber(t){return this._has(t)?this._getCallbacks(t).length:null}}},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]=0?o.checkSystemRequirements().then((function(t){t.result||a.default.log(p+".您的浏览器不兼容此应用!\n建议下载最新版Chrome浏览器")})):o.checkSystemRequirements().then((function(t){t||a.default.log(p+".您的浏览器不兼容此应用!\n建议下载最新版Chrome浏览器")})),this.init()}return t.prototype.init=function(){this._client=o.createClient({mode:"rtc",sdkAppId:this._sdkAppID,userId:this._userID,userSig:this._userSig,frameWorkType:32}),this.handleEvents()},t.prototype.getRemoteStreams=function(){return this._remoteStreams},t.prototype.getCamera=function(){return i(this,void 0,void 0,(function(){var t,e=this;return r(this,(function(n){switch(n.label){case 0:return[4,o.getCameras()];case 1:return t=n.sent(),a.default.log(p+".getCamera - "+JSON.stringify(t)),t.length>0?this._device.video&&t.some((function(t){return t.deviceId===e._device.video.deviceId}))||(this._device.video=t[0]):this._device.video=null,[2,t]}}))}))},t.prototype.getMicrophone=function(){return i(this,void 0,void 0,(function(){var t,e=this;return r(this,(function(n){switch(n.label){case 0:return[4,o.getMicrophones()];case 1:return t=n.sent(),a.default.log(p+".getMicrophone - "+JSON.stringify(t)),t.length>0?this._device.audio&&t.some((function(t){return t.deviceId===e._device.audio.deviceId}))||(this._device.audio=t[0]):this._device.audio=null,[2,t]}}))}))},t.prototype.switchDevice=function(t,e){return i(this,void 0,void 0,(function(){var n;return r(this,(function(i){return a.default.log(p+".switchDevice - params: deviceType:"+t+",deviceID:"+e),this._localStream?this._localStream.switchDevice(t,e):(n={deviceType:t,deviceId:e},this._device[t]=n),[2]}))}))},t.prototype.join=function(t){return i(this,void 0,void 0,(function(){var e,n,i,s,u,c;return r(this,(function(r){switch(r.label){case 0:return[4,this.getCamera()];case 1:return r.sent(),[4,this.getMicrophone()];case 2:if(r.sent(),e=this.getCallType(),!this._device.audio)return a.default.warn(p+".join - invalid microphone"),this._trtcCalling._delegate.onError(f.default.NOT_MICROPHONE_LIST,"invalid microphone"),this._trtcCalling._resetTRTCClient(),[2];if(!this._device.video&&e===l.CALL_TYPE.VIDEO_CALL)return a.default.warn(p+".join - invalid camera"),this._trtcCalling._delegate.onError(f.default.NOT_CAMERA_LIST,"invalid camera"),this._trtcCalling._resetTRTCClient(),[2];if(this._isJoined)return a.default.warn(p+".join - duplicate RtcClient.join() observed"),[2];r.label=3;case 3:return r.trys.push([3,14,,15]),[4,this._client.join({roomId:t})];case 4:if(r.sent(),this._isJoined=!0,this._trtcCalling.getCallStatus()===l.CALL_STATUS.IDLE)return a.default.warn(p+".join - early hangup"),this._trtcCalling.hangup(),[2];if(a.default.log(p+".join - join room success, callType:"+e),e!==l.CALL_TYPE.AUDIO_CALL&&e!==l.CALL_TYPE.VIDEO_CALL)return a.default.log(p+".join - invalid callType"),[2];n={audio:!0,video:!1,userId:this._userID,microphoneId:this._device.audio.deviceId},e===l.CALL_TYPE.VIDEO_CALL&&(n.video=!0,n.cameraId=this._device.video.deviceId),this._localStream=o.createStream(n),this._localStream.setVideoProfile(this._trtcCalling.getVideoQuality()),r.label=5;case 5:return r.trys.push([5,8,,13]),[4,this._localStream.initialize()];case 6:return r.sent(),a.default.log(p+".join - initialize local stream success"),this._localStream.on("player-state-changed",(function(t){a.default.log(p+".join - local stream "+t.type+" player is "+t.state)})),[4,this.publish()];case 7:return r.sent(),a.default.log(p+".publish success"),this._joinedTimestamp=new Date,[3,13];case 8:i=r.sent(),a.default.error(p+".join - failed to initialize local stream - "+i),r.label=9;case 9:return r.trys.push([9,11,,12]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!0})];case 10:return s=r.sent(),this.releaseStream(s),[3,12];case 11:return u=r.sent(),this._trtcCalling._delegate.onError(f.default.NOT_MEDIA_ACCESS,JSON.stringify(u)),[3,12];case 12:return[3,13];case 13:return[3,15];case 14:return c=r.sent(),a.default.error(p+".join - join room failed! "+c),[3,15];case 15:return[2]}}))}))},t.prototype.playVideo=function(t){a.default.debug(p+".playVideo - params:",t);var e=t.domID,n=t.type,i=t.userID;if("local"===n&&this._localStream.play(e),"remote"===n){var r=this._remoteStreams.find((function(t){return t.getUserId()===i}));r&&r.play(e)}},t.prototype.stopVideo=function(t){a.default.debug(p+".stopVideo - params:",t);var e=t.type,n=t.userID;if("local"===e&&this._localStream.stop(),"remote"===e){var i=this._remoteStreams.find((function(t){return t.getUserId()===n}));i&&i.stop()}},t.prototype.getCallType=function(){return this._trtcCalling.getCallType()},t.prototype.leave=function(){return i(this,void 0,void 0,(function(){var t;return r(this,(function(e){switch(e.label){case 0:return a.default.log(p+"-leave._isJoined:"+this._isJoined),a.default.log(p+"-leave._localStream:"+this._localStream),this._isJoined?this._localStream?[4,this.unpublish()]:[3,2]:(a.default.warn(p+".leave - please join() firstly"),[2]);case 1:e.sent(),this._localStream&&this._localStream.stop(),this._localStream&&this._localStream.close(),this._localStream=null,e.label=2;case 2:return e.trys.push([2,4,,5]),[4,this._client.leave()];case 3:return e.sent(),this._isJoined=!1,this._leaveTimestamp=new Date,t=Math.floor((this._leaveTimestamp-this._joinedTimestamp)/1e3),new c.default(d.default.TALK_TIME).setTalkTime(t).setText("talkTime record").setEnd(),[3,5];case 4:throw e.sent(),new Error("leave room error");case 5:return[2]}}))}))},t.prototype.publish=function(){return i(this,void 0,void 0,(function(){var t;return r(this,(function(e){switch(e.label){case 0:if(!this._isJoined)return a.default.warn(p+".publish - please join() firstly"),[2];if(this._isPublished)return a.default.warn(p+".publish - duplicate RtcClient.publish() observed"),[2];if(this._trtcCalling.getCallStatus()===l.CALL_STATUS.IDLE)return a.default.warn(p+".join - early hangup"),this._trtcCalling.hangup(),[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this._client.publish(this._localStream)];case 2:return e.sent(),a.default.log(p+".publish - success"),[3,4];case 3:return t=e.sent(),a.default.error(p+".publish - failed to publish local stream "+t),this._isPublished=!1,[3,4];case 4:return this._isPublished=!0,[2]}}))}))},t.prototype.unpublish=function(){return i(this,void 0,void 0,(function(){var t;return r(this,(function(e){switch(e.label){case 0:if(!this._isJoined)return a.default.warn(p+".unpublish - please join() firstly"),[2];if(!this._isPublished)return a.default.warn(p+".unpublish - RtcClient.unpublish() called but not published yet"),[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this._client.unpublish(this._localStream)];case 2:return e.sent(),a.default.log(p+".unpublish - success"),[3,4];case 3:return t=e.sent(),a.default.error(p+".unpublish - failed to publish local stream "+t),[3,4];case 4:return this._isPublished=!1,[2]}}))}))},t.prototype.handleEvents=function(){var t=this;this._client.on("error",(function(e){a.default.error(p+".handleEvents - client on error "+e);var n=e.getCode(),i=JSON.stringify({name:"TRTC",error:e});t._trtcCalling._delegate.onError(n,i)})),this._client.on("client-banned",(function(t){a.default.error(p+".handleEvents - client has been banned for "+t)})),this._client.on("peer-join",(function(e){var n=e.userId;if(a.default.debug(p+".handleEvents - peer-join "+n),t._connectStartTime||(t._connectStartTime=Date.now()),t._trtcCalling.isGroupCall()){var i=t._trtcCalling.getUnHandledInviteeList(),r=s(i,[n]);t._trtcCalling.setUnHandledInviteeList(r),t._trtcCalling._delegate.onGroupCallInviteeListUpdate(r)}})),this._client.on("peer-leave",(function(e){return i(t,void 0,void 0,(function(){var t,n,i,s,o;return r(this,(function(r){switch(r.label){case 0:return t=e.userId,n=this._remoteStreams.filter((function(e){return e.getUserId()!==t})),i=this._trtcCalling.getUnHandledInviteeList(),s=this._trtcCalling.isGroupCall(),a.default.log(p+".handleEvents - peer-leave isGroupCall:"+s+" userID:"+t+",\n remainStreamsCount:"+n.length+" unHandledListLength:"+i.length),s&&0!==i.length&&(o=i.filter((function(e){return e!==t})),this._trtcCalling.setUnHandledInviteeList(o),this._trtcCalling._delegate.onGroupCallInviteeListUpdate(o)),0!==n.length?[3,3]:[4,this.leave()];case 1:return r.sent(),[4,this._trtcCalling._tsignalingClient.lastOneHangup({userIDList:[t],callType:this.getCallType(),callEnd:Math.round((Date.now()-this._connectStartTime)/1e3)})];case 2:r.sent(),this._trtcCalling._resetTRTCClient(),this._connectStartTime=0,r.label=3;case 3:return[2]}}))}))})),this._client.on("stream-added",(function(e){return i(t,void 0,void 0,(function(){var t,n,i;return r(this,(function(r){switch(r.label){case 0:t=e.stream,n=t.getId(),i=t.getUserId(),a.default.log(p+".handleEvents - remote stream added, userID:"+i+" streamID:"+n+" type:"+t.getType()),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._client.subscribe(t)];case 2:return r.sent(),[3,4];case 3:return r.sent(),0===this._remoteStreams.length&&this._trtcCalling.hangup(),[3,4];case 4:return[2]}}))}))})),this._client.on("stream-subscribed",(function(e){return i(t,void 0,void 0,(function(){var t,n,i,s,o,u,c;return r(this,(function(r){return t=e.stream,this._remoteStreams.push(t),n=t.getUserId(),this._trtcCalling._delegate.onUserEnter(n),i="_trtc_calling_audio_call-"+n,a.default.log(p+".handleEvents - stream subscribed, _remoteStreams:"+this._remoteStreams),this.getCallType()===l.CALL_TYPE.AUDIO_CALL&&((s=document.getElementById("_trtc_calling_layer"))||((s=document.createElement("div")).setAttribute("id","_trtc_calling_layer"),s.style.display="none",document.body.appendChild(s)),(o=document.createElement("div")).setAttribute("id",i),s.appendChild(o),(u=document.createElement("button")).onclick=function(){a.default.log(p+".remoteStream - resume"),t.resume()},u.setAttribute("class","resume"),u.style.display="none",document.body.appendChild(u),t.play(i),c=setTimeout((function(){u.click(),clearTimeout(c),document.body.removeChild(u)}),0)),[2]}))}))})),this._client.on("stream-removed",(function(e){var n=e.stream,i=n.getId(),r=n.getUserId(),s="_trtc_calling_audio_call-"+r;if(n.stop(),n.close(),t._remoteStreams=t._remoteStreams.filter((function(t){return t.getId()!==i})),t._trtcCalling._delegate.onUserLeave(r),t.getCallType()===l.CALL_TYPE.AUDIO_CALL){var o=document.getElementById("_trtc_calling_layer"),u=document.getElementById(s);o&&u&&o.removeChild(u)}a.default.debug(p+".handleEvents - remote stream-removed, streamID:"+i+" type:"+n.getType())})),this._client.on("stream-updated",(function(t){var e=t.stream,n=e.getType(),i=e.hasAudio(),r=e.hasVideo();a.default.log(p+".handleEvents - stream-updated, type:"+n+" hasAudio:"+i+" hasVideo:"+r)})),this._client.on("mute-audio",(function(e){a.default.debug(p+".handleEvents - "+e.userId+" mute audio"),t._trtcCalling._delegate.onUserAudioAvailable({userID:e.userId,isAudioAvailable:!1})})),this._client.on("unmute-audio",(function(e){a.default.debug(p+".handleEvents - "+e.userId+" unmute audio"),t._trtcCalling._delegate.onUserAudioAvailable({userID:e.userId,isAudioAvailable:!0})})),this._client.on("mute-video",(function(e){a.default.debug(p+".handleEvents - "+e.userId+" mute video"),t._trtcCalling._delegate.onUserVideoAvailable({userID:e.userId,isVideoAvailable:!1})})),this._client.on("unmute-video",(function(e){a.default.debug(p+".handleEvents - "+e.userId+" unmute video"),t._trtcCalling._delegate.onUserVideoAvailable({userID:e.userId,isVideoAvailable:!0})})),this._client.on("connection-state-changed",(function(t){a.default.log(p+".handleEvents - RtcClient state changed from "+t.prevState+" to "+t.state)}))},t.prototype.muteLocalVideo=function(){this._localStream.muteVideo()},t.prototype.unMuteLocalVideo=function(){this._localStream.unmuteVideo()},t.prototype.muteLocalAudio=function(){this._localStream.muteAudio()},t.prototype.unMuteLocalAudio=function(){this._localStream.unmuteAudio()},t.prototype.switchCallMode=function(t){a.default.log(p+".switchCallMode - type",t);var e=this._localStream.getVideoTrack();switch(t){case l.CALL_TYPE.VIDEO_CALL:this.removeTrack(e),this._trtcCalling.setSwitchCallModeStatus(!0);break;case l.CALL_TYPE.AUDIO_CALL:this.addTrack(e),this._trtcCalling.setSwitchCallModeStatus(!0)}},t.prototype.removeTrack=function(t){return i(this,void 0,void 0,(function(){var e;return r(this,(function(n){switch(n.label){case 0:if(a.default.log(p+".removeTrack ",!!t),!t)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._localStream.removeTrack(t)];case 2:return n.sent(),t.stop(),this._trtcCalling.setCallType(l.CALL_TYPE.AUDIO_CALL),[3,4];case 3:return e=n.sent(),a.default.error(p+".removeTrack - failed to removeTrack local stream "+e),this._trtcCalling._delegate.onError(f.default.FAILURE_SWITCH_TO_AUDIO,"switch to audio call error'"),[3,4];case 4:return[2]}}))}))},t.prototype.addTrack=function(t){return i(this,void 0,void 0,(function(){var e,n,i;return r(this,(function(r){switch(r.label){case 0:return a.default.log(p+".addTrack ",!t),t?[3,5]:[4,(e=o.createStream({userId:this._trtcCalling.getUserID(),audio:!1,video:!0})).initialize()];case 1:r.sent(),n=e.getVideoTrack(),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this._localStream.addTrack(n)];case 3:return r.sent(),this._trtcCalling.setCallType(l.CALL_TYPE.VIDEO_CALL),[3,5];case 4:return i=r.sent(),a.default.error(p+".addTrack - failed to addTrack local stream "+i),this._trtcCalling._delegate.onError(f.default.FAILURE_SWITCH_TO_VIDEO,"switch to video call error'"),[3,5];case 5:return[2]}}))}))},t.prototype.reset=function(){return i(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return console.log(p+"._isJoined:"+this._isJoined+",_localStream:"+this._localStream),[4,this.leave()];case 1:return t.sent(),[2]}}))}))},t.prototype.releaseStream=function(t){for(var e=t.getTracks(),n=0;n1)for(var n=1;n=0)return;o[e]="set-cookie"===e?(o[e]?o[e]:[]).concat([n]):o[e]?o[e]+", "+n:n}})),o):o}},function(t,e,n){"use strict";var i=n(2);t.exports=i.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(t){var i=t;return e&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=r(window.location.href),function(e){var n=i.isString(e)?r(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},function(t,e,n){"use strict";var i=n(19);function r(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var n=this;t((function(t){n.reason||(n.reason=new i(t),e(n.reason))}))}r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var t;return{token:new r((function(e){t=e})),cancel:t}},t.exports=r},function(t,e,n){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,n){"use strict";t.exports=function(t){return"object"==typeof t&&!0===t.isAxiosError}},function(t,n){t.exports=e},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]=2||p.data&&p.data.userIDs)){if(!p.room_id||0===p.call_end)return this._trtcCalling._delegate.onCallEnd(i,p.call_end||0),[2]}else if(c.isNumber(p.call_end)&&p.call_end>=0)return this._trtcCalling._delegate.onCallEnd(i,p.call_end),[2];if(!f&&this._isOnACall()&&this.judgeSwitchCallMode(p))return this.handleSwitchCallMode(a,p),[2];if(this._isOnACall()||e===u.CALL_STATUS.CALLING)return this.reject({inviteID:a,callType:p.call_type,isBusy:!0}),this._trtcCalling.setSwitchCallModeStatus(!0),this._trtcCalling._delegate.onLineBusy(i,this._trtcCalling.getUserID()),[2];this._trtcCalling.setInviterID(i),_&&(this._trtcCalling.setIsGroupCall(_),this._trtcCalling.setInviteeList(r),this._trtcCalling.setUnHandledInviteeList(r),this._trtcCalling.setGroupID(f)),this._trtcCalling.changeCallStatus(u.CALL_STATUS.CALLING),this._newInvitationData={sponsor:i,userIDList:r,isFromGroup:_,inviteID:a,inviteData:{version:p.version,callType:p.call_type,callEnd:0,roomID:p.room_id}},s.label=1;case 1:return s.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:p.call_type===u.CALL_TYPE.VIDEO_CALL})];case 2:return g=s.sent(),l.default.log("getUserMedia info",JSON.stringify(g)),this._trtcCalling._trtcClient.releaseStream(g),this._trtcCalling._delegate.onInvited(this._newInvitationData),[3,4];case 3:return I=s.sent(),this._trtcCalling._delegate.onError(d.default.NOT_MEDIA_ACCESS,JSON.stringify(I)),l.default.error("onNewInvitationReceived getUserMedia failure "+JSON.stringify(I)+". reject remote invite"),this._trtcCalling.reject(),[3,4];case 4:return[2]}}))}))},t.prototype.getInviteData=function(){return this._newInvitationData},t.prototype.setInviteData=function(t){this._newInvitationData=t},t.prototype.handleSwitchCallMode=function(t,e){var n={inviteID:t,callType:e.call_type},i={cmd:"switchToVideo"};e.call_type===u.CALL_TYPE.VIDEO_CALL&&(n.switch_to_audio_call="switch_to_audio_call",i.cmd="switchToAudio"),this.accept(n,i),this._trtcCalling.setSwitchCallModeStatus(!1),this._trtcCalling._trtcClient.switchCallMode(this._trtcCalling.getCallType())},t.prototype.judgeSwitchCallMode=function(t){return t.switch_to_audio_call&&"switch_to_audio_call"===t.switch_to_audio_call||t.data&&"switchToAudio"===t.data.cmd||t.data&&"switchToVideo"===t.data.cmd},t.prototype.onInviteeAccepted=function(t){l.default.log(h+".onInviteeAccepted - params:",t);var e=JSON.parse(t.data.data);if(this._trtcCalling.isGroupCall()||!this._isOnACall()||!this.judgeSwitchCallMode(e)||this._trtcCalling.getSwitchCallModeStatus()){this._trtcCalling._delegate.onUserAccept(this._trtcCalling.getUserID()),this._trtcCalling.delInviterInviteID(t.data.inviteID);var n=t.data.invitee;if(this._trtcCalling.isGroupCall()){var i=this._trtcCalling.getUnHandledInviteeList().filter((function(t){return t!==n}));this._trtcCalling.setUnHandledInviteeList(i)}return n===this._trtcCalling.getUserID()&&this._trtcCalling.getCallStatus()===u.CALL_STATUS.CONNECTED?(this._trtcCalling._resetTRTCClient(),void this._trtcCalling._delegate.onReject(this._trtcCalling.getInviterID())):void 0}this._trtcCalling._trtcClient.switchCallMode(this._trtcCalling.getCallType())},t.prototype.onInviteeRejected=function(t){if(!this._trtcCalling.isGroupCall()&&!this._trtcCalling.getSwitchCallModeStatus())return l.default.log(h+".onInviteeRejected - Audio and video switching is not available"),void this._trtcCalling.setSwitchCallModeStatus(!0);l.default.log(h+".onInviteeRejected - params:",t);var e=t.data.invitee,n=t.data.inviter,i=t.data.inviteID,r=JSON.parse(t.data.data);if("line_busy"===r.line_busy||""===r.line_busy||r.data&&r.data.message&&"lineBusy"===r.data.message?this._trtcCalling._delegate.onLineBusy(n,e):this._trtcCalling._delegate.onReject(e),this._trtcCalling.delInviterInviteID(i),this._trtcCalling.isGroupCall()){var s=this._trtcCalling.getUnHandledInviteeList();s=s.filter((function(t){return t!==e})),this._trtcCalling.setUnHandledInviteeList(s),0===s.length&&(this._trtcCalling.getCallStatus()===u.CALL_STATUS.CALLING&&this._trtcCalling._resetTRTCClient(),this._trtcCalling.getCallStatus()===u.CALL_STATUS.CONNECTED&&(this._trtcCalling.hasRemoteConnectedUsers()||(this._trtcCalling._delegate.onCallEnd(e,0),this._trtcCalling._resetTRTCClient())))}else this._trtcCalling._resetTRTCClient()},t.prototype.onInvitationCancelled=function(t){l.default.log(h+".onInvitationCancelled - params:",t),this._trtcCalling._delegate.onCallingCancel(),this._trtcCalling._resetTRTCClient()},t.prototype.onInvitationTimeout=function(t){var e=t.data,n=e.inviter,i=e.inviteeList,r=e.isSelfTimeout,s=this._trtcCalling.getUserID(),o=this._trtcCalling.isGroupCall(),a=n===s,c=this._isOnACall(),d=this._trtcCalling.getRemoteStreamCount();if(l.default.log(h+".onInvitationTimeout - params:",t,"currentUserID:"+s+" isInviter:"+a+" isGroupCall:"+o+" isOnACall:"+c+" remoteStreamCount:"+d),this._trtcCalling.delInviterInviteID(t.data.inviteID),r&&a)return this._trtcCalling._delegate.onNoResp(n,i),void(o&&0!==d||(this._trtcCalling._resetTRTCClient(),this._trtcCalling._delegate.onCallEnd(n,0)));if(this._trtcCalling._delegate.onCallingTimeout(n,i),o){var f=this._trtcCalling.getUnHandledInviteeList(),p=[];f.forEach((function(t){-1===i.indexOf(t)&&p.push(t)})),this._trtcCalling.setUnHandledInviteeList(p),0===d&&0===p.length&&(c?this.lastOneHangup({userIDList:[n],callType:this._trtcCalling.getCallType(),callEnd:0}):(this._trtcCalling._delegate.onCallEnd(n,0),this._trtcCalling.changeCallStatus(u.CALL_STATUS.IDLE)),this._trtcCalling._resetTRTCClient())}else this._trtcCalling._delegate.onCallEnd(n,0),this._trtcCalling._resetTRTCClient(),this._trtcCalling.changeCallStatus(u.CALL_STATUS.IDLE)},t.prototype._isOnACall=function(){return this._trtcCalling.getCallStatus()===u.CALL_STATUS.CONNECTED},t.prototype.onKickedOut=function(){l.default.debug(h+".onKickedOut"),this._trtcCalling._delegate.onKickedOut(),this._trtcCalling.changeCallStatus(u.CALL_STATUS.IDLE)},t.prototype.onNetStateChange=function(){l.default.debug(h+".onNetStateChange")},t.prototype.login=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,this._tsignaling.login(t)]}))}))},t.prototype.logout=function(){return r(this,void 0,void 0,(function(){return s(this,(function(t){return this._joined=!1,[2,this._tsignaling.logout()]}))}))},t.prototype.invite=function(t){return r(this,void 0,void 0,(function(){var e,n,i,r,o,a,l;return s(this,(function(s){switch(s.label){case 0:return e=t.userID,n=t.type,i=t.roomID,r=t.timeout,o=t.offlinePushInfo,a=t.userIDList,[4,this._tsignaling.invite({userID:e,data:JSON.stringify(this.handleNewSignaling({version:0,call_type:n,room_id:i},{userIDs:a})),timeout:r,offlinePushInfo:o})];case 1:return l=s.sent(),this._trtcCalling.isGroupCall()||!this._trtcCalling.isInviter()||this._joined||this._trtcCalling.getCallStatus()!==u.CALL_STATUS.CALLING?[3,3]:[4,this._trtcCalling._trtcClient.join(this._trtcCalling._roomID)];case 2:s.sent(),this._trtcCalling.changeCallStatus(u.CALL_STATUS.CONNECTED),this._joined=!0,s.label=3;case 3:return[2,l]}}))}))},t.prototype.inviteInGroup=function(t){return r(this,void 0,void 0,(function(){var e,n,i,r,o,a,l;return s(this,(function(s){switch(s.label){case 0:return e=t.groupID,n=t.userIDList,i=t.roomID,r=t.type,o=t.timeout,a=t.offlinePushInfo,l=null,e?[3,2]:[4,this.inviteInGroupTRTC(t)];case 1:return l=s.sent(),[3,4];case 2:return[4,this._tsignaling.inviteInGroup({groupID:e,inviteeList:n,data:JSON.stringify(this.handleNewSignaling({version:0,call_type:r,room_id:i})),timeout:o,offlinePushInfo:a})];case 3:l=s.sent(),s.label=4;case 4:return!this._trtcCalling.isInviter()||this._joined||this._trtcCalling.getCallStatus()!==u.CALL_STATUS.CALLING?[3,6]:[4,this._trtcCalling._trtcClient.join(this._trtcCalling._roomID)];case 5:s.sent(),this._trtcCalling.changeCallStatus(u.CALL_STATUS.CONNECTED),this._joined=!0,s.label=6;case 6:return[2,l]}}))}))},t.prototype.inviteInGroupTRTC=function(t){return r(this,void 0,void 0,(function(){var e,n,i,r,o,a,l,u,c,d=this;return s(this,(function(s){switch(s.label){case 0:e=t.userIDList,n=t.roomID,i=t.type,r=t.timeout,o=t.offlinePushInfo,a={code:0,data:[]},s.label=1;case 1:return s.trys.push([1,3,,4]),l=e.map((function(t){return d.invite({userID:t,type:i,roomID:n,timeout:r,offlinePushInfo:o,userIDList:e})})),[4,Promise.all(l)];case 2:return u=s.sent(),a.data=u,[3,4];case 3:return c=s.sent(),a.code=1,a.error=c,[3,4];case 4:return[2,a]}}))}))},t.prototype.lastOneHangup=function(t){return r(this,void 0,void 0,(function(){var e,n,i;return s(this,(function(r){switch(r.label){case 0:return l.default.log(h+".lastOneHangup - params:",t),e=t.userIDList,n=t.callType,i=t.callEnd,this._trtcCalling.isGroupCall()&&this._trtcCalling.getGroupID()?[4,this._tsignaling.inviteInGroup({inviteeList:e,groupID:this._trtcCalling.getGroupID(),data:JSON.stringify(this.handleNewSignaling({version:0,call_type:n,call_end:i},{cmd:"hangup"})),timeout:0})]:[3,2];case 1:return r.sent(),[3,4];case 2:return[4,this._tsignaling.invite({userID:e[0],data:JSON.stringify(this.handleNewSignaling({version:0,call_type:n,call_end:i},{cmd:"hangup"})),timeout:0})];case 3:r.sent(),r.label=4;case 4:return this._joined=!1,this._trtcCalling._delegate.onCallEnd(this._trtcCalling.getInviterID(),i),[2]}}))}))},t.prototype.accept=function(t,e){return r(this,void 0,void 0,(function(){var n,r,a;return s(this,(function(s){switch(s.label){case 0:return n=t.inviteID,r=t.callType,a=o(t,["inviteID","callType"]),[4,this._tsignaling.accept({inviteID:n,data:JSON.stringify(this.handleNewSignaling(i({version:0,call_type:r},a),e))})];case 1:return[2,s.sent()]}}))}))},t.prototype.reject=function(t){return r(this,void 0,void 0,(function(){var e,n,i,r;return s(this,(function(s){return e=t.inviteID,n=t.callType,i=t.isBusy,r={version:0,call_type:n},i&&(r.line_busy="line_busy"),[2,this._tsignaling.reject({inviteID:e,data:JSON.stringify(this.handleNewSignaling(r,{message:i?"lineBusy":""}))})]}))}))},t.prototype.cancel=function(t){return r(this,void 0,void 0,(function(){var e;return s(this,(function(n){return e=t.inviteID,[2,this._tsignaling.cancel({inviteID:e,data:JSON.stringify(this.handleNewSignaling({version:4,businessID:"av_call",call_type:this._trtcCalling.getCallType()}))})]}))}))},t.prototype.resetJoined=function(){this._joined=!1},t.prototype.switchCallMode=function(t){return r(this,void 0,void 0,(function(){var e,n,i,r,o,a,l;return s(this,(function(s){return e=t.userID,n=t.call_type,i=t.roomID,r=t.timeout,o=t.mode,a={version:0,call_type:n,room_id:i},l={cmd:"switchToVideo"},o===u.MODE_TYPE.AUDIO&&(a.switch_to_audio_call="switch_to_audio_call",l.cmd="switchToAudio"),[2,this._tsignaling.invite({userID:e,data:JSON.stringify(this.handleNewSignaling(a,l)),timeout:r})]}))}))},t.prototype.handleNewSignaling=function(t,e){return i(i({extraInfo:""},t),{version:4,businessID:"av_call",platform:"Web",data:i({cmd:u.CMD_TYPE_LIST[t.call_type],room_id:t.room_id,message:""},e)})},t}();e.default=f},function(t,e){t.exports=n},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(20),r=n(1),s=n(6),o=n(8),a=n(9),l="TRTCCallingDelegate",u=function(){function t(t){this._eventEmitter=t,this._eventStatController=new a.default,s.default.bindController(this._eventStatController)}return t.prototype._setInterfaceUpLoad=function(t){return r.default.time(t),new s.default(t)},t.prototype.onError=function(t,e){r.default.debug(l+".onError code:"+t+" msg:"+e),this._eventEmitter.emit(i.EVENT.ERROR,{code:t,msg:e}),this._setInterfaceUpLoad(o.default.ERROR).setText("").setEnd()},t.prototype.onSdkReady=function(t){r.default.debug(l+".onSdkReady params:"+t),this._eventEmitter.emit(i.EVENT.SDK_READY,t),this._setInterfaceUpLoad(o.default.SDK_READY).setText("").setEnd()},t.prototype.onInvited=function(t){r.default.debug(l+".onInvited params:",t);var e=t.sponsor,n=t.userIDList,s=t.isFromGroup,a=t.inviteData,u=t.inviteID;this._eventEmitter.emit(i.EVENT.INVITED,{sponsor:e,userIDList:n,isFromGroup:s,inviteData:a,inviteID:u}),this._setInterfaceUpLoad(o.default.INVITED).setText("EVENT.INVITED emitted").setEnd()},t.prototype.onUserAccept=function(t){r.default.debug(l+".onUserAccept userID:"+t),this._eventEmitter.emit(i.EVENT.USER_ACCEPT,{userID:t})},t.prototype.onUserEnter=function(t){r.default.debug(l+".onUserEnter userID:"+t),this._eventEmitter.emit(i.EVENT.USER_ENTER,{userID:t}),this._setInterfaceUpLoad(o.default.USER_ENTER).setText("EVENT.USER_ENTER emitted").setEnd()},t.prototype.onUserLeave=function(t){r.default.debug(l+".onUserLeave userID:"+t),this._eventEmitter.emit(i.EVENT.USER_LEAVE,{userID:t}),this._setInterfaceUpLoad(o.default.USER_LEAVE).setText("EVENT.USER_LEAVE emitted").setEnd()},t.prototype.onReject=function(t){r.default.debug(l+".onReject userID:"+t),this._eventEmitter.emit(i.EVENT.REJECT,{userID:t}),this._setInterfaceUpLoad(o.default.REJECT).setText("EVENT.REJECT emitted").setEnd()},t.prototype.onNoResp=function(t,e){r.default.debug(l+".onNoResp userIDList:",e),this._eventEmitter.emit(i.EVENT.NO_RESP,{sponsor:t,userIDList:e}),this._setInterfaceUpLoad(o.default.NO_RESP).setText("EVENT.NO_RESP emitted").setEnd()},t.prototype.onLineBusy=function(t,e){r.default.debug(l+".onLineBusy sponsor:"+t+" userID:"+e),this._eventEmitter.emit(i.EVENT.LINE_BUSY,{sponsor:t,userID:e}),this._setInterfaceUpLoad(o.default.LINE_BUSY).setText("EVENT.LINE_BUSY emitted").setEnd()},t.prototype.onCallingCancel=function(){r.default.debug(l+".onCallingCancel"),this._eventEmitter.emit(i.EVENT.CALLING_CANCEL,{}),this._setInterfaceUpLoad(o.default.CALLING_CANCEL).setText("EVENT.CALLING_CANCEL emitted").setEnd()},t.prototype.onKickedOut=function(){r.default.debug(l+".onKickedOut"),this._eventEmitter.emit(i.EVENT.KICKED_OUT,{}),this._setInterfaceUpLoad(o.default.KICKED_OUT).setText("EVENT.KICKED_OUT emitted").setEnd()},t.prototype.onCallingTimeout=function(t,e){r.default.debug(l+".onCallingTimeout userIDList:",e),this._eventEmitter.emit(i.EVENT.CALLING_TIMEOUT,{sponsor:t,userIDList:e}),this._setInterfaceUpLoad(o.default.CALLING_TIMEOUT).setText("EVENT.CALLING_TIMEOUT emitted").setEnd()},t.prototype.onCallEnd=function(t,e){r.default.debug(l+".onCallEnd userID:"+t+" callEnd:"+e),this._eventEmitter.emit(i.EVENT.CALLING_END,{userID:t,callEnd:e}),this._setInterfaceUpLoad(o.default.CALLING_END).setText("EVENT.CALLING_END emitted").setEnd()},t.prototype.onUserVideoAvailable=function(t){r.default.debug(l+".onUserVideoAvailable params:",t);var e=t.userID,n=t.isVideoAvailable;this._eventEmitter.emit(i.EVENT.USER_VIDEO_AVAILABLE,{userID:e,isVideoAvailable:n});var s="EVENT.USER_VIDEO_AVAILABLE emitted, userID: "+e+", video: "+n;this._setInterfaceUpLoad(o.default.USER_VIDEO_AVAILABLE).setText(s).setEnd()},t.prototype.onUserAudioAvailable=function(t){r.default.debug(l+".onUserAudioAvailable params:",t);var e=t.userID,n=t.isAudioAvailable;this._eventEmitter.emit(i.EVENT.USER_AUDIO_AVAILABLE,{userID:e,isAudioAvailable:n});var s="EVENT.USER_AUDIO_AVAILABLE emitted, userID: "+e+", mic: "+n;this._setInterfaceUpLoad(o.default.USER_AUDIO_AVAILABLE).setText(s).setEnd()},t.prototype.onUserVoiceVolume=function(t){this._eventEmitter.emit(i.EVENT.USER_VOICE_VOLUME,{volumeMap:t}),this._setInterfaceUpLoad(o.default.USER_VOICE_VOLUME).setText("EVENT.USER_VOICE_VOLUME emitted").setEnd()},t.prototype.onGroupCallInviteeListUpdate=function(t){this._eventEmitter.emit(i.EVENT.GROUP_CALL_INVITEE_LIST_UPDATE,{userIDList:t}),this._setInterfaceUpLoad(o.default.GROUP_CALL_INVITEE_LIST_UPDATE).setText("EVENT.GROUP_CALL_INVITEE_LIST_UPDATE emitted").setEnd()},t}();e.default=u},function(t,e,n){"use strict";n.r(e);var i=n(1);const r="none",s="online",o=function(){let t=window.location.protocol;return["http:","https:"].indexOf(t)<0&&(t="http:"),t};e.default=class{constructor(){this._networkType="",this.maxWaitTime=3e3}start(){this._networkType=s}_onNetworkStatusChange(t){this._networkType=t.networkType,t.isConnected?i.default.info("NetMonitor networkType:"+t.networkType):i.default.warn("NetMonitor no network, please check!")}probe(){return new Promise(t=>{if(window&&window.fetch)fetch(`${o()}//webim-1252463788.file.myqcloud.com/assets/test/speed.xml?random=${Math.random()}`).then(e=>{e.ok?t([!0,s]):t([!1,r])}).catch(()=>{t([!1,r])});else{const e=new XMLHttpRequest,n=setTimeout(()=>{i.default.warn("NetMonitor fetch timeout. Probably no network, please check!"),e.abort(),this._networkType=r,t([!1,r])},this.maxWaitTime);e.onreadystatechange=function(){4===e.readyState&&(clearTimeout(n),200===e.status||304===e.status?(this._networkType=s,t([!0,s])):(i.default.warn(`NetMonitor fetch status:${e.status}. Probably no network, please check!`),this._networkType=r,t([!1,r])))},e.open("GET",`${o()}//webim-1252463788.file.myqcloud.com/assets/test/speed.xml?random=${Math.random()}`),e.send()}})}getNetworkType(){return this._networkType}reset(){this._networkType=""}}},function(t,e,n){"use strict";n.r(e),n.d(e,"isFunction",(function(){return i})),n.d(e,"isUndefined",(function(){return r})),n.d(e,"isString",(function(){return s})),n.d(e,"isNumber",(function(){return o})),n.d(e,"isBoolean",(function(){return a})),n.d(e,"isPlainObject",(function(){return l}));const i=t=>"function"==typeof t,r=t=>void 0===t,s=t=>"string"==typeof t,o=t=>"number"==typeof t,a=t=>"boolean"==typeof t,l=function(t){if(!t||"object"!=typeof t||"[object Object]"!=Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var n=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)}},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var s=n(4),o=function(t){function e(e){var n=e.message,i=e.code,r=void 0===i?s.default.UNKNOWN:i,o=t.call(this,n+" <"+function(t){for(var e in s.default)if(s.default[e]===t)return e;return"UNKNOWN"}(r)+" "+r+">")||this;return o.code_=r,o.name="TRTCCallingError",o.message_=n,o}return r(e,t),e.prototype.getCode=function(){return this.code_},e}(Error);e.default=o}]).default}));