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
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("trtc-sdk-v5"),require("trtc-sdk-v5/plugins/lebplayer"),require("trtc-sdk-v5/plugins/video-effect/virtual-background"),require("trtc-sdk-v5/plugins/video-effect/basic-beauty"),require("trtc-sdk-v5/plugins/realtime-transcriber"),require("trtc-sdk-v5/plugins/video-effect/video-mixer")):"function"==typeof define&&define.amd?define(["exports","trtc-sdk-v5","trtc-sdk-v5/plugins/lebplayer","trtc-sdk-v5/plugins/video-effect/virtual-background","trtc-sdk-v5/plugins/video-effect/basic-beauty","trtc-sdk-v5/plugins/realtime-transcriber","trtc-sdk-v5/plugins/video-effect/video-mixer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TRTCCloud={},e.TRTC,e.LEBPlayer,e.VirtualBackground,e.BasicBeauty,e.realtimeTranscriber,e.VideoMixer)}(this,(function(e,t,i,o,r,n,s){function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(t),u=a(s),l=function(e,t){return l=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])},l(e,t)};var d=function(){return d=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},d.apply(this,arguments)};function h(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 p(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 T(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 f(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 v(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 g(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=f(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 m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function R(e,t){return e(t={exports:{}},t.exports),t.exports}var y,C,_,b,S,M,w,E,V=R((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],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,o),!0;case 4:return l.fn.call(l.context,t,o,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(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var h,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,o);break;case 4:l[u].fn.call(l[u].context,t,o,r);break;default:if(!c)for(h=1,c=new Array(d-1);h<d;h++)c[h-1]=arguments[h];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}));e.TRTCVideoResolution=void 0,(y=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[y.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",y[y.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",y[y.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",y[y.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",y[y.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",y[y.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",y[y.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",y[y.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",y[y.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",y[y.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",y[y.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",y[y.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",y[y.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",y[y.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",y[y.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",y[y.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",y[y.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",y[y.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",y[y.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",y[y.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(C=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[C.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",C[C.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",C[C.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(_=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[_.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",_[_.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(b=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[b.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",b[b.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",b[b.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(S=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[S.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",S[S.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(M=e.TRTCAppScene||(e.TRTCAppScene={}))[M.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",M[M.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",M[M.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",M[M.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(w=e.TRTCRoleType||(e.TRTCRoleType={}))[w.TRTCRoleAnchor=20]="TRTCRoleAnchor",w[w.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(E=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[E.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",E[E.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",E[E.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic";var A,P,L=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};e.TRTCDeviceState=void 0,(A=e.TRTCDeviceState||(e.TRTCDeviceState={}))[A.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",A[A.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",A[A.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(P=e.TRTCDeviceType||(e.TRTCDeviceType={}))[P.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",P[P.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",P[P.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",P[P.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var I,x=function(t,i,o,r,n,s,a,c,u,l,d){void 0===t&&(t=0),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=0),void 0===n&&(n=""),void 0===s&&(s=e.TRTCRoleType.TRTCRoleAnchor),void 0===a&&(a=null),void 0===u&&(u=null),void 0===l&&(l=null),void 0===d&&(d=30),this.sdkAppId=t,this.userId=i,this.userSig=o,this.roomId=r,this.strRoomId=n,this.role=s,this.privateMapKey=a,this.streamId=u,this.userDefineRecordId=l,this.frameWorkType=d},O=function(t,i,o,r){void 0===t&&(t=e.TRTCVideoResolution.TRTCVideoResolution_640_360),void 0===i&&(i=e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape),void 0===o&&(o=15),void 0===r&&(r=550),this.videoResolution=t,this.resMode=i,this.videoFps=o,this.videoBitrate=r};e.TRTCVideoRotation=void 0,(I=e.TRTCVideoRotation||(e.TRTCVideoRotation={}))[I.TRTCVideoRotation0=0]="TRTCVideoRotation0",I[I.TRTCVideoRotation90=1]="TRTCVideoRotation90",I[I.TRTCVideoRotation180=2]="TRTCVideoRotation180",I[I.TRTCVideoRotation270=3]="TRTCVideoRotation270";var k,D=function(t,i,o){void 0===t&&(t=e.TRTCVideoRotation.TRTCVideoRotation0),void 0===i&&(i=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit),void 0===o&&(o=e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),this.rotation=t,this.fillMode=i,this.mirrorType=o};e.TRTCQuality=void 0,(k=e.TRTCQuality||(e.TRTCQuality={}))[k.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",k[k.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",k[k.TRTCQuality_Good=2]="TRTCQuality_Good",k[k.TRTCQuality_Poor=3]="TRTCQuality_Poor",k[k.TRTCQuality_Bad=4]="TRTCQuality_Bad",k[k.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",k[k.TRTCQuality_Down=6]="TRTCQuality_Down";var B,z,F,N=function(t,i){void 0===t&&(t=""),void 0===i&&(i=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=i},Q=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},H=function(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),this.appId=e,this.bizId=t,this.url=i},W=function(t,i,o,r,n,s,a){void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.width=t,this.height=i,this.frameRate=o,this.videoBitrate=r,this.audioBitrate=s,this.streamType=a},j=function(t,i,o,r,n,s,a,c,u,l,d,h,p,T){void 0===t&&(t=""),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===c&&(c=0),void 0===T&&(T=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.userId=t,this.width=o,this.height=r,this.frameRate=n,this.videoBitrate=s,this.audioBitrate=c,this.streamType=T},U=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};e.TRTCVideoResolutionMode=void 0,(B=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[B.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",B[B.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(z=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[z.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",z[z.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(F=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[F.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",F[F.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var q,G,Y=function(t,i){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===i&&(i=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=i},K=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};e.TRTCLogLevel=void 0,(q=e.TRTCLogLevel||(e.TRTCLogLevel={}))[q.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",q[q.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",q[q.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",q[q.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",q[q.TRTCLogLevelError=4]="TRTCLogLevelError",q[q.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",q[q.TRTCLogLevelNone=6]="TRTCLogLevelNone",e.TRTCScreenCaptureSourceType=void 0,(G=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[G.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",G[G.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",G[G.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",G[G.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var J,X=function(t,i,o,r,n,s){void 0===t&&(t=e.TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=new K),void 0===n&&(n=new K),void 0===s&&(s=!1),this.type=t,this.sourceId=i,this.sourceName=o,this.thumbBGRA=r,this.iconBGRA=n,this.isMinimizeWindow=s},$=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},Z=function(t,i,o,r,n,s,a,c,u,l,d,h,p,T,f){void 0===t&&(t=e.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=15),void 0===c&&(c=2),void 0===u&&(u=0),void 0===l&&(l=""),void 0===d&&(d=64),void 0===h&&(h=48e3),void 0===p&&(p=1),void 0===T&&(T=[]),void 0===f&&(f=""),this.mode=t,this.appId=i,this.bizId=o,this.videoWidth=r,this.videoHeight=n,this.videoBitrate=s,this.videoFramerate=a,this.videoGOP=c,this.backgroundColor=u,this.backgroundImage=l,this.audioSampleRate=d,this.audioBitrate=h,this.audioChannels=p,this.mixUsersArray=T,this.mixUsersArraySize=T.length,this.streamId=f};e.TRTCTranscodingConfigMode=void 0,(J=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[J.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",J[J.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",J[J.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",J[J.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",J[J.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",J[J.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",J[J.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",J[J.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",J[J.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",J[J.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var ee,te,ie=function(t,i,o,r,n,s,a,c){void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=null),void 0===r&&(r=0),void 0===n&&(n=!1),void 0===s&&(s=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),void 0===a&&(a=e.TRTCMixInputType.TRTCMixInputTypeUndefined),void 0===c&&(c=0),this.userId=t,this.roomId=i,this.rect=o,this.zOrder=r,this.pureAudio=n,this.streamType=s,this.inputType=a,this.renderMode=c};e.TRTCMixInputType=void 0,(ee=e.TRTCMixInputType||(e.TRTCMixInputType={}))[ee.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",ee[ee.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",ee[ee.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",ee[ee.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio",e.TRTCCameraCaptureMode=void 0,(te=e.TRTCCameraCaptureMode||(e.TRTCCameraCaptureMode={}))[te.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",te[te.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",te[te.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",te[te.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual";var oe,re=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},ne="onError",se="onWarning",ae="rtc",ce="live",ue="VirtualBackground",le="BasicBeauty",de="blur",he="image",pe={20:"anchor",21:"audience"},Te={0:ae,1:ce,2:ae,3:ce};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(oe||(oe={}));var fe="enum";function ve(){return Math.floor(performance.now())}var ge=function(e){return void 0===e},me=function(e){return"number"==typeof e},Re=function(e){return"boolean"==typeof e};function ye(e){if("string"!=typeof e)return e;var t;try{var i=JSON.parse(e);t="object"==typeof i&&i?i:e}catch(o){t=e}return t}function Ce(e){return null==e}function _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 be(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]=be(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=be(e[i]))}))):t=e,t)}var Se,Me,we=function(e){return e&&e.Math===Math&&e},Ee=we("object"==typeof globalThis&&globalThis)||we("object"==typeof window&&window)||we("object"==typeof self&&self)||we("object"==typeof m&&m)||function(){return this}()||m||Function("return this")(),Ve=function(e){try{return!!e()}catch(t){return!0}},Ae=!Ve((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Pe=!Ve((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Le=Function.prototype.call,Ie=Pe?Le.bind(Le):function(){return Le.apply(Le,arguments)},xe={}.propertyIsEnumerable,Oe=Object.getOwnPropertyDescriptor,ke={f:Oe&&!xe.call({1:2},1)?function(e){var t=Oe(this,e);return!!t&&t.enumerable}:xe},De=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Be=Function.prototype,ze=Be.call,Fe=Pe&&Be.bind.bind(ze,ze),Ne=Pe?Fe:function(e){return function(){return ze.apply(e,arguments)}},Qe=Ne({}.toString),He=Ne("".slice),We=function(e){return He(Qe(e),8,-1)},je=Object,Ue=Ne("".split),qe=Ve((function(){return!je("z").propertyIsEnumerable(0)}))?function(e){return"String"===We(e)?Ue(e,""):je(e)}:je,Ge=function(e){return null==e},Ye=TypeError,Ke=function(e){if(Ge(e))throw Ye("Can't call method on "+e);return e},Je=function(e){return qe(Ke(e))},Xe="object"==typeof document&&document.all,$e={all:Xe,IS_HTMLDDA:void 0===Xe&&void 0!==Xe},Ze=$e.all,et=$e.IS_HTMLDDA?function(e){return"function"==typeof e||e===Ze}:function(e){return"function"==typeof e},tt=$e.all,it=$e.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:et(e)||e===tt}:function(e){return"object"==typeof e?null!==e:et(e)},ot=function(e,t){return arguments.length<2?(i=Ee[e],et(i)?i:void 0):Ee[e]&&Ee[e][t];var i},rt=Ne({}.isPrototypeOf),nt="undefined"!=typeof navigator&&String(navigator.userAgent)||"",st=Ee.process,at=Ee.Deno,ct=st&&st.versions||at&&at.version,ut=ct&&ct.v8;ut&&(Me=(Se=ut.split("."))[0]>0&&Se[0]<4?1:+(Se[0]+Se[1])),!Me&&nt&&(!(Se=nt.match(/Edge\/(\d+)/))||Se[1]>=74)&&(Se=nt.match(/Chrome\/(\d+)/))&&(Me=+Se[1]);var lt=Me,dt=Ee.String,ht=!!Object.getOwnPropertySymbols&&!Ve((function(){var e=Symbol("symbol detection");return!dt(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&lt&&lt<41})),pt=ht&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Tt=Object,ft=pt?function(e){return"symbol"==typeof e}:function(e){var t=ot("Symbol");return et(t)&&rt(t.prototype,Tt(e))},vt=String,gt=TypeError,mt=function(e){if(et(e))return e;throw gt(function(e){try{return vt(e)}catch(t){return"Object"}}(e)+" is not a function")},Rt=function(e,t){var i=e[t];return Ge(i)?void 0:mt(i)},yt=TypeError,Ct=Object.defineProperty,_t=function(e,t){try{Ct(Ee,e,{value:t,configurable:!0,writable:!0})}catch(i){Ee[e]=t}return t},bt="__core-js_shared__",St=Ee[bt]||_t(bt,{}),Mt=R((function(e){(e.exports=function(e,t){return St[e]||(St[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"})})),wt=Object,Et=function(e){return wt(Ke(e))},Vt=Ne({}.hasOwnProperty),At=Object.hasOwn||function(e,t){return Vt(Et(e),t)},Pt=0,Lt=Math.random(),It=Ne(1..toString),xt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+It(++Pt+Lt,36)},Ot=Ee.Symbol,kt=Mt("wks"),Dt=pt?Ot.for||Ot:Ot&&Ot.withoutSetter||xt,Bt=function(e){return At(kt,e)||(kt[e]=ht&&At(Ot,e)?Ot[e]:Dt("Symbol."+e)),kt[e]},zt=TypeError,Ft=Bt("toPrimitive"),Nt=function(e,t){if(!it(e)||ft(e))return e;var i,o=Rt(e,Ft);if(o){if(void 0===t&&(t="default"),i=Ie(o,e,t),!it(i)||ft(i))return i;throw zt("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&et(i=e.toString)&&!it(o=Ie(i,e)))return o;if(et(i=e.valueOf)&&!it(o=Ie(i,e)))return o;if("string"!==t&&et(i=e.toString)&&!it(o=Ie(i,e)))return o;throw yt("Can't convert object to primitive value")}(e,t)},Qt=function(e){var t=Nt(e,"string");return ft(t)?t:t+""},Ht=Ee.document,Wt=it(Ht)&&it(Ht.createElement),jt=function(e){return Wt?Ht.createElement(e):{}},Ut=!Ae&&!Ve((function(){return 7!==Object.defineProperty(jt("div"),"a",{get:function(){return 7}}).a})),qt=Object.getOwnPropertyDescriptor,Gt={f:Ae?qt:function(e,t){if(e=Je(e),t=Qt(t),Ut)try{return qt(e,t)}catch(i){}if(At(e,t))return De(!Ie(ke.f,e,t),e[t])}},Yt=Ae&&Ve((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Kt=String,Jt=TypeError,Xt=function(e){if(it(e))return e;throw Jt(Kt(e)+" is not an object")},$t=TypeError,Zt=Object.defineProperty,ei=Object.getOwnPropertyDescriptor,ti="enumerable",ii="configurable",oi="writable",ri={f:Ae?Yt?function(e,t,i){if(Xt(e),t=Qt(t),Xt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&oi in i&&!i[oi]){var o=ei(e,t);o&&o[oi]&&(e[t]=i.value,i={configurable:ii in i?i[ii]:o[ii],enumerable:ti in i?i[ti]:o[ti],writable:!1})}return Zt(e,t,i)}:Zt:function(e,t,i){if(Xt(e),t=Qt(t),Xt(i),Ut)try{return Zt(e,t,i)}catch(o){}if("get"in i||"set"in i)throw $t("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},ni=Ae?function(e,t,i){return ri.f(e,t,De(1,i))}:function(e,t,i){return e[t]=i,e},si=Function.prototype,ai=Ae&&Object.getOwnPropertyDescriptor,ci=At(si,"name"),ui={EXISTS:ci,PROPER:ci&&"something"===function(){}.name,CONFIGURABLE:ci&&(!Ae||Ae&&ai(si,"name").configurable)},li=Ne(Function.toString);et(St.inspectSource)||(St.inspectSource=function(e){return li(e)});var di,hi,pi,Ti=St.inspectSource,fi=Ee.WeakMap,vi=et(fi)&&/native code/.test(String(fi)),gi=Mt("keys"),mi=function(e){return gi[e]||(gi[e]=xt(e))},Ri={},yi="Object already initialized",Ci=Ee.TypeError,_i=Ee.WeakMap;if(vi||St.state){var bi=St.state||(St.state=new _i);bi.get=bi.get,bi.has=bi.has,bi.set=bi.set,di=function(e,t){if(bi.has(e))throw Ci(yi);return t.facade=e,bi.set(e,t),t},hi=function(e){return bi.get(e)||{}},pi=function(e){return bi.has(e)}}else{var Si=mi("state");Ri[Si]=!0,di=function(e,t){if(At(e,Si))throw Ci(yi);return t.facade=e,ni(e,Si,t),t},hi=function(e){return At(e,Si)?e[Si]:{}},pi=function(e){return At(e,Si)}}var Mi={set:di,get:hi,has:pi,enforce:function(e){return pi(e)?hi(e):di(e,{})},getterFor:function(e){return function(t){var i;if(!it(t)||(i=hi(t)).type!==e)throw Ci("Incompatible receiver, "+e+" required");return i}}},wi=R((function(e){var t=ui.CONFIGURABLE,i=Mi.enforce,o=Mi.get,r=String,n=Object.defineProperty,s=Ne("".slice),a=Ne("".replace),c=Ne([].join),u=Ae&&!Ve((function(){return 8!==n((function(){}),"length",{value:8}).length})),l=String(String).split("String"),d=e.exports=function(e,o,d){"Symbol("===s(r(o),0,7)&&(o="["+a(r(o),/^Symbol\(([^)]*)\)/,"$1")+"]"),d&&d.getter&&(o="get "+o),d&&d.setter&&(o="set "+o),(!At(e,"name")||t&&e.name!==o)&&(Ae?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&d&&At(d,"arity")&&e.length!==d.arity&&n(e,"length",{value:d.arity});try{d&&At(d,"constructor")&&d.constructor?Ae&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var h=i(e);return At(h,"source")||(h.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=d((function(){return et(this)&&o(this).source||Ti(this)}),"toString")})),Ei=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(et(i)&&wi(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:ri.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Vi=Math.ceil,Ai=Math.floor,Pi=Math.trunc||function(e){var t=+e;return(t>0?Ai:Vi)(t)},Li=function(e){var t=+e;return t!=t||0===t?0:Pi(t)},Ii=Math.max,xi=Math.min,Oi=Math.min,ki=function(e){return e>0?Oi(Li(e),9007199254740991):0},Di=function(e){return ki(e.length)},Bi=function(e){return function(t,i,o){var r,n=Je(t),s=Di(n),a=function(e,t){var i=Li(e);return i<0?Ii(i+t,0):xi(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}},zi={includes:Bi(!0),indexOf:Bi(!1)}.indexOf,Fi=Ne([].push),Ni=function(e,t){var i,o=Je(e),r=0,n=[];for(i in o)!At(Ri,i)&&At(o,i)&&Fi(n,i);for(;t.length>r;)At(o,i=t[r++])&&(~zi(n,i)||Fi(n,i));return n},Qi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Hi=Qi.concat("length","prototype"),Wi={f:Object.getOwnPropertyNames||function(e){return Ni(e,Hi)}},ji={f:Object.getOwnPropertySymbols},Ui=Ne([].concat),qi=ot("Reflect","ownKeys")||function(e){var t=Wi.f(Xt(e)),i=ji.f;return i?Ui(t,i(e)):t},Gi=function(e,t,i){for(var o=qi(t),r=ri.f,n=Gt.f,s=0;s<o.length;s++){var a=o[s];At(e,a)||i&&At(i,a)||r(e,a,n(t,a))}},Yi=/#|\.prototype\./,Ki=function(e,t){var i=Xi[Ji(e)];return i===Zi||i!==$i&&(et(t)?Ve(t):!!t)},Ji=Ki.normalize=function(e){return String(e).replace(Yi,".").toLowerCase()},Xi=Ki.data={},$i=Ki.NATIVE="N",Zi=Ki.POLYFILL="P",eo=Ki,to=Gt.f,io=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?Ee:u?Ee[a]||_t(a,{}):(Ee[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=to(i,o))&&s.value:i[o],!eo(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Gi(n,r)}(e.sham||r&&r.sham)&&ni(n,"sham",!0),Ei(i,o,n,e)}},oo={};oo[Bt("toStringTag")]="z";var ro,no="[object z]"===String(oo),so=Bt("toStringTag"),ao=Object,co="Arguments"===We(function(){return arguments}()),uo=no?We: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=ao(e),so))?i:co?We(t):"Object"===(o=We(t))&&et(t.callee)?"Arguments":o},lo=String,ho=function(e){if("Symbol"===uo(e))throw TypeError("Cannot convert a Symbol value to a string");return lo(e)},po=function(){var e=Xt(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},To=Ee.RegExp,fo=Ve((function(){var e=To("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),vo=fo||Ve((function(){return!To("a","y").sticky})),go={BROKEN_CARET:fo||Ve((function(){var e=To("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:vo,UNSUPPORTED_Y:fo},mo=Object.keys||function(e){return Ni(e,Qi)},Ro=Ae&&!Yt?Object.defineProperties:function(e,t){Xt(e);for(var i,o=Je(t),r=mo(t),n=r.length,s=0;n>s;)ri.f(e,i=r[s++],o[i]);return e},yo={f:Ro},Co=ot("document","documentElement"),_o="prototype",bo="script",So=mi("IE_PROTO"),Mo=function(){},wo=function(e){return"<"+bo+">"+e+"</"+bo+">"},Eo=function(e){e.write(wo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Vo=function(){try{ro=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Vo="undefined"!=typeof document?document.domain&&ro?Eo(ro):(t=jt("iframe"),i="java"+bo+":",t.style.display="none",Co.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(wo("document.F=Object")),e.close(),e.F):Eo(ro);for(var o=Qi.length;o--;)delete Vo[_o][Qi[o]];return Vo()};Ri[So]=!0;var Ao,Po,Lo=Object.create||function(e,t){var i;return null!==e?(Mo[_o]=Xt(e),i=new Mo,Mo[_o]=null,i[So]=e):i=Vo(),void 0===t?i:yo.f(i,t)},Io=Ee.RegExp,xo=Ve((function(){var e=Io(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Oo=Ee.RegExp,ko=Ve((function(){var e=Oo("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Do=Mi.get,Bo=Mt("native-string-replace",String.prototype.replace),zo=RegExp.prototype.exec,Fo=zo,No=Ne("".charAt),Qo=Ne("".indexOf),Ho=Ne("".replace),Wo=Ne("".slice),jo=(Po=/b*/g,Ie(zo,Ao=/a/,"a"),Ie(zo,Po,"a"),0!==Ao.lastIndex||0!==Po.lastIndex),Uo=go.BROKEN_CARET,qo=void 0!==/()??/.exec("")[1];(jo||qo||Uo||xo||ko)&&(Fo=function(e){var t,i,o,r,n,s,a,c=this,u=Do(c),l=ho(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=Ie(Fo,d,l),c.lastIndex=d.lastIndex,t;var h=u.groups,p=Uo&&c.sticky,T=Ie(po,c),f=c.source,v=0,g=l;if(p&&(T=Ho(T,"y",""),-1===Qo(T,"g")&&(T+="g"),g=Wo(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==No(l,c.lastIndex-1))&&(f="(?: "+f+")",g=" "+g,v++),i=new RegExp("^(?:"+f+")",T)),qo&&(i=new RegExp("^"+f+"$(?!\\s)",T)),jo&&(o=c.lastIndex),r=Ie(zo,p?i:c,g),p?r?(r.input=Wo(r.input,v),r[0]=Wo(r[0],v),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:jo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),qo&&r&&r.length>1&&Ie(Bo,r[0],i,(function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(r[n]=void 0)})),r&&h)for(r.groups=s=Lo(null),n=0;n<h.length;n++)s[(a=h[n])[0]]=r[a[1]];return r});var Go=Fo;io({target:"RegExp",proto:!0,forced:/./.exec!==Go},{exec:Go});var Yo="\t\n\v\f\r                 \u2028\u2029\ufeff",Ko=Ne("".replace),Jo=RegExp("^["+Yo+"]+"),Xo=RegExp("(^|[^"+Yo+"])["+Yo+"]+$"),$o=function(e){return function(t){var i=ho(Ke(t));return 1&e&&(i=Ko(i,Jo,"")),2&e&&(i=Ko(i,Xo,"$1")),i}},Zo={start:$o(1),end:$o(2),trim:$o(3)}.trim,er=Ne("".charAt),tr=Ee.parseFloat,ir=Ee.Symbol,or=ir&&ir.iterator,rr=1/tr(Yo+"-0")!=-Infinity||or&&!Ve((function(){tr(Object(or))}))?function(e){var t=Zo(ho(e)),i=tr(t);return 0===i&&"-"===er(t,0)?-0:i}:tr;io({global:!0,forced:parseFloat!==rr},{parseFloat:rr});var nr=function(e){if("Function"===We(e))return Ne(e)},sr=Bt("species"),ar=RegExp.prototype,cr=Ne("".charAt),ur=Ne("".charCodeAt),lr=Ne("".slice),dr=function(e){return function(t,i){var o,r,n=ho(Ke(t)),s=Li(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=ur(n,s))<55296||o>56319||s+1===a||(r=ur(n,s+1))<56320||r>57343?e?cr(n,s):o:e?lr(n,s,s+2):r-56320+(o-55296<<10)+65536}},hr={codeAt:dr(!1),charAt:dr(!0)}.charAt,pr=function(e,t,i){return t+(i?hr(e,t).length:1)},Tr=TypeError,fr=function(e,t){var i=e.exec;if(et(i)){var o=Ie(i,e,t);return null!==o&&Xt(o),o}if("RegExp"===We(e))return Ie(Go,e,t);throw Tr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=Bt(e),n=!Ve((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Ve((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[sr]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=nr(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=nr(e),c=t.exec;return c===Go||c===ar.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));Ei(String.prototype,e,c[0]),Ei(ar,r,c[1])}o&&ni(ar[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Ke(this),o=Ge(t)?void 0:Rt(t,e);return o?Ie(o,t,i):new RegExp(t)[e](ho(i))},function(e){var o=Xt(this),r=ho(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return fr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=fr(o,r));){var l=ho(a[0]);c[u]=l,""===l&&(o.lastIndex=pr(r,ki(o.lastIndex),s)),u++}return 0===u?null:c}]}));var vr=Array.isArray||function(e){return"Array"===We(e)},gr=TypeError,mr=function(e){if(e>9007199254740991)throw gr("Maximum allowed index exceeded");return e},Rr=function(e,t,i){var o=Qt(t);o in e?ri.f(e,o,De(0,i)):e[o]=i},yr=function(){},Cr=[],_r=ot("Reflect","construct"),br=/^\s*(?:class|function)\b/,Sr=Ne(br.exec),Mr=!br.exec(yr),wr=function(e){if(!et(e))return!1;try{return _r(yr,Cr,e),!0}catch(t){return!1}},Er=function(e){if(!et(e))return!1;switch(uo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Mr||!!Sr(br,Ti(e))}catch(t){return!0}};Er.sham=!0;var Vr,Ar=!_r||Ve((function(){var e;return wr(wr.call)||!wr(Object)||!wr((function(){e=!0}))||e}))?Er:wr,Pr=Bt("species"),Lr=Array,Ir=function(e,t){return new(function(e){var t;return vr(e)&&(t=e.constructor,(Ar(t)&&(t===Lr||vr(t.prototype))||it(t)&&null===(t=t[Pr]))&&(t=void 0)),void 0===t?Lr:t}(e))(0===t?0:t)},xr=Bt("species"),Or=Bt("isConcatSpreadable"),kr=lt>=51||!Ve((function(){var e=[];return e[Or]=!1,e.concat()[0]!==e})),Dr=function(e){if(!it(e))return!1;var t=e[Or];return void 0!==t?!!t:vr(e)};io({target:"Array",proto:!0,arity:1,forced:!(kr&&(Vr="concat",lt>=51||!Ve((function(){var e=[];return(e.constructor={})[xr]=function(){return{foo:1}},1!==e[Vr](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=Et(this),a=Ir(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Dr(n=-1===t?s:arguments[t]))for(r=Di(n),mr(c+r),i=0;i<r;i++,c++)i in n&&Rr(a,c,n[i]);else mr(c+1),Rr(a,c++,n);return a.length=c,a}});var Br=window.navigator&&window.navigator.userAgent||"",zr=/AppleWebKit\/([\d.]+)/i.exec(Br);zr&&parseFloat(zr.pop());var Fr=/iPad/i.test(Br),Nr=/iPhone/i.test(Br)&&!Fr,Qr=/iPod/i.test(Br),Hr=Nr||Fr||Qr,Wr=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(Br);Hr&&function(){var e=Br.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var jr=/Android/i.test(Br);jr&&function(){var e=Br.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]))}();jr&&/webkit/i.test(Br),/Firefox/i.test(Br)&&function(){var e=Br.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Ur=/Edge\//i.test(Br);Ur&&function(){var e=Br.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var qr=/Edg\//i.test(Br);qr&&function(){var e=Br.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Gr=/SogouMobileBrowser\//i.test(Br);Gr&&function(){var e=Br.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Yr=/MetaSr\s/i.test(Br);Yr&&function(){var e=Br.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Kr=/TBS\/\d+/i.test(Br);Kr&&function(){var e=Br.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Jr=/XWEB\/\d+/i.test(Br);Jr&&function(){var e=Br.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(Br),/MSIE\/\d+/i.test(Br)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(Br),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(Br)&&/rv:11.0/.test(Br)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(Br)&&function(){var e=Br.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var Xr=!Kr&&/MQQBrowser\/\d+/i.test(Br)&&/COVC\/\d+/i.test(Br),$r=!Kr&&/MQQBrowser\/\d+/i.test(Br)&&!/COVC\/\d+/i.test(Br);($r||Xr)&&function(){var e=Br.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Zr=!Kr&&/ QQBrowser\/\d+/i.test(Br);Zr&&function(){var e=Br.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var en=!Kr&&/QQBrowserLite\/\d+/i.test(Br);en&&function(){var e=Br.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var tn=!Kr&&/MQBHD\/\d+/i.test(Br);tn&&function(){var e=Br.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(Br),!Hr&&/MAC OS X/i.test(Br),!jr&&/Linux/i.test(Br),/MicroMessenger/i.test(Br),/UCBrowser/i.test(Br),/Electron/i.test(Br);var on=/MiuiBrowser/i.test(Br);on&&function(){var e=Br.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var rn=/HuaweiBrowser/i.test(Br);/Huawei/i.test(Br),rn&&function(){var e=Br.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var nn=/SamsungBrowser/i.test(Br);nn&&function(){var e=Br.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var sn=/HeyTapBrowser/i.test(Br);sn&&function(){var e=Br.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var an=/VivoBrowser/i.test(Br);an&&function(){var e=Br.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var cn,un,ln,dn=/Chrome/i.test(Br),hn=!Ur&&!Yr&&!Gr&&!Kr&&!Jr&&!qr&&!Zr&&!on&&!rn&&!nn&&!sn&&!an&&/Chrome/i.test(Br);hn&&function(){var e=Br.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),hn&&function(){var e=Br.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!dn&&!$r&&!Xr&&!en&&!tn&&/Safari/i.test(Br)&&function(){var e=Br.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"}(cn||(cn={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(un||(un={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(ln||(ln={}));var pn,Tn,fn,vn=-3340,gn=-1301,mn=-1314,Rn=-1315,yn=-1316,Cn=-1302,_n=-1317,bn=-1318,Sn=-1319,Mn=-70252,wn={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},En={code:-1005,message:"not supported"},Vn="2.11.1";e.TRTCMediaMixingErrorCode=void 0,(pn=e.TRTCMediaMixingErrorCode||(e.TRTCMediaMixingErrorCode={}))[pn.Success=0]="Success",pn[pn.Error=-1]="Error",pn[pn.InvalidParams=-2]="InvalidParams",pn[pn.NotFoundSource=-3]="NotFoundSource",pn[pn.ImageSourceLoadFailed=-4]="ImageSourceLoadFailed",pn[pn.CameraNotAuthorized=-5]="CameraNotAuthorized",pn[pn.CameraIsOccupied=-6]="CameraIsOccupied",pn[pn.CameraDisconnected=-7]="CameraDisconnected",e.TRTCMediaSourceType=void 0,(Tn=e.TRTCMediaSourceType||(e.TRTCMediaSourceType={}))[Tn.kCamera=0]="kCamera",Tn[Tn.kScreen=1]="kScreen",Tn[Tn.kImage=2]="kImage",Tn[Tn.kPhoneMirror=4]="kPhoneMirror",Tn[Tn.kText=5]="kText",Tn[Tn.kVideo=6]="kVideo",e.TRTCMediaMixingEvent=void 0,(fn=e.TRTCMediaMixingEvent||(e.TRTCMediaMixingEvent={})).onSourceSelected="onSourceSelected",fn.onSourceMoved="onSourceMoved",fn.onSourceResized="onSourceResized",fn.onRightButtonClicked="onRightButtonClicked",fn.onError="onError",fn.onSourcePlugged="onSourcePlugged",fn.onSourceConnected="onSourceConnected",fn.onSourceDisconnected="onSourceDisconnected",fn.onSourceUnplugged="onSourceUnplugged",fn.onMediaSourceSizeChanged="onMediaSourceSizeChanged";var An,Pn=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}(),Ln=new Pn(null),In=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"):Ln.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 Ln.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)):Ln.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 Ln.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){Ln.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",Ln.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"}(An||(An={}));var xn="trtc-resizable-top-left-anchor",On="trtc-resizable-top-anchor",kn="trtc-resizable-top-right-anchor",Dn="trtc-resizable-left-anchor",Bn="trtc-resizable-right-anchor",zn="trtc-resizable-bottom-left-anchor",Fn="trtc-resizable-bottom-anchor",Nn="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 Hn(e,t){for(var i in t)e.style[i]=t[i]}var Wn=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:An.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:An.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||An.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(xn),Hn(c,Object.assign({},Qn.resizeAnchor,Qn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(On),Hn(u,Object.assign({},Qn.resizeAnchor,Qn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(kn),Hn(l,Object.assign({},Qn.resizeAnchor,Qn.topRightAnchor)),this.topRightAnchor=l;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(Dn),Hn(d,Object.assign({},Qn.resizeAnchor,Qn.leftAnchor)),this.leftAnchor=d;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(Bn),Hn(h,Object.assign({},Qn.resizeAnchor,Qn.rightAnchor)),this.rightAnchor=h;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(zn),Hn(p,Object.assign({},Qn.resizeAnchor,Qn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var T=document.createElement("div");T.className="trtc-resizable-resize-anchor ".concat(Fn),Hn(T,Object.assign({},Qn.resizeAnchor,Qn.bottomAnchor)),this.bottomAnchor=T;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(Nn),Hn(f,Object.assign({},Qn.resizeAnchor,Qn.bottomRightAnchor)),this.bottomRightAnchor=f,this.options.anchorMode!==An.Both&&this.options.anchorMode!==An.Edge||(null===(e=this.resizeTarget)||void 0===e||e.appendChild(u),null===(t=this.resizeTarget)||void 0===t||t.appendChild(d),null===(i=this.resizeTarget)||void 0===i||i.appendChild(h),null===(o=this.resizeTarget)||void 0===o||o.appendChild(T)),this.options.anchorMode!==An.Both&&this.options.anchorMode!==An.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(f))},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,Ln.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else Ln.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 xn: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 On: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 kn: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 Dn: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 Bn: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 zn: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 Fn: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 Nn: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 Ln.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 Ln.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 Ln.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,d,h,p,T,f;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!==An.Both&&this.options.anchorMode!==An.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===(d=this.resizeTarget)||void 0===d||d.removeChild(this.bottomAnchor))),this.options.anchorMode!==An.Both&&this.options.anchorMode!==An.Corner||(this.topLeftAnchor&&(null===(h=this.resizeTarget)||void 0===h||h.removeChild(this.topLeftAnchor)),this.topRightAnchor&&(null===(p=this.resizeTarget)||void 0===p||p.removeChild(this.topRightAnchor)),this.bottomLeftAnchor&&(null===(T=this.resizeTarget)||void 0===T||T.removeChild(this.bottomLeftAnchor)),this.bottomRightAnchor&&(null===(f=this.resizeTarget)||void 0===f||f.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}(),jn=function(){var t=new Map;for(var i in e.TRTCVideoResolution)if(isNaN(Number(i))){var o=e.TRTCVideoResolution[i],r=i.split("_");t.set(o,{width:parseInt(r[1]),height:parseInt(r[2])})}return t}(),Un=function(){function t(t){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=t.logger,this.container=t.view,this.container.style.position="relative",this.videoResolution=t.videoResolution,this.resMode=t.resMode,jn.has(t.videoResolution)){var i=jn.get(t.videoResolution),o=i.width,r=i.height;this.resMode===e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=o,this.mixingVideoHeight=r):(this.mixingVideoWidth=r,this.mixingVideoHeight=o)}this.updatePreviewProperty(),this.canExceedContainer=t.canExceedContainer||!1,this.eventEmitter=new V,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 t.prototype.updateOptions=function(t){if(!Ce(t.videoResolution)||!Ce(t.resMode)){if(this.resMode=Ce(t.resMode)?this.resMode:t.resMode,t.videoResolution&&jn.has(t.videoResolution)){var i=jn.get(t.videoResolution),o=i.width,r=i.height;this.resMode===e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=o,this.mixingVideoHeight=r):(this.mixingVideoWidth=r,this.mixingVideoHeight=o)}this.updatePreviewProperty(),this.updateOverlay()}},t.prototype.addMedia=function(e){this.mediaList.unshift(e),e.isSelected&&(this.selectedMediaIndex=0,this.updateOverlay())},t.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()))},t.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()))},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.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=[]},t.prototype.initMediaMovable=function(){this.onMove=this.onMove.bind(this),this.movableHandler=new In(this.moveAndResizeOverlay,this.container,{canExceedContainer:this.canExceedContainer,calcPositionOnly:!1}),this.movableHandler.on("move",this.onMove)},t.prototype.initMediaResizable=function(){this.onResize=this.onResize.bind(this),this.resizableHandler=new Wn(this.moveAndResizeOverlay,this.container,{keepRatio:!0,stopPropagation:!0,canExceedContainer:this.canExceedContainer,anchorMode:0}),this.resizableHandler.on("resize",this.onResize)},t.prototype.updateCanExceedContainer=function(e){this.movableHandler&&(this.movableHandler.options.canExceedContainer=e),this.resizableHandler&&(this.resizableHandler.options.canExceedContainer=e)},t.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"))},t.prototype.initContainerResizeObserver=function(){this.container&&(this.onPreviewAreaResize=this.onPreviewAreaResize.bind(this),this.resizeObserver=new ResizeObserver(this.onPreviewAreaResize),this.resizeObserver.observe(this.container))},t.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}}},t.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"))},t.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}},t.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",d({},o),n)}else console.debug("".concat(this.logPrefix,"onMove no selected media"))},t.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)},t.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(!ge(s.showResizeAnchors)&&!s.showResizeAnchors)return;var a={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+i,bottom:t-this.previewTop+o},c={left:Math.round(a.left/this.previewScale),top:Math.round(a.top/this.previewScale),right:Math.round(a.right/this.previewScale),bottom:Math.round(a.bottom/this.previewScale)};null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",d({},n),c)}else console.debug("".concat(this.logPrefix,"onResize no selected media"))},t.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},t.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?d({},e):null)},t.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)}},t.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}))))}},t.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},t.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",d({},this.mediaList[this.selectedMediaIndex]))},t}(),qn=function(){function t(i){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new V,this.publishParams={videoEncoderParams:{videoResolution:e.TRTCVideoResolution.TRTCVideoResolution_1280_720,resMode:e.TRTCVideoResolutionMode.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=i.logger,this.trtc=i.trtc,this.trtcCloud=i.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 p(this,void 0,Promise,(function(){var e,i,o,r,n;return T(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 p(this,void 0,Promise,(function(){var t,i,o,r,n=this;return T(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(t){var i;return((i={})[e.TRTCMediaSourceType.kCamera]="camera",i[e.TRTCMediaSourceType.kScreen]="screen",i[e.TRTCMediaSourceType.kText]="text",i[e.TRTCMediaSourceType.kVideo]="video",i[e.TRTCMediaSourceType.kImage]="image",i)[t.type]},t.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]="cover",i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]="contain",i)[t]},t.prototype._getTRTCVideoProfile=function(t,i){var o,r,n,s=null!==(r=((o={})[e.TRTCVideoResolution.TRTCVideoResolution_480_270]={width:480,height:270},o[e.TRTCVideoResolution.TRTCVideoResolution_640_360]={width:640,height:360},o[e.TRTCVideoResolution.TRTCVideoResolution_960_540]={width:960,height:540},o[e.TRTCVideoResolution.TRTCVideoResolution_1280_720]={width:1280,height:720},o[e.TRTCVideoResolution.TRTCVideoResolution_1920_1080]={width:1920,height:1080},o)[t])&&void 0!==r?r:(n=t)&&"object"==typeof n&&"number"==typeof n.width&&"number"==typeof n.height?t:{width:1920,height:1080};return{width:s.width,height:s.height,frameRate:i,bitrate:1e3}},t.prototype._getTRTCLayout=function(t){var i,o,r,n,s,a,c,u,l,d,h,p,T,f,v,g,m={zIndex:(null===(r=t.layout)||void 0===r?void 0:r.zOrder)||0};if(ge(null===(n=t.layout)||void 0===n?void 0:n.rect)||(m.x=null===(s=t.layout)||void 0===s?void 0:s.rect.left,m.y=null===(a=t.layout)||void 0===a?void 0:a.rect.top,m.width=(null===(c=t.layout)||void 0===c?void 0:c.rect.right)-(null===(u=t.layout)||void 0===u?void 0:u.rect.left),m.height=(null===(l=t.layout)||void 0===l?void 0:l.rect.bottom)-(null===(d=t.layout)||void 0===d?void 0:d.rect.top)),ge(null===(h=t.layout)||void 0===h?void 0:h.fillMode)||(m.fillMode=this._getTRTCFillMode(null===(p=t.layout)||void 0===p?void 0:p.fillMode)),!ge(null===(T=t.layout)||void 0===T?void 0:T.mirror)){var R=((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i);m.mirror=R[null===(f=t.layout)||void 0===f?void 0:f.mirror]}if(!ge(null===(v=t.layout)||void 0===v?void 0:v.rotation)){var y=((o={})[e.TRTCVideoRotation.TRTCVideoRotation0]=0,o[e.TRTCVideoRotation.TRTCVideoRotation90]=90,o[e.TRTCVideoRotation.TRTCVideoRotation180]=180,o[e.TRTCVideoRotation.TRTCVideoRotation270]=270,o);m.rotation=y[null===(g=t.layout)||void 0===g?void 0:g.rotation]}return m},t.prototype._getTRTCSourceItem=function(t){var i,o,r,n,s,a,c,u,l,h;switch(t.type){case e.TRTCMediaSourceType.kScreen:return h=e.TRTCVideoResolution.TRTCVideoResolution_1920_1080,(null==t?void 0:t.useInternalTrack)?{id:t.id,layout:this._getTRTCLayout(t),useInternalTrack:!0}:{id:t.id,profile:this._getTRTCVideoProfile((null===(i=t.screen)||void 0===i?void 0:i.resolution)||h,(null===(o=t.screen)||void 0===o?void 0:o.fps)||15),layout:this._getTRTCLayout(t),systemAudio:null===(r=t.screen)||void 0===r?void 0:r.systemAudio};case e.TRTCMediaSourceType.kCamera:return h=e.TRTCVideoResolution.TRTCVideoResolution_1280_720,(null==t?void 0:t.useInternalTrack)?{id:t.id,layout:this._getTRTCLayout(t),useInternalTrack:!0}:{id:t.id,cameraId:null===(n=t.camera)||void 0===n?void 0:n.cameraId,profile:this._getTRTCVideoProfile((null===(s=t.camera)||void 0===s?void 0:s.resolution)||h,(null===(a=t.camera)||void 0===a?void 0:a.fps)||15),videoTrack:null===(c=t.camera)||void 0===c?void 0:c.videoTrack,layout:this._getTRTCLayout(t)};case e.TRTCMediaSourceType.kText:return d(d({id:t.id},t.text||{}),{layout:this._getTRTCLayout(t)});case e.TRTCMediaSourceType.kImage:return{id:t.id,url:null===(u=t.image)||void 0===u?void 0:u.url,layout:this._getTRTCLayout(t)};case e.TRTCMediaSourceType.kVideo:return{id:t.id,url:null===(l=t.video)||void 0===l?void 0:l.url,layout:this._getTRTCLayout(t)};default:return null}},t.prototype._getCanvasSize=function(t,i){var o,r,n=((o={})[e.TRTCVideoResolution.TRTCVideoResolution_480_270]={width:480,height:270},o[e.TRTCVideoResolution.TRTCVideoResolution_640_360]={width:640,height:360},o[e.TRTCVideoResolution.TRTCVideoResolution_960_540]={width:960,height:540},o[e.TRTCVideoResolution.TRTCVideoResolution_1280_720]={width:1280,height:720},o[e.TRTCVideoResolution.TRTCVideoResolution_1920_1080]={width:1920,height:1080},o)[t],s=n.width,a=n.height;return i===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait&&(s=(r=[a,s])[0],a=r[1]),{width:s,height:a}},t.prototype.addMediaSource=function(t){var i;return p(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,l,d;return T(this,(function(h){switch(h.label){case 0:if(-1!==this.findMediaSourceIndex(t))throw new Error("Media source already existed");if(o=be(t),r=this._getTRTCSourceKey(o),!(n=this._getTRTCSourceItem(o))||!r)throw new Error("Invalid media source");return(s=be(this.trtcSourceMap.get(r))||[]).push(n),[4,this.trtc.updatePlugin("VideoMixer",(d={},d[r]=s,d))];case 1:return a=h.sent(),c=a.result,u=a.systemAudioTrackList,t.type===e.TRTCMediaSourceType.kScreen&&(null==u?void 0:u[t.id])?(this.screensWithSystemAudio.add(t.id),l=null==u?void 0:u[t.id],this.logger.log("".concat(this.logPrefix," startPlugin AudioMixer, track ID:"),l.id),[4,this.trtc.startPlugin("AudioMixer",{id:"systemAudioTrack_".concat(t.id),track:l})]):[3,3];case 2:h.sent(),h.label=3;case 3:if(c.failedDetails.find((function(e){return e.id===t.id})))throw new Error("Failed to add media source");return o.isSelected&&(this.unselectMediaSource(this.selectedSource),this.selectedSource=t),this.trtcSourceMap.set(r,s),null===(i=this.mediaMixingDesigner)||void 0===i||i.addMedia({id:o.id,rect:this._getDesignerMediaRect(t),isSelected:!!ge(o.isSelected)||o.isSelected,origin:o,interaction:o.interaction}),o.isSelected&&(this.selectedSource=o),this.sourceList.push(o),[2]}}))}))},t.prototype.removeMediaSource=function(t){var i,o,r;return p(this,void 0,Promise,(function(){var n,s,a,c,u,l;return T(this,(function(d){switch(d.label){case 0:if(this.logger.log("".concat(this.logPrefix,"removeMediaSource:"),t),-1===(n=this.findMediaSourceIndex(t)))throw new Error("Not existing media source to remove");return s=this._getTRTCSourceKey(t),a=be(this.trtcSourceMap.get(s))||[],c=a.findIndex((function(e){return e.id===t.id})),a.splice(c,1),[4,this.trtc.updatePlugin("VideoMixer",(l={},l[s]=a,l))];case 1:return u=d.sent().result,t.type===e.TRTCMediaSourceType.kScreen&&this.screensWithSystemAudio.has(t.id)?(this.screensWithSystemAudio.delete(t.id),[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(t.id)})]):[3,3];case 2:d.sent(),d.label=3;case 3:if(u.failedDetails.find((function(e){return e.id===t.id})))throw new Error("Failed to remove media source");return null===(i=this.mediaMixingDesigner)||void 0===i||i.removeMedia({id:t.id,rect:null===(o=t.layout)||void 0===o?void 0:o.rect,isSelected:t.isSelected||!1,origin:be(t)}),(null===(r=this.selectedSource)||void 0===r?void 0:r.id)===t.id&&(this.selectedSource=null),this.trtcSourceMap.set(s,a),this.sourceList.splice(n,1),[2]}}))}))},t.prototype._getDesignerMediaRect=function(t){var i,o,r=(null===(i=t.layout)||void 0===i?void 0:i.rect)||{left:0,top:0,right:0,bottom:0},n=r.left,s=r.top,a=r.right,c=r.bottom,u=a-n,l=c-s;switch(null===(o=t.layout)||void 0===o?void 0:o.rotation){case e.TRTCVideoRotation.TRTCVideoRotation0:case e.TRTCVideoRotation.TRTCVideoRotation180:return{left:n,top:s,right:a,bottom:c};case e.TRTCVideoRotation.TRTCVideoRotation90:case e.TRTCVideoRotation.TRTCVideoRotation270:return{left:n,top:s,right:n+l,bottom:s+u};default:return{left:n,top:s,right:a,bottom:c}}},t.prototype._getPluginMediaRect=function(t){var i,o,r=(null===(i=t.layout)||void 0===i?void 0:i.rect)||{left:0,top:0,right:0,bottom:0},n=r.left,s=r.top,a=r.right,c=r.bottom;switch(null===(o=t.layout)||void 0===o?void 0:o.rotation){case e.TRTCVideoRotation.TRTCVideoRotation0:case e.TRTCVideoRotation.TRTCVideoRotation180:return{left:n,top:s,right:a,bottom:c};case e.TRTCVideoRotation.TRTCVideoRotation90:case e.TRTCVideoRotation.TRTCVideoRotation270:return{left:n,top:s,right:n+(c-s),bottom:s+(a-n)};default:return{left:n,top:s,right:a,bottom:c}}},t.prototype.updateMediaSource=function(e){var t,i;return p(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,l;return T(this,(function(h){switch(h.label){case 0:if(this.logger.log("".concat(this.logPrefix,"updateMediaSource:"),e),-1===(o=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to update");return r=d(d({},this.sourceList[o]),be(e)),e.isSelected?(this.unselectMediaSource(this.selectedSource),this.selectedSource=e):(null===(t=this.selectedSource)||void 0===t?void 0:t.id)===e.id&&(this.selectedSource=null),n=this._getTRTCSourceKey(r),s=this._getTRTCSourceItem(r),a=be(this.trtcSourceMap.get(n))||[],c=a.findIndex((function(t){return t.id===e.id})),a[c]=s,[4,this.trtc.updatePlugin("VideoMixer",(l={},l[n]=a,l))];case 1:if(h.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return u={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:be(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(u)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(u),this.trtcSourceMap.set(n,a),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(){return p(this,void 0,Promise,(function(){return T(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 p(this,void 0,Promise,(function(){return T(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(e){var t,i,o,r,n;return p(this,void 0,Promise,(function(){var s,a,u,l,d,h,p,f,v,m,R,y,C,_,b,S,M,w,E,V,A,P,L,I;return T(this,(function(T){switch(T.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),e),s=this.publishParams,this.publishParams=e,a=this._getCanvasSize(e.videoEncoderParams.videoResolution,e.videoEncoderParams.resMode),u=a.width,l=a.height,T.label=1;case 1:return T.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:u,height:l,canvasColor:String(e.canvasColor)}})];case 2:return T.sent(),[3,4];case 3:if((d=T.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw d;return[3,4];case 4:null===(o=this.mediaMixingDesigner)||void 0===o||o.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),T.label=5;case 5:T.trys.push([5,11,12,17]),h=g(this.sourceList),T.label=6;case 6:return[4,h.next()];case 7:return(p=T.sent()).done?[3,10]:(f=p.value).layout?(v=f.layout.rect||{left:0,top:0,right:0,bottom:0},m=v.left,R=v.top,y=v.right,C=v.bottom,_=this._getCanvasSize(s.videoEncoderParams.videoResolution),b=_.width,S=_.height,M=this._getCanvasSize(e.videoEncoderParams.videoResolution),w=M.width,E=M.height,V=m*w/b,A=R*E/S,P=y*w/b,L=C*E/S,f.layout.rect={left:V,top:A,right:P,bottom:L},[4,this.updateMediaSource(f)]):[3,9];case 8:T.sent(),null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",f,null===(n=f.layout)||void 0===n?void 0:n.rect),T.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return I=T.sent(),t={error:I},[3,17];case 12:return T.trys.push([12,,15,16]),p&&!p.done&&(i=h.return)?[4,i.call(h)]:[3,14];case 13:T.sent(),T.label=14;case 14:return[3,16];case 15:if(t)throw t.error;return[7];case 16:return[7];case 17:return[4,this.trtcCloud.setVideoEncoderParam(e.videoEncoderParams)];case 18:return T.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 t,i;this.view&&(this.mediaMixingDesigner=new Un({view:this.view,videoResolution:(null===(t=this.publishParams)||void 0===t?void 0:t.videoEncoderParams.videoResolution)||e.TRTCVideoResolution.TRTCVideoResolution_1920_1080,resMode:(null===(i=this.publishParams)||void 0===i?void 0:i.videoEncoderParams.resMode)||e.TRTCVideoResolutionMode.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 p(this,void 0,void 0,(function(){return T(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(d(d({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(d(d({},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=d(d({},e.origin),{layout:d(d({},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=d(d({},e.origin),{layout:d(d({},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 p(this,void 0,Promise,(function(){var o;return T(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:be(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}(),Gn=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=d(d({},e),{functionName:o}),a=new Promise((function(e,t){s.resolve=e,s.reject=t}));if(s.promise=a,t)this.length<=1?this.queue.push(s):null===(n=null===(r=this.lastQueueItem)||void 0===r?void 0:r.promise)||void 0===n||n.then(s.resolve,s.reject);else{if(i&&o&&this.queue.length>1){var c=[];this.queue=this.queue.filter((function(e,t){return 0===t||(e.functionName!==o||(c.push(e),!1))})),c.forEach((function(e){e.reject(new Error("aborted by newer task"))}))}this.queue.push(s)}return this.isRunning||this.callNext(),a},e.prototype.shift=function(){return this.queue.shift()},e.prototype.callNext=function(){var e=this;if(!this.isRunning&&0!==this.length){var t=this.queue[0],i=t.fn,o=t.args,r=t.context,n=t.resolve,s=t.reject;this.isRunning=!0,i.apply(r,o).then(n,s).finally((function(){e.isRunning=!1,e.shift(),e.callNext()}))}},e}(),Yn=new WeakMap,Kn=new WeakMap,Jn=new WeakMap;function Xn(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=Jn.get(this)||new Map;Jn.set(this,c);for(var u=null,l=0,d=s;l<d.length;l++){var h=d[l],p=c.get(h);if(p){u=p;break}}for(var T=u||new Gn,f=0,v=s;f<v.length;f++){h=v[f];c.set(h,T)}var g=a?o:void 0;return T.push({fn:n,args:t,context:this},!1,a,g)},r}}var $n=function(){function e(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 e.prototype.registerStateListener=function(){this.trtc.on(c.default.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},e.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)}},e.prototype.updateMessageSubscription=function(){var e=!this.isPaused&&this.listeners.size>0;if(e&&!this.isMessageListenerRegistered)return this.trtc.on(c.default.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),void(this.isMessageListenerRegistered=!0);!e&&this.isMessageListenerRegistered&&(this.trtc.off(c.default.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),this.isMessageListenerRegistered=!1)},e.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,v([e,this.logPrefix],i,!1))},e.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,v([e,this.logPrefix],i,!1))},e.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)}}))},e.prototype.startRealtimeTranscriber=function(e){return p(this,void 0,Promise,(function(){var t,i,o;return T(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]}}))}))},e.prototype.stopRealtimeTranscriber=function(e){return p(this,void 0,Promise,(function(){var t;return T(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]}}))}))},e.prototype.pauseReceivingMessage=function(){this.isPaused||(this.log("pauseReceivingMessage"),this.isPaused=!0,this.updateMessageSubscription())},e.prototype.resumeReceivingMessage=function(){this.isPaused&&(this.log("resumeReceivingMessage"),this.isPaused=!1,this.updateMessageSubscription())},e.prototype.addListener=function(e){this.listeners.add(e),this.updateMessageSubscription()},e.prototype.removeListener=function(e){this.log("removeListener"),this.listeners.delete(e),this.updateMessageSubscription()},e.prototype.destroy=function(){this.log("destroy"),this.listeners.clear(),this.isPaused=!0,this.updateMessageSubscription(),this.trtc.off(c.default.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},e}(),Zn=c.default._loggerManager;Zn.info("TRTCCloud Version: ".concat(Vn));var es,ts,is,os="trtcCloud",rs=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(es=function(){0!==ns.size&&Array.from(ns.values()).forEach((function(e){e.fn()}))},ts=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];is>0&&clearTimeout(is),is=window.setTimeout((function(){es.apply(e,t),is=-1}),ts)}));var ns=new Map,ss=function(t){function s(o){void 0===o&&(o={});var r=t.call(this)||this;r._version="",r._frameWorkType=30,r._component=0,r._language=0,r._networkProxy={},r._localView=null,r._autoRecvAudio=!0,r._autoRecvVideo=!1,r._localTestView=null,r._isVideoPublish=!0,r._localRenderParams={rotation:e.TRTCVideoRotation.TRTCVideoRotation0,fillMode:e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,mirrorType:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto},r._encoderMirror=void 0,r._videoProfile={},r._isAudioPublish=!0,r._audioMuteType=!1,r._audioProfile=c.default.TYPE.AUDIO_PROFILE_STANDARD,r._captureVolume=100,r._playoutVolume=100,r._isSharingScreen=!1,r._remoteStreamConfig=new Map,r._remoteStreamMap=new Map,r._cameraList=[],r._microphoneList=[],r._speakerList=[],r._currentCamera={},r._currentMicrophone={},r._currentSpeaker={},r._currentCameraId="",r._currentMicrophoneId="",r._currentSpeakerId="",r._screenShareParams={option:{}},r._isMobile=Wr,r._isFrontCamera=!0,r._cameraVideoTrack=null,r._smallStreamVideoProfile=void 0,r._qosPreference=void 0,r._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},r._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},r._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},r._isVirtualBackground=!1,r._isTestVirtualBackground=!1,r._isBeautyEnabled=!1,r._isTestBeautyEnabled=!1,r._remoteStatisticsUserIdList=[],r._hasJoinedRoom=!1,r._isExitingRoom=!1,r._version=Vn;var a=o.frameWorkType,l=void 0===a?30:a,d=o.component,h=void 0===d?0:d,p=o.language,T=void 0===p?0:p;return r._frameWorkType=l,r._component=h,r._language=T,r._trtc=c.default.create({enableSEI:s.enableSEI,assetsPath:s.assetsPath,enableVolumeControlInIOS:!0,plugins:[u.default,i.LEBPlayer,n.RealtimeTranscriber]}),r._testTrtc=c.default.create(),r._log=c.default._loggerManager,r.logger=new Pn(Zn,{seq:rs++}),r._echoCancellation=void 0,r._noiseSuppression=void 0,r._autoGainControl=void 0,r._addTRTCEvents(),r.handleDeviceChange=r.handleDeviceChange.bind(r),ns.set(r,{fn:r.handleDeviceChange,self:r}),r}var a;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}l(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(s,t),s.getPlugin=function(e){return"VirtualBackground"===e?o.VirtualBackground:"BasicBeauty"===e?r.BasicBeauty:"VideoMixer"===e?u.default:null},s.getTRTCShareInstance=function(e){return s.shareInstance||(s.shareInstance=new s(e)),s.shareInstance},s.setLogLevel=function(t,i){var o,r=((o={})[e.TRTCLogLevel.TRTCLogLevelVerbose]=0,o[e.TRTCLogLevel.TRTCLogLevelDebug]=1,o[e.TRTCLogLevel.TRTCLogLevelInfo]=2,o[e.TRTCLogLevel.TRTCLogLevelWarn]=3,o[e.TRTCLogLevel.TRTCLogLevelError]=4,o[e.TRTCLogLevel.TRTCLogLevelFatal]=4,o[e.TRTCLogLevel.TRTCLogLevelNone]=5,o),n=r[t];ge(n)&&(n=r[e.TRTCLogLevel.TRTCLogLevelInfo]);var s=!Re(i)||i;c.default.setLogLevel(n,s)},s.destroyTRTCShareInstance=function(){s.shareInstance&&(s.shareInstance._destroy(),s.shareInstance=null),Array.from(s.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},s.callExperimentalAPI=function(e){console.log("static ".concat(os,".callExperimentalAPI"),e);var t=ye(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":s.enableSEI=o.enable;break;case"setAssetsPath":s.assetsPath=o.assetsPath}}catch(r){throw r}}},s.prototype.createSubCloud=function(){if(this!==s.shareInstance)return null;var e=new s;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),s.subCloudMap.set(e,e),e},s.prototype.destroy=function(){this!==s.shareInstance?(s.subCloudMap.get(this)&&s.subCloudMap.delete(this),this._destroy()):s.destroyTRTCShareInstance()},s.prototype._destroy=function(){ns.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},s.prototype.getSDKVersion=function(){return this._version||""},s.prototype.enterRoom=function(e,t){return p(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,l,h,p,f,v,g,m,R,y,C;return T(this,(function(T){switch(T.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,a=e.role,c=e.privateMapKey,u=e.businessInfo,l=e.enableAutoPlayDialog,h=e.proxy,p=e.streamId,f=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(os,".enterRoom with params: "),e,t),h&&(this._networkProxy=h),!(i&&o&&r))return[3,5];T.label=1;case 1:return T.trys.push([1,3,,4]),v={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:pe[a],scene:Te[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},v=c?d(d({},v),{privateMapKey:c}):v,v=u?d(d({},v),{businessInfo:u}):v,g=l||this._enableAutoPlayDialog,v=Re(g)?d(d({},v),{enableAutoPlayDialog:g}):v,v=this._networkProxy?d(d({},v),{proxy:this._networkProxy}):v,v=p?d(d({},v),{streamId:p}):v,v=f?d(d({},v),{userDefineRecordId:f}):v,v=void 0!==this._latencyLevel?d(d({},v),{latencyLevel:this._latencyLevel}):v,m=ve(),[4,this._trtc.enterRoom(v)];case 2:return T.sent(),this._hasJoinedRoom=!0,R=ve()-m,this.emit("onEnterRoom",R),[3,4];case 3:return y=T.sent(),C=(C=this._transformTRTCErrorCode(y,"enterRoom"))<0?C:-1,this.emit("onEnterRoom",C),this._callFunctionErrorManage(y,"enterRoom"),[3,4];case 4:return[3,6];case 5:this._emitError(wn),T.label=6;case 6:return[2]}}))}))},s.prototype.exitRoom=function(){return p(this,void 0,Promise,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(os,".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",ln.exitRoom),[3,3];case 2:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,3];case 3:return[2]}}))}))},s.prototype.switchRole=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(pe[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(pe[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]}}))}))},s.prototype.setDefaultStreamRecvMode=function(e,t){return p(this,void 0,void 0,(function(){return T(this,(function(i){return this.logger.info("".concat(os,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),Re(e)&&(this._autoRecvAudio=e),Re(t)&&(this._autoRecvVideo=t),[2]}))}))},s.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()},s.prototype._updateLocalVideo=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalTestVideo=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalScreen=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateRemoteVideo=function(e,t){return p(this,void 0,void 0,(function(){var i;return T(this,(function(o){switch(o.label){case 0:if(!this._hasJoinedRoom||this._isExitingRoom)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(e,t))];case 2:return o.sent(),[3,4];case 3:if((i=o.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw i;return[3,4];case 4:return[2]}}))}))},s.prototype.startLocalPreview=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return p(this,void 0,Promise,(function(){var t,i,o,r,n;return T(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(os,".startLocalPreview with params: "),e),1===v([],e,!0).length?i=v([],e,!0)[0]:2===v([],e,!0).length&&(n=v([],e,!0),t=n[0],i=n[1]),ge(t)||(this._setIsMobile(!0),this._setIsFrontCamera(t)),this._setLocalView(i),s.label=1;case 1:s.trys.push([1,9,,10]),s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return s.sent(),[3,8];case 4:return(o=s.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return s.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return this.emit("onCameraDidReady"),[3,10];case 9:return r=s.sent(),this._callFunctionErrorManage(r,"startLocalPreview"),[3,10];case 10:return[2]}}))}))},s.prototype.updateLocalView=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(os,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},s.prototype.stopLocalPreview=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(os,".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(os," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},s.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.startRemoteView=function(t,i,o){return p(this,void 0,void 0,(function(){var r,n;return T(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(os,".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===e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(o))))return[2];s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,o))];case 3:return s.sent(),[3,8];case 4:return(r=s.sent()).code!==c.default.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]}}))}))},s.prototype.updateRemoteView=function(e,t,i){return p(this,void 0,void 0,(function(){return T(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(os,".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]}}))}))},s.prototype.stopRemoteView=function(e,t){return p(this,void 0,void 0,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.stopAllRemoteView=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.setVideoEncoderParam=function(t){return p(this,void 0,void 0,(function(){var i,o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(os,".setVideoEncoderParam with params: "),t),r.label=1;case 1:return r.trys.push([1,4,,5]),i=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,t),this._setVideoProfile(i),[4,this._updateLocalVideo()];case 2:return r.sent(),[4,this._updateLocalTestVideo()];case 3:return r.sent(),[3,5];case 4:return o=r.sent(),this._callFunctionErrorManage(o,"setVideoEncoderParam"),[3,5];case 5:return[2]}}))}))},s.prototype.setNetworkQosParam=function(e){return p(this,void 0,void 0,(function(){var t,i,o=this;return T(this,(function(r){return this.logger.info("".concat(os,".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)}))}))]}))}))},s.prototype.setLocalRenderParams=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.setVideoEncoderMirror=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.setRemoteRenderParams=function(e,t,i){return p(this,void 0,void 0,(function(){var o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype._updateLocalAudio=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalTestAudio=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),p(this,void 0,void 0,(function(){var i,o,r;return T(this,(function(n){switch(n.label){case 0:t===e.TRTCAudioQuality.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(os,".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!==c.default.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(os," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),[3,10];case 10:return[2]}}))}))},s.prototype.stopLocalAudio=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.setAudioCaptureVolume=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(os,".getAudioCaptureVolume")),this._getCaptureVolume()},s.prototype.setAudioPlayoutVolume=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(os,".getAudioPlayoutVolume")),this._playoutVolume},s.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),p(this,void 0,void 0,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".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(wn),[2]);case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},s.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(os,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},s.prototype.muteRemoteVideoStream=function(e,t,i){return p(this,void 0,void 0,(function(){var o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.muteAllRemoteVideoStreams=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(os,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){this._callFunctionErrorManage(i,"setRemoteAudioVolume")}},s.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(os,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},s.prototype.enableSmallVideoStream=function(t,i){return p(this,void 0,Promise,(function(){var o;return T(this,(function(r){switch(r.label){case 0:return this.logger.info("".concat(os,".enableSmallVideoStream with params: "),t,i),t?(o=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall,i),this._setSmallStreamVideoProfile(o)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return r.sent(),[2]}}))}))},s.prototype.snapshotVideo=function(t,i){var o="";return o=""===t&&i===e.TRTCVideoStreamType.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===t&&i===e.TRTCVideoStreamType.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(i)}):this._trtc.getVideoSnapshot({userId:t,streamType:this._getTRTCStreamType(i)}),this.emit("onSnapshotComplete",t,i,o),o},s.prototype.startScreenShare=function(t,i,o){return p(this,void 0,void 0,(function(){var r,n,s,a,u,l;return T(this,(function(d){switch(d.label){case 0:this.logger.info("".concat(os,".startScreenShare with params: "),t,i,o),d.label=1;case 1:return d.trys.push([1,3,,4]),n=(r=o||{}).screenAudio,s=void 0!==n&&n,a=r.videoTrack,u=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,o),this._setScreenShareParams({view:t,profile:u,systemAudio:s,videoTrack:a,streamType:i}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return d.sent(),this._isSharingScreen=!0,this.emit("onScreenCaptureStarted"),[3,4];case 3:if((l=d.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw console.error("Start share screen error:",l,l.code,l.name,l.message),l;return[3,4];case 4:return[2]}}))}))},s.prototype.setSubStreamEncoderParam=function(t){return p(this,void 0,void 0,(function(){var i,o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(os,".setSubStreamEncoderParam with params: "),t),i=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,t),this._setScreenShareParams({profile:i}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._updateLocalScreen()];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"setSubStreamEncoderParam"),[3,4];case 4:return[2]}}))}))},s.prototype.stopScreenShare=function(){return p(this,void 0,Promise,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype._startPublishVideoTrack=function(e){var t=e.videoTrack;return p(this,void 0,void 0,(function(){var e,i;return T(this,(function(o){switch(o.label){case 0:o.trys.push([0,7,,8]),o.label=1;case 1:return o.trys.push([1,3,,6]),[4,this._trtc.startLocalVideo({option:{videoTrack:t,profile:this._getVideoProfile()},forcePublish:!0})];case 2:return o.sent(),[3,6];case 3:return(e=o.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._trtc.updateLocalVideo({option:{videoTrack:t,profile:this._getVideoProfile()},forcePublish:!0})];case 4:o.sent(),o.label=5;case 5:throw e;case 6:return[3,8];case 7:return i=o.sent(),this._callFunctionErrorManage(i,"startPublishVideoTrack"),[3,8];case 8:return[2]}}))}))},s.prototype._stopPublishVideoTrack=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},s.prototype.startScreenCapture=function(){this._emitError(En)},s.prototype.pauseScreenCapture=function(){this._emitError(En)},s.prototype.resumeScreenCapture=function(){this._emitError(En)},s.prototype.getScreenCaptureSources=function(){this._emitError(En)},s.prototype.selectScreenCaptureTarget=function(){this._emitError(En)},s.prototype.getCameraDevicesList=function(){return p(this,void 0,Promise,(function(){var e,t,i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".getCameraDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,c.default.getCameraList()];case 2:return e=o.sent(),t=e.map((function(e){return d(d({},e),{deviceName:e.label})})),this._cameraList=e,"{}"!==JSON.stringify(this._currentCamera)?[3,4]:(this._currentCamera=this.getDefaultDeviceInfo(e),this._currentCameraId=this._currentCamera.deviceId,[4,this.setCurrentCameraDevice(this._currentCameraId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getCameraDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentCameraDevice=function(e){var t;return p(this,void 0,Promise,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(os,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new L(t,i,o,i,r)},s.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},s.prototype.switchCamera=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(os,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},s.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},s.prototype.setVirtualBackground=function(e){return p(this,void 0,void 0,(function(){var t,i,o,r,n;return T(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!==de?[3,2]:[4,this._trtc.updatePlugin(ue,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==he?[3,4]:[4,this._trtc.updatePlugin(ue,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(ue,d(d({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._trtc.stopPlugin(ue),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(os,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},s.prototype.setTestVirtualBackground=function(e){return p(this,void 0,void 0,(function(){var t,i,o,r,n;return T(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!==de?[3,2]:[4,this._testTrtc.updatePlugin(ue,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==he?[3,4]:[4,this._testTrtc.updatePlugin(ue,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(ue,d(d({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isTestVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._testTrtc.stopPlugin(ue),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(os,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},s.prototype.useVirtualBackground=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:o.VirtualBackground,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:o.VirtualBackground,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},s.prototype.setBeautyStyle=function(e,t,i,o){return p(this,void 0,void 0,(function(){return T(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]}}))}))},s.prototype.setTestBeautyStyle=function(e,t,i,o){return p(this,void 0,void 0,(function(){return T(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]}}))}))},s.prototype.useBeautyStyle=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:r.BasicBeauty,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:r.BasicBeauty,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},s.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return p(this,void 0,void 0,(function(){var i,a,c,u,l;return T(this,(function(d){switch(d.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");d.label=1;case 1:return d.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(le)]:[3,3];case 2:return d.sent(),s?this._isTestBeautyEnabled=!1:this._isBeautyEnabled=!1,[3,7];case 3:return u={beauty:i,brightness:a,ruddy:c},t?[3,5]:[4,e.startPlugin(le,u)];case 4:return d.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(le,u)];case 6:d.sent(),d.label=7;case 7:return[3,9];case 8:throw l=d.sent(),s?this.logger.error("".concat(os,".").concat("setTestBeautyStyle"," fail: "),l):this.logger.error("".concat(os,".").concat("setBeautyStyle"," fail: "),l),l;case 9:return[2]}}))}))},s.prototype._resetBeautyStyle=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(le)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(le)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},s.prototype.getMicDevicesList=function(){return p(this,void 0,Promise,(function(){var e,t,i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".getMicDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,c.default.getMicrophoneList()];case 2:return e=o.sent(),t=e.map((function(e){return d(d({},e),{deviceName:e.label})})),this._microphoneList=e,"{}"!==JSON.stringify(this._currentMicrophone)?[3,4]:(this._currentMicrophone=this.getDefaultDeviceInfo(e),this._currentMicrophoneId=this._currentMicrophone.deviceId,[4,this.setCurrentMicDevice(this._currentMicrophoneId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getMicDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentMicDevice=function(e){var t;return p(this,void 0,Promise,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(os,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new L(t,i,o,i,r)},s.prototype.getSpeakerDevicesList=function(){return p(this,void 0,Promise,(function(){var e,t,i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".getSpeakerDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,c.default.getSpeakerList()];case 2:return e=o.sent(),t=e.map((function(e){return d(d({},e),{deviceName:e.label})})),this._speakerList=e,"{}"!==JSON.stringify(this._currentSpeaker)?[3,4]:(this._currentSpeaker=this.getDefaultDeviceInfo(e),this._currentSpeakerId=this._currentSpeaker.deviceId,[4,this.setCurrentSpeakerDevice(this._currentSpeakerId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentSpeakerDevice=function(e){return p(this,void 0,Promise,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".setCurrentSpeakerDevice with params: "),{speakerId:e}),i.label=1;case 1:return i.trys.push([1,3,,4]),e?[4,c.default.setCurrentSpeaker(e)]:[2,!1];case 2:return i.sent(),this._setCurrentSpeakerId(e),this._currentSpeaker=this._speakerList.find((function(t){return t.deviceId===e}))||{},[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"setCurrentSpeakerDevice"),t;case 4:return[2]}}))}))},s.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(os,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new L(t,i,o,i,r)},s.prototype.startCameraDeviceTest=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:if(this.logger.info("".concat(os,".startCameraDeviceTest with params: "),e),!e)return[2];this._setLocalTestView(e),i.label=1;case 1:return i.trys.push([1,3,,7]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return i.sent(),[3,7];case 3:return(t=i.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return i.sent(),[3,6];case 5:throw this._callFunctionErrorManage(t,"startCameraDeviceTest"),t;case 6:return[3,7];case 7:return[2]}}))}))},s.prototype.stopCameraDeviceTest=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(os,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},s.prototype.startMicDeviceTest=function(e){return p(this,void 0,void 0,(function(){var t,i=this;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".startMicDeviceTest with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,7]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return o.sent(),[3,7];case 3:return(t=o.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return o.sent(),[3,6];case 5:throw this._callFunctionErrorManage(t,"startMicDeviceTest"),t;case 6:return[3,7];case 7:return this._testTrtc.on(c.default.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,o=e.volume;""===t&&i.emit("onTestMicVolume",o)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(e)];case 8:return o.sent(),[2]}}))}))},s.prototype.stopMicDeviceTest=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(os,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},s.prototype.callExperimentalAPI=function(e){return p(this,void 0,void 0,(function(){var t,i,o;return T(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(os,".callExperimentalAPI"),e),(t=ye(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]}}))}))},s.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;me(t)&&(this._frameWorkType=t),me(i)&&(this._component=i),me(o)&&(this._language=o)},s.prototype._handleKeyMetricsStats=function(e){var t=e.key,i=e.opt,o=e.value,r=e.version,n=i===fe;c.default._addKVStat({type:i,key:t,value:o,version:r,useUV:n,base:100})},s.prototype._setVideoEncodeParamEx=function(t){return p(this,void 0,void 0,(function(){return T(this,(function(i){switch(i.label){case 0:switch(t.streamType){case e.TRTCVideoStreamType.TRTCVideoStreamTypeBig:return[3,1];case e.TRTCVideoStreamType.TRTCVideoStreamTypeSub:return[3,3]}return[3,5];case 1:return[4,this.setVideoEncoderParam(t)];case 2:case 4:return i.sent(),[3,6];case 3:return[4,this.setSubStreamEncoderParam(t)];case 5:return[3,6];case 6:return[2]}}))}))},s.prototype._switchPlaybackQuality=function(e){return p(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return T(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]}}))}))},s.prototype._requestPictureInPicture=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(os,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},s.prototype._exitPictureInPicture=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(os,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},s.prototype._emitError=function(e){e&&this.emit&&this.emit(ne,e.code,e.message)},s.prototype._emitWarning=function(e){this.emit&&this.emit(se,e)},s.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?Mn:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},s.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:vn},s.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},s.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},s.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 gn;if(o)return Cn;break;case 5302:if(i)return mn;if(o)return _n;break;case 5303:if(i)return yn;if(o)return Sn;break;case 5304:if(i)return Rn;if(o)return bn}},s.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?gn:o?Cn:e.code},s.prototype._transformTRTCErrorCode=function(e,t){var i=null==e?void 0:e.code;if(e&&e.code)switch(e.code){case c.default.ERROR_CODE.DEVICE_ERROR:i=this._transformTRTCDeviceError(e,t);break;case c.default.ERROR_CODE.SERVER_ERROR:i=this._transformTRTCServerError(e);break;case c.default.ERROR_CODE.INVALID_OPERATION:case c.default.ERROR_CODE.OPERATION_ABORT:i=this._transformTRTCInvalidOperationError(e,t);break;case c.default.ERROR_CODE.UNKNOWN_ERROR:i=this._transformTRTCUnKnowError(e,t)}return i},s.prototype._callFunctionErrorManage=function(e,t){if(!e||e.code!==c.default.ERROR_CODE.OPERATION_ABORT){this.logger.warn("(".concat(t,") failed - ").concat(e.code," - ").concat(e.message));var i=this._transformTRTCErrorCode(e,t);this.emit(ne,i,e.message)}},s.prototype._getTRTCResolution=function(t){var i=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(i.length>1&&i[1]),height:+(i.length>2&&i[2])}},s.prototype._getTRTCVideoProfile=function(t,i){void 0===i&&(i={});var o=i.videoWidth,r=i.videoHeight,n=i.videoResolution,s=i.videoFps,a=i.videoBitrate,c=i.resMode,u=i.resolutionMode,l={};switch(t){case e.TRTCVideoStreamType.TRTCVideoStreamTypeSub:l=this._defaultScreenProfile;break;case e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall:l=this._defaultSmallVideoProfile;break;case e.TRTCVideoStreamType.TRTCVideoStreamTypeBig:default:l=this._defaultVideoProfile}if(ge(n))ge(o)||(l.width=o),ge(r)||(l.height=r);else{var d=this._getTRTCResolution(n);l.width=d.width,l.height=d.height}if(!ge(c)&&c===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait||!ge(u)&&u===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait){var h=l.height,p=l.width;l.width=h,l.height=p}return s&&(l.frameRate=s),a&&(l.bitrate=a),l},s.prototype._getTRTCStreamType=function(t){var i;return((i={})[e.TRTCVideoStreamType.TRTCVideoStreamTypeBig]=c.default.TYPE.STREAM_TYPE_MAIN,i[e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall]=c.default.TYPE.STREAM_TYPE_MAIN,i[e.TRTCVideoStreamType.TRTCVideoStreamTypeSub]=c.default.TYPE.STREAM_TYPE_SUB,i)[t]},s.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=un.COVER,i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=un.CONTAIN,i)[t]},s.prototype._getTRTCCloudVideoFillMode=function(t){var i;return((i={})[un.COVER]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,i[un.CONTAIN]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit,i)[t]},s.prototype._getTRTCCloudMirrorType=function(t){return!0===t?e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable},s.prototype._getLocalRenderMirror=function(t){var i;return t===e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i)[t]},s.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return ge(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},s.prototype._getTRTCRemoteMirror=function(t){var i;return((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto]=!1,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i)[t]},s.prototype._getTRTCQosPreference=function(t){var i;return((i={})[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceSmooth]=c.default.TYPE.QOS_PREFERENCE_SMOOTH,i[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear]=c.default.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},s.prototype._getTRTCAudioQuality=function(t){var i;return((i={})[e.TRTCAudioQuality.TRTCAudioQualitySpeech]=c.default.TYPE.AUDIO_PROFILE_STANDARD,i[e.TRTCAudioQuality.TRTCAudioQualityDefault]=c.default.TYPE.AUDIO_PROFILE_STANDARD,i[e.TRTCAudioQuality.TRTCAudioQualityMusic]=c.default.TYPE.AUDIO_PROFILE_HIGH_STEREO,i)[t]},s.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},s.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},s.prototype._getTRTCCloudQuality=function(t){return[e.TRTCQuality.TRTCQuality_Unknown,e.TRTCQuality.TRTCQuality_Excellent,e.TRTCQuality.TRTCQuality_Good,e.TRTCQuality.TRTCQuality_Poor,e.TRTCQuality.TRTCQuality_Bad,e.TRTCQuality.TRTCQuality_Vbad,e.TRTCQuality.TRTCQuality_Down][t]},s.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},s.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},s.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return Re(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),Re(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),Re(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},s.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},s.prototype._generateRemoteVideoData=function(e,t){return be(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},s.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(c.default.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(c.default.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(c.default.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(c.default.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(c.default.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(c.default.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(c.default.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(c.default.EVENT.AUDIO_VOLUME,(function(e){(null==e?void 0:e.result)&&t.emit("onUserVoiceVolume",null==e?void 0:e.result,((null==e?void 0:e.result)||[]).length)})),this._trtc.on(c.default.EVENT.KICKED_OUT,(function(e){var i={banned:ln.banned,room_disband:ln.roomDisband};me(i[e.reason])&&t.emit("onExitRoom",i[e.reason])})),this._trtc.on(c.default.EVENT.NETWORK_QUALITY,(function(e){var i=e.uplinkNetworkQuality,o=e.downlinkNetworkQuality,r=new N("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new N(e,t._getTRTCCloudQuality(o))}))),t.emit("onNetworkQuality",r,n)})),this._trtc.on(c.default.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),this._trtc.on(c.default.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(c.default.EVENT.STATISTICS,(function(i){var o,r=i.rtt,n=i.upLoss,s=i.downLoss,a=i.bytesSent,c=i.bytesReceived,u=i.localStatistics,l=i.remoteStatistics;t._remoteStatisticsUserIdList=l.map((function(e){return e.userId}));var d={big:e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,small:e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall,sub:e.TRTCVideoStreamType.TRTCVideoStreamTypeSub},h=(null===(o=u.video)||void 0===o?void 0:o.length)>0?u.video.map((function(e){var t=new W;return t.width=e.width,t.height=e.height,t.frameRate=e.frameRate,t.videoBitrate=e.bitrate,t.audioBitrate=u.audio.bitrate||0,t.streamType=d[e.videoType],t})):[];if(0===h.length&&u.audio.bitrate>0){var p=new W;p.audioBitrate=u.audio.bitrate||0,h.push(p)}var T=[];l.forEach((function(e){var t=[],i=e.userId,o=e.audio.bitrate;if(e.video&&e.video.forEach((function(e){var r=new j;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=d[e.videoType],t.push(r)})),0===t.length){var r=new j;r.userId=i,r.audioBitrate=o||0,t.push(r)}T.push.apply(T,t)}));var f=new U;f.upLoss=n,f.downLoss=s,f.rtt=r,f.sentBytes=a,f.receivedBytes=c,f.localStatisticsArray=h,f.localStatisticsArraySize=h.length,f.remoteStatisticsArray=T,f.remoteStatisticsArraySize=T.length,t.emit("onStatistics",f)})),this._trtc.on(c.default.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._clearScreenShareParams(),t._isSharingScreen=!1})),this._trtc.on(c.default.EVENT.PUBLISH_STATE_CHANGED,(function(i){var o=i.mediaType;"started"===i.state&&("audio"===o?t.emit("onSendFirstLocalAudioFrame"):"video"===o?t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig):"screen"===o&&t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub))})),this._trtc.on(c.default.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(c.default.EVENT.AUDIO_PLAY_STATE_CHANGED,(function(e){var i=e.userId;"PLAYING"===e.state&&t.emit("onFirstAudioFrame",i)})),this._trtc.on(c.default.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(c.default.EVENT.CUSTOM_MESSAGE,(function(e){e&&t.emit("onRecvCustomCmdMsg",e.userId,e.cmdId,e.seq,null==e?void 0:e.data)})),this._trtc.on(c.default.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(c.default.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},s.prototype._removeTRTCEvents=function(){this._trtc.off("*")},s.prototype._emitVideoAvailable=function(e,t){var i=e.userId,o=e.streamType;t?this._remoteStreamMap.set("".concat(i,"_").concat(o),!0):this._remoteStreamMap.delete("".concat(i,"_").concat(o)),o===c.default.TYPE.STREAM_TYPE_SUB?i&&this.emit("onUserSubStreamAvailable",i,t):i&&this.emit("onUserVideoAvailable",i,t)},s.prototype._setLocalView=function(e){this._localView=e},s.prototype._getLocalView=function(){return this._localView},s.prototype._setIsMobile=function(e){this._isMobile=e},s.prototype._getIsMobile=function(){return this._isMobile},s.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},s.prototype._getIsFrontCamera=function(){return this._isFrontCamera},s.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},s.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},s.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},s.prototype._getIsVideoPublish=function(){return this._isVideoPublish},s.prototype._setVideoProfile=function(e){this._videoProfile=e},s.prototype._getVideoProfile=function(){return this._videoProfile},s.prototype._setQosPreference=function(e){this._qosPreference=e},s.prototype._getQosPreference=function(){return this._qosPreference},s.prototype._setLocalTestView=function(e){this._localTestView=e},s.prototype._getLocalTestView=function(){return this._localTestView},s.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;ge(t)||(this._screenShareParams.view=t),ge(i)||(this._screenShareParams.option.systemAudio=i),ge(o)||(this._screenShareParams.option.fillMode=o),ge(r)||(this._screenShareParams.option.profile=r),ge(n)||(this._screenShareParams.option.videoTrack=n),ge(s)||(this._screenShareParams.option.qosPreference=s),ge(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},s.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},s.prototype._getScreenShareParams=function(){return this._screenShareParams},s.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},s.prototype._getIsAudioPublish=function(){return this._isAudioPublish},s.prototype._setAudioMuteType=function(e){this._audioMuteType=e},s.prototype._getAudioMuteType=function(){return this._audioMuteType},s.prototype._setAudioProfile=function(e){this._audioProfile=e},s.prototype._getAudioProfile=function(){return this._audioProfile},s.prototype._getCaptureVolume=function(){return this._captureVolume},s.prototype._setCaptureVolume=function(e){this._captureVolume=e},s.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},s.prototype._getCurrentCameraId=function(){return this._currentCameraId},s.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},s.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},s.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},s.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},s.prototype._setRemoteStreamConfig=function(t,i,o){var r=this._remoteStreamConfig.get("".concat(t,"_").concat(this._getTRTCStreamType(i)));r||(r={userId:t,streamType:this._getTRTCStreamType(i),option:{mirror:this._getTRTCRemoteMirror(e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(e.TRTCVideoFillMode.TRTCVideoFillMode_Fit)}});var n=o.view,s=o.mirrorType,a=o.fillMode,c=o.small;ge(n)||(r.view=n),ge(s)||(r.option.mirror=this._getTRTCRemoteMirror(s)),ge(a)||(r.option.fillMode=this._getTRTCFillMode(a)),ge(c)||(r.option.small=c),this._remoteStreamConfig.set("".concat(t,"_").concat(this._getTRTCStreamType(i)),r)},s.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=d({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},s.prototype._inheritEventsToSubCloud=function(e){var t=this;e._trtc.on(c.default.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),e._trtc.on(c.default.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},s.prototype.handleDeviceChange=function(){return p(this,void 0,void 0,(function(){var t=this;return T(this,(function(i){return c.default.getCameraList().then((function(i){return p(t,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this._cameraList.length===i.length?[2]:[4,this.deviceChangeManage(this._cameraList,i,e.TRTCDeviceType.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=i,[2]}}))}))})),c.default.getMicrophoneList().then((function(i){return p(t,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,i,e.TRTCDeviceType.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=i,[2]}}))}))})),c.default.getSpeakerList().then((function(i){return p(t,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,i,e.TRTCDeviceType.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=i,[2]}}))}))})),[2]}))}))},s.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)},s.prototype.deviceChangeManage=function(t,i,o){return p(this,void 0,void 0,(function(){var r,n,s,a,c;return T(this,(function(u){switch(u.label){case 0:return r=void 0,t.length!==i.length&&(n=(i||[]).map((function(e){return e.deviceId})),s=new L,t.length>i.length?(s=t.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateRemove):(n=(t||[]).map((function(e){return e.deviceId})),s=i.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateAdd),a=s.deviceId,this.emitOnDeviceChange(a,o,r)),c=this.getDefaultDeviceInfo(i),o!==e.TRTCDeviceType.TRTCDeviceTypeCamera||r!==e.TRTCDeviceState.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,2];case 1:u.sent(),u.label=2;case 2:u.label=3;case 3:return o!==e.TRTCDeviceType.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,5];case 4:u.sent(),u.label=5;case 5:u.label=6;case 6:return o!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,8];case 7:u.sent(),u.label=8;case 8:u.label=9;case 9:return[2]}}))}))},s.prototype.getDefaultDeviceInfo=function(e){var t=new L;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]},s.prototype.autoChangeDevice=function(t,i){return p(this,void 0,void 0,(function(){var o,r,n;return T(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==e.TRTCDeviceType.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,c.default.ERROR_CODE.OPERATION_ABORT,[3,5];case 5:this._currentCameraId=o,this._currentCamera=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=6;case 6:return t!==e.TRTCDeviceType.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,c.default.ERROR_CODE.OPERATION_ABORT,[3,11];case 11:this._currentMicrophoneId=o,this._currentMicrophone=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=12;case 12:return t!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,14]:[4,c.default.setCurrentSpeaker(o)];case 13:s.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=14;case 14:return[2]}}))}))},s.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},s.prototype.getMediaMixingManager=function(){return new qn({logger:this.logger,trtc:this._trtc,trtcCloud:this})},s.prototype.getAITranscriberManager=function(){return new $n({logger:this.logger,trtc:this._trtc})},s.shareInstance=null,s.subCloudMap=new Map,s.enableSEI=!1,s.assetsPath="",h([(a="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 c=[];return null===(t=null===(e=Yn.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return c.push(e)})),null===(i=Kn.get(this))||void 0===i||i.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return c.push(e)}))})),null===(r=Jn.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return c.push(e)}))})),c.forEach((function(e){e.reject(new Error("aborted ".concat(a)))})),Yn.delete(this),Kn.delete(this),Jn.delete(this),o.apply(this,n)},i})],s.prototype,"exitRoom",null),h([Xn((function(e){return e}))],s.prototype,"muteRemoteAudio",null),h([Xn((function(e){return e}))],s.prototype,"muteRemoteVideoStream",null),h([Xn((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})],s.prototype,"_switchPlaybackQuality",null),s}(V);e.AITranscriberListener=undefined,e.AudioMuteType=undefined,e.IAITranscriberManager=undefined,e.ITRTCMediaMixingEvent=undefined,e.ITRTCMediaMixingManager=undefined,e.InteractionOption=undefined,e.Rect=$,e.TRTCCameraCaptureParams=undefined,e.TRTCDeviceInfo=L,e.TRTCImageBuffer=K,e.TRTCLocalStatistics=W,e.TRTCMediaMixingEncParam=undefined,e.TRTCMediaSource=undefined,e.TRTCMixUser=ie,e.TRTCNetworkQosParam=Y,e.TRTCParams=x,e.TRTCPublishCDNParam=H,e.TRTCQualityInfo=N,e.TRTCRemoteStatistics=j,e.TRTCRenderParams=D,e.TRTCScreenCaptureProperty=re,e.TRTCScreenCaptureSourceInfo=X,e.TRTCStatistics=U,e.TRTCTranscodingConfig=Z,e.TRTCVideoEncParam=O,e.TRTCVolumeInfo=Q,e.TranscriberMessage=undefined,e.TranscriberParams=undefined,e.default=ss,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("trtc-sdk-v5"),require("trtc-sdk-v5/plugins/lebplayer"),require("trtc-sdk-v5/plugins/video-effect/virtual-background"),require("trtc-sdk-v5/plugins/video-effect/basic-beauty"),require("trtc-sdk-v5/plugins/realtime-transcriber"),require("trtc-sdk-v5/plugins/video-effect/video-mixer")):"function"==typeof define&&define.amd?define(["exports","trtc-sdk-v5","trtc-sdk-v5/plugins/lebplayer","trtc-sdk-v5/plugins/video-effect/virtual-background","trtc-sdk-v5/plugins/video-effect/basic-beauty","trtc-sdk-v5/plugins/realtime-transcriber","trtc-sdk-v5/plugins/video-effect/video-mixer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TRTCCloud={},e.TRTC,e.LEBPlayer,e.VirtualBackground,e.BasicBeauty,e.realtimeTranscriber,e.VideoMixer)}(this,(function(e,t,i,o,r,n,s){function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(t),u=a(s),l=function(e,t){return l=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])},l(e,t)};var d=function(){return d=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},d.apply(this,arguments)};function h(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 p(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 T(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 f(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 v(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 g(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=f(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 m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function R(e,t){return e(t={exports:{}},t.exports),t.exports}var y,C,_,b,S,M,w,E,V=R((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],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,o),!0;case 4:return l.fn.call(l.context,t,o,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(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var h,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,o);break;case 4:l[u].fn.call(l[u].context,t,o,r);break;default:if(!c)for(h=1,c=new Array(d-1);h<d;h++)c[h-1]=arguments[h];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}));e.TRTCVideoResolution=void 0,(y=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[y.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",y[y.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",y[y.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",y[y.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",y[y.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",y[y.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",y[y.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",y[y.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",y[y.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",y[y.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",y[y.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",y[y.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",y[y.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",y[y.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",y[y.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",y[y.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",y[y.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",y[y.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",y[y.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",y[y.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(C=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[C.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",C[C.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",C[C.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(_=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[_.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",_[_.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(b=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[b.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",b[b.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",b[b.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(S=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[S.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",S[S.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(M=e.TRTCAppScene||(e.TRTCAppScene={}))[M.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",M[M.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",M[M.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",M[M.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(w=e.TRTCRoleType||(e.TRTCRoleType={}))[w.TRTCRoleAnchor=20]="TRTCRoleAnchor",w[w.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(E=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[E.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",E[E.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",E[E.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic";var A,P,L=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};e.TRTCDeviceState=void 0,(A=e.TRTCDeviceState||(e.TRTCDeviceState={}))[A.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",A[A.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",A[A.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(P=e.TRTCDeviceType||(e.TRTCDeviceType={}))[P.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",P[P.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",P[P.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",P[P.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var I,x=function(t,i,o,r,n,s,a,c,u,l,d){void 0===t&&(t=0),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=0),void 0===n&&(n=""),void 0===s&&(s=e.TRTCRoleType.TRTCRoleAnchor),void 0===a&&(a=null),void 0===u&&(u=null),void 0===l&&(l=null),void 0===d&&(d=30),this.sdkAppId=t,this.userId=i,this.userSig=o,this.roomId=r,this.strRoomId=n,this.role=s,this.privateMapKey=a,this.streamId=u,this.userDefineRecordId=l,this.frameWorkType=d},O=function(t,i,o,r){void 0===t&&(t=e.TRTCVideoResolution.TRTCVideoResolution_640_360),void 0===i&&(i=e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape),void 0===o&&(o=15),void 0===r&&(r=550),this.videoResolution=t,this.resMode=i,this.videoFps=o,this.videoBitrate=r};e.TRTCVideoRotation=void 0,(I=e.TRTCVideoRotation||(e.TRTCVideoRotation={}))[I.TRTCVideoRotation0=0]="TRTCVideoRotation0",I[I.TRTCVideoRotation90=1]="TRTCVideoRotation90",I[I.TRTCVideoRotation180=2]="TRTCVideoRotation180",I[I.TRTCVideoRotation270=3]="TRTCVideoRotation270";var k,D=function(t,i,o){void 0===t&&(t=e.TRTCVideoRotation.TRTCVideoRotation0),void 0===i&&(i=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit),void 0===o&&(o=e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),this.rotation=t,this.fillMode=i,this.mirrorType=o};e.TRTCQuality=void 0,(k=e.TRTCQuality||(e.TRTCQuality={}))[k.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",k[k.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",k[k.TRTCQuality_Good=2]="TRTCQuality_Good",k[k.TRTCQuality_Poor=3]="TRTCQuality_Poor",k[k.TRTCQuality_Bad=4]="TRTCQuality_Bad",k[k.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",k[k.TRTCQuality_Down=6]="TRTCQuality_Down";var B,z,F,N=function(t,i){void 0===t&&(t=""),void 0===i&&(i=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=i},Q=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},H=function(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),this.appId=e,this.bizId=t,this.url=i},W=function(t,i,o,r,n,s,a){void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.width=t,this.height=i,this.frameRate=o,this.videoBitrate=r,this.audioBitrate=s,this.streamType=a},j=function(t,i,o,r,n,s,a,c,u,l,d,h,p,T){void 0===t&&(t=""),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===c&&(c=0),void 0===T&&(T=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.userId=t,this.width=o,this.height=r,this.frameRate=n,this.videoBitrate=s,this.audioBitrate=c,this.streamType=T},U=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};e.TRTCVideoResolutionMode=void 0,(B=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[B.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",B[B.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(z=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[z.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",z[z.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(F=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[F.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",F[F.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var q,G,Y=function(t,i){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===i&&(i=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=i},K=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};e.TRTCLogLevel=void 0,(q=e.TRTCLogLevel||(e.TRTCLogLevel={}))[q.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",q[q.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",q[q.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",q[q.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",q[q.TRTCLogLevelError=4]="TRTCLogLevelError",q[q.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",q[q.TRTCLogLevelNone=6]="TRTCLogLevelNone",e.TRTCScreenCaptureSourceType=void 0,(G=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[G.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",G[G.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",G[G.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",G[G.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var J,X=function(t,i,o,r,n,s){void 0===t&&(t=e.TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=new K),void 0===n&&(n=new K),void 0===s&&(s=!1),this.type=t,this.sourceId=i,this.sourceName=o,this.thumbBGRA=r,this.iconBGRA=n,this.isMinimizeWindow=s},$=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},Z=function(t,i,o,r,n,s,a,c,u,l,d,h,p,T,f){void 0===t&&(t=e.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=15),void 0===c&&(c=2),void 0===u&&(u=0),void 0===l&&(l=""),void 0===d&&(d=64),void 0===h&&(h=48e3),void 0===p&&(p=1),void 0===T&&(T=[]),void 0===f&&(f=""),this.mode=t,this.appId=i,this.bizId=o,this.videoWidth=r,this.videoHeight=n,this.videoBitrate=s,this.videoFramerate=a,this.videoGOP=c,this.backgroundColor=u,this.backgroundImage=l,this.audioSampleRate=d,this.audioBitrate=h,this.audioChannels=p,this.mixUsersArray=T,this.mixUsersArraySize=T.length,this.streamId=f};e.TRTCTranscodingConfigMode=void 0,(J=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[J.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",J[J.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",J[J.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",J[J.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",J[J.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",J[J.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",J[J.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",J[J.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",J[J.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",J[J.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var ee,te,ie=function(t,i,o,r,n,s,a,c){void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=null),void 0===r&&(r=0),void 0===n&&(n=!1),void 0===s&&(s=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),void 0===a&&(a=e.TRTCMixInputType.TRTCMixInputTypeUndefined),void 0===c&&(c=0),this.userId=t,this.roomId=i,this.rect=o,this.zOrder=r,this.pureAudio=n,this.streamType=s,this.inputType=a,this.renderMode=c};e.TRTCMixInputType=void 0,(ee=e.TRTCMixInputType||(e.TRTCMixInputType={}))[ee.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",ee[ee.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",ee[ee.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",ee[ee.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio",e.TRTCCameraCaptureMode=void 0,(te=e.TRTCCameraCaptureMode||(e.TRTCCameraCaptureMode={}))[te.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",te[te.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",te[te.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",te[te.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual";var oe,re=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},ne="onError",se="onWarning",ae="rtc",ce="live",ue="VirtualBackground",le="BasicBeauty",de="blur",he="image",pe={20:"anchor",21:"audience"},Te={0:ae,1:ce,2:ae,3:ce};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(oe||(oe={}));var fe="enum";function ve(){return Math.floor(performance.now())}var ge=function(e){return void 0===e},me=function(e){return"number"==typeof e},Re=function(e){return"boolean"==typeof e};function ye(e){if("string"!=typeof e)return e;var t;try{var i=JSON.parse(e);t="object"==typeof i&&i?i:e}catch(o){t=e}return t}function Ce(e){return null==e}function _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 be(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]=be(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=be(e[i]))}))):t=e,t)}var Se,Me,we=function(e){return e&&e.Math===Math&&e},Ee=we("object"==typeof globalThis&&globalThis)||we("object"==typeof window&&window)||we("object"==typeof self&&self)||we("object"==typeof m&&m)||function(){return this}()||m||Function("return this")(),Ve=function(e){try{return!!e()}catch(t){return!0}},Ae=!Ve((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Pe=!Ve((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Le=Function.prototype.call,Ie=Pe?Le.bind(Le):function(){return Le.apply(Le,arguments)},xe={}.propertyIsEnumerable,Oe=Object.getOwnPropertyDescriptor,ke={f:Oe&&!xe.call({1:2},1)?function(e){var t=Oe(this,e);return!!t&&t.enumerable}:xe},De=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Be=Function.prototype,ze=Be.call,Fe=Pe&&Be.bind.bind(ze,ze),Ne=Pe?Fe:function(e){return function(){return ze.apply(e,arguments)}},Qe=Ne({}.toString),He=Ne("".slice),We=function(e){return He(Qe(e),8,-1)},je=Object,Ue=Ne("".split),qe=Ve((function(){return!je("z").propertyIsEnumerable(0)}))?function(e){return"String"===We(e)?Ue(e,""):je(e)}:je,Ge=function(e){return null==e},Ye=TypeError,Ke=function(e){if(Ge(e))throw Ye("Can't call method on "+e);return e},Je=function(e){return qe(Ke(e))},Xe="object"==typeof document&&document.all,$e={all:Xe,IS_HTMLDDA:void 0===Xe&&void 0!==Xe},Ze=$e.all,et=$e.IS_HTMLDDA?function(e){return"function"==typeof e||e===Ze}:function(e){return"function"==typeof e},tt=$e.all,it=$e.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:et(e)||e===tt}:function(e){return"object"==typeof e?null!==e:et(e)},ot=function(e,t){return arguments.length<2?(i=Ee[e],et(i)?i:void 0):Ee[e]&&Ee[e][t];var i},rt=Ne({}.isPrototypeOf),nt="undefined"!=typeof navigator&&String(navigator.userAgent)||"",st=Ee.process,at=Ee.Deno,ct=st&&st.versions||at&&at.version,ut=ct&&ct.v8;ut&&(Me=(Se=ut.split("."))[0]>0&&Se[0]<4?1:+(Se[0]+Se[1])),!Me&&nt&&(!(Se=nt.match(/Edge\/(\d+)/))||Se[1]>=74)&&(Se=nt.match(/Chrome\/(\d+)/))&&(Me=+Se[1]);var lt=Me,dt=Ee.String,ht=!!Object.getOwnPropertySymbols&&!Ve((function(){var e=Symbol("symbol detection");return!dt(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&lt&&lt<41})),pt=ht&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Tt=Object,ft=pt?function(e){return"symbol"==typeof e}:function(e){var t=ot("Symbol");return et(t)&&rt(t.prototype,Tt(e))},vt=String,gt=TypeError,mt=function(e){if(et(e))return e;throw gt(function(e){try{return vt(e)}catch(t){return"Object"}}(e)+" is not a function")},Rt=function(e,t){var i=e[t];return Ge(i)?void 0:mt(i)},yt=TypeError,Ct=Object.defineProperty,_t=function(e,t){try{Ct(Ee,e,{value:t,configurable:!0,writable:!0})}catch(i){Ee[e]=t}return t},bt="__core-js_shared__",St=Ee[bt]||_t(bt,{}),Mt=R((function(e){(e.exports=function(e,t){return St[e]||(St[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"})})),wt=Object,Et=function(e){return wt(Ke(e))},Vt=Ne({}.hasOwnProperty),At=Object.hasOwn||function(e,t){return Vt(Et(e),t)},Pt=0,Lt=Math.random(),It=Ne(1..toString),xt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+It(++Pt+Lt,36)},Ot=Ee.Symbol,kt=Mt("wks"),Dt=pt?Ot.for||Ot:Ot&&Ot.withoutSetter||xt,Bt=function(e){return At(kt,e)||(kt[e]=ht&&At(Ot,e)?Ot[e]:Dt("Symbol."+e)),kt[e]},zt=TypeError,Ft=Bt("toPrimitive"),Nt=function(e,t){if(!it(e)||ft(e))return e;var i,o=Rt(e,Ft);if(o){if(void 0===t&&(t="default"),i=Ie(o,e,t),!it(i)||ft(i))return i;throw zt("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&et(i=e.toString)&&!it(o=Ie(i,e)))return o;if(et(i=e.valueOf)&&!it(o=Ie(i,e)))return o;if("string"!==t&&et(i=e.toString)&&!it(o=Ie(i,e)))return o;throw yt("Can't convert object to primitive value")}(e,t)},Qt=function(e){var t=Nt(e,"string");return ft(t)?t:t+""},Ht=Ee.document,Wt=it(Ht)&&it(Ht.createElement),jt=function(e){return Wt?Ht.createElement(e):{}},Ut=!Ae&&!Ve((function(){return 7!==Object.defineProperty(jt("div"),"a",{get:function(){return 7}}).a})),qt=Object.getOwnPropertyDescriptor,Gt={f:Ae?qt:function(e,t){if(e=Je(e),t=Qt(t),Ut)try{return qt(e,t)}catch(i){}if(At(e,t))return De(!Ie(ke.f,e,t),e[t])}},Yt=Ae&&Ve((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Kt=String,Jt=TypeError,Xt=function(e){if(it(e))return e;throw Jt(Kt(e)+" is not an object")},$t=TypeError,Zt=Object.defineProperty,ei=Object.getOwnPropertyDescriptor,ti="enumerable",ii="configurable",oi="writable",ri={f:Ae?Yt?function(e,t,i){if(Xt(e),t=Qt(t),Xt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&oi in i&&!i[oi]){var o=ei(e,t);o&&o[oi]&&(e[t]=i.value,i={configurable:ii in i?i[ii]:o[ii],enumerable:ti in i?i[ti]:o[ti],writable:!1})}return Zt(e,t,i)}:Zt:function(e,t,i){if(Xt(e),t=Qt(t),Xt(i),Ut)try{return Zt(e,t,i)}catch(o){}if("get"in i||"set"in i)throw $t("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},ni=Ae?function(e,t,i){return ri.f(e,t,De(1,i))}:function(e,t,i){return e[t]=i,e},si=Function.prototype,ai=Ae&&Object.getOwnPropertyDescriptor,ci=At(si,"name"),ui={EXISTS:ci,PROPER:ci&&"something"===function(){}.name,CONFIGURABLE:ci&&(!Ae||Ae&&ai(si,"name").configurable)},li=Ne(Function.toString);et(St.inspectSource)||(St.inspectSource=function(e){return li(e)});var di,hi,pi,Ti=St.inspectSource,fi=Ee.WeakMap,vi=et(fi)&&/native code/.test(String(fi)),gi=Mt("keys"),mi=function(e){return gi[e]||(gi[e]=xt(e))},Ri={},yi="Object already initialized",Ci=Ee.TypeError,_i=Ee.WeakMap;if(vi||St.state){var bi=St.state||(St.state=new _i);bi.get=bi.get,bi.has=bi.has,bi.set=bi.set,di=function(e,t){if(bi.has(e))throw Ci(yi);return t.facade=e,bi.set(e,t),t},hi=function(e){return bi.get(e)||{}},pi=function(e){return bi.has(e)}}else{var Si=mi("state");Ri[Si]=!0,di=function(e,t){if(At(e,Si))throw Ci(yi);return t.facade=e,ni(e,Si,t),t},hi=function(e){return At(e,Si)?e[Si]:{}},pi=function(e){return At(e,Si)}}var Mi={set:di,get:hi,has:pi,enforce:function(e){return pi(e)?hi(e):di(e,{})},getterFor:function(e){return function(t){var i;if(!it(t)||(i=hi(t)).type!==e)throw Ci("Incompatible receiver, "+e+" required");return i}}},wi=R((function(e){var t=ui.CONFIGURABLE,i=Mi.enforce,o=Mi.get,r=String,n=Object.defineProperty,s=Ne("".slice),a=Ne("".replace),c=Ne([].join),u=Ae&&!Ve((function(){return 8!==n((function(){}),"length",{value:8}).length})),l=String(String).split("String"),d=e.exports=function(e,o,d){"Symbol("===s(r(o),0,7)&&(o="["+a(r(o),/^Symbol\(([^)]*)\)/,"$1")+"]"),d&&d.getter&&(o="get "+o),d&&d.setter&&(o="set "+o),(!At(e,"name")||t&&e.name!==o)&&(Ae?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&d&&At(d,"arity")&&e.length!==d.arity&&n(e,"length",{value:d.arity});try{d&&At(d,"constructor")&&d.constructor?Ae&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var h=i(e);return At(h,"source")||(h.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=d((function(){return et(this)&&o(this).source||Ti(this)}),"toString")})),Ei=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(et(i)&&wi(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:ri.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Vi=Math.ceil,Ai=Math.floor,Pi=Math.trunc||function(e){var t=+e;return(t>0?Ai:Vi)(t)},Li=function(e){var t=+e;return t!=t||0===t?0:Pi(t)},Ii=Math.max,xi=Math.min,Oi=Math.min,ki=function(e){return e>0?Oi(Li(e),9007199254740991):0},Di=function(e){return ki(e.length)},Bi=function(e){return function(t,i,o){var r,n=Je(t),s=Di(n),a=function(e,t){var i=Li(e);return i<0?Ii(i+t,0):xi(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}},zi={includes:Bi(!0),indexOf:Bi(!1)}.indexOf,Fi=Ne([].push),Ni=function(e,t){var i,o=Je(e),r=0,n=[];for(i in o)!At(Ri,i)&&At(o,i)&&Fi(n,i);for(;t.length>r;)At(o,i=t[r++])&&(~zi(n,i)||Fi(n,i));return n},Qi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Hi=Qi.concat("length","prototype"),Wi={f:Object.getOwnPropertyNames||function(e){return Ni(e,Hi)}},ji={f:Object.getOwnPropertySymbols},Ui=Ne([].concat),qi=ot("Reflect","ownKeys")||function(e){var t=Wi.f(Xt(e)),i=ji.f;return i?Ui(t,i(e)):t},Gi=function(e,t,i){for(var o=qi(t),r=ri.f,n=Gt.f,s=0;s<o.length;s++){var a=o[s];At(e,a)||i&&At(i,a)||r(e,a,n(t,a))}},Yi=/#|\.prototype\./,Ki=function(e,t){var i=Xi[Ji(e)];return i===Zi||i!==$i&&(et(t)?Ve(t):!!t)},Ji=Ki.normalize=function(e){return String(e).replace(Yi,".").toLowerCase()},Xi=Ki.data={},$i=Ki.NATIVE="N",Zi=Ki.POLYFILL="P",eo=Ki,to=Gt.f,io=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?Ee:u?Ee[a]||_t(a,{}):(Ee[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=to(i,o))&&s.value:i[o],!eo(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Gi(n,r)}(e.sham||r&&r.sham)&&ni(n,"sham",!0),Ei(i,o,n,e)}},oo={};oo[Bt("toStringTag")]="z";var ro,no="[object z]"===String(oo),so=Bt("toStringTag"),ao=Object,co="Arguments"===We(function(){return arguments}()),uo=no?We: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=ao(e),so))?i:co?We(t):"Object"===(o=We(t))&&et(t.callee)?"Arguments":o},lo=String,ho=function(e){if("Symbol"===uo(e))throw TypeError("Cannot convert a Symbol value to a string");return lo(e)},po=function(){var e=Xt(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},To=Ee.RegExp,fo=Ve((function(){var e=To("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),vo=fo||Ve((function(){return!To("a","y").sticky})),go={BROKEN_CARET:fo||Ve((function(){var e=To("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:vo,UNSUPPORTED_Y:fo},mo=Object.keys||function(e){return Ni(e,Qi)},Ro=Ae&&!Yt?Object.defineProperties:function(e,t){Xt(e);for(var i,o=Je(t),r=mo(t),n=r.length,s=0;n>s;)ri.f(e,i=r[s++],o[i]);return e},yo={f:Ro},Co=ot("document","documentElement"),_o="prototype",bo="script",So=mi("IE_PROTO"),Mo=function(){},wo=function(e){return"<"+bo+">"+e+"</"+bo+">"},Eo=function(e){e.write(wo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Vo=function(){try{ro=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Vo="undefined"!=typeof document?document.domain&&ro?Eo(ro):(t=jt("iframe"),i="java"+bo+":",t.style.display="none",Co.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(wo("document.F=Object")),e.close(),e.F):Eo(ro);for(var o=Qi.length;o--;)delete Vo[_o][Qi[o]];return Vo()};Ri[So]=!0;var Ao,Po,Lo=Object.create||function(e,t){var i;return null!==e?(Mo[_o]=Xt(e),i=new Mo,Mo[_o]=null,i[So]=e):i=Vo(),void 0===t?i:yo.f(i,t)},Io=Ee.RegExp,xo=Ve((function(){var e=Io(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Oo=Ee.RegExp,ko=Ve((function(){var e=Oo("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Do=Mi.get,Bo=Mt("native-string-replace",String.prototype.replace),zo=RegExp.prototype.exec,Fo=zo,No=Ne("".charAt),Qo=Ne("".indexOf),Ho=Ne("".replace),Wo=Ne("".slice),jo=(Po=/b*/g,Ie(zo,Ao=/a/,"a"),Ie(zo,Po,"a"),0!==Ao.lastIndex||0!==Po.lastIndex),Uo=go.BROKEN_CARET,qo=void 0!==/()??/.exec("")[1];(jo||qo||Uo||xo||ko)&&(Fo=function(e){var t,i,o,r,n,s,a,c=this,u=Do(c),l=ho(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=Ie(Fo,d,l),c.lastIndex=d.lastIndex,t;var h=u.groups,p=Uo&&c.sticky,T=Ie(po,c),f=c.source,v=0,g=l;if(p&&(T=Ho(T,"y",""),-1===Qo(T,"g")&&(T+="g"),g=Wo(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==No(l,c.lastIndex-1))&&(f="(?: "+f+")",g=" "+g,v++),i=new RegExp("^(?:"+f+")",T)),qo&&(i=new RegExp("^"+f+"$(?!\\s)",T)),jo&&(o=c.lastIndex),r=Ie(zo,p?i:c,g),p?r?(r.input=Wo(r.input,v),r[0]=Wo(r[0],v),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:jo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),qo&&r&&r.length>1&&Ie(Bo,r[0],i,(function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(r[n]=void 0)})),r&&h)for(r.groups=s=Lo(null),n=0;n<h.length;n++)s[(a=h[n])[0]]=r[a[1]];return r});var Go=Fo;io({target:"RegExp",proto:!0,forced:/./.exec!==Go},{exec:Go});var Yo="\t\n\v\f\r                 \u2028\u2029\ufeff",Ko=Ne("".replace),Jo=RegExp("^["+Yo+"]+"),Xo=RegExp("(^|[^"+Yo+"])["+Yo+"]+$"),$o=function(e){return function(t){var i=ho(Ke(t));return 1&e&&(i=Ko(i,Jo,"")),2&e&&(i=Ko(i,Xo,"$1")),i}},Zo={start:$o(1),end:$o(2),trim:$o(3)}.trim,er=Ne("".charAt),tr=Ee.parseFloat,ir=Ee.Symbol,or=ir&&ir.iterator,rr=1/tr(Yo+"-0")!=-Infinity||or&&!Ve((function(){tr(Object(or))}))?function(e){var t=Zo(ho(e)),i=tr(t);return 0===i&&"-"===er(t,0)?-0:i}:tr;io({global:!0,forced:parseFloat!==rr},{parseFloat:rr});var nr=function(e){if("Function"===We(e))return Ne(e)},sr=Bt("species"),ar=RegExp.prototype,cr=Ne("".charAt),ur=Ne("".charCodeAt),lr=Ne("".slice),dr=function(e){return function(t,i){var o,r,n=ho(Ke(t)),s=Li(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=ur(n,s))<55296||o>56319||s+1===a||(r=ur(n,s+1))<56320||r>57343?e?cr(n,s):o:e?lr(n,s,s+2):r-56320+(o-55296<<10)+65536}},hr={codeAt:dr(!1),charAt:dr(!0)}.charAt,pr=function(e,t,i){return t+(i?hr(e,t).length:1)},Tr=TypeError,fr=function(e,t){var i=e.exec;if(et(i)){var o=Ie(i,e,t);return null!==o&&Xt(o),o}if("RegExp"===We(e))return Ie(Go,e,t);throw Tr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=Bt(e),n=!Ve((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Ve((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[sr]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=nr(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=nr(e),c=t.exec;return c===Go||c===ar.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));Ei(String.prototype,e,c[0]),Ei(ar,r,c[1])}o&&ni(ar[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Ke(this),o=Ge(t)?void 0:Rt(t,e);return o?Ie(o,t,i):new RegExp(t)[e](ho(i))},function(e){var o=Xt(this),r=ho(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return fr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=fr(o,r));){var l=ho(a[0]);c[u]=l,""===l&&(o.lastIndex=pr(r,ki(o.lastIndex),s)),u++}return 0===u?null:c}]}));var vr=Array.isArray||function(e){return"Array"===We(e)},gr=TypeError,mr=function(e){if(e>9007199254740991)throw gr("Maximum allowed index exceeded");return e},Rr=function(e,t,i){var o=Qt(t);o in e?ri.f(e,o,De(0,i)):e[o]=i},yr=function(){},Cr=[],_r=ot("Reflect","construct"),br=/^\s*(?:class|function)\b/,Sr=Ne(br.exec),Mr=!br.exec(yr),wr=function(e){if(!et(e))return!1;try{return _r(yr,Cr,e),!0}catch(t){return!1}},Er=function(e){if(!et(e))return!1;switch(uo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Mr||!!Sr(br,Ti(e))}catch(t){return!0}};Er.sham=!0;var Vr,Ar=!_r||Ve((function(){var e;return wr(wr.call)||!wr(Object)||!wr((function(){e=!0}))||e}))?Er:wr,Pr=Bt("species"),Lr=Array,Ir=function(e,t){return new(function(e){var t;return vr(e)&&(t=e.constructor,(Ar(t)&&(t===Lr||vr(t.prototype))||it(t)&&null===(t=t[Pr]))&&(t=void 0)),void 0===t?Lr:t}(e))(0===t?0:t)},xr=Bt("species"),Or=Bt("isConcatSpreadable"),kr=lt>=51||!Ve((function(){var e=[];return e[Or]=!1,e.concat()[0]!==e})),Dr=function(e){if(!it(e))return!1;var t=e[Or];return void 0!==t?!!t:vr(e)};io({target:"Array",proto:!0,arity:1,forced:!(kr&&(Vr="concat",lt>=51||!Ve((function(){var e=[];return(e.constructor={})[xr]=function(){return{foo:1}},1!==e[Vr](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=Et(this),a=Ir(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Dr(n=-1===t?s:arguments[t]))for(r=Di(n),mr(c+r),i=0;i<r;i++,c++)i in n&&Rr(a,c,n[i]);else mr(c+1),Rr(a,c++,n);return a.length=c,a}});var Br=window.navigator&&window.navigator.userAgent||"",zr=/AppleWebKit\/([\d.]+)/i.exec(Br);zr&&parseFloat(zr.pop());var Fr=/iPad/i.test(Br),Nr=/iPhone/i.test(Br)&&!Fr,Qr=/iPod/i.test(Br),Hr=Nr||Fr||Qr,Wr=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(Br);Hr&&function(){var e=Br.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var jr=/Android/i.test(Br);jr&&function(){var e=Br.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]))}();jr&&/webkit/i.test(Br),/Firefox/i.test(Br)&&function(){var e=Br.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Ur=/Edge\//i.test(Br);Ur&&function(){var e=Br.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var qr=/Edg\//i.test(Br);qr&&function(){var e=Br.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Gr=/SogouMobileBrowser\//i.test(Br);Gr&&function(){var e=Br.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Yr=/MetaSr\s/i.test(Br);Yr&&function(){var e=Br.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Kr=/TBS\/\d+/i.test(Br);Kr&&function(){var e=Br.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Jr=/XWEB\/\d+/i.test(Br);Jr&&function(){var e=Br.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(Br),/MSIE\/\d+/i.test(Br)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(Br),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(Br)&&/rv:11.0/.test(Br)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(Br)&&function(){var e=Br.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var Xr=!Kr&&/MQQBrowser\/\d+/i.test(Br)&&/COVC\/\d+/i.test(Br),$r=!Kr&&/MQQBrowser\/\d+/i.test(Br)&&!/COVC\/\d+/i.test(Br);($r||Xr)&&function(){var e=Br.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Zr=!Kr&&/ QQBrowser\/\d+/i.test(Br);Zr&&function(){var e=Br.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var en=!Kr&&/QQBrowserLite\/\d+/i.test(Br);en&&function(){var e=Br.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var tn=!Kr&&/MQBHD\/\d+/i.test(Br);tn&&function(){var e=Br.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(Br),!Hr&&/MAC OS X/i.test(Br),!jr&&/Linux/i.test(Br),/MicroMessenger/i.test(Br),/UCBrowser/i.test(Br),/Electron/i.test(Br);var on=/MiuiBrowser/i.test(Br);on&&function(){var e=Br.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var rn=/HuaweiBrowser/i.test(Br);/Huawei/i.test(Br),rn&&function(){var e=Br.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var nn=/SamsungBrowser/i.test(Br);nn&&function(){var e=Br.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var sn=/HeyTapBrowser/i.test(Br);sn&&function(){var e=Br.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var an=/VivoBrowser/i.test(Br);an&&function(){var e=Br.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var cn,un,ln,dn=/Chrome/i.test(Br),hn=!Ur&&!Yr&&!Gr&&!Kr&&!Jr&&!qr&&!Zr&&!on&&!rn&&!nn&&!sn&&!an&&/Chrome/i.test(Br);hn&&function(){var e=Br.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),hn&&function(){var e=Br.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!dn&&!$r&&!Xr&&!en&&!tn&&/Safari/i.test(Br)&&function(){var e=Br.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"}(cn||(cn={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(un||(un={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(ln||(ln={}));var pn,Tn,fn,vn=-3340,gn=-1301,mn=-1314,Rn=-1315,yn=-1316,Cn=-1302,_n=-1317,bn=-1318,Sn=-1319,Mn=-70252,wn={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},En={code:-1005,message:"not supported"},Vn="2.11.2";e.TRTCMediaMixingErrorCode=void 0,(pn=e.TRTCMediaMixingErrorCode||(e.TRTCMediaMixingErrorCode={}))[pn.Success=0]="Success",pn[pn.Error=-1]="Error",pn[pn.InvalidParams=-2]="InvalidParams",pn[pn.NotFoundSource=-3]="NotFoundSource",pn[pn.ImageSourceLoadFailed=-4]="ImageSourceLoadFailed",pn[pn.CameraNotAuthorized=-5]="CameraNotAuthorized",pn[pn.CameraIsOccupied=-6]="CameraIsOccupied",pn[pn.CameraDisconnected=-7]="CameraDisconnected",e.TRTCMediaSourceType=void 0,(Tn=e.TRTCMediaSourceType||(e.TRTCMediaSourceType={}))[Tn.kCamera=0]="kCamera",Tn[Tn.kScreen=1]="kScreen",Tn[Tn.kImage=2]="kImage",Tn[Tn.kPhoneMirror=4]="kPhoneMirror",Tn[Tn.kText=5]="kText",Tn[Tn.kVideo=6]="kVideo",e.TRTCMediaMixingEvent=void 0,(fn=e.TRTCMediaMixingEvent||(e.TRTCMediaMixingEvent={})).onSourceSelected="onSourceSelected",fn.onSourceMoved="onSourceMoved",fn.onSourceResized="onSourceResized",fn.onRightButtonClicked="onRightButtonClicked",fn.onError="onError",fn.onSourcePlugged="onSourcePlugged",fn.onSourceConnected="onSourceConnected",fn.onSourceDisconnected="onSourceDisconnected",fn.onSourceUnplugged="onSourceUnplugged",fn.onMediaSourceSizeChanged="onMediaSourceSizeChanged";var An,Pn=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}(),Ln=new Pn(null),In=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"):Ln.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 Ln.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)):Ln.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 Ln.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){Ln.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",Ln.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"}(An||(An={}));var xn="trtc-resizable-top-left-anchor",On="trtc-resizable-top-anchor",kn="trtc-resizable-top-right-anchor",Dn="trtc-resizable-left-anchor",Bn="trtc-resizable-right-anchor",zn="trtc-resizable-bottom-left-anchor",Fn="trtc-resizable-bottom-anchor",Nn="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 Hn(e,t){for(var i in t)e.style[i]=t[i]}var Wn=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:An.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:An.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||An.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(xn),Hn(c,Object.assign({},Qn.resizeAnchor,Qn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(On),Hn(u,Object.assign({},Qn.resizeAnchor,Qn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(kn),Hn(l,Object.assign({},Qn.resizeAnchor,Qn.topRightAnchor)),this.topRightAnchor=l;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(Dn),Hn(d,Object.assign({},Qn.resizeAnchor,Qn.leftAnchor)),this.leftAnchor=d;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(Bn),Hn(h,Object.assign({},Qn.resizeAnchor,Qn.rightAnchor)),this.rightAnchor=h;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(zn),Hn(p,Object.assign({},Qn.resizeAnchor,Qn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var T=document.createElement("div");T.className="trtc-resizable-resize-anchor ".concat(Fn),Hn(T,Object.assign({},Qn.resizeAnchor,Qn.bottomAnchor)),this.bottomAnchor=T;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(Nn),Hn(f,Object.assign({},Qn.resizeAnchor,Qn.bottomRightAnchor)),this.bottomRightAnchor=f,this.options.anchorMode!==An.Both&&this.options.anchorMode!==An.Edge||(null===(e=this.resizeTarget)||void 0===e||e.appendChild(u),null===(t=this.resizeTarget)||void 0===t||t.appendChild(d),null===(i=this.resizeTarget)||void 0===i||i.appendChild(h),null===(o=this.resizeTarget)||void 0===o||o.appendChild(T)),this.options.anchorMode!==An.Both&&this.options.anchorMode!==An.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(f))},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,Ln.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else Ln.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 xn: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 On: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 kn: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 Dn: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 Bn: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 zn: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 Fn: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 Nn: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 Ln.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 Ln.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 Ln.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,d,h,p,T,f;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!==An.Both&&this.options.anchorMode!==An.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===(d=this.resizeTarget)||void 0===d||d.removeChild(this.bottomAnchor))),this.options.anchorMode!==An.Both&&this.options.anchorMode!==An.Corner||(this.topLeftAnchor&&(null===(h=this.resizeTarget)||void 0===h||h.removeChild(this.topLeftAnchor)),this.topRightAnchor&&(null===(p=this.resizeTarget)||void 0===p||p.removeChild(this.topRightAnchor)),this.bottomLeftAnchor&&(null===(T=this.resizeTarget)||void 0===T||T.removeChild(this.bottomLeftAnchor)),this.bottomRightAnchor&&(null===(f=this.resizeTarget)||void 0===f||f.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}(),jn=function(){var t=new Map;for(var i in e.TRTCVideoResolution)if(isNaN(Number(i))){var o=e.TRTCVideoResolution[i],r=i.split("_");t.set(o,{width:parseInt(r[1]),height:parseInt(r[2])})}return t}(),Un=function(){function t(t){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=t.logger,this.container=t.view,this.container.style.position="relative",this.videoResolution=t.videoResolution,this.resMode=t.resMode,jn.has(t.videoResolution)){var i=jn.get(t.videoResolution),o=i.width,r=i.height;this.resMode===e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=o,this.mixingVideoHeight=r):(this.mixingVideoWidth=r,this.mixingVideoHeight=o)}this.updatePreviewProperty(),this.canExceedContainer=t.canExceedContainer||!1,this.eventEmitter=new V,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 t.prototype.updateOptions=function(t){if(!Ce(t.videoResolution)||!Ce(t.resMode)){if(this.resMode=Ce(t.resMode)?this.resMode:t.resMode,t.videoResolution&&jn.has(t.videoResolution)){var i=jn.get(t.videoResolution),o=i.width,r=i.height;this.resMode===e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape?(this.mixingVideoWidth=o,this.mixingVideoHeight=r):(this.mixingVideoWidth=r,this.mixingVideoHeight=o)}this.updatePreviewProperty(),this.updateOverlay()}},t.prototype.addMedia=function(e){this.mediaList.unshift(e),e.isSelected&&(this.selectedMediaIndex=0,this.updateOverlay())},t.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()))},t.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()))},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.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=[]},t.prototype.initMediaMovable=function(){this.onMove=this.onMove.bind(this),this.movableHandler=new In(this.moveAndResizeOverlay,this.container,{canExceedContainer:this.canExceedContainer,calcPositionOnly:!1}),this.movableHandler.on("move",this.onMove)},t.prototype.initMediaResizable=function(){this.onResize=this.onResize.bind(this),this.resizableHandler=new Wn(this.moveAndResizeOverlay,this.container,{keepRatio:!0,stopPropagation:!0,canExceedContainer:this.canExceedContainer,anchorMode:0}),this.resizableHandler.on("resize",this.onResize)},t.prototype.updateCanExceedContainer=function(e){this.movableHandler&&(this.movableHandler.options.canExceedContainer=e),this.resizableHandler&&(this.resizableHandler.options.canExceedContainer=e)},t.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"))},t.prototype.initContainerResizeObserver=function(){this.container&&(this.onPreviewAreaResize=this.onPreviewAreaResize.bind(this),this.resizeObserver=new ResizeObserver(this.onPreviewAreaResize),this.resizeObserver.observe(this.container))},t.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}}},t.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"))},t.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}},t.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",d({},o),n)}else console.debug("".concat(this.logPrefix,"onMove no selected media"))},t.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)},t.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(!ge(s.showResizeAnchors)&&!s.showResizeAnchors)return;var a={left:e-this.previewLeft,top:t-this.previewTop,right:e-this.previewLeft+i,bottom:t-this.previewTop+o},c={left:Math.round(a.left/this.previewScale),top:Math.round(a.top/this.previewScale),right:Math.round(a.right/this.previewScale),bottom:Math.round(a.bottom/this.previewScale)};null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",d({},n),c)}else console.debug("".concat(this.logPrefix,"onResize no selected media"))},t.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},t.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?d({},e):null)},t.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)}},t.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}))))}},t.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},t.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",d({},this.mediaList[this.selectedMediaIndex]))},t}(),qn=function(){function t(i){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new V,this.publishParams={videoEncoderParams:{videoResolution:e.TRTCVideoResolution.TRTCVideoResolution_1280_720,resMode:e.TRTCVideoResolutionMode.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=i.logger,this.trtc=i.trtc,this.trtcCloud=i.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 p(this,void 0,Promise,(function(){var e,i,o,r,n;return T(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 p(this,void 0,Promise,(function(){var t,i,o,r,n=this;return T(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(t){var i;return((i={})[e.TRTCMediaSourceType.kCamera]="camera",i[e.TRTCMediaSourceType.kScreen]="screen",i[e.TRTCMediaSourceType.kText]="text",i[e.TRTCMediaSourceType.kVideo]="video",i[e.TRTCMediaSourceType.kImage]="image",i)[t.type]},t.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]="cover",i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]="contain",i)[t]},t.prototype._getTRTCVideoProfile=function(t,i){var o,r,n,s=null!==(r=((o={})[e.TRTCVideoResolution.TRTCVideoResolution_480_270]={width:480,height:270},o[e.TRTCVideoResolution.TRTCVideoResolution_640_360]={width:640,height:360},o[e.TRTCVideoResolution.TRTCVideoResolution_960_540]={width:960,height:540},o[e.TRTCVideoResolution.TRTCVideoResolution_1280_720]={width:1280,height:720},o[e.TRTCVideoResolution.TRTCVideoResolution_1920_1080]={width:1920,height:1080},o)[t])&&void 0!==r?r:(n=t)&&"object"==typeof n&&"number"==typeof n.width&&"number"==typeof n.height?t:{width:1920,height:1080};return{width:s.width,height:s.height,frameRate:i,bitrate:1e3}},t.prototype._getTRTCLayout=function(t){var i,o,r,n,s,a,c,u,l,d,h,p,T,f,v,g,m={zIndex:(null===(r=t.layout)||void 0===r?void 0:r.zOrder)||0};if(ge(null===(n=t.layout)||void 0===n?void 0:n.rect)||(m.x=null===(s=t.layout)||void 0===s?void 0:s.rect.left,m.y=null===(a=t.layout)||void 0===a?void 0:a.rect.top,m.width=(null===(c=t.layout)||void 0===c?void 0:c.rect.right)-(null===(u=t.layout)||void 0===u?void 0:u.rect.left),m.height=(null===(l=t.layout)||void 0===l?void 0:l.rect.bottom)-(null===(d=t.layout)||void 0===d?void 0:d.rect.top)),ge(null===(h=t.layout)||void 0===h?void 0:h.fillMode)||(m.fillMode=this._getTRTCFillMode(null===(p=t.layout)||void 0===p?void 0:p.fillMode)),!ge(null===(T=t.layout)||void 0===T?void 0:T.mirror)){var R=((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i);m.mirror=R[null===(f=t.layout)||void 0===f?void 0:f.mirror]}if(!ge(null===(v=t.layout)||void 0===v?void 0:v.rotation)){var y=((o={})[e.TRTCVideoRotation.TRTCVideoRotation0]=0,o[e.TRTCVideoRotation.TRTCVideoRotation90]=90,o[e.TRTCVideoRotation.TRTCVideoRotation180]=180,o[e.TRTCVideoRotation.TRTCVideoRotation270]=270,o);m.rotation=y[null===(g=t.layout)||void 0===g?void 0:g.rotation]}return m},t.prototype._getTRTCSourceItem=function(t){var i,o,r,n,s,a,c,u,l,h;switch(t.type){case e.TRTCMediaSourceType.kScreen:return h=e.TRTCVideoResolution.TRTCVideoResolution_1920_1080,(null==t?void 0:t.useInternalTrack)?{id:t.id,layout:this._getTRTCLayout(t),useInternalTrack:!0}:{id:t.id,profile:this._getTRTCVideoProfile((null===(i=t.screen)||void 0===i?void 0:i.resolution)||h,(null===(o=t.screen)||void 0===o?void 0:o.fps)||15),layout:this._getTRTCLayout(t),systemAudio:null===(r=t.screen)||void 0===r?void 0:r.systemAudio};case e.TRTCMediaSourceType.kCamera:return h=e.TRTCVideoResolution.TRTCVideoResolution_1280_720,(null==t?void 0:t.useInternalTrack)?{id:t.id,layout:this._getTRTCLayout(t),useInternalTrack:!0}:{id:t.id,cameraId:null===(n=t.camera)||void 0===n?void 0:n.cameraId,profile:this._getTRTCVideoProfile((null===(s=t.camera)||void 0===s?void 0:s.resolution)||h,(null===(a=t.camera)||void 0===a?void 0:a.fps)||15),videoTrack:null===(c=t.camera)||void 0===c?void 0:c.videoTrack,layout:this._getTRTCLayout(t)};case e.TRTCMediaSourceType.kText:return d(d({id:t.id},t.text||{}),{layout:this._getTRTCLayout(t)});case e.TRTCMediaSourceType.kImage:return{id:t.id,url:null===(u=t.image)||void 0===u?void 0:u.url,layout:this._getTRTCLayout(t)};case e.TRTCMediaSourceType.kVideo:return{id:t.id,url:null===(l=t.video)||void 0===l?void 0:l.url,layout:this._getTRTCLayout(t)};default:return null}},t.prototype._getCanvasSize=function(t,i){var o,r,n=((o={})[e.TRTCVideoResolution.TRTCVideoResolution_480_270]={width:480,height:270},o[e.TRTCVideoResolution.TRTCVideoResolution_640_360]={width:640,height:360},o[e.TRTCVideoResolution.TRTCVideoResolution_960_540]={width:960,height:540},o[e.TRTCVideoResolution.TRTCVideoResolution_1280_720]={width:1280,height:720},o[e.TRTCVideoResolution.TRTCVideoResolution_1920_1080]={width:1920,height:1080},o)[t],s=n.width,a=n.height;return i===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait&&(s=(r=[a,s])[0],a=r[1]),{width:s,height:a}},t.prototype.addMediaSource=function(t){var i;return p(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,l,d;return T(this,(function(h){switch(h.label){case 0:if(-1!==this.findMediaSourceIndex(t))throw new Error("Media source already existed");if(o=be(t),r=this._getTRTCSourceKey(o),!(n=this._getTRTCSourceItem(o))||!r)throw new Error("Invalid media source");return(s=be(this.trtcSourceMap.get(r))||[]).push(n),[4,this.trtc.updatePlugin("VideoMixer",(d={},d[r]=s,d))];case 1:return a=h.sent(),c=a.result,u=a.systemAudioTrackList,t.type===e.TRTCMediaSourceType.kScreen&&(null==u?void 0:u[t.id])?(this.screensWithSystemAudio.add(t.id),l=null==u?void 0:u[t.id],this.logger.log("".concat(this.logPrefix," startPlugin AudioMixer, track ID:"),l.id),[4,this.trtc.startPlugin("AudioMixer",{id:"systemAudioTrack_".concat(t.id),track:l})]):[3,3];case 2:h.sent(),h.label=3;case 3:if(c.failedDetails.find((function(e){return e.id===t.id})))throw new Error("Failed to add media source");return o.isSelected&&(this.unselectMediaSource(this.selectedSource),this.selectedSource=t),this.trtcSourceMap.set(r,s),null===(i=this.mediaMixingDesigner)||void 0===i||i.addMedia({id:o.id,rect:this._getDesignerMediaRect(t),isSelected:!!ge(o.isSelected)||o.isSelected,origin:o,interaction:o.interaction}),o.isSelected&&(this.selectedSource=o),this.sourceList.push(o),[2]}}))}))},t.prototype.removeMediaSource=function(t){var i,o,r;return p(this,void 0,Promise,(function(){var n,s,a,c,u,l;return T(this,(function(d){switch(d.label){case 0:if(this.logger.log("".concat(this.logPrefix,"removeMediaSource:"),t),-1===(n=this.findMediaSourceIndex(t)))throw new Error("Not existing media source to remove");return s=this._getTRTCSourceKey(t),a=be(this.trtcSourceMap.get(s))||[],c=a.findIndex((function(e){return e.id===t.id})),a.splice(c,1),[4,this.trtc.updatePlugin("VideoMixer",(l={},l[s]=a,l))];case 1:return u=d.sent().result,t.type===e.TRTCMediaSourceType.kScreen&&this.screensWithSystemAudio.has(t.id)?(this.screensWithSystemAudio.delete(t.id),[4,this.trtc.stopPlugin("AudioMixer",{id:"systemAudioTrack_".concat(t.id)})]):[3,3];case 2:d.sent(),d.label=3;case 3:if(u.failedDetails.find((function(e){return e.id===t.id})))throw new Error("Failed to remove media source");return null===(i=this.mediaMixingDesigner)||void 0===i||i.removeMedia({id:t.id,rect:null===(o=t.layout)||void 0===o?void 0:o.rect,isSelected:t.isSelected||!1,origin:be(t)}),(null===(r=this.selectedSource)||void 0===r?void 0:r.id)===t.id&&(this.selectedSource=null),this.trtcSourceMap.set(s,a),this.sourceList.splice(n,1),[2]}}))}))},t.prototype._getDesignerMediaRect=function(t){var i,o,r=(null===(i=t.layout)||void 0===i?void 0:i.rect)||{left:0,top:0,right:0,bottom:0},n=r.left,s=r.top,a=r.right,c=r.bottom,u=a-n,l=c-s;switch(null===(o=t.layout)||void 0===o?void 0:o.rotation){case e.TRTCVideoRotation.TRTCVideoRotation0:case e.TRTCVideoRotation.TRTCVideoRotation180:return{left:n,top:s,right:a,bottom:c};case e.TRTCVideoRotation.TRTCVideoRotation90:case e.TRTCVideoRotation.TRTCVideoRotation270:return{left:n,top:s,right:n+l,bottom:s+u};default:return{left:n,top:s,right:a,bottom:c}}},t.prototype._getPluginMediaRect=function(t){var i,o,r=(null===(i=t.layout)||void 0===i?void 0:i.rect)||{left:0,top:0,right:0,bottom:0},n=r.left,s=r.top,a=r.right,c=r.bottom;switch(null===(o=t.layout)||void 0===o?void 0:o.rotation){case e.TRTCVideoRotation.TRTCVideoRotation0:case e.TRTCVideoRotation.TRTCVideoRotation180:return{left:n,top:s,right:a,bottom:c};case e.TRTCVideoRotation.TRTCVideoRotation90:case e.TRTCVideoRotation.TRTCVideoRotation270:return{left:n,top:s,right:n+(c-s),bottom:s+(a-n)};default:return{left:n,top:s,right:a,bottom:c}}},t.prototype.updateMediaSource=function(e){var t,i;return p(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,l;return T(this,(function(h){switch(h.label){case 0:if(this.logger.log("".concat(this.logPrefix,"updateMediaSource:"),e),-1===(o=this.findMediaSourceIndex(e)))throw new Error("Not existing media source to update");return r=d(d({},this.sourceList[o]),be(e)),e.isSelected?(this.unselectMediaSource(this.selectedSource),this.selectedSource=e):(null===(t=this.selectedSource)||void 0===t?void 0:t.id)===e.id&&(this.selectedSource=null),n=this._getTRTCSourceKey(r),s=this._getTRTCSourceItem(r),a=be(this.trtcSourceMap.get(n))||[],c=a.findIndex((function(t){return t.id===e.id})),a[c]=s,[4,this.trtc.updatePlugin("VideoMixer",(l={},l[n]=a,l))];case 1:if(h.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return u={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:be(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(u)),null===(i=this.mediaMixingDesigner)||void 0===i||i.updateMedia(u),this.trtcSourceMap.set(n,a),this.sourceList[o]=r,[2]}}))}))},t.prototype.startPublish=function(){return p(this,void 0,Promise,(function(){return T(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 p(this,void 0,Promise,(function(){return T(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(e){var t,i,o,r,n;return p(this,void 0,Promise,(function(){var s,a,u,l,d,h,p,f,v,m,R,y,C,_,b,S,M,w,E,V,A,P,L,I;return T(this,(function(T){switch(T.label){case 0:this.logger.log("".concat(this.logPrefix,"updatePublishParams:"),e),s=this.publishParams,this.publishParams=e,a=this._getCanvasSize(e.videoEncoderParams.videoResolution,e.videoEncoderParams.resMode),u=a.width,l=a.height,T.label=1;case 1:return T.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:u,height:l,canvasColor:String(e.canvasColor)}})];case 2:return T.sent(),[3,4];case 3:if((d=T.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw d;return[3,4];case 4:null===(o=this.mediaMixingDesigner)||void 0===o||o.updateOptions({videoResolution:this.publishParams.videoEncoderParams.videoResolution,resMode:this.publishParams.videoEncoderParams.resMode}),T.label=5;case 5:T.trys.push([5,11,12,17]),h=g(this.sourceList),T.label=6;case 6:return[4,h.next()];case 7:return(p=T.sent()).done?[3,10]:(f=p.value).layout?(v=f.layout.rect||{left:0,top:0,right:0,bottom:0},m=v.left,R=v.top,y=v.right,C=v.bottom,_=this._getCanvasSize(s.videoEncoderParams.videoResolution),b=_.width,S=_.height,M=this._getCanvasSize(e.videoEncoderParams.videoResolution),w=M.width,E=M.height,V=m*w/b,A=R*E/S,P=y*w/b,L=C*E/S,f.layout.rect={left:V,top:A,right:P,bottom:L},[4,this.updateMediaSource(f)]):[3,9];case 8:T.sent(),null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",f,null===(n=f.layout)||void 0===n?void 0:n.rect),T.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return I=T.sent(),t={error:I},[3,17];case 12:return T.trys.push([12,,15,16]),p&&!p.done&&(i=h.return)?[4,i.call(h)]:[3,14];case 13:T.sent(),T.label=14;case 14:return[3,16];case 15:if(t)throw t.error;return[7];case 16:return[7];case 17:return[4,this.trtcCloud.setVideoEncoderParam(e.videoEncoderParams)];case 18:return T.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 t,i;this.view&&(this.mediaMixingDesigner=new Un({view:this.view,videoResolution:(null===(t=this.publishParams)||void 0===t?void 0:t.videoEncoderParams.videoResolution)||e.TRTCVideoResolution.TRTCVideoResolution_1920_1080,resMode:(null===(i=this.publishParams)||void 0===i?void 0:i.videoEncoderParams.resMode)||e.TRTCVideoResolutionMode.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 p(this,void 0,void 0,(function(){return T(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(d(d({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(d(d({},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=d(d({},e.origin),{layout:d(d({},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=d(d({},e.origin),{layout:d(d({},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 p(this,void 0,Promise,(function(){var o;return T(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:be(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}(),Gn=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=d(d({},e),{functionName:o}),a=new Promise((function(e,t){s.resolve=e,s.reject=t}));if(s.promise=a,t)this.length<=1?this.queue.push(s):null===(n=null===(r=this.lastQueueItem)||void 0===r?void 0:r.promise)||void 0===n||n.then(s.resolve,s.reject);else{if(i&&o&&this.queue.length>1){var c=[];this.queue=this.queue.filter((function(e,t){return 0===t||(e.functionName!==o||(c.push(e),!1))})),c.forEach((function(e){e.reject(new Error("aborted by newer task"))}))}this.queue.push(s)}return this.isRunning||this.callNext(),a},e.prototype.shift=function(){return this.queue.shift()},e.prototype.callNext=function(){var e=this;if(!this.isRunning&&0!==this.length){var t=this.queue[0],i=t.fn,o=t.args,r=t.context,n=t.resolve,s=t.reject;this.isRunning=!0,i.apply(r,o).then(n,s).finally((function(){e.isRunning=!1,e.shift(),e.callNext()}))}},e}(),Yn=new WeakMap,Kn=new WeakMap,Jn=new WeakMap;function Xn(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=Jn.get(this)||new Map;Jn.set(this,c);for(var u=null,l=0,d=s;l<d.length;l++){var h=d[l],p=c.get(h);if(p){u=p;break}}for(var T=u||new Gn,f=0,v=s;f<v.length;f++){h=v[f];c.set(h,T)}var g=a?o:void 0;return T.push({fn:n,args:t,context:this},!1,a,g)},r}}var $n=function(){function e(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 e.prototype.registerStateListener=function(){this.trtc.on(c.default.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},e.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)}},e.prototype.updateMessageSubscription=function(){var e=!this.isPaused&&this.listeners.size>0;if(e&&!this.isMessageListenerRegistered)return this.trtc.on(c.default.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),void(this.isMessageListenerRegistered=!0);!e&&this.isMessageListenerRegistered&&(this.trtc.off(c.default.EVENT.REALTIME_TRANSCRIBER_MESSAGE,this.handleMessageEvent),this.isMessageListenerRegistered=!1)},e.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,v([e,this.logPrefix],i,!1))},e.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,v([e,this.logPrefix],i,!1))},e.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)}}))},e.prototype.startRealtimeTranscriber=function(e){return p(this,void 0,Promise,(function(){var t,i,o;return T(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]}}))}))},e.prototype.stopRealtimeTranscriber=function(e){return p(this,void 0,Promise,(function(){var t;return T(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]}}))}))},e.prototype.pauseReceivingMessage=function(){this.isPaused||(this.log("pauseReceivingMessage"),this.isPaused=!0,this.updateMessageSubscription())},e.prototype.resumeReceivingMessage=function(){this.isPaused&&(this.log("resumeReceivingMessage"),this.isPaused=!1,this.updateMessageSubscription())},e.prototype.addListener=function(e){this.listeners.add(e),this.updateMessageSubscription()},e.prototype.removeListener=function(e){this.log("removeListener"),this.listeners.delete(e),this.updateMessageSubscription()},e.prototype.destroy=function(){this.log("destroy"),this.listeners.clear(),this.isPaused=!0,this.updateMessageSubscription(),this.trtc.off(c.default.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED,this.handleStateEvent)},e}(),Zn=c.default._loggerManager;Zn.info("TRTCCloud Version: ".concat(Vn));var es,ts,is,os="trtcCloud",rs=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(es=function(){0!==ns.size&&Array.from(ns.values()).forEach((function(e){e.fn()}))},ts=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];is>0&&clearTimeout(is),is=window.setTimeout((function(){es.apply(e,t),is=-1}),ts)}));var ns=new Map,ss=function(t){function s(o){void 0===o&&(o={});var r=t.call(this)||this;r._version="",r._frameWorkType=30,r._component=0,r._language=0,r._networkProxy={},r._localView=null,r._autoRecvAudio=!0,r._autoRecvVideo=!1,r._localTestView=null,r._isVideoPublish=!0,r._localRenderParams={rotation:e.TRTCVideoRotation.TRTCVideoRotation0,fillMode:e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,mirrorType:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto},r._encoderMirror=void 0,r._videoProfile={},r._isAudioPublish=!0,r._audioMuteType=!1,r._audioProfile=c.default.TYPE.AUDIO_PROFILE_STANDARD,r._captureVolume=100,r._playoutVolume=100,r._isSharingScreen=!1,r._remoteStreamConfig=new Map,r._remoteStreamMap=new Map,r._cameraList=[],r._microphoneList=[],r._speakerList=[],r._currentCamera={},r._currentMicrophone={},r._currentSpeaker={},r._currentCameraId="",r._currentMicrophoneId="",r._currentSpeakerId="",r._screenShareParams={option:{}},r._isMobile=Wr,r._isFrontCamera=!0,r._cameraVideoTrack=null,r._smallStreamVideoProfile=void 0,r._qosPreference=void 0,r._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},r._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},r._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},r._isVirtualBackground=!1,r._isTestVirtualBackground=!1,r._isBeautyEnabled=!1,r._isTestBeautyEnabled=!1,r._remoteStatisticsUserIdList=[],r._hasJoinedRoom=!1,r._isExitingRoom=!1,r._version=Vn;var a=o.frameWorkType,l=void 0===a?30:a,d=o.component,h=void 0===d?0:d,p=o.language,T=void 0===p?0:p;return r._frameWorkType=l,r._component=h,r._language=T,r._trtc=c.default.create({enableSEI:s.enableSEI,assetsPath:s.assetsPath,enableVolumeControlInIOS:!0,plugins:[u.default,i.LEBPlayer,n.RealtimeTranscriber]}),r._testTrtc=c.default.create(),r._log=c.default._loggerManager,r.logger=new Pn(Zn,{seq:rs++}),r._echoCancellation=void 0,r._noiseSuppression=void 0,r._autoGainControl=void 0,r._addTRTCEvents(),r.handleDeviceChange=r.handleDeviceChange.bind(r),ns.set(r,{fn:r.handleDeviceChange,self:r}),r}var a;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}l(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(s,t),s.getPlugin=function(e){return"VirtualBackground"===e?o.VirtualBackground:"BasicBeauty"===e?r.BasicBeauty:"VideoMixer"===e?u.default:null},s.getTRTCShareInstance=function(e){return s.shareInstance||(s.shareInstance=new s(e)),s.shareInstance},s.setLogLevel=function(t,i){var o,r=((o={})[e.TRTCLogLevel.TRTCLogLevelVerbose]=0,o[e.TRTCLogLevel.TRTCLogLevelDebug]=1,o[e.TRTCLogLevel.TRTCLogLevelInfo]=2,o[e.TRTCLogLevel.TRTCLogLevelWarn]=3,o[e.TRTCLogLevel.TRTCLogLevelError]=4,o[e.TRTCLogLevel.TRTCLogLevelFatal]=4,o[e.TRTCLogLevel.TRTCLogLevelNone]=5,o),n=r[t];ge(n)&&(n=r[e.TRTCLogLevel.TRTCLogLevelInfo]);var s=!Re(i)||i;c.default.setLogLevel(n,s)},s.destroyTRTCShareInstance=function(){s.shareInstance&&(s.shareInstance._destroy(),s.shareInstance=null),Array.from(s.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},s.callExperimentalAPI=function(e){console.log("static ".concat(os,".callExperimentalAPI"),e);var t=ye(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":s.enableSEI=o.enable;break;case"setAssetsPath":s.assetsPath=o.assetsPath}}catch(r){throw r}}},s.prototype.createSubCloud=function(){if(this!==s.shareInstance)return null;var e=new s;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),s.subCloudMap.set(e,e),e},s.prototype.destroy=function(){this!==s.shareInstance?(s.subCloudMap.get(this)&&s.subCloudMap.delete(this),this._destroy()):s.destroyTRTCShareInstance()},s.prototype._destroy=function(){ns.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},s.prototype.getSDKVersion=function(){return this._version||""},s.prototype.enterRoom=function(e,t){return p(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,l,h,p,f,v,g,m,R,y,C;return T(this,(function(T){switch(T.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,a=e.role,c=e.privateMapKey,u=e.businessInfo,l=e.enableAutoPlayDialog,h=e.proxy,p=e.streamId,f=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(os,".enterRoom with params: "),e,t),h&&(this._networkProxy=h),!(i&&o&&r))return[3,5];T.label=1;case 1:return T.trys.push([1,3,,4]),v={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:pe[a],scene:Te[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},v=c?d(d({},v),{privateMapKey:c}):v,v=u?d(d({},v),{businessInfo:u}):v,g=l||this._enableAutoPlayDialog,v=Re(g)?d(d({},v),{enableAutoPlayDialog:g}):v,v=this._networkProxy?d(d({},v),{proxy:this._networkProxy}):v,v=p?d(d({},v),{streamId:p}):v,v=f?d(d({},v),{userDefineRecordId:f}):v,v=void 0!==this._latencyLevel?d(d({},v),{latencyLevel:this._latencyLevel}):v,m=ve(),[4,this._trtc.enterRoom(v)];case 2:return T.sent(),this._hasJoinedRoom=!0,R=ve()-m,this.emit("onEnterRoom",R),[3,4];case 3:return y=T.sent(),C=(C=this._transformTRTCErrorCode(y,"enterRoom"))<0?C:-1,this.emit("onEnterRoom",C),this._callFunctionErrorManage(y,"enterRoom"),[3,4];case 4:return[3,6];case 5:this._emitError(wn),T.label=6;case 6:return[2]}}))}))},s.prototype.exitRoom=function(){return p(this,void 0,Promise,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(os,".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",ln.exitRoom),[3,3];case 2:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,3];case 3:return[2]}}))}))},s.prototype.switchRole=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(pe[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(pe[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]}}))}))},s.prototype.setDefaultStreamRecvMode=function(e,t){return p(this,void 0,void 0,(function(){return T(this,(function(i){return this.logger.info("".concat(os,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),Re(e)&&(this._autoRecvAudio=e),Re(t)&&(this._autoRecvVideo=t),[2]}))}))},s.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()},s.prototype._updateLocalVideo=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalTestVideo=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalScreen=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateRemoteVideo=function(e,t){return p(this,void 0,void 0,(function(){var i;return T(this,(function(o){switch(o.label){case 0:if(!this._hasJoinedRoom||this._isExitingRoom)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(e,t))];case 2:return o.sent(),[3,4];case 3:if((i=o.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw i;return[3,4];case 4:return[2]}}))}))},s.prototype.startLocalPreview=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return p(this,void 0,Promise,(function(){var t,i,o,r,n;return T(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(os,".startLocalPreview with params: "),e),1===v([],e,!0).length?i=v([],e,!0)[0]:2===v([],e,!0).length&&(n=v([],e,!0),t=n[0],i=n[1]),ge(t)||(this._setIsMobile(!0),this._setIsFrontCamera(t)),this._setLocalView(i),s.label=1;case 1:s.trys.push([1,9,,10]),s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return s.sent(),[3,8];case 4:return(o=s.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return s.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return this.emit("onCameraDidReady"),[3,10];case 9:return r=s.sent(),this._callFunctionErrorManage(r,"startLocalPreview"),[3,10];case 10:return[2]}}))}))},s.prototype.updateLocalView=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(os,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},s.prototype.stopLocalPreview=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(os,".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(os," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},s.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.startRemoteView=function(t,i,o){return p(this,void 0,void 0,(function(){var r,n;return T(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(os,".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===e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(o))))return[2];s.label=2;case 2:return s.trys.push([2,4,,8]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,o))];case 3:return s.sent(),[3,8];case 4:return(r=s.sent()).code!==c.default.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]}}))}))},s.prototype.updateRemoteView=function(e,t,i){return p(this,void 0,void 0,(function(){return T(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(os,".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]}}))}))},s.prototype.stopRemoteView=function(e,t){return p(this,void 0,void 0,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.stopAllRemoteView=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.setVideoEncoderParam=function(t){return p(this,void 0,void 0,(function(){var i,o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(os,".setVideoEncoderParam with params: "),t),r.label=1;case 1:return r.trys.push([1,4,,5]),i=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,t),this._setVideoProfile(i),[4,this._updateLocalVideo()];case 2:return r.sent(),[4,this._updateLocalTestVideo()];case 3:return r.sent(),[3,5];case 4:return o=r.sent(),this._callFunctionErrorManage(o,"setVideoEncoderParam"),[3,5];case 5:return[2]}}))}))},s.prototype.setNetworkQosParam=function(e){return p(this,void 0,void 0,(function(){var t,i,o=this;return T(this,(function(r){return this.logger.info("".concat(os,".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)}))}))]}))}))},s.prototype.setLocalRenderParams=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.setVideoEncoderMirror=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.setRemoteRenderParams=function(e,t,i){return p(this,void 0,void 0,(function(){var o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype._updateLocalAudio=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype._updateLocalTestAudio=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalAudio(this._generateLocalTestAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw e;return[3,3];case 3:return[2]}}))}))},s.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),p(this,void 0,void 0,(function(){var i,o,r;return T(this,(function(n){switch(n.label){case 0:t===e.TRTCAudioQuality.TRTCAudioQualitySpeech?this.logger.warn("Web trtcCloud not support audioQuality of TRTCAudioQualitySpeech, and will use TRTCAudioQualityDefault"):this.logger.info("".concat(os,".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!==c.default.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(os," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),[3,10];case 10:return[2]}}))}))},s.prototype.stopLocalAudio=function(){return p(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.setAudioCaptureVolume=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(os,".getAudioCaptureVolume")),this._getCaptureVolume()},s.prototype.setAudioPlayoutVolume=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(os,".getAudioPlayoutVolume")),this._playoutVolume},s.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),p(this,void 0,void 0,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".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(wn),[2]);case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},s.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(os,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},s.prototype.muteRemoteVideoStream=function(e,t,i){return p(this,void 0,void 0,(function(){var o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.muteAllRemoteVideoStreams=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(os,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){this._callFunctionErrorManage(i,"setRemoteAudioVolume")}},s.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(os,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},s.prototype.enableSmallVideoStream=function(t,i){return p(this,void 0,Promise,(function(){var o;return T(this,(function(r){switch(r.label){case 0:return this.logger.info("".concat(os,".enableSmallVideoStream with params: "),t,i),t?(o=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall,i),this._setSmallStreamVideoProfile(o)):this._setSmallStreamVideoProfile(void 0),[4,this._updateLocalVideo()];case 1:return r.sent(),[2]}}))}))},s.prototype.snapshotVideo=function(t,i){var o="";return o=""===t&&i===e.TRTCVideoStreamType.TRTCVideoStreamTypeBig?this._trtc.getVideoSnapshot():""===t&&i===e.TRTCVideoStreamType.TRTCVideoStreamTypeSub?this._trtc.getVideoSnapshot({streamType:this._getTRTCStreamType(i)}):this._trtc.getVideoSnapshot({userId:t,streamType:this._getTRTCStreamType(i)}),this.emit("onSnapshotComplete",t,i,o),o},s.prototype.startScreenShare=function(t,i,o){return p(this,void 0,void 0,(function(){var r,n,s,a,u,l;return T(this,(function(d){switch(d.label){case 0:this.logger.info("".concat(os,".startScreenShare with params: "),t,i,o),d.label=1;case 1:return d.trys.push([1,3,,4]),n=(r=o||{}).screenAudio,s=void 0!==n&&n,a=r.videoTrack,u=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,o),this._setScreenShareParams({view:t,profile:u,systemAudio:s,videoTrack:a,streamType:i}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return d.sent(),this._isSharingScreen=!0,this.emit("onScreenCaptureStarted"),[3,4];case 3:if((l=d.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT)throw console.error("Start share screen error:",l,l.code,l.name,l.message),l;return[3,4];case 4:return[2]}}))}))},s.prototype.setSubStreamEncoderParam=function(t){return p(this,void 0,void 0,(function(){var i,o;return T(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(os,".setSubStreamEncoderParam with params: "),t),i=this._getTRTCVideoProfile(e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,t),this._setScreenShareParams({profile:i}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._updateLocalScreen()];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"setSubStreamEncoderParam"),[3,4];case 4:return[2]}}))}))},s.prototype.stopScreenShare=function(){return p(this,void 0,Promise,(function(){var e;return T(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype._startPublishVideoTrack=function(e){var t=e.videoTrack;return p(this,void 0,void 0,(function(){var e,i;return T(this,(function(o){switch(o.label){case 0:o.trys.push([0,7,,8]),o.label=1;case 1:return o.trys.push([1,3,,6]),[4,this._trtc.startLocalVideo({option:{videoTrack:t,profile:this._getVideoProfile()},forcePublish:!0})];case 2:return o.sent(),[3,6];case 3:return(e=o.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._trtc.updateLocalVideo({option:{videoTrack:t,profile:this._getVideoProfile()},forcePublish:!0})];case 4:o.sent(),o.label=5;case 5:throw e;case 6:return[3,8];case 7:return i=o.sent(),this._callFunctionErrorManage(i,"startPublishVideoTrack"),[3,8];case 8:return[2]}}))}))},s.prototype._stopPublishVideoTrack=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},s.prototype.startScreenCapture=function(){this._emitError(En)},s.prototype.pauseScreenCapture=function(){this._emitError(En)},s.prototype.resumeScreenCapture=function(){this._emitError(En)},s.prototype.getScreenCaptureSources=function(){this._emitError(En)},s.prototype.selectScreenCaptureTarget=function(){this._emitError(En)},s.prototype.getCameraDevicesList=function(){return p(this,void 0,Promise,(function(){var e,t,i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".getCameraDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,c.default.getCameraList()];case 2:return e=o.sent(),t=e.map((function(e){return d(d({},e),{deviceName:e.label})})),this._cameraList=e,"{}"!==JSON.stringify(this._currentCamera)?[3,4]:(this._currentCamera=this.getDefaultDeviceInfo(e),this._currentCameraId=this._currentCamera.deviceId,[4,this.setCurrentCameraDevice(this._currentCameraId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getCameraDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentCameraDevice=function(e){var t;return p(this,void 0,Promise,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(os,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new L(t,i,o,i,r)},s.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},s.prototype.switchCamera=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(os,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},s.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},s.prototype.setVirtualBackground=function(e){return p(this,void 0,void 0,(function(){var t,i,o,r,n;return T(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!==de?[3,2]:[4,this._trtc.updatePlugin(ue,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==he?[3,4]:[4,this._trtc.updatePlugin(ue,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(ue,d(d({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._trtc.stopPlugin(ue),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(os,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},s.prototype.setTestVirtualBackground=function(e){return p(this,void 0,void 0,(function(){var t,i,o,r,n;return T(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!==de?[3,2]:[4,this._testTrtc.updatePlugin(ue,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==he?[3,4]:[4,this._testTrtc.updatePlugin(ue,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(ue,d(d({},e),{src:r,onAbort:this._onVirtualBackgroundError.bind(this)}))];case 6:s.sent(),this._isTestVirtualBackground=!0,s.label=7;case 7:return[3,9];case 8:this._testTrtc.stopPlugin(ue),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(os,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},s.prototype.useVirtualBackground=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:o.VirtualBackground,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:o.VirtualBackground,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},s.prototype.setBeautyStyle=function(e,t,i,o){return p(this,void 0,void 0,(function(){return T(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]}}))}))},s.prototype.setTestBeautyStyle=function(e,t,i,o){return p(this,void 0,void 0,(function(){return T(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]}}))}))},s.prototype.useBeautyStyle=function(e){return p(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this._trtc?[4,this._trtc.use({plugin:r.BasicBeauty,assetsPath:e})]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._testTrtc?[4,this._testTrtc.use({plugin:r.BasicBeauty,assetsPath:e})]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},s.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return p(this,void 0,void 0,(function(){var i,a,c,u,l;return T(this,(function(d){switch(d.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");d.label=1;case 1:return d.trys.push([1,8,,9]),a=r/9,c=n/9,0===(i=o/9)&&0===a&&0===c?[4,e.stopPlugin(le)]:[3,3];case 2:return d.sent(),s?this._isTestBeautyEnabled=!1:this._isBeautyEnabled=!1,[3,7];case 3:return u={beauty:i,brightness:a,ruddy:c},t?[3,5]:[4,e.startPlugin(le,u)];case 4:return d.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(le,u)];case 6:d.sent(),d.label=7;case 7:return[3,9];case 8:throw l=d.sent(),s?this.logger.error("".concat(os,".").concat("setTestBeautyStyle"," fail: "),l):this.logger.error("".concat(os,".").concat("setBeautyStyle"," fail: "),l),l;case 9:return[2]}}))}))},s.prototype._resetBeautyStyle=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(le)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(le)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},s.prototype.getMicDevicesList=function(){return p(this,void 0,Promise,(function(){var e,t,i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".getMicDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,c.default.getMicrophoneList()];case 2:return e=o.sent(),t=e.map((function(e){return d(d({},e),{deviceName:e.label})})),this._microphoneList=e,"{}"!==JSON.stringify(this._currentMicrophone)?[3,4]:(this._currentMicrophone=this.getDefaultDeviceInfo(e),this._currentMicrophoneId=this._currentMicrophone.deviceId,[4,this.setCurrentMicDevice(this._currentMicrophoneId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getMicDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentMicDevice=function(e){var t;return p(this,void 0,Promise,(function(){var i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".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]}}))}))},s.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(os,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new L(t,i,o,i,r)},s.prototype.getSpeakerDevicesList=function(){return p(this,void 0,Promise,(function(){var e,t,i;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".getSpeakerDevicesList")),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,c.default.getSpeakerList()];case 2:return e=o.sent(),t=e.map((function(e){return d(d({},e),{deviceName:e.label})})),this._speakerList=e,"{}"!==JSON.stringify(this._currentSpeaker)?[3,4]:(this._currentSpeaker=this.getDefaultDeviceInfo(e),this._currentSpeakerId=this._currentSpeaker.deviceId,[4,this.setCurrentSpeakerDevice(this._currentSpeakerId)]);case 3:o.sent(),o.label=4;case 4:return[2,Promise.resolve(t)];case 5:return i=o.sent(),this._callFunctionErrorManage(i,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 6:return[2]}}))}))},s.prototype.setCurrentSpeakerDevice=function(e){return p(this,void 0,Promise,(function(){var t;return T(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(os,".setCurrentSpeakerDevice with params: "),{speakerId:e}),i.label=1;case 1:return i.trys.push([1,3,,4]),e?[4,c.default.setCurrentSpeaker(e)]:[2,!1];case 2:return i.sent(),this._setCurrentSpeakerId(e),this._currentSpeaker=this._speakerList.find((function(t){return t.deviceId===e}))||{},[3,4];case 3:throw t=i.sent(),this._callFunctionErrorManage(t,"setCurrentSpeakerDevice"),t;case 4:return[2]}}))}))},s.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(os,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new L(t,i,o,i,r)},s.prototype.startCameraDeviceTest=function(e){return p(this,void 0,void 0,(function(){var t;return T(this,(function(i){switch(i.label){case 0:if(this.logger.info("".concat(os,".startCameraDeviceTest with params: "),e),!e)return[2];this._setLocalTestView(e),i.label=1;case 1:return i.trys.push([1,3,,7]),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())];case 2:return i.sent(),[3,7];case 3:return(t=i.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestVideo()];case 4:return i.sent(),[3,6];case 5:throw this._callFunctionErrorManage(t,"startCameraDeviceTest"),t;case 6:return[3,7];case 7:return[2]}}))}))},s.prototype.stopCameraDeviceTest=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(os,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},s.prototype.startMicDeviceTest=function(e){return p(this,void 0,void 0,(function(){var t,i=this;return T(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(os,".startMicDeviceTest with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,7]),[4,this._testTrtc.startLocalAudio(this._generateLocalTestAudioData())];case 2:return o.sent(),[3,7];case 3:return(t=o.sent()).code!==c.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalTestAudio()];case 4:return o.sent(),[3,6];case 5:throw this._callFunctionErrorManage(t,"startMicDeviceTest"),t;case 6:return[3,7];case 7:return this._testTrtc.on(c.default.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,o=e.volume;""===t&&i.emit("onTestMicVolume",o)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(e)];case 8:return o.sent(),[2]}}))}))},s.prototype.stopMicDeviceTest=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(os,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},s.prototype.callExperimentalAPI=function(e){return p(this,void 0,void 0,(function(){var t,i,o;return T(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(os,".callExperimentalAPI"),e),(t=ye(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]}}))}))},s.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;me(t)&&(this._frameWorkType=t),me(i)&&(this._component=i),me(o)&&(this._language=o)},s.prototype._handleKeyMetricsStats=function(e){var t=e.key,i=e.opt,o=e.value,r=e.version,n=i===fe;c.default._addKVStat({type:i,key:t,value:o,version:r,useUV:n,base:100})},s.prototype._setVideoEncodeParamEx=function(t){return p(this,void 0,void 0,(function(){return T(this,(function(i){switch(i.label){case 0:switch(t.streamType){case e.TRTCVideoStreamType.TRTCVideoStreamTypeBig:return[3,1];case e.TRTCVideoStreamType.TRTCVideoStreamTypeSub:return[3,3]}return[3,5];case 1:return[4,this.setVideoEncoderParam(t)];case 2:case 4:return i.sent(),[3,6];case 3:return[4,this.setSubStreamEncoderParam(t)];case 5:return[3,6];case 6:return[2]}}))}))},s.prototype._switchPlaybackQuality=function(e){return p(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return T(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]}}))}))},s.prototype._requestPictureInPicture=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(os,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},s.prototype._exitPictureInPicture=function(){return p(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(os,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},s.prototype._emitError=function(e){e&&this.emit&&this.emit(ne,e.code,e.message)},s.prototype._emitWarning=function(e){this.emit&&this.emit(se,e)},s.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?Mn:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},s.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:vn},s.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},s.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},s.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 gn;if(o)return Cn;break;case 5302:if(i)return mn;if(o)return _n;break;case 5303:if(i)return yn;if(o)return Sn;break;case 5304:if(i)return Rn;if(o)return bn}},s.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?gn:o?Cn:e.code},s.prototype._transformTRTCErrorCode=function(e,t){var i=null==e?void 0:e.code;if(e&&e.code)switch(e.code){case c.default.ERROR_CODE.DEVICE_ERROR:i=this._transformTRTCDeviceError(e,t);break;case c.default.ERROR_CODE.SERVER_ERROR:i=this._transformTRTCServerError(e);break;case c.default.ERROR_CODE.INVALID_OPERATION:case c.default.ERROR_CODE.OPERATION_ABORT:i=this._transformTRTCInvalidOperationError(e,t);break;case c.default.ERROR_CODE.UNKNOWN_ERROR:i=this._transformTRTCUnKnowError(e,t)}return i},s.prototype._callFunctionErrorManage=function(e,t){if(!e||e.code!==c.default.ERROR_CODE.OPERATION_ABORT){this.logger.warn("(".concat(t,") failed - ").concat(e.code," - ").concat(e.message));var i=this._transformTRTCErrorCode(e,t);this.emit(ne,i,e.message)}},s.prototype._getTRTCResolution=function(t){var i=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(i.length>1&&i[1]),height:+(i.length>2&&i[2])}},s.prototype._getTRTCVideoProfile=function(t,i){void 0===i&&(i={});var o=i.videoWidth,r=i.videoHeight,n=i.videoResolution,s=i.videoFps,a=i.videoBitrate,c=i.resMode,u=i.resolutionMode,l={};switch(t){case e.TRTCVideoStreamType.TRTCVideoStreamTypeSub:l=this._defaultScreenProfile;break;case e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall:l=this._defaultSmallVideoProfile;break;case e.TRTCVideoStreamType.TRTCVideoStreamTypeBig:default:l=this._defaultVideoProfile}if(ge(n))ge(o)||(l.width=o),ge(r)||(l.height=r);else{var d=this._getTRTCResolution(n);l.width=d.width,l.height=d.height}if(!ge(c)&&c===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait||!ge(u)&&u===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait){var h=l.height,p=l.width;l.width=h,l.height=p}return s&&(l.frameRate=s),a&&(l.bitrate=a),l},s.prototype._getTRTCStreamType=function(t){var i;return((i={})[e.TRTCVideoStreamType.TRTCVideoStreamTypeBig]=c.default.TYPE.STREAM_TYPE_MAIN,i[e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall]=c.default.TYPE.STREAM_TYPE_MAIN,i[e.TRTCVideoStreamType.TRTCVideoStreamTypeSub]=c.default.TYPE.STREAM_TYPE_SUB,i)[t]},s.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=un.COVER,i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=un.CONTAIN,i)[t]},s.prototype._getTRTCCloudVideoFillMode=function(t){var i;return((i={})[un.COVER]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,i[un.CONTAIN]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit,i)[t]},s.prototype._getTRTCCloudMirrorType=function(t){return!0===t?e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable},s.prototype._getLocalRenderMirror=function(t){var i;return t===e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i)[t]},s.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return ge(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},s.prototype._getTRTCRemoteMirror=function(t){var i;return((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto]=!1,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i)[t]},s.prototype._getTRTCQosPreference=function(t){var i;return((i={})[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceSmooth]=c.default.TYPE.QOS_PREFERENCE_SMOOTH,i[e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear]=c.default.TYPE.QOS_PREFERENCE_CLEAR,i)[t]},s.prototype._getTRTCAudioQuality=function(t){var i;return((i={})[e.TRTCAudioQuality.TRTCAudioQualitySpeech]=c.default.TYPE.AUDIO_PROFILE_STANDARD,i[e.TRTCAudioQuality.TRTCAudioQualityDefault]=c.default.TYPE.AUDIO_PROFILE_STANDARD,i[e.TRTCAudioQuality.TRTCAudioQualityMusic]=c.default.TYPE.AUDIO_PROFILE_HIGH_STEREO,i)[t]},s.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},s.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},s.prototype._getTRTCCloudQuality=function(t){return[e.TRTCQuality.TRTCQuality_Unknown,e.TRTCQuality.TRTCQuality_Excellent,e.TRTCQuality.TRTCQuality_Good,e.TRTCQuality.TRTCQuality_Poor,e.TRTCQuality.TRTCQuality_Bad,e.TRTCQuality.TRTCQuality_Vbad,e.TRTCQuality.TRTCQuality_Down][t]},s.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},s.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},s.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return Re(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),Re(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),Re(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},s.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},s.prototype._generateRemoteVideoData=function(e,t){return be(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},s.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(c.default.EVENT.ERROR,(function(e){e&&t.emit("onError",e.code,e.message)})),this._trtc.on(c.default.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(c.default.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(c.default.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(c.default.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(c.default.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(c.default.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(c.default.EVENT.AUDIO_VOLUME,(function(e){(null==e?void 0:e.result)&&t.emit("onUserVoiceVolume",null==e?void 0:e.result,((null==e?void 0:e.result)||[]).length)})),this._trtc.on(c.default.EVENT.KICKED_OUT,(function(e){var i={banned:ln.banned,room_disband:ln.roomDisband};me(i[e.reason])&&t.emit("onExitRoom",i[e.reason])})),this._trtc.on(c.default.EVENT.NETWORK_QUALITY,(function(e){var i=e.uplinkNetworkQuality,o=e.downlinkNetworkQuality,r=new N("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new N(e,t._getTRTCCloudQuality(o))}))),t.emit("onNetworkQuality",r,n)})),this._trtc.on(c.default.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),this._trtc.on(c.default.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(c.default.EVENT.STATISTICS,(function(i){var o,r=i.rtt,n=i.upLoss,s=i.downLoss,a=i.bytesSent,c=i.bytesReceived,u=i.localStatistics,l=i.remoteStatistics;t._remoteStatisticsUserIdList=l.map((function(e){return e.userId}));var d={big:e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,small:e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall,sub:e.TRTCVideoStreamType.TRTCVideoStreamTypeSub},h=(null===(o=u.video)||void 0===o?void 0:o.length)>0?u.video.map((function(e){var t=new W;return t.width=e.width,t.height=e.height,t.frameRate=e.frameRate,t.videoBitrate=e.bitrate,t.audioBitrate=u.audio.bitrate||0,t.streamType=d[e.videoType],t})):[];if(0===h.length&&u.audio.bitrate>0){var p=new W;p.audioBitrate=u.audio.bitrate||0,h.push(p)}var T=[];l.forEach((function(e){var t=[],i=e.userId,o=e.audio.bitrate;if(e.video&&e.video.forEach((function(e){var r=new j;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=d[e.videoType],t.push(r)})),0===t.length){var r=new j;r.userId=i,r.audioBitrate=o||0,t.push(r)}T.push.apply(T,t)}));var f=new U;f.upLoss=n,f.downLoss=s,f.rtt=r,f.sentBytes=a,f.receivedBytes=c,f.localStatisticsArray=h,f.localStatisticsArraySize=h.length,f.remoteStatisticsArray=T,f.remoteStatisticsArraySize=T.length,t.emit("onStatistics",f)})),this._trtc.on(c.default.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._clearScreenShareParams(),t._isSharingScreen=!1})),this._trtc.on(c.default.EVENT.PUBLISH_STATE_CHANGED,(function(i){var o=i.mediaType;"started"===i.state&&("audio"===o?t.emit("onSendFirstLocalAudioFrame"):"video"===o?t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig):"screen"===o&&t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub))})),this._trtc.on(c.default.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(c.default.EVENT.AUDIO_PLAY_STATE_CHANGED,(function(e){var i=e.userId;"PLAYING"===e.state&&t.emit("onFirstAudioFrame",i)})),this._trtc.on(c.default.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(c.default.EVENT.CUSTOM_MESSAGE,(function(e){e&&t.emit("onRecvCustomCmdMsg",e.userId,e.cmdId,e.seq,null==e?void 0:e.data)})),this._trtc.on(c.default.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(c.default.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},s.prototype._removeTRTCEvents=function(){this._trtc.off("*")},s.prototype._emitVideoAvailable=function(e,t){var i=e.userId,o=e.streamType;t?this._remoteStreamMap.set("".concat(i,"_").concat(o),!0):this._remoteStreamMap.delete("".concat(i,"_").concat(o)),o===c.default.TYPE.STREAM_TYPE_SUB?i&&this.emit("onUserSubStreamAvailable",i,t):i&&this.emit("onUserVideoAvailable",i,t)},s.prototype._setLocalView=function(e){this._localView=e},s.prototype._getLocalView=function(){return this._localView},s.prototype._setIsMobile=function(e){this._isMobile=e},s.prototype._getIsMobile=function(){return this._isMobile},s.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},s.prototype._getIsFrontCamera=function(){return this._isFrontCamera},s.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},s.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},s.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},s.prototype._getIsVideoPublish=function(){return this._isVideoPublish},s.prototype._setVideoProfile=function(e){this._videoProfile=e},s.prototype._getVideoProfile=function(){return this._videoProfile},s.prototype._setQosPreference=function(e){this._qosPreference=e},s.prototype._getQosPreference=function(){return this._qosPreference},s.prototype._setLocalTestView=function(e){this._localTestView=e},s.prototype._getLocalTestView=function(){return this._localTestView},s.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;ge(t)||(this._screenShareParams.view=t),ge(i)||(this._screenShareParams.option.systemAudio=i),ge(o)||(this._screenShareParams.option.fillMode=o),ge(r)||(this._screenShareParams.option.profile=r),ge(n)||(this._screenShareParams.option.videoTrack=n),ge(s)||(this._screenShareParams.option.qosPreference=s),ge(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},s.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},s.prototype._getScreenShareParams=function(){return this._screenShareParams},s.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},s.prototype._getIsAudioPublish=function(){return this._isAudioPublish},s.prototype._setAudioMuteType=function(e){this._audioMuteType=e},s.prototype._getAudioMuteType=function(){return this._audioMuteType},s.prototype._setAudioProfile=function(e){this._audioProfile=e},s.prototype._getAudioProfile=function(){return this._audioProfile},s.prototype._getCaptureVolume=function(){return this._captureVolume},s.prototype._setCaptureVolume=function(e){this._captureVolume=e},s.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},s.prototype._getCurrentCameraId=function(){return this._currentCameraId},s.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},s.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},s.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},s.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},s.prototype._setRemoteStreamConfig=function(t,i,o){var r=this._remoteStreamConfig.get("".concat(t,"_").concat(this._getTRTCStreamType(i)));r||(r={userId:t,streamType:this._getTRTCStreamType(i),option:{mirror:this._getTRTCRemoteMirror(e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(e.TRTCVideoFillMode.TRTCVideoFillMode_Fit)}});var n=o.view,s=o.mirrorType,a=o.fillMode,c=o.small;ge(n)||(r.view=n),ge(s)||(r.option.mirror=this._getTRTCRemoteMirror(s)),ge(a)||(r.option.fillMode=this._getTRTCFillMode(a)),ge(c)||(r.option.small=c),this._remoteStreamConfig.set("".concat(t,"_").concat(this._getTRTCStreamType(i)),r)},s.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=d({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},s.prototype._inheritEventsToSubCloud=function(e){var t=this;e._trtc.on(c.default.EVENT.AUTOPLAY_FAILED,(function(e){t.emit("onAutoPlayFailed",e)})),e._trtc.on(c.default.EVENT.PICTURE_IN_PICTURE_STATE_CHANGED,(function(e){t.emit("onPictureInPictureStateChanged",e)}))},s.prototype.handleDeviceChange=function(){return p(this,void 0,void 0,(function(){var t=this;return T(this,(function(i){return c.default.getCameraList().then((function(i){return p(t,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this._cameraList.length===i.length?[2]:[4,this.deviceChangeManage(this._cameraList,i,e.TRTCDeviceType.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=i,[2]}}))}))})),c.default.getMicrophoneList().then((function(i){return p(t,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,i,e.TRTCDeviceType.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=i,[2]}}))}))})),c.default.getSpeakerList().then((function(i){return p(t,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,i,e.TRTCDeviceType.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=i,[2]}}))}))})),[2]}))}))},s.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)},s.prototype.deviceChangeManage=function(t,i,o){return p(this,void 0,void 0,(function(){var r,n,s,a,c;return T(this,(function(u){switch(u.label){case 0:return r=void 0,t.length!==i.length&&(n=(i||[]).map((function(e){return e.deviceId})),s=new L,t.length>i.length?(s=t.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateRemove):(n=(t||[]).map((function(e){return e.deviceId})),s=i.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateAdd),a=s.deviceId,this.emitOnDeviceChange(a,o,r)),c=this.getDefaultDeviceInfo(i),o!==e.TRTCDeviceType.TRTCDeviceTypeCamera||r!==e.TRTCDeviceState.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,2];case 1:u.sent(),u.label=2;case 2:u.label=3;case 3:return o!==e.TRTCDeviceType.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,5];case 4:u.sent(),u.label=5;case 5:u.label=6;case 6:return o!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,8];case 7:u.sent(),u.label=8;case 8:u.label=9;case 9:return[2]}}))}))},s.prototype.getDefaultDeviceInfo=function(e){var t=new L;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]},s.prototype.autoChangeDevice=function(t,i){return p(this,void 0,void 0,(function(){var o,r,n;return T(this,(function(s){switch(s.label){case 0:return o=i.deviceId,t!==e.TRTCDeviceType.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,c.default.ERROR_CODE.OPERATION_ABORT,[3,5];case 5:this._currentCameraId=o,this._currentCamera=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=6;case 6:return t!==e.TRTCDeviceType.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,c.default.ERROR_CODE.OPERATION_ABORT,[3,11];case 11:this._currentMicrophoneId=o,this._currentMicrophone=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=12;case 12:return t!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,14]:[4,c.default.setCurrentSpeaker(o)];case 13:s.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=14;case 14:return[2]}}))}))},s.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},s.prototype.getMediaMixingManager=function(){return new qn({logger:this.logger,trtc:this._trtc,trtcCloud:this})},s.prototype.getAITranscriberManager=function(){return new $n({logger:this.logger,trtc:this._trtc})},s.shareInstance=null,s.subCloudMap=new Map,s.enableSEI=!1,s.assetsPath="",h([(a="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 c=[];return null===(t=null===(e=Yn.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return c.push(e)})),null===(i=Kn.get(this))||void 0===i||i.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return c.push(e)}))})),null===(r=Jn.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return c.push(e)}))})),c.forEach((function(e){e.reject(new Error("aborted ".concat(a)))})),Yn.delete(this),Kn.delete(this),Jn.delete(this),o.apply(this,n)},i})],s.prototype,"exitRoom",null),h([Xn((function(e){return e}))],s.prototype,"muteRemoteAudio",null),h([Xn((function(e){return e}))],s.prototype,"muteRemoteVideoStream",null),h([Xn((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})],s.prototype,"_switchPlaybackQuality",null),s}(V);e.AITranscriberListener=undefined,e.AudioMuteType=undefined,e.IAITranscriberManager=undefined,e.ITRTCMediaMixingEvent=undefined,e.ITRTCMediaMixingManager=undefined,e.InteractionOption=undefined,e.Rect=$,e.TRTCCameraCaptureParams=undefined,e.TRTCDeviceInfo=L,e.TRTCImageBuffer=K,e.TRTCLocalStatistics=W,e.TRTCMediaMixingEncParam=undefined,e.TRTCMediaSource=undefined,e.TRTCMixUser=ie,e.TRTCNetworkQosParam=Y,e.TRTCParams=x,e.TRTCPublishCDNParam=H,e.TRTCQualityInfo=N,e.TRTCRemoteStatistics=j,e.TRTCRenderParams=D,e.TRTCScreenCaptureProperty=re,e.TRTCScreenCaptureSourceInfo=X,e.TRTCStatistics=U,e.TRTCTranscodingConfig=Z,e.TRTCVideoEncParam=O,e.TRTCVolumeInfo=Q,e.TranscriberMessage=undefined,e.TranscriberParams=undefined,e.default=ss,Object.defineProperty(e,"__esModule",{value:!0})}));