@rongcloud/plugin-call-plus 2.1.4 → 2.1.5-alpha.1
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/index.d.ts +3523 -0
- package/index.js +1 -0
- package/package.json +5 -2
- package/wrapper/index.esm.js +1 -1
- package/wrapper/index.js +1 -1
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@rongcloud/engine"),t=require("@rongcloud/plugin-rtc"),r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)};function i(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}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},n.apply(this,arguments)};function a(e,t,r,i){return new(r||(r=Promise))((function(n,a){function o(e){try{_(i.next(e))}catch(e){a(e)}}function l(e){try{_(i.throw(e))}catch(e){a(e)}}function _(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,l)}_((i=i.apply(e,t||[])).next())}))}function o(e,t){var r,i,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(_){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,i&&(n=2&l[0]?i.return:l[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,l[1])).done)return n;switch(i=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,i=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){o.label=l[1];break}if(6===l[0]&&o.label<n[1]){o.label=n[1],n=l;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(l);break}n[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],i=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,_])}}}function l(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}function _(e,t,r){if(r||2===arguments.length)for(var i,n=0,a=t.length;n<a;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var s,c={SUCCESS:0,PARAM_ERROR:80001,SESSION_EXIST:80002,NOT_IN_CALL:80003,MEDIATYPE_INVALID:80004,NOT_VIDEO_CALL:80005,RTC_SERVICE_UNAVAILABLE:80006,USER_LIST_INVAILD:80007,CALL_ID_INVALID:80008,TRANSACTION_ID_INVALID:80009,USER_ID_INVALID:80010,SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON:80011,SIGNAL_DISCONNECTED:80012,CAMERA_CLOSED:80100,MICROPHONE_CLOSED:80101,MEDIA_RESOURCE_INVALIED:80102,NOT_INSTALL_RTC_PLUGIN:80103,PLAY_MEDIA_FAILED:80104,VIDEO_VIEW_NOT_SET:80105};!function(e){e.L_INDEX_INSTALL_CALL_PLUS_PLUGIN_O="L-index_install_call_plus_plugin-O",e.L_CALLPLUS_CLIENT_SET_EVENT_LISTENER_O="L-callplus_client_set_event_listener-O",e.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O="L-callplus_client_call_event_listener-O",e.L_CALLPLUS_CLIENT_SET_STATUS_REPORT_LISTENER_O="L-callplus_client_set_status_report_listener-O",e.L_CALLPLUS_CLIENT_CALL_STATUS_REPORT_LISTENER_O="L-callplus_client_call_status_report_listener-O",e.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_T="L-callplus_client_set_video_config-T",e.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R="L-callplus_client_set_video_config-R",e.L_CALLPLUS_VIDEO_CONFIG_SET_FRAME_RATE_O="L-callplus_video_config_set_frame_rate-O",e.L_CALLPLUS_VIDEO_CONFIG_SET_RESOLUTION_O="L-callplus_video_config_set_resolution-O",e.L_CALLPLUS_VIDEO_CONFIG_SET_BITRATE_O="L-callplus_video_config_set_bitrate-O",e.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_T="L-callplus_client_set_audio_config-T",e.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R="L-callplus_client_set_audio_config-R",e.L_CALLPLUS_AUDIO_CONFIG_SET_BITRATE_O="L-callplus_audio_config_set_bitrate-O",e.L_CALLPLUS_AUDIO_CONFIG_SET_SAMPLE_RATE_O="L-callplus_audio_config_set_sample_rate-O",e.L_CALLPLUS_CLIENT_PREVIEW_T="L-callplus_client_preview-T",e.L_CALLPLUS_CLIENT_PREVIEW_R="L-callplus_client_preview-R",e.L_CALLPLUS_CLIENT_START_CALL_T="L-callplus_client_start_call-T",e.L_CALLPLUS_CLIENT_START_CALL_R="L-callplus_client_start_call-R",e.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_T="L-callplus_client_join_multi_call-T",e.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R="L-callplus_client_join_multi_call-R",e.L_CALLPLUS_CLIENT_ACCEPT_T="L-callplus_client_accept-T",e.L_CALLPLUS_CLIENT_ACCEPT_R="L-callplus_client_accept-R",e.L_CALLPLUS_CLIENT_HANGUP_T="L-callplus_client_hangup-T",e.L_CALLPLUS_CLIENT_HANGUP_R="L-callplus_client_hangup-R",e.L_CALLPLUS_CLIENT_INVITE_T="L-callplus_client_invite-T",e.L_CALLPLUS_CLIENT_INVITE_R="L-callplus_client_invite-R",e.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_T="L-callplus_client_request_change_media_type-T",e.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R="L-callplus_client_request_change_media_type-R",e.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_T="L-callplus_client_cancel_change_media_type-T",e.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R="L-callplus_client_cancel_change_media_type-R",e.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_T="L-callplus_client_reply_change_media_type-T",e.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R="L-callplus_client_reply_change_media_type-R",e.L_CALLPLUS_CLIENT_GET_CURRENT_CALL_SESSION_T="L-callplus_client_get_current_call_session-T",e.L_CALLPLUS_CLIENT_GET_CURRENT_CALL_SESSION_R="L-callplus_client_get_current_call_session-R",e.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_T="L-callplus_client_get_available_call_sessions_from_server-T",e.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_R="L-callplus_client_get_available_call_sessions_from_server-R",e.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_T="L-callplus_client_get_call_records-T",e.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R="L-callplus_client_get_call_records-R",e.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_T="L-callplus_client_delete_call_records_by_callId-T",e.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R="L-callplus_client_delete_call_records_by_callId-R",e.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_T="L-callplus_client_delete_all_call_records_from_server-T",e.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_R="L-callplus_client_delete_all_call_records_from_server-R",e.L_CALLPLUS_CLIENT_START_CAMERA_T="L-callplus_client_start_camera-T",e.L_CALLPLUS_CLIENT_START_CAMERA_R="L-callplus_client_start_camera-R",e.L_CALLPLUS_CLIENT_STOP_CAMERA_T="L-callplus_client_stop_camera-T",e.L_CALLPLUS_CLIENT_STOP_CAMERA_R="L-callplus_client_stop_camera-R",e.L_CALLPLUS_CLIENT_SWITCH_CAMERA_T="L-callplus_client_switch_camera-T",e.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R="L-callplus_client_switch_camera-R",e.L_CALLPLUS_CLIENT_START_MICROPHONE_T="L-callplus_client_start_microphone-T",e.L_CALLPLUS_CLIENT_START_MICROPHONE_R="L-callplus_client_start_microphone-R",e.L_CALLPLUS_CLIENT_STOP_MICROPHONE_T="L-callplus_client_stop_microphone-T",e.L_CALLPLUS_CLIENT_STOP_MICROPHONE_R="L-callplus_client_stop_microphone-R",e.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_T="L-callplus_client_switch_microphone-T",e.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R="L-callplus_client_switch_microphone-R",e.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_T="L-callplus_client_set_video_view-T",e.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R="L-callplus_client_set_video_view-R",e.L_RTC_MODULE_SET_VIDEO_VIEW_O="L-rtc_module_set_video_view-O",e.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_T="L-callplus_client_remove_video_view-T",e.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_R="L-callplus_client_remove_video_view-R",e.L_RTC_MODULE_REMOVE_VIDEO_VIEW_O="L-rtc_module_remove_video_view-O",e.L_CALLPLUS_CLIENT_PLAY_MEDIA_T="L-callplus_client_play_media-T",e.L_CALLPLUS_CLIENT_PLAY_MEDIA_R="L-callplus_client_play_media-R",e.L_RTC_MODULE_PLAY_MEDIA_T="L-rtc_module_play_media-T",e.L_RTC_MODULE_PLAY_MEDIA_R="L-rtc_module_play_media-R",e.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_T="L-rtc_module_set_all_remote_audio_enbale-T",e.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_R="L-rtc_module_set_all_remote_audio_enable-R",e.L_RTC_MODULE_SUBSCRIBE_T="L-rtc_module_subscribe-T",e.L_RTC_MODULE_SUBSCRIBE_R="L-rtc_module_subscribe-R",e.L_RTC_MODULE_UNSUBSCRIBE_T="L-rtc_module_unsubscribe-T",e.L_RTC_MODULE_UNSUBSCRIBE_R="L-rtc_module_unsubscribe-R",e.L_RTC_MODULE_PUBLISH_T="L-rtc_module_publish-T",e.L_RTC_MODULE_PUBLISH_R="L-rtc_module_publish-R",e.L_RTC_MODULE_UNPUBLISH_T="L-rtc_module_unpublish-T",e.L_RTC_MODULE_UNPUBLISH_R="L-rtc_module_unpublish-R",e.L_RTC_MODULE_DESTROY_ALL_TRACKS_O="L-rtc_module_destroy_all_tracks-O",e.L_RTC_MODULE_SESSION_CONNECT_T="L-rtc_module_session_connect-T",e.L_RTC_MODULE_SESSION_CONNECT_P="L-rtc_module_session_connect-P",e.L_RTC_MODULE_SESSION_CONNECT_R="L-rtc_module_session_connect-R",e.L_RTC_MODULE_SESSION_CLOSE_T="L-rtc_module_session_close-T",e.L_RTC_MODULE_SESSION_CLOSE_P="L-rtc_module_session_close-P",e.L_RTC_MODULE_SESSION_CLOSE_R="L-rtc_module_session_close-R",e.L_RTC_MODULE_CREATE_VIDEO_TRACK_T="L-rtc_module_create_video_track-T",e.L_RTC_MODULE_CREATE_VIDEO_TRACK_R="L-rtc_module_create_video_track-R",e.L_RTC_MODULE_CREATE_AUDIO_TRACK_T="L-rtc_module_create_audio_track-T",e.L_RTC_MODULE_CREATE_AUDIO_TRACK_R="L-rtc_module_create_audio_track-R",e.L_RTC_MODULE_RECEIVE_TRACK_PUBLISH_O="L-rtc_module_receive_track_publish-O",e.L_RTC_MODULE_RECEIVE_TRACK_UNPUBLISH_O="L-rtc_module_receive_track_unpublish-O",e.L_RTC_MODULE_RECEIVE_TRACK_ENABLE_CHANGE_O="L-rtc_module_receive_track_enable_change-O",e.L_RTC_MODULE_RECEIVE_KICK_OFF_O="L-rtc_module_receive_kick_off-O",e.L_RTC_MODULE_RECEIVE_PEERCONNECTION_EXCEPT_CLOSE_O="L-rtc_module_receive_peerconnection_except_close-O",e.L_RTC_MODULE_CHANGE_MEDIA_TYPE_T="L-rtc_module_change_media_type-T",e.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R="L-rtc_module_change_media_type-R",e.L_RTC_MODULE_JOIN_RTC_ROOM_T="L-rtc_module_join_rtc_room-T",e.L_RTC_MODULE_JOIN_RTC_ROOM_R="L-rtc_module_join_rtc_room-R",e.L_RTC_MODULE_QUIT_RTC_ROOM_T="L-rtc_module_quit_rtc_room-T",e.L_RTC_MODULE_QUIT_RTC_ROOM_R="L-rtc_module_quit_rtc_room-R",e.L_RTC_MODULE_CREATE_CALL_MEDIA_TRACKS_P="L-rtc_module_create_call_media_tracks-P",e.L_SIGNAL_TRANSPORTER_SINGLE_CALL_T="L-signal_transporter_single_call-T",e.L_SIGNAL_TRANSPORTER_GROUP_CALL_T="L-signal_transporter_group_call-T",e.L_SIGNAL_TRANSPORTER_INVITE_T="L-signal_transporter_invite-T",e.L_SIGNAL_TRANSPORTER_RING_T="L-signal_transporter_ring-T",e.L_SIGNAL_TRANSPORTER_ACCEPT_T="L-signal_transporter_accept-T",e.L_SIGNAL_TRANSPORTER_ACCEPT_R="L-signal_transporter_accept-R",e.L_SIGNAL_TRANSPORTER_JOIN_CALL_T="L-signal_transporter_join_call-T",e.L_SIGNAL_TRANSPORTER_HANGUP_T="L-signal_transporter_hangup-T",e.L_SIGNAL_TRANSPORTER_CALL_STATUS_UP_T="L-signal_transporter_call_status_up-T",e.L_SIGNAL_TRANSPORTER_CALL_EVENT_UP_T="L-signal_transporter_call_event_up-T",e.L_SIGNAL_TRANSPORTER_CALL_DIALOG_UP_T="L-signal_transporter_call_dialog_up-T",e.L_SIGNAL_TRANSPORTER_DELETE_CALL_RECORD_T="L-signal_transporter_delete_call_record-T",e.L_SIGNAL_TRANSPORTER_GET_CALL_RECORD_T="L-signal_transporter_get_call_record-T",e.L_SIGNAL_TRANSPORTER_GET_CALL_SERVER_TIME_T="L-signal_transporter_get_call_server_time-T",e.L_SIGNAL_TRANSPORTER_GET_CALL_TIME_INFO_T="L-signal_transporter_get_call_time_info-T",e.L_SIGNAL_TRANSPORTER_GET_AVAILABLE_CALL_LIST_T="L-signal_transporter_get_available_call_list-T",e.L_SIGNAL_TRANSPORTER_CLEAR_CALL_RECORD_T="L-signal_transporter_clear_call_record-T",e.L_SIGNAL_TRANSPORTER_GET_CALL_INFO_BY_CALLID_T="L-signal_transporter_get_call_info_by_callId-T",e.L_SIGNAL_TRANSPORTER_USER_SYSTEM_STATE_UP_T="L-signal_transporter_user_system_state_up-T",e.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_SIGNAL_DATA_O="L-signal_transporter_receive_call_signal_data-O",e.L_SIGNAL_TRANSPORTER_IM_STATE_CHANGE_O="L-signal_transporter_im_state_change-O",e.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O="L-signal_transporter_receive_invite-O",e.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_STATUS_O="L-signal_transporter_receive_call_status-O",e.L_SIGNAL_TRANSPORTER_RECEIVE_MISS_MESSAGE_O="L-signal_transporter_receive_miss_message-O",e.L_CALL_ENGINE_UPDATE_USERS_STATE_O="L-call_engine_update_users_state-O",e.L_CALL_ENGINE_IM_STATE_CHANGE_O="L-call_engine_im_state_change-O",e.L_CALL_ENGINE_CALL_TIMEOUT_O="L-call_engine_call_timeout-O",e.L_CALL_ENGINE_START_CALL_TIMER_O="L-call_engine_start_call_timer-O",e.L_CALL_ENGINE_STOP_CALL_TIMER_O="L-call_engine_stop_call_timer-O",e.L_CALL_ENGINE_UP_ON_PHONE_END_T="L-call_engine_up_on_phone_end-T",e.L_CALL_ENGINE_UP_ON_PHONE_END_R="L-call_engine_up_on_phone_end-R",e.L_CALL_ENGINE_RECEIVE_FIRST_FRAME_TIME_O="L-call_engine_receive_first_frame_time-O",e.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O="L-call_engine_receive_mediatype_change-O",e.L_CALL_ENGINE_RECEIVE_CLOSE_SESSION_O="L-call_engine_receive_close_session-O",e.L_CALL_ENGINE_RECEIVE_CALL_RECORD_O="L-call_engine_receive_call_record-O",e.L_CALL_ENGINE_RECEIVE_COMPLEMENTARY_DATA_O="L-call_engine_receive_complementary_data-O",e.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_T="L-call_engine_create_session_by_server-T",e.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_R="L-call_engine_create_session_by_server-R",e.L_CALL_ENGINE_UP_FIRST_FRAME_TIME_T="L-call_engine_up_first_frame_time-T",e.L_CALL_ENGINE_UP_FIRST_FRAME_TIME_R="L-call_engine_up_first_frame_time-R",e.L_TIME_CORRECT_START_O="L-time_correct_start-O",e.L_TIME_CORRECT_STOP_O="L-time_correct_stop-O",e.L_TIME_CORRECT_RESTART_O="L-time_correct_restart-O",e.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_T="L-time_correct_get_call_client_time_by_server-T",e.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_P="L-time_correct_get_call_client_time_by_server-P",e.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R="L-time_correct_get_call_client_time_by_server-R",e.L_TIME_CORRECT_CALC_CLIENT_START_TIME_T="L-time_correct_calc_client_start_time-T",e.L_TIME_CORRECT_CALC_CLIENT_START_TIME_R="L-time_correct_calc_client_start_time-R",e.L_TIME_CORRECT_SET_DELTA_TIME_O="L-time_correct_set_delta_time-O",e.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_T="L-time_correct_loop_correct_client_time-T",e.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_R="L-time_correct_loop_correct_client_time-R",e.L_INNER_SESSION_UPDATE_USER_STATE_O="L-inner_session_update_user_state-O",e.L_INNER_SESSION_SET_USER_DEVICE_ENABLE_O="L-inner_session_set_user_device_enable-O",e.L_CALLPLUS_SESSION_GET_CREATE_TIME_T="L-callplus_session_get_create_time-T",e.L_CALLPLUS_SESSION_GET_CREATE_TIME_R="L-callplus_session_get_create_time-R",e.L_CALLPLUS_SESSION_GET_DURATION_T="L-callplus_session_get_duration-T",e.L_CALLPLUS_SESSION_GET_DURATION_R="L-callplus_session_get_duration-R",e.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O="L-callplus_set_android_push_config-O",e.L_ABNORMAL_ADD_CALL_ID_E="L-ABNORMAL_ADD_CALL_ID-E",e.L_ABNORMAL_REMOVE_CALL_IDS_E="L-ABNORMAL_REMOVE_CALL_IDS-E",e.L_ABNORMAL_GET_CALL_IDS_E="L-ABNORMAL_GET_CALL_IDS-E"}(s||(s={}));var u,C,d,L,E,T,S=function(){function e(e,t,r){Object.defineProperty(this,"_session",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_startTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_duration",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:""}),this._callId=this._session.getCallId()}return Object.defineProperty(e.prototype,"getCallId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(e.prototype,"getState",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getSessionState()}}),Object.defineProperty(e.prototype,"getCallType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getCallType()}}),Object.defineProperty(e.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getMediaType()}}),Object.defineProperty(e.prototype,"getUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getUserList().map((function(e){return{userId:e.userId,state:e.userState,cameraEnable:e.cameraEnable,microphoneEnable:e.microphoneEnable}}))}}),Object.defineProperty(e.prototype,"getCreatorUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getStartCallerId()}}),Object.defineProperty(e.prototype,"getInviterUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getCallerId()}}),Object.defineProperty(e.prototype,"getCreateTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,t,r,i;return o(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_SESSION_GET_CREATE_TIME_T,"",e),this._startTime?[2,{code:c.SUCCESS,startTime:this._startTime}]:[4,this._callEngine.getCallStaringTime({callId:this._callId},e)];case 1:return t=n.sent(),r=t.code,i=t.clientStartTime,r!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_SESSION_GET_CREATE_TIME_R,"errCode: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_SESSION_GET_CREATE_TIME_R,"success",e),this._startTime=i,[2,{code:c.SUCCESS,startTime:this._startTime}])}}))}))}}),Object.defineProperty(e.prototype,"getDuration",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,t,r,i;return o(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_SESSION_GET_DURATION_T,"",e),this._duration?(this._logger.info(s.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(c.SUCCESS,", duration: ").concat(this._duration),e),[2,{code:c.SUCCESS,duration:this._duration}]):[4,this._callEngine.getCallTimeInfo(this._callId,e)];case 1:return t=n.sent(),r=t.code,i=t.data,r!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(c.SUCCESS,", duration: ").concat(i.duration),e),this._duration=i.duration,[2,{code:c.SUCCESS,duration:this._duration}])}}))}))}}),e}();exports.RCCallPlusType=void 0,(u=exports.RCCallPlusType||(exports.RCCallPlusType={}))[u.SINGLE=0]="SINGLE",u[u.MULTI=1]="MULTI",exports.RCCallPlusSessionUserState=void 0,(C=exports.RCCallPlusSessionUserState||(exports.RCCallPlusSessionUserState={}))[C.IDLE=0]="IDLE",C[C.CALLING=100]="CALLING",C[C.INVITED=101]="INVITED",C[C.RINGING=102]="RINGING",C[C.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",C[C.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",C[C.CONNECTING=200]="CONNECTING",C[C.ONCALL=300]="ONCALL",C[C.ONPHONE=301]="ONPHONE",C[C.ENDED=1e3]="ENDED",C[C.NO_ANSWER=1001]="NO_ANSWER",C[C.MISSED=1002]="MISSED",C[C.CANCELLED=1003]="CANCELLED",C[C.DECLINED=1004]="DECLINED",C[C.ERROR=2e3]="ERROR",exports.RCCallPlusMediaType=void 0,(d=exports.RCCallPlusMediaType||(exports.RCCallPlusMediaType={}))[d.AUDIO=0]="AUDIO",d[d.AUDIO_VIDEO=1]="AUDIO_VIDEO",d[d.VIDEO=2]="VIDEO",exports.RCCallPlusCallState=void 0,(L=exports.RCCallPlusCallState||(exports.RCCallPlusCallState={}))[L.IDLE=0]="IDLE",L[L.CALLING=100]="CALLING",L[L.INVITED=101]="INVITED",L[L.RINGING=102]="RINGING",L[L.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",L[L.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",L[L.CONNECTING=200]="CONNECTING",L[L.ONCALL=300]="ONCALL",L[L.ENDED=1e3]="ENDED",L[L.NOANSWER=1001]="NOANSWER",L[L.MISSED=1002]="MISSED",L[L.CANCELED=1003]="CANCELED",L[L.DECLINED=1004]="DECLINED",L[L.ERROR=2e3]="ERROR",exports.RCCallPlusMediaTypeChangeResult=void 0,(E=exports.RCCallPlusMediaTypeChangeResult||(exports.RCCallPlusMediaTypeChangeResult={}))[E.CANCEL_CHANGE_MEDIA_TYPE=0]="CANCEL_CHANGE_MEDIA_TYPE",E[E.REFUSE_CHANGE_MEDIA_TYPE=1]="REFUSE_CHANGE_MEDIA_TYPE",E[E.SERVER_ALLOW_MEDIA_TYPE=2]="SERVER_ALLOW_MEDIA_TYPE",E[E.CHANGE_MEDIA_TYPE_TIMEOUT=3]="CHANGE_MEDIA_TYPE_TIMEOUT",exports.RCCallPlusReason=void 0,(T=exports.RCCallPlusReason||(exports.RCCallPlusReason={}))[T.IDLE=0]="IDLE",T[T.CALLING=100]="CALLING",T[T.INVITED=101]="INVITED",T[T.RINGING=102]="RINGING",T[T.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",T[T.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",T[T.CONNECTING=200]="CONNECTING",T[T.ONCALL=300]="ONCALL",T[T.ON_PHONE=301]="ON_PHONE",T[T.ON_PHONE_END=302]="ON_PHONE_END",T[T.ON_DEVICE_DISABLE=303]="ON_DEVICE_DISABLE",T[T.ON_DEVICE_ENABLE=304]="ON_DEVICE_ENABLE",T[T.ABNORMAL_END=999]="ABNORMAL_END",T[T.ENDED=1e3]="ENDED",T[T.NO_ANSWER=1001]="NO_ANSWER",T[T.MISSED=1002]="MISSED",T[T.CANCELLED=1003]="CANCELLED",T[T.DECLINED=1004]="DECLINED",T[T.OTHER_CLIENT_CALLING=1010]="OTHER_CLIENT_CALLING",T[T.OTHER_CLIENT_ACCEPT=1011]="OTHER_CLIENT_ACCEPT",T[T.JOIN_ROOM_ERR=1105]="JOIN_ROOM_ERR",T[T.PUBLISH_ERR=1106]="PUBLISH_ERR",T[T.SUBSCRIBE_ERR=1107]="SUBSCRIBE_ERR",T[T.ACCEPT_CARRIER=1108]="ACCEPT_CARRIER",T[T.KICKED_BY_SERVER=1109]="KICKED_BY_SERVER",T[T.CONNECTION_ERR=1110]="CONNECTION_ERR",T[T.LOGOUT=1111]="LOGOUT",T[T.OTHER_CLIENT_LOGIN=1112]="OTHER_CLIENT_LOGIN",T[T.OTHER_CLIENT_JOINED=1113]="OTHER_CLIENT_JOINED",T[T.OTHER_CLIENT_IN_ROOM=1114]="OTHER_CLIENT_IN_ROOM",T[T.OTHER_CLIENT_HANGUP=1151]="OTHER_CLIENT_HANGUP",T[T.REMOTE_JOIN_RTC_ERROR=1205]="REMOTE_JOIN_RTC_ERROR",T[T.REMOTE_PUBLISH_ERROR=1206]="REMOTE_PUBLISH_ERROR",T[T.REMOTE_SUBSCRIBE_ERROR=1207]="REMOTE_SUBSCRIBE_ERROR",T[T.REMOTE_KICKED_BY_SERVER=1209]="REMOTE_KICKED_BY_SERVER",T[T.REMOTE_CONNECTION_ERROR=1210]="REMOTE_CONNECTION_ERROR",T[T.REMOTE_LOGOUT=1211]="REMOTE_LOGOUT",T[T.REMOTE_OTHER_CLIENT_LOGIN=1212]="REMOTE_OTHER_CLIENT_LOGIN",T[T.REMOTE_OTHER_JOINED_RTC=1213]="REMOTE_OTHER_JOINED_RTC",T[T.REMOTE_OTHER_CLIENT_IN_RTC=1214]="REMOTE_OTHER_CLIENT_IN_RTC";var I,g=function(){function t(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_audioConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(t.prototype,"setDefaultMicrophoneId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._audioConfig.microphoneId=e,this}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return!e.isNumber(t)||!e.isNumber(r)||r<=0||t<=0||r<t?(this._logger.error(s.L_CALLPLUS_AUDIO_CONFIG_SET_BITRATE_O,"params error -> max: ".concat(r,",min: ").concat(t,", max and min is a number > 0, max should > min")),this):(this._audioConfig.minBitrate=t,this._audioConfig.maxBitrate=r,this)}}),Object.defineProperty(t.prototype,"setSampleRate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isNumber(t)?(this._audioConfig.sampleRate=t,this):(this._logger.error(s.L_CALLPLUS_AUDIO_CONFIG_SET_SAMPLE_RATE_O,"params error -> sampleRate: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._audioConfig}}),t}(),p=function(){function r(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_videoConfig",{enumerable:!0,configurable:!0,writable:!0,value:{resolution:t.RCResolution.W640_H480,frameRate:t.RCFrameRate.FPS_15}})}return Object.defineProperty(r.prototype,"setFrameRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return t.RCFrameRate[e]?(this._videoConfig.frameRate=e,this):(this._logger.error(s.L_CALLPLUS_VIDEO_CONFIG_SET_FRAME_RATE_O,"params error -> fps: ".concat(e)),this)}}),Object.defineProperty(r.prototype,"setVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return t.RCResolution[e]?(this._videoConfig.resolution=e,this):(this._logger.error(s.L_CALLPLUS_VIDEO_CONFIG_SET_RESOLUTION_O,"params error -> resolution: ".concat(e)),this)}}),Object.defineProperty(r.prototype,"setDefaultCameraId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._videoConfig.cameraId=e,this}}),Object.defineProperty(r.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return!e.isNumber(t)||!e.isNumber(r)||r<=0||t<=0||r<t?(this._logger.error(s.L_CALLPLUS_VIDEO_CONFIG_SET_BITRATE_O,"params error -> max: ".concat(r,",min: ").concat(t,", max and min is a number > 0, max should > min")),this):(this._videoConfig.minBitrate=t,this._videoConfig.maxBitrate=r,this)}}),Object.defineProperty(r.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._videoConfig}}),r}(),R=function(e){return{callId:e.callId,callType:e.callType,callDirection:e.callDir,mediaType:e.mediaType,callerUserId:e.callingUserId,callUserIds:e.callUserIds,sessionState:e.callStatus,userState:e.sessionStatus,startTimestamp:e.startTime,endTimestamp:e.endTime,duration:e.duration,syncTimestamp:e.syncTime,systemState:e.sysStatus,createTimestamp:e.crtTime}},f=function(e){var t=e.voipCallInfo;return!!t&&1===JSON.parse(t).strategy},h=function(t,r){return!t&&0!==t||e.isNumber(t)&&!(t<=0)?!r&&0!==r||e.isNumber(r)&&!(r<=0)?t&&r&&r<t?{code:c.PARAM_ERROR,errorMsg:"params error -> maxBitrate: ".concat(r,", minBitrate: ").concat(t,", maxBitrate should > minBitrate")}:{code:c.SUCCESS}:{code:c.PARAM_ERROR,errorMsg:"params error -> maxBitrate: a number of > 0, value: ".concat(r)}:{code:c.PARAM_ERROR,errorMsg:"params error -> minBitrate: a number of > 0, value: ".concat(t)}},b=function(e){var t=[];for(var r in e){var i=e[r],n=i.videoView,a=i.isTiny;t.push({userId:r,videoView:n.nodeName,isTiny:a})}return t},O=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r={});var i=t.threadId,n=t.apnsCollapseId,a=t.richMediaUri,o=r.channelIdMi,l=r.channelIdHW,_=r.channelIdOPPO,s=r.typeVivo,c=r.fcmChannelId,u=r.fcmCollapseKey,C=r.fcmImageUrl,d=r.importanceHW,L=r.categoryHW,E=r.imageUrlHW,T=r.categoryVivo,S=r.importanceHonor,I=r.imageUrlHonor,g={};i&&(g["thread-id"]=i),g["apns-collapse-id"]=n||e,a&&(g.richMediaUri=a);var p={};l&&(p.channelId=l),E&&(p.image=E),L&&(p.category=L),p.importance=d||"NORMAL";var R,f,h,b,O=[{HW:p},{APNS:g}];return(u||C||c)&&(R={},u&&(R.collapse_key=u),C&&(R.imageUrl=C),c&&(R.channelId=c),O[0].FCM=R),o&&(O[0].MI={channelId:o}),_&&((f={}).channelId=_,O[0].OPPO=f),(s||T)&&(h={},s&&(h.classification=s),T&&(h.category=T),O[0].VIVO=h),(S||I)&&(b={},S&&(b.importance=S),I&&(b.image=I),O[0].HONOR=b),JSON.stringify(O)},A=function(t,r){var i=t.pushTitle,n=void 0===i?"":i,a=t.iOSConfig,o=t.androidConfig,l=t.disablePushTitle,_=t.templateId,s={pushConfigs:O(r,a,o)};return e.isBoolean(l)&&(s.disableTitle=l),n&&(s.title=n),_&&(s.templateId=_),JSON.stringify(s)},N=function(t){var r=["pushTitle","iOSConfig","androidConfig","disablePushTitle","templateId"],i=Object.keys(t).every((function(e){return r.includes(e)}));if(!i)return{code:c.PARAM_ERROR,errorMsg:"right key: ".concat(r.join(","))};for(var n=0;n<r.length;n++){var a=r[n];if("disablePushTitle"===a){if(!e.isUndefined(t[a])&&!e.isBoolean(t[a]))return{code:c.PARAM_ERROR,errorMsg:"".concat(a," type is boolean")}}else if(("pushTitle"===a||"templateId"===a)&&t[a]&&!e.isString(t[a]))return{code:c.PARAM_ERROR,errorMsg:"".concat(a," type is string")}}var o=t.iOSConfig,l=t.androidConfig,_=m(o||{});if(_.code!==c.SUCCESS)return _;var s=v(l||{});return s.code!==c.SUCCESS?s:{code:c.SUCCESS}},m=function(t){var r=t||{},i=r.threadId,n=r.richMediaUri;return i&&!e.isString(i)?{code:c.PARAM_ERROR,errorMsg:"iOSConfig.threadId type is string"}:n&&!e.isString(n)?{code:c.PARAM_ERROR,errorMsg:"iOSConfig.richMediaUri type is string"}:{code:c.SUCCESS}},v=function(t){var r=["channelIdMi","channelIdHW","categoryHW","importanceHW","imageUrlHW","channelIdOPPO","typeVivo","categoryVivo","fcmChannelId","fcmCollapseKey","fcmImageUrl","importanceHonor","imageUrlHonor"],i=Object.keys(t).every((function(e){return r.includes(e)}));if(!i)return{code:c.PARAM_ERROR,errorMsg:"right key: ".concat(r.join(","))};for(var n=0;n<r.length;n++){var a=r[n];if("importanceHW"===a||"importanceHonor"===a){if(t[a]&&"LOW"!==t[a]&&"NORMAL"!==t[a])return{code:c.PARAM_ERROR,errorMsg:"androidConfig.".concat(a," value is NORMAL|LOW")}}else if(t[a]&&!e.isString(t[a]))return{code:c.PARAM_ERROR,errorMsg:"androidConfig.".concat(a," type is string")}}return{code:c.SUCCESS}},P=function(e,t){void 0===t&&(t="utf-8");return"utf-16"===t?y(e):U(e)},y=function(e){for(var t=0,r=0,i=e.length;r<i;r++)t+=e.charCodeAt(r)<=65535?2:4;return t},U=function(e){for(var t,r=0,i=0,n=e.length;i<n;i++)r+=(t=e.charCodeAt(i))<127?1:t<=2047?2:t<=65535?3:4;return r};!function(e){e.L_QS_START_CALL_S="Call-start-S",e.L_QS_ACCEPT_CALL_S="Call-accept-S",e.L_QS_HANGUP_CALL_S="Call-hangup-S",e.L_QS_RECEIVE_CALL_S="Call-recv-S",e.L_QS_ABNORMAL_HANGUP_S="Call-interrupt-S"}(I||(I={}));var M,D,w,j,G=function(){function e(e,t){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t})}return Object.defineProperty(e.prototype,"reportStatisticsData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,a,o,l){var _=+new Date,s=i?{mediaType:i.getMediaType(),callType:i.getCallType(),callId:i.getCallId()}:l,c={cr:"unknown",net:"unknown",cod:t,mtp:s.mediaType,ctp:s.callType,cid:s.callId,time:_,uid:this._context.getCurrentId()};a&&Object.assign(c,{ccid:a});var u=null;switch(e){case I.L_QS_RECEIVE_CALL_S:u=n(n({},c),{rf:o});break;case I.L_QS_ABNORMAL_HANGUP_S:u=n({},c);break;default:u=n(n({},c),{dur:_-r})}this._logger.__statistics(e,JSON.stringify(u))}}),e}();!function(e){e.REQUEST="request",e.ACCEPT="accept",e.REFUSE="refuse",e.CANCEL="cancel",e.NOTICE="notice",e.TIMEOUT="timeout"}(M||(M={})),function(e){e[e.SWITCH_MEDIA_TYPE=1]="SWITCH_MEDIA_TYPE"}(D||(D={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.SECRET=1]="SECRET"}(w||(w={})),function(e){e.INVITER="inviter",e.INVITEE="invitee"}(j||(j={}));var V,x=function(e){function t(t,r,i,n,a,o,l,_){var s=e.call(this)||this;return Object.defineProperty(s,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"_state",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_callType",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_startCallerId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(s,"_callerId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"_callUsers",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(s,"_reqMediaType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_inviterTimerId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_inviteeTimerId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_oldDialogData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"isLocalClientHangup",{enumerable:!0,configurable:!0,writable:!0,value:!1}),s}return i(t,e),Object.defineProperty(t.prototype,"getCallId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(t.prototype,"getSessionState",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._state}}),Object.defineProperty(t.prototype,"getCallType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callType}}),Object.defineProperty(t.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mediaType}}),Object.defineProperty(t.prototype,"getStartCallerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._startCallerId}}),Object.defineProperty(t.prototype,"getCallerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callerId}}),Object.defineProperty(t.prototype,"getUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callUsers}}),Object.defineProperty(t.prototype,"getReqMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._reqMediaType}}),Object.defineProperty(t.prototype,"getInviterTimerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._inviterTimerId}}),Object.defineProperty(t.prototype,"getInviteeTimerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._inviteeTimerId}}),Object.defineProperty(t.prototype,"getAllTimerIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return[this._inviterTimerId,this._inviteeTimerId]}}),Object.defineProperty(t.prototype,"setUserDeviceEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){this._logger.info(s.L_INNER_SESSION_SET_USER_DEVICE_ENABLE_O,"userId: ".concat(e,", mediaType: ").concat(t,", enable: ").concat(r),i);var n=this._callUsers.find((function(t){return e===t.userId}));t===exports.RCCallPlusMediaType.AUDIO?n.microphoneEnable=r:n.cameraEnable=r}}),Object.defineProperty(t.prototype,"updateUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=[];return e.forEach((function(e){var t=e.userState,n=e.stateTime,a=e.systemState,o=e.userId,l=r._callUsers.findIndex((function(e){return e.userId===o}));if(l<0)return r._callUsers.push(e),void i.push(e);var _,s,c,u,C=r._callUsers[l],d=C.stateTime,L=C.systemState,E=C.userState,T=(_=L,s=a,c=!1,u=[exports.RCCallPlusReason.INVITED,exports.RCCallPlusReason.RINGING,exports.RCCallPlusReason.BUSYLINE_RINGING,exports.RCCallPlusReason.BUSYLINE_WAIT,exports.RCCallPlusReason.CONNECTING,exports.RCCallPlusReason.ONCALL],_===exports.RCCallPlusReason.ONCALL&&u.includes(s)&&(c=!0),c),S=function(e,t){var r=!1,i=[exports.RCCallPlusSessionUserState.INVITED,exports.RCCallPlusSessionUserState.RINGING,exports.RCCallPlusSessionUserState.BUSYLINE_RINGING,exports.RCCallPlusSessionUserState.BUSYLINE_WAIT,exports.RCCallPlusSessionUserState.CONNECTING,exports.RCCallPlusSessionUserState.ONCALL];return e===exports.RCCallPlusSessionUserState.ONCALL&&i.includes(t)&&(r=!0),r}(E,t),I=a===exports.RCCallPlusReason.ON_PHONE_END&&L!==exports.RCCallPlusReason.ON_PHONE&&t!==exports.RCCallPlusSessionUserState.IDLE;n&&d&&n<d||T&&S||(r._callUsers[l]=e,!I&&i.push(e))})),i}}),Object.defineProperty(t.prototype,"setOldDialogData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._oldDialogData=e}}),Object.defineProperty(t.prototype,"updateSessionState",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._state=e}}),Object.defineProperty(t.prototype,"updateCallType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callType=e}}),Object.defineProperty(t.prototype,"updateMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._mediaType=e}}),Object.defineProperty(t.prototype,"updateReqMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reqMediaType=e}}),Object.defineProperty(t.prototype,"updateTimerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e===j.INVITER?this._inviterTimerId=t:this._inviteeTimerId=t}}),Object.defineProperty(t.prototype,"getOldDialogData",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._oldDialogData}}),Object.defineProperty(t.prototype,"setIsLocalClientHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isLocalClientHangup=e}}),Object.defineProperty(t.prototype,"getIsLocalClientHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isLocalClientHangup}}),t}(e.EventEmitter);!function(e){e.START_SINGLE_CALL="startSingleCall",e.START_GROUP_CALL="startGroupCall",e.INVITE_CALL="inviteCall",e.PUB_INVITE_CALL="pubInviteCall",e.RINGING_CALL="ringCall",e.ACCEPT_CALL="acceptCall",e.JOIN_CALL="joinCall",e.HANGUP_CALL="hangupCall",e.STATUS_UP_CALL="statusUpCall",e.STATUS_DOWN_CALL="statusDownCall",e.EVENT_UP_CALL="eventUpCall",e.EVENT_DOWN_CALL="eventDownCall",e.DIALOG_UP_CALL="dialogUpCall",e.DIALOG_DOWN_CALL="dialogDownCall",e.GET_CALL_USER_SESSION_LIST="getCallUSerSessionList",e.SYNC_CALL_LOG="syncCallLog",e.PUB_CALL_LOG="pubCallLog",e.DEL_CALL_LOG="deleteCallLog",e.QRY_CALL_STATE="queryUserHasCall",e.QRY_SRV_TIMESTAMP="getCallSrvTimeStamp",e.GET_CALL_STATE_LIST="getUserCallStateList",e.CLEAR_CALL_LOG="cleanCallLog",e.GET_CALL_SESSION="getCallSession",e.GET_CALL_TIME_INFO="getCallTimeInfo",e.END_ABNORMAL_CALL="endUserAbnormalCalls",e.SYS_STATUS_UP="sysStatusUp",e.UP_CALL_LOG_READED="upCallLogReaded",e.PUB_CALL_LOG_READED="pubCallLogReaded",e.PUB_NACK_SEQ_ID="pubNACKSeqId",e.GET_USER_CALL_SESSION_ID_LIST="getUserCallSessionIdList"}(V||(V={}));var H,k,B,F=function(e,t){return setTimeout(e,t)},Y=[e.ErrorCode.RC_NET_CHANNEL_INVALID,e.ErrorCode.RC_NET_UNAVAILABLE,e.ErrorCode.RC_MSG_RESP_TIMEOUT,t.RCRTCCode.SIGNAL_DISCONNECTED,t.RCRTCCode.REQUEST_FAILED],J=function(e){var t=e.asyncFn,r=e.fnArgs,i=e.currentRetryTime,n=void 0===i?Date.now():i,s=e.maxDuration,u=void 0===s?6e4:s,C=e.intervals,d=void 0===C?[2e3,4e3,8e3,16e3,32e3,64e3]:C,L=e.index,E=void 0===L?0:L,T=e.onError;return a(void 0,void 0,void 0,(function(){var e;return o(this,(function(i){switch(i.label){case 0:return[4,t.apply(void 0,_([],l(r),!1))];case 1:return e=i.sent(),2e3,e.code===c.SUCCESS||!Y.includes(e.code)||Date.now()+2e3-n>u?[3,3]:(T&&T(e.code),[4,(a=2e3,new Promise((function(e){setTimeout(e,a)})))]);case 2:return i.sent(),[2,J({asyncFn:t,fnArgs:r,currentRetryTime:n,maxDuration:u,intervals:d,index:E,onError:T})];case 3:return[2,e]}var a}))}))};!function(e){e.onBeforePublish="onBeforePublish",e.onPublishRes="onPublishRes",e.onPubInviteCall="onPubInviteCall",e.onPubInviteCallPullKv="onPubInviteCallPullKv",e.onPubInviteCallMiss="onPubInviteCallMiss"}(H||(H={})),function(e){e.NOT_CURRENT_DEVICEID="not current device id",e.SECRET_CALL="secret call",e.NOT_INVITEE="not an invitee"}(k||(k={})),function(e){e.PUB_INVITE="pubinvitecall",e.PULL_KV_INVITE="pullkv_invitecall",e.PUSH="system_pubsh"}(B||(B={}));var W,K,Q=131072,q="RC:CallPlusMiss",X=function(t){function r(r,i,n,a,o,l){var _=t.call(this)||this;return Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(_,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_timeCorrectioner",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(_,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_needRetryActions",{enumerable:!0,configurable:!0,writable:!0,value:[V.START_SINGLE_CALL,V.START_GROUP_CALL,V.ACCEPT_CALL,V.JOIN_CALL,V.EVENT_UP_CALL]}),Object.defineProperty(_,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:""}),_._context.onCallInfo=_._onRecvCallSignal.bind(_),_._context.onconnectionstatechange=_._onIMConnectionStateChange.bind(_),_._context.onmessage=_._onMessage.bind(_),_._sessionId=e.getUUID22(),_}return i(r,t),Object.defineProperty(r.prototype,"_onMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if([q].includes(e.messageType)){var t=e.content,r=t.callId,i=t.mediaType,n=t.startTime,a=t.callSessionUsers,o=e.targetId,l=e.senderUserId,_=this._context.getCurrentId();if(!localStorage.getItem("missMessageMap-".concat(_,"-").concat(r))){var c={callId:r,callerUserId:l,targetId:o,mediaType:i,firstFrameTime:0,callStartTime:n-this._timeCorrectioner.getLocalDelayTime(),callEndTime:0,hangupReason:a.filter((function(e){return e.userId===_}))[0].sessionStatus};this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_MISS_MESSAGE_O,"receive miss message: ".concat(JSON.stringify(e)));var u=Object.assign(e,{content:JSON.stringify(c)});this._reportAppEventModule.onReceivedCallPlusSummaryMessage(u),localStorage.setItem("missMessageMap-".concat(_,"-").concat(r),r)}return!0}return!1}}),Object.defineProperty(r.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(r.prototype,"registerListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(r.prototype,"startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,n,a,l,_,s,c,u,C,d;return o(this,(function(o){return r=e.clientCallId,i=e.callType,n=e.toUsers,a=e.mediaType,l=e.secretChat,_=e.targetType,s=e.targetId,c=e.nickName,u=e.oldRoomId,C=e.pushExt,d=e.extra,i===exports.RCCallPlusType.SINGLE?[2,this.startSingleCall({clientCallId:r,toUserId:n[0].userId,mediaType:a,secretChat:l,targetType:_,targetId:s,oldRoomId:u,toOrgId:n[0].orgId||"",pushExt:C,extra:d},t)]:[2,this.startGroupCall({clientCallId:r,toUsers:n,mediaType:a,targetType:_,targetId:s,nickName:c,oldRoomId:u,pushExt:C,extra:d},t)]}))}))}}),Object.defineProperty(r.prototype,"startSingleCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_SINGLE_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(this._context.getCurrentId(),V.START_SINGLE_CALL,e)]}))}))}}),Object.defineProperty(r.prototype,"startGroupCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GROUP_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(this._context.getCurrentId(),V.START_GROUP_CALL,e)]}))}))}}),Object.defineProperty(r.prototype,"inviteCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_INVITE_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,V.INVITE_CALL,e)]}))}))}}),Object.defineProperty(r.prototype,"ringingCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_RING_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,V.RINGING_CALL,e)]}))}))}}),Object.defineProperty(r.prototype,"acceptCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_ACCEPT_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,V.ACCEPT_CALL,e)]}))}))}}),Object.defineProperty(r.prototype,"joinCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_JOIN_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,V.JOIN_CALL,e)]}))}))}}),Object.defineProperty(r.prototype,"hangupCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r;return o(this,(function(i){switch(i.label){case 0:return this._logger.info(s.L_SIGNAL_TRANSPORTER_HANGUP_T,"params: ".concat(JSON.stringify(e)),t),[4,this._sendCallSignal(e.callId,V.HANGUP_CALL,e)];case 1:return(r=i.sent().code)===c.NOT_IN_CALL?[2,{code:c.SUCCESS}]:[2,{code:r}]}}))}))}}),Object.defineProperty(r.prototype,"statusUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_CALL_STATUS_UP_T,"call status up params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,V.STATUS_UP_CALL,e)]}))}))}}),Object.defineProperty(r.prototype,"eventUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_CALL_EVENT_UP_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,V.EVENT_UP_CALL,e)]}))}))}}),Object.defineProperty(r.prototype,"dialogUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_CALL_DIALOG_UP_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,V.DIALOG_UP_CALL,e)]}))}))}}),Object.defineProperty(r.prototype,"deleteCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){return o(this,(function(i){return this._logger.info(s.L_SIGNAL_TRANSPORTER_DELETE_CALL_RECORD_T,"callIds: ".concat(JSON.stringify(t)),r),[2,this._sendCallSignal(e,V.DEL_CALL_LOG,{callIds:t})]}))}))}}),Object.defineProperty(r.prototype,"syncCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_RECORD_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.userId,V.SYNC_CALL_LOG,e)]}))}))}}),Object.defineProperty(r.prototype,"queryUserHasCall",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e;return o(this,(function(t){return e=this._context.getCurrentId(),[2,this._sendCallSignal(e,V.QRY_CALL_STATE,null)]}))}))}}),Object.defineProperty(r.prototype,"getCallServerTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return o(this,(function(r){return t=this._context.getCurrentId(),this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_SERVER_TIME_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,V.QRY_SRV_TIMESTAMP,null)]}))}))}}),Object.defineProperty(r.prototype,"getCallTimeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_TIME_INFO_T,"callId: ".concat(e),t),[2,this._sendCallSignal(e,V.GET_CALL_TIME_INFO,{callId:e})]}))}))}}),Object.defineProperty(r.prototype,"getUserCallStateList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return o(this,(function(r){return t=this._context.getCurrentId(),this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_AVAILABLE_CALL_LIST_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,V.GET_CALL_STATE_LIST,null)]}))}))}}),Object.defineProperty(r.prototype,"clearCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return o(this,(function(r){return t=this._context.getCurrentId(),this._logger.info(s.L_SIGNAL_TRANSPORTER_CLEAR_CALL_RECORD_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,V.CLEAR_CALL_LOG,null)]}))}))}}),Object.defineProperty(r.prototype,"getCallSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_INFO_BY_CALLID_T,"callId: ".concat(e.callId),t),[2,this._sendCallSignal(e.callId,V.GET_CALL_SESSION,e)]}))}))}}),Object.defineProperty(r.prototype,"sysStatusUp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_USER_SYSTEM_STATE_UP_T,"opts: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,V.SYS_STATUS_UP,e)]}))}))}}),Object.defineProperty(r.prototype,"upCallLogReaded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return o(this,(function(r){return t=this._context.getCurrentId(),[2,this._sendCallSignal(t,V.UP_CALL_LOG_READED,e)]}))}))}}),Object.defineProperty(r.prototype,"endUserAbnormalCalls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this._sendCallSignal(this._context.getCurrentId(),V.END_ABNORMAL_CALL,e)]}))}))}}),Object.defineProperty(r.prototype,"_onIMConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this._logger.createTraceId();this._logger.info(s.L_SIGNAL_TRANSPORTER_IM_STATE_CHANGE_O,"state: ".concat(t),r),this._listener.onIMStateChange(t),t===e.RCConnectionStatus.CONNECTED?this._timeCorrectioner.start(r):this._timeCorrectioner.stop(r)}}),Object.defineProperty(r.prototype,"_sendCallSignal",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return a(this,void 0,void 0,(function(){var a,l,_,s,u,C;return o(this,(function(o){switch(o.label){case 0:return a=i?JSON.stringify(n(n({},i),{sessionId:this._sessionId})):"",this._needRetryActions.includes(r)?[4,J({asyncFn:this._context.setCallInfo.bind(this._context),fnArgs:[t,r,a]})]:[3,2];case 1:return l=o.sent(),[3,4];case 2:return[4,this._context.setCallInfo(t,r,a)];case 3:l=o.sent(),o.label=4;case 4:return _=l.code,s=l.data,_!==e.ErrorCode.SUCCESS?[2,{code:_}]:(u=s.value,C=JSON.parse(u).data,[2,{code:c.SUCCESS,data:C}])}}))}))}}),Object.defineProperty(r.prototype,"_onRecvCallSignal",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=this._logger.createTraceId();this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_SIGNAL_DATA_O,"data: ".concat(e),r),JSON.parse(e).list.forEach((function(e){var i=e.key,n=JSON.parse(e.value);switch(i){case V.PUB_INVITE_CALL:t._onPubInviteCall(n,r,!0);break;case V.STATUS_DOWN_CALL:t._onStatusDownCall(n,r);break;case V.EVENT_DOWN_CALL:t._onEventDownCall(n,r);break;case V.DIALOG_DOWN_CALL:t._onDialogDownCall(n,r);break;case V.PUB_CALL_LOG:t._onPubCallLog(n,r);break;case V.PUB_CALL_LOG_READED:case V.PUB_NACK_SEQ_ID:break;default:t._onConpensationData(n,r)}}))}}),Object.defineProperty(r.prototype,"_isValidData",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return!!e.isNull(t)||!(!e.isString(t)||0!==(null==t?void 0:t.length)&&t!==this._sessionId)}}),Object.defineProperty(r.prototype,"_onPubInviteCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){void 0===r&&(r=!0);try{var i=this._context.getCurrentId(),n=e.callSessionUsers.find((function(e){return e.userId===i})),a=this._context.getConnectionStatus();this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O,"currentUser: ".concat(JSON.stringify(n),", currentUserId: ").concat(i,", state: ").concat(a),t)}catch(e){this._logger.error(s.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O,"error: ".concat(e.message),t)}if(this._isValidData(e.toDeviceId||""))this._listener.onInvite(e,r,t),r?this.emit(H.onPubInviteCall,Object.assign(e,{extra:JSON.stringify(e)})):this.emit(H.onPubInviteCallPullKv,Object.assign(e,{extra:JSON.stringify(e)}));else{this._logger.warn(s.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O,"not current deviceId -> deviceInfo: ".concat(JSON.stringify({toDeviceId:e.toDeviceId,clientDeviceId:this._sessionId})),t);var o={extra:JSON.stringify(e),reason:k.NOT_CURRENT_DEVICEID,refer:r?B.PUB_INVITE:B.PULL_KV_INVITE};this.emit(H.onPubInviteCallMiss,Object.assign(e,o))}}}),Object.defineProperty(r.prototype,"_onStatusDownCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(e.callSessionUsers=e.callSessionUsers.filter((function(e){return Boolean(e.changed)})),this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_STATUS_O,"",t),!this._isValidData(e.toDeviceId||""))return this._logger.warn(s.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_STATUS_O,"not current deviceId -> deviceInfo: ".concat(JSON.stringify({toDeviceId:e.toDeviceId,clientDeviceId:this._sessionId})),t),void this._listener.onOtherClientStatusDown(e,t);this._listener.onStatusDown(e,t,this._sessionId)}}),Object.defineProperty(r.prototype,"_onEventDownCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._listener.onEventDown(e,t)}}),Object.defineProperty(r.prototype,"_onDialogDownCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.dialogType===D.SWITCH_MEDIA_TYPE&&this._listener.onSwitchMediaType(e,t)}}),Object.defineProperty(r.prototype,"_onPubCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALL_ENGINE_RECEIVE_CALL_RECORD_O,"call record: ".concat(JSON.stringify(e)),t),this._listener.onRecvCallEndLog(e,t)}}),Object.defineProperty(r.prototype,"_onConpensationData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;this._logger.info(s.L_CALL_ENGINE_RECEIVE_COMPLEMENTARY_DATA_O,"",t);var i=e.callId,n=e.callType,a=e.mediaType,o=e.secretChat,l=e.duration,_=e.callStatus,c=e.callingUserId,u=e.callSessionUsers,C=e.toDeviceId,d=e.callDialogEntitys,L=e.extra;u.some((function(e){return e.sessionStatus===exports.RCCallPlusSessionUserState.INVITED&&e.userId===r._context.getCurrentId()}))?this._onPubInviteCall({callId:i,toDeviceId:C,callType:n,mediaType:a,inviteUserId:c,callingUserId:c,callSessionUsers:u,secretChat:o,extra:L},t,!0):this._onStatusDownCall({callId:i,toDeviceId:C,callStatus:_,duration:l,callSessionUsers:u},t),d.length>0&&d.forEach((function(e){return r._onDialogDownCall(e,t)}),this)}}),r}(e.EventEmitter),z=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return e="".concat(e.replace(/-/g,""),"0"),(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),r=t.length+1,i=+e,n=[];do{var a=i%r;i=(i-a)/r,n.unshift(t[a])}while(i);return n.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e},Z=function(){function e(e,t){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_localStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._localStore=e.localStorage}return Object.defineProperty(e.prototype,"addAbnormallCallId",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){try{var i=JSON.parse(this._localStore.getItem(e._STORAGE_KEY)||"{}"),n=i[t];n?n.push(r):n=[r],i[t]=n,this._localStore.setItem(e._STORAGE_KEY,JSON.stringify(i))}catch(e){this._logger.error(s.L_ABNORMAL_ADD_CALL_ID_E,e.message),console.error(e)}}}),Object.defineProperty(e.prototype,"removeAbnormalCallIds",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){try{var i=JSON.parse(this._localStore.getItem(e._STORAGE_KEY)||"{}"),n=i[t];n&&((n=n.filter((function(e){return!r.includes(e)}))).length>0?i[t]=n:delete i[t],this._localStore.setItem(e._STORAGE_KEY,JSON.stringify(i)))}catch(e){this._logger.error(s.L_ABNORMAL_REMOVE_CALL_IDS_E,e.message),console.error(e)}}}),Object.defineProperty(e.prototype,"getAbnormalCallIds",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=null;try{var i=JSON.parse(this._localStore.getItem(e._STORAGE_KEY)||"{}")[t];i&&(r=i)}catch(e){this._logger.error(s.L_ABNORMAL_GET_CALL_IDS_E,e.message),console.error(e)}return Promise.resolve(r)}}),Object.defineProperty(e,"_STORAGE_KEY",{enumerable:!0,configurable:!0,writable:!0,value:"CallPlus_AbnormalCall"}),e}();!function(e){e[e.PROMPT=0]="PROMPT",e[e.CALL_DURATION=10]="CALL_DURATION",e[e.FIRST_FRAME=20]="FIRST_FRAME"}(W||(W={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.INVALID_RESPONSE_TIME=80170]="INVALID_RESPONSE_TIME",e[e.NONOPTIMAL_RES_TIME=80171]="NONOPTIMAL_RES_TIME"}(K||(K={}));var $,ee,te,re=function(){function e(e,t,r){Object.defineProperty(this,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_singleCallDurationEv",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_RTT",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_validMinRTT",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(this,"_validMaxRTT",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),Object.defineProperty(this,"_deltaTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_timerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_interval",{enumerable:!0,configurable:!0,writable:!0,value:2e3}),Object.defineProperty(this,"_maxRetryTimes",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(this,"_startTimes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_retryTimesInCall",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_maxRetryTimesInCall",{enumerable:!0,configurable:!0,writable:!0,value:3})}return Object.defineProperty(e.prototype,"getCallClientTimeByServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,n,a,l,_,u;return o(this,(function(o){switch(o.label){case 0:return this._logger.info(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_T,"callId: ".concat(e),t),!this._RTT||this._RTT>this._validMinRTT?[4,this._getDeltaTime(t)]:[3,2];case 1:o.sent(),o.label=2;case 2:return this._RTT>this._validMaxRTT&&this._logger.error(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,"code: ".concat(K.INVALID_RESPONSE_TIME),t),[4,this._callEngine.getCallTimeInfo(e,t)];case 3:return r=o.sent(),i=r.code,n=r.data,i!==c.SUCCESS?(this._logger.error(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,"code: ".concat(i),t),[2,{code:i}]):(a=n.startTime,l=Math.floor(a-this._deltaTime),_=Date.now(),(u=(_+this._deltaTime-a)/1e3)<0&&(this._logger.warn(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_P,"invalid duration: ".concat(u),t),u=0),u=Math.floor(u),this._RTT>this._validMinRTT&&this._RTT<=this._validMaxRTT&&this._logger.error(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,"code: ".concat(K.NONOPTIMAL_RES_TIME),t),this._logger.info(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,JSON.stringify({rtt:this._RTT,deltaT:this._deltaTime,serverStartTime:a,clientStartTime:l,duration:u}),t),[2,{code:i,duration:u,clientStartTime:l}])}}))}))}}),Object.defineProperty(e.prototype,"calcClientStartTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(this._logger.info(s.L_TIME_CORRECT_CALC_CLIENT_START_TIME_T,"callId: ".concat(e,", startTime: ").concat(t),r),this._RTT>this._validMaxRTT)return this._logger.error(s.L_TIME_CORRECT_CALC_CLIENT_START_TIME_R,"code: ".concat(K.INVALID_RESPONSE_TIME),r),this._loopCorrectClientTime(e,r),{code:K.INVALID_RESPONSE_TIME};var i=Math.floor(t-this._deltaTime);return this._logger.info(s.L_TIME_CORRECT_CALC_CLIENT_START_TIME_R,JSON.stringify({rtt:this._RTT,deltaT:this._deltaTime,startT:t,clientStartTime:i}),r),this._RTT>this._validMinRTT&&(this._retryTimesInCall=0,this._loopCorrectClientTime(e,r)),{code:K.SUCCESS,clientStartTime:i}}}),Object.defineProperty(e.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this._timerId||this._startTimes>=this._maxRetryTimes||(this._logger.info(s.L_TIME_CORRECT_START_O,"timerId: ".concat(this._timerId)),this._startTimes++,this._getDeltaTime(e),this._timerId=F((function(){t._timerId=null,t.start(e)}),this._interval))}}),Object.defineProperty(e.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_TIME_CORRECT_STOP_O,"timerId: ".concat(this._timerId),e),this._timerId&&clearTimeout(this._timerId),this._timerId=null,this._startTimes=0}}),Object.defineProperty(e.prototype,"restart",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_TIME_CORRECT_RESTART_O,"legal rtt time, RTT: ".concat(this._RTT,", validMinRTT: ").concat(this._validMinRTT),e),this._RTT<this._validMinRTT||(this.stop(e),this.start(e))}}),Object.defineProperty(e.prototype,"getLocalDelayTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Math.round(this._deltaTime)}}),Object.defineProperty(e.prototype,"getRTT",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._RTT}}),Object.defineProperty(e.prototype,"_getDeltaTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,i,n,a,l;return o(this,(function(o){switch(o.label){case 0:return t=Date.now(),[4,this._callEngine.getCallServerTimestamp(e)];case 1:return r=o.sent(),i=r.code,n=r.data,a=Date.now(),i!==c.SUCCESS?[2,{code:i}]:(((l=a-t)<this._RTT||0===this._RTT)&&l<=this._validMaxRTT&&(this._RTT=l),l<this._validMinRTT&&this.stop(e),this._deltaTime=n-t-this._RTT/2,this._logger.info(s.L_TIME_CORRECT_SET_DELTA_TIME_O,JSON.stringify({rtt:this._RTT,deltaT:this._deltaTime}),e),[2,{code:i,delayTime:this._deltaTime}])}}))}))}}),Object.defineProperty(e.prototype,"_getDeltaTimeInCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,n,a,l,_,u,C;return o(this,(function(o){switch(o.label){case 0:return r=Date.now(),[4,this._callEngine.getCallTimeInfo(e,t)];case 1:return i=o.sent(),n=i.code,a=i.data,l=Date.now(),n!==c.SUCCESS?[2,{code:n}]:((_=l-r)<this._RTT&&(this._RTT=_),this._deltaTime=a.syncTime-r-this._RTT/2,this._logger.info(s.L_TIME_CORRECT_SET_DELTA_TIME_O,JSON.stringify({callId:e,rtt:this._RTT,deltaT:this._deltaTime}),t),u=Math.floor(a.startTime-this._deltaTime),C=Math.floor(a.firstFrametime-this._deltaTime),_<this._validMinRTT?[2,{code:K.SUCCESS,clientStartTime:u,clientFirstFrameTime:C}]:[2,{code:K.INVALID_RESPONSE_TIME,clientStartTime:u,clientFirstFrameTime:C}])}}))}))}}),Object.defineProperty(e.prototype,"_loopCorrectClientTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,n,a,l=this;return o(this,(function(o){switch(o.label){case 0:return this.stop(t),this._logger.info(s.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_T,"callId: ".concat(e),t),[4,this._getDeltaTimeInCall(e,t)];case 1:return r=o.sent(),i=r.code,n=r.clientStartTime,a=r.clientFirstFrameTime,i===K.SUCCESS?(this._logger.info(s.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_R,"code: ".concat(c.SUCCESS),t),this._singleCallDurationEv(e,n,a,t),[2]):this._retryTimesInCall>this._maxRetryTimesInCall&&i===K.INVALID_RESPONSE_TIME?(this._logger.info(s.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_R,"code: ".concat(K.INVALID_RESPONSE_TIME),t),this._singleCallDurationEv(e,n,a,t),[2]):(this._retryTimesInCall>this._maxRetryTimesInCall||(this._retryTimesInCall++,setTimeout((function(){l._loopCorrectClientTime(e,t)}),this._interval)),[2])}}))}))}}),e}();!function(e){e[e.SOON_AFETER=0]="SOON_AFETER",e[e.CURRENT=1]="CURRENT"}($||($={})),function(e){e[e.PUB_INVITE_CALL=0]="PUB_INVITE_CALL",e[e.PULL_KV_INVITE_CALL=1]="PULL_KV_INVITE_CALL",e[e.SYSTEM_PUSH=2]="SYSTEM_PUSH"}(ee||(ee={})),function(e){e[e.OUT=-1]="OUT",e[e.GROUP=0]="GROUP",e[e.IN=1]="IN"}(te||(te={}));var ie,ne=function(t){function r(e,r,i,n,a){var o=t.call(this)||this;return Object.defineProperty(o,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(o,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(o,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(o,"_mainSession",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(o,"_holdSessions",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(o,"_signalModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_abnormalModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_isUpFirstFrameTime",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_callStartMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(o,"_timeCorrectioner",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_clientCallId",{enumerable:!0,configurable:!0,writable:!0,value:""}),o._timeCorrectioner=new re(o,n,o._onRecvSinCallDuration.bind(o)),o._signalModule=new X(e,r,i,o._timeCorrectioner,o._logger,o._reportAppEventModule),o._signalModule.registerListener({onInvite:o._onInvite.bind(o),onStatusDown:o._onStatusDown.bind(o),onOtherClientStatusDown:o._onOtherClientStatusDown.bind(o),onEventDown:o._onEventDown.bind(o),onSwitchMediaType:o._onSwitchMediaType.bind(o),onRecvCallEndLog:o._onRecvCallEndLog.bind(o),onIMStateChange:o._onIMStateChange.bind(o)}),o._abnormalModule=new Z(r,n),o}return i(r,t),Object.defineProperty(r.prototype,"startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,n,a,s,u,C,d,L,E,T,S,I,g,p,R,f,h,b,O,N=this;return o(this,(function(o){switch(o.label){case 0:return r=this._context.getCurrentId(),i=e.callType,n=e.mediaType,a=e.toUsers,s=e.targetId,u=e.targetType,C=e.oldRoomId,d=e.pushConfig,L=e.extra,this._clientCallId=e.callId,E=d?A(d,this._clientCallId):"",[4,this._signalModule.startCall({clientCallId:this._clientCallId,callType:i,mediaType:n,toUsers:a,secretChat:w.NORMAL,targetType:u,targetId:s,oldRoomId:C,pushExt:E,extra:L},t)];case 1:return T=o.sent(),S=T.code,I=T.data,S!==c.SUCCESS?[2,{code:S}]:(p=(g=I).callId,R=g.busylineUsers,this._abnormalModule.addAbnormallCallId(r,p),this._mainSession=new x(p,exports.RCCallPlusCallState.INVITED,i,n,r,r,[],this._logger),i===exports.RCCallPlusType.SINGLE&&(f=this._startTimer(I.callId,exports.RCCallPlusSessionUserState.NO_ANSWER,t),this._mainSession.updateTimerId(j.INVITER,f)),h={userId:r,userState:exports.RCCallPlusSessionUserState.CALLING,systemState:exports.RCCallPlusReason.CALLING,targetType:u,targetId:s,cameraEnable:!1,microphoneEnable:!1},b=a.map((function(e){var t=e.userId,r=e.targetType,i=e.targetId;return{userId:t,userState:exports.RCCallPlusSessionUserState.INVITED,systemState:exports.RCCallPlusReason.INVITED,targetType:r,targetId:i,cameraEnable:!1,microphoneEnable:!1}})),O=[],R&&(O=R.map((function(e){var t=b.find((function(t){return t.userId===e.userId})),r=t.targetType,i=t.targetId;return{userId:e.userId,userState:e.sessionStatus,systemState:exports.RCCallPlusReason.BUSYLINE_RINGING,targetType:r,targetId:i,cameraEnable:!1,microphoneEnable:!1}})),b=b.filter((function(e){var t=e.userId;return O.every((function(e){return e.userId!==t}))}))),setTimeout((function(){N.updateUsersState(p,_(_([h],l(b),!1),l(O),!1),t)})),[2,{code:S,data:I}])}}))}))}}),Object.defineProperty(r.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return a(this,void 0,void 0,(function(){var i,n,a,s,u,C,d,L,E,T;return o(this,(function(o){switch(o.label){case 0:return this._mainSession?(i=e.toUsers,n=e.pushConfig,a=e.extra,s=n?A(n,this._clientCallId):"",u=this._mainSession.getCallId(),[4,this._signalModule.inviteCall({callId:u,toUsers:i,pushExt:s,extra:a},t)]):[2,{code:c.NOT_IN_CALL}];case 1:return C=o.sent(),d=C.code,L=C.data,d===c.SUCCESS&&(this._mainSession.getCallType()===exports.RCCallPlusType.SINGLE&&(this._mainSession.updateCallType(exports.RCCallPlusType.MULTI),this._onCallTypeChange(this._mainSession.getCallId(),exports.RCCallPlusType.MULTI,t)),E=i.map((function(e){var t=e.userId,r=e.targetType,i=e.targetId;return{userId:t,userState:exports.RCCallPlusSessionUserState.INVITED,systemState:exports.RCCallPlusReason.INVITED,targetType:r,targetId:i,cameraEnable:!1,microphoneEnable:!1}})),T=[],L.busylineUsers&&(T=null===(r=L.busylineUsers)||void 0===r?void 0:r.map((function(e){var t=E.find((function(t){return t.userId===e.userId})),r=t.targetType,i=t.targetId;return{userId:e.userId,userState:e.sessionStatus,systemState:exports.RCCallPlusReason.BUSYLINE_RINGING,targetType:r,targetId:i,cameraEnable:!1,microphoneEnable:!1}})),E=E.filter((function(e){var t=e.userId;return T.every((function(e){return e.userId!==t}))}))),this.updateUsersState(u,_(_([],l(E),!1),l(T),!1),t)),[2,{code:d,data:L}]}}))}))}}),Object.defineProperty(r.prototype,"clearAllTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;_([this._mainSession],l(this._holdSessions),!1).forEach((function(i){i&&i.getCallId()===e&&i.getAllTimerIds().forEach((function(e){return r._stopTimer.bind(r)(e,t)}))}))}}),Object.defineProperty(r.prototype,"hangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,n,a,l;return o(this,(function(o){switch(o.label){case 0:return r=e.callId,i=e.systemState,n=e.pushConfig,a=n?A(n,this._clientCallId):"",[4,this._signalModule.hangupCall({callId:r,sysStatus:i,pushExt:a},t)];case 1:return l=o.sent().code,this.endCurrentSession(e.systemState,r,t),[2,{code:l}]}}))}))}}),Object.defineProperty(r.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i;return o(this,(function(n){switch(n.label){case 0:return this._mainSession?(r=e.callId,[4,this._signalModule.acceptCall({callId:r},t)]):[2,{code:c.NOT_IN_CALL}];case 1:return i=n.sent().code,this._stopTimer(this._mainSession.getInviteeTimerId(),t),i!==c.SUCCESS?[2,{code:i}]:(this._clearMobileOnPhone(e.callId,t),this._mainSession.updateSessionState(exports.RCCallPlusCallState.CONNECTING),[2,{code:i}])}}))}))}}),Object.defineProperty(r.prototype,"joinCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i;return o(this,(function(n){switch(n.label){case 0:return r=this._context.getCurrentId(),this._mainSession&&this._stopTimer(this._mainSession.getInviteeTimerId(),t),[4,this._signalModule.joinCall({callId:e.callId},t)];case 1:return(i=n.sent().code)!==c.SUCCESS?[2,{code:i}]:(this._abnormalModule.addAbnormallCallId(r,e.callId),this._mainSession?[3,3]:[4,this._createSessionByServer(e.callId,t,!0)]);case 2:return n.sent(),[3,4];case 3:this._clearMobileOnPhone(e.callId,t),n.label=4;case 4:return[2,{code:i}]}}))}))}}),Object.defineProperty(r.prototype,"requestChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,n;return o(this,(function(a){switch(a.label){case 0:return this._mainSession?(r={mediaType:e.mediaType},this._mainSession.updateReqMediaType(e.mediaType),i=z(),[4,this._signalModule.dialogUpCall({transactionId:i,callId:this._mainSession.getCallId(),toUserIds:e.toUserIds,dialogType:D.SWITCH_MEDIA_TYPE,action:M.REQUEST,extraKeyVal:r},t)]):[2,{code:c.NOT_IN_CALL}];case 1:return(n=a.sent().code)!==c.SUCCESS?[2,{code:n}]:[2,{code:c.SUCCESS,data:{transactionId:i}}]}}))}))}}),Object.defineProperty(r.prototype,"responseChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r;return o(this,(function(i){return this._mainSession?(r=this._mainSession.getReqMediaType(),e.agree&&(this._mainSession.updateMediaType(r),this._mainSession.updateReqMediaType(null)),[2,this._signalModule.dialogUpCall({transactionId:e.transactionId,callId:this._mainSession.getCallId(),dialogType:D.SWITCH_MEDIA_TYPE,action:e.agree?M.ACCEPT:M.REFUSE},t)]):[2,{code:c.NOT_IN_CALL}]}))}))}}),Object.defineProperty(r.prototype,"cancelChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this._mainSession?[2,this._signalModule.dialogUpCall({transactionId:e.transactionId,callId:this._mainSession.getCallId(),dialogType:D.SWITCH_MEDIA_TYPE,action:M.CANCEL},t)]:[2,{code:c.NOT_IN_CALL}]}))}))}}),Object.defineProperty(r.prototype,"getCallLogList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,n,a,l,_,s,u;return o(this,(function(o){switch(o.label){case 0:return r=this._context.getCurrentId(),i=e.timestamp,n=e.count,a=e.order,[4,this._signalModule.syncCallLog({userId:r,syncTime:i,count:n,order:a},t)];case 1:return l=o.sent(),_=l.code,s=l.data,_!==c.SUCCESS?[2,{code:_}]:(u=s.callLogList.map((function(e){return R(e)})),[2,{code:c.SUCCESS,data:{hasMore:Boolean(null==s?void 0:s.hasMore),syncTime:0===a?s.maxTime:s.minTime,list:u}}])}}))}))}}),Object.defineProperty(r.prototype,"deleteCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r;return o(this,(function(i){return r=this._context.getCurrentId(),[2,this._signalModule.deleteCallRecord(r,e,t)]}))}))}}),Object.defineProperty(r.prototype,"getCallServerTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,i;return o(this,(function(n){switch(n.label){case 0:return[4,this._signalModule.getCallServerTimestamp(e)];case 1:return t=n.sent(),r=t.code,i=t.data,r!==c.SUCCESS?[2,{code:r}]:[2,{code:r,data:i.syncTime}]}}))}))}}),Object.defineProperty(r.prototype,"getCallTimeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return[2,this._signalModule.getCallTimeInfo(e,t)]}))}))}}),Object.defineProperty(r.prototype,"getOpenCallList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,i,n,a,l=this;return o(this,(function(o){switch(o.label){case 0:return t=this._context.getCurrentId(),[4,this._signalModule.getUserCallStateList(e)];case 1:return r=o.sent(),i=r.code,n=r.data,i!==c.SUCCESS?[2,{code:i}]:(a=n.callStateList.map((function(r){var i=r.callId,n=r.callType,a=r.mediaType,o=r.callingUserId,_=r.callUserIds,s=r.callStatus,c=r.crtTime,u=r.userSessionStatus,C=r.startTime,d=r.syncTime,L=o===t?te.OUT:te.IN,E=l._timeCorrectioner.calcClientStartTime(i,C,e).clientStartTime,T=void 0===E?C:E;return{callId:i,callType:n,callDirection:L,mediaType:a,callerUserId:o,callUserIds:_,sessionState:s,userState:u,startTimestamp:C,endTimestamp:0,duration:Math.floor((+new Date-T)/1e3),syncTimestamp:d,systemState:0,createTimestamp:c}})),[2,{code:i,data:a}])}}))}))}}),Object.defineProperty(r.prototype,"removeAllCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._signalModule.clearCallRecord(e)];case 1:return[2,{code:t.sent().code}]}}))}))}}),Object.defineProperty(r.prototype,"getCallSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,n,a,l,_,s,u,C,d,L,E,T,S;return o(this,(function(o){switch(o.label){case 0:return[4,this._signalModule.getCallSession(e,t)];case 1:return r=o.sent(),i=r.code,n=r.data,i!==c.SUCCESS?[2,{code:i}]:(l=(a=n).callId,_=a.callingUserId,s=a.callType,u=a.mediaType,C=a.callStatus,d=a.callSessionUsers,L=a.startTime,E=a.duration,T=a.syncTime,S=d.map((function(e){return{userId:e.userId,userState:e.sessionStatus,systemState:e.sysStatus,targetType:e.targetType,targetId:e.targetId,cameraEnable:!1,microphoneEnable:!1}})),[2,{code:i,data:{callId:l,startCallerId:_,callType:s,mediaType:u,sessionState:C,callSessionUsers:S,startTime:L,duration:E,syncTime:T}}])}}))}))}}),Object.defineProperty(r.prototype,"getHoldSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._holdSessions.find((function(t){return t&&t.getCallId()===e}));return t?new S(t,this,this._logger):null}}),Object.defineProperty(r.prototype,"getLocalMainSession",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mainSession?new S(this._mainSession,this,this._logger):null}}),Object.defineProperty(r.prototype,"updateMainSessionState",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;null===(t=this._mainSession)||void 0===t||t.updateSessionState(e)}}),Object.defineProperty(r.prototype,"setIsLocalClientHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;null===(t=this._mainSession)||void 0===t||t.setIsLocalClientHangup(e)}}),Object.defineProperty(r.prototype,"updateUsersState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALL_ENGINE_UPDATE_USERS_STATE_O,"updateUsersState -> users: ".concat(JSON.stringify(t)),r);var i=_([this._mainSession],l(this._holdSessions),!1).find((function(t){return(null==t?void 0:t.getCallId())===e})),a=[];if(i){var o=t.map((function(e){var t=i.getUserList().filter((function(t){return t.userId===e.userId}))[0]||{},r=e.userState===exports.RCCallPlusSessionUserState.IDLE?{cameraEnable:!1,microphoneEnable:!1}:t,a=r.cameraEnable,o=void 0!==a&&a,l=r.microphoneEnable,_=void 0!==l&&l;return n(n({},e),{cameraEnable:o,microphoneEnable:_})}));a.push.apply(a,_([],l(i.updateUserList(o,r)),!1))}else a.push.apply(a,_([],l(t),!1));a.length>0&&this._onUserStateChange(e,a,r)}}),Object.defineProperty(r.prototype,"setUserDeviceEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n;null===(n=this._mainSession)||void 0===n||n.setUserDeviceEnable(e,t,r,i)}}),Object.defineProperty(r.prototype,"getCallStaringTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return[2,this._timeCorrectioner.getCallClientTimeByServer(e.callId,t)]}))}))}}),Object.defineProperty(r.prototype,"systemStatusUp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return[2,this._signalModule.sysStatusUp(e,t)]}))}))}}),Object.defineProperty(r.prototype,"upFirstFrameTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,i,n,a;return o(this,(function(o){switch(o.label){case 0:return!this._mainSession||this._mainSession&&this._mainSession.getCallType()!==exports.RCCallPlusType.SINGLE||this._isUpFirstFrameTime?[2,{code:c.SUCCESS}]:(t=Date.now(),r=this._timeCorrectioner.getLocalDelayTime(),i=Math.floor(t+r),this._logger.info(s.L_CALL_ENGINE_UP_FIRST_FRAME_TIME_T,"now: ".concat(t,"; delay: ").concat(r,"; streamReadyTime: ").concat(i),e),this._isUpFirstFrameTime=!0,n=this._mainSession.getCallId(),[4,this._signalModule.eventUpCall({callId:n,eventType:W.FIRST_FRAME,eventArgs:{streamReadyTime:i},eventTime:Date.now()},e)]);case 1:return a=o.sent().code,this._logger.info(s.L_CALL_ENGINE_UP_FIRST_FRAME_TIME_R,"code: ".concat(a),e),[2,{code:a}]}}))}))}}),Object.defineProperty(r.prototype,"endCurrentSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this,n=this._context.getCurrentId();if(this._mainSession&&this._mainSession.getCallId()===t){var a=this._mainSession.getUserList().map((function(t){var r=t.userId,a=t.systemState,o=t.targetType,l=t.targetId;return r===n&&(a=e),{userId:r,sessionStatus:exports.RCCallPlusSessionUserState.ENDED,statusTime:Date.now(),duration:0,changed:1,inviteUserId:i._mainSession.getStartCallerId(),sysStatus:a,targetType:o,targetId:l}})),o={callId:this._mainSession.getCallId(),toDeviceId:this._signalModule.getSessionId(),callStatus:exports.RCCallPlusCallState.ENDED,duration:0,callSessionUsers:a};this._onStatusDown(o,r)}}}),Object.defineProperty(r.prototype,"startTimeCorrection",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._timeCorrectioner.restart(e)}}),Object.defineProperty(r.prototype,"getDelayTimeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{delayTime:this._timeCorrectioner.getLocalDelayTime(),rtt:this._timeCorrectioner.getRTT()}}}),Object.defineProperty(r.prototype,"upgradeMainSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=this._holdSessions.findIndex((function(t){return t.getCallId()===e}));this._mainSession=null===(t=this._holdSessions.splice(r,1))||void 0===t?void 0:t[0]}}),Object.defineProperty(r.prototype,"endCurrentUserAbnormalCalls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,i;return o(this,(function(n){switch(n.label){case 0:return t=this._context.getCurrentId(),[4,this._abnormalModule.getAbnormalCallIds(t)];case 1:return(r=n.sent())?[4,this._signalModule.endUserAbnormalCalls({callIds:r,allDevice:e?1:0})]:[2,{code:c.SUCCESS}];case 2:return(i=n.sent().code)===c.SUCCESS&&this._abnormalModule.removeAbnormalCallIds(t,r),[2,{code:i}]}}))}))}}),Object.defineProperty(r.prototype,"_onIMStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this,i=this._logger.createTraceId(),n=0;t===e.RCConnectionStatus.DISCONNECTED&&this._mainSession&&this._mainSession.getSessionState()!==exports.RCCallPlusCallState.ONCALL&&(n=F((function(){var e;r._logger.info(s.L_CALL_ENGINE_IM_STATE_CHANGE_O,"endCurrentSession, IM disconnected for more than 60s",i),r.endCurrentSession(exports.RCCallPlusReason.CONNECTION_ERR,null===(e=r._mainSession)||void 0===e?void 0:e.getCallId(),i)}),6e4)),t===e.RCConnectionStatus.CONNECTED&&(n&&clearTimeout(n),this.endCurrentUserAbnormalCalls(!0))}}),Object.defineProperty(r.prototype,"_handleCallTimeout",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(s.L_CALL_ENGINE_CALL_TIMEOUT_O,"call timeout callId: ".concat(e,", userState: ").concat(t),r);var i=_([this._mainSession],l(this._holdSessions),!1).find((function(t){return t&&t.getCallId()===e}));if(i){var n=this._context.getCurrentId();this._onStatusDown({callId:e,toDeviceId:this._signalModule.getSessionId(),callStatus:exports.RCCallPlusCallState.ENDED,duration:0,callSessionUsers:i.getUserList().map((function(e){var r,a,o=e.userId,l=e.targetType,_=e.targetId,s=e.stateTime;return o===n?(r=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusReason.MISSED:exports.RCCallPlusReason.NO_ANSWER,a=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusSessionUserState.MISSED:exports.RCCallPlusSessionUserState.NO_ANSWER):(r=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusReason.NO_ANSWER:exports.RCCallPlusReason.MISSED,a=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusSessionUserState.NO_ANSWER:exports.RCCallPlusSessionUserState.MISSED),{userId:o,sessionStatus:a,statusTime:s?s+1:Date.now(),duration:0,changed:1,inviteUserId:i.getCallerId(),sysStatus:r,targetType:l,targetId:_}}))},r)}else this._logger.warn(s.L_CALL_ENGINE_CALL_TIMEOUT_O,"handleCallTimeout without session, callId: ".concat(e),r)}}),Object.defineProperty(r.prototype,"_startTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this,n=F((function(){i._handleCallTimeout(e,t,r),i._signalModule.statusUpCall({callId:e,sessionStatus:t},r)}),6e4);return this._logger.info(s.L_CALL_ENGINE_START_CALL_TIMER_O,"callId: ".concat(e,", timerId: ").concat(n),r),n}}),Object.defineProperty(r.prototype,"_stopTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){clearTimeout(e),this._logger.info(s.L_CALL_ENGINE_STOP_CALL_TIMER_O,"timerId: ".concat(e),t)}}),Object.defineProperty(r.prototype,"_onInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){this._clientCallId=e.getUUID();var n=this._context.getCurrentId(),a=t.callSessionUsers,o=t.secretChat,l=t.extra,_=void 0===l?"{}":l;o!==w.SECRET?(a.some((function(e){return e.userId===n}))&&this._selfIsInviteeHandle(t,r,i,_),this._othersIsInviteeHandle(t,i)):this.emit(H.onPubInviteCallMiss,Object.assign(t,{extra:JSON.stringify(t),reason:k.SECRET_CALL,refer:r?B.PUB_INVITE:B.PULL_KV_INVITE}))}}),Object.defineProperty(r.prototype,"_selfIsInviteeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,n){var a=e.callId,o=e.inviteUserId,l=e.callType,_=e.mediaType,s=e.callSessionUsers,c=this._context.getCurrentId();this._abnormalModule.addAbnormallCallId(c,a);var u=new x(a,exports.RCCallPlusCallState.RINGING,l,_,o,o,[],this._logger);this._signalModule.ringingCall({callId:a},i);var C=this._startTimer(a,exports.RCCallPlusSessionUserState.MISSED,i);u.updateTimerId(j.INVITEE,C),this._mainSession?(this._holdSessions.push(u),this._mainSession.updateSessionState(exports.RCCallPlusCallState.BUSYLINE_WAIT)):this._mainSession=u;var d=new S(u,this,this._logger);this._reportAppEventModule.onReceivedCall(d,i,JSON.parse(n||"{}").extra);var L=t?ee.PUB_INVITE_CALL:ee.PULL_KV_INVITE_CALL;this.emit(r.__INNER_INVITE__,d,L);var E=s.map((function(e){return{userId:e.userId,userState:e.sessionStatus,systemState:e.sysStatus,targetType:e.targetType,targetId:e.targetId,stateTime:e.statusTime,cameraEnable:!1,microphoneEnable:!1}}));this.updateUsersState(a,E,i)}}),Object.defineProperty(r.prototype,"_othersIsInviteeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n,a=e.callId,o=e.inviteUserId,l=e.callSessionUsers,_=this._context.getCurrentId(),s=l.filter((function(e){return e.userId!==_&&e.userId!==o&&e.sessionStatus===exports.RCCallPlusSessionUserState.INVITED}));if(s.length){(null===(r=this._mainSession)||void 0===r?void 0:r.getCallType())===exports.RCCallPlusType.SINGLE&&(null===(i=this._mainSession)||void 0===i?void 0:i.getCallId())===a&&(this._onCallTypeChange(this._mainSession.getCallId(),exports.RCCallPlusType.MULTI,t),null===(n=this._mainSession)||void 0===n||n.updateCallType(exports.RCCallPlusType.MULTI));var c=[],u=[];s.forEach((function(e){var t=e.userId,r=e.sessionStatus,i=e.sysStatus;c.push({callId:a,userId:t,userState:r}),u.push({userId:t,userState:r,systemState:i,cameraEnable:!1,microphoneEnable:!1})})),this._onOtherMemberInvite(c),this.updateUsersState(a,u,t)}}}),Object.defineProperty(r.prototype,"_onHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this;this._mainSession&&e.forEach((function(e){e.callId===i._mainSession.getCallId()&&(e.userState===exports.RCCallPlusSessionUserState.CANCELLED?i._stopTimer(i._mainSession.getInviteeTimerId(),r):i._stopTimer(i._mainSession.getInviterTimerId(),r))}))}}),Object.defineProperty(r.prototype,"_onAccept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,n,a,o,l=null===(i=this._mainSession)||void 0===i?void 0:i.getSessionState(),_=[exports.RCCallPlusCallState.CONNECTING,exports.RCCallPlusCallState.ONCALL,exports.RCCallPlusCallState.BUSYLINE_WAIT];if((null===(n=this._mainSession)||void 0===n?void 0:n.getCallType())!==exports.RCCallPlusType.SINGLE||!l||!_.includes(l)){var s=this._mainSession.getStartCallerId(),c=this._context.getCurrentId();if((null===(a=this._mainSession)||void 0===a?void 0:a.getCallType())===exports.RCCallPlusType.SINGLE&&s===c)e.filter((function(e){return e.fromUserId!==c}))&&this.emit(r.__INNER_SESSION_CONNECT__,this.getLocalMainSession().getCallId(),t);null===(o=this._mainSession)||void 0===o||o.updateSessionState(exports.RCCallPlusCallState.CONNECTING),this._stopTimer(this._mainSession.getInviterTimerId(),t)}}}),Object.defineProperty(r.prototype,"_onStatusDown",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i;return a(this,void 0,void 0,(function(){var n,a,l,_,s,c,u,C,d,L,E,T,S;return o(this,(function(o){return n=e.callStatus,a=e.startTime,(l=e.callId)!==(null===(r=this._mainSession)||void 0===r?void 0:r.getCallId())?[2]:(this._callStartMap[l]=this._callStartMap[l]||{},this._callStartMap[l].isReceiveCallStartTime||n!==exports.RCCallPlusCallState.ONCALL||(this._callStartMap[l].isReceiveCallStartTime=!0,_=this._timeCorrectioner.calcClientStartTime(l,a,t),s=_.code,c=_.clientStartTime,s===K.SUCCESS&&(this._callStartMap[l].callStartTime=c,this._reportAppEventModule.onReceivedCallStartTime({callId:l,callStartTime:c},t))),u=!1,C=this._context.getCurrentId(),(d=e.callSessionUsers.map((function(e){return[exports.RCCallPlusSessionUserState.IDLE,exports.RCCallPlusSessionUserState.DECLINED,exports.RCCallPlusSessionUserState.MISSED,exports.RCCallPlusSessionUserState.NO_ANSWER,exports.RCCallPlusSessionUserState.CANCELLED].includes(e.sessionStatus)&&e.sysStatus!==exports.RCCallPlusReason.CANCELLED&&e.userId===C&&(u=!0),{userId:e.userId,userState:e.sessionStatus,systemState:e.sysStatus,stateTime:e.statusTime,cameraEnable:!1,microphoneEnable:!1}}))).length>0&&this.updateUsersState(l,d,t),this._mainSession||this._holdSessions.length?(L=function(e){var t=e.callId,r=[],i=[],n=[],a=[];return e.callSessionUsers.forEach((function(e){var o=e.userId,l=e.sessionStatus,_=e.sysStatus;switch(l){case exports.RCCallPlusSessionUserState.INVITED:a.push({callId:t,userId:o,userState:l});break;case exports.RCCallPlusSessionUserState.RINGING:r.push({callId:t,fromUserId:o});break;case exports.RCCallPlusSessionUserState.CONNECTING:n.push({fromUserId:o});break;case exports.RCCallPlusSessionUserState.CANCELLED:case exports.RCCallPlusSessionUserState.DECLINED:case exports.RCCallPlusSessionUserState.ENDED:case exports.RCCallPlusSessionUserState.IDLE:i.push({callId:t,fromUserId:o,userState:l,systemState:_})}})),{ringingData:r,hangupData:i,acceptData:n,otherInvitedData:a}}(e),E=L.hangupData,T=L.acceptData,S=L.otherInvitedData,E.length>0&&this._onHangup(E,e.callStatus,t),T.length>0&&this._onAccept(T,t),S.length>0&&(null===(i=this._mainSession)||void 0===i?void 0:i.getCallType())===exports.RCCallPlusType.MULTI&&this._onOtherMemberInvite(S),(e.callStatus===exports.RCCallPlusCallState.ENDED||u)&&this._onSessionClose(e,t,u),[2]):[2])}))}))}}),Object.defineProperty(r.prototype,"_onOtherClientStatusDown",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n,a=this._context.getCurrentId(),o=e.callId,l=e.callSessionUsers.find((function(e){return e.userId===a}));if(l&&(this._mainSession||this._holdSessions.length)){var _=l.userId,s=l.sessionStatus,c=l.statusTime;if(s===exports.RCCallPlusSessionUserState.CONNECTING){var u=[exports.RCCallPlusSessionUserState.ONCALL,exports.RCCallPlusSessionUserState.CONNECTING],C=(null===(r=this._mainSession)||void 0===r?void 0:r.getCallId())===o,d=null===(n=null===(i=this._mainSession)||void 0===i?void 0:i.getUserList().find((function(e){return e.userId===a})))||void 0===n?void 0:n.userState;C&&d&&u.includes(d)||(this.updateUsersState(o,[{userId:_,userState:s,systemState:exports.RCCallPlusReason.OTHER_CLIENT_ACCEPT,stateTime:c,cameraEnable:!1,microphoneEnable:!1}],t),this._onSessionClose(e,t,!1))}}}}),Object.defineProperty(r.prototype,"_onEventDown",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return a(this,void 0,void 0,(function(){var i,n,a,l,_,c;return o(this,(function(o){return i=e.callId,n=e.eventArgs,e.eventType===W.CALL_DURATION&&i===(null===(r=this._mainSession)||void 0===r?void 0:r.getCallId())&&(a=n.firstFrameTime,l=this._timeCorrectioner.calcClientStartTime(i,a,t),_=l.code,c=l.clientStartTime,this._logger.info(s.L_CALL_ENGINE_RECEIVE_FIRST_FRAME_TIME_O,"clientFirstFrameTime: ".concat(c),t),_===K.SUCCESS&&(this._callStartMap[i].firstFrameTime=c,this._reportAppEventModule.onReceivedCallFirstFrameTime(i,c,t))),[2]}))}))}}),Object.defineProperty(r.prototype,"_onRecvSinCallDuration",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var a;(null===(a=this._mainSession)||void 0===a?void 0:a.getCallId())===e&&(this._callStartMap[e].callStartTime=t,this._callStartMap[e].firstFrameTime=r,this._reportAppEventModule.onReceivedCallStartTime(n({callId:e},{callStartTime:t}),i),this._reportAppEventModule.onReceivedCallFirstFrameTime(e,r,i))}}),Object.defineProperty(r.prototype,"_onSwitchMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n,a,o,l=e.callId,_=e.action,c=e.extraKeyVal,u=e.transactionId,C=e.promoterId,d=c.mediaType,L=c.reason,E=null===(r=this._mainSession)||void 0===r?void 0:r.getCallId();if(l===E){var T=(null===(i=this._mainSession)||void 0===i?void 0:i.getOldDialogData())||{},S=T.transactionId,I=T.action,g=T.mediaType;if(S!==u||I!==_||g!==d){if(this._logger.info(s.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O,"action: ".concat(_,", reason: ").concat(L),t),null===(n=this._mainSession)||void 0===n||n.setOldDialogData({transactionId:u,action:_,mediaType:d}),_===M.REQUEST)this._onRequestChangeMediaType({transactionId:u,userId:C,mediaType:d},t);else{var p=null;switch(L){case M.CANCEL:p=exports.RCCallPlusMediaTypeChangeResult.CANCEL_CHANGE_MEDIA_TYPE;break;case M.ACCEPT:p=exports.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE,null===(a=this._mainSession)||void 0===a||a.updateMediaType(this._mainSession.getReqMediaType()),null===(o=this._mainSession)||void 0===o||o.updateReqMediaType(null);break;case M.REFUSE:p=exports.RCCallPlusMediaTypeChangeResult.REFUSE_CHANGE_MEDIA_TYPE;break;case M.TIMEOUT:p=exports.RCCallPlusMediaTypeChangeResult.CHANGE_MEDIA_TYPE_TIMEOUT}exports.RCCallPlusMediaTypeChangeResult[p]&&this._receiveMediaTypeChangeResult({transactionId:u,userId:C,mediaType:d},p,t)}_!==M.NOTICE||d!==exports.RCCallPlusMediaType.AUDIO||L||this._receiveMediaTypeChangeResult({transactionId:u,userId:C,mediaType:d},exports.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE,t)}else this._logger.info(s.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O,"duplicate dialog data",t)}else this._logger.info(s.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O,"not current session callId: ".concat(E,", recvCallId: ").concat(l),t)}}),Object.defineProperty(r.prototype,"_onRecvCallEndLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=R(e);this._reportAppEventModule.onReceivedCallRecord(r,t)}}),Object.defineProperty(r.prototype,"_onSessionClose",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){var n=this,a=e.callId,o=this._context.getCurrentId();this._abnormalModule.removeAbnormalCallIds(o,[a]);var c=_([this._mainSession],l(this._holdSessions),!1).find((function(e){return e&&e.getCallId()===a}));if(c){this._logger.warn(s.L_CALL_ENGINE_RECEIVE_CLOSE_SESSION_O,"callId: ".concat(a),t),this.emit(r.__INNER_SESSION_CLOSE__,a,t);var u,C=c.getUserList().find((function(e){return e.userId===o}));u=i&&e.toDeviceId!==this._signalModule.getSessionId()?c.getIsLocalClientHangup()?C.systemState:exports.RCCallPlusReason.OTHER_CLIENT_HANGUP:C.systemState,this._reportAppEventModule.onCallEnded(new S(c,this,this._logger),u,t),this._reportCallPlusSummaryMessage(c,a,u),this._mainSession&&this._mainSession.getCallId()===a&&(this._mainSession.getAllTimerIds().forEach((function(e){return n._stopTimer.bind(n)(e,t)})),c.getCallType()===exports.RCCallPlusType.SINGLE&&(this._isUpFirstFrameTime=!1),delete this._callStartMap[a]),this._removeSession(a)}else this._logger.warn(s.L_CALL_ENGINE_RECEIVE_CLOSE_SESSION_O,"unexpect session callId -> ".concat(a),t)}}),Object.defineProperty(r.prototype,"_reportCallPlusSummaryMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n=this._context.getCurrentId(),a=t.getUserList().filter((function(e){return e.userId!==n}))[0].userId,o=t.getStartCallerId();if(!localStorage.getItem("missMessageMap-".concat(n,"-").concat(r))){var l={callId:r,callerUserId:o,targetId:a,mediaType:t.getMediaType(),firstFrameTime:this._callStartMap[r].firstFrameTime||0,callStartTime:this._callStartMap[r].callStartTime||0,callEndTime:this._callStartMap[r].callStartTime?+new Date-this._timeCorrectioner.getLocalDelayTime():0,hangupReason:i};this._reportAppEventModule.onReceivedCallPlusSummaryMessage({messageType:q,content:JSON.stringify(l),senderUserId:o,targetId:a,channelId:"",conversationType:e.ConversationType.PRIVATE,sentTime:+new Date-this._timeCorrectioner.getLocalDelayTime(),receivedTime:+new Date-this._timeCorrectioner.getLocalDelayTime(),messageUId:"",messageDirection:o===n?e.MessageDirection.SEND:e.MessageDirection.RECEIVE,isPersited:!0,isCounted:!1,isOffLineMessage:!1,canIncludeExpansion:!1,receivedStatus:e.ReceivedStatus.READ,isStatusMessage:!1,isMentioned:!1,expansion:null,disableNotification:!1}),localStorage.setItem("missMessageMap-".concat(n,"-").concat(r),r)}}}),Object.defineProperty(r.prototype,"_removeSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;if(e===(null===(t=this._mainSession)||void 0===t?void 0:t.getCallId()))this._mainSession=null;else{var r=this._holdSessions.findIndex((function(t){return(null==t?void 0:t.getCallId())===e}));this._holdSessions.splice(r,1)}}}),Object.defineProperty(r.prototype,"_createSessionByServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),a(this,void 0,void 0,(function(){var i,n,a,l,_,u,C,d;return o(this,(function(o){switch(o.label){case 0:return this._logger.info(s.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_T,"callId: ".concat(e),t),[4,this.getCallSession({callId:e},t)];case 1:return i=o.sent(),n=i.code,a=i.data,n!==c.SUCCESS?(this._logger.error(s.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_R,"errcode: ".concat(n),t),[2]):(this._logger.info(s.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_R,"code: ".concat(n,", data: ").concat(JSON.stringify(a)),t),_=(l=a).callType,u=l.mediaType,C=l.callSessionUsers,d=l.startCallerId,this._mainSession=new x(e,exports.RCCallPlusCallState.CONNECTING,_,u,d,d,[],this._logger),r&&this._clearMobileOnPhone(e,t),this.updateUsersState(e,C,t),[2])}}))}))}}),Object.defineProperty(r.prototype,"_clearMobileOnPhone",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i;return o(this,(function(n){switch(n.label){case 0:return(r=_([this._mainSession],l(this._holdSessions),!1).find((function(t){return(null==t?void 0:t.getCallId())===e})))&&r.getCallType()===exports.RCCallPlusType.MULTI?(this._logger.info(s.L_CALL_ENGINE_UP_ON_PHONE_END_T,"callId: ".concat(e),t),[4,this.systemStatusUp({callId:e,sysStatus:exports.RCCallPlusReason.ON_PHONE_END,forward:$.CURRENT},t)]):[3,2];case 1:(i=n.sent().code)===c.SUCCESS?this._logger.info(s.L_CALL_ENGINE_UP_ON_PHONE_END_R,"callId: ".concat(e),t):this._logger.warn(s.L_CALL_ENGINE_UP_ON_PHONE_END_R,"callId: ".concat(e,", errCode: ").concat(i),t),n.label=2;case 2:return[2]}}))}))}}),Object.defineProperty(r.prototype,"_onUserStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){var n=this,a=this._context.getCurrentId();t.forEach((function(t){var r=t.userId,o=t.userState,l=t.systemState;r!==a&&n._reportAppEventModule.onRemoteUserStateChanged({callId:e,userId:r,userState:o,reason:l},i)})),t.forEach((function(t){var o=t.userId,l=t.systemState;o===a&&l===exports.RCCallPlusReason.ABNORMAL_END&&n.emit(r.__INNER_SESSION_CLOSE__,e,i)}))}}),Object.defineProperty(r.prototype,"_onOtherMemberInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){var r,i=e.userId,n=e.callId,a=null===(r=t.getLocalMainSession())||void 0===r?void 0:r.getInviterUserId();t._reportAppEventModule.onRemoteUserInvited([i],a,n)}))}}),Object.defineProperty(r.prototype,"_onRequestChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.userId,i=e.transactionId,n=e.mediaType;this._reportAppEventModule.onReceivedChangeMediaTypeRequest(r,i,n,t)}}),Object.defineProperty(r.prototype,"_receiveMediaTypeChangeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){t===exports.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE&&this.emit(r.__INNER_CHANGE_MEDIA_TYPE__,e.mediaType,i),this._reportAppEventModule.onReceivedChangeMediaTypeResult(n(n({},e),{code:t}),i)}}),Object.defineProperty(r.prototype,"_onCallTypeChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._reportAppEventModule.onCallTypeChanged(t,e,r)}}),Object.defineProperty(r,"__INNER_SESSION_CLOSE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-session-close"}),Object.defineProperty(r,"__INNER_SESSION_CONNECT__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-session-connect"}),Object.defineProperty(r,"__INNER_CHANGE_MEDIA_TYPE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-change-media-type"}),Object.defineProperty(r,"__INNER_INVITE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-invite"}),r}(e.EventEmitter);!function(e){e.NORMAL="RongCloudRTC",e.SCREEN="ScreenShare"}(ie||(ie={}));var ae,oe=function(r){function u(e,i,n,a,o,l){var _=r.call(this)||this;return Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(_,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(_,"_rtcClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(_,"_room",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(_,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(_,"_callMediaType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_videoConfig",{enumerable:!0,configurable:!0,writable:!0,value:{resolution:t.RCResolution.W640_H480,frameRate:t.RCFrameRate.FPS_15}}),Object.defineProperty(_,"_audioConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(_,"_isPubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(_,"_videoConfigIsChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(_,"_audioConfigIsChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(_,"_userViewMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(_,"_callPlusStatusReportListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(_,"_remoteAudioEnable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),_._rtcClient=null==n?void 0:n.rtcClient,_._isPubTiny=n.isPubTiny||!1,_}return i(u,r),Object.defineProperty(u.prototype,"setCallPlusStatusReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callPlusStatusReportListener=e}}),Object.defineProperty(u.prototype,"getCameraVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,i,n,a;return o(this,(function(o){switch(o.label){case 0:return!(t=this.getLocalVideoTrack())||this._videoConfigIsChange?[3,1]:(a={track:t,code:c.SUCCESS},[3,3]);case 1:return[4,this._createVideoTrack(e)];case 2:a=o.sent(),o.label=3;case 3:return i=(r=a).code,n=r.track,this._videoConfigIsChange=!1,i!==c.SUCCESS?[2,{code:i}]:[2,{code:c.SUCCESS,track:n}]}}))}))}}),Object.defineProperty(u.prototype,"getMicrophoneAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,i,n,a;return o(this,(function(o){switch(o.label){case 0:return!(t=this.getLocalAudioTrack())||this._audioConfigIsChange?[3,1]:(a={track:t,code:c.SUCCESS},[3,3]);case 1:return[4,this._createAudioTrack(e)];case 2:a=o.sent(),o.label=3;case 3:return i=(r=a).code,n=r.track,this._audioConfigIsChange=!1,i!==c.SUCCESS?[2,{code:i}]:[2,{code:c.SUCCESS,track:n}]}}))}))}}),Object.defineProperty(u.prototype,"createCallMediaTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i;return o(this,(function(n){switch(n.label){case 0:return this._callMediaType=e,[4,this.getMicrophoneAudioTrack(t)];case 1:return(r=n.sent().code)!==c.SUCCESS?[2,{code:r}]:e!==exports.RCCallPlusMediaType.AUDIO_VIDEO?[3,3]:[4,this.getCameraVideoTrack(t)];case 2:(i=n.sent().code)!==c.SUCCESS&&this._logger.warn(s.L_RTC_MODULE_CREATE_CALL_MEDIA_TRACKS_P,"get camera video track error code: ".concat(i),t),n.label=3;case 3:return[2,{code:c.SUCCESS}]}}))}))}}),Object.defineProperty(u.prototype,"setVideoConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._videoConfigIsChange=!0,this._videoConfig=e}}),Object.defineProperty(u.prototype,"setAudioConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._audioConfigIsChange=!0,this._audioConfig=e}}),Object.defineProperty(u.prototype,"destroyAllTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_RTC_MODULE_DESTROY_ALL_TRACKS_O,"",e),this._localTracks.forEach((function(e){e.destroy()})),this._localTracks.length=0}}),Object.defineProperty(u.prototype,"setAllRemoteAudioEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return this._logger.info(s.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_T,"enable: ".concat(t),r),e.isBoolean(t)?(this._remoteAudioEnable=t,this._room?(this._room.getRemoteTracks().filter((function(e){return e.isAudioTrack()})).forEach((function(e){t?e.unmute():e.mute()})),this._logger.info(s.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_R,"success",r),{code:c.SUCCESS}):{code:c.SUCCESS}):(this._logger.error(s.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_R,"param error, enable: type is boolean, value: ".concat(t)),{code:c.PARAM_ERROR})}}),Object.defineProperty(u.prototype,"destroyTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return o(this,(function(r){return e.destroy(),t=this._localTracks.findIndex((function(t){return t.getTrackId()===e.getTrackId()})),this._localTracks.splice(t,1),[2]}))}))}}),Object.defineProperty(u.prototype,"sessionConnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return a(this,void 0,void 0,(function(){var i,n,a,l,_;return o(this,(function(o){switch(o.label){case 0:return this._logger.info(s.L_RTC_MODULE_SESSION_CONNECT_T,"callId: ".concat(e),t),this._room?[3,2]:[4,this.joinRTCRoom(e,t)];case 1:if(i=o.sent(),_=i.code,n=i.room,_!==c.SUCCESS)return[2];this._room=n,o.label=2;case 2:return this._callId=e,this._regRTCListeners(),(a=(null===(r=this._room)||void 0===r?void 0:r.getRemoteUserIds())||[]).length>0&&this._onOtherMemJoined(a.map((function(t){return{callId:e,userId:t}})),t),this._localTracks.length>0?(this.emit(H.onBeforePublish),l=this._isPubTiny?this._localTracks.map((function(e){return e.isVideoTrack()?{track:e,isPubTiny:!0}:e})):this._localTracks,[4,this.publish(l,t)]):[3,4];case 3:return _=o.sent().code,this.emit(H.onPublishRes,_),[3,5];case 4:this._logger.warn(s.L_RTC_MODULE_SESSION_CONNECT_P,"sessionConnected local tracks is empty",t),o.label=5;case 5:return this._logger.info(s.L_RTC_MODULE_SESSION_CONNECT_R,"code: ".concat(c.SUCCESS),t),[2]}}))}))}}),Object.defineProperty(u.prototype,"sessionClose",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var i;return a(this,void 0,void 0,(function(){var n,a;return o(this,(function(o){switch(o.label){case 0:return this._logger.info(s.L_RTC_MODULE_SESSION_CLOSE_T,"callId: ".concat(e),r),this.destroyAllTracks(r),n=null===(i=this._room)||void 0===i?void 0:i.getRoomId(),this._room&&e===n?[4,this._rtcClient.leaveRoom(this._room)]:[3,2];case 1:return a=o.sent().code,this._releaseStoredData(),a!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_SESSION_CLOSE_R,"leaveRoom failed, code: ".concat(a),r),[2]):(this._logger.info(s.L_RTC_MODULE_SESSION_CLOSE_R,"leaveRoom success",r),[3,3]);case 2:this._logger.warn(s.L_RTC_MODULE_SESSION_CLOSE_R,"leaveRoom throw exception: not in room",r),o.label=3;case 3:return[2]}}))}))}}),Object.defineProperty(u.prototype,"disableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return(e=this.getLocalVideoTrack())?[4,e.mute()]:[2,{code:c.CAMERA_CLOSED}];case 1:return[2,{code:t.sent(),track:e}]}}))}))}}),Object.defineProperty(u.prototype,"enableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return(e=this.getLocalVideoTrack())?e.isOwnerMuted()?[4,e.unmute()]:[2,{code:c.SUCCESS}]:[2,{code:c.CAMERA_CLOSED}];case 1:return[2,{code:t.sent()}]}}))}))}}),Object.defineProperty(u.prototype,"changeVideoDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var r,i,n,a,l,_,s,u,C,d;return o(this,(function(o){switch(o.label){case 0:return r=[],i=[],[4,this._rtcClient.createCameraVideoTrack(ie.NORMAL,this._videoConfig)];case 1:return n=o.sent(),a=n.code,l=n.track,a!==t.RCRTCCode.SUCCESS?[2,{code:a}]:(_=this._videoConfig,s=_.minBitrate,u=_.maxBitrate,(s||u)&&l.setBitrate(u,s),this._localTracks&&this._localTracks.forEach((function(e){e.isVideoTrack()?(e.destroy(),C=e):i.push(e)})),this._localTracks=this._localTracks.filter((function(e){return C&&e.getTrackId()!==C.getTrackId()})),r.push(l),i.push(l),this._localTracks=i,this._onLocalTrackReady(r,e),this._room?[4,this._room.publish(r)]:[3,3]);case 2:if((d=o.sent().code)!==t.RCRTCCode.SUCCESS)return[2,{code:d}];o.label=3;case 3:return[2,{code:c.SUCCESS,track:l}]}}))}))}}),Object.defineProperty(u.prototype,"changeAudioDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var r,i,a,l,_,s,u;return o(this,(function(o){switch(o.label){case 0:return r=[],i=[],a=n(n({},this._audioConfig),{micphoneId:this._audioConfig.microphoneId}),[4,this._rtcClient.createMicrophoneAudioTrack(ie.NORMAL,a)];case 1:return l=o.sent(),_=l.code,s=l.track,_!==t.RCRTCCode.SUCCESS?[2,{code:_}]:(this._localTracks&&this._localTracks.forEach((function(e){e.isAudioTrack()||i.push(e)})),r.push(s),i.push(s),this._localTracks=i,this._onLocalTrackReady(r,e),this._room?[4,this._room.publish(r)]:[3,3]);case 2:if((u=o.sent().code)!==t.RCRTCCode.SUCCESS)return[2,{code:u}];o.label=3;case 3:return[2,{code:c.SUCCESS}]}}))}))}}),Object.defineProperty(u.prototype,"disableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return(e=this.getLocalAudioTrack())?[4,e.mute()]:[2,{code:c.MICROPHONE_CLOSED}];case 1:return[2,{code:t.sent(),track:e}]}}))}))}}),Object.defineProperty(u.prototype,"changeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r;return o(this,(function(i){switch(i.label){case 0:return this._logger.info(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_T,"mediaType: ".concat(e),t),e!==exports.RCCallPlusMediaType.AUDIO_VIDEO?[3,2]:[4,this._upgradeMediaType(t)];case 1:return r=i.sent(),[3,4];case 2:return[4,this._downgradeMediaType(t)];case 3:r=i.sent(),i.label=4;case 4:return r.code===c.SUCCESS&&this._logger.info(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"success",t),[2]}}))}))}}),Object.defineProperty(u.prototype,"_upgradeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,i,n,a,l,_,u,C;return o(this,(function(o){switch(o.label){case 0:return(t=this.getLocalVideoTrack())?[3,2]:[4,this._createVideoTrack(e)];case 1:if(r=o.sent(),i=r.code,n=r.track,i!==c.SUCCESS)return this._logger.error(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"create video track errCode: ".concat(i),e),[2,{code:i}];t=n,a=this._videoConfig,l=a.minBitrate,_=a.maxBitrate,(l||_)&&t.setBitrate(_,l),o.label=2;case 2:return u=this._isPubTiny?{track:t,isPubTiny:!0}:t,[4,this.publish([u],e)];case 3:return(C=o.sent().code)!==c.SUCCESS&&this._logger.error(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"publish errCode: ".concat(C),e),[2,{code:C}]}}))}))}}),Object.defineProperty(u.prototype,"_downgradeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var r,i;return o(this,(function(n){switch(n.label){case 0:return(r=this.getLocalVideoTrack())?[4,this._room.unpublish([r])]:[3,2];case 1:if((i=n.sent().code)!==t.RCRTCCode.SUCCESS)return this._logger.error(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"unpublish errCode: ".concat(i),e),[2,{code:i}];this.destroyTrack(r),n.label=2;case 2:return[2,{code:c.SUCCESS}]}}))}))}}),Object.defineProperty(u.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(r,i){return a(this,void 0,void 0,(function(){var n,a,l,_;return o(this,(function(o){switch(o.label){case 0:return this._logger.info(s.L_RTC_MODULE_JOIN_RTC_ROOM_T,"call: ".concat(r),i),[4,J({asyncFn:this._rtcClient.joinRTCRoomWithOptions.bind(this._rtcClient),fnArgs:[r,{mode:e.RTCMode.CALL}]})];case 1:return n=o.sent(),a=n.code,l=n.room,_=n.tracks,a!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_JOIN_RTC_ROOM_R,"callId: ".concat(r,", errCode: ").concat(a),i),this._onRTCMethodFail(exports.RCCallPlusReason.JOIN_ROOM_ERR,i),[2,{code:a}]):(this._logger.info(s.L_RTC_MODULE_JOIN_RTC_ROOM_R,"success",i),this._room=l,this._onSelfJoined({callId:r,userId:this._context.getCurrentId()},i),(null==_?void 0:_.length)&&this._onRemoteTrackPublish(_),this._callId=r,[2,{code:c.SUCCESS,room:l,tracks:_}])}}))}))}}),Object.defineProperty(u.prototype,"subscribeTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return a(this,void 0,void 0,(function(){var i;return o(this,(function(n){switch(n.label){case 0:return this._logger.info(s.L_RTC_MODULE_SUBSCRIBE_T,JSON.stringify({params:e.map((function(e){var t=e.track,r=e.subTiny;return{trackId:t.getTrackId(),subTiny:r}}))}),r),this._room?[4,J({asyncFn:this._room.subscribe.bind(this._room),fnArgs:[e],onError:function(e){}})]:[2,{code:c.SUCCESS}];case 1:return(i=n.sent().code)!==t.RCRTCCode.SUCCESS?(this._reportAppEventModule.onFetchRemoteMediaError(e,i),this._onRTCMethodFail(exports.RCCallPlusReason.SUBSCRIBE_ERR,r),this._logger.error(s.L_RTC_MODULE_SUBSCRIBE_R,"errorCode: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_SUBSCRIBE_R,"success",r),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(u.prototype,"unsubscribeTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return a(this,void 0,void 0,(function(){var i;return o(this,(function(n){switch(n.label){case 0:return this._logger.info(s.L_RTC_MODULE_UNSUBSCRIBE_T,JSON.stringify({trackIds:e.map((function(e){return e.getTrackId()}))}),r),this._room?[4,this._room.unsubscribe(e)]:[2,{code:c.SUCCESS}];case 1:return(i=n.sent().code)!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_UNSUBSCRIBE_R,"errorCode: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_UNSUBSCRIBE_R,"success",r),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(u.prototype,"_releaseStoredData",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._room=null,this._remoteAudioEnable=!0,this._userViewMap={}}}),Object.defineProperty(u.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t={};return this._room?(this._room.getRemoteUserIds().forEach((function(r){t[r]=e._room.getRemoteTracksByUserId(r)})),t):t}}),Object.defineProperty(u.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return null===(r=this._room)||void 0===r?void 0:r.getRemoteTracksByUserId(e).find((function(e){return t===exports.RCCallPlusMediaType.AUDIO?e.isAudioTrack():e.isVideoTrack()}))}}),Object.defineProperty(u.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._room?this._room.getSessionId():null}}),Object.defineProperty(u.prototype,"_regRTCListeners",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._room.registerRoomEventListener({onKickOff:function(t,r){e._onKickOff(t,e._room.getRoomId(),r),e._releaseStoredData()},onUserJoin:function(t){var r=t.map((function(t){return{callId:e._callId,userId:t}})),i=e._logger.createTraceId();e._onOtherMemJoined(r,i)},onUserLeave:function(t){t.forEach((function(t){delete e._userViewMap[t]}))},onTrackPublish:this._onRemoteTrackPublish.bind(this),onTrackUnpublish:this._onTrackUnpublish.bind(this),onTrackReady:function(t){e._onRemoteTrackReady([t])},onVideoMuteChange:function(t){e._onVideoMuteChagne({fromUserId:t.getUserId(),muted:t.isOwnerMuted(),trackId:t.getTrackId()})},onAudioMuteChange:function(t){e._onAudioMuteChange({fromUserId:t.getUserId(),muted:t.isOwnerMuted(),trackId:t.getTrackId()})},onRTCPeerConnectionCloseByException:this._onRTCPeerConnectionCloseByException.bind(this)}),this._room.registerReportListener({onStateReport:this._onRTCStateReport.bind(this)}),this._room.onAudioLevelChange((function(t){e._reportAppEventModule.onUserAudioLevelChanged(t)}))}}),Object.defineProperty(u.prototype,"_onLocalTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._reportAppEventModule.onUserMediaAvailable(e,t)}}),Object.defineProperty(u.prototype,"_onRemoteTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportAppEventModule.onUserMediaAvailable(e),this.emit(u.__INNER_RECEIVE_FIRST_FRAME__)}}),Object.defineProperty(u.prototype,"_onKickOff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i,n){this._logger.info(s.L_RTC_MODULE_RECEIVE_KICK_OFF_O,"roonId: ".concat(r,", byServer: ").concat(e,", state: ").concat(i,", kickExtra: ").concat(JSON.stringify(n)));var a=exports.RCCallPlusReason.CONNECTION_ERR;if(e)if(n)a=n.kickReasonCode;else switch(i){case t.RCKickReason.SERVER_KICK:a=exports.RCCallPlusReason.KICKED_BY_SERVER;break;case t.RCKickReason.OTHER_KICK:a=exports.RCCallPlusReason.OTHER_CLIENT_JOINED;break;case t.RCKickReason.IM_DISCONNECTED:a=exports.RCCallPlusReason.CONNECTION_ERR;break;case t.RCKickReason.IM_LOGOUT:a=exports.RCCallPlusReason.LOGOUT;break;case t.RCKickReason.OTHER_CLIENT_IM_CONNECTED:a=exports.RCCallPlusReason.OTHER_CLIENT_LOGIN}this.emit(u.__INNER_ON_KICKOFF__,a,r)}}),Object.defineProperty(u.prototype,"_onRTCPeerConnectionCloseByException",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_PEERCONNECTION_EXCEPT_CLOSE_O,"",e),this.emit(u.__INNER_RTC_PEERCONNECTION_ABNORMAL_CLOSE__,e)}}),Object.defineProperty(u.prototype,"_onSelfJoined",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(r){return this.emit(u.__INNER_ON_SELF_JOINED__,e.callId,t),[2]}))}))}}),Object.defineProperty(u.prototype,"_onRemoteTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=this._logger.createTraceId();this._onDeviceEnableChange(e,r),this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_PUBLISH_O,JSON.stringify({callId:this._callId,trackIds:e.map((function(e){return e.getTrackId()}))}),r);var i=[];e.forEach((function(e){var r,n=e.getUserId();if(e.isAudioTrack())i.push({track:e,subTiny:!1}),t._reportAppEventModule.onRemoteMicrophoneStateChanged(t._callId,e);else if(null===(r=t._userViewMap[n])||void 0===r?void 0:r.videoView){t._reportAppEventModule.onRemoteCameraStateChanged(t._callId,e);var a=t._userViewMap[n].isTiny;i.push({track:e,subTiny:a})}})),i.length&&this.subscribeTracks(i,r)}}),Object.defineProperty(u.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._onDeviceEnableChange(e,t),this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_UNPUBLISH_O,JSON.stringify({callId:this._callId,trackIds:e.map((function(e){return e.getTrackId()}))}),t),[4,this.unsubscribeTracks(e,t)];case 1:return r.sent(),[2]}}))}))}}),Object.defineProperty(u.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_ENABLE_CHANGE_O,JSON.stringify({info:e}),t);var r=this._room.getRemoteTrack(e.trackId);this._onDeviceEnableChange([r],t),this._reportAppEventModule.onRemoteMicrophoneStateChanged(this._callId,r)}}),Object.defineProperty(u.prototype,"_onVideoMuteChagne",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_ENABLE_CHANGE_O,JSON.stringify({info:e}),t);var r=this._room.getRemoteTrack(e.trackId);this._onDeviceEnableChange([r],t),this._reportAppEventModule.onRemoteCameraStateChanged(this._callId,r)}}),Object.defineProperty(u.prototype,"_onRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this,i=e.senders,n=e.receivers;i.forEach((function(e){var t,i=e.kind,n=e.packetsLostRate,a=e.rtt;r._callMediaType===exports.RCCallPlusMediaType.AUDIO_VIDEO&&"audio"===i||null===(t=r._callPlusStatusReportListener)||void 0===t||t.onSendPacketLoss(n||0,a||0)})),n.forEach((function(e){var i,n=e.trackId,a=e.kind,o=e.packetsLostRate,l=e.bitrate;if(r._callMediaType!==exports.RCCallPlusMediaType.AUDIO_VIDEO||"audio"!==a){var _=t.helper.parseTrackId(n).userId,s={};o&&(s[_]={packetLostRate:o,bitRate:l},null===(i=r._callPlusStatusReportListener)||void 0===i||i.onReceivePacketLoss(s))}}))}}),Object.defineProperty(u.prototype,"_onRTCMethodFail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.emit(u.__INNER_RTC_PROCESS_FAILED__,e,t)}}),Object.defineProperty(u.prototype,"_onOtherMemJoined",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.emit(u.__INNER_ON_OTHER_JOINED__,e,t)}}),Object.defineProperty(u.prototype,"_onDeviceEnableChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.emit(u.__INNER_ON_DEVICE_ENABLE_CHANGE__,e,t)}}),Object.defineProperty(u.prototype,"_createAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r;return a(this,void 0,void 0,(function(){var i,n,a,l,_,u,C;return o(this,(function(o){switch(o.label){case 0:return this._logger.info(s.L_RTC_MODULE_CREATE_AUDIO_TRACK_T,"",e),(null===(r=this._localTracks)||void 0===r?void 0:r.some((function(e){return e.isAudioTrack()})))?(this._logger.info(s.L_RTC_MODULE_CREATE_AUDIO_TRACK_R,"success",e),[2,{code:c.SUCCESS}]):(i=Object.assign(this._audioConfig,{micphoneId:this._audioConfig.microphoneId}),[4,this._rtcClient.createMicrophoneAudioTrack(ie.NORMAL,i)]);case 1:return n=o.sent(),a=n.code,l=n.track,a!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_CREATE_AUDIO_TRACK_R,"errCode: ".concat(a),e),[2,{code:a}]):(this._logger.info(s.L_RTC_MODULE_CREATE_AUDIO_TRACK_R,"success",e),_=this._audioConfig,u=_.minBitrate,C=_.maxBitrate,(u||C)&&l.setBitrate(C,u),this._localTracks.push(l),this._onLocalTrackReady([l],e),[2,{code:c.SUCCESS,track:l}])}}))}))}}),Object.defineProperty(u.prototype,"_createVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r;return a(this,void 0,void 0,(function(){var i,n,a,l,_,u;return o(this,(function(o){switch(o.label){case 0:return this._logger.info(s.L_RTC_MODULE_CREATE_VIDEO_TRACK_T,"",e),(null===(r=this._localTracks)||void 0===r?void 0:r.some((function(e){return e.isVideoTrack()&&!e.isDestroyed()})))?(this._logger.info(s.L_RTC_MODULE_CREATE_VIDEO_TRACK_R,"success",e),[2,{code:c.SUCCESS}]):[4,this._rtcClient.createCameraVideoTrack(ie.NORMAL,this._videoConfig)];case 1:return i=o.sent(),n=i.code,a=i.track,n!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_CREATE_VIDEO_TRACK_R,"errCode: ".concat(n),e),[2,{code:n}]):(this._logger.info(s.L_RTC_MODULE_CREATE_VIDEO_TRACK_R,"success",e),l=this._videoConfig,_=l.minBitrate,u=l.maxBitrate,(_||u)&&a.setBitrate(u,_),this._localTracks.push(a),this._onLocalTrackReady([a],e),[2,{code:c.SUCCESS,track:a}])}}))}))}}),Object.defineProperty(u.prototype,"getLocalVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return this._localTracks&&(e=l(this._localTracks.filter((function(e){return e.isVideoTrack()})),1)[0]),e}}),Object.defineProperty(u.prototype,"getLocalAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return this._localTracks&&(e=l(this._localTracks.filter((function(e){return e.isAudioTrack()})),1)[0]),e}}),Object.defineProperty(u.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return a(this,void 0,void 0,(function(){var i;return o(this,(function(n){switch(n.label){case 0:return this._logger.info(s.L_RTC_MODULE_PUBLISH_T,"tracksIds: ".concat(e.map((function(e){return e instanceof t.RCLocalTrack?e.getTrackId():e.track.getTrackId()}))),r),[4,J({asyncFn:this._room.publish.bind(this._room),fnArgs:[e],onError:function(e){}})];case 1:return(i=n.sent().code)!==t.RCRTCCode.SUCCESS?(this._onRTCMethodFail(exports.RCCallPlusReason.PUBLISH_ERR,r),this._logger.error(s.L_RTC_MODULE_PUBLISH_R,"errCode: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_PUBLISH_R,"code: ".concat(c.SUCCESS),r),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(u.prototype,"publishVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getLocalVideoTrack(),t=this._isPubTiny?{track:e,isPubTiny:!0}:e;return this._room.publish([t])}}),Object.defineProperty(u.prototype,"setVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=[];e.forEach((function(e){var t=e.userId,n=e.videoElement,a=e.isTiny,o=void 0!==a&&a;if(r._userViewMap[t]={videoView:n,isTiny:o},t!==r._context.getCurrentId()&&r._room){var s=(r.getRemoteTracks()[t]||[]).map((function(e){return{track:e,subTiny:o}})).filter((function(e){return!e.track.isSubscribed()}));i.push.apply(i,_([],l(s),!1))}})),this._logger.info(s.L_RTC_MODULE_SET_VIDEO_VIEW_O,JSON.stringify({userViewMap:b(this._userViewMap),needSubTrackIds:i.map((function(e){return e.track.getTrackId()}))}),t),i.length&&this.subscribeTracks(i,t)}}),Object.defineProperty(u.prototype,"removeVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=[];e.forEach((function(e){var t=r.getRemoteTracks()[e];if(t&&t.length){var n=t.filter((function(e){return e.isVideoTrack()}));n.length&&i.push(n[0])}delete r._userViewMap[e]})),this._logger.info(s.L_RTC_MODULE_REMOVE_VIDEO_VIEW_O,JSON.stringify({userViewMap:b(this._userViewMap),unsubTracks:i.map((function(e){return e.getTrackId()}))}),t),i.length&&this.unsubscribeTracks(i,t)}}),Object.defineProperty(u.prototype,"getUserViewMap",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._userViewMap}}),Object.defineProperty(u.prototype,"playMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i,n){return a(this,void 0,void 0,(function(){var a,l,_,u;return o(this,(function(o){switch(o.label){case 0:if(this._logger.info(s.L_RTC_MODULE_PLAY_MEDIA_T,"userId: ".concat(e,", mediaType: ").concat(r,", videoView: ").concat(null==i?void 0:i.nodeName),n),a=null,!(a=e===this._context.getCurrentId()?r===exports.RCCallPlusMediaType.AUDIO?this.getLocalAudioTrack():this.getLocalVideoTrack():this.getRemoteTracks()[e].filter((function(e){return r===exports.RCCallPlusMediaType.AUDIO?e.isAudioTrack():e.isVideoTrack()}))[0]))return this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"error code: ".concat(c.MEDIA_RESOURCE_INVALIED),n),[2,{code:c.MEDIA_RESOURCE_INVALIED}];o.label=1;case 1:return o.trys.push([1,6,,7]),a.isAudioTrack()?[4,a.play()]:[3,3];case 2:return _=o.sent(),[3,5];case 3:return[4,a.play(i)];case 4:_=o.sent(),o.label=5;case 5:return l=_.code,a.isAudioTrack()&&!this._remoteAudioEnable&&a.mute(),l!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"errCode: ".concat(l),n),[2,{code:l}]):(this._logger.info(s.L_RTC_MODULE_PLAY_MEDIA_R,"success",n),[2,{code:c.SUCCESS}]);case 6:return u=o.sent(),this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"errCode: ".concat(c.PLAY_MEDIA_FAILED,", message: ").concat(u.message,","),n),[2,{code:c.PLAY_MEDIA_FAILED}];case 7:return[2]}}))}))}}),Object.defineProperty(u,"__INNER_RTC_PROCESS_FAILED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-rtc-process-failed"}),Object.defineProperty(u,"__INNER_RTC_PEERCONNECTION_ABNORMAL_CLOSE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-rtc-peerconnection-abnormal-close"}),Object.defineProperty(u,"__INNER_ON_SELF_JOINED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-on-self-joined"}),Object.defineProperty(u,"__INNER_ON_OTHER_JOINED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-on-other-joined"}),Object.defineProperty(u,"__INNER_RECEIVE_FIRST_FRAME__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-receive-first-frame"}),Object.defineProperty(u,"__INNER_ON_KICKOFF__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-kickoff-frame"}),Object.defineProperty(u,"__INNER_ON_DEVICE_ENABLE_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-on-device-enable-change"}),u}(e.EventEmitter),le=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,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return a(this,void 0,void 0,(function(){var i,n;return o(this,(function(a){switch(a.label){case 0:if(!(i=null===(t=this._listener)||void 0===t?void 0:t[e]))return[2];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.apply(void 0,_([],l(r),!1))];case 2:return a.sent(),[3,4];case 3:return n=a.sent(),console.error(n),this._logger.error(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({name:n.name,message:n.message})),[3,4];case 4:return[2]}}))}))}}),Object.defineProperty(e.prototype,"onReceivedCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCall",callId:e.getCallId()}),t),this._callAppListener("onReceivedCall",e,r)}}),Object.defineProperty(e.prototype,"onRemoteUserInvited",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteUserInvited",inviteeUserList:e,inviterUserId:t,callId:r})),this._callAppListener("onRemoteUserInvited",e,t,r)}}),Object.defineProperty(e.prototype,"onCallConnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onCallConnected",callId:e.getCallId()})),this._callAppListener("onCallConnected",e)}}),Object.defineProperty(e.prototype,"onCallTypeChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onCallTypeChanged",callId:t,callType:e}),r),this._callAppListener("onCallTypeChanged",e,t)}}),Object.defineProperty(e.prototype,"onRemoteUserStateChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.callId,i=e.userId,n=e.userState,a=e.reason;this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteUserStateChanged",callId:r,userId:i,userState:n,reason:a}),t),this._callAppListener("onRemoteUserStateChanged",r,i,n,a)}}),Object.defineProperty(e.prototype,"onCallEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onCallEnded",callId:e.getCallId(),closeReason:t}),r),this._callAppListener("onCallEnded",e,t)}}),Object.defineProperty(e.prototype,"onRemoteCameraStateChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteCameraStateChanged",callId:e,trackId:null==t?void 0:t.getTrackId(),enable:null==t?void 0:t.isOwnerMuted()}));var r=null==t?void 0:t.getUserId();this._callAppListener("onRemoteCameraStateChanged",e,r,null==t?void 0:t.isOwnerMuted())}}),Object.defineProperty(e.prototype,"onRemoteMicrophoneStateChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteMicrophoneStateChanged",callId:e,trackId:null==t?void 0:t.getTrackId(),enable:null==t?void 0:t.isOwnerMuted()}));var r=null==t?void 0:t.getUserId();this._callAppListener("onRemoteMicrophoneStateChanged",e,r,null==t?void 0:t.isOwnerMuted())}}),Object.defineProperty(e.prototype,"onReceivedCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCallRecord",record:e}),t),this._callAppListener("onReceivedCallRecord",e)}}),Object.defineProperty(e.prototype,"onReceivedChangeMediaTypeRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedChangeMediaTypeRequest",userId:e,transactionId:t}),i),this._callAppListener("onReceivedChangeMediaTypeRequest",e,t,r)}}),Object.defineProperty(e.prototype,"onReceivedChangeMediaTypeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.userId,i=e.transactionId,n=e.mediaType,a=e.code;this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedChangeMediaTypeResult",userId:r,mediaType:n}),t),this._callAppListener("onReceivedChangeMediaTypeResult",{userId:r,transactionId:i,mediaType:n,code:a})}}),Object.defineProperty(e.prototype,"onReceivedCallStartTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCallStartTime",info:e}),t),this._callAppListener("onReceivedCallStartTime",e)}}),Object.defineProperty(e.prototype,"onReceivedCallFirstFrameTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCallFirstFrameTime",callId:e,callFirstFrameTime:t}),r),this._callAppListener("onReceivedCallFirstFrameTime",e,t)}}),Object.defineProperty(e.prototype,"onUserMediaAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onUserMediaAvailable",trackIds:e.map((function(e){return e.getTrackId()}))}),t),e.forEach((function(e){var t=e.getUserId(),i=e.isAudioTrack()?exports.RCCallPlusMediaType.AUDIO:exports.RCCallPlusMediaType.VIDEO;r._callAppListener("onUserMediaAvailable",t,i)}))}}),Object.defineProperty(e.prototype,"onFetchRemoteMediaError",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var i=e.track.getUserId();r._callAppListener("onFetchRemoteMediaError",i,t)}))}}),Object.defineProperty(e.prototype,"onUserAudioLevelChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){var r=e.track,i=e.audioLevel,n=r.getUserId();t._callAppListener("onUserAudioLevelChanged",n,i)}))}}),Object.defineProperty(e.prototype,"onReceivedCallPlusSummaryMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callAppListener("onReceivedCallPlusSummaryMessage",e)}}),e}();!function(e){e[e.UNKNOW_ERR=41e3]="UNKNOW_ERR",e[e.DB_ERR=41001]="DB_ERR",e[e.JSON_ERR=41002]="JSON_ERR",e[e.INVALID_JSON_ERR=41003]="INVALID_JSON_ERR",e[e.MISSING_PARAMS=41004]="MISSING_PARAMS",e[e.PARAMS_REQUIRED=41005]="PARAMS_REQUIRED",e[e.DATA_FORMAT_ERR=41006]="DATA_FORMAT_ERR",e[e.METHOD_NOT_IMPLEMENTED=41007]="METHOD_NOT_IMPLEMENTED",e[e.CALL_NOT_EXIST=41010]="CALL_NOT_EXIST",e[e.SINGAL_EXCEED_TWO_INVITEE=41011]="SINGAL_EXCEED_TWO_INVITEE",e[e.GROUP_EXCEEDS_QUORUM=41012]="GROUP_EXCEEDS_QUORUM",e[e.OPERATION_EXPIRED=41013]="OPERATION_EXPIRED",e[e.DEVICE_IS_CALLING=41014]="DEVICE_IS_CALLING",e[e.REPORT_STREAM_READY_TIME_IS_INVALID=41018]="REPORT_STREAM_READY_TIME_IS_INVALID",e[e.NOT_CALL_YOURSELF=41019]="NOT_CALL_YOURSELF",e[e.SESSION_STATUS_NOT_EXIST=41020]="SESSION_STATUS_NOT_EXIST",e[e.HANGUP_NOT_ALLOW=41021]="HANGUP_NOT_ALLOW",e[e.ACCEPT_NOT_ALLOW=41022]="ACCEPT_NOT_ALLOW",e[e.OPERATION_NOT_ALLOW=41025]="OPERATION_NOT_ALLOW",e[e.TRANSACTION_ID_ERR=41100]="TRANSACTION_ID_ERR",e[e.UP_VIDEO_CANCELED=41050]="UP_VIDEO_CANCELED",e[e.CURRENT_CALL_IS_AUDIO=41051]="CURRENT_CALL_IS_AUDIO",e[e.CURRENT_CALL_IS_VIDEO=41052]="CURRENT_CALL_IS_VIDEO"}(ae||(ae={}));var _e=function(){function t(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_androidPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(t.prototype,"setChannelIdMi",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.channelIdMi=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: channelIdMi type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setMiLargeIconUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._logger.warn(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"`setMiLargeIconUrl` has been deprecated."),this}}),Object.defineProperty(t.prototype,"setChannelIdHW",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.channelIdHW=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: channelIdHW type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setCategoryHW",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.categoryHW=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: categoryHW type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setImportanceHW",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"LOW"!==e&&"NORMAL"!==e?(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: importanceHW value is NORMAL|LOW, value: ".concat(e)),this):(this._androidPushConfig.importanceHW=e,this)}}),Object.defineProperty(t.prototype,"setImageUrlHW",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.imageUrlHW=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: imageUrlHW type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setChannelIdOPPO",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.channelIdOPPO=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: channelIdOPPO type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setTypeVivo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.typeVivo=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: typeVivo type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setCategoryVivo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.categoryVivo=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: categoryVivo type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setFcmChannelId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.fcmChannelId=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: fcmChannelId type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setFcmCollapseKey",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.fcmCollapseKey=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: fcmCollapseKey type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setFcmImageUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.fcmImageUrl=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: fcmImageUrl type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setimportanceHonor",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"LOW"!==e&&"NORMAL"!==e?(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: importanceHonor value is NORMAL|LOW, value: ".concat(e)),this):(this._androidPushConfig.importanceHonor=e,this)}}),Object.defineProperty(t.prototype,"setimageUrlHonor",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.imageUrlHonor=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: imageUrlHonor type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._androidPushConfig}}),t}(),se=function(){function r(e,r,i,n){var a=this;Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_videoConfig",{enumerable:!0,configurable:!0,writable:!0,value:{resolution:t.RCResolution.W640_H480,frameRate:t.RCFrameRate.FPS_15}}),Object.defineProperty(this,"_audioConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_callPlusStatistics",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clientCallId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_isLaunchHangup",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_needHangupCallId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rtcModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._reportAppEventModule=new le(r),this._callPlusStatistics=new G(this._logger,this._context),this._callEngine=new ne(this._context,this._runtime,this._initOpts,this._logger,this._reportAppEventModule),this._rtcModule=new oe(this._context,this._runtime,this._initOpts,this._logger,this._callEngine,this._reportAppEventModule),this._rtcModule.on(oe.__INNER_RTC_PROCESS_FAILED__,this._rtcProcessFailHandle.bind(this)),this._rtcModule.on(oe.__INNER_RTC_PEERCONNECTION_ABNORMAL_CLOSE__,this._peerConnectionAbnormalClose.bind(this)),this._rtcModule.on(oe.__INNER_ON_SELF_JOINED__,this._selfJoinedHandle.bind(this)),this._rtcModule.on(oe.__INNER_ON_OTHER_JOINED__,this._otherJoinedHandle.bind(this)),this._rtcModule.on(oe.__INNER_RECEIVE_FIRST_FRAME__,this._receiveFirstFrameHandle.bind(this)),this._rtcModule.on(oe.__INNER_ON_KICKOFF__,this._kickoffHandle.bind(this)),this._rtcModule.on(oe.__INNER_ON_DEVICE_ENABLE_CHANGE__,this._receiveDeviceEnableChangeHandle.bind(this)),this._callEngine.on(ne.__INNER_SESSION_CONNECT__,this._rtcModule.sessionConnected.bind(this._rtcModule)),this._callEngine.on(ne.__INNER_SESSION_CLOSE__,this._sessionCloseHandle.bind(this)),this._callEngine.on(ne.__INNER_CHANGE_MEDIA_TYPE__,this._rtcModule.changeMediaType.bind(this._rtcModule)),this._callEngine.on(ne.__INNER_INVITE__,(function(e,t){a._callPlusStatistics.reportStatisticsData(I.L_QS_RECEIVE_CALL_S,c.SUCCESS,+new Date,e,"",t)}))}return Object.defineProperty(r.prototype,"_rtcProcessFailHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._callEngine.getLocalMainSession();if(r){var i=r.getCallId();this._callEngine.systemStatusUp({callId:i,sysStatus:e,forward:$.CURRENT},t),this._callPlusStatistics.reportStatisticsData(I.L_QS_ABNORMAL_HANGUP_S,c.SUCCESS,+new Date,r),this.__innerHangup({callId:i,systemState:e},t)}}}),Object.defineProperty(r.prototype,"_peerConnectionAbnormalClose",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._callEngine.getLocalMainSession();t&&(this._callEngine.systemStatusUp({callId:t.getCallId(),sysStatus:exports.RCCallPlusReason.CONNECTION_ERR,forward:$.CURRENT},e),this._callEngine.endCurrentSession(exports.RCCallPlusReason.CONNECTION_ERR,t.getCallId(),e))}}),Object.defineProperty(r.prototype,"_selfJoinedHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,n,a,l,_,s;return o(this,(function(o){return r=this._context.getCurrentId(),i=this._callEngine.getLocalMainSession(),this._reportAppEventModule.onCallConnected(i),n=this._rtcModule.getLocalVideoTrack(),a=this._rtcModule.getLocalAudioTrack(),l=!!n&&!n.isOwnerMuted(),_=!!a&&!a.isOwnerMuted(),this._callEngine.setUserDeviceEnable(r,exports.RCCallPlusMediaType.VIDEO,l,t),this._callEngine.setUserDeviceEnable(r,exports.RCCallPlusMediaType.AUDIO,_,t),s=[{userId:r,userState:exports.RCCallPlusSessionUserState.ONCALL,systemState:exports.RCCallPlusReason.ONCALL,cameraEnable:l,microphoneEnable:_}],this._callEngine.updateUsersState(e,s,t),this._callEngine.startTimeCorrection(t),[2]}))}))}}),Object.defineProperty(r.prototype,"_otherJoinedHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i="",n=e.map((function(e){return i=e.callId,{userId:e.userId,userState:exports.RCCallPlusSessionUserState.ONCALL,systemState:exports.RCCallPlusReason.ONCALL,cameraEnable:!1,microphoneEnable:!1}}));this._callEngine.updateUsersState(i,n,t),(null===(r=this._callEngine.getLocalMainSession())||void 0===r?void 0:r.getState())!==exports.RCCallPlusCallState.ONCALL&&this._callEngine.updateMainSessionState(exports.RCCallPlusCallState.ONCALL)}}),Object.defineProperty(r.prototype,"_receiveFirstFrameHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(null===(t=this._callEngine.getLocalMainSession())||void 0===t?void 0:t.getState())!==exports.RCCallPlusCallState.ONCALL&&this._callEngine.updateMainSessionState(exports.RCCallPlusCallState.ONCALL),this._callEngine.upFirstFrameTime(e)}}),Object.defineProperty(r.prototype,"_kickoffHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(e!==exports.RCCallPlusReason.CONNECTION_ERR){var i=this._callEngine.getLocalMainSession();if(i){var n=i.getCallId();this._callPlusStatistics.reportStatisticsData(I.L_QS_ABNORMAL_HANGUP_S,c.SUCCESS,+new Date,i,this._clientCallId),this._callEngine.systemStatusUp({callId:n,sysStatus:e,forward:$.CURRENT},r),this._callEngine.endCurrentSession(e,t,r)}}else this._callEngine.endCurrentSession(e,t,r)}}),Object.defineProperty(r.prototype,"_receiveDeviceEnableChangeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var i=e.getUserId(),n=e.isAudioTrack()?exports.RCCallPlusMediaType.AUDIO:exports.RCCallPlusMediaType.VIDEO;r._callEngine.setUserDeviceEnable(i,n,!e.isOwnerMuted(),t)}))}}),Object.defineProperty(r.prototype,"_sessionCloseHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._isLaunchHangup||(this._clientCallId=""),this._isLaunchHangup=!1,this._rtcModule.sessionClose(e,t)}}),Object.defineProperty(r.prototype,"setCallPlusEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_SET_EVENT_LISTENER_O,e?Object.keys(e).join(","):null),this._reportAppEventModule.registerEventListener(e)}}),Object.defineProperty(r.prototype,"setStatusReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_SET_STATUS_REPORT_LISTENER_O,e?Object.keys(e).join(","):null),this._rtcModule.setCallPlusStatusReportListener(e)}}),Object.defineProperty(r.prototype,"setVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,n,a=this._logger.createTraceId();if(this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_T,JSON.stringify({list:t.map((function(e){var t=e.userId,r=e.videoElement,i=e.isTiny;return{userId:t,elementName:null==r?void 0:r.nodeName,isTiny:i}}))}),a),!e.notEmptyArray(t))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"params err, list: not empty array, value: ".concat(JSON.stringify(t)),a),{code:c.PARAM_ERROR};try{for(var o=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(t),l=o.next();!l.done;l=o.next()){var _=l.value,u=_.userId,C=_.videoElement;if(!e.notEmptyString(u))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"params err, userId: not empty string, value: ".concat(u),a),{code:c.PARAM_ERROR};if(!(n=C)||!n.nodeName||"VIDEO"!==n.nodeName.toUpperCase())return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"params err, videoElement: need a video element, value: ".concat(C instanceof HTMLElement?C.nodeName:C),a),{code:c.PARAM_ERROR}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"succes",a),this._rtcModule.setVideoView(t,a),{code:c.SUCCESS}}}),Object.defineProperty(r.prototype,"removeVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this._logger.createTraceId();return this._logger.info(s.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_T,JSON.stringify({userIds:t}),r),e.notEmptyArray(t)&&t.every((function(t){return e.notEmptyString(t)}))?(this._logger.info(s.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_R,"succes",r),this._rtcModule.removeVideoView(t,r),{code:c.SUCCESS}):(this._logger.error(s.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_R,"params err, userIds: not empty array, userId: not empty string, value: ".concat(JSON.stringify(t)),r),{code:c.PARAM_ERROR})}}),Object.defineProperty(r.prototype,"playMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return a(this,void 0,void 0,(function(){var i,n;return o(this,(function(a){return i=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_T,JSON.stringify({userId:t,mediaType:r}),i),e.notEmptyString(t)?e.isUndefined(exports.RCCallPlusMediaType[r])?(this._logger.error(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"params err, mediaType is illegal, value: ".concat(r),i),[2,{code:c.PARAM_ERROR}]):r===exports.RCCallPlusMediaType.AUDIO&&t===this._context.getCurrentId()?(this._logger.info(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"success",i),[2,{code:c.SUCCESS}]):(n=(this._rtcModule.getUserViewMap()[t]||{}).videoView,r===exports.RCCallPlusMediaType.AUDIO||n?[2,this._rtcModule.playMedia(t,r,n,i)]:(this._logger.error(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"errCode: ".concat(c.VIDEO_VIEW_NOT_SET,", video view not set"),i),[2,{code:c.VIDEO_VIEW_NOT_SET}])):(this._logger.error(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"params err, userId: not empty string, value: ".concat(t),i),[2,{code:c.PARAM_ERROR}])}))}))}}),Object.defineProperty(r.prototype,"createVideoConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new p(this._logger)}}),Object.defineProperty(r.prototype,"setVideoConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_T,JSON.stringify(e));var r=e.frameRate,i=e.resolution,a=e.maxBitrate,o=e.minBitrate;if(!t.RCFrameRate[r])return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,"param error, frameRate is illegal, value: ".concat(r)),{code:c.PARAM_ERROR};if(!t.RCResolution[i])return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,"param error, resolution is illegal, value: ".concat(i)),{code:c.PARAM_ERROR};var l=h(o,a),_=l.code,u=l.errorMsg;return _!==c.SUCCESS&&this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,u),this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,"success"),this._videoConfig=n({},e),this._rtcModule.setVideoConfig(this._videoConfig),{code:c.SUCCESS}}}),Object.defineProperty(r.prototype,"createAudioConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new g(this._logger)}}),Object.defineProperty(r.prototype,"createAndroidPushConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new _e(this._logger)}}),Object.defineProperty(r.prototype,"setAudioConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this._logger.info(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_T,JSON.stringify(t));var r=t.sampleRate,i=t.minBitrate,a=t.maxBitrate;if(r&&!e.isNumber(r))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R,"param error, sampleRate: type is number, value: ".concat(r)),{code:c.PARAM_ERROR};var o=h(i,a),l=o.code,_=o.errorMsg;return l!==c.SUCCESS&&this._logger.error(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R,_),this._logger.info(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R,"success"),this._audioConfig=n({},t),this._rtcModule.setAudioConfig(this._audioConfig),{code:c.SUCCESS}}}),Object.defineProperty(r.prototype,"startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n,l){return void 0===r&&(r=exports.RCCallPlusType.SINGLE),void 0===i&&(i=exports.RCCallPlusMediaType.AUDIO_VIDEO),a(this,void 0,void 0,(function(){var a,_,u,C,d,L,E,T,S,g,p;return o(this,(function(o){switch(o.label){case 0:if(this._clientCallId=e.getUUID(),a=+new Date,_=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_START_CALL_T,"userIds: ".concat(t.join(","),", callType: ").concat(r,", mediaType: ").concat(i,", pushConfig: ").concat(n,", extra: ").concat(l),_),this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED)return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"errCode: ".concat(c.SIGNAL_DISCONNECTED),_),[2,{code:c.SIGNAL_DISCONNECTED}];if(!(u=this._context.getNaviInfo())||!f(u))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"errCode: ".concat(c.RTC_SERVICE_UNAVAILABLE),_),[2,{code:c.RTC_SERVICE_UNAVAILABLE}];if(!e.notEmptyArray(t)||!t.every((function(t){return e.notEmptyString(t)})))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, userIds: not empty array, userId: not empty string, value: ".concat(JSON.stringify(t)),_),[2,{code:c.PARAM_ERROR}];if(e.isUndefined(exports.RCCallPlusType[r]))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, callType is illegal, value: ".concat(r),_),[2,{code:c.PARAM_ERROR}];if(e.isUndefined(exports.RCCallPlusMediaType[i]))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, mediaType is illegal, value: ".concat(i),_),[2,{code:c.PARAM_ERROR}];if(n&&(C=N(n)).code!==c.SUCCESS)return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, pushConfig is illegal, msg: ".concat(C.errorMsg),_),[2,{code:c.PARAM_ERROR}];if(l){if(!e.isString(l))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, extra is illegal, value: ".concat(l),_),[2,{code:c.PARAM_ERROR}];if(P(l)>Q)return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, extra max size is 128KB",_),[2,{code:c.PARAM_ERROR}]}return t.length>1&&r===exports.RCCallPlusType.SINGLE?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, You can only call one person in a single call, userIds: ".concat(t.join(",")),_),[2,{code:c.PARAM_ERROR}]):this._callEngine.getLocalMainSession()?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"errCode: ".concat(c.SESSION_EXIST,", session exist"),_),[2,{code:c.SESSION_EXIST}]):[4,this._rtcModule.createCallMediaTracks(i,_)];case 1:return(d=o.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"create meida tracks error code: ".concat(d),_),[2,{code:d}]):[4,this._callEngine.startCall({toUsers:t.map((function(e){return{userId:e}})),callType:r,mediaType:i,callId:this._clientCallId,pushConfig:n,extra:JSON.stringify({userId:this._context.getCurrentId(),extra:l})},_)];case 2:return L=o.sent(),E=L.code,T=L.data,this._callPlusStatistics.reportStatisticsData(I.L_QS_START_CALL_S,E,a,null,this._clientCallId,null,{mediaType:i,callType:r,callId:(null==T?void 0:T.callId)||""}),E!==c.SUCCESS?(this._rtcModule.destroyAllTracks(_),this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"signal error code: ".concat(E),_),[2,{code:E}]):(g=(S=T).callId,p=S.clientCallId,this._needHangupCallId===p?(this._callEngine.clearAllTimer(g,_),this._callEngine.hangup({callId:g,systemState:exports.RCCallPlusReason.CANCELLED},_),this._logger.info(s.L_CALLPLUS_CLIENT_START_CALL_R,"the ".concat(g," call has been hangup"),_),[2,{code:c.SUCCESS}]):(r===exports.RCCallPlusType.MULTI&&this._rtcModule.sessionConnected(g,_),this._logger.info(s.L_CALLPLUS_CLIENT_START_CALL_R,JSON.stringify({data:T,code:E}),_),[2,{code:c.SUCCESS,callId:g}]))}}))}))}}),Object.defineProperty(r.prototype,"joinMultiCall",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,i,n,a,l,_,u,C,d;return o(this,(function(o){switch(o.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_T,"callId: ".concat(t),r),this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"code: ".concat(c.SIGNAL_DISCONNECTED),r),[2,{code:c.SIGNAL_DISCONNECTED}]):(i=this._context.getNaviInfo())&&f(i)?e.notEmptyString(t)?[4,this._callEngine.getCallSession({callId:t},r)]:(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"params err, callId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"code: ".concat(c.RTC_SERVICE_UNAVAILABLE),r),[2,{code:c.RTC_SERVICE_UNAVAILABLE}]);case 1:return n=o.sent(),a=n.code,l=n.data,a!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"get call data error, code: ".concat(a),r),[2,{code:a}]):(_=l.mediaType,(u=this._callEngine.getLocalMainSession())&&u.getCallId()!==t?[2,{code:c.SESSION_EXIST}]:[4,this._rtcModule.createCallMediaTracks(_,r)]);case 2:return(C=o.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"create meida tracks error code: ".concat(C),r),[2,{code:C}]):[4,this._callEngine.joinCall({callId:t,mediaType:_},r)];case 3:return(d=o.sent().code)!==c.SUCCESS?(this._rtcModule.destroyAllTracks(r),this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"signal error code: ".concat(d),r),[2,{code:d}]):(this._logger.info(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"code: ".concat(c.SUCCESS),r),[4,this._rtcModule.sessionConnected(t,r)]);case 4:return o.sent(),[2,{code:c.SUCCESS}]}}))}))}}),Object.defineProperty(r.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n;return a(this,void 0,void 0,(function(){var a,u,C,d,L,E;return o(this,(function(o){switch(o.label){case 0:if(a=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_INVITE_T,"callId: ".concat(t.join(","),", pushConfig: ").concat(r,", extra: ").concat(i),a),!e.notEmptyArray(t)||!t.every((function(t){return e.notEmptyString(t)})))return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, userIds: not empty array, userId: not empty string, value: ".concat(JSON.stringify(t)),a),[2,{code:c.PARAM_ERROR}];if(r&&(u=N(r)).code!==c.SUCCESS)return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, pushConfig is illegal, msg: ".concat(u.errorMsg),a),[2,{code:c.PARAM_ERROR}];if(i){if(!e.isString(i))return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, extra is illegal, value: ".concat(i),a),[2,{code:c.PARAM_ERROR}];if(P(i)>Q)return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, extra max size is 128KB",a),[2,{code:c.PARAM_ERROR}]}return[4,this._callEngine.invite({toUsers:t.map((function(e){return{userId:e}})),pushConfig:r,extra:JSON.stringify({userId:this._context.getCurrentId(),extra:i})},a)];case 1:return C=o.sent(),d=C.code,L=C.data,d!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"signal error code: ".concat(d),a),[2,{code:d}]):(E=[],(null===(n=L.busylineUsers)||void 0===n?void 0:n.length)&&E.push.apply(E,_([],l(L.busylineUsers.map((function(e){return{userId:e.userId,state:e.sessionStatus}}))),!1)),this._logger.info(s.L_CALLPLUS_CLIENT_INVITE_R,"success busyUsers: ".concat(JSON.stringify(E)),a),[2,{code:c.SUCCESS,busyUsers:E}])}}))}))}}),Object.defineProperty(r.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return a(this,void 0,void 0,(function(){var i,n,a,l,_,u,C,d,L,E;return o(this,(function(o){switch(o.label){case 0:return i=+new Date,n=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_ACCEPT_T,"callId: ".concat(t,", pushConfig: ").concat(r),n),this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"errCode: ".concat(c.SIGNAL_DISCONNECTED),n),[2,{code:c.SIGNAL_DISCONNECTED}]):(a=this._context.getNaviInfo())&&f(a)?e.notEmptyString(t)?r&&(l=N(r)).code!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"params err, pushConfig is illegal, msg: ".concat(l.errorMsg),n),[2,{code:c.PARAM_ERROR}]):(_=this._callEngine.getLocalMainSession(),u=this._callEngine.getHoldSession(t),_||u?t===(null==u?void 0:u.getCallId())?[4,this.hangup(_.getCallId())]:[3,2]:(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"errCode : ".concat(c.NOT_IN_CALL,", session not exist"),n),[2,{code:c.NOT_IN_CALL}])):(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"params err, callId: not empty string, value: ".concat(t),n),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"errCode: ".concat(c.RTC_SERVICE_UNAVAILABLE),n),[2,{code:c.RTC_SERVICE_UNAVAILABLE}]);case 1:if((C=o.sent().code)!==c.SUCCESS)return this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"hangup mainSession error code: ".concat(C),n),[2,{code:C}];this._callEngine.upgradeMainSession(t),_=this._callEngine.getLocalMainSession(),o.label=2;case 2:return d=_.getMediaType(),[4,this._rtcModule.createCallMediaTracks(d,n)];case 3:return(L=o.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"create meida tracks error code: ".concat(L),n),[2,{code:L}]):[4,this._callEngine.accept({callId:t},n)];case 4:return E=o.sent().code,this._callPlusStatistics.reportStatisticsData(I.L_QS_ACCEPT_CALL_S,E,i,_),E!==c.SUCCESS?(this._rtcModule.destroyAllTracks(n),this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"signal error code: ".concat(E),n),[2,{code:E}]):(this._logger.info(s.L_CALLPLUS_CLIENT_ACCEPT_R,"success",n),this._rtcModule.sessionConnected(t,n),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"__innerHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return a(this,void 0,void 0,(function(){var i,n;return o(this,(function(a){switch(a.label){case 0:return i=e.callId,this._callEngine.setIsLocalClientHangup(!0),this._callEngine.clearAllTimer(i,t),[4,this._callEngine.hangup(e,t)];case 1:return(n=a.sent().code)===ae.CALL_NOT_EXIST?[2,{code:c.SUCCESS}]:n!==c.SUCCESS||i!==(null===(r=this._callEngine.getLocalMainSession())||void 0===r?void 0:r.getCallId())?[3,3]:[4,this._rtcModule.sessionClose(i,t)];case 2:a.sent(),a.label=3;case 3:return[2,{code:n}]}}))}))}}),Object.defineProperty(r.prototype,"hangup",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return a(this,void 0,void 0,(function(){var i,n,a,l,_,u,C,d,L,E,T,S;return o(this,(function(o){switch(o.label){case 0:return i=+new Date,n=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_HANGUP_T,"callId: ".concat(t,", pushConfig: ").concat(r),n),(a=this._callEngine.getLocalMainSession())?t&&!e.isString(t)?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"params err, callId: type is string, value: ".concat(t),n),[2,{code:c.PARAM_ERROR}]):r&&(l=N(r)).code!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"params err, pushConfig is illegal, msg: ".concat(l.errorMsg),n),[2,{code:c.PARAM_ERROR}]):(_=a.getCallId(),t&&t!==_&&!this._callEngine.getHoldSession(t)?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"params err, callId is invalid, value: ".concat(t),n),[2,{code:c.CALL_ID_INVALID}]):(this._isLaunchHangup=!0,this._needHangupCallId=t||_,u=this._callEngine.getHoldSession(this._needHangupCallId),C=u||a,d=this._context.getCurrentId(),L=a.getUserList().filter((function(e){return e.userId===d}))[0].state,E=[a.getCreatorUserId(),a.getInviterUserId()].includes(d),T=function(e,t){var r;switch(e){case exports.RCCallPlusSessionUserState.CALLING:r=exports.RCCallPlusReason.CANCELLED;break;case exports.RCCallPlusSessionUserState.RINGING:case exports.RCCallPlusSessionUserState.INVITED:r=exports.RCCallPlusReason.DECLINED;break;case exports.RCCallPlusSessionUserState.CONNECTING:r=t?exports.RCCallPlusReason.DECLINED:exports.RCCallPlusReason.CANCELLED;break;case exports.RCCallPlusSessionUserState.ONCALL:r=exports.RCCallPlusReason.ENDED}return r}(L,E)||exports.RCCallPlusReason.ENDED,[4,this.__innerHangup({callId:this._needHangupCallId,systemState:T,pushConfig:r},n)])):[2,{code:c.NOT_IN_CALL}];case 1:return S=o.sent().code,this._callPlusStatistics.reportStatisticsData(I.L_QS_HANGUP_CALL_S,S,i,C,this._clientCallId),S!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"signal error code : ".concat(S),n),[2,{code:S}]):(this._needHangupCallId=null,this._logger.info(s.L_CALLPLUS_CLIENT_HANGUP_R,"success",n),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"requestChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,i,n,a,l,_,u,C=this;return o(this,(function(o){switch(o.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_T,"mediaType: ".concat(t),r),e.isUndefined(exports.RCCallPlusMediaType[t])?(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"params err, mediaType is illegal, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]):(i=this.getCurrentCallSession(),n=null==i?void 0:i.getMediaType(),t===n?(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"error code: ".concat(c.MEDIATYPE_INVALID),r),[2,{code:c.MEDIATYPE_INVALID}]):this._callEngine.getLocalMainSession()?(a=null==i?void 0:i.getUserList().filter((function(e){return e.userId!==C._context.getCurrentId()})).map((function(e){return e.userId})),[4,this._callEngine.requestChangeMediaType({mediaType:t,toUserIds:a||[]},r)]):(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"error code : ".concat(c.NOT_IN_CALL,", session not exist"),r),[2,{code:c.NOT_IN_CALL}]));case 1:return l=o.sent(),_=l.code,u=l.data,_!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"signal error code: ".concat(_),r),[2,{code:_}]):(this._logger.info(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"success transactionId: ".concat(u.transactionId),r),[2,{code:c.SUCCESS,transactionId:u.transactionId}])}}))}))}}),Object.defineProperty(r.prototype,"cancelChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,i;return o(this,(function(n){switch(n.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_T,"transactionId: ".concat(t),r),e.notEmptyString(t)?this._callEngine.getLocalMainSession()?[4,this._callEngine.cancelChangeMediaType({transactionId:t},r)]:(this._logger.error(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"error code : ".concat(c.NOT_IN_CALL,", session not exist"),r),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"param error, transactionId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]);case 1:return(i=n.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"signal error code: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"success",r),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"replyChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return a(this,void 0,void 0,(function(){var i,n;return o(this,(function(a){switch(a.label){case 0:return i=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_T,"transactionId: ".concat(t),i),e.notEmptyString(t)?e.isBoolean(r)?this._callEngine.getLocalMainSession()?[4,this._callEngine.responseChangeMediaType({transactionId:t,agree:r},i)]:(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"error code : ".concat(c.NOT_IN_CALL,", session not exist"),i),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"param error, isAgree: type is boolean, value: ".concat(r),i),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"param error, transactionId: not empty string, value: ".concat(t),i),[2,{code:c.PARAM_ERROR}]);case 1:return(n=a.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"signal error: ".concat(n),i),[2,{code:n}]):(this._logger.info(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"success",i),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"getCurrentCallSession",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callEngine.getLocalMainSession()}}),Object.defineProperty(r.prototype,"getAvailableCallRecordsFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,t,r,i;return o(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_T,"",e),[4,this._callEngine.getOpenCallList(e)];case 1:return t=n.sent(),r=t.code,i=t.data,r!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_R,"signal error code: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_R,"success, data: ".concat(JSON.stringify(i)),e),[2,{code:c.SUCCESS,records:i}])}}))}))}}),Object.defineProperty(r.prototype,"getCallRecords",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return void 0===i&&(i=0),a(this,void 0,void 0,(function(){var n,a,l,_;return o(this,(function(o){switch(o.label){case 0:return n=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_T,"startTimestamp: ".concat(t,", count: ").concat(r),n),e.isNumber(t)&&t>=0?e.isNumber(r)&&r>0?[4,this._callEngine.getCallLogList({timestamp:t,count:r,order:i},n)]:(this._logger.error(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"params error, count: is a number >= 0, value: ".concat(r),n),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"params error, startTimestamp: is a number >= 0, value: ".concat(t),n),[2,{code:c.PARAM_ERROR}]);case 1:return a=o.sent(),l=a.code,_=a.data,l!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"signal error code: ".concat(l),n),[2,{code:l}]):(this._logger.info(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"success",n),[2,{code:c.SUCCESS,result:_}])}}))}))}}),Object.defineProperty(r.prototype,"deleteCallRecordsFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,i;return o(this,(function(n){switch(n.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_T,"callIds: ".concat(t.join(",")),r),e.notEmptyArray(t)&&t.every((function(t){return e.notEmptyString(t)}))?[4,this._callEngine.deleteCallLog(t,r)]:(this._logger.error(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R,"params err, callIds: not empty array, callId: not empty string, callIds: ".concat(JSON.stringify(t)),r),[2,{code:c.PARAM_ERROR}]);case 1:return(i=n.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R,"signal error code: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R,"success",r),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"deleteAllCallRecordsFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,t;return o(this,(function(r){switch(r.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_T,"",e),[4,this._callEngine.removeAllCallLog(e)];case 1:return(t=r.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_R,"signal error code: ".concat(t),e),[2,{code:t}]):(this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_R,"success",e),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"startCamera",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return a(this,void 0,void 0,(function(){var r,i,n,a,l,_;return o(this,(function(o){switch(o.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_START_CAMERA_T,"",r),[4,this._rtcModule.getCameraVideoTrack(r)];case 1:return i=o.sent(),n=i.code,a=i.track,n!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"create video track error code: ".concat(n),r),[2,{code:n}]):(this._callEngine.setUserDeviceEnable(this._context.getCurrentId(),exports.RCCallPlusMediaType.VIDEO,!0,r),(null==a?void 0:a.isPublished())||(null===(e=this._callEngine.getLocalMainSession())||void 0===e?void 0:e.getState())!==exports.RCCallPlusCallState.ONCALL?[3,3]:[4,this._rtcModule.publishVideoTrack()]);case 2:return(l=o.sent().code)!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"publish error code: ".concat(l),r),[2,{code:l}]):(this._logger.info(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"success",r),[2,{code:c.SUCCESS}]);case 3:return[4,this._rtcModule.enableVideoTrack(r)];case 4:return(_=o.sent().code)!==t.RCRTCCode.SUCCESS&&_!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"signal error code: ".concat(_),r),[2,{code:_}]):(this._logger.info(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"success",r),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"stopCamera",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,r,i,n;return o(this,(function(a){switch(a.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_STOP_CAMERA_T,"",e),[4,this._rtcModule.disableVideoTrack()];case 1:return r=a.sent(),i=r.code,n=r.track,i!==c.SUCCESS&&i!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_STOP_CAMERA_R,"error code: ".concat(i),e),[2,{code:i}]):(this._rtcModule.destroyTrack(n),this._callEngine.setUserDeviceEnable(this._context.getCurrentId(),exports.RCCallPlusMediaType.VIDEO,!1,e),this._logger.info(s.L_CALLPLUS_CLIENT_STOP_CAMERA_R,"success",e),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"switchCamera",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,i,n;return o(this,(function(a){switch(a.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_T,"cameraId: ".concat(t),r),e.notEmptyString(t)?(i=this._callEngine.getLocalMainSession())?i.getMediaType()===exports.RCCallPlusMediaType.AUDIO?(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"errCode: ".concat(c.NOT_VIDEO_CALL),r),[2,{code:c.NOT_VIDEO_CALL}]):(this._videoConfig.cameraId=t,this._rtcModule.setVideoConfig(this._videoConfig),[4,this._rtcModule.changeVideoDevice(r)]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"errCode: ".concat(c.NOT_IN_CALL),r),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"param error, cameraId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]);case 1:return(n=a.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"call client changeVideoDevice error code: ".concat(n),r),[2,{code:n}]):(this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"success",r),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"startMicrophone",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,r,i,n,a;return o(this,(function(o){switch(o.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_START_MICROPHONE_T,"",e),[4,this._rtcModule.getMicrophoneAudioTrack(e)];case 1:return r=o.sent(),i=r.code,n=r.track,i!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"create microphone audio track error code: ".concat(i),e),[2,{code:i}]):(this._callEngine.setUserDeviceEnable(this._context.getCurrentId(),exports.RCCallPlusMediaType.AUDIO,!0,e),n.isOwnerMuted()?[4,n.unmute()]:(this._logger.info(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"success",e),[2,{code:c.SUCCESS}]));case 2:return(a=o.sent())!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"signal error code: ".concat(i),e),[2,{code:a}]):(this._logger.info(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"success",e),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"stopMicrophone",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,r;return o(this,(function(i){switch(i.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_STOP_MICROPHONE_T,"",e),[4,this._rtcModule.disableAudioTrack()];case 1:return(r=i.sent().code)!==c.SUCCESS&&r!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_STOP_MICROPHONE_R,"signal error code: ".concat(r),e),[2,{code:r}]):(this._callEngine.setUserDeviceEnable(this._context.getCurrentId(),exports.RCCallPlusMediaType.AUDIO,!1,e),this._logger.info(s.L_CALLPLUS_CLIENT_STOP_MICROPHONE_R,"success",e),[2,{code:c.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"isMicrophoneEnabled",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._rtcModule.getLocalAudioTrack();return!!e&&!e.isOwnerMuted()}}),Object.defineProperty(r.prototype,"setAllRemoteAudioEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return o(this,(function(r){return t=this._logger.createTraceId(),[2,this._rtcModule.setAllRemoteAudioEnable(e,t)]}))}))}}),Object.defineProperty(r.prototype,"getVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"2.1.5-alpha.1"}}),Object.defineProperty(r.prototype,"getCameras",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,t.device.getCameras()];case 1:return[2,e.sent()]}}))}))}}),Object.defineProperty(r.prototype,"getMicrophones",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,t.device.getMicrophones()];case 1:return[2,e.sent()]}}))}))}}),Object.defineProperty(r.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rtcModule.getRTCSessionId()}}),Object.defineProperty(r.prototype,"switchMicrophone",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,i;return o(this,(function(n){switch(n.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_T,"microphoneId: ".concat(t),r),e.notEmptyString(t)?this._callEngine.getLocalMainSession()?(this._audioConfig.microphoneId=t,this._rtcModule.setAudioConfig(this._audioConfig),[4,this._rtcModule.changeAudioDevice(r)]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"errCode: ".concat(c.NOT_IN_CALL),r),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"param error, microphoneId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]);case 1:return(i=n.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"call client changeAudioDevice error code: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"success",r),[2,{code:c.SUCCESS}])}}))}))}}),r}();e.VersionManage.add("callplus","2.1.5-alpha.1");var ce={tag:"CallPlus",verify:function(t){return!!e.VersionManage.validEngine("5.8.2")||(console.error("The current engine version '".concat(e.VersionManage.getInfo().engine,"' error, plugin-call-plus required engine version at least '").concat("5.8.2","'.")),!1)},setup:function(t,r,i){var n,a=(n=i)?e.isObject(n)?Object.keys(n).includes("rtcClient")?e.isObject(n.rtcClient)?{isLegal:!0}:{isLegal:!1,msg:"Initialization 'rtcClient' parameter must be of type 'object'"}:{isLegal:!1,code:c.NOT_INSTALL_RTC_PLUGIN}:{isLegal:!1,msg:"Initialization options must be an object"}:{isLegal:!1,msg:"Initialization missing parameter -> options"};if(!a.isLegal)throw new Error("[CallPlusLib installer steup]".concat(a.msg));var o=t.createLogger("CallPlus","RTC"),l=e.isUndefined(i.logOutputLevel)?e.LogL.WARN:i.logOutputLevel;return o.setOutputLevel(l),o.warn(s.L_INDEX_INSTALL_CALL_PLUS_PLUGIN_O,"CallPlus Version: ".concat("2.1.5-alpha.1",", Commit: ").concat("56d103bb664bf42606d69da406331b37e6e1a112")),new se(t,o,r,i)}};Object.defineProperty(exports,"RCCallPlusFrameRate",{enumerable:!0,get:function(){return t.RCFrameRate}}),Object.defineProperty(exports,"RCCallPlusResolution",{enumerable:!0,get:function(){return t.RCResolution}}),exports.RCAudioConfigBuilder=g,exports.RCCallPlusAndroidPushConfigBuilder=_e,exports.RCCallPlusClient=se,exports.RCCallPlusCode=c,exports.RCCallPlusSession=S,exports.RCVideoConfigBuilder=p,exports.installer=ce;
|
package/package.json
CHANGED
|
@@ -21,12 +21,15 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"README.md",
|
|
23
23
|
"LICENSE",
|
|
24
|
-
"wrapper"
|
|
24
|
+
"wrapper",
|
|
25
|
+
"index.d.ts",
|
|
26
|
+
"idnex.esm.js",
|
|
27
|
+
"index.js"
|
|
25
28
|
],
|
|
26
29
|
"license": "LGPL 2.1",
|
|
27
30
|
"description": "@rongcloud/plugin-call-plus",
|
|
28
31
|
"homepage": "https://www.rongcloud.cn",
|
|
29
|
-
"version": "2.1.
|
|
32
|
+
"version": "2.1.5-alpha.1",
|
|
30
33
|
"dependencies": {
|
|
31
34
|
"@rongcloud/engine": "^5.8.2",
|
|
32
35
|
"@rongcloud/plugin-rtc": "^5.7.0"
|