UNPKG

@rongcloud/plugin-call-plus

Version:

@rongcloud/plugin-call-plus

2 lines (1 loc) 46.6 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@rongcloud/engine"),t=require("@rongcloud/plugin-call-plus"),l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])},l(e,t)};function n(e,t,l,n){return new(l||(l=Promise))(function(r,o){function a(e){try{i(n.next(e))}catch(e){o(e)}}function s(e){try{i(n.throw(e))}catch(e){o(e)}}function i(e){var t;e.done?r(e.value):(t=e.value,t instanceof l?t:new l(function(e){e(t)})).then(a,s)}i((n=n.apply(e,t||[])).next())})}function r(e,t){var l,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(i){return function(s){if(l)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(l=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{l=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}}function o(e,t){var l="function"==typeof Symbol&&e[Symbol.iterator];if(!l)return e;var n,r,o=l.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(l=o.return)&&l.call(o)}finally{if(r)throw r.error}}return a}function a(e,t,l){if(l||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}var s,i,_,C,E,R;"function"==typeof SuppressedError&&SuppressedError;(s=exports.RCCallMediaType||(exports.RCCallMediaType={}))[s.AUDIO=1]="AUDIO",s[s.AUDIO_VIDEO=2]="AUDIO_VIDEO",(i=exports.RCCallErrorCode||(exports.RCCallErrorCode={}))[i.SUCCESS=1e4]="SUCCESS",i[i.STATE_MACHINE_EXIT=53200]="STATE_MACHINE_EXIT",i[i.SEND_MSG_ERROR=53201]="SEND_MSG_ERROR",i[i.REJECTED_BY_BLACKLIST=53202]="REJECTED_BY_BLACKLIST",i[i.NOT_IN_GROUP=53203]="NOT_IN_GROUP",i[i.GET_LOCAL_AUDIO_TRACK_ERROR=53301]="GET_LOCAL_AUDIO_TRACK_ERROR",i[i.GET_LOCAL_VIDEO_TRACK_ERROR=53302]="GET_LOCAL_VIDEO_TRACK_ERROR",i[i.GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR=53303]="GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR",i[i.JOIN_ROOM_ERROR=53304]="JOIN_ROOM_ERROR",i[i.AUDIO_PUBLISH_ERROR=53305]="AUDIO_PUBLISH_ERROR",i[i.VIDEO_PUBLISH_ERROR=53306]="VIDEO_PUBLISH_ERROR",i[i.AUDIO_AND_VIDEO_PUBLISH_ERROR=53307]="AUDIO_AND_VIDEO_PUBLISH_ERROR",i[i.QUERY_JOINED_USER_INFO_ERROR=53308]="QUERY_JOINED_USER_INFO_ERROR",i[i.MISSING_VIDEO_TRACK_ERROR=53309]="MISSING_VIDEO_TRACK_ERROR",i[i.UNPUBLISH_VIDEO_ERROR=53310]="UNPUBLISH_VIDEO_ERROR",i[i.CONVERSATION_NOT_GROUP_ERROR=53311]="CONVERSATION_NOT_GROUP_ERROR",i[i.NOT_IN_ROOM_ERROR=53312]="NOT_IN_ROOM_ERROR",i[i.PARAM_ERROR=53313]="PARAM_ERROR",i[i.NOT_IN_CALL=53314]="NOT_IN_CALL",i[i.MEDIATYPE_INVALID=53315]="MEDIATYPE_INVALID",i[i.NOT_VIDEO_CALL=53316]="NOT_VIDEO_CALL",i[i.RTC_SERVICE_UNAVAILABLE=53317]="RTC_SERVICE_UNAVAILABLE",i[i.USER_LIST_INVAILD=53318]="USER_LIST_INVAILD",i[i.CALL_ID_INVALID=53319]="CALL_ID_INVALID",i[i.TRANSACTION_ID_INVALID=53320]="TRANSACTION_ID_INVALID",i[i.USER_ID_INVALID=53321]="USER_ID_INVALID",i[i.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON=53322]="SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON",i[i.MICROPHONE_CLOSED=53323]="MICROPHONE_CLOSED",i[i.MEDIA_RESOURCE_INVALIED=53324]="MEDIA_RESOURCE_INVALIED",i[i.NOT_INSTALL_RTC_PLUGIN=53325]="NOT_INSTALL_RTC_PLUGIN",i[i.PLAY_MEDIA_FAILED=53326]="PLAY_MEDIA_FAILED",i[i.VIDEO_VIEW_NOT_SET=53327]="VIDEO_VIEW_NOT_SET",(_=exports.RCCallUserState||(exports.RCCallUserState={}))[_.NONE=0]="NONE",_[_.WAITING=1]="WAITING",_[_.KEEPING=2]="KEEPING",(C=exports.RCCallSessionState||(exports.RCCallSessionState={}))[C.WAITING=0]="WAITING",C[C.KEEPING=1]="KEEPING",C[C.END=2]="END",(R=exports.RCCallEndReason||(exports.RCCallEndReason={}))[R.CANCEL=1]="CANCEL",R[R.REJECT=2]="REJECT",R[R.HANGUP=3]="HANGUP",R[R.BUSY_LINE=4]="BUSY_LINE",R[R.NO_RESPONSE=5]="NO_RESPONSE",R[R.ENGINE_UNSUPPORTED=6]="ENGINE_UNSUPPORTED",R[R.NETWORK_ERROR=7]="NETWORK_ERROR",R[R.GET_MEDIA_RESOURCES_ERROR=8]="GET_MEDIA_RESOURCES_ERROR",R[R.PUBLISH_ERROR=9]="PUBLISH_ERROR",R[R.SUBSCRIBE_ERROR=10]="SUBSCRIBE_ERROR",R[R.REMOTE_CANCEL=11]="REMOTE_CANCEL",R[R.REMOTE_REJECT=12]="REMOTE_REJECT",R[R.REMOTE_HANGUP=13]="REMOTE_HANGUP",R[R.REMOTE_BUSY_LINE=14]="REMOTE_BUSY_LINE",R[R.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",R[R.REMOTE_ENGINE_UNSUPPORTED=16]="REMOTE_ENGINE_UNSUPPORTED",R[R.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",R[R.REMOTE_GET_MEDIA_RESOURCE_ERROR=18]="REMOTE_GET_MEDIA_RESOURCE_ERROR",R[R.REMOTE_PUBLISH_ERROR=19]="REMOTE_PUBLISH_ERROR",R[R.REMOTE_SUBSCRIBE_ERROR=20]="REMOTE_SUBSCRIBE_ERROR",R[R.OTHER_CLIENT_JOINED_CALL=21]="OTHER_CLIENT_JOINED_CALL",R[R.OTHER_CLIENT_IN_CALL=22]="OTHER_CLIENT_IN_CALL",R[R.KICKED_BY_SERVER=23]="KICKED_BY_SERVER",R[R.ACCEPT_SYSTEM_CALL=24]="ACCEPT_SYSTEM_CALL",R[R.REMOTE_OTHER_CLIENT_JOINED_CALL=31]="REMOTE_OTHER_CLIENT_JOINED_CALL",R[R.REMOTE_OTHER_CLIENT_IN_CALL=32]="REMOTE_OTHER_CLIENT_IN_CALL",R[R.REMOTE_KICKED_BY_SERVER=33]="REMOTE_KICKED_BY_SERVER",R[R.REMOTE_ACCEPT_SYSTEM_CALL=34]="REMOTE_ACCEPT_SYSTEM_CALL",R[R.ACCEPT_BY_OTHER_CLIENT=101]="ACCEPT_BY_OTHER_CLIENT",R[R.HANGUP_BY_OTHER_CLIENT=102]="HANGUP_BY_OTHER_CLIENT",R[R.ADDED_TO_BLACKLIST=103]="ADDED_TO_BLACKLIST",R[R.SERVICE_NOT_OPENED=104]="SERVICE_NOT_OPENED";(E={})[exports.RCCallEndReason.CANCEL]=exports.RCCallEndReason.REMOTE_CANCEL,E[exports.RCCallEndReason.REJECT]=exports.RCCallEndReason.REMOTE_REJECT,E[exports.RCCallEndReason.HANGUP]=exports.RCCallEndReason.REMOTE_HANGUP,E[exports.RCCallEndReason.BUSY_LINE]=exports.RCCallEndReason.REMOTE_BUSY_LINE,E[exports.RCCallEndReason.NO_RESPONSE]=exports.RCCallEndReason.REMOTE_NO_RESPONSE,E[exports.RCCallEndReason.ENGINE_UNSUPPORTED]=exports.RCCallEndReason.REMOTE_ENGINE_UNSUPPORTED,E[exports.RCCallEndReason.NETWORK_ERROR]=exports.RCCallEndReason.REMOTE_NETWORK_ERROR,E[exports.RCCallEndReason.GET_MEDIA_RESOURCES_ERROR]=exports.RCCallEndReason.REMOTE_GET_MEDIA_RESOURCE_ERROR,E[exports.RCCallEndReason.PUBLISH_ERROR]=exports.RCCallEndReason.REMOTE_PUBLISH_ERROR,E[exports.RCCallEndReason.SUBSCRIBE_ERROR]=exports.RCCallEndReason.REMOTE_SUBSCRIBE_ERROR,E[exports.RCCallEndReason.OTHER_CLIENT_JOINED_CALL]=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL,E[exports.RCCallEndReason.OTHER_CLIENT_IN_CALL]=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_IN_CALL,E[exports.RCCallEndReason.KICKED_BY_SERVER]=exports.RCCallEndReason.REMOTE_KICKED_BY_SERVER,E[exports.RCCallEndReason.REMOTE_NO_RESPONSE]=exports.RCCallEndReason.NO_RESPONSE,E[exports.RCCallEndReason.ACCEPT_SYSTEM_CALL]=exports.RCCallEndReason.REMOTE_ACCEPT_SYSTEM_CALL;var u,c=function(e){var l=null;switch(e){case t.RCCallPlusSessionUserState.IDLE:l=exports.RCCallUserState.NONE;break;case t.RCCallPlusSessionUserState.CALLING:case t.RCCallPlusSessionUserState.INVITED:case t.RCCallPlusSessionUserState.RINGING:l=exports.RCCallUserState.WAITING;break;case t.RCCallPlusSessionUserState.BUSYLINE_RINGING:case t.RCCallPlusSessionUserState.BUSYLINE_WAIT:l=exports.RCCallUserState.NONE;break;case t.RCCallPlusSessionUserState.CONNECTING:l=exports.RCCallUserState.WAITING;break;case t.RCCallPlusSessionUserState.ONCALL:l=exports.RCCallUserState.KEEPING;break;case t.RCCallPlusSessionUserState.ONPHONE:l=exports.RCCallUserState.WAITING;break;case t.RCCallPlusSessionUserState.ENDED:case t.RCCallPlusSessionUserState.NO_ANSWER:case t.RCCallPlusSessionUserState.MISSED:case t.RCCallPlusSessionUserState.CANCELLED:case t.RCCallPlusSessionUserState.DECLINED:case t.RCCallPlusSessionUserState.ERROR:default:l=exports.RCCallUserState.NONE}return l},d=function(e){var l=null;switch(e){case t.RCCallPlusCode.SUCCESS:l=exports.RCCallErrorCode.SUCCESS;break;case t.RCCallPlusCode.PARAM_ERROR:l=exports.RCCallErrorCode.PARAM_ERROR;break;case t.RCCallPlusCode.SESSION_EXIST:l=exports.RCCallErrorCode.STATE_MACHINE_EXIT;break;case t.RCCallPlusCode.NOT_IN_CALL:l=exports.RCCallErrorCode.NOT_IN_CALL;break;case t.RCCallPlusCode.MEDIATYPE_INVALID:l=exports.RCCallErrorCode.MEDIATYPE_INVALID;break;case t.RCCallPlusCode.NOT_VIDEO_CALL:l=exports.RCCallErrorCode.NOT_VIDEO_CALL;break;case t.RCCallPlusCode.RTC_SERVICE_UNAVAILABLE:l=exports.RCCallErrorCode.RTC_SERVICE_UNAVAILABLE;break;case t.RCCallPlusCode.USER_LIST_INVAILD:l=exports.RCCallErrorCode.USER_LIST_INVAILD;break;case t.RCCallPlusCode.CALL_ID_INVALID:l=exports.RCCallErrorCode.CALL_ID_INVALID;break;case t.RCCallPlusCode.TRANSACTION_ID_INVALID:l=exports.RCCallErrorCode.TRANSACTION_ID_INVALID;break;case t.RCCallPlusCode.USER_ID_INVALID:l=exports.RCCallErrorCode.USER_ID_INVALID;break;case t.RCCallPlusCode.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON:l=exports.RCCallErrorCode.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON;break;case t.RCCallPlusCode.CAMERA_CLOSED:l=exports.RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR;break;case t.RCCallPlusCode.MICROPHONE_CLOSED:l=exports.RCCallErrorCode.MICROPHONE_CLOSED;break;case t.RCCallPlusCode.MEDIA_RESOURCE_INVALIED:l=exports.RCCallErrorCode.MEDIA_RESOURCE_INVALIED;break;case t.RCCallPlusCode.NOT_INSTALL_RTC_PLUGIN:l=exports.RCCallErrorCode.NOT_INSTALL_RTC_PLUGIN;break;case t.RCCallPlusCode.PLAY_MEDIA_FAILED:l=exports.RCCallErrorCode.PLAY_MEDIA_FAILED;break;case t.RCCallPlusCode.VIDEO_VIEW_NOT_SET:l=exports.RCCallErrorCode.VIDEO_VIEW_NOT_SET;break;default:l=e}return l},I=function(e,l){var n=null;switch(e){case t.RCCallPlusReason.BUSYLINE_RINGING:n=l?exports.RCCallEndReason.BUSY_LINE:exports.RCCallEndReason.REMOTE_BUSY_LINE;break;case t.RCCallPlusReason.ON_DEVICE_DISABLE:n=exports.RCCallEndReason.REMOTE_GET_MEDIA_RESOURCE_ERROR;break;case t.RCCallPlusReason.ENDED:n=l?exports.RCCallEndReason.HANGUP:exports.RCCallEndReason.REMOTE_HANGUP;break;case t.RCCallPlusReason.NO_ANSWER:n=exports.RCCallEndReason.REMOTE_NO_RESPONSE;break;case t.RCCallPlusReason.MISSED:n=exports.RCCallEndReason.NO_RESPONSE;break;case t.RCCallPlusReason.CANCELLED:n=l?exports.RCCallEndReason.CANCEL:exports.RCCallEndReason.REMOTE_CANCEL;break;case t.RCCallPlusReason.DECLINED:n=l?exports.RCCallEndReason.REJECT:exports.RCCallEndReason.REMOTE_REJECT;break;case t.RCCallPlusReason.OTHER_CLIENT_ACCEPT:n=exports.RCCallEndReason.ACCEPT_BY_OTHER_CLIENT;break;case t.RCCallPlusReason.PUBLISH_ERR:n=exports.RCCallEndReason.PUBLISH_ERROR;break;case t.RCCallPlusReason.SUBSCRIBE_ERR:n=exports.RCCallEndReason.SUBSCRIBE_ERROR;break;case t.RCCallPlusReason.ACCEPT_CARRIER:n=l?exports.RCCallEndReason.ACCEPT_SYSTEM_CALL:exports.RCCallEndReason.REMOTE_ACCEPT_SYSTEM_CALL;break;case t.RCCallPlusReason.KICKED_BY_SERVER:n=exports.RCCallEndReason.KICKED_BY_SERVER;break;case t.RCCallPlusReason.CONNECTION_ERR:n=exports.RCCallEndReason.NETWORK_ERROR;break;case t.RCCallPlusReason.OTHER_CLIENT_JOINED:n=l?exports.RCCallEndReason.OTHER_CLIENT_JOINED_CALL:exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case t.RCCallPlusReason.OTHER_CLIENT_IN_ROOM:n=exports.RCCallEndReason.OTHER_CLIENT_IN_CALL;break;case t.RCCallPlusReason.OTHER_CLIENT_HANGUP:n=exports.RCCallEndReason.HANGUP_BY_OTHER_CLIENT;break;case t.RCCallPlusReason.REMOTE_PUBLISH_ERROR:n=exports.RCCallEndReason.REMOTE_PUBLISH_ERROR;break;case t.RCCallPlusReason.REMOTE_SUBSCRIBE_ERROR:n=exports.RCCallEndReason.REMOTE_SUBSCRIBE_ERROR;break;case t.RCCallPlusReason.REMOTE_KICKED_BY_SERVER:n=exports.RCCallEndReason.REMOTE_KICKED_BY_SERVER;break;case t.RCCallPlusReason.REMOTE_CONNECTION_ERROR:n=exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case t.RCCallPlusReason.ABNORMAL_END:n=l?exports.RCCallEndReason.NETWORK_ERROR:exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case t.RCCallPlusReason.OTHER_CLIENT_CALLING:n=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case t.RCCallPlusReason.JOIN_ROOM_ERR:n=exports.RCCallEndReason.NETWORK_ERROR;break;case t.RCCallPlusReason.LOGOUT:n=exports.RCCallEndReason.HANGUP;break;case t.RCCallPlusReason.OTHER_CLIENT_LOGIN:n=exports.RCCallEndReason.NETWORK_ERROR;break;case t.RCCallPlusReason.REMOTE_JOIN_RTC_ERROR:n=exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case t.RCCallPlusReason.REMOTE_LOGOUT:n=exports.RCCallEndReason.REMOTE_HANGUP;break;case t.RCCallPlusReason.REMOTE_OTHER_CLIENT_LOGIN:n=exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case t.RCCallPlusReason.REMOTE_OTHER_JOINED_RTC:n=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case t.RCCallPlusReason.REMOTE_OTHER_CLIENT_IN_RTC:n=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_IN_CALL;break;default:n=exports.RCCallEndReason.NETWORK_ERROR}return n};!function(e){e.L_CALL_PLUS_WRAPPER_INIT_O="L-call_plus_wrapper_init-O",e.L_CALL_CLIENT_REGISTER_USER_INFO_O="L-call_client_register_user_info-O",e.L_CALL_CLIENT_START_CROSS_CALL_O="L-call_client_start_cross_call-O",e.L_CALL_CLIENT_CALL_T="L-call_client_call-T",e.L_CALL_CLIENT_CALL_R="L-call_client_call-R",e.L_CALL_CLIENT_CALL_IN_GROUP_T="L-call_client_call_in_group-T",e.L_CALL_CLIENT_CALL_IN_GROUP_R="L-call_client_call_in_group-R",e.L_CALL_CLIENT_SET_PUSH_CONFIG_O="L-call_client_set_push_config-O",e.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O="L-call_session_register_session_listener-O",e.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_T="L-call_session_change_audio_device-T",e.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R="L-call_session_change_audio_device-R",e.L_CALL_SESSION_INVITE_T="L-call_session_invite-T",e.L_CALL_SESSION_INVITE_R="L-call_session_invite-R",e.L_CALL_SESSION_ACCEPT_T="L-call_session_accept-T",e.L_CALL_SESSION_ACCEPT_R="L-call_session_accept-R",e.L_CALL_SESSION_HUNGUP_T="L-call_session_hungup-T",e.L_CALL_SESSION_HUNGUP_R="L-call_session_hungup-R",e.L_CALL_SESSION_DESCEND_ABILITY_T="L-call_session_descend_ability-T",e.L_CALL_SESSION_DESCEND_ABILITY_R="L-call_session_descend_ability-R",e.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T="L-call_session_disable_video_track-T",e.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R="L-call_session_disable_video_track-R",e.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T="L-call_session_enable_video_track-T",e.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R="L-call_session_enable_video_track-R",e.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T="L-call_session_disable_audio_track-T",e.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R="L-call_session_disable_audio_track-R",e.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T="L-call_session_enable_audio_track-T",e.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R="L-call_session_enable_audio_track-R",e.L_CALL_EXECUTE_EVENT_LISTENER_O="L-call_execute_event_listener-O",e.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E="L-call_client_get_joined_room_info-E"}(u||(u={}));var O,L=function(){function e(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"registerEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(e.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,l=[],s=1;s<arguments.length;s++)l[s-1]=arguments[s];return n(this,void 0,void 0,function(){var n,s;return r(this,function(r){switch(r.label){case 0:if(!(n=null===(t=this._listener)||void 0===t?void 0:t[e]))return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,n.apply(void 0,a([],o(l),!1))];case 2:return r.sent(),[3,4];case 3:return s=r.sent(),this._logger.error(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventName:e,name:s.name,message:s.message})),[3,4];case 4:return[2]}})})}}),Object.defineProperty(e.prototype,"onRinging",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onRinging",sender:e,sessionId:t.getSessionId()})),this._callAppListener("onRinging",e,t)}}),Object.defineProperty(e.prototype,"onAccept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onAccept",sender:e,sessionId:t.getSessionId()})),this._callAppListener("onAccept",e,t)}}),Object.defineProperty(e.prototype,"onHungup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onHungup",sender:e,reason:t,sessionId:l.getSessionId()})),this._callAppListener("onHungup",e,t,l)}}),Object.defineProperty(e.prototype,"onMemberModify",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onMemberModify",sender:e,invitedUsers:t,sessionId:l.getSessionId()})),this._callAppListener("onMemberModify",e,t,l)}}),Object.defineProperty(e.prototype,"onMediaModify",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onMediaModify",sender:e,mediaType:t,sessionId:l.getSessionId()})),this._callAppListener("onMediaModify",e,t,l)}}),Object.defineProperty(e.prototype,"onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackReady",userId:e,mediaType:t,sessionId:null==l?void 0:l.getSessionId()})),this._callAppListener("onTrackReady",e,t,l)}}),Object.defineProperty(e.prototype,"onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onAudioMuteChange",muteUser:e,sessionId:t.getSessionId()})),this._callAppListener("onAudioMuteChange",e,t)}}),Object.defineProperty(e.prototype,"onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onVideoMuteChange",muteUser:e,sessionId:t.getSessionId()})),this._callAppListener("onVideoMuteChange",e,t)}}),Object.defineProperty(e.prototype,"onTrackSubscribeFail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackSubscribeFail",code:e,sessionId:t.getSessionId()})),this._callAppListener("onTrackSubscribeFail",e,t)}}),Object.defineProperty(e.prototype,"onSendPacketLoss",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onSendPacketLoss",sessionId:l.getSessionId()})),this._callAppListener("onSendPacketLoss",e,t,l)}}),Object.defineProperty(e.prototype,"onReceivePacketLoss",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivePacketLoss",sessionId:t.getSessionId()})),this._callAppListener("onReceivePacketLoss",e,t)}}),e}();!function(e){e.INNER_ON_RINGING="inner-on-ringing",e.INNER_ON_ACCEPT="inner-on-accept",e.INNER_ON_HANGUP="inner-on-hangup",e.INNER_ON_TRACK_READY="inner-on-track-ready",e.INNER_ON_MEMBER_MODIFY="inner-on-member-modify",e.INNER_ON_MEDIA_MODIFY="inner-on-media-modify",e.INNER_ON_AUDIO_MUTE_CHANGE="inner-on-audio-mute-change",e.INNER_ON_VIDEO_MUTE_CHANGE="inner-on-video-mute-change",e.INNER_ON_TRACK_SUBSCRIBE_FAIL="inner-on-track-subscribe-fail",e.INNER_ON_SELF_HANGUP="inner-on-self-hangup",e.INNER_ON_SEND_PACKET_LOSS="inner-on-send-packet-loss",e.INNER_ON_RECEIVE_PACKET_LOSS="inner-on-receive-packet-loss"}(O||(O={}));var S,N=function(o){function a(e,t,l,n,r,a,s,i,_){var C=o.call(this)||this;return Object.defineProperty(C,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(C,"_callPlusClient",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(C,"_channelId",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(C,"_targetId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(C,"_callType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(C,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(C,"_context",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(C,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(C,"_options",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(C,"_descendResolve",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(C,"_audioConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(C,"_videoConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(C,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),C._audioConfigBuilder=C._callPlusClient.createAudioConfigBuilder(),C._videoConfigBuilder=C._callPlusClient.createVideoConfigBuilder(),C._reportAppEventModule=new L(i),C}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 n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(a,o),Object.defineProperty(a.prototype,"registerSessionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this._logger.info(u.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O,Object.keys(e).join(",")),this._reportAppEventModule.registerEventListener(e),this.on(O.INNER_ON_RINGING,function(e,l){t._reportAppEventModule.onRinging(e,l)}),this.on(O.INNER_ON_ACCEPT,function(e,l){t._reportAppEventModule.onAccept(e,l)}),this.on(O.INNER_ON_HANGUP,function(e,l,n){t._reportAppEventModule.onHungup(e,l,n)}),this.on(O.INNER_ON_TRACK_READY,function(e,l,n){t._reportAppEventModule.onTrackReady(e,l,n)}),this.on(O.INNER_ON_MEMBER_MODIFY,function(e,l,n){t._reportAppEventModule.onMemberModify(e,l,n)}),this.on(O.INNER_ON_MEDIA_MODIFY,function(e,l,n,r){t._reportAppEventModule.onMediaModify(e,l,n)}),this.on(O.INNER_ON_AUDIO_MUTE_CHANGE,function(e,l){t._reportAppEventModule.onAudioMuteChange(e,l)}),this.on(O.INNER_ON_VIDEO_MUTE_CHANGE,function(e,l){t._reportAppEventModule.onVideoMuteChange(e,l)}),this.on(O.INNER_ON_TRACK_SUBSCRIBE_FAIL,function(e,l){var n,r;null===(r=(n=t._reportAppEventModule).onTrackSubscribeFail)||void 0===r||r.call(n,e,l)}),this.on(O.INNER_ON_SEND_PACKET_LOSS,function(e,l,n){var r,o;null===(o=(r=t._reportAppEventModule).onSendPacketLoss)||void 0===o||o.call(r,e,l,n)}),this.on(O.INNER_ON_RECEIVE_PACKET_LOSS,function(e,l){var n,r;null===(r=(n=t._reportAppEventModule).onReceivePacketLoss)||void 0===r||r.call(n,e,l)})}}),Object.defineProperty(a.prototype,"changeAudioDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return n(this,void 0,void 0,function(){var l,n,o,a;return r(this,function(r){switch(r.label){case 0:return l=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_T,JSON.stringify(e),l),e?(n=e.micphoneId,o=e.sampleRate,this._callPlusClient.setAudioConfig({microphoneId:n,sampleRate:o}),[4,this._callPlusClient.switchMicrophone(n)]):(this._logger.error(u.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(exports.RCCallErrorCode.PARAM_ERROR),l),[2,{code:exports.RCCallErrorCode.PARAM_ERROR}]);case 1:return(a=r.sent().code)!==t.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(d(a)),l),[2,{code:d(a)}]):(this._logger.info(u.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"success",l),[2,{code:d(a)}])}})})}}),Object.defineProperty(a.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(l,o){return void 0===o&&(o={}),n(this,void 0,void 0,function(){var n,a,s,i,_;return r(this,function(r){switch(r.label){case 0:return n=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_INVITE_T,JSON.stringify({userIds:l,options:o}),n),a=o.extra,s=JSON.stringify({callLibExtra:a,targetId:this._targetId,channelId:this._channelId,conversationType:e.ConversationType.GROUP}),i=this._options.callPushConfig||o.pushConfig,[4,this._callPlusClient.invite(l,i,s)];case 1:return(_=r.sent().code)!==t.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_INVITE_R,"errorCode: ".concat(d(_)),n),[2,{code:d(_)}]):(this._logger.info(u.L_CALL_SESSION_INVITE_R,"success",n),[2,{code:d(_)}])}})})}}),Object.defineProperty(a.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return n(this,void 0,void 0,function(){var l,n,o,a,s,i;return r(this,function(r){switch(r.label){case 0:return l=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_ACCEPT_T,JSON.stringify(e),l),e&&(n=e.audio,o=e.video,(null==n?void 0:n.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(n.micphoneId),(null==n?void 0:n.sampleRate)&&this._audioConfigBuilder.setSampleRate(n.sampleRate),(null==o?void 0:o.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(o.cameraId),(null==o?void 0:o.frameRate)&&this._videoConfigBuilder.setFrameRate(o.frameRate),(null==o?void 0:o.resolution)&&this._videoConfigBuilder.setVideoResolution(o.resolution)),a=this._audioConfigBuilder.build(),s=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(a),this._callPlusClient.setVideoConfig(s),[4,this._callPlusClient.accept(this._callId,this._options.callPushConfig)];case 1:return(i=r.sent().code)!==t.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_ACCEPT_R,"errorCode: ".concat(d(i)),l),[2,{code:d(i)}]):(this._logger.info(u.L_CALL_SESSION_ACCEPT_R,"success",l),[2,{code:d(i)}])}})})}}),Object.defineProperty(a.prototype,"hungup",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var e,l;return r(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_HUNGUP_T,"",e),this.emit(O.INNER_ON_SELF_HANGUP),[4,this._callPlusClient.hangup(this._callId,this._options.hangupPushConfig)];case 1:return(l=n.sent().code)!==t.RCCallPlusCode.SUCCESS?this._logger.error(u.L_CALL_SESSION_HUNGUP_R,"errorCode: ".concat(d(l)),e):this._logger.info(u.L_CALL_SESSION_HUNGUP_R,"success",e),[2,{code:d(l)}]}})})}}),Object.defineProperty(a.prototype,"descendAbility",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var e,l,n,o,a,s=this;return r(this,function(r){switch(r.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_DESCEND_ABILITY_T,"",e),[4,this._callPlusClient.requestChangeMediaType(t.RCCallPlusMediaType.AUDIO)];case 1:return l=r.sent(),n=l.code,o=l.transactionId,n!==t.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_DESCEND_ABILITY_R,"errorCode: ".concat(d(n)),e),[2,{code:d(n)}]):[4,new Promise(function(e){s._descendResolve[o]=e})];case 2:return a=r.sent(),this._logger.info(u.L_CALL_SESSION_DESCEND_ABILITY_R,"transactionId: ".concat(o),e),[2,{code:a.code}]}})})}}),Object.defineProperty(a.prototype,"disableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var e,l;return r(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.stopCamera()];case 1:return(l=n.sent().code)!==t.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"errorCode: ".concat(d(l)),e),[2,{code:d(l)}]):(this._logger.info(u.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"success",e),[2,{code:d(l)}])}})})}}),Object.defineProperty(a.prototype,"enableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var e,l;return r(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.startCamera()];case 1:return(l=n.sent().code)!==t.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"errorCode: ".concat(d(l)),e),[2,{code:d(l)}]):(this._logger.info(u.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"success",e),[2,{code:d(l)}])}})})}}),Object.defineProperty(a.prototype,"disableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var e,l;return r(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.stopMicrophone()];case 1:return(l=n.sent().code)!==t.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"errorCode: ".concat(d(l)),e),[2,{code:d(l)}]):(this._logger.info(u.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"success",e),[2,{code:d(l)}])}})})}}),Object.defineProperty(a.prototype,"enableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var e,l;return r(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.startMicrophone()];case 1:return(l=n.sent().code)!==t.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"errorCode: ".concat(d(l)),e),[2,{code:d(l)}]):(this._logger.info(u.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"success",e),[2,{code:d(l)}])}})})}}),Object.defineProperty(a.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(a.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return this._callId!==(null==e?void 0:e.getCallId())?null:this._callPlusClient.getRTCSessionId()}}),Object.defineProperty(a.prototype,"getTargetId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._targetId}}),Object.defineProperty(a.prototype,"getChannelId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._channelId}}),Object.defineProperty(a.prototype,"getConversationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callType}}),Object.defineProperty(a.prototype,"getRemoteUsers",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._callPlusClient.getCurrentCallSession();if(this._callId!==(null==t?void 0:t.getCallId()))return[];var l=(null==t?void 0:t.getUserList())||[];return null==l?void 0:l.map(function(t){var l=t.userId,n=t.state;return{userId:l,state:c(n),isCaller:l===e.getCallerId(),isRemote:l!==e._context.getCurrentId()}})}}),Object.defineProperty(a.prototype,"getUserState",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._callPlusClient.getCurrentCallSession();if(this._callId!==(null==t?void 0:t.getCallId()))return exports.RCCallUserState.NONE;var l=null==t?void 0:t.getUserList().filter(function(t){return t.userId===e})[0].state;return c(l)}}),Object.defineProperty(a.prototype,"getState",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return function(e){var l=null;switch(e){case t.RCCallPlusCallState.IDLE:l=exports.RCCallSessionState.END;break;case t.RCCallPlusCallState.CALLING:case t.RCCallPlusCallState.INVITED:case t.RCCallPlusCallState.RINGING:case t.RCCallPlusCallState.BUSYLINE_RINGING:case t.RCCallPlusCallState.BUSYLINE_WAIT:l=exports.RCCallSessionState.WAITING;break;case t.RCCallPlusCallState.CONNECTING:case t.RCCallPlusCallState.ONCALL:l=exports.RCCallSessionState.KEEPING;break;case t.RCCallPlusCallState.ENDED:case t.RCCallPlusCallState.NOANSWER:case t.RCCallPlusCallState.MISSED:case t.RCCallPlusCallState.CANCELED:case t.RCCallPlusCallState.DECLINED:case t.RCCallPlusCallState.ERROR:default:l=exports.RCCallSessionState.END}return l}(this._callId===(null==e?void 0:e.getCallId())?null==e?void 0:e.getState():t.RCCallPlusCallState.ENDED)}}),Object.defineProperty(a.prototype,"getCallerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return this._callId!==(null==e?void 0:e.getCallId())?"":e.getCreatorUserId()}}),Object.defineProperty(a.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mediaType===t.RCCallPlusMediaType.AUDIO?exports.RCCallMediaType.AUDIO:exports.RCCallMediaType.AUDIO_VIDEO}}),Object.defineProperty(a.prototype,"__innerEndTranction",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._mediaType=e,this._descendResolve[t]&&(this._descendResolve[t]({code:exports.RCCallErrorCode.SUCCESS}),delete this._descendResolve[t])}}),a}(e.EventEmitter),p=function(){function l(e,t,l){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"_callPlusClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_targetId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_channelId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_session",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_sessionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_audioConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_videoConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_callPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_hangupPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_isSelfHangup",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._callPlusClient=l.callPlusClient,this._reportAppEventModule=new L(t),this._setCallPlusEventListener(),this._audioConfigBuilder=this._callPlusClient.createAudioConfigBuilder(),this._videoConfigBuilder=this._callPlusClient.createVideoConfigBuilder()}return Object.defineProperty(l.prototype,"_setCallPlusEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var l=this,o=0,a={},s={};this._callPlusClient.setStatusReportListener({onSendPacketLoss:function(e,t){var n,r,o;l._listener?null===(r=(n=l._listener).onSendPacketLoss)||void 0===r||r.call(n,e,t,l._session):null===(o=l._session)||void 0===o||o.emit(O.INNER_ON_SEND_PACKET_LOSS,e,t,l._session)},onReceivePacketLoss:function(e){var t,n,r;l._listener?null===(n=(t=l._listener).onReceivePacketLoss)||void 0===n||n.call(t,e,l._session):null===(r=l._session)||void 0===r||r.emit(O.INNER_ON_RECEIVE_PACKET_LOSS,e,l._session)}}),this._callPlusClient.setCallPlusEventListener({onReceivedCall:function(o,a){return void 0===a&&(a="{}"),n(this,void 0,void 0,function(){var n,s,i;return r(this,function(r){return n=o.getCallId(),l._session?(l._callPlusClient.hangup(n,l._hangupPushConfig),[2]):(l._targetId=JSON.parse(a).targetId||"",l._channelId=JSON.parse(a).channelId||"",l._mediaType=o.getMediaType()===t.RCCallPlusMediaType.AUDIO?exports.RCCallMediaType.AUDIO:exports.RCCallMediaType.AUDIO_VIDEO,s=o.getCallType(),i=s===t.RCCallPlusType.MULTI?e.ConversationType.GROUP:e.ConversationType.PRIVATE,l._session=new N(n,l._callPlusClient,l._channelId,l._targetId,i,o.getMediaType(),l._context,l._logger,{callPushConfig:l._callPushConfig,hangupPushConfig:l._hangupPushConfig}),l._session.on(O.INNER_ON_SELF_HANGUP,function(){l._isSelfHangup=!0}),l._options.onSession(l._session,JSON.parse(a).callLibExtra||""),[2])})})},onRemoteUserInvited:function(e,t,n){var r,o={userId:t},a=e.map(function(e){return{userId:e}});l._listener?l._reportAppEventModule.onMemberModify(o,a,l._session):null===(r=l._session)||void 0===r||r.emit(O.INNER_ON_MEMBER_MODIFY,o,a,l._session)},onCallConnected:function(e){var t=e.getCallId();s[t]=!0},onCallTypeChanged:function(e,t){},onRemoteUserStateChanged:function(e,o,s,i){var _,C,E;return n(this,void 0,void 0,function(){var n,R,u,c,d,L,S,N,p;return r(this,function(r){return n={userId:o},R=[t.RCCallPlusSessionUserState.IDLE,t.RCCallPlusSessionUserState.DECLINED,t.RCCallPlusSessionUserState.MISSED,t.RCCallPlusSessionUserState.NO_ANSWER].includes(s),l._listener?(s===t.RCCallPlusSessionUserState.RINGING&&l._reportAppEventModule.onRinging(n,l._session),s===t.RCCallPlusSessionUserState.CONNECTING&&l._reportAppEventModule.onAccept(n,l._session),R&&l._reportAppEventModule.onHungup(n,I(i,l._isSelfHangup),l._session)):(s===t.RCCallPlusSessionUserState.RINGING&&(null===(_=l._session)||void 0===_||_.emit(O.INNER_ON_RINGING,n,l._session)),s===t.RCCallPlusSessionUserState.CONNECTING&&(null===(C=l._session)||void 0===C||C.emit(O.INNER_ON_ACCEPT,n,l._session)),R&&(null===(E=l._session)||void 0===E||E.emit(O.INNER_ON_HANGUP,n,I(i,l._isSelfHangup),l._session))),u=l._callPlusClient.getCurrentCallSession(),c=null==u?void 0:u.getCallType(),d=null==u?void 0:u.getUserList(),L=null==d?void 0:d.filter(function(e){return e.userId===l._context.getCurrentId()})[0],S=null==d?void 0:d.filter(function(e){return e.userId!==l._context.getCurrentId()}),N=null==S?void 0:S.every(function(e){return e.state===t.RCCallPlusSessionUserState.IDLE}),p=(null==L?void 0:L.state)===t.RCCallPlusSessionUserState.ONCALL&&N,R&&c===t.RCCallPlusType.MULTI&&p&&(l._callPlusClient.hangup(),a[e]=i===t.RCCallPlusReason.MISSED?t.RCCallPlusReason.NO_ANSWER:i,l._isSelfHangup=!1),[2]})})},onCallEnded:function(e,t){return n(this,void 0,void 0,function(){var n,i,_;return r(this,function(r){return n=+new Date-o,i=e.getCallId(),_={conversationType:l._session.getConversationType(),channelId:l._session.getChannelId(),targetId:l._session.getTargetId(),mediaType:l._session.getMediaType(),beginTimestamp:l._sessionStartTime,endTimestamp:n,duration:s[i]?Math.ceil((n-l._sessionStartTime)/1e3):0,endReason:a[i]?I(a[i],l._isSelfHangup):I(t,l._isSelfHangup)},l._options.onSessionClose(l._session,_),l._session=null,l._sessionStartTime=0,delete a[i],delete s[i],[2]})})},onUserMediaAvailable:function(e,o){var a;return n(this,void 0,void 0,function(){var n;return r(this,function(r){return n=o===t.RCCallPlusMediaType.AUDIO?exports.RCCallMediaType.AUDIO:exports.RCCallMediaType.AUDIO_VIDEO,l._listener?l._reportAppEventModule.onTrackReady(e,n,l._session):null===(a=l._session)||void 0===a||a.emit(O.INNER_ON_TRACK_READY,e,n,l._session),[2]})})},onFetchRemoteMediaError:function(e,t){var n,r,o;l._listener?null===(r=(n=l._reportAppEventModule).onTrackSubscribeFail)||void 0===r||r.call(n,t,l._session):null===(o=l._session)||void 0===o||o.emit(O.INNER_ON_TRACK_SUBSCRIBE_FAIL,t,l._session)},onRemoteCameraStateChanged:function(e,t,n){var r,o={userId:t,muted:n,kind:"video",trackId:"".concat(t,"_RongCloudRTC_1")};l._listener?l._reportAppEventModule.onVideoMuteChange(o,l._session):null===(r=l._session)||void 0===r||r.emit(O.INNER_ON_VIDEO_MUTE_CHANGE,o,l._session)},onRemoteMicrophoneStateChanged:function(e,t,n){var r,o={userId:t,muted:n,kind:"audio",trackId:"".concat(t,"_RongCloudRTC_0")};l._listener?l._reportAppEventModule.onAudioMuteChange(o,l._session):null===(r=l._session)||void 0===r||r.emit(O.INNER_ON_AUDIO_MUTE_CHANGE,o,l._session)},onReceivedCallRecord:function(e){},onReceivedChangeMediaTypeRequest:function(e,t,n){l._callPlusClient.replyChangeMediaType(t,!0)},onReceivedChangeMediaTypeResult:function(e){var n,r;if(l._mediaType===exports.RCCallMediaType.AUDIO_VIDEO&&e.mediaType===t.RCCallPlusMediaType.AUDIO&&e.code===t.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE){var o={userId:e.userId};l._mediaType=exports.RCCallMediaType.AUDIO,null===(n=l._session)||void 0===n||n.__innerEndTranction(t.RCCallPlusMediaType.AUDIO,e.transactionId),l._listener?l._reportAppEventModule.onMediaModify(o,l._mediaType,l._session):null===(r=l._session)||void 0===r||r.emit(O.INNER_ON_MEDIA_MODIFY,o,l._mediaType,l._session,e.transactionId)}},onReceivedCallStartTime:function(e){l._sessionStartTime=e.callStartTime,o=+new Date-e.callStartTime},onReceivedCallFirstFrameTime:function(e,t){},onUserAudioLevelChanged:function(e,t){}})}}),Object.defineProperty(l.prototype,"registerUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.error(u.L_CALL_CLIENT_REGISTER_USER_INFO_O,"`RCCallClient.registerUserInfo` has been deprecated.")}}),Object.defineProperty(l.prototype,"startCrossCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return n(this,void 0,void 0,function(){return r(this,function(e){return this._logger.error(u.L_CALL_CLIENT_START_CROSS_CALL_O,"`RCCallClient.startCrossCall` has been deprecated"),[2]})})}}),Object.defineProperty(l.prototype,"__startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(l,o){var a=o.targetId,s=o.userIds,i=o.mediaType,_=void 0===i?exports.RCCallMediaType.AUDIO:i,C=o.listener,E=o.constraints,R=o.channelId,c=void 0===R?"":R,I=o.extra,L=void 0===I?"":I,S=o.bitrate;return n(this,void 0,void 0,function(){var n,o,i,R,I,p,T,A,f,g,b,P,h,v,D=this;return r(this,function(r){switch(r.label){case 0:return n=this._logger.createTraceId(),this._logger.info(u.L_CALL_CLIENT_CALL_T,JSON.stringify({targetId:a,userIds:s,mediaType:_,listener:Object.keys(C),constraints:E,channelId:c,extra:L,bitrate:S}),n),E&&(o=E.audio,i=E.video,(null==o?void 0:o.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(o.micphoneId),(null==o?void 0:o.sampleRate)&&this._audioConfigBuilder.setSampleRate(o.sampleRate),(null==i?void 0:i.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(i.cameraId),(null==i?void 0:i.frameRate)&&this._videoConfigBuilder.setFrameRate(i.frameRate),(null==i?void 0:i.resolution)&&this._videoConfigBuilder.setVideoResolution(i.resolution)),S&&(o=S.audio,i=S.video,o&&this._audioConfigBuilder.setBitrate(o,o),i&&this._videoConfigBuilder.setBitrate(i.min,i.max)),R=this._audioConfigBuilder.build(),I=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(R),this._callPlusClient.setVideoConfig(I),this._targetId=a,this._listener=C,this._reportAppEventModule.registerEventListener(C),this._mediaType=_,p=_===exports.RCCallMediaType.AUDIO?t.RCCallPlusMediaType.AUDIO:t.RCCallPlusMediaType.AUDIO_VIDEO,T=l?t.RCCallPlusType.SINGLE:t.RCCallPlusType.MULTI,A=l?[a]:s,f=l?e.ConversationType.PRIVATE:e.ConversationType.GROUP,g=l?this._context.getCurrentId():a,b=JSON.stringify({callLibExtra:L,channelId:c,targetId:g,conversationType:f}),[4,this._callPlusClient.startCall(A,T,p,this._callPushConfig,b)];case 1:return P=r.sent(),h=P.code,v=P.callId,h!==t.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_CLIENT_CALL_R,"errorCode: ".concat(d(h)),n),[2,{code:d(h)}]):(this._logger.info(u.L_CALL_CLIENT_CALL_R,"success",n),this._session=new N(v,this._callPlusClient,this._channelId,this._targetId,f,p,this._context,this._logger,{callPushConfig:this._callPushConfig,hangupPushConfig:this._hangupPushConfig}),this._session.on(O.INNER_ON_SELF_HANGUP,function(){D._isSelfHangup=!0}),[2,{code:exports.RCCallErrorCode.SUCCESS,session:this._session}])}})})}}),Object.defineProperty(l.prototype,"call",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.targetId,l=e.mediaType,o=void 0===l?exports.RCCallMediaType.AUDIO:l,a=e.listener,s=e.constraints,i=e.channelId,_=void 0===i?"":i,C=e.extra,E=void 0===C?"":C,R=e.bitrate;return n(this,void 0,void 0,function(){return r(this,function(e){return[2,this.__startCall(!0,{targetId:t,userIds:[],mediaType:o,listener:a,constraints:s,channelId:_,extra:E,bitrate:R})]})})}}),Object.defineProperty(l.prototype,"callInGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.targetId,l=e.userIds,o=e.mediaType,a=void 0===o?exports.RCCallMediaType.AUDIO:o,s=e.listener,i=e.constraints,_=e.channelId,C=void 0===_?"":_,E=e.extra,R=void 0===E?"":E,u=e.bitrate;return n(this,void 0,void 0,function(){return r(this,function(e){return[2,this.__startCall(!1,{targetId:t,userIds:l,mediaType:a,listener:s,constraints:i,channelId:C,extra:R,bitrate:u})]})})}}),Object.defineProperty(l.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,function(){var t,l,n;return r(this,function(r){switch(r.label){case 0:return[4,this._context.getRTCJoinedUserInfo(this._context.getCurrentId())];case 1:return t=r.sent(),l=t.code,n=t.data,l!==e.ErrorCode.SUCCESS?(this._logger.error(u.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E,l),[2,{code:exports.RCCallErrorCode.QUERY_JOINED_USER_INFO_ERROR}]):[2,{code:exports.RCCallErrorCode.SUCCESS,data:n}]}})})}}),Object.defineProperty(l.prototype,"setPushConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this._logger.info(u.L_CALL_CLIENT_SET_PUSH_CONFIG_O,JSON.stringify({callPushConfig:e,hangupPushConfig:t})),this._callPushConfig=e,this._hangupPushConfig=t,delete this._callPushConfig.pushContent,delete this._hangupPushConfig.pushContent}}),l}();(S=exports.RCCallLanguage||(exports.RCCallLanguage={})).ZH="zh",S.EN="en",e.VersionManage.add("callpluswrapper","2.24.0");var T={tag:"CallPlusWrapper",verify:function(e){return"browser"===e.tag},setup:function(t,l,n){var r=t.createLogger("CWrapper","RTC"),o=e.isUndefined(n.logOutputLevel)?e.LogL.WARN:n.logOutputLevel;return r.setOutputLevel(o),r.warn(u.L_CALL_PLUS_WRAPPER_INIT_O,"CallPlus Version: ".concat("2.24.0",", Commit: ").concat("5f224140da330e67dad7c51921b244ec674211bc")),new p(t,r,n)}};exports.RCCallClient=p,exports.RCCallSession=N,exports.installer=T;