trtc-cloud-js-sdk 2.4.1 → 2.4.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-cloud-js-sdk",
3
- "version": "2.4.1",
3
+ "version": "2.4.2-beta.2",
4
4
  "description": "Tencent Cloud RTC SDK for Web And Electron",
5
5
  "main": "trtc-cloud-js-sdk.js",
6
6
  "keywords": [
@@ -17,6 +17,6 @@
17
17
  "author": "Tencent Cloud Client R&D Center",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "trtc-sdk-v5": "5.5.2"
20
+ "trtc-sdk-v5": "5.6.0-beta.8"
21
21
  }
22
22
  }
@@ -1 +1 @@
1
- var global,factory;global=this,factory=function(e,t,o){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(t),n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},n(e,t)},a=function(){return a=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function s(e,t,o,i){return new(o||(o=Promise))((function(r,n){function a(e){try{c(i.next(e))}catch(t){n(t)}}function s(e){try{c(i.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function c(e,t){var o,i,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(s){return function(c){return function(s){if(o)throw new TypeError("Generator is already executing.");for(;n&&(n=0,s[0]&&(a=0)),a;)try{if(o=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 a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(c){s=[6,c],i=0}finally{o=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function u(e,t,o){if(o||2===arguments.length)for(var i,r=0,n=t.length;r<n;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var l,d,T,h,p,f,R,v,_=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=Object.prototype.hasOwnProperty,o="~";function i(){}function r(e,t,o){this.fn=e,this.context=t,this.once=o||!1}function n(e,t,i,n,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new r(i,n||e,a),c=o?o+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(o=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(o?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=o?o+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,n=i.length,a=new Array(n);r<n;r++)a[r]=i[r].fn;return a},s.prototype.listenerCount=function(e){var t=o?o+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,r,n,a){var s=o?o+e:e;if(!this._events[s])return!1;var c,u,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,r),!0;case 5:return l.fn.call(l.context,t,i,r,n),!0;case 6:return l.fn.call(l.context,t,i,r,n,a),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var T,h=l.length;for(u=0;u<h;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,i);break;case 4:l[u].fn.call(l[u].context,t,i,r);break;default:if(!c)for(T=1,c=new Array(d-1);T<d;T++)c[T-1]=arguments[T];l[u].fn.apply(l[u].context,c)}}return!0},s.prototype.on=function(e,t,o){return n(this,e,t,o,!1)},s.prototype.once=function(e,t,o){return n(this,e,t,o,!0)},s.prototype.removeListener=function(e,t,i,r){var n=o?o+e:e;if(!this._events[n])return this;if(!t)return a(this,n),this;var s=this._events[n];if(s.fn)s.fn!==t||r&&!s.once||i&&s.context!==i||a(this,n);else{for(var c=0,u=[],l=s.length;c<l;c++)(s[c].fn!==t||r&&!s[c].once||i&&s[c].context!==i)&&u.push(s[c]);u.length?this._events[n]=1===u.length?u[0]:u:a(this,n)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=o?o+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=o,s.EventEmitter=s,e.exports=s}));e.TRTCVideoResolution=void 0,(l=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[l.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",l[l.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",l[l.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",l[l.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",l[l.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",l[l.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",l[l.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",l[l.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",l[l.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",l[l.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",l[l.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",l[l.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",l[l.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",l[l.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",l[l.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",l[l.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",l[l.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",l[l.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",l[l.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",l[l.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(d=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[d.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",d[d.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",d[d.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(T=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[T.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",T[T.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(h=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[h.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",h[h.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",h[h.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(p=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[p.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",p[p.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(f=e.TRTCAppScene||(e.TRTCAppScene={}))[f.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",f[f.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",f[f.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",f[f.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(R=e.TRTCRoleType||(e.TRTCRoleType={}))[R.TRTCRoleAnchor=20]="TRTCRoleAnchor",R[R.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(v=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[v.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",v[v.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",v[v.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic";var C,g,m=function(e,t,o,i,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===o&&(o=""),void 0===i&&(i=""),void 0===r&&(r=""),this.deviceId=e,this.deviceName=t,this.kind=o,this.label=i,this.groupId=r};e.TRTCDeviceState=void 0,(C=e.TRTCDeviceState||(e.TRTCDeviceState={}))[C.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",C[C.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",C[C.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(g=e.TRTCDeviceType||(e.TRTCDeviceType={}))[g.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",g[g.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",g[g.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",g[g.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var y,S=function(t,o,i,r,n,a,s,c,u,l,d){void 0===t&&(t=0),void 0===o&&(o=""),void 0===i&&(i=""),void 0===r&&(r=0),void 0===n&&(n=""),void 0===a&&(a=e.TRTCRoleType.TRTCRoleAnchor),void 0===s&&(s=null),void 0===u&&(u=null),void 0===l&&(l=null),void 0===d&&(d=30),this.sdkAppId=t,this.userId=o,this.userSig=i,this.roomId=r,this.strRoomId=n,this.role=a,this.privateMapKey=s,this.streamId=u,this.userDefineRecordId=l,this.frameWorkType=d},V=function(t,o,i,r){void 0===t&&(t=e.TRTCVideoResolution.TRTCVideoResolution_640_360),void 0===o&&(o=e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape),void 0===i&&(i=15),void 0===r&&(r=550),this.videoResolution=t,this.resMode=o,this.videoFps=i,this.videoBitrate=r};e.TRTCVideoRotation=void 0,(y=e.TRTCVideoRotation||(e.TRTCVideoRotation={}))[y.TRTCVideoRotation0=0]="TRTCVideoRotation0",y[y.TRTCVideoRotation90=1]="TRTCVideoRotation90",y[y.TRTCVideoRotation180=2]="TRTCVideoRotation180",y[y.TRTCVideoRotation270=3]="TRTCVideoRotation270";var b,w=function(t,o,i){void 0===t&&(t=e.TRTCVideoRotation.TRTCVideoRotation0),void 0===o&&(o=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit),void 0===i&&(i=e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),this.rotation=t,this.fillMode=o,this.mirrorType=i};e.TRTCQuality=void 0,(b=e.TRTCQuality||(e.TRTCQuality={}))[b.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",b[b.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",b[b.TRTCQuality_Good=2]="TRTCQuality_Good",b[b.TRTCQuality_Poor=3]="TRTCQuality_Poor",b[b.TRTCQuality_Bad=4]="TRTCQuality_Bad",b[b.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",b[b.TRTCQuality_Down=6]="TRTCQuality_Down";var A,M,L,E=function(t,o){void 0===t&&(t=""),void 0===o&&(o=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=o},P=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},I=function(e,t,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=null),this.appId=e,this.bizId=t,this.url=o},D=function(t,o,i,r,n,a,s){void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===a&&(a=0),void 0===s&&(s=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.width=t,this.height=o,this.frameRate=i,this.videoBitrate=r,this.audioBitrate=a,this.streamType=s},O=function(t,o,i,r,n,a,s,c,u,l,d,T,h,p){void 0===t&&(t=""),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===c&&(c=0),void 0===p&&(p=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.userId=t,this.width=i,this.height=r,this.frameRate=n,this.videoBitrate=a,this.audioBitrate=c,this.streamType=p},k=function(e,t,o,i,r,n,a,s,c,u,l){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=[]),void 0===c&&(c=0),void 0===u&&(u=[]),void 0===l&&(l=0),this.upLoss=e,this.downLoss=t,this.rtt=r,this.receivedBytes=n,this.sentBytes=a,this.localStatisticsArray=s,this.localStatisticsArraySize=c,this.remoteStatisticsArray=u,this.remoteStatisticsArraySize=l};e.TRTCVideoResolutionMode=void 0,(A=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[A.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",A[A.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(M=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[M.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",M[M.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(L=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[L.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",L[L.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var Q,F,B=function(t,o){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===o&&(o=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=o},N=function(e,t,o,i){void 0===e&&(e=new ArrayBuffer(0)),void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),this.buffer=e,this.length=t,this.width=o,this.height=i};e.TRTCLogLevel=void 0,(Q=e.TRTCLogLevel||(e.TRTCLogLevel={}))[Q.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",Q[Q.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",Q[Q.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",Q[Q.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",Q[Q.TRTCLogLevelError=4]="TRTCLogLevelError",Q[Q.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",Q[Q.TRTCLogLevelNone=6]="TRTCLogLevelNone",e.TRTCScreenCaptureSourceType=void 0,(F=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[F.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",F[F.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",F[F.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",F[F.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var x,U=function(t,o,i,r,n,a){void 0===t&&(t=e.TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown),void 0===o&&(o=""),void 0===i&&(i=""),void 0===r&&(r=new N),void 0===n&&(n=new N),void 0===a&&(a=!1),this.type=t,this.sourceId=o,this.sourceName=i,this.thumbBGRA=r,this.iconBGRA=n,this.isMinimizeWindow=a},j=function(e,t,o,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),this.left=e,this.top=t,this.right=o,this.bottom=i},W=function(t,o,i,r,n,a,s,c,u,l,d,T,h,p,f){void 0===t&&(t=e.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown),void 0===o&&(o=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=15),void 0===c&&(c=2),void 0===u&&(u=0),void 0===l&&(l=""),void 0===d&&(d=64),void 0===T&&(T=48e3),void 0===h&&(h=1),void 0===p&&(p=[]),void 0===f&&(f=""),this.mode=t,this.appId=o,this.bizId=i,this.videoWidth=r,this.videoHeight=n,this.videoBitrate=a,this.videoFramerate=s,this.videoGOP=c,this.backgroundColor=u,this.backgroundImage=l,this.audioSampleRate=d,this.audioBitrate=T,this.audioChannels=h,this.mixUsersArray=p,this.mixUsersArraySize=p.length,this.streamId=f};e.TRTCTranscodingConfigMode=void 0,(x=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[x.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",x[x.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",x[x.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",x[x.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",x[x.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",x[x.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",x[x.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",x[x.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",x[x.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",x[x.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var G,Y=function(t,o,i,r,n,a,s,c){void 0===t&&(t=""),void 0===o&&(o=""),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=!1),void 0===a&&(a=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),void 0===s&&(s=e.TRTCMixInputType.TRTCMixInputTypeUndefined),void 0===c&&(c=0),this.userId=t,this.roomId=o,this.rect=i,this.zOrder=r,this.pureAudio=n,this.streamType=a,this.inputType=s,this.renderMode=c};e.TRTCMixInputType=void 0,(G=e.TRTCMixInputType||(e.TRTCMixInputType={}))[G.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",G[G.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",G[G.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",G[G.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio";var q,K="onError",J="onWarning",z="rtc",H="live",X="VirtualBackground",Z="blur",$="image",ee={20:"anchor",21:"audience"},te={0:z,1:H,2:z,3:H};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(q||(q={}));var oe="enum";function ie(){return Math.floor(performance.now())}var re,ne,ae,se=function(e){return void 0===e},ce=function(e){return"number"==typeof e},ue=function(e){return"boolean"==typeof e};!function(e){e.LIVE="live",e.RTC="rtc"}(re||(re={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(ne||(ne={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(ae||(ae={}));var le={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},de={code:-1005,message:"not supported"},Te="2.4.1",he=function(){function e(e,t){if(this.logRegion="tc",this.loggerManager=e,t){var o=t.sdkAppId,i=t.userId,r=t.seq;this.seq=r,e&&(this.logger=e.createLogger({id:"".concat(this.logRegion).concat(r),userId:i,sdkAppId:o}))}else this.logger=e;this.logger||(this.logger={debug:function(e){console.debug(e)},info:function(e){console.info(e)},warn:function(e){console.warn(e)},error:function(e){console.error(e)}})}return e.prototype.getLogMessage=function(e){var t=this;return e.map((function(e){return t.getStringifyMessage(e)})).join(" ")},e.prototype.getStringifyMessage=function(e){var t=this;if("object"!=typeof e)return e;if(e instanceof HTMLElement)return"".concat(e.tagName.toLocaleLowerCase(),"#").concat(e.id);if(e instanceof Array){var o=[];return Object.keys(e).forEach((function(i){return o[i]=t.getStringifyMessage(e[i])})),JSON.stringify(o)}if(e instanceof Object){var i={};return Object.keys(e).forEach((function(o){return i[o]=t.getStringifyMessage(e[o])})),JSON.stringify(i)}return e},e.prototype.update=function(e){var t=e.userId,o=e.sdkAppId;this.loggerManager&&this.loggerManager.createLogger&&(this.logger=this.loggerManager.createLogger({id:"".concat(this.logRegion).concat(this.seq),userId:t,sdkAppId:o}))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger.debug(o)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger&&this.logger.info&&this.logger.info(o)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger&&this.logger.warn&&this.logger.warn(o)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger&&this.logger.error&&this.logger.error(o)},e}(),pe=null,fe=r.default._loggerManager;fe.info("TRTCCloud Version: ".concat(Te));var Re="trtcCloud",ve=1,_e=function(t){function i(o){void 0===o&&(o={});var i=t.call(this)||this;i._version="",i._frameWorkType=30,i._component=0,i._language=0,i._networkProxy={},i._localView=null,i._autoRecvAudio=!0,i._autoRecvVideo=!0,i._localTestView=null,i._isVideoPublish=!0,i._localRenderParams={rotation:e.TRTCVideoRotation.TRTCVideoRotation0,fillMode:e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,mirrorType:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto},i._videoProfile={},i._videoPlayOption={},i._isAudioPublish=!0,i._audioProfile=r.default.TYPE.AUDIO_PROFILE_STANDARD,i._isSharingScreen=!1,i._remoteStreamConfig=new Map,i._remoteStreamMap=new Map,i._cameraList=[],i._microphoneList=[],i._speakerList=[],i._currentCamera={},i._currentMicrophone={},i._currentSpeaker={},i._currentCameraId="",i._currentMicrophoneId="",i._currentSpeakerId="",i._screenShareParams={option:{}},i._isMobile=!1,i._isFrontCamera=!1,i._smallStreamVideoProfile=void 0,i._qosPreference=void 0,i._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},i._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},i._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},i._isVirtualBackground=!1,i._version=Te;var n,a,s,c=o.frameWorkType,u=void 0===c?30:c,l=o.component,d=void 0===l?0:l,T=o.language,h=void 0===T?0:T;return i._frameWorkType=u,i._component=d,i._language=h,i._trtc=r.default.create(),i._testTrtc=r.default.create(),i._log=r.default._loggerManager,i.logger=new he(fe,{seq:ve++}),i._echoCancellation=void 0,i._noiseSuppression=void 0,i._autoGainControl=void 0,i._addTRTCEvents(),i.handleDeviceChange=i.handleDeviceChange.bind(i),navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(n=i.handleDeviceChange,a=30,function(){for(var e=this,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];s>0&&clearTimeout(s),s=window.setTimeout((function(){n.apply(e,t),s=-1}),a)})),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}(i,t),i.getTRTCShareInstance=function(e){return pe||(pe=new i(e)),pe},i.setLogLevel=function(t,o){var i,n=((i={})[e.TRTCLogLevel.TRTCLogLevelVerbose]=0,i[e.TRTCLogLevel.TRTCLogLevelDebug]=1,i[e.TRTCLogLevel.TRTCLogLevelInfo]=2,i[e.TRTCLogLevel.TRTCLogLevelWarn]=3,i[e.TRTCLogLevel.TRTCLogLevelError]=4,i[e.TRTCLogLevel.TRTCLogLevelFatal]=4,i[e.TRTCLogLevel.TRTCLogLevelNone]=5,i),a=n[t];se(a)&&(a=n[e.TRTCLogLevel.TRTCLogLevelInfo]);var s=!ue(o)||o;r.default.setLogLevel(a,s)},i.prototype.destroyTRTCShareInstance=function(){pe&&(this._removeTRTCEvents(),pe._destroy(),pe=null)},i.prototype.getSDKVersion=function(){return this._version||""},i.prototype.enterRoom=function(e,t){return s(this,void 0,Promise,(function(){var o,i,r,n,s,u,l,d,T,h,p,f,R,v,_,C;return c(this,(function(c){switch(c.label){case 0:if(o=e.sdkAppId,i=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,u=e.role,l=e.privateMapKey,d=e.businessInfo,T=e.enableAutoPlayDialog,h=e.proxy,p=e.streamId,f=e.userDefineRecordId,this.logger.update({sdkAppId:o,userId:i}),this.logger.info("".concat(Re,".enterRoom with params: "),e,t),h&&(this._networkProxy=h),!(o&&i&&r))return[3,5];c.label=1;case 1:return c.trys.push([1,3,,4]),R={sdkAppId:o,userId:i,userSig:r,roomId:n,strRoomId:s,role:ee[u],scene:te[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},R=l?a(a({},R),{privateMapKey:l}):R,R=d?a(a({},R),{businessInfo:d}):R,R=T?a(a({},R),{enableAutoPlayDialog:T}):R,R=this._networkProxy?a(a({},R),{proxy:this._networkProxy}):R,R=p?a(a({},R),{streamId:p}):R,R=f?a(a({},R),{userDefineRecordId:f}):R,v=ie(),[4,this._trtc.enterRoom(R)];case 2:return c.sent(),_=ie()-v,this.emit("onEnterRoom",_),[3,4];case 3:return C=c.sent(),this.emit("onEnterRoom",-1),this._callFunctionErrorManage(C,"enterRoom"),[3,4];case 4:return[3,6];case 5:this._emitError(le),c.label=6;case 6:return[2]}}))}))},i.prototype.exitRoom=function(){return s(this,void 0,Promise,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),this.logger.info("".concat(Re,".exitRoom")),this._isSharingScreen?[4,this.stopScreenShare()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.resetTRTCCloud(),[4,this._trtc.exitRoom()];case 3:return t.sent(),this.emit("onExitRoom",ae.exitRoom),[3,5];case 4:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,5];case 5:return[2]}}))}))},i.prototype.switchRole=function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Re,".switchRole with param: "),e),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.switchRole(ee[e])];case 2:return o.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(ee[e])),[3,4];case 3:return t=o.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),[3,4];case 4:return[2]}}))}))},i.prototype.setDefaultStreamRecvMode=function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(o){return this.logger.info("".concat(Re,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),ue(e)&&(this._autoRecvAudio=e),ue(t)&&(this._autoRecvVideo=t),[2]}))}))},i.prototype.resetTRTCCloud=function(){this._setIsAudioPublish(!0),this._echoCancellation=void 0,this._noiseSuppression=void 0,this._autoGainControl=void 0,this._isVirtualBackground=!1},i.prototype._updateLocalVideo=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===r.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},i.prototype._updateLocalTestVideo=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===r.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},i.prototype._updateLocalScreen=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===r.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},i.prototype._updateRemoteVideo=function(e,t){return s(this,void 0,void 0,(function(){var o;return c(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(e,t))];case 1:return i.sent(),[3,3];case 2:if((o=i.sent()).code===r.default.ERROR_CODE.OPERATION_ABORT)return[2];throw o;case 3:return[2]}}))}))},i.prototype.startLocalPreview=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return s(this,void 0,Promise,(function(){var o,i,n,a,s,l,d,T;return c(this,(function(c){switch(c.label){case 0:this.logger.info("".concat(Re,".startLocalPreview with params: "),t),1===u([],t,!0).length?i=u([],t,!0)[0]:2===u([],t,!0).length&&(T=u([],t,!0),o=T[0],i=T[1]),se(o)||(this._setIsMobile(!0),this._setIsFrontCamera(o)),this._setLocalView(i),c.label=1;case 1:c.trys.push([1,8,,9]),c.label=2;case 2:return c.trys.push([2,4,,7]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return c.sent(),[3,7];case 4:return(n=c.sent()).code!==r.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return c.sent(),[2];case 6:throw n;case 7:return this.emit("onCameraDidReady"),a=this._getVideoProfile(),s=a.width,l=a.height,this.emit("onFirstVideoFrame","",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,s,l),[3,9];case 8:return d=c.sent(),this._callFunctionErrorManage(d,"startLocalPreview"),[3,9];case 9:return[2]}}))}))},i.prototype.updateLocalView=function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Re,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},i.prototype.stopLocalPreview=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Re,".stopLocalPreview")),t.label=1;case 1:return t.trys.push([1,3,,4]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.warn("".concat(Re," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},i.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,(function(){var t;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Re,".muteLocalVideo with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return o.sent(),[3,4];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),[3,4];case 4:return[2]}}))}))},i.prototype.startRemoteView=function(t,o,i){return s(this,void 0,void 0,(function(){var n,a;return c(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(Re,".startRemoteView with params: "),t,o,i),s.label=1;case 1:if(s.trys.push([1,8,,9]),this._setRemoteStreamConfig(t,i,{view:o,small:i===e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(i))))return[2];s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,i))];case 3:return s.sent(),[3,7];case 4:return(n=s.sent()).code!==r.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateRemoteVideo(t,i)];case 5:return s.sent(),[2];case 6:throw n;case 7:return this.emit("onFirstVideoFrame",t,i,0,0),[3,9];case 8:return a=s.sent(),this._callFunctionErrorManage(a,"startRemoteView"),[3,9];case 9:return[2]}}))}))},i.prototype.updateRemoteView=function(e,t,o){return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return this.logger.info("".concat(Re,".updateRemoteView with params: "),e,t,o),this._setRemoteStreamConfig(e,o,{view:t}),this._remoteStreamMap.get("".concat(e,"_").concat(this._getTRTCStreamType(o)))?[4,this._updateRemoteVideo(e,o)]:[2];case 1:return i.sent(),[2]}}))}))},i.prototype.stopRemoteView=function(e,t){return s(this,void 0,void 0,(function(){var o;return c(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Re,".stopRemoteView with params: "),e,t),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"stopRemoteView"),[3,4];case 4:return[2]}}))}))},i.prototype.stopAllRemoteView=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Re,".stopAllRemoteView")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),[3,4];case 4:return[2]}}))}))},i.prototype.setVideoEncoderParam=function(e){return s(this,void 0,void 0,(function(){var t,o;return c(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Re,".setVideoEncoderParam with params: "),e),i.label=1;case 1:return i.trys.push([1,4,,5]),t=this._getTRTCVideoProfile("video",e),this._setVideoProfile(t),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return o=i.sent(),this._callFunctionErrorManage(o,"setVideoEncoderParam"),[3,5];case 5:return[2]}}))}))},i.prototype.setNetworkQosParam=function(e){return s(this,void 0,void 0,(function(){var t,o,i=this;return c(this,(function(r){return this.logger.info("".concat(Re,".setNetworkQosParam with params: "),e),t=e.preference,o=this._getTRTCQosPreference(t),this._setQosPreference(o),this._setScreenShareParams({qosPreference:o}),[2,new Promise((function(e,t){Promise.all([i._updateLocalVideo(),i._updateLocalScreen()]).then((function(){e(!0)})).catch((function(e){i._callFunctionErrorManage(e,"setNetworkQosParam"),t(e)}))}))]}))}))},i.prototype.setLocalRenderParams=function(e){return s(this,void 0,void 0,(function(){var t,o;return c(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Re,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),i.label=1;case 1:return i.trys.push([1,4,,5]),t={},e.mirrorType&&(t.mirror=this._getTRTCMirror(e.mirrorType)),e.fillMode&&(t.fillMode=this._getTRTCFillMode(e.fillMode)),this._setVideoPlayOption(t),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return o=i.sent(),this._callFunctionErrorManage(o,"setLocalRenderParams"),[3,5];case 5:return[2]}}))}))},i.prototype.setRemoteRenderParams=function(e,t,o){return s(this,void 0,void 0,(function(){var i;return c(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Re,".setRemoteRenderParams with params: "),e,t,o),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,o),[4,this._updateRemoteVideo(e,t)];case 2:return r.sent(),[3,4];case 3:return i=r.sent(),this._callFunctionErrorManage(i,"setRemoteRenderParams"),[3,4];case 4:return[2]}}))}))},i.prototype._updateLocalAudio=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===r.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},i.prototype._updateLocalTestAudio=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===r.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},i.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),s(this,void 0,void 0,(function(){var o,i,n;return c(this,(function(a){switch(a.label){case 0:t===e.TRTCAudioQuality.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(Re,".startLocalAudio with params: "),t),o=this._getTRTCAudioQuality(t),a.label=1;case 1:a.trys.push([1,8,,9]),this._setAudioProfile(o),a.label=2;case 2:return a.trys.push([2,4,,7]),[4,this._trtc.startLocalAudio(this._generateLocalAudioData())];case 3:return a.sent(),[3,7];case 4:return(i=a.sent()).code!==r.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalAudio()];case 5:return a.sent(),[2];case 6:throw i;case 7:return this.emit("onMicDidReady"),[3,9];case 8:return n=a.sent(),console.warn("".concat(Re," startLocalAudio error: ").concat(n)),this._callFunctionErrorManage(n,"startLocalAudio"),[3,9];case 9:return[2]}}))}))},i.prototype.stopLocalAudio=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Re,".stopLocalAudio")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopLocalAudio()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),[3,4];case 4:return[2]}}))}))},i.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,(function(){var t;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Re,".muteLocalAudio with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,4]),this._setIsAudioPublish(!e),[4,this._updateLocalAudio()];case 2:return o.sent(),[3,4];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),[3,4];case 4:return[2]}}))}))},i.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),s(this,void 0,void 0,(function(){var o;return c(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Re,".muteRemoteAudio with params: "),e,t),i.label=1;case 1:return i.trys.push([1,3,,4]),e?[4,this._trtc.muteRemoteAudio(e,t)]:(this._emitError(le),[2]);case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},i.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(Re,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},i.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(Re,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(o){this._callFunctionErrorManage(o,"setRemoteAudioVolume")}},i.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(Re,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},i.prototype.enableSmallVideoStream=function(e,t){return s(this,void 0,Promise,(function(){var o;return c(this,(function(i){switch(i.label){case 0:return this.logger.info("".concat(Re,".enableSmallVideoStream with params: "),e,t),e?(o=this._getTRTCVideoProfile("small",t),this._setSmallStreamVideoProfile(o)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return i.sent(),[2]}}))}))},i.prototype.snapshotVideo=function(t,o){var i="";return i=""===t&&o===e.TRTCVideoStreamType.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===t&&o===e.TRTCVideoStreamType.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(o)}):this._trtc.getVideoSnapshot({userId:t,streamType:this._getTRTCStreamType(o)}),this.emit("onSnapshotComplete",t,o,i),i},i.prototype.startScreenShare=function(t,o,i){return s(this,void 0,void 0,(function(){var n,a,s,u,l,d,T,h;return c(this,(function(c){switch(c.label){case 0:this.logger.info("".concat(Re,".startScreenShare with params: "),t,o,i),c.label=1;case 1:return c.trys.push([1,3,,4]),a=(n=i||{}).screenAudio,s=void 0!==a&&a,u=n.videoTrack,l=this._getTRTCVideoProfile("screen",i),this._setScreenShareParams({view:t,profile:l,systemAudio:s,videoTrack:u}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return c.sent(),this._isSharingScreen=!0,d=l.width,T=l.height,this.emit("onFirstVideoFrame","",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,d,T),[3,4];case 3:if((h=c.sent()).code===r.default.ERROR_CODE.OPERATION_ABORT)return[2];throw console.error("Start share screen error:",h,h.code,h.name,h.message),h;case 4:return[2]}}))}))},i.prototype.setSubStreamEncoderParam=function(e){return s(this,void 0,void 0,(function(){var t,o;return c(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Re,".setSubStreamEncoderParam with params: "),e),t=this._getTRTCVideoProfile("screen",e),this._setScreenShareParams({profile:t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._updateLocalScreen()];case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"setSubStreamEncoderParam"),[3,4];case 4:return[2]}}))}))},i.prototype.stopScreenShare=function(){return s(this,void 0,Promise,(function(){var e;return c(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Re,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",0),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),[3,4];case 4:return[2]}}))}))},i.prototype.startScreenCapture=function(){this._emitError(de)},i.prototype.pauseScreenCapture=function(){this._emitError(de)},i.prototype.resumeScreenCapture=function(){this._emitError(de)},i.prototype.getScreenCaptureSources=function(){this._emitError(de)},i.prototype.selectScreenCaptureTarget=function(){this._emitError(de)},i.prototype.getCameraDevicesList=function(){return s(this,void 0,Promise,(function(){var e,t,o;return c(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Re,".getCameraDevicesList")),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.default.getCameraList()];case 2:return e=i.sent(),t=e.map((function(e){return a(a({},e),{deviceName:e.label})})),this._cameraList=e,"{}"===JSON.stringify(this._currentCamera)&&(this._currentCamera=this.getDefaultDeviceInfo(e),this._currentCameraId=this._currentCamera.deviceId),[2,Promise.resolve(t)];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"getCameraDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},i.prototype.setCurrentCameraDevice=function(e){return s(this,void 0,Promise,(function(){var t;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Re,".setCurrentCameraDevice with params: "),{cameraId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._currentCameraId=e,this._currentCamera=this._cameraList.find((function(t){return t.deviceId===e}))||{},[4,this._updateLocalVideo()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),[2,!0];case 4:return t=o.sent(),this._callFunctionErrorManage(t,"setCurrentCameraDevice"),[2,!1];case 5:return[2]}}))}))},i.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(Re,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,o=e.label,i=e.kind,r=e.groupId;return new m(t,o,i,o,r)},i.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},i.prototype.switchCamera=function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Re,".switchCamera with params: "),e),this._setIsFrontCamera(e),(t=this._getVideoPlayOption()).mirror=this._getTRTCMirror(this._localRenderParams.mirrorType),this._setVideoPlayOption(t),[4,this._updateLocalVideo()];case 1:return o.sent(),[2]}}))}))},i.prototype._onVirtualBackgroundError=function(e){this._emitWarning(e)},i.prototype.setVirtualBackground=function(e){return s(this,void 0,void 0,(function(){var t,o,i,r,n;return c(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,o=e.type,i=e.blurLevel,r=e.imagePath,t?this._isVirtualBackground?o!==Z?[3,2]:[4,this._trtc.updatePlugin(X,{type:o,blurLevel:i})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return o!==$?[3,4]:[4,this._trtc.updatePlugin(X,{type:o,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(X,a(a({},e),{src:r,onError:this._onVirtualBackgroundError}))];case 6:s.sent(),this._isVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._trtc.stopPlugin(X),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Re,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},i.prototype.useVirtualBackground=function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:o.VirtualBackground,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},i.prototype.getMicDevicesList=function(){return s(this,void 0,Promise,(function(){var e,t,o;return c(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Re,".getMicDevicesList")),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.default.getMicrophoneList()];case 2:return e=i.sent(),t=e.map((function(e){return a(a({},e),{deviceName:e.label})})),this._microphoneList=e,"{}"===JSON.stringify(this._currentMicrophone)&&(this._currentMicrophone=this.getDefaultDeviceInfo(e),this._currentMicrophoneId=this._currentMicrophone.deviceId),[2,Promise.resolve(t)];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"getMicDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},i.prototype.setCurrentMicDevice=function(e){return s(this,void 0,Promise,(function(){var t;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Re,".setCurrentMicDevice with params: "),{micId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._setCurrentMicrophoneId(e),this._currentMicrophone=this._microphoneList.find((function(t){return t.deviceId===e}))||{},[4,this._updateLocalAudio()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestAudio()];case 3:return o.sent(),[2,!0];case 4:return t=o.sent(),this._callFunctionErrorManage(t,"setCurrentMicDevice"),[2,!1];case 5:return[2]}}))}))},i.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(Re,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,o=e.label,i=e.kind,r=e.groupId;return new m(t,o,i,o,r)},i.prototype.getSpeakerDevicesList=function(){return s(this,void 0,Promise,(function(){var e,t,o;return c(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Re,".getSpeakerDevicesList")),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.default.getSpeakerList()];case 2:return e=i.sent(),t=e.map((function(e){return a(a({},e),{deviceName:e.label})})),this._speakerList=e,"{}"===JSON.stringify(this._currentSpeaker)&&(this._currentSpeaker=this.getDefaultDeviceInfo(e),this._currentSpeakerId=this._currentSpeaker.deviceId),[2,Promise.resolve(t)];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},i.prototype.setCurrentSpeakerDevice=function(e){return s(this,void 0,Promise,(function(){var t;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Re,".setCurrentSpeakerDevice with params: "),{speakerId:e}),o.label=1;case 1:return o.trys.push([1,3,,4]),e?(this._setCurrentSpeakerId(e),this._currentSpeaker=this._speakerList.find((function(t){return t.deviceId===e}))||{},[4,r.default.setCurrentSpeaker(e)]):[2,!1];case 2:return o.sent(),[2,!0];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"setCurrentSpeakerDevice"),[2,!1];case 4:return[2]}}))}))},i.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(Re,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,o=e.label,i=e.kind,r=e.groupId;return new m(t,o,i,o,r)},i.prototype.startCameraDeviceTest=function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(o){switch(o.label){case 0:if(this.logger.info("".concat(Re,".startCameraDeviceTest with params: "),e),!e)return[2];this._setLocalTestView(e),o.label=1;case 1:return o.trys.push([1,3,,6]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return o.sent(),[3,6];case 3:return(t=o.sent()).code!==r.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return o.sent(),[2];case 5:throw t;case 6:return[2]}}))}))},i.prototype.stopCameraDeviceTest=function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Re,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},i.prototype.startMicDeviceTest=function(e){return s(this,void 0,void 0,(function(){var t,o=this;return c(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Re,".startMicDeviceTest with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,6]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return i.sent(),[3,6];case 3:return(t=i.sent()).code!==r.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return i.sent(),[2];case 5:throw t;case 6:return this._testTrtc.on(r.default.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,i=e.volume;""===t&&o.emit("onTestMicVolume",i)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(e)];case 7:return i.sent(),[2]}}))}))},i.prototype.stopMicDeviceTest=function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Re,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},i.prototype.callExperimentalAPI=function(e){return s(this,void 0,void 0,(function(){var t,o,i;return c(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(Re,".callExperimentalAPI"),e),(t=function(e){if("string"!=typeof e)return e;var t;try{var o=JSON.parse(e);t="object"==typeof o&&o?o:e}catch(i){t=e}return t}(e))===e)return[2];if(o=t.api,i=t.params,!o||!i)return[2];r.label=1;case 1:switch(r.trys.push([1,12,,13]),o){case"setFramework":return[3,2];case"enableAudioAEC":return[3,3];case"enableAudioANS":return[3,4];case"enableAudioAGC":return[3,5];case"KeyMetricsStats":return[3,6];case"setNetworkProxy":return[3,7];case"enableVirtualBackground":return[3,8]}return[3,10];case 2:return this._handleSetFrameWork(i),[3,11];case 3:return this._echoCancellation=Boolean(i.enable),[3,11];case 4:return this._noiseSuppression=Boolean(i.enable),[3,11];case 5:return this._autoGainControl=Boolean(i.enable),[3,11];case 6:return this._handleKeyMetricsStats(i),[3,11];case 7:return this._networkProxy=i,[3,11];case 8:return[4,this.setVirtualBackground(i)];case 9:return r.sent(),[3,11];case 10:return[3,11];case 11:return[3,13];case 12:throw r.sent();case 13:return[2]}}))}))},i.prototype._handleSetFrameWork=function(e){var t=e.frameWork,o=e.component,i=e.language;ce(t)&&(this._frameWorkType=t),ce(o)&&(this._component=o),ce(i)&&(this._language=i)},i.prototype._handleKeyMetricsStats=function(e){var t=e.key,o=e.opt,i=e.value,n=e.version,a=o===oe;r.default._addKVStat({option:{type:o,key:t,value:i,version:n,useUV:a,base:100}})},i.prototype._unbindEvents=function(){},i.prototype._destroy=function(){this._unbindEvents()},i.prototype._emitError=function(e){e&&this.emit&&this.emit(K,e.code,e.message)},i.prototype._emitWarning=function(e){this.emit&&this.emit(J,e)},i.prototype._callFunctionErrorManage=function(e,t){e&&e.code===r.default.ERROR_CODE.OPERATION_ABORT||(this.emit(K,e.code,e.message),this.logger.warn("(".concat(t,") failed - ").concat(e.code," - ").concat(e.message)))},i.prototype._getTRTCResolution=function(t){var o=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(o.length>1&&o[1]),height:+(o.length>2&&o[2])}},i.prototype._getTRTCVideoProfile=function(t,o){var i=o.videoResolution,r=o.videoFps,n=o.videoBitrate,a=o.resMode,s={};switch(t){case"screen":s=this._defaultScreenProfile;break;case"small":s=this._defaultSmallVideoProfile;break;default:s=this._defaultVideoProfile}if(!se(i)){var c=this._getTRTCResolution(i);s.width=c.width,s.height=c.height}if(!se(a)&&a===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait){var u=s.height,l=s.width;s.width=u,s.height=l}return r&&(s.frameRate=r),n&&(s.bitrate=n),s},i.prototype._getTRTCStreamType=function(t){var o;return((o={})[e.TRTCVideoStreamType.TRTCVideoStreamTypeBig]=r.default.TYPE.STREAM_TYPE_MAIN,o[e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall]=r.default.TYPE.STREAM_TYPE_MAIN,o[e.TRTCVideoStreamType.TRTCVideoStreamTypeSub]=r.default.TYPE.STREAM_TYPE_SUB,o)[t]},i.prototype._getTRTCFillMode=function(t){var o;return((o={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=ne.COVER,o[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=ne.CONTAIN,o)[t]},i.prototype._getTRTCMirror=function(t){var o;return t===e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((o={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,o[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,o)[t]},i.prototype._getTRTCQosPreference=function(t){var o;return((o={})[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceSmooth]=r.default.TYPE.QOS_PREFERENCE_SMOOTH,o[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear]=r.default.TYPE.QOS_PREFERENCE_CLEAR,o)[t]},i.prototype._getTRTCAudioQuality=function(t){var o;return((o={})[e.TRTCAudioQuality.TRTCAudioQualitySpeech]=r.default.TYPE.AUDIO_PROFILE_STANDARD,o[e.TRTCAudioQuality.TRTCAudioQualityDefault]=r.default.TYPE.AUDIO_PROFILE_STANDARD,o[e.TRTCAudioQuality.TRTCAudioQualityMusic]=r.default.TYPE.AUDIO_PROFILE_HIGH_STEREO,o)[t]},i.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},i.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},i.prototype._getTRTCCloudQuality=function(t){return[e.TRTCQuality.TRTCQuality_Unknown,e.TRTCQuality.TRTCQuality_Excellent,e.TRTCQuality.TRTCQuality_Good,e.TRTCQuality.TRTCQuality_Poor,e.TRTCQuality.TRTCQuality_Bad,e.TRTCQuality.TRTCQuality_Vbad,e.TRTCQuality.TRTCQuality_Down][t]},i.prototype._generateLocalVideoData=function(){var e={view:this._getLocalView(),publish:this._getIsVideoPublish(),option:a({profile:this._getVideoProfile(),small:this._getSmallStreamVideoProfile()||!1},this._getVideoPlayOption())};return this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),this._getQosPreference()&&e&&Object.assign(e.option,{qosPreference:this._getQosPreference()}),e},i.prototype._generateLocalTestVideoData=function(){return{view:this._getLocalTestView(),publish:!1,option:a({cameraId:this._getCurrentCameraId(),profile:this._getVideoProfile()},this._getVideoPlayOption())}},i.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}};return ue(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),ue(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),ue(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},i.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},i.prototype._generateRemoteVideoData=function(e,t){return this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t)))},i.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(r.default.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(r.default.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(r.default.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(r.default.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(r.default.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(r.default.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(r.default.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(r.default.EVENT.AUDIO_VOLUME,(function(e){(null==e?void 0:e.result)&&t.emit("onUserVoiceVolume",null==e?void 0:e.result,((null==e?void 0:e.result)||[]).length)})),this._trtc.on(r.default.EVENT.KICKED_OUT,(function(e){var o={banned:ae.banned,room_disband:ae.roomDisband};ce(o[e.reason])&&t.emit("onExitRoom",o[e.reason])})),this._trtc.on(r.default.EVENT.NETWORK_QUALITY,(function(e){var o=e.uplinkNetworkQuality,i=e.downlinkNetworkQuality,r=e.downlinkInfo,n=new E("",t._getTRTCCloudQuality(o)),a=[];r.length>0&&(a=r.map((function(e){return new E(e.userId,t._getTRTCCloudQuality(i))}))),t.emit("onNetworkQuality",n,a)})),this._trtc.on(r.default.EVENT.STATISTICS,(function(o){var i,r=o.rtt,n=o.upLoss,a=o.downLoss,s=o.bytesSent,c=o.bytesReceived,u=o.localStatistics,l=o.remoteStatistics,d={big:e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,small:e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall,sub:e.TRTCVideoStreamType.TRTCVideoStreamTypeSub},T=(null===(i=u.video)||void 0===i?void 0:i.length)>0?u.video.map((function(e){var t=new D;return t.width=e.width,t.height=e.height,t.frameRate=e.frameRate,t.videoBitrate=e.bitrate,t.audioBitrate=u.audio.bitrate||0,t.streamType=d[e.videoType],t})):[];if(0===T.length&&u.audio.bitrate>0){var h=new D;h.audioBitrate=u.audio.bitrate||0,T.push(h)}var p=[];l.forEach((function(e){var t=[],o=e.userId,i=e.audio.bitrate;if(e.video&&e.video.forEach((function(e){var r=new O;r.userId=o,r.width=e.width,r.height=e.height,r.frameRate=e.frameRate,r.videoBitrate=e.bitrate,r.audioBitrate=i||0,r.streamType=d[e.videoType],t.push(r)})),0===t.length){var r=new O;r.userId=o,r.audioBitrate=i||0,t.push(r)}p.push.apply(p,t)}));var f=new k;f.upLoss=n,f.downLoss=a,f.rtt=r,f.sentBytes=s,f.receivedBytes=c,f.localStatisticsArray=T,f.localStatisticsArraySize=T.length,f.remoteStatisticsArray=p,f.remoteStatisticsArraySize=p.length,t.emit("onStatistics",f)})),this._trtc.on(r.default.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._isSharingScreen=!1})),this._trtc.on(r.default.EVENT.PUBLISH_STATE_CHANGED,(function(o){var i=o.mediaType;"started"===o.state&&("audio"===i?t.emit("onSendFirstLocalAudioFrame"):"video"===i?t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig):"screen"===i&&t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub))}))},i.prototype._removeTRTCEvents=function(){this._trtc.off("*")},i.prototype._emitVideoAvailable=function(e,t){var o=e.userId,i=e.streamType;t?this._remoteStreamMap.set("".concat(o,"_").concat(i),!0):this._remoteStreamMap.delete("".concat(o,"_").concat(i)),i===r.default.TYPE.STREAM_TYPE_SUB?o&&this.emit("onUserSubStreamAvailable",o,t):o&&this.emit("onUserVideoAvailable",o,t)},i.prototype._setLocalView=function(e){this._localView=e},i.prototype._getLocalView=function(){return this._localView},i.prototype._setIsMobile=function(e){this._isMobile=e},i.prototype._getIsMobile=function(){return this._isMobile},i.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},i.prototype._getIsFrontCamera=function(){return this._isFrontCamera},i.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},i.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},i.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},i.prototype._getIsVideoPublish=function(){return this._isVideoPublish},i.prototype._setVideoProfile=function(e){this._videoProfile=e},i.prototype._getVideoProfile=function(){return this._videoProfile},i.prototype._setVideoPlayOption=function(e){this._videoPlayOption=e},i.prototype._getVideoPlayOption=function(){return this._videoPlayOption},i.prototype._setQosPreference=function(e){this._qosPreference=e},i.prototype._getQosPreference=function(){return this._qosPreference},i.prototype._setLocalTestView=function(e){this._localTestView=e},i.prototype._getLocalTestView=function(){return this._localTestView},i.prototype._setScreenShareParams=function(e){var t=e.view,o=e.systemAudio,i=e.fillMode,r=e.profile,n=e.videoTrack,a=e.qosPreference;se(t)||(this._screenShareParams.view=t),se(o)||(this._screenShareParams.option.systemAudio=o),se(i)||(this._screenShareParams.option.fillMode=i),se(r)||(this._screenShareParams.option.profile=r),se(n)||(this._screenShareParams.option.videoTrack=n),se(a)||(this._screenShareParams.option.qosPreference=a)},i.prototype._getScreenShareParams=function(){return this._screenShareParams},i.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},i.prototype._getIsAudioPublish=function(){return this._isAudioPublish},i.prototype._setAudioProfile=function(e){this._audioProfile=e},i.prototype._getAudioProfile=function(){return this._audioProfile},i.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},i.prototype._getCurrentCameraId=function(){return this._currentCameraId},i.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},i.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},i.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},i.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},i.prototype._setRemoteStreamConfig=function(t,o,i){var r=this._remoteStreamConfig.get("".concat(t,"_").concat(this._getTRTCStreamType(o)));r||(r={userId:t,streamType:this._getTRTCStreamType(o),option:{mirror:this._getTRTCMirror(e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(e.TRTCVideoFillMode.TRTCVideoFillMode_Fit)}});var n=i.view,a=i.mirrorType,s=i.fillMode,c=i.small;se(n)||(r.view=n),se(a)||(r.option.mirror=this._getTRTCMirror(a)),se(s)||(r.option.fillMode=this._getTRTCFillMode(s)),se(c)||(r.option.small=c),this._remoteStreamConfig.set("".concat(t,"_").concat(this._getTRTCStreamType(o)),r)},i.prototype.handleDeviceChange=function(){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(o){return r.default.getCameraList().then((function(o){return s(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this._cameraList.length===o.length?[2]:[4,this.deviceChangeManage(this._cameraList,o,e.TRTCDeviceType.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=o,[2]}}))}))})),r.default.getMicrophoneList().then((function(o){return s(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,o,e.TRTCDeviceType.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=o,[2]}}))}))})),r.default.getSpeakerList().then((function(o){return s(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,o,e.TRTCDeviceType.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=o,[2]}}))}))})),[2]}))}))},i.prototype.isSameDevice=function(e,t){var o=e&&e.deviceId&&e.groupId&&e.label,i=t&&t.deviceId&&t.groupId&&t.label;return!(!o||!i)&&e.deviceId===t.deviceId&&e.groupId===t.groupId&&e.label===t.label},i.prototype.deviceChangeManage=function(t,o,i){return s(this,void 0,void 0,(function(){var r,n,a,s,u;return c(this,(function(c){switch(c.label){case 0:return r=void 0,t.length!==o.length&&(n=(o||[]).map((function(e){return e.deviceId})),a=new m,t.length>o.length?(a=t.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateRemove):(n=(t||[]).map((function(e){return e.deviceId})),a=o.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateAdd),s=a.deviceId,this.emitOnDeviceChange(s,i,r)),u=this.getDefaultDeviceInfo(o),i!==e.TRTCDeviceType.TRTCDeviceTypeCamera||r!==e.TRTCDeviceState.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,u)?[2]:u.deviceId?[4,this.autoChangeDevice(i,u)]:[3,2];case 1:c.sent(),c.label=2;case 2:c.label=3;case 3:return i!==e.TRTCDeviceType.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,u)?[2]:u.deviceId?[4,this.autoChangeDevice(i,u)]:[3,5];case 4:c.sent(),c.label=5;case 5:c.label=6;case 6:return i!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,u)?[2]:u.deviceId?[4,this.autoChangeDevice(i,u)]:[3,8];case 7:c.sent(),c.label=8;case 8:c.label=9;case 9:return[2]}}))}))},i.prototype.getDefaultDeviceInfo=function(e){var t=new m;if(0===e.length)return t;var o=e.filter((function(e){return"default"===e.deviceId}));return t=o.length>0?o[0]:e[0]},i.prototype.autoChangeDevice=function(t,o){return s(this,void 0,void 0,(function(){var i,n,a,s,u;return c(this,(function(c){switch(c.label){case 0:if(i=o.deviceId,t!==e.TRTCDeviceType.TRTCDeviceTypeCamera)return[3,8];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._trtc.updateLocalVideo({option:{cameraId:i}})];case 2:return c.sent(),[3,4];case 3:return n=c.sent(),console.log("error",JSON.stringify(n)),n.code,r.default.ERROR_CODE.OPERATION_ABORT,[3,4];case 4:return c.trys.push([4,6,,7]),[4,this._testTrtc.updateLocalVideo({option:{cameraId:i}})];case 5:return c.sent(),[3,7];case 6:return a=c.sent(),console.log("testTRTC error",JSON.stringify(a)),a.code,r.default.ERROR_CODE.OPERATION_ABORT,[3,7];case 7:this._currentCameraId=i,this._currentCamera=o,this.emitOnDeviceChange(i,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=8;case 8:if(t!==e.TRTCDeviceType.TRTCDeviceTypeMic)return[3,16];c.label=9;case 9:return c.trys.push([9,11,,12]),[4,this._trtc.updateLocalAudio({option:{microphoneId:i}})];case 10:return c.sent(),[3,12];case 11:return s=c.sent(),console.log("error",JSON.stringify(s)),s.code,r.default.ERROR_CODE.OPERATION_ABORT,[3,12];case 12:return c.trys.push([12,14,,15]),[4,this._testTrtc.updateLocalAudio({option:{microphoneId:i}})];case 13:return c.sent(),[3,15];case 14:return u=c.sent(),console.log("testTRTC error",JSON.stringify(u)),u.code,r.default.ERROR_CODE.OPERATION_ABORT,[3,15];case 15:this._currentMicrophoneId=i,this._currentMicrophone=o,this.emitOnDeviceChange(i,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=16;case 16:return t!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,18]:[4,r.default.setCurrentSpeaker(i)];case 17:c.sent(),this._currentSpeakerId=i,this._currentSpeaker=o,this.emitOnDeviceChange(i,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=18;case 18:return[2]}}))}))},i.prototype.emitOnDeviceChange=function(e,t,o){this.emit("onDeviceChange",e,t,o)},i}(_);e.Rect=j,e.TRTCDeviceInfo=m,e.TRTCImageBuffer=N,e.TRTCLocalStatistics=D,e.TRTCMixUser=Y,e.TRTCNetworkQosParam=B,e.TRTCParams=S,e.TRTCPublishCDNParam=I,e.TRTCQualityInfo=E,e.TRTCRemoteStatistics=O,e.TRTCRenderParams=w,e.TRTCScreenCaptureSourceInfo=U,e.TRTCStatistics=k,e.TRTCTranscodingConfig=W,e.TRTCVideoEncParam=V,e.TRTCVolumeInfo=P,e.default=_e,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("trtc-sdk-v5"),require("trtc-sdk-v5/plugins/video-effect/virtual-background")):"function"==typeof define&&define.amd?define(["exports","trtc-sdk-v5","trtc-sdk-v5/plugins/video-effect/virtual-background"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).TRTCCloud={},global.TRTC,global.virtualBackground);
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("trtc-sdk-v5"),require("trtc-sdk-v5/plugins/video-effect/virtual-background")):"function"==typeof define&&define.amd?define(["exports","trtc-sdk-v5","trtc-sdk-v5/plugins/video-effect/virtual-background"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TRTCCloud={},e.TRTC,e.virtualBackground)}(this,(function(e,t,r){function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(t),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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};var a=function(){return a=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.apply(this,arguments)};function s(e,t,r,o){return new(r||(r=Promise))((function(i,n){function a(e){try{c(o.next(e))}catch(t){n(t)}}function s(e){try{c(o.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))}function c(e,t){var r,o,i,n,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;n&&(n=0,s[0]&&(a=0)),a;)try{if(r=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(c){s=[6,c],o=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function u(e,t,r){if(r||2===arguments.length)for(var o,i=0,n=t.length;i<n;i++)!o&&i in t||(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function d(e,t){return e(t={exports:{}},t.exports),t.exports}var T,h,p,f,v,R,g,_,C=d((function(e){var t=Object.prototype.hasOwnProperty,r="~";function o(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function n(e,t,o,n,a){if("function"!=typeof o)throw new TypeError("The listener must be a function");var s=new i(o,n||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function s(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,o,i=[];if(0===this._eventsCount)return i;for(o in e=this._events)t.call(e,o)&&i.push(r?o.slice(1):o);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var i=0,n=o.length,a=new Array(n);i<n;i++)a[i]=o[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,o=this._events[t];return o?o.fn?1:o.length:0},s.prototype.emit=function(e,t,o,i,n,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,o),!0;case 4:return l.fn.call(l.context,t,o,i),!0;case 5:return l.fn.call(l.context,t,o,i,n),!0;case 6:return l.fn.call(l.context,t,o,i,n,a),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var T,h=l.length;for(u=0;u<h;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,o);break;case 4:l[u].fn.call(l[u].context,t,o,i);break;default:if(!c)for(T=1,c=new Array(d-1);T<d;T++)c[T-1]=arguments[T];l[u].fn.apply(l[u].context,c)}}return!0},s.prototype.on=function(e,t,r){return n(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return n(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,o,i){var n=r?r+e:e;if(!this._events[n])return this;if(!t)return a(this,n),this;var s=this._events[n];if(s.fn)s.fn!==t||i&&!s.once||o&&s.context!==o||a(this,n);else{for(var c=0,u=[],l=s.length;c<l;c++)(s[c].fn!==t||i&&!s[c].once||o&&s[c].context!==o)&&u.push(s[c]);u.length?this._events[n]=1===u.length?u[0]:u:a(this,n)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new o,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}));e.TRTCVideoResolution=void 0,(T=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[T.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",T[T.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",T[T.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",T[T.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",T[T.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",T[T.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",T[T.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",T[T.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",T[T.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",T[T.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",T[T.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",T[T.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",T[T.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",T[T.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",T[T.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",T[T.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",T[T.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",T[T.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",T[T.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",T[T.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(h=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[h.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",h[h.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",h[h.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(p=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[p.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",p[p.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(f=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[f.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",f[f.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",f[f.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(v=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[v.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",v[v.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(R=e.TRTCAppScene||(e.TRTCAppScene={}))[R.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",R[R.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",R[R.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",R[R.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(g=e.TRTCRoleType||(e.TRTCRoleType={}))[g.TRTCRoleAnchor=20]="TRTCRoleAnchor",g[g.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(_=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[_.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",_[_.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",_[_.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic";var m,y,S=function(e,t,r,o,i){void 0===e&&(e=""),void 0===t&&(t=""),void 0===r&&(r=""),void 0===o&&(o=""),void 0===i&&(i=""),this.deviceId=e,this.deviceName=t,this.kind=r,this.label=o,this.groupId=i};e.TRTCDeviceState=void 0,(m=e.TRTCDeviceState||(e.TRTCDeviceState={}))[m.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",m[m.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",m[m.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(y=e.TRTCDeviceType||(e.TRTCDeviceType={}))[y.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",y[y.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",y[y.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",y[y.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var b,V=function(t,r,o,i,n,a,s,c,u,l,d){void 0===t&&(t=0),void 0===r&&(r=""),void 0===o&&(o=""),void 0===i&&(i=0),void 0===n&&(n=""),void 0===a&&(a=e.TRTCRoleType.TRTCRoleAnchor),void 0===s&&(s=null),void 0===u&&(u=null),void 0===l&&(l=null),void 0===d&&(d=30),this.sdkAppId=t,this.userId=r,this.userSig=o,this.roomId=i,this.strRoomId=n,this.role=a,this.privateMapKey=s,this.streamId=u,this.userDefineRecordId=l,this.frameWorkType=d},w=function(t,r,o,i){void 0===t&&(t=e.TRTCVideoResolution.TRTCVideoResolution_640_360),void 0===r&&(r=e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape),void 0===o&&(o=15),void 0===i&&(i=550),this.videoResolution=t,this.resMode=r,this.videoFps=o,this.videoBitrate=i};e.TRTCVideoRotation=void 0,(b=e.TRTCVideoRotation||(e.TRTCVideoRotation={}))[b.TRTCVideoRotation0=0]="TRTCVideoRotation0",b[b.TRTCVideoRotation90=1]="TRTCVideoRotation90",b[b.TRTCVideoRotation180=2]="TRTCVideoRotation180",b[b.TRTCVideoRotation270=3]="TRTCVideoRotation270";var E,A=function(t,r,o){void 0===t&&(t=e.TRTCVideoRotation.TRTCVideoRotation0),void 0===r&&(r=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit),void 0===o&&(o=e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),this.rotation=t,this.fillMode=r,this.mirrorType=o};e.TRTCQuality=void 0,(E=e.TRTCQuality||(e.TRTCQuality={}))[E.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",E[E.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",E[E.TRTCQuality_Good=2]="TRTCQuality_Good",E[E.TRTCQuality_Poor=3]="TRTCQuality_Poor",E[E.TRTCQuality_Bad=4]="TRTCQuality_Bad",E[E.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",E[E.TRTCQuality_Down=6]="TRTCQuality_Down";var M,I,P,L=function(t,r){void 0===t&&(t=""),void 0===r&&(r=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=r},O=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},D=function(e,t,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=null),this.appId=e,this.bizId=t,this.url=r},k=function(t,r,o,i,n,a,s){void 0===t&&(t=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===a&&(a=0),void 0===s&&(s=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.width=t,this.height=r,this.frameRate=o,this.videoBitrate=i,this.audioBitrate=a,this.streamType=s},x=function(t,r,o,i,n,a,s,c,u,l,d,T,h,p){void 0===t&&(t=""),void 0===o&&(o=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===c&&(c=0),void 0===p&&(p=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.userId=t,this.width=o,this.height=i,this.frameRate=n,this.videoBitrate=a,this.audioBitrate=c,this.streamType=p},F=function(e,t,r,o,i,n,a,s,c,u,l){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=[]),void 0===c&&(c=0),void 0===u&&(u=[]),void 0===l&&(l=0),this.upLoss=e,this.downLoss=t,this.rtt=i,this.receivedBytes=n,this.sentBytes=a,this.localStatisticsArray=s,this.localStatisticsArraySize=c,this.remoteStatisticsArray=u,this.remoteStatisticsArraySize=l};e.TRTCVideoResolutionMode=void 0,(M=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[M.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",M[M.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(I=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[I.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",I[I.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(P=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[P.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",P[P.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var B,Q,N=function(t,r){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===r&&(r=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=r},j=function(e,t,r,o){void 0===e&&(e=new ArrayBuffer(0)),void 0===t&&(t=0),void 0===r&&(r=0),void 0===o&&(o=0),this.buffer=e,this.length=t,this.width=r,this.height=o};e.TRTCLogLevel=void 0,(B=e.TRTCLogLevel||(e.TRTCLogLevel={}))[B.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",B[B.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",B[B.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",B[B.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",B[B.TRTCLogLevelError=4]="TRTCLogLevelError",B[B.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",B[B.TRTCLogLevelNone=6]="TRTCLogLevelNone",e.TRTCScreenCaptureSourceType=void 0,(Q=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[Q.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",Q[Q.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",Q[Q.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",Q[Q.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var U,W=function(t,r,o,i,n,a){void 0===t&&(t=e.TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown),void 0===r&&(r=""),void 0===o&&(o=""),void 0===i&&(i=new j),void 0===n&&(n=new j),void 0===a&&(a=!1),this.type=t,this.sourceId=r,this.sourceName=o,this.thumbBGRA=i,this.iconBGRA=n,this.isMinimizeWindow=a},G=function(e,t,r,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),void 0===o&&(o=0),this.left=e,this.top=t,this.right=r,this.bottom=o},H=function(t,r,o,i,n,a,s,c,u,l,d,T,h,p,f){void 0===t&&(t=e.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown),void 0===r&&(r=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=15),void 0===c&&(c=2),void 0===u&&(u=0),void 0===l&&(l=""),void 0===d&&(d=64),void 0===T&&(T=48e3),void 0===h&&(h=1),void 0===p&&(p=[]),void 0===f&&(f=""),this.mode=t,this.appId=r,this.bizId=o,this.videoWidth=i,this.videoHeight=n,this.videoBitrate=a,this.videoFramerate=s,this.videoGOP=c,this.backgroundColor=u,this.backgroundImage=l,this.audioSampleRate=d,this.audioBitrate=T,this.audioChannels=h,this.mixUsersArray=p,this.mixUsersArraySize=p.length,this.streamId=f};e.TRTCTranscodingConfigMode=void 0,(U=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[U.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",U[U.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",U[U.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",U[U.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",U[U.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",U[U.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",U[U.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",U[U.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",U[U.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",U[U.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var K,Y=function(t,r,o,i,n,a,s,c){void 0===t&&(t=""),void 0===r&&(r=""),void 0===o&&(o=null),void 0===i&&(i=0),void 0===n&&(n=!1),void 0===a&&(a=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),void 0===s&&(s=e.TRTCMixInputType.TRTCMixInputTypeUndefined),void 0===c&&(c=0),this.userId=t,this.roomId=r,this.rect=o,this.zOrder=i,this.pureAudio=n,this.streamType=a,this.inputType=s,this.renderMode=c};e.TRTCMixInputType=void 0,(K=e.TRTCMixInputType||(e.TRTCMixInputType={}))[K.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",K[K.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",K[K.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",K[K.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio";var z,q="onError",J="onWarning",X="rtc",$="live",Z="VirtualBackground",ee="blur",te="image",re={20:"anchor",21:"audience"},oe={0:X,1:$,2:X,3:$};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(z||(z={}));var ie="enum";function ne(){return Math.floor(performance.now())}var ae=function(e){return void 0===e},se=function(e){return"number"==typeof e},ce=function(e){return"boolean"==typeof e};var ue,le,de=function(e){return e&&e.Math===Math&&e},Te=de("object"==typeof globalThis&&globalThis)||de("object"==typeof window&&window)||de("object"==typeof self&&self)||de("object"==typeof l&&l)||function(){return this}()||l||Function("return this")(),he=function(e){try{return!!e()}catch(t){return!0}},pe=!he((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),fe=!he((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),ve=Function.prototype.call,Re=fe?ve.bind(ve):function(){return ve.apply(ve,arguments)},ge={}.propertyIsEnumerable,_e=Object.getOwnPropertyDescriptor,Ce={f:_e&&!ge.call({1:2},1)?function(e){var t=_e(this,e);return!!t&&t.enumerable}:ge},me=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ye=Function.prototype,Se=ye.call,be=fe&&ye.bind.bind(Se,Se),Ve=fe?be:function(e){return function(){return Se.apply(e,arguments)}},we=Ve({}.toString),Ee=Ve("".slice),Ae=function(e){return Ee(we(e),8,-1)},Me=Object,Ie=Ve("".split),Pe=he((function(){return!Me("z").propertyIsEnumerable(0)}))?function(e){return"String"===Ae(e)?Ie(e,""):Me(e)}:Me,Le=function(e){return null==e},Oe=TypeError,De=function(e){if(Le(e))throw Oe("Can't call method on "+e);return e},ke=function(e){return Pe(De(e))},xe="object"==typeof document&&document.all,Fe={all:xe,IS_HTMLDDA:void 0===xe&&void 0!==xe},Be=Fe.all,Qe=Fe.IS_HTMLDDA?function(e){return"function"==typeof e||e===Be}:function(e){return"function"==typeof e},Ne=Fe.all,je=Fe.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:Qe(e)||e===Ne}:function(e){return"object"==typeof e?null!==e:Qe(e)},Ue=function(e,t){return arguments.length<2?(r=Te[e],Qe(r)?r:void 0):Te[e]&&Te[e][t];var r},We=Ve({}.isPrototypeOf),Ge="undefined"!=typeof navigator&&String(navigator.userAgent)||"",He=Te.process,Ke=Te.Deno,Ye=He&&He.versions||Ke&&Ke.version,ze=Ye&&Ye.v8;ze&&(le=(ue=ze.split("."))[0]>0&&ue[0]<4?1:+(ue[0]+ue[1])),!le&&Ge&&(!(ue=Ge.match(/Edge\/(\d+)/))||ue[1]>=74)&&(ue=Ge.match(/Chrome\/(\d+)/))&&(le=+ue[1]);var qe=le,Je=Te.String,Xe=!!Object.getOwnPropertySymbols&&!he((function(){var e=Symbol("symbol detection");return!Je(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&qe&&qe<41})),$e=Xe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ze=Object,et=$e?function(e){return"symbol"==typeof e}:function(e){var t=Ue("Symbol");return Qe(t)&&We(t.prototype,Ze(e))},tt=String,rt=TypeError,ot=function(e){if(Qe(e))return e;throw rt(function(e){try{return tt(e)}catch(t){return"Object"}}(e)+" is not a function")},it=function(e,t){var r=e[t];return Le(r)?void 0:ot(r)},nt=TypeError,at=Object.defineProperty,st=function(e,t){try{at(Te,e,{value:t,configurable:!0,writable:!0})}catch(r){Te[e]=t}return t},ct="__core-js_shared__",ut=Te[ct]||st(ct,{}),lt=d((function(e){(e.exports=function(e,t){return ut[e]||(ut[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.32.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"})})),dt=Object,Tt=function(e){return dt(De(e))},ht=Ve({}.hasOwnProperty),pt=Object.hasOwn||function(e,t){return ht(Tt(e),t)},ft=0,vt=Math.random(),Rt=Ve(1..toString),gt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Rt(++ft+vt,36)},_t=Te.Symbol,Ct=lt("wks"),mt=$e?_t.for||_t:_t&&_t.withoutSetter||gt,yt=function(e){return pt(Ct,e)||(Ct[e]=Xe&&pt(_t,e)?_t[e]:mt("Symbol."+e)),Ct[e]},St=TypeError,bt=yt("toPrimitive"),Vt=function(e,t){if(!je(e)||et(e))return e;var r,o=it(e,bt);if(o){if(void 0===t&&(t="default"),r=Re(o,e,t),!je(r)||et(r))return r;throw St("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var r,o;if("string"===t&&Qe(r=e.toString)&&!je(o=Re(r,e)))return o;if(Qe(r=e.valueOf)&&!je(o=Re(r,e)))return o;if("string"!==t&&Qe(r=e.toString)&&!je(o=Re(r,e)))return o;throw nt("Can't convert object to primitive value")}(e,t)},wt=function(e){var t=Vt(e,"string");return et(t)?t:t+""},Et=Te.document,At=je(Et)&&je(Et.createElement),Mt=function(e){return At?Et.createElement(e):{}},It=!pe&&!he((function(){return 7!==Object.defineProperty(Mt("div"),"a",{get:function(){return 7}}).a})),Pt=Object.getOwnPropertyDescriptor,Lt={f:pe?Pt:function(e,t){if(e=ke(e),t=wt(t),It)try{return Pt(e,t)}catch(r){}if(pt(e,t))return me(!Re(Ce.f,e,t),e[t])}},Ot=pe&&he((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Dt=String,kt=TypeError,xt=function(e){if(je(e))return e;throw kt(Dt(e)+" is not an object")},Ft=TypeError,Bt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,Nt="enumerable",jt="configurable",Ut="writable",Wt={f:pe?Ot?function(e,t,r){if(xt(e),t=wt(t),xt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ut in r&&!r[Ut]){var o=Qt(e,t);o&&o[Ut]&&(e[t]=r.value,r={configurable:jt in r?r[jt]:o[jt],enumerable:Nt in r?r[Nt]:o[Nt],writable:!1})}return Bt(e,t,r)}:Bt:function(e,t,r){if(xt(e),t=wt(t),xt(r),It)try{return Bt(e,t,r)}catch(o){}if("get"in r||"set"in r)throw Ft("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},Gt=pe?function(e,t,r){return Wt.f(e,t,me(1,r))}:function(e,t,r){return e[t]=r,e},Ht=Function.prototype,Kt=pe&&Object.getOwnPropertyDescriptor,Yt=pt(Ht,"name"),zt={EXISTS:Yt,PROPER:Yt&&"something"===function(){}.name,CONFIGURABLE:Yt&&(!pe||pe&&Kt(Ht,"name").configurable)},qt=Ve(Function.toString);Qe(ut.inspectSource)||(ut.inspectSource=function(e){return qt(e)});var Jt,Xt,$t,Zt=ut.inspectSource,er=Te.WeakMap,tr=Qe(er)&&/native code/.test(String(er)),rr=lt("keys"),or=function(e){return rr[e]||(rr[e]=gt(e))},ir={},nr="Object already initialized",ar=Te.TypeError,sr=Te.WeakMap;if(tr||ut.state){var cr=ut.state||(ut.state=new sr);cr.get=cr.get,cr.has=cr.has,cr.set=cr.set,Jt=function(e,t){if(cr.has(e))throw ar(nr);return t.facade=e,cr.set(e,t),t},Xt=function(e){return cr.get(e)||{}},$t=function(e){return cr.has(e)}}else{var ur=or("state");ir[ur]=!0,Jt=function(e,t){if(pt(e,ur))throw ar(nr);return t.facade=e,Gt(e,ur,t),t},Xt=function(e){return pt(e,ur)?e[ur]:{}},$t=function(e){return pt(e,ur)}}var lr={set:Jt,get:Xt,has:$t,enforce:function(e){return $t(e)?Xt(e):Jt(e,{})},getterFor:function(e){return function(t){var r;if(!je(t)||(r=Xt(t)).type!==e)throw ar("Incompatible receiver, "+e+" required");return r}}},dr=d((function(e){var t=zt.CONFIGURABLE,r=lr.enforce,o=lr.get,i=String,n=Object.defineProperty,a=Ve("".slice),s=Ve("".replace),c=Ve([].join),u=pe&&!he((function(){return 8!==n((function(){}),"length",{value:8}).length})),l=String(String).split("String"),d=e.exports=function(e,o,d){"Symbol("===a(i(o),0,7)&&(o="["+s(i(o),/^Symbol\(([^)]*)\)/,"$1")+"]"),d&&d.getter&&(o="get "+o),d&&d.setter&&(o="set "+o),(!pt(e,"name")||t&&e.name!==o)&&(pe?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&d&&pt(d,"arity")&&e.length!==d.arity&&n(e,"length",{value:d.arity});try{d&&pt(d,"constructor")&&d.constructor?pe&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(h){}var T=r(e);return pt(T,"source")||(T.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=d((function(){return Qe(this)&&o(this).source||Zt(this)}),"toString")})),Tr=function(e,t,r,o){o||(o={});var i=o.enumerable,n=void 0!==o.name?o.name:t;if(Qe(r)&&dr(r,n,o),o.global)i?e[t]=r:st(t,r);else{try{o.unsafe?e[t]&&(i=!0):delete e[t]}catch(a){}i?e[t]=r:Wt.f(e,t,{value:r,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},hr=Math.ceil,pr=Math.floor,fr=Math.trunc||function(e){var t=+e;return(t>0?pr:hr)(t)},vr=function(e){var t=+e;return t!=t||0===t?0:fr(t)},Rr=Math.max,gr=Math.min,_r=Math.min,Cr=function(e){return e>0?_r(vr(e),9007199254740991):0},mr=function(e){return Cr(e.length)},yr=function(e){return function(t,r,o){var i,n=ke(t),a=mr(n),s=function(e,t){var r=vr(e);return r<0?Rr(r+t,0):gr(r,t)}(o,a);if(e&&r!=r){for(;a>s;)if((i=n[s++])!=i)return!0}else for(;a>s;s++)if((e||s in n)&&n[s]===r)return e||s||0;return!e&&-1}},Sr={includes:yr(!0),indexOf:yr(!1)}.indexOf,br=Ve([].push),Vr=function(e,t){var r,o=ke(e),i=0,n=[];for(r in o)!pt(ir,r)&&pt(o,r)&&br(n,r);for(;t.length>i;)pt(o,r=t[i++])&&(~Sr(n,r)||br(n,r));return n},wr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Er=wr.concat("length","prototype"),Ar={f:Object.getOwnPropertyNames||function(e){return Vr(e,Er)}},Mr={f:Object.getOwnPropertySymbols},Ir=Ve([].concat),Pr=Ue("Reflect","ownKeys")||function(e){var t=Ar.f(xt(e)),r=Mr.f;return r?Ir(t,r(e)):t},Lr=function(e,t,r){for(var o=Pr(t),i=Wt.f,n=Lt.f,a=0;a<o.length;a++){var s=o[a];pt(e,s)||r&&pt(r,s)||i(e,s,n(t,s))}},Or=/#|\.prototype\./,Dr=function(e,t){var r=xr[kr(e)];return r===Br||r!==Fr&&(Qe(t)?he(t):!!t)},kr=Dr.normalize=function(e){return String(e).replace(Or,".").toLowerCase()},xr=Dr.data={},Fr=Dr.NATIVE="N",Br=Dr.POLYFILL="P",Qr=Dr,Nr=Lt.f,jr=function(e,t){var r,o,i,n,a,s=e.target,c=e.global,u=e.stat;if(r=c?Te:u?Te[s]||st(s,{}):(Te[s]||{}).prototype)for(o in t){if(n=t[o],i=e.dontCallGetSet?(a=Nr(r,o))&&a.value:r[o],!Qr(c?o:s+(u?".":"#")+o,e.forced)&&void 0!==i){if(typeof n==typeof i)continue;Lr(n,i)}(e.sham||i&&i.sham)&&Gt(n,"sham",!0),Tr(r,o,n,e)}},Ur={};Ur[yt("toStringTag")]="z";var Wr,Gr="[object z]"===String(Ur),Hr=yt("toStringTag"),Kr=Object,Yr="Arguments"===Ae(function(){return arguments}()),zr=Gr?Ae:function(e){var t,r,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(r){}}(t=Kr(e),Hr))?r:Yr?Ae(t):"Object"===(o=Ae(t))&&Qe(t.callee)?"Arguments":o},qr=String,Jr=function(e){if("Symbol"===zr(e))throw TypeError("Cannot convert a Symbol value to a string");return qr(e)},Xr=function(){var e=xt(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},$r=Te.RegExp,Zr=he((function(){var e=$r("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),eo=Zr||he((function(){return!$r("a","y").sticky})),to={BROKEN_CARET:Zr||he((function(){var e=$r("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:eo,UNSUPPORTED_Y:Zr},ro=Object.keys||function(e){return Vr(e,wr)},oo=pe&&!Ot?Object.defineProperties:function(e,t){xt(e);for(var r,o=ke(t),i=ro(t),n=i.length,a=0;n>a;)Wt.f(e,r=i[a++],o[r]);return e},io={f:oo},no=Ue("document","documentElement"),ao="prototype",so="script",co=or("IE_PROTO"),uo=function(){},lo=function(e){return"<"+so+">"+e+"</"+so+">"},To=function(e){e.write(lo("")),e.close();var t=e.parentWindow.Object;return e=null,t},ho=function(){try{Wr=new ActiveXObject("htmlfile")}catch(i){}var e,t,r;ho="undefined"!=typeof document?document.domain&&Wr?To(Wr):(t=Mt("iframe"),r="java"+so+":",t.style.display="none",no.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(lo("document.F=Object")),e.close(),e.F):To(Wr);for(var o=wr.length;o--;)delete ho[ao][wr[o]];return ho()};ir[co]=!0;var po,fo,vo=Object.create||function(e,t){var r;return null!==e?(uo[ao]=xt(e),r=new uo,uo[ao]=null,r[co]=e):r=ho(),void 0===t?r:io.f(r,t)},Ro=Te.RegExp,go=he((function(){var e=Ro(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),_o=Te.RegExp,Co=he((function(){var e=_o("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),mo=lr.get,yo=lt("native-string-replace",String.prototype.replace),So=RegExp.prototype.exec,bo=So,Vo=Ve("".charAt),wo=Ve("".indexOf),Eo=Ve("".replace),Ao=Ve("".slice),Mo=(fo=/b*/g,Re(So,po=/a/,"a"),Re(So,fo,"a"),0!==po.lastIndex||0!==fo.lastIndex),Io=to.BROKEN_CARET,Po=void 0!==/()??/.exec("")[1];(Mo||Po||Io||go||Co)&&(bo=function(e){var t,r,o,i,n,a,s,c=this,u=mo(c),l=Jr(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=Re(bo,d,l),c.lastIndex=d.lastIndex,t;var T=u.groups,h=Io&&c.sticky,p=Re(Xr,c),f=c.source,v=0,R=l;if(h&&(p=Eo(p,"y",""),-1===wo(p,"g")&&(p+="g"),R=Ao(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Vo(l,c.lastIndex-1))&&(f="(?: "+f+")",R=" "+R,v++),r=new RegExp("^(?:"+f+")",p)),Po&&(r=new RegExp("^"+f+"$(?!\\s)",p)),Mo&&(o=c.lastIndex),i=Re(So,h?r:c,R),h?i?(i.input=Ao(i.input,v),i[0]=Ao(i[0],v),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:Mo&&i&&(c.lastIndex=c.global?i.index+i[0].length:o),Po&&i&&i.length>1&&Re(yo,i[0],r,(function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(i[n]=void 0)})),i&&T)for(i.groups=a=vo(null),n=0;n<T.length;n++)a[(s=T[n])[0]]=i[s[1]];return i});var Lo=bo;jr({target:"RegExp",proto:!0,forced:/./.exec!==Lo},{exec:Lo});var Oo="\t\n\v\f\r                 \u2028\u2029\ufeff",Do=Ve("".replace),ko=RegExp("^["+Oo+"]+"),xo=RegExp("(^|[^"+Oo+"])["+Oo+"]+$"),Fo=function(e){return function(t){var r=Jr(De(t));return 1&e&&(r=Do(r,ko,"")),2&e&&(r=Do(r,xo,"$1")),r}},Bo={start:Fo(1),end:Fo(2),trim:Fo(3)}.trim,Qo=Ve("".charAt),No=Te.parseFloat,jo=Te.Symbol,Uo=jo&&jo.iterator,Wo=1/No(Oo+"-0")!=-Infinity||Uo&&!he((function(){No(Object(Uo))}))?function(e){var t=Bo(Jr(e)),r=No(t);return 0===r&&"-"===Qo(t,0)?-0:r}:No;jr({global:!0,forced:parseFloat!==Wo},{parseFloat:Wo});var Go=function(e){if("Function"===Ae(e))return Ve(e)},Ho=yt("species"),Ko=RegExp.prototype,Yo=Ve("".charAt),zo=Ve("".charCodeAt),qo=Ve("".slice),Jo=function(e){return function(t,r){var o,i,n=Jr(De(t)),a=vr(r),s=n.length;return a<0||a>=s?e?"":void 0:(o=zo(n,a))<55296||o>56319||a+1===s||(i=zo(n,a+1))<56320||i>57343?e?Yo(n,a):o:e?qo(n,a,a+2):i-56320+(o-55296<<10)+65536}},Xo={codeAt:Jo(!1),charAt:Jo(!0)}.charAt,$o=function(e,t,r){return t+(r?Xo(e,t).length:1)},Zo=TypeError,ei=function(e,t){var r=e.exec;if(Qe(r)){var o=Re(r,e,t);return null!==o&&xt(o),o}if("RegExp"===Ae(e))return Re(Lo,e,t);throw Zo("RegExp#exec called on incompatible receiver")};!function(e,t,r,o){var i=yt(e),n=!he((function(){var t={};return t[i]=function(){return 7},7!==""[e](t)})),a=n&&!he((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Ho]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!n||!a||r){var s=Go(/./[i]),c=t(i,""[e],(function(e,t,r,o,i){var a=Go(e),c=t.exec;return c===Lo||c===Ko.exec?n&&!i?{done:!0,value:s(t,r,o)}:{done:!0,value:a(r,t,o)}:{done:!1}}));Tr(String.prototype,e,c[0]),Tr(Ko,i,c[1])}o&&Gt(Ko[i],"sham",!0)}("match",(function(e,t,r){return[function(t){var r=De(this),o=Le(t)?void 0:it(t,e);return o?Re(o,t,r):new RegExp(t)[e](Jr(r))},function(e){var o=xt(this),i=Jr(e),n=r(t,o,i);if(n.done)return n.value;if(!o.global)return ei(o,i);var a=o.unicode;o.lastIndex=0;for(var s,c=[],u=0;null!==(s=ei(o,i));){var l=Jr(s[0]);c[u]=l,""===l&&(o.lastIndex=$o(i,Cr(o.lastIndex),a)),u++}return 0===u?null:c}]}));var ti=Array.isArray||function(e){return"Array"===Ae(e)},ri=TypeError,oi=function(e){if(e>9007199254740991)throw ri("Maximum allowed index exceeded");return e},ii=function(e,t,r){var o=wt(t);o in e?Wt.f(e,o,me(0,r)):e[o]=r},ni=function(){},ai=[],si=Ue("Reflect","construct"),ci=/^\s*(?:class|function)\b/,ui=Ve(ci.exec),li=!ci.exec(ni),di=function(e){if(!Qe(e))return!1;try{return si(ni,ai,e),!0}catch(t){return!1}},Ti=function(e){if(!Qe(e))return!1;switch(zr(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return li||!!ui(ci,Zt(e))}catch(t){return!0}};Ti.sham=!0;var hi,pi=!si||he((function(){var e;return di(di.call)||!di(Object)||!di((function(){e=!0}))||e}))?Ti:di,fi=yt("species"),vi=Array,Ri=function(e,t){return new(function(e){var t;return ti(e)&&(t=e.constructor,(pi(t)&&(t===vi||ti(t.prototype))||je(t)&&null===(t=t[fi]))&&(t=void 0)),void 0===t?vi:t}(e))(0===t?0:t)},gi=yt("species"),_i=yt("isConcatSpreadable"),Ci=qe>=51||!he((function(){var e=[];return e[_i]=!1,e.concat()[0]!==e})),mi=function(e){if(!je(e))return!1;var t=e[_i];return void 0!==t?!!t:ti(e)};jr({target:"Array",proto:!0,arity:1,forced:!(Ci&&(hi="concat",qe>=51||!he((function(){var e=[];return(e.constructor={})[gi]=function(){return{foo:1}},1!==e[hi](Boolean).foo}))))},{concat:function(e){var t,r,o,i,n,a=Tt(this),s=Ri(a,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(mi(n=-1===t?a:arguments[t]))for(i=mr(n),oi(c+i),r=0;r<i;r++,c++)r in n&&ii(s,c,n[r]);else oi(c+1),ii(s,c++,n);return s.length=c,s}});var yi=window.navigator&&window.navigator.userAgent||"",Si=/AppleWebKit\/([\d.]+)/i.exec(yi);Si&&parseFloat(Si.pop());var bi=/iPad/i.test(yi),Vi=/iPhone/i.test(yi)&&!bi,wi=/iPod/i.test(yi),Ei=Vi||bi||wi,Ai=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(yi);Ei&&function(){var e=yi.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var Mi=/Android/i.test(yi);Mi&&function(){var e=yi.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),r=e[2]&&parseFloat(e[2]);t&&r&&parseFloat("".concat(e[1],".").concat(e[2]))}();Mi&&/webkit/i.test(yi),/Firefox/i.test(yi)&&function(){var e=yi.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Ii=/Edge\//i.test(yi);Ii&&function(){var e=yi.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var Pi=/Edg\//i.test(yi);Pi&&function(){var e=yi.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Li=/SogouMobileBrowser\//i.test(yi);Li&&function(){var e=yi.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Oi=/MetaSr\s/i.test(yi);Oi&&function(){var e=yi.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Di=/TBS\/\d+/i.test(yi);Di&&function(){var e=yi.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var ki=/XWEB\/\d+/i.test(yi);ki&&function(){var e=yi.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(yi),/MSIE\/\d+/i.test(yi)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(yi),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(yi)&&/rv:11.0/.test(yi)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(yi)&&function(){var e=yi.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var xi=!Di&&/MQQBrowser\/\d+/i.test(yi)&&/COVC\/\d+/i.test(yi),Fi=!Di&&/MQQBrowser\/\d+/i.test(yi)&&!/COVC\/\d+/i.test(yi);(Fi||xi)&&function(){var e=yi.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Bi=!Di&&/ QQBrowser\/\d+/i.test(yi);Bi&&function(){var e=yi.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Qi=!Di&&/QQBrowserLite\/\d+/i.test(yi);Qi&&function(){var e=yi.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var Ni=!Di&&/MQBHD\/\d+/i.test(yi);Ni&&function(){var e=yi.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(yi),!Ei&&/MAC OS X/i.test(yi),!Mi&&/Linux/i.test(yi),/MicroMessenger/i.test(yi),/UCBrowser/i.test(yi),/Electron/i.test(yi);var ji=/MiuiBrowser/i.test(yi);ji&&function(){var e=yi.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Ui=/HuaweiBrowser/i.test(yi);/Huawei/i.test(yi),Ui&&function(){var e=yi.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Wi=/SamsungBrowser/i.test(yi);Wi&&function(){var e=yi.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Gi=/HeyTapBrowser/i.test(yi);Gi&&function(){var e=yi.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Hi=/VivoBrowser/i.test(yi);Hi&&function(){var e=yi.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Ki,Yi,zi,qi=/Chrome/i.test(yi),Ji=!Ii&&!Oi&&!Li&&!Di&&!ki&&!Pi&&!Bi&&!ji&&!Ui&&!Wi&&!Gi&&!Hi&&/Chrome/i.test(yi);Ji&&function(){var e=yi.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),Ji&&function(){var e=yi.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!qi&&!Fi&&!xi&&!Qi&&!Ni&&/Safari/i.test(yi)&&function(){var e=yi.match(/Version\/([\d.]+)/);e&&e[1]&&e[1]}(),"file:"===location.protocol||"localhost"===location.hostname||/^\d+\.\d+\.\d+\.\d+$/.test(location.hostname),function(e){e.LIVE="live",e.RTC="rtc"}(Ki||(Ki={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(Yi||(Yi={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(zi||(zi={}));var Xi={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},$i={code:-1005,message:"not supported"},Zi="2.4.2-beta.2",en=function(){function e(e,t){if(this.logRegion="tc",this.loggerManager=e,t){var r=t.sdkAppId,o=t.userId,i=t.seq;this.seq=i,e&&(this.logger=e.createLogger({id:"".concat(this.logRegion).concat(i),userId:o,sdkAppId:r}))}else this.logger=e;this.logger||(this.logger={debug:function(e){console.debug(e)},info:function(e){console.info(e)},warn:function(e){console.warn(e)},error:function(e){console.error(e)}})}return e.prototype.getLogMessage=function(e){var t=this;return e.map((function(e){return t.getStringifyMessage(e)})).join(" ")},e.prototype.getStringifyMessage=function(e){var t=this;if("object"!=typeof e)return e;if(e instanceof HTMLElement)return"".concat(e.tagName.toLocaleLowerCase(),"#").concat(e.id);if(e instanceof Array){var r=[];return Object.keys(e).forEach((function(o){return r[o]=t.getStringifyMessage(e[o])})),JSON.stringify(r)}if(e instanceof Object){var o={};return Object.keys(e).forEach((function(r){return o[r]=t.getStringifyMessage(e[r])})),JSON.stringify(o)}return e},e.prototype.update=function(e){var t=e.userId,r=e.sdkAppId;this.loggerManager&&this.loggerManager.createLogger&&(this.logger=this.loggerManager.createLogger({id:"".concat(this.logRegion).concat(this.seq),userId:t,sdkAppId:r}))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.getLogMessage(e);this.logger.debug(r)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.getLogMessage(e);this.logger&&this.logger.info&&this.logger.info(r)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.getLogMessage(e);this.logger&&this.logger.warn&&this.logger.warn(r)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.getLogMessage(e);this.logger&&this.logger.error&&this.logger.error(r)},e}(),tn=null,rn=i.default._loggerManager;rn.info("TRTCCloud Version: ".concat(Zi));var on="trtcCloud",nn=1,an=function(t){function o(r){void 0===r&&(r={});var o=t.call(this)||this;o._version="",o._frameWorkType=30,o._component=0,o._language=0,o._networkProxy={},o._localView=null,o._autoRecvAudio=!0,o._autoRecvVideo=!0,o._localTestView=null,o._isVideoPublish=!0,o._localRenderParams={rotation:e.TRTCVideoRotation.TRTCVideoRotation0,fillMode:e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,mirrorType:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto},o._videoProfile={},o._videoPlayOption={},o._isAudioPublish=!0,o._audioProfile=i.default.TYPE.AUDIO_PROFILE_STANDARD,o._isSharingScreen=!1,o._remoteStreamConfig=new Map,o._remoteStreamMap=new Map,o._cameraList=[],o._microphoneList=[],o._speakerList=[],o._currentCamera={},o._currentMicrophone={},o._currentSpeaker={},o._currentCameraId="",o._currentMicrophoneId="",o._currentSpeakerId="",o._screenShareParams={option:{}},o._isMobile=Ai,o._isFrontCamera=!0,o._smallStreamVideoProfile=void 0,o._qosPreference=void 0,o._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},o._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},o._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},o._isVirtualBackground=!1,o._version=Zi;var n,a,s,c=r.frameWorkType,u=void 0===c?30:c,l=r.component,d=void 0===l?0:l,T=r.language,h=void 0===T?0:T;return o._frameWorkType=u,o._component=d,o._language=h,o._trtc=i.default.create(),o._testTrtc=i.default.create(),o._log=i.default._loggerManager,o.logger=new en(rn,{seq:nn++}),o._echoCancellation=void 0,o._noiseSuppression=void 0,o._autoGainControl=void 0,o._addTRTCEvents(),o.handleDeviceChange=o.handleDeviceChange.bind(o),navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(n=o.handleDeviceChange,a=30,function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];s>0&&clearTimeout(s),s=window.setTimeout((function(){n.apply(e,t),s=-1}),a)})),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(o,t),o.getTRTCShareInstance=function(e){return tn||(tn=new o(e)),tn},o.setLogLevel=function(t,r){var o,n=((o={})[e.TRTCLogLevel.TRTCLogLevelVerbose]=0,o[e.TRTCLogLevel.TRTCLogLevelDebug]=1,o[e.TRTCLogLevel.TRTCLogLevelInfo]=2,o[e.TRTCLogLevel.TRTCLogLevelWarn]=3,o[e.TRTCLogLevel.TRTCLogLevelError]=4,o[e.TRTCLogLevel.TRTCLogLevelFatal]=4,o[e.TRTCLogLevel.TRTCLogLevelNone]=5,o),a=n[t];ae(a)&&(a=n[e.TRTCLogLevel.TRTCLogLevelInfo]);var s=!ce(r)||r;i.default.setLogLevel(a,s)},o.prototype.destroyTRTCShareInstance=function(){tn&&(this._removeTRTCEvents(),tn._destroy(),tn=null)},o.prototype.getSDKVersion=function(){return this._version||""},o.prototype.enterRoom=function(e,t){return s(this,void 0,Promise,(function(){var r,o,i,n,s,u,l,d,T,h,p,f,v,R,g,_;return c(this,(function(c){switch(c.label){case 0:if(r=e.sdkAppId,o=e.userId,i=e.userSig,n=e.roomId,s=e.strRoomId,u=e.role,l=e.privateMapKey,d=e.businessInfo,T=e.enableAutoPlayDialog,h=e.proxy,p=e.streamId,f=e.userDefineRecordId,this.logger.update({sdkAppId:r,userId:o}),this.logger.info("".concat(on,".enterRoom with params: "),e,t),h&&(this._networkProxy=h),!(r&&o&&i))return[3,5];c.label=1;case 1:return c.trys.push([1,3,,4]),v={sdkAppId:r,userId:o,userSig:i,roomId:n,strRoomId:s,role:re[u],scene:oe[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},v=l?a(a({},v),{privateMapKey:l}):v,v=d?a(a({},v),{businessInfo:d}):v,v=T?a(a({},v),{enableAutoPlayDialog:T}):v,v=this._networkProxy?a(a({},v),{proxy:this._networkProxy}):v,v=p?a(a({},v),{streamId:p}):v,v=f?a(a({},v),{userDefineRecordId:f}):v,R=ne(),[4,this._trtc.enterRoom(v)];case 2:return c.sent(),g=ne()-R,this.emit("onEnterRoom",g),[3,4];case 3:return _=c.sent(),this.emit("onEnterRoom",-1),this._callFunctionErrorManage(_,"enterRoom"),[3,4];case 4:return[3,6];case 5:this._emitError(Xi),c.label=6;case 6:return[2]}}))}))},o.prototype.exitRoom=function(){return s(this,void 0,Promise,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),this.logger.info("".concat(on,".exitRoom")),this._isSharingScreen?[4,this.stopScreenShare()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.resetTRTCCloud(),[4,this._trtc.exitRoom()];case 3:return t.sent(),this.emit("onExitRoom",zi.exitRoom),[3,5];case 4:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,5];case 5:return[2]}}))}))},o.prototype.switchRole=function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(on,".switchRole with param: "),e),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.switchRole(re[e])];case 2:return r.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(re[e])),[3,4];case 3:return t=r.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),[3,4];case 4:return[2]}}))}))},o.prototype.setDefaultStreamRecvMode=function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this.logger.info("".concat(on,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),ce(e)&&(this._autoRecvAudio=e),ce(t)&&(this._autoRecvVideo=t),[2]}))}))},o.prototype.resetTRTCCloud=function(){this._setIsAudioPublish(!0),this._echoCancellation=void 0,this._noiseSuppression=void 0,this._autoGainControl=void 0,this._isVirtualBackground=!1},o.prototype._updateLocalVideo=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype._updateLocalTestVideo=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype._updateLocalScreen=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype._updateRemoteVideo=function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(e,t))];case 1:return o.sent(),[3,3];case 2:if((r=o.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw r;case 3:return[2]}}))}))},o.prototype.startLocalPreview=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return s(this,void 0,Promise,(function(){var r,o,n,a,s,l,d,T;return c(this,(function(c){switch(c.label){case 0:this.logger.info("".concat(on,".startLocalPreview with params: "),t),1===u([],t,!0).length?o=u([],t,!0)[0]:2===u([],t,!0).length&&(T=u([],t,!0),r=T[0],o=T[1]),ae(r)||(this._setIsMobile(!0),this._setIsFrontCamera(r)),this._setLocalView(o),c.label=1;case 1:c.trys.push([1,8,,9]),c.label=2;case 2:return c.trys.push([2,4,,7]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return c.sent(),[3,7];case 4:return(n=c.sent()).code!==i.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return c.sent(),[2];case 6:throw n;case 7:return this.emit("onCameraDidReady"),a=this._getVideoProfile(),s=a.width,l=a.height,this.emit("onFirstVideoFrame","",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,s,l),[3,9];case 8:return d=c.sent(),this._callFunctionErrorManage(d,"startLocalPreview"),[3,9];case 9:return[2]}}))}))},o.prototype.updateLocalView=function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(on,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},o.prototype.stopLocalPreview=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(on,".stopLocalPreview")),t.label=1;case 1:return t.trys.push([1,3,,4]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.warn("".concat(on," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},o.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(on,".muteLocalVideo with params: "),e),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),[3,4];case 4:return[2]}}))}))},o.prototype.startRemoteView=function(t,r,o){return s(this,void 0,void 0,(function(){var n,a;return c(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(on,".startRemoteView with params: "),t,r,o),s.label=1;case 1:if(s.trys.push([1,8,,9]),this._setRemoteStreamConfig(t,o,{view:r,small:o===e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(o))))return[2];s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,o))];case 3:return s.sent(),[3,7];case 4:return(n=s.sent()).code!==i.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateRemoteVideo(t,o)];case 5:return s.sent(),[2];case 6:throw n;case 7:return this.emit("onFirstVideoFrame",t,o,0,0),[3,9];case 8:return a=s.sent(),this._callFunctionErrorManage(a,"startRemoteView"),[3,9];case 9:return[2]}}))}))},o.prototype.updateRemoteView=function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(on,".updateRemoteView with params: "),e,t,r),this._setRemoteStreamConfig(e,r,{view:t}),this._remoteStreamMap.get("".concat(e,"_").concat(this._getTRTCStreamType(r)))?[4,this._updateRemoteVideo(e,r)]:[2];case 1:return o.sent(),[2]}}))}))},o.prototype.stopRemoteView=function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(on,".stopRemoteView with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 2:return o.sent(),[3,4];case 3:return r=o.sent(),this._callFunctionErrorManage(r,"stopRemoteView"),[3,4];case 4:return[2]}}))}))},o.prototype.stopAllRemoteView=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(on,".stopAllRemoteView")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),[3,4];case 4:return[2]}}))}))},o.prototype.setVideoEncoderParam=function(e){return s(this,void 0,void 0,(function(){var t,r;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(on,".setVideoEncoderParam with params: "),e),o.label=1;case 1:return o.trys.push([1,4,,5]),t=this._getTRTCVideoProfile("video",e),this._setVideoProfile(t),[4,this._updateLocalVideo()];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),[3,5];case 4:return r=o.sent(),this._callFunctionErrorManage(r,"setVideoEncoderParam"),[3,5];case 5:return[2]}}))}))},o.prototype.setNetworkQosParam=function(e){return s(this,void 0,void 0,(function(){var t,r,o=this;return c(this,(function(i){return this.logger.info("".concat(on,".setNetworkQosParam with params: "),e),t=e.preference,r=this._getTRTCQosPreference(t),this._setQosPreference(r),this._setScreenShareParams({qosPreference:r}),[2,new Promise((function(e,t){Promise.all([o._updateLocalVideo(),o._updateLocalScreen()]).then((function(){e(!0)})).catch((function(e){o._callFunctionErrorManage(e,"setNetworkQosParam"),t(e)}))}))]}))}))},o.prototype.setLocalRenderParams=function(e){return s(this,void 0,void 0,(function(){var t,r;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(on,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),o.label=1;case 1:return o.trys.push([1,4,,5]),t={},e.mirrorType&&(t.mirror=this._getTRTCMirror(e.mirrorType)),e.fillMode&&(t.fillMode=this._getTRTCFillMode(e.fillMode)),this._setVideoPlayOption(t),[4,this._updateLocalVideo()];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),[3,5];case 4:return r=o.sent(),this._callFunctionErrorManage(r,"setLocalRenderParams"),[3,5];case 5:return[2]}}))}))},o.prototype.setRemoteRenderParams=function(e,t,r){return s(this,void 0,void 0,(function(){var o;return c(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(on,".setRemoteRenderParams with params: "),e,t,r),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,r),[4,this._updateRemoteVideo(e,t)];case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),[3,4];case 4:return[2]}}))}))},o.prototype._updateLocalAudio=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype._updateLocalTestAudio=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),s(this,void 0,void 0,(function(){var r,o,n;return c(this,(function(a){switch(a.label){case 0:t===e.TRTCAudioQuality.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(on,".startLocalAudio with params: "),t),r=this._getTRTCAudioQuality(t),a.label=1;case 1:a.trys.push([1,8,,9]),this._setAudioProfile(r),a.label=2;case 2:return a.trys.push([2,4,,7]),[4,this._trtc.startLocalAudio(this._generateLocalAudioData())];case 3:return a.sent(),[3,7];case 4:return(o=a.sent()).code!==i.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalAudio()];case 5:return a.sent(),[2];case 6:throw o;case 7:return this.emit("onMicDidReady"),[3,9];case 8:return n=a.sent(),console.warn("".concat(on," startLocalAudio error: ").concat(n)),this._callFunctionErrorManage(n,"startLocalAudio"),[3,9];case 9:return[2]}}))}))},o.prototype.stopLocalAudio=function(){return s(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(on,".stopLocalAudio")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopLocalAudio()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),[3,4];case 4:return[2]}}))}))},o.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(on,".muteLocalAudio with params: "),e),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setIsAudioPublish(!e),[4,this._updateLocalAudio()];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),[3,4];case 4:return[2]}}))}))},o.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),s(this,void 0,void 0,(function(){var r;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(on,".muteRemoteAudio with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),e?[4,this._trtc.muteRemoteAudio(e,t)]:(this._emitError(Xi),[2]);case 2:return o.sent(),[3,4];case 3:return r=o.sent(),this._callFunctionErrorManage(r,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},o.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(on,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},o.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(on,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(r){this._callFunctionErrorManage(r,"setRemoteAudioVolume")}},o.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(on,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},o.prototype.enableSmallVideoStream=function(e,t){return s(this,void 0,Promise,(function(){var r;return c(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(on,".enableSmallVideoStream with params: "),e,t),e?(r=this._getTRTCVideoProfile("small",t),this._setSmallStreamVideoProfile(r)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return o.sent(),[2]}}))}))},o.prototype.snapshotVideo=function(t,r){var o="";return o=""===t&&r===e.TRTCVideoStreamType.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===t&&r===e.TRTCVideoStreamType.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(r)}):this._trtc.getVideoSnapshot({userId:t,streamType:this._getTRTCStreamType(r)}),this.emit("onSnapshotComplete",t,r,o),o},o.prototype.startScreenShare=function(t,r,o){return s(this,void 0,void 0,(function(){var n,a,s,u,l,d,T,h;return c(this,(function(c){switch(c.label){case 0:this.logger.info("".concat(on,".startScreenShare with params: "),t,r,o),c.label=1;case 1:return c.trys.push([1,3,,4]),a=(n=o||{}).screenAudio,s=void 0!==a&&a,u=n.videoTrack,l=this._getTRTCVideoProfile("screen",o),this._setScreenShareParams({view:t,profile:l,systemAudio:s,videoTrack:u}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return c.sent(),this._isSharingScreen=!0,d=l.width,T=l.height,this.emit("onFirstVideoFrame","",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,d,T),[3,4];case 3:if((h=c.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw console.error("Start share screen error:",h,h.code,h.name,h.message),h;case 4:return[2]}}))}))},o.prototype.setSubStreamEncoderParam=function(e){return s(this,void 0,void 0,(function(){var t,r;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(on,".setSubStreamEncoderParam with params: "),e),t=this._getTRTCVideoProfile("screen",e),this._setScreenShareParams({profile:t}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._updateLocalScreen()];case 2:return o.sent(),[3,4];case 3:return r=o.sent(),this._callFunctionErrorManage(r,"setSubStreamEncoderParam"),[3,4];case 4:return[2]}}))}))},o.prototype.stopScreenShare=function(){return s(this,void 0,Promise,(function(){var e;return c(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(on,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",0),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),[3,4];case 4:return[2]}}))}))},o.prototype.startScreenCapture=function(){this._emitError($i)},o.prototype.pauseScreenCapture=function(){this._emitError($i)},o.prototype.resumeScreenCapture=function(){this._emitError($i)},o.prototype.getScreenCaptureSources=function(){this._emitError($i)},o.prototype.selectScreenCaptureTarget=function(){this._emitError($i)},o.prototype.getCameraDevicesList=function(){return s(this,void 0,Promise,(function(){var e,t,r;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(on,".getCameraDevicesList")),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i.default.getCameraList()];case 2:return e=o.sent(),t=e.map((function(e){return a(a({},e),{deviceName:e.label})})),this._cameraList=e,"{}"===JSON.stringify(this._currentCamera)&&(this._currentCamera=this.getDefaultDeviceInfo(e),this._currentCameraId=this._currentCamera.deviceId),[2,Promise.resolve(t)];case 3:return r=o.sent(),this._callFunctionErrorManage(r,"getCameraDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},o.prototype.setCurrentCameraDevice=function(e){return s(this,void 0,Promise,(function(){var t;return c(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(on,".setCurrentCameraDevice with params: "),{cameraId:e}),r.label=1;case 1:return r.trys.push([1,4,,5]),e?(this._currentCameraId=e,this._currentCamera=this._cameraList.find((function(t){return t.deviceId===e}))||{},[4,this._updateLocalVideo()]):[2,!1];case 2:return r.sent(),[4,this._updateLocalTestVideo()];case 3:return r.sent(),[2,!0];case 4:return t=r.sent(),this._callFunctionErrorManage(t,"setCurrentCameraDevice"),[2,!1];case 5:return[2]}}))}))},o.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(on,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,r=e.label,o=e.kind,i=e.groupId;return new S(t,r,o,r,i)},o.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},o.prototype.switchCamera=function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return this.logger.info("".concat(on,".switchCamera with params: "),e),this._setIsFrontCamera(e),(t=this._getVideoPlayOption()).mirror=this._getTRTCMirror(this._localRenderParams.mirrorType),this._setVideoPlayOption(t),[4,this._updateLocalVideo()];case 1:return r.sent(),[2]}}))}))},o.prototype._onVirtualBackgroundError=function(e){this._emitWarning(e)},o.prototype.setVirtualBackground=function(e){return s(this,void 0,void 0,(function(){var t,r,o,i,n;return c(this,(function(s){switch(s.label){case 0:return s.trys.push([0,13,,14]),t=e.enable,r=e.type,o=e.blurLevel,i=e.imagePath,t?this._isVirtualBackground?r!==ee?[3,3]:[4,this._trtc.updatePlugin(Z,{type:r,blurLevel:o})]:[3,7]:[3,11];case 1:return s.sent(),[4,this._testTrtc.updatePlugin(Z,{type:r,blurLevel:o})];case 2:s.sent(),s.label=3;case 3:return r!==te?[3,6]:[4,this._trtc.updatePlugin(Z,{type:r,src:i})];case 4:return s.sent(),[4,this._testTrtc.updatePlugin(Z,{type:r,src:i})];case 5:s.sent(),s.label=6;case 6:return[3,10];case 7:return[4,this._trtc.startPlugin(Z,a(a({},e),{src:i,onError:this._onVirtualBackgroundError}))];case 8:return s.sent(),[4,this._testTrtc.startPlugin(Z,a(a({},e),{src:i,onError:this._onVirtualBackgroundError}))];case 9:s.sent(),this._isVirtualBackground=!0,s.label=10;case 10:return[3,12];case 11:this._trtc.stopPlugin(Z),this._testTrtc.stopPlugin(Z),this._isVirtualBackground=!1,s.label=12;case 12:return[3,14];case 13:throw n=s.sent(),this.logger.error("".concat(on,".setVirtualBackground fail: "),n),n;case 14:return[2]}}))}))},o.prototype.useVirtualBackground=function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:r.VirtualBackground,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:r.VirtualBackground,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},o.prototype.getMicDevicesList=function(){return s(this,void 0,Promise,(function(){var e,t,r;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(on,".getMicDevicesList")),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i.default.getMicrophoneList()];case 2:return e=o.sent(),t=e.map((function(e){return a(a({},e),{deviceName:e.label})})),this._microphoneList=e,"{}"===JSON.stringify(this._currentMicrophone)&&(this._currentMicrophone=this.getDefaultDeviceInfo(e),this._currentMicrophoneId=this._currentMicrophone.deviceId),[2,Promise.resolve(t)];case 3:return r=o.sent(),this._callFunctionErrorManage(r,"getMicDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},o.prototype.setCurrentMicDevice=function(e){return s(this,void 0,Promise,(function(){var t;return c(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(on,".setCurrentMicDevice with params: "),{micId:e}),r.label=1;case 1:return r.trys.push([1,4,,5]),e?(this._setCurrentMicrophoneId(e),this._currentMicrophone=this._microphoneList.find((function(t){return t.deviceId===e}))||{},[4,this._updateLocalAudio()]):[2,!1];case 2:return r.sent(),[4,this._updateLocalTestAudio()];case 3:return r.sent(),[2,!0];case 4:return t=r.sent(),this._callFunctionErrorManage(t,"setCurrentMicDevice"),[2,!1];case 5:return[2]}}))}))},o.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(on,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,r=e.label,o=e.kind,i=e.groupId;return new S(t,r,o,r,i)},o.prototype.getSpeakerDevicesList=function(){return s(this,void 0,Promise,(function(){var e,t,r;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(on,".getSpeakerDevicesList")),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i.default.getSpeakerList()];case 2:return e=o.sent(),t=e.map((function(e){return a(a({},e),{deviceName:e.label})})),this._speakerList=e,"{}"===JSON.stringify(this._currentSpeaker)&&(this._currentSpeaker=this.getDefaultDeviceInfo(e),this._currentSpeakerId=this._currentSpeaker.deviceId),[2,Promise.resolve(t)];case 3:return r=o.sent(),this._callFunctionErrorManage(r,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},o.prototype.setCurrentSpeakerDevice=function(e){return s(this,void 0,Promise,(function(){var t;return c(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(on,".setCurrentSpeakerDevice with params: "),{speakerId:e}),r.label=1;case 1:return r.trys.push([1,3,,4]),e?(this._setCurrentSpeakerId(e),this._currentSpeaker=this._speakerList.find((function(t){return t.deviceId===e}))||{},[4,i.default.setCurrentSpeaker(e)]):[2,!1];case 2:return r.sent(),[2,!0];case 3:return t=r.sent(),this._callFunctionErrorManage(t,"setCurrentSpeakerDevice"),[2,!1];case 4:return[2]}}))}))},o.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(on,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,r=e.label,o=e.kind,i=e.groupId;return new S(t,r,o,r,i)},o.prototype.startCameraDeviceTest=function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(on,".startCameraDeviceTest with params: "),e),!e)return[2];this._setLocalTestView(e),r.label=1;case 1:return r.trys.push([1,3,,6]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return r.sent(),[3,6];case 3:return(t=r.sent()).code!==i.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return r.sent(),[2];case 5:throw t;case 6:return[2]}}))}))},o.prototype.stopCameraDeviceTest=function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(on,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},o.prototype.startMicDeviceTest=function(e){return s(this,void 0,void 0,(function(){var t,r=this;return c(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(on,".startMicDeviceTest with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,6]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return o.sent(),[3,6];case 3:return(t=o.sent()).code!==i.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return o.sent(),[2];case 5:throw t;case 6:return this._testTrtc.on(i.default.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,o=e.volume;""===t&&r.emit("onTestMicVolume",o)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(e)];case 7:return o.sent(),[2]}}))}))},o.prototype.stopMicDeviceTest=function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(on,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},o.prototype.callExperimentalAPI=function(e){return s(this,void 0,void 0,(function(){var t,r,o;return c(this,(function(i){switch(i.label){case 0:if(this.logger.info("".concat(on,".callExperimentalAPI"),e),t=function(e){if("string"!=typeof e)return e;var t;try{var r=JSON.parse(e);t="object"==typeof r&&r?r:e}catch(o){t=e}return t}(e),t===e)return[2];if(r=t.api,o=t.params,!r||!o)return[2];i.label=1;case 1:switch(i.trys.push([1,12,,13]),r){case"setFramework":return[3,2];case"enableAudioAEC":return[3,3];case"enableAudioANS":return[3,4];case"enableAudioAGC":return[3,5];case"KeyMetricsStats":return[3,6];case"setNetworkProxy":return[3,7];case"enableVirtualBackground":return[3,8]}return[3,10];case 2:return this._handleSetFrameWork(o),[3,11];case 3:return this._echoCancellation=Boolean(o.enable),[3,11];case 4:return this._noiseSuppression=Boolean(o.enable),[3,11];case 5:return this._autoGainControl=Boolean(o.enable),[3,11];case 6:return this._handleKeyMetricsStats(o),[3,11];case 7:return this._networkProxy=o,[3,11];case 8:return[4,this.setVirtualBackground(o)];case 9:return i.sent(),[3,11];case 10:return[3,11];case 11:return[3,13];case 12:throw i.sent();case 13:return[2]}}))}))},o.prototype._handleSetFrameWork=function(e){var t=e.frameWork,r=e.component,o=e.language;se(t)&&(this._frameWorkType=t),se(r)&&(this._component=r),se(o)&&(this._language=o)},o.prototype._handleKeyMetricsStats=function(e){var t=e.key,r=e.opt,o=e.value,n=e.version,a=r===ie;i.default._addKVStat({option:{type:r,key:t,value:o,version:n,useUV:a,base:100}})},o.prototype._unbindEvents=function(){},o.prototype._destroy=function(){this._unbindEvents()},o.prototype._emitError=function(e){e&&this.emit&&this.emit(q,e.code,e.message)},o.prototype._emitWarning=function(e){this.emit&&this.emit(J,e)},o.prototype._callFunctionErrorManage=function(e,t){var r=e.code,o=e.extraCode;if(!e||r!==i.default.ERROR_CODE.OPERATION_ABORT){if(this.logger.warn("(".concat(t,") failed - ").concat(r," - ").concat(e.message)),e&&o&&e.code===i.default.ERROR_CODE.DEVICE_ERROR&&5303===o)r=-1316;this.emit(q,r,e.message)}},o.prototype._getTRTCResolution=function(t){var r=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(r.length>1&&r[1]),height:+(r.length>2&&r[2])}},o.prototype._getTRTCVideoProfile=function(t,r){var o=r.videoResolution,i=r.videoFps,n=r.videoBitrate,a=r.resMode,s={};switch(t){case"screen":s=this._defaultScreenProfile;break;case"small":s=this._defaultSmallVideoProfile;break;default:s=this._defaultVideoProfile}if(!ae(o)){var c=this._getTRTCResolution(o);s.width=c.width,s.height=c.height}if(!ae(a)&&a===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait){var u=s.height,l=s.width;s.width=u,s.height=l}return i&&(s.frameRate=i),n&&(s.bitrate=n),s},o.prototype._getTRTCStreamType=function(t){var r;return((r={})[e.TRTCVideoStreamType.TRTCVideoStreamTypeBig]=i.default.TYPE.STREAM_TYPE_MAIN,r[e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall]=i.default.TYPE.STREAM_TYPE_MAIN,r[e.TRTCVideoStreamType.TRTCVideoStreamTypeSub]=i.default.TYPE.STREAM_TYPE_SUB,r)[t]},o.prototype._getTRTCFillMode=function(t){var r;return((r={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=Yi.COVER,r[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=Yi.CONTAIN,r)[t]},o.prototype._getTRTCMirror=function(t){var r;return t===e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((r={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,r[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,r)[t]},o.prototype._getTRTCQosPreference=function(t){var r;return((r={})[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceSmooth]=i.default.TYPE.QOS_PREFERENCE_SMOOTH,r[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear]=i.default.TYPE.QOS_PREFERENCE_CLEAR,r)[t]},o.prototype._getTRTCAudioQuality=function(t){var r;return((r={})[e.TRTCAudioQuality.TRTCAudioQualitySpeech]=i.default.TYPE.AUDIO_PROFILE_STANDARD,r[e.TRTCAudioQuality.TRTCAudioQualityDefault]=i.default.TYPE.AUDIO_PROFILE_STANDARD,r[e.TRTCAudioQuality.TRTCAudioQualityMusic]=i.default.TYPE.AUDIO_PROFILE_HIGH_STEREO,r)[t]},o.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},o.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},o.prototype._getTRTCCloudQuality=function(t){return[e.TRTCQuality.TRTCQuality_Unknown,e.TRTCQuality.TRTCQuality_Excellent,e.TRTCQuality.TRTCQuality_Good,e.TRTCQuality.TRTCQuality_Poor,e.TRTCQuality.TRTCQuality_Bad,e.TRTCQuality.TRTCQuality_Vbad,e.TRTCQuality.TRTCQuality_Down][t]},o.prototype._generateLocalVideoData=function(){var e={view:this._getLocalView(),publish:this._getIsVideoPublish(),option:a({profile:this._getVideoProfile(),small:this._getSmallStreamVideoProfile()||!1},this._getVideoPlayOption())};return this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),this._getQosPreference()&&e&&Object.assign(e.option,{qosPreference:this._getQosPreference()}),e},o.prototype._generateLocalTestVideoData=function(){return{view:this._getLocalTestView(),publish:!1,option:a({cameraId:this._getCurrentCameraId(),profile:this._getVideoProfile()},this._getVideoPlayOption())}},o.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}};return ce(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),ce(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),ce(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},o.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},o.prototype._generateRemoteVideoData=function(e,t){return this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t)))},o.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(i.default.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(i.default.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(i.default.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(i.default.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(i.default.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(i.default.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(i.default.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(i.default.EVENT.AUDIO_VOLUME,(function(e){(null==e?void 0:e.result)&&t.emit("onUserVoiceVolume",null==e?void 0:e.result,((null==e?void 0:e.result)||[]).length)})),this._trtc.on(i.default.EVENT.KICKED_OUT,(function(e){var r={banned:zi.banned,room_disband:zi.roomDisband};se(r[e.reason])&&t.emit("onExitRoom",r[e.reason])})),this._trtc.on(i.default.EVENT.NETWORK_QUALITY,(function(e){var r=e.uplinkNetworkQuality,o=e.downlinkNetworkQuality,i=e.downlinkInfo,n=new L("",t._getTRTCCloudQuality(r)),a=[];i.length>0&&(a=i.map((function(e){return new L(e.userId,t._getTRTCCloudQuality(o))}))),t.emit("onNetworkQuality",n,a)})),this._trtc.on(i.default.EVENT.STATISTICS,(function(r){var o,i=r.rtt,n=r.upLoss,a=r.downLoss,s=r.bytesSent,c=r.bytesReceived,u=r.localStatistics,l=r.remoteStatistics,d={big:e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,small:e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall,sub:e.TRTCVideoStreamType.TRTCVideoStreamTypeSub},T=(null===(o=u.video)||void 0===o?void 0:o.length)>0?u.video.map((function(e){var t=new k;return t.width=e.width,t.height=e.height,t.frameRate=e.frameRate,t.videoBitrate=e.bitrate,t.audioBitrate=u.audio.bitrate||0,t.streamType=d[e.videoType],t})):[];if(0===T.length&&u.audio.bitrate>0){var h=new k;h.audioBitrate=u.audio.bitrate||0,T.push(h)}var p=[];l.forEach((function(e){var t=[],r=e.userId,o=e.audio.bitrate;if(e.video&&e.video.forEach((function(e){var i=new x;i.userId=r,i.width=e.width,i.height=e.height,i.frameRate=e.frameRate,i.videoBitrate=e.bitrate,i.audioBitrate=o||0,i.streamType=d[e.videoType],t.push(i)})),0===t.length){var i=new x;i.userId=r,i.audioBitrate=o||0,t.push(i)}p.push.apply(p,t)}));var f=new F;f.upLoss=n,f.downLoss=a,f.rtt=i,f.sentBytes=s,f.receivedBytes=c,f.localStatisticsArray=T,f.localStatisticsArraySize=T.length,f.remoteStatisticsArray=p,f.remoteStatisticsArraySize=p.length,t.emit("onStatistics",f)})),this._trtc.on(i.default.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._isSharingScreen=!1})),this._trtc.on(i.default.EVENT.PUBLISH_STATE_CHANGED,(function(r){var o=r.mediaType;"started"===r.state&&("audio"===o?t.emit("onSendFirstLocalAudioFrame"):"video"===o?t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig):"screen"===o&&t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub))}))},o.prototype._removeTRTCEvents=function(){this._trtc.off("*")},o.prototype._emitVideoAvailable=function(e,t){var r=e.userId,o=e.streamType;t?this._remoteStreamMap.set("".concat(r,"_").concat(o),!0):this._remoteStreamMap.delete("".concat(r,"_").concat(o)),o===i.default.TYPE.STREAM_TYPE_SUB?r&&this.emit("onUserSubStreamAvailable",r,t):r&&this.emit("onUserVideoAvailable",r,t)},o.prototype._setLocalView=function(e){this._localView=e},o.prototype._getLocalView=function(){return this._localView},o.prototype._setIsMobile=function(e){this._isMobile=e},o.prototype._getIsMobile=function(){return this._isMobile},o.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},o.prototype._getIsFrontCamera=function(){return this._isFrontCamera},o.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},o.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},o.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},o.prototype._getIsVideoPublish=function(){return this._isVideoPublish},o.prototype._setVideoProfile=function(e){this._videoProfile=e},o.prototype._getVideoProfile=function(){return this._videoProfile},o.prototype._setVideoPlayOption=function(e){this._videoPlayOption=e},o.prototype._getVideoPlayOption=function(){return this._videoPlayOption},o.prototype._setQosPreference=function(e){this._qosPreference=e},o.prototype._getQosPreference=function(){return this._qosPreference},o.prototype._setLocalTestView=function(e){this._localTestView=e},o.prototype._getLocalTestView=function(){return this._localTestView},o.prototype._setScreenShareParams=function(e){var t=e.view,r=e.systemAudio,o=e.fillMode,i=e.profile,n=e.videoTrack,a=e.qosPreference;ae(t)||(this._screenShareParams.view=t),ae(r)||(this._screenShareParams.option.systemAudio=r),ae(o)||(this._screenShareParams.option.fillMode=o),ae(i)||(this._screenShareParams.option.profile=i),ae(n)||(this._screenShareParams.option.videoTrack=n),ae(a)||(this._screenShareParams.option.qosPreference=a)},o.prototype._getScreenShareParams=function(){return this._screenShareParams},o.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},o.prototype._getIsAudioPublish=function(){return this._isAudioPublish},o.prototype._setAudioProfile=function(e){this._audioProfile=e},o.prototype._getAudioProfile=function(){return this._audioProfile},o.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},o.prototype._getCurrentCameraId=function(){return this._currentCameraId},o.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},o.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},o.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},o.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},o.prototype._setRemoteStreamConfig=function(t,r,o){var i=this._remoteStreamConfig.get("".concat(t,"_").concat(this._getTRTCStreamType(r)));i||(i={userId:t,streamType:this._getTRTCStreamType(r),option:{mirror:this._getTRTCMirror(e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(e.TRTCVideoFillMode.TRTCVideoFillMode_Fit)}});var n=o.view,a=o.mirrorType,s=o.fillMode,c=o.small;ae(n)||(i.view=n),ae(a)||(i.option.mirror=this._getTRTCMirror(a)),ae(s)||(i.option.fillMode=this._getTRTCFillMode(s)),ae(c)||(i.option.small=c),this._remoteStreamConfig.set("".concat(t,"_").concat(this._getTRTCStreamType(r)),i)},o.prototype.handleDeviceChange=function(){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(r){return i.default.getCameraList().then((function(r){return s(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this._cameraList.length===r.length?[2]:[4,this.deviceChangeManage(this._cameraList,r,e.TRTCDeviceType.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=r,[2]}}))}))})),i.default.getMicrophoneList().then((function(r){return s(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,r,e.TRTCDeviceType.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=r,[2]}}))}))})),i.default.getSpeakerList().then((function(r){return s(t,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,r,e.TRTCDeviceType.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=r,[2]}}))}))})),[2]}))}))},o.prototype.isSameDevice=function(e,t){var r=e&&e.deviceId&&e.groupId&&e.label,o=t&&t.deviceId&&t.groupId&&t.label;return!(!r||!o)&&(e.deviceId===t.deviceId&&e.groupId===t.groupId&&e.label===t.label)},o.prototype.deviceChangeManage=function(t,r,o){return s(this,void 0,void 0,(function(){var i,n,a,s,u;return c(this,(function(c){switch(c.label){case 0:return i=void 0,t.length!==r.length&&(n=(r||[]).map((function(e){return e.deviceId})),a=new S,t.length>r.length?(a=t.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},i=e.TRTCDeviceState.TRTCDeviceStateRemove):(n=(t||[]).map((function(e){return e.deviceId})),a=r.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},i=e.TRTCDeviceState.TRTCDeviceStateAdd),s=a.deviceId,this.emitOnDeviceChange(s,o,i)),u=this.getDefaultDeviceInfo(r),o!==e.TRTCDeviceType.TRTCDeviceTypeCamera||i!==e.TRTCDeviceState.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,u)?[2]:u.deviceId?[4,this.autoChangeDevice(o,u)]:[3,2];case 1:c.sent(),c.label=2;case 2:c.label=3;case 3:return o!==e.TRTCDeviceType.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,u)?[2]:u.deviceId?[4,this.autoChangeDevice(o,u)]:[3,5];case 4:c.sent(),c.label=5;case 5:c.label=6;case 6:return o!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,u)?[2]:u.deviceId?[4,this.autoChangeDevice(o,u)]:[3,8];case 7:c.sent(),c.label=8;case 8:c.label=9;case 9:return[2]}}))}))},o.prototype.getDefaultDeviceInfo=function(e){var t=new S;if(0===e.length)return t;var r=e.filter((function(e){return"default"===e.deviceId}));return t=r.length>0?r[0]:e[0]},o.prototype.autoChangeDevice=function(t,r){return s(this,void 0,void 0,(function(){var o,n,a,s,u;return c(this,(function(c){switch(c.label){case 0:if(o=r.deviceId,t!==e.TRTCDeviceType.TRTCDeviceTypeCamera)return[3,8];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._trtc.updateLocalVideo({option:{cameraId:o}})];case 2:return c.sent(),[3,4];case 3:return n=c.sent(),console.log("error",JSON.stringify(n)),n.code,i.default.ERROR_CODE.OPERATION_ABORT,[3,4];case 4:return c.trys.push([4,6,,7]),[4,this._testTrtc.updateLocalVideo({option:{cameraId:o}})];case 5:return c.sent(),[3,7];case 6:return a=c.sent(),console.log("testTRTC error",JSON.stringify(a)),a.code,i.default.ERROR_CODE.OPERATION_ABORT,[3,7];case 7:this._currentCameraId=o,this._currentCamera=r,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=8;case 8:if(t!==e.TRTCDeviceType.TRTCDeviceTypeMic)return[3,16];c.label=9;case 9:return c.trys.push([9,11,,12]),[4,this._trtc.updateLocalAudio({option:{microphoneId:o}})];case 10:return c.sent(),[3,12];case 11:return s=c.sent(),console.log("error",JSON.stringify(s)),s.code,i.default.ERROR_CODE.OPERATION_ABORT,[3,12];case 12:return c.trys.push([12,14,,15]),[4,this._testTrtc.updateLocalAudio({option:{microphoneId:o}})];case 13:return c.sent(),[3,15];case 14:return u=c.sent(),console.log("testTRTC error",JSON.stringify(u)),u.code,i.default.ERROR_CODE.OPERATION_ABORT,[3,15];case 15:this._currentMicrophoneId=o,this._currentMicrophone=r,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=16;case 16:return t!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,18]:[4,i.default.setCurrentSpeaker(o)];case 17:c.sent(),this._currentSpeakerId=o,this._currentSpeaker=r,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=18;case 18:return[2]}}))}))},o.prototype.emitOnDeviceChange=function(e,t,r){this.emit("onDeviceChange",e,t,r)},o}(C);e.Rect=G,e.TRTCDeviceInfo=S,e.TRTCImageBuffer=j,e.TRTCLocalStatistics=k,e.TRTCMixUser=Y,e.TRTCNetworkQosParam=N,e.TRTCParams=V,e.TRTCPublishCDNParam=D,e.TRTCQualityInfo=L,e.TRTCRemoteStatistics=x,e.TRTCRenderParams=A,e.TRTCScreenCaptureSourceInfo=W,e.TRTCStatistics=F,e.TRTCTranscodingConfig=H,e.TRTCVideoEncParam=w,e.TRTCVolumeInfo=O,e.default=an,Object.defineProperty(e,"__esModule",{value:!0})}));