trtc-cloud-js-sdk 2.10.15-beta.2 → 2.10.15
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 +3 -2
- package/trtc-cloud-js-sdk.esm.js +1 -0
- package/trtc-cloud-js-sdk.js +1 -1
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trtc-cloud-js-sdk",
|
|
3
|
-
"version": "2.10.15
|
|
3
|
+
"version": "2.10.15",
|
|
4
4
|
"description": "Tencent Cloud RTC SDK for Web And Electron",
|
|
5
5
|
"main": "trtc-cloud-js-sdk.js",
|
|
6
|
+
"module": "trtc-cloud-js-sdk.esm.js",
|
|
6
7
|
"keywords": [
|
|
7
8
|
"实时音视频",
|
|
8
9
|
"视频通话",
|
|
@@ -17,6 +18,6 @@
|
|
|
17
18
|
"author": "Tencent Cloud Client R&D Center",
|
|
18
19
|
"license": "ISC",
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"trtc-sdk-v5": "5.15.3-beta.
|
|
21
|
+
"trtc-sdk-v5": "5.15.3-beta.12"
|
|
21
22
|
}
|
|
22
23
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"trtc-sdk-v5";import{LEBPlayer as t}from"trtc-sdk-v5/plugins/lebplayer";import{VirtualBackground as i}from"trtc-sdk-v5/plugins/video-effect/virtual-background";import{BasicBeauty as o}from"trtc-sdk-v5/plugins/video-effect/basic-beauty";import{RealtimeTranscriber as r}from"trtc-sdk-v5/plugins/realtime-transcriber";import n from"trtc-sdk-v5/plugins/video-effect/video-mixer";var s=function(e,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},s(e,t)};var a=function(){return a=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function c(e,t,i,o){var r,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s}function u(e,t,i,o){return new(i||(i=Promise))((function(r,n){function s(e){try{c(o.next(e))}catch(t){n(t)}}function a(e){try{c(o.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function l(e,t){var i,o,r,n,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(a){return function(c){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;n&&(n=0,a[0]&&(s=0)),s;)try{if(i=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(c){a=[6,c],o=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function h(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],o=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t,i){if(i||2===arguments.length)for(var o,r=0,n=t.length;r<n;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function p(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=h(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=e[i]&&function(t){return new Promise((function(o,r){(function(e,t,i,o){Promise.resolve(o).then((function(t){e({value:t,done:i})}),t)})(o,r,(t=e[i](t)).done,t.value)}))}}}var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function v(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function o(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function n(e,t,o,n,s){if("function"!=typeof o)throw new TypeError("The listener must be a function");var a=new r(o,n||e,s),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function a(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,o,r=[];if(0===this._eventsCount)return r;for(o in e=this._events)t.call(e,o)&&r.push(i?o.slice(1):o);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var r=0,n=o.length,s=new Array(n);r<n;r++)s[r]=o[r].fn;return s},a.prototype.listenerCount=function(e){var t=i?i+e:e,o=this._events[t];return o?o.fn?1:o.length:0},a.prototype.emit=function(e,t,o,r,n,s){var a=i?i+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){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,r),!0;case 5:return l.fn.call(l.context,t,o,r,n),!0;case 6:return l.fn.call(l.context,t,o,r,n,s),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),h){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,r);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];l[u].fn.apply(l[u].context,c)}}return!0},a.prototype.on=function(e,t,i){return n(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return n(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,o,r){var n=i?i+e:e;if(!this._events[n])return this;if(!t)return s(this,n),this;var a=this._events[n];if(a.fn)a.fn!==t||r&&!a.once||o&&a.context!==o||s(this,n);else{for(var c=0,u=[],l=a.length;c<l;c++)(a[c].fn!==t||r&&!a[c].once||o&&a[c].context!==o)&&u.push(a[c]);u.length?this._events[n]=1===u.length?u[0]:u:s(this,n)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&s(this,t)):(this._events=new o,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a}(g);var m,T,y,_,R,b,C,S,w=v(g.exports);!function(e){e[e.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",e[e.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",e[e.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",e[e.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",e[e.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",e[e.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",e[e.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",e[e.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",e[e.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",e[e.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",e[e.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",e[e.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",e[e.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",e[e.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",e[e.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",e[e.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",e[e.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",e[e.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",e[e.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",e[e.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080"}(m||(m={})),function(e){e[e.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",e[e.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",e[e.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub"}(T||(T={})),function(e){e[e.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",e[e.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit"}(y||(y={})),function(e){e[e.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",e[e.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",e[e.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable"}(_||(_={})),function(e){e[e.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",e[e.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature"}(R||(R={})),function(e){e[e.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",e[e.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",e[e.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",e[e.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom"}(b||(b={})),function(e){e[e.TRTCRoleAnchor=20]="TRTCRoleAnchor",e[e.TRTCRoleAudience=21]="TRTCRoleAudience"}(C||(C={})),function(e){e[e.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",e[e.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",e[e.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic"}(S||(S={}));var M,E,A=function(e,t,i,o,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=""),this.deviceId=e,this.deviceName=t,this.kind=i,this.label=o,this.groupId=r};!function(e){e[e.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",e[e.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",e[e.TRTCDeviceStateActive=2]="TRTCDeviceStateActive"}(M||(M={})),function(e){e[e.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",e[e.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",e[e.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",e[e.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera"}(E||(E={}));var P,L=function(e,t,i,o,r,n,s,a,c,u,l){void 0===e&&(e=0),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=0),void 0===r&&(r=""),void 0===n&&(n=C.TRTCRoleAnchor),void 0===s&&(s=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===l&&(l=30),this.sdkAppId=e,this.userId=t,this.userSig=i,this.roomId=o,this.strRoomId=r,this.role=n,this.privateMapKey=s,this.streamId=c,this.userDefineRecordId=u,this.frameWorkType=l},V=function(e,t,i,o){void 0===e&&(e=m.TRTCVideoResolution_640_360),void 0===t&&(t=O.TRTCVideoResolutionModeLandscape),void 0===i&&(i=15),void 0===o&&(o=550),this.videoResolution=e,this.resMode=t,this.videoFps=i,this.videoBitrate=o};!function(e){e[e.TRTCVideoRotation0=0]="TRTCVideoRotation0",e[e.TRTCVideoRotation90=1]="TRTCVideoRotation90",e[e.TRTCVideoRotation180=2]="TRTCVideoRotation180",e[e.TRTCVideoRotation270=3]="TRTCVideoRotation270"}(P||(P={}));var I,x=function(e,t,i){void 0===e&&(e=P.TRTCVideoRotation0),void 0===t&&(t=y.TRTCVideoFillMode_Fit),void 0===i&&(i=_.TRTCVideoMirrorType_Disable),this.rotation=e,this.fillMode=t,this.mirrorType=i};!function(e){e[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"}(I||(I={}));var O,k,D,z=function(e,t){void 0===e&&(e=""),void 0===t&&(t=I.TRTCQuality_Unknown),this.userId=e,this.quality=t},B=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},N=function(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),this.appId=e,this.bizId=t,this.url=i},F=function(e,t,i,o,r,n,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===n&&(n=0),void 0===s&&(s=T.TRTCVideoStreamTypeBig),this.width=e,this.height=t,this.frameRate=i,this.videoBitrate=o,this.audioBitrate=n,this.streamType=s},H=function(e,t,i,o,r,n,s,a,c,u,l,h,d,p){void 0===e&&(e=""),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===p&&(p=T.TRTCVideoStreamTypeBig),this.userId=e,this.width=i,this.height=o,this.frameRate=r,this.videoBitrate=n,this.audioBitrate=a,this.streamType=p},W=function(e,t,i,o,r,n,s,a,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===s&&(s=0),void 0===a&&(a=[]),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=s,this.localStatisticsArray=a,this.localStatisticsArraySize=c,this.remoteStatisticsArray=u,this.remoteStatisticsArraySize=l};!function(e){e[e.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",e[e.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait"}(O||(O={})),function(e){e[e.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",e[e.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear"}(k||(k={})),function(e){e[e.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",e[e.TRTCQosControlModeServer=1]="TRTCQosControlModeServer"}(D||(D={}));var j,Q,U=function(e,t){void 0===e&&(e=k.TRTCVideoQosPreferenceClear),void 0===t&&(t=D.TRTCQosControlModeServer),this.preference=e,this.controlMode=t},q=function(e,t,i,o){void 0===e&&(e=new ArrayBuffer(0)),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.buffer=e,this.length=t,this.width=i,this.height=o};!function(e){e[e.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",e[e.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",e[e.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",e[e.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",e[e.TRTCLogLevelError=4]="TRTCLogLevelError",e[e.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",e[e.TRTCLogLevelNone=6]="TRTCLogLevelNone"}(j||(j={})),function(e){e[e.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",e[e.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",e[e.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",e[e.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom"}(Q||(Q={}));var G,Y=function(e,t,i,o,r,n){void 0===e&&(e=Q.TRTCScreenCaptureSourceTypeUnknown),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=new q),void 0===r&&(r=new q),void 0===n&&(n=!1),this.type=e,this.sourceId=t,this.sourceName=i,this.thumbBGRA=o,this.iconBGRA=r,this.isMinimizeWindow=n},K=function(e,t,i,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.left=e,this.top=t,this.right=i,this.bottom=o},J=function(e,t,i,o,r,n,s,a,c,u,l,h,d,p,f){void 0===e&&(e=G.TRTCTranscodingConfigMode_Unknown),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=15),void 0===a&&(a=2),void 0===c&&(c=0),void 0===u&&(u=""),void 0===l&&(l=64),void 0===h&&(h=48e3),void 0===d&&(d=1),void 0===p&&(p=[]),void 0===f&&(f=""),this.mode=e,this.appId=t,this.bizId=i,this.videoWidth=o,this.videoHeight=r,this.videoBitrate=n,this.videoFramerate=s,this.videoGOP=a,this.backgroundColor=c,this.backgroundImage=u,this.audioSampleRate=l,this.audioBitrate=h,this.audioChannels=d,this.mixUsersArray=p,this.mixUsersArraySize=p.length,this.streamId=f};!function(e){e[e.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",e[e.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",e[e.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",e[e.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",e[e.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",e[e.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",e[e.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",e[e.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",e[e.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",e[e.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing"}(G||(G={}));var X,$,Z=function(e,t,i,o,r,n,s,a){void 0===e&&(e=""),void 0===t&&(t=""),void 0===i&&(i=null),void 0===o&&(o=0),void 0===r&&(r=!1),void 0===n&&(n=T.TRTCVideoStreamTypeBig),void 0===s&&(s=X.TRTCMixInputTypeUndefined),void 0===a&&(a=0),this.userId=e,this.roomId=t,this.rect=i,this.zOrder=o,this.pureAudio=r,this.streamType=n,this.inputType=s,this.renderMode=a};!function(e){e[e.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",e[e.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",e[e.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",e[e.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio"}(X||(X={})),function(e){e[e.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",e[e.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",e[e.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",e[e.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual"}($||($={}));var ee,te=function(e,t,i,o,r,n){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.enableCaptureMouse=e,this.enableHighLight=t,this.enableHighPerformance=i,this.highLightColor=o,this.highLightWidth=r,this.enableCaptureChildWindow=n},ie="onError",oe="onWarning",re="rtc",ne="live",se="VirtualBackground",ae="BasicBeauty",ce="blur",ue="image",le={20:"anchor",21:"audience"},he={0:re,1:ne,2:re,3:ne};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(ee||(ee={}));var de="enum";function pe(){return Math.floor(performance.now())}var fe=function(e){return void 0===e},ve=function(e){return"number"==typeof e},ge=function(e){return"boolean"==typeof e};function me(e){if("string"!=typeof e)return e;var t;try{var i=JSON.parse(e);t="object"==typeof i&&i?i:e}catch(o){t=e}return t}function Te(e){return null==e}function ye(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return Object.keys(t).forEach((function(i){e[i]&&"object"==typeof e[i]?e[i]=ye(e[i],t[i]):e[i]=t[i]})),e}),{})}function _e(e){var t=null;return e instanceof MediaStream||e instanceof MediaStreamTrack||e instanceof HTMLElement?e:([Date,RegExp,Set,WeakSet,Map,WeakMap,Error].includes(null==e?void 0:e.constructor)?t=new e.constructor(e):Array.isArray(e)?(t=[],e.forEach((function(e,i){t[i]=_e(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=_e(e[i]))}))):t=e,t)}var Re=function(e){return e&&e.Math===Math&&e},be=Re("object"==typeof globalThis&&globalThis)||Re("object"==typeof window&&window)||Re("object"==typeof self&&self)||Re("object"==typeof f&&f)||function(){return this}()||f||Function("return this")(),Ce={},Se=function(e){try{return!!e()}catch(t){return!0}},we=!Se((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Me=!Se((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Ee=Me,Ae=Function.prototype.call,Pe=Ee?Ae.bind(Ae):function(){return Ae.apply(Ae,arguments)},Le={},Ve={}.propertyIsEnumerable,Ie=Object.getOwnPropertyDescriptor,xe=Ie&&!Ve.call({1:2},1);Le.f=xe?function(e){var t=Ie(this,e);return!!t&&t.enumerable}:Ve;var Oe,ke,De=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ze=Me,Be=Function.prototype,Ne=Be.call,Fe=ze&&Be.bind.bind(Ne,Ne),He=ze?Fe:function(e){return function(){return Ne.apply(e,arguments)}},We=He,je=We({}.toString),Qe=We("".slice),Ue=function(e){return Qe(je(e),8,-1)},qe=Se,Ge=Ue,Ye=Object,Ke=He("".split),Je=qe((function(){return!Ye("z").propertyIsEnumerable(0)}))?function(e){return"String"===Ge(e)?Ke(e,""):Ye(e)}:Ye,Xe=function(e){return null==e},$e=Xe,Ze=TypeError,et=function(e){if($e(e))throw Ze("Can't call method on "+e);return e},tt=Je,it=et,ot=function(e){return tt(it(e))},rt="object"==typeof document&&document.all,nt={all:rt,IS_HTMLDDA:void 0===rt&&void 0!==rt},st=nt.all,at=nt.IS_HTMLDDA?function(e){return"function"==typeof e||e===st}:function(e){return"function"==typeof e},ct=at,ut=nt.all,lt=nt.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:ct(e)||e===ut}:function(e){return"object"==typeof e?null!==e:ct(e)},ht=be,dt=at,pt=function(e,t){return arguments.length<2?(i=ht[e],dt(i)?i:void 0):ht[e]&&ht[e][t];var i},ft=He({}.isPrototypeOf),vt=be,gt="undefined"!=typeof navigator&&String(navigator.userAgent)||"",mt=vt.process,Tt=vt.Deno,yt=mt&&mt.versions||Tt&&Tt.version,_t=yt&&yt.v8;_t&&(ke=(Oe=_t.split("."))[0]>0&&Oe[0]<4?1:+(Oe[0]+Oe[1])),!ke&>&&(!(Oe=gt.match(/Edge\/(\d+)/))||Oe[1]>=74)&&(Oe=gt.match(/Chrome\/(\d+)/))&&(ke=+Oe[1]);var Rt=ke,bt=Rt,Ct=Se,St=be.String,wt=!!Object.getOwnPropertySymbols&&!Ct((function(){var e=Symbol("symbol detection");return!St(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&bt&&bt<41})),Mt=wt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Et=pt,At=at,Pt=ft,Lt=Object,Vt=Mt?function(e){return"symbol"==typeof e}:function(e){var t=Et("Symbol");return At(t)&&Pt(t.prototype,Lt(e))},It=String,xt=at,Ot=function(e){try{return It(e)}catch(t){return"Object"}},kt=TypeError,Dt=function(e){if(xt(e))return e;throw kt(Ot(e)+" is not a function")},zt=Xe,Bt=function(e,t){var i=e[t];return zt(i)?void 0:Dt(i)},Nt=Pe,Ft=at,Ht=lt,Wt=TypeError,jt={exports:{}},Qt=be,Ut=Object.defineProperty,qt=function(e,t){try{Ut(Qt,e,{value:t,configurable:!0,writable:!0})}catch(i){Qt[e]=t}return t},Gt=qt,Yt="__core-js_shared__",Kt=be[Yt]||Gt(Yt,{}),Jt=Kt;(jt.exports=function(e,t){return Jt[e]||(Jt[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"});var Xt=jt.exports,$t=et,Zt=Object,ei=function(e){return Zt($t(e))},ti=ei,ii=He({}.hasOwnProperty),oi=Object.hasOwn||function(e,t){return ii(ti(e),t)},ri=He,ni=0,si=Math.random(),ai=ri(1..toString),ci=function(e){return"Symbol("+(void 0===e?"":e)+")_"+ai(++ni+si,36)},ui=Xt,li=oi,hi=ci,di=wt,pi=Mt,fi=be.Symbol,vi=ui("wks"),gi=pi?fi.for||fi:fi&&fi.withoutSetter||hi,mi=function(e){return li(vi,e)||(vi[e]=di&&li(fi,e)?fi[e]:gi("Symbol."+e)),vi[e]},Ti=Pe,yi=lt,_i=Vt,Ri=Bt,bi=function(e,t){var i,o;if("string"===t&&Ft(i=e.toString)&&!Ht(o=Nt(i,e)))return o;if(Ft(i=e.valueOf)&&!Ht(o=Nt(i,e)))return o;if("string"!==t&&Ft(i=e.toString)&&!Ht(o=Nt(i,e)))return o;throw Wt("Can't convert object to primitive value")},Ci=TypeError,Si=mi("toPrimitive"),wi=function(e,t){if(!yi(e)||_i(e))return e;var i,o=Ri(e,Si);if(o){if(void 0===t&&(t="default"),i=Ti(o,e,t),!yi(i)||_i(i))return i;throw Ci("Can't convert object to primitive value")}return void 0===t&&(t="number"),bi(e,t)},Mi=Vt,Ei=function(e){var t=wi(e,"string");return Mi(t)?t:t+""},Ai=lt,Pi=be.document,Li=Ai(Pi)&&Ai(Pi.createElement),Vi=function(e){return Li?Pi.createElement(e):{}},Ii=Vi,xi=!we&&!Se((function(){return 7!==Object.defineProperty(Ii("div"),"a",{get:function(){return 7}}).a})),Oi=we,ki=Pe,Di=Le,zi=De,Bi=ot,Ni=Ei,Fi=oi,Hi=xi,Wi=Object.getOwnPropertyDescriptor;Ce.f=Oi?Wi:function(e,t){if(e=Bi(e),t=Ni(t),Hi)try{return Wi(e,t)}catch(i){}if(Fi(e,t))return zi(!ki(Di.f,e,t),e[t])};var ji={},Qi=we&&Se((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ui=lt,qi=String,Gi=TypeError,Yi=function(e){if(Ui(e))return e;throw Gi(qi(e)+" is not an object")},Ki=we,Ji=xi,Xi=Qi,$i=Yi,Zi=Ei,eo=TypeError,to=Object.defineProperty,io=Object.getOwnPropertyDescriptor,oo="enumerable",ro="configurable",no="writable";ji.f=Ki?Xi?function(e,t,i){if($i(e),t=Zi(t),$i(i),"function"==typeof e&&"prototype"===t&&"value"in i&&no in i&&!i[no]){var o=io(e,t);o&&o[no]&&(e[t]=i.value,i={configurable:ro in i?i[ro]:o[ro],enumerable:oo in i?i[oo]:o[oo],writable:!1})}return to(e,t,i)}:to:function(e,t,i){if($i(e),t=Zi(t),$i(i),Ji)try{return to(e,t,i)}catch(o){}if("get"in i||"set"in i)throw eo("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var so=ji,ao=De,co=we?function(e,t,i){return so.f(e,t,ao(1,i))}:function(e,t,i){return e[t]=i,e},uo={exports:{}},lo=we,ho=oi,po=Function.prototype,fo=lo&&Object.getOwnPropertyDescriptor,vo=ho(po,"name"),go={EXISTS:vo,PROPER:vo&&"something"===function(){}.name,CONFIGURABLE:vo&&(!lo||lo&&fo(po,"name").configurable)},mo=at,To=Kt,yo=He(Function.toString);mo(To.inspectSource)||(To.inspectSource=function(e){return yo(e)});var _o,Ro,bo,Co=To.inspectSource,So=at,wo=be.WeakMap,Mo=So(wo)&&/native code/.test(String(wo)),Eo=ci,Ao=Xt("keys"),Po=function(e){return Ao[e]||(Ao[e]=Eo(e))},Lo={},Vo=Mo,Io=be,xo=lt,Oo=co,ko=oi,Do=Kt,zo=Po,Bo=Lo,No="Object already initialized",Fo=Io.TypeError,Ho=Io.WeakMap;if(Vo||Do.state){var Wo=Do.state||(Do.state=new Ho);Wo.get=Wo.get,Wo.has=Wo.has,Wo.set=Wo.set,_o=function(e,t){if(Wo.has(e))throw Fo(No);return t.facade=e,Wo.set(e,t),t},Ro=function(e){return Wo.get(e)||{}},bo=function(e){return Wo.has(e)}}else{var jo=zo("state");Bo[jo]=!0,_o=function(e,t){if(ko(e,jo))throw Fo(No);return t.facade=e,Oo(e,jo,t),t},Ro=function(e){return ko(e,jo)?e[jo]:{}},bo=function(e){return ko(e,jo)}}var Qo={set:_o,get:Ro,has:bo,enforce:function(e){return bo(e)?Ro(e):_o(e,{})},getterFor:function(e){return function(t){var i;if(!xo(t)||(i=Ro(t)).type!==e)throw Fo("Incompatible receiver, "+e+" required");return i}}},Uo=He,qo=Se,Go=at,Yo=oi,Ko=we,Jo=go.CONFIGURABLE,Xo=Co,$o=Qo.enforce,Zo=Qo.get,er=String,tr=Object.defineProperty,ir=Uo("".slice),or=Uo("".replace),rr=Uo([].join),nr=Ko&&!qo((function(){return 8!==tr((function(){}),"length",{value:8}).length})),sr=String(String).split("String"),ar=uo.exports=function(e,t,i){"Symbol("===ir(er(t),0,7)&&(t="["+or(er(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(t="get "+t),i&&i.setter&&(t="set "+t),(!Yo(e,"name")||Jo&&e.name!==t)&&(Ko?tr(e,"name",{value:t,configurable:!0}):e.name=t),nr&&i&&Yo(i,"arity")&&e.length!==i.arity&&tr(e,"length",{value:i.arity});try{i&&Yo(i,"constructor")&&i.constructor?Ko&&tr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(r){}var o=$o(e);return Yo(o,"source")||(o.source=rr(sr,"string"==typeof t?t:"")),e};Function.prototype.toString=ar((function(){return Go(this)&&Zo(this).source||Xo(this)}),"toString");var cr=uo.exports,ur=at,lr=ji,hr=cr,dr=qt,pr=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(ur(i)&&hr(i,n,o),o.global)r?e[t]=i:dr(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:lr.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},fr={},vr=Math.ceil,gr=Math.floor,mr=Math.trunc||function(e){var t=+e;return(t>0?gr:vr)(t)},Tr=function(e){var t=+e;return t!=t||0===t?0:mr(t)},yr=Tr,_r=Math.max,Rr=Math.min,br=Tr,Cr=Math.min,Sr=function(e){return e>0?Cr(br(e),9007199254740991):0},wr=Sr,Mr=function(e){return wr(e.length)},Er=ot,Ar=function(e,t){var i=yr(e);return i<0?_r(i+t,0):Rr(i,t)},Pr=Mr,Lr=function(e){return function(t,i,o){var r,n=Er(t),s=Pr(n),a=Ar(o,s);if(e&&i!=i){for(;s>a;)if((r=n[a++])!=r)return!0}else for(;s>a;a++)if((e||a in n)&&n[a]===i)return e||a||0;return!e&&-1}},Vr={includes:Lr(!0),indexOf:Lr(!1)},Ir=oi,xr=ot,Or=Vr.indexOf,kr=Lo,Dr=He([].push),zr=function(e,t){var i,o=xr(e),r=0,n=[];for(i in o)!Ir(kr,i)&&Ir(o,i)&&Dr(n,i);for(;t.length>r;)Ir(o,i=t[r++])&&(~Or(n,i)||Dr(n,i));return n},Br=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Nr=zr,Fr=Br.concat("length","prototype");fr.f=Object.getOwnPropertyNames||function(e){return Nr(e,Fr)};var Hr={};Hr.f=Object.getOwnPropertySymbols;var Wr=pt,jr=fr,Qr=Hr,Ur=Yi,qr=He([].concat),Gr=Wr("Reflect","ownKeys")||function(e){var t=jr.f(Ur(e)),i=Qr.f;return i?qr(t,i(e)):t},Yr=oi,Kr=Gr,Jr=Ce,Xr=ji,$r=Se,Zr=at,en=/#|\.prototype\./,tn=function(e,t){var i=rn[on(e)];return i===sn||i!==nn&&(Zr(t)?$r(t):!!t)},on=tn.normalize=function(e){return String(e).replace(en,".").toLowerCase()},rn=tn.data={},nn=tn.NATIVE="N",sn=tn.POLYFILL="P",an=tn,cn=be,un=Ce.f,ln=co,hn=pr,dn=qt,pn=function(e,t,i){for(var o=Kr(t),r=Xr.f,n=Jr.f,s=0;s<o.length;s++){var a=o[s];Yr(e,a)||i&&Yr(i,a)||r(e,a,n(t,a))}},fn=an,vn=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?cn:u?cn[a]||dn(a,{}):(cn[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=un(i,o))&&s.value:i[o],!fn(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;pn(n,r)}(e.sham||r&&r.sham)&&ln(n,"sham",!0),hn(i,o,n,e)}},gn={};gn[mi("toStringTag")]="z";var mn="[object z]"===String(gn),Tn=at,yn=Ue,_n=mi("toStringTag"),Rn=Object,bn="Arguments"===yn(function(){return arguments}()),Cn=mn?yn:function(e){var t,i,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=Rn(e),_n))?i:bn?yn(t):"Object"===(o=yn(t))&&Tn(t.callee)?"Arguments":o},Sn=Cn,wn=String,Mn=function(e){if("Symbol"===Sn(e))throw TypeError("Cannot convert a Symbol value to a string");return wn(e)},En=Yi,An=Se,Pn=be.RegExp,Ln=An((function(){var e=Pn("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),Vn=Ln||An((function(){return!Pn("a","y").sticky})),In={BROKEN_CARET:Ln||An((function(){var e=Pn("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:Vn,UNSUPPORTED_Y:Ln},xn={},On=zr,kn=Br,Dn=Object.keys||function(e){return On(e,kn)},zn=we,Bn=Qi,Nn=ji,Fn=Yi,Hn=ot,Wn=Dn;xn.f=zn&&!Bn?Object.defineProperties:function(e,t){Fn(e);for(var i,o=Hn(t),r=Wn(t),n=r.length,s=0;n>s;)Nn.f(e,i=r[s++],o[i]);return e};var jn,Qn=pt("document","documentElement"),Un=Yi,qn=xn,Gn=Br,Yn=Lo,Kn=Qn,Jn=Vi,Xn="prototype",$n="script",Zn=Po("IE_PROTO"),es=function(){},ts=function(e){return"<"+$n+">"+e+"</"+$n+">"},is=function(e){e.write(ts("")),e.close();var t=e.parentWindow.Object;return e=null,t},os=function(){try{jn=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;os="undefined"!=typeof document?document.domain&&jn?is(jn):(t=Jn("iframe"),i="java"+$n+":",t.style.display="none",Kn.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(ts("document.F=Object")),e.close(),e.F):is(jn);for(var o=Gn.length;o--;)delete os[Xn][Gn[o]];return os()};Yn[Zn]=!0;var rs,ns,ss=Object.create||function(e,t){var i;return null!==e?(es[Xn]=Un(e),i=new es,es[Xn]=null,i[Zn]=e):i=os(),void 0===t?i:qn.f(i,t)},as=Se,cs=be.RegExp,us=as((function(){var e=cs(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),ls=Se,hs=be.RegExp,ds=ls((function(){var e=hs("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),ps=Pe,fs=He,vs=Mn,gs=function(){var e=En(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},ms=In,Ts=ss,ys=Qo.get,_s=us,Rs=ds,bs=Xt("native-string-replace",String.prototype.replace),Cs=RegExp.prototype.exec,Ss=Cs,ws=fs("".charAt),Ms=fs("".indexOf),Es=fs("".replace),As=fs("".slice),Ps=(ns=/b*/g,ps(Cs,rs=/a/,"a"),ps(Cs,ns,"a"),0!==rs.lastIndex||0!==ns.lastIndex),Ls=ms.BROKEN_CARET,Vs=void 0!==/()??/.exec("")[1];(Ps||Vs||Ls||_s||Rs)&&(Ss=function(e){var t,i,o,r,n,s,a,c=this,u=ys(c),l=vs(e),h=u.raw;if(h)return h.lastIndex=c.lastIndex,t=ps(Ss,h,l),c.lastIndex=h.lastIndex,t;var d=u.groups,p=Ls&&c.sticky,f=ps(gs,c),v=c.source,g=0,m=l;if(p&&(f=Es(f,"y",""),-1===Ms(f,"g")&&(f+="g"),m=As(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==ws(l,c.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,g++),i=new RegExp("^(?:"+v+")",f)),Vs&&(i=new RegExp("^"+v+"$(?!\\s)",f)),Ps&&(o=c.lastIndex),r=ps(Cs,p?i:c,m),p?r?(r.input=As(r.input,g),r[0]=As(r[0],g),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Ps&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),Vs&&r&&r.length>1&&ps(bs,r[0],i,(function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(r[n]=void 0)})),r&&d)for(r.groups=s=Ts(null),n=0;n<d.length;n++)s[(a=d[n])[0]]=r[a[1]];return r});var Is=Ss;vn({target:"RegExp",proto:!0,forced:/./.exec!==Is},{exec:Is});var xs="\t\n\v\f\r \u2028\u2029\ufeff",Os=et,ks=Mn,Ds=xs,zs=He("".replace),Bs=RegExp("^["+Ds+"]+"),Ns=RegExp("(^|[^"+Ds+"])["+Ds+"]+$"),Fs=function(e){return function(t){var i=ks(Os(t));return 1&e&&(i=zs(i,Bs,"")),2&e&&(i=zs(i,Ns,"$1")),i}},Hs={start:Fs(1),end:Fs(2),trim:Fs(3)},Ws=be,js=Se,Qs=Mn,Us=Hs.trim,qs=xs,Gs=He("".charAt),Ys=Ws.parseFloat,Ks=Ws.Symbol,Js=Ks&&Ks.iterator,Xs=1/Ys(qs+"-0")!=-Infinity||Js&&!js((function(){Ys(Object(Js))}))?function(e){var t=Us(Qs(e)),i=Ys(t);return 0===i&&"-"===Gs(t,0)?-0:i}:Ys;vn({global:!0,forced:parseFloat!==Xs},{parseFloat:Xs});var $s=Ue,Zs=He,ea=function(e){if("Function"===$s(e))return Zs(e)},ta=pr,ia=Is,oa=Se,ra=mi,na=co,sa=ra("species"),aa=RegExp.prototype,ca=He,ua=Tr,la=Mn,ha=et,da=ca("".charAt),pa=ca("".charCodeAt),fa=ca("".slice),va=function(e){return function(t,i){var o,r,n=la(ha(t)),s=ua(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=pa(n,s))<55296||o>56319||s+1===a||(r=pa(n,s+1))<56320||r>57343?e?da(n,s):o:e?fa(n,s,s+2):r-56320+(o-55296<<10)+65536}},ga={codeAt:va(!1),charAt:va(!0)}.charAt,ma=Pe,Ta=Yi,ya=at,_a=Ue,Ra=Is,ba=TypeError,Ca=Pe,Sa=function(e,t,i,o){var r=ra(e),n=!oa((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!oa((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[sa]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=ea(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=ea(e),c=t.exec;return c===ia||c===aa.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));ta(String.prototype,e,c[0]),ta(aa,r,c[1])}o&&na(aa[r],"sham",!0)},wa=Yi,Ma=Xe,Ea=Sr,Aa=Mn,Pa=et,La=Bt,Va=function(e,t,i){return t+(i?ga(e,t).length:1)},Ia=function(e,t){var i=e.exec;if(ya(i)){var o=ma(i,e,t);return null!==o&&Ta(o),o}if("RegExp"===_a(e))return ma(Ra,e,t);throw ba("RegExp#exec called on incompatible receiver")};Sa("match",(function(e,t,i){return[function(t){var i=Pa(this),o=Ma(t)?void 0:La(t,e);return o?Ca(o,t,i):new RegExp(t)[e](Aa(i))},function(e){var o=wa(this),r=Aa(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return Ia(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=Ia(o,r));){var l=Aa(a[0]);c[u]=l,""===l&&(o.lastIndex=Va(r,Ea(o.lastIndex),s)),u++}return 0===u?null:c}]}));var xa=Ue,Oa=Array.isArray||function(e){return"Array"===xa(e)},ka=TypeError,Da=Ei,za=ji,Ba=De,Na=He,Fa=Se,Ha=at,Wa=Cn,ja=Co,Qa=function(){},Ua=[],qa=pt("Reflect","construct"),Ga=/^\s*(?:class|function)\b/,Ya=Na(Ga.exec),Ka=!Ga.exec(Qa),Ja=function(e){if(!Ha(e))return!1;try{return qa(Qa,Ua,e),!0}catch(t){return!1}},Xa=function(e){if(!Ha(e))return!1;switch(Wa(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ka||!!Ya(Ga,ja(e))}catch(t){return!0}};Xa.sham=!0;var $a=!qa||Fa((function(){var e;return Ja(Ja.call)||!Ja(Object)||!Ja((function(){e=!0}))||e}))?Xa:Ja,Za=Oa,ec=$a,tc=lt,ic=mi("species"),oc=Array,rc=function(e){var t;return Za(e)&&(t=e.constructor,(ec(t)&&(t===oc||Za(t.prototype))||tc(t)&&null===(t=t[ic]))&&(t=void 0)),void 0===t?oc:t},nc=Se,sc=Rt,ac=mi("species"),cc=vn,uc=Se,lc=Oa,hc=lt,dc=ei,pc=Mr,fc=function(e){if(e>9007199254740991)throw ka("Maximum allowed index exceeded");return e},vc=function(e,t,i){var o=Da(t);o in e?za.f(e,o,Ba(0,i)):e[o]=i},gc=function(e,t){return new(rc(e))(0===t?0:t)},mc=function(e){return sc>=51||!nc((function(){var t=[];return(t.constructor={})[ac]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Tc=Rt,yc=mi("isConcatSpreadable"),_c=Tc>=51||!uc((function(){var e=[];return e[yc]=!1,e.concat()[0]!==e})),Rc=function(e){if(!hc(e))return!1;var t=e[yc];return void 0!==t?!!t:lc(e)};cc({target:"Array",proto:!0,arity:1,forced:!_c||!mc("concat")},{concat:function(e){var t,i,o,r,n,s=dc(this),a=gc(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Rc(n=-1===t?s:arguments[t]))for(r=pc(n),fc(c+r),i=0;i<r;i++,c++)i in n&&vc(a,c,n[i]);else fc(c+1),vc(a,c++,n);return a.length=c,a}});var bc=window.navigator&&window.navigator.userAgent||"",Cc=/AppleWebKit\/([\d.]+)/i.exec(bc);Cc&&parseFloat(Cc.pop());var Sc=/iPad/i.test(bc),wc=/iPhone/i.test(bc)&&!Sc,Mc=/iPod/i.test(bc),Ec=wc||Sc||Mc,Ac=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(bc);Ec&&function(){var e=bc.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var Pc=/Android/i.test(bc);Pc&&function(){var e=bc.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);t&&i&&parseFloat("".concat(e[1],".").concat(e[2]))}();Pc&&/webkit/i.test(bc),/Firefox/i.test(bc)&&function(){var e=bc.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Lc=/Edge\//i.test(bc);Lc&&function(){var e=bc.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var Vc=/Edg\//i.test(bc);Vc&&function(){var e=bc.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Ic=/SogouMobileBrowser\//i.test(bc);Ic&&function(){var e=bc.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var xc=/MetaSr\s/i.test(bc);xc&&function(){var e=bc.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Oc=/TBS\/\d+/i.test(bc);Oc&&function(){var e=bc.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var kc=/XWEB\/\d+/i.test(bc);kc&&function(){var e=bc.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(bc),/MSIE\/\d+/i.test(bc)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(bc),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(bc)&&/rv:11.0/.test(bc)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(bc)&&function(){var e=bc.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var Dc=!Oc&&/MQQBrowser\/\d+/i.test(bc)&&/COVC\/\d+/i.test(bc),zc=!Oc&&/MQQBrowser\/\d+/i.test(bc)&&!/COVC\/\d+/i.test(bc);(zc||Dc)&&function(){var e=bc.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Bc=!Oc&&/ QQBrowser\/\d+/i.test(bc);Bc&&function(){var e=bc.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Nc=!Oc&&/QQBrowserLite\/\d+/i.test(bc);Nc&&function(){var e=bc.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var Fc=!Oc&&/MQBHD\/\d+/i.test(bc);Fc&&function(){var e=bc.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(bc),!Ec&&/MAC OS X/i.test(bc),!Pc&&/Linux/i.test(bc),/MicroMessenger/i.test(bc),/UCBrowser/i.test(bc),/Electron/i.test(bc);var Hc=/MiuiBrowser/i.test(bc);Hc&&function(){var e=bc.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Wc=/HuaweiBrowser/i.test(bc);/Huawei/i.test(bc),Wc&&function(){var e=bc.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var jc=/SamsungBrowser/i.test(bc);jc&&function(){var e=bc.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Qc=/HeyTapBrowser/i.test(bc);Qc&&function(){var e=bc.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Uc=/VivoBrowser/i.test(bc);Uc&&function(){var e=bc.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var qc,Gc,Yc,Kc=/Chrome/i.test(bc),Jc=!Lc&&!xc&&!Ic&&!Oc&&!kc&&!Vc&&!Bc&&!Hc&&!Wc&&!jc&&!Qc&&!Uc&&/Chrome/i.test(bc);Jc&&function(){var e=bc.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),Jc&&function(){var e=bc.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!Kc&&!zc&&!Dc&&!Nc&&!Fc&&/Safari/i.test(bc)&&function(){var e=bc.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"}(qc||(qc={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(Gc||(Gc={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(Yc||(Yc={}));var Xc,$c,Zc,eu=-3340,tu=-1301,iu=-1314,ou=-1315,ru=-1316,nu=-1302,su=-1317,au=-1318,cu=-1319,uu=-70252,lu={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},hu={code:-1005,message:"not supported"},du="2.10.15";!function(e){e[e.Success=0]="Success",e[e.Error=-1]="Error",e[e.InvalidParams=-2]="InvalidParams",e[e.NotFoundSource=-3]="NotFoundSource",e[e.ImageSourceLoadFailed=-4]="ImageSourceLoadFailed",e[e.CameraNotAuthorized=-5]="CameraNotAuthorized",e[e.CameraIsOccupied=-6]="CameraIsOccupied",e[e.CameraDisconnected=-7]="CameraDisconnected"}(Xc||(Xc={})),function(e){e[e.kCamera=0]="kCamera",e[e.kScreen=1]="kScreen",e[e.kImage=2]="kImage",e[e.kPhoneMirror=4]="kPhoneMirror",e[e.kText=5]="kText",e[e.kVideo=6]="kVideo"}($c||($c={})),function(e){e.onSourceSelected="onSourceSelected",e.onSourceMoved="onSourceMoved",e.onSourceResized="onSourceResized",e.onRightButtonClicked="onRightButtonClicked",e.onError="onError",e.onSourcePlugged="onSourcePlugged",e.onSourceConnected="onSourceConnected",e.onSourceDisconnected="onSourceDisconnected",e.onSourceUnplugged="onSourceUnplugged",e.onMediaSourceSizeChanged="onMediaSourceSizeChanged"}(Zc||(Zc={}));var pu,fu=function(){function e(e,t){if(this.logRegion="tc",this.loggerManager=e,t){var i=t.sdkAppId,o=t.userId,r=t.seq;this.seq=r,e&&(this.logger=e.createLogger({id:"".concat(this.logRegion).concat(r),userId:o,sdkAppId:i}))}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 i=[];return Object.keys(e).forEach((function(o){return i[o]=t.getStringifyMessage(e[o])})),JSON.stringify(i)}if(e instanceof Object){var o={};return Object.keys(e).forEach((function(i){return o[i]=t.getStringifyMessage(e[i])})),JSON.stringify(o)}return e},e.prototype.update=function(e){var t=e.userId,i=e.sdkAppId;this.loggerManager&&this.loggerManager.createLogger&&(this.logger=this.loggerManager.createLogger({id:"".concat(this.logRegion).concat(this.seq),userId:t,sdkAppId:i}))},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.info&&this.logger.info(i)},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger.debug(i)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.info&&this.logger.info(i)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.warn&&this.logger.warn(i)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.getLogMessage(e);this.logger&&this.logger.error&&this.logger.error(i)},e}(),vu=new fu(null),gu=function(){function e(e,t,i){void 0===i&&(i={calcPositionOnly:!1,canExceedContainer:!1}),this.logPrefix="[Movable]",this.movable=null,this.container=null,this.options={calcPositionOnly:!1,canExceedContainer:!1},this.callbacksMap=new Map,this.enabled=!0,this.originLeft=0,this.originTop=0,this.moveStartOfLeft=0,this.moveStartOfTop=0,this.movable=e,this.container=t||document.body,this.options={calcPositionOnly:!!i.calcPositionOnly||!1,canExceedContainer:!!i.canExceedContainer||!1},this.setStyle(),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseMove5px=this.onMouseMove5px.bind(this),this.onMouseUp5px=this.onMouseUp5px.bind(this),this.movable.addEventListener("mousedown",this.onMouseDown,!1)}return e.prototype.setStyle=function(){this.movable?(this.movable.style.position="absolute",this.movable.style.cursor="move"):vu.debug("".concat(this.logPrefix,"setStyle 'movable' is null"))},e.prototype.onMouseDown=function(e){if(this.enabled&&0===e.button){if(e.preventDefault(),document.defaultView&&this.movable){var t=document.defaultView.getComputedStyle(this.movable);this.originLeft=window.parseInt(t.left),this.originTop=window.parseInt(t.top)}else vu.debug("".concat(this.logPrefix,"onMouseDown 'movable' is null"));this.moveStartOfLeft=e.screenX,this.moveStartOfTop=e.screenY,document.addEventListener("mousemove",this.onMouseMove5px,!1),document.addEventListener("mouseup",this.onMouseUp5px,!1)}},e.prototype.onMouseMove5px=function(e){var t=e.screenX-(this.moveStartOfLeft||0),i=e.screenY-(this.moveStartOfTop||0);Math.abs(t)>=5||Math.abs(i)>=5?(document.removeEventListener("mousemove",this.onMouseMove5px,!1),document.removeEventListener("mouseup",this.onMouseUp5px,!1),document.addEventListener("mousemove",this.onMouseMove,!1),document.addEventListener("mouseup",this.onMouseUp,!1)):vu.debug("".concat(this.logPrefix,"on Movable mouse move less than 5px"))},e.prototype.onMouseUp5px=function(){document.removeEventListener("mousemove",this.onMouseMove5px,!1),document.removeEventListener("mouseup",this.onMouseUp5px,!1)},e.prototype.onMouseMove=function(e){if(this.movable&&this.container){var t=e.screenX-this.moveStartOfLeft,i=e.screenY-this.moveStartOfTop,o=this.originLeft+t,r=this.originTop+i,n=this.movable.offsetWidth,s=this.movable.offsetHeight,a=this.container.offsetWidth,c=this.container.offsetHeight;this.options.canExceedContainer||(o<0?o=0:o>a-n&&(o=a-n),r<0?r=0:r>c-s&&(r=c-s)),!this.options.calcPositionOnly&&this.movable&&(this.movable.style.left="".concat(o,"px"),this.movable.style.top="".concat(r,"px")),this.emit("move",o,r)}else vu.debug("".concat(this.logPrefix,"onMouseMove error:No 'movable' and 'container'."))},e.prototype.onMouseUp=function(){document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),this.originLeft=0,this.originTop=0,this.moveStartOfLeft=0,this.moveStartOfTop=0},e.prototype.on=function(e,t){var i=this.callbacksMap.get(e);i?i.push(t):this.callbacksMap.set(e,[t])},e.prototype.off=function(e,t){var i=this.callbacksMap.get(e);i&&(i=i.filter((function(e){return e!=t})),this.callbacksMap.set(e,i))},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=this.callbacksMap.get(e);o&&o.forEach((function(e){try{e.apply(null,t)}catch(i){console.error("[Movable]emit error:",e,i)}}))},e.prototype.destroy=function(){var e;null===(e=this.movable)||void 0===e||e.removeEventListener("mousedown",this.onMouseDown,!1),this.callbacksMap.clear(),this.movable=null,this.container=null},e.prototype.setEnabled=function(e){vu.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",vu.debug("".concat(this.logPrefix,"setEnabled: cursor updated to '").concat(e?"move":"default","'")))},e.prototype.isEnabled=function(){return this.enabled},e}();!function(e){e[e.Both=0]="Both",e[e.Corner=1]="Corner",e[e.Edge=2]="Edge"}(pu||(pu={}));var mu="trtc-resizable-top-left-anchor",Tu="trtc-resizable-top-anchor",yu="trtc-resizable-top-right-anchor",_u="trtc-resizable-left-anchor",Ru="trtc-resizable-right-anchor",bu="trtc-resizable-bottom-left-anchor",Cu="trtc-resizable-bottom-anchor",Su="trtc-resizable-bottom-right-anchor",wu={resizeAnchor:{position:"absolute",width:"".concat(8,"px"),height:"".concat(8,"px"),border:"1px solid #3D7EFD",backgroundColor:"#FFFFFF"},topLeftAnchor:{top:"-".concat(4,"px"),left:"-".concat(4,"px"),cursor:"nw-resize"},topAnchor:{top:"-".concat(4,"px"),left:"calc(50% - ".concat(4,"px)"),cursor:"n-resize"},topRightAnchor:{top:"-".concat(4,"px"),right:"-".concat(4,"px"),cursor:"ne-resize"},leftAnchor:{top:"calc(50% - ".concat(4,"px)"),left:"-".concat(4,"px"),cursor:"w-resize"},rightAnchor:{top:"calc(50% - ".concat(4,"px)"),right:"-".concat(4,"px"),cursor:"e-resize"},bottomLeftAnchor:{bottom:"-".concat(4,"px"),left:"-".concat(4,"px"),cursor:"sw-resize"},bottomAnchor:{bottom:"-".concat(4,"px"),left:"calc(50% - ".concat(4,"px)"),cursor:"s-resize"},bottomRightAnchor:{bottom:"-".concat(4,"px"),right:"-".concat(4,"px"),cursor:"se-resize"}};function Mu(e,t){for(var i in t)e.style[i]=t[i]}var Eu=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:pu.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:pu.Both,canExceedContainer:!1},this.callbacksMap=new Map,this.topLeftAnchor=null,this.topAnchor=null,this.topRightAnchor=null,this.leftAnchor=null,this.rightAnchor=null,this.bottomLeftAnchor=null,this.bottomAnchor=null,this.bottomRightAnchor=null,this.currentAnchor=null,this.resizeStartLeft=0,this.resizeStartTop=0,this.originLeft=0,this.originTop=0,this.originWidth=0,this.originHeight=0,this.resizeTarget=e,this.container=t||document.body,this.options={keepRatio:!!i.keepRatio||!1,stopPropagation:!!i.stopPropagation||!1,anchorMode:i.anchorMode||pu.Both,canExceedContainer:!!i.canExceedContainer||!1},this.mousedown=this.mousedown.bind(this),this.mousemove=this.mousemove.bind(this),this.mouseup=this.mouseup.bind(this),this.currentAnchor=null,this.createResizeAnchor(),this.resizeTarget.classList.add("trtc-resizable"),this.resizeTarget.style.position="absolute",this.resizeTarget.style.border="1px solid #3D7EFD",this.resizeTarget.style.boxSizing="border-box",this.initResizeEvent()}return e.prototype.createResizeAnchor=function(){var e,t,i,o,r,n,s,a,c=document.createElement("div");c.className="trtc-resizable-resize-anchor ".concat(mu),Mu(c,Object.assign({},wu.resizeAnchor,wu.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(Tu),Mu(u,Object.assign({},wu.resizeAnchor,wu.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(yu),Mu(l,Object.assign({},wu.resizeAnchor,wu.topRightAnchor)),this.topRightAnchor=l;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(_u),Mu(h,Object.assign({},wu.resizeAnchor,wu.leftAnchor)),this.leftAnchor=h;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(Ru),Mu(d,Object.assign({},wu.resizeAnchor,wu.rightAnchor)),this.rightAnchor=d;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(bu),Mu(p,Object.assign({},wu.resizeAnchor,wu.bottomLeftAnchor)),this.bottomLeftAnchor=p;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(Cu),Mu(f,Object.assign({},wu.resizeAnchor,wu.bottomAnchor)),this.bottomAnchor=f;var v=document.createElement("div");v.className="trtc-resizable-resize-anchor ".concat(Su),Mu(v,Object.assign({},wu.resizeAnchor,wu.bottomRightAnchor)),this.bottomRightAnchor=v,this.options.anchorMode!==pu.Both&&this.options.anchorMode!==pu.Edge||(null===(e=this.resizeTarget)||void 0===e||e.appendChild(u),null===(t=this.resizeTarget)||void 0===t||t.appendChild(h),null===(i=this.resizeTarget)||void 0===i||i.appendChild(d),null===(o=this.resizeTarget)||void 0===o||o.appendChild(f)),this.options.anchorMode!==pu.Both&&this.options.anchorMode!==pu.Corner||(null===(r=this.resizeTarget)||void 0===r||r.appendChild(c),null===(n=this.resizeTarget)||void 0===n||n.appendChild(l),null===(s=this.resizeTarget)||void 0===s||s.appendChild(p),null===(a=this.resizeTarget)||void 0===a||a.appendChild(v))},e.prototype.initResizeEvent=function(){var e,t,i,o,r,n,s,a;null===(e=this.topLeftAnchor)||void 0===e||e.addEventListener("mousedown",this.mousedown,!1),null===(t=this.topAnchor)||void 0===t||t.addEventListener("mousedown",this.mousedown,!1),null===(i=this.topRightAnchor)||void 0===i||i.addEventListener("mousedown",this.mousedown,!1),null===(o=this.leftAnchor)||void 0===o||o.addEventListener("mousedown",this.mousedown,!1),null===(r=this.rightAnchor)||void 0===r||r.addEventListener("mousedown",this.mousedown,!1),null===(n=this.bottomLeftAnchor)||void 0===n||n.addEventListener("mousedown",this.mousedown,!1),null===(s=this.bottomAnchor)||void 0===s||s.addEventListener("mousedown",this.mousedown,!1),null===(a=this.bottomRightAnchor)||void 0===a||a.addEventListener("mousedown",this.mousedown,!1)},e.prototype.mousedown=function(e){if(0===e.button){if(e.preventDefault(),this.options.stopPropagation&&e.stopPropagation(),this.currentAnchor=e.target,this.resizeStartLeft=e.screenX,this.resizeStartTop=e.screenY,document.defaultView&&this.resizeTarget){var t=document.defaultView.getComputedStyle(this.resizeTarget);this.originTop=window.parseInt(t.top),this.originLeft=window.parseInt(t.left),this.originWidth=this.resizeTarget.offsetWidth,this.originHeight=this.resizeTarget.offsetHeight,vu.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else vu.debug("".concat(this.logPrefix,"mouseDown 'resizeTarget' is null"));document.addEventListener("mousemove",this.mousemove,!1),document.addEventListener("mouseup",this.mouseup,!1)}},e.prototype.mousemove=function(e){if(this.container&&this.resizeTarget&&this.currentAnchor){var t,i=this.currentAnchor.classList[1],o=this.originLeft,r=this.originTop,n=this.originWidth,s=this.originHeight;switch(i){case mu:r=(t=this._resizeTop(e)).top,s=t.height,o=(t=this._resizeLeft(e)).left,n=t.width,this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?(s=n*this.originHeight/this.originWidth,r=this.originTop+this.originHeight-s):(n=s*this.originWidth/this.originHeight,o=this.originLeft+this.originWidth-n));break;case Tu:r=(t=this._resizeTop(e)).top,s=t.height,this.options.keepRatio&&((n=this.originWidth*s/this.originHeight)<20?(n=20,s=this.originHeight*n/this.originWidth,r=this.originTop+this.originHeight-s):!this.options.canExceedContainer&&n>this.container.offsetWidth-this.originLeft&&(n=this.container.offsetWidth-this.originLeft,s=this.originHeight*n/this.originWidth,r=this.originTop+this.originHeight-s));break;case yu:r=(t=this._resizeTop(e)).top,s=t.height,n=this._resizeRight(e),this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?(s=n*this.originHeight/this.originWidth,r=this.originTop+this.originHeight-s):n=s*this.originWidth/this.originHeight);break;case _u:o=(t=this._resizeLeft(e)).left,n=t.width,this.options.keepRatio&&((s=this.originHeight*n/this.originWidth)<20?(s=20,n=this.originWidth*s/this.originHeight,o=this.originLeft+this.originWidth-n):!this.options.canExceedContainer&&s>this.container.offsetHeight-this.originTop&&(s=this.container.offsetHeight-this.originTop,n=this.originWidth*s/this.originHeight,o=this.originLeft+this.originWidth-n));break;case Ru:n=this._resizeRight(e),this.options.keepRatio&&((s=n*this.originHeight/this.originWidth)<20?n=(s=20)*this.originWidth/this.originHeight:!this.options.canExceedContainer&&s>this.container.offsetHeight-this.originTop&&(n=(s=this.container.offsetHeight-this.originTop)*this.originWidth/this.originHeight));break;case bu:s=this._resizeBottom(e),o=(t=this._resizeLeft(e)).left,n=t.width,this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?s=n*this.originHeight/this.originWidth:(n=s*this.originWidth/this.originHeight,o=this.originLeft+this.originWidth-n));break;case Cu:s=this._resizeBottom(e),this.options.keepRatio&&((n=s*this.originWidth/this.originHeight)<20?s=(n=20)*this.originHeight/this.originWidth:!this.options.canExceedContainer&&n>this.container.offsetWidth-this.originLeft&&(s=(n=this.container.offsetWidth-this.originLeft)*this.originHeight/this.originWidth));break;case Su:s=this._resizeBottom(e),n=this._resizeRight(e),this.options.keepRatio&&(n/this.originWidth<s/this.originHeight?s=n*this.originHeight/this.originWidth:n=s*this.originWidth/this.originHeight)}this.resizeTarget.style.left="".concat(o,"px"),this.resizeTarget.style.top="".concat(r,"px"),this.resizeTarget.style.height="".concat(s,"px"),this.resizeTarget.style.width="".concat(n,"px"),this.emit("resize",o,r,n,s)}else vu.debug("".concat(this.logPrefix,"mouseMove error. No valid inner info:"),this.container,this.resizeTarget,this.currentAnchor)},e.prototype._resizeLeft=function(e){var t=e.screenX-this.resizeStartLeft,i=this.originLeft+t,o=this.originWidth-t;return!this.options.canExceedContainer&&i<0?(i=0,o=this.originWidth+this.originLeft):i>this.originLeft+this.originWidth-20&&(i=this.originLeft+this.originWidth-20,o=20),{left:i,width:o}},e.prototype._resizeTop=function(e){var t=e.screenY-this.resizeStartTop,i=this.originTop+t,o=this.originHeight-t;return!this.options.canExceedContainer&&i<0?(i=0,o=this.originHeight+this.originTop):i>this.originTop+this.originHeight-20&&(i=this.originTop+this.originHeight-20,o=20),{top:i,height:o}},e.prototype._resizeRight=function(e){if(!this.container)return vu.debug("".concat(this.logPrefix,"_resizeRight error. No container:"),this.container),0;var t=e.screenX-this.resizeStartLeft,i=this.originWidth+t;return i<20?i=20:!this.options.canExceedContainer&&i>this.container.offsetWidth-this.originLeft&&(i=this.container.offsetWidth-this.originLeft),i},e.prototype._resizeBottom=function(e){if(!this.container)return vu.debug("".concat(this.logPrefix,"_resizeBottom error. No container:"),this.container),0;var t=e.screenY-this.resizeStartTop,i=this.originHeight+t;return i<20?i=20:!this.options.canExceedContainer&&i>this.container.offsetHeight-this.originTop&&(i=this.container.offsetHeight-this.originTop),i},e.prototype.mouseup=function(){document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1),this.currentAnchor=null,this.resizeStartLeft=0,this.resizeStartTop=0,this.originLeft=0,this.originTop=0,this.originWidth=0,this.originHeight=0},e.prototype.on=function(e,t){var i=this.callbacksMap.get(e);i?i.push(t):this.callbacksMap.set(e,[t])},e.prototype.off=function(e,t){var i=this.callbacksMap.get(e);i&&(i=i.filter((function(e){return e!=t})),this.callbacksMap.set(e,i))},e.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var o=this.callbacksMap.get(e);o&&o.slice().forEach((function(e){try{e.apply(null,t)}catch(i){console.error("[Resizable]emit error:",e,i)}}))},e.prototype.destroy=function(){var e,t,i,o,r,n,s,a,c,u,l,h,d,p,f,v;null===(e=this.topLeftAnchor)||void 0===e||e.removeEventListener("mousedown",this.mousedown,!1),null===(t=this.topAnchor)||void 0===t||t.removeEventListener("mousedown",this.mousedown,!1),null===(i=this.topRightAnchor)||void 0===i||i.removeEventListener("mousedown",this.mousedown,!1),null===(o=this.leftAnchor)||void 0===o||o.removeEventListener("mousedown",this.mousedown,!1),null===(r=this.rightAnchor)||void 0===r||r.removeEventListener("mousedown",this.mousedown,!1),null===(n=this.bottomLeftAnchor)||void 0===n||n.removeEventListener("mousedown",this.mousedown,!1),null===(s=this.bottomAnchor)||void 0===s||s.removeEventListener("mousedown",this.mousedown,!1),null===(a=this.bottomRightAnchor)||void 0===a||a.removeEventListener("mousedown",this.mousedown,!1),this.callbacksMap.clear(),this.options.anchorMode!==pu.Both&&this.options.anchorMode!==pu.Edge||(this.topAnchor&&(null===(c=this.resizeTarget)||void 0===c||c.removeChild(this.topAnchor)),this.leftAnchor&&(null===(u=this.resizeTarget)||void 0===u||u.removeChild(this.leftAnchor)),this.rightAnchor&&(null===(l=this.resizeTarget)||void 0===l||l.removeChild(this.rightAnchor)),this.bottomAnchor&&(null===(h=this.resizeTarget)||void 0===h||h.removeChild(this.bottomAnchor))),this.options.anchorMode!==pu.Both&&this.options.anchorMode!==pu.Corner||(this.topLeftAnchor&&(null===(d=this.resizeTarget)||void 0===d||d.removeChild(this.topLeftAnchor)),this.topRightAnchor&&(null===(p=this.resizeTarget)||void 0===p||p.removeChild(this.topRightAnchor)),this.bottomLeftAnchor&&(null===(f=this.resizeTarget)||void 0===f||f.removeChild(this.bottomLeftAnchor)),this.bottomRightAnchor&&(null===(v=this.resizeTarget)||void 0===v||v.removeChild(this.bottomRightAnchor))),this.topLeftAnchor=null,this.topAnchor=null,this.topRightAnchor=null,this.leftAnchor=null,this.rightAnchor=null,this.bottomLeftAnchor=null,this.bottomAnchor=null,this.bottomRightAnchor=null,this.resizeTarget=null,this.container=null,this.currentAnchor=null,this.resizeStartLeft=0,this.resizeStartTop=0,this.originLeft=0,this.originTop=0,this.originWidth=0,this.originHeight=0},e.prototype.setVisible=function(e){var t=e?"block":"none";this.topLeftAnchor&&(this.topLeftAnchor.style.display=t),this.topAnchor&&(this.topAnchor.style.display=t),this.topRightAnchor&&(this.topRightAnchor.style.display=t),this.leftAnchor&&(this.leftAnchor.style.display=t),this.rightAnchor&&(this.rightAnchor.style.display=t),this.bottomLeftAnchor&&(this.bottomLeftAnchor.style.display=t),this.bottomAnchor&&(this.bottomAnchor.style.display=t),this.bottomRightAnchor&&(this.bottomRightAnchor.style.display=t)},e}(),Au=function(){var e=new Map;for(var t in m)if(isNaN(Number(t))){var i=m[t],o=t.split("_");e.set(i,{width:parseInt(o[1]),height:parseInt(o[2])})}return e}(),Pu=function(){function e(e){if(this.logPrefix="[TRTCMediaMixingDesigner]",this.mixingVideoWidth=640,this.mixingVideoHeight=360,this.canExceedContainer=!1,this.movableHandler=null,this.resizableHandler=null,this.previewScale=1,this.previewWidth=0,this.previewHeight=0,this.previewLeft=0,this.previewTop=0,this.BOUNDARY_ADSORPTION_THRESHOLD=10,this.newSelected=null,this.clickedMediaSources=[],this.oldSelectedIndex=-1,this.mousedownLeft=null,this.mousedownTop=null,this.eventButton=null,this.resizeObserver=null,this.logger=e.logger,this.container=e.view,this.container.style.position="relative",this.videoResolution=e.videoResolution,this.resMode=e.resMode,Au.has(e.videoResolution)){var t=Au.get(e.videoResolution),i=t.width,o=t.height;this.resMode===O.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=i,this.mixingVideoHeight=o):(this.mixingVideoWidth=o,this.mixingVideoHeight=i)}this.updatePreviewProperty(),this.canExceedContainer=e.canExceedContainer||!1,this.eventEmitter=new w,this.mediaList=[],this.selectedMediaIndex=-1,this.moveAndResizeOverlay=document.createElement("div"),this.moveAndResizeOverlay.style.position="relative",this.container.appendChild(this.moveAndResizeOverlay),this.initMediaMovable(),this.initMediaResizable(),this.initContainerMouseEventHander(),this.initContainerResizeObserver()}return e.prototype.updateOptions=function(e){if(!Te(e.videoResolution)||!Te(e.resMode)){if(this.resMode=Te(e.resMode)?this.resMode:e.resMode,e.videoResolution&&Au.has(e.videoResolution)){var t=Au.get(e.videoResolution),i=t.width,o=t.height;this.resMode===O.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=i,this.mixingVideoHeight=o):(this.mixingVideoWidth=o,this.mixingVideoHeight=i)}this.updatePreviewProperty(),this.updateOverlay()}},e.prototype.addMedia=function(e){this.mediaList.unshift(e),e.isSelected&&(this.selectedMediaIndex=0,this.updateOverlay())},e.prototype.removeMedia=function(e){var t=this.mediaList.findIndex((function(t){return t.id===e.id}));-1!==t&&(this.mediaList.splice(t,1),(this.selectedMediaIndex===t||e.isSelected)&&(this.selectedMediaIndex=-1,this.updateOverlay()))},e.prototype.updateMedia=function(e){var t=this.mediaList.findIndex((function(t){return t.id===e.id}));-1!==t&&(this.mediaList[t]=Object.assign({},this.mediaList[t],e),e.isSelected&&(this.selectedMediaIndex=t,this.updateOverlay()))},e.prototype.on=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.on(e,t)},e.prototype.off=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.off(e,t)},e.prototype.destroy=function(){var e,t,i,o;this.resizeObserver&&(this.container&&this.resizeObserver.unobserve(this.container),this.resizeObserver.disconnect(),this.resizeObserver=null),null===(e=this.movableHandler)||void 0===e||e.destroy(),null===(t=this.resizableHandler)||void 0===t||t.destroy(),this.movableHandler=null,this.resizableHandler=null,null===(i=this.container)||void 0===i||i.removeEventListener("contextmenu",this.onRightButtonClicked,!1),document.removeEventListener("mousedown",this.onContainerMousedown,!1),this.moveAndResizeOverlay&&(null===(o=this.container)||void 0===o||o.removeChild(this.moveAndResizeOverlay),this.moveAndResizeOverlay=null),this.container=null,this.eventEmitter=null,this.mediaList=[]},e.prototype.initMediaMovable=function(){this.onMove=this.onMove.bind(this),this.movableHandler=new gu(this.moveAndResizeOverlay,this.container,{canExceedContainer:this.canExceedContainer,calcPositionOnly:!1}),this.movableHandler.on("move",this.onMove)},e.prototype.initMediaResizable=function(){this.onResize=this.onResize.bind(this),this.resizableHandler=new Eu(this.moveAndResizeOverlay,this.container,{keepRatio:!0,stopPropagation:!0,canExceedContainer:this.canExceedContainer,anchorMode:0}),this.resizableHandler.on("resize",this.onResize)},e.prototype.updateCanExceedContainer=function(e){this.movableHandler&&(this.movableHandler.options.canExceedContainer=e),this.resizableHandler&&(this.resizableHandler.options.canExceedContainer=e)},e.prototype.initContainerMouseEventHander=function(){this.container?(this.onContainerMousedown=this.onContainerMousedown.bind(this),this.onContainerMousemove=this.onContainerMousemove.bind(this),this.onContainerMouseup=this.onContainerMouseup.bind(this),document.addEventListener("mousedown",this.onContainerMousedown,!1),this.onRightButtonClicked=this.onRightButtonClicked.bind(this),this.container.addEventListener("contextmenu",this.onRightButtonClicked,!1)):this.logger.error("".concat(this.logPrefix,"initContainerMouseEventHander failed, no container view"))},e.prototype.initContainerResizeObserver=function(){this.container&&(this.onPreviewAreaResize=this.onPreviewAreaResize.bind(this),this.resizeObserver=new ResizeObserver(this.onPreviewAreaResize),this.resizeObserver.observe(this.container))},e.prototype.onPreviewAreaResize=function(e){for(var t=0,i=e;t<i.length;t++){if(i[t].target===this.container){this.updatePreviewProperty(),this.updateOverlay();break}}},e.prototype.updatePreviewProperty=function(){if(this.container){var e=this.container.offsetWidth,t=this.container.offsetHeight,i=e/this.mixingVideoWidth,o=t/this.mixingVideoHeight;this.previewScale=i>o?i:o,this.previewWidth=this.mixingVideoWidth*this.previewScale,this.previewHeight=this.mixingVideoHeight*this.previewScale,this.previewLeft=(e-this.previewWidth)/2,this.previewTop=(t-this.previewHeight)/2}else console.debug("".concat(this.logPrefix,"calcPreviewScale failed, no HTML element to display"))},e.prototype.updateOverlay=function(){if(this.moveAndResizeOverlay){var e=void 0,t=void 0,i=void 0,o=void 0;if(this.selectedMediaIndex>=0){var r=this.mediaList[this.selectedMediaIndex],n={left:r.rect.left*this.previewScale,top:r.rect.top*this.previewScale,right:r.rect.right*this.previewScale,bottom:r.rect.bottom*this.previewScale};e="".concat(n.left+this.previewLeft,"px"),t="".concat(n.top+this.previewTop,"px"),i="".concat(n.right-n.left,"px"),o="".concat(n.bottom-n.top,"px");var s=r.interaction||{},a=!1!==s.showBorder,c=!1!==s.showResizeAnchors,u=!1!==s.draggable,l=!1!==s.canExceedCanvas;this.logger.debug("".concat(this.logPrefix,"updateOverlay: interaction config -"),{showBorder:a,showResizeAnchors:c,draggable:u,canExceedCanvas:l}),this.updateCanExceedContainer(l),this.moveAndResizeOverlay.style.display="block",this.moveAndResizeOverlay.style.border=a?"1px solid #3D7EFD":"none",this.resizableHandler&&this.resizableHandler.setVisible(c),this.movableHandler&&(this.logger.debug("".concat(this.logPrefix,"updateOverlay: setting movableHandler.setEnabled(").concat(u,")")),this.movableHandler.setEnabled(u))}else e="".concat(this.previewLeft,"px"),t="".concat(this.previewTop,"px"),i="0px",o="0px",this.moveAndResizeOverlay.style.display="none";this.moveAndResizeOverlay.style.left=e,this.moveAndResizeOverlay.style.top=t,this.moveAndResizeOverlay.style.width=i,this.moveAndResizeOverlay.style.height=o}},e.prototype.onMove=function(e,t){var i;console.debug("".concat(this.logPrefix,"onMove: ").concat(e," ").concat(t));var o=this.mediaList[this.selectedMediaIndex];if(o&&this.moveAndResizeOverlay){var r={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+this.moveAndResizeOverlay.offsetWidth,bottom:t-this.previewTop+this.moveAndResizeOverlay.offsetHeight};this.doAdsorption(r);var n={left:Math.round(r.left/this.previewScale),top:Math.round(r.top/this.previewScale),right:Math.round(r.right/this.previewScale),bottom:Math.round(r.bottom/this.previewScale)};null===(i=this.eventEmitter)||void 0===i||i.emit("onSourceMoved",a({},o),n)}else console.debug("".concat(this.logPrefix,"onMove no selected media"))},e.prototype.doAdsorption=function(e){var t=this.BOUNDARY_ADSORPTION_THRESHOLD;Math.abs(e.left)<t&&(e.right=e.right-e.left,e.left=0),Math.abs(e.top)<t&&(e.bottom=e.bottom-e.top,e.top=0),Math.abs(e.right-this.previewWidth)<t&&(e.left=e.left+this.previewWidth-e.right,e.right=this.previewWidth),Math.abs(e.bottom-this.previewHeight)<t&&(e.top=e.top+this.previewHeight-e.bottom,e.bottom=this.previewHeight)},e.prototype.onResize=function(e,t,i,o){var r;console.debug("".concat(this.logPrefix,"onResize: ").concat(e," ").concat(t," ").concat(i," ").concat(o));var n=this.mediaList[this.selectedMediaIndex];if(n){var s=n.interaction||{};if(!fe(s.showResizeAnchors)&&!s.showResizeAnchors)return;var c={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+i,bottom:t-this.previewTop+o},u={left:Math.round(c.left/this.previewScale),top:Math.round(c.top/this.previewScale),right:Math.round(c.right/this.previewScale),bottom:Math.round(c.bottom/this.previewScale)};null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",a({},n),u)}else console.debug("".concat(this.logPrefix,"onResize no selected media"))},e.prototype.getMaxZOrderMedia=function(e){var t,i,o,r,n,s;if(0===e.length)return null;for(var a=e[0],c=null!==(o=null===(i=null===(t=a.origin)||void 0===t?void 0:t.layout)||void 0===i?void 0:i.zOrder)&&void 0!==o?o:-Infinity,u=1;u<e.length;u++){var l=null!==(s=null===(n=null===(r=e[u].origin)||void 0===r?void 0:r.layout)||void 0===n?void 0:n.zOrder)&&void 0!==s?s:-Infinity;l>c&&(c=l,a=e[u])}return a},e.prototype.emitOnSelect=function(e){var t;if(e){for(var i=this.mediaList.length,o=0;o<i;o++)if(e.id===this.mediaList[o].id){this.selectedMediaIndex=o;break}}else this.selectedMediaIndex=-1;this.updateOverlay(),null===(t=this.eventEmitter)||void 0===t||t.emit("onSourceSelected",e?a({},e):null)},e.prototype.onContainerMousedown=function(e){var t;console.debug("".concat(this.logPrefix,"onContainerMousedown event:"),e,e.target,e.currentTarget);var i=e.target;if(this.eventButton=e.button,i&&this.container){if(this.container.contains(i)){console.debug("".concat(this.logPrefix,"onContainerMousedown mix video image clicked"));var o=this.container.getBoundingClientRect(),r=e.clientX-o.x-this.previewLeft,n=e.clientY-o.y-this.previewTop,s=r/this.previewScale,a=n/this.previewScale;console.debug("".concat(this.logPrefix,"onContainerMousedown click point coordinates in mix video:"),r,n,s,a);for(var c=0;c<this.mediaList.length;c++){var u=this.mediaList[c];u.rect&&s>=u.rect.left&&s<=u.rect.right&&a>=u.rect.top&&a<=u.rect.bottom&&!1!==(null===(t=u.interaction)||void 0===t?void 0:t.selectable)&&(this.clickedMediaSources.push(u),this.mediaList[this.selectedMediaIndex]&&u.id===this.mediaList[this.selectedMediaIndex].id&&(this.oldSelectedIndex=this.clickedMediaSources.length-1))}this.mousedownLeft=e.screenX,this.mousedownTop=e.screenY}this.clickedMediaSources.length>0?2===this.eventButton&&-1===this.oldSelectedIndex?(this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMousedown find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected),this.clickedMediaSources.splice(0,this.clickedMediaSources.length)):(document.addEventListener("mousemove",this.onContainerMousemove,!1),document.addEventListener("mouseup",this.onContainerMouseup,!1)):(this.newSelected=null,console.debug("".concat(this.logPrefix,"onContainerMousedown find clicked media source:"),this.newSelected),this.emitOnSelect(null),this.mousedownLeft=null,this.mousedownTop=null,this.eventButton=null)}},e.prototype.onContainerMousemove=function(e){var t;if(e.target&&this.container&&null!==this.mousedownLeft&&null!==this.mousedownTop){var i=e.screenX-this.mousedownLeft,o=e.screenY-this.mousedownTop;(Math.abs(i)>=5||Math.abs(o)>=5)&&(this.oldSelectedIndex>=0?(console.debug("".concat(this.logPrefix,"onContainerMousemove move or resize old selected media source, clear data:"),this.clickedMediaSources,this.oldSelectedIndex),this.clickedMediaSources.splice(0,this.clickedMediaSources.length),this.oldSelectedIndex=-1):this.clickedMediaSources.length>0&&(this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMousemove find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected),this.clickedMediaSources.splice(0,this.clickedMediaSources.length),null===(t=this.moveAndResizeOverlay)||void 0===t||t.dispatchEvent(new MouseEvent("mousedown",{screenX:this.mousedownLeft,screenY:this.mousedownTop,button:this.eventButton}))))}},e.prototype.onContainerMouseup=function(e){if(document.removeEventListener("mousemove",this.onContainerMousemove,!1),document.removeEventListener("mouseup",this.onContainerMouseup,!1),console.debug("".concat(this.logPrefix,"onContainerMouseup data:"),this.clickedMediaSources,this.oldSelectedIndex),e.target&&this.container){if(this.clickedMediaSources.length>0)if(this.oldSelectedIndex>=0){if(0===this.eventButton){var t=(this.oldSelectedIndex+1)%this.clickedMediaSources.length;this.newSelected=this.clickedMediaSources[t],console.debug("".concat(this.logPrefix,"onContainerMouseup find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected)}}else this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMouseup find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected)}else console.debug("".concat(this.logPrefix,"onContainerMouseup click outside of mixing video image")),this.emitOnSelect(null);this.mousedownLeft=null,this.mousedownTop=null,this.clickedMediaSources.splice(0,this.clickedMediaSources.length),this.oldSelectedIndex=-1,this.newSelected=null,this.eventButton=null},e.prototype.onRightButtonClicked=function(e){var t;console.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e.target,e.currentTarget,e.buttons),e.preventDefault(),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",a({},this.mediaList[this.selectedMediaIndex]))},e}(),Lu=function(){function t(e){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new w,this.publishParams={videoEncoderParams:{videoResolution:m.TRTCVideoResolution_1280_720,resMode:O.TRTCVideoResolutionModeLandscape,videoFps:15,videoBitrate:1800},canvasColor:0},this.mediaMixingDesigner=null,this.sourceList=[],this.trtcSourceMap=new Map,this.mixVideoTrack=null,this.selectedSource=null,this.view=null,this.screensWithSystemAudio=new Set,t.mediaMixingManager)return t.mediaMixingManager;t.mediaMixingManager=this,this.logger=e.logger,this.trtc=e.trtc,this.trtcCloud=e.trtcCloud,this.onSourceSelected=this.onSourceSelected.bind(this),this.onSourceMoved=this.onSourceMoved.bind(this),this.onSourceResized=this.onSourceResized.bind(this),this.onRightButtonClicked=this.onRightButtonClicked.bind(this)}return t.prototype.destroy=function(){return u(this,void 0,Promise,(function(){var e,i,o,r,n;return l(this,(function(s){switch(s.label){case 0:this.view=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.trtc.stopPlugin("VideoMixer")];case 2:return s.sent(),[3,4];case 3:return e=s.sent(),this.logger.error("".concat(this.logPrefix," destroy and stopPlugin error:"),e),[3,4];case 4:if(!(this.screensWithSystemAudio.size>0))return[3,12];s.label=5;case 5:s.trys.push([5,10,,11]),i=0,o=Array.from(this.screensWithSystemAudio),s.label=6;case 6:return i<o.length?(r=o[i],[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(r)})]):[3,9];case 7:s.sent(),s.label=8;case 8:return i++,[3,6];case 9:return[3,11];case 10:return n=s.sent(),this.logger.error("".concat(this.logPrefix," destroy and stopPlugin AudioMixer error:"),n),[3,11];case 11:this.screensWithSystemAudio.clear(),s.label=12;case 12:return this.destroyDesigner(),this.eventEmitter=null,t.mediaMixingManager=null,[2]}}))}))},t.prototype.bindPreviewArea=function(e){return u(this,void 0,Promise,(function(){var t,i,o,r,n=this;return l(this,(function(s){switch(s.label){case 0:return this.logger.log("".concat(this.logPrefix," bindPreviewArea:"),e),this.view=e,t=this._getCanvasSize(this.publishParams.videoEncoderParams.videoResolution,this.publishParams.videoEncoderParams.resMode),i=t.width,o=t.height,[4,this.trtc.startPlugin("VideoMixer",{view:e,canvasInfo:{width:i,height:o,canvasColor:String(this.publishParams.canvasColor)},onScreenShareStop:function(e){var t,i=n.sourceList.find((function(t){return t.id===e}));n.removeMediaSource(i),null===(t=n.eventEmitter)||void 0===t||t.emit("onSourceDisconnected",i||null)}})];case 1:return r=s.sent(),console.log("startPlugin result",r,r.track),this.mixVideoTrack=r.track,this.createDesigner(),[2]}}))}))},t.prototype._getTRTCSourceKey=function(e){var t;return((t={})[$c.kCamera]="camera",t[$c.kScreen]="screen",t[$c.kText]="text",t[$c.kVideo]="video",t[$c.kImage]="image",t)[e.type]},t.prototype._getTRTCFillMode=function(e){var t;return((t={})[y.TRTCVideoFillMode_Fill]="cover",t[y.TRTCVideoFillMode_Fit]="contain",t)[e]},t.prototype._getTRTCVideoProfile=function(e,t){var i,o=((i={})[m.TRTCVideoResolution_480_270]={width:480,height:270},i[m.TRTCVideoResolution_640_360]={width:640,height:360},i[m.TRTCVideoResolution_960_540]={width:960,height:540},i[m.TRTCVideoResolution_1280_720]={width:1280,height:720},i[m.TRTCVideoResolution_1920_1080]={width:1920,height:1080},i);return{width:o[e].width,height:o[e].height,frameRate:t,bitrate:1e3}},t.prototype._getTRTCLayout=function(e){var t,i,o,r,n,s,a,c,u,l,h,d,p,f,v,g,m={zIndex:(null===(o=e.layout)||void 0===o?void 0:o.zOrder)||0};if(fe(null===(r=e.layout)||void 0===r?void 0:r.rect)||(m.x=null===(n=e.layout)||void 0===n?void 0:n.rect.left,m.y=null===(s=e.layout)||void 0===s?void 0:s.rect.top,m.width=(null===(a=e.layout)||void 0===a?void 0:a.rect.right)-(null===(c=e.layout)||void 0===c?void 0:c.rect.left),m.height=(null===(u=e.layout)||void 0===u?void 0:u.rect.bottom)-(null===(l=e.layout)||void 0===l?void 0:l.rect.top)),fe(null===(h=e.layout)||void 0===h?void 0:h.fillMode)||(m.fillMode=this._getTRTCFillMode(null===(d=e.layout)||void 0===d?void 0:d.fillMode)),!fe(null===(p=e.layout)||void 0===p?void 0:p.mirror)){var T=((t={})[_.TRTCVideoMirrorType_Auto]=!0,t[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t);m.mirror=T[null===(f=e.layout)||void 0===f?void 0:f.mirror]}if(!fe(null===(v=e.layout)||void 0===v?void 0:v.rotation)){var y=((i={})[P.TRTCVideoRotation0]=0,i[P.TRTCVideoRotation90]=90,i[P.TRTCVideoRotation180]=180,i[P.TRTCVideoRotation270]=270,i);m.rotation=y[null===(g=e.layout)||void 0===g?void 0:g.rotation]}return m},t.prototype._getTRTCSourceItem=function(e){var t,i,o,r,n,s,c,u,l,h;switch(e.type){case $c.kScreen:return h=m.TRTCVideoResolution_1920_1080,(null==e?void 0:e.useInternalTrack)?{id:e.id,layout:this._getTRTCLayout(e),useInternalTrack:!0}:{id:e.id,profile:this._getTRTCVideoProfile((null===(t=e.screen)||void 0===t?void 0:t.resolution)||h,(null===(i=e.screen)||void 0===i?void 0:i.fps)||15),layout:this._getTRTCLayout(e),systemAudio:null===(o=e.screen)||void 0===o?void 0:o.systemAudio};case $c.kCamera:return h=m.TRTCVideoResolution_1280_720,(null==e?void 0:e.useInternalTrack)?{id:e.id,layout:this._getTRTCLayout(e),useInternalTrack:!0}:{id:e.id,cameraId:null===(r=e.camera)||void 0===r?void 0:r.cameraId,profile:this._getTRTCVideoProfile((null===(n=e.camera)||void 0===n?void 0:n.resolution)||h,(null===(s=e.camera)||void 0===s?void 0:s.fps)||15),videoTrack:null===(c=e.camera)||void 0===c?void 0:c.videoTrack,layout:this._getTRTCLayout(e)};case $c.kText:return a(a({id:e.id},e.text||{}),{layout:this._getTRTCLayout(e)});case $c.kImage:return{id:e.id,url:null===(u=e.image)||void 0===u?void 0:u.url,layout:this._getTRTCLayout(e)};case $c.kVideo:return{id:e.id,url:null===(l=e.video)||void 0===l?void 0:l.url,layout:this._getTRTCLayout(e)};default:return null}},t.prototype._getCanvasSize=function(e,t){var i,o,r=((i={})[m.TRTCVideoResolution_480_270]={width:480,height:270},i[m.TRTCVideoResolution_640_360]={width:640,height:360},i[m.TRTCVideoResolution_960_540]={width:960,height:540},i[m.TRTCVideoResolution_1280_720]={width:1280,height:720},i[m.TRTCVideoResolution_1920_1080]={width:1920,height:1080},i)[e],n=r.width,s=r.height;return t===O.TRTCVideoResolutionModePortrait&&(n=(o=[s,n])[0],s=o[1]),{width:n,height:s}},t.prototype.addMediaSource=function(e){var t;return u(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:if(-1!==this.findMediaSourceIndex(e))throw new Error("Media source already existed");if(i=_e(e),o=this._getTRTCSourceKey(i),!(r=this._getTRTCSourceItem(i))||!o)throw new Error("Invalid media source");return(n=_e(this.trtcSourceMap.get(o))||[]).push(r),[4,this.trtc.updatePlugin("VideoMixer",(h={},h[o]=n,h))];case 1:return s=l.sent(),a=s.result,c=s.systemAudioTrackList,e.type===$c.kScreen&&(null==c?void 0:c[e.id])?(this.screensWithSystemAudio.add(e.id),u=null==c?void 0:c[e.id],this.logger.log("".concat(this.logPrefix," startPlugin AudioMixer, track ID:"),u.id),[4,this.trtc.startPlugin("AudioMixer",{id:"systemAudioTrack_".concat(e.id),track:u})]):[3,3];case 2:l.sent(),l.label=3;case 3:if(a.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to add media source");return i.isSelected&&(this.unselectMediaSource(this.selectedSource),this.selectedSource=e),this.trtcSourceMap.set(o,n),null===(t=this.mediaMixingDesigner)||void 0===t||t.addMedia({id:i.id,rect:this._getDesignerMediaRect(e),isSelected:!!fe(i.isSelected)||i.isSelected,origin:i,interaction:i.interaction}),i.isSelected&&(this.selectedSource=i),this.sourceList.push(i),[2]}}))}))},t.prototype.removeMediaSource=function(e){var t,i,o;return u(this,void 0,Promise,(function(){var r,n,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:if(this.logger.log("".concat(this.logPrefix,"removeMediaSource:"),e),-1===(r=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to remove");return n=this._getTRTCSourceKey(e),s=_e(this.trtcSourceMap.get(n))||[],a=s.findIndex((function(t){return t.id===e.id})),s.splice(a,1),[4,this.trtc.updatePlugin("VideoMixer",(u={},u[n]=s,u))];case 1:return c=l.sent().result,e.type===$c.kScreen&&this.screensWithSystemAudio.has(e.id)?(this.screensWithSystemAudio.delete(e.id),[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(e.id)})]):[3,3];case 2:l.sent(),l.label=3;case 3:if(c.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to remove media source");return null===(t=this.mediaMixingDesigner)||void 0===t||t.removeMedia({id:e.id,rect:null===(i=e.layout)||void 0===i?void 0:i.rect,isSelected:e.isSelected||!1,origin:_e(e)}),(null===(o=this.selectedSource)||void 0===o?void 0:o.id)===e.id&&(this.selectedSource=null),this.trtcSourceMap.set(n,s),this.sourceList.splice(r,1),[2]}}))}))},t.prototype._getDesignerMediaRect=function(e){var t,i,o=(null===(t=e.layout)||void 0===t?void 0:t.rect)||{left:0,top:0,right:0,bottom:0},r=o.left,n=o.top,s=o.right,a=o.bottom,c=s-r,u=a-n;switch(null===(i=e.layout)||void 0===i?void 0:i.rotation){case P.TRTCVideoRotation0:case P.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case P.TRTCVideoRotation90:case P.TRTCVideoRotation270:return{left:r,top:n,right:r+u,bottom:n+c};default:return{left:r,top:n,right:s,bottom:a}}},t.prototype._getPluginMediaRect=function(e){var t,i,o=(null===(t=e.layout)||void 0===t?void 0:t.rect)||{left:0,top:0,right:0,bottom:0},r=o.left,n=o.top,s=o.right,a=o.bottom;switch(null===(i=e.layout)||void 0===i?void 0:i.rotation){case P.TRTCVideoRotation0:case P.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case P.TRTCVideoRotation90:case P.TRTCVideoRotation270:return{left:r,top:n,right:r+(a-n),bottom:n+(s-r)};default:return{left:r,top:n,right:s,bottom:a}}},t.prototype.updateMediaSource=function(e){var t,i;return u(this,void 0,Promise,(function(){var o,r,n,s,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:if(this.logger.log("".concat(this.logPrefix,"updateMediaSource:"),e),-1===(o=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to update");return r=a(a({},this.sourceList[o]),_e(e)),e.isSelected?(this.unselectMediaSource(this.selectedSource),this.selectedSource=e):(null===(t=this.selectedSource)||void 0===t?void 0:t.id)===e.id&&(this.selectedSource=null),n=this._getTRTCSourceKey(r),s=this._getTRTCSourceItem(r),c=_e(this.trtcSourceMap.get(n))||[],u=c.findIndex((function(t){return t.id===e.id})),c[u]=s,[4,this.trtc.updatePlugin("VideoMixer",(d={},d[n]=c,d))];case 1:if(l.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return h={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:_e(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(h)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(h),this.trtcSourceMap.set(n,c),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(){return u(this,void 0,Promise,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," startPublish")),[4,this.trtcCloud._startPublishVideoTrack({videoTrack:this.mixVideoTrack})];case 1:return e.sent(),[2]}}))}))},t.prototype.stopPublish=function(){return u(this,void 0,Promise,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," stopPublish")),[4,this.trtcCloud._stopPublishVideoTrack()];case 1:return e.sent(),[2]}}))}))},t.prototype.updatePublishParams=function(t){var i,o,r,n,s;return u(this,void 0,Promise,(function(){var a,c,u,h,d,f,v,g,m,T,y,_,R,b,C,S,w,M,E,A,P,L,V,I;return l(this,(function(l){switch(l.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),t),a=this.publishParams,this.publishParams=t,c=this._getCanvasSize(t.videoEncoderParams.videoResolution,t.videoEncoderParams.resMode),u=c.width,h=c.height,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:u,height:h,canvasColor:String(t.canvasColor)}})];case 2:return l.sent(),[3,4];case 3:if((d=l.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw d;return[3,4];case 4:null===(r=this.mediaMixingDesigner)||void 0===r||r.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),l.label=5;case 5:l.trys.push([5,11,12,17]),f=p(this.sourceList),l.label=6;case 6:return[4,f.next()];case 7:return(v=l.sent()).done?[3,10]:(g=v.value).layout?(m=g.layout.rect||{left:0,top:0,right:0,bottom:0},T=m.left,y=m.top,_=m.right,R=m.bottom,b=this._getCanvasSize(a.videoEncoderParams.videoResolution),C=b.width,S=b.height,w=this._getCanvasSize(t.videoEncoderParams.videoResolution),M=w.width,E=w.height,A=T*M/C,P=y*E/S,L=_*M/C,V=R*E/S,g.layout.rect={left:A,top:P,right:L,bottom:V},[4,this.updateMediaSource(g)]):[3,9];case 8:l.sent(),null===(n=this.eventEmitter)||void 0===n||n.emit("onSourceResized",g,null===(s=g.layout)||void 0===s?void 0:s.rect),l.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return I=l.sent(),i={error:I},[3,17];case 12:return l.trys.push([12,,15,16]),v&&!v.done&&(o=f.return)?[4,o.call(f)]:[3,14];case 13:l.sent(),l.label=14;case 14:return[3,16];case 15:if(i)throw i.error;return[7];case 16:return[7];case 17:return[4,this.trtcCloud.setVideoEncoderParam(t.videoEncoderParams)];case 18:return l.sent(),[2]}}))}))},t.prototype.on=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.on(e,t)},t.prototype.off=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.off(e,t)},t.prototype.onVisibilityChange=function(){this.logger.log("".concat(this.logPrefix,"onVisibilityChange document.hidden:").concat(document.hidden)),document.hidden?this.bindPreviewArea(null):this.bindPreviewArea(this.view)},t.prototype.createDesigner=function(){var e,t;this.view&&(this.mediaMixingDesigner=new Pu({view:this.view,videoResolution:(null===(e=this.publishParams)||void 0===e?void 0:e.videoEncoderParams.videoResolution)||m.TRTCVideoResolution_1920_1080,resMode:(null===(t=this.publishParams)||void 0===t?void 0:t.videoEncoderParams.resMode)||O.TRTCVideoResolutionModeLandscape,canExceedContainer:!0,logger:this.logger}),this.listenDesignerEvent())},t.prototype.destroyDesigner=function(){var e;this.mediaMixingDesigner&&(this.unlistenDesignerEvent(),null===(e=this.mediaMixingDesigner)||void 0===e||e.destroy(),this.mediaMixingDesigner=null)},t.prototype.listenDesignerEvent=function(){var e,t,i,o,r;null===(e=this.mediaMixingDesigner)||void 0===e||e.on("onError",this.onError),null===(t=this.mediaMixingDesigner)||void 0===t||t.on("onSourceSelected",this.onSourceSelected),null===(i=this.mediaMixingDesigner)||void 0===i||i.on("onSourceMoved",this.onSourceMoved),null===(o=this.mediaMixingDesigner)||void 0===o||o.on("onSourceResized",this.onSourceResized),null===(r=this.mediaMixingDesigner)||void 0===r||r.on("onRightButtonClicked",this.onRightButtonClicked)},t.prototype.unlistenDesignerEvent=function(){var e,t,i,o,r;null===(e=this.mediaMixingDesigner)||void 0===e||e.off("onError",this.onError),null===(t=this.mediaMixingDesigner)||void 0===t||t.off("onSourceSelected",this.onSourceSelected),null===(i=this.mediaMixingDesigner)||void 0===i||i.off("onSourceMoved",this.onSourceMoved),null===(o=this.mediaMixingDesigner)||void 0===o||o.off("onSourceResized",this.onSourceResized),null===(r=this.mediaMixingDesigner)||void 0===r||r.off("onRightButtonClicked",this.onRightButtonClicked)},t.prototype.onError=function(e,t){this.logger.log("".concat(this.logPrefix,"onError:"),e,t)},t.prototype.onSourceSelected=function(e){var t;return u(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return this.logger.debug("".concat(this.logPrefix,"onSourceSelected: "),e,this.selectedSource),e&&this.selectedSource&&e.origin.id===this.selectedSource.id?[2]:(null==e?void 0:e.origin)?(this.updateMediaSource(a(a({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(a(a({},this.selectedSource),{isSelected:!1}))]:[3,3];case 2:i.sent(),this.selectedSource=null,i.label=3;case 3:return null===(t=this.eventEmitter)||void 0===t||t.emit("onSourceSelected",e?e.origin:null),[2]}}))}))},t.prototype.onSourceMoved=function(e,t){var i,o;if(this.logger.debug("".concat(this.logPrefix,"onSourceMoved:"),e,t),null==e?void 0:e.origin){var r=a(a({},e.origin),{layout:a(a({},e.origin.layout),{rect:t})});this.updateMediaSource(ye(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id}))),null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceMoved",e.origin,this._getPluginMediaRect(r))}},t.prototype.onSourceResized=function(e,t){var i,o;if(this.logger.debug("".concat(this.logPrefix,"onSourceResized:"),e,t),null==e?void 0:e.origin){var r=a(a({},e.origin),{layout:a(a({},e.origin.layout),{rect:t})});this.updateMediaSource(ye(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id})))}null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceResized",e.origin,t)},t.prototype.onRightButtonClicked=function(e){var t;this.logger.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",e.origin)},t.prototype.isSameMediaSource=function(e,t){return e.id===t.id},t.prototype.isMediaSourceExisted=function(e){var t=this;return this.sourceList.some((function(i){return t.isSameMediaSource(i,e)}))},t.prototype.findMediaSourceIndex=function(e){return this.sourceList.findIndex((function(t){return t.id===e.id}))},t.prototype.unselectMediaSource=function(e){var t,i;return u(this,void 0,Promise,(function(){var o;return l(this,(function(r){return e?(-1!==(o=this.findMediaSourceIndex(e))&&(this.sourceList[o].isSelected=!1),null===(t=this.mediaMixingDesigner)||void 0===t||t.updateMedia({id:e.id,rect:null===(i=e.layout)||void 0===i?void 0:i.rect,isSelected:!1,origin:_e(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}(),Vu=function(){function e(){this.isRunning=!1,this.queue=[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastQueueItem",{get:function(){return 0===this.length?null:this.queue[this.length-1]},enumerable:!1,configurable:!0}),e.prototype.push=function(e,t,i,o){var r,n;void 0===t&&(t=!1),void 0===i&&(i=!1);var s=a(a({},e),{functionName:o}),c=new Promise((function(e,t){s.resolve=e,s.reject=t}));if(s.promise=c,t)this.length<=1?this.queue.push(s):null===(n=null===(r=this.lastQueueItem)||void 0===r?void 0:r.promise)||void 0===n||n.then(s.resolve,s.reject);else{if(i&&o&&this.queue.length>1){var u=[];this.queue=this.queue.filter((function(e,t){return 0===t||(e.functionName!==o||(u.push(e),!1))})),u.forEach((function(e){e.reject(new Error("aborted by newer task"))}))}this.queue.push(s)}return this.isRunning||this.callNext(),c},e.prototype.shift=function(){return this.queue.shift()},e.prototype.callNext=function(){var e=this;if(!this.isRunning&&0!==this.length){var t=this.queue[0],i=t.fn,o=t.args,r=t.context,n=t.resolve,s=t.reject;this.isRunning=!0,i.apply(r,o).then(n,s).finally((function(){e.isRunning=!1,e.shift(),e.callNext()}))}},e}(),Iu=new WeakMap,xu=new WeakMap,Ou=new WeakMap;function ku(e,t){return void 0===t&&(t={}),function(i,o,r){var n=r.value,s=t.deduplicate,a=void 0!==s&&s;return r.value=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var r=e.apply(void 0,t),s=Array.isArray(r)?r:[r],c=Ou.get(this)||new Map;Ou.set(this,c);for(var u=null,l=0,h=s;l<h.length;l++){var d=h[l],p=c.get(d);if(p){u=p;break}}for(var f=u||new Vu,v=0,g=s;v<g.length;v++){d=g[v];c.set(d,f)}var m=a?o:void 0;return f.push({fn:n,args:t,context:this},!1,a,m)},r}}var Du=function(){function t(e){var t=this;this.logPrefix="[AITranscriberManager]",this.listeners=new Set,this.isPaused=!1,this.isMessageListenerRegistered=!1,this.handleMessageEvent=function(e){var i=t.createMessageFromEvent(e);t._notifyListeners("onReceiveTranscriberMessage",e.roomId,i)},this.handleStateEvent=function(e){var i=e.transcriberRobotId,o=e.state,r=e.roomId,n=e.sourceLanguage,s=void 0===n?"":n,a=e.error,c=e.errorMessage,u=void 0===c?"":c;if(r&&i){if("started"===o)t._notifyListeners("onRealtimeTranscriberStarted",r,i,s);else if("stopped"===o){t._notifyListeners("onRealtimeTranscriberStopped",r,i,0)}null!=a&&t._notifyListeners("onRealtimeTranscriberError",r,i,a,u)}},this.logger=e.logger,this.trtc=e.trtc,this.registerStateListener()}return t.prototype.registerStateListener=function(){this.trtc.on(e.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},t.prototype.createMessageFromEvent=function(e){var t,i,o,r;return{segmentId:null!==(t=null==e?void 0:e.segmentId)&&void 0!==t?t:"",speakerUserId:null!==(i=null==e?void 0:e.speakerUserId)&&void 0!==i?i:"",sourceText:null!==(o=null==e?void 0:e.sourceText)&&void 0!==o?o:"",translationTexts:(null==e?void 0:e.translationTexts)?new Map(Object.entries(e.translationTexts)):void 0,timestamp:null!==(r=null==e?void 0:e.timestamp)&&void 0!==r?r:Date.now(),isCompleted:Boolean(null==e?void 0:e.isCompleted)}},t.prototype.updateMessageSubscription=function(){var t=!this.isPaused&&this.listeners.size>0;if(t&&!this.isMessageListenerRegistered)return this.trtc.on(e.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),void(this.isMessageListenerRegistered=!0);!t&&this.isMessageListenerRegistered&&(this.trtc.off(e.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),this.isMessageListenerRegistered=!1)},t.prototype.log=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.log)||void 0===t||t.call.apply(t,d([e,this.logPrefix],i,!1))},t.prototype.logError=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.error)||void 0===t||t.call.apply(t,d([e,this.logPrefix],i,!1))},t.prototype._notifyListeners=function(e){for(var t=this,i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];this.listeners.forEach((function(o){var r=o[e];if("function"==typeof r)try{r.apply(o,i)}catch(n){t.logError("Error notifying listener:",n)}}))},t.prototype.startRealtimeTranscriber=function(e){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:if(this.log("startRealtimeTranscriber:",e),!(null==e?void 0:e.sourceLanguage))throw new Error("sourceLanguage is required");t={sourceLanguage:e.sourceLanguage},e.transcriberRobotId&&(t.transcriberRobotId=e.transcriberRobotId),void 0!==e.userIdsToTranscribe&&(t.userIdsToTranscribe=e.userIdsToTranscribe),void 0!==e.translationLanguages&&(t.translationLanguages=e.translationLanguages),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.trtc.startPlugin("RealtimeTranscriber",t)];case 2:return i=r.sent(),this.log("startRealtimeTranscriber success, robotId:",i),[2,i];case 3:throw o=r.sent(),this.logError("startRealtimeTranscriber error:",o),o;case 4:return[2]}}))}))},t.prototype.stopRealtimeTranscriber=function(e){return u(this,void 0,Promise,(function(){var t;return l(this,(function(i){switch(i.label){case 0:if(this.log("stopRealtimeTranscriber:",e),!e)throw new Error("transcriberRobotId is required");i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.trtc.stopPlugin("RealtimeTranscriber",{transcriberRobotId:e})];case 2:return i.sent(),this.log("stopRealtimeTranscriber success"),[3,4];case 3:throw t=i.sent(),this.logError("stopRealtimeTranscriber error:",t),t;case 4:return[2]}}))}))},t.prototype.pauseReceivingMessage=function(){this.isPaused||(this.log("pauseReceivingMessage"),this.isPaused=!0,this.updateMessageSubscription())},t.prototype.resumeReceivingMessage=function(){this.isPaused&&(this.log("resumeReceivingMessage"),this.isPaused=!1,this.updateMessageSubscription())},t.prototype.addListener=function(e){this.listeners.add(e),this.updateMessageSubscription()},t.prototype.removeListener=function(e){this.log("removeListener"),this.listeners.delete(e),this.updateMessageSubscription()},t.prototype.destroy=function(){this.log("destroy"),this.listeners.clear(),this.isPaused=!0,this.updateMessageSubscription(),this.trtc.off(e.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},t}(),zu=e._loggerManager;zu.info("TRTCCloud Version: ".concat(du));var Bu,Nu,Fu,Hu="trtcCloud",Wu=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(Bu=function(){0!==ju.size&&Array.from(ju.values()).forEach((function(e){e.fn()}))},Nu=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];Fu>0&&clearTimeout(Fu),Fu=window.setTimeout((function(){Bu.apply(e,t),Fu=-1}),Nu)}));var ju=new Map,Qu=function(h){function p(i){void 0===i&&(i={});var o=h.call(this)||this;o._version="",o._frameWorkType=30,o._component=0,o._language=0,o._networkProxy={},o._localView=null,o._autoRecvAudio=!0,o._autoRecvVideo=!1,o._localTestView=null,o._isVideoPublish=!0,o._localRenderParams={rotation:P.TRTCVideoRotation0,fillMode:y.TRTCVideoFillMode_Fill,mirrorType:_.TRTCVideoMirrorType_Auto},o._encoderMirror=void 0,o._videoProfile={},o._isAudioPublish=!0,o._audioMuteType=!1,o._audioProfile=e.TYPE.AUDIO_PROFILE_STANDARD,o._captureVolume=100,o._playoutVolume=100,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=Ac,o._isFrontCamera=!0,o._cameraVideoTrack=null,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._isTestVirtualBackground=!1,o._isBeautyEnabled=!1,o._isTestBeautyEnabled=!1,o._remoteStatisticsUserIdList=[],o._hasJoinedRoom=!1,o._isExitingRoom=!1,o._version=du;var s=i.frameWorkType,a=void 0===s?30:s,c=i.component,u=void 0===c?0:c,l=i.language,d=void 0===l?0:l;return o._frameWorkType=a,o._component=u,o._language=d,o._trtc=e.create({enableSEI:p.enableSEI,assetsPath:p.assetsPath,enableVolumeControlInIOS:!0,plugins:[n,t,r]}),o._testTrtc=e.create(),o._log=e._loggerManager,o.logger=new fu(zu,{seq:Wu++}),o._echoCancellation=void 0,o._noiseSuppression=void 0,o._autoGainControl=void 0,o._addTRTCEvents(),o.handleDeviceChange=o.handleDeviceChange.bind(o),ju.set(o,{fn:o.handleDeviceChange,self:o}),o}var f;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 i(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(p,h),p.getPlugin=function(e){return"VirtualBackground"===e?i:"BasicBeauty"===e?o:"VideoMixer"===e?n:null},p.getTRTCShareInstance=function(e){return p.shareInstance||(p.shareInstance=new p(e)),p.shareInstance},p.setLogLevel=function(t,i){var o,r=((o={})[j.TRTCLogLevelVerbose]=0,o[j.TRTCLogLevelDebug]=1,o[j.TRTCLogLevelInfo]=2,o[j.TRTCLogLevelWarn]=3,o[j.TRTCLogLevelError]=4,o[j.TRTCLogLevelFatal]=4,o[j.TRTCLogLevelNone]=5,o),n=r[t];fe(n)&&(n=r[j.TRTCLogLevelInfo]);var s=!ge(i)||i;e.setLogLevel(n,s)},p.destroyTRTCShareInstance=function(){p.shareInstance&&(p.shareInstance._destroy(),p.shareInstance=null),Array.from(p.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},p.callExperimentalAPI=function(e){console.log("static ".concat(Hu,".callExperimentalAPI"),e);var t=me(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":p.enableSEI=o.enable;break;case"setAssetsPath":p.assetsPath=o.assetsPath}}catch(r){throw r}}},p.prototype.createSubCloud=function(){if(this!==p.shareInstance)return null;var e=new p;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),p.subCloudMap.set(e,e),e},p.prototype.destroy=function(){this!==p.shareInstance?(p.subCloudMap.get(this)&&p.subCloudMap.delete(this),this._destroy()):p.destroyTRTCShareInstance()},p.prototype._destroy=function(){ju.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},p.prototype.getSDKVersion=function(){return this._version||""},p.prototype.enterRoom=function(e,t){return u(this,void 0,Promise,(function(){var i,o,r,n,s,c,u,h,d,p,f,v,g,m,T,y,_,R;return l(this,(function(l){switch(l.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,c=e.role,u=e.privateMapKey,h=e.businessInfo,d=e.enableAutoPlayDialog,p=e.proxy,f=e.streamId,v=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(Hu,".enterRoom with params: "),e,t),p&&(this._networkProxy=p),!(i&&o&&r))return[3,5];l.label=1;case 1:return l.trys.push([1,3,,4]),g={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:le[c],scene:he[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},g=u?a(a({},g),{privateMapKey:u}):g,g=h?a(a({},g),{businessInfo:h}):g,m=d||this._enableAutoPlayDialog,g=ge(m)?a(a({},g),{enableAutoPlayDialog:m}):g,g=this._networkProxy?a(a({},g),{proxy:this._networkProxy}):g,g=f?a(a({},g),{streamId:f}):g,g=v?a(a({},g),{userDefineRecordId:v}):g,g=void 0!==this._latencyLevel?a(a({},g),{latencyLevel:this._latencyLevel}):g,T=pe(),[4,this._trtc.enterRoom(g)];case 2:return l.sent(),this._hasJoinedRoom=!0,y=pe()-T,this.emit("onEnterRoom",y),[3,4];case 3:return _=l.sent(),R=(R=this._transformTRTCErrorCode(_,"enterRoom"))<0?R:-1,this.emit("onEnterRoom",R),this._callFunctionErrorManage(_,"enterRoom"),[3,4];case 4:return[3,6];case 5:this._emitError(lu),l.label=6;case 6:return[2]}}))}))},p.prototype.exitRoom=function(){return u(this,void 0,Promise,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(Hu,".exitRoom")),this._isExitingRoom=!0,this._isSharingScreen&&this.stopScreenShare(),this.resetTRTCCloud(),this.stopLocalPreview(),this.stopLocalAudio(),[4,this._trtc.exitRoom()];case 1:return t.sent(),this._hasJoinedRoom=!1,this._isExitingRoom=!1,this._isVideoPublish=!0,this._isAudioPublish=!0,this.emit("onExitRoom",Yc.exitRoom),[3,3];case 2:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,3];case 3:return[2]}}))}))},p.prototype.switchRole=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Hu,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(le[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(le[e])),[3,4];case 3:return t=i.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),[3,4];case 4:return[2]}}))}))},p.prototype.setDefaultStreamRecvMode=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(i){return this.logger.info("".concat(Hu,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),ge(e)&&(this._autoRecvAudio=e),ge(t)&&(this._autoRecvVideo=t),[2]}))}))},p.prototype.resetTRTCCloud=function(){this._setIsAudioPublish(!0),this._setAudioMuteType(!1),this._echoCancellation=void 0,this._noiseSuppression=void 0,this._autoGainControl=void 0,this._isVirtualBackground=!1,this._isTestVirtualBackground=!1,this._remoteStatisticsUserIdList=[],this._resetBeautyStyle()},p.prototype._updateLocalVideo=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateLocalTestVideo=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateLocalScreen=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateRemoteVideo=function(t,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:if(!this._hasJoinedRoom||this._isExitingRoom)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(t,i))];case 2:return r.sent(),[3,4];case 3:if((o=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw o;return[3,4];case 4:return[2]}}))}))},p.prototype.startLocalPreview=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return u(this,void 0,Promise,(function(){var i,o,r,n,s;return l(this,(function(a){switch(a.label){case 0:this.logger.info("".concat(Hu,".startLocalPreview with params: "),t),1===d([],t,!0).length?o=d([],t,!0)[0]:2===d([],t,!0).length&&(s=d([],t,!0),i=s[0],o=s[1]),fe(i)||(this._setIsMobile(!0),this._setIsFrontCamera(i)),this._setLocalView(o),a.label=1;case 1:a.trys.push([1,9,,10]),a.label=2;case 2:return a.trys.push([2,4,,8]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return a.sent(),[3,8];case 4:return(r=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return a.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return this.emit("onCameraDidReady"),[3,10];case 9:return n=a.sent(),this._callFunctionErrorManage(n,"startLocalPreview"),[3,10];case 10:return[2]}}))}))},p.prototype.updateLocalView=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Hu,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},p.prototype.stopLocalPreview=function(){return u(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Hu,".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(),this.emit("onCameraStopped"),[3,4];case 3:return e=t.sent(),console.warn("".concat(Hu," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},p.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Hu,".muteLocalVideo with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),[3,4];case 4:return[2]}}))}))},p.prototype.startRemoteView=function(t,i,o){return u(this,void 0,void 0,(function(){var r,n;return l(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(Hu,".startRemoteView with params: "),t,i,o),s.label=1;case 1:if(s.trys.push([1,9,,10]),this._setRemoteStreamConfig(t,o,{view:i,small:o===T.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(o))))return[2];s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,o))];case 3:return s.sent(),[3,8];case 4:return(r=s.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateRemoteVideo(t,o)];case 5:return s.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return[3,10];case 9:return n=s.sent(),this._callFunctionErrorManage(n,"startRemoteView"),[3,10];case 10:return[2]}}))}))},p.prototype.updateRemoteView=function(e,t,i){return u(this,void 0,void 0,(function(){return l(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Hu,".updateRemoteView with params: "),e,t,i),this._setRemoteStreamConfig(e,i,{view:t}),this._remoteStreamMap.get("".concat(e,"_").concat(this._getTRTCStreamType(i)))?[4,this._updateRemoteVideo(e,i)]:[2];case 1:return o.sent(),[2]}}))}))},p.prototype.stopRemoteView=function(e,t){return u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Hu,".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 i=o.sent(),this._callFunctionErrorManage(i,"stopRemoteView"),[3,4];case 4:return[2]}}))}))},p.prototype.stopAllRemoteView=function(){return u(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Hu,".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]}}))}))},p.prototype.setVideoEncoderParam=function(e){return u(this,void 0,void 0,(function(){var t,i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Hu,".setVideoEncoderParam with params: "),e),o.label=1;case 1:return o.trys.push([1,4,,5]),t=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeBig,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 i=o.sent(),this._callFunctionErrorManage(i,"setVideoEncoderParam"),[3,5];case 5:return[2]}}))}))},p.prototype.setNetworkQosParam=function(e){return u(this,void 0,void 0,(function(){var t,i,o=this;return l(this,(function(r){return this.logger.info("".concat(Hu,".setNetworkQosParam with params: "),e),t=e.preference,i=this._getTRTCQosPreference(t),this._setQosPreference(i),this._setScreenShareParams({qosPreference:i}),[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)}))}))]}))}))},p.prototype.setLocalRenderParams=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Hu,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return t=i.sent(),this._callFunctionErrorManage(t,"setLocalRenderParams"),[3,5];case 5:return[2]}}))}))},p.prototype.setVideoEncoderMirror=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Hu,".setVideoEncoderMirror with params: "),e),this._encoderMirror=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setVideoEncoderMirror"),[3,4];case 4:return[2]}}))}))},p.prototype.setRemoteRenderParams=function(e,t,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Hu,".setRemoteRenderParams with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,i),[4,this._updateRemoteVideo(e,t)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),[3,4];case 4:return[2]}}))}))},p.prototype._updateLocalAudio=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateLocalTestAudio=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype.startLocalAudio=function(t){return void 0===t&&(t=S.TRTCAudioQualityDefault),u(this,void 0,void 0,(function(){var i,o,r;return l(this,(function(n){switch(n.label){case 0:t===S.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(Hu,".startLocalAudio with params: "),t),i=this._getTRTCAudioQuality(t),n.label=1;case 1:n.trys.push([1,9,,10]),this._setAudioProfile(i),n.label=2;case 2:return n.trys.push([2,4,,8]),[4,this._trtc.startLocalAudio(this._generateLocalAudioData())];case 3:return n.sent(),[3,8];case 4:return(o=n.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalAudio()];case 5:return n.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return this.emit("onMicDidReady"),[3,10];case 9:return r=n.sent(),console.warn("".concat(Hu," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),[3,10];case 10:return[2]}}))}))},p.prototype.stopLocalAudio=function(){return u(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Hu,".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]}}))}))},p.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Hu,".muteLocalAudio with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setAudioMuteType(!!e&&"microphone"),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),[3,4];case 4:return[2]}}))}))},p.prototype.setAudioCaptureVolume=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Hu,".setAudioCaptureVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setCaptureVolume(e),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setAudioCaptureVolume"),[3,4];case 4:return[2]}}))}))},p.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(Hu,".getAudioCaptureVolume")),this._getCaptureVolume()},p.prototype.setAudioPlayoutVolume=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Hu,".setAudioPlayoutVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._playoutVolume=e,[4,this._trtc.setRemoteAudioVolume("*",e)];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setAudioPlayoutVolume"),[3,4];case 4:return[2]}}))}))},p.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(Hu,".getAudioPlayoutVolume")),this._playoutVolume},p.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Hu,".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(lu),[2]);case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},p.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(Hu,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},p.prototype.muteRemoteVideoStream=function(e,t,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Hu,".muteRemoteVideoStream with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo({userId:e,mute:t,streamType:this._getTRTCStreamType(i)})];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"muteRemoteVideoStream"),[3,4];case 4:return[2]}}))}))},p.prototype.muteAllRemoteVideoStreams=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Hu,".muteAllRemoteVideoStreams with params: "),e),i.label=1;case 1:return i.trys.push([1,6,,7]),e?[4,this._trtc.callExperimentalAPI("pauseRemotePlayer",{userId:"*"})]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this._trtc.callExperimentalAPI("resumeRemotePlayer",{userId:"*"})];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:return t=i.sent(),this._callFunctionErrorManage(t,"muteAllRemoteVideoStreams"),[3,7];case 7:return[2]}}))}))},p.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(Hu,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){this._callFunctionErrorManage(i,"setRemoteAudioVolume")}},p.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(Hu,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},p.prototype.enableSmallVideoStream=function(e,t){return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Hu,".enableSmallVideoStream with params: "),e,t),e?(i=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeSmall,t),this._setSmallStreamVideoProfile(i)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return o.sent(),[2]}}))}))},p.prototype.snapshotVideo=function(e,t){var i="";return i=""===e&&t===T.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===e&&t===T.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(t)}):this._trtc.getVideoSnapshot({userId:e,streamType:this._getTRTCStreamType(t)}),this.emit("onSnapshotComplete",e,t,i),i},p.prototype.startScreenShare=function(t,i,o){return u(this,void 0,void 0,(function(){var r,n,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:this.logger.info("".concat(Hu,".startScreenShare with params: "),t,i,o),l.label=1;case 1:return l.trys.push([1,3,,4]),n=(r=o||{}).screenAudio,s=void 0!==n&&n,a=r.videoTrack,c=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeSub,o),this._setScreenShareParams({view:t,profile:c,systemAudio:s,videoTrack:a,streamType:i}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return l.sent(),this._isSharingScreen=!0,this.emit("onScreenCaptureStarted"),[3,4];case 3:if((u=l.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw console.error("Start share screen error:",u,u.code,u.name,u.message),u;return[3,4];case 4:return[2]}}))}))},p.prototype.setSubStreamEncoderParam=function(e){return u(this,void 0,void 0,(function(){var t,i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Hu,".setSubStreamEncoderParam with params: "),e),t=this._getTRTCVideoProfile(T.TRTCVideoStreamTypeSub,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 i=o.sent(),this._callFunctionErrorManage(i,"setSubStreamEncoderParam"),[3,4];case 4:return[2]}}))}))},p.prototype.stopScreenShare=function(){return u(this,void 0,Promise,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Hu,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._clearScreenShareParams(),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]}}))}))},p.prototype._startPublishVideoTrack=function(t){var i=t.videoTrack;return u(this,void 0,void 0,(function(){var t,o;return l(this,(function(r){switch(r.label){case 0:r.trys.push([0,7,,8]),r.label=1;case 1:return r.trys.push([1,3,,6]),[4,this._trtc.startLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 2:return r.sent(),[3,6];case 3:return(t=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._trtc.updateLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 4:r.sent(),r.label=5;case 5:throw t;case 6:return[3,8];case 7:return o=r.sent(),this._callFunctionErrorManage(o,"startPublishVideoTrack"),[3,8];case 8:return[2]}}))}))},p.prototype._stopPublishVideoTrack=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},p.prototype.startScreenCapture=function(){this._emitError(hu)},p.prototype.pauseScreenCapture=function(){this._emitError(hu)},p.prototype.resumeScreenCapture=function(){this._emitError(hu)},p.prototype.getScreenCaptureSources=function(){this._emitError(hu)},p.prototype.selectScreenCaptureTarget=function(){this._emitError(hu)},p.prototype.getCameraDevicesList=function(){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Hu,".getCameraDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getCameraList()];case 2:return t=r.sent(),i=t.map((function(e){return a(a({},e),{deviceName:e.label})})),this._cameraList=t,"{}"!==JSON.stringify(this._currentCamera)?[3,4]:(this._currentCamera=this.getDefaultDeviceInfo(t),this._currentCameraId=this._currentCamera.deviceId,[4,this.setCurrentCameraDevice(this._currentCameraId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getCameraDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},p.prototype.setCurrentCameraDevice=function(e){var t;return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Hu,".setCurrentCameraDevice with params: "),{cameraId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._currentCameraId=e,[4,this._updateLocalVideo()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),this._currentCamera=this._cameraList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._currentCameraId=null===(t=this._currentCamera)||void 0===t?void 0:t.cameraId,this._callFunctionErrorManage(i,"setCurrentCameraDevice"),i;case 5:return[2]}}))}))},p.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(Hu,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new A(t,i,o,i,r)},p.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},p.prototype.switchCamera=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Hu,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},p.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},p.prototype.setVirtualBackground=function(e){return u(this,void 0,void 0,(function(){var t,i,o,r,n;return l(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,i=e.type,o=e.blurLevel,r=e.imagePath,t?this._isVirtualBackground?i!==ce?[3,2]:[4,this._trtc.updatePlugin(se,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==ue?[3,4]:[4,this._trtc.updatePlugin(se,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(se,a(a({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._trtc.stopPlugin(se),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Hu,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},p.prototype.setTestVirtualBackground=function(e){return u(this,void 0,void 0,(function(){var t,i,o,r,n;return l(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,i=e.type,o=e.blurLevel,r=e.imagePath,t?this._isTestVirtualBackground?i!==ce?[3,2]:[4,this._testTrtc.updatePlugin(se,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==ue?[3,4]:[4,this._testTrtc.updatePlugin(se,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(se,a(a({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isTestVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._testTrtc.stopPlugin(se),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Hu,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},p.prototype.useVirtualBackground=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:i,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:i,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},p.prototype.setBeautyStyle=function(e,t,i,o){return u(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this._handleBeautyStyleParam(this._trtc,this._isBeautyEnabled,e,t,i,o,!1)];case 1:return r.sent(),[2]}}))}))},p.prototype.setTestBeautyStyle=function(e,t,i,o){return u(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this._handleBeautyStyleParam(this._testTrtc,this._isTestBeautyEnabled,e,t,i,o,!0)];case 1:return r.sent(),[2]}}))}))},p.prototype.useBeautyStyle=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:o,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:o,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},p.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return u(this,void 0,void 0,(function(){var i,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:if(o<0||o>9)throw new Error("beautyLevel must be between 0 and 9");if(r<0||r>9)throw new Error("whitenessLevel must be between 0 and 9");if(n<0||n>9)throw new Error("ruddinessLevel must be between 0 and 9");l.label=1;case 1:return l.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(ae)]:[3,3];case 2:return l.sent(),s?this._isTestBeautyEnabled=!1:this._isBeautyEnabled=!1,[3,7];case 3:return u={beauty:i,brightness:a,ruddy:c},t?[3,5]:[4,e.startPlugin(ae,u)];case 4:return l.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(ae,u)];case 6:l.sent(),l.label=7;case 7:return[3,9];case 8:throw h=l.sent(),s?this.logger.error("".concat(Hu,".").concat("setTestBeautyStyle"," fail: "),h):this.logger.error("".concat(Hu,".").concat("setBeautyStyle"," fail: "),h),h;case 9:return[2]}}))}))},p.prototype._resetBeautyStyle=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(ae)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(ae)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},p.prototype.getMicDevicesList=function(){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Hu,".getMicDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getMicrophoneList()];case 2:return t=r.sent(),i=t.map((function(e){return a(a({},e),{deviceName:e.label})})),this._microphoneList=t,"{}"!==JSON.stringify(this._currentMicrophone)?[3,4]:(this._currentMicrophone=this.getDefaultDeviceInfo(t),this._currentMicrophoneId=this._currentMicrophone.deviceId,[4,this.setCurrentMicDevice(this._currentMicrophoneId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getMicDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},p.prototype.setCurrentMicDevice=function(e){var t;return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Hu,".setCurrentMicDevice with params: "),{micId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._setCurrentMicrophoneId(e),[4,this._updateLocalAudio()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestAudio()];case 3:return o.sent(),this._currentMicrophone=this._microphoneList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._setCurrentMicrophoneId(null===(t=this._currentMicrophone)||void 0===t?void 0:t.deviceId),this._callFunctionErrorManage(i,"setCurrentMicDevice"),i;case 5:return[2]}}))}))},p.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(Hu,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new A(t,i,o,i,r)},p.prototype.getSpeakerDevicesList=function(){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Hu,".getSpeakerDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getSpeakerList()];case 2:return t=r.sent(),i=t.map((function(e){return a(a({},e),{deviceName:e.label})})),this._speakerList=t,"{}"!==JSON.stringify(this._currentSpeaker)?[3,4]:(this._currentSpeaker=this.getDefaultDeviceInfo(t),this._currentSpeakerId=this._currentSpeaker.deviceId,[4,this.setCurrentSpeakerDevice(this._currentSpeakerId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},p.prototype.setCurrentSpeakerDevice=function(t){return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Hu,".setCurrentSpeakerDevice with params: "),{speakerId:t}),o.label=1;case 1:return o.trys.push([1,3,,4]),t?[4,e.setCurrentSpeaker(t)]:[2,!1];case 2:return o.sent(),this._setCurrentSpeakerId(t),this._currentSpeaker=this._speakerList.find((function(e){return e.deviceId===t}))||{},[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"setCurrentSpeakerDevice"),i;case 4:return[2]}}))}))},p.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(Hu,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new A(t,i,o,i,r)},p.prototype.startCameraDeviceTest=function(t){return u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:if(this.logger.info("".concat(Hu,".startCameraDeviceTest with params: "),t),!t)return[2];this._setLocalTestView(t),o.label=1;case 1:return o.trys.push([1,3,,7]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return o.sent(),[3,7];case 3:return(i=o.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return o.sent(),[3,6];case 5:throw this._callFunctionErrorManage(i,"startCameraDeviceTest"),i;case 6:return[3,7];case 7:return[2]}}))}))},p.prototype.stopCameraDeviceTest=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Hu,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},p.prototype.startMicDeviceTest=function(t){return u(this,void 0,void 0,(function(){var i,o=this;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Hu,".startMicDeviceTest with params: "),t),r.label=1;case 1:return r.trys.push([1,3,,7]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return r.sent(),[3,7];case 3:return(i=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return r.sent(),[3,6];case 5:throw this._callFunctionErrorManage(i,"startMicDeviceTest"),i;case 6:return[3,7];case 7:return this._testTrtc.on(e.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(t)];case 8:return r.sent(),[2]}}))}))},p.prototype.stopMicDeviceTest=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Hu,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},p.prototype.callExperimentalAPI=function(e){return u(this,void 0,void 0,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(Hu,".callExperimentalAPI"),e),(t=me(e))===e)return[2];if(i=t.api,o=t.params,!i||!o)return[2];r.label=1;case 1:switch(r.trys.push([1,25,,26]),i){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];case"enableTestVirtualBackground":return[3,10];case"enableTestBeautyStyle":return[3,12];case"setVideoEncodeParamEx":return[3,14];case"enableAutoPlayDialog":return[3,15];case"setAudienceLatencyLevel":return[3,16];case"switchPlaybackQuality":return[3,17];case"requestPictureInPicture":return[3,19];case"exitPictureInPicture":return[3,21]}return[3,23];case 2:return this._handleSetFrameWork(o),[3,24];case 3:return this._echoCancellation=Boolean(o.enable),[3,24];case 4:return this._noiseSuppression=Boolean(o.enable),[3,24];case 5:return this._autoGainControl=Boolean(o.enable),[3,24];case 6:return this._handleKeyMetricsStats(o),[3,24];case 7:return this._networkProxy=o,[3,24];case 8:return[4,this.setVirtualBackground(o)];case 9:return r.sent(),[3,24];case 10:return[4,this.setTestVirtualBackground(o)];case 11:return r.sent(),[3,24];case 12:return[4,this.setTestBeautyStyle(o.style,o.beautyLevel,o.whitenessLevel,o.ruddinessLevel)];case 13:return r.sent(),[3,24];case 14:return this._setVideoEncodeParamEx(o),[3,24];case 15:return this._enableAutoPlayDialog=Boolean(o.enable),[3,24];case 16:return this._latencyLevel=o.latencyLevel,[3,24];case 17:return[4,this._switchPlaybackQuality(o)];case 18:return r.sent(),[3,24];case 19:return[4,this._requestPictureInPicture()];case 20:return r.sent(),[3,24];case 21:return[4,this._exitPictureInPicture()];case 22:return r.sent(),[3,24];case 23:return[3,24];case 24:return[3,26];case 25:throw r.sent();case 26:return[2]}}))}))},p.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;ve(t)&&(this._frameWorkType=t),ve(i)&&(this._component=i),ve(o)&&(this._language=o)},p.prototype._handleKeyMetricsStats=function(t){var i=t.key,o=t.opt,r=t.value,n=t.version,s=o===de;e._addKVStat({type:o,key:i,value:r,version:n,useUV:s,base:100})},p.prototype._setVideoEncodeParamEx=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:switch(e.streamType){case T.TRTCVideoStreamTypeBig:return[3,1];case T.TRTCVideoStreamTypeSub:return[3,3]}return[3,5];case 1:return[4,this.setVideoEncoderParam(e)];case 2:case 4:return t.sent(),[3,6];case 3:return[4,this.setSubStreamEncoderParam(e)];case 5:return[3,6];case 6:return[2]}}))}))},p.prototype._switchPlaybackQuality=function(e){return u(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return l(this,(function(u){switch(u.label){case 0:if(i=(t=e||{}).quality,o=t.stream_list,r=void 0===o?[]:o,!i||0===r.length)return[2];for(n=null,s=0,a=r;s<a.length;s++)(c=a[s]).name===i&&(n=c),c.userId=c.user_id;return n&&n.user_id?[4,this._trtc.callExperimentalAPI("switchPlaybackQuality",{streamList:r,quality:n.name})]:[2];case 1:return u.sent(),[2]}}))}))},p.prototype._requestPictureInPicture=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Hu,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},p.prototype._exitPictureInPicture=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Hu,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},p.prototype._emitError=function(e){e&&this.emit&&this.emit(ie,e.code,e.message)},p.prototype._emitWarning=function(e){this.emit&&this.emit(oe,e)},p.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?uu:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},p.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:eu},p.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},p.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},p.prototype._transformTRTCDeviceError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);switch(e.extraCode){case 5301:case 5305:case 5306:case 5307:case 5308:case 5309:if(i)return tu;if(o)return nu;break;case 5302:if(i)return iu;if(o)return su;break;case 5303:if(i)return ru;if(o)return cu;break;case 5304:if(i)return ou;if(o)return au}},p.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?tu:o?nu:e.code},p.prototype._transformTRTCErrorCode=function(t,i){var o=null==t?void 0:t.code;if(t&&t.code)switch(t.code){case e.ERROR_CODE.DEVICE_ERROR:o=this._transformTRTCDeviceError(t,i);break;case e.ERROR_CODE.SERVER_ERROR:o=this._transformTRTCServerError(t);break;case e.ERROR_CODE.INVALID_OPERATION:case e.ERROR_CODE.OPERATION_ABORT:o=this._transformTRTCInvalidOperationError(t,i);break;case e.ERROR_CODE.UNKNOWN_ERROR:o=this._transformTRTCUnKnowError(t,i)}return o},p.prototype._callFunctionErrorManage=function(t,i){if(!t||t.code!==e.ERROR_CODE.OPERATION_ABORT){this.logger.warn("(".concat(i,") failed - ").concat(t.code," - ").concat(t.message));var o=this._transformTRTCErrorCode(t,i);this.emit(ie,o,t.message)}},p.prototype._getTRTCResolution=function(e){var t=(m[e]||"").split("_");return{width:+(t.length>1&&t[1]),height:+(t.length>2&&t[2])}},p.prototype._getTRTCVideoProfile=function(e,t){void 0===t&&(t={});var i=t.videoWidth,o=t.videoHeight,r=t.videoResolution,n=t.videoFps,s=t.videoBitrate,a=t.resMode,c=t.resolutionMode,u={};switch(e){case T.TRTCVideoStreamTypeSub:u=this._defaultScreenProfile;break;case T.TRTCVideoStreamTypeSmall:u=this._defaultSmallVideoProfile;break;case T.TRTCVideoStreamTypeBig:default:u=this._defaultVideoProfile}if(fe(r))fe(i)||(u.width=i),fe(o)||(u.height=o);else{var l=this._getTRTCResolution(r);u.width=l.width,u.height=l.height}if(!fe(a)&&a===O.TRTCVideoResolutionModePortrait||!fe(c)&&c===O.TRTCVideoResolutionModePortrait){var h=u.height,d=u.width;u.width=h,u.height=d}return n&&(u.frameRate=n),s&&(u.bitrate=s),u},p.prototype._getTRTCStreamType=function(t){var i;return((i={})[T.TRTCVideoStreamTypeBig]=e.TYPE.STREAM_TYPE_MAIN,i[T.TRTCVideoStreamTypeSmall]=e.TYPE.STREAM_TYPE_MAIN,i[T.TRTCVideoStreamTypeSub]=e.TYPE.STREAM_TYPE_SUB,i)[t]},p.prototype._getTRTCFillMode=function(e){var t;return((t={})[y.TRTCVideoFillMode_Fill]=Gc.COVER,t[y.TRTCVideoFillMode_Fit]=Gc.CONTAIN,t)[e]},p.prototype._getTRTCCloudVideoFillMode=function(e){var t;return((t={})[Gc.COVER]=y.TRTCVideoFillMode_Fill,t[Gc.CONTAIN]=y.TRTCVideoFillMode_Fit,t)[e]},p.prototype._getTRTCCloudMirrorType=function(e){return!0===e?_.TRTCVideoMirrorType_Enable:_.TRTCVideoMirrorType_Disable},p.prototype._getLocalRenderMirror=function(e){var t;return e===_.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((t={})[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t)[e]},p.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return fe(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},p.prototype._getTRTCRemoteMirror=function(e){var t;return((t={})[_.TRTCVideoMirrorType_Auto]=!1,t[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t)[e]},p.prototype._getTRTCQosPreference=function(t){var i;return((i={})[k.TRTCVideoQosPreferenceSmooth]=e.TYPE.QOS_PREFERENCE_SMOOTH,i[k.TRTCVideoQosPreferenceClear]=e.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},p.prototype._getTRTCAudioQuality=function(t){var i;return((i={})[S.TRTCAudioQualitySpeech]=e.TYPE.AUDIO_PROFILE_STANDARD,i[S.TRTCAudioQualityDefault]=e.TYPE.AUDIO_PROFILE_STANDARD,i[S.TRTCAudioQualityMusic]=e.TYPE.AUDIO_PROFILE_HIGH_STEREO,i)[t]},p.prototype._getTRTCCloudDeviceType=function(e){return{camera:E.TRTCDeviceTypeCamera,microphone:E.TRTCDeviceTypeMic,speaker:E.TRTCDeviceTypeSpeaker}[e]},p.prototype._getTRTCCloudDeviceState=function(e){return{add:M.TRTCDeviceStateAdd,remove:M.TRTCDeviceStateRemove,active:M.TRTCDeviceStateActive}[e]},p.prototype._getTRTCCloudQuality=function(e){return[I.TRTCQuality_Unknown,I.TRTCQuality_Excellent,I.TRTCQuality_Good,I.TRTCQuality_Poor,I.TRTCQuality_Bad,I.TRTCQuality_Vbad,I.TRTCQuality_Down][e]},p.prototype._generateLocalVideoData=function(){var e={view:this._getLocalView(),publish:this._getIsVideoPublish(),option:{profile:this._getVideoProfile(),small:this._getSmallStreamVideoProfile()||!1,mirror:this._getTRTCLocalMirror(this._localRenderParams.mirrorType,this._encoderMirror),fillMode:this._getTRTCFillMode(this._localRenderParams.fillMode)}};return this._cameraVideoTrack?e&&Object.assign(e.option,{videoTrack:this._cameraVideoTrack}):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},p.prototype._generateLocalTestVideoData=function(){var e={view:this._getLocalTestView(),publish:!1,option:{profile:this._getVideoProfile(),mirror:this._getTRTCLocalMirror(this._localRenderParams.mirrorType,this._encoderMirror),fillMode:this._getTRTCFillMode(this._localRenderParams.fillMode)}};return this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),e},p.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return ge(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),ge(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),ge(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},p.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},p.prototype._generateRemoteVideoData=function(e,t){return _e(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},p.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(e.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(e.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(e.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(e.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(e.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(e.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(e.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(e.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(e.EVENT.KICKED_OUT,(function(e){var i={banned:Yc.banned,room_disband:Yc.roomDisband};ve(i[e.reason])&&t.emit("onExitRoom",i[e.reason])})),this._trtc.on(e.EVENT.NETWORK_QUALITY,(function(e){var i=e.uplinkNetworkQuality,o=e.downlinkNetworkQuality,r=new z("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new z(e,t._getTRTCCloudQuality(o))}))),t.emit("onNetworkQuality",r,n)})),this._trtc.on(e.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),this._trtc.on(e.EVENT.SEI_MESSAGE,(function(e){if(e.data&&"object"==typeof e.data&&e.data instanceof ArrayBuffer){for(var i=new Uint8Array(e.data),o="",r=0;r<i.length;r++)o+=String.fromCharCode(i[r]);e.stringData=o}t.emit("onRecvSEIMsg",e.userId,JSON.stringify(e))})),this._trtc.on(e.EVENT.STATISTICS,(function(e){var i,o=e.rtt,r=e.upLoss,n=e.downLoss,s=e.bytesSent,a=e.bytesReceived,c=e.localStatistics,u=e.remoteStatistics;t._remoteStatisticsUserIdList=u.map((function(e){return e.userId}));var l={big:T.TRTCVideoStreamTypeBig,small:T.TRTCVideoStreamTypeSmall,sub:T.TRTCVideoStreamTypeSub},h=(null===(i=c.video)||void 0===i?void 0:i.length)>0?c.video.map((function(e){var t=new F;return t.width=e.width,t.height=e.height,t.frameRate=e.frameRate,t.videoBitrate=e.bitrate,t.audioBitrate=c.audio.bitrate||0,t.streamType=l[e.videoType],t})):[];if(0===h.length&&c.audio.bitrate>0){var d=new F;d.audioBitrate=c.audio.bitrate||0,h.push(d)}var p=[];u.forEach((function(e){var t=[],i=e.userId,o=e.audio.bitrate;if(e.video&&e.video.forEach((function(e){var r=new H;r.userId=i,r.width=e.width,r.height=e.height,r.frameRate=e.frameRate,r.videoBitrate=e.bitrate,r.audioBitrate=o||0,r.streamType=l[e.videoType],t.push(r)})),0===t.length){var r=new H;r.userId=i,r.audioBitrate=o||0,t.push(r)}p.push.apply(p,t)}));var f=new W;f.upLoss=r,f.downLoss=n,f.rtt=o,f.sentBytes=s,f.receivedBytes=a,f.localStatisticsArray=h,f.localStatisticsArraySize=h.length,f.remoteStatisticsArray=p,f.remoteStatisticsArraySize=p.length,t.emit("onStatistics",f)})),this._trtc.on(e.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._clearScreenShareParams(),t._isSharingScreen=!1})),this._trtc.on(e.EVENT.PUBLISH_STATE_CHANGED,(function(e){var i=e.mediaType;"started"===e.state&&("audio"===i?t.emit("onSendFirstLocalAudioFrame"):"video"===i?t.emit("onSendFirstLocalVideoFrame",T.TRTCVideoStreamTypeBig):"screen"===i&&t.emit("onSendFirstLocalVideoFrame",T.TRTCVideoStreamTypeSub))})),this._trtc.on(e.EVENT.FIRST_VIDEO_FRAME,(function(e){var i=e.userId,o=e.streamType,r=e.width,n=e.height;t.emit("onFirstVideoFrame",i,o,r,n)})),this._trtc.on(e.EVENT.AUDIO_PLAY_STATE_CHANGED,(function(e){var i=e.userId;"PLAYING"===e.state&&t.emit("onFirstAudioFrame",i)})),this._trtc.on(e.EVENT.DEVICE_CHANGED,(function(e){var i=e.type,o=e.device,r=e.action,n=o.deviceId;if("active"===r){switch(i){case"camera":t._currentCameraId=n,t._currentCamera=o;break;case"microphone":t._currentMicrophoneId=n,t._currentMicrophone=o;break;case"speaker":t._currentSpeakerId=n,t._currentSpeaker=o}t.emitOnDeviceChange(n,t._getTRTCCloudDeviceType(i),t._getTRTCCloudDeviceState(r))}})),this._trtc.on(e.EVENT.CUSTOM_MESSAGE,(function(e){e&&t.emit("onRecvCustomCmdMsg",e.userId,e.cmdId,e.seq,null==e?void 0:e.data)})),this._trtc.on(e.EVENT.CONNECTION_STATE_CHANGED,(function(e){t._hasJoinedRoom&&!t._isExitingRoom&&("CONNECTED"===e.prevState&&"DISCONNECTED"===e.state?t.emit("onConnectionLost"):"DISCONNECTED"===e.prevState&&"CONNECTING"===e.state?t.emit("onTryToReconnect"):"CONNECTING"===e.prevState&&"CONNECTED"===e.state&&t.emit("onConnectionRecovery"))})),this._trtc.on(e.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},p.prototype._removeTRTCEvents=function(){this._trtc.off("*")},p.prototype._emitVideoAvailable=function(t,i){var o=t.userId,r=t.streamType;i?this._remoteStreamMap.set("".concat(o,"_").concat(r),!0):this._remoteStreamMap.delete("".concat(o,"_").concat(r)),r===e.TYPE.STREAM_TYPE_SUB?o&&this.emit("onUserSubStreamAvailable",o,i):o&&this.emit("onUserVideoAvailable",o,i)},p.prototype._setLocalView=function(e){this._localView=e},p.prototype._getLocalView=function(){return this._localView},p.prototype._setIsMobile=function(e){this._isMobile=e},p.prototype._getIsMobile=function(){return this._isMobile},p.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},p.prototype._getIsFrontCamera=function(){return this._isFrontCamera},p.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},p.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},p.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},p.prototype._getIsVideoPublish=function(){return this._isVideoPublish},p.prototype._setVideoProfile=function(e){this._videoProfile=e},p.prototype._getVideoProfile=function(){return this._videoProfile},p.prototype._setQosPreference=function(e){this._qosPreference=e},p.prototype._getQosPreference=function(){return this._qosPreference},p.prototype._setLocalTestView=function(e){this._localTestView=e},p.prototype._getLocalTestView=function(){return this._localTestView},p.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;fe(t)||(this._screenShareParams.view=t),fe(i)||(this._screenShareParams.option.systemAudio=i),fe(o)||(this._screenShareParams.option.fillMode=o),fe(r)||(this._screenShareParams.option.profile=r),fe(n)||(this._screenShareParams.option.videoTrack=n),fe(s)||(this._screenShareParams.option.qosPreference=s),fe(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},p.prototype._clearScreenShareParams=function(){var e,t,i,o,r;(null===(e=this._screenShareParams)||void 0===e?void 0:e.view)&&delete this._screenShareParams.view,(null===(i=null===(t=this._screenShareParams)||void 0===t?void 0:t.option)||void 0===i?void 0:i.systemAudio)&&delete this._screenShareParams.option.systemAudio,(null===(r=null===(o=this._screenShareParams)||void 0===o?void 0:o.option)||void 0===r?void 0:r.videoTrack)&&delete this._screenShareParams.option.videoTrack},p.prototype._getScreenShareParams=function(){return this._screenShareParams},p.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},p.prototype._getIsAudioPublish=function(){return this._isAudioPublish},p.prototype._setAudioMuteType=function(e){this._audioMuteType=e},p.prototype._getAudioMuteType=function(){return this._audioMuteType},p.prototype._setAudioProfile=function(e){this._audioProfile=e},p.prototype._getAudioProfile=function(){return this._audioProfile},p.prototype._getCaptureVolume=function(){return this._captureVolume},p.prototype._setCaptureVolume=function(e){this._captureVolume=e},p.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},p.prototype._getCurrentCameraId=function(){return this._currentCameraId},p.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},p.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},p.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},p.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},p.prototype._setRemoteStreamConfig=function(e,t,i){var o=this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t)));o||(o={userId:e,streamType:this._getTRTCStreamType(t),option:{mirror:this._getTRTCRemoteMirror(_.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(y.TRTCVideoFillMode_Fit)}});var r=i.view,n=i.mirrorType,s=i.fillMode,a=i.small;fe(r)||(o.view=r),fe(n)||(o.option.mirror=this._getTRTCRemoteMirror(n)),fe(s)||(o.option.fillMode=this._getTRTCFillMode(s)),fe(a)||(o.option.small=a),this._remoteStreamConfig.set("".concat(e,"_").concat(this._getTRTCStreamType(t)),o)},p.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=a({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},p.prototype._inheritEventsToSubCloud=function(t){var i=this;t._trtc.on(e.EVENT.AUTOPLAY_FAILED,(function(e){i.emit("onAutoPlayFailed",e)})),t._trtc.on(e.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){i.emit("onPictureInPictureStateChanged",e)}))},p.prototype.handleDeviceChange=function(){return u(this,void 0,void 0,(function(){var t=this;return l(this,(function(i){return e.getCameraList().then((function(e){return u(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._cameraList.length===e.length?[2]:[4,this.deviceChangeManage(this._cameraList,e,E.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=e,[2]}}))}))})),e.getMicrophoneList().then((function(e){return u(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,e,E.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=e,[2]}}))}))})),e.getSpeakerList().then((function(e){return u(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,e,E.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=e,[2]}}))}))})),[2]}))}))},p.prototype.isSameDevice=function(e,t){var i=e&&e.deviceId&&e.groupId&&e.label,o=t&&t.deviceId&&t.groupId&&t.label;return!(!i||!o)&&(e.deviceId===t.deviceId&&e.groupId===t.groupId&&e.label===t.label)},p.prototype.deviceChangeManage=function(e,t,i){return u(this,void 0,void 0,(function(){var o,r,n,s,a;return l(this,(function(c){switch(c.label){case 0:return o=void 0,e.length!==t.length&&(r=(t||[]).map((function(e){return e.deviceId})),n=new A,e.length>t.length?(n=e.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=M.TRTCDeviceStateRemove):(r=(e||[]).map((function(e){return e.deviceId})),n=t.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=M.TRTCDeviceStateAdd),s=n.deviceId,this.emitOnDeviceChange(s,i,o)),a=this.getDefaultDeviceInfo(t),i!==E.TRTCDeviceTypeCamera||o!==M.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,2];case 1:c.sent(),c.label=2;case 2:c.label=3;case 3:return i!==E.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,5];case 4:c.sent(),c.label=5;case 5:c.label=6;case 6:return i!==E.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,8];case 7:c.sent(),c.label=8;case 8:c.label=9;case 9:return[2]}}))}))},p.prototype.getDefaultDeviceInfo=function(e){var t=new A;if(0===e.length)return t;var i=e.filter((function(e){return"default"===e.deviceId}));return t=i.length>0?i[0]:e[0]},p.prototype.autoChangeDevice=function(t,i){return u(this,void 0,void 0,(function(){var o,r,n;return l(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==E.TRTCDeviceTypeCamera?[3,6]:(this._setCurrentCameraId(o),[4,this._updateLocalVideo()]);case 1:s.sent(),s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this._testTrtc.updateLocalVideo({option:{cameraId:o}})];case 3:return s.sent(),[3,5];case 4:return r=s.sent(),console.log("testTRTC error",JSON.stringify(r)),r.code,e.ERROR_CODE.OPERATION_ABORT,[3,5];case 5:this._currentCameraId=o,this._currentCamera=i,this.emitOnDeviceChange(o,t,M.TRTCDeviceStateActive),s.label=6;case 6:return t!==E.TRTCDeviceTypeMic?[3,12]:(this._setCurrentMicrophoneId(o),[4,this._updateLocalAudio()]);case 7:s.sent(),s.label=8;case 8:return s.trys.push([8,10,,11]),[4,this._testTrtc.updateLocalAudio({option:{microphoneId:o}})];case 9:return s.sent(),[3,11];case 10:return n=s.sent(),console.log("testTRTC error",JSON.stringify(n)),n.code,e.ERROR_CODE.OPERATION_ABORT,[3,11];case 11:this._currentMicrophoneId=o,this._currentMicrophone=i,this.emitOnDeviceChange(o,t,M.TRTCDeviceStateActive),s.label=12;case 12:return t!==E.TRTCDeviceTypeSpeaker?[3,14]:[4,e.setCurrentSpeaker(o)];case 13:s.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,M.TRTCDeviceStateActive),s.label=14;case 14:return[2]}}))}))},p.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},p.prototype.getMediaMixingManager=function(){return new Lu({logger:this.logger,trtc:this._trtc,trtcCloud:this})},p.prototype.getAITranscriberManager=function(){return new Du({logger:this.logger,trtc:this._trtc})},p.shareInstance=null,p.subCloudMap=new Map,p.enableSEI=!1,p.assetsPath="",c([(f="exitRoom",function(e,t,i){var o=i.value;return i.value=function(){for(var e,t,i,r,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];var a=[];return null===(t=null===(e=Iu.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return a.push(e)})),null===(i=xu.get(this))||void 0===i||i.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),null===(r=Ou.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),a.forEach((function(e){e.reject(new Error("aborted ".concat(f)))})),Iu.delete(this),xu.delete(this),Ou.delete(this),o.apply(this,n)},i})],p.prototype,"exitRoom",null),c([ku((function(e){return e}))],p.prototype,"muteRemoteAudio",null),c([ku((function(e){return e}))],p.prototype,"muteRemoteVideoStream",null),c([ku((function(e){var t=e||{},i=t.quality,o=t.stream_list,r=void 0===o?[]:o,n=r.some((function(e){return e.name===i}));return i&&n?r.map((function(e){return e.user_id})):(console.warn("[QualitySwitch] Invalid params: target ".concat(i," not found in list")),[])}),{deduplicate:!0})],p.prototype,"_switchPlaybackQuality",null),p}(w);export{K as Rect,b as TRTCAppScene,S as TRTCAudioQuality,R as TRTCBeautyStyle,$ as TRTCCameraCaptureMode,A as TRTCDeviceInfo,M as TRTCDeviceState,E as TRTCDeviceType,q as TRTCImageBuffer,F as TRTCLocalStatistics,j as TRTCLogLevel,Xc as TRTCMediaMixingErrorCode,Zc as TRTCMediaMixingEvent,$c as TRTCMediaSourceType,X as TRTCMixInputType,Z as TRTCMixUser,U as TRTCNetworkQosParam,L as TRTCParams,N as TRTCPublishCDNParam,D as TRTCQosControlMode,I as TRTCQuality,z as TRTCQualityInfo,H as TRTCRemoteStatistics,x as TRTCRenderParams,C as TRTCRoleType,te as TRTCScreenCaptureProperty,Y as TRTCScreenCaptureSourceInfo,Q as TRTCScreenCaptureSourceType,W as TRTCStatistics,J as TRTCTranscodingConfig,G as TRTCTranscodingConfigMode,V as TRTCVideoEncParam,y as TRTCVideoFillMode,_ as TRTCVideoMirrorType,k as TRTCVideoQosPreference,m as TRTCVideoResolution,O as TRTCVideoResolutionMode,P as TRTCVideoRotation,T as TRTCVideoStreamType,B as TRTCVolumeInfo,Qu as default};
|