trtc-cloud-js-sdk 2.13.1-beta.4 → 2.13.1-beta.5

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.
@@ -1 +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{Watermark as o}from"trtc-sdk-v5/plugins/video-effect/watermark";import{BasicBeauty as r}from"trtc-sdk-v5/plugins/video-effect/basic-beauty";import{RealtimeTranscriber as n}from"trtc-sdk-v5/plugins/realtime-transcriber";import s from"trtc-sdk-v5/plugins/video-effect/video-mixer";var a=function(e,t){return a=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])},a(e,t)};var c=function(){return c=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},c.apply(this,arguments)};function u(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 l(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 h(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 d(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 p(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 f(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=d(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 v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(e,t){return e(t={exports:{}},t.exports),t.exports}var m,T,y,_,R,b,C,S,w,E=g((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}));!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={})),function(e){e[e.default=0]="default",e[e.silent=8]="silent",e[e.hifi2=18]="hifi2"}(w||(w={}));var M,A,P=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"}(A||(A={}));var I,V=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},L=function(e,t,i,o){void 0===e&&(e=m.TRTCVideoResolution_640_360),void 0===t&&(t=k.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"}(I||(I={}));var x,O=function(e,t,i){void 0===e&&(e=I.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"}(x||(x={}));var k,D,z,B=function(e,t){void 0===e&&(e=""),void 0===t&&(t=x.TRTCQuality_Unknown),this.userId=e,this.quality=t},N=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},F=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},W=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},Q=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"}(k||(k={})),function(e){e[e.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",e[e.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear"}(D||(D={})),function(e){e[e.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",e[e.TRTCQosControlModeServer=1]="TRTCQosControlModeServer"}(z||(z={}));var j,U,q=function(e,t){void 0===e&&(e=D.TRTCVideoQosPreferenceClear),void 0===t&&(t=z.TRTCQosControlModeServer),this.preference=e,this.controlMode=t},G=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"}(U||(U={}));var Y,K=function(e,t,i,o,r,n){void 0===e&&(e=U.TRTCScreenCaptureSourceTypeUnknown),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=new G),void 0===r&&(r=new G),void 0===n&&(n=!1),this.type=e,this.sourceId=t,this.sourceName=i,this.thumbBGRA=o,this.iconBGRA=r,this.isMinimizeWindow=n},J=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},X=function(e,t,i,o,r,n,s,a,c,u,l,h,d,p,f){void 0===e&&(e=Y.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"}(Y||(Y={}));var $,Z,ee=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=$.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"}($||($={})),function(e){e[e.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",e[e.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",e[e.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",e[e.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual"}(Z||(Z={}));var te,ie=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},oe=void 0,re=void 0,ne="onError",se="onWarning",ae="rtc",ce="live",ue="VirtualBackground",le="BasicBeauty",he="AIDenoiser",de="Watermark",pe="blur",fe="image",ve={20:"anchor",21:"audience"},ge={0:ae,1:ce,2:ae,3:ce};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(te||(te={}));var me="enum";function Te(){return Math.floor(performance.now())}var ye=function(e){return void 0===e},_e=function(e){return"number"==typeof e},Re=function(e){return"boolean"==typeof e};function be(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 Ce(e){return null==e}function Se(){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]=Se(e[i],t[i]):e[i]=t[i]})),e}),{})}function we(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]=we(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=we(e[i]))}))):t=e,t)}var Ee,Me,Ae=function(e){return e&&e.Math===Math&&e},Pe=Ae("object"==typeof globalThis&&globalThis)||Ae("object"==typeof window&&window)||Ae("object"==typeof self&&self)||Ae("object"==typeof v&&v)||function(){return this}()||v||Function("return this")(),Ie=function(e){try{return!!e()}catch(t){return!0}},Ve=!Ie((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Le=!Ie((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),xe=Function.prototype.call,Oe=Le?xe.bind(xe):function(){return xe.apply(xe,arguments)},ke={}.propertyIsEnumerable,De=Object.getOwnPropertyDescriptor,ze={f:De&&!ke.call({1:2},1)?function(e){var t=De(this,e);return!!t&&t.enumerable}:ke},Be=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Ne=Function.prototype,Fe=Ne.call,We=Le&&Ne.bind.bind(Fe,Fe),He=Le?We:function(e){return function(){return Fe.apply(e,arguments)}},Qe=He({}.toString),je=He("".slice),Ue=function(e){return je(Qe(e),8,-1)},qe=Object,Ge=He("".split),Ye=Ie((function(){return!qe("z").propertyIsEnumerable(0)}))?function(e){return"String"===Ue(e)?Ge(e,""):qe(e)}:qe,Ke=function(e){return null==e},Je=TypeError,Xe=function(e){if(Ke(e))throw Je("Can't call method on "+e);return e},$e=function(e){return Ye(Xe(e))},Ze="object"==typeof document&&document.all,et={all:Ze,IS_HTMLDDA:void 0===Ze&&void 0!==Ze},tt=et.all,it=et.IS_HTMLDDA?function(e){return"function"==typeof e||e===tt}:function(e){return"function"==typeof e},ot=et.all,rt=et.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:it(e)||e===ot}:function(e){return"object"==typeof e?null!==e:it(e)},nt=function(e,t){return arguments.length<2?(i=Pe[e],it(i)?i:void 0):Pe[e]&&Pe[e][t];var i},st=He({}.isPrototypeOf),at="undefined"!=typeof navigator&&String(navigator.userAgent)||"",ct=Pe.process,ut=Pe.Deno,lt=ct&&ct.versions||ut&&ut.version,ht=lt&&lt.v8;ht&&(Me=(Ee=ht.split("."))[0]>0&&Ee[0]<4?1:+(Ee[0]+Ee[1])),!Me&&at&&(!(Ee=at.match(/Edge\/(\d+)/))||Ee[1]>=74)&&(Ee=at.match(/Chrome\/(\d+)/))&&(Me=+Ee[1]);var dt=Me,pt=Pe.String,ft=!!Object.getOwnPropertySymbols&&!Ie((function(){var e=Symbol("symbol detection");return!pt(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&dt&&dt<41})),vt=ft&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,gt=Object,mt=vt?function(e){return"symbol"==typeof e}:function(e){var t=nt("Symbol");return it(t)&&st(t.prototype,gt(e))},Tt=String,yt=TypeError,_t=function(e){if(it(e))return e;throw yt(function(e){try{return Tt(e)}catch(t){return"Object"}}(e)+" is not a function")},Rt=function(e,t){var i=e[t];return Ke(i)?void 0:_t(i)},bt=TypeError,Ct=Object.defineProperty,St=function(e,t){try{Ct(Pe,e,{value:t,configurable:!0,writable:!0})}catch(i){Pe[e]=t}return t},wt="__core-js_shared__",Et=Pe[wt]||St(wt,{}),Mt=g((function(e){(e.exports=function(e,t){return Et[e]||(Et[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"})})),At=Object,Pt=function(e){return At(Xe(e))},It=He({}.hasOwnProperty),Vt=Object.hasOwn||function(e,t){return It(Pt(e),t)},Lt=0,xt=Math.random(),Ot=He(1..toString),kt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ot(++Lt+xt,36)},Dt=Pe.Symbol,zt=Mt("wks"),Bt=vt?Dt.for||Dt:Dt&&Dt.withoutSetter||kt,Nt=function(e){return Vt(zt,e)||(zt[e]=ft&&Vt(Dt,e)?Dt[e]:Bt("Symbol."+e)),zt[e]},Ft=TypeError,Wt=Nt("toPrimitive"),Ht=function(e,t){if(!rt(e)||mt(e))return e;var i,o=Rt(e,Wt);if(o){if(void 0===t&&(t="default"),i=Oe(o,e,t),!rt(i)||mt(i))return i;throw Ft("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&it(i=e.toString)&&!rt(o=Oe(i,e)))return o;if(it(i=e.valueOf)&&!rt(o=Oe(i,e)))return o;if("string"!==t&&it(i=e.toString)&&!rt(o=Oe(i,e)))return o;throw bt("Can't convert object to primitive value")}(e,t)},Qt=function(e){var t=Ht(e,"string");return mt(t)?t:t+""},jt=Pe.document,Ut=rt(jt)&&rt(jt.createElement),qt=function(e){return Ut?jt.createElement(e):{}},Gt=!Ve&&!Ie((function(){return 7!==Object.defineProperty(qt("div"),"a",{get:function(){return 7}}).a})),Yt=Object.getOwnPropertyDescriptor,Kt={f:Ve?Yt:function(e,t){if(e=$e(e),t=Qt(t),Gt)try{return Yt(e,t)}catch(i){}if(Vt(e,t))return Be(!Oe(ze.f,e,t),e[t])}},Jt=Ve&&Ie((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xt=String,$t=TypeError,Zt=function(e){if(rt(e))return e;throw $t(Xt(e)+" is not an object")},ei=TypeError,ti=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,oi="enumerable",ri="configurable",ni="writable",si={f:Ve?Jt?function(e,t,i){if(Zt(e),t=Qt(t),Zt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&ni in i&&!i[ni]){var o=ii(e,t);o&&o[ni]&&(e[t]=i.value,i={configurable:ri in i?i[ri]:o[ri],enumerable:oi in i?i[oi]:o[oi],writable:!1})}return ti(e,t,i)}:ti:function(e,t,i){if(Zt(e),t=Qt(t),Zt(i),Gt)try{return ti(e,t,i)}catch(o){}if("get"in i||"set"in i)throw ei("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},ai=Ve?function(e,t,i){return si.f(e,t,Be(1,i))}:function(e,t,i){return e[t]=i,e},ci=Function.prototype,ui=Ve&&Object.getOwnPropertyDescriptor,li=Vt(ci,"name"),hi={EXISTS:li,PROPER:li&&"something"===function(){}.name,CONFIGURABLE:li&&(!Ve||Ve&&ui(ci,"name").configurable)},di=He(Function.toString);it(Et.inspectSource)||(Et.inspectSource=function(e){return di(e)});var pi,fi,vi,gi=Et.inspectSource,mi=Pe.WeakMap,Ti=it(mi)&&/native code/.test(String(mi)),yi=Mt("keys"),_i=function(e){return yi[e]||(yi[e]=kt(e))},Ri={},bi="Object already initialized",Ci=Pe.TypeError,Si=Pe.WeakMap;if(Ti||Et.state){var wi=Et.state||(Et.state=new Si);wi.get=wi.get,wi.has=wi.has,wi.set=wi.set,pi=function(e,t){if(wi.has(e))throw Ci(bi);return t.facade=e,wi.set(e,t),t},fi=function(e){return wi.get(e)||{}},vi=function(e){return wi.has(e)}}else{var Ei=_i("state");Ri[Ei]=!0,pi=function(e,t){if(Vt(e,Ei))throw Ci(bi);return t.facade=e,ai(e,Ei,t),t},fi=function(e){return Vt(e,Ei)?e[Ei]:{}},vi=function(e){return Vt(e,Ei)}}var Mi={set:pi,get:fi,has:vi,enforce:function(e){return vi(e)?fi(e):pi(e,{})},getterFor:function(e){return function(t){var i;if(!rt(t)||(i=fi(t)).type!==e)throw Ci("Incompatible receiver, "+e+" required");return i}}},Ai=g((function(e){var t=hi.CONFIGURABLE,i=Mi.enforce,o=Mi.get,r=String,n=Object.defineProperty,s=He("".slice),a=He("".replace),c=He([].join),u=Ve&&!Ie((function(){return 8!==n((function(){}),"length",{value:8}).length})),l=String(String).split("String"),h=e.exports=function(e,o,h){"Symbol("===s(r(o),0,7)&&(o="["+a(r(o),/^Symbol\(([^)]*)\)/,"$1")+"]"),h&&h.getter&&(o="get "+o),h&&h.setter&&(o="set "+o),(!Vt(e,"name")||t&&e.name!==o)&&(Ve?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&h&&Vt(h,"arity")&&e.length!==h.arity&&n(e,"length",{value:h.arity});try{h&&Vt(h,"constructor")&&h.constructor?Ve&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var d=i(e);return Vt(d,"source")||(d.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=h((function(){return it(this)&&o(this).source||gi(this)}),"toString")})),Pi=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(it(i)&&Ai(i,n,o),o.global)r?e[t]=i:St(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:si.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Ii=Math.ceil,Vi=Math.floor,Li=Math.trunc||function(e){var t=+e;return(t>0?Vi:Ii)(t)},xi=function(e){var t=+e;return t!=t||0===t?0:Li(t)},Oi=Math.max,ki=Math.min,Di=Math.min,zi=function(e){return e>0?Di(xi(e),9007199254740991):0},Bi=function(e){return zi(e.length)},Ni=function(e){return function(t,i,o){var r,n=$e(t),s=Bi(n),a=function(e,t){var i=xi(e);return i<0?Oi(i+t,0):ki(i,t)}(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}},Fi={includes:Ni(!0),indexOf:Ni(!1)}.indexOf,Wi=He([].push),Hi=function(e,t){var i,o=$e(e),r=0,n=[];for(i in o)!Vt(Ri,i)&&Vt(o,i)&&Wi(n,i);for(;t.length>r;)Vt(o,i=t[r++])&&(~Fi(n,i)||Wi(n,i));return n},Qi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ji=Qi.concat("length","prototype"),Ui={f:Object.getOwnPropertyNames||function(e){return Hi(e,ji)}},qi={f:Object.getOwnPropertySymbols},Gi=He([].concat),Yi=nt("Reflect","ownKeys")||function(e){var t=Ui.f(Zt(e)),i=qi.f;return i?Gi(t,i(e)):t},Ki=function(e,t,i){for(var o=Yi(t),r=si.f,n=Kt.f,s=0;s<o.length;s++){var a=o[s];Vt(e,a)||i&&Vt(i,a)||r(e,a,n(t,a))}},Ji=/#|\.prototype\./,Xi=function(e,t){var i=Zi[$i(e)];return i===to||i!==eo&&(it(t)?Ie(t):!!t)},$i=Xi.normalize=function(e){return String(e).replace(Ji,".").toLowerCase()},Zi=Xi.data={},eo=Xi.NATIVE="N",to=Xi.POLYFILL="P",io=Xi,oo=Kt.f,ro=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?Pe:u?Pe[a]||St(a,{}):(Pe[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=oo(i,o))&&s.value:i[o],!io(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Ki(n,r)}(e.sham||r&&r.sham)&&ai(n,"sham",!0),Pi(i,o,n,e)}},no={};no[Nt("toStringTag")]="z";var so,ao="[object z]"===String(no),co=Nt("toStringTag"),uo=Object,lo="Arguments"===Ue(function(){return arguments}()),ho=ao?Ue: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=uo(e),co))?i:lo?Ue(t):"Object"===(o=Ue(t))&&it(t.callee)?"Arguments":o},po=String,fo=function(e){if("Symbol"===ho(e))throw TypeError("Cannot convert a Symbol value to a string");return po(e)},vo=function(){var e=Zt(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},go=Pe.RegExp,mo=Ie((function(){var e=go("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),To=mo||Ie((function(){return!go("a","y").sticky})),yo={BROKEN_CARET:mo||Ie((function(){var e=go("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:To,UNSUPPORTED_Y:mo},_o=Object.keys||function(e){return Hi(e,Qi)},Ro=Ve&&!Jt?Object.defineProperties:function(e,t){Zt(e);for(var i,o=$e(t),r=_o(t),n=r.length,s=0;n>s;)si.f(e,i=r[s++],o[i]);return e},bo={f:Ro},Co=nt("document","documentElement"),So="prototype",wo="script",Eo=_i("IE_PROTO"),Mo=function(){},Ao=function(e){return"<"+wo+">"+e+"</"+wo+">"},Po=function(e){e.write(Ao("")),e.close();var t=e.parentWindow.Object;return e=null,t},Io=function(){try{so=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Io="undefined"!=typeof document?document.domain&&so?Po(so):(t=qt("iframe"),i="java"+wo+":",t.style.display="none",Co.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(Ao("document.F=Object")),e.close(),e.F):Po(so);for(var o=Qi.length;o--;)delete Io[So][Qi[o]];return Io()};Ri[Eo]=!0;var Vo,Lo,xo=Object.create||function(e,t){var i;return null!==e?(Mo[So]=Zt(e),i=new Mo,Mo[So]=null,i[Eo]=e):i=Io(),void 0===t?i:bo.f(i,t)},Oo=Pe.RegExp,ko=Ie((function(){var e=Oo(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Do=Pe.RegExp,zo=Ie((function(){var e=Do("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Bo=Mi.get,No=Mt("native-string-replace",String.prototype.replace),Fo=RegExp.prototype.exec,Wo=Fo,Ho=He("".charAt),Qo=He("".indexOf),jo=He("".replace),Uo=He("".slice),qo=(Lo=/b*/g,Oe(Fo,Vo=/a/,"a"),Oe(Fo,Lo,"a"),0!==Vo.lastIndex||0!==Lo.lastIndex),Go=yo.BROKEN_CARET,Yo=void 0!==/()??/.exec("")[1];(qo||Yo||Go||ko||zo)&&(Wo=function(e){var t,i,o,r,n,s,a,c=this,u=Bo(c),l=fo(e),h=u.raw;if(h)return h.lastIndex=c.lastIndex,t=Oe(Wo,h,l),c.lastIndex=h.lastIndex,t;var d=u.groups,p=Go&&c.sticky,f=Oe(vo,c),v=c.source,g=0,m=l;if(p&&(f=jo(f,"y",""),-1===Qo(f,"g")&&(f+="g"),m=Uo(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Ho(l,c.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,g++),i=new RegExp("^(?:"+v+")",f)),Yo&&(i=new RegExp("^"+v+"$(?!\\s)",f)),qo&&(o=c.lastIndex),r=Oe(Fo,p?i:c,m),p?r?(r.input=Uo(r.input,g),r[0]=Uo(r[0],g),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:qo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),Yo&&r&&r.length>1&&Oe(No,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=xo(null),n=0;n<d.length;n++)s[(a=d[n])[0]]=r[a[1]];return r});var Ko=Wo;ro({target:"RegExp",proto:!0,forced:/./.exec!==Ko},{exec:Ko});var Jo="\t\n\v\f\r                 \u2028\u2029\ufeff",Xo=He("".replace),$o=RegExp("^["+Jo+"]+"),Zo=RegExp("(^|[^"+Jo+"])["+Jo+"]+$"),er=function(e){return function(t){var i=fo(Xe(t));return 1&e&&(i=Xo(i,$o,"")),2&e&&(i=Xo(i,Zo,"$1")),i}},tr={start:er(1),end:er(2),trim:er(3)}.trim,ir=He("".charAt),or=Pe.parseFloat,rr=Pe.Symbol,nr=rr&&rr.iterator,sr=1/or(Jo+"-0")!=-Infinity||nr&&!Ie((function(){or(Object(nr))}))?function(e){var t=tr(fo(e)),i=or(t);return 0===i&&"-"===ir(t,0)?-0:i}:or;ro({global:!0,forced:parseFloat!==sr},{parseFloat:sr});var ar=function(e){if("Function"===Ue(e))return He(e)},cr=Nt("species"),ur=RegExp.prototype,lr=He("".charAt),hr=He("".charCodeAt),dr=He("".slice),pr=function(e){return function(t,i){var o,r,n=fo(Xe(t)),s=xi(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=hr(n,s))<55296||o>56319||s+1===a||(r=hr(n,s+1))<56320||r>57343?e?lr(n,s):o:e?dr(n,s,s+2):r-56320+(o-55296<<10)+65536}},fr={codeAt:pr(!1),charAt:pr(!0)}.charAt,vr=function(e,t,i){return t+(i?fr(e,t).length:1)},gr=TypeError,mr=function(e,t){var i=e.exec;if(it(i)){var o=Oe(i,e,t);return null!==o&&Zt(o),o}if("RegExp"===Ue(e))return Oe(Ko,e,t);throw gr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=Nt(e),n=!Ie((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Ie((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[cr]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=ar(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=ar(e),c=t.exec;return c===Ko||c===ur.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));Pi(String.prototype,e,c[0]),Pi(ur,r,c[1])}o&&ai(ur[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Xe(this),o=Ke(t)?void 0:Rt(t,e);return o?Oe(o,t,i):new RegExp(t)[e](fo(i))},function(e){var o=Zt(this),r=fo(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return mr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=mr(o,r));){var l=fo(a[0]);c[u]=l,""===l&&(o.lastIndex=vr(r,zi(o.lastIndex),s)),u++}return 0===u?null:c}]}));var Tr=Array.isArray||function(e){return"Array"===Ue(e)},yr=TypeError,_r=function(e){if(e>9007199254740991)throw yr("Maximum allowed index exceeded");return e},Rr=function(e,t,i){var o=Qt(t);o in e?si.f(e,o,Be(0,i)):e[o]=i},br=function(){},Cr=[],Sr=nt("Reflect","construct"),wr=/^\s*(?:class|function)\b/,Er=He(wr.exec),Mr=!wr.exec(br),Ar=function(e){if(!it(e))return!1;try{return Sr(br,Cr,e),!0}catch(t){return!1}},Pr=function(e){if(!it(e))return!1;switch(ho(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Mr||!!Er(wr,gi(e))}catch(t){return!0}};Pr.sham=!0;var Ir,Vr=!Sr||Ie((function(){var e;return Ar(Ar.call)||!Ar(Object)||!Ar((function(){e=!0}))||e}))?Pr:Ar,Lr=Nt("species"),xr=Array,Or=function(e,t){return new(function(e){var t;return Tr(e)&&(t=e.constructor,(Vr(t)&&(t===xr||Tr(t.prototype))||rt(t)&&null===(t=t[Lr]))&&(t=void 0)),void 0===t?xr:t}(e))(0===t?0:t)},kr=Nt("species"),Dr=Nt("isConcatSpreadable"),zr=dt>=51||!Ie((function(){var e=[];return e[Dr]=!1,e.concat()[0]!==e})),Br=function(e){if(!rt(e))return!1;var t=e[Dr];return void 0!==t?!!t:Tr(e)};ro({target:"Array",proto:!0,arity:1,forced:!(zr&&(Ir="concat",dt>=51||!Ie((function(){var e=[];return(e.constructor={})[kr]=function(){return{foo:1}},1!==e[Ir](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=Pt(this),a=Or(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Br(n=-1===t?s:arguments[t]))for(r=Bi(n),_r(c+r),i=0;i<r;i++,c++)i in n&&Rr(a,c,n[i]);else _r(c+1),Rr(a,c++,n);return a.length=c,a}});var Nr=window.navigator&&window.navigator.userAgent||"",Fr=/AppleWebKit\/([\d.]+)/i.exec(Nr);Fr&&parseFloat(Fr.pop());var Wr=/iPad/i.test(Nr),Hr=/iPhone/i.test(Nr)&&!Wr,Qr=/iPod/i.test(Nr),jr=Hr||Wr||Qr,Ur=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(Nr);jr&&function(){var e=Nr.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var qr=/Android/i.test(Nr);qr&&function(){var e=Nr.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]))}();qr&&/webkit/i.test(Nr),/Firefox/i.test(Nr)&&function(){var e=Nr.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Gr=/Edge\//i.test(Nr);Gr&&function(){var e=Nr.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var Yr=/Edg\//i.test(Nr);Yr&&function(){var e=Nr.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Kr=/SogouMobileBrowser\//i.test(Nr);Kr&&function(){var e=Nr.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Jr=/MetaSr\s/i.test(Nr);Jr&&function(){var e=Nr.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Xr=/TBS\/\d+/i.test(Nr);Xr&&function(){var e=Nr.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var $r=/XWEB\/\d+/i.test(Nr);$r&&function(){var e=Nr.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(Nr),/MSIE\/\d+/i.test(Nr)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(Nr),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(Nr)&&/rv:11.0/.test(Nr)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(Nr)&&function(){var e=Nr.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var Zr=!Xr&&/MQQBrowser\/\d+/i.test(Nr)&&/COVC\/\d+/i.test(Nr),en=!Xr&&/MQQBrowser\/\d+/i.test(Nr)&&!/COVC\/\d+/i.test(Nr);(en||Zr)&&function(){var e=Nr.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var tn=!Xr&&/ QQBrowser\/\d+/i.test(Nr);tn&&function(){var e=Nr.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var on=!Xr&&/QQBrowserLite\/\d+/i.test(Nr);on&&function(){var e=Nr.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var rn=!Xr&&/MQBHD\/\d+/i.test(Nr);rn&&function(){var e=Nr.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(Nr),!jr&&/MAC OS X/i.test(Nr),!qr&&/Linux/i.test(Nr),/MicroMessenger/i.test(Nr),/UCBrowser/i.test(Nr),/Electron/i.test(Nr);var nn=/MiuiBrowser/i.test(Nr);nn&&function(){var e=Nr.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var sn=/HuaweiBrowser/i.test(Nr);/Huawei/i.test(Nr),sn&&function(){var e=Nr.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var an=/SamsungBrowser/i.test(Nr);an&&function(){var e=Nr.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var cn=/HeyTapBrowser/i.test(Nr);cn&&function(){var e=Nr.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var un=/VivoBrowser/i.test(Nr);un&&function(){var e=Nr.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var ln,hn,dn,pn=/Chrome/i.test(Nr),fn=!Gr&&!Jr&&!Kr&&!Xr&&!$r&&!Yr&&!tn&&!nn&&!sn&&!an&&!cn&&!un&&/Chrome/i.test(Nr);fn&&function(){var e=Nr.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),fn&&function(){var e=Nr.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!pn&&!en&&!Zr&&!on&&!rn&&/Safari/i.test(Nr)&&function(){var e=Nr.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"}(ln||(ln={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(hn||(hn={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(dn||(dn={}));var vn,gn,mn,Tn=-3340,yn=-1301,_n=-1314,Rn=-1315,bn=-1316,Cn=-1302,Sn=-1317,wn=-1318,En=-1319,Mn=-1308,An=-102015,Pn=-70252,In={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},Vn={code:-1005,message:"not supported"},Ln="2.13.1-beta.4";!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"}(vn||(vn={})),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"}(gn||(gn={})),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"}(mn||(mn={}));var xn,On=void 0,kn=void 0,Dn=void 0,zn=void 0,Bn=void 0,Nn=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}(),Fn=new Nn(null),Wn=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"):Fn.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 Fn.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)):Fn.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 Fn.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){Fn.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",Fn.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"}(xn||(xn={}));var Hn="trtc-resizable-top-left-anchor",Qn="trtc-resizable-top-anchor",jn="trtc-resizable-top-right-anchor",Un="trtc-resizable-left-anchor",qn="trtc-resizable-right-anchor",Gn="trtc-resizable-bottom-left-anchor",Yn="trtc-resizable-bottom-anchor",Kn="trtc-resizable-bottom-right-anchor",Jn={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 Xn(e,t){for(var i in t)e.style[i]=t[i]}var $n,Zn=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:xn.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:xn.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||xn.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(Hn),Xn(c,Object.assign({},Jn.resizeAnchor,Jn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(Qn),Xn(u,Object.assign({},Jn.resizeAnchor,Jn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(jn),Xn(l,Object.assign({},Jn.resizeAnchor,Jn.topRightAnchor)),this.topRightAnchor=l;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(Un),Xn(h,Object.assign({},Jn.resizeAnchor,Jn.leftAnchor)),this.leftAnchor=h;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(qn),Xn(d,Object.assign({},Jn.resizeAnchor,Jn.rightAnchor)),this.rightAnchor=d;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(Gn),Xn(p,Object.assign({},Jn.resizeAnchor,Jn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(Yn),Xn(f,Object.assign({},Jn.resizeAnchor,Jn.bottomAnchor)),this.bottomAnchor=f;var v=document.createElement("div");v.className="trtc-resizable-resize-anchor ".concat(Kn),Xn(v,Object.assign({},Jn.resizeAnchor,Jn.bottomRightAnchor)),this.bottomRightAnchor=v,this.options.anchorMode!==xn.Both&&this.options.anchorMode!==xn.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!==xn.Both&&this.options.anchorMode!==xn.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,Fn.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else Fn.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 Hn: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 Qn: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 jn: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 Un: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 qn: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 Gn: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 Yn: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 Kn: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 Fn.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 Fn.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 Fn.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!==xn.Both&&this.options.anchorMode!==xn.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!==xn.Both&&this.options.anchorMode!==xn.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}(),es=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}(),ts=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,es.has(e.videoResolution)){var t=es.get(e.videoResolution),i=t.width,o=t.height;this.resMode===k.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=i,this.mixingVideoHeight=o):(this.mixingVideoWidth=o,this.mixingVideoHeight=i)}this.updatePreviewProperty(),this.canExceedContainer=e.canExceedContainer||!1,this.eventEmitter=new E,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(!Ce(e.videoResolution)||!Ce(e.resMode)){if(this.resMode=Ce(e.resMode)?this.resMode:e.resMode,e.videoResolution&&es.has(e.videoResolution)){var t=es.get(e.videoResolution),i=t.width,o=t.height;this.resMode===k.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 Wn(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 Zn(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",c({},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(!ye(s.showResizeAnchors)&&!s.showResizeAnchors)return;var a={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+i,bottom:t-this.previewTop+o},u={left:Math.round(a.left/this.previewScale),top:Math.round(a.top/this.previewScale),right:Math.round(a.right/this.previewScale),bottom:Math.round(a.bottom/this.previewScale)};null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",c({},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?c({},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",c({},this.mediaList[this.selectedMediaIndex]))},e}(),is=function(){function t(e){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new E,this.publishParams={videoEncoderParams:{videoResolution:m.TRTCVideoResolution_1280_720,resMode:k.TRTCVideoResolutionModeLandscape,videoFps:15,videoBitrate:1800},canvasColor:0},this.mediaMixingDesigner=null,this.sourceList=[],this.trtcSourceMap=new Map,this.mixVideoTrack=null,this.publishStreamType=T.TRTCVideoStreamTypeBig,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 l(this,void 0,Promise,(function(){var e,i,o,r,n;return h(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){var t;return l(this,void 0,Promise,(function(){var i,o,r,n,s=this;return h(this,(function(a){switch(a.label){case 0:return this.logger.log("".concat(this.logPrefix," bindPreviewArea:"),e),this.view=e,i=this._getCanvasSize(this.publishParams.videoEncoderParams.videoResolution,this.publishParams.videoEncoderParams.resMode),o=i.width,r=i.height,[4,this.trtc.startPlugin("VideoMixer",{view:e,canvasInfo:{width:o,height:r,canvasColor:String(this.publishParams.canvasColor),frameRate:null!==(t=this.publishParams.videoEncoderParams.videoFps)&&void 0!==t?t:15},onScreenShareStop:function(e){var t,i=s.sourceList.find((function(t){return t.id===e}));s.removeMediaSource(i),null===(t=s.eventEmitter)||void 0===t||t.emit("onSourceDisconnected",i||null)}})];case 1:return n=a.sent(),console.log("startPlugin result",n,n.track),this.mixVideoTrack=n.track,this.createDesigner(),[2]}}))}))},t.prototype.updatePreviewArea=function(e){return l(this,void 0,Promise,(function(){return h(this,(function(t){switch(t.label){case 0:return this.logger.log("".concat(this.logPrefix," updatePreviewArea:"),e),e===this.view?[2]:[4,this.trtc.updatePlugin("VideoMixer",{view:e})];case 1:return t.sent(),this.destroyDesigner(),this.view=e,e&&this.createDesigner(),[2]}}))}))},t.prototype._getTRTCSourceKey=function(e){var t;return((t={})[gn.kCamera]="camera",t[gn.kScreen]="screen",t[gn.kText]="text",t[gn.kVideo]="video",t[gn.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,r,n=null!==(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)[e])&&void 0!==o?o:(r=e)&&"object"==typeof r&&"number"==typeof r.width&&"number"==typeof r.height?e:{width:1920,height:1080};return{width:n.width,height:n.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(ye(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)),ye(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)),!ye(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(!ye(null===(v=e.layout)||void 0===v?void 0:v.rotation)){var y=((i={})[I.TRTCVideoRotation0]=0,i[I.TRTCVideoRotation90]=90,i[I.TRTCVideoRotation180]=180,i[I.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,a,u,l,h;switch(e.type){case gn.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 gn.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===(a=e.camera)||void 0===a?void 0:a.videoTrack,layout:this._getTRTCLayout(e)};case gn.kText:return c(c({id:e.id},e.text||{}),{layout:this._getTRTCLayout(e)});case gn.kImage:return{id:e.id,url:null===(u=e.image)||void 0===u?void 0:u.url,layout:this._getTRTCLayout(e)};case gn.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===k.TRTCVideoResolutionModePortrait&&(n=(o=[s,n])[0],s=o[1]),{width:n,height:s}},t.prototype.addMediaSource=function(e){var t;return l(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,l;return h(this,(function(h){switch(h.label){case 0:if(-1!==this.findMediaSourceIndex(e))throw new Error("Media source already existed");if(i=we(e),o=this._getTRTCSourceKey(i),!(r=this._getTRTCSourceItem(i))||!o)throw new Error("Invalid media source");return(n=we(this.trtcSourceMap.get(o))||[]).push(r),[4,this.trtc.updatePlugin("VideoMixer",(l={},l[o]=n,l))];case 1:return s=h.sent(),a=s.result,c=s.systemAudioTrackList,e.type===gn.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:h.sent(),h.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:!!ye(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 l(this,void 0,Promise,(function(){var r,n,s,a,c,u;return h(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=we(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===gn.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:we(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 I.TRTCVideoRotation0:case I.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case I.TRTCVideoRotation90:case I.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 I.TRTCVideoRotation0:case I.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case I.TRTCVideoRotation90:case I.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 l(this,void 0,Promise,(function(){var o,r,n,s,a,u,l,d;return h(this,(function(h){switch(h.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=c(c({},this.sourceList[o]),we(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),a=we(this.trtcSourceMap.get(n))||[],u=a.findIndex((function(t){return t.id===e.id})),a[u]=s,[4,this.trtc.updatePlugin("VideoMixer",(d={},d[n]=a,d))];case 1:if(h.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return l={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:we(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(l)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(l),this.trtcSourceMap.set(n,a),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(e){var t;return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:return i=null!==(t=null==e?void 0:e.streamType)&&void 0!==t?t:T.TRTCVideoStreamTypeBig,this.publishStreamType=i,this.logger.log("".concat(this.logPrefix," startPublish, streamType:"),i),[4,this.trtcCloud._startPublishVideoTrack({videoTrack:this.mixVideoTrack,streamType:i})];case 1:return o.sent(),[2]}}))}))},t.prototype.stopPublish=function(){return l(this,void 0,Promise,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," stopPublish, streamType:"),this.publishStreamType),[4,this.trtcCloud._stopPublishVideoTrack({streamType:this.publishStreamType})];case 1:return e.sent(),[2]}}))}))},t.prototype.updatePublishParams=function(t){var i,o,r,n,s,a;return l(this,void 0,Promise,(function(){var c,u,l,d,p,v,g,m,T,y,_,R,b,C,S,w,E,M,A,P,I,V,L,x;return h(this,(function(h){switch(h.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),t),c=this.publishParams,this.publishParams=t,u=this._getCanvasSize(t.videoEncoderParams.videoResolution,t.videoEncoderParams.resMode),l=u.width,d=u.height,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:l,height:d,canvasColor:String(t.canvasColor),frameRate:null!==(r=t.videoEncoderParams.videoFps)&&void 0!==r?r:15}})];case 2:return h.sent(),[3,4];case 3:if((p=h.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw p;return[3,4];case 4:null===(n=this.mediaMixingDesigner)||void 0===n||n.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),h.label=5;case 5:h.trys.push([5,11,12,17]),v=f(this.sourceList),h.label=6;case 6:return[4,v.next()];case 7:return(g=h.sent()).done?[3,10]:(m=g.value).layout?(T=m.layout.rect||{left:0,top:0,right:0,bottom:0},y=T.left,_=T.top,R=T.right,b=T.bottom,C=this._getCanvasSize(c.videoEncoderParams.videoResolution),S=C.width,w=C.height,E=this._getCanvasSize(t.videoEncoderParams.videoResolution),M=E.width,A=E.height,P=y*M/S,I=_*A/w,V=R*M/S,L=b*A/w,m.layout.rect={left:P,top:I,right:V,bottom:L},[4,this.updateMediaSource(m)]):[3,9];case 8:h.sent(),null===(s=this.eventEmitter)||void 0===s||s.emit("onSourceResized",m,null===(a=m.layout)||void 0===a?void 0:a.rect),h.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return x=h.sent(),i={error:x},[3,17];case 12:return h.trys.push([12,,15,16]),g&&!g.done&&(o=v.return)?[4,o.call(v)]:[3,14];case 13:h.sent(),h.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 h.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 ts({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)||k.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 l(this,void 0,void 0,(function(){return h(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(c(c({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(c(c({},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=c(c({},e.origin),{layout:c(c({},e.origin.layout),{rect:t})});this.updateMediaSource(Se(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=c(c({},e.origin),{layout:c(c({},e.origin.layout),{rect:t})});this.updateMediaSource(Se(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 l(this,void 0,Promise,(function(){var o;return h(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:we(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}();!function(e){e.STARTED="started",e.STOPPED="stopped",e.ERROR="error",e.STALLED="stalled",e.RESUMED="resumed",e.UNDO_STATE_CHANGED="undo-state-changed",e.REDO_STATE_CHANGED="redo-state-changed"}($n||($n={}));var os=void 0,rs=void 0,ns=void 0,ss=void 0,as=void 0,cs=void 0,us=void 0,ls=void 0,hs=["pen","rect","ellipse","arrow","laser","eraserObject"];function ds(e){var t,i={},o=e.tool;if(e.view_handle&&(i.view=e.view_handle),e.canvas&&(i.canvasInfo={},"number"==typeof e.canvas.width&&(i.canvasInfo.width=e.canvas.width),"number"==typeof e.canvas.height&&(i.canvasInfo.height=e.canvas.height)),(null==o?void 0:o.type)&&hs.includes(o.type)&&(i.tool={name:o.type}),o){var r=i.tool||{};o.color&&(r.color=o.color),"number"==typeof o.line_width&&(r.lineWidth=o.line_width),"laser"===o.type&&(r.laserFadeDuration="number"==typeof o.laserFadeDuration?o.laserFadeDuration:1e3),Object.keys(r).length>0&&(i.tool=r)}return"boolean"==typeof(null===(t=e.whiteboard)||void 0===t?void 0:t.interactive)&&(i.config={interactive:e.whiteboard.interactive}),i}var ps="Whiteboard",fs=Object.values($n),vs=function(){function e(t){if(this.eventEmitter=new E,this.pluginEventHandlers=[],this.boundPlugin=null,this.started=!1,e.whiteboardManager)return e.whiteboardManager;e.whiteboardManager=this,this.trtc=t.trtc,this._bindPluginEvents()}return e.prototype.onRecvWhiteboardCommand=function(e){return l(this,void 0,Promise,(function(){return h(this,(function(t){switch(t.label){case 0:return e&&"object"==typeof e?0!==Number(e.enable)?[3,2]:[4,this._stop()]:[2];case 1:return t.sent(),[2];case 2:return e.owner_id?[2]:this.started?[3,4]:[4,this._start(e)];case 3:return t.sent(),[3,6];case 4:return[4,this._update(e)];case 5:t.sent(),t.label=6;case 6:return e.op?[4,this._applyLocalOp(e.op)]:[3,8];case 7:t.sent(),t.label=8;case 8:return[2]}}))}))},e.prototype._start=function(e){return l(this,void 0,Promise,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return t=ds(e),this._bindPluginEvents(),[4,this.trtc.startPlugin(ps,t)];case 1:return i.sent(),this.started=!0,[2]}}))}))},e.prototype._update=function(e){return l(this,void 0,Promise,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return t=ds(e),0===Object.keys(t).length?[2]:[4,this.trtc.updatePlugin(ps,t)];case 1:return i.sent(),[2]}}))}))},e.prototype._stop=function(){return l(this,void 0,Promise,(function(){return h(this,(function(e){switch(e.label){case 0:if(!this.started)return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.trtc.stopPlugin(ps)];case 2:case 3:return e.sent(),[3,5];case 4:return this.started=!1,this._resetPluginEventBinding(),[7];case 5:return[2]}}))}))},e.prototype._applyLocalOp=function(e){return l(this,void 0,Promise,(function(){var t;return h(this,(function(i){switch(i.label){case 0:if(t=function(e){switch(e){case"undo":return{operation:"undo"};case"redo":return{operation:"redo"};case"clearall":return{tool:{clearScope:"all"},operation:"clear"};default:return null}}(e),!t)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.trtc.updatePlugin(ps,t)];case 2:case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},e.prototype._bindPluginEvents=function(){var e=this,t=this._getWhiteboardPlugin();t&&"function"==typeof t.on&&(this._offPluginEvents(),this.boundPlugin=t,fs.forEach((function(i){var o=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];e._emitWhiteboardEvent(i,t)};t.on(i,o),e.pluginEventHandlers.push({event:i,handler:o})})))},e.prototype._offPluginEvents=function(){var e=this;this.boundPlugin&&0!==this.pluginEventHandlers.length?("function"==typeof this.boundPlugin.off&&this.pluginEventHandlers.forEach((function(t){var i=t.event,o=t.handler;e.boundPlugin.off(i,o)})),this._resetPluginEventBinding()):this._resetPluginEventBinding()},e.prototype._resetPluginEventBinding=function(){this.boundPlugin=null,this.pluginEventHandlers=[]},e.prototype._getWhiteboardPlugin=function(){var e,t,i;return(null===(i=null===(t=null===(e=this.trtc)||void 0===e?void 0:e._plugins)||void 0===t?void 0:t.get)||void 0===i?void 0:i.call(t,ps))||null},e.prototype._emitWhiteboardEvent=function(e,t){var i;void 0===t&&(t=[]),0!==t.length?(i=this.eventEmitter).emit.apply(i,p([e],t,!1)):this.eventEmitter.emit(e)},e.prototype.on=function(e,t){this.eventEmitter.on(e,t)},e.prototype.off=function(e,t){this.eventEmitter.off(e,t)},e.prototype.destroy=function(){return l(this,void 0,Promise,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this._stop()];case 1:return t.sent(),this._offPluginEvents(),this.eventEmitter.removeAllListeners(),e.whiteboardManager=null,[2]}}))}))},e.whiteboardManager=null,e}(),gs=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=c(c({},e),{functionName:o}),a=new Promise((function(e,t){s.resolve=e,s.reject=t}));if(s.promise=a,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(),a},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}(),ms=new WeakMap,Ts=new WeakMap,ys=new WeakMap;function _s(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=ys.get(this)||new Map;ys.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 gs,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 Rs=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,p([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,p([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 l(this,void 0,Promise,(function(){var t,i,o;return h(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 l(this,void 0,Promise,(function(){var t;return h(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}(),bs=void 0,Cs=void 0,Ss=void 0,ws=void 0,Es=e._loggerManager;Es.info("TRTCCloud Version: ".concat(Ln));var Ms,As,Ps,Is="trtcCloud",Vs=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(Ms=function(){0!==Ls.size&&Array.from(Ls.values()).forEach((function(e){e.fn()}))},As=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];Ps>0&&clearTimeout(Ps),Ps=window.setTimeout((function(){Ms.apply(e,t),Ps=-1}),As)}));var Ls=new Map,xs=function(d){function f(i){void 0===i&&(i={});var r=d.call(this)||this;r._version="",r._frameWorkType=30,r._component=0,r._language=0,r._networkProxy={},r._localView=null,r._autoRecvAudio=!0,r._autoRecvVideo=!1,r._localTestView=null,r._isVideoPublish=!0,r._localRenderParams={rotation:I.TRTCVideoRotation0,fillMode:y.TRTCVideoFillMode_Fill,mirrorType:_.TRTCVideoMirrorType_Auto},r._encoderMirror=void 0,r._videoProfile={},r._isAudioPublish=!0,r._audioMuteType=!1,r._audioProfile=e.TYPE.AUDIO_PROFILE_STANDARD,r._captureVolume=100,r._playoutVolume=100,r._isSharingScreen=!1,r._remoteStreamConfig=new Map,r._remoteStreamMap=new Map,r._cameraList=[],r._microphoneList=[],r._speakerList=[],r._currentCamera={},r._currentMicrophone={},r._currentSpeaker={},r._currentCameraId="",r._currentMicrophoneId="",r._currentSpeakerId="",r._screenShareParams={option:{}},r._isMobile=Ur,r._isFrontCamera=!0,r._cameraVideoTrack=null,r._smallStreamVideoProfile=void 0,r._qosPreference=void 0,r._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},r._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},r._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},r._isVirtualBackground=!1,r._isTestVirtualBackground=!1,r._isBeautyEnabled=!1,r._isTestBeautyEnabled=!1,r._isWaterMark=!1,r._currentAudioQuality=S.TRTCAudioQualityDefault,r._lastAudioScene=w.default,r._isAIDenoiserEnabled=!1,r._currentAIDenoiserMode=void 0,r._pendingAIDenoiserApply=!1,r._remoteStatisticsUserIdList=[],r._hasJoinedRoom=!1,r._isExitingRoom=!1,r._version=Ln;var a=i.frameWorkType,c=void 0===a?30:a,u=i.component,l=void 0===u?0:u,h=i.language,p=void 0===h?0:h;return r._frameWorkType=c,r._component=l,r._language=p,r._trtc=e.create({enableSEI:f.enableSEI,assetsPath:f.assetsPath,enableVolumeControlInIOS:!0,plugins:[s,t,n,o]}),r._testTrtc=e.create(),r._log=e._loggerManager,r.logger=new Nn(Es,{seq:Vs++}),r._echoCancellation=void 0,r._noiseSuppression=void 0,r._autoGainControl=void 0,r._addTRTCEvents(),r.handleDeviceChange=r.handleDeviceChange.bind(r),Ls.set(r,{fn:r.handleDeviceChange,self:r}),r}var v;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}a(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(f,d),f.getPlugin=function(e){return"VirtualBackground"===e?i:"BasicBeauty"===e?r:"VideoMixer"===e?s:"Whiteboard"===e?Whiteboard:null},f.getTRTCShareInstance=function(e){return f.shareInstance||(f.shareInstance=new f(e)),f.shareInstance},f.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];ye(n)&&(n=r[j.TRTCLogLevelInfo]);var s=!Re(i)||i;e.setLogLevel(n,s)},f.destroyTRTCShareInstance=function(){f.shareInstance&&(f.shareInstance._destroy(),f.shareInstance=null),Array.from(f.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},f.callExperimentalAPI=function(e){console.log("static ".concat(Is,".callExperimentalAPI"),e);var t=be(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":f.enableSEI=o.enable;break;case"setAssetsPath":f.assetsPath=o.assetsPath}}catch(r){throw r}}},f.prototype.createSubCloud=function(){if(this!==f.shareInstance)return null;var e=new f;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),f.subCloudMap.set(e,e),e},f.prototype.destroy=function(){this!==f.shareInstance?(f.subCloudMap.get(this)&&f.subCloudMap.delete(this),this._destroy()):f.destroyTRTCShareInstance()},f.prototype._destroy=function(){Ls.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},f.prototype.getSDKVersion=function(){return this._version||""},f.prototype.enterRoom=function(e,t){return l(this,void 0,Promise,(function(){var i,o,r,n,s,a,u,l,d,p,f,v,g,m,T,y,_,R,b=this;return h(this,(function(h){switch(h.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,a=e.role,u=e.privateMapKey,l=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(Is,".enterRoom with params: "),e,t),p&&(this._networkProxy=p),!(i&&o&&r))return[3,5];h.label=1;case 1:return h.trys.push([1,3,,4]),g={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:ve[a],scene:ge[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},g=u?c(c({},g),{privateMapKey:u}):g,g=l?c(c({},g),{businessInfo:l}):g,m=d||this._enableAutoPlayDialog,g=Re(m)?c(c({},g),{enableAutoPlayDialog:m}):g,g=this._networkProxy?c(c({},g),{proxy:this._networkProxy}):g,g=f?c(c({},g),{streamId:f}):g,g=v?c(c({},g),{userDefineRecordId:v}):g,g=void 0!==this._latencyLevel?c(c({},g),{latencyLevel:this._latencyLevel}):g,T=Te(),[4,this._trtc.enterRoom(g)];case 2:return h.sent(),this._hasJoinedRoom=!0,this._sdkAppId=i,this._userId=o,this._userSig=r,this._pendingAIDenoiserApply&&(this._pendingAIDenoiserApply=!1,this._applyAIDenoiserDecision().catch((function(e){b.logger.warn("".concat(Is,".enterRoom flush AI denoiser decision fail: "),e)}))),y=Te()-T,this.emit("onEnterRoom",y),[3,4];case 3:throw _=h.sent(),R=(R=this._transformTRTCErrorCode(_,"enterRoom"))<0?R:-1,this.emit("onEnterRoom",R),this._callFunctionErrorManage(_,"enterRoom"),_;case 4:return[3,6];case 5:this._emitError(In),h.label=6;case 6:return[2]}}))}))},f.prototype.exitRoom=function(){return l(this,void 0,Promise,(function(){var e;return h(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(Is,".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",dn.exitRoom),[3,3];case 2:throw e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),e;case 3:return[2]}}))}))},f.prototype.switchRole=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Is,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(ve[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(ve[e])),[3,4];case 3:throw t=i.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),t;case 4:return[2]}}))}))},f.prototype.setDefaultStreamRecvMode=function(e,t){return l(this,void 0,void 0,(function(){return h(this,(function(i){return this.logger.info("".concat(Is,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),Re(e)&&(this._autoRecvAudio=e),Re(t)&&(this._autoRecvVideo=t),[2]}))}))},f.prototype.resetTRTCCloud=function(){if(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._isWaterMark=!1,this._remoteStatisticsUserIdList=[],this._resetBeautyStyle(),this._sdkAppId=void 0,this._userId=void 0,this._userSig=void 0,this._currentAudioQuality=S.TRTCAudioQualityDefault,this._lastAudioScene=w.default,this._isAIDenoiserEnabled&&this._trtc)try{this._trtc.stopPlugin(he)}catch(e){this.logger.warn("".concat(Is,".resetTRTCCloud stop AI denoiser fail: "),e)}this._isAIDenoiserEnabled=!1,this._currentAIDenoiserMode=void 0,this._pendingAIDenoiserApply=!1},f.prototype._updateLocalVideo=function(){return l(this,void 0,void 0,(function(){var t;return h(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]}}))}))},f.prototype._updateLocalTestVideo=function(){return l(this,void 0,void 0,(function(){var t;return h(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]}}))}))},f.prototype._updateLocalScreen=function(){return l(this,void 0,void 0,(function(){var t;return h(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]}}))}))},f.prototype._updateRemoteVideo=function(t,i){return l(this,void 0,void 0,(function(){var o;return h(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]}}))}))},f.prototype.startLocalPreview=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return l(this,void 0,Promise,(function(){var i,o,r,n,s;return h(this,(function(a){switch(a.label){case 0:this.logger.info("".concat(Is,".startLocalPreview with params: "),t),1===p([],t,!0).length?o=p([],t,!0)[0]:2===p([],t,!0).length&&(s=p([],t,!0),i=s[0],o=s[1]),ye(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:throw n=a.sent(),this._callFunctionErrorManage(n,"startLocalPreview"),n;case 10:return[2]}}))}))},f.prototype.updateLocalView=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Is,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},f.prototype.stopLocalPreview=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Is,".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:throw e=t.sent(),console.warn("".concat(Is," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),e;case 4:return[2]}}))}))},f.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Is,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),t;case 4:return[2]}}))}))},f.prototype.startRemoteView=function(t,i,o){return l(this,void 0,void 0,(function(){var r,n;return h(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(Is,".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:throw n=s.sent(),this._callFunctionErrorManage(n,"startRemoteView"),n;case 10:return[2]}}))}))},f.prototype.updateRemoteView=function(e,t,i){return l(this,void 0,void 0,(function(){return h(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Is,".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]}}))}))},f.prototype.stopRemoteView=function(e,t){return l(this,void 0,void 0,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Is,".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:throw i=o.sent(),this._callFunctionErrorManage(i,"stopRemoteView"),i;case 4:return[2]}}))}))},f.prototype.stopAllRemoteView=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Is,".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:throw e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),e;case 4:return[2]}}))}))},f.prototype.setVideoEncoderParam=function(e){return l(this,void 0,void 0,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Is,".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:throw i=o.sent(),this._callFunctionErrorManage(i,"setVideoEncoderParam"),i;case 5:return[2]}}))}))},f.prototype.setNetworkQosParam=function(e){return l(this,void 0,void 0,(function(){var t,i,o=this;return h(this,(function(r){return this.logger.info("".concat(Is,".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)}))}))]}))}))},f.prototype.setLocalRenderParams=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Is,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"setLocalRenderParams"),t;case 5:return[2]}}))}))},f.prototype.setVideoEncoderMirror=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Is,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"setVideoEncoderMirror"),t;case 4:return[2]}}))}))},f.prototype.setRemoteRenderParams=function(e,t,i){return l(this,void 0,void 0,(function(){var o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Is,".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:throw o=r.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),o;case 4:return[2]}}))}))},f.prototype._updateLocalAudio=function(){return l(this,void 0,void 0,(function(){var t;return h(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]}}))}))},f.prototype._updateLocalTestAudio=function(){return l(this,void 0,void 0,(function(){var t;return h(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]}}))}))},f.prototype.startLocalAudio=function(t){return void 0===t&&(t=S.TRTCAudioQualityDefault),l(this,void 0,void 0,(function(){var i,o,r;return h(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(Is,".startLocalAudio with params: "),t),this._currentAudioQuality=t,i=this._getTRTCAudioQuality(t),n.label=1;case 1:n.trys.push([1,11,,12]),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"),this._lastAudioScene===w.default?[3,10]:[4,this._applyAIDenoiserDecision()];case 9:n.sent(),n.label=10;case 10:return[3,12];case 11:throw r=n.sent(),console.warn("".concat(Is," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),r;case 12:return[2]}}))}))},f.prototype.stopLocalAudio=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Is,".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:throw e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),e;case 4:return[2]}}))}))},f.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Is,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),t;case 4:return[2]}}))}))},f.prototype.setAudioCaptureVolume=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Is,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"setAudioCaptureVolume"),t;case 4:return[2]}}))}))},f.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(Is,".getAudioCaptureVolume")),this._getCaptureVolume()},f.prototype.setAudioPlayoutVolume=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Is,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"setAudioPlayoutVolume"),t;case 4:return[2]}}))}))},f.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(Is,".getAudioPlayoutVolume")),this._playoutVolume},f.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),l(this,void 0,void 0,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Is,".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(In),[2]);case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),i;case 4:return[2]}}))}))},f.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(Is,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){throw this._callFunctionErrorManage(t,"muteAllRemoteAudio"),t}},f.prototype.muteRemoteVideoStream=function(e,t,i){return l(this,void 0,void 0,(function(){var o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Is,".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:throw o=r.sent(),this._callFunctionErrorManage(o,"muteRemoteVideoStream"),o;case 4:return[2]}}))}))},f.prototype.muteAllRemoteVideoStreams=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Is,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"muteAllRemoteVideoStreams"),t;case 7:return[2]}}))}))},f.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(Is,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){throw this._callFunctionErrorManage(i,"setRemoteAudioVolume"),i}},f.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(Is,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){throw this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation"),t}},f.prototype.enableSmallVideoStream=function(e,t){return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Is,".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]}}))}))},f.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},f.prototype.startScreenShare=function(t,i,o){return l(this,void 0,void 0,(function(){var r,n,s,a,c,u;return h(this,(function(l){switch(l.label){case 0:this.logger.info("".concat(Is,".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(),this._callFunctionErrorManage(u,"startScreenShare"),u.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]}}))}))},f.prototype.setSubStreamEncoderParam=function(e){return l(this,void 0,void 0,(function(){var t,i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Is,".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:throw i=o.sent(),this._callFunctionErrorManage(i,"setSubStreamEncoderParam"),i;case 4:return[2]}}))}))},f.prototype.stopScreenShare=function(){return l(this,void 0,Promise,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Is,".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:throw e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),e;case 4:return[2]}}))}))},f.prototype._startPublishVideoTrack=function(t){var i=t.videoTrack,o=t.streamType,r=void 0===o?T.TRTCVideoStreamTypeBig:o;return l(this,void 0,void 0,(function(){var t,o,n,s;return h(this,(function(a){switch(a.label){case 0:if(r!==T.TRTCVideoStreamTypeSub)return[3,10];a.label=1;case 1:a.trys.push([1,8,,9]),a.label=2;case 2:return a.trys.push([2,4,,7]),[4,this._trtc.startScreenShare({publish:!0,streamType:e.TYPE.STREAM_TYPE_SUB,option:{videoTrack:i}})];case 3:return a.sent(),[3,7];case 4:return(t=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._trtc.updateScreenShare({publish:!0,option:{videoTrack:i}})];case 5:a.sent(),a.label=6;case 6:throw t;case 7:return[3,9];case 8:return o=a.sent(),this._callFunctionErrorManage(o,"startPublishVideoTrack"),[3,9];case 9:return[2];case 10:a.trys.push([10,17,,18]),a.label=11;case 11:return a.trys.push([11,13,,16]),[4,this._trtc.startLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 12:return a.sent(),[3,16];case 13:return(n=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,15]:[4,this._trtc.updateLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 14:a.sent(),a.label=15;case 15:throw n;case 16:return[3,18];case 17:return s=a.sent(),this._callFunctionErrorManage(s,"startPublishVideoTrack"),[3,18];case 18:return[2]}}))}))},f.prototype._stopPublishVideoTrack=function(e){var t=(void 0===e?{}:e).streamType,i=void 0===t?T.TRTCVideoStreamTypeBig:t;return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return i!==T.TRTCVideoStreamTypeSub?[3,2]:[4,this._trtc.stopScreenShare()];case 1:case 3:return e.sent(),[2];case 2:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()]}}))}))},f.prototype.startScreenCapture=function(){this._emitError(Vn)},f.prototype.pauseScreenCapture=function(){this._emitError(Vn)},f.prototype.resumeScreenCapture=function(){this._emitError(Vn)},f.prototype.getScreenCaptureSources=function(){this._emitError(Vn)},f.prototype.selectScreenCaptureTarget=function(){this._emitError(Vn)},f.prototype.getCameraDevicesList=function(){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Is,".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 c(c({},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]}}))}))},f.prototype.setCurrentCameraDevice=function(e){var t;return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Is,".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]}}))}))},f.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(Is,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},f.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},f.prototype.switchCamera=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Is,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},f.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},f.prototype.setVirtualBackground=function(e){return l(this,void 0,void 0,(function(){var t,i,o,r,n;return h(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!==pe?[3,2]:[4,this._trtc.updatePlugin(ue,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==fe?[3,4]:[4,this._trtc.updatePlugin(ue,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(ue,c(c({},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(ue),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Is,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},f.prototype.setTestVirtualBackground=function(e){return l(this,void 0,void 0,(function(){var t,i,o,r,n;return h(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!==pe?[3,2]:[4,this._testTrtc.updatePlugin(ue,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==fe?[3,4]:[4,this._testTrtc.updatePlugin(ue,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(ue,c(c({},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(ue),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Is,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},f.prototype.useVirtualBackground=function(e){return l(this,void 0,void 0,(function(){return h(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]}}))}))},f.prototype.setBeautyStyle=function(e,t,i,o){return l(this,void 0,void 0,(function(){return h(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]}}))}))},f.prototype.setTestBeautyStyle=function(e,t,i,o){return l(this,void 0,void 0,(function(){return h(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]}}))}))},f.prototype.useBeautyStyle=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:r,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:r,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},f.prototype._setAudioQualityEx=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(i){switch(i.label){case 0:return t=(e||{}).audioScene,_e(t)?(this.logger.info("".concat(Is,"._setAudioQualityEx audioScene=").concat(t)),this._lastAudioScene=t,[4,this._applyAIDenoiserDecision()]):(this.logger.warn("".concat(Is,"._setAudioQualityEx invalid audioScene: "),t),[2]);case 1:return i.sent(),[2]}}))}))},f.prototype._applyAIDenoiserDecision=function(){return l(this,void 0,void 0,(function(){var e,t,i,o,r;return h(this,(function(n){switch(n.label){case 0:if(e=this._currentAudioQuality,t=this._lastAudioScene,!(void 0===(i=this._resolveAIDenoiserMode(e,t))||this._sdkAppId&&this._userId&&this._userSig))return this._pendingAIDenoiserApply=!0,this.logger.info("".concat(Is,".applyAIDenoiserDecision pending: enterRoom not ready, will retry after enterRoom success")),[2];n.label=1;case 1:return n.trys.push([1,9,,10]),void 0!==i?[3,4]:this._isAIDenoiserEnabled?[4,this._trtc.stopPlugin(he)]:[3,3];case 2:n.sent(),this._isAIDenoiserEnabled=!1,this._currentAIDenoiserMode=void 0,n.label=3;case 3:return[2];case 4:return this._isAIDenoiserEnabled?[3,6]:f.assetsPath?(o={sdkAppId:this._sdkAppId,userId:this._userId,userSig:this._userSig,mode:i,assetsPath:f.assetsPath},[4,this._trtc.startPlugin(he,o)]):(this.logger.warn("".concat(Is,".applyAIDenoiserDecision: assetsPath is not set, skip startPlugin: ").concat(he)),[2]);case 5:return n.sent(),this._isAIDenoiserEnabled=!0,this._currentAIDenoiserMode=i,[2];case 6:return this._currentAIDenoiserMode===i?[3,8]:[4,this._trtc.updatePlugin(he,{mode:i})];case 7:n.sent(),this._currentAIDenoiserMode=i,n.label=8;case 8:return[3,10];case 9:return r=n.sent(),this.logger.error("".concat(Is,".applyAIDenoiserDecision fail: "),r),[3,10];case 10:return[2]}}))}))},f.prototype._resolveAIDenoiserMode=function(e,t){if(t!==w.default&&e!==S.TRTCAudioQualityMusic)return e===S.TRTCAudioQualitySpeech?1:0},f.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return l(this,void 0,void 0,(function(){var i,a,c,u,l;return h(this,(function(h){switch(h.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");h.label=1;case 1:return h.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(le)]:[3,3];case 2:return h.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(le,u)];case 4:return h.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(le,u)];case 6:h.sent(),h.label=7;case 7:return[3,9];case 8:throw l=h.sent(),s?this.logger.error("".concat(Is,".").concat("setTestBeautyStyle"," fail: "),l):this.logger.error("".concat(Is,".").concat("setBeautyStyle"," fail: "),l),l;case 9:return[2]}}))}))},f.prototype._resetBeautyStyle=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(le)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(le)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},f.prototype.setWaterMark=function(e){return l(this,void 0,void 0,(function(){var t,i,o,r,n,s,a;return h(this,(function(c){switch(c.label){case 0:return c.trys.push([0,7,,8]),t=e.enable,i=e.imageUrl,o=e.x,r=e.y,n=e.size,s=e.mosaic,t?this._isWaterMark?[4,this._trtc.updatePlugin(de,{imageUrl:i,x:o,y:r,size:n,mosaic:s})]:[3,2]:[3,5];case 1:return c.sent(),[3,4];case 2:return[4,this._trtc.startPlugin(de,{imageUrl:i,x:o,y:r,size:n,mosaic:s})];case 3:c.sent(),this._isWaterMark=!0,c.label=4;case 4:return[3,6];case 5:this._trtc.stopPlugin(de),this._isWaterMark=!1,c.label=6;case 6:return[3,8];case 7:throw a=c.sent(),this.logger.error("".concat(Is,".setWaterMark fail: "),a),a;case 8:return[2]}}))}))},f.prototype.getMicDevicesList=function(){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Is,".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 c(c({},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]}}))}))},f.prototype.setCurrentMicDevice=function(e){var t;return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Is,".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]}}))}))},f.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(Is,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},f.prototype.getSpeakerDevicesList=function(){return l(this,void 0,Promise,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Is,".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 c(c({},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]}}))}))},f.prototype.setCurrentSpeakerDevice=function(t){return l(this,void 0,Promise,(function(){var i;return h(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Is,".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]}}))}))},f.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(Is,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},f.prototype.startCameraDeviceTest=function(t){return l(this,void 0,void 0,(function(){var i;return h(this,(function(o){switch(o.label){case 0:if(this.logger.info("".concat(Is,".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]}}))}))},f.prototype.stopCameraDeviceTest=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Is,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},f.prototype.startMicDeviceTest=function(t){return l(this,void 0,void 0,(function(){var i,o=this;return h(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Is,".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]}}))}))},f.prototype.stopMicDeviceTest=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Is,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},f.prototype.callExperimentalAPI=function(e){return l(this,void 0,void 0,(function(){var t,i,o;return h(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(Is,".callExperimentalAPI"),e),(t=be(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,31,,32]),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"setAudioQualityEx":return[3,16];case"setAudienceLatencyLevel":return[3,18];case"switchPlaybackQuality":return[3,19];case"requestPictureInPicture":return[3,21];case"exitPictureInPicture":return[3,23];case"OnRecvWhiteboardCommand":return[3,25];case"setWaterMark":return[3,27]}return[3,29];case 2:return this._handleSetFrameWork(o),[3,30];case 3:return this._echoCancellation=Boolean(o.enable),[3,30];case 4:return this._noiseSuppression=Boolean(o.enable),[3,30];case 5:return this._autoGainControl=Boolean(o.enable),[3,30];case 6:return this._handleKeyMetricsStats(o),[3,30];case 7:return this._networkProxy=o,[3,30];case 8:return[4,this.setVirtualBackground(o)];case 9:return r.sent(),[3,30];case 10:return[4,this.setTestVirtualBackground(o)];case 11:return r.sent(),[3,30];case 12:return[4,this.setTestBeautyStyle(o.style,o.beautyLevel,o.whitenessLevel,o.ruddinessLevel)];case 13:return r.sent(),[3,30];case 14:return this._setVideoEncodeParamEx(o),[3,30];case 15:return this._enableAutoPlayDialog=Boolean(o.enable),[3,30];case 16:return[4,this._setAudioQualityEx(o)];case 17:return r.sent(),[3,30];case 18:return this._latencyLevel=o.latencyLevel,[3,30];case 19:return[4,this._switchPlaybackQuality(o)];case 20:return r.sent(),[3,30];case 21:return[4,this._requestPictureInPicture()];case 22:return r.sent(),[3,30];case 23:return[4,this._exitPictureInPicture()];case 24:return r.sent(),[3,30];case 25:return[4,this.getWhiteboardManager().onRecvWhiteboardCommand(JSON.parse(o))];case 26:return r.sent(),[3,30];case 27:return[4,null==this?void 0:this.setWaterMark(o)];case 28:return r.sent(),[3,30];case 29:return[3,30];case 30:return[3,32];case 31:throw r.sent();case 32:return[2]}}))}))},f.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;_e(t)&&(this._frameWorkType=t),_e(i)&&(this._component=i),_e(o)&&(this._language=o)},f.prototype._handleKeyMetricsStats=function(t){var i=t.key,o=t.opt,r=t.value,n=t.version,s=o===me;e._addKVStat({type:o,key:i,value:r,version:n,useUV:s,base:100})},f.prototype._setVideoEncodeParamEx=function(e){return l(this,void 0,void 0,(function(){return h(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]}}))}))},f.prototype._switchPlaybackQuality=function(e){return l(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return h(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,autoUnmuteAudio:!0})]:[2];case 1:return u.sent(),[2]}}))}))},f.prototype._requestPictureInPicture=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Is,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},f.prototype._exitPictureInPicture=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Is,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},f.prototype._emitError=function(e){e&&this.emit&&this.emit(ne,e.code,e.message)},f.prototype._emitWarning=function(e){this.emit&&this.emit(se,e)},f.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?Pn:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},f.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:Tn},f.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},f.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},f.prototype._transformTRTCDeviceError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t),r="startScreenShare"===t;switch(e.extraCode){case 5301:case 5305:case 5306:case 5307:case 5308:case 5309:if(i)return yn;if(o)return Cn;if(r)return Mn;break;case 5302:if(i)return _n;if(o)return Sn;if(r)return An;break;case 5303:if(i)return bn;if(o)return En;if(r)return Mn;break;case 5304:if(i)return Rn;if(o)return wn;if(r)return Mn}},f.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?yn:o?Cn:e.code},f.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},f.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),r=t.message;"startScreenShare"===i&&(r=JSON.stringify({name:t.originError.name,message:r})),this.emit(ne,o,r)}},f.prototype._getTRTCResolution=function(e){var t=(m[e]||"").split("_");return{width:+(t.length>1&&t[1]),height:+(t.length>2&&t[2])}},f.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(ye(r))ye(i)||(u.width=i),ye(o)||(u.height=o);else{var l=this._getTRTCResolution(r);u.width=l.width,u.height=l.height}if(!ye(a)&&a===k.TRTCVideoResolutionModePortrait||!ye(c)&&c===k.TRTCVideoResolutionModePortrait){var h=u.height,d=u.width;u.width=h,u.height=d}return n&&(u.frameRate=n),s&&(u.bitrate=s),u},f.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]},f.prototype._getTRTCFillMode=function(e){var t;return((t={})[y.TRTCVideoFillMode_Fill]=hn.COVER,t[y.TRTCVideoFillMode_Fit]=hn.CONTAIN,t)[e]},f.prototype._getTRTCCloudVideoFillMode=function(e){var t;return((t={})[hn.COVER]=y.TRTCVideoFillMode_Fill,t[hn.CONTAIN]=y.TRTCVideoFillMode_Fit,t)[e]},f.prototype._getTRTCCloudMirrorType=function(e){return!0===e?_.TRTCVideoMirrorType_Enable:_.TRTCVideoMirrorType_Disable},f.prototype._getLocalRenderMirror=function(e){var t;return e===_.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((t={})[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t)[e]},f.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return ye(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},f.prototype._getTRTCRemoteMirror=function(e){var t;return((t={})[_.TRTCVideoMirrorType_Auto]=!1,t[_.TRTCVideoMirrorType_Enable]=!0,t[_.TRTCVideoMirrorType_Disable]=!1,t)[e]},f.prototype._getTRTCQosPreference=function(t){var i;return((i={})[D.TRTCVideoQosPreferenceSmooth]=e.TYPE.QOS_PREFERENCE_SMOOTH,i[D.TRTCVideoQosPreferenceClear]=e.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},f.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]},f.prototype._getTRTCCloudDeviceType=function(e){return{camera:A.TRTCDeviceTypeCamera,microphone:A.TRTCDeviceTypeMic,speaker:A.TRTCDeviceTypeSpeaker}[e]},f.prototype._getTRTCCloudDeviceState=function(e){return{add:M.TRTCDeviceStateAdd,remove:M.TRTCDeviceStateRemove,active:M.TRTCDeviceStateActive}[e]},f.prototype._getTRTCCloudQuality=function(e){return[x.TRTCQuality_Unknown,x.TRTCQuality_Excellent,x.TRTCQuality_Good,x.TRTCQuality_Poor,x.TRTCQuality_Bad,x.TRTCQuality_Vbad,x.TRTCQuality_Down][e]},f.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},f.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},f.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return Re(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),Re(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),Re(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},f.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},f.prototype._generateRemoteVideoData=function(e,t){return we(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},f.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:dn.banned,room_disband:dn.roomDisband};_e(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 B("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new B(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 W;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 W;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 Q;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)}))},f.prototype._removeTRTCEvents=function(){this._trtc.off("*")},f.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)},f.prototype._setLocalView=function(e){this._localView=e},f.prototype._getLocalView=function(){return this._localView},f.prototype._setIsMobile=function(e){this._isMobile=e},f.prototype._getIsMobile=function(){return this._isMobile},f.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},f.prototype._getIsFrontCamera=function(){return this._isFrontCamera},f.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},f.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},f.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},f.prototype._getIsVideoPublish=function(){return this._isVideoPublish},f.prototype._setVideoProfile=function(e){this._videoProfile=e},f.prototype._getVideoProfile=function(){return this._videoProfile},f.prototype._setQosPreference=function(e){this._qosPreference=e},f.prototype._getQosPreference=function(){return this._qosPreference},f.prototype._setLocalTestView=function(e){this._localTestView=e},f.prototype._getLocalTestView=function(){return this._localTestView},f.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;ye(t)||(this._screenShareParams.view=t),ye(i)||(this._screenShareParams.option.systemAudio=i),ye(o)||(this._screenShareParams.option.fillMode=o),ye(r)||(this._screenShareParams.option.profile=r),ye(n)||(this._screenShareParams.option.videoTrack=n),ye(s)||(this._screenShareParams.option.qosPreference=s),ye(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},f.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},f.prototype._getScreenShareParams=function(){return this._screenShareParams},f.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},f.prototype._getIsAudioPublish=function(){return this._isAudioPublish},f.prototype._setAudioMuteType=function(e){this._audioMuteType=e},f.prototype._getAudioMuteType=function(){return this._audioMuteType},f.prototype._setAudioProfile=function(e){this._audioProfile=e},f.prototype._getAudioProfile=function(){return this._audioProfile},f.prototype._getCaptureVolume=function(){return this._captureVolume},f.prototype._setCaptureVolume=function(e){this._captureVolume=e},f.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},f.prototype._getCurrentCameraId=function(){return this._currentCameraId},f.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},f.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},f.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},f.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},f.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;ye(r)||(o.view=r),ye(n)||(o.option.mirror=this._getTRTCRemoteMirror(n)),ye(s)||(o.option.fillMode=this._getTRTCFillMode(s)),ye(a)||(o.option.small=a),this._remoteStreamConfig.set("".concat(e,"_").concat(this._getTRTCStreamType(t)),o)},f.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=c({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},f.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)}))},f.prototype.handleDeviceChange=function(){return l(this,void 0,void 0,(function(){var t=this;return h(this,(function(i){return e.getCameraList().then((function(e){return l(t,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this._cameraList.length===e.length?[2]:[4,this.deviceChangeManage(this._cameraList,e,A.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=e,[2]}}))}))})),e.getMicrophoneList().then((function(e){return l(t,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,e,A.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=e,[2]}}))}))})),e.getSpeakerList().then((function(e){return l(t,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,e,A.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=e,[2]}}))}))})),[2]}))}))},f.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)},f.prototype.deviceChangeManage=function(e,t,i){return l(this,void 0,void 0,(function(){var o,r,n,s,a;return h(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 P,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!==A.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!==A.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!==A.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]}}))}))},f.prototype.getDefaultDeviceInfo=function(e){var t=new P;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]},f.prototype.autoChangeDevice=function(t,i){return l(this,void 0,void 0,(function(){var o,r,n;return h(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==A.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!==A.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!==A.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]}}))}))},f.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},f.prototype.getMediaMixingManager=function(){return new is({logger:this.logger,trtc:this._trtc,trtcCloud:this})},f.prototype.getWhiteboardManager=function(){return new vs({trtc:this._trtc})},f.prototype.getAITranscriberManager=function(){return new Rs({logger:this.logger,trtc:this._trtc})},f.shareInstance=null,f.subCloudMap=new Map,f.enableSEI=!1,f.assetsPath="",u([(v="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=ms.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return a.push(e)})),null===(i=Ts.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=ys.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(v)))})),ms.delete(this),Ts.delete(this),ys.delete(this),o.apply(this,n)},i})],f.prototype,"exitRoom",null),u([_s((function(e){return e}))],f.prototype,"muteRemoteAudio",null),u([_s((function(e){return e}))],f.prototype,"muteRemoteVideoStream",null),u([_s((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})],f.prototype,"_switchPlaybackQuality",null),f}(E);export{Ss as AITranscriberListener,oe as AudioMuteType,ws as IAITranscriberManager,Bn as ITRTCMediaMixingEvent,zn as ITRTCMediaMixingManager,ls as ITRTCWhiteboardManager,Dn as InteractionOption,J as Rect,b as TRTCAppScene,S as TRTCAudioQuality,w as TRTCAudioSceneEx,R as TRTCBeautyStyle,Z as TRTCCameraCaptureMode,re as TRTCCameraCaptureParams,P as TRTCDeviceInfo,M as TRTCDeviceState,A as TRTCDeviceType,G as TRTCImageBuffer,W as TRTCLocalStatistics,j as TRTCLogLevel,On as TRTCMediaMixingEncParam,vn as TRTCMediaMixingErrorCode,mn as TRTCMediaMixingEvent,kn as TRTCMediaSource,gn as TRTCMediaSourceType,$ as TRTCMixInputType,ee as TRTCMixUser,q as TRTCNetworkQosParam,V as TRTCParams,F as TRTCPublishCDNParam,z as TRTCQosControlMode,x as TRTCQuality,B as TRTCQualityInfo,H as TRTCRemoteStatistics,O as TRTCRenderParams,C as TRTCRoleType,ie as TRTCScreenCaptureProperty,K as TRTCScreenCaptureSourceInfo,U as TRTCScreenCaptureSourceType,Q as TRTCStatistics,X as TRTCTranscodingConfig,Y as TRTCTranscodingConfigMode,L as TRTCVideoEncParam,y as TRTCVideoFillMode,_ as TRTCVideoMirrorType,D as TRTCVideoQosPreference,m as TRTCVideoResolution,k as TRTCVideoResolutionMode,I as TRTCVideoRotation,T as TRTCVideoStreamType,N as TRTCVolumeInfo,$n as TRTCWhiteboardEvent,Cs as TranscriberMessage,bs as TranscriberParams,rs as WhiteboardCanvasInfo,us as WhiteboardHistoryStateChangedInfo,ns as WhiteboardRecvCommand,ss as WhiteboardSendPayload,cs as WhiteboardSessionResumedInfo,as as WhiteboardSessionStalledInfo,os as WhiteboardToolConfig,xs as default,Es as loggerManager};export const __esModule=!0;
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{Watermark as o}from"trtc-sdk-v5/plugins/video-effect/watermark";import{BasicBeauty as r}from"trtc-sdk-v5/plugins/video-effect/basic-beauty";import{RealtimeTranscriber as n}from"trtc-sdk-v5/plugins/realtime-transcriber";import s from"trtc-sdk-v5/plugins/video-effect/video-mixer";import a from"trtc-sdk-v5/plugins/whiteboard";var c=function(e,t){return c=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])},c(e,t)};var u=function(){return u=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},u.apply(this,arguments)};function l(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 h(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 d(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 p(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 f(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 v(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=p(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 g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function m(e,t){return e(t={exports:{}},t.exports),t.exports}var T,y,_,R,b,C,S,w,E,M=m((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}));!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"}(T||(T={})),function(e){e[e.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",e[e.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",e[e.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub"}(y||(y={})),function(e){e[e.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",e[e.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit"}(_||(_={})),function(e){e[e.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",e[e.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",e[e.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable"}(R||(R={})),function(e){e[e.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",e[e.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature"}(b||(b={})),function(e){e[e.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",e[e.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",e[e.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",e[e.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom"}(C||(C={})),function(e){e[e.TRTCRoleAnchor=20]="TRTCRoleAnchor",e[e.TRTCRoleAudience=21]="TRTCRoleAudience"}(S||(S={})),function(e){e[e.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",e[e.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",e[e.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic"}(w||(w={})),function(e){e[e.default=0]="default",e[e.silent=8]="silent",e[e.hifi2=18]="hifi2"}(E||(E={}));var A,P,I=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"}(A||(A={})),function(e){e[e.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",e[e.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",e[e.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",e[e.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera"}(P||(P={}));var V,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=S.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},x=function(e,t,i,o){void 0===e&&(e=T.TRTCVideoResolution_640_360),void 0===t&&(t=D.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"}(V||(V={}));var O,k=function(e,t,i){void 0===e&&(e=V.TRTCVideoRotation0),void 0===t&&(t=_.TRTCVideoFillMode_Fit),void 0===i&&(i=R.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"}(O||(O={}));var D,z,B,N=function(e,t){void 0===e&&(e=""),void 0===t&&(t=O.TRTCQuality_Unknown),this.userId=e,this.quality=t},F=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},W=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},H=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=y.TRTCVideoStreamTypeBig),this.width=e,this.height=t,this.frameRate=i,this.videoBitrate=o,this.audioBitrate=n,this.streamType=s},Q=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=y.TRTCVideoStreamTypeBig),this.userId=e,this.width=i,this.height=o,this.frameRate=r,this.videoBitrate=n,this.audioBitrate=a,this.streamType=p},j=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"}(D||(D={})),function(e){e[e.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",e[e.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear"}(z||(z={})),function(e){e[e.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",e[e.TRTCQosControlModeServer=1]="TRTCQosControlModeServer"}(B||(B={}));var U,q,G=function(e,t){void 0===e&&(e=z.TRTCVideoQosPreferenceClear),void 0===t&&(t=B.TRTCQosControlModeServer),this.preference=e,this.controlMode=t},Y=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"}(U||(U={})),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 K,J=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 Y),void 0===r&&(r=new Y),void 0===n&&(n=!1),this.type=e,this.sourceId=t,this.sourceName=i,this.thumbBGRA=o,this.iconBGRA=r,this.isMinimizeWindow=n},X=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},$=function(e,t,i,o,r,n,s,a,c,u,l,h,d,p,f){void 0===e&&(e=K.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"}(K||(K={}));var Z,ee,te=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=y.TRTCVideoStreamTypeBig),void 0===s&&(s=Z.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"}(Z||(Z={})),function(e){e[e.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",e[e.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",e[e.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",e[e.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual"}(ee||(ee={}));var ie,oe=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},re=void 0,ne=void 0,se="onError",ae="onWarning",ce="rtc",ue="live",le="VirtualBackground",he="BasicBeauty",de="AIDenoiser",pe="Watermark",fe="blur",ve="image",ge={20:"anchor",21:"audience"},me={0:ce,1:ue,2:ce,3:ue};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(ie||(ie={}));var Te="enum";function ye(){return Math.floor(performance.now())}var _e=function(e){return void 0===e},Re=function(e){return"number"==typeof e},be=function(e){return"boolean"==typeof e};function Ce(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 Se(e){return null==e}function we(){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]=we(e[i],t[i]):e[i]=t[i]})),e}),{})}function Ee(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]=Ee(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=Ee(e[i]))}))):t=e,t)}var Me,Ae,Pe=function(e){return e&&e.Math===Math&&e},Ie=Pe("object"==typeof globalThis&&globalThis)||Pe("object"==typeof window&&window)||Pe("object"==typeof self&&self)||Pe("object"==typeof g&&g)||function(){return this}()||g||Function("return this")(),Ve=function(e){try{return!!e()}catch(t){return!0}},Le=!Ve((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),xe=!Ve((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Oe=Function.prototype.call,ke=xe?Oe.bind(Oe):function(){return Oe.apply(Oe,arguments)},De={}.propertyIsEnumerable,ze=Object.getOwnPropertyDescriptor,Be={f:ze&&!De.call({1:2},1)?function(e){var t=ze(this,e);return!!t&&t.enumerable}:De},Ne=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Fe=Function.prototype,We=Fe.call,He=xe&&Fe.bind.bind(We,We),Qe=xe?He:function(e){return function(){return We.apply(e,arguments)}},je=Qe({}.toString),Ue=Qe("".slice),qe=function(e){return Ue(je(e),8,-1)},Ge=Object,Ye=Qe("".split),Ke=Ve((function(){return!Ge("z").propertyIsEnumerable(0)}))?function(e){return"String"===qe(e)?Ye(e,""):Ge(e)}:Ge,Je=function(e){return null==e},Xe=TypeError,$e=function(e){if(Je(e))throw Xe("Can't call method on "+e);return e},Ze=function(e){return Ke($e(e))},et="object"==typeof document&&document.all,tt={all:et,IS_HTMLDDA:void 0===et&&void 0!==et},it=tt.all,ot=tt.IS_HTMLDDA?function(e){return"function"==typeof e||e===it}:function(e){return"function"==typeof e},rt=tt.all,nt=tt.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:ot(e)||e===rt}:function(e){return"object"==typeof e?null!==e:ot(e)},st=function(e,t){return arguments.length<2?(i=Ie[e],ot(i)?i:void 0):Ie[e]&&Ie[e][t];var i},at=Qe({}.isPrototypeOf),ct="undefined"!=typeof navigator&&String(navigator.userAgent)||"",ut=Ie.process,lt=Ie.Deno,ht=ut&&ut.versions||lt&&lt.version,dt=ht&&ht.v8;dt&&(Ae=(Me=dt.split("."))[0]>0&&Me[0]<4?1:+(Me[0]+Me[1])),!Ae&&ct&&(!(Me=ct.match(/Edge\/(\d+)/))||Me[1]>=74)&&(Me=ct.match(/Chrome\/(\d+)/))&&(Ae=+Me[1]);var pt=Ae,ft=Ie.String,vt=!!Object.getOwnPropertySymbols&&!Ve((function(){var e=Symbol("symbol detection");return!ft(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&pt&&pt<41})),gt=vt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,mt=Object,Tt=gt?function(e){return"symbol"==typeof e}:function(e){var t=st("Symbol");return ot(t)&&at(t.prototype,mt(e))},yt=String,_t=TypeError,Rt=function(e){if(ot(e))return e;throw _t(function(e){try{return yt(e)}catch(t){return"Object"}}(e)+" is not a function")},bt=function(e,t){var i=e[t];return Je(i)?void 0:Rt(i)},Ct=TypeError,St=Object.defineProperty,wt=function(e,t){try{St(Ie,e,{value:t,configurable:!0,writable:!0})}catch(i){Ie[e]=t}return t},Et="__core-js_shared__",Mt=Ie[Et]||wt(Et,{}),At=m((function(e){(e.exports=function(e,t){return Mt[e]||(Mt[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"})})),Pt=Object,It=function(e){return Pt($e(e))},Vt=Qe({}.hasOwnProperty),Lt=Object.hasOwn||function(e,t){return Vt(It(e),t)},xt=0,Ot=Math.random(),kt=Qe(1..toString),Dt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+kt(++xt+Ot,36)},zt=Ie.Symbol,Bt=At("wks"),Nt=gt?zt.for||zt:zt&&zt.withoutSetter||Dt,Ft=function(e){return Lt(Bt,e)||(Bt[e]=vt&&Lt(zt,e)?zt[e]:Nt("Symbol."+e)),Bt[e]},Wt=TypeError,Ht=Ft("toPrimitive"),Qt=function(e,t){if(!nt(e)||Tt(e))return e;var i,o=bt(e,Ht);if(o){if(void 0===t&&(t="default"),i=ke(o,e,t),!nt(i)||Tt(i))return i;throw Wt("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&ot(i=e.toString)&&!nt(o=ke(i,e)))return o;if(ot(i=e.valueOf)&&!nt(o=ke(i,e)))return o;if("string"!==t&&ot(i=e.toString)&&!nt(o=ke(i,e)))return o;throw Ct("Can't convert object to primitive value")}(e,t)},jt=function(e){var t=Qt(e,"string");return Tt(t)?t:t+""},Ut=Ie.document,qt=nt(Ut)&&nt(Ut.createElement),Gt=function(e){return qt?Ut.createElement(e):{}},Yt=!Le&&!Ve((function(){return 7!==Object.defineProperty(Gt("div"),"a",{get:function(){return 7}}).a})),Kt=Object.getOwnPropertyDescriptor,Jt={f:Le?Kt:function(e,t){if(e=Ze(e),t=jt(t),Yt)try{return Kt(e,t)}catch(i){}if(Lt(e,t))return Ne(!ke(Be.f,e,t),e[t])}},Xt=Le&&Ve((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),$t=String,Zt=TypeError,ei=function(e){if(nt(e))return e;throw Zt($t(e)+" is not an object")},ti=TypeError,ii=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,ri="enumerable",ni="configurable",si="writable",ai={f:Le?Xt?function(e,t,i){if(ei(e),t=jt(t),ei(i),"function"==typeof e&&"prototype"===t&&"value"in i&&si in i&&!i[si]){var o=oi(e,t);o&&o[si]&&(e[t]=i.value,i={configurable:ni in i?i[ni]:o[ni],enumerable:ri in i?i[ri]:o[ri],writable:!1})}return ii(e,t,i)}:ii:function(e,t,i){if(ei(e),t=jt(t),ei(i),Yt)try{return ii(e,t,i)}catch(o){}if("get"in i||"set"in i)throw ti("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},ci=Le?function(e,t,i){return ai.f(e,t,Ne(1,i))}:function(e,t,i){return e[t]=i,e},ui=Function.prototype,li=Le&&Object.getOwnPropertyDescriptor,hi=Lt(ui,"name"),di={EXISTS:hi,PROPER:hi&&"something"===function(){}.name,CONFIGURABLE:hi&&(!Le||Le&&li(ui,"name").configurable)},pi=Qe(Function.toString);ot(Mt.inspectSource)||(Mt.inspectSource=function(e){return pi(e)});var fi,vi,gi,mi=Mt.inspectSource,Ti=Ie.WeakMap,yi=ot(Ti)&&/native code/.test(String(Ti)),_i=At("keys"),Ri=function(e){return _i[e]||(_i[e]=Dt(e))},bi={},Ci="Object already initialized",Si=Ie.TypeError,wi=Ie.WeakMap;if(yi||Mt.state){var Ei=Mt.state||(Mt.state=new wi);Ei.get=Ei.get,Ei.has=Ei.has,Ei.set=Ei.set,fi=function(e,t){if(Ei.has(e))throw Si(Ci);return t.facade=e,Ei.set(e,t),t},vi=function(e){return Ei.get(e)||{}},gi=function(e){return Ei.has(e)}}else{var Mi=Ri("state");bi[Mi]=!0,fi=function(e,t){if(Lt(e,Mi))throw Si(Ci);return t.facade=e,ci(e,Mi,t),t},vi=function(e){return Lt(e,Mi)?e[Mi]:{}},gi=function(e){return Lt(e,Mi)}}var Ai={set:fi,get:vi,has:gi,enforce:function(e){return gi(e)?vi(e):fi(e,{})},getterFor:function(e){return function(t){var i;if(!nt(t)||(i=vi(t)).type!==e)throw Si("Incompatible receiver, "+e+" required");return i}}},Pi=m((function(e){var t=di.CONFIGURABLE,i=Ai.enforce,o=Ai.get,r=String,n=Object.defineProperty,s=Qe("".slice),a=Qe("".replace),c=Qe([].join),u=Le&&!Ve((function(){return 8!==n((function(){}),"length",{value:8}).length})),l=String(String).split("String"),h=e.exports=function(e,o,h){"Symbol("===s(r(o),0,7)&&(o="["+a(r(o),/^Symbol\(([^)]*)\)/,"$1")+"]"),h&&h.getter&&(o="get "+o),h&&h.setter&&(o="set "+o),(!Lt(e,"name")||t&&e.name!==o)&&(Le?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&h&&Lt(h,"arity")&&e.length!==h.arity&&n(e,"length",{value:h.arity});try{h&&Lt(h,"constructor")&&h.constructor?Le&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var d=i(e);return Lt(d,"source")||(d.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=h((function(){return ot(this)&&o(this).source||mi(this)}),"toString")})),Ii=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(ot(i)&&Pi(i,n,o),o.global)r?e[t]=i:wt(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:ai.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Vi=Math.ceil,Li=Math.floor,xi=Math.trunc||function(e){var t=+e;return(t>0?Li:Vi)(t)},Oi=function(e){var t=+e;return t!=t||0===t?0:xi(t)},ki=Math.max,Di=Math.min,zi=Math.min,Bi=function(e){return e>0?zi(Oi(e),9007199254740991):0},Ni=function(e){return Bi(e.length)},Fi=function(e){return function(t,i,o){var r,n=Ze(t),s=Ni(n),a=function(e,t){var i=Oi(e);return i<0?ki(i+t,0):Di(i,t)}(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}},Wi={includes:Fi(!0),indexOf:Fi(!1)}.indexOf,Hi=Qe([].push),Qi=function(e,t){var i,o=Ze(e),r=0,n=[];for(i in o)!Lt(bi,i)&&Lt(o,i)&&Hi(n,i);for(;t.length>r;)Lt(o,i=t[r++])&&(~Wi(n,i)||Hi(n,i));return n},ji=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ui=ji.concat("length","prototype"),qi={f:Object.getOwnPropertyNames||function(e){return Qi(e,Ui)}},Gi={f:Object.getOwnPropertySymbols},Yi=Qe([].concat),Ki=st("Reflect","ownKeys")||function(e){var t=qi.f(ei(e)),i=Gi.f;return i?Yi(t,i(e)):t},Ji=function(e,t,i){for(var o=Ki(t),r=ai.f,n=Jt.f,s=0;s<o.length;s++){var a=o[s];Lt(e,a)||i&&Lt(i,a)||r(e,a,n(t,a))}},Xi=/#|\.prototype\./,$i=function(e,t){var i=eo[Zi(e)];return i===io||i!==to&&(ot(t)?Ve(t):!!t)},Zi=$i.normalize=function(e){return String(e).replace(Xi,".").toLowerCase()},eo=$i.data={},to=$i.NATIVE="N",io=$i.POLYFILL="P",oo=$i,ro=Jt.f,no=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?Ie:u?Ie[a]||wt(a,{}):(Ie[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=ro(i,o))&&s.value:i[o],!oo(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Ji(n,r)}(e.sham||r&&r.sham)&&ci(n,"sham",!0),Ii(i,o,n,e)}},so={};so[Ft("toStringTag")]="z";var ao,co="[object z]"===String(so),uo=Ft("toStringTag"),lo=Object,ho="Arguments"===qe(function(){return arguments}()),po=co?qe: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=lo(e),uo))?i:ho?qe(t):"Object"===(o=qe(t))&&ot(t.callee)?"Arguments":o},fo=String,vo=function(e){if("Symbol"===po(e))throw TypeError("Cannot convert a Symbol value to a string");return fo(e)},go=function(){var e=ei(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},mo=Ie.RegExp,To=Ve((function(){var e=mo("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),yo=To||Ve((function(){return!mo("a","y").sticky})),_o={BROKEN_CARET:To||Ve((function(){var e=mo("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:yo,UNSUPPORTED_Y:To},Ro=Object.keys||function(e){return Qi(e,ji)},bo=Le&&!Xt?Object.defineProperties:function(e,t){ei(e);for(var i,o=Ze(t),r=Ro(t),n=r.length,s=0;n>s;)ai.f(e,i=r[s++],o[i]);return e},Co={f:bo},So=st("document","documentElement"),wo="prototype",Eo="script",Mo=Ri("IE_PROTO"),Ao=function(){},Po=function(e){return"<"+Eo+">"+e+"</"+Eo+">"},Io=function(e){e.write(Po("")),e.close();var t=e.parentWindow.Object;return e=null,t},Vo=function(){try{ao=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Vo="undefined"!=typeof document?document.domain&&ao?Io(ao):(t=Gt("iframe"),i="java"+Eo+":",t.style.display="none",So.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(Po("document.F=Object")),e.close(),e.F):Io(ao);for(var o=ji.length;o--;)delete Vo[wo][ji[o]];return Vo()};bi[Mo]=!0;var Lo,xo,Oo=Object.create||function(e,t){var i;return null!==e?(Ao[wo]=ei(e),i=new Ao,Ao[wo]=null,i[Mo]=e):i=Vo(),void 0===t?i:Co.f(i,t)},ko=Ie.RegExp,Do=Ve((function(){var e=ko(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),zo=Ie.RegExp,Bo=Ve((function(){var e=zo("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),No=Ai.get,Fo=At("native-string-replace",String.prototype.replace),Wo=RegExp.prototype.exec,Ho=Wo,Qo=Qe("".charAt),jo=Qe("".indexOf),Uo=Qe("".replace),qo=Qe("".slice),Go=(xo=/b*/g,ke(Wo,Lo=/a/,"a"),ke(Wo,xo,"a"),0!==Lo.lastIndex||0!==xo.lastIndex),Yo=_o.BROKEN_CARET,Ko=void 0!==/()??/.exec("")[1];(Go||Ko||Yo||Do||Bo)&&(Ho=function(e){var t,i,o,r,n,s,a,c=this,u=No(c),l=vo(e),h=u.raw;if(h)return h.lastIndex=c.lastIndex,t=ke(Ho,h,l),c.lastIndex=h.lastIndex,t;var d=u.groups,p=Yo&&c.sticky,f=ke(go,c),v=c.source,g=0,m=l;if(p&&(f=Uo(f,"y",""),-1===jo(f,"g")&&(f+="g"),m=qo(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Qo(l,c.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,g++),i=new RegExp("^(?:"+v+")",f)),Ko&&(i=new RegExp("^"+v+"$(?!\\s)",f)),Go&&(o=c.lastIndex),r=ke(Wo,p?i:c,m),p?r?(r.input=qo(r.input,g),r[0]=qo(r[0],g),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Go&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),Ko&&r&&r.length>1&&ke(Fo,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=Oo(null),n=0;n<d.length;n++)s[(a=d[n])[0]]=r[a[1]];return r});var Jo=Ho;no({target:"RegExp",proto:!0,forced:/./.exec!==Jo},{exec:Jo});var Xo="\t\n\v\f\r                 \u2028\u2029\ufeff",$o=Qe("".replace),Zo=RegExp("^["+Xo+"]+"),er=RegExp("(^|[^"+Xo+"])["+Xo+"]+$"),tr=function(e){return function(t){var i=vo($e(t));return 1&e&&(i=$o(i,Zo,"")),2&e&&(i=$o(i,er,"$1")),i}},ir={start:tr(1),end:tr(2),trim:tr(3)}.trim,or=Qe("".charAt),rr=Ie.parseFloat,nr=Ie.Symbol,sr=nr&&nr.iterator,ar=1/rr(Xo+"-0")!=-Infinity||sr&&!Ve((function(){rr(Object(sr))}))?function(e){var t=ir(vo(e)),i=rr(t);return 0===i&&"-"===or(t,0)?-0:i}:rr;no({global:!0,forced:parseFloat!==ar},{parseFloat:ar});var cr=function(e){if("Function"===qe(e))return Qe(e)},ur=Ft("species"),lr=RegExp.prototype,hr=Qe("".charAt),dr=Qe("".charCodeAt),pr=Qe("".slice),fr=function(e){return function(t,i){var o,r,n=vo($e(t)),s=Oi(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=dr(n,s))<55296||o>56319||s+1===a||(r=dr(n,s+1))<56320||r>57343?e?hr(n,s):o:e?pr(n,s,s+2):r-56320+(o-55296<<10)+65536}},vr={codeAt:fr(!1),charAt:fr(!0)}.charAt,gr=function(e,t,i){return t+(i?vr(e,t).length:1)},mr=TypeError,Tr=function(e,t){var i=e.exec;if(ot(i)){var o=ke(i,e,t);return null!==o&&ei(o),o}if("RegExp"===qe(e))return ke(Jo,e,t);throw mr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=Ft(e),n=!Ve((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Ve((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[ur]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=cr(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=cr(e),c=t.exec;return c===Jo||c===lr.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));Ii(String.prototype,e,c[0]),Ii(lr,r,c[1])}o&&ci(lr[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=$e(this),o=Je(t)?void 0:bt(t,e);return o?ke(o,t,i):new RegExp(t)[e](vo(i))},function(e){var o=ei(this),r=vo(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return Tr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=Tr(o,r));){var l=vo(a[0]);c[u]=l,""===l&&(o.lastIndex=gr(r,Bi(o.lastIndex),s)),u++}return 0===u?null:c}]}));var yr=Array.isArray||function(e){return"Array"===qe(e)},_r=TypeError,Rr=function(e){if(e>9007199254740991)throw _r("Maximum allowed index exceeded");return e},br=function(e,t,i){var o=jt(t);o in e?ai.f(e,o,Ne(0,i)):e[o]=i},Cr=function(){},Sr=[],wr=st("Reflect","construct"),Er=/^\s*(?:class|function)\b/,Mr=Qe(Er.exec),Ar=!Er.exec(Cr),Pr=function(e){if(!ot(e))return!1;try{return wr(Cr,Sr,e),!0}catch(t){return!1}},Ir=function(e){if(!ot(e))return!1;switch(po(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ar||!!Mr(Er,mi(e))}catch(t){return!0}};Ir.sham=!0;var Vr,Lr=!wr||Ve((function(){var e;return Pr(Pr.call)||!Pr(Object)||!Pr((function(){e=!0}))||e}))?Ir:Pr,xr=Ft("species"),Or=Array,kr=function(e,t){return new(function(e){var t;return yr(e)&&(t=e.constructor,(Lr(t)&&(t===Or||yr(t.prototype))||nt(t)&&null===(t=t[xr]))&&(t=void 0)),void 0===t?Or:t}(e))(0===t?0:t)},Dr=Ft("species"),zr=Ft("isConcatSpreadable"),Br=pt>=51||!Ve((function(){var e=[];return e[zr]=!1,e.concat()[0]!==e})),Nr=function(e){if(!nt(e))return!1;var t=e[zr];return void 0!==t?!!t:yr(e)};no({target:"Array",proto:!0,arity:1,forced:!(Br&&(Vr="concat",pt>=51||!Ve((function(){var e=[];return(e.constructor={})[Dr]=function(){return{foo:1}},1!==e[Vr](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=It(this),a=kr(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Nr(n=-1===t?s:arguments[t]))for(r=Ni(n),Rr(c+r),i=0;i<r;i++,c++)i in n&&br(a,c,n[i]);else Rr(c+1),br(a,c++,n);return a.length=c,a}});var Fr=window.navigator&&window.navigator.userAgent||"",Wr=/AppleWebKit\/([\d.]+)/i.exec(Fr);Wr&&parseFloat(Wr.pop());var Hr=/iPad/i.test(Fr),Qr=/iPhone/i.test(Fr)&&!Hr,jr=/iPod/i.test(Fr),Ur=Qr||Hr||jr,qr=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(Fr);Ur&&function(){var e=Fr.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var Gr=/Android/i.test(Fr);Gr&&function(){var e=Fr.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]))}();Gr&&/webkit/i.test(Fr),/Firefox/i.test(Fr)&&function(){var e=Fr.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Yr=/Edge\//i.test(Fr);Yr&&function(){var e=Fr.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var Kr=/Edg\//i.test(Fr);Kr&&function(){var e=Fr.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Jr=/SogouMobileBrowser\//i.test(Fr);Jr&&function(){var e=Fr.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Xr=/MetaSr\s/i.test(Fr);Xr&&function(){var e=Fr.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var $r=/TBS\/\d+/i.test(Fr);$r&&function(){var e=Fr.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Zr=/XWEB\/\d+/i.test(Fr);Zr&&function(){var e=Fr.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(Fr),/MSIE\/\d+/i.test(Fr)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(Fr),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(Fr)&&/rv:11.0/.test(Fr)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(Fr)&&function(){var e=Fr.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var en=!$r&&/MQQBrowser\/\d+/i.test(Fr)&&/COVC\/\d+/i.test(Fr),tn=!$r&&/MQQBrowser\/\d+/i.test(Fr)&&!/COVC\/\d+/i.test(Fr);(tn||en)&&function(){var e=Fr.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var on=!$r&&/ QQBrowser\/\d+/i.test(Fr);on&&function(){var e=Fr.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var rn=!$r&&/QQBrowserLite\/\d+/i.test(Fr);rn&&function(){var e=Fr.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var nn=!$r&&/MQBHD\/\d+/i.test(Fr);nn&&function(){var e=Fr.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(Fr),!Ur&&/MAC OS X/i.test(Fr),!Gr&&/Linux/i.test(Fr),/MicroMessenger/i.test(Fr),/UCBrowser/i.test(Fr),/Electron/i.test(Fr);var sn=/MiuiBrowser/i.test(Fr);sn&&function(){var e=Fr.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var an=/HuaweiBrowser/i.test(Fr);/Huawei/i.test(Fr),an&&function(){var e=Fr.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var cn=/SamsungBrowser/i.test(Fr);cn&&function(){var e=Fr.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var un=/HeyTapBrowser/i.test(Fr);un&&function(){var e=Fr.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var ln=/VivoBrowser/i.test(Fr);ln&&function(){var e=Fr.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var hn,dn,pn,fn=/Chrome/i.test(Fr),vn=!Yr&&!Xr&&!Jr&&!$r&&!Zr&&!Kr&&!on&&!sn&&!an&&!cn&&!un&&!ln&&/Chrome/i.test(Fr);vn&&function(){var e=Fr.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),vn&&function(){var e=Fr.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!fn&&!tn&&!en&&!rn&&!nn&&/Safari/i.test(Fr)&&function(){var e=Fr.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"}(hn||(hn={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(dn||(dn={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(pn||(pn={}));var gn,mn,Tn,yn=-3340,_n=-1301,Rn=-1314,bn=-1315,Cn=-1316,Sn=-1302,wn=-1317,En=-1318,Mn=-1319,An=-1308,Pn=-102015,In=-70252,Vn={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},Ln={code:-1005,message:"not supported"},xn="2.13.1-beta.5";!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"}(gn||(gn={})),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"}(mn||(mn={})),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"}(Tn||(Tn={}));var On,kn=void 0,Dn=void 0,zn=void 0,Bn=void 0,Nn=void 0,Fn=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}(),Wn=new Fn(null),Hn=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"):Wn.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 Wn.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)):Wn.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 Wn.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){Wn.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",Wn.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"}(On||(On={}));var Qn="trtc-resizable-top-left-anchor",jn="trtc-resizable-top-anchor",Un="trtc-resizable-top-right-anchor",qn="trtc-resizable-left-anchor",Gn="trtc-resizable-right-anchor",Yn="trtc-resizable-bottom-left-anchor",Kn="trtc-resizable-bottom-anchor",Jn="trtc-resizable-bottom-right-anchor",Xn={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 $n(e,t){for(var i in t)e.style[i]=t[i]}var Zn,es=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:On.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:On.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||On.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(Qn),$n(c,Object.assign({},Xn.resizeAnchor,Xn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(jn),$n(u,Object.assign({},Xn.resizeAnchor,Xn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(Un),$n(l,Object.assign({},Xn.resizeAnchor,Xn.topRightAnchor)),this.topRightAnchor=l;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(qn),$n(h,Object.assign({},Xn.resizeAnchor,Xn.leftAnchor)),this.leftAnchor=h;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(Gn),$n(d,Object.assign({},Xn.resizeAnchor,Xn.rightAnchor)),this.rightAnchor=d;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(Yn),$n(p,Object.assign({},Xn.resizeAnchor,Xn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(Kn),$n(f,Object.assign({},Xn.resizeAnchor,Xn.bottomAnchor)),this.bottomAnchor=f;var v=document.createElement("div");v.className="trtc-resizable-resize-anchor ".concat(Jn),$n(v,Object.assign({},Xn.resizeAnchor,Xn.bottomRightAnchor)),this.bottomRightAnchor=v,this.options.anchorMode!==On.Both&&this.options.anchorMode!==On.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!==On.Both&&this.options.anchorMode!==On.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,Wn.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else Wn.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 Qn: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 jn: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 Un: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 qn: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 Gn: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 Yn: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 Kn: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 Jn: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 Wn.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 Wn.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 Wn.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!==On.Both&&this.options.anchorMode!==On.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!==On.Both&&this.options.anchorMode!==On.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}(),ts=function(){var e=new Map;for(var t in T)if(isNaN(Number(t))){var i=T[t],o=t.split("_");e.set(i,{width:parseInt(o[1]),height:parseInt(o[2])})}return e}(),is=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,ts.has(e.videoResolution)){var t=ts.get(e.videoResolution),i=t.width,o=t.height;this.resMode===D.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=i,this.mixingVideoHeight=o):(this.mixingVideoWidth=o,this.mixingVideoHeight=i)}this.updatePreviewProperty(),this.canExceedContainer=e.canExceedContainer||!1,this.eventEmitter=new M,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(!Se(e.videoResolution)||!Se(e.resMode)){if(this.resMode=Se(e.resMode)?this.resMode:e.resMode,e.videoResolution&&ts.has(e.videoResolution)){var t=ts.get(e.videoResolution),i=t.width,o=t.height;this.resMode===D.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 Hn(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 es(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",u({},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(!_e(s.showResizeAnchors)&&!s.showResizeAnchors)return;var a={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+i,bottom:t-this.previewTop+o},c={left:Math.round(a.left/this.previewScale),top:Math.round(a.top/this.previewScale),right:Math.round(a.right/this.previewScale),bottom:Math.round(a.bottom/this.previewScale)};null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",u({},n),c)}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?u({},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",u({},this.mediaList[this.selectedMediaIndex]))},e}(),os=function(){function t(e){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new M,this.publishParams={videoEncoderParams:{videoResolution:T.TRTCVideoResolution_1280_720,resMode:D.TRTCVideoResolutionModeLandscape,videoFps:15,videoBitrate:1800},canvasColor:0},this.mediaMixingDesigner=null,this.sourceList=[],this.trtcSourceMap=new Map,this.mixVideoTrack=null,this.publishStreamType=y.TRTCVideoStreamTypeBig,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 h(this,void 0,Promise,(function(){var e,i,o,r,n;return d(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){var t;return h(this,void 0,Promise,(function(){var i,o,r,n,s=this;return d(this,(function(a){switch(a.label){case 0:return this.logger.log("".concat(this.logPrefix," bindPreviewArea:"),e),this.view=e,i=this._getCanvasSize(this.publishParams.videoEncoderParams.videoResolution,this.publishParams.videoEncoderParams.resMode),o=i.width,r=i.height,[4,this.trtc.startPlugin("VideoMixer",{view:e,canvasInfo:{width:o,height:r,canvasColor:String(this.publishParams.canvasColor),frameRate:null!==(t=this.publishParams.videoEncoderParams.videoFps)&&void 0!==t?t:15},onScreenShareStop:function(e){var t,i=s.sourceList.find((function(t){return t.id===e}));s.removeMediaSource(i),null===(t=s.eventEmitter)||void 0===t||t.emit("onSourceDisconnected",i||null)}})];case 1:return n=a.sent(),console.log("startPlugin result",n,n.track),this.mixVideoTrack=n.track,this.createDesigner(),[2]}}))}))},t.prototype.updatePreviewArea=function(e){return h(this,void 0,Promise,(function(){return d(this,(function(t){switch(t.label){case 0:return this.logger.log("".concat(this.logPrefix," updatePreviewArea:"),e),e===this.view?[2]:[4,this.trtc.updatePlugin("VideoMixer",{view:e})];case 1:return t.sent(),this.destroyDesigner(),this.view=e,e&&this.createDesigner(),[2]}}))}))},t.prototype._getTRTCSourceKey=function(e){var t;return((t={})[mn.kCamera]="camera",t[mn.kScreen]="screen",t[mn.kText]="text",t[mn.kVideo]="video",t[mn.kImage]="image",t)[e.type]},t.prototype._getTRTCFillMode=function(e){var t;return((t={})[_.TRTCVideoFillMode_Fill]="cover",t[_.TRTCVideoFillMode_Fit]="contain",t)[e]},t.prototype._getTRTCVideoProfile=function(e,t){var i,o,r,n=null!==(o=((i={})[T.TRTCVideoResolution_480_270]={width:480,height:270},i[T.TRTCVideoResolution_640_360]={width:640,height:360},i[T.TRTCVideoResolution_960_540]={width:960,height:540},i[T.TRTCVideoResolution_1280_720]={width:1280,height:720},i[T.TRTCVideoResolution_1920_1080]={width:1920,height:1080},i)[e])&&void 0!==o?o:(r=e)&&"object"==typeof r&&"number"==typeof r.width&&"number"==typeof r.height?e:{width:1920,height:1080};return{width:n.width,height:n.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(_e(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)),_e(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)),!_e(null===(p=e.layout)||void 0===p?void 0:p.mirror)){var T=((t={})[R.TRTCVideoMirrorType_Auto]=!0,t[R.TRTCVideoMirrorType_Enable]=!0,t[R.TRTCVideoMirrorType_Disable]=!1,t);m.mirror=T[null===(f=e.layout)||void 0===f?void 0:f.mirror]}if(!_e(null===(v=e.layout)||void 0===v?void 0:v.rotation)){var y=((i={})[V.TRTCVideoRotation0]=0,i[V.TRTCVideoRotation90]=90,i[V.TRTCVideoRotation180]=180,i[V.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,a,c,l,h;switch(e.type){case mn.kScreen:return h=T.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 mn.kCamera:return h=T.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===(a=e.camera)||void 0===a?void 0:a.videoTrack,layout:this._getTRTCLayout(e)};case mn.kText:return u(u({id:e.id},e.text||{}),{layout:this._getTRTCLayout(e)});case mn.kImage:return{id:e.id,url:null===(c=e.image)||void 0===c?void 0:c.url,layout:this._getTRTCLayout(e)};case mn.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={})[T.TRTCVideoResolution_480_270]={width:480,height:270},i[T.TRTCVideoResolution_640_360]={width:640,height:360},i[T.TRTCVideoResolution_960_540]={width:960,height:540},i[T.TRTCVideoResolution_1280_720]={width:1280,height:720},i[T.TRTCVideoResolution_1920_1080]={width:1920,height:1080},i)[e],n=r.width,s=r.height;return t===D.TRTCVideoResolutionModePortrait&&(n=(o=[s,n])[0],s=o[1]),{width:n,height:s}},t.prototype.addMediaSource=function(e){var t;return h(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,l;return d(this,(function(h){switch(h.label){case 0:if(-1!==this.findMediaSourceIndex(e))throw new Error("Media source already existed");if(i=Ee(e),o=this._getTRTCSourceKey(i),!(r=this._getTRTCSourceItem(i))||!o)throw new Error("Invalid media source");return(n=Ee(this.trtcSourceMap.get(o))||[]).push(r),[4,this.trtc.updatePlugin("VideoMixer",(l={},l[o]=n,l))];case 1:return s=h.sent(),a=s.result,c=s.systemAudioTrackList,e.type===mn.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:h.sent(),h.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:!!_e(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 h(this,void 0,Promise,(function(){var r,n,s,a,c,u;return d(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=Ee(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===mn.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:Ee(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 V.TRTCVideoRotation0:case V.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case V.TRTCVideoRotation90:case V.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 V.TRTCVideoRotation0:case V.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case V.TRTCVideoRotation90:case V.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 h(this,void 0,Promise,(function(){var o,r,n,s,a,c,l,h;return d(this,(function(d){switch(d.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=u(u({},this.sourceList[o]),Ee(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),a=Ee(this.trtcSourceMap.get(n))||[],c=a.findIndex((function(t){return t.id===e.id})),a[c]=s,[4,this.trtc.updatePlugin("VideoMixer",(h={},h[n]=a,h))];case 1:if(d.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return l={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:Ee(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(l)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(l),this.trtcSourceMap.set(n,a),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(e){var t;return h(this,void 0,Promise,(function(){var i;return d(this,(function(o){switch(o.label){case 0:return i=null!==(t=null==e?void 0:e.streamType)&&void 0!==t?t:y.TRTCVideoStreamTypeBig,this.publishStreamType=i,this.logger.log("".concat(this.logPrefix," startPublish, streamType:"),i),[4,this.trtcCloud._startPublishVideoTrack({videoTrack:this.mixVideoTrack,streamType:i})];case 1:return o.sent(),[2]}}))}))},t.prototype.stopPublish=function(){return h(this,void 0,Promise,(function(){return d(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," stopPublish, streamType:"),this.publishStreamType),[4,this.trtcCloud._stopPublishVideoTrack({streamType:this.publishStreamType})];case 1:return e.sent(),[2]}}))}))},t.prototype.updatePublishParams=function(t){var i,o,r,n,s,a;return h(this,void 0,Promise,(function(){var c,u,l,h,p,f,g,m,T,y,_,R,b,C,S,w,E,M,A,P,I,V,L,x;return d(this,(function(d){switch(d.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),t),c=this.publishParams,this.publishParams=t,u=this._getCanvasSize(t.videoEncoderParams.videoResolution,t.videoEncoderParams.resMode),l=u.width,h=u.height,d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:l,height:h,canvasColor:String(t.canvasColor),frameRate:null!==(r=t.videoEncoderParams.videoFps)&&void 0!==r?r:15}})];case 2:return d.sent(),[3,4];case 3:if((p=d.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw p;return[3,4];case 4:null===(n=this.mediaMixingDesigner)||void 0===n||n.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),d.label=5;case 5:d.trys.push([5,11,12,17]),f=v(this.sourceList),d.label=6;case 6:return[4,f.next()];case 7:return(g=d.sent()).done?[3,10]:(m=g.value).layout?(T=m.layout.rect||{left:0,top:0,right:0,bottom:0},y=T.left,_=T.top,R=T.right,b=T.bottom,C=this._getCanvasSize(c.videoEncoderParams.videoResolution),S=C.width,w=C.height,E=this._getCanvasSize(t.videoEncoderParams.videoResolution),M=E.width,A=E.height,P=y*M/S,I=_*A/w,V=R*M/S,L=b*A/w,m.layout.rect={left:P,top:I,right:V,bottom:L},[4,this.updateMediaSource(m)]):[3,9];case 8:d.sent(),null===(s=this.eventEmitter)||void 0===s||s.emit("onSourceResized",m,null===(a=m.layout)||void 0===a?void 0:a.rect),d.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return x=d.sent(),i={error:x},[3,17];case 12:return d.trys.push([12,,15,16]),g&&!g.done&&(o=f.return)?[4,o.call(f)]:[3,14];case 13:d.sent(),d.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 d.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 is({view:this.view,videoResolution:(null===(e=this.publishParams)||void 0===e?void 0:e.videoEncoderParams.videoResolution)||T.TRTCVideoResolution_1920_1080,resMode:(null===(t=this.publishParams)||void 0===t?void 0:t.videoEncoderParams.resMode)||D.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 h(this,void 0,void 0,(function(){return d(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(u(u({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(u(u({},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=u(u({},e.origin),{layout:u(u({},e.origin.layout),{rect:t})});this.updateMediaSource(we(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=u(u({},e.origin),{layout:u(u({},e.origin.layout),{rect:t})});this.updateMediaSource(we(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 h(this,void 0,Promise,(function(){var o;return d(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:Ee(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}();!function(e){e.STARTED="started",e.STOPPED="stopped",e.ERROR="error",e.STALLED="stalled",e.RESUMED="resumed",e.UNDO_STATE_CHANGED="undo-state-changed",e.REDO_STATE_CHANGED="redo-state-changed"}(Zn||(Zn={}));var rs=void 0,ns=void 0,ss=void 0,as=void 0,cs=void 0,us=void 0,ls=void 0,hs=void 0,ds=["pen","rect","ellipse","arrow","laser","eraserObject"];function ps(e){var t,i={},o=e.tool;if(e.view_handle&&(i.view=e.view_handle),e.canvas&&(i.canvasInfo={},"number"==typeof e.canvas.width&&(i.canvasInfo.width=e.canvas.width),"number"==typeof e.canvas.height&&(i.canvasInfo.height=e.canvas.height)),(null==o?void 0:o.type)&&ds.includes(o.type)&&(i.tool={name:o.type}),o){var r=i.tool||{};o.color&&(r.color=o.color),"number"==typeof o.line_width&&(r.lineWidth=o.line_width),"laser"===o.type&&(r.laserFadeDuration="number"==typeof o.laserFadeDuration?o.laserFadeDuration:1e3),Object.keys(r).length>0&&(i.tool=r)}return"boolean"==typeof(null===(t=e.whiteboard)||void 0===t?void 0:t.interactive)&&(i.config={interactive:e.whiteboard.interactive}),i}var fs="Whiteboard",vs=Object.values(Zn),gs=function(){function e(t){if(this.eventEmitter=new M,this.pluginEventHandlers=[],this.boundPlugin=null,this.started=!1,e.whiteboardManager)return e.whiteboardManager;e.whiteboardManager=this,this.trtc=t.trtc,this._bindPluginEvents()}return e.prototype.onRecvWhiteboardCommand=function(e){return h(this,void 0,Promise,(function(){return d(this,(function(t){switch(t.label){case 0:return e&&"object"==typeof e?0!==Number(e.enable)?[3,2]:[4,this._stop()]:[2];case 1:return t.sent(),[2];case 2:return e.owner_id?[2]:this.started?[3,4]:[4,this._start(e)];case 3:return t.sent(),[3,6];case 4:return[4,this._update(e)];case 5:t.sent(),t.label=6;case 6:return e.op?[4,this._applyLocalOp(e.op)]:[3,8];case 7:t.sent(),t.label=8;case 8:return[2]}}))}))},e.prototype._start=function(e){return h(this,void 0,Promise,(function(){var t;return d(this,(function(i){switch(i.label){case 0:return t=ps(e),this._bindPluginEvents(),[4,this.trtc.startPlugin(fs,t)];case 1:return i.sent(),this.started=!0,[2]}}))}))},e.prototype._update=function(e){return h(this,void 0,Promise,(function(){var t;return d(this,(function(i){switch(i.label){case 0:return t=ps(e),0===Object.keys(t).length?[2]:[4,this.trtc.updatePlugin(fs,t)];case 1:return i.sent(),[2]}}))}))},e.prototype._stop=function(){return h(this,void 0,Promise,(function(){return d(this,(function(e){switch(e.label){case 0:if(!this.started)return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.trtc.stopPlugin(fs)];case 2:case 3:return e.sent(),[3,5];case 4:return this.started=!1,this._resetPluginEventBinding(),[7];case 5:return[2]}}))}))},e.prototype._applyLocalOp=function(e){return h(this,void 0,Promise,(function(){var t;return d(this,(function(i){switch(i.label){case 0:if(t=function(e){switch(e){case"undo":return{operation:"undo"};case"redo":return{operation:"redo"};case"clearall":return{tool:{clearScope:"all"},operation:"clear"};default:return null}}(e),!t)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.trtc.updatePlugin(fs,t)];case 2:case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},e.prototype._bindPluginEvents=function(){var e=this,t=this._getWhiteboardPlugin();t&&"function"==typeof t.on&&(this._offPluginEvents(),this.boundPlugin=t,vs.forEach((function(i){var o=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];e._emitWhiteboardEvent(i,t)};t.on(i,o),e.pluginEventHandlers.push({event:i,handler:o})})))},e.prototype._offPluginEvents=function(){var e=this;this.boundPlugin&&0!==this.pluginEventHandlers.length?("function"==typeof this.boundPlugin.off&&this.pluginEventHandlers.forEach((function(t){var i=t.event,o=t.handler;e.boundPlugin.off(i,o)})),this._resetPluginEventBinding()):this._resetPluginEventBinding()},e.prototype._resetPluginEventBinding=function(){this.boundPlugin=null,this.pluginEventHandlers=[]},e.prototype._getWhiteboardPlugin=function(){var e,t,i;return(null===(i=null===(t=null===(e=this.trtc)||void 0===e?void 0:e._plugins)||void 0===t?void 0:t.get)||void 0===i?void 0:i.call(t,fs))||null},e.prototype._emitWhiteboardEvent=function(e,t){var i;void 0===t&&(t=[]),0!==t.length?(i=this.eventEmitter).emit.apply(i,f([e],t,!1)):this.eventEmitter.emit(e)},e.prototype.on=function(e,t){this.eventEmitter.on(e,t)},e.prototype.off=function(e,t){this.eventEmitter.off(e,t)},e.prototype.destroy=function(){return h(this,void 0,Promise,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this._stop()];case 1:return t.sent(),this._offPluginEvents(),this.eventEmitter.removeAllListeners(),e.whiteboardManager=null,[2]}}))}))},e.whiteboardManager=null,e}(),ms=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=u(u({},e),{functionName:o}),a=new Promise((function(e,t){s.resolve=e,s.reject=t}));if(s.promise=a,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 c=[];this.queue=this.queue.filter((function(e,t){return 0===t||(e.functionName!==o||(c.push(e),!1))})),c.forEach((function(e){e.reject(new Error("aborted by newer task"))}))}this.queue.push(s)}return this.isRunning||this.callNext(),a},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}(),Ts=new WeakMap,ys=new WeakMap,_s=new WeakMap;function Rs(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=_s.get(this)||new Map;_s.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 ms,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 bs=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,f([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,f([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 h(this,void 0,Promise,(function(){var t,i,o;return d(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 h(this,void 0,Promise,(function(){var t;return d(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}(),Cs=void 0,Ss=void 0,ws=void 0,Es=void 0,Ms=e._loggerManager;Ms.info("TRTCCloud Version: ".concat(xn));var As,Ps,Is,Vs="trtcCloud",Ls=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(As=function(){0!==xs.size&&Array.from(xs.values()).forEach((function(e){e.fn()}))},Ps=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];Is>0&&clearTimeout(Is),Is=window.setTimeout((function(){As.apply(e,t),Is=-1}),Ps)}));var xs=new Map,Os=function(p){function v(i){void 0===i&&(i={});var r=p.call(this)||this;r._version="",r._frameWorkType=30,r._component=0,r._language=0,r._networkProxy={},r._localView=null,r._autoRecvAudio=!0,r._autoRecvVideo=!1,r._localTestView=null,r._isVideoPublish=!0,r._localRenderParams={rotation:V.TRTCVideoRotation0,fillMode:_.TRTCVideoFillMode_Fill,mirrorType:R.TRTCVideoMirrorType_Auto},r._encoderMirror=void 0,r._videoProfile={},r._isAudioPublish=!0,r._audioMuteType=!1,r._audioProfile=e.TYPE.AUDIO_PROFILE_STANDARD,r._captureVolume=100,r._playoutVolume=100,r._isSharingScreen=!1,r._remoteStreamConfig=new Map,r._remoteStreamMap=new Map,r._cameraList=[],r._microphoneList=[],r._speakerList=[],r._currentCamera={},r._currentMicrophone={},r._currentSpeaker={},r._currentCameraId="",r._currentMicrophoneId="",r._currentSpeakerId="",r._screenShareParams={option:{}},r._isMobile=qr,r._isFrontCamera=!0,r._cameraVideoTrack=null,r._smallStreamVideoProfile=void 0,r._qosPreference=void 0,r._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},r._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},r._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},r._isVirtualBackground=!1,r._isTestVirtualBackground=!1,r._isBeautyEnabled=!1,r._isTestBeautyEnabled=!1,r._isWaterMark=!1,r._currentAudioQuality=w.TRTCAudioQualityDefault,r._lastAudioScene=E.default,r._isAIDenoiserEnabled=!1,r._currentAIDenoiserMode=void 0,r._pendingAIDenoiserApply=!1,r._remoteStatisticsUserIdList=[],r._hasJoinedRoom=!1,r._isExitingRoom=!1,r._version=xn;var c=i.frameWorkType,u=void 0===c?30:c,l=i.component,h=void 0===l?0:l,d=i.language,f=void 0===d?0:d;return r._frameWorkType=u,r._component=h,r._language=f,r._trtc=e.create({enableSEI:v.enableSEI,assetsPath:v.assetsPath,enableVolumeControlInIOS:!0,plugins:[s,t,n,a,o]}),r._testTrtc=e.create(),r._log=e._loggerManager,r.logger=new Fn(Ms,{seq:Ls++}),r._echoCancellation=void 0,r._noiseSuppression=void 0,r._autoGainControl=void 0,r._addTRTCEvents(),r.handleDeviceChange=r.handleDeviceChange.bind(r),xs.set(r,{fn:r.handleDeviceChange,self:r}),r}var g;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}c(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(v,p),v.getPlugin=function(e){return"VirtualBackground"===e?i:"BasicBeauty"===e?r:"VideoMixer"===e?s:"Whiteboard"===e?a:null},v.getTRTCShareInstance=function(e){return v.shareInstance||(v.shareInstance=new v(e)),v.shareInstance},v.setLogLevel=function(t,i){var o,r=((o={})[U.TRTCLogLevelVerbose]=0,o[U.TRTCLogLevelDebug]=1,o[U.TRTCLogLevelInfo]=2,o[U.TRTCLogLevelWarn]=3,o[U.TRTCLogLevelError]=4,o[U.TRTCLogLevelFatal]=4,o[U.TRTCLogLevelNone]=5,o),n=r[t];_e(n)&&(n=r[U.TRTCLogLevelInfo]);var s=!be(i)||i;e.setLogLevel(n,s)},v.destroyTRTCShareInstance=function(){v.shareInstance&&(v.shareInstance._destroy(),v.shareInstance=null),Array.from(v.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},v.callExperimentalAPI=function(e){console.log("static ".concat(Vs,".callExperimentalAPI"),e);var t=Ce(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":v.enableSEI=o.enable;break;case"setAssetsPath":v.assetsPath=o.assetsPath}}catch(r){throw r}}},v.prototype.createSubCloud=function(){if(this!==v.shareInstance)return null;var e=new v;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),v.subCloudMap.set(e,e),e},v.prototype.destroy=function(){this!==v.shareInstance?(v.subCloudMap.get(this)&&v.subCloudMap.delete(this),this._destroy()):v.destroyTRTCShareInstance()},v.prototype._destroy=function(){xs.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},v.prototype.getSDKVersion=function(){return this._version||""},v.prototype.enterRoom=function(e,t){return h(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,l,h,p,f,v,g,m,T,y,_,R,b=this;return d(this,(function(d){switch(d.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,a=e.role,c=e.privateMapKey,l=e.businessInfo,h=e.enableAutoPlayDialog,p=e.proxy,f=e.streamId,v=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(Vs,".enterRoom with params: "),e,t),p&&(this._networkProxy=p),!(i&&o&&r))return[3,5];d.label=1;case 1:return d.trys.push([1,3,,4]),g={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:ge[a],scene:me[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},g=c?u(u({},g),{privateMapKey:c}):g,g=l?u(u({},g),{businessInfo:l}):g,m=h||this._enableAutoPlayDialog,g=be(m)?u(u({},g),{enableAutoPlayDialog:m}):g,g=this._networkProxy?u(u({},g),{proxy:this._networkProxy}):g,g=f?u(u({},g),{streamId:f}):g,g=v?u(u({},g),{userDefineRecordId:v}):g,g=void 0!==this._latencyLevel?u(u({},g),{latencyLevel:this._latencyLevel}):g,T=ye(),[4,this._trtc.enterRoom(g)];case 2:return d.sent(),this._hasJoinedRoom=!0,this._sdkAppId=i,this._userId=o,this._userSig=r,this._pendingAIDenoiserApply&&(this._pendingAIDenoiserApply=!1,this._applyAIDenoiserDecision().catch((function(e){b.logger.warn("".concat(Vs,".enterRoom flush AI denoiser decision fail: "),e)}))),y=ye()-T,this.emit("onEnterRoom",y),[3,4];case 3:throw _=d.sent(),R=(R=this._transformTRTCErrorCode(_,"enterRoom"))<0?R:-1,this.emit("onEnterRoom",R),this._callFunctionErrorManage(_,"enterRoom"),_;case 4:return[3,6];case 5:this._emitError(Vn),d.label=6;case 6:return[2]}}))}))},v.prototype.exitRoom=function(){return h(this,void 0,Promise,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(Vs,".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",pn.exitRoom),[3,3];case 2:throw e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),e;case 3:return[2]}}))}))},v.prototype.switchRole=function(e){return h(this,void 0,void 0,(function(){var t;return d(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Vs,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(ge[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(ge[e])),[3,4];case 3:throw t=i.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),t;case 4:return[2]}}))}))},v.prototype.setDefaultStreamRecvMode=function(e,t){return h(this,void 0,void 0,(function(){return d(this,(function(i){return this.logger.info("".concat(Vs,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),be(e)&&(this._autoRecvAudio=e),be(t)&&(this._autoRecvVideo=t),[2]}))}))},v.prototype.resetTRTCCloud=function(){if(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._isWaterMark=!1,this._remoteStatisticsUserIdList=[],this._resetBeautyStyle(),this._sdkAppId=void 0,this._userId=void 0,this._userSig=void 0,this._currentAudioQuality=w.TRTCAudioQualityDefault,this._lastAudioScene=E.default,this._isAIDenoiserEnabled&&this._trtc)try{this._trtc.stopPlugin(de)}catch(e){this.logger.warn("".concat(Vs,".resetTRTCCloud stop AI denoiser fail: "),e)}this._isAIDenoiserEnabled=!1,this._currentAIDenoiserMode=void 0,this._pendingAIDenoiserApply=!1},v.prototype._updateLocalVideo=function(){return h(this,void 0,void 0,(function(){var t;return d(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]}}))}))},v.prototype._updateLocalTestVideo=function(){return h(this,void 0,void 0,(function(){var t;return d(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]}}))}))},v.prototype._updateLocalScreen=function(){return h(this,void 0,void 0,(function(){var t;return d(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]}}))}))},v.prototype._updateRemoteVideo=function(t,i){return h(this,void 0,void 0,(function(){var o;return d(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]}}))}))},v.prototype.startLocalPreview=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return h(this,void 0,Promise,(function(){var i,o,r,n,s;return d(this,(function(a){switch(a.label){case 0:this.logger.info("".concat(Vs,".startLocalPreview with params: "),t),1===f([],t,!0).length?o=f([],t,!0)[0]:2===f([],t,!0).length&&(s=f([],t,!0),i=s[0],o=s[1]),_e(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:throw n=a.sent(),this._callFunctionErrorManage(n,"startLocalPreview"),n;case 10:return[2]}}))}))},v.prototype.updateLocalView=function(e){return h(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Vs,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},v.prototype.stopLocalPreview=function(){return h(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Vs,".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:throw e=t.sent(),console.warn("".concat(Vs," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),e;case 4:return[2]}}))}))},v.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),h(this,void 0,void 0,(function(){var t;return d(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Vs,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),t;case 4:return[2]}}))}))},v.prototype.startRemoteView=function(t,i,o){return h(this,void 0,void 0,(function(){var r,n;return d(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(Vs,".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===y.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:throw n=s.sent(),this._callFunctionErrorManage(n,"startRemoteView"),n;case 10:return[2]}}))}))},v.prototype.updateRemoteView=function(e,t,i){return h(this,void 0,void 0,(function(){return d(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Vs,".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]}}))}))},v.prototype.stopRemoteView=function(e,t){return h(this,void 0,void 0,(function(){var i;return d(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Vs,".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:throw i=o.sent(),this._callFunctionErrorManage(i,"stopRemoteView"),i;case 4:return[2]}}))}))},v.prototype.stopAllRemoteView=function(){return h(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Vs,".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:throw e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),e;case 4:return[2]}}))}))},v.prototype.setVideoEncoderParam=function(e){return h(this,void 0,void 0,(function(){var t,i;return d(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Vs,".setVideoEncoderParam with params: "),e),o.label=1;case 1:return o.trys.push([1,4,,5]),t=this._getTRTCVideoProfile(y.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:throw i=o.sent(),this._callFunctionErrorManage(i,"setVideoEncoderParam"),i;case 5:return[2]}}))}))},v.prototype.setNetworkQosParam=function(e){return h(this,void 0,void 0,(function(){var t,i,o=this;return d(this,(function(r){return this.logger.info("".concat(Vs,".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)}))}))]}))}))},v.prototype.setLocalRenderParams=function(e){return h(this,void 0,void 0,(function(){var t;return d(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Vs,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"setLocalRenderParams"),t;case 5:return[2]}}))}))},v.prototype.setVideoEncoderMirror=function(e){return h(this,void 0,void 0,(function(){var t;return d(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Vs,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"setVideoEncoderMirror"),t;case 4:return[2]}}))}))},v.prototype.setRemoteRenderParams=function(e,t,i){return h(this,void 0,void 0,(function(){var o;return d(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Vs,".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:throw o=r.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),o;case 4:return[2]}}))}))},v.prototype._updateLocalAudio=function(){return h(this,void 0,void 0,(function(){var t;return d(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]}}))}))},v.prototype._updateLocalTestAudio=function(){return h(this,void 0,void 0,(function(){var t;return d(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]}}))}))},v.prototype.startLocalAudio=function(t){return void 0===t&&(t=w.TRTCAudioQualityDefault),h(this,void 0,void 0,(function(){var i,o,r;return d(this,(function(n){switch(n.label){case 0:t===w.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(Vs,".startLocalAudio with params: "),t),this._currentAudioQuality=t,i=this._getTRTCAudioQuality(t),n.label=1;case 1:n.trys.push([1,11,,12]),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"),this._lastAudioScene===E.default?[3,10]:[4,this._applyAIDenoiserDecision()];case 9:n.sent(),n.label=10;case 10:return[3,12];case 11:throw r=n.sent(),console.warn("".concat(Vs," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),r;case 12:return[2]}}))}))},v.prototype.stopLocalAudio=function(){return h(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Vs,".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:throw e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),e;case 4:return[2]}}))}))},v.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),h(this,void 0,void 0,(function(){var t;return d(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Vs,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),t;case 4:return[2]}}))}))},v.prototype.setAudioCaptureVolume=function(e){return h(this,void 0,void 0,(function(){var t;return d(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Vs,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"setAudioCaptureVolume"),t;case 4:return[2]}}))}))},v.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(Vs,".getAudioCaptureVolume")),this._getCaptureVolume()},v.prototype.setAudioPlayoutVolume=function(e){return h(this,void 0,void 0,(function(){var t;return d(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Vs,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"setAudioPlayoutVolume"),t;case 4:return[2]}}))}))},v.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(Vs,".getAudioPlayoutVolume")),this._playoutVolume},v.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),h(this,void 0,void 0,(function(){var i;return d(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Vs,".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(Vn),[2]);case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),i;case 4:return[2]}}))}))},v.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(Vs,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){throw this._callFunctionErrorManage(t,"muteAllRemoteAudio"),t}},v.prototype.muteRemoteVideoStream=function(e,t,i){return h(this,void 0,void 0,(function(){var o;return d(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Vs,".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:throw o=r.sent(),this._callFunctionErrorManage(o,"muteRemoteVideoStream"),o;case 4:return[2]}}))}))},v.prototype.muteAllRemoteVideoStreams=function(e){return h(this,void 0,void 0,(function(){var t;return d(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(Vs,".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:throw t=i.sent(),this._callFunctionErrorManage(t,"muteAllRemoteVideoStreams"),t;case 7:return[2]}}))}))},v.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(Vs,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){throw this._callFunctionErrorManage(i,"setRemoteAudioVolume"),i}},v.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(Vs,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){throw this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation"),t}},v.prototype.enableSmallVideoStream=function(e,t){return h(this,void 0,Promise,(function(){var i;return d(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(Vs,".enableSmallVideoStream with params: "),e,t),e?(i=this._getTRTCVideoProfile(y.TRTCVideoStreamTypeSmall,t),this._setSmallStreamVideoProfile(i)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return o.sent(),[2]}}))}))},v.prototype.snapshotVideo=function(e,t){var i="";return i=""===e&&t===y.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===e&&t===y.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(t)}):this._trtc.getVideoSnapshot({userId:e,streamType:this._getTRTCStreamType(t)}),this.emit("onSnapshotComplete",e,t,i),i},v.prototype.startScreenShare=function(t,i,o){return h(this,void 0,void 0,(function(){var r,n,s,a,c,u;return d(this,(function(l){switch(l.label){case 0:this.logger.info("".concat(Vs,".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(y.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(),this._callFunctionErrorManage(u,"startScreenShare"),u.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]}}))}))},v.prototype.setSubStreamEncoderParam=function(e){return h(this,void 0,void 0,(function(){var t,i;return d(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Vs,".setSubStreamEncoderParam with params: "),e),t=this._getTRTCVideoProfile(y.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:throw i=o.sent(),this._callFunctionErrorManage(i,"setSubStreamEncoderParam"),i;case 4:return[2]}}))}))},v.prototype.stopScreenShare=function(){return h(this,void 0,Promise,(function(){var e;return d(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(Vs,".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:throw e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),e;case 4:return[2]}}))}))},v.prototype._startPublishVideoTrack=function(t){var i=t.videoTrack,o=t.streamType,r=void 0===o?y.TRTCVideoStreamTypeBig:o;return h(this,void 0,void 0,(function(){var t,o,n,s;return d(this,(function(a){switch(a.label){case 0:if(r!==y.TRTCVideoStreamTypeSub)return[3,10];a.label=1;case 1:a.trys.push([1,8,,9]),a.label=2;case 2:return a.trys.push([2,4,,7]),[4,this._trtc.startScreenShare({publish:!0,streamType:e.TYPE.STREAM_TYPE_SUB,option:{videoTrack:i}})];case 3:return a.sent(),[3,7];case 4:return(t=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._trtc.updateScreenShare({publish:!0,option:{videoTrack:i}})];case 5:a.sent(),a.label=6;case 6:throw t;case 7:return[3,9];case 8:return o=a.sent(),this._callFunctionErrorManage(o,"startPublishVideoTrack"),[3,9];case 9:return[2];case 10:a.trys.push([10,17,,18]),a.label=11;case 11:return a.trys.push([11,13,,16]),[4,this._trtc.startLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 12:return a.sent(),[3,16];case 13:return(n=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,15]:[4,this._trtc.updateLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 14:a.sent(),a.label=15;case 15:throw n;case 16:return[3,18];case 17:return s=a.sent(),this._callFunctionErrorManage(s,"startPublishVideoTrack"),[3,18];case 18:return[2]}}))}))},v.prototype._stopPublishVideoTrack=function(e){var t=(void 0===e?{}:e).streamType,i=void 0===t?y.TRTCVideoStreamTypeBig:t;return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return i!==y.TRTCVideoStreamTypeSub?[3,2]:[4,this._trtc.stopScreenShare()];case 1:case 3:return e.sent(),[2];case 2:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()]}}))}))},v.prototype.startScreenCapture=function(){this._emitError(Ln)},v.prototype.pauseScreenCapture=function(){this._emitError(Ln)},v.prototype.resumeScreenCapture=function(){this._emitError(Ln)},v.prototype.getScreenCaptureSources=function(){this._emitError(Ln)},v.prototype.selectScreenCaptureTarget=function(){this._emitError(Ln)},v.prototype.getCameraDevicesList=function(){return h(this,void 0,Promise,(function(){var t,i,o;return d(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Vs,".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 u(u({},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]}}))}))},v.prototype.setCurrentCameraDevice=function(e){var t;return h(this,void 0,Promise,(function(){var i;return d(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Vs,".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]}}))}))},v.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(Vs,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new I(t,i,o,i,r)},v.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},v.prototype.switchCamera=function(e){return h(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(Vs,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},v.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},v.prototype.setVirtualBackground=function(e){return h(this,void 0,void 0,(function(){var t,i,o,r,n;return d(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!==fe?[3,2]:[4,this._trtc.updatePlugin(le,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==ve?[3,4]:[4,this._trtc.updatePlugin(le,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(le,u(u({},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(le),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Vs,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},v.prototype.setTestVirtualBackground=function(e){return h(this,void 0,void 0,(function(){var t,i,o,r,n;return d(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!==fe?[3,2]:[4,this._testTrtc.updatePlugin(le,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==ve?[3,4]:[4,this._testTrtc.updatePlugin(le,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(le,u(u({},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(le),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(Vs,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},v.prototype.useVirtualBackground=function(e){return h(this,void 0,void 0,(function(){return d(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]}}))}))},v.prototype.setBeautyStyle=function(e,t,i,o){return h(this,void 0,void 0,(function(){return d(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]}}))}))},v.prototype.setTestBeautyStyle=function(e,t,i,o){return h(this,void 0,void 0,(function(){return d(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]}}))}))},v.prototype.useBeautyStyle=function(e){return h(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:r,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:r,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},v.prototype._setAudioQualityEx=function(e){return h(this,void 0,void 0,(function(){var t;return d(this,(function(i){switch(i.label){case 0:return t=(e||{}).audioScene,Re(t)?(this.logger.info("".concat(Vs,"._setAudioQualityEx audioScene=").concat(t)),this._lastAudioScene=t,[4,this._applyAIDenoiserDecision()]):(this.logger.warn("".concat(Vs,"._setAudioQualityEx invalid audioScene: "),t),[2]);case 1:return i.sent(),[2]}}))}))},v.prototype._applyAIDenoiserDecision=function(){return h(this,void 0,void 0,(function(){var e,t,i,o,r;return d(this,(function(n){switch(n.label){case 0:if(e=this._currentAudioQuality,t=this._lastAudioScene,!(void 0===(i=this._resolveAIDenoiserMode(e,t))||this._sdkAppId&&this._userId&&this._userSig))return this._pendingAIDenoiserApply=!0,this.logger.info("".concat(Vs,".applyAIDenoiserDecision pending: enterRoom not ready, will retry after enterRoom success")),[2];n.label=1;case 1:return n.trys.push([1,9,,10]),void 0!==i?[3,4]:this._isAIDenoiserEnabled?[4,this._trtc.stopPlugin(de)]:[3,3];case 2:n.sent(),this._isAIDenoiserEnabled=!1,this._currentAIDenoiserMode=void 0,n.label=3;case 3:return[2];case 4:return this._isAIDenoiserEnabled?[3,6]:v.assetsPath?(o={sdkAppId:this._sdkAppId,userId:this._userId,userSig:this._userSig,mode:i,assetsPath:v.assetsPath},[4,this._trtc.startPlugin(de,o)]):(this.logger.warn("".concat(Vs,".applyAIDenoiserDecision: assetsPath is not set, skip startPlugin: ").concat(de)),[2]);case 5:return n.sent(),this._isAIDenoiserEnabled=!0,this._currentAIDenoiserMode=i,[2];case 6:return this._currentAIDenoiserMode===i?[3,8]:[4,this._trtc.updatePlugin(de,{mode:i})];case 7:n.sent(),this._currentAIDenoiserMode=i,n.label=8;case 8:return[3,10];case 9:return r=n.sent(),this.logger.error("".concat(Vs,".applyAIDenoiserDecision fail: "),r),[3,10];case 10:return[2]}}))}))},v.prototype._resolveAIDenoiserMode=function(e,t){if(t!==E.default&&e!==w.TRTCAudioQualityMusic)return e===w.TRTCAudioQualitySpeech?1:0},v.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return h(this,void 0,void 0,(function(){var i,a,c,u,l;return d(this,(function(h){switch(h.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");h.label=1;case 1:return h.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(he)]:[3,3];case 2:return h.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(he,u)];case 4:return h.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(he,u)];case 6:h.sent(),h.label=7;case 7:return[3,9];case 8:throw l=h.sent(),s?this.logger.error("".concat(Vs,".").concat("setTestBeautyStyle"," fail: "),l):this.logger.error("".concat(Vs,".").concat("setBeautyStyle"," fail: "),l),l;case 9:return[2]}}))}))},v.prototype._resetBeautyStyle=function(){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(he)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(he)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},v.prototype.setWaterMark=function(e){return h(this,void 0,void 0,(function(){var t,i,o,r,n,s,a;return d(this,(function(c){switch(c.label){case 0:return c.trys.push([0,7,,8]),t=e.enable,i=e.imageUrl,o=e.x,r=e.y,n=e.size,s=e.mosaic,t?this._isWaterMark?[4,this._trtc.updatePlugin(pe,{imageUrl:i,x:o,y:r,size:n,mosaic:s})]:[3,2]:[3,5];case 1:return c.sent(),[3,4];case 2:return[4,this._trtc.startPlugin(pe,{imageUrl:i,x:o,y:r,size:n,mosaic:s})];case 3:c.sent(),this._isWaterMark=!0,c.label=4;case 4:return[3,6];case 5:this._trtc.stopPlugin(pe),this._isWaterMark=!1,c.label=6;case 6:return[3,8];case 7:throw a=c.sent(),this.logger.error("".concat(Vs,".setWaterMark fail: "),a),a;case 8:return[2]}}))}))},v.prototype.getMicDevicesList=function(){return h(this,void 0,Promise,(function(){var t,i,o;return d(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Vs,".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 u(u({},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]}}))}))},v.prototype.setCurrentMicDevice=function(e){var t;return h(this,void 0,Promise,(function(){var i;return d(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Vs,".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]}}))}))},v.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(Vs,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new I(t,i,o,i,r)},v.prototype.getSpeakerDevicesList=function(){return h(this,void 0,Promise,(function(){var t,i,o;return d(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Vs,".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 u(u({},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]}}))}))},v.prototype.setCurrentSpeakerDevice=function(t){return h(this,void 0,Promise,(function(){var i;return d(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(Vs,".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]}}))}))},v.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(Vs,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new I(t,i,o,i,r)},v.prototype.startCameraDeviceTest=function(t){return h(this,void 0,void 0,(function(){var i;return d(this,(function(o){switch(o.label){case 0:if(this.logger.info("".concat(Vs,".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]}}))}))},v.prototype.stopCameraDeviceTest=function(){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Vs,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},v.prototype.startMicDeviceTest=function(t){return h(this,void 0,void 0,(function(){var i,o=this;return d(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(Vs,".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]}}))}))},v.prototype.stopMicDeviceTest=function(){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Vs,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},v.prototype.callExperimentalAPI=function(e){return h(this,void 0,void 0,(function(){var t,i,o;return d(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(Vs,".callExperimentalAPI"),e),(t=Ce(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,31,,32]),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"setAudioQualityEx":return[3,16];case"setAudienceLatencyLevel":return[3,18];case"switchPlaybackQuality":return[3,19];case"requestPictureInPicture":return[3,21];case"exitPictureInPicture":return[3,23];case"OnRecvWhiteboardCommand":return[3,25];case"setWaterMark":return[3,27]}return[3,29];case 2:return this._handleSetFrameWork(o),[3,30];case 3:return this._echoCancellation=Boolean(o.enable),[3,30];case 4:return this._noiseSuppression=Boolean(o.enable),[3,30];case 5:return this._autoGainControl=Boolean(o.enable),[3,30];case 6:return this._handleKeyMetricsStats(o),[3,30];case 7:return this._networkProxy=o,[3,30];case 8:return[4,this.setVirtualBackground(o)];case 9:return r.sent(),[3,30];case 10:return[4,this.setTestVirtualBackground(o)];case 11:return r.sent(),[3,30];case 12:return[4,this.setTestBeautyStyle(o.style,o.beautyLevel,o.whitenessLevel,o.ruddinessLevel)];case 13:return r.sent(),[3,30];case 14:return this._setVideoEncodeParamEx(o),[3,30];case 15:return this._enableAutoPlayDialog=Boolean(o.enable),[3,30];case 16:return[4,this._setAudioQualityEx(o)];case 17:return r.sent(),[3,30];case 18:return this._latencyLevel=o.latencyLevel,[3,30];case 19:return[4,this._switchPlaybackQuality(o)];case 20:return r.sent(),[3,30];case 21:return[4,this._requestPictureInPicture()];case 22:return r.sent(),[3,30];case 23:return[4,this._exitPictureInPicture()];case 24:return r.sent(),[3,30];case 25:return[4,this.getWhiteboardManager().onRecvWhiteboardCommand(JSON.parse(o))];case 26:return r.sent(),[3,30];case 27:return[4,null==this?void 0:this.setWaterMark(o)];case 28:return r.sent(),[3,30];case 29:return[3,30];case 30:return[3,32];case 31:throw r.sent();case 32:return[2]}}))}))},v.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;Re(t)&&(this._frameWorkType=t),Re(i)&&(this._component=i),Re(o)&&(this._language=o)},v.prototype._handleKeyMetricsStats=function(t){var i=t.key,o=t.opt,r=t.value,n=t.version,s=o===Te;e._addKVStat({type:o,key:i,value:r,version:n,useUV:s,base:100})},v.prototype._setVideoEncodeParamEx=function(e){return h(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:switch(e.streamType){case y.TRTCVideoStreamTypeBig:return[3,1];case y.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]}}))}))},v.prototype._switchPlaybackQuality=function(e){return h(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return d(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,autoUnmuteAudio:!0})]:[2];case 1:return u.sent(),[2]}}))}))},v.prototype._requestPictureInPicture=function(){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Vs,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},v.prototype._exitPictureInPicture=function(){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(Vs,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},v.prototype._emitError=function(e){e&&this.emit&&this.emit(se,e.code,e.message)},v.prototype._emitWarning=function(e){this.emit&&this.emit(ae,e)},v.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?In:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},v.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:yn},v.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},v.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},v.prototype._transformTRTCDeviceError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t),r="startScreenShare"===t;switch(e.extraCode){case 5301:case 5305:case 5306:case 5307:case 5308:case 5309:if(i)return _n;if(o)return Sn;if(r)return An;break;case 5302:if(i)return Rn;if(o)return wn;if(r)return Pn;break;case 5303:if(i)return Cn;if(o)return Mn;if(r)return An;break;case 5304:if(i)return bn;if(o)return En;if(r)return An}},v.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?_n:o?Sn:e.code},v.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},v.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),r=t.message;"startScreenShare"===i&&(r=JSON.stringify({name:t.originError.name,message:r})),this.emit(se,o,r)}},v.prototype._getTRTCResolution=function(e){var t=(T[e]||"").split("_");return{width:+(t.length>1&&t[1]),height:+(t.length>2&&t[2])}},v.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 y.TRTCVideoStreamTypeSub:u=this._defaultScreenProfile;break;case y.TRTCVideoStreamTypeSmall:u=this._defaultSmallVideoProfile;break;case y.TRTCVideoStreamTypeBig:default:u=this._defaultVideoProfile}if(_e(r))_e(i)||(u.width=i),_e(o)||(u.height=o);else{var l=this._getTRTCResolution(r);u.width=l.width,u.height=l.height}if(!_e(a)&&a===D.TRTCVideoResolutionModePortrait||!_e(c)&&c===D.TRTCVideoResolutionModePortrait){var h=u.height,d=u.width;u.width=h,u.height=d}return n&&(u.frameRate=n),s&&(u.bitrate=s),u},v.prototype._getTRTCStreamType=function(t){var i;return((i={})[y.TRTCVideoStreamTypeBig]=e.TYPE.STREAM_TYPE_MAIN,i[y.TRTCVideoStreamTypeSmall]=e.TYPE.STREAM_TYPE_MAIN,i[y.TRTCVideoStreamTypeSub]=e.TYPE.STREAM_TYPE_SUB,i)[t]},v.prototype._getTRTCFillMode=function(e){var t;return((t={})[_.TRTCVideoFillMode_Fill]=dn.COVER,t[_.TRTCVideoFillMode_Fit]=dn.CONTAIN,t)[e]},v.prototype._getTRTCCloudVideoFillMode=function(e){var t;return((t={})[dn.COVER]=_.TRTCVideoFillMode_Fill,t[dn.CONTAIN]=_.TRTCVideoFillMode_Fit,t)[e]},v.prototype._getTRTCCloudMirrorType=function(e){return!0===e?R.TRTCVideoMirrorType_Enable:R.TRTCVideoMirrorType_Disable},v.prototype._getLocalRenderMirror=function(e){var t;return e===R.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((t={})[R.TRTCVideoMirrorType_Enable]=!0,t[R.TRTCVideoMirrorType_Disable]=!1,t)[e]},v.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return _e(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},v.prototype._getTRTCRemoteMirror=function(e){var t;return((t={})[R.TRTCVideoMirrorType_Auto]=!1,t[R.TRTCVideoMirrorType_Enable]=!0,t[R.TRTCVideoMirrorType_Disable]=!1,t)[e]},v.prototype._getTRTCQosPreference=function(t){var i;return((i={})[z.TRTCVideoQosPreferenceSmooth]=e.TYPE.QOS_PREFERENCE_SMOOTH,i[z.TRTCVideoQosPreferenceClear]=e.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},v.prototype._getTRTCAudioQuality=function(t){var i;return((i={})[w.TRTCAudioQualitySpeech]=e.TYPE.AUDIO_PROFILE_STANDARD,i[w.TRTCAudioQualityDefault]=e.TYPE.AUDIO_PROFILE_STANDARD,i[w.TRTCAudioQualityMusic]=e.TYPE.AUDIO_PROFILE_HIGH_STEREO,i)[t]},v.prototype._getTRTCCloudDeviceType=function(e){return{camera:P.TRTCDeviceTypeCamera,microphone:P.TRTCDeviceTypeMic,speaker:P.TRTCDeviceTypeSpeaker}[e]},v.prototype._getTRTCCloudDeviceState=function(e){return{add:A.TRTCDeviceStateAdd,remove:A.TRTCDeviceStateRemove,active:A.TRTCDeviceStateActive}[e]},v.prototype._getTRTCCloudQuality=function(e){return[O.TRTCQuality_Unknown,O.TRTCQuality_Excellent,O.TRTCQuality_Good,O.TRTCQuality_Poor,O.TRTCQuality_Bad,O.TRTCQuality_Vbad,O.TRTCQuality_Down][e]},v.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},v.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},v.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return be(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),be(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),be(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},v.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},v.prototype._generateRemoteVideoData=function(e,t){return Ee(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},v.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:pn.banned,room_disband:pn.roomDisband};Re(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 N("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new N(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:y.TRTCVideoStreamTypeBig,small:y.TRTCVideoStreamTypeSmall,sub:y.TRTCVideoStreamTypeSub},h=(null===(i=c.video)||void 0===i?void 0:i.length)>0?c.video.map((function(e){var t=new H;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 H;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 Q;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 Q;r.userId=i,r.audioBitrate=o||0,t.push(r)}p.push.apply(p,t)}));var f=new j;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",y.TRTCVideoStreamTypeBig):"screen"===i&&t.emit("onSendFirstLocalVideoFrame",y.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)}))},v.prototype._removeTRTCEvents=function(){this._trtc.off("*")},v.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)},v.prototype._setLocalView=function(e){this._localView=e},v.prototype._getLocalView=function(){return this._localView},v.prototype._setIsMobile=function(e){this._isMobile=e},v.prototype._getIsMobile=function(){return this._isMobile},v.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},v.prototype._getIsFrontCamera=function(){return this._isFrontCamera},v.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},v.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},v.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},v.prototype._getIsVideoPublish=function(){return this._isVideoPublish},v.prototype._setVideoProfile=function(e){this._videoProfile=e},v.prototype._getVideoProfile=function(){return this._videoProfile},v.prototype._setQosPreference=function(e){this._qosPreference=e},v.prototype._getQosPreference=function(){return this._qosPreference},v.prototype._setLocalTestView=function(e){this._localTestView=e},v.prototype._getLocalTestView=function(){return this._localTestView},v.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;_e(t)||(this._screenShareParams.view=t),_e(i)||(this._screenShareParams.option.systemAudio=i),_e(o)||(this._screenShareParams.option.fillMode=o),_e(r)||(this._screenShareParams.option.profile=r),_e(n)||(this._screenShareParams.option.videoTrack=n),_e(s)||(this._screenShareParams.option.qosPreference=s),_e(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},v.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},v.prototype._getScreenShareParams=function(){return this._screenShareParams},v.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},v.prototype._getIsAudioPublish=function(){return this._isAudioPublish},v.prototype._setAudioMuteType=function(e){this._audioMuteType=e},v.prototype._getAudioMuteType=function(){return this._audioMuteType},v.prototype._setAudioProfile=function(e){this._audioProfile=e},v.prototype._getAudioProfile=function(){return this._audioProfile},v.prototype._getCaptureVolume=function(){return this._captureVolume},v.prototype._setCaptureVolume=function(e){this._captureVolume=e},v.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},v.prototype._getCurrentCameraId=function(){return this._currentCameraId},v.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},v.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},v.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},v.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},v.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(R.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(_.TRTCVideoFillMode_Fit)}});var r=i.view,n=i.mirrorType,s=i.fillMode,a=i.small;_e(r)||(o.view=r),_e(n)||(o.option.mirror=this._getTRTCRemoteMirror(n)),_e(s)||(o.option.fillMode=this._getTRTCFillMode(s)),_e(a)||(o.option.small=a),this._remoteStreamConfig.set("".concat(e,"_").concat(this._getTRTCStreamType(t)),o)},v.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=u({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},v.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)}))},v.prototype.handleDeviceChange=function(){return h(this,void 0,void 0,(function(){var t=this;return d(this,(function(i){return e.getCameraList().then((function(e){return h(t,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return this._cameraList.length===e.length?[2]:[4,this.deviceChangeManage(this._cameraList,e,P.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=e,[2]}}))}))})),e.getMicrophoneList().then((function(e){return h(t,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,e,P.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=e,[2]}}))}))})),e.getSpeakerList().then((function(e){return h(t,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,e,P.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=e,[2]}}))}))})),[2]}))}))},v.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)},v.prototype.deviceChangeManage=function(e,t,i){return h(this,void 0,void 0,(function(){var o,r,n,s,a;return d(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 I,e.length>t.length?(n=e.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=A.TRTCDeviceStateRemove):(r=(e||[]).map((function(e){return e.deviceId})),n=t.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=A.TRTCDeviceStateAdd),s=n.deviceId,this.emitOnDeviceChange(s,i,o)),a=this.getDefaultDeviceInfo(t),i!==P.TRTCDeviceTypeCamera||o!==A.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!==P.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!==P.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]}}))}))},v.prototype.getDefaultDeviceInfo=function(e){var t=new I;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]},v.prototype.autoChangeDevice=function(t,i){return h(this,void 0,void 0,(function(){var o,r,n;return d(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==P.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,A.TRTCDeviceStateActive),s.label=6;case 6:return t!==P.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,A.TRTCDeviceStateActive),s.label=12;case 12:return t!==P.TRTCDeviceTypeSpeaker?[3,14]:[4,e.setCurrentSpeaker(o)];case 13:s.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,A.TRTCDeviceStateActive),s.label=14;case 14:return[2]}}))}))},v.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},v.prototype.getMediaMixingManager=function(){return new os({logger:this.logger,trtc:this._trtc,trtcCloud:this})},v.prototype.getWhiteboardManager=function(){return new gs({trtc:this._trtc})},v.prototype.getAITranscriberManager=function(){return new bs({logger:this.logger,trtc:this._trtc})},v.shareInstance=null,v.subCloudMap=new Map,v.enableSEI=!1,v.assetsPath="",l([(g="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=Ts.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return a.push(e)})),null===(i=ys.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=_s.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(g)))})),Ts.delete(this),ys.delete(this),_s.delete(this),o.apply(this,n)},i})],v.prototype,"exitRoom",null),l([Rs((function(e){return e}))],v.prototype,"muteRemoteAudio",null),l([Rs((function(e){return e}))],v.prototype,"muteRemoteVideoStream",null),l([Rs((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})],v.prototype,"_switchPlaybackQuality",null),v}(M);export{ws as AITranscriberListener,re as AudioMuteType,Es as IAITranscriberManager,Nn as ITRTCMediaMixingEvent,Bn as ITRTCMediaMixingManager,hs as ITRTCWhiteboardManager,zn as InteractionOption,X as Rect,C as TRTCAppScene,w as TRTCAudioQuality,E as TRTCAudioSceneEx,b as TRTCBeautyStyle,ee as TRTCCameraCaptureMode,ne as TRTCCameraCaptureParams,I as TRTCDeviceInfo,A as TRTCDeviceState,P as TRTCDeviceType,Y as TRTCImageBuffer,H as TRTCLocalStatistics,U as TRTCLogLevel,kn as TRTCMediaMixingEncParam,gn as TRTCMediaMixingErrorCode,Tn as TRTCMediaMixingEvent,Dn as TRTCMediaSource,mn as TRTCMediaSourceType,Z as TRTCMixInputType,te as TRTCMixUser,G as TRTCNetworkQosParam,L as TRTCParams,W as TRTCPublishCDNParam,B as TRTCQosControlMode,O as TRTCQuality,N as TRTCQualityInfo,Q as TRTCRemoteStatistics,k as TRTCRenderParams,S as TRTCRoleType,oe as TRTCScreenCaptureProperty,J as TRTCScreenCaptureSourceInfo,q as TRTCScreenCaptureSourceType,j as TRTCStatistics,$ as TRTCTranscodingConfig,K as TRTCTranscodingConfigMode,x as TRTCVideoEncParam,_ as TRTCVideoFillMode,R as TRTCVideoMirrorType,z as TRTCVideoQosPreference,T as TRTCVideoResolution,D as TRTCVideoResolutionMode,V as TRTCVideoRotation,y as TRTCVideoStreamType,F as TRTCVolumeInfo,Zn as TRTCWhiteboardEvent,Ss as TranscriberMessage,Cs as TranscriberParams,ns as WhiteboardCanvasInfo,ls as WhiteboardHistoryStateChangedInfo,ss as WhiteboardRecvCommand,as as WhiteboardSendPayload,us as WhiteboardSessionResumedInfo,cs as WhiteboardSessionStalledInfo,rs as WhiteboardToolConfig,Os as default,Ms as loggerManager};export const __esModule=!0;