trtc-cloud-js-sdk 2.11.1 → 2.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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{BasicBeauty as o}from"trtc-sdk-v5/plugins/video-effect/basic-beauty";import{RealtimeTranscriber as r}from"trtc-sdk-v5/plugins/realtime-transcriber";import n from"trtc-sdk-v5/plugins/video-effect/video-mixer";var s=function(e,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},s(e,t)};var a=function(){return a=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function c(e,t,i,o){var r,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s}function u(e,t,i,o){return new(i||(i=Promise))((function(r,n){function s(e){try{c(o.next(e))}catch(t){n(t)}}function a(e){try{c(o.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function l(e,t){var i,o,r,n,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(a){return function(c){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;n&&(n=0,a[0]&&(s=0)),s;)try{if(i=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(c){a=[6,c],o=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function h(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],o=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t,i){if(i||2===arguments.length)for(var o,r=0,n=t.length;r<n;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function p(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=h(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=e[i]&&function(t){return new Promise((function(o,r){(function(e,t,i,o){Promise.resolve(o).then((function(t){e({value:t,done:i})}),t)})(o,r,(t=e[i](t)).done,t.value)}))}}}var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function v(e,t){return e(t={exports:{}},t.exports),t.exports}var g,m,T,y,_,R,b,C,S=v((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"}(g||(g={})),function(e){e[e.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",e[e.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",e[e.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub"}(m||(m={})),function(e){e[e.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",e[e.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit"}(T||(T={})),function(e){e[e.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",e[e.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",e[e.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable"}(y||(y={})),function(e){e[e.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",e[e.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature"}(_||(_={})),function(e){e[e.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",e[e.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",e[e.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",e[e.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom"}(R||(R={})),function(e){e[e.TRTCRoleAnchor=20]="TRTCRoleAnchor",e[e.TRTCRoleAudience=21]="TRTCRoleAudience"}(b||(b={})),function(e){e[e.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",e[e.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",e[e.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic"}(C||(C={}));var w,M,E=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"}(w||(w={})),function(e){e[e.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",e[e.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",e[e.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",e[e.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera"}(M||(M={}));var A,P=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=b.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=g.TRTCVideoResolution_640_360),void 0===t&&(t=x.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"}(A||(A={}));var V,I=function(e,t,i){void 0===e&&(e=A.TRTCVideoRotation0),void 0===t&&(t=T.TRTCVideoFillMode_Fit),void 0===i&&(i=y.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"}(V||(V={}));var x,O,k,D=function(e,t){void 0===e&&(e=""),void 0===t&&(t=V.TRTCQuality_Unknown),this.userId=e,this.quality=t},z=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},B=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},N=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=m.TRTCVideoStreamTypeBig),this.width=e,this.height=t,this.frameRate=i,this.videoBitrate=o,this.audioBitrate=n,this.streamType=s},F=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=m.TRTCVideoStreamTypeBig),this.userId=e,this.width=i,this.height=o,this.frameRate=r,this.videoBitrate=n,this.audioBitrate=a,this.streamType=p},H=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"}(x||(x={})),function(e){e[e.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",e[e.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear"}(O||(O={})),function(e){e[e.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",e[e.TRTCQosControlModeServer=1]="TRTCQosControlModeServer"}(k||(k={}));var W,j,Q=function(e,t){void 0===e&&(e=O.TRTCVideoQosPreferenceClear),void 0===t&&(t=k.TRTCQosControlModeServer),this.preference=e,this.controlMode=t},U=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"}(W||(W={})),function(e){e[e.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",e[e.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",e[e.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",e[e.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom"}(j||(j={}));var q,G=function(e,t,i,o,r,n){void 0===e&&(e=j.TRTCScreenCaptureSourceTypeUnknown),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=new U),void 0===r&&(r=new U),void 0===n&&(n=!1),this.type=e,this.sourceId=t,this.sourceName=i,this.thumbBGRA=o,this.iconBGRA=r,this.isMinimizeWindow=n},Y=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},K=function(e,t,i,o,r,n,s,a,c,u,l,h,d,p,f){void 0===e&&(e=q.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"}(q||(q={}));var J,X,$=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=m.TRTCVideoStreamTypeBig),void 0===s&&(s=J.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"}(J||(J={})),function(e){e[e.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",e[e.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",e[e.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",e[e.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual"}(X||(X={}));var Z,ee=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},te=void 0,ie=void 0,oe="onError",re="onWarning",ne="rtc",se="live",ae="VirtualBackground",ce="BasicBeauty",ue="blur",le="image",he={20:"anchor",21:"audience"},de={0:ne,1:se,2:ne,3:se};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(Z||(Z={}));var pe="enum";function fe(){return Math.floor(performance.now())}var ve=function(e){return void 0===e},ge=function(e){return"number"==typeof e},me=function(e){return"boolean"==typeof e};function Te(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 ye(e){return null==e}function _e(){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]=_e(e[i],t[i]):e[i]=t[i]})),e}),{})}function Re(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]=Re(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=Re(e[i]))}))):t=e,t)}var be,Ce,Se=function(e){return e&&e.Math===Math&&e},we=Se("object"==typeof globalThis&&globalThis)||Se("object"==typeof window&&window)||Se("object"==typeof self&&self)||Se("object"==typeof f&&f)||function(){return this}()||f||Function("return this")(),Me=function(e){try{return!!e()}catch(t){return!0}},Ee=!Me((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Ae=!Me((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Pe=Function.prototype.call,Le=Ae?Pe.bind(Pe):function(){return Pe.apply(Pe,arguments)},Ve={}.propertyIsEnumerable,Ie=Object.getOwnPropertyDescriptor,xe={f:Ie&&!Ve.call({1:2},1)?function(e){var t=Ie(this,e);return!!t&&t.enumerable}:Ve},Oe=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ke=Function.prototype,De=ke.call,ze=Ae&&ke.bind.bind(De,De),Be=Ae?ze:function(e){return function(){return De.apply(e,arguments)}},Ne=Be({}.toString),Fe=Be("".slice),He=function(e){return Fe(Ne(e),8,-1)},We=Object,je=Be("".split),Qe=Me((function(){return!We("z").propertyIsEnumerable(0)}))?function(e){return"String"===He(e)?je(e,""):We(e)}:We,Ue=function(e){return null==e},qe=TypeError,Ge=function(e){if(Ue(e))throw qe("Can't call method on "+e);return e},Ye=function(e){return Qe(Ge(e))},Ke="object"==typeof document&&document.all,Je={all:Ke,IS_HTMLDDA:void 0===Ke&&void 0!==Ke},Xe=Je.all,$e=Je.IS_HTMLDDA?function(e){return"function"==typeof e||e===Xe}:function(e){return"function"==typeof e},Ze=Je.all,et=Je.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:$e(e)||e===Ze}:function(e){return"object"==typeof e?null!==e:$e(e)},tt=function(e,t){return arguments.length<2?(i=we[e],$e(i)?i:void 0):we[e]&&we[e][t];var i},it=Be({}.isPrototypeOf),ot="undefined"!=typeof navigator&&String(navigator.userAgent)||"",rt=we.process,nt=we.Deno,st=rt&&rt.versions||nt&&nt.version,at=st&&st.v8;at&&(Ce=(be=at.split("."))[0]>0&&be[0]<4?1:+(be[0]+be[1])),!Ce&&ot&&(!(be=ot.match(/Edge\/(\d+)/))||be[1]>=74)&&(be=ot.match(/Chrome\/(\d+)/))&&(Ce=+be[1]);var ct=Ce,ut=we.String,lt=!!Object.getOwnPropertySymbols&&!Me((function(){var e=Symbol("symbol detection");return!ut(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ct&&ct<41})),ht=lt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,dt=Object,pt=ht?function(e){return"symbol"==typeof e}:function(e){var t=tt("Symbol");return $e(t)&&it(t.prototype,dt(e))},ft=String,vt=TypeError,gt=function(e){if($e(e))return e;throw vt(function(e){try{return ft(e)}catch(t){return"Object"}}(e)+" is not a function")},mt=function(e,t){var i=e[t];return Ue(i)?void 0:gt(i)},Tt=TypeError,yt=Object.defineProperty,_t=function(e,t){try{yt(we,e,{value:t,configurable:!0,writable:!0})}catch(i){we[e]=t}return t},Rt="__core-js_shared__",bt=we[Rt]||_t(Rt,{}),Ct=v((function(e){(e.exports=function(e,t){return bt[e]||(bt[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"})})),St=Object,wt=function(e){return St(Ge(e))},Mt=Be({}.hasOwnProperty),Et=Object.hasOwn||function(e,t){return Mt(wt(e),t)},At=0,Pt=Math.random(),Lt=Be(1..toString),Vt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Lt(++At+Pt,36)},It=we.Symbol,xt=Ct("wks"),Ot=ht?It.for||It:It&&It.withoutSetter||Vt,kt=function(e){return Et(xt,e)||(xt[e]=lt&&Et(It,e)?It[e]:Ot("Symbol."+e)),xt[e]},Dt=TypeError,zt=kt("toPrimitive"),Bt=function(e,t){if(!et(e)||pt(e))return e;var i,o=mt(e,zt);if(o){if(void 0===t&&(t="default"),i=Le(o,e,t),!et(i)||pt(i))return i;throw Dt("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&$e(i=e.toString)&&!et(o=Le(i,e)))return o;if($e(i=e.valueOf)&&!et(o=Le(i,e)))return o;if("string"!==t&&$e(i=e.toString)&&!et(o=Le(i,e)))return o;throw Tt("Can't convert object to primitive value")}(e,t)},Nt=function(e){var t=Bt(e,"string");return pt(t)?t:t+""},Ft=we.document,Ht=et(Ft)&&et(Ft.createElement),Wt=function(e){return Ht?Ft.createElement(e):{}},jt=!Ee&&!Me((function(){return 7!==Object.defineProperty(Wt("div"),"a",{get:function(){return 7}}).a})),Qt=Object.getOwnPropertyDescriptor,Ut={f:Ee?Qt:function(e,t){if(e=Ye(e),t=Nt(t),jt)try{return Qt(e,t)}catch(i){}if(Et(e,t))return Oe(!Le(xe.f,e,t),e[t])}},qt=Ee&&Me((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Gt=String,Yt=TypeError,Kt=function(e){if(et(e))return e;throw Yt(Gt(e)+" is not an object")},Jt=TypeError,Xt=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Zt="enumerable",ei="configurable",ti="writable",ii={f:Ee?qt?function(e,t,i){if(Kt(e),t=Nt(t),Kt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&ti in i&&!i[ti]){var o=$t(e,t);o&&o[ti]&&(e[t]=i.value,i={configurable:ei in i?i[ei]:o[ei],enumerable:Zt in i?i[Zt]:o[Zt],writable:!1})}return Xt(e,t,i)}:Xt:function(e,t,i){if(Kt(e),t=Nt(t),Kt(i),jt)try{return Xt(e,t,i)}catch(o){}if("get"in i||"set"in i)throw Jt("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},oi=Ee?function(e,t,i){return ii.f(e,t,Oe(1,i))}:function(e,t,i){return e[t]=i,e},ri=Function.prototype,ni=Ee&&Object.getOwnPropertyDescriptor,si=Et(ri,"name"),ai={EXISTS:si,PROPER:si&&"something"===function(){}.name,CONFIGURABLE:si&&(!Ee||Ee&&ni(ri,"name").configurable)},ci=Be(Function.toString);$e(bt.inspectSource)||(bt.inspectSource=function(e){return ci(e)});var ui,li,hi,di=bt.inspectSource,pi=we.WeakMap,fi=$e(pi)&&/native code/.test(String(pi)),vi=Ct("keys"),gi=function(e){return vi[e]||(vi[e]=Vt(e))},mi={},Ti="Object already initialized",yi=we.TypeError,_i=we.WeakMap;if(fi||bt.state){var Ri=bt.state||(bt.state=new _i);Ri.get=Ri.get,Ri.has=Ri.has,Ri.set=Ri.set,ui=function(e,t){if(Ri.has(e))throw yi(Ti);return t.facade=e,Ri.set(e,t),t},li=function(e){return Ri.get(e)||{}},hi=function(e){return Ri.has(e)}}else{var bi=gi("state");mi[bi]=!0,ui=function(e,t){if(Et(e,bi))throw yi(Ti);return t.facade=e,oi(e,bi,t),t},li=function(e){return Et(e,bi)?e[bi]:{}},hi=function(e){return Et(e,bi)}}var Ci={set:ui,get:li,has:hi,enforce:function(e){return hi(e)?li(e):ui(e,{})},getterFor:function(e){return function(t){var i;if(!et(t)||(i=li(t)).type!==e)throw yi("Incompatible receiver, "+e+" required");return i}}},Si=v((function(e){var t=ai.CONFIGURABLE,i=Ci.enforce,o=Ci.get,r=String,n=Object.defineProperty,s=Be("".slice),a=Be("".replace),c=Be([].join),u=Ee&&!Me((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),(!Et(e,"name")||t&&e.name!==o)&&(Ee?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&h&&Et(h,"arity")&&e.length!==h.arity&&n(e,"length",{value:h.arity});try{h&&Et(h,"constructor")&&h.constructor?Ee&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var d=i(e);return Et(d,"source")||(d.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=h((function(){return $e(this)&&o(this).source||di(this)}),"toString")})),wi=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if($e(i)&&Si(i,n,o),o.global)r?e[t]=i:_t(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:ii.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Mi=Math.ceil,Ei=Math.floor,Ai=Math.trunc||function(e){var t=+e;return(t>0?Ei:Mi)(t)},Pi=function(e){var t=+e;return t!=t||0===t?0:Ai(t)},Li=Math.max,Vi=Math.min,Ii=Math.min,xi=function(e){return e>0?Ii(Pi(e),9007199254740991):0},Oi=function(e){return xi(e.length)},ki=function(e){return function(t,i,o){var r,n=Ye(t),s=Oi(n),a=function(e,t){var i=Pi(e);return i<0?Li(i+t,0):Vi(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}},Di={includes:ki(!0),indexOf:ki(!1)}.indexOf,zi=Be([].push),Bi=function(e,t){var i,o=Ye(e),r=0,n=[];for(i in o)!Et(mi,i)&&Et(o,i)&&zi(n,i);for(;t.length>r;)Et(o,i=t[r++])&&(~Di(n,i)||zi(n,i));return n},Ni=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Fi=Ni.concat("length","prototype"),Hi={f:Object.getOwnPropertyNames||function(e){return Bi(e,Fi)}},Wi={f:Object.getOwnPropertySymbols},ji=Be([].concat),Qi=tt("Reflect","ownKeys")||function(e){var t=Hi.f(Kt(e)),i=Wi.f;return i?ji(t,i(e)):t},Ui=function(e,t,i){for(var o=Qi(t),r=ii.f,n=Ut.f,s=0;s<o.length;s++){var a=o[s];Et(e,a)||i&&Et(i,a)||r(e,a,n(t,a))}},qi=/#|\.prototype\./,Gi=function(e,t){var i=Ki[Yi(e)];return i===Xi||i!==Ji&&($e(t)?Me(t):!!t)},Yi=Gi.normalize=function(e){return String(e).replace(qi,".").toLowerCase()},Ki=Gi.data={},Ji=Gi.NATIVE="N",Xi=Gi.POLYFILL="P",$i=Gi,Zi=Ut.f,eo=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?we:u?we[a]||_t(a,{}):(we[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=Zi(i,o))&&s.value:i[o],!$i(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Ui(n,r)}(e.sham||r&&r.sham)&&oi(n,"sham",!0),wi(i,o,n,e)}},to={};to[kt("toStringTag")]="z";var io,oo="[object z]"===String(to),ro=kt("toStringTag"),no=Object,so="Arguments"===He(function(){return arguments}()),ao=oo?He: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=no(e),ro))?i:so?He(t):"Object"===(o=He(t))&&$e(t.callee)?"Arguments":o},co=String,uo=function(e){if("Symbol"===ao(e))throw TypeError("Cannot convert a Symbol value to a string");return co(e)},lo=function(){var e=Kt(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},ho=we.RegExp,po=Me((function(){var e=ho("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),fo=po||Me((function(){return!ho("a","y").sticky})),vo={BROKEN_CARET:po||Me((function(){var e=ho("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:fo,UNSUPPORTED_Y:po},go=Object.keys||function(e){return Bi(e,Ni)},mo=Ee&&!qt?Object.defineProperties:function(e,t){Kt(e);for(var i,o=Ye(t),r=go(t),n=r.length,s=0;n>s;)ii.f(e,i=r[s++],o[i]);return e},To={f:mo},yo=tt("document","documentElement"),_o="prototype",Ro="script",bo=gi("IE_PROTO"),Co=function(){},So=function(e){return"<"+Ro+">"+e+"</"+Ro+">"},wo=function(e){e.write(So("")),e.close();var t=e.parentWindow.Object;return e=null,t},Mo=function(){try{io=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Mo="undefined"!=typeof document?document.domain&&io?wo(io):(t=Wt("iframe"),i="java"+Ro+":",t.style.display="none",yo.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(So("document.F=Object")),e.close(),e.F):wo(io);for(var o=Ni.length;o--;)delete Mo[_o][Ni[o]];return Mo()};mi[bo]=!0;var Eo,Ao,Po=Object.create||function(e,t){var i;return null!==e?(Co[_o]=Kt(e),i=new Co,Co[_o]=null,i[bo]=e):i=Mo(),void 0===t?i:To.f(i,t)},Lo=we.RegExp,Vo=Me((function(){var e=Lo(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Io=we.RegExp,xo=Me((function(){var e=Io("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Oo=Ci.get,ko=Ct("native-string-replace",String.prototype.replace),Do=RegExp.prototype.exec,zo=Do,Bo=Be("".charAt),No=Be("".indexOf),Fo=Be("".replace),Ho=Be("".slice),Wo=(Ao=/b*/g,Le(Do,Eo=/a/,"a"),Le(Do,Ao,"a"),0!==Eo.lastIndex||0!==Ao.lastIndex),jo=vo.BROKEN_CARET,Qo=void 0!==/()??/.exec("")[1];(Wo||Qo||jo||Vo||xo)&&(zo=function(e){var t,i,o,r,n,s,a,c=this,u=Oo(c),l=uo(e),h=u.raw;if(h)return h.lastIndex=c.lastIndex,t=Le(zo,h,l),c.lastIndex=h.lastIndex,t;var d=u.groups,p=jo&&c.sticky,f=Le(lo,c),v=c.source,g=0,m=l;if(p&&(f=Fo(f,"y",""),-1===No(f,"g")&&(f+="g"),m=Ho(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Bo(l,c.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,g++),i=new RegExp("^(?:"+v+")",f)),Qo&&(i=new RegExp("^"+v+"$(?!\\s)",f)),Wo&&(o=c.lastIndex),r=Le(Do,p?i:c,m),p?r?(r.input=Ho(r.input,g),r[0]=Ho(r[0],g),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Wo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),Qo&&r&&r.length>1&&Le(ko,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=Po(null),n=0;n<d.length;n++)s[(a=d[n])[0]]=r[a[1]];return r});var Uo=zo;eo({target:"RegExp",proto:!0,forced:/./.exec!==Uo},{exec:Uo});var qo="\t\n\v\f\r                 \u2028\u2029\ufeff",Go=Be("".replace),Yo=RegExp("^["+qo+"]+"),Ko=RegExp("(^|[^"+qo+"])["+qo+"]+$"),Jo=function(e){return function(t){var i=uo(Ge(t));return 1&e&&(i=Go(i,Yo,"")),2&e&&(i=Go(i,Ko,"$1")),i}},Xo={start:Jo(1),end:Jo(2),trim:Jo(3)}.trim,$o=Be("".charAt),Zo=we.parseFloat,er=we.Symbol,tr=er&&er.iterator,ir=1/Zo(qo+"-0")!=-Infinity||tr&&!Me((function(){Zo(Object(tr))}))?function(e){var t=Xo(uo(e)),i=Zo(t);return 0===i&&"-"===$o(t,0)?-0:i}:Zo;eo({global:!0,forced:parseFloat!==ir},{parseFloat:ir});var or=function(e){if("Function"===He(e))return Be(e)},rr=kt("species"),nr=RegExp.prototype,sr=Be("".charAt),ar=Be("".charCodeAt),cr=Be("".slice),ur=function(e){return function(t,i){var o,r,n=uo(Ge(t)),s=Pi(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=ar(n,s))<55296||o>56319||s+1===a||(r=ar(n,s+1))<56320||r>57343?e?sr(n,s):o:e?cr(n,s,s+2):r-56320+(o-55296<<10)+65536}},lr={codeAt:ur(!1),charAt:ur(!0)}.charAt,hr=function(e,t,i){return t+(i?lr(e,t).length:1)},dr=TypeError,pr=function(e,t){var i=e.exec;if($e(i)){var o=Le(i,e,t);return null!==o&&Kt(o),o}if("RegExp"===He(e))return Le(Uo,e,t);throw dr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=kt(e),n=!Me((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Me((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[rr]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=or(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=or(e),c=t.exec;return c===Uo||c===nr.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));wi(String.prototype,e,c[0]),wi(nr,r,c[1])}o&&oi(nr[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Ge(this),o=Ue(t)?void 0:mt(t,e);return o?Le(o,t,i):new RegExp(t)[e](uo(i))},function(e){var o=Kt(this),r=uo(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return pr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=pr(o,r));){var l=uo(a[0]);c[u]=l,""===l&&(o.lastIndex=hr(r,xi(o.lastIndex),s)),u++}return 0===u?null:c}]}));var fr=Array.isArray||function(e){return"Array"===He(e)},vr=TypeError,gr=function(e){if(e>9007199254740991)throw vr("Maximum allowed index exceeded");return e},mr=function(e,t,i){var o=Nt(t);o in e?ii.f(e,o,Oe(0,i)):e[o]=i},Tr=function(){},yr=[],_r=tt("Reflect","construct"),Rr=/^\s*(?:class|function)\b/,br=Be(Rr.exec),Cr=!Rr.exec(Tr),Sr=function(e){if(!$e(e))return!1;try{return _r(Tr,yr,e),!0}catch(t){return!1}},wr=function(e){if(!$e(e))return!1;switch(ao(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Cr||!!br(Rr,di(e))}catch(t){return!0}};wr.sham=!0;var Mr,Er=!_r||Me((function(){var e;return Sr(Sr.call)||!Sr(Object)||!Sr((function(){e=!0}))||e}))?wr:Sr,Ar=kt("species"),Pr=Array,Lr=function(e,t){return new(function(e){var t;return fr(e)&&(t=e.constructor,(Er(t)&&(t===Pr||fr(t.prototype))||et(t)&&null===(t=t[Ar]))&&(t=void 0)),void 0===t?Pr:t}(e))(0===t?0:t)},Vr=kt("species"),Ir=kt("isConcatSpreadable"),xr=ct>=51||!Me((function(){var e=[];return e[Ir]=!1,e.concat()[0]!==e})),Or=function(e){if(!et(e))return!1;var t=e[Ir];return void 0!==t?!!t:fr(e)};eo({target:"Array",proto:!0,arity:1,forced:!(xr&&(Mr="concat",ct>=51||!Me((function(){var e=[];return(e.constructor={})[Vr]=function(){return{foo:1}},1!==e[Mr](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=wt(this),a=Lr(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Or(n=-1===t?s:arguments[t]))for(r=Oi(n),gr(c+r),i=0;i<r;i++,c++)i in n&&mr(a,c,n[i]);else gr(c+1),mr(a,c++,n);return a.length=c,a}});var kr=window.navigator&&window.navigator.userAgent||"",Dr=/AppleWebKit\/([\d.]+)/i.exec(kr);Dr&&parseFloat(Dr.pop());var zr=/iPad/i.test(kr),Br=/iPhone/i.test(kr)&&!zr,Nr=/iPod/i.test(kr),Fr=Br||zr||Nr,Hr=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(kr);Fr&&function(){var e=kr.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var Wr=/Android/i.test(kr);Wr&&function(){var e=kr.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]))}();Wr&&/webkit/i.test(kr),/Firefox/i.test(kr)&&function(){var e=kr.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var jr=/Edge\//i.test(kr);jr&&function(){var e=kr.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var Qr=/Edg\//i.test(kr);Qr&&function(){var e=kr.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Ur=/SogouMobileBrowser\//i.test(kr);Ur&&function(){var e=kr.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var qr=/MetaSr\s/i.test(kr);qr&&function(){var e=kr.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Gr=/TBS\/\d+/i.test(kr);Gr&&function(){var e=kr.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Yr=/XWEB\/\d+/i.test(kr);Yr&&function(){var e=kr.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(kr),/MSIE\/\d+/i.test(kr)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(kr),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(kr)&&/rv:11.0/.test(kr)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(kr)&&function(){var e=kr.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var Kr=!Gr&&/MQQBrowser\/\d+/i.test(kr)&&/COVC\/\d+/i.test(kr),Jr=!Gr&&/MQQBrowser\/\d+/i.test(kr)&&!/COVC\/\d+/i.test(kr);(Jr||Kr)&&function(){var e=kr.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Xr=!Gr&&/ QQBrowser\/\d+/i.test(kr);Xr&&function(){var e=kr.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var $r=!Gr&&/QQBrowserLite\/\d+/i.test(kr);$r&&function(){var e=kr.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var Zr=!Gr&&/MQBHD\/\d+/i.test(kr);Zr&&function(){var e=kr.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(kr),!Fr&&/MAC OS X/i.test(kr),!Wr&&/Linux/i.test(kr),/MicroMessenger/i.test(kr),/UCBrowser/i.test(kr),/Electron/i.test(kr);var en=/MiuiBrowser/i.test(kr);en&&function(){var e=kr.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var tn=/HuaweiBrowser/i.test(kr);/Huawei/i.test(kr),tn&&function(){var e=kr.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var on=/SamsungBrowser/i.test(kr);on&&function(){var e=kr.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var rn=/HeyTapBrowser/i.test(kr);rn&&function(){var e=kr.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var nn=/VivoBrowser/i.test(kr);nn&&function(){var e=kr.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var sn,an,cn,un=/Chrome/i.test(kr),ln=!jr&&!qr&&!Ur&&!Gr&&!Yr&&!Qr&&!Xr&&!en&&!tn&&!on&&!rn&&!nn&&/Chrome/i.test(kr);ln&&function(){var e=kr.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),ln&&function(){var e=kr.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!un&&!Jr&&!Kr&&!$r&&!Zr&&/Safari/i.test(kr)&&function(){var e=kr.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"}(sn||(sn={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(an||(an={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(cn||(cn={}));var hn,dn,pn,fn=-3340,vn=-1301,gn=-1314,mn=-1315,Tn=-1316,yn=-1302,_n=-1317,Rn=-1318,bn=-1319,Cn=-70252,Sn={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},wn={code:-1005,message:"not supported"},Mn="2.11.1";!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"}(hn||(hn={})),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"}(dn||(dn={})),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"}(pn||(pn={}));var En,An=void 0,Pn=void 0,Ln=void 0,Vn=void 0,In=void 0,xn=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}(),On=new xn(null),kn=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"):On.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 On.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)):On.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 On.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){On.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",On.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"}(En||(En={}));var Dn="trtc-resizable-top-left-anchor",zn="trtc-resizable-top-anchor",Bn="trtc-resizable-top-right-anchor",Nn="trtc-resizable-left-anchor",Fn="trtc-resizable-right-anchor",Hn="trtc-resizable-bottom-left-anchor",Wn="trtc-resizable-bottom-anchor",jn="trtc-resizable-bottom-right-anchor",Qn={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 Un(e,t){for(var i in t)e.style[i]=t[i]}var qn=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:En.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:En.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||En.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(Dn),Un(c,Object.assign({},Qn.resizeAnchor,Qn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(zn),Un(u,Object.assign({},Qn.resizeAnchor,Qn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(Bn),Un(l,Object.assign({},Qn.resizeAnchor,Qn.topRightAnchor)),this.topRightAnchor=l;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(Nn),Un(h,Object.assign({},Qn.resizeAnchor,Qn.leftAnchor)),this.leftAnchor=h;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(Fn),Un(d,Object.assign({},Qn.resizeAnchor,Qn.rightAnchor)),this.rightAnchor=d;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(Hn),Un(p,Object.assign({},Qn.resizeAnchor,Qn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(Wn),Un(f,Object.assign({},Qn.resizeAnchor,Qn.bottomAnchor)),this.bottomAnchor=f;var v=document.createElement("div");v.className="trtc-resizable-resize-anchor ".concat(jn),Un(v,Object.assign({},Qn.resizeAnchor,Qn.bottomRightAnchor)),this.bottomRightAnchor=v,this.options.anchorMode!==En.Both&&this.options.anchorMode!==En.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!==En.Both&&this.options.anchorMode!==En.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,On.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else On.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 Dn: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 zn: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 Bn: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 Nn: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 Fn: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 Hn: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 Wn: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 On.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 On.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 On.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!==En.Both&&this.options.anchorMode!==En.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!==En.Both&&this.options.anchorMode!==En.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}(),Gn=function(){var e=new Map;for(var t in g)if(isNaN(Number(t))){var i=g[t],o=t.split("_");e.set(i,{width:parseInt(o[1]),height:parseInt(o[2])})}return e}(),Yn=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,Gn.has(e.videoResolution)){var t=Gn.get(e.videoResolution),i=t.width,o=t.height;this.resMode===x.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=i,this.mixingVideoHeight=o):(this.mixingVideoWidth=o,this.mixingVideoHeight=i)}this.updatePreviewProperty(),this.canExceedContainer=e.canExceedContainer||!1,this.eventEmitter=new S,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(!ye(e.videoResolution)||!ye(e.resMode)){if(this.resMode=ye(e.resMode)?this.resMode:e.resMode,e.videoResolution&&Gn.has(e.videoResolution)){var t=Gn.get(e.videoResolution),i=t.width,o=t.height;this.resMode===x.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 kn(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 qn(this.moveAndResizeOverlay,this.container,{keepRatio:!0,stopPropagation:!0,canExceedContainer:this.canExceedContainer,anchorMode:0}),this.resizableHandler.on("resize",this.onResize)},e.prototype.updateCanExceedContainer=function(e){this.movableHandler&&(this.movableHandler.options.canExceedContainer=e),this.resizableHandler&&(this.resizableHandler.options.canExceedContainer=e)},e.prototype.initContainerMouseEventHander=function(){this.container?(this.onContainerMousedown=this.onContainerMousedown.bind(this),this.onContainerMousemove=this.onContainerMousemove.bind(this),this.onContainerMouseup=this.onContainerMouseup.bind(this),document.addEventListener("mousedown",this.onContainerMousedown,!1),this.onRightButtonClicked=this.onRightButtonClicked.bind(this),this.container.addEventListener("contextmenu",this.onRightButtonClicked,!1)):this.logger.error("".concat(this.logPrefix,"initContainerMouseEventHander failed, no container view"))},e.prototype.initContainerResizeObserver=function(){this.container&&(this.onPreviewAreaResize=this.onPreviewAreaResize.bind(this),this.resizeObserver=new ResizeObserver(this.onPreviewAreaResize),this.resizeObserver.observe(this.container))},e.prototype.onPreviewAreaResize=function(e){for(var t=0,i=e;t<i.length;t++){if(i[t].target===this.container){this.updatePreviewProperty(),this.updateOverlay();break}}},e.prototype.updatePreviewProperty=function(){if(this.container){var e=this.container.offsetWidth,t=this.container.offsetHeight,i=e/this.mixingVideoWidth,o=t/this.mixingVideoHeight;this.previewScale=i>o?i:o,this.previewWidth=this.mixingVideoWidth*this.previewScale,this.previewHeight=this.mixingVideoHeight*this.previewScale,this.previewLeft=(e-this.previewWidth)/2,this.previewTop=(t-this.previewHeight)/2}else console.debug("".concat(this.logPrefix,"calcPreviewScale failed, no HTML element to display"))},e.prototype.updateOverlay=function(){if(this.moveAndResizeOverlay){var e=void 0,t=void 0,i=void 0,o=void 0;if(this.selectedMediaIndex>=0){var r=this.mediaList[this.selectedMediaIndex],n={left:r.rect.left*this.previewScale,top:r.rect.top*this.previewScale,right:r.rect.right*this.previewScale,bottom:r.rect.bottom*this.previewScale};e="".concat(n.left+this.previewLeft,"px"),t="".concat(n.top+this.previewTop,"px"),i="".concat(n.right-n.left,"px"),o="".concat(n.bottom-n.top,"px");var s=r.interaction||{},a=!1!==s.showBorder,c=!1!==s.showResizeAnchors,u=!1!==s.draggable,l=!1!==s.canExceedCanvas;this.logger.debug("".concat(this.logPrefix,"updateOverlay: interaction config -"),{showBorder:a,showResizeAnchors:c,draggable:u,canExceedCanvas:l}),this.updateCanExceedContainer(l),this.moveAndResizeOverlay.style.display="block",this.moveAndResizeOverlay.style.border=a?"1px solid #3D7EFD":"none",this.resizableHandler&&this.resizableHandler.setVisible(c),this.movableHandler&&(this.logger.debug("".concat(this.logPrefix,"updateOverlay: setting movableHandler.setEnabled(").concat(u,")")),this.movableHandler.setEnabled(u))}else e="".concat(this.previewLeft,"px"),t="".concat(this.previewTop,"px"),i="0px",o="0px",this.moveAndResizeOverlay.style.display="none";this.moveAndResizeOverlay.style.left=e,this.moveAndResizeOverlay.style.top=t,this.moveAndResizeOverlay.style.width=i,this.moveAndResizeOverlay.style.height=o}},e.prototype.onMove=function(e,t){var i;console.debug("".concat(this.logPrefix,"onMove: ").concat(e," ").concat(t));var o=this.mediaList[this.selectedMediaIndex];if(o&&this.moveAndResizeOverlay){var r={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+this.moveAndResizeOverlay.offsetWidth,bottom:t-this.previewTop+this.moveAndResizeOverlay.offsetHeight};this.doAdsorption(r);var n={left:Math.round(r.left/this.previewScale),top:Math.round(r.top/this.previewScale),right:Math.round(r.right/this.previewScale),bottom:Math.round(r.bottom/this.previewScale)};null===(i=this.eventEmitter)||void 0===i||i.emit("onSourceMoved",a({},o),n)}else console.debug("".concat(this.logPrefix,"onMove no selected media"))},e.prototype.doAdsorption=function(e){var t=this.BOUNDARY_ADSORPTION_THRESHOLD;Math.abs(e.left)<t&&(e.right=e.right-e.left,e.left=0),Math.abs(e.top)<t&&(e.bottom=e.bottom-e.top,e.top=0),Math.abs(e.right-this.previewWidth)<t&&(e.left=e.left+this.previewWidth-e.right,e.right=this.previewWidth),Math.abs(e.bottom-this.previewHeight)<t&&(e.top=e.top+this.previewHeight-e.bottom,e.bottom=this.previewHeight)},e.prototype.onResize=function(e,t,i,o){var r;console.debug("".concat(this.logPrefix,"onResize: ").concat(e," ").concat(t," ").concat(i," ").concat(o));var n=this.mediaList[this.selectedMediaIndex];if(n){var s=n.interaction||{};if(!ve(s.showResizeAnchors)&&!s.showResizeAnchors)return;var c={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+i,bottom:t-this.previewTop+o},u={left:Math.round(c.left/this.previewScale),top:Math.round(c.top/this.previewScale),right:Math.round(c.right/this.previewScale),bottom:Math.round(c.bottom/this.previewScale)};null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",a({},n),u)}else console.debug("".concat(this.logPrefix,"onResize no selected media"))},e.prototype.getMaxZOrderMedia=function(e){var t,i,o,r,n,s;if(0===e.length)return null;for(var a=e[0],c=null!==(o=null===(i=null===(t=a.origin)||void 0===t?void 0:t.layout)||void 0===i?void 0:i.zOrder)&&void 0!==o?o:-Infinity,u=1;u<e.length;u++){var l=null!==(s=null===(n=null===(r=e[u].origin)||void 0===r?void 0:r.layout)||void 0===n?void 0:n.zOrder)&&void 0!==s?s:-Infinity;l>c&&(c=l,a=e[u])}return a},e.prototype.emitOnSelect=function(e){var t;if(e){for(var i=this.mediaList.length,o=0;o<i;o++)if(e.id===this.mediaList[o].id){this.selectedMediaIndex=o;break}}else this.selectedMediaIndex=-1;this.updateOverlay(),null===(t=this.eventEmitter)||void 0===t||t.emit("onSourceSelected",e?a({},e):null)},e.prototype.onContainerMousedown=function(e){var t;console.debug("".concat(this.logPrefix,"onContainerMousedown event:"),e,e.target,e.currentTarget);var i=e.target;if(this.eventButton=e.button,i&&this.container){if(this.container.contains(i)){console.debug("".concat(this.logPrefix,"onContainerMousedown mix video image clicked"));var o=this.container.getBoundingClientRect(),r=e.clientX-o.x-this.previewLeft,n=e.clientY-o.y-this.previewTop,s=r/this.previewScale,a=n/this.previewScale;console.debug("".concat(this.logPrefix,"onContainerMousedown click point coordinates in mix video:"),r,n,s,a);for(var c=0;c<this.mediaList.length;c++){var u=this.mediaList[c];u.rect&&s>=u.rect.left&&s<=u.rect.right&&a>=u.rect.top&&a<=u.rect.bottom&&!1!==(null===(t=u.interaction)||void 0===t?void 0:t.selectable)&&(this.clickedMediaSources.push(u),this.mediaList[this.selectedMediaIndex]&&u.id===this.mediaList[this.selectedMediaIndex].id&&(this.oldSelectedIndex=this.clickedMediaSources.length-1))}this.mousedownLeft=e.screenX,this.mousedownTop=e.screenY}this.clickedMediaSources.length>0?2===this.eventButton&&-1===this.oldSelectedIndex?(this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMousedown find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected),this.clickedMediaSources.splice(0,this.clickedMediaSources.length)):(document.addEventListener("mousemove",this.onContainerMousemove,!1),document.addEventListener("mouseup",this.onContainerMouseup,!1)):(this.newSelected=null,console.debug("".concat(this.logPrefix,"onContainerMousedown find clicked media source:"),this.newSelected),this.emitOnSelect(null),this.mousedownLeft=null,this.mousedownTop=null,this.eventButton=null)}},e.prototype.onContainerMousemove=function(e){var t;if(e.target&&this.container&&null!==this.mousedownLeft&&null!==this.mousedownTop){var i=e.screenX-this.mousedownLeft,o=e.screenY-this.mousedownTop;(Math.abs(i)>=5||Math.abs(o)>=5)&&(this.oldSelectedIndex>=0?(console.debug("".concat(this.logPrefix,"onContainerMousemove move or resize old selected media source, clear data:"),this.clickedMediaSources,this.oldSelectedIndex),this.clickedMediaSources.splice(0,this.clickedMediaSources.length),this.oldSelectedIndex=-1):this.clickedMediaSources.length>0&&(this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMousemove find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected),this.clickedMediaSources.splice(0,this.clickedMediaSources.length),null===(t=this.moveAndResizeOverlay)||void 0===t||t.dispatchEvent(new MouseEvent("mousedown",{screenX:this.mousedownLeft,screenY:this.mousedownTop,button:this.eventButton}))))}},e.prototype.onContainerMouseup=function(e){if(document.removeEventListener("mousemove",this.onContainerMousemove,!1),document.removeEventListener("mouseup",this.onContainerMouseup,!1),console.debug("".concat(this.logPrefix,"onContainerMouseup data:"),this.clickedMediaSources,this.oldSelectedIndex),e.target&&this.container){if(this.clickedMediaSources.length>0)if(this.oldSelectedIndex>=0){if(0===this.eventButton){var t=(this.oldSelectedIndex+1)%this.clickedMediaSources.length;this.newSelected=this.clickedMediaSources[t],console.debug("".concat(this.logPrefix,"onContainerMouseup find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected)}}else this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMouseup find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected)}else console.debug("".concat(this.logPrefix,"onContainerMouseup click outside of mixing video image")),this.emitOnSelect(null);this.mousedownLeft=null,this.mousedownTop=null,this.clickedMediaSources.splice(0,this.clickedMediaSources.length),this.oldSelectedIndex=-1,this.newSelected=null,this.eventButton=null},e.prototype.onRightButtonClicked=function(e){var t;console.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e.target,e.currentTarget,e.buttons),e.preventDefault(),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",a({},this.mediaList[this.selectedMediaIndex]))},e}(),Kn=function(){function t(e){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new S,this.publishParams={videoEncoderParams:{videoResolution:g.TRTCVideoResolution_1280_720,resMode:x.TRTCVideoResolutionModeLandscape,videoFps:15,videoBitrate:1800},canvasColor:0},this.mediaMixingDesigner=null,this.sourceList=[],this.trtcSourceMap=new Map,this.mixVideoTrack=null,this.selectedSource=null,this.view=null,this.screensWithSystemAudio=new Set,t.mediaMixingManager)return t.mediaMixingManager;t.mediaMixingManager=this,this.logger=e.logger,this.trtc=e.trtc,this.trtcCloud=e.trtcCloud,this.onSourceSelected=this.onSourceSelected.bind(this),this.onSourceMoved=this.onSourceMoved.bind(this),this.onSourceResized=this.onSourceResized.bind(this),this.onRightButtonClicked=this.onRightButtonClicked.bind(this)}return t.prototype.destroy=function(){return u(this,void 0,Promise,(function(){var e,i,o,r,n;return l(this,(function(s){switch(s.label){case 0:this.view=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.trtc.stopPlugin("VideoMixer")];case 2:return s.sent(),[3,4];case 3:return e=s.sent(),this.logger.error("".concat(this.logPrefix," destroy and stopPlugin error:"),e),[3,4];case 4:if(!(this.screensWithSystemAudio.size>0))return[3,12];s.label=5;case 5:s.trys.push([5,10,,11]),i=0,o=Array.from(this.screensWithSystemAudio),s.label=6;case 6:return i<o.length?(r=o[i],[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(r)})]):[3,9];case 7:s.sent(),s.label=8;case 8:return i++,[3,6];case 9:return[3,11];case 10:return n=s.sent(),this.logger.error("".concat(this.logPrefix," destroy and stopPlugin AudioMixer error:"),n),[3,11];case 11:this.screensWithSystemAudio.clear(),s.label=12;case 12:return this.destroyDesigner(),this.eventEmitter=null,t.mediaMixingManager=null,[2]}}))}))},t.prototype.bindPreviewArea=function(e){return u(this,void 0,Promise,(function(){var t,i,o,r,n=this;return l(this,(function(s){switch(s.label){case 0:return this.logger.log("".concat(this.logPrefix," bindPreviewArea:"),e),this.view=e,t=this._getCanvasSize(this.publishParams.videoEncoderParams.videoResolution,this.publishParams.videoEncoderParams.resMode),i=t.width,o=t.height,[4,this.trtc.startPlugin("VideoMixer",{view:e,canvasInfo:{width:i,height:o,canvasColor:String(this.publishParams.canvasColor)},onScreenShareStop:function(e){var t,i=n.sourceList.find((function(t){return t.id===e}));n.removeMediaSource(i),null===(t=n.eventEmitter)||void 0===t||t.emit("onSourceDisconnected",i||null)}})];case 1:return r=s.sent(),console.log("startPlugin result",r,r.track),this.mixVideoTrack=r.track,this.createDesigner(),[2]}}))}))},t.prototype._getTRTCSourceKey=function(e){var t;return((t={})[dn.kCamera]="camera",t[dn.kScreen]="screen",t[dn.kText]="text",t[dn.kVideo]="video",t[dn.kImage]="image",t)[e.type]},t.prototype._getTRTCFillMode=function(e){var t;return((t={})[T.TRTCVideoFillMode_Fill]="cover",t[T.TRTCVideoFillMode_Fit]="contain",t)[e]},t.prototype._getTRTCVideoProfile=function(e,t){var i,o,r,n=null!==(o=((i={})[g.TRTCVideoResolution_480_270]={width:480,height:270},i[g.TRTCVideoResolution_640_360]={width:640,height:360},i[g.TRTCVideoResolution_960_540]={width:960,height:540},i[g.TRTCVideoResolution_1280_720]={width:1280,height:720},i[g.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(ve(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)),ve(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)),!ve(null===(p=e.layout)||void 0===p?void 0:p.mirror)){var T=((t={})[y.TRTCVideoMirrorType_Auto]=!0,t[y.TRTCVideoMirrorType_Enable]=!0,t[y.TRTCVideoMirrorType_Disable]=!1,t);m.mirror=T[null===(f=e.layout)||void 0===f?void 0:f.mirror]}if(!ve(null===(v=e.layout)||void 0===v?void 0:v.rotation)){var _=((i={})[A.TRTCVideoRotation0]=0,i[A.TRTCVideoRotation90]=90,i[A.TRTCVideoRotation180]=180,i[A.TRTCVideoRotation270]=270,i);m.rotation=_[null===(g=e.layout)||void 0===g?void 0:g.rotation]}return m},t.prototype._getTRTCSourceItem=function(e){var t,i,o,r,n,s,c,u,l,h;switch(e.type){case dn.kScreen:return h=g.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 dn.kCamera:return h=g.TRTCVideoResolution_1280_720,(null==e?void 0:e.useInternalTrack)?{id:e.id,layout:this._getTRTCLayout(e),useInternalTrack:!0}:{id:e.id,cameraId:null===(r=e.camera)||void 0===r?void 0:r.cameraId,profile:this._getTRTCVideoProfile((null===(n=e.camera)||void 0===n?void 0:n.resolution)||h,(null===(s=e.camera)||void 0===s?void 0:s.fps)||15),videoTrack:null===(c=e.camera)||void 0===c?void 0:c.videoTrack,layout:this._getTRTCLayout(e)};case dn.kText:return a(a({id:e.id},e.text||{}),{layout:this._getTRTCLayout(e)});case dn.kImage:return{id:e.id,url:null===(u=e.image)||void 0===u?void 0:u.url,layout:this._getTRTCLayout(e)};case dn.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={})[g.TRTCVideoResolution_480_270]={width:480,height:270},i[g.TRTCVideoResolution_640_360]={width:640,height:360},i[g.TRTCVideoResolution_960_540]={width:960,height:540},i[g.TRTCVideoResolution_1280_720]={width:1280,height:720},i[g.TRTCVideoResolution_1920_1080]={width:1920,height:1080},i)[e],n=r.width,s=r.height;return t===x.TRTCVideoResolutionModePortrait&&(n=(o=[s,n])[0],s=o[1]),{width:n,height:s}},t.prototype.addMediaSource=function(e){var t;return u(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:if(-1!==this.findMediaSourceIndex(e))throw new Error("Media source already existed");if(i=Re(e),o=this._getTRTCSourceKey(i),!(r=this._getTRTCSourceItem(i))||!o)throw new Error("Invalid media source");return(n=Re(this.trtcSourceMap.get(o))||[]).push(r),[4,this.trtc.updatePlugin("VideoMixer",(h={},h[o]=n,h))];case 1:return s=l.sent(),a=s.result,c=s.systemAudioTrackList,e.type===dn.kScreen&&(null==c?void 0:c[e.id])?(this.screensWithSystemAudio.add(e.id),u=null==c?void 0:c[e.id],this.logger.log("".concat(this.logPrefix," startPlugin AudioMixer, track ID:"),u.id),[4,this.trtc.startPlugin("AudioMixer",{id:"systemAudioTrack_".concat(e.id),track:u})]):[3,3];case 2:l.sent(),l.label=3;case 3:if(a.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to add media source");return i.isSelected&&(this.unselectMediaSource(this.selectedSource),this.selectedSource=e),this.trtcSourceMap.set(o,n),null===(t=this.mediaMixingDesigner)||void 0===t||t.addMedia({id:i.id,rect:this._getDesignerMediaRect(e),isSelected:!!ve(i.isSelected)||i.isSelected,origin:i,interaction:i.interaction}),i.isSelected&&(this.selectedSource=i),this.sourceList.push(i),[2]}}))}))},t.prototype.removeMediaSource=function(e){var t,i,o;return u(this,void 0,Promise,(function(){var r,n,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:if(this.logger.log("".concat(this.logPrefix,"removeMediaSource:"),e),-1===(r=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to remove");return n=this._getTRTCSourceKey(e),s=Re(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===dn.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:Re(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 A.TRTCVideoRotation0:case A.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case A.TRTCVideoRotation90:case A.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 A.TRTCVideoRotation0:case A.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case A.TRTCVideoRotation90:case A.TRTCVideoRotation270:return{left:r,top:n,right:r+(a-n),bottom:n+(s-r)};default:return{left:r,top:n,right:s,bottom:a}}},t.prototype.updateMediaSource=function(e){var t,i;return u(this,void 0,Promise,(function(){var o,r,n,s,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:if(this.logger.log("".concat(this.logPrefix,"updateMediaSource:"),e),-1===(o=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to update");return r=a(a({},this.sourceList[o]),Re(e)),e.isSelected?(this.unselectMediaSource(this.selectedSource),this.selectedSource=e):(null===(t=this.selectedSource)||void 0===t?void 0:t.id)===e.id&&(this.selectedSource=null),n=this._getTRTCSourceKey(r),s=this._getTRTCSourceItem(r),c=Re(this.trtcSourceMap.get(n))||[],u=c.findIndex((function(t){return t.id===e.id})),c[u]=s,[4,this.trtc.updatePlugin("VideoMixer",(d={},d[n]=c,d))];case 1:if(l.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return h={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:Re(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(h)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(h),this.trtcSourceMap.set(n,c),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(){return u(this,void 0,Promise,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," startPublish")),[4,this.trtcCloud._startPublishVideoTrack({videoTrack:this.mixVideoTrack})];case 1:return e.sent(),[2]}}))}))},t.prototype.stopPublish=function(){return u(this,void 0,Promise,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," stopPublish")),[4,this.trtcCloud._stopPublishVideoTrack()];case 1:return e.sent(),[2]}}))}))},t.prototype.updatePublishParams=function(t){var i,o,r,n,s;return u(this,void 0,Promise,(function(){var a,c,u,h,d,f,v,g,m,T,y,_,R,b,C,S,w,M,E,A,P,L,V,I;return l(this,(function(l){switch(l.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),t),a=this.publishParams,this.publishParams=t,c=this._getCanvasSize(t.videoEncoderParams.videoResolution,t.videoEncoderParams.resMode),u=c.width,h=c.height,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:u,height:h,canvasColor:String(t.canvasColor)}})];case 2:return l.sent(),[3,4];case 3:if((d=l.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw d;return[3,4];case 4:null===(r=this.mediaMixingDesigner)||void 0===r||r.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),l.label=5;case 5:l.trys.push([5,11,12,17]),f=p(this.sourceList),l.label=6;case 6:return[4,f.next()];case 7:return(v=l.sent()).done?[3,10]:(g=v.value).layout?(m=g.layout.rect||{left:0,top:0,right:0,bottom:0},T=m.left,y=m.top,_=m.right,R=m.bottom,b=this._getCanvasSize(a.videoEncoderParams.videoResolution),C=b.width,S=b.height,w=this._getCanvasSize(t.videoEncoderParams.videoResolution),M=w.width,E=w.height,A=T*M/C,P=y*E/S,L=_*M/C,V=R*E/S,g.layout.rect={left:A,top:P,right:L,bottom:V},[4,this.updateMediaSource(g)]):[3,9];case 8:l.sent(),null===(n=this.eventEmitter)||void 0===n||n.emit("onSourceResized",g,null===(s=g.layout)||void 0===s?void 0:s.rect),l.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return I=l.sent(),i={error:I},[3,17];case 12:return l.trys.push([12,,15,16]),v&&!v.done&&(o=f.return)?[4,o.call(f)]:[3,14];case 13:l.sent(),l.label=14;case 14:return[3,16];case 15:if(i)throw i.error;return[7];case 16:return[7];case 17:return[4,this.trtcCloud.setVideoEncoderParam(t.videoEncoderParams)];case 18:return l.sent(),[2]}}))}))},t.prototype.on=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.on(e,t)},t.prototype.off=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.off(e,t)},t.prototype.onVisibilityChange=function(){this.logger.log("".concat(this.logPrefix,"onVisibilityChange document.hidden:").concat(document.hidden)),document.hidden?this.bindPreviewArea(null):this.bindPreviewArea(this.view)},t.prototype.createDesigner=function(){var e,t;this.view&&(this.mediaMixingDesigner=new Yn({view:this.view,videoResolution:(null===(e=this.publishParams)||void 0===e?void 0:e.videoEncoderParams.videoResolution)||g.TRTCVideoResolution_1920_1080,resMode:(null===(t=this.publishParams)||void 0===t?void 0:t.videoEncoderParams.resMode)||x.TRTCVideoResolutionModeLandscape,canExceedContainer:!0,logger:this.logger}),this.listenDesignerEvent())},t.prototype.destroyDesigner=function(){var e;this.mediaMixingDesigner&&(this.unlistenDesignerEvent(),null===(e=this.mediaMixingDesigner)||void 0===e||e.destroy(),this.mediaMixingDesigner=null)},t.prototype.listenDesignerEvent=function(){var e,t,i,o,r;null===(e=this.mediaMixingDesigner)||void 0===e||e.on("onError",this.onError),null===(t=this.mediaMixingDesigner)||void 0===t||t.on("onSourceSelected",this.onSourceSelected),null===(i=this.mediaMixingDesigner)||void 0===i||i.on("onSourceMoved",this.onSourceMoved),null===(o=this.mediaMixingDesigner)||void 0===o||o.on("onSourceResized",this.onSourceResized),null===(r=this.mediaMixingDesigner)||void 0===r||r.on("onRightButtonClicked",this.onRightButtonClicked)},t.prototype.unlistenDesignerEvent=function(){var e,t,i,o,r;null===(e=this.mediaMixingDesigner)||void 0===e||e.off("onError",this.onError),null===(t=this.mediaMixingDesigner)||void 0===t||t.off("onSourceSelected",this.onSourceSelected),null===(i=this.mediaMixingDesigner)||void 0===i||i.off("onSourceMoved",this.onSourceMoved),null===(o=this.mediaMixingDesigner)||void 0===o||o.off("onSourceResized",this.onSourceResized),null===(r=this.mediaMixingDesigner)||void 0===r||r.off("onRightButtonClicked",this.onRightButtonClicked)},t.prototype.onError=function(e,t){this.logger.log("".concat(this.logPrefix,"onError:"),e,t)},t.prototype.onSourceSelected=function(e){var t;return u(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return this.logger.debug("".concat(this.logPrefix,"onSourceSelected: "),e,this.selectedSource),e&&this.selectedSource&&e.origin.id===this.selectedSource.id?[2]:(null==e?void 0:e.origin)?(this.updateMediaSource(a(a({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(a(a({},this.selectedSource),{isSelected:!1}))]:[3,3];case 2:i.sent(),this.selectedSource=null,i.label=3;case 3:return null===(t=this.eventEmitter)||void 0===t||t.emit("onSourceSelected",e?e.origin:null),[2]}}))}))},t.prototype.onSourceMoved=function(e,t){var i,o;if(this.logger.debug("".concat(this.logPrefix,"onSourceMoved:"),e,t),null==e?void 0:e.origin){var r=a(a({},e.origin),{layout:a(a({},e.origin.layout),{rect:t})});this.updateMediaSource(_e(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id}))),null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceMoved",e.origin,this._getPluginMediaRect(r))}},t.prototype.onSourceResized=function(e,t){var i,o;if(this.logger.debug("".concat(this.logPrefix,"onSourceResized:"),e,t),null==e?void 0:e.origin){var r=a(a({},e.origin),{layout:a(a({},e.origin.layout),{rect:t})});this.updateMediaSource(_e(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id})))}null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceResized",e.origin,t)},t.prototype.onRightButtonClicked=function(e){var t;this.logger.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",e.origin)},t.prototype.isSameMediaSource=function(e,t){return e.id===t.id},t.prototype.isMediaSourceExisted=function(e){var t=this;return this.sourceList.some((function(i){return t.isSameMediaSource(i,e)}))},t.prototype.findMediaSourceIndex=function(e){return this.sourceList.findIndex((function(t){return t.id===e.id}))},t.prototype.unselectMediaSource=function(e){var t,i;return u(this,void 0,Promise,(function(){var o;return l(this,(function(r){return e?(-1!==(o=this.findMediaSourceIndex(e))&&(this.sourceList[o].isSelected=!1),null===(t=this.mediaMixingDesigner)||void 0===t||t.updateMedia({id:e.id,rect:null===(i=e.layout)||void 0===i?void 0:i.rect,isSelected:!1,origin:Re(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}(),Jn=function(){function e(){this.isRunning=!1,this.queue=[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastQueueItem",{get:function(){return 0===this.length?null:this.queue[this.length-1]},enumerable:!1,configurable:!0}),e.prototype.push=function(e,t,i,o){var r,n;void 0===t&&(t=!1),void 0===i&&(i=!1);var s=a(a({},e),{functionName:o}),c=new Promise((function(e,t){s.resolve=e,s.reject=t}));if(s.promise=c,t)this.length<=1?this.queue.push(s):null===(n=null===(r=this.lastQueueItem)||void 0===r?void 0:r.promise)||void 0===n||n.then(s.resolve,s.reject);else{if(i&&o&&this.queue.length>1){var u=[];this.queue=this.queue.filter((function(e,t){return 0===t||(e.functionName!==o||(u.push(e),!1))})),u.forEach((function(e){e.reject(new Error("aborted by newer task"))}))}this.queue.push(s)}return this.isRunning||this.callNext(),c},e.prototype.shift=function(){return this.queue.shift()},e.prototype.callNext=function(){var e=this;if(!this.isRunning&&0!==this.length){var t=this.queue[0],i=t.fn,o=t.args,r=t.context,n=t.resolve,s=t.reject;this.isRunning=!0,i.apply(r,o).then(n,s).finally((function(){e.isRunning=!1,e.shift(),e.callNext()}))}},e}(),Xn=new WeakMap,$n=new WeakMap,Zn=new WeakMap;function es(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=Zn.get(this)||new Map;Zn.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 Jn,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 ts=function(){function t(e){var t=this;this.logPrefix="[AITranscriberManager]",this.listeners=new Set,this.isPaused=!1,this.isMessageListenerRegistered=!1,this.handleMessageEvent=function(e){var i=t.createMessageFromEvent(e);t._notifyListeners("onReceiveTranscriberMessage",e.roomId,i)},this.handleStateEvent=function(e){var i=e.transcriberRobotId,o=e.state,r=e.roomId,n=e.sourceLanguage,s=void 0===n?"":n,a=e.error,c=e.errorMessage,u=void 0===c?"":c;if(r&&i){if("started"===o)t._notifyListeners("onRealtimeTranscriberStarted",r,i,s);else if("stopped"===o){t._notifyListeners("onRealtimeTranscriberStopped",r,i,0)}null!=a&&t._notifyListeners("onRealtimeTranscriberError",r,i,a,u)}},this.logger=e.logger,this.trtc=e.trtc,this.registerStateListener()}return t.prototype.registerStateListener=function(){this.trtc.on(e.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},t.prototype.createMessageFromEvent=function(e){var t,i,o,r;return{segmentId:null!==(t=null==e?void 0:e.segmentId)&&void 0!==t?t:"",speakerUserId:null!==(i=null==e?void 0:e.speakerUserId)&&void 0!==i?i:"",sourceText:null!==(o=null==e?void 0:e.sourceText)&&void 0!==o?o:"",translationTexts:(null==e?void 0:e.translationTexts)?new Map(Object.entries(e.translationTexts)):void 0,timestamp:null!==(r=null==e?void 0:e.timestamp)&&void 0!==r?r:Date.now(),isCompleted:Boolean(null==e?void 0:e.isCompleted)}},t.prototype.updateMessageSubscription=function(){var t=!this.isPaused&&this.listeners.size>0;if(t&&!this.isMessageListenerRegistered)return this.trtc.on(e.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),void(this.isMessageListenerRegistered=!0);!t&&this.isMessageListenerRegistered&&(this.trtc.off(e.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),this.isMessageListenerRegistered=!1)},t.prototype.log=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.log)||void 0===t||t.call.apply(t,d([e,this.logPrefix],i,!1))},t.prototype.logError=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.error)||void 0===t||t.call.apply(t,d([e,this.logPrefix],i,!1))},t.prototype._notifyListeners=function(e){for(var t=this,i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];this.listeners.forEach((function(o){var r=o[e];if("function"==typeof r)try{r.apply(o,i)}catch(n){t.logError("Error notifying listener:",n)}}))},t.prototype.startRealtimeTranscriber=function(e){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:if(this.log("startRealtimeTranscriber:",e),!(null==e?void 0:e.sourceLanguage))throw new Error("sourceLanguage is required");t={sourceLanguage:e.sourceLanguage},e.transcriberRobotId&&(t.transcriberRobotId=e.transcriberRobotId),void 0!==e.userIdsToTranscribe&&(t.userIdsToTranscribe=e.userIdsToTranscribe),void 0!==e.translationLanguages&&(t.translationLanguages=e.translationLanguages),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.trtc.startPlugin("RealtimeTranscriber",t)];case 2:return i=r.sent(),this.log("startRealtimeTranscriber success, robotId:",i),[2,i];case 3:throw o=r.sent(),this.logError("startRealtimeTranscriber error:",o),o;case 4:return[2]}}))}))},t.prototype.stopRealtimeTranscriber=function(e){return u(this,void 0,Promise,(function(){var t;return l(this,(function(i){switch(i.label){case 0:if(this.log("stopRealtimeTranscriber:",e),!e)throw new Error("transcriberRobotId is required");i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.trtc.stopPlugin("RealtimeTranscriber",{transcriberRobotId:e})];case 2:return i.sent(),this.log("stopRealtimeTranscriber success"),[3,4];case 3:throw t=i.sent(),this.logError("stopRealtimeTranscriber error:",t),t;case 4:return[2]}}))}))},t.prototype.pauseReceivingMessage=function(){this.isPaused||(this.log("pauseReceivingMessage"),this.isPaused=!0,this.updateMessageSubscription())},t.prototype.resumeReceivingMessage=function(){this.isPaused&&(this.log("resumeReceivingMessage"),this.isPaused=!1,this.updateMessageSubscription())},t.prototype.addListener=function(e){this.listeners.add(e),this.updateMessageSubscription()},t.prototype.removeListener=function(e){this.log("removeListener"),this.listeners.delete(e),this.updateMessageSubscription()},t.prototype.destroy=function(){this.log("destroy"),this.listeners.clear(),this.isPaused=!0,this.updateMessageSubscription(),this.trtc.off(e.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},t}(),is=void 0,os=void 0,rs=void 0,ns=void 0,ss=e._loggerManager;ss.info("TRTCCloud Version: ".concat(Mn));var as,cs,us,ls="trtcCloud",hs=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(as=function(){0!==ds.size&&Array.from(ds.values()).forEach((function(e){e.fn()}))},cs=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];us>0&&clearTimeout(us),us=window.setTimeout((function(){as.apply(e,t),us=-1}),cs)}));var ds=new Map,ps=function(h){function p(i){void 0===i&&(i={});var o=h.call(this)||this;o._version="",o._frameWorkType=30,o._component=0,o._language=0,o._networkProxy={},o._localView=null,o._autoRecvAudio=!0,o._autoRecvVideo=!1,o._localTestView=null,o._isVideoPublish=!0,o._localRenderParams={rotation:A.TRTCVideoRotation0,fillMode:T.TRTCVideoFillMode_Fill,mirrorType:y.TRTCVideoMirrorType_Auto},o._encoderMirror=void 0,o._videoProfile={},o._isAudioPublish=!0,o._audioMuteType=!1,o._audioProfile=e.TYPE.AUDIO_PROFILE_STANDARD,o._captureVolume=100,o._playoutVolume=100,o._isSharingScreen=!1,o._remoteStreamConfig=new Map,o._remoteStreamMap=new Map,o._cameraList=[],o._microphoneList=[],o._speakerList=[],o._currentCamera={},o._currentMicrophone={},o._currentSpeaker={},o._currentCameraId="",o._currentMicrophoneId="",o._currentSpeakerId="",o._screenShareParams={option:{}},o._isMobile=Hr,o._isFrontCamera=!0,o._cameraVideoTrack=null,o._smallStreamVideoProfile=void 0,o._qosPreference=void 0,o._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},o._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},o._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},o._isVirtualBackground=!1,o._isTestVirtualBackground=!1,o._isBeautyEnabled=!1,o._isTestBeautyEnabled=!1,o._remoteStatisticsUserIdList=[],o._hasJoinedRoom=!1,o._isExitingRoom=!1,o._version=Mn;var s=i.frameWorkType,a=void 0===s?30:s,c=i.component,u=void 0===c?0:c,l=i.language,d=void 0===l?0:l;return o._frameWorkType=a,o._component=u,o._language=d,o._trtc=e.create({enableSEI:p.enableSEI,assetsPath:p.assetsPath,enableVolumeControlInIOS:!0,plugins:[n,t,r]}),o._testTrtc=e.create(),o._log=e._loggerManager,o.logger=new xn(ss,{seq:hs++}),o._echoCancellation=void 0,o._noiseSuppression=void 0,o._autoGainControl=void 0,o._addTRTCEvents(),o.handleDeviceChange=o.handleDeviceChange.bind(o),ds.set(o,{fn:o.handleDeviceChange,self:o}),o}var f;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(p,h),p.getPlugin=function(e){return"VirtualBackground"===e?i:"BasicBeauty"===e?o:"VideoMixer"===e?n:null},p.getTRTCShareInstance=function(e){return p.shareInstance||(p.shareInstance=new p(e)),p.shareInstance},p.setLogLevel=function(t,i){var o,r=((o={})[W.TRTCLogLevelVerbose]=0,o[W.TRTCLogLevelDebug]=1,o[W.TRTCLogLevelInfo]=2,o[W.TRTCLogLevelWarn]=3,o[W.TRTCLogLevelError]=4,o[W.TRTCLogLevelFatal]=4,o[W.TRTCLogLevelNone]=5,o),n=r[t];ve(n)&&(n=r[W.TRTCLogLevelInfo]);var s=!me(i)||i;e.setLogLevel(n,s)},p.destroyTRTCShareInstance=function(){p.shareInstance&&(p.shareInstance._destroy(),p.shareInstance=null),Array.from(p.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},p.callExperimentalAPI=function(e){console.log("static ".concat(ls,".callExperimentalAPI"),e);var t=Te(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":p.enableSEI=o.enable;break;case"setAssetsPath":p.assetsPath=o.assetsPath}}catch(r){throw r}}},p.prototype.createSubCloud=function(){if(this!==p.shareInstance)return null;var e=new p;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),p.subCloudMap.set(e,e),e},p.prototype.destroy=function(){this!==p.shareInstance?(p.subCloudMap.get(this)&&p.subCloudMap.delete(this),this._destroy()):p.destroyTRTCShareInstance()},p.prototype._destroy=function(){ds.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},p.prototype.getSDKVersion=function(){return this._version||""},p.prototype.enterRoom=function(e,t){return u(this,void 0,Promise,(function(){var i,o,r,n,s,c,u,h,d,p,f,v,g,m,T,y,_,R;return l(this,(function(l){switch(l.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,c=e.role,u=e.privateMapKey,h=e.businessInfo,d=e.enableAutoPlayDialog,p=e.proxy,f=e.streamId,v=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(ls,".enterRoom with params: "),e,t),p&&(this._networkProxy=p),!(i&&o&&r))return[3,5];l.label=1;case 1:return l.trys.push([1,3,,4]),g={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:he[c],scene:de[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},g=u?a(a({},g),{privateMapKey:u}):g,g=h?a(a({},g),{businessInfo:h}):g,m=d||this._enableAutoPlayDialog,g=me(m)?a(a({},g),{enableAutoPlayDialog:m}):g,g=this._networkProxy?a(a({},g),{proxy:this._networkProxy}):g,g=f?a(a({},g),{streamId:f}):g,g=v?a(a({},g),{userDefineRecordId:v}):g,g=void 0!==this._latencyLevel?a(a({},g),{latencyLevel:this._latencyLevel}):g,T=fe(),[4,this._trtc.enterRoom(g)];case 2:return l.sent(),this._hasJoinedRoom=!0,y=fe()-T,this.emit("onEnterRoom",y),[3,4];case 3:return _=l.sent(),R=(R=this._transformTRTCErrorCode(_,"enterRoom"))<0?R:-1,this.emit("onEnterRoom",R),this._callFunctionErrorManage(_,"enterRoom"),[3,4];case 4:return[3,6];case 5:this._emitError(Sn),l.label=6;case 6:return[2]}}))}))},p.prototype.exitRoom=function(){return u(this,void 0,Promise,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(ls,".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",cn.exitRoom),[3,3];case 2:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,3];case 3:return[2]}}))}))},p.prototype.switchRole=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(he[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(he[e])),[3,4];case 3:return t=i.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),[3,4];case 4:return[2]}}))}))},p.prototype.setDefaultStreamRecvMode=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(i){return this.logger.info("".concat(ls,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),me(e)&&(this._autoRecvAudio=e),me(t)&&(this._autoRecvVideo=t),[2]}))}))},p.prototype.resetTRTCCloud=function(){this._setIsAudioPublish(!0),this._setAudioMuteType(!1),this._echoCancellation=void 0,this._noiseSuppression=void 0,this._autoGainControl=void 0,this._isVirtualBackground=!1,this._isTestVirtualBackground=!1,this._remoteStatisticsUserIdList=[],this._resetBeautyStyle()},p.prototype._updateLocalVideo=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateLocalTestVideo=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateLocalScreen=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateRemoteVideo=function(t,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:if(!this._hasJoinedRoom||this._isExitingRoom)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(t,i))];case 2:return r.sent(),[3,4];case 3:if((o=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw o;return[3,4];case 4:return[2]}}))}))},p.prototype.startLocalPreview=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return u(this,void 0,Promise,(function(){var i,o,r,n,s;return l(this,(function(a){switch(a.label){case 0:this.logger.info("".concat(ls,".startLocalPreview with params: "),t),1===d([],t,!0).length?o=d([],t,!0)[0]:2===d([],t,!0).length&&(s=d([],t,!0),i=s[0],o=s[1]),ve(i)||(this._setIsMobile(!0),this._setIsFrontCamera(i)),this._setLocalView(o),a.label=1;case 1:a.trys.push([1,9,,10]),a.label=2;case 2:return a.trys.push([2,4,,8]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return a.sent(),[3,8];case 4:return(r=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return a.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return this.emit("onCameraDidReady"),[3,10];case 9:return n=a.sent(),this._callFunctionErrorManage(n,"startLocalPreview"),[3,10];case 10:return[2]}}))}))},p.prototype.updateLocalView=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(ls,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},p.prototype.stopLocalPreview=function(){return u(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ls,".stopLocalPreview")),t.label=1;case 1:return t.trys.push([1,3,,4]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 2:return t.sent(),this.emit("onCameraStopped"),[3,4];case 3:return e=t.sent(),console.warn("".concat(ls," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},p.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".muteLocalVideo with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),[3,4];case 4:return[2]}}))}))},p.prototype.startRemoteView=function(t,i,o){return u(this,void 0,void 0,(function(){var r,n;return l(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(ls,".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===m.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(o))))return[2];s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,o))];case 3:return s.sent(),[3,8];case 4:return(r=s.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateRemoteVideo(t,o)];case 5:return s.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return[3,10];case 9:return n=s.sent(),this._callFunctionErrorManage(n,"startRemoteView"),[3,10];case 10:return[2]}}))}))},p.prototype.updateRemoteView=function(e,t,i){return u(this,void 0,void 0,(function(){return l(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(ls,".updateRemoteView with params: "),e,t,i),this._setRemoteStreamConfig(e,i,{view:t}),this._remoteStreamMap.get("".concat(e,"_").concat(this._getTRTCStreamType(i)))?[4,this._updateRemoteVideo(e,i)]:[2];case 1:return o.sent(),[2]}}))}))},p.prototype.stopRemoteView=function(e,t){return u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".stopRemoteView with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"stopRemoteView"),[3,4];case 4:return[2]}}))}))},p.prototype.stopAllRemoteView=function(){return u(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ls,".stopAllRemoteView")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),[3,4];case 4:return[2]}}))}))},p.prototype.setVideoEncoderParam=function(e){return u(this,void 0,void 0,(function(){var t,i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".setVideoEncoderParam with params: "),e),o.label=1;case 1:return o.trys.push([1,4,,5]),t=this._getTRTCVideoProfile(m.TRTCVideoStreamTypeBig,e),this._setVideoProfile(t),[4,this._updateLocalVideo()];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),[3,5];case 4:return i=o.sent(),this._callFunctionErrorManage(i,"setVideoEncoderParam"),[3,5];case 5:return[2]}}))}))},p.prototype.setNetworkQosParam=function(e){return u(this,void 0,void 0,(function(){var t,i,o=this;return l(this,(function(r){return this.logger.info("".concat(ls,".setNetworkQosParam with params: "),e),t=e.preference,i=this._getTRTCQosPreference(t),this._setQosPreference(i),this._setScreenShareParams({qosPreference:i}),[2,new Promise((function(e,t){Promise.all([o._updateLocalVideo(),o._updateLocalScreen()]).then((function(){e(!0)})).catch((function(e){o._callFunctionErrorManage(e,"setNetworkQosParam"),t(e)}))}))]}))}))},p.prototype.setLocalRenderParams=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return t=i.sent(),this._callFunctionErrorManage(t,"setLocalRenderParams"),[3,5];case 5:return[2]}}))}))},p.prototype.setVideoEncoderMirror=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".setVideoEncoderMirror with params: "),e),this._encoderMirror=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setVideoEncoderMirror"),[3,4];case 4:return[2]}}))}))},p.prototype.setRemoteRenderParams=function(e,t,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".setRemoteRenderParams with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,i),[4,this._updateRemoteVideo(e,t)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),[3,4];case 4:return[2]}}))}))},p.prototype._updateLocalAudio=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateLocalTestAudio=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype.startLocalAudio=function(t){return void 0===t&&(t=C.TRTCAudioQualityDefault),u(this,void 0,void 0,(function(){var i,o,r;return l(this,(function(n){switch(n.label){case 0:t===C.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(ls,".startLocalAudio with params: "),t),i=this._getTRTCAudioQuality(t),n.label=1;case 1:n.trys.push([1,9,,10]),this._setAudioProfile(i),n.label=2;case 2:return n.trys.push([2,4,,8]),[4,this._trtc.startLocalAudio(this._generateLocalAudioData())];case 3:return n.sent(),[3,8];case 4:return(o=n.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalAudio()];case 5:return n.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return this.emit("onMicDidReady"),[3,10];case 9:return r=n.sent(),console.warn("".concat(ls," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),[3,10];case 10:return[2]}}))}))},p.prototype.stopLocalAudio=function(){return u(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ls,".stopLocalAudio")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopLocalAudio()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),[3,4];case 4:return[2]}}))}))},p.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".muteLocalAudio with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setAudioMuteType(!!e&&"microphone"),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),[3,4];case 4:return[2]}}))}))},p.prototype.setAudioCaptureVolume=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".setAudioCaptureVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setCaptureVolume(e),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setAudioCaptureVolume"),[3,4];case 4:return[2]}}))}))},p.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(ls,".getAudioCaptureVolume")),this._getCaptureVolume()},p.prototype.setAudioPlayoutVolume=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".setAudioPlayoutVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._playoutVolume=e,[4,this._trtc.setRemoteAudioVolume("*",e)];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setAudioPlayoutVolume"),[3,4];case 4:return[2]}}))}))},p.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(ls,".getAudioPlayoutVolume")),this._playoutVolume},p.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".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(Sn),[2]);case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},p.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(ls,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},p.prototype.muteRemoteVideoStream=function(e,t,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".muteRemoteVideoStream with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo({userId:e,mute:t,streamType:this._getTRTCStreamType(i)})];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"muteRemoteVideoStream"),[3,4];case 4:return[2]}}))}))},p.prototype.muteAllRemoteVideoStreams=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".muteAllRemoteVideoStreams with params: "),e),i.label=1;case 1:return i.trys.push([1,6,,7]),e?[4,this._trtc.callExperimentalAPI("pauseRemotePlayer",{userId:"*"})]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this._trtc.callExperimentalAPI("resumeRemotePlayer",{userId:"*"})];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:return t=i.sent(),this._callFunctionErrorManage(t,"muteAllRemoteVideoStreams"),[3,7];case 7:return[2]}}))}))},p.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(ls,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){this._callFunctionErrorManage(i,"setRemoteAudioVolume")}},p.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(ls,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},p.prototype.enableSmallVideoStream=function(e,t){return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(ls,".enableSmallVideoStream with params: "),e,t),e?(i=this._getTRTCVideoProfile(m.TRTCVideoStreamTypeSmall,t),this._setSmallStreamVideoProfile(i)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return o.sent(),[2]}}))}))},p.prototype.snapshotVideo=function(e,t){var i="";return i=""===e&&t===m.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===e&&t===m.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(t)}):this._trtc.getVideoSnapshot({userId:e,streamType:this._getTRTCStreamType(t)}),this.emit("onSnapshotComplete",e,t,i),i},p.prototype.startScreenShare=function(t,i,o){return u(this,void 0,void 0,(function(){var r,n,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:this.logger.info("".concat(ls,".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(m.TRTCVideoStreamTypeSub,o),this._setScreenShareParams({view:t,profile:c,systemAudio:s,videoTrack:a,streamType:i}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return l.sent(),this._isSharingScreen=!0,this.emit("onScreenCaptureStarted"),[3,4];case 3:if((u=l.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw console.error("Start share screen error:",u,u.code,u.name,u.message),u;return[3,4];case 4:return[2]}}))}))},p.prototype.setSubStreamEncoderParam=function(e){return u(this,void 0,void 0,(function(){var t,i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".setSubStreamEncoderParam with params: "),e),t=this._getTRTCVideoProfile(m.TRTCVideoStreamTypeSub,e),this._setScreenShareParams({profile:t}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._updateLocalScreen()];case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"setSubStreamEncoderParam"),[3,4];case 4:return[2]}}))}))},p.prototype.stopScreenShare=function(){return u(this,void 0,Promise,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ls,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._clearScreenShareParams(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",0),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),[3,4];case 4:return[2]}}))}))},p.prototype._startPublishVideoTrack=function(t){var i=t.videoTrack;return u(this,void 0,void 0,(function(){var t,o;return l(this,(function(r){switch(r.label){case 0:r.trys.push([0,7,,8]),r.label=1;case 1:return r.trys.push([1,3,,6]),[4,this._trtc.startLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 2:return r.sent(),[3,6];case 3:return(t=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._trtc.updateLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 4:r.sent(),r.label=5;case 5:throw t;case 6:return[3,8];case 7:return o=r.sent(),this._callFunctionErrorManage(o,"startPublishVideoTrack"),[3,8];case 8:return[2]}}))}))},p.prototype._stopPublishVideoTrack=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},p.prototype.startScreenCapture=function(){this._emitError(wn)},p.prototype.pauseScreenCapture=function(){this._emitError(wn)},p.prototype.resumeScreenCapture=function(){this._emitError(wn)},p.prototype.getScreenCaptureSources=function(){this._emitError(wn)},p.prototype.selectScreenCaptureTarget=function(){this._emitError(wn)},p.prototype.getCameraDevicesList=function(){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".getCameraDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getCameraList()];case 2:return t=r.sent(),i=t.map((function(e){return a(a({},e),{deviceName:e.label})})),this._cameraList=t,"{}"!==JSON.stringify(this._currentCamera)?[3,4]:(this._currentCamera=this.getDefaultDeviceInfo(t),this._currentCameraId=this._currentCamera.deviceId,[4,this.setCurrentCameraDevice(this._currentCameraId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getCameraDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},p.prototype.setCurrentCameraDevice=function(e){var t;return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".setCurrentCameraDevice with params: "),{cameraId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._currentCameraId=e,[4,this._updateLocalVideo()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),this._currentCamera=this._cameraList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._currentCameraId=null===(t=this._currentCamera)||void 0===t?void 0:t.cameraId,this._callFunctionErrorManage(i,"setCurrentCameraDevice"),i;case 5:return[2]}}))}))},p.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(ls,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new E(t,i,o,i,r)},p.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},p.prototype.switchCamera=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(ls,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},p.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},p.prototype.setVirtualBackground=function(e){return u(this,void 0,void 0,(function(){var t,i,o,r,n;return l(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,i=e.type,o=e.blurLevel,r=e.imagePath,t?this._isVirtualBackground?i!==ue?[3,2]:[4,this._trtc.updatePlugin(ae,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==le?[3,4]:[4,this._trtc.updatePlugin(ae,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(ae,a(a({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._trtc.stopPlugin(ae),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(ls,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},p.prototype.setTestVirtualBackground=function(e){return u(this,void 0,void 0,(function(){var t,i,o,r,n;return l(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,i=e.type,o=e.blurLevel,r=e.imagePath,t?this._isTestVirtualBackground?i!==ue?[3,2]:[4,this._testTrtc.updatePlugin(ae,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==le?[3,4]:[4,this._testTrtc.updatePlugin(ae,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(ae,a(a({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isTestVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._testTrtc.stopPlugin(ae),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(ls,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},p.prototype.useVirtualBackground=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:i,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:i,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},p.prototype.setBeautyStyle=function(e,t,i,o){return u(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this._handleBeautyStyleParam(this._trtc,this._isBeautyEnabled,e,t,i,o,!1)];case 1:return r.sent(),[2]}}))}))},p.prototype.setTestBeautyStyle=function(e,t,i,o){return u(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this._handleBeautyStyleParam(this._testTrtc,this._isTestBeautyEnabled,e,t,i,o,!0)];case 1:return r.sent(),[2]}}))}))},p.prototype.useBeautyStyle=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:o,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:o,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},p.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return u(this,void 0,void 0,(function(){var i,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:if(o<0||o>9)throw new Error("beautyLevel must be between 0 and 9");if(r<0||r>9)throw new Error("whitenessLevel must be between 0 and 9");if(n<0||n>9)throw new Error("ruddinessLevel must be between 0 and 9");l.label=1;case 1:return l.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(ce)]:[3,3];case 2:return l.sent(),s?this._isTestBeautyEnabled=!1:this._isBeautyEnabled=!1,[3,7];case 3:return u={beauty:i,brightness:a,ruddy:c},t?[3,5]:[4,e.startPlugin(ce,u)];case 4:return l.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(ce,u)];case 6:l.sent(),l.label=7;case 7:return[3,9];case 8:throw h=l.sent(),s?this.logger.error("".concat(ls,".").concat("setTestBeautyStyle"," fail: "),h):this.logger.error("".concat(ls,".").concat("setBeautyStyle"," fail: "),h),h;case 9:return[2]}}))}))},p.prototype._resetBeautyStyle=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(ce)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(ce)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},p.prototype.getMicDevicesList=function(){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".getMicDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getMicrophoneList()];case 2:return t=r.sent(),i=t.map((function(e){return a(a({},e),{deviceName:e.label})})),this._microphoneList=t,"{}"!==JSON.stringify(this._currentMicrophone)?[3,4]:(this._currentMicrophone=this.getDefaultDeviceInfo(t),this._currentMicrophoneId=this._currentMicrophone.deviceId,[4,this.setCurrentMicDevice(this._currentMicrophoneId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getMicDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},p.prototype.setCurrentMicDevice=function(e){var t;return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".setCurrentMicDevice with params: "),{micId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._setCurrentMicrophoneId(e),[4,this._updateLocalAudio()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestAudio()];case 3:return o.sent(),this._currentMicrophone=this._microphoneList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._setCurrentMicrophoneId(null===(t=this._currentMicrophone)||void 0===t?void 0:t.deviceId),this._callFunctionErrorManage(i,"setCurrentMicDevice"),i;case 5:return[2]}}))}))},p.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(ls,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new E(t,i,o,i,r)},p.prototype.getSpeakerDevicesList=function(){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".getSpeakerDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getSpeakerList()];case 2:return t=r.sent(),i=t.map((function(e){return a(a({},e),{deviceName:e.label})})),this._speakerList=t,"{}"!==JSON.stringify(this._currentSpeaker)?[3,4]:(this._currentSpeaker=this.getDefaultDeviceInfo(t),this._currentSpeakerId=this._currentSpeaker.deviceId,[4,this.setCurrentSpeakerDevice(this._currentSpeakerId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},p.prototype.setCurrentSpeakerDevice=function(t){return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".setCurrentSpeakerDevice with params: "),{speakerId:t}),o.label=1;case 1:return o.trys.push([1,3,,4]),t?[4,e.setCurrentSpeaker(t)]:[2,!1];case 2:return o.sent(),this._setCurrentSpeakerId(t),this._currentSpeaker=this._speakerList.find((function(e){return e.deviceId===t}))||{},[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"setCurrentSpeakerDevice"),i;case 4:return[2]}}))}))},p.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(ls,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new E(t,i,o,i,r)},p.prototype.startCameraDeviceTest=function(t){return u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:if(this.logger.info("".concat(ls,".startCameraDeviceTest with params: "),t),!t)return[2];this._setLocalTestView(t),o.label=1;case 1:return o.trys.push([1,3,,7]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return o.sent(),[3,7];case 3:return(i=o.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return o.sent(),[3,6];case 5:throw this._callFunctionErrorManage(i,"startCameraDeviceTest"),i;case 6:return[3,7];case 7:return[2]}}))}))},p.prototype.stopCameraDeviceTest=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(ls,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},p.prototype.startMicDeviceTest=function(t){return u(this,void 0,void 0,(function(){var i,o=this;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".startMicDeviceTest with params: "),t),r.label=1;case 1:return r.trys.push([1,3,,7]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return r.sent(),[3,7];case 3:return(i=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return r.sent(),[3,6];case 5:throw this._callFunctionErrorManage(i,"startMicDeviceTest"),i;case 6:return[3,7];case 7:return this._testTrtc.on(e.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,i=e.volume;""===t&&o.emit("onTestMicVolume",i)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(t)];case 8:return r.sent(),[2]}}))}))},p.prototype.stopMicDeviceTest=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(ls,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},p.prototype.callExperimentalAPI=function(e){return u(this,void 0,void 0,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(ls,".callExperimentalAPI"),e),(t=Te(e))===e)return[2];if(i=t.api,o=t.params,!i||!o)return[2];r.label=1;case 1:switch(r.trys.push([1,25,,26]),i){case"setFramework":return[3,2];case"enableAudioAEC":return[3,3];case"enableAudioANS":return[3,4];case"enableAudioAGC":return[3,5];case"KeyMetricsStats":return[3,6];case"setNetworkProxy":return[3,7];case"enableVirtualBackground":return[3,8];case"enableTestVirtualBackground":return[3,10];case"enableTestBeautyStyle":return[3,12];case"setVideoEncodeParamEx":return[3,14];case"enableAutoPlayDialog":return[3,15];case"setAudienceLatencyLevel":return[3,16];case"switchPlaybackQuality":return[3,17];case"requestPictureInPicture":return[3,19];case"exitPictureInPicture":return[3,21]}return[3,23];case 2:return this._handleSetFrameWork(o),[3,24];case 3:return this._echoCancellation=Boolean(o.enable),[3,24];case 4:return this._noiseSuppression=Boolean(o.enable),[3,24];case 5:return this._autoGainControl=Boolean(o.enable),[3,24];case 6:return this._handleKeyMetricsStats(o),[3,24];case 7:return this._networkProxy=o,[3,24];case 8:return[4,this.setVirtualBackground(o)];case 9:return r.sent(),[3,24];case 10:return[4,this.setTestVirtualBackground(o)];case 11:return r.sent(),[3,24];case 12:return[4,this.setTestBeautyStyle(o.style,o.beautyLevel,o.whitenessLevel,o.ruddinessLevel)];case 13:return r.sent(),[3,24];case 14:return this._setVideoEncodeParamEx(o),[3,24];case 15:return this._enableAutoPlayDialog=Boolean(o.enable),[3,24];case 16:return this._latencyLevel=o.latencyLevel,[3,24];case 17:return[4,this._switchPlaybackQuality(o)];case 18:return r.sent(),[3,24];case 19:return[4,this._requestPictureInPicture()];case 20:return r.sent(),[3,24];case 21:return[4,this._exitPictureInPicture()];case 22:return r.sent(),[3,24];case 23:return[3,24];case 24:return[3,26];case 25:throw r.sent();case 26:return[2]}}))}))},p.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;ge(t)&&(this._frameWorkType=t),ge(i)&&(this._component=i),ge(o)&&(this._language=o)},p.prototype._handleKeyMetricsStats=function(t){var i=t.key,o=t.opt,r=t.value,n=t.version,s=o===pe;e._addKVStat({type:o,key:i,value:r,version:n,useUV:s,base:100})},p.prototype._setVideoEncodeParamEx=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:switch(e.streamType){case m.TRTCVideoStreamTypeBig:return[3,1];case m.TRTCVideoStreamTypeSub:return[3,3]}return[3,5];case 1:return[4,this.setVideoEncoderParam(e)];case 2:case 4:return t.sent(),[3,6];case 3:return[4,this.setSubStreamEncoderParam(e)];case 5:return[3,6];case 6:return[2]}}))}))},p.prototype._switchPlaybackQuality=function(e){return u(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return l(this,(function(u){switch(u.label){case 0:if(i=(t=e||{}).quality,o=t.stream_list,r=void 0===o?[]:o,!i||0===r.length)return[2];for(n=null,s=0,a=r;s<a.length;s++)(c=a[s]).name===i&&(n=c),c.userId=c.user_id;return n&&n.user_id?[4,this._trtc.callExperimentalAPI("switchPlaybackQuality",{streamList:r,quality:n.name})]:[2];case 1:return u.sent(),[2]}}))}))},p.prototype._requestPictureInPicture=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(ls,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},p.prototype._exitPictureInPicture=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(ls,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},p.prototype._emitError=function(e){e&&this.emit&&this.emit(oe,e.code,e.message)},p.prototype._emitWarning=function(e){this.emit&&this.emit(re,e)},p.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?Cn:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},p.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:fn},p.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},p.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},p.prototype._transformTRTCDeviceError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);switch(e.extraCode){case 5301:case 5305:case 5306:case 5307:case 5308:case 5309:if(i)return vn;if(o)return yn;break;case 5302:if(i)return gn;if(o)return _n;break;case 5303:if(i)return Tn;if(o)return bn;break;case 5304:if(i)return mn;if(o)return Rn}},p.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?vn:o?yn:e.code},p.prototype._transformTRTCErrorCode=function(t,i){var o=null==t?void 0:t.code;if(t&&t.code)switch(t.code){case e.ERROR_CODE.DEVICE_ERROR:o=this._transformTRTCDeviceError(t,i);break;case e.ERROR_CODE.SERVER_ERROR:o=this._transformTRTCServerError(t);break;case e.ERROR_CODE.INVALID_OPERATION:case e.ERROR_CODE.OPERATION_ABORT:o=this._transformTRTCInvalidOperationError(t,i);break;case e.ERROR_CODE.UNKNOWN_ERROR:o=this._transformTRTCUnKnowError(t,i)}return o},p.prototype._callFunctionErrorManage=function(t,i){if(!t||t.code!==e.ERROR_CODE.OPERATION_ABORT){this.logger.warn("(".concat(i,") failed - ").concat(t.code," - ").concat(t.message));var o=this._transformTRTCErrorCode(t,i);this.emit(oe,o,t.message)}},p.prototype._getTRTCResolution=function(e){var t=(g[e]||"").split("_");return{width:+(t.length>1&&t[1]),height:+(t.length>2&&t[2])}},p.prototype._getTRTCVideoProfile=function(e,t){void 0===t&&(t={});var i=t.videoWidth,o=t.videoHeight,r=t.videoResolution,n=t.videoFps,s=t.videoBitrate,a=t.resMode,c=t.resolutionMode,u={};switch(e){case m.TRTCVideoStreamTypeSub:u=this._defaultScreenProfile;break;case m.TRTCVideoStreamTypeSmall:u=this._defaultSmallVideoProfile;break;case m.TRTCVideoStreamTypeBig:default:u=this._defaultVideoProfile}if(ve(r))ve(i)||(u.width=i),ve(o)||(u.height=o);else{var l=this._getTRTCResolution(r);u.width=l.width,u.height=l.height}if(!ve(a)&&a===x.TRTCVideoResolutionModePortrait||!ve(c)&&c===x.TRTCVideoResolutionModePortrait){var h=u.height,d=u.width;u.width=h,u.height=d}return n&&(u.frameRate=n),s&&(u.bitrate=s),u},p.prototype._getTRTCStreamType=function(t){var i;return((i={})[m.TRTCVideoStreamTypeBig]=e.TYPE.STREAM_TYPE_MAIN,i[m.TRTCVideoStreamTypeSmall]=e.TYPE.STREAM_TYPE_MAIN,i[m.TRTCVideoStreamTypeSub]=e.TYPE.STREAM_TYPE_SUB,i)[t]},p.prototype._getTRTCFillMode=function(e){var t;return((t={})[T.TRTCVideoFillMode_Fill]=an.COVER,t[T.TRTCVideoFillMode_Fit]=an.CONTAIN,t)[e]},p.prototype._getTRTCCloudVideoFillMode=function(e){var t;return((t={})[an.COVER]=T.TRTCVideoFillMode_Fill,t[an.CONTAIN]=T.TRTCVideoFillMode_Fit,t)[e]},p.prototype._getTRTCCloudMirrorType=function(e){return!0===e?y.TRTCVideoMirrorType_Enable:y.TRTCVideoMirrorType_Disable},p.prototype._getLocalRenderMirror=function(e){var t;return e===y.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((t={})[y.TRTCVideoMirrorType_Enable]=!0,t[y.TRTCVideoMirrorType_Disable]=!1,t)[e]},p.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return ve(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},p.prototype._getTRTCRemoteMirror=function(e){var t;return((t={})[y.TRTCVideoMirrorType_Auto]=!1,t[y.TRTCVideoMirrorType_Enable]=!0,t[y.TRTCVideoMirrorType_Disable]=!1,t)[e]},p.prototype._getTRTCQosPreference=function(t){var i;return((i={})[O.TRTCVideoQosPreferenceSmooth]=e.TYPE.QOS_PREFERENCE_SMOOTH,i[O.TRTCVideoQosPreferenceClear]=e.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},p.prototype._getTRTCAudioQuality=function(t){var i;return((i={})[C.TRTCAudioQualitySpeech]=e.TYPE.AUDIO_PROFILE_STANDARD,i[C.TRTCAudioQualityDefault]=e.TYPE.AUDIO_PROFILE_STANDARD,i[C.TRTCAudioQualityMusic]=e.TYPE.AUDIO_PROFILE_HIGH_STEREO,i)[t]},p.prototype._getTRTCCloudDeviceType=function(e){return{camera:M.TRTCDeviceTypeCamera,microphone:M.TRTCDeviceTypeMic,speaker:M.TRTCDeviceTypeSpeaker}[e]},p.prototype._getTRTCCloudDeviceState=function(e){return{add:w.TRTCDeviceStateAdd,remove:w.TRTCDeviceStateRemove,active:w.TRTCDeviceStateActive}[e]},p.prototype._getTRTCCloudQuality=function(e){return[V.TRTCQuality_Unknown,V.TRTCQuality_Excellent,V.TRTCQuality_Good,V.TRTCQuality_Poor,V.TRTCQuality_Bad,V.TRTCQuality_Vbad,V.TRTCQuality_Down][e]},p.prototype._generateLocalVideoData=function(){var e={view:this._getLocalView(),publish:this._getIsVideoPublish(),option:{profile:this._getVideoProfile(),small:this._getSmallStreamVideoProfile()||!1,mirror:this._getTRTCLocalMirror(this._localRenderParams.mirrorType,this._encoderMirror),fillMode:this._getTRTCFillMode(this._localRenderParams.fillMode)}};return this._cameraVideoTrack?e&&Object.assign(e.option,{videoTrack:this._cameraVideoTrack}):this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),this._getQosPreference()&&e&&Object.assign(e.option,{qosPreference:this._getQosPreference()}),e},p.prototype._generateLocalTestVideoData=function(){var e={view:this._getLocalTestView(),publish:!1,option:{profile:this._getVideoProfile(),mirror:this._getTRTCLocalMirror(this._localRenderParams.mirrorType,this._encoderMirror),fillMode:this._getTRTCFillMode(this._localRenderParams.fillMode)}};return this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),e},p.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return me(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),me(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),me(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},p.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},p.prototype._generateRemoteVideoData=function(e,t){return Re(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},p.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(e.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(e.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(e.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(e.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(e.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(e.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(e.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(e.EVENT.AUDIO_VOLUME,(function(e){(null==e?void 0:e.result)&&t.emit("onUserVoiceVolume",null==e?void 0:e.result,((null==e?void 0:e.result)||[]).length)})),this._trtc.on(e.EVENT.KICKED_OUT,(function(e){var i={banned:cn.banned,room_disband:cn.roomDisband};ge(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 D("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new D(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:m.TRTCVideoStreamTypeBig,small:m.TRTCVideoStreamTypeSmall,sub:m.TRTCVideoStreamTypeSub},h=(null===(i=c.video)||void 0===i?void 0:i.length)>0?c.video.map((function(e){var t=new N;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 N;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 F;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 F;r.userId=i,r.audioBitrate=o||0,t.push(r)}p.push.apply(p,t)}));var f=new H;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",m.TRTCVideoStreamTypeBig):"screen"===i&&t.emit("onSendFirstLocalVideoFrame",m.TRTCVideoStreamTypeSub))})),this._trtc.on(e.EVENT.FIRST_VIDEO_FRAME,(function(e){var i=e.userId,o=e.streamType,r=e.width,n=e.height;t.emit("onFirstVideoFrame",i,o,r,n)})),this._trtc.on(e.EVENT.AUDIO_PLAY_STATE_CHANGED,(function(e){var i=e.userId;"PLAYING"===e.state&&t.emit("onFirstAudioFrame",i)})),this._trtc.on(e.EVENT.DEVICE_CHANGED,(function(e){var i=e.type,o=e.device,r=e.action,n=o.deviceId;if("active"===r){switch(i){case"camera":t._currentCameraId=n,t._currentCamera=o;break;case"microphone":t._currentMicrophoneId=n,t._currentMicrophone=o;break;case"speaker":t._currentSpeakerId=n,t._currentSpeaker=o}t.emitOnDeviceChange(n,t._getTRTCCloudDeviceType(i),t._getTRTCCloudDeviceState(r))}})),this._trtc.on(e.EVENT.CUSTOM_MESSAGE,(function(e){e&&t.emit("onRecvCustomCmdMsg",e.userId,e.cmdId,e.seq,null==e?void 0:e.data)})),this._trtc.on(e.EVENT.CONNECTION_STATE_CHANGED,(function(e){t._hasJoinedRoom&&!t._isExitingRoom&&("CONNECTED"===e.prevState&&"DISCONNECTED"===e.state?t.emit("onConnectionLost"):"DISCONNECTED"===e.prevState&&"CONNECTING"===e.state?t.emit("onTryToReconnect"):"CONNECTING"===e.prevState&&"CONNECTED"===e.state&&t.emit("onConnectionRecovery"))})),this._trtc.on(e.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},p.prototype._removeTRTCEvents=function(){this._trtc.off("*")},p.prototype._emitVideoAvailable=function(t,i){var o=t.userId,r=t.streamType;i?this._remoteStreamMap.set("".concat(o,"_").concat(r),!0):this._remoteStreamMap.delete("".concat(o,"_").concat(r)),r===e.TYPE.STREAM_TYPE_SUB?o&&this.emit("onUserSubStreamAvailable",o,i):o&&this.emit("onUserVideoAvailable",o,i)},p.prototype._setLocalView=function(e){this._localView=e},p.prototype._getLocalView=function(){return this._localView},p.prototype._setIsMobile=function(e){this._isMobile=e},p.prototype._getIsMobile=function(){return this._isMobile},p.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},p.prototype._getIsFrontCamera=function(){return this._isFrontCamera},p.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},p.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},p.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},p.prototype._getIsVideoPublish=function(){return this._isVideoPublish},p.prototype._setVideoProfile=function(e){this._videoProfile=e},p.prototype._getVideoProfile=function(){return this._videoProfile},p.prototype._setQosPreference=function(e){this._qosPreference=e},p.prototype._getQosPreference=function(){return this._qosPreference},p.prototype._setLocalTestView=function(e){this._localTestView=e},p.prototype._getLocalTestView=function(){return this._localTestView},p.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;ve(t)||(this._screenShareParams.view=t),ve(i)||(this._screenShareParams.option.systemAudio=i),ve(o)||(this._screenShareParams.option.fillMode=o),ve(r)||(this._screenShareParams.option.profile=r),ve(n)||(this._screenShareParams.option.videoTrack=n),ve(s)||(this._screenShareParams.option.qosPreference=s),ve(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},p.prototype._clearScreenShareParams=function(){var e,t,i,o,r;(null===(e=this._screenShareParams)||void 0===e?void 0:e.view)&&delete this._screenShareParams.view,(null===(i=null===(t=this._screenShareParams)||void 0===t?void 0:t.option)||void 0===i?void 0:i.systemAudio)&&delete this._screenShareParams.option.systemAudio,(null===(r=null===(o=this._screenShareParams)||void 0===o?void 0:o.option)||void 0===r?void 0:r.videoTrack)&&delete this._screenShareParams.option.videoTrack},p.prototype._getScreenShareParams=function(){return this._screenShareParams},p.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},p.prototype._getIsAudioPublish=function(){return this._isAudioPublish},p.prototype._setAudioMuteType=function(e){this._audioMuteType=e},p.prototype._getAudioMuteType=function(){return this._audioMuteType},p.prototype._setAudioProfile=function(e){this._audioProfile=e},p.prototype._getAudioProfile=function(){return this._audioProfile},p.prototype._getCaptureVolume=function(){return this._captureVolume},p.prototype._setCaptureVolume=function(e){this._captureVolume=e},p.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},p.prototype._getCurrentCameraId=function(){return this._currentCameraId},p.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},p.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},p.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},p.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},p.prototype._setRemoteStreamConfig=function(e,t,i){var o=this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t)));o||(o={userId:e,streamType:this._getTRTCStreamType(t),option:{mirror:this._getTRTCRemoteMirror(y.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(T.TRTCVideoFillMode_Fit)}});var r=i.view,n=i.mirrorType,s=i.fillMode,a=i.small;ve(r)||(o.view=r),ve(n)||(o.option.mirror=this._getTRTCRemoteMirror(n)),ve(s)||(o.option.fillMode=this._getTRTCFillMode(s)),ve(a)||(o.option.small=a),this._remoteStreamConfig.set("".concat(e,"_").concat(this._getTRTCStreamType(t)),o)},p.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=a({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},p.prototype._inheritEventsToSubCloud=function(t){var i=this;t._trtc.on(e.EVENT.AUTOPLAY_FAILED,(function(e){i.emit("onAutoPlayFailed",e)})),t._trtc.on(e.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){i.emit("onPictureInPictureStateChanged",e)}))},p.prototype.handleDeviceChange=function(){return u(this,void 0,void 0,(function(){var t=this;return l(this,(function(i){return e.getCameraList().then((function(e){return u(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._cameraList.length===e.length?[2]:[4,this.deviceChangeManage(this._cameraList,e,M.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=e,[2]}}))}))})),e.getMicrophoneList().then((function(e){return u(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,e,M.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=e,[2]}}))}))})),e.getSpeakerList().then((function(e){return u(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,e,M.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=e,[2]}}))}))})),[2]}))}))},p.prototype.isSameDevice=function(e,t){var i=e&&e.deviceId&&e.groupId&&e.label,o=t&&t.deviceId&&t.groupId&&t.label;return!(!i||!o)&&(e.deviceId===t.deviceId&&e.groupId===t.groupId&&e.label===t.label)},p.prototype.deviceChangeManage=function(e,t,i){return u(this,void 0,void 0,(function(){var o,r,n,s,a;return l(this,(function(c){switch(c.label){case 0:return o=void 0,e.length!==t.length&&(r=(t||[]).map((function(e){return e.deviceId})),n=new E,e.length>t.length?(n=e.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=w.TRTCDeviceStateRemove):(r=(e||[]).map((function(e){return e.deviceId})),n=t.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=w.TRTCDeviceStateAdd),s=n.deviceId,this.emitOnDeviceChange(s,i,o)),a=this.getDefaultDeviceInfo(t),i!==M.TRTCDeviceTypeCamera||o!==w.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!==M.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!==M.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,8];case 7:c.sent(),c.label=8;case 8:c.label=9;case 9:return[2]}}))}))},p.prototype.getDefaultDeviceInfo=function(e){var t=new E;if(0===e.length)return t;var i=e.filter((function(e){return"default"===e.deviceId}));return t=i.length>0?i[0]:e[0]},p.prototype.autoChangeDevice=function(t,i){return u(this,void 0,void 0,(function(){var o,r,n;return l(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==M.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,w.TRTCDeviceStateActive),s.label=6;case 6:return t!==M.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,w.TRTCDeviceStateActive),s.label=12;case 12:return t!==M.TRTCDeviceTypeSpeaker?[3,14]:[4,e.setCurrentSpeaker(o)];case 13:s.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,w.TRTCDeviceStateActive),s.label=14;case 14:return[2]}}))}))},p.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},p.prototype.getMediaMixingManager=function(){return new Kn({logger:this.logger,trtc:this._trtc,trtcCloud:this})},p.prototype.getAITranscriberManager=function(){return new ts({logger:this.logger,trtc:this._trtc})},p.shareInstance=null,p.subCloudMap=new Map,p.enableSEI=!1,p.assetsPath="",c([(f="exitRoom",function(e,t,i){var o=i.value;return i.value=function(){for(var e,t,i,r,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];var a=[];return null===(t=null===(e=Xn.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return a.push(e)})),null===(i=$n.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=Zn.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),a.forEach((function(e){e.reject(new Error("aborted ".concat(f)))})),Xn.delete(this),$n.delete(this),Zn.delete(this),o.apply(this,n)},i})],p.prototype,"exitRoom",null),c([es((function(e){return e}))],p.prototype,"muteRemoteAudio",null),c([es((function(e){return e}))],p.prototype,"muteRemoteVideoStream",null),c([es((function(e){var t=e||{},i=t.quality,o=t.stream_list,r=void 0===o?[]:o,n=r.some((function(e){return e.name===i}));return i&&n?r.map((function(e){return e.user_id})):(console.warn("[QualitySwitch] Invalid params: target ".concat(i," not found in list")),[])}),{deduplicate:!0})],p.prototype,"_switchPlaybackQuality",null),p}(S);export{rs as AITranscriberListener,te as AudioMuteType,ns as IAITranscriberManager,In as ITRTCMediaMixingEvent,Vn as ITRTCMediaMixingManager,Ln as InteractionOption,Y as Rect,R as TRTCAppScene,C as TRTCAudioQuality,_ as TRTCBeautyStyle,X as TRTCCameraCaptureMode,ie as TRTCCameraCaptureParams,E as TRTCDeviceInfo,w as TRTCDeviceState,M as TRTCDeviceType,U as TRTCImageBuffer,N as TRTCLocalStatistics,W as TRTCLogLevel,An as TRTCMediaMixingEncParam,hn as TRTCMediaMixingErrorCode,pn as TRTCMediaMixingEvent,Pn as TRTCMediaSource,dn as TRTCMediaSourceType,J as TRTCMixInputType,$ as TRTCMixUser,Q as TRTCNetworkQosParam,P as TRTCParams,B as TRTCPublishCDNParam,k as TRTCQosControlMode,V as TRTCQuality,D as TRTCQualityInfo,F as TRTCRemoteStatistics,I as TRTCRenderParams,b as TRTCRoleType,ee as TRTCScreenCaptureProperty,G as TRTCScreenCaptureSourceInfo,j as TRTCScreenCaptureSourceType,H as TRTCStatistics,K as TRTCTranscodingConfig,q as TRTCTranscodingConfigMode,L as TRTCVideoEncParam,T as TRTCVideoFillMode,y as TRTCVideoMirrorType,O as TRTCVideoQosPreference,g as TRTCVideoResolution,x as TRTCVideoResolutionMode,A as TRTCVideoRotation,m as TRTCVideoStreamType,z as TRTCVolumeInfo,os as TranscriberMessage,is as TranscriberParams,ps as default};
1
+ import e from"trtc-sdk-v5";import{LEBPlayer as t}from"trtc-sdk-v5/plugins/lebplayer";import{VirtualBackground as i}from"trtc-sdk-v5/plugins/video-effect/virtual-background";import{BasicBeauty as o}from"trtc-sdk-v5/plugins/video-effect/basic-beauty";import{RealtimeTranscriber as r}from"trtc-sdk-v5/plugins/realtime-transcriber";import n from"trtc-sdk-v5/plugins/video-effect/video-mixer";var s=function(e,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},s(e,t)};var a=function(){return a=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function c(e,t,i,o){var r,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s}function u(e,t,i,o){return new(i||(i=Promise))((function(r,n){function s(e){try{c(o.next(e))}catch(t){n(t)}}function a(e){try{c(o.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function l(e,t){var i,o,r,n,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(a){return function(c){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;n&&(n=0,a[0]&&(s=0)),s;)try{if(i=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(c){a=[6,c],o=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function h(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],o=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t,i){if(i||2===arguments.length)for(var o,r=0,n=t.length;r<n;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function p(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=h(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=e[i]&&function(t){return new Promise((function(o,r){(function(e,t,i,o){Promise.resolve(o).then((function(t){e({value:t,done:i})}),t)})(o,r,(t=e[i](t)).done,t.value)}))}}}var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function v(e,t){return e(t={exports:{}},t.exports),t.exports}var g,m,T,y,_,R,b,C,S=v((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"}(g||(g={})),function(e){e[e.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",e[e.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",e[e.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub"}(m||(m={})),function(e){e[e.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",e[e.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit"}(T||(T={})),function(e){e[e.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",e[e.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",e[e.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable"}(y||(y={})),function(e){e[e.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",e[e.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature"}(_||(_={})),function(e){e[e.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",e[e.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",e[e.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",e[e.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom"}(R||(R={})),function(e){e[e.TRTCRoleAnchor=20]="TRTCRoleAnchor",e[e.TRTCRoleAudience=21]="TRTCRoleAudience"}(b||(b={})),function(e){e[e.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",e[e.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",e[e.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic"}(C||(C={}));var w,M,E=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"}(w||(w={})),function(e){e[e.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",e[e.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",e[e.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",e[e.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera"}(M||(M={}));var A,P=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=b.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=g.TRTCVideoResolution_640_360),void 0===t&&(t=x.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"}(A||(A={}));var V,I=function(e,t,i){void 0===e&&(e=A.TRTCVideoRotation0),void 0===t&&(t=T.TRTCVideoFillMode_Fit),void 0===i&&(i=y.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"}(V||(V={}));var x,O,k,D=function(e,t){void 0===e&&(e=""),void 0===t&&(t=V.TRTCQuality_Unknown),this.userId=e,this.quality=t},z=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},B=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},N=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=m.TRTCVideoStreamTypeBig),this.width=e,this.height=t,this.frameRate=i,this.videoBitrate=o,this.audioBitrate=n,this.streamType=s},F=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=m.TRTCVideoStreamTypeBig),this.userId=e,this.width=i,this.height=o,this.frameRate=r,this.videoBitrate=n,this.audioBitrate=a,this.streamType=p},H=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"}(x||(x={})),function(e){e[e.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",e[e.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear"}(O||(O={})),function(e){e[e.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",e[e.TRTCQosControlModeServer=1]="TRTCQosControlModeServer"}(k||(k={}));var W,j,Q=function(e,t){void 0===e&&(e=O.TRTCVideoQosPreferenceClear),void 0===t&&(t=k.TRTCQosControlModeServer),this.preference=e,this.controlMode=t},U=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"}(W||(W={})),function(e){e[e.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",e[e.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",e[e.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",e[e.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom"}(j||(j={}));var q,G=function(e,t,i,o,r,n){void 0===e&&(e=j.TRTCScreenCaptureSourceTypeUnknown),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=new U),void 0===r&&(r=new U),void 0===n&&(n=!1),this.type=e,this.sourceId=t,this.sourceName=i,this.thumbBGRA=o,this.iconBGRA=r,this.isMinimizeWindow=n},Y=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},K=function(e,t,i,o,r,n,s,a,c,u,l,h,d,p,f){void 0===e&&(e=q.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"}(q||(q={}));var J,X,$=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=m.TRTCVideoStreamTypeBig),void 0===s&&(s=J.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"}(J||(J={})),function(e){e[e.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",e[e.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",e[e.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",e[e.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual"}(X||(X={}));var Z,ee=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},te=void 0,ie=void 0,oe="onError",re="onWarning",ne="rtc",se="live",ae="VirtualBackground",ce="BasicBeauty",ue="blur",le="image",he={20:"anchor",21:"audience"},de={0:ne,1:se,2:ne,3:se};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(Z||(Z={}));var pe="enum";function fe(){return Math.floor(performance.now())}var ve=function(e){return void 0===e},ge=function(e){return"number"==typeof e},me=function(e){return"boolean"==typeof e};function Te(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 ye(e){return null==e}function _e(){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]=_e(e[i],t[i]):e[i]=t[i]})),e}),{})}function Re(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]=Re(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=Re(e[i]))}))):t=e,t)}var be,Ce,Se=function(e){return e&&e.Math===Math&&e},we=Se("object"==typeof globalThis&&globalThis)||Se("object"==typeof window&&window)||Se("object"==typeof self&&self)||Se("object"==typeof f&&f)||function(){return this}()||f||Function("return this")(),Me=function(e){try{return!!e()}catch(t){return!0}},Ee=!Me((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Ae=!Me((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Pe=Function.prototype.call,Le=Ae?Pe.bind(Pe):function(){return Pe.apply(Pe,arguments)},Ve={}.propertyIsEnumerable,Ie=Object.getOwnPropertyDescriptor,xe={f:Ie&&!Ve.call({1:2},1)?function(e){var t=Ie(this,e);return!!t&&t.enumerable}:Ve},Oe=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ke=Function.prototype,De=ke.call,ze=Ae&&ke.bind.bind(De,De),Be=Ae?ze:function(e){return function(){return De.apply(e,arguments)}},Ne=Be({}.toString),Fe=Be("".slice),He=function(e){return Fe(Ne(e),8,-1)},We=Object,je=Be("".split),Qe=Me((function(){return!We("z").propertyIsEnumerable(0)}))?function(e){return"String"===He(e)?je(e,""):We(e)}:We,Ue=function(e){return null==e},qe=TypeError,Ge=function(e){if(Ue(e))throw qe("Can't call method on "+e);return e},Ye=function(e){return Qe(Ge(e))},Ke="object"==typeof document&&document.all,Je={all:Ke,IS_HTMLDDA:void 0===Ke&&void 0!==Ke},Xe=Je.all,$e=Je.IS_HTMLDDA?function(e){return"function"==typeof e||e===Xe}:function(e){return"function"==typeof e},Ze=Je.all,et=Je.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:$e(e)||e===Ze}:function(e){return"object"==typeof e?null!==e:$e(e)},tt=function(e,t){return arguments.length<2?(i=we[e],$e(i)?i:void 0):we[e]&&we[e][t];var i},it=Be({}.isPrototypeOf),ot="undefined"!=typeof navigator&&String(navigator.userAgent)||"",rt=we.process,nt=we.Deno,st=rt&&rt.versions||nt&&nt.version,at=st&&st.v8;at&&(Ce=(be=at.split("."))[0]>0&&be[0]<4?1:+(be[0]+be[1])),!Ce&&ot&&(!(be=ot.match(/Edge\/(\d+)/))||be[1]>=74)&&(be=ot.match(/Chrome\/(\d+)/))&&(Ce=+be[1]);var ct=Ce,ut=we.String,lt=!!Object.getOwnPropertySymbols&&!Me((function(){var e=Symbol("symbol detection");return!ut(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ct&&ct<41})),ht=lt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,dt=Object,pt=ht?function(e){return"symbol"==typeof e}:function(e){var t=tt("Symbol");return $e(t)&&it(t.prototype,dt(e))},ft=String,vt=TypeError,gt=function(e){if($e(e))return e;throw vt(function(e){try{return ft(e)}catch(t){return"Object"}}(e)+" is not a function")},mt=function(e,t){var i=e[t];return Ue(i)?void 0:gt(i)},Tt=TypeError,yt=Object.defineProperty,_t=function(e,t){try{yt(we,e,{value:t,configurable:!0,writable:!0})}catch(i){we[e]=t}return t},Rt="__core-js_shared__",bt=we[Rt]||_t(Rt,{}),Ct=v((function(e){(e.exports=function(e,t){return bt[e]||(bt[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"})})),St=Object,wt=function(e){return St(Ge(e))},Mt=Be({}.hasOwnProperty),Et=Object.hasOwn||function(e,t){return Mt(wt(e),t)},At=0,Pt=Math.random(),Lt=Be(1..toString),Vt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Lt(++At+Pt,36)},It=we.Symbol,xt=Ct("wks"),Ot=ht?It.for||It:It&&It.withoutSetter||Vt,kt=function(e){return Et(xt,e)||(xt[e]=lt&&Et(It,e)?It[e]:Ot("Symbol."+e)),xt[e]},Dt=TypeError,zt=kt("toPrimitive"),Bt=function(e,t){if(!et(e)||pt(e))return e;var i,o=mt(e,zt);if(o){if(void 0===t&&(t="default"),i=Le(o,e,t),!et(i)||pt(i))return i;throw Dt("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&$e(i=e.toString)&&!et(o=Le(i,e)))return o;if($e(i=e.valueOf)&&!et(o=Le(i,e)))return o;if("string"!==t&&$e(i=e.toString)&&!et(o=Le(i,e)))return o;throw Tt("Can't convert object to primitive value")}(e,t)},Nt=function(e){var t=Bt(e,"string");return pt(t)?t:t+""},Ft=we.document,Ht=et(Ft)&&et(Ft.createElement),Wt=function(e){return Ht?Ft.createElement(e):{}},jt=!Ee&&!Me((function(){return 7!==Object.defineProperty(Wt("div"),"a",{get:function(){return 7}}).a})),Qt=Object.getOwnPropertyDescriptor,Ut={f:Ee?Qt:function(e,t){if(e=Ye(e),t=Nt(t),jt)try{return Qt(e,t)}catch(i){}if(Et(e,t))return Oe(!Le(xe.f,e,t),e[t])}},qt=Ee&&Me((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Gt=String,Yt=TypeError,Kt=function(e){if(et(e))return e;throw Yt(Gt(e)+" is not an object")},Jt=TypeError,Xt=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Zt="enumerable",ei="configurable",ti="writable",ii={f:Ee?qt?function(e,t,i){if(Kt(e),t=Nt(t),Kt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&ti in i&&!i[ti]){var o=$t(e,t);o&&o[ti]&&(e[t]=i.value,i={configurable:ei in i?i[ei]:o[ei],enumerable:Zt in i?i[Zt]:o[Zt],writable:!1})}return Xt(e,t,i)}:Xt:function(e,t,i){if(Kt(e),t=Nt(t),Kt(i),jt)try{return Xt(e,t,i)}catch(o){}if("get"in i||"set"in i)throw Jt("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},oi=Ee?function(e,t,i){return ii.f(e,t,Oe(1,i))}:function(e,t,i){return e[t]=i,e},ri=Function.prototype,ni=Ee&&Object.getOwnPropertyDescriptor,si=Et(ri,"name"),ai={EXISTS:si,PROPER:si&&"something"===function(){}.name,CONFIGURABLE:si&&(!Ee||Ee&&ni(ri,"name").configurable)},ci=Be(Function.toString);$e(bt.inspectSource)||(bt.inspectSource=function(e){return ci(e)});var ui,li,hi,di=bt.inspectSource,pi=we.WeakMap,fi=$e(pi)&&/native code/.test(String(pi)),vi=Ct("keys"),gi=function(e){return vi[e]||(vi[e]=Vt(e))},mi={},Ti="Object already initialized",yi=we.TypeError,_i=we.WeakMap;if(fi||bt.state){var Ri=bt.state||(bt.state=new _i);Ri.get=Ri.get,Ri.has=Ri.has,Ri.set=Ri.set,ui=function(e,t){if(Ri.has(e))throw yi(Ti);return t.facade=e,Ri.set(e,t),t},li=function(e){return Ri.get(e)||{}},hi=function(e){return Ri.has(e)}}else{var bi=gi("state");mi[bi]=!0,ui=function(e,t){if(Et(e,bi))throw yi(Ti);return t.facade=e,oi(e,bi,t),t},li=function(e){return Et(e,bi)?e[bi]:{}},hi=function(e){return Et(e,bi)}}var Ci={set:ui,get:li,has:hi,enforce:function(e){return hi(e)?li(e):ui(e,{})},getterFor:function(e){return function(t){var i;if(!et(t)||(i=li(t)).type!==e)throw yi("Incompatible receiver, "+e+" required");return i}}},Si=v((function(e){var t=ai.CONFIGURABLE,i=Ci.enforce,o=Ci.get,r=String,n=Object.defineProperty,s=Be("".slice),a=Be("".replace),c=Be([].join),u=Ee&&!Me((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),(!Et(e,"name")||t&&e.name!==o)&&(Ee?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&h&&Et(h,"arity")&&e.length!==h.arity&&n(e,"length",{value:h.arity});try{h&&Et(h,"constructor")&&h.constructor?Ee&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var d=i(e);return Et(d,"source")||(d.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=h((function(){return $e(this)&&o(this).source||di(this)}),"toString")})),wi=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if($e(i)&&Si(i,n,o),o.global)r?e[t]=i:_t(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:ii.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Mi=Math.ceil,Ei=Math.floor,Ai=Math.trunc||function(e){var t=+e;return(t>0?Ei:Mi)(t)},Pi=function(e){var t=+e;return t!=t||0===t?0:Ai(t)},Li=Math.max,Vi=Math.min,Ii=Math.min,xi=function(e){return e>0?Ii(Pi(e),9007199254740991):0},Oi=function(e){return xi(e.length)},ki=function(e){return function(t,i,o){var r,n=Ye(t),s=Oi(n),a=function(e,t){var i=Pi(e);return i<0?Li(i+t,0):Vi(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}},Di={includes:ki(!0),indexOf:ki(!1)}.indexOf,zi=Be([].push),Bi=function(e,t){var i,o=Ye(e),r=0,n=[];for(i in o)!Et(mi,i)&&Et(o,i)&&zi(n,i);for(;t.length>r;)Et(o,i=t[r++])&&(~Di(n,i)||zi(n,i));return n},Ni=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Fi=Ni.concat("length","prototype"),Hi={f:Object.getOwnPropertyNames||function(e){return Bi(e,Fi)}},Wi={f:Object.getOwnPropertySymbols},ji=Be([].concat),Qi=tt("Reflect","ownKeys")||function(e){var t=Hi.f(Kt(e)),i=Wi.f;return i?ji(t,i(e)):t},Ui=function(e,t,i){for(var o=Qi(t),r=ii.f,n=Ut.f,s=0;s<o.length;s++){var a=o[s];Et(e,a)||i&&Et(i,a)||r(e,a,n(t,a))}},qi=/#|\.prototype\./,Gi=function(e,t){var i=Ki[Yi(e)];return i===Xi||i!==Ji&&($e(t)?Me(t):!!t)},Yi=Gi.normalize=function(e){return String(e).replace(qi,".").toLowerCase()},Ki=Gi.data={},Ji=Gi.NATIVE="N",Xi=Gi.POLYFILL="P",$i=Gi,Zi=Ut.f,eo=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?we:u?we[a]||_t(a,{}):(we[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=Zi(i,o))&&s.value:i[o],!$i(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Ui(n,r)}(e.sham||r&&r.sham)&&oi(n,"sham",!0),wi(i,o,n,e)}},to={};to[kt("toStringTag")]="z";var io,oo="[object z]"===String(to),ro=kt("toStringTag"),no=Object,so="Arguments"===He(function(){return arguments}()),ao=oo?He: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=no(e),ro))?i:so?He(t):"Object"===(o=He(t))&&$e(t.callee)?"Arguments":o},co=String,uo=function(e){if("Symbol"===ao(e))throw TypeError("Cannot convert a Symbol value to a string");return co(e)},lo=function(){var e=Kt(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},ho=we.RegExp,po=Me((function(){var e=ho("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),fo=po||Me((function(){return!ho("a","y").sticky})),vo={BROKEN_CARET:po||Me((function(){var e=ho("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:fo,UNSUPPORTED_Y:po},go=Object.keys||function(e){return Bi(e,Ni)},mo=Ee&&!qt?Object.defineProperties:function(e,t){Kt(e);for(var i,o=Ye(t),r=go(t),n=r.length,s=0;n>s;)ii.f(e,i=r[s++],o[i]);return e},To={f:mo},yo=tt("document","documentElement"),_o="prototype",Ro="script",bo=gi("IE_PROTO"),Co=function(){},So=function(e){return"<"+Ro+">"+e+"</"+Ro+">"},wo=function(e){e.write(So("")),e.close();var t=e.parentWindow.Object;return e=null,t},Mo=function(){try{io=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Mo="undefined"!=typeof document?document.domain&&io?wo(io):(t=Wt("iframe"),i="java"+Ro+":",t.style.display="none",yo.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(So("document.F=Object")),e.close(),e.F):wo(io);for(var o=Ni.length;o--;)delete Mo[_o][Ni[o]];return Mo()};mi[bo]=!0;var Eo,Ao,Po=Object.create||function(e,t){var i;return null!==e?(Co[_o]=Kt(e),i=new Co,Co[_o]=null,i[bo]=e):i=Mo(),void 0===t?i:To.f(i,t)},Lo=we.RegExp,Vo=Me((function(){var e=Lo(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Io=we.RegExp,xo=Me((function(){var e=Io("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Oo=Ci.get,ko=Ct("native-string-replace",String.prototype.replace),Do=RegExp.prototype.exec,zo=Do,Bo=Be("".charAt),No=Be("".indexOf),Fo=Be("".replace),Ho=Be("".slice),Wo=(Ao=/b*/g,Le(Do,Eo=/a/,"a"),Le(Do,Ao,"a"),0!==Eo.lastIndex||0!==Ao.lastIndex),jo=vo.BROKEN_CARET,Qo=void 0!==/()??/.exec("")[1];(Wo||Qo||jo||Vo||xo)&&(zo=function(e){var t,i,o,r,n,s,a,c=this,u=Oo(c),l=uo(e),h=u.raw;if(h)return h.lastIndex=c.lastIndex,t=Le(zo,h,l),c.lastIndex=h.lastIndex,t;var d=u.groups,p=jo&&c.sticky,f=Le(lo,c),v=c.source,g=0,m=l;if(p&&(f=Fo(f,"y",""),-1===No(f,"g")&&(f+="g"),m=Ho(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Bo(l,c.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,g++),i=new RegExp("^(?:"+v+")",f)),Qo&&(i=new RegExp("^"+v+"$(?!\\s)",f)),Wo&&(o=c.lastIndex),r=Le(Do,p?i:c,m),p?r?(r.input=Ho(r.input,g),r[0]=Ho(r[0],g),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Wo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),Qo&&r&&r.length>1&&Le(ko,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=Po(null),n=0;n<d.length;n++)s[(a=d[n])[0]]=r[a[1]];return r});var Uo=zo;eo({target:"RegExp",proto:!0,forced:/./.exec!==Uo},{exec:Uo});var qo="\t\n\v\f\r                 \u2028\u2029\ufeff",Go=Be("".replace),Yo=RegExp("^["+qo+"]+"),Ko=RegExp("(^|[^"+qo+"])["+qo+"]+$"),Jo=function(e){return function(t){var i=uo(Ge(t));return 1&e&&(i=Go(i,Yo,"")),2&e&&(i=Go(i,Ko,"$1")),i}},Xo={start:Jo(1),end:Jo(2),trim:Jo(3)}.trim,$o=Be("".charAt),Zo=we.parseFloat,er=we.Symbol,tr=er&&er.iterator,ir=1/Zo(qo+"-0")!=-Infinity||tr&&!Me((function(){Zo(Object(tr))}))?function(e){var t=Xo(uo(e)),i=Zo(t);return 0===i&&"-"===$o(t,0)?-0:i}:Zo;eo({global:!0,forced:parseFloat!==ir},{parseFloat:ir});var or=function(e){if("Function"===He(e))return Be(e)},rr=kt("species"),nr=RegExp.prototype,sr=Be("".charAt),ar=Be("".charCodeAt),cr=Be("".slice),ur=function(e){return function(t,i){var o,r,n=uo(Ge(t)),s=Pi(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=ar(n,s))<55296||o>56319||s+1===a||(r=ar(n,s+1))<56320||r>57343?e?sr(n,s):o:e?cr(n,s,s+2):r-56320+(o-55296<<10)+65536}},lr={codeAt:ur(!1),charAt:ur(!0)}.charAt,hr=function(e,t,i){return t+(i?lr(e,t).length:1)},dr=TypeError,pr=function(e,t){var i=e.exec;if($e(i)){var o=Le(i,e,t);return null!==o&&Kt(o),o}if("RegExp"===He(e))return Le(Uo,e,t);throw dr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=kt(e),n=!Me((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Me((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[rr]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=or(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=or(e),c=t.exec;return c===Uo||c===nr.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));wi(String.prototype,e,c[0]),wi(nr,r,c[1])}o&&oi(nr[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Ge(this),o=Ue(t)?void 0:mt(t,e);return o?Le(o,t,i):new RegExp(t)[e](uo(i))},function(e){var o=Kt(this),r=uo(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return pr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=pr(o,r));){var l=uo(a[0]);c[u]=l,""===l&&(o.lastIndex=hr(r,xi(o.lastIndex),s)),u++}return 0===u?null:c}]}));var fr=Array.isArray||function(e){return"Array"===He(e)},vr=TypeError,gr=function(e){if(e>9007199254740991)throw vr("Maximum allowed index exceeded");return e},mr=function(e,t,i){var o=Nt(t);o in e?ii.f(e,o,Oe(0,i)):e[o]=i},Tr=function(){},yr=[],_r=tt("Reflect","construct"),Rr=/^\s*(?:class|function)\b/,br=Be(Rr.exec),Cr=!Rr.exec(Tr),Sr=function(e){if(!$e(e))return!1;try{return _r(Tr,yr,e),!0}catch(t){return!1}},wr=function(e){if(!$e(e))return!1;switch(ao(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Cr||!!br(Rr,di(e))}catch(t){return!0}};wr.sham=!0;var Mr,Er=!_r||Me((function(){var e;return Sr(Sr.call)||!Sr(Object)||!Sr((function(){e=!0}))||e}))?wr:Sr,Ar=kt("species"),Pr=Array,Lr=function(e,t){return new(function(e){var t;return fr(e)&&(t=e.constructor,(Er(t)&&(t===Pr||fr(t.prototype))||et(t)&&null===(t=t[Ar]))&&(t=void 0)),void 0===t?Pr:t}(e))(0===t?0:t)},Vr=kt("species"),Ir=kt("isConcatSpreadable"),xr=ct>=51||!Me((function(){var e=[];return e[Ir]=!1,e.concat()[0]!==e})),Or=function(e){if(!et(e))return!1;var t=e[Ir];return void 0!==t?!!t:fr(e)};eo({target:"Array",proto:!0,arity:1,forced:!(xr&&(Mr="concat",ct>=51||!Me((function(){var e=[];return(e.constructor={})[Vr]=function(){return{foo:1}},1!==e[Mr](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=wt(this),a=Lr(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Or(n=-1===t?s:arguments[t]))for(r=Oi(n),gr(c+r),i=0;i<r;i++,c++)i in n&&mr(a,c,n[i]);else gr(c+1),mr(a,c++,n);return a.length=c,a}});var kr=window.navigator&&window.navigator.userAgent||"",Dr=/AppleWebKit\/([\d.]+)/i.exec(kr);Dr&&parseFloat(Dr.pop());var zr=/iPad/i.test(kr),Br=/iPhone/i.test(kr)&&!zr,Nr=/iPod/i.test(kr),Fr=Br||zr||Nr,Hr=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(kr);Fr&&function(){var e=kr.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var Wr=/Android/i.test(kr);Wr&&function(){var e=kr.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]))}();Wr&&/webkit/i.test(kr),/Firefox/i.test(kr)&&function(){var e=kr.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var jr=/Edge\//i.test(kr);jr&&function(){var e=kr.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var Qr=/Edg\//i.test(kr);Qr&&function(){var e=kr.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Ur=/SogouMobileBrowser\//i.test(kr);Ur&&function(){var e=kr.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var qr=/MetaSr\s/i.test(kr);qr&&function(){var e=kr.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Gr=/TBS\/\d+/i.test(kr);Gr&&function(){var e=kr.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Yr=/XWEB\/\d+/i.test(kr);Yr&&function(){var e=kr.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(kr),/MSIE\/\d+/i.test(kr)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(kr),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(kr)&&/rv:11.0/.test(kr)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(kr)&&function(){var e=kr.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var Kr=!Gr&&/MQQBrowser\/\d+/i.test(kr)&&/COVC\/\d+/i.test(kr),Jr=!Gr&&/MQQBrowser\/\d+/i.test(kr)&&!/COVC\/\d+/i.test(kr);(Jr||Kr)&&function(){var e=kr.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Xr=!Gr&&/ QQBrowser\/\d+/i.test(kr);Xr&&function(){var e=kr.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var $r=!Gr&&/QQBrowserLite\/\d+/i.test(kr);$r&&function(){var e=kr.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var Zr=!Gr&&/MQBHD\/\d+/i.test(kr);Zr&&function(){var e=kr.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(kr),!Fr&&/MAC OS X/i.test(kr),!Wr&&/Linux/i.test(kr),/MicroMessenger/i.test(kr),/UCBrowser/i.test(kr),/Electron/i.test(kr);var en=/MiuiBrowser/i.test(kr);en&&function(){var e=kr.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var tn=/HuaweiBrowser/i.test(kr);/Huawei/i.test(kr),tn&&function(){var e=kr.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var on=/SamsungBrowser/i.test(kr);on&&function(){var e=kr.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var rn=/HeyTapBrowser/i.test(kr);rn&&function(){var e=kr.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var nn=/VivoBrowser/i.test(kr);nn&&function(){var e=kr.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var sn,an,cn,un=/Chrome/i.test(kr),ln=!jr&&!qr&&!Ur&&!Gr&&!Yr&&!Qr&&!Xr&&!en&&!tn&&!on&&!rn&&!nn&&/Chrome/i.test(kr);ln&&function(){var e=kr.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),ln&&function(){var e=kr.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!un&&!Jr&&!Kr&&!$r&&!Zr&&/Safari/i.test(kr)&&function(){var e=kr.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"}(sn||(sn={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(an||(an={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(cn||(cn={}));var hn,dn,pn,fn=-3340,vn=-1301,gn=-1314,mn=-1315,Tn=-1316,yn=-1302,_n=-1317,Rn=-1318,bn=-1319,Cn=-70252,Sn={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},wn={code:-1005,message:"not supported"},Mn="2.11.2";!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"}(hn||(hn={})),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"}(dn||(dn={})),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"}(pn||(pn={}));var En,An=void 0,Pn=void 0,Ln=void 0,Vn=void 0,In=void 0,xn=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}(),On=new xn(null),kn=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"):On.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 On.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)):On.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 On.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){On.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",On.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"}(En||(En={}));var Dn="trtc-resizable-top-left-anchor",zn="trtc-resizable-top-anchor",Bn="trtc-resizable-top-right-anchor",Nn="trtc-resizable-left-anchor",Fn="trtc-resizable-right-anchor",Hn="trtc-resizable-bottom-left-anchor",Wn="trtc-resizable-bottom-anchor",jn="trtc-resizable-bottom-right-anchor",Qn={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 Un(e,t){for(var i in t)e.style[i]=t[i]}var qn=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:En.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:En.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||En.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(Dn),Un(c,Object.assign({},Qn.resizeAnchor,Qn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(zn),Un(u,Object.assign({},Qn.resizeAnchor,Qn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(Bn),Un(l,Object.assign({},Qn.resizeAnchor,Qn.topRightAnchor)),this.topRightAnchor=l;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(Nn),Un(h,Object.assign({},Qn.resizeAnchor,Qn.leftAnchor)),this.leftAnchor=h;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(Fn),Un(d,Object.assign({},Qn.resizeAnchor,Qn.rightAnchor)),this.rightAnchor=d;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(Hn),Un(p,Object.assign({},Qn.resizeAnchor,Qn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(Wn),Un(f,Object.assign({},Qn.resizeAnchor,Qn.bottomAnchor)),this.bottomAnchor=f;var v=document.createElement("div");v.className="trtc-resizable-resize-anchor ".concat(jn),Un(v,Object.assign({},Qn.resizeAnchor,Qn.bottomRightAnchor)),this.bottomRightAnchor=v,this.options.anchorMode!==En.Both&&this.options.anchorMode!==En.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!==En.Both&&this.options.anchorMode!==En.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,On.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else On.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 Dn: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 zn: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 Bn: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 Nn: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 Fn: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 Hn: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 Wn: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 On.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 On.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 On.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!==En.Both&&this.options.anchorMode!==En.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!==En.Both&&this.options.anchorMode!==En.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}(),Gn=function(){var e=new Map;for(var t in g)if(isNaN(Number(t))){var i=g[t],o=t.split("_");e.set(i,{width:parseInt(o[1]),height:parseInt(o[2])})}return e}(),Yn=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,Gn.has(e.videoResolution)){var t=Gn.get(e.videoResolution),i=t.width,o=t.height;this.resMode===x.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=i,this.mixingVideoHeight=o):(this.mixingVideoWidth=o,this.mixingVideoHeight=i)}this.updatePreviewProperty(),this.canExceedContainer=e.canExceedContainer||!1,this.eventEmitter=new S,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(!ye(e.videoResolution)||!ye(e.resMode)){if(this.resMode=ye(e.resMode)?this.resMode:e.resMode,e.videoResolution&&Gn.has(e.videoResolution)){var t=Gn.get(e.videoResolution),i=t.width,o=t.height;this.resMode===x.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 kn(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 qn(this.moveAndResizeOverlay,this.container,{keepRatio:!0,stopPropagation:!0,canExceedContainer:this.canExceedContainer,anchorMode:0}),this.resizableHandler.on("resize",this.onResize)},e.prototype.updateCanExceedContainer=function(e){this.movableHandler&&(this.movableHandler.options.canExceedContainer=e),this.resizableHandler&&(this.resizableHandler.options.canExceedContainer=e)},e.prototype.initContainerMouseEventHander=function(){this.container?(this.onContainerMousedown=this.onContainerMousedown.bind(this),this.onContainerMousemove=this.onContainerMousemove.bind(this),this.onContainerMouseup=this.onContainerMouseup.bind(this),document.addEventListener("mousedown",this.onContainerMousedown,!1),this.onRightButtonClicked=this.onRightButtonClicked.bind(this),this.container.addEventListener("contextmenu",this.onRightButtonClicked,!1)):this.logger.error("".concat(this.logPrefix,"initContainerMouseEventHander failed, no container view"))},e.prototype.initContainerResizeObserver=function(){this.container&&(this.onPreviewAreaResize=this.onPreviewAreaResize.bind(this),this.resizeObserver=new ResizeObserver(this.onPreviewAreaResize),this.resizeObserver.observe(this.container))},e.prototype.onPreviewAreaResize=function(e){for(var t=0,i=e;t<i.length;t++){if(i[t].target===this.container){this.updatePreviewProperty(),this.updateOverlay();break}}},e.prototype.updatePreviewProperty=function(){if(this.container){var e=this.container.offsetWidth,t=this.container.offsetHeight,i=e/this.mixingVideoWidth,o=t/this.mixingVideoHeight;this.previewScale=i>o?i:o,this.previewWidth=this.mixingVideoWidth*this.previewScale,this.previewHeight=this.mixingVideoHeight*this.previewScale,this.previewLeft=(e-this.previewWidth)/2,this.previewTop=(t-this.previewHeight)/2}else console.debug("".concat(this.logPrefix,"calcPreviewScale failed, no HTML element to display"))},e.prototype.updateOverlay=function(){if(this.moveAndResizeOverlay){var e=void 0,t=void 0,i=void 0,o=void 0;if(this.selectedMediaIndex>=0){var r=this.mediaList[this.selectedMediaIndex],n={left:r.rect.left*this.previewScale,top:r.rect.top*this.previewScale,right:r.rect.right*this.previewScale,bottom:r.rect.bottom*this.previewScale};e="".concat(n.left+this.previewLeft,"px"),t="".concat(n.top+this.previewTop,"px"),i="".concat(n.right-n.left,"px"),o="".concat(n.bottom-n.top,"px");var s=r.interaction||{},a=!1!==s.showBorder,c=!1!==s.showResizeAnchors,u=!1!==s.draggable,l=!1!==s.canExceedCanvas;this.logger.debug("".concat(this.logPrefix,"updateOverlay: interaction config -"),{showBorder:a,showResizeAnchors:c,draggable:u,canExceedCanvas:l}),this.updateCanExceedContainer(l),this.moveAndResizeOverlay.style.display="block",this.moveAndResizeOverlay.style.border=a?"1px solid #3D7EFD":"none",this.resizableHandler&&this.resizableHandler.setVisible(c),this.movableHandler&&(this.logger.debug("".concat(this.logPrefix,"updateOverlay: setting movableHandler.setEnabled(").concat(u,")")),this.movableHandler.setEnabled(u))}else e="".concat(this.previewLeft,"px"),t="".concat(this.previewTop,"px"),i="0px",o="0px",this.moveAndResizeOverlay.style.display="none";this.moveAndResizeOverlay.style.left=e,this.moveAndResizeOverlay.style.top=t,this.moveAndResizeOverlay.style.width=i,this.moveAndResizeOverlay.style.height=o}},e.prototype.onMove=function(e,t){var i;console.debug("".concat(this.logPrefix,"onMove: ").concat(e," ").concat(t));var o=this.mediaList[this.selectedMediaIndex];if(o&&this.moveAndResizeOverlay){var r={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+this.moveAndResizeOverlay.offsetWidth,bottom:t-this.previewTop+this.moveAndResizeOverlay.offsetHeight};this.doAdsorption(r);var n={left:Math.round(r.left/this.previewScale),top:Math.round(r.top/this.previewScale),right:Math.round(r.right/this.previewScale),bottom:Math.round(r.bottom/this.previewScale)};null===(i=this.eventEmitter)||void 0===i||i.emit("onSourceMoved",a({},o),n)}else console.debug("".concat(this.logPrefix,"onMove no selected media"))},e.prototype.doAdsorption=function(e){var t=this.BOUNDARY_ADSORPTION_THRESHOLD;Math.abs(e.left)<t&&(e.right=e.right-e.left,e.left=0),Math.abs(e.top)<t&&(e.bottom=e.bottom-e.top,e.top=0),Math.abs(e.right-this.previewWidth)<t&&(e.left=e.left+this.previewWidth-e.right,e.right=this.previewWidth),Math.abs(e.bottom-this.previewHeight)<t&&(e.top=e.top+this.previewHeight-e.bottom,e.bottom=this.previewHeight)},e.prototype.onResize=function(e,t,i,o){var r;console.debug("".concat(this.logPrefix,"onResize: ").concat(e," ").concat(t," ").concat(i," ").concat(o));var n=this.mediaList[this.selectedMediaIndex];if(n){var s=n.interaction||{};if(!ve(s.showResizeAnchors)&&!s.showResizeAnchors)return;var c={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+i,bottom:t-this.previewTop+o},u={left:Math.round(c.left/this.previewScale),top:Math.round(c.top/this.previewScale),right:Math.round(c.right/this.previewScale),bottom:Math.round(c.bottom/this.previewScale)};null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",a({},n),u)}else console.debug("".concat(this.logPrefix,"onResize no selected media"))},e.prototype.getMaxZOrderMedia=function(e){var t,i,o,r,n,s;if(0===e.length)return null;for(var a=e[0],c=null!==(o=null===(i=null===(t=a.origin)||void 0===t?void 0:t.layout)||void 0===i?void 0:i.zOrder)&&void 0!==o?o:-Infinity,u=1;u<e.length;u++){var l=null!==(s=null===(n=null===(r=e[u].origin)||void 0===r?void 0:r.layout)||void 0===n?void 0:n.zOrder)&&void 0!==s?s:-Infinity;l>c&&(c=l,a=e[u])}return a},e.prototype.emitOnSelect=function(e){var t;if(e){for(var i=this.mediaList.length,o=0;o<i;o++)if(e.id===this.mediaList[o].id){this.selectedMediaIndex=o;break}}else this.selectedMediaIndex=-1;this.updateOverlay(),null===(t=this.eventEmitter)||void 0===t||t.emit("onSourceSelected",e?a({},e):null)},e.prototype.onContainerMousedown=function(e){var t;console.debug("".concat(this.logPrefix,"onContainerMousedown event:"),e,e.target,e.currentTarget);var i=e.target;if(this.eventButton=e.button,i&&this.container){if(this.container.contains(i)){console.debug("".concat(this.logPrefix,"onContainerMousedown mix video image clicked"));var o=this.container.getBoundingClientRect(),r=e.clientX-o.x-this.previewLeft,n=e.clientY-o.y-this.previewTop,s=r/this.previewScale,a=n/this.previewScale;console.debug("".concat(this.logPrefix,"onContainerMousedown click point coordinates in mix video:"),r,n,s,a);for(var c=0;c<this.mediaList.length;c++){var u=this.mediaList[c];u.rect&&s>=u.rect.left&&s<=u.rect.right&&a>=u.rect.top&&a<=u.rect.bottom&&!1!==(null===(t=u.interaction)||void 0===t?void 0:t.selectable)&&(this.clickedMediaSources.push(u),this.mediaList[this.selectedMediaIndex]&&u.id===this.mediaList[this.selectedMediaIndex].id&&(this.oldSelectedIndex=this.clickedMediaSources.length-1))}this.mousedownLeft=e.screenX,this.mousedownTop=e.screenY}this.clickedMediaSources.length>0?2===this.eventButton&&-1===this.oldSelectedIndex?(this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMousedown find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected),this.clickedMediaSources.splice(0,this.clickedMediaSources.length)):(document.addEventListener("mousemove",this.onContainerMousemove,!1),document.addEventListener("mouseup",this.onContainerMouseup,!1)):(this.newSelected=null,console.debug("".concat(this.logPrefix,"onContainerMousedown find clicked media source:"),this.newSelected),this.emitOnSelect(null),this.mousedownLeft=null,this.mousedownTop=null,this.eventButton=null)}},e.prototype.onContainerMousemove=function(e){var t;if(e.target&&this.container&&null!==this.mousedownLeft&&null!==this.mousedownTop){var i=e.screenX-this.mousedownLeft,o=e.screenY-this.mousedownTop;(Math.abs(i)>=5||Math.abs(o)>=5)&&(this.oldSelectedIndex>=0?(console.debug("".concat(this.logPrefix,"onContainerMousemove move or resize old selected media source, clear data:"),this.clickedMediaSources,this.oldSelectedIndex),this.clickedMediaSources.splice(0,this.clickedMediaSources.length),this.oldSelectedIndex=-1):this.clickedMediaSources.length>0&&(this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMousemove find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected),this.clickedMediaSources.splice(0,this.clickedMediaSources.length),null===(t=this.moveAndResizeOverlay)||void 0===t||t.dispatchEvent(new MouseEvent("mousedown",{screenX:this.mousedownLeft,screenY:this.mousedownTop,button:this.eventButton}))))}},e.prototype.onContainerMouseup=function(e){if(document.removeEventListener("mousemove",this.onContainerMousemove,!1),document.removeEventListener("mouseup",this.onContainerMouseup,!1),console.debug("".concat(this.logPrefix,"onContainerMouseup data:"),this.clickedMediaSources,this.oldSelectedIndex),e.target&&this.container){if(this.clickedMediaSources.length>0)if(this.oldSelectedIndex>=0){if(0===this.eventButton){var t=(this.oldSelectedIndex+1)%this.clickedMediaSources.length;this.newSelected=this.clickedMediaSources[t],console.debug("".concat(this.logPrefix,"onContainerMouseup find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected)}}else this.newSelected=this.getMaxZOrderMedia(this.clickedMediaSources),console.debug("".concat(this.logPrefix,"onContainerMouseup find clicked media source:"),this.newSelected),this.emitOnSelect(this.newSelected)}else console.debug("".concat(this.logPrefix,"onContainerMouseup click outside of mixing video image")),this.emitOnSelect(null);this.mousedownLeft=null,this.mousedownTop=null,this.clickedMediaSources.splice(0,this.clickedMediaSources.length),this.oldSelectedIndex=-1,this.newSelected=null,this.eventButton=null},e.prototype.onRightButtonClicked=function(e){var t;console.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e.target,e.currentTarget,e.buttons),e.preventDefault(),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",a({},this.mediaList[this.selectedMediaIndex]))},e}(),Kn=function(){function t(e){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new S,this.publishParams={videoEncoderParams:{videoResolution:g.TRTCVideoResolution_1280_720,resMode:x.TRTCVideoResolutionModeLandscape,videoFps:15,videoBitrate:1800},canvasColor:0},this.mediaMixingDesigner=null,this.sourceList=[],this.trtcSourceMap=new Map,this.mixVideoTrack=null,this.selectedSource=null,this.view=null,this.screensWithSystemAudio=new Set,t.mediaMixingManager)return t.mediaMixingManager;t.mediaMixingManager=this,this.logger=e.logger,this.trtc=e.trtc,this.trtcCloud=e.trtcCloud,this.onSourceSelected=this.onSourceSelected.bind(this),this.onSourceMoved=this.onSourceMoved.bind(this),this.onSourceResized=this.onSourceResized.bind(this),this.onRightButtonClicked=this.onRightButtonClicked.bind(this)}return t.prototype.destroy=function(){return u(this,void 0,Promise,(function(){var e,i,o,r,n;return l(this,(function(s){switch(s.label){case 0:this.view=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.trtc.stopPlugin("VideoMixer")];case 2:return s.sent(),[3,4];case 3:return e=s.sent(),this.logger.error("".concat(this.logPrefix," destroy and stopPlugin error:"),e),[3,4];case 4:if(!(this.screensWithSystemAudio.size>0))return[3,12];s.label=5;case 5:s.trys.push([5,10,,11]),i=0,o=Array.from(this.screensWithSystemAudio),s.label=6;case 6:return i<o.length?(r=o[i],[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(r)})]):[3,9];case 7:s.sent(),s.label=8;case 8:return i++,[3,6];case 9:return[3,11];case 10:return n=s.sent(),this.logger.error("".concat(this.logPrefix," destroy and stopPlugin AudioMixer error:"),n),[3,11];case 11:this.screensWithSystemAudio.clear(),s.label=12;case 12:return this.destroyDesigner(),this.eventEmitter=null,t.mediaMixingManager=null,[2]}}))}))},t.prototype.bindPreviewArea=function(e){return u(this,void 0,Promise,(function(){var t,i,o,r,n=this;return l(this,(function(s){switch(s.label){case 0:return this.logger.log("".concat(this.logPrefix," bindPreviewArea:"),e),this.view=e,t=this._getCanvasSize(this.publishParams.videoEncoderParams.videoResolution,this.publishParams.videoEncoderParams.resMode),i=t.width,o=t.height,[4,this.trtc.startPlugin("VideoMixer",{view:e,canvasInfo:{width:i,height:o,canvasColor:String(this.publishParams.canvasColor)},onScreenShareStop:function(e){var t,i=n.sourceList.find((function(t){return t.id===e}));n.removeMediaSource(i),null===(t=n.eventEmitter)||void 0===t||t.emit("onSourceDisconnected",i||null)}})];case 1:return r=s.sent(),console.log("startPlugin result",r,r.track),this.mixVideoTrack=r.track,this.createDesigner(),[2]}}))}))},t.prototype._getTRTCSourceKey=function(e){var t;return((t={})[dn.kCamera]="camera",t[dn.kScreen]="screen",t[dn.kText]="text",t[dn.kVideo]="video",t[dn.kImage]="image",t)[e.type]},t.prototype._getTRTCFillMode=function(e){var t;return((t={})[T.TRTCVideoFillMode_Fill]="cover",t[T.TRTCVideoFillMode_Fit]="contain",t)[e]},t.prototype._getTRTCVideoProfile=function(e,t){var i,o,r,n=null!==(o=((i={})[g.TRTCVideoResolution_480_270]={width:480,height:270},i[g.TRTCVideoResolution_640_360]={width:640,height:360},i[g.TRTCVideoResolution_960_540]={width:960,height:540},i[g.TRTCVideoResolution_1280_720]={width:1280,height:720},i[g.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(ve(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)),ve(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)),!ve(null===(p=e.layout)||void 0===p?void 0:p.mirror)){var T=((t={})[y.TRTCVideoMirrorType_Auto]=!0,t[y.TRTCVideoMirrorType_Enable]=!0,t[y.TRTCVideoMirrorType_Disable]=!1,t);m.mirror=T[null===(f=e.layout)||void 0===f?void 0:f.mirror]}if(!ve(null===(v=e.layout)||void 0===v?void 0:v.rotation)){var _=((i={})[A.TRTCVideoRotation0]=0,i[A.TRTCVideoRotation90]=90,i[A.TRTCVideoRotation180]=180,i[A.TRTCVideoRotation270]=270,i);m.rotation=_[null===(g=e.layout)||void 0===g?void 0:g.rotation]}return m},t.prototype._getTRTCSourceItem=function(e){var t,i,o,r,n,s,c,u,l,h;switch(e.type){case dn.kScreen:return h=g.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 dn.kCamera:return h=g.TRTCVideoResolution_1280_720,(null==e?void 0:e.useInternalTrack)?{id:e.id,layout:this._getTRTCLayout(e),useInternalTrack:!0}:{id:e.id,cameraId:null===(r=e.camera)||void 0===r?void 0:r.cameraId,profile:this._getTRTCVideoProfile((null===(n=e.camera)||void 0===n?void 0:n.resolution)||h,(null===(s=e.camera)||void 0===s?void 0:s.fps)||15),videoTrack:null===(c=e.camera)||void 0===c?void 0:c.videoTrack,layout:this._getTRTCLayout(e)};case dn.kText:return a(a({id:e.id},e.text||{}),{layout:this._getTRTCLayout(e)});case dn.kImage:return{id:e.id,url:null===(u=e.image)||void 0===u?void 0:u.url,layout:this._getTRTCLayout(e)};case dn.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={})[g.TRTCVideoResolution_480_270]={width:480,height:270},i[g.TRTCVideoResolution_640_360]={width:640,height:360},i[g.TRTCVideoResolution_960_540]={width:960,height:540},i[g.TRTCVideoResolution_1280_720]={width:1280,height:720},i[g.TRTCVideoResolution_1920_1080]={width:1920,height:1080},i)[e],n=r.width,s=r.height;return t===x.TRTCVideoResolutionModePortrait&&(n=(o=[s,n])[0],s=o[1]),{width:n,height:s}},t.prototype.addMediaSource=function(e){var t;return u(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:if(-1!==this.findMediaSourceIndex(e))throw new Error("Media source already existed");if(i=Re(e),o=this._getTRTCSourceKey(i),!(r=this._getTRTCSourceItem(i))||!o)throw new Error("Invalid media source");return(n=Re(this.trtcSourceMap.get(o))||[]).push(r),[4,this.trtc.updatePlugin("VideoMixer",(h={},h[o]=n,h))];case 1:return s=l.sent(),a=s.result,c=s.systemAudioTrackList,e.type===dn.kScreen&&(null==c?void 0:c[e.id])?(this.screensWithSystemAudio.add(e.id),u=null==c?void 0:c[e.id],this.logger.log("".concat(this.logPrefix," startPlugin AudioMixer, track ID:"),u.id),[4,this.trtc.startPlugin("AudioMixer",{id:"systemAudioTrack_".concat(e.id),track:u})]):[3,3];case 2:l.sent(),l.label=3;case 3:if(a.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to add media source");return i.isSelected&&(this.unselectMediaSource(this.selectedSource),this.selectedSource=e),this.trtcSourceMap.set(o,n),null===(t=this.mediaMixingDesigner)||void 0===t||t.addMedia({id:i.id,rect:this._getDesignerMediaRect(e),isSelected:!!ve(i.isSelected)||i.isSelected,origin:i,interaction:i.interaction}),i.isSelected&&(this.selectedSource=i),this.sourceList.push(i),[2]}}))}))},t.prototype.removeMediaSource=function(e){var t,i,o;return u(this,void 0,Promise,(function(){var r,n,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:if(this.logger.log("".concat(this.logPrefix,"removeMediaSource:"),e),-1===(r=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to remove");return n=this._getTRTCSourceKey(e),s=Re(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===dn.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:Re(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 A.TRTCVideoRotation0:case A.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case A.TRTCVideoRotation90:case A.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 A.TRTCVideoRotation0:case A.TRTCVideoRotation180:return{left:r,top:n,right:s,bottom:a};case A.TRTCVideoRotation90:case A.TRTCVideoRotation270:return{left:r,top:n,right:r+(a-n),bottom:n+(s-r)};default:return{left:r,top:n,right:s,bottom:a}}},t.prototype.updateMediaSource=function(e){var t,i;return u(this,void 0,Promise,(function(){var o,r,n,s,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:if(this.logger.log("".concat(this.logPrefix,"updateMediaSource:"),e),-1===(o=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to update");return r=a(a({},this.sourceList[o]),Re(e)),e.isSelected?(this.unselectMediaSource(this.selectedSource),this.selectedSource=e):(null===(t=this.selectedSource)||void 0===t?void 0:t.id)===e.id&&(this.selectedSource=null),n=this._getTRTCSourceKey(r),s=this._getTRTCSourceItem(r),c=Re(this.trtcSourceMap.get(n))||[],u=c.findIndex((function(t){return t.id===e.id})),c[u]=s,[4,this.trtc.updatePlugin("VideoMixer",(d={},d[n]=c,d))];case 1:if(l.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return h={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:Re(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(h)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(h),this.trtcSourceMap.set(n,c),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(){return u(this,void 0,Promise,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," startPublish")),[4,this.trtcCloud._startPublishVideoTrack({videoTrack:this.mixVideoTrack})];case 1:return e.sent(),[2]}}))}))},t.prototype.stopPublish=function(){return u(this,void 0,Promise,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.log("".concat(this.logPrefix," stopPublish")),[4,this.trtcCloud._stopPublishVideoTrack()];case 1:return e.sent(),[2]}}))}))},t.prototype.updatePublishParams=function(t){var i,o,r,n,s;return u(this,void 0,Promise,(function(){var a,c,u,h,d,f,v,g,m,T,y,_,R,b,C,S,w,M,E,A,P,L,V,I;return l(this,(function(l){switch(l.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),t),a=this.publishParams,this.publishParams=t,c=this._getCanvasSize(t.videoEncoderParams.videoResolution,t.videoEncoderParams.resMode),u=c.width,h=c.height,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:u,height:h,canvasColor:String(t.canvasColor)}})];case 2:return l.sent(),[3,4];case 3:if((d=l.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw d;return[3,4];case 4:null===(r=this.mediaMixingDesigner)||void 0===r||r.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),l.label=5;case 5:l.trys.push([5,11,12,17]),f=p(this.sourceList),l.label=6;case 6:return[4,f.next()];case 7:return(v=l.sent()).done?[3,10]:(g=v.value).layout?(m=g.layout.rect||{left:0,top:0,right:0,bottom:0},T=m.left,y=m.top,_=m.right,R=m.bottom,b=this._getCanvasSize(a.videoEncoderParams.videoResolution),C=b.width,S=b.height,w=this._getCanvasSize(t.videoEncoderParams.videoResolution),M=w.width,E=w.height,A=T*M/C,P=y*E/S,L=_*M/C,V=R*E/S,g.layout.rect={left:A,top:P,right:L,bottom:V},[4,this.updateMediaSource(g)]):[3,9];case 8:l.sent(),null===(n=this.eventEmitter)||void 0===n||n.emit("onSourceResized",g,null===(s=g.layout)||void 0===s?void 0:s.rect),l.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return I=l.sent(),i={error:I},[3,17];case 12:return l.trys.push([12,,15,16]),v&&!v.done&&(o=f.return)?[4,o.call(f)]:[3,14];case 13:l.sent(),l.label=14;case 14:return[3,16];case 15:if(i)throw i.error;return[7];case 16:return[7];case 17:return[4,this.trtcCloud.setVideoEncoderParam(t.videoEncoderParams)];case 18:return l.sent(),[2]}}))}))},t.prototype.on=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.on(e,t)},t.prototype.off=function(e,t){var i;null===(i=this.eventEmitter)||void 0===i||i.off(e,t)},t.prototype.onVisibilityChange=function(){this.logger.log("".concat(this.logPrefix,"onVisibilityChange document.hidden:").concat(document.hidden)),document.hidden?this.bindPreviewArea(null):this.bindPreviewArea(this.view)},t.prototype.createDesigner=function(){var e,t;this.view&&(this.mediaMixingDesigner=new Yn({view:this.view,videoResolution:(null===(e=this.publishParams)||void 0===e?void 0:e.videoEncoderParams.videoResolution)||g.TRTCVideoResolution_1920_1080,resMode:(null===(t=this.publishParams)||void 0===t?void 0:t.videoEncoderParams.resMode)||x.TRTCVideoResolutionModeLandscape,canExceedContainer:!0,logger:this.logger}),this.listenDesignerEvent())},t.prototype.destroyDesigner=function(){var e;this.mediaMixingDesigner&&(this.unlistenDesignerEvent(),null===(e=this.mediaMixingDesigner)||void 0===e||e.destroy(),this.mediaMixingDesigner=null)},t.prototype.listenDesignerEvent=function(){var e,t,i,o,r;null===(e=this.mediaMixingDesigner)||void 0===e||e.on("onError",this.onError),null===(t=this.mediaMixingDesigner)||void 0===t||t.on("onSourceSelected",this.onSourceSelected),null===(i=this.mediaMixingDesigner)||void 0===i||i.on("onSourceMoved",this.onSourceMoved),null===(o=this.mediaMixingDesigner)||void 0===o||o.on("onSourceResized",this.onSourceResized),null===(r=this.mediaMixingDesigner)||void 0===r||r.on("onRightButtonClicked",this.onRightButtonClicked)},t.prototype.unlistenDesignerEvent=function(){var e,t,i,o,r;null===(e=this.mediaMixingDesigner)||void 0===e||e.off("onError",this.onError),null===(t=this.mediaMixingDesigner)||void 0===t||t.off("onSourceSelected",this.onSourceSelected),null===(i=this.mediaMixingDesigner)||void 0===i||i.off("onSourceMoved",this.onSourceMoved),null===(o=this.mediaMixingDesigner)||void 0===o||o.off("onSourceResized",this.onSourceResized),null===(r=this.mediaMixingDesigner)||void 0===r||r.off("onRightButtonClicked",this.onRightButtonClicked)},t.prototype.onError=function(e,t){this.logger.log("".concat(this.logPrefix,"onError:"),e,t)},t.prototype.onSourceSelected=function(e){var t;return u(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return this.logger.debug("".concat(this.logPrefix,"onSourceSelected: "),e,this.selectedSource),e&&this.selectedSource&&e.origin.id===this.selectedSource.id?[2]:(null==e?void 0:e.origin)?(this.updateMediaSource(a(a({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(a(a({},this.selectedSource),{isSelected:!1}))]:[3,3];case 2:i.sent(),this.selectedSource=null,i.label=3;case 3:return null===(t=this.eventEmitter)||void 0===t||t.emit("onSourceSelected",e?e.origin:null),[2]}}))}))},t.prototype.onSourceMoved=function(e,t){var i,o;if(this.logger.debug("".concat(this.logPrefix,"onSourceMoved:"),e,t),null==e?void 0:e.origin){var r=a(a({},e.origin),{layout:a(a({},e.origin.layout),{rect:t})});this.updateMediaSource(_e(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id}))),null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceMoved",e.origin,this._getPluginMediaRect(r))}},t.prototype.onSourceResized=function(e,t){var i,o;if(this.logger.debug("".concat(this.logPrefix,"onSourceResized:"),e,t),null==e?void 0:e.origin){var r=a(a({},e.origin),{layout:a(a({},e.origin.layout),{rect:t})});this.updateMediaSource(_e(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id})))}null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceResized",e.origin,t)},t.prototype.onRightButtonClicked=function(e){var t;this.logger.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",e.origin)},t.prototype.isSameMediaSource=function(e,t){return e.id===t.id},t.prototype.isMediaSourceExisted=function(e){var t=this;return this.sourceList.some((function(i){return t.isSameMediaSource(i,e)}))},t.prototype.findMediaSourceIndex=function(e){return this.sourceList.findIndex((function(t){return t.id===e.id}))},t.prototype.unselectMediaSource=function(e){var t,i;return u(this,void 0,Promise,(function(){var o;return l(this,(function(r){return e?(-1!==(o=this.findMediaSourceIndex(e))&&(this.sourceList[o].isSelected=!1),null===(t=this.mediaMixingDesigner)||void 0===t||t.updateMedia({id:e.id,rect:null===(i=e.layout)||void 0===i?void 0:i.rect,isSelected:!1,origin:Re(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}(),Jn=function(){function e(){this.isRunning=!1,this.queue=[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastQueueItem",{get:function(){return 0===this.length?null:this.queue[this.length-1]},enumerable:!1,configurable:!0}),e.prototype.push=function(e,t,i,o){var r,n;void 0===t&&(t=!1),void 0===i&&(i=!1);var s=a(a({},e),{functionName:o}),c=new Promise((function(e,t){s.resolve=e,s.reject=t}));if(s.promise=c,t)this.length<=1?this.queue.push(s):null===(n=null===(r=this.lastQueueItem)||void 0===r?void 0:r.promise)||void 0===n||n.then(s.resolve,s.reject);else{if(i&&o&&this.queue.length>1){var u=[];this.queue=this.queue.filter((function(e,t){return 0===t||(e.functionName!==o||(u.push(e),!1))})),u.forEach((function(e){e.reject(new Error("aborted by newer task"))}))}this.queue.push(s)}return this.isRunning||this.callNext(),c},e.prototype.shift=function(){return this.queue.shift()},e.prototype.callNext=function(){var e=this;if(!this.isRunning&&0!==this.length){var t=this.queue[0],i=t.fn,o=t.args,r=t.context,n=t.resolve,s=t.reject;this.isRunning=!0,i.apply(r,o).then(n,s).finally((function(){e.isRunning=!1,e.shift(),e.callNext()}))}},e}(),Xn=new WeakMap,$n=new WeakMap,Zn=new WeakMap;function es(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=Zn.get(this)||new Map;Zn.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 Jn,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 ts=function(){function t(e){var t=this;this.logPrefix="[AITranscriberManager]",this.listeners=new Set,this.isPaused=!1,this.isMessageListenerRegistered=!1,this.handleMessageEvent=function(e){var i=t.createMessageFromEvent(e);t._notifyListeners("onReceiveTranscriberMessage",e.roomId,i)},this.handleStateEvent=function(e){var i=e.transcriberRobotId,o=e.state,r=e.roomId,n=e.sourceLanguage,s=void 0===n?"":n,a=e.error,c=e.errorMessage,u=void 0===c?"":c;if(r&&i){if("started"===o)t._notifyListeners("onRealtimeTranscriberStarted",r,i,s);else if("stopped"===o){t._notifyListeners("onRealtimeTranscriberStopped",r,i,0)}null!=a&&t._notifyListeners("onRealtimeTranscriberError",r,i,a,u)}},this.logger=e.logger,this.trtc=e.trtc,this.registerStateListener()}return t.prototype.registerStateListener=function(){this.trtc.on(e.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},t.prototype.createMessageFromEvent=function(e){var t,i,o,r;return{segmentId:null!==(t=null==e?void 0:e.segmentId)&&void 0!==t?t:"",speakerUserId:null!==(i=null==e?void 0:e.speakerUserId)&&void 0!==i?i:"",sourceText:null!==(o=null==e?void 0:e.sourceText)&&void 0!==o?o:"",translationTexts:(null==e?void 0:e.translationTexts)?new Map(Object.entries(e.translationTexts)):void 0,timestamp:null!==(r=null==e?void 0:e.timestamp)&&void 0!==r?r:Date.now(),isCompleted:Boolean(null==e?void 0:e.isCompleted)}},t.prototype.updateMessageSubscription=function(){var t=!this.isPaused&&this.listeners.size>0;if(t&&!this.isMessageListenerRegistered)return this.trtc.on(e.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),void(this.isMessageListenerRegistered=!0);!t&&this.isMessageListenerRegistered&&(this.trtc.off(e.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),this.isMessageListenerRegistered=!1)},t.prototype.log=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.log)||void 0===t||t.call.apply(t,d([e,this.logPrefix],i,!1))},t.prototype.logError=function(){for(var e,t,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null===(t=null===(e=this.logger)||void 0===e?void 0:e.error)||void 0===t||t.call.apply(t,d([e,this.logPrefix],i,!1))},t.prototype._notifyListeners=function(e){for(var t=this,i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];this.listeners.forEach((function(o){var r=o[e];if("function"==typeof r)try{r.apply(o,i)}catch(n){t.logError("Error notifying listener:",n)}}))},t.prototype.startRealtimeTranscriber=function(e){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:if(this.log("startRealtimeTranscriber:",e),!(null==e?void 0:e.sourceLanguage))throw new Error("sourceLanguage is required");t={sourceLanguage:e.sourceLanguage},e.transcriberRobotId&&(t.transcriberRobotId=e.transcriberRobotId),void 0!==e.userIdsToTranscribe&&(t.userIdsToTranscribe=e.userIdsToTranscribe),void 0!==e.translationLanguages&&(t.translationLanguages=e.translationLanguages),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.trtc.startPlugin("RealtimeTranscriber",t)];case 2:return i=r.sent(),this.log("startRealtimeTranscriber success, robotId:",i),[2,i];case 3:throw o=r.sent(),this.logError("startRealtimeTranscriber error:",o),o;case 4:return[2]}}))}))},t.prototype.stopRealtimeTranscriber=function(e){return u(this,void 0,Promise,(function(){var t;return l(this,(function(i){switch(i.label){case 0:if(this.log("stopRealtimeTranscriber:",e),!e)throw new Error("transcriberRobotId is required");i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.trtc.stopPlugin("RealtimeTranscriber",{transcriberRobotId:e})];case 2:return i.sent(),this.log("stopRealtimeTranscriber success"),[3,4];case 3:throw t=i.sent(),this.logError("stopRealtimeTranscriber error:",t),t;case 4:return[2]}}))}))},t.prototype.pauseReceivingMessage=function(){this.isPaused||(this.log("pauseReceivingMessage"),this.isPaused=!0,this.updateMessageSubscription())},t.prototype.resumeReceivingMessage=function(){this.isPaused&&(this.log("resumeReceivingMessage"),this.isPaused=!1,this.updateMessageSubscription())},t.prototype.addListener=function(e){this.listeners.add(e),this.updateMessageSubscription()},t.prototype.removeListener=function(e){this.log("removeListener"),this.listeners.delete(e),this.updateMessageSubscription()},t.prototype.destroy=function(){this.log("destroy"),this.listeners.clear(),this.isPaused=!0,this.updateMessageSubscription(),this.trtc.off(e.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},t}(),is=void 0,os=void 0,rs=void 0,ns=void 0,ss=e._loggerManager;ss.info("TRTCCloud Version: ".concat(Mn));var as,cs,us,ls="trtcCloud",hs=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(as=function(){0!==ds.size&&Array.from(ds.values()).forEach((function(e){e.fn()}))},cs=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];us>0&&clearTimeout(us),us=window.setTimeout((function(){as.apply(e,t),us=-1}),cs)}));var ds=new Map,ps=function(h){function p(i){void 0===i&&(i={});var o=h.call(this)||this;o._version="",o._frameWorkType=30,o._component=0,o._language=0,o._networkProxy={},o._localView=null,o._autoRecvAudio=!0,o._autoRecvVideo=!1,o._localTestView=null,o._isVideoPublish=!0,o._localRenderParams={rotation:A.TRTCVideoRotation0,fillMode:T.TRTCVideoFillMode_Fill,mirrorType:y.TRTCVideoMirrorType_Auto},o._encoderMirror=void 0,o._videoProfile={},o._isAudioPublish=!0,o._audioMuteType=!1,o._audioProfile=e.TYPE.AUDIO_PROFILE_STANDARD,o._captureVolume=100,o._playoutVolume=100,o._isSharingScreen=!1,o._remoteStreamConfig=new Map,o._remoteStreamMap=new Map,o._cameraList=[],o._microphoneList=[],o._speakerList=[],o._currentCamera={},o._currentMicrophone={},o._currentSpeaker={},o._currentCameraId="",o._currentMicrophoneId="",o._currentSpeakerId="",o._screenShareParams={option:{}},o._isMobile=Hr,o._isFrontCamera=!0,o._cameraVideoTrack=null,o._smallStreamVideoProfile=void 0,o._qosPreference=void 0,o._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},o._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},o._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},o._isVirtualBackground=!1,o._isTestVirtualBackground=!1,o._isBeautyEnabled=!1,o._isTestBeautyEnabled=!1,o._remoteStatisticsUserIdList=[],o._hasJoinedRoom=!1,o._isExitingRoom=!1,o._version=Mn;var s=i.frameWorkType,a=void 0===s?30:s,c=i.component,u=void 0===c?0:c,l=i.language,d=void 0===l?0:l;return o._frameWorkType=a,o._component=u,o._language=d,o._trtc=e.create({enableSEI:p.enableSEI,assetsPath:p.assetsPath,enableVolumeControlInIOS:!0,plugins:[n,t,r]}),o._testTrtc=e.create(),o._log=e._loggerManager,o.logger=new xn(ss,{seq:hs++}),o._echoCancellation=void 0,o._noiseSuppression=void 0,o._autoGainControl=void 0,o._addTRTCEvents(),o.handleDeviceChange=o.handleDeviceChange.bind(o),ds.set(o,{fn:o.handleDeviceChange,self:o}),o}var f;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(p,h),p.getPlugin=function(e){return"VirtualBackground"===e?i:"BasicBeauty"===e?o:"VideoMixer"===e?n:null},p.getTRTCShareInstance=function(e){return p.shareInstance||(p.shareInstance=new p(e)),p.shareInstance},p.setLogLevel=function(t,i){var o,r=((o={})[W.TRTCLogLevelVerbose]=0,o[W.TRTCLogLevelDebug]=1,o[W.TRTCLogLevelInfo]=2,o[W.TRTCLogLevelWarn]=3,o[W.TRTCLogLevelError]=4,o[W.TRTCLogLevelFatal]=4,o[W.TRTCLogLevelNone]=5,o),n=r[t];ve(n)&&(n=r[W.TRTCLogLevelInfo]);var s=!me(i)||i;e.setLogLevel(n,s)},p.destroyTRTCShareInstance=function(){p.shareInstance&&(p.shareInstance._destroy(),p.shareInstance=null),Array.from(p.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},p.callExperimentalAPI=function(e){console.log("static ".concat(ls,".callExperimentalAPI"),e);var t=Te(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":p.enableSEI=o.enable;break;case"setAssetsPath":p.assetsPath=o.assetsPath}}catch(r){throw r}}},p.prototype.createSubCloud=function(){if(this!==p.shareInstance)return null;var e=new p;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),p.subCloudMap.set(e,e),e},p.prototype.destroy=function(){this!==p.shareInstance?(p.subCloudMap.get(this)&&p.subCloudMap.delete(this),this._destroy()):p.destroyTRTCShareInstance()},p.prototype._destroy=function(){ds.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},p.prototype.getSDKVersion=function(){return this._version||""},p.prototype.enterRoom=function(e,t){return u(this,void 0,Promise,(function(){var i,o,r,n,s,c,u,h,d,p,f,v,g,m,T,y,_,R;return l(this,(function(l){switch(l.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,c=e.role,u=e.privateMapKey,h=e.businessInfo,d=e.enableAutoPlayDialog,p=e.proxy,f=e.streamId,v=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(ls,".enterRoom with params: "),e,t),p&&(this._networkProxy=p),!(i&&o&&r))return[3,5];l.label=1;case 1:return l.trys.push([1,3,,4]),g={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:he[c],scene:de[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},g=u?a(a({},g),{privateMapKey:u}):g,g=h?a(a({},g),{businessInfo:h}):g,m=d||this._enableAutoPlayDialog,g=me(m)?a(a({},g),{enableAutoPlayDialog:m}):g,g=this._networkProxy?a(a({},g),{proxy:this._networkProxy}):g,g=f?a(a({},g),{streamId:f}):g,g=v?a(a({},g),{userDefineRecordId:v}):g,g=void 0!==this._latencyLevel?a(a({},g),{latencyLevel:this._latencyLevel}):g,T=fe(),[4,this._trtc.enterRoom(g)];case 2:return l.sent(),this._hasJoinedRoom=!0,y=fe()-T,this.emit("onEnterRoom",y),[3,4];case 3:return _=l.sent(),R=(R=this._transformTRTCErrorCode(_,"enterRoom"))<0?R:-1,this.emit("onEnterRoom",R),this._callFunctionErrorManage(_,"enterRoom"),[3,4];case 4:return[3,6];case 5:this._emitError(Sn),l.label=6;case 6:return[2]}}))}))},p.prototype.exitRoom=function(){return u(this,void 0,Promise,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(ls,".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",cn.exitRoom),[3,3];case 2:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,3];case 3:return[2]}}))}))},p.prototype.switchRole=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(he[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(he[e])),[3,4];case 3:return t=i.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),[3,4];case 4:return[2]}}))}))},p.prototype.setDefaultStreamRecvMode=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(i){return this.logger.info("".concat(ls,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),me(e)&&(this._autoRecvAudio=e),me(t)&&(this._autoRecvVideo=t),[2]}))}))},p.prototype.resetTRTCCloud=function(){this._setIsAudioPublish(!0),this._setAudioMuteType(!1),this._echoCancellation=void 0,this._noiseSuppression=void 0,this._autoGainControl=void 0,this._isVirtualBackground=!1,this._isTestVirtualBackground=!1,this._remoteStatisticsUserIdList=[],this._resetBeautyStyle()},p.prototype._updateLocalVideo=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateLocalTestVideo=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateLocalScreen=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateRemoteVideo=function(t,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:if(!this._hasJoinedRoom||this._isExitingRoom)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(t,i))];case 2:return r.sent(),[3,4];case 3:if((o=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw o;return[3,4];case 4:return[2]}}))}))},p.prototype.startLocalPreview=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return u(this,void 0,Promise,(function(){var i,o,r,n,s;return l(this,(function(a){switch(a.label){case 0:this.logger.info("".concat(ls,".startLocalPreview with params: "),t),1===d([],t,!0).length?o=d([],t,!0)[0]:2===d([],t,!0).length&&(s=d([],t,!0),i=s[0],o=s[1]),ve(i)||(this._setIsMobile(!0),this._setIsFrontCamera(i)),this._setLocalView(o),a.label=1;case 1:a.trys.push([1,9,,10]),a.label=2;case 2:return a.trys.push([2,4,,8]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return a.sent(),[3,8];case 4:return(r=a.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return a.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return this.emit("onCameraDidReady"),[3,10];case 9:return n=a.sent(),this._callFunctionErrorManage(n,"startLocalPreview"),[3,10];case 10:return[2]}}))}))},p.prototype.updateLocalView=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(ls,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},p.prototype.stopLocalPreview=function(){return u(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ls,".stopLocalPreview")),t.label=1;case 1:return t.trys.push([1,3,,4]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 2:return t.sent(),this.emit("onCameraStopped"),[3,4];case 3:return e=t.sent(),console.warn("".concat(ls," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},p.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".muteLocalVideo with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),[3,4];case 4:return[2]}}))}))},p.prototype.startRemoteView=function(t,i,o){return u(this,void 0,void 0,(function(){var r,n;return l(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(ls,".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===m.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(o))))return[2];s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,o))];case 3:return s.sent(),[3,8];case 4:return(r=s.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateRemoteVideo(t,o)];case 5:return s.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return[3,10];case 9:return n=s.sent(),this._callFunctionErrorManage(n,"startRemoteView"),[3,10];case 10:return[2]}}))}))},p.prototype.updateRemoteView=function(e,t,i){return u(this,void 0,void 0,(function(){return l(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(ls,".updateRemoteView with params: "),e,t,i),this._setRemoteStreamConfig(e,i,{view:t}),this._remoteStreamMap.get("".concat(e,"_").concat(this._getTRTCStreamType(i)))?[4,this._updateRemoteVideo(e,i)]:[2];case 1:return o.sent(),[2]}}))}))},p.prototype.stopRemoteView=function(e,t){return u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".stopRemoteView with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"stopRemoteView"),[3,4];case 4:return[2]}}))}))},p.prototype.stopAllRemoteView=function(){return u(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ls,".stopAllRemoteView")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),[3,4];case 4:return[2]}}))}))},p.prototype.setVideoEncoderParam=function(e){return u(this,void 0,void 0,(function(){var t,i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".setVideoEncoderParam with params: "),e),o.label=1;case 1:return o.trys.push([1,4,,5]),t=this._getTRTCVideoProfile(m.TRTCVideoStreamTypeBig,e),this._setVideoProfile(t),[4,this._updateLocalVideo()];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),[3,5];case 4:return i=o.sent(),this._callFunctionErrorManage(i,"setVideoEncoderParam"),[3,5];case 5:return[2]}}))}))},p.prototype.setNetworkQosParam=function(e){return u(this,void 0,void 0,(function(){var t,i,o=this;return l(this,(function(r){return this.logger.info("".concat(ls,".setNetworkQosParam with params: "),e),t=e.preference,i=this._getTRTCQosPreference(t),this._setQosPreference(i),this._setScreenShareParams({qosPreference:i}),[2,new Promise((function(e,t){Promise.all([o._updateLocalVideo(),o._updateLocalScreen()]).then((function(){e(!0)})).catch((function(e){o._callFunctionErrorManage(e,"setNetworkQosParam"),t(e)}))}))]}))}))},p.prototype.setLocalRenderParams=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return t=i.sent(),this._callFunctionErrorManage(t,"setLocalRenderParams"),[3,5];case 5:return[2]}}))}))},p.prototype.setVideoEncoderMirror=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".setVideoEncoderMirror with params: "),e),this._encoderMirror=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setVideoEncoderMirror"),[3,4];case 4:return[2]}}))}))},p.prototype.setRemoteRenderParams=function(e,t,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".setRemoteRenderParams with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,i),[4,this._updateRemoteVideo(e,t)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),[3,4];case 4:return[2]}}))}))},p.prototype._updateLocalAudio=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype._updateLocalTestAudio=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return i.sent(),[3,3];case 2:if((t=i.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw t;return[3,3];case 3:return[2]}}))}))},p.prototype.startLocalAudio=function(t){return void 0===t&&(t=C.TRTCAudioQualityDefault),u(this,void 0,void 0,(function(){var i,o,r;return l(this,(function(n){switch(n.label){case 0:t===C.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(ls,".startLocalAudio with params: "),t),i=this._getTRTCAudioQuality(t),n.label=1;case 1:n.trys.push([1,9,,10]),this._setAudioProfile(i),n.label=2;case 2:return n.trys.push([2,4,,8]),[4,this._trtc.startLocalAudio(this._generateLocalAudioData())];case 3:return n.sent(),[3,8];case 4:return(o=n.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalAudio()];case 5:return n.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return this.emit("onMicDidReady"),[3,10];case 9:return r=n.sent(),console.warn("".concat(ls," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),[3,10];case 10:return[2]}}))}))},p.prototype.stopLocalAudio=function(){return u(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ls,".stopLocalAudio")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopLocalAudio()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),[3,4];case 4:return[2]}}))}))},p.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".muteLocalAudio with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setAudioMuteType(!!e&&"microphone"),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),[3,4];case 4:return[2]}}))}))},p.prototype.setAudioCaptureVolume=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".setAudioCaptureVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setCaptureVolume(e),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setAudioCaptureVolume"),[3,4];case 4:return[2]}}))}))},p.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(ls,".getAudioCaptureVolume")),this._getCaptureVolume()},p.prototype.setAudioPlayoutVolume=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".setAudioPlayoutVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._playoutVolume=e,[4,this._trtc.setRemoteAudioVolume("*",e)];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setAudioPlayoutVolume"),[3,4];case 4:return[2]}}))}))},p.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(ls,".getAudioPlayoutVolume")),this._playoutVolume},p.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".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(Sn),[2]);case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},p.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(ls,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},p.prototype.muteRemoteVideoStream=function(e,t,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".muteRemoteVideoStream with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo({userId:e,mute:t,streamType:this._getTRTCStreamType(i)})];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"muteRemoteVideoStream"),[3,4];case 4:return[2]}}))}))},p.prototype.muteAllRemoteVideoStreams=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ls,".muteAllRemoteVideoStreams with params: "),e),i.label=1;case 1:return i.trys.push([1,6,,7]),e?[4,this._trtc.callExperimentalAPI("pauseRemotePlayer",{userId:"*"})]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this._trtc.callExperimentalAPI("resumeRemotePlayer",{userId:"*"})];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:return t=i.sent(),this._callFunctionErrorManage(t,"muteAllRemoteVideoStreams"),[3,7];case 7:return[2]}}))}))},p.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(ls,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){this._callFunctionErrorManage(i,"setRemoteAudioVolume")}},p.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(ls,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},p.prototype.enableSmallVideoStream=function(e,t){return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(ls,".enableSmallVideoStream with params: "),e,t),e?(i=this._getTRTCVideoProfile(m.TRTCVideoStreamTypeSmall,t),this._setSmallStreamVideoProfile(i)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return o.sent(),[2]}}))}))},p.prototype.snapshotVideo=function(e,t){var i="";return i=""===e&&t===m.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===e&&t===m.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(t)}):this._trtc.getVideoSnapshot({userId:e,streamType:this._getTRTCStreamType(t)}),this.emit("onSnapshotComplete",e,t,i),i},p.prototype.startScreenShare=function(t,i,o){return u(this,void 0,void 0,(function(){var r,n,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:this.logger.info("".concat(ls,".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(m.TRTCVideoStreamTypeSub,o),this._setScreenShareParams({view:t,profile:c,systemAudio:s,videoTrack:a,streamType:i}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return l.sent(),this._isSharingScreen=!0,this.emit("onScreenCaptureStarted"),[3,4];case 3:if((u=l.sent()).code!==e.ERROR_CODE.OPERATION_ABORT)throw console.error("Start share screen error:",u,u.code,u.name,u.message),u;return[3,4];case 4:return[2]}}))}))},p.prototype.setSubStreamEncoderParam=function(e){return u(this,void 0,void 0,(function(){var t,i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".setSubStreamEncoderParam with params: "),e),t=this._getTRTCVideoProfile(m.TRTCVideoStreamTypeSub,e),this._setScreenShareParams({profile:t}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._updateLocalScreen()];case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"setSubStreamEncoderParam"),[3,4];case 4:return[2]}}))}))},p.prototype.stopScreenShare=function(){return u(this,void 0,Promise,(function(){var e;return l(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ls,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._clearScreenShareParams(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",0),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),[3,4];case 4:return[2]}}))}))},p.prototype._startPublishVideoTrack=function(t){var i=t.videoTrack;return u(this,void 0,void 0,(function(){var t,o;return l(this,(function(r){switch(r.label){case 0:r.trys.push([0,7,,8]),r.label=1;case 1:return r.trys.push([1,3,,6]),[4,this._trtc.startLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 2:return r.sent(),[3,6];case 3:return(t=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._trtc.updateLocalVideo({option:{videoTrack:i,profile:this._getVideoProfile()},forcePublish:!0})];case 4:r.sent(),r.label=5;case 5:throw t;case 6:return[3,8];case 7:return o=r.sent(),this._callFunctionErrorManage(o,"startPublishVideoTrack"),[3,8];case 8:return[2]}}))}))},p.prototype._stopPublishVideoTrack=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},p.prototype.startScreenCapture=function(){this._emitError(wn)},p.prototype.pauseScreenCapture=function(){this._emitError(wn)},p.prototype.resumeScreenCapture=function(){this._emitError(wn)},p.prototype.getScreenCaptureSources=function(){this._emitError(wn)},p.prototype.selectScreenCaptureTarget=function(){this._emitError(wn)},p.prototype.getCameraDevicesList=function(){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".getCameraDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getCameraList()];case 2:return t=r.sent(),i=t.map((function(e){return a(a({},e),{deviceName:e.label})})),this._cameraList=t,"{}"!==JSON.stringify(this._currentCamera)?[3,4]:(this._currentCamera=this.getDefaultDeviceInfo(t),this._currentCameraId=this._currentCamera.deviceId,[4,this.setCurrentCameraDevice(this._currentCameraId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getCameraDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},p.prototype.setCurrentCameraDevice=function(e){var t;return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".setCurrentCameraDevice with params: "),{cameraId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._currentCameraId=e,[4,this._updateLocalVideo()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),this._currentCamera=this._cameraList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._currentCameraId=null===(t=this._currentCamera)||void 0===t?void 0:t.cameraId,this._callFunctionErrorManage(i,"setCurrentCameraDevice"),i;case 5:return[2]}}))}))},p.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(ls,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new E(t,i,o,i,r)},p.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},p.prototype.switchCamera=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(ls,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},p.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},p.prototype.setVirtualBackground=function(e){return u(this,void 0,void 0,(function(){var t,i,o,r,n;return l(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,i=e.type,o=e.blurLevel,r=e.imagePath,t?this._isVirtualBackground?i!==ue?[3,2]:[4,this._trtc.updatePlugin(ae,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==le?[3,4]:[4,this._trtc.updatePlugin(ae,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(ae,a(a({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._trtc.stopPlugin(ae),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(ls,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},p.prototype.setTestVirtualBackground=function(e){return u(this,void 0,void 0,(function(){var t,i,o,r,n;return l(this,(function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),t=e.enable,i=e.type,o=e.blurLevel,r=e.imagePath,t?this._isTestVirtualBackground?i!==ue?[3,2]:[4,this._testTrtc.updatePlugin(ae,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==le?[3,4]:[4,this._testTrtc.updatePlugin(ae,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(ae,a(a({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isTestVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._testTrtc.stopPlugin(ae),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(ls,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},p.prototype.useVirtualBackground=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:i,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:i,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},p.prototype.setBeautyStyle=function(e,t,i,o){return u(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this._handleBeautyStyleParam(this._trtc,this._isBeautyEnabled,e,t,i,o,!1)];case 1:return r.sent(),[2]}}))}))},p.prototype.setTestBeautyStyle=function(e,t,i,o){return u(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this._handleBeautyStyleParam(this._testTrtc,this._isTestBeautyEnabled,e,t,i,o,!0)];case 1:return r.sent(),[2]}}))}))},p.prototype.useBeautyStyle=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:o,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:o,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},p.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return u(this,void 0,void 0,(function(){var i,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:if(o<0||o>9)throw new Error("beautyLevel must be between 0 and 9");if(r<0||r>9)throw new Error("whitenessLevel must be between 0 and 9");if(n<0||n>9)throw new Error("ruddinessLevel must be between 0 and 9");l.label=1;case 1:return l.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(ce)]:[3,3];case 2:return l.sent(),s?this._isTestBeautyEnabled=!1:this._isBeautyEnabled=!1,[3,7];case 3:return u={beauty:i,brightness:a,ruddy:c},t?[3,5]:[4,e.startPlugin(ce,u)];case 4:return l.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(ce,u)];case 6:l.sent(),l.label=7;case 7:return[3,9];case 8:throw h=l.sent(),s?this.logger.error("".concat(ls,".").concat("setTestBeautyStyle"," fail: "),h):this.logger.error("".concat(ls,".").concat("setBeautyStyle"," fail: "),h),h;case 9:return[2]}}))}))},p.prototype._resetBeautyStyle=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(ce)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(ce)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},p.prototype.getMicDevicesList=function(){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".getMicDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getMicrophoneList()];case 2:return t=r.sent(),i=t.map((function(e){return a(a({},e),{deviceName:e.label})})),this._microphoneList=t,"{}"!==JSON.stringify(this._currentMicrophone)?[3,4]:(this._currentMicrophone=this.getDefaultDeviceInfo(t),this._currentMicrophoneId=this._currentMicrophone.deviceId,[4,this.setCurrentMicDevice(this._currentMicrophoneId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getMicDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},p.prototype.setCurrentMicDevice=function(e){var t;return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".setCurrentMicDevice with params: "),{micId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._setCurrentMicrophoneId(e),[4,this._updateLocalAudio()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestAudio()];case 3:return o.sent(),this._currentMicrophone=this._microphoneList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._setCurrentMicrophoneId(null===(t=this._currentMicrophone)||void 0===t?void 0:t.deviceId),this._callFunctionErrorManage(i,"setCurrentMicDevice"),i;case 5:return[2]}}))}))},p.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(ls,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new E(t,i,o,i,r)},p.prototype.getSpeakerDevicesList=function(){return u(this,void 0,Promise,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".getSpeakerDevicesList")),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,e.getSpeakerList()];case 2:return t=r.sent(),i=t.map((function(e){return a(a({},e),{deviceName:e.label})})),this._speakerList=t,"{}"!==JSON.stringify(this._currentSpeaker)?[3,4]:(this._currentSpeaker=this.getDefaultDeviceInfo(t),this._currentSpeakerId=this._currentSpeaker.deviceId,[4,this.setCurrentSpeakerDevice(this._currentSpeakerId)]);case 3:r.sent(),r.label=4;case 4:return[2,Promise.resolve(i)];case 5:return o=r.sent(),this._callFunctionErrorManage(o,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},p.prototype.setCurrentSpeakerDevice=function(t){return u(this,void 0,Promise,(function(){var i;return l(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ls,".setCurrentSpeakerDevice with params: "),{speakerId:t}),o.label=1;case 1:return o.trys.push([1,3,,4]),t?[4,e.setCurrentSpeaker(t)]:[2,!1];case 2:return o.sent(),this._setCurrentSpeakerId(t),this._currentSpeaker=this._speakerList.find((function(e){return e.deviceId===t}))||{},[3,4];case 3:throw i=o.sent(),this._callFunctionErrorManage(i,"setCurrentSpeakerDevice"),i;case 4:return[2]}}))}))},p.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(ls,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new E(t,i,o,i,r)},p.prototype.startCameraDeviceTest=function(t){return u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:if(this.logger.info("".concat(ls,".startCameraDeviceTest with params: "),t),!t)return[2];this._setLocalTestView(t),o.label=1;case 1:return o.trys.push([1,3,,7]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return o.sent(),[3,7];case 3:return(i=o.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return o.sent(),[3,6];case 5:throw this._callFunctionErrorManage(i,"startCameraDeviceTest"),i;case 6:return[3,7];case 7:return[2]}}))}))},p.prototype.stopCameraDeviceTest=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(ls,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},p.prototype.startMicDeviceTest=function(t){return u(this,void 0,void 0,(function(){var i,o=this;return l(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ls,".startMicDeviceTest with params: "),t),r.label=1;case 1:return r.trys.push([1,3,,7]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return r.sent(),[3,7];case 3:return(i=r.sent()).code!==e.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return r.sent(),[3,6];case 5:throw this._callFunctionErrorManage(i,"startMicDeviceTest"),i;case 6:return[3,7];case 7:return this._testTrtc.on(e.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,i=e.volume;""===t&&o.emit("onTestMicVolume",i)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(t)];case 8:return r.sent(),[2]}}))}))},p.prototype.stopMicDeviceTest=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(ls,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},p.prototype.callExperimentalAPI=function(e){return u(this,void 0,void 0,(function(){var t,i,o;return l(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(ls,".callExperimentalAPI"),e),(t=Te(e))===e)return[2];if(i=t.api,o=t.params,!i||!o)return[2];r.label=1;case 1:switch(r.trys.push([1,25,,26]),i){case"setFramework":return[3,2];case"enableAudioAEC":return[3,3];case"enableAudioANS":return[3,4];case"enableAudioAGC":return[3,5];case"KeyMetricsStats":return[3,6];case"setNetworkProxy":return[3,7];case"enableVirtualBackground":return[3,8];case"enableTestVirtualBackground":return[3,10];case"enableTestBeautyStyle":return[3,12];case"setVideoEncodeParamEx":return[3,14];case"enableAutoPlayDialog":return[3,15];case"setAudienceLatencyLevel":return[3,16];case"switchPlaybackQuality":return[3,17];case"requestPictureInPicture":return[3,19];case"exitPictureInPicture":return[3,21]}return[3,23];case 2:return this._handleSetFrameWork(o),[3,24];case 3:return this._echoCancellation=Boolean(o.enable),[3,24];case 4:return this._noiseSuppression=Boolean(o.enable),[3,24];case 5:return this._autoGainControl=Boolean(o.enable),[3,24];case 6:return this._handleKeyMetricsStats(o),[3,24];case 7:return this._networkProxy=o,[3,24];case 8:return[4,this.setVirtualBackground(o)];case 9:return r.sent(),[3,24];case 10:return[4,this.setTestVirtualBackground(o)];case 11:return r.sent(),[3,24];case 12:return[4,this.setTestBeautyStyle(o.style,o.beautyLevel,o.whitenessLevel,o.ruddinessLevel)];case 13:return r.sent(),[3,24];case 14:return this._setVideoEncodeParamEx(o),[3,24];case 15:return this._enableAutoPlayDialog=Boolean(o.enable),[3,24];case 16:return this._latencyLevel=o.latencyLevel,[3,24];case 17:return[4,this._switchPlaybackQuality(o)];case 18:return r.sent(),[3,24];case 19:return[4,this._requestPictureInPicture()];case 20:return r.sent(),[3,24];case 21:return[4,this._exitPictureInPicture()];case 22:return r.sent(),[3,24];case 23:return[3,24];case 24:return[3,26];case 25:throw r.sent();case 26:return[2]}}))}))},p.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;ge(t)&&(this._frameWorkType=t),ge(i)&&(this._component=i),ge(o)&&(this._language=o)},p.prototype._handleKeyMetricsStats=function(t){var i=t.key,o=t.opt,r=t.value,n=t.version,s=o===pe;e._addKVStat({type:o,key:i,value:r,version:n,useUV:s,base:100})},p.prototype._setVideoEncodeParamEx=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:switch(e.streamType){case m.TRTCVideoStreamTypeBig:return[3,1];case m.TRTCVideoStreamTypeSub:return[3,3]}return[3,5];case 1:return[4,this.setVideoEncoderParam(e)];case 2:case 4:return t.sent(),[3,6];case 3:return[4,this.setSubStreamEncoderParam(e)];case 5:return[3,6];case 6:return[2]}}))}))},p.prototype._switchPlaybackQuality=function(e){return u(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return l(this,(function(u){switch(u.label){case 0:if(i=(t=e||{}).quality,o=t.stream_list,r=void 0===o?[]:o,!i||0===r.length)return[2];for(n=null,s=0,a=r;s<a.length;s++)(c=a[s]).name===i&&(n=c),c.userId=c.user_id;return n&&n.user_id?[4,this._trtc.callExperimentalAPI("switchPlaybackQuality",{streamList:r,quality:n.name})]:[2];case 1:return u.sent(),[2]}}))}))},p.prototype._requestPictureInPicture=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(ls,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},p.prototype._exitPictureInPicture=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(ls,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},p.prototype._emitError=function(e){e&&this.emit&&this.emit(oe,e.code,e.message)},p.prototype._emitWarning=function(e){this.emit&&this.emit(re,e)},p.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?Cn:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},p.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:fn},p.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},p.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},p.prototype._transformTRTCDeviceError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);switch(e.extraCode){case 5301:case 5305:case 5306:case 5307:case 5308:case 5309:if(i)return vn;if(o)return yn;break;case 5302:if(i)return gn;if(o)return _n;break;case 5303:if(i)return Tn;if(o)return bn;break;case 5304:if(i)return mn;if(o)return Rn}},p.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?vn:o?yn:e.code},p.prototype._transformTRTCErrorCode=function(t,i){var o=null==t?void 0:t.code;if(t&&t.code)switch(t.code){case e.ERROR_CODE.DEVICE_ERROR:o=this._transformTRTCDeviceError(t,i);break;case e.ERROR_CODE.SERVER_ERROR:o=this._transformTRTCServerError(t);break;case e.ERROR_CODE.INVALID_OPERATION:case e.ERROR_CODE.OPERATION_ABORT:o=this._transformTRTCInvalidOperationError(t,i);break;case e.ERROR_CODE.UNKNOWN_ERROR:o=this._transformTRTCUnKnowError(t,i)}return o},p.prototype._callFunctionErrorManage=function(t,i){if(!t||t.code!==e.ERROR_CODE.OPERATION_ABORT){this.logger.warn("(".concat(i,") failed - ").concat(t.code," - ").concat(t.message));var o=this._transformTRTCErrorCode(t,i);this.emit(oe,o,t.message)}},p.prototype._getTRTCResolution=function(e){var t=(g[e]||"").split("_");return{width:+(t.length>1&&t[1]),height:+(t.length>2&&t[2])}},p.prototype._getTRTCVideoProfile=function(e,t){void 0===t&&(t={});var i=t.videoWidth,o=t.videoHeight,r=t.videoResolution,n=t.videoFps,s=t.videoBitrate,a=t.resMode,c=t.resolutionMode,u={};switch(e){case m.TRTCVideoStreamTypeSub:u=this._defaultScreenProfile;break;case m.TRTCVideoStreamTypeSmall:u=this._defaultSmallVideoProfile;break;case m.TRTCVideoStreamTypeBig:default:u=this._defaultVideoProfile}if(ve(r))ve(i)||(u.width=i),ve(o)||(u.height=o);else{var l=this._getTRTCResolution(r);u.width=l.width,u.height=l.height}if(!ve(a)&&a===x.TRTCVideoResolutionModePortrait||!ve(c)&&c===x.TRTCVideoResolutionModePortrait){var h=u.height,d=u.width;u.width=h,u.height=d}return n&&(u.frameRate=n),s&&(u.bitrate=s),u},p.prototype._getTRTCStreamType=function(t){var i;return((i={})[m.TRTCVideoStreamTypeBig]=e.TYPE.STREAM_TYPE_MAIN,i[m.TRTCVideoStreamTypeSmall]=e.TYPE.STREAM_TYPE_MAIN,i[m.TRTCVideoStreamTypeSub]=e.TYPE.STREAM_TYPE_SUB,i)[t]},p.prototype._getTRTCFillMode=function(e){var t;return((t={})[T.TRTCVideoFillMode_Fill]=an.COVER,t[T.TRTCVideoFillMode_Fit]=an.CONTAIN,t)[e]},p.prototype._getTRTCCloudVideoFillMode=function(e){var t;return((t={})[an.COVER]=T.TRTCVideoFillMode_Fill,t[an.CONTAIN]=T.TRTCVideoFillMode_Fit,t)[e]},p.prototype._getTRTCCloudMirrorType=function(e){return!0===e?y.TRTCVideoMirrorType_Enable:y.TRTCVideoMirrorType_Disable},p.prototype._getLocalRenderMirror=function(e){var t;return e===y.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((t={})[y.TRTCVideoMirrorType_Enable]=!0,t[y.TRTCVideoMirrorType_Disable]=!1,t)[e]},p.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return ve(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},p.prototype._getTRTCRemoteMirror=function(e){var t;return((t={})[y.TRTCVideoMirrorType_Auto]=!1,t[y.TRTCVideoMirrorType_Enable]=!0,t[y.TRTCVideoMirrorType_Disable]=!1,t)[e]},p.prototype._getTRTCQosPreference=function(t){var i;return((i={})[O.TRTCVideoQosPreferenceSmooth]=e.TYPE.QOS_PREFERENCE_SMOOTH,i[O.TRTCVideoQosPreferenceClear]=e.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},p.prototype._getTRTCAudioQuality=function(t){var i;return((i={})[C.TRTCAudioQualitySpeech]=e.TYPE.AUDIO_PROFILE_STANDARD,i[C.TRTCAudioQualityDefault]=e.TYPE.AUDIO_PROFILE_STANDARD,i[C.TRTCAudioQualityMusic]=e.TYPE.AUDIO_PROFILE_HIGH_STEREO,i)[t]},p.prototype._getTRTCCloudDeviceType=function(e){return{camera:M.TRTCDeviceTypeCamera,microphone:M.TRTCDeviceTypeMic,speaker:M.TRTCDeviceTypeSpeaker}[e]},p.prototype._getTRTCCloudDeviceState=function(e){return{add:w.TRTCDeviceStateAdd,remove:w.TRTCDeviceStateRemove,active:w.TRTCDeviceStateActive}[e]},p.prototype._getTRTCCloudQuality=function(e){return[V.TRTCQuality_Unknown,V.TRTCQuality_Excellent,V.TRTCQuality_Good,V.TRTCQuality_Poor,V.TRTCQuality_Bad,V.TRTCQuality_Vbad,V.TRTCQuality_Down][e]},p.prototype._generateLocalVideoData=function(){var e={view:this._getLocalView(),publish:this._getIsVideoPublish(),option:{profile:this._getVideoProfile(),small:this._getSmallStreamVideoProfile()||!1,mirror:this._getTRTCLocalMirror(this._localRenderParams.mirrorType,this._encoderMirror),fillMode:this._getTRTCFillMode(this._localRenderParams.fillMode)}};return this._cameraVideoTrack?e&&Object.assign(e.option,{videoTrack:this._cameraVideoTrack}):this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),this._getQosPreference()&&e&&Object.assign(e.option,{qosPreference:this._getQosPreference()}),e},p.prototype._generateLocalTestVideoData=function(){var e={view:this._getLocalTestView(),publish:!1,option:{profile:this._getVideoProfile(),mirror:this._getTRTCLocalMirror(this._localRenderParams.mirrorType,this._encoderMirror),fillMode:this._getTRTCFillMode(this._localRenderParams.fillMode)}};return this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),e},p.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return me(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),me(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),me(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},p.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},p.prototype._generateRemoteVideoData=function(e,t){return Re(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},p.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(e.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(e.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(e.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(e.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(e.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(e.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(e.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(e.EVENT.AUDIO_VOLUME,(function(e){(null==e?void 0:e.result)&&t.emit("onUserVoiceVolume",null==e?void 0:e.result,((null==e?void 0:e.result)||[]).length)})),this._trtc.on(e.EVENT.KICKED_OUT,(function(e){var i={banned:cn.banned,room_disband:cn.roomDisband};ge(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 D("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new D(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:m.TRTCVideoStreamTypeBig,small:m.TRTCVideoStreamTypeSmall,sub:m.TRTCVideoStreamTypeSub},h=(null===(i=c.video)||void 0===i?void 0:i.length)>0?c.video.map((function(e){var t=new N;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 N;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 F;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 F;r.userId=i,r.audioBitrate=o||0,t.push(r)}p.push.apply(p,t)}));var f=new H;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",m.TRTCVideoStreamTypeBig):"screen"===i&&t.emit("onSendFirstLocalVideoFrame",m.TRTCVideoStreamTypeSub))})),this._trtc.on(e.EVENT.FIRST_VIDEO_FRAME,(function(e){var i=e.userId,o=e.streamType,r=e.width,n=e.height;t.emit("onFirstVideoFrame",i,o,r,n)})),this._trtc.on(e.EVENT.AUDIO_PLAY_STATE_CHANGED,(function(e){var i=e.userId;"PLAYING"===e.state&&t.emit("onFirstAudioFrame",i)})),this._trtc.on(e.EVENT.DEVICE_CHANGED,(function(e){var i=e.type,o=e.device,r=e.action,n=o.deviceId;if("active"===r){switch(i){case"camera":t._currentCameraId=n,t._currentCamera=o;break;case"microphone":t._currentMicrophoneId=n,t._currentMicrophone=o;break;case"speaker":t._currentSpeakerId=n,t._currentSpeaker=o}t.emitOnDeviceChange(n,t._getTRTCCloudDeviceType(i),t._getTRTCCloudDeviceState(r))}})),this._trtc.on(e.EVENT.CUSTOM_MESSAGE,(function(e){e&&t.emit("onRecvCustomCmdMsg",e.userId,e.cmdId,e.seq,null==e?void 0:e.data)})),this._trtc.on(e.EVENT.CONNECTION_STATE_CHANGED,(function(e){t._hasJoinedRoom&&!t._isExitingRoom&&("CONNECTED"===e.prevState&&"DISCONNECTED"===e.state?t.emit("onConnectionLost"):"DISCONNECTED"===e.prevState&&"CONNECTING"===e.state?t.emit("onTryToReconnect"):"CONNECTING"===e.prevState&&"CONNECTED"===e.state&&t.emit("onConnectionRecovery"))})),this._trtc.on(e.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},p.prototype._removeTRTCEvents=function(){this._trtc.off("*")},p.prototype._emitVideoAvailable=function(t,i){var o=t.userId,r=t.streamType;i?this._remoteStreamMap.set("".concat(o,"_").concat(r),!0):this._remoteStreamMap.delete("".concat(o,"_").concat(r)),r===e.TYPE.STREAM_TYPE_SUB?o&&this.emit("onUserSubStreamAvailable",o,i):o&&this.emit("onUserVideoAvailable",o,i)},p.prototype._setLocalView=function(e){this._localView=e},p.prototype._getLocalView=function(){return this._localView},p.prototype._setIsMobile=function(e){this._isMobile=e},p.prototype._getIsMobile=function(){return this._isMobile},p.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},p.prototype._getIsFrontCamera=function(){return this._isFrontCamera},p.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},p.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},p.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},p.prototype._getIsVideoPublish=function(){return this._isVideoPublish},p.prototype._setVideoProfile=function(e){this._videoProfile=e},p.prototype._getVideoProfile=function(){return this._videoProfile},p.prototype._setQosPreference=function(e){this._qosPreference=e},p.prototype._getQosPreference=function(){return this._qosPreference},p.prototype._setLocalTestView=function(e){this._localTestView=e},p.prototype._getLocalTestView=function(){return this._localTestView},p.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;ve(t)||(this._screenShareParams.view=t),ve(i)||(this._screenShareParams.option.systemAudio=i),ve(o)||(this._screenShareParams.option.fillMode=o),ve(r)||(this._screenShareParams.option.profile=r),ve(n)||(this._screenShareParams.option.videoTrack=n),ve(s)||(this._screenShareParams.option.qosPreference=s),ve(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},p.prototype._clearScreenShareParams=function(){var e,t,i,o,r;(null===(e=this._screenShareParams)||void 0===e?void 0:e.view)&&delete this._screenShareParams.view,(null===(i=null===(t=this._screenShareParams)||void 0===t?void 0:t.option)||void 0===i?void 0:i.systemAudio)&&delete this._screenShareParams.option.systemAudio,(null===(r=null===(o=this._screenShareParams)||void 0===o?void 0:o.option)||void 0===r?void 0:r.videoTrack)&&delete this._screenShareParams.option.videoTrack},p.prototype._getScreenShareParams=function(){return this._screenShareParams},p.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},p.prototype._getIsAudioPublish=function(){return this._isAudioPublish},p.prototype._setAudioMuteType=function(e){this._audioMuteType=e},p.prototype._getAudioMuteType=function(){return this._audioMuteType},p.prototype._setAudioProfile=function(e){this._audioProfile=e},p.prototype._getAudioProfile=function(){return this._audioProfile},p.prototype._getCaptureVolume=function(){return this._captureVolume},p.prototype._setCaptureVolume=function(e){this._captureVolume=e},p.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},p.prototype._getCurrentCameraId=function(){return this._currentCameraId},p.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},p.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},p.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},p.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},p.prototype._setRemoteStreamConfig=function(e,t,i){var o=this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t)));o||(o={userId:e,streamType:this._getTRTCStreamType(t),option:{mirror:this._getTRTCRemoteMirror(y.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(T.TRTCVideoFillMode_Fit)}});var r=i.view,n=i.mirrorType,s=i.fillMode,a=i.small;ve(r)||(o.view=r),ve(n)||(o.option.mirror=this._getTRTCRemoteMirror(n)),ve(s)||(o.option.fillMode=this._getTRTCFillMode(s)),ve(a)||(o.option.small=a),this._remoteStreamConfig.set("".concat(e,"_").concat(this._getTRTCStreamType(t)),o)},p.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=a({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},p.prototype._inheritEventsToSubCloud=function(t){var i=this;t._trtc.on(e.EVENT.AUTOPLAY_FAILED,(function(e){i.emit("onAutoPlayFailed",e)})),t._trtc.on(e.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){i.emit("onPictureInPictureStateChanged",e)}))},p.prototype.handleDeviceChange=function(){return u(this,void 0,void 0,(function(){var t=this;return l(this,(function(i){return e.getCameraList().then((function(e){return u(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._cameraList.length===e.length?[2]:[4,this.deviceChangeManage(this._cameraList,e,M.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=e,[2]}}))}))})),e.getMicrophoneList().then((function(e){return u(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,e,M.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=e,[2]}}))}))})),e.getSpeakerList().then((function(e){return u(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,e,M.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=e,[2]}}))}))})),[2]}))}))},p.prototype.isSameDevice=function(e,t){var i=e&&e.deviceId&&e.groupId&&e.label,o=t&&t.deviceId&&t.groupId&&t.label;return!(!i||!o)&&(e.deviceId===t.deviceId&&e.groupId===t.groupId&&e.label===t.label)},p.prototype.deviceChangeManage=function(e,t,i){return u(this,void 0,void 0,(function(){var o,r,n,s,a;return l(this,(function(c){switch(c.label){case 0:return o=void 0,e.length!==t.length&&(r=(t||[]).map((function(e){return e.deviceId})),n=new E,e.length>t.length?(n=e.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=w.TRTCDeviceStateRemove):(r=(e||[]).map((function(e){return e.deviceId})),n=t.filter((function(e){return!r.includes(e.deviceId)}))[0]||{},o=w.TRTCDeviceStateAdd),s=n.deviceId,this.emitOnDeviceChange(s,i,o)),a=this.getDefaultDeviceInfo(t),i!==M.TRTCDeviceTypeCamera||o!==w.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!==M.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!==M.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,a)?[2]:a.deviceId?[4,this.autoChangeDevice(i,a)]:[3,8];case 7:c.sent(),c.label=8;case 8:c.label=9;case 9:return[2]}}))}))},p.prototype.getDefaultDeviceInfo=function(e){var t=new E;if(0===e.length)return t;var i=e.filter((function(e){return"default"===e.deviceId}));return t=i.length>0?i[0]:e[0]},p.prototype.autoChangeDevice=function(t,i){return u(this,void 0,void 0,(function(){var o,r,n;return l(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==M.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,w.TRTCDeviceStateActive),s.label=6;case 6:return t!==M.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,w.TRTCDeviceStateActive),s.label=12;case 12:return t!==M.TRTCDeviceTypeSpeaker?[3,14]:[4,e.setCurrentSpeaker(o)];case 13:s.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,w.TRTCDeviceStateActive),s.label=14;case 14:return[2]}}))}))},p.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},p.prototype.getMediaMixingManager=function(){return new Kn({logger:this.logger,trtc:this._trtc,trtcCloud:this})},p.prototype.getAITranscriberManager=function(){return new ts({logger:this.logger,trtc:this._trtc})},p.shareInstance=null,p.subCloudMap=new Map,p.enableSEI=!1,p.assetsPath="",c([(f="exitRoom",function(e,t,i){var o=i.value;return i.value=function(){for(var e,t,i,r,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];var a=[];return null===(t=null===(e=Xn.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return a.push(e)})),null===(i=$n.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=Zn.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),a.forEach((function(e){e.reject(new Error("aborted ".concat(f)))})),Xn.delete(this),$n.delete(this),Zn.delete(this),o.apply(this,n)},i})],p.prototype,"exitRoom",null),c([es((function(e){return e}))],p.prototype,"muteRemoteAudio",null),c([es((function(e){return e}))],p.prototype,"muteRemoteVideoStream",null),c([es((function(e){var t=e||{},i=t.quality,o=t.stream_list,r=void 0===o?[]:o,n=r.some((function(e){return e.name===i}));return i&&n?r.map((function(e){return e.user_id})):(console.warn("[QualitySwitch] Invalid params: target ".concat(i," not found in list")),[])}),{deduplicate:!0})],p.prototype,"_switchPlaybackQuality",null),p}(S);export{rs as AITranscriberListener,te as AudioMuteType,ns as IAITranscriberManager,In as ITRTCMediaMixingEvent,Vn as ITRTCMediaMixingManager,Ln as InteractionOption,Y as Rect,R as TRTCAppScene,C as TRTCAudioQuality,_ as TRTCBeautyStyle,X as TRTCCameraCaptureMode,ie as TRTCCameraCaptureParams,E as TRTCDeviceInfo,w as TRTCDeviceState,M as TRTCDeviceType,U as TRTCImageBuffer,N as TRTCLocalStatistics,W as TRTCLogLevel,An as TRTCMediaMixingEncParam,hn as TRTCMediaMixingErrorCode,pn as TRTCMediaMixingEvent,Pn as TRTCMediaSource,dn as TRTCMediaSourceType,J as TRTCMixInputType,$ as TRTCMixUser,Q as TRTCNetworkQosParam,P as TRTCParams,B as TRTCPublishCDNParam,k as TRTCQosControlMode,V as TRTCQuality,D as TRTCQualityInfo,F as TRTCRemoteStatistics,I as TRTCRenderParams,b as TRTCRoleType,ee as TRTCScreenCaptureProperty,G as TRTCScreenCaptureSourceInfo,j as TRTCScreenCaptureSourceType,H as TRTCStatistics,K as TRTCTranscodingConfig,q as TRTCTranscodingConfigMode,L as TRTCVideoEncParam,T as TRTCVideoFillMode,y as TRTCVideoMirrorType,O as TRTCVideoQosPreference,g as TRTCVideoResolution,x as TRTCVideoResolutionMode,A as TRTCVideoRotation,m as TRTCVideoStreamType,z as TRTCVolumeInfo,os as TranscriberMessage,is as TranscriberParams,ps as default};