trtc-cloud-js-sdk 2.10.13 → 2.10.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-cloud-js-sdk",
3
- "version": "2.10.13",
3
+ "version": "2.10.14",
4
4
  "description": "Tencent Cloud RTC SDK for Web And Electron",
5
5
  "main": "trtc-cloud-js-sdk.js",
6
6
  "keywords": [
@@ -17,6 +17,6 @@
17
17
  "author": "Tencent Cloud Client R&D Center",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "trtc-sdk-v5": "5.15.2-beta.5"
20
+ "trtc-sdk-v5": "5.15.3-beta.9"
21
21
  }
22
22
  }
@@ -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=function(e,t){return u=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])},u(e,t)};var l=function(){return l=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},l.apply(this,arguments)};function d(e,t,i,o){var r,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s}function h(e,t,i,o){return new(i||(i=Promise))((function(r,n){function s(e){try{c(o.next(e))}catch(t){n(t)}}function a(e){try{c(o.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function p(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 T(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],o=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(e,t,i){if(i||2===arguments.length)for(var o,r=0,n=t.length;r<n;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function v(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=T(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=e[i]&&function(t){return new Promise((function(o,r){(function(e,t,i,o){Promise.resolve(o).then((function(t){e({value:t,done:i})}),t)})(o,r,(t=e[i](t)).done,t.value)}))}}}var g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function m(e,t){return e(t={exports:{}},t.exports),t.exports}var R,y,C,_,b,S,M,w,E=m((function(e){var t=Object.prototype.hasOwnProperty,i="~";function o(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function n(e,t,o,n,s){if("function"!=typeof o)throw new TypeError("The listener must be a function");var a=new r(o,n||e,s),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function a(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,o,r=[];if(0===this._eventsCount)return r;for(o in e=this._events)t.call(e,o)&&r.push(i?o.slice(1):o);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var r=0,n=o.length,s=new Array(n);r<n;r++)s[r]=o[r].fn;return s},a.prototype.listenerCount=function(e){var t=i?i+e:e,o=this._events[t];return o?o.fn?1:o.length:0},a.prototype.emit=function(e,t,o,r,n,s){var a=i?i+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],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,(R=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[R.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",R[R.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",R[R.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",R[R.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",R[R.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",R[R.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",R[R.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",R[R.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",R[R.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",R[R.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",R[R.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",R[R.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",R[R.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",R[R.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",R[R.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",R[R.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",R[R.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",R[R.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",R[R.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",R[R.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(y=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[y.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",y[y.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",y[y.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(C=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[C.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",C[C.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(_=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[_.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",_[_.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",_[_.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(b=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[b.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",b[b.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(S=e.TRTCAppScene||(e.TRTCAppScene={}))[S.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",S[S.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",S[S.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",S[S.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(M=e.TRTCRoleType||(e.TRTCRoleType={}))[M.TRTCRoleAnchor=20]="TRTCRoleAnchor",M[M.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(w=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[w.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",w[w.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",w[w.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic";var V,A,P=function(e,t,i,o,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=""),this.deviceId=e,this.deviceName=t,this.kind=i,this.label=o,this.groupId=r};e.TRTCDeviceState=void 0,(V=e.TRTCDeviceState||(e.TRTCDeviceState={}))[V.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",V[V.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",V[V.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(A=e.TRTCDeviceType||(e.TRTCDeviceType={}))[A.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",A[A.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",A[A.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",A[A.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var L,I=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},x=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,(L=e.TRTCVideoRotation||(e.TRTCVideoRotation={}))[L.TRTCVideoRotation0=0]="TRTCVideoRotation0",L[L.TRTCVideoRotation90=1]="TRTCVideoRotation90",L[L.TRTCVideoRotation180=2]="TRTCVideoRotation180",L[L.TRTCVideoRotation270=3]="TRTCVideoRotation270";var O,k=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,(O=e.TRTCQuality||(e.TRTCQuality={}))[O.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",O[O.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",O[O.TRTCQuality_Good=2]="TRTCQuality_Good",O[O.TRTCQuality_Poor=3]="TRTCQuality_Poor",O[O.TRTCQuality_Bad=4]="TRTCQuality_Bad",O[O.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",O[O.TRTCQuality_Down=6]="TRTCQuality_Down";var D,B,z,F=function(t,i){void 0===t&&(t=""),void 0===i&&(i=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=i},N=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},Q=function(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),this.appId=e,this.bizId=t,this.url=i},H=function(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},W=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},j=function(e,t,i,o,r,n,s,a,c,u,l){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=[]),void 0===c&&(c=0),void 0===u&&(u=[]),void 0===l&&(l=0),this.upLoss=e,this.downLoss=t,this.rtt=r,this.receivedBytes=n,this.sentBytes=s,this.localStatisticsArray=a,this.localStatisticsArraySize=c,this.remoteStatisticsArray=u,this.remoteStatisticsArraySize=l};e.TRTCVideoResolutionMode=void 0,(D=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[D.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",D[D.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(B=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[B.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",B[B.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(z=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[z.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",z[z.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var U,q,G=function(t,i){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===i&&(i=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=i},Y=function(e,t,i,o){void 0===e&&(e=new ArrayBuffer(0)),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.buffer=e,this.length=t,this.width=i,this.height=o};e.TRTCLogLevel=void 0,(U=e.TRTCLogLevel||(e.TRTCLogLevel={}))[U.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",U[U.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",U[U.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",U[U.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",U[U.TRTCLogLevelError=4]="TRTCLogLevelError",U[U.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",U[U.TRTCLogLevelNone=6]="TRTCLogLevelNone",e.TRTCScreenCaptureSourceType=void 0,(q=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[q.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",q[q.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",q[q.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",q[q.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var K,J=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 Y),void 0===n&&(n=new Y),void 0===s&&(s=!1),this.type=t,this.sourceId=i,this.sourceName=o,this.thumbBGRA=r,this.iconBGRA=n,this.isMinimizeWindow=s},X=function(e,t,i,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.left=e,this.top=t,this.right=i,this.bottom=o},$=function(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,(K=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[K.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",K[K.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",K[K.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",K[K.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",K[K.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",K[K.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",K[K.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",K[K.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",K[K.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",K[K.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var Z,ee,te=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,(Z=e.TRTCMixInputType||(e.TRTCMixInputType={}))[Z.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",Z[Z.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",Z[Z.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",Z[Z.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio",e.TRTCCameraCaptureMode=void 0,(ee=e.TRTCCameraCaptureMode||(e.TRTCCameraCaptureMode={}))[ee.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",ee[ee.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",ee[ee.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",ee[ee.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual";var ie,oe=function(e,t,i,o,r,n){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.enableCaptureMouse=e,this.enableHighLight=t,this.enableHighPerformance=i,this.highLightColor=o,this.highLightWidth=r,this.enableCaptureChildWindow=n},re="onError",ne="onWarning",se="rtc",ae="live",ce="VirtualBackground",ue="BasicBeauty",le="blur",de="image",he={20:"anchor",21:"audience"},pe={0:se,1:ae,2:se,3:ae};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(ie||(ie={}));var Te="enum";function fe(){return Math.floor(performance.now())}var ve=function(e){return void 0===e},ge=function(e){return"number"==typeof e},me=function(e){return"boolean"==typeof e};function Re(e){if("string"!=typeof e)return e;var t;try{var i=JSON.parse(e);t="object"==typeof i&&i?i:e}catch(o){t=e}return t}function ye(e){return null==e}function Ce(){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]=Ce(e[i],t[i]):e[i]=t[i]})),e}),{})}function _e(e){var t=null;return e instanceof MediaStream||e instanceof MediaStreamTrack||e instanceof HTMLElement?e:([Date,RegExp,Set,WeakSet,Map,WeakMap,Error].includes(null==e?void 0:e.constructor)?t=new e.constructor(e):Array.isArray(e)?(t=[],e.forEach((function(e,i){t[i]=_e(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=_e(e[i]))}))):t=e,t)}var be,Se,Me=function(e){return e&&e.Math===Math&&e},we=Me("object"==typeof globalThis&&globalThis)||Me("object"==typeof window&&window)||Me("object"==typeof self&&self)||Me("object"==typeof g&&g)||function(){return this}()||g||Function("return this")(),Ee=function(e){try{return!!e()}catch(t){return!0}},Ve=!Ee((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Ae=!Ee((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Pe=Function.prototype.call,Le=Ae?Pe.bind(Pe):function(){return Pe.apply(Pe,arguments)},Ie={}.propertyIsEnumerable,xe=Object.getOwnPropertyDescriptor,Oe={f:xe&&!Ie.call({1:2},1)?function(e){var t=xe(this,e);return!!t&&t.enumerable}:Ie},ke=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},De=Function.prototype,Be=De.call,ze=Ae&&De.bind.bind(Be,Be),Fe=Ae?ze:function(e){return function(){return Be.apply(e,arguments)}},Ne=Fe({}.toString),Qe=Fe("".slice),He=function(e){return Qe(Ne(e),8,-1)},We=Object,je=Fe("".split),Ue=Ee((function(){return!We("z").propertyIsEnumerable(0)}))?function(e){return"String"===He(e)?je(e,""):We(e)}:We,qe=function(e){return null==e},Ge=TypeError,Ye=function(e){if(qe(e))throw Ge("Can't call method on "+e);return e},Ke=function(e){return Ue(Ye(e))},Je="object"==typeof document&&document.all,Xe={all:Je,IS_HTMLDDA:void 0===Je&&void 0!==Je},$e=Xe.all,Ze=Xe.IS_HTMLDDA?function(e){return"function"==typeof e||e===$e}:function(e){return"function"==typeof e},et=Xe.all,tt=Xe.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:Ze(e)||e===et}:function(e){return"object"==typeof e?null!==e:Ze(e)},it=function(e,t){return arguments.length<2?(i=we[e],Ze(i)?i:void 0):we[e]&&we[e][t];var i},ot=Fe({}.isPrototypeOf),rt="undefined"!=typeof navigator&&String(navigator.userAgent)||"",nt=we.process,st=we.Deno,at=nt&&nt.versions||st&&st.version,ct=at&&at.v8;ct&&(Se=(be=ct.split("."))[0]>0&&be[0]<4?1:+(be[0]+be[1])),!Se&&rt&&(!(be=rt.match(/Edge\/(\d+)/))||be[1]>=74)&&(be=rt.match(/Chrome\/(\d+)/))&&(Se=+be[1]);var ut=Se,lt=we.String,dt=!!Object.getOwnPropertySymbols&&!Ee((function(){var e=Symbol("symbol detection");return!lt(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ut&&ut<41})),ht=dt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,pt=Object,Tt=ht?function(e){return"symbol"==typeof e}:function(e){var t=it("Symbol");return Ze(t)&&ot(t.prototype,pt(e))},ft=String,vt=TypeError,gt=function(e){if(Ze(e))return e;throw vt(function(e){try{return ft(e)}catch(t){return"Object"}}(e)+" is not a function")},mt=function(e,t){var i=e[t];return qe(i)?void 0:gt(i)},Rt=TypeError,yt=Object.defineProperty,Ct=function(e,t){try{yt(we,e,{value:t,configurable:!0,writable:!0})}catch(i){we[e]=t}return t},_t="__core-js_shared__",bt=we[_t]||Ct(_t,{}),St=m((function(e){(e.exports=function(e,t){return bt[e]||(bt[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.32.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"})})),Mt=Object,wt=function(e){return Mt(Ye(e))},Et=Fe({}.hasOwnProperty),Vt=Object.hasOwn||function(e,t){return Et(wt(e),t)},At=0,Pt=Math.random(),Lt=Fe(1..toString),It=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Lt(++At+Pt,36)},xt=we.Symbol,Ot=St("wks"),kt=ht?xt.for||xt:xt&&xt.withoutSetter||It,Dt=function(e){return Vt(Ot,e)||(Ot[e]=dt&&Vt(xt,e)?xt[e]:kt("Symbol."+e)),Ot[e]},Bt=TypeError,zt=Dt("toPrimitive"),Ft=function(e,t){if(!tt(e)||Tt(e))return e;var i,o=mt(e,zt);if(o){if(void 0===t&&(t="default"),i=Le(o,e,t),!tt(i)||Tt(i))return i;throw Bt("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&Ze(i=e.toString)&&!tt(o=Le(i,e)))return o;if(Ze(i=e.valueOf)&&!tt(o=Le(i,e)))return o;if("string"!==t&&Ze(i=e.toString)&&!tt(o=Le(i,e)))return o;throw Rt("Can't convert object to primitive value")}(e,t)},Nt=function(e){var t=Ft(e,"string");return Tt(t)?t:t+""},Qt=we.document,Ht=tt(Qt)&&tt(Qt.createElement),Wt=function(e){return Ht?Qt.createElement(e):{}},jt=!Ve&&!Ee((function(){return 7!==Object.defineProperty(Wt("div"),"a",{get:function(){return 7}}).a})),Ut=Object.getOwnPropertyDescriptor,qt={f:Ve?Ut:function(e,t){if(e=Ke(e),t=Nt(t),jt)try{return Ut(e,t)}catch(i){}if(Vt(e,t))return ke(!Le(Oe.f,e,t),e[t])}},Gt=Ve&&Ee((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Yt=String,Kt=TypeError,Jt=function(e){if(tt(e))return e;throw Kt(Yt(e)+" is not an object")},Xt=TypeError,$t=Object.defineProperty,Zt=Object.getOwnPropertyDescriptor,ei="enumerable",ti="configurable",ii="writable",oi={f:Ve?Gt?function(e,t,i){if(Jt(e),t=Nt(t),Jt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&ii in i&&!i[ii]){var o=Zt(e,t);o&&o[ii]&&(e[t]=i.value,i={configurable:ti in i?i[ti]:o[ti],enumerable:ei in i?i[ei]:o[ei],writable:!1})}return $t(e,t,i)}:$t:function(e,t,i){if(Jt(e),t=Nt(t),Jt(i),jt)try{return $t(e,t,i)}catch(o){}if("get"in i||"set"in i)throw Xt("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},ri=Ve?function(e,t,i){return oi.f(e,t,ke(1,i))}:function(e,t,i){return e[t]=i,e},ni=Function.prototype,si=Ve&&Object.getOwnPropertyDescriptor,ai=Vt(ni,"name"),ci={EXISTS:ai,PROPER:ai&&"something"===function(){}.name,CONFIGURABLE:ai&&(!Ve||Ve&&si(ni,"name").configurable)},ui=Fe(Function.toString);Ze(bt.inspectSource)||(bt.inspectSource=function(e){return ui(e)});var li,di,hi,pi=bt.inspectSource,Ti=we.WeakMap,fi=Ze(Ti)&&/native code/.test(String(Ti)),vi=St("keys"),gi=function(e){return vi[e]||(vi[e]=It(e))},mi={},Ri="Object already initialized",yi=we.TypeError,Ci=we.WeakMap;if(fi||bt.state){var _i=bt.state||(bt.state=new Ci);_i.get=_i.get,_i.has=_i.has,_i.set=_i.set,li=function(e,t){if(_i.has(e))throw yi(Ri);return t.facade=e,_i.set(e,t),t},di=function(e){return _i.get(e)||{}},hi=function(e){return _i.has(e)}}else{var bi=gi("state");mi[bi]=!0,li=function(e,t){if(Vt(e,bi))throw yi(Ri);return t.facade=e,ri(e,bi,t),t},di=function(e){return Vt(e,bi)?e[bi]:{}},hi=function(e){return Vt(e,bi)}}var Si={set:li,get:di,has:hi,enforce:function(e){return hi(e)?di(e):li(e,{})},getterFor:function(e){return function(t){var i;if(!tt(t)||(i=di(t)).type!==e)throw yi("Incompatible receiver, "+e+" required");return i}}},Mi=m((function(e){var t=ci.CONFIGURABLE,i=Si.enforce,o=Si.get,r=String,n=Object.defineProperty,s=Fe("".slice),a=Fe("".replace),c=Fe([].join),u=Ve&&!Ee((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),(!Vt(e,"name")||t&&e.name!==o)&&(Ve?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&d&&Vt(d,"arity")&&e.length!==d.arity&&n(e,"length",{value:d.arity});try{d&&Vt(d,"constructor")&&d.constructor?Ve&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var h=i(e);return Vt(h,"source")||(h.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=d((function(){return Ze(this)&&o(this).source||pi(this)}),"toString")})),wi=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(Ze(i)&&Mi(i,n,o),o.global)r?e[t]=i:Ct(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:oi.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Ei=Math.ceil,Vi=Math.floor,Ai=Math.trunc||function(e){var t=+e;return(t>0?Vi:Ei)(t)},Pi=function(e){var t=+e;return t!=t||0===t?0:Ai(t)},Li=Math.max,Ii=Math.min,xi=Math.min,Oi=function(e){return e>0?xi(Pi(e),9007199254740991):0},ki=function(e){return Oi(e.length)},Di=function(e){return function(t,i,o){var r,n=Ke(t),s=ki(n),a=function(e,t){var i=Pi(e);return i<0?Li(i+t,0):Ii(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}},Bi={includes:Di(!0),indexOf:Di(!1)}.indexOf,zi=Fe([].push),Fi=function(e,t){var i,o=Ke(e),r=0,n=[];for(i in o)!Vt(mi,i)&&Vt(o,i)&&zi(n,i);for(;t.length>r;)Vt(o,i=t[r++])&&(~Bi(n,i)||zi(n,i));return n},Ni=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Qi=Ni.concat("length","prototype"),Hi={f:Object.getOwnPropertyNames||function(e){return Fi(e,Qi)}},Wi={f:Object.getOwnPropertySymbols},ji=Fe([].concat),Ui=it("Reflect","ownKeys")||function(e){var t=Hi.f(Jt(e)),i=Wi.f;return i?ji(t,i(e)):t},qi=function(e,t,i){for(var o=Ui(t),r=oi.f,n=qt.f,s=0;s<o.length;s++){var a=o[s];Vt(e,a)||i&&Vt(i,a)||r(e,a,n(t,a))}},Gi=/#|\.prototype\./,Yi=function(e,t){var i=Ji[Ki(e)];return i===$i||i!==Xi&&(Ze(t)?Ee(t):!!t)},Ki=Yi.normalize=function(e){return String(e).replace(Gi,".").toLowerCase()},Ji=Yi.data={},Xi=Yi.NATIVE="N",$i=Yi.POLYFILL="P",Zi=Yi,eo=qt.f,to=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?we:u?we[a]||Ct(a,{}):(we[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=eo(i,o))&&s.value:i[o],!Zi(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;qi(n,r)}(e.sham||r&&r.sham)&&ri(n,"sham",!0),wi(i,o,n,e)}},io={};io[Dt("toStringTag")]="z";var oo,ro="[object z]"===String(io),no=Dt("toStringTag"),so=Object,ao="Arguments"===He(function(){return arguments}()),co=ro?He:function(e){var t,i,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=so(e),no))?i:ao?He(t):"Object"===(o=He(t))&&Ze(t.callee)?"Arguments":o},uo=String,lo=function(e){if("Symbol"===co(e))throw TypeError("Cannot convert a Symbol value to a string");return uo(e)},ho=function(){var e=Jt(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},po=we.RegExp,To=Ee((function(){var e=po("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),fo=To||Ee((function(){return!po("a","y").sticky})),vo={BROKEN_CARET:To||Ee((function(){var e=po("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:fo,UNSUPPORTED_Y:To},go=Object.keys||function(e){return Fi(e,Ni)},mo=Ve&&!Gt?Object.defineProperties:function(e,t){Jt(e);for(var i,o=Ke(t),r=go(t),n=r.length,s=0;n>s;)oi.f(e,i=r[s++],o[i]);return e},Ro={f:mo},yo=it("document","documentElement"),Co="prototype",_o="script",bo=gi("IE_PROTO"),So=function(){},Mo=function(e){return"<"+_o+">"+e+"</"+_o+">"},wo=function(e){e.write(Mo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Eo=function(){try{oo=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Eo="undefined"!=typeof document?document.domain&&oo?wo(oo):(t=Wt("iframe"),i="java"+_o+":",t.style.display="none",yo.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(Mo("document.F=Object")),e.close(),e.F):wo(oo);for(var o=Ni.length;o--;)delete Eo[Co][Ni[o]];return Eo()};mi[bo]=!0;var Vo,Ao,Po=Object.create||function(e,t){var i;return null!==e?(So[Co]=Jt(e),i=new So,So[Co]=null,i[bo]=e):i=Eo(),void 0===t?i:Ro.f(i,t)},Lo=we.RegExp,Io=Ee((function(){var e=Lo(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),xo=we.RegExp,Oo=Ee((function(){var e=xo("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),ko=Si.get,Do=St("native-string-replace",String.prototype.replace),Bo=RegExp.prototype.exec,zo=Bo,Fo=Fe("".charAt),No=Fe("".indexOf),Qo=Fe("".replace),Ho=Fe("".slice),Wo=(Ao=/b*/g,Le(Bo,Vo=/a/,"a"),Le(Bo,Ao,"a"),0!==Vo.lastIndex||0!==Ao.lastIndex),jo=vo.BROKEN_CARET,Uo=void 0!==/()??/.exec("")[1];(Wo||Uo||jo||Io||Oo)&&(zo=function(e){var t,i,o,r,n,s,a,c=this,u=ko(c),l=lo(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=Le(zo,d,l),c.lastIndex=d.lastIndex,t;var h=u.groups,p=jo&&c.sticky,T=Le(ho,c),f=c.source,v=0,g=l;if(p&&(T=Qo(T,"y",""),-1===No(T,"g")&&(T+="g"),g=Ho(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Fo(l,c.lastIndex-1))&&(f="(?: "+f+")",g=" "+g,v++),i=new RegExp("^(?:"+f+")",T)),Uo&&(i=new RegExp("^"+f+"$(?!\\s)",T)),Wo&&(o=c.lastIndex),r=Le(Bo,p?i:c,g),p?r?(r.input=Ho(r.input,v),r[0]=Ho(r[0],v),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Wo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),Uo&&r&&r.length>1&&Le(Do,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=Po(null),n=0;n<h.length;n++)s[(a=h[n])[0]]=r[a[1]];return r});var qo=zo;to({target:"RegExp",proto:!0,forced:/./.exec!==qo},{exec:qo});var Go="\t\n\v\f\r                 \u2028\u2029\ufeff",Yo=Fe("".replace),Ko=RegExp("^["+Go+"]+"),Jo=RegExp("(^|[^"+Go+"])["+Go+"]+$"),Xo=function(e){return function(t){var i=lo(Ye(t));return 1&e&&(i=Yo(i,Ko,"")),2&e&&(i=Yo(i,Jo,"$1")),i}},$o={start:Xo(1),end:Xo(2),trim:Xo(3)}.trim,Zo=Fe("".charAt),er=we.parseFloat,tr=we.Symbol,ir=tr&&tr.iterator,or=1/er(Go+"-0")!=-Infinity||ir&&!Ee((function(){er(Object(ir))}))?function(e){var t=$o(lo(e)),i=er(t);return 0===i&&"-"===Zo(t,0)?-0:i}:er;to({global:!0,forced:parseFloat!==or},{parseFloat:or});var rr=function(e){if("Function"===He(e))return Fe(e)},nr=Dt("species"),sr=RegExp.prototype,ar=Fe("".charAt),cr=Fe("".charCodeAt),ur=Fe("".slice),lr=function(e){return function(t,i){var o,r,n=lo(Ye(t)),s=Pi(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=cr(n,s))<55296||o>56319||s+1===a||(r=cr(n,s+1))<56320||r>57343?e?ar(n,s):o:e?ur(n,s,s+2):r-56320+(o-55296<<10)+65536}},dr={codeAt:lr(!1),charAt:lr(!0)}.charAt,hr=function(e,t,i){return t+(i?dr(e,t).length:1)},pr=TypeError,Tr=function(e,t){var i=e.exec;if(Ze(i)){var o=Le(i,e,t);return null!==o&&Jt(o),o}if("RegExp"===He(e))return Le(qo,e,t);throw pr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=Dt(e),n=!Ee((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Ee((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[nr]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=rr(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=rr(e),c=t.exec;return c===qo||c===sr.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));wi(String.prototype,e,c[0]),wi(sr,r,c[1])}o&&ri(sr[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Ye(this),o=qe(t)?void 0:mt(t,e);return o?Le(o,t,i):new RegExp(t)[e](lo(i))},function(e){var o=Jt(this),r=lo(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return Tr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=Tr(o,r));){var l=lo(a[0]);c[u]=l,""===l&&(o.lastIndex=hr(r,Oi(o.lastIndex),s)),u++}return 0===u?null:c}]}));var fr=Array.isArray||function(e){return"Array"===He(e)},vr=TypeError,gr=function(e){if(e>9007199254740991)throw vr("Maximum allowed index exceeded");return e},mr=function(e,t,i){var o=Nt(t);o in e?oi.f(e,o,ke(0,i)):e[o]=i},Rr=function(){},yr=[],Cr=it("Reflect","construct"),_r=/^\s*(?:class|function)\b/,br=Fe(_r.exec),Sr=!_r.exec(Rr),Mr=function(e){if(!Ze(e))return!1;try{return Cr(Rr,yr,e),!0}catch(t){return!1}},wr=function(e){if(!Ze(e))return!1;switch(co(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Sr||!!br(_r,pi(e))}catch(t){return!0}};wr.sham=!0;var Er,Vr=!Cr||Ee((function(){var e;return Mr(Mr.call)||!Mr(Object)||!Mr((function(){e=!0}))||e}))?wr:Mr,Ar=Dt("species"),Pr=Array,Lr=function(e,t){return new(function(e){var t;return fr(e)&&(t=e.constructor,(Vr(t)&&(t===Pr||fr(t.prototype))||tt(t)&&null===(t=t[Ar]))&&(t=void 0)),void 0===t?Pr:t}(e))(0===t?0:t)},Ir=Dt("species"),xr=Dt("isConcatSpreadable"),Or=ut>=51||!Ee((function(){var e=[];return e[xr]=!1,e.concat()[0]!==e})),kr=function(e){if(!tt(e))return!1;var t=e[xr];return void 0!==t?!!t:fr(e)};to({target:"Array",proto:!0,arity:1,forced:!(Or&&(Er="concat",ut>=51||!Ee((function(){var e=[];return(e.constructor={})[Ir]=function(){return{foo:1}},1!==e[Er](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=wt(this),a=Lr(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(kr(n=-1===t?s:arguments[t]))for(r=ki(n),gr(c+r),i=0;i<r;i++,c++)i in n&&mr(a,c,n[i]);else gr(c+1),mr(a,c++,n);return a.length=c,a}});var Dr=window.navigator&&window.navigator.userAgent||"",Br=/AppleWebKit\/([\d.]+)/i.exec(Dr);Br&&parseFloat(Br.pop());var zr=/iPad/i.test(Dr),Fr=/iPhone/i.test(Dr)&&!zr,Nr=/iPod/i.test(Dr),Qr=Fr||zr||Nr,Hr=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(Dr);Qr&&function(){var e=Dr.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var Wr=/Android/i.test(Dr);Wr&&function(){var e=Dr.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);t&&i&&parseFloat("".concat(e[1],".").concat(e[2]))}();Wr&&/webkit/i.test(Dr),/Firefox/i.test(Dr)&&function(){var e=Dr.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var jr=/Edge\//i.test(Dr);jr&&function(){var e=Dr.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var Ur=/Edg\//i.test(Dr);Ur&&function(){var e=Dr.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var qr=/SogouMobileBrowser\//i.test(Dr);qr&&function(){var e=Dr.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Gr=/MetaSr\s/i.test(Dr);Gr&&function(){var e=Dr.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Yr=/TBS\/\d+/i.test(Dr);Yr&&function(){var e=Dr.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Kr=/XWEB\/\d+/i.test(Dr);Kr&&function(){var e=Dr.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(Dr),/MSIE\/\d+/i.test(Dr)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(Dr),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(Dr)&&/rv:11.0/.test(Dr)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(Dr)&&function(){var e=Dr.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var Jr=!Yr&&/MQQBrowser\/\d+/i.test(Dr)&&/COVC\/\d+/i.test(Dr),Xr=!Yr&&/MQQBrowser\/\d+/i.test(Dr)&&!/COVC\/\d+/i.test(Dr);(Xr||Jr)&&function(){var e=Dr.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var $r=!Yr&&/ QQBrowser\/\d+/i.test(Dr);$r&&function(){var e=Dr.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Zr=!Yr&&/QQBrowserLite\/\d+/i.test(Dr);Zr&&function(){var e=Dr.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var en=!Yr&&/MQBHD\/\d+/i.test(Dr);en&&function(){var e=Dr.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(Dr),!Qr&&/MAC OS X/i.test(Dr),!Wr&&/Linux/i.test(Dr),/MicroMessenger/i.test(Dr),/UCBrowser/i.test(Dr),/Electron/i.test(Dr);var tn=/MiuiBrowser/i.test(Dr);tn&&function(){var e=Dr.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var on=/HuaweiBrowser/i.test(Dr);/Huawei/i.test(Dr),on&&function(){var e=Dr.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var rn=/SamsungBrowser/i.test(Dr);rn&&function(){var e=Dr.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var nn=/HeyTapBrowser/i.test(Dr);nn&&function(){var e=Dr.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var sn=/VivoBrowser/i.test(Dr);sn&&function(){var e=Dr.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var an,cn,un,ln=/Chrome/i.test(Dr),dn=!jr&&!Gr&&!qr&&!Yr&&!Kr&&!Ur&&!$r&&!tn&&!on&&!rn&&!nn&&!sn&&/Chrome/i.test(Dr);dn&&function(){var e=Dr.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),dn&&function(){var e=Dr.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!ln&&!Xr&&!Jr&&!Zr&&!en&&/Safari/i.test(Dr)&&function(){var e=Dr.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"}(an||(an={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(cn||(cn={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(un||(un={}));var hn,pn,Tn,fn=-3340,vn=-1301,gn=-1314,mn=-1315,Rn=-1316,yn=-1302,Cn=-1317,_n=-1318,bn=-1319,Sn=-70252,Mn={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},wn={code:-1005,message:"not supported"},En="2.10.13";e.TRTCMediaMixingErrorCode=void 0,(hn=e.TRTCMediaMixingErrorCode||(e.TRTCMediaMixingErrorCode={}))[hn.Success=0]="Success",hn[hn.Error=-1]="Error",hn[hn.InvalidParams=-2]="InvalidParams",hn[hn.NotFoundSource=-3]="NotFoundSource",hn[hn.ImageSourceLoadFailed=-4]="ImageSourceLoadFailed",hn[hn.CameraNotAuthorized=-5]="CameraNotAuthorized",hn[hn.CameraIsOccupied=-6]="CameraIsOccupied",hn[hn.CameraDisconnected=-7]="CameraDisconnected",e.TRTCMediaSourceType=void 0,(pn=e.TRTCMediaSourceType||(e.TRTCMediaSourceType={}))[pn.kCamera=0]="kCamera",pn[pn.kScreen=1]="kScreen",pn[pn.kImage=2]="kImage",pn[pn.kPhoneMirror=4]="kPhoneMirror",pn[pn.kText=5]="kText",pn[pn.kVideo=6]="kVideo",e.TRTCMediaMixingEvent=void 0,(Tn=e.TRTCMediaMixingEvent||(e.TRTCMediaMixingEvent={})).onSourceSelected="onSourceSelected",Tn.onSourceMoved="onSourceMoved",Tn.onSourceResized="onSourceResized",Tn.onRightButtonClicked="onRightButtonClicked",Tn.onError="onError",Tn.onSourcePlugged="onSourcePlugged",Tn.onSourceConnected="onSourceConnected",Tn.onSourceDisconnected="onSourceDisconnected",Tn.onSourceUnplugged="onSourceUnplugged",Tn.onMediaSourceSizeChanged="onMediaSourceSizeChanged";var Vn,An=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}(),Pn=new An(null),Ln=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"):Pn.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 Pn.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)):Pn.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 Pn.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){Pn.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",Pn.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"}(Vn||(Vn={}));var In="trtc-resizable-top-left-anchor",xn="trtc-resizable-top-anchor",On="trtc-resizable-top-right-anchor",kn="trtc-resizable-left-anchor",Dn="trtc-resizable-right-anchor",Bn="trtc-resizable-bottom-left-anchor",zn="trtc-resizable-bottom-anchor",Fn="trtc-resizable-bottom-right-anchor",Nn={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 Qn(e,t){for(var i in t)e.style[i]=t[i]}var Hn=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:Vn.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:Vn.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||Vn.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(In),Qn(c,Object.assign({},Nn.resizeAnchor,Nn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(xn),Qn(u,Object.assign({},Nn.resizeAnchor,Nn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(On),Qn(l,Object.assign({},Nn.resizeAnchor,Nn.topRightAnchor)),this.topRightAnchor=l;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(kn),Qn(d,Object.assign({},Nn.resizeAnchor,Nn.leftAnchor)),this.leftAnchor=d;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(Dn),Qn(h,Object.assign({},Nn.resizeAnchor,Nn.rightAnchor)),this.rightAnchor=h;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(Bn),Qn(p,Object.assign({},Nn.resizeAnchor,Nn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var T=document.createElement("div");T.className="trtc-resizable-resize-anchor ".concat(zn),Qn(T,Object.assign({},Nn.resizeAnchor,Nn.bottomAnchor)),this.bottomAnchor=T;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(Fn),Qn(f,Object.assign({},Nn.resizeAnchor,Nn.bottomRightAnchor)),this.bottomRightAnchor=f,this.options.anchorMode!==Vn.Both&&this.options.anchorMode!==Vn.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!==Vn.Both&&this.options.anchorMode!==Vn.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,Pn.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else Pn.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 In: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 xn: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 On: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 kn: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 Dn: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 Bn: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 zn: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 Fn: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 Pn.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 Pn.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 Pn.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!==Vn.Both&&this.options.anchorMode!==Vn.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!==Vn.Both&&this.options.anchorMode!==Vn.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}(),Wn=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}(),jn=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,Wn.has(t.videoResolution)){var i=Wn.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 E,this.mediaList=[],this.selectedMediaIndex=-1,this.moveAndResizeOverlay=document.createElement("div"),this.moveAndResizeOverlay.style.position="relative",this.container.appendChild(this.moveAndResizeOverlay),this.initMediaMovable(),this.initMediaResizable(),this.initContainerMouseEventHander(),this.initContainerResizeObserver()}return t.prototype.updateOptions=function(t){if(!ye(t.videoResolution)||!ye(t.resMode)){if(this.resMode=ye(t.resMode)?this.resMode:t.resMode,t.videoResolution&&Wn.has(t.videoResolution)){var i=Wn.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 Ln(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 Hn(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",l({},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(!ve(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",l({},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?l({},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",l({},this.mediaList[this.selectedMediaIndex]))},t}(),Un=function(){function t(i){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new E,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 h(this,void 0,Promise,(function(){var e,i,o,r,n;return p(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 h(this,void 0,Promise,(function(){var t,i,o,r,n=this;return p(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=((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);return{width:r[t].width,height:r[t].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(ve(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)),ve(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)),!ve(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(!ve(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,d,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 l(l({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===(d=t.video)||void 0===d?void 0:d.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 h(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,l,d;return p(this,(function(h){switch(h.label){case 0:if(-1!==this.findMediaSourceIndex(t))throw new Error("Media source already existed");if(o=_e(t),r=this._getTRTCSourceKey(o),!(n=this._getTRTCSourceItem(o))||!r)throw new Error("Invalid media source");return(s=_e(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:!!ve(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 h(this,void 0,Promise,(function(){var n,s,a,c,u,l;return p(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=_e(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:_e(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 h(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,d;return p(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=l(l({},this.sourceList[o]),_e(e)),e.isSelected?(this.unselectMediaSource(this.selectedSource),this.selectedSource=e):(null===(t=this.selectedSource)||void 0===t?void 0:t.id)===e.id&&(this.selectedSource=null),n=this._getTRTCSourceKey(r),s=this._getTRTCSourceItem(r),a=_e(this.trtcSourceMap.get(n))||[],c=a.findIndex((function(t){return t.id===e.id})),a[c]=s,[4,this.trtc.updatePlugin("VideoMixer",(d={},d[n]=a,d))];case 1:if(h.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return u={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:_e(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(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 h(this,void 0,Promise,(function(){return p(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 h(this,void 0,Promise,(function(){return p(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 h(this,void 0,Promise,(function(){var s,a,u,l,d,h,T,f,g,m,R,y,C,_,b,S,M,w,E,V,A,P,L,I;return p(this,(function(p){switch(p.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,p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:u,height:l,canvasColor:String(e.canvasColor)}})];case 2:return p.sent(),[3,4];case 3:if((d=p.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}),p.label=5;case 5:p.trys.push([5,11,12,17]),h=v(this.sourceList),p.label=6;case 6:return[4,h.next()];case 7:return(T=p.sent()).done?[3,10]:(f=T.value).layout?(g=f.layout.rect||{left:0,top:0,right:0,bottom:0},m=g.left,R=g.top,y=g.right,C=g.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:p.sent(),null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",f,null===(n=f.layout)||void 0===n?void 0:n.rect),p.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return I=p.sent(),t={error:I},[3,17];case 12:return p.trys.push([12,,15,16]),T&&!T.done&&(i=h.return)?[4,i.call(h)]:[3,14];case 13:p.sent(),p.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 p.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 jn({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 h(this,void 0,void 0,(function(){return p(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(l(l({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(l(l({},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=l(l({},e.origin),{layout:l(l({},e.origin.layout),{rect:t})});this.updateMediaSource(Ce(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=l(l({},e.origin),{layout:l(l({},e.origin.layout),{rect:t})});this.updateMediaSource(Ce(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id})))}null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceResized",e.origin,t)},t.prototype.onRightButtonClicked=function(e){var t;this.logger.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",e.origin)},t.prototype.isSameMediaSource=function(e,t){return e.id===t.id},t.prototype.isMediaSourceExisted=function(e){var t=this;return this.sourceList.some((function(i){return t.isSameMediaSource(i,e)}))},t.prototype.findMediaSourceIndex=function(e){return this.sourceList.findIndex((function(t){return t.id===e.id}))},t.prototype.unselectMediaSource=function(e){var t,i;return h(this,void 0,Promise,(function(){var o;return p(this,(function(r){return e?(-1!==(o=this.findMediaSourceIndex(e))&&(this.sourceList[o].isSelected=!1),null===(t=this.mediaMixingDesigner)||void 0===t||t.updateMedia({id:e.id,rect:null===(i=e.layout)||void 0===i?void 0:i.rect,isSelected:!1,origin:_e(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}(),qn=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=l(l({},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}(),Gn=new WeakMap,Yn=new WeakMap,Kn=new WeakMap;function Jn(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=Kn.get(this)||new Map;Kn.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 qn,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 Xn=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,f([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,f([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 h(this,void 0,Promise,(function(){var t,i,o;return p(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 h(this,void 0,Promise,(function(){var t;return p(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}(),$n=c.default._loggerManager;$n.info("TRTCCloud Version: ".concat(En));var Zn,es,ts,is="trtcCloud",os=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(Zn=function(){0!==rs.size&&Array.from(rs.values()).forEach((function(e){e.fn()}))},es=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];ts>0&&clearTimeout(ts),ts=window.setTimeout((function(){Zn.apply(e,t),ts=-1}),es)}));var rs=new Map,ns=function(t){function a(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=Hr,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=En;var u=o.frameWorkType,l=void 0===u?30:u,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:a.enableSEI,assetsPath:a.assetsPath,enableVolumeControlInIOS:!0,plugins:[s.VideoMixer,i.LEBPlayer,n.RealtimeTranscriber]}),r._testTrtc=c.default.create(),r._log=c.default._loggerManager,r.logger=new An($n,{seq:os++}),r._echoCancellation=void 0,r._noiseSuppression=void 0,r._autoGainControl=void 0,r._addTRTCEvents(),r.handleDeviceChange=r.handleDeviceChange.bind(r),rs.set(r,{fn:r.handleDeviceChange,self:r}),r}var T;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}u(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(a,t),a.getPlugin=function(e){return"VirtualBackground"===e?o.VirtualBackground:"BasicBeauty"===e?r.BasicBeauty:"VideoMixer"===e?s.VideoMixer:null},a.getTRTCShareInstance=function(e){return a.shareInstance||(a.shareInstance=new a(e)),a.shareInstance},a.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];ve(n)&&(n=r[e.TRTCLogLevel.TRTCLogLevelInfo]);var s=!me(i)||i;c.default.setLogLevel(n,s)},a.destroyTRTCShareInstance=function(){a.shareInstance&&(a.shareInstance._destroy(),a.shareInstance=null),Array.from(a.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},a.callExperimentalAPI=function(e){console.log("static ".concat(is,".callExperimentalAPI"),e);var t=Re(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":a.enableSEI=o.enable;break;case"setAssetsPath":a.assetsPath=o.assetsPath}}catch(r){throw r}}},a.prototype.createSubCloud=function(){if(this!==a.shareInstance)return null;var e=new a;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),a.subCloudMap.set(e,e),e},a.prototype.destroy=function(){this!==a.shareInstance?(a.subCloudMap.get(this)&&a.subCloudMap.delete(this),this._destroy()):a.destroyTRTCShareInstance()},a.prototype._destroy=function(){rs.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},a.prototype.getSDKVersion=function(){return this._version||""},a.prototype.enterRoom=function(e,t){return h(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,d,h,T,f,v,g,m,R,y,C;return p(this,(function(p){switch(p.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,d=e.enableAutoPlayDialog,h=e.proxy,T=e.streamId,f=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(is,".enterRoom with params: "),e,t),h&&(this._networkProxy=h),!(i&&o&&r))return[3,5];p.label=1;case 1:return p.trys.push([1,3,,4]),v={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:he[a],scene:pe[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},v=c?l(l({},v),{privateMapKey:c}):v,v=u?l(l({},v),{businessInfo:u}):v,g=d||this._enableAutoPlayDialog,v=me(g)?l(l({},v),{enableAutoPlayDialog:g}):v,v=this._networkProxy?l(l({},v),{proxy:this._networkProxy}):v,v=T?l(l({},v),{streamId:T}):v,v=f?l(l({},v),{userDefineRecordId:f}):v,v=void 0!==this._latencyLevel?l(l({},v),{latencyLevel:this._latencyLevel}):v,m=fe(),[4,this._trtc.enterRoom(v)];case 2:return p.sent(),this._hasJoinedRoom=!0,R=fe()-m,this.emit("onEnterRoom",R),[3,4];case 3:return y=p.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(Mn),p.label=6;case 6:return[2]}}))}))},a.prototype.exitRoom=function(){return h(this,void 0,Promise,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(is,".exitRoom")),this._isExitingRoom=!0,this._isSharingScreen&&this.stopScreenShare(),this.resetTRTCCloud(),this.stopLocalPreview(),this.stopLocalAudio(),[4,this._trtc.exitRoom()];case 1:return t.sent(),this._hasJoinedRoom=!1,this._isExitingRoom=!1,this._isVideoPublish=!0,this._isAudioPublish=!0,this.emit("onExitRoom",un.exitRoom),[3,3];case 2:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,3];case 3:return[2]}}))}))},a.prototype.switchRole=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(he[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(he[e])),[3,4];case 3:return t=i.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),[3,4];case 4:return[2]}}))}))},a.prototype.setDefaultStreamRecvMode=function(e,t){return h(this,void 0,void 0,(function(){return p(this,(function(i){return this.logger.info("".concat(is,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),me(e)&&(this._autoRecvAudio=e),me(t)&&(this._autoRecvVideo=t),[2]}))}))},a.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()},a.prototype._updateLocalVideo=function(){return h(this,void 0,void 0,(function(){var e;return p(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]}}))}))},a.prototype._updateLocalTestVideo=function(){return h(this,void 0,void 0,(function(){var e;return p(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]}}))}))},a.prototype._updateLocalScreen=function(){return h(this,void 0,void 0,(function(){var e;return p(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]}}))}))},a.prototype._updateRemoteVideo=function(e,t){return h(this,void 0,void 0,(function(){var i;return p(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]}}))}))},a.prototype.startLocalPreview=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,Promise,(function(){var t,i,o,r,n;return p(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(is,".startLocalPreview with params: "),e),1===f([],e,!0).length?i=f([],e,!0)[0]:2===f([],e,!0).length&&(n=f([],e,!0),t=n[0],i=n[1]),ve(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]}}))}))},a.prototype.updateLocalView=function(e){return h(this,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(is,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},a.prototype.stopLocalPreview=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(is,".stopLocalPreview")),t.label=1;case 1:return t.trys.push([1,3,,4]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 2:return t.sent(),this.emit("onCameraStopped"),[3,4];case 3:return e=t.sent(),console.warn("".concat(is," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},a.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".muteLocalVideo with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),[3,4];case 4:return[2]}}))}))},a.prototype.startRemoteView=function(t,i,o){return h(this,void 0,void 0,(function(){var r,n;return p(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(is,".startRemoteView with params: "),t,i,o),s.label=1;case 1:if(s.trys.push([1,9,,10]),this._setRemoteStreamConfig(t,o,{view:i,small:o===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]}}))}))},a.prototype.updateRemoteView=function(e,t,i){return h(this,void 0,void 0,(function(){return p(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(is,".updateRemoteView with params: "),e,t,i),this._setRemoteStreamConfig(e,i,{view:t}),this._remoteStreamMap.get("".concat(e,"_").concat(this._getTRTCStreamType(i)))?[4,this._updateRemoteVideo(e,i)]:[2];case 1:return o.sent(),[2]}}))}))},a.prototype.stopRemoteView=function(e,t){return h(this,void 0,void 0,(function(){var i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".stopRemoteView with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"stopRemoteView"),[3,4];case 4:return[2]}}))}))},a.prototype.stopAllRemoteView=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(is,".stopAllRemoteView")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),[3,4];case 4:return[2]}}))}))},a.prototype.setVideoEncoderParam=function(t){return h(this,void 0,void 0,(function(){var i,o;return p(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(is,".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]}}))}))},a.prototype.setNetworkQosParam=function(e){return h(this,void 0,void 0,(function(){var t,i,o=this;return p(this,(function(r){return this.logger.info("".concat(is,".setNetworkQosParam with params: "),e),t=e.preference,i=this._getTRTCQosPreference(t),this._setQosPreference(i),this._setScreenShareParams({qosPreference:i}),[2,new Promise((function(e,t){Promise.all([o._updateLocalVideo(),o._updateLocalScreen()]).then((function(){e(!0)})).catch((function(e){o._callFunctionErrorManage(e,"setNetworkQosParam"),t(e)}))}))]}))}))},a.prototype.setLocalRenderParams=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return t=i.sent(),this._callFunctionErrorManage(t,"setLocalRenderParams"),[3,5];case 5:return[2]}}))}))},a.prototype.setVideoEncoderMirror=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".setVideoEncoderMirror with params: "),e),this._encoderMirror=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setVideoEncoderMirror"),[3,4];case 4:return[2]}}))}))},a.prototype.setRemoteRenderParams=function(e,t,i){return h(this,void 0,void 0,(function(){var o;return p(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(is,".setRemoteRenderParams with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,i),[4,this._updateRemoteVideo(e,t)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),[3,4];case 4:return[2]}}))}))},a.prototype._updateLocalAudio=function(){return h(this,void 0,void 0,(function(){var e;return p(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]}}))}))},a.prototype._updateLocalTestAudio=function(){return h(this,void 0,void 0,(function(){var e;return p(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]}}))}))},a.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),h(this,void 0,void 0,(function(){var i,o,r;return p(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(is,".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(is," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),[3,10];case 10:return[2]}}))}))},a.prototype.stopLocalAudio=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(is,".stopLocalAudio")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopLocalAudio()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),[3,4];case 4:return[2]}}))}))},a.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".muteLocalAudio with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setAudioMuteType(!!e&&"microphone"),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),[3,4];case 4:return[2]}}))}))},a.prototype.setAudioCaptureVolume=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".setAudioCaptureVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setCaptureVolume(e),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setAudioCaptureVolume"),[3,4];case 4:return[2]}}))}))},a.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(is,".getAudioCaptureVolume")),this._getCaptureVolume()},a.prototype.setAudioPlayoutVolume=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".setAudioPlayoutVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._playoutVolume=e,[4,this._trtc.setRemoteAudioVolume("*",e)];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setAudioPlayoutVolume"),[3,4];case 4:return[2]}}))}))},a.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(is,".getAudioPlayoutVolume")),this._playoutVolume},a.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),h(this,void 0,void 0,(function(){var i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".muteRemoteAudio with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),e?[4,this._trtc.muteRemoteAudio(e,t)]:(this._emitError(Mn),[2]);case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},a.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(is,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},a.prototype.muteRemoteVideoStream=function(e,t,i){return h(this,void 0,void 0,(function(){var o;return p(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(is,".muteRemoteVideoStream with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo({userId:e,mute:t,streamType:this._getTRTCStreamType(i)})];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"muteRemoteVideoStream"),[3,4];case 4:return[2]}}))}))},a.prototype.muteAllRemoteVideoStreams=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".muteAllRemoteVideoStreams with params: "),e),i.label=1;case 1:return i.trys.push([1,6,,7]),e?[4,this._trtc.callExperimentalAPI("pauseRemotePlayer",{userId:"*"})]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this._trtc.callExperimentalAPI("resumeRemotePlayer",{userId:"*"})];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:return t=i.sent(),this._callFunctionErrorManage(t,"muteAllRemoteVideoStreams"),[3,7];case 7:return[2]}}))}))},a.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(is,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){this._callFunctionErrorManage(i,"setRemoteAudioVolume")}},a.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(is,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},a.prototype.enableSmallVideoStream=function(t,i){return h(this,void 0,Promise,(function(){var o;return p(this,(function(r){switch(r.label){case 0:return this.logger.info("".concat(is,".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]}}))}))},a.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},a.prototype.startScreenShare=function(t,i,o){return h(this,void 0,void 0,(function(){var r,n,s,a,u,l;return p(this,(function(d){switch(d.label){case 0:this.logger.info("".concat(is,".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]}}))}))},a.prototype.setSubStreamEncoderParam=function(t){return h(this,void 0,void 0,(function(){var i,o;return p(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(is,".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]}}))}))},a.prototype.stopScreenShare=function(){return h(this,void 0,Promise,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(is,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._clearScreenShareParams(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",0),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),[3,4];case 4:return[2]}}))}))},a.prototype._startPublishVideoTrack=function(e){var t=e.videoTrack;return h(this,void 0,void 0,(function(){var e,i;return p(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]}}))}))},a.prototype._stopPublishVideoTrack=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},a.prototype.startScreenCapture=function(){this._emitError(wn)},a.prototype.pauseScreenCapture=function(){this._emitError(wn)},a.prototype.resumeScreenCapture=function(){this._emitError(wn)},a.prototype.getScreenCaptureSources=function(){this._emitError(wn)},a.prototype.selectScreenCaptureTarget=function(){this._emitError(wn)},a.prototype.getCameraDevicesList=function(){return h(this,void 0,Promise,(function(){var e,t,i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".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 l(l({},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]}}))}))},a.prototype.setCurrentCameraDevice=function(e){var t;return h(this,void 0,Promise,(function(){var i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".setCurrentCameraDevice with params: "),{cameraId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._currentCameraId=e,[4,this._updateLocalVideo()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),this._currentCamera=this._cameraList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._currentCameraId=null===(t=this._currentCamera)||void 0===t?void 0:t.cameraId,this._callFunctionErrorManage(i,"setCurrentCameraDevice"),i;case 5:return[2]}}))}))},a.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(is,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},a.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},a.prototype.switchCamera=function(e){return h(this,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(is,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},a.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},a.prototype.setVirtualBackground=function(e){return h(this,void 0,void 0,(function(){var t,i,o,r,n;return p(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!==le?[3,2]:[4,this._trtc.updatePlugin(ce,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==de?[3,4]:[4,this._trtc.updatePlugin(ce,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(ce,l(l({},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(ce),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(is,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},a.prototype.setTestVirtualBackground=function(e){return h(this,void 0,void 0,(function(){var t,i,o,r,n;return p(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!==le?[3,2]:[4,this._testTrtc.updatePlugin(ce,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==de?[3,4]:[4,this._testTrtc.updatePlugin(ce,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(ce,l(l({},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(ce),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(is,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},a.prototype.useVirtualBackground=function(e){return h(this,void 0,void 0,(function(){return p(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]}}))}))},a.prototype.setBeautyStyle=function(e,t,i,o){return h(this,void 0,void 0,(function(){return p(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]}}))}))},a.prototype.setTestBeautyStyle=function(e,t,i,o){return h(this,void 0,void 0,(function(){return p(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]}}))}))},a.prototype.useBeautyStyle=function(e){return h(this,void 0,void 0,(function(){return p(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]}}))}))},a.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return h(this,void 0,void 0,(function(){var i,a,c,u,l;return p(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(ue)]:[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(ue,u)];case 4:return d.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(ue,u)];case 6:d.sent(),d.label=7;case 7:return[3,9];case 8:throw l=d.sent(),s?this.logger.error("".concat(is,".").concat("setTestBeautyStyle"," fail: "),l):this.logger.error("".concat(is,".").concat("setBeautyStyle"," fail: "),l),l;case 9:return[2]}}))}))},a.prototype._resetBeautyStyle=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(ue)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(ue)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},a.prototype.getMicDevicesList=function(){return h(this,void 0,Promise,(function(){var e,t,i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".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 l(l({},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]}}))}))},a.prototype.setCurrentMicDevice=function(e){var t;return h(this,void 0,Promise,(function(){var i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".setCurrentMicDevice with params: "),{micId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._setCurrentMicrophoneId(e),[4,this._updateLocalAudio()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestAudio()];case 3:return o.sent(),this._currentMicrophone=this._microphoneList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._setCurrentMicrophoneId(null===(t=this._currentMicrophone)||void 0===t?void 0:t.deviceId),this._callFunctionErrorManage(i,"setCurrentMicDevice"),i;case 5:return[2]}}))}))},a.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(is,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},a.prototype.getSpeakerDevicesList=function(){return h(this,void 0,Promise,(function(){var e,t,i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".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 l(l({},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]}}))}))},a.prototype.setCurrentSpeakerDevice=function(e){return h(this,void 0,Promise,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".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]}}))}))},a.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(is,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},a.prototype.startCameraDeviceTest=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:if(this.logger.info("".concat(is,".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]}}))}))},a.prototype.stopCameraDeviceTest=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(is,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},a.prototype.startMicDeviceTest=function(e){return h(this,void 0,void 0,(function(){var t,i=this;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".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]}}))}))},a.prototype.stopMicDeviceTest=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(is,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},a.prototype.callExperimentalAPI=function(e){return h(this,void 0,void 0,(function(){var t,i,o;return p(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(is,".callExperimentalAPI"),e),(t=Re(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]}}))}))},a.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;ge(t)&&(this._frameWorkType=t),ge(i)&&(this._component=i),ge(o)&&(this._language=o)},a.prototype._handleKeyMetricsStats=function(e){var t=e.key,i=e.opt,o=e.value,r=e.version,n=i===Te;c.default._addKVStat({type:i,key:t,value:o,version:r,useUV:n,base:100})},a.prototype._setVideoEncodeParamEx=function(t){return h(this,void 0,void 0,(function(){return p(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]}}))}))},a.prototype._switchPlaybackQuality=function(e){return h(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return p(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]}}))}))},a.prototype._requestPictureInPicture=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(is,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},a.prototype._exitPictureInPicture=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(is,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},a.prototype._emitError=function(e){e&&this.emit&&this.emit(re,e.code,e.message)},a.prototype._emitWarning=function(e){this.emit&&this.emit(ne,e)},a.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?Sn:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},a.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:fn},a.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},a.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},a.prototype._transformTRTCDeviceError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);switch(e.extraCode){case 5301:case 5305:case 5306:case 5307:case 5308:case 5309:if(i)return vn;if(o)return yn;break;case 5302:if(i)return gn;if(o)return Cn;break;case 5303:if(i)return Rn;if(o)return bn;break;case 5304:if(i)return mn;if(o)return _n}},a.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?vn:o?yn:e.code},a.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},a.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(re,i,e.message)}},a.prototype._getTRTCResolution=function(t){var i=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(i.length>1&&i[1]),height:+(i.length>2&&i[2])}},a.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(ve(n))ve(o)||(l.width=o),ve(r)||(l.height=r);else{var d=this._getTRTCResolution(n);l.width=d.width,l.height=d.height}if(!ve(c)&&c===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait||!ve(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},a.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]},a.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=cn.COVER,i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=cn.CONTAIN,i)[t]},a.prototype._getTRTCCloudVideoFillMode=function(t){var i;return((i={})[cn.COVER]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,i[cn.CONTAIN]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit,i)[t]},a.prototype._getTRTCCloudMirrorType=function(t){return!0===t?e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable},a.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]},a.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return ve(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},a.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]},a.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]},a.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]},a.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},a.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},a.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]},a.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},a.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},a.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return me(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),me(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),me(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},a.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},a.prototype._generateRemoteVideoData=function(e,t){return _e(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},a.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:un.banned,room_disband:un.roomDisband};ge(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 F("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new F(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 H;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 H;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 W;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 W;r.userId=i,r.audioBitrate=o||0,t.push(r)}T.push.apply(T,t)}));var f=new j;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)}))},a.prototype._removeTRTCEvents=function(){this._trtc.off("*")},a.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)},a.prototype._setLocalView=function(e){this._localView=e},a.prototype._getLocalView=function(){return this._localView},a.prototype._setIsMobile=function(e){this._isMobile=e},a.prototype._getIsMobile=function(){return this._isMobile},a.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},a.prototype._getIsFrontCamera=function(){return this._isFrontCamera},a.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},a.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},a.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},a.prototype._getIsVideoPublish=function(){return this._isVideoPublish},a.prototype._setVideoProfile=function(e){this._videoProfile=e},a.prototype._getVideoProfile=function(){return this._videoProfile},a.prototype._setQosPreference=function(e){this._qosPreference=e},a.prototype._getQosPreference=function(){return this._qosPreference},a.prototype._setLocalTestView=function(e){this._localTestView=e},a.prototype._getLocalTestView=function(){return this._localTestView},a.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;ve(t)||(this._screenShareParams.view=t),ve(i)||(this._screenShareParams.option.systemAudio=i),ve(o)||(this._screenShareParams.option.fillMode=o),ve(r)||(this._screenShareParams.option.profile=r),ve(n)||(this._screenShareParams.option.videoTrack=n),ve(s)||(this._screenShareParams.option.qosPreference=s),ve(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},a.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},a.prototype._getScreenShareParams=function(){return this._screenShareParams},a.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},a.prototype._getIsAudioPublish=function(){return this._isAudioPublish},a.prototype._setAudioMuteType=function(e){this._audioMuteType=e},a.prototype._getAudioMuteType=function(){return this._audioMuteType},a.prototype._setAudioProfile=function(e){this._audioProfile=e},a.prototype._getAudioProfile=function(){return this._audioProfile},a.prototype._getCaptureVolume=function(){return this._captureVolume},a.prototype._setCaptureVolume=function(e){this._captureVolume=e},a.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},a.prototype._getCurrentCameraId=function(){return this._currentCameraId},a.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},a.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},a.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},a.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},a.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;ve(n)||(r.view=n),ve(s)||(r.option.mirror=this._getTRTCRemoteMirror(s)),ve(a)||(r.option.fillMode=this._getTRTCFillMode(a)),ve(c)||(r.option.small=c),this._remoteStreamConfig.set("".concat(t,"_").concat(this._getTRTCStreamType(i)),r)},a.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=l({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},a.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)}))},a.prototype.handleDeviceChange=function(){return h(this,void 0,void 0,(function(){var t=this;return p(this,(function(i){return c.default.getCameraList().then((function(i){return h(t,void 0,void 0,(function(){return p(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 h(t,void 0,void 0,(function(){return p(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 h(t,void 0,void 0,(function(){return p(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]}))}))},a.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)},a.prototype.deviceChangeManage=function(t,i,o){return h(this,void 0,void 0,(function(){var r,n,s,a,c;return p(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 P,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]}}))}))},a.prototype.getDefaultDeviceInfo=function(e){var t=new P;if(0===e.length)return t;var i=e.filter((function(e){return"default"===e.deviceId}));return t=i.length>0?i[0]:e[0]},a.prototype.autoChangeDevice=function(t,i){return h(this,void 0,void 0,(function(){var o,r,n;return p(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]}}))}))},a.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},a.prototype.getMediaMixingManager=function(){return new Un({logger:this.logger,trtc:this._trtc,trtcCloud:this})},a.prototype.getAITranscriberManager=function(){return new Xn({logger:this.logger,trtc:this._trtc})},a.shareInstance=null,a.subCloudMap=new Map,a.enableSEI=!1,a.assetsPath="",d([(T="exitRoom",function(e,t,i){var o=i.value;return i.value=function(){for(var e,t,i,r,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];var a=[];return null===(t=null===(e=Gn.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return a.push(e)})),null===(i=Yn.get(this))||void 0===i||i.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),null===(r=Kn.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),a.forEach((function(e){e.reject(new Error("aborted ".concat(T)))})),Gn.delete(this),Yn.delete(this),Kn.delete(this),o.apply(this,n)},i})],a.prototype,"exitRoom",null),d([Jn((function(e){return e}))],a.prototype,"muteRemoteAudio",null),d([Jn((function(e){return e}))],a.prototype,"muteRemoteVideoStream",null),d([Jn((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})],a.prototype,"_switchPlaybackQuality",null),a}(E);e.Rect=X,e.TRTCDeviceInfo=P,e.TRTCImageBuffer=Y,e.TRTCLocalStatistics=H,e.TRTCMixUser=te,e.TRTCNetworkQosParam=G,e.TRTCParams=I,e.TRTCPublishCDNParam=Q,e.TRTCQualityInfo=F,e.TRTCRemoteStatistics=W,e.TRTCRenderParams=k,e.TRTCScreenCaptureProperty=oe,e.TRTCScreenCaptureSourceInfo=J,e.TRTCStatistics=j,e.TRTCTranscodingConfig=$,e.TRTCVideoEncParam=x,e.TRTCVolumeInfo=N,e.default=ns,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=function(e,t){return u=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])},u(e,t)};var l=function(){return l=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},l.apply(this,arguments)};function d(e,t,i,o){var r,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s}function h(e,t,i,o){return new(i||(i=Promise))((function(r,n){function s(e){try{c(o.next(e))}catch(t){n(t)}}function a(e){try{c(o.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function p(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 T(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],o=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(e,t,i){if(i||2===arguments.length)for(var o,r=0,n=t.length;r<n;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function v(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=T(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=e[i]&&function(t){return new Promise((function(o,r){(function(e,t,i,o){Promise.resolve(o).then((function(t){e({value:t,done:i})}),t)})(o,r,(t=e[i](t)).done,t.value)}))}}}var g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function m(e,t){return e(t={exports:{}},t.exports),t.exports}var R,y,C,_,b,S,M,w,E=m((function(e){var t=Object.prototype.hasOwnProperty,i="~";function o(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function n(e,t,o,n,s){if("function"!=typeof o)throw new TypeError("The listener must be a function");var a=new r(o,n||e,s),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function a(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,o,r=[];if(0===this._eventsCount)return r;for(o in e=this._events)t.call(e,o)&&r.push(i?o.slice(1):o);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var r=0,n=o.length,s=new Array(n);r<n;r++)s[r]=o[r].fn;return s},a.prototype.listenerCount=function(e){var t=i?i+e:e,o=this._events[t];return o?o.fn?1:o.length:0},a.prototype.emit=function(e,t,o,r,n,s){var a=i?i+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],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,(R=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[R.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",R[R.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",R[R.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",R[R.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",R[R.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",R[R.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",R[R.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",R[R.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",R[R.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",R[R.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",R[R.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",R[R.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",R[R.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",R[R.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",R[R.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",R[R.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",R[R.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",R[R.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",R[R.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",R[R.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(y=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[y.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",y[y.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",y[y.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(C=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[C.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",C[C.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(_=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[_.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",_[_.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",_[_.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(b=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[b.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",b[b.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(S=e.TRTCAppScene||(e.TRTCAppScene={}))[S.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",S[S.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",S[S.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",S[S.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(M=e.TRTCRoleType||(e.TRTCRoleType={}))[M.TRTCRoleAnchor=20]="TRTCRoleAnchor",M[M.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(w=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[w.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",w[w.TRTCAudioQualityDefault=2]="TRTCAudioQualityDefault",w[w.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic";var V,A,P=function(e,t,i,o,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=""),this.deviceId=e,this.deviceName=t,this.kind=i,this.label=o,this.groupId=r};e.TRTCDeviceState=void 0,(V=e.TRTCDeviceState||(e.TRTCDeviceState={}))[V.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",V[V.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",V[V.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(A=e.TRTCDeviceType||(e.TRTCDeviceType={}))[A.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",A[A.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",A[A.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",A[A.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var L,I=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},x=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,(L=e.TRTCVideoRotation||(e.TRTCVideoRotation={}))[L.TRTCVideoRotation0=0]="TRTCVideoRotation0",L[L.TRTCVideoRotation90=1]="TRTCVideoRotation90",L[L.TRTCVideoRotation180=2]="TRTCVideoRotation180",L[L.TRTCVideoRotation270=3]="TRTCVideoRotation270";var O,k=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,(O=e.TRTCQuality||(e.TRTCQuality={}))[O.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",O[O.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",O[O.TRTCQuality_Good=2]="TRTCQuality_Good",O[O.TRTCQuality_Poor=3]="TRTCQuality_Poor",O[O.TRTCQuality_Bad=4]="TRTCQuality_Bad",O[O.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",O[O.TRTCQuality_Down=6]="TRTCQuality_Down";var D,B,z,F=function(t,i){void 0===t&&(t=""),void 0===i&&(i=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=i},N=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},Q=function(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),this.appId=e,this.bizId=t,this.url=i},H=function(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},W=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},j=function(e,t,i,o,r,n,s,a,c,u,l){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=[]),void 0===c&&(c=0),void 0===u&&(u=[]),void 0===l&&(l=0),this.upLoss=e,this.downLoss=t,this.rtt=r,this.receivedBytes=n,this.sentBytes=s,this.localStatisticsArray=a,this.localStatisticsArraySize=c,this.remoteStatisticsArray=u,this.remoteStatisticsArraySize=l};e.TRTCVideoResolutionMode=void 0,(D=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[D.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",D[D.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(B=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[B.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",B[B.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(z=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[z.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",z[z.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var U,q,G=function(t,i){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===i&&(i=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=i},Y=function(e,t,i,o){void 0===e&&(e=new ArrayBuffer(0)),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.buffer=e,this.length=t,this.width=i,this.height=o};e.TRTCLogLevel=void 0,(U=e.TRTCLogLevel||(e.TRTCLogLevel={}))[U.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",U[U.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",U[U.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",U[U.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",U[U.TRTCLogLevelError=4]="TRTCLogLevelError",U[U.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",U[U.TRTCLogLevelNone=6]="TRTCLogLevelNone",e.TRTCScreenCaptureSourceType=void 0,(q=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[q.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",q[q.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",q[q.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",q[q.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var K,J=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 Y),void 0===n&&(n=new Y),void 0===s&&(s=!1),this.type=t,this.sourceId=i,this.sourceName=o,this.thumbBGRA=r,this.iconBGRA=n,this.isMinimizeWindow=s},X=function(e,t,i,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.left=e,this.top=t,this.right=i,this.bottom=o},$=function(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,(K=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[K.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",K[K.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",K[K.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",K[K.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",K[K.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",K[K.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",K[K.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",K[K.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",K[K.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",K[K.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var Z,ee,te=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,(Z=e.TRTCMixInputType||(e.TRTCMixInputType={}))[Z.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",Z[Z.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",Z[Z.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",Z[Z.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio",e.TRTCCameraCaptureMode=void 0,(ee=e.TRTCCameraCaptureMode||(e.TRTCCameraCaptureMode={}))[ee.TRTCCameraResolutionStrategyAuto=0]="TRTCCameraResolutionStrategyAuto",ee[ee.TRTCCameraResolutionStrategyPerformance=1]="TRTCCameraResolutionStrategyPerformance",ee[ee.TRTCCameraResolutionStrategyHighQuality=2]="TRTCCameraResolutionStrategyHighQuality",ee[ee.TRTCCameraCaptureManual=3]="TRTCCameraCaptureManual";var ie,oe=function(e,t,i,o,r,n){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.enableCaptureMouse=e,this.enableHighLight=t,this.enableHighPerformance=i,this.highLightColor=o,this.highLightWidth=r,this.enableCaptureChildWindow=n},re="onError",ne="onWarning",se="rtc",ae="live",ce="VirtualBackground",ue="BasicBeauty",le="blur",de="image",he={20:"anchor",21:"audience"},pe={0:se,1:ae,2:se,3:ae};!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(ie||(ie={}));var Te="enum";function fe(){return Math.floor(performance.now())}var ve=function(e){return void 0===e},ge=function(e){return"number"==typeof e},me=function(e){return"boolean"==typeof e};function Re(e){if("string"!=typeof e)return e;var t;try{var i=JSON.parse(e);t="object"==typeof i&&i?i:e}catch(o){t=e}return t}function ye(e){return null==e}function Ce(){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]=Ce(e[i],t[i]):e[i]=t[i]})),e}),{})}function _e(e){var t=null;return e instanceof MediaStream||e instanceof MediaStreamTrack||e instanceof HTMLElement?e:([Date,RegExp,Set,WeakSet,Map,WeakMap,Error].includes(null==e?void 0:e.constructor)?t=new e.constructor(e):Array.isArray(e)?(t=[],e.forEach((function(e,i){t[i]=_e(e)}))):"object"==typeof e&&null!==e?(t={},Object.keys(e).forEach((function(i){Object.hasOwnProperty.call(e,i)&&(t[i]=_e(e[i]))}))):t=e,t)}var be,Se,Me=function(e){return e&&e.Math===Math&&e},we=Me("object"==typeof globalThis&&globalThis)||Me("object"==typeof window&&window)||Me("object"==typeof self&&self)||Me("object"==typeof g&&g)||function(){return this}()||g||Function("return this")(),Ee=function(e){try{return!!e()}catch(t){return!0}},Ve=!Ee((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Ae=!Ee((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Pe=Function.prototype.call,Le=Ae?Pe.bind(Pe):function(){return Pe.apply(Pe,arguments)},Ie={}.propertyIsEnumerable,xe=Object.getOwnPropertyDescriptor,Oe={f:xe&&!Ie.call({1:2},1)?function(e){var t=xe(this,e);return!!t&&t.enumerable}:Ie},ke=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},De=Function.prototype,Be=De.call,ze=Ae&&De.bind.bind(Be,Be),Fe=Ae?ze:function(e){return function(){return Be.apply(e,arguments)}},Ne=Fe({}.toString),Qe=Fe("".slice),He=function(e){return Qe(Ne(e),8,-1)},We=Object,je=Fe("".split),Ue=Ee((function(){return!We("z").propertyIsEnumerable(0)}))?function(e){return"String"===He(e)?je(e,""):We(e)}:We,qe=function(e){return null==e},Ge=TypeError,Ye=function(e){if(qe(e))throw Ge("Can't call method on "+e);return e},Ke=function(e){return Ue(Ye(e))},Je="object"==typeof document&&document.all,Xe={all:Je,IS_HTMLDDA:void 0===Je&&void 0!==Je},$e=Xe.all,Ze=Xe.IS_HTMLDDA?function(e){return"function"==typeof e||e===$e}:function(e){return"function"==typeof e},et=Xe.all,tt=Xe.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:Ze(e)||e===et}:function(e){return"object"==typeof e?null!==e:Ze(e)},it=function(e,t){return arguments.length<2?(i=we[e],Ze(i)?i:void 0):we[e]&&we[e][t];var i},ot=Fe({}.isPrototypeOf),rt="undefined"!=typeof navigator&&String(navigator.userAgent)||"",nt=we.process,st=we.Deno,at=nt&&nt.versions||st&&st.version,ct=at&&at.v8;ct&&(Se=(be=ct.split("."))[0]>0&&be[0]<4?1:+(be[0]+be[1])),!Se&&rt&&(!(be=rt.match(/Edge\/(\d+)/))||be[1]>=74)&&(be=rt.match(/Chrome\/(\d+)/))&&(Se=+be[1]);var ut=Se,lt=we.String,dt=!!Object.getOwnPropertySymbols&&!Ee((function(){var e=Symbol("symbol detection");return!lt(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ut&&ut<41})),ht=dt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,pt=Object,Tt=ht?function(e){return"symbol"==typeof e}:function(e){var t=it("Symbol");return Ze(t)&&ot(t.prototype,pt(e))},ft=String,vt=TypeError,gt=function(e){if(Ze(e))return e;throw vt(function(e){try{return ft(e)}catch(t){return"Object"}}(e)+" is not a function")},mt=function(e,t){var i=e[t];return qe(i)?void 0:gt(i)},Rt=TypeError,yt=Object.defineProperty,Ct=function(e,t){try{yt(we,e,{value:t,configurable:!0,writable:!0})}catch(i){we[e]=t}return t},_t="__core-js_shared__",bt=we[_t]||Ct(_t,{}),St=m((function(e){(e.exports=function(e,t){return bt[e]||(bt[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.32.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"})})),Mt=Object,wt=function(e){return Mt(Ye(e))},Et=Fe({}.hasOwnProperty),Vt=Object.hasOwn||function(e,t){return Et(wt(e),t)},At=0,Pt=Math.random(),Lt=Fe(1..toString),It=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Lt(++At+Pt,36)},xt=we.Symbol,Ot=St("wks"),kt=ht?xt.for||xt:xt&&xt.withoutSetter||It,Dt=function(e){return Vt(Ot,e)||(Ot[e]=dt&&Vt(xt,e)?xt[e]:kt("Symbol."+e)),Ot[e]},Bt=TypeError,zt=Dt("toPrimitive"),Ft=function(e,t){if(!tt(e)||Tt(e))return e;var i,o=mt(e,zt);if(o){if(void 0===t&&(t="default"),i=Le(o,e,t),!tt(i)||Tt(i))return i;throw Bt("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var i,o;if("string"===t&&Ze(i=e.toString)&&!tt(o=Le(i,e)))return o;if(Ze(i=e.valueOf)&&!tt(o=Le(i,e)))return o;if("string"!==t&&Ze(i=e.toString)&&!tt(o=Le(i,e)))return o;throw Rt("Can't convert object to primitive value")}(e,t)},Nt=function(e){var t=Ft(e,"string");return Tt(t)?t:t+""},Qt=we.document,Ht=tt(Qt)&&tt(Qt.createElement),Wt=function(e){return Ht?Qt.createElement(e):{}},jt=!Ve&&!Ee((function(){return 7!==Object.defineProperty(Wt("div"),"a",{get:function(){return 7}}).a})),Ut=Object.getOwnPropertyDescriptor,qt={f:Ve?Ut:function(e,t){if(e=Ke(e),t=Nt(t),jt)try{return Ut(e,t)}catch(i){}if(Vt(e,t))return ke(!Le(Oe.f,e,t),e[t])}},Gt=Ve&&Ee((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Yt=String,Kt=TypeError,Jt=function(e){if(tt(e))return e;throw Kt(Yt(e)+" is not an object")},Xt=TypeError,$t=Object.defineProperty,Zt=Object.getOwnPropertyDescriptor,ei="enumerable",ti="configurable",ii="writable",oi={f:Ve?Gt?function(e,t,i){if(Jt(e),t=Nt(t),Jt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&ii in i&&!i[ii]){var o=Zt(e,t);o&&o[ii]&&(e[t]=i.value,i={configurable:ti in i?i[ti]:o[ti],enumerable:ei in i?i[ei]:o[ei],writable:!1})}return $t(e,t,i)}:$t:function(e,t,i){if(Jt(e),t=Nt(t),Jt(i),jt)try{return $t(e,t,i)}catch(o){}if("get"in i||"set"in i)throw Xt("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},ri=Ve?function(e,t,i){return oi.f(e,t,ke(1,i))}:function(e,t,i){return e[t]=i,e},ni=Function.prototype,si=Ve&&Object.getOwnPropertyDescriptor,ai=Vt(ni,"name"),ci={EXISTS:ai,PROPER:ai&&"something"===function(){}.name,CONFIGURABLE:ai&&(!Ve||Ve&&si(ni,"name").configurable)},ui=Fe(Function.toString);Ze(bt.inspectSource)||(bt.inspectSource=function(e){return ui(e)});var li,di,hi,pi=bt.inspectSource,Ti=we.WeakMap,fi=Ze(Ti)&&/native code/.test(String(Ti)),vi=St("keys"),gi=function(e){return vi[e]||(vi[e]=It(e))},mi={},Ri="Object already initialized",yi=we.TypeError,Ci=we.WeakMap;if(fi||bt.state){var _i=bt.state||(bt.state=new Ci);_i.get=_i.get,_i.has=_i.has,_i.set=_i.set,li=function(e,t){if(_i.has(e))throw yi(Ri);return t.facade=e,_i.set(e,t),t},di=function(e){return _i.get(e)||{}},hi=function(e){return _i.has(e)}}else{var bi=gi("state");mi[bi]=!0,li=function(e,t){if(Vt(e,bi))throw yi(Ri);return t.facade=e,ri(e,bi,t),t},di=function(e){return Vt(e,bi)?e[bi]:{}},hi=function(e){return Vt(e,bi)}}var Si={set:li,get:di,has:hi,enforce:function(e){return hi(e)?di(e):li(e,{})},getterFor:function(e){return function(t){var i;if(!tt(t)||(i=di(t)).type!==e)throw yi("Incompatible receiver, "+e+" required");return i}}},Mi=m((function(e){var t=ci.CONFIGURABLE,i=Si.enforce,o=Si.get,r=String,n=Object.defineProperty,s=Fe("".slice),a=Fe("".replace),c=Fe([].join),u=Ve&&!Ee((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),(!Vt(e,"name")||t&&e.name!==o)&&(Ve?n(e,"name",{value:o,configurable:!0}):e.name=o),u&&d&&Vt(d,"arity")&&e.length!==d.arity&&n(e,"length",{value:d.arity});try{d&&Vt(d,"constructor")&&d.constructor?Ve&&n(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(p){}var h=i(e);return Vt(h,"source")||(h.source=c(l,"string"==typeof o?o:"")),e};Function.prototype.toString=d((function(){return Ze(this)&&o(this).source||pi(this)}),"toString")})),wi=function(e,t,i,o){o||(o={});var r=o.enumerable,n=void 0!==o.name?o.name:t;if(Ze(i)&&Mi(i,n,o),o.global)r?e[t]=i:Ct(t,i);else{try{o.unsafe?e[t]&&(r=!0):delete e[t]}catch(s){}r?e[t]=i:oi.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e},Ei=Math.ceil,Vi=Math.floor,Ai=Math.trunc||function(e){var t=+e;return(t>0?Vi:Ei)(t)},Pi=function(e){var t=+e;return t!=t||0===t?0:Ai(t)},Li=Math.max,Ii=Math.min,xi=Math.min,Oi=function(e){return e>0?xi(Pi(e),9007199254740991):0},ki=function(e){return Oi(e.length)},Di=function(e){return function(t,i,o){var r,n=Ke(t),s=ki(n),a=function(e,t){var i=Pi(e);return i<0?Li(i+t,0):Ii(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}},Bi={includes:Di(!0),indexOf:Di(!1)}.indexOf,zi=Fe([].push),Fi=function(e,t){var i,o=Ke(e),r=0,n=[];for(i in o)!Vt(mi,i)&&Vt(o,i)&&zi(n,i);for(;t.length>r;)Vt(o,i=t[r++])&&(~Bi(n,i)||zi(n,i));return n},Ni=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Qi=Ni.concat("length","prototype"),Hi={f:Object.getOwnPropertyNames||function(e){return Fi(e,Qi)}},Wi={f:Object.getOwnPropertySymbols},ji=Fe([].concat),Ui=it("Reflect","ownKeys")||function(e){var t=Hi.f(Jt(e)),i=Wi.f;return i?ji(t,i(e)):t},qi=function(e,t,i){for(var o=Ui(t),r=oi.f,n=qt.f,s=0;s<o.length;s++){var a=o[s];Vt(e,a)||i&&Vt(i,a)||r(e,a,n(t,a))}},Gi=/#|\.prototype\./,Yi=function(e,t){var i=Ji[Ki(e)];return i===$i||i!==Xi&&(Ze(t)?Ee(t):!!t)},Ki=Yi.normalize=function(e){return String(e).replace(Gi,".").toLowerCase()},Ji=Yi.data={},Xi=Yi.NATIVE="N",$i=Yi.POLYFILL="P",Zi=Yi,eo=qt.f,to=function(e,t){var i,o,r,n,s,a=e.target,c=e.global,u=e.stat;if(i=c?we:u?we[a]||Ct(a,{}):(we[a]||{}).prototype)for(o in t){if(n=t[o],r=e.dontCallGetSet?(s=eo(i,o))&&s.value:i[o],!Zi(c?o:a+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;qi(n,r)}(e.sham||r&&r.sham)&&ri(n,"sham",!0),wi(i,o,n,e)}},io={};io[Dt("toStringTag")]="z";var oo,ro="[object z]"===String(io),no=Dt("toStringTag"),so=Object,ao="Arguments"===He(function(){return arguments}()),co=ro?He:function(e){var t,i,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=so(e),no))?i:ao?He(t):"Object"===(o=He(t))&&Ze(t.callee)?"Arguments":o},uo=String,lo=function(e){if("Symbol"===co(e))throw TypeError("Cannot convert a Symbol value to a string");return uo(e)},ho=function(){var e=Jt(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},po=we.RegExp,To=Ee((function(){var e=po("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),fo=To||Ee((function(){return!po("a","y").sticky})),vo={BROKEN_CARET:To||Ee((function(){var e=po("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:fo,UNSUPPORTED_Y:To},go=Object.keys||function(e){return Fi(e,Ni)},mo=Ve&&!Gt?Object.defineProperties:function(e,t){Jt(e);for(var i,o=Ke(t),r=go(t),n=r.length,s=0;n>s;)oi.f(e,i=r[s++],o[i]);return e},Ro={f:mo},yo=it("document","documentElement"),Co="prototype",_o="script",bo=gi("IE_PROTO"),So=function(){},Mo=function(e){return"<"+_o+">"+e+"</"+_o+">"},wo=function(e){e.write(Mo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Eo=function(){try{oo=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Eo="undefined"!=typeof document?document.domain&&oo?wo(oo):(t=Wt("iframe"),i="java"+_o+":",t.style.display="none",yo.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(Mo("document.F=Object")),e.close(),e.F):wo(oo);for(var o=Ni.length;o--;)delete Eo[Co][Ni[o]];return Eo()};mi[bo]=!0;var Vo,Ao,Po=Object.create||function(e,t){var i;return null!==e?(So[Co]=Jt(e),i=new So,So[Co]=null,i[bo]=e):i=Eo(),void 0===t?i:Ro.f(i,t)},Lo=we.RegExp,Io=Ee((function(){var e=Lo(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),xo=we.RegExp,Oo=Ee((function(){var e=xo("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),ko=Si.get,Do=St("native-string-replace",String.prototype.replace),Bo=RegExp.prototype.exec,zo=Bo,Fo=Fe("".charAt),No=Fe("".indexOf),Qo=Fe("".replace),Ho=Fe("".slice),Wo=(Ao=/b*/g,Le(Bo,Vo=/a/,"a"),Le(Bo,Ao,"a"),0!==Vo.lastIndex||0!==Ao.lastIndex),jo=vo.BROKEN_CARET,Uo=void 0!==/()??/.exec("")[1];(Wo||Uo||jo||Io||Oo)&&(zo=function(e){var t,i,o,r,n,s,a,c=this,u=ko(c),l=lo(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=Le(zo,d,l),c.lastIndex=d.lastIndex,t;var h=u.groups,p=jo&&c.sticky,T=Le(ho,c),f=c.source,v=0,g=l;if(p&&(T=Qo(T,"y",""),-1===No(T,"g")&&(T+="g"),g=Ho(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Fo(l,c.lastIndex-1))&&(f="(?: "+f+")",g=" "+g,v++),i=new RegExp("^(?:"+f+")",T)),Uo&&(i=new RegExp("^"+f+"$(?!\\s)",T)),Wo&&(o=c.lastIndex),r=Le(Bo,p?i:c,g),p?r?(r.input=Ho(r.input,v),r[0]=Ho(r[0],v),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Wo&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),Uo&&r&&r.length>1&&Le(Do,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=Po(null),n=0;n<h.length;n++)s[(a=h[n])[0]]=r[a[1]];return r});var qo=zo;to({target:"RegExp",proto:!0,forced:/./.exec!==qo},{exec:qo});var Go="\t\n\v\f\r                 \u2028\u2029\ufeff",Yo=Fe("".replace),Ko=RegExp("^["+Go+"]+"),Jo=RegExp("(^|[^"+Go+"])["+Go+"]+$"),Xo=function(e){return function(t){var i=lo(Ye(t));return 1&e&&(i=Yo(i,Ko,"")),2&e&&(i=Yo(i,Jo,"$1")),i}},$o={start:Xo(1),end:Xo(2),trim:Xo(3)}.trim,Zo=Fe("".charAt),er=we.parseFloat,tr=we.Symbol,ir=tr&&tr.iterator,or=1/er(Go+"-0")!=-Infinity||ir&&!Ee((function(){er(Object(ir))}))?function(e){var t=$o(lo(e)),i=er(t);return 0===i&&"-"===Zo(t,0)?-0:i}:er;to({global:!0,forced:parseFloat!==or},{parseFloat:or});var rr=function(e){if("Function"===He(e))return Fe(e)},nr=Dt("species"),sr=RegExp.prototype,ar=Fe("".charAt),cr=Fe("".charCodeAt),ur=Fe("".slice),lr=function(e){return function(t,i){var o,r,n=lo(Ye(t)),s=Pi(i),a=n.length;return s<0||s>=a?e?"":void 0:(o=cr(n,s))<55296||o>56319||s+1===a||(r=cr(n,s+1))<56320||r>57343?e?ar(n,s):o:e?ur(n,s,s+2):r-56320+(o-55296<<10)+65536}},dr={codeAt:lr(!1),charAt:lr(!0)}.charAt,hr=function(e,t,i){return t+(i?dr(e,t).length:1)},pr=TypeError,Tr=function(e,t){var i=e.exec;if(Ze(i)){var o=Le(i,e,t);return null!==o&&Jt(o),o}if("RegExp"===He(e))return Le(qo,e,t);throw pr("RegExp#exec called on incompatible receiver")};!function(e,t,i,o){var r=Dt(e),n=!Ee((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),s=n&&!Ee((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[nr]=function(){return i},i.flags="",i[r]=/./[r]),i.exec=function(){return t=!0,null},i[r](""),!t}));if(!n||!s||i){var a=rr(/./[r]),c=t(r,""[e],(function(e,t,i,o,r){var s=rr(e),c=t.exec;return c===qo||c===sr.exec?n&&!r?{done:!0,value:a(t,i,o)}:{done:!0,value:s(i,t,o)}:{done:!1}}));wi(String.prototype,e,c[0]),wi(sr,r,c[1])}o&&ri(sr[r],"sham",!0)}("match",(function(e,t,i){return[function(t){var i=Ye(this),o=qe(t)?void 0:mt(t,e);return o?Le(o,t,i):new RegExp(t)[e](lo(i))},function(e){var o=Jt(this),r=lo(e),n=i(t,o,r);if(n.done)return n.value;if(!o.global)return Tr(o,r);var s=o.unicode;o.lastIndex=0;for(var a,c=[],u=0;null!==(a=Tr(o,r));){var l=lo(a[0]);c[u]=l,""===l&&(o.lastIndex=hr(r,Oi(o.lastIndex),s)),u++}return 0===u?null:c}]}));var fr=Array.isArray||function(e){return"Array"===He(e)},vr=TypeError,gr=function(e){if(e>9007199254740991)throw vr("Maximum allowed index exceeded");return e},mr=function(e,t,i){var o=Nt(t);o in e?oi.f(e,o,ke(0,i)):e[o]=i},Rr=function(){},yr=[],Cr=it("Reflect","construct"),_r=/^\s*(?:class|function)\b/,br=Fe(_r.exec),Sr=!_r.exec(Rr),Mr=function(e){if(!Ze(e))return!1;try{return Cr(Rr,yr,e),!0}catch(t){return!1}},wr=function(e){if(!Ze(e))return!1;switch(co(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Sr||!!br(_r,pi(e))}catch(t){return!0}};wr.sham=!0;var Er,Vr=!Cr||Ee((function(){var e;return Mr(Mr.call)||!Mr(Object)||!Mr((function(){e=!0}))||e}))?wr:Mr,Ar=Dt("species"),Pr=Array,Lr=function(e,t){return new(function(e){var t;return fr(e)&&(t=e.constructor,(Vr(t)&&(t===Pr||fr(t.prototype))||tt(t)&&null===(t=t[Ar]))&&(t=void 0)),void 0===t?Pr:t}(e))(0===t?0:t)},Ir=Dt("species"),xr=Dt("isConcatSpreadable"),Or=ut>=51||!Ee((function(){var e=[];return e[xr]=!1,e.concat()[0]!==e})),kr=function(e){if(!tt(e))return!1;var t=e[xr];return void 0!==t?!!t:fr(e)};to({target:"Array",proto:!0,arity:1,forced:!(Or&&(Er="concat",ut>=51||!Ee((function(){var e=[];return(e.constructor={})[Ir]=function(){return{foo:1}},1!==e[Er](Boolean).foo}))))},{concat:function(e){var t,i,o,r,n,s=wt(this),a=Lr(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(kr(n=-1===t?s:arguments[t]))for(r=ki(n),gr(c+r),i=0;i<r;i++,c++)i in n&&mr(a,c,n[i]);else gr(c+1),mr(a,c++,n);return a.length=c,a}});var Dr=window.navigator&&window.navigator.userAgent||"",Br=/AppleWebKit\/([\d.]+)/i.exec(Dr);Br&&parseFloat(Br.pop());var zr=/iPad/i.test(Dr),Fr=/iPhone/i.test(Dr)&&!zr,Nr=/iPod/i.test(Dr),Qr=Fr||zr||Nr,Hr=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(Dr);Qr&&function(){var e=Dr.match(/OS (\d+)_/i);e&&e[1]&&e[1]}();var Wr=/Android/i.test(Dr);Wr&&function(){var e=Dr.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);t&&i&&parseFloat("".concat(e[1],".").concat(e[2]))}();Wr&&/webkit/i.test(Dr),/Firefox/i.test(Dr)&&function(){var e=Dr.match(/Firefox\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var jr=/Edge\//i.test(Dr);jr&&function(){var e=Dr.match(/Edge\/(\d+)/i);if(e&&e[1])e[1]}();var Ur=/Edg\//i.test(Dr);Ur&&function(){var e=Dr.match(/Edg\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var qr=/SogouMobileBrowser\//i.test(Dr);qr&&function(){var e=Dr.match(/SogouMobileBrowser\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Gr=/MetaSr\s/i.test(Dr);Gr&&function(){var e=Dr.match(/MetaSr(\s\d+(\.\d+)+)/);e&&e[1]&&parseFloat(e[1])}();var Yr=/TBS\/\d+/i.test(Dr);Yr&&function(){var e=Dr.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Kr=/XWEB\/\d+/i.test(Dr);Kr&&function(){var e=Dr.match(/XWEB\/(\d+)/i);if(e&&e[1])e[1]}(),/MSIE\s8\.0/.test(Dr),/MSIE\/\d+/i.test(Dr)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(Dr),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(Dr)&&/rv:11.0/.test(Dr)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(Dr)&&function(){var e=Dr.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])e[1]}();var Jr=!Yr&&/MQQBrowser\/\d+/i.test(Dr)&&/COVC\/\d+/i.test(Dr),Xr=!Yr&&/MQQBrowser\/\d+/i.test(Dr)&&!/COVC\/\d+/i.test(Dr);(Xr||Jr)&&function(){var e=Dr.match(/ MQQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var $r=!Yr&&/ QQBrowser\/\d+/i.test(Dr);$r&&function(){var e=Dr.match(/ QQBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var Zr=!Yr&&/QQBrowserLite\/\d+/i.test(Dr);Zr&&function(){var e=Dr.match(/QQBrowserLite\/([\d.]+)/);e&&e[1]&&e[1]}();var en=!Yr&&/MQBHD\/\d+/i.test(Dr);en&&function(){var e=Dr.match(/MQBHD\/([\d.]+)/);e&&e[1]&&e[1]}(),/Windows/i.test(Dr),!Qr&&/MAC OS X/i.test(Dr),!Wr&&/Linux/i.test(Dr),/MicroMessenger/i.test(Dr),/UCBrowser/i.test(Dr),/Electron/i.test(Dr);var tn=/MiuiBrowser/i.test(Dr);tn&&function(){var e=Dr.match(/MiuiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var on=/HuaweiBrowser/i.test(Dr);/Huawei/i.test(Dr),on&&function(){var e=Dr.match(/HuaweiBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var rn=/SamsungBrowser/i.test(Dr);rn&&function(){var e=Dr.match(/SamsungBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var nn=/HeyTapBrowser/i.test(Dr);nn&&function(){var e=Dr.match(/HeyTapBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var sn=/VivoBrowser/i.test(Dr);sn&&function(){var e=Dr.match(/VivoBrowser\/([\d.]+)/);e&&e[1]&&e[1]}();var an,cn,un,ln=/Chrome/i.test(Dr),dn=!jr&&!Gr&&!qr&&!Yr&&!Kr&&!Ur&&!$r&&!tn&&!on&&!rn&&!nn&&!sn&&/Chrome/i.test(Dr);dn&&function(){var e=Dr.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),dn&&function(){var e=Dr.match(/Chrome\/([\d.]+)/);e&&e[1]&&e[1]}(),!ln&&!Xr&&!Jr&&!Zr&&!en&&/Safari/i.test(Dr)&&function(){var e=Dr.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"}(an||(an={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(cn||(cn={})),function(e){e[e.exitRoom=0]="exitRoom",e[e.banned=1]="banned",e[e.roomDisband=2]="roomDisband"}(un||(un={}));var hn,pn,Tn,fn=-3340,vn=-1301,gn=-1314,mn=-1315,Rn=-1316,yn=-1302,Cn=-1317,_n=-1318,bn=-1319,Sn=-70252,Mn={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},wn={code:-1005,message:"not supported"},En="2.10.14";e.TRTCMediaMixingErrorCode=void 0,(hn=e.TRTCMediaMixingErrorCode||(e.TRTCMediaMixingErrorCode={}))[hn.Success=0]="Success",hn[hn.Error=-1]="Error",hn[hn.InvalidParams=-2]="InvalidParams",hn[hn.NotFoundSource=-3]="NotFoundSource",hn[hn.ImageSourceLoadFailed=-4]="ImageSourceLoadFailed",hn[hn.CameraNotAuthorized=-5]="CameraNotAuthorized",hn[hn.CameraIsOccupied=-6]="CameraIsOccupied",hn[hn.CameraDisconnected=-7]="CameraDisconnected",e.TRTCMediaSourceType=void 0,(pn=e.TRTCMediaSourceType||(e.TRTCMediaSourceType={}))[pn.kCamera=0]="kCamera",pn[pn.kScreen=1]="kScreen",pn[pn.kImage=2]="kImage",pn[pn.kPhoneMirror=4]="kPhoneMirror",pn[pn.kText=5]="kText",pn[pn.kVideo=6]="kVideo",e.TRTCMediaMixingEvent=void 0,(Tn=e.TRTCMediaMixingEvent||(e.TRTCMediaMixingEvent={})).onSourceSelected="onSourceSelected",Tn.onSourceMoved="onSourceMoved",Tn.onSourceResized="onSourceResized",Tn.onRightButtonClicked="onRightButtonClicked",Tn.onError="onError",Tn.onSourcePlugged="onSourcePlugged",Tn.onSourceConnected="onSourceConnected",Tn.onSourceDisconnected="onSourceDisconnected",Tn.onSourceUnplugged="onSourceUnplugged",Tn.onMediaSourceSizeChanged="onMediaSourceSizeChanged";var Vn,An=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}(),Pn=new An(null),Ln=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"):Pn.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 Pn.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)):Pn.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 Pn.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){Pn.debug("".concat(this.logPrefix,"setEnabled: ").concat(this.enabled," -> ").concat(e)),this.enabled=e,this.movable&&(this.movable.style.cursor=e?"move":"default",Pn.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"}(Vn||(Vn={}));var In="trtc-resizable-top-left-anchor",xn="trtc-resizable-top-anchor",On="trtc-resizable-top-right-anchor",kn="trtc-resizable-left-anchor",Dn="trtc-resizable-right-anchor",Bn="trtc-resizable-bottom-left-anchor",zn="trtc-resizable-bottom-anchor",Fn="trtc-resizable-bottom-right-anchor",Nn={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 Qn(e,t){for(var i in t)e.style[i]=t[i]}var Hn=function(){function e(e,t,i){void 0===i&&(i={keepRatio:!1,stopPropagation:!1,anchorMode:Vn.Both,canExceedContainer:!1}),this.logPrefix="[Resizable]",this.container=null,this.options={keepRatio:!1,stopPropagation:!1,anchorMode:Vn.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||Vn.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(In),Qn(c,Object.assign({},Nn.resizeAnchor,Nn.topLeftAnchor)),this.topLeftAnchor=c;var u=document.createElement("div");u.className="trtc-resizable-resize-anchor ".concat(xn),Qn(u,Object.assign({},Nn.resizeAnchor,Nn.topAnchor)),this.topAnchor=u;var l=document.createElement("div");l.className="trtc-resizable-resize-anchor ".concat(On),Qn(l,Object.assign({},Nn.resizeAnchor,Nn.topRightAnchor)),this.topRightAnchor=l;var d=document.createElement("div");d.className="trtc-resizable-resize-anchor ".concat(kn),Qn(d,Object.assign({},Nn.resizeAnchor,Nn.leftAnchor)),this.leftAnchor=d;var h=document.createElement("div");h.className="trtc-resizable-resize-anchor ".concat(Dn),Qn(h,Object.assign({},Nn.resizeAnchor,Nn.rightAnchor)),this.rightAnchor=h;var p=document.createElement("div");p.className="trtc-resizable-resize-anchor ".concat(Bn),Qn(p,Object.assign({},Nn.resizeAnchor,Nn.bottomLeftAnchor)),this.bottomLeftAnchor=p;var T=document.createElement("div");T.className="trtc-resizable-resize-anchor ".concat(zn),Qn(T,Object.assign({},Nn.resizeAnchor,Nn.bottomAnchor)),this.bottomAnchor=T;var f=document.createElement("div");f.className="trtc-resizable-resize-anchor ".concat(Fn),Qn(f,Object.assign({},Nn.resizeAnchor,Nn.bottomRightAnchor)),this.bottomRightAnchor=f,this.options.anchorMode!==Vn.Both&&this.options.anchorMode!==Vn.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!==Vn.Both&&this.options.anchorMode!==Vn.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,Pn.debug("resize origin:",this.originTop,this.originLeft,this.originWidth,this.originHeight)}else Pn.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 In: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 xn: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 On: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 kn: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 Dn: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 Bn: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 zn: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 Fn: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 Pn.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 Pn.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 Pn.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!==Vn.Both&&this.options.anchorMode!==Vn.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!==Vn.Both&&this.options.anchorMode!==Vn.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}(),Wn=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}(),jn=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,Wn.has(t.videoResolution)){var i=Wn.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 E,this.mediaList=[],this.selectedMediaIndex=-1,this.moveAndResizeOverlay=document.createElement("div"),this.moveAndResizeOverlay.style.position="relative",this.container.appendChild(this.moveAndResizeOverlay),this.initMediaMovable(),this.initMediaResizable(),this.initContainerMouseEventHander(),this.initContainerResizeObserver()}return t.prototype.updateOptions=function(t){if(!ye(t.videoResolution)||!ye(t.resMode)){if(this.resMode=ye(t.resMode)?this.resMode:t.resMode,t.videoResolution&&Wn.has(t.videoResolution)){var i=Wn.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 Ln(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 Hn(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",l({},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(!ve(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",l({},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?l({},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",l({},this.mediaList[this.selectedMediaIndex]))},t}(),Un=function(){function t(i){if(this.logPrefix="[TRTCMediaMixingManager]",this.eventEmitter=new E,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 h(this,void 0,Promise,(function(){var e,i,o,r,n;return p(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 h(this,void 0,Promise,(function(){var t,i,o,r,n=this;return p(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=((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);return{width:r[t].width,height:r[t].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(ve(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)),ve(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)),!ve(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(!ve(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,d,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 l(l({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===(d=t.video)||void 0===d?void 0:d.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 h(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,l,d;return p(this,(function(h){switch(h.label){case 0:if(-1!==this.findMediaSourceIndex(t))throw new Error("Media source already existed");if(o=_e(t),r=this._getTRTCSourceKey(o),!(n=this._getTRTCSourceItem(o))||!r)throw new Error("Invalid media source");return(s=_e(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:!!ve(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 h(this,void 0,Promise,(function(){var n,s,a,c,u,l;return p(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=_e(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:_e(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 h(this,void 0,Promise,(function(){var o,r,n,s,a,c,u,d;return p(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=l(l({},this.sourceList[o]),_e(e)),e.isSelected?(this.unselectMediaSource(this.selectedSource),this.selectedSource=e):(null===(t=this.selectedSource)||void 0===t?void 0:t.id)===e.id&&(this.selectedSource=null),n=this._getTRTCSourceKey(r),s=this._getTRTCSourceItem(r),a=_e(this.trtcSourceMap.get(n))||[],c=a.findIndex((function(t){return t.id===e.id})),a[c]=s,[4,this.trtc.updatePlugin("VideoMixer",(d={},d[n]=a,d))];case 1:if(h.sent().result.failedDetails.find((function(t){return t.id===e.id})))throw new Error("Failed to update media source");return u={id:e.id,rect:this._getDesignerMediaRect(e),isSelected:e.isSelected||!1,origin:_e(e),interaction:r.interaction},this.logger.log("".concat(this.logPrefix,"updateParams:"),JSON.stringify(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 h(this,void 0,Promise,(function(){return p(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 h(this,void 0,Promise,(function(){return p(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 h(this,void 0,Promise,(function(){var s,a,u,l,d,h,T,f,g,m,R,y,C,_,b,S,M,w,E,V,A,P,L,I;return p(this,(function(p){switch(p.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,p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.trtc.updatePlugin("VideoMixer",{canvasInfo:{width:u,height:l,canvasColor:String(e.canvasColor)}})];case 2:return p.sent(),[3,4];case 3:if((d=p.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}),p.label=5;case 5:p.trys.push([5,11,12,17]),h=v(this.sourceList),p.label=6;case 6:return[4,h.next()];case 7:return(T=p.sent()).done?[3,10]:(f=T.value).layout?(g=f.layout.rect||{left:0,top:0,right:0,bottom:0},m=g.left,R=g.top,y=g.right,C=g.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:p.sent(),null===(r=this.eventEmitter)||void 0===r||r.emit("onSourceResized",f,null===(n=f.layout)||void 0===n?void 0:n.rect),p.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return I=p.sent(),t={error:I},[3,17];case 12:return p.trys.push([12,,15,16]),T&&!T.done&&(i=h.return)?[4,i.call(h)]:[3,14];case 13:p.sent(),p.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 p.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 jn({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 h(this,void 0,void 0,(function(){return p(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(l(l({},e.origin),{isSelected:!0})),[3,3]):[3,1];case 1:return this.selectedSource?[4,this.updateMediaSource(l(l({},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=l(l({},e.origin),{layout:l(l({},e.origin.layout),{rect:t})});this.updateMediaSource(Ce(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=l(l({},e.origin),{layout:l(l({},e.origin.layout),{rect:t})});this.updateMediaSource(Ce(r,{layout:{rect:this._getPluginMediaRect(r)}})),(null===(i=this.selectedSource)||void 0===i?void 0:i.id)===e.origin.id&&(this.selectedSource=this.sourceList.find((function(t){return t.id===e.origin.id})))}null===(o=this.eventEmitter)||void 0===o||o.emit("onSourceResized",e.origin,t)},t.prototype.onRightButtonClicked=function(e){var t;this.logger.debug("".concat(this.logPrefix,"onRightButtonClicked:"),e),null===(t=this.eventEmitter)||void 0===t||t.emit("onRightButtonClicked",e.origin)},t.prototype.isSameMediaSource=function(e,t){return e.id===t.id},t.prototype.isMediaSourceExisted=function(e){var t=this;return this.sourceList.some((function(i){return t.isSameMediaSource(i,e)}))},t.prototype.findMediaSourceIndex=function(e){return this.sourceList.findIndex((function(t){return t.id===e.id}))},t.prototype.unselectMediaSource=function(e){var t,i;return h(this,void 0,Promise,(function(){var o;return p(this,(function(r){return e?(-1!==(o=this.findMediaSourceIndex(e))&&(this.sourceList[o].isSelected=!1),null===(t=this.mediaMixingDesigner)||void 0===t||t.updateMedia({id:e.id,rect:null===(i=e.layout)||void 0===i?void 0:i.rect,isSelected:!1,origin:_e(e)}),[2]):[2]}))}))},t.mediaMixingManager=null,t}(),qn=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=l(l({},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}(),Gn=new WeakMap,Yn=new WeakMap,Kn=new WeakMap;function Jn(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=Kn.get(this)||new Map;Kn.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 qn,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 Xn=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,f([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,f([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 h(this,void 0,Promise,(function(){var t,i,o;return p(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 h(this,void 0,Promise,(function(){var t;return p(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}(),$n=c.default._loggerManager;$n.info("TRTCCloud Version: ".concat(En));var Zn,es,ts,is="trtcCloud",os=1;navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(Zn=function(){0!==rs.size&&Array.from(rs.values()).forEach((function(e){e.fn()}))},es=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];ts>0&&clearTimeout(ts),ts=window.setTimeout((function(){Zn.apply(e,t),ts=-1}),es)}));var rs=new Map,ns=function(t){function a(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=Hr,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=En;var u=o.frameWorkType,l=void 0===u?30:u,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:a.enableSEI,assetsPath:a.assetsPath,enableVolumeControlInIOS:!0,plugins:[s.VideoMixer,i.LEBPlayer,n.RealtimeTranscriber]}),r._testTrtc=c.default.create(),r._log=c.default._loggerManager,r.logger=new An($n,{seq:os++}),r._echoCancellation=void 0,r._noiseSuppression=void 0,r._autoGainControl=void 0,r._addTRTCEvents(),r.handleDeviceChange=r.handleDeviceChange.bind(r),rs.set(r,{fn:r.handleDeviceChange,self:r}),r}var T;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}u(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(a,t),a.getPlugin=function(e){return"VirtualBackground"===e?o.VirtualBackground:"BasicBeauty"===e?r.BasicBeauty:"VideoMixer"===e?s.VideoMixer:null},a.getTRTCShareInstance=function(e){return a.shareInstance||(a.shareInstance=new a(e)),a.shareInstance},a.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];ve(n)&&(n=r[e.TRTCLogLevel.TRTCLogLevelInfo]);var s=!me(i)||i;c.default.setLogLevel(n,s)},a.destroyTRTCShareInstance=function(){a.shareInstance&&(a.shareInstance._destroy(),a.shareInstance=null),Array.from(a.subCloudMap.keys()).forEach((function(e){return e._destroy()}))},a.callExperimentalAPI=function(e){console.log("static ".concat(is,".callExperimentalAPI"),e);var t=Re(e);if(t!==e){var i=t.api,o=t.params;if(i&&o)try{switch(i){case"enableSEI":a.enableSEI=o.enable;break;case"setAssetsPath":a.assetsPath=o.assetsPath}}catch(r){throw r}}},a.prototype.createSubCloud=function(){if(this!==a.shareInstance)return null;var e=new a;return this._inheritPropertiesToSubCloud(e),this._inheritEventsToSubCloud(e),a.subCloudMap.set(e,e),e},a.prototype.destroy=function(){this!==a.shareInstance?(a.subCloudMap.get(this)&&a.subCloudMap.delete(this),this._destroy()):a.destroyTRTCShareInstance()},a.prototype._destroy=function(){rs.delete(this),this.removeAllListeners(),this._trtc.off("*"),this._trtc.destroy(),this._trtc=null,this._testTrtc.off("*"),this._testTrtc.destroy(),this._testTrtc=null},a.prototype.getSDKVersion=function(){return this._version||""},a.prototype.enterRoom=function(e,t){return h(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,d,h,T,f,v,g,m,R,y,C;return p(this,(function(p){switch(p.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,d=e.enableAutoPlayDialog,h=e.proxy,T=e.streamId,f=e.userDefineRecordId,this.logger.update({sdkAppId:i,userId:o}),this.logger.info("".concat(is,".enterRoom with params: "),e,t),h&&(this._networkProxy=h),!(i&&o&&r))return[3,5];p.label=1;case 1:return p.trys.push([1,3,,4]),v={sdkAppId:i,userId:o,userSig:r,roomId:n,strRoomId:s,role:he[a],scene:pe[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},v=c?l(l({},v),{privateMapKey:c}):v,v=u?l(l({},v),{businessInfo:u}):v,g=d||this._enableAutoPlayDialog,v=me(g)?l(l({},v),{enableAutoPlayDialog:g}):v,v=this._networkProxy?l(l({},v),{proxy:this._networkProxy}):v,v=T?l(l({},v),{streamId:T}):v,v=f?l(l({},v),{userDefineRecordId:f}):v,v=void 0!==this._latencyLevel?l(l({},v),{latencyLevel:this._latencyLevel}):v,m=fe(),[4,this._trtc.enterRoom(v)];case 2:return p.sent(),this._hasJoinedRoom=!0,R=fe()-m,this.emit("onEnterRoom",R),[3,4];case 3:return y=p.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(Mn),p.label=6;case 6:return[2]}}))}))},a.prototype.exitRoom=function(){return h(this,void 0,Promise,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.logger.info("".concat(is,".exitRoom")),this._isExitingRoom=!0,this._isSharingScreen&&this.stopScreenShare(),this.resetTRTCCloud(),this.stopLocalPreview(),this.stopLocalAudio(),[4,this._trtc.exitRoom()];case 1:return t.sent(),this._hasJoinedRoom=!1,this._isExitingRoom=!1,this._isVideoPublish=!0,this._isAudioPublish=!0,this.emit("onExitRoom",un.exitRoom),[3,3];case 2:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,3];case 3:return[2]}}))}))},a.prototype.switchRole=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".switchRole with param: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.switchRole(he[e])];case 2:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(he[e])),[3,4];case 3:return t=i.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),[3,4];case 4:return[2]}}))}))},a.prototype.setDefaultStreamRecvMode=function(e,t){return h(this,void 0,void 0,(function(){return p(this,(function(i){return this.logger.info("".concat(is,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),me(e)&&(this._autoRecvAudio=e),me(t)&&(this._autoRecvVideo=t),[2]}))}))},a.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()},a.prototype._updateLocalVideo=function(){return h(this,void 0,void 0,(function(){var e;return p(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]}}))}))},a.prototype._updateLocalTestVideo=function(){return h(this,void 0,void 0,(function(){var e;return p(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]}}))}))},a.prototype._updateLocalScreen=function(){return h(this,void 0,void 0,(function(){var e;return p(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]}}))}))},a.prototype._updateRemoteVideo=function(e,t){return h(this,void 0,void 0,(function(){var i;return p(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]}}))}))},a.prototype.startLocalPreview=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,Promise,(function(){var t,i,o,r,n;return p(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(is,".startLocalPreview with params: "),e),1===f([],e,!0).length?i=f([],e,!0)[0]:2===f([],e,!0).length&&(n=f([],e,!0),t=n[0],i=n[1]),ve(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]}}))}))},a.prototype.updateLocalView=function(e){return h(this,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(is,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},a.prototype.stopLocalPreview=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(is,".stopLocalPreview")),t.label=1;case 1:return t.trys.push([1,3,,4]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 2:return t.sent(),this.emit("onCameraStopped"),[3,4];case 3:return e=t.sent(),console.warn("".concat(is," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},a.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".muteLocalVideo with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),[3,4];case 4:return[2]}}))}))},a.prototype.startRemoteView=function(t,i,o){return h(this,void 0,void 0,(function(){var r,n;return p(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(is,".startRemoteView with params: "),t,i,o),s.label=1;case 1:if(s.trys.push([1,9,,10]),this._setRemoteStreamConfig(t,o,{view:i,small:o===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]}}))}))},a.prototype.updateRemoteView=function(e,t,i){return h(this,void 0,void 0,(function(){return p(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(is,".updateRemoteView with params: "),e,t,i),this._setRemoteStreamConfig(e,i,{view:t}),this._remoteStreamMap.get("".concat(e,"_").concat(this._getTRTCStreamType(i)))?[4,this._updateRemoteVideo(e,i)]:[2];case 1:return o.sent(),[2]}}))}))},a.prototype.stopRemoteView=function(e,t){return h(this,void 0,void 0,(function(){var i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".stopRemoteView with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"stopRemoteView"),[3,4];case 4:return[2]}}))}))},a.prototype.stopAllRemoteView=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(is,".stopAllRemoteView")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),[3,4];case 4:return[2]}}))}))},a.prototype.setVideoEncoderParam=function(t){return h(this,void 0,void 0,(function(){var i,o;return p(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(is,".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]}}))}))},a.prototype.setNetworkQosParam=function(e){return h(this,void 0,void 0,(function(){var t,i,o=this;return p(this,(function(r){return this.logger.info("".concat(is,".setNetworkQosParam with params: "),e),t=e.preference,i=this._getTRTCQosPreference(t),this._setQosPreference(i),this._setScreenShareParams({qosPreference:i}),[2,new Promise((function(e,t){Promise.all([o._updateLocalVideo(),o._updateLocalScreen()]).then((function(){e(!0)})).catch((function(e){o._callFunctionErrorManage(e,"setNetworkQosParam"),t(e)}))}))]}))}))},a.prototype.setLocalRenderParams=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return t=i.sent(),this._callFunctionErrorManage(t,"setLocalRenderParams"),[3,5];case 5:return[2]}}))}))},a.prototype.setVideoEncoderMirror=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".setVideoEncoderMirror with params: "),e),this._encoderMirror=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._updateLocalVideo()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setVideoEncoderMirror"),[3,4];case 4:return[2]}}))}))},a.prototype.setRemoteRenderParams=function(e,t,i){return h(this,void 0,void 0,(function(){var o;return p(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(is,".setRemoteRenderParams with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,i),[4,this._updateRemoteVideo(e,t)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),[3,4];case 4:return[2]}}))}))},a.prototype._updateLocalAudio=function(){return h(this,void 0,void 0,(function(){var e;return p(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]}}))}))},a.prototype._updateLocalTestAudio=function(){return h(this,void 0,void 0,(function(){var e;return p(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]}}))}))},a.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),h(this,void 0,void 0,(function(){var i,o,r;return p(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(is,".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(is," startLocalAudio error: ").concat(r)),this._callFunctionErrorManage(r,"startLocalAudio"),[3,10];case 10:return[2]}}))}))},a.prototype.stopLocalAudio=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(is,".stopLocalAudio")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopLocalAudio()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),[3,4];case 4:return[2]}}))}))},a.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".muteLocalAudio with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setAudioMuteType(!!e&&"microphone"),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),[3,4];case 4:return[2]}}))}))},a.prototype.setAudioCaptureVolume=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".setAudioCaptureVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._setCaptureVolume(e),[4,this._updateLocalAudio()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setAudioCaptureVolume"),[3,4];case 4:return[2]}}))}))},a.prototype.getAudioCaptureVolume=function(){return this.logger.info("".concat(is,".getAudioCaptureVolume")),this._getCaptureVolume()},a.prototype.setAudioPlayoutVolume=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".setAudioPlayoutVolume with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),this._playoutVolume=e,[4,this._trtc.setRemoteAudioVolume("*",e)];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setAudioPlayoutVolume"),[3,4];case 4:return[2]}}))}))},a.prototype.getAudioPlayoutVolume=function(){return this.logger.info("".concat(is,".getAudioPlayoutVolume")),this._playoutVolume},a.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),h(this,void 0,void 0,(function(){var i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".muteRemoteAudio with params: "),e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),e?[4,this._trtc.muteRemoteAudio(e,t)]:(this._emitError(Mn),[2]);case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},a.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(is,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},a.prototype.muteRemoteVideoStream=function(e,t,i){return h(this,void 0,void 0,(function(){var o;return p(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(is,".muteRemoteVideoStream with params: "),e,t,i),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._trtc.updateRemoteVideo({userId:e,mute:t,streamType:this._getTRTCStreamType(i)})];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"muteRemoteVideoStream"),[3,4];case 4:return[2]}}))}))},a.prototype.muteAllRemoteVideoStreams=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".muteAllRemoteVideoStreams with params: "),e),i.label=1;case 1:return i.trys.push([1,6,,7]),e?[4,this._trtc.callExperimentalAPI("pauseRemotePlayer",{userId:"*"})]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this._trtc.callExperimentalAPI("resumeRemotePlayer",{userId:"*"})];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:return t=i.sent(),this._callFunctionErrorManage(t,"muteAllRemoteVideoStreams"),[3,7];case 7:return[2]}}))}))},a.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(is,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){this._callFunctionErrorManage(i,"setRemoteAudioVolume")}},a.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(is,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},a.prototype.enableSmallVideoStream=function(t,i){return h(this,void 0,Promise,(function(){var o;return p(this,(function(r){switch(r.label){case 0:return this.logger.info("".concat(is,".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]}}))}))},a.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},a.prototype.startScreenShare=function(t,i,o){return h(this,void 0,void 0,(function(){var r,n,s,a,u,l;return p(this,(function(d){switch(d.label){case 0:this.logger.info("".concat(is,".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]}}))}))},a.prototype.setSubStreamEncoderParam=function(t){return h(this,void 0,void 0,(function(){var i,o;return p(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(is,".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]}}))}))},a.prototype.stopScreenShare=function(){return h(this,void 0,Promise,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(is,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._clearScreenShareParams(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",0),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),[3,4];case 4:return[2]}}))}))},a.prototype._startPublishVideoTrack=function(e){var t=e.videoTrack;return h(this,void 0,void 0,(function(){var e,i;return p(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]}}))}))},a.prototype._stopPublishVideoTrack=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this._cameraVideoTrack=null,[4,this._trtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},a.prototype.startScreenCapture=function(){this._emitError(wn)},a.prototype.pauseScreenCapture=function(){this._emitError(wn)},a.prototype.resumeScreenCapture=function(){this._emitError(wn)},a.prototype.getScreenCaptureSources=function(){this._emitError(wn)},a.prototype.selectScreenCaptureTarget=function(){this._emitError(wn)},a.prototype.getCameraDevicesList=function(){return h(this,void 0,Promise,(function(){var e,t,i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".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 l(l({},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]}}))}))},a.prototype.setCurrentCameraDevice=function(e){var t;return h(this,void 0,Promise,(function(){var i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".setCurrentCameraDevice with params: "),{cameraId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._currentCameraId=e,[4,this._updateLocalVideo()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),this._currentCamera=this._cameraList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._currentCameraId=null===(t=this._currentCamera)||void 0===t?void 0:t.cameraId,this._callFunctionErrorManage(i,"setCurrentCameraDevice"),i;case 5:return[2]}}))}))},a.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(is,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},a.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},a.prototype.switchCamera=function(e){return h(this,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(is,".switchCamera with params: "),e),this._setIsFrontCamera(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[4,this._updateLocalTestVideo()];case 2:return t.sent(),[2]}}))}))},a.prototype._onVirtualBackgroundError=function(e){this._emitError({code:-1006,message:e.message?e.message:"virtual background error"})},a.prototype.setVirtualBackground=function(e){return h(this,void 0,void 0,(function(){var t,i,o,r,n;return p(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!==le?[3,2]:[4,this._trtc.updatePlugin(ce,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==de?[3,4]:[4,this._trtc.updatePlugin(ce,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._trtc.startPlugin(ce,l(l({},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(ce),this._isVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(is,".setVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},a.prototype.setTestVirtualBackground=function(e){return h(this,void 0,void 0,(function(){var t,i,o,r,n;return p(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!==le?[3,2]:[4,this._testTrtc.updatePlugin(ce,{type:i,blurLevel:o})]:[3,5]:[3,8];case 1:s.sent(),s.label=2;case 2:return i!==de?[3,4]:[4,this._testTrtc.updatePlugin(ce,{type:i,src:r})];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,this._testTrtc.startPlugin(ce,l(l({},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(ce),this._isTestVirtualBackground=!1,s.label=9;case 9:return[3,11];case 10:throw n=s.sent(),this.logger.error("".concat(is,".setTestVirtualBackground fail: "),n),n;case 11:return[2]}}))}))},a.prototype.useVirtualBackground=function(e){return h(this,void 0,void 0,(function(){return p(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]}}))}))},a.prototype.setBeautyStyle=function(e,t,i,o){return h(this,void 0,void 0,(function(){return p(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]}}))}))},a.prototype.setTestBeautyStyle=function(e,t,i,o){return h(this,void 0,void 0,(function(){return p(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]}}))}))},a.prototype.useBeautyStyle=function(e){return h(this,void 0,void 0,(function(){return p(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]}}))}))},a.prototype._handleBeautyStyleParam=function(e,t,i,o,r,n,s){return h(this,void 0,void 0,(function(){var i,a,c,u,l;return p(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(ue)]:[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(ue,u)];case 4:return d.sent(),s?this._isTestBeautyEnabled=!0:this._isBeautyEnabled=!0,[3,7];case 5:return[4,e.updatePlugin(ue,u)];case 6:d.sent(),d.label=7;case 7:return[3,9];case 8:throw l=d.sent(),s?this.logger.error("".concat(is,".").concat("setTestBeautyStyle"," fail: "),l):this.logger.error("".concat(is,".").concat("setBeautyStyle"," fail: "),l),l;case 9:return[2]}}))}))},a.prototype._resetBeautyStyle=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this._isBeautyEnabled?[4,this._trtc.stopPlugin(ue)]:[3,2];case 1:e.sent(),this._isBeautyEnabled=!1,e.label=2;case 2:return this._isTestBeautyEnabled?[4,this._testTrtc.stopPlugin(ue)]:[3,4];case 3:e.sent(),this._isTestBeautyEnabled=!1,e.label=4;case 4:return[2]}}))}))},a.prototype.getMicDevicesList=function(){return h(this,void 0,Promise,(function(){var e,t,i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".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 l(l({},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]}}))}))},a.prototype.setCurrentMicDevice=function(e){var t;return h(this,void 0,Promise,(function(){var i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".setCurrentMicDevice with params: "),{micId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._setCurrentMicrophoneId(e),[4,this._updateLocalAudio()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestAudio()];case 3:return o.sent(),this._currentMicrophone=this._microphoneList.find((function(t){return t.deviceId===e}))||{},[3,5];case 4:throw i=o.sent(),this._setCurrentMicrophoneId(null===(t=this._currentMicrophone)||void 0===t?void 0:t.deviceId),this._callFunctionErrorManage(i,"setCurrentMicDevice"),i;case 5:return[2]}}))}))},a.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(is,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},a.prototype.getSpeakerDevicesList=function(){return h(this,void 0,Promise,(function(){var e,t,i;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".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 l(l({},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]}}))}))},a.prototype.setCurrentSpeakerDevice=function(e){return h(this,void 0,Promise,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(is,".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]}}))}))},a.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(is,".getCurrentSpeakerDevice"));var e=this._currentSpeaker,t=e.deviceId,i=e.label,o=e.kind,r=e.groupId;return new P(t,i,o,i,r)},a.prototype.startCameraDeviceTest=function(e){return h(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:if(this.logger.info("".concat(is,".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]}}))}))},a.prototype.stopCameraDeviceTest=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(is,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},a.prototype.startMicDeviceTest=function(e){return h(this,void 0,void 0,(function(){var t,i=this;return p(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(is,".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]}}))}))},a.prototype.stopMicDeviceTest=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(is,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},a.prototype.callExperimentalAPI=function(e){return h(this,void 0,void 0,(function(){var t,i,o;return p(this,(function(r){switch(r.label){case 0:if(this.logger.info("".concat(is,".callExperimentalAPI"),e),(t=Re(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]}}))}))},a.prototype._handleSetFrameWork=function(e){var t=e.frameWork,i=e.component,o=e.language;ge(t)&&(this._frameWorkType=t),ge(i)&&(this._component=i),ge(o)&&(this._language=o)},a.prototype._handleKeyMetricsStats=function(e){var t=e.key,i=e.opt,o=e.value,r=e.version,n=i===Te;c.default._addKVStat({type:i,key:t,value:o,version:r,useUV:n,base:100})},a.prototype._setVideoEncodeParamEx=function(t){return h(this,void 0,void 0,(function(){return p(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]}}))}))},a.prototype._switchPlaybackQuality=function(e){return h(this,void 0,void 0,(function(){var t,i,o,r,n,s,a,c;return p(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]}}))}))},a.prototype._requestPictureInPicture=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(is,"._requestPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!0})];case 1:return e.sent(),[2]}}))}))},a.prototype._exitPictureInPicture=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(is,"._exitPictureInPicture")),[4,this._trtc.callExperimentalAPI("requestPictureInPicture",{enable:!1})];case 1:return e.sent(),[2]}}))}))},a.prototype._emitError=function(e){e&&this.emit&&this.emit(re,e.code,e.message)},a.prototype._emitWarning=function(e){this.emit&&this.emit(ne,e)},a.prototype._transformTRTCServerError=function(e){return-8===e.extraCode?Sn:0===String(e.extraCode).indexOf("70")?0-e.extraCode:void 0},a.prototype._transformTRTCInvalidOperationError=function(e,t){return"enterRoom"!==t||5104!==e.extraCode&&5998!==e.code?e.code:fn},a.prototype._isCameraError=function(e){return["startLocalPreview","updateLocalView","muteLocalVideo","setVideoEncoderParam","setCurrentCameraDevice","switchCamera","setLocalRenderParams","enableSmallVideoStream","startCameraDeviceTest"].includes(e)},a.prototype._isMicError=function(e){return["startLocalAudio","muteLocalAudio","setAudioCaptureVolume","setCurrentMicDevice","startMicDeviceTest"].includes(e)},a.prototype._transformTRTCDeviceError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);switch(e.extraCode){case 5301:case 5305:case 5306:case 5307:case 5308:case 5309:if(i)return vn;if(o)return yn;break;case 5302:if(i)return gn;if(o)return Cn;break;case 5303:if(i)return Rn;if(o)return bn;break;case 5304:if(i)return mn;if(o)return _n}},a.prototype._transformTRTCUnKnowError=function(e,t){var i=this._isCameraError(t),o=this._isMicError(t);return i?vn:o?yn:e.code},a.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},a.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(re,i,e.message)}},a.prototype._getTRTCResolution=function(t){var i=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(i.length>1&&i[1]),height:+(i.length>2&&i[2])}},a.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(ve(n))ve(o)||(l.width=o),ve(r)||(l.height=r);else{var d=this._getTRTCResolution(n);l.width=d.width,l.height=d.height}if(!ve(c)&&c===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait||!ve(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},a.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]},a.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=cn.COVER,i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=cn.CONTAIN,i)[t]},a.prototype._getTRTCCloudVideoFillMode=function(t){var i;return((i={})[cn.COVER]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,i[cn.CONTAIN]=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit,i)[t]},a.prototype._getTRTCCloudMirrorType=function(t){return!0===t?e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable},a.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]},a.prototype._getTRTCLocalMirror=function(e,t){var i=this._getLocalRenderMirror(e);return ve(t)?!!i&&"both":i&&t?"both":i&&!t?"view":!i&&t?"publish":!(!i&&!t)&&"view"},a.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]},a.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]},a.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]},a.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},a.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},a.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]},a.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},a.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},a.prototype._generateLocalAudioData=function(){var e={publish:this._getIsAudioPublish(),mute:this._getAudioMuteType(),muteKeepVolumeDetection:!0,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile(),captureVolume:this._getCaptureVolume()}};return me(this._echoCancellation)&&(e.option.echoCancellation=this._echoCancellation),me(this._autoGainControl)&&(e.option.autoGainControl=this._autoGainControl),me(this._noiseSuppression)&&(e.option.noiseSuppression=this._noiseSuppression),e},a.prototype._generateLocalTestAudioData=function(){return{publish:!1,option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},a.prototype._generateRemoteVideoData=function(e,t){return _e(this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t))))},a.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:un.banned,room_disband:un.roomDisband};ge(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 F("",t._getTRTCCloudQuality(i)),n=[];t._remoteStatisticsUserIdList.length>0&&(n=t._remoteStatisticsUserIdList.map((function(e){return new F(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 H;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 H;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 W;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 W;r.userId=i,r.audioBitrate=o||0,t.push(r)}T.push.apply(T,t)}));var f=new j;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)}))},a.prototype._removeTRTCEvents=function(){this._trtc.off("*")},a.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)},a.prototype._setLocalView=function(e){this._localView=e},a.prototype._getLocalView=function(){return this._localView},a.prototype._setIsMobile=function(e){this._isMobile=e},a.prototype._getIsMobile=function(){return this._isMobile},a.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},a.prototype._getIsFrontCamera=function(){return this._isFrontCamera},a.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},a.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},a.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},a.prototype._getIsVideoPublish=function(){return this._isVideoPublish},a.prototype._setVideoProfile=function(e){this._videoProfile=e},a.prototype._getVideoProfile=function(){return this._videoProfile},a.prototype._setQosPreference=function(e){this._qosPreference=e},a.prototype._getQosPreference=function(){return this._qosPreference},a.prototype._setLocalTestView=function(e){this._localTestView=e},a.prototype._getLocalTestView=function(){return this._localTestView},a.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile,n=e.videoTrack,s=e.qosPreference;ve(t)||(this._screenShareParams.view=t),ve(i)||(this._screenShareParams.option.systemAudio=i),ve(o)||(this._screenShareParams.option.fillMode=o),ve(r)||(this._screenShareParams.option.profile=r),ve(n)||(this._screenShareParams.option.videoTrack=n),ve(s)||(this._screenShareParams.option.qosPreference=s),ve(e.streamType)||(this._screenShareParams.streamType=this._getTRTCStreamType(e.streamType))},a.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},a.prototype._getScreenShareParams=function(){return this._screenShareParams},a.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},a.prototype._getIsAudioPublish=function(){return this._isAudioPublish},a.prototype._setAudioMuteType=function(e){this._audioMuteType=e},a.prototype._getAudioMuteType=function(){return this._audioMuteType},a.prototype._setAudioProfile=function(e){this._audioProfile=e},a.prototype._getAudioProfile=function(){return this._audioProfile},a.prototype._getCaptureVolume=function(){return this._captureVolume},a.prototype._setCaptureVolume=function(e){this._captureVolume=e},a.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},a.prototype._getCurrentCameraId=function(){return this._currentCameraId},a.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},a.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},a.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},a.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},a.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;ve(n)||(r.view=n),ve(s)||(r.option.mirror=this._getTRTCRemoteMirror(s)),ve(a)||(r.option.fillMode=this._getTRTCFillMode(a)),ve(c)||(r.option.small=c),this._remoteStreamConfig.set("".concat(t,"_").concat(this._getTRTCStreamType(i)),r)},a.prototype._inheritPropertiesToSubCloud=function(e){e._frameWorkType=this._frameWorkType,e._component=this._component,e._language=this._language,e._networkProxy=l({},this._networkProxy),e._latencyLevel=this._latencyLevel,e._enableAutoPlayDialog=this._enableAutoPlayDialog},a.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)}))},a.prototype.handleDeviceChange=function(){return h(this,void 0,void 0,(function(){var t=this;return p(this,(function(i){return c.default.getCameraList().then((function(i){return h(t,void 0,void 0,(function(){return p(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 h(t,void 0,void 0,(function(){return p(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 h(t,void 0,void 0,(function(){return p(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]}))}))},a.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)},a.prototype.deviceChangeManage=function(t,i,o){return h(this,void 0,void 0,(function(){var r,n,s,a,c;return p(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 P,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]}}))}))},a.prototype.getDefaultDeviceInfo=function(e){var t=new P;if(0===e.length)return t;var i=e.filter((function(e){return"default"===e.deviceId}));return t=i.length>0?i[0]:e[0]},a.prototype.autoChangeDevice=function(t,i){return h(this,void 0,void 0,(function(){var o,r,n;return p(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]}}))}))},a.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},a.prototype.getMediaMixingManager=function(){return new Un({logger:this.logger,trtc:this._trtc,trtcCloud:this})},a.prototype.getAITranscriberManager=function(){return new Xn({logger:this.logger,trtc:this._trtc})},a.shareInstance=null,a.subCloudMap=new Map,a.enableSEI=!1,a.assetsPath="",d([(T="exitRoom",function(e,t,i){var o=i.value;return i.value=function(){for(var e,t,i,r,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];var a=[];return null===(t=null===(e=Gn.get(this))||void 0===e?void 0:e.queue)||void 0===t||t.forEach((function(e){return a.push(e)})),null===(i=Yn.get(this))||void 0===i||i.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),null===(r=Kn.get(this))||void 0===r||r.forEach((function(e){return null==e?void 0:e.queue.forEach((function(e){return a.push(e)}))})),a.forEach((function(e){e.reject(new Error("aborted ".concat(T)))})),Gn.delete(this),Yn.delete(this),Kn.delete(this),o.apply(this,n)},i})],a.prototype,"exitRoom",null),d([Jn((function(e){return e}))],a.prototype,"muteRemoteAudio",null),d([Jn((function(e){return e}))],a.prototype,"muteRemoteVideoStream",null),d([Jn((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})],a.prototype,"_switchPlaybackQuality",null),a}(E);e.Rect=X,e.TRTCDeviceInfo=P,e.TRTCImageBuffer=Y,e.TRTCLocalStatistics=H,e.TRTCMixUser=te,e.TRTCNetworkQosParam=G,e.TRTCParams=I,e.TRTCPublishCDNParam=Q,e.TRTCQualityInfo=F,e.TRTCRemoteStatistics=W,e.TRTCRenderParams=k,e.TRTCScreenCaptureProperty=oe,e.TRTCScreenCaptureSourceInfo=J,e.TRTCStatistics=j,e.TRTCTranscodingConfig=$,e.TRTCVideoEncParam=x,e.TRTCVolumeInfo=N,e.default=ns,Object.defineProperty(e,"__esModule",{value:!0})}));