@rongcloud/plugin-rtc 5.7.3-enterprise-alpha.8 → 5.7.3-enterprise-lz-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/dist/index.cjs.js +1 -25
- package/dist/index.d.ts +3040 -2952
- package/dist/index.esm.js +1 -25
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
import{HttpMethod as e,isArray as t,notEmptyObject as r,notEmptyArray as n,RCConnectionStatus as i,isNumber as o,EventEmitter as a,validate as s,isObject as c,ErrorCode as u,notEmptyString as l,isString as d,assert as _,ConversationType as p,logger as f,isNull as b,isHttpUrl as m,isUndefined as h,forEach as g,VersionManage as v,AssertRules as R}from"@rongcloud/engine";var S=function(e,t){return S=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])},S(e,t)};function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}S(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var T,E,O=function(){return O=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},O.apply(this,arguments)};function C(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function I(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function L(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function P(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function A(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.L_INDEX_INSTALL_RTC_PLUGIN_O="L-index_install_rtc_plugin-O",e.L_RTC_CLIENT_IM_CONNECTION_STATE_S="L-rtc_client_im_connection_state-S",e.L_RTC_CLIENT_IM_DISCONNECT_S="L-rtc_client_im_disconnect-S",e.L_RTC_CLIENT_MESSAGE_O="L-rtc_client_message-O",e.L_RTC_CLIENT_DESTROY_S="L-rtc_client_destroy-S",e.L_RTC_CLIENT_JOIN_RTC_ROOM_T="L-rtc_client_join_rtc_room-T",e.L_RTC_CLIENT_JOIN_RTC_ROOM_R="L-rtc_client_join_rtc_room-R",e.L_RTC_JOIN_MEETING_ROOM_T="L-join-meeting-room-T",e.L_RTC_JOIN_MEETING_ROOM_R="L-join-meeting-room-R",e.L_RTC_CLIENT_LEAVE_ROOM_T="L-rtc_client_leave_room-T",e.L_RTC_CLIENT_LEAVE_ROOM_R="L-rtc_client_leave_room-R",e.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O="L-rtc_client_create_microphone_audio_track-O",e.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O="L-rtc_client_create_camera_video_track-O",e.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O="L-rtc_client_create_microphone_and_camera_tracks-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O="L-rtc_client_create_screen_video_track-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O="L-rtc_client_create_screen_video_and_audio_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O="L-rtc_client_create_local_audio_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O="L-rtc_client_create_local_video_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O="L-rtc_client_create_local_file_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O="L-rtc_client_create_local_tracks-O",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T="L-rtc_client_get_joined_room_info-T",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R="L-rtc_client_get_joined_room_info-R",e.L_PINGER_START_O="L-pinger_start-O",e.L_PINGER_STOP_O="L-pinger_stop-O",e.L_PINGER_SEND_RTCPING_T="L-pinger_send_rtcping-T",e.L_PINGER_SEND_RTCPING_R="L-pinger_send_rtcping-R",e.L_PINGER_SEND_RTCPING_E="L-pinger_send_rtcping-E",e.L_ABSTRACT_ROOM_SEND_MESSAGE_T="L-abstract_room_send_message-T",e.L_ABSTRACT_ROOM_SEND_MESSAGE_R="L-abstract_room_send_message-R",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T="L-abstract_room_set_room_attribute-T",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R="L-abstract_room_set_room_attribute_R",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T="L-abstract_room_delete_room_attribute_T",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R="L-abstract_room_delete_room_attribute_R",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T="L-abstract_room_get_room_attribute_T",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R="L-abstract_room_get_room_attribute_R",e.L_ABSTRACT_ROOM_PUBLISH_T="L-abstract_room_publish-T",e.L_ABSTRACT_ROOM_PUBLISH_R="L-abstract_room_publish-R",e.L_ABSTRACT_ROOM_PUBLISH_P="L-abstract_room_publish-P",e.L_ABSTRACT_ROOM_PUBLISH_E="L-abstract_room_publish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_T="L-abstract_room_unpublish-T",e.L_ABSTRACT_ROOM_UNPUBLISH_R="L-abstract_room_unpublish-R",e.L_ABSTRACT_ROOM_UNPUBLISH_E="L-abstract_room_unpublish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_P="L-abstract_room_unpublish-P",e.L_ABSTRACT_ROOM_SUBSCRIBE_T="L-abstract_room_subscribe-T",e.L_ABSTRACT_ROOM_SUBSCRIBE_R="L-abstract_room_subscribe-R",e.L_ABSTRACT_ROOM_SUBSCRIBE_E="L-abstract_room_subscribe-E",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_T="L-abstract_room_unsubscribe-T",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_R="L-abstract_room_unsubscribe-R",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_E="L-abstract_room_unsubscribe-E",e.L_APP_CALL_UNSUBSCRIBE_O="L-app_call_unsubscribe-O",e.L_USER_LEFT_UNSUBSCRIBE_O="L-user_left_unsubscribe-O",e.L_RES_UNPUB_UNSUBSCRIBE_O="L-res_unpub_unsubscribe-O",e.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O="L-abstract_room_register_room_event_listener-O",e.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O="L-abstract_room_register_report_listener-O",e.L_ABSTRACT_ROOM_AUDIO_LEVEL_O="L-abstract_room_audio_level-O",e.L_ABSTRACT_ROOM_IM_RECONNECTED_T="L-abstract_room_im_reconnected-T",e.L_ABSTRACT_ROOM_IM_RECONNECTED_R="L-abstract_room_im_reconnected-R",e.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O="L-abstract_room_call_app_listener-O",e.L_ABSTRACT_ROOM_SETBITRATE_O="L-abstract_room_setBitrate-O",e.L_ABSTRACT_ROOM_ONTRACKREADY_O="L-abstract_room_onTrackReady-O",e.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O="L-abstract_room_receive_message-O",e.L_ABSTRACT_ROOM_ONKICKOFF_O="L-abstract_room_onKickoff-O",e.L_MEDIA_SERVICE_MSLIST_CHANGE_O="L-media_service_msList_change-O",e.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O="L-media_service_parse_navi_callvoip_info-O",e.L_MEDIA_SERVICE_REQUEST_T="L-media_service_request-T",e.L_MEDIA_SERVICE_REQUEST_R="L-media_service_request-R",e.L_LOCAL_TRACK_DESTROY_O="L-local_track_destroy-O",e.L_LOCAL_TRACK_SET_BITRATE_O="L-local_track_set_bitrate-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_O="L-local_track_set_local_muted-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T="L-local_track_set_local_muted_spread-T",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R="L-local_track_set_local_muted_spread-R",e.L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_T="L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_T",e.L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_R="L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_R",e.L_TRACK_PLAY_O="L-track_play-O",e.L_TRACK_PLAY_E="L-track_play-E",e.L_TRACK_LOAD_START_O="L-track_load_start-O",e.L_TRACK_DURATION_CHANGE_O="L-track_duration_change-O",e.L_TRACK_LOADED_META_DATA_O="L-track_loaded_meta_data-O",e.L_TRACK_LOADED_DATA_O="L-track_loaded_data-O",e.L_TRACK_ABORT_O="L-track_abort-O",e.L_TRACK_VOLUME_CHANGE_O="L-track_volume_change-O",e.L_TRACK_CANPLAY_O="L-track_canplay-O",e.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O="L-abstract_stat_parser_format_rtc_state_report-O",e.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O="L-a_sdp_strategy_set_sdp_semantics-O",e.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O="L-a_sdp_strategy_set_remote_answer-O",e.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O="L-rtc_peer_connection_add_local_track-O",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S="L-rtc_peer_connection_ice_connection_state-S",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R="L-rtc_peer_connection_ice_connection_state_report-R",e.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S="L-rtc_peer_connection_connection_state-S",e.L_RTC_PEER_CONNECTION_SET_BITRATE_O="L-rtc_peer_connection_set_bitrate-O",e.L_RTC_PEER_CONNECTION_CREATE_OFFER_O="L-rtc_peer_connection_create_offer-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O="L-rtc_peer_connection_remove_local_track_by_id-O",e.L_RTC_PEER_CONNECTION_REMOVE_ALL_LOCAL_TRACK_O="L-rtc_peer_connection_remove_all_local_track-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O="L-rtc_peer_connection_remove_local_track-O",e.L_RTC_PEER_CONNECTION_DESTROY_O="L-rtc_peer_connection_destroy-O",e.L_RTC_SET_RECOMMEND_BITRATE_O="L_rtc_set_recommend_bitrate_O",e.L_RTC_3ANOISE_NODE_O="L_RTC_AAAnoiseNode_O",e.L_RTC_3ANOISE_NODE_E="L_RTC_AAAnoiseNode_E",e.L_RTC_3ANOISE_NODE_STOP_O="L_RTC_AAAnoiseNode_Stop_O",e.L_QS_JOIN_ROOM_S="RTC-joinRoomRtc-S",e.L_QS_SUBSCRIBE_S="RTC-subscribe-S",e.L_QS_UNSUBSCRIBE_S="RTC-unsubscribe-S",e.L_QS_PUBLISH_S="RTC-publishRtc-S",e.L_QS_UNPUBLISH_S="RTC-unpublishRtc-S",e.L_QS_ICE_STATUS_S="RTC-iceStatus-S",e.L_QS_KICKED_S="RTC-forcedOffline-S",e.L_QS_PUB_ICE_STATUS_S="RTC-pubIceConnected-S",e.L_QS_SUB_ICE_STATUS_S="RTC-subIceConnected-S",e.L_QS_RECV_PUB_MSG_S="RTC-recvPubMsg-S",e.L_QS_MEIDA_PING_DETECT_S="RTC-mediaPingDetect-S",e.L_QS_LOCAL_STREAM_STATE_CHANGED_S="RTC-localStreamStateChanged-S",e.L_QS_LEAVE_RTC_ROOM_S="RTC-leaveRtcRoom-S",e.L_QS_DECODE_FIRST_S="RTC-decodeFirst-S",e.L_SET_ENCODER_PREFERENCES_S="RTC-set_Encoder_Preferences-S",e.L_RTCNTF_PULL_ROOM_STATUS_O="L-rtcntf_pull_room_status-O",e.L_RTCPING_PULL_ROOM_STATUS_O="L-rtcping_pull_room_status-O",e.L_PULL_ROOM_STATUS_T="L-pull_room_status-T",e.L_PULL_ROOM_STATUS_P="L-pull_room_status-P",e.L_PULL_ROOM_STATUS_R="L-pull_room_status-R",e.L_PARSE_REMOTE_RES_COMMAND_P="L-parse_remote_res_command-P",e.L_UPDATE_SUB_REMOTE_TRACKS_O="L_update_sub_remote_tracks_O",e.L_OLD_DAILY_RECORD_O="L-old_daily_record-O",e.L_REMOTE_USER_JOINED_RESOURCES_O="L-remote_user_joined_resources-O",e.L_REMOTE_USER_STATE_HANDLE_O="L-remote_user_state_handle-O",e.L_HTTP_POLARIS_REPORT_FAIL_O="L-http_polaris_report_fail-O",e.L_HTTP_POLARIS_REPORT_LOCAL_QOS_FAIL_O="L_HTTP_POLARIS_REPORT_LOCAL_QOS_FAIL_O",e.L_UPDATE_SUBSCRIBELIST_COMMAND_T="L-update_subscribeList_command-T",e.L_UPDATE_SUBSCRIBELIST_COMMAND_P="L-update_subscribeList_command-P",e.L_UPDATE_SUBSCRIBELIST_COMMAND_R="L-update_subscribeList_command-R",e.L_RTC_CLIENT_NAVI_CHANGE_O="L-rtc_client_navi_change-O",e.L_UNPUBLISH_PREV_COMMAND_T="L-unpublish_prev_command-T",e.L_UNPUBLISH_PREV_COMMAND_R="L-unpublish_prev_command-R",e.L_RETRY_EXCHANGE_COMMAND_T="L-retry_exchange_command-T",e.L_RETRY_EXCHANGE_SPREAD_T="L-retry_exchange_spread-T",e.L_RETRY_EXCHANGE_SPREAD_R="L-retry_exchange_spread-R",e.L_PARSE_USERSTATE_COMMAND_R="L-parse_userstate_command-R",e.L_RESUB_REPUB_RES_R="L-resub_repub_res-R",e.L_PARSE_ROOMDATA_URIS_R="L-parse_roomdata_uris-R",e.L_SET_AUDIO_CONSTRAINTS_O="L-set_audio_constraints-O",e.L_FUNCTION_IS_UNAVAILABLE="L-function_is_unavailable",e.L_CLEAR_UNSUBSCRIBE_LIST_O="L-clear_unsubscribe_list-O",e.L_INVOKER_PUSH_O="L-invoker_push-O",e.L_INVOKER_EXECUTE_T="L-invoker_execute-T",e.L_INVOKER_EXECUTE_R="L-invoker_execute-R",e.L_INVOKER_EXECUTE_E="L-invoker_execute-E",e.L_INVOKER_DESTROY_O="L-invoker_destroy-R",e.L_QOS_R3_DATA_O="L-qos_r3_data-O",e.L_QOS_R4_DATA_O="L-qos_r4_data-O",e.L_SDK_EXECUTE_E="L-sdk_execute-E",e.L_START_1V1_CALL_AND_JOIN_ROOM_T="L-start_1v1_call_and_join_room-T",e.L_START_1V1_CALL_AND_JOIN_ROOM_R="L-start_1v1_call_and_join_room-R",e.L_ACCEPT_1V1_CALL_AND_JOIN_ROOM_T="L-accept_1v1_call_and_join_room-T",e.L_ACCEPT_1V1_CALL_AND_JOIN_ROOM_R="L-accept_1v1_call_and_join_room-R",e.L_JOIN_CALL_AND_JOIN_ROOM_T="L-join_call_and_join_room-T",e.L_JOIN_CALL_AND_JOIN_ROOM_R="L-join_call_and_join_room-R",e.L_HANGUP_1V1_CALL_AND_EXIT_ROOM_T="L-hangup_1v1_call_and_exit_room-T",e.L_HANGUP_1V1_CALL_AND_EXIT_ROOM_R="L-hangup_1v1_call_and_exit_room-R",e.L_PUBLISH_AND_SUBSCRIBE_STREAMS_T="L-publish_and_subscribe_streams-T",e.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P="L-publish_and_subscribe_streams-P",e.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R="L-publish_and_subscribe_streams-R",e.L_PRE_PUB_AND_SUB_T="L_PRE_PUB_AND_SUB_T",e.L_PRE_PUB_AND_SUB_R="L_PRE_PUB_AND_SUB_R",e.L_UN_PRE_PUB_AND_SUB_T="L_UN_PRE_PUB_AND_SUB_T",e.L_UN_PRE_PUB_AND_SUB_R="L_UN_PRE_PUB_AND_SUB_R",e.L_JOIN_MEETING_AND_RTC_ROOM_T="L-join_meeting_and_rtc_room-T",e.L_JOIN_MEETING_AND_RTC_ROOM_R="L-join_meeting_and_rtc_room-R",e.L_JOIN_MEETING_AND_RTC_ROOM_P="L-join_meeting_and_rtc_room-P",e.L_QUICK_MEETING_AND_RTC_ROOM_T="L-quick_meeting_and_rtc_room-T",e.L_QUICK_MEETING_AND_RTC_ROOM_R="L-quick_meeting_and_rtc_room-R",e.L_QUICK_MEETING_AND_RTC_ROOM_P="L-quick_meeting_and_rtc_room-P",e.L_END_MEETING_AND_RTC_ROOM_T="L-end_meeting_and_rtc_room-T",e.L_END_MEETING_AND_RTC_ROOM_R="L-end_meeting_and_rtc_room-R",e.L_LEAVE_MEETING_AND_RTC_ROOM_R="L-leave_meeting_and_rtc_room-R",e.L_LEAVE_MEETING_AND_RTC_ROOM_T="L-leave_meeting_and_rtc_room-T",e.L_END_MEETING_ONLY_O="L_END_MEETING_ONLY_O",e.L_RTCNTF_PULL_MEETING_AND_ROOM_STATUS_O="L-rtcntf_pull_meeting_and_room_status-O",e.L_PULL_CONNECTION_STATUS_O="L-pull_connection_status-O",e.L_PULL_MEETING_AND_ROOM_STATUS_T="L-pull_meeting_and_room_status-T",e.L_PULL_MEETING_AND_ROOM_STATUS_R="L-pull_meeting_and_room_status-R",e.L_PULL_MEETING_AND_ROOM_STATUS_P="L-pull_meeting_and_room_status-P",e.L_PULL_JOIN_MEETING_STATUS_T="L-pull_join_meeting_status-T",e.L_PULL_JOIN_MEETING_STATUS_R="L-pull_join_meeting_status-R",e.L_PULL_JOIN_MEETING_STATUS_P="L-pull_join_meeting_status-P",e.L_DATACHANNEL_OPEN_O="L_DATACHANNEL_OPEN_O",e.L_DATACHANNEL_OPEN_FAILED_O="L_DATACHANNEL_OPEN_FAILED_O",e.L_DATACHANNEL_CLOSE_O="L_DATACHANNEL_CLOSE_O",e.L_DATACHANNEL_E="L_DATACHANNEL_E",e.L_DATACHANNEL_RECV_MSG_O="L_DATACHANNEL_RECV_MSG_O",e.L_SUB_PEER_SET_REMOTE_DESC_E="L_SUB_PEER_SET_REMOTE_DESC_E",e.L_SUB_PEER_CREATE_OFFER_E="L_SUB_PEER_CREATE_OFFER_E",e.L_SUB_PEER_SET_OFFER_O="L_SUB_PEER_SET_OFFER_O",e.L_SUB_PEER_SET_REMOTE_DESC_O="L_SUB_PEER_SET_REMOTE_DESC_O",e.L_SUB_PEER_SET_LOCAL_DESC_E="L_SUB_PEER_SET_LOCAL_DESC_E",e.L_PEER_SET_REMOTE_DESC_E="L_PEER_SET_REMOTE_DESC_E",e.L_PEER_CREATE_OFFER_E="L_PEER_CREATE_OFFER_E",e.L_PEER_SET_LOCAL_DESC_E="L_PEER_SET_LOCAL_DESC_E",e.L_SUB_ICE_CONNECTION_S="L_SUB_ICE_CONNECTION_S",e.L_SUB_CONNECTION_S="L_SUB_CONNECTION_S",e.L_SEND_VIDEO_SUB_REQ_T="L_SEND_VIDEO_SUB_REQ_T",e.L_SEND_VIDEO_SUB_REQ_R="L_SEND_VIDEO_SUB_REQ_R",e.L_SEND_VIDEO_SUB_REQ_E="L_SEND_VIDEO_SUB_REQ_E",e.L_RETRY_SUB_AUDIO_O="L_RETRY_SUB_AUDIO_O",e.L_REMOVE_SRC_OBJECT_O="L_REMOVE_SRC_OBJECT_O",e.L_AUDIO_LEVEL_O="L_AUDIO_LEVEL_O",e.L_COLLECT_VOLUME_O="L_COLLECT_VOLUME_O",e.L_SPEAKER_VOLUME_CHANGE_O="L_SPEAKER_VOLUME_CHANGE_O",e.L_DEVICE_CHANGED_O="L_DEVICE_CHANGED_O",e.L_MICPHONE_VOLUME_CHANGE_O="L_MICPHONE_VOLUME_CHANGE_O",e.L_SUB_ICE_CONNECTION_STATE_S="L_SUB_ICE_CONNECTION_STATE_S",e.L_LOCAL_SRFLX_ADDRESS_O="L_LOCAL_SRFLX_ADDRESS_O",e.L_GET_LOCAL_SRFLX_ADDRESS_PEER_E="L_GET_LOCAL_SRFLX_ADDRESS_PEER_E",e.L_GET_MEDIA_SERVICE_LIST_O="L_GET_MEDIA_SERVICE_LIST_O",e.L_FAST_MEDIA_URL="L_FAST_MEDIA_URL",e.L_GET_USER_MEDIA_E="L_GET_USER_MEDIA_E",e.L_VIDEO_FREEZED_O="L_VIDEO_FREEZED_O",e.L_AUDIO_FREEZED_O="L_AUDIO_FREEZED_O",e.L_CONNECTION_LOST_O="L_CONNECTION_LOST_O",e.L_SEND_CONNECTION_LOST_O="L_SEND_CONNECTION_LOST_O",e.L_RECV_CONNECTION_LOST_O="L_RECV_CONNECTION_LOST_O",e.L_OPEN_WZ264_O="L_OPEN_WZ264_O",e.L_PARSE_JSON_E="L_PARSE_JSON_E",e.L_DATA_BASE_E="L_DATA_BASE_E",e.L_DATA_BASE_O="L_DATA_BASE_O",e.L_PAUSE_VIDEO_T="L_PAUSE_VIDEO_T",e.L_PAUSE_VIDEO_R="L_PAUSE_VIDEO_R",e.L_QS_OPEN_DATA_CHANNEL_COST_S="RTC-openDataChannelCost-S",e.L_QS_DATA_CHANNEL_STATE_CHANGE_S="RTC-dataChannelStateChange-S",e.L_QS_DATA_CHANNEL_REQUEST_COST_S="RTC-dataChannelRequestCost-S",e.L_VIRTUAL_BG_LOAD_S="L-virtualBGLoad-S",e.L_ENABLE_VIRTUAL_BG_T="L-enableVirtualBG-T",e.L_ENABLE_VIRTUAL_BG_R="L-enableVirtualBG-R",e.L_ENABLE_VIRTUAL_BG_BLUR_T="L-enableVirtualBGBlur-T",e.L_ENABLE_VIRTUAL_BG_BLUR_R="L-enableVirtualBGBlur-R",e.L_SET_VIRTUAL_BG_IMAGE_PATH_O="L-setVirtualBGImagePath-O",e.L_QS_RENDER_S="RTC-render-S",e.L_QS_VIDEO_FIRST_CAPTURE_FRAME_S="RTC-videoFirstCaptureFrame-S",e.L_QS_ENCODE_FIRST_S="RTC-encodeFirst-S",e.L_QS_RCV_PACKET_S="RTC-rcvPacket-S",e.L_QS_SNT_PACKET_S="RTC-sntPacket-S",e.L_QS_AUDIO_FIRST_CAPTURE_S="RTC-audioFirstCapture-S",e.L_QS_AUDIO_ENCODER_CREATE_S="RTC-audioEncoderCreate-S",e.L_QS_AUDIO_DECODER_CREATE_S="RTC-audioDecoderCreate-S",e.L_QS_VIDEO_ENCODER_CREATE_S="RTC-videoEncoderCreate-S",e.L_QS_VIDEO_DECODER_CREATE_S="RTC-videoDecoderCreate-S",e.L_QS_RD_PACKET_S="RTC-rdPacket-S",e.L_BOTTOM_LOG_O="L_BOTTOM_LOG_O",e.L_QS_AUDIO_RECORD_STATUS_S="RTC-audioRecordStatus-S",e.L_QS_SRTP_ERROR_S="RTC-SrtpError-S",e.L_NOT_SUPPORT_AUDIO_LEVEL_MONITOR_O="L_NOT_SUPPORT_AUDIO_LEVEL_MONITOR_O",e.L_PARSE_VOIP_SERVER_CONF_E="L_PARSE_VOIP_SERVER_CONF_E",e.L_INNER_SET_TRACK_O="L_INNER_SET_TRACK_O",e.A_APPLY_3A_NOISE_WORKLET_T="A-apply_3a_noise_worklet-T",e.A_APPLY_3A_NOISE_WORKLET_R="A-apply_3a_noise_worklet-R",e.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_T="L-rtc_client_set_custom_extend_info-T",e.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_R="L-rtc_client_set_custom_extend_info-R",e.L_ENCRYPTOR_ENCODE_E="L-encryptor_encode-E",e.L_ENCRYPTOR_DECODE_E="L-encryptor_decode-E"}(T||(T={})),function(e){e.FAILED="fail",e.SUCCEEDED="success",e.TIMEOUT="timeout",e.INFO="info"}(E||(E={}));let w=!0,k=!0;function D(e,t,r){const n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function N(e,t,r){if(!e.RTCPeerConnection)return;const n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};const o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function M(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(w=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function U(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(k=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function j(){if("object"==typeof window){if(w)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function B(e,t){k&&console.warn(e+" is deprecated, please use "+t+" instead.")}function x(e){return"[object Object]"===Object.prototype.toString.call(e)}function F(e){return x(e)?Object.keys(e).reduce((function(t,r){const n=x(e[r]),i=n?F(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})}),{}):e}function V(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?V(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{V(e,e.get(t),r)}))})))}function J(e,t,r){const n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===n&&r.trackId===t.id&&V(e,r,i)}))})),i}const H=j;function G(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[i("min",r)]=n.ideal,t.optional.push(e),e={},e[i("max",r)]=n.ideal,t.optional.push(e)):(e[i("",r)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const a=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||a)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let a=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!a&&r.length&&t.includes("back")&&(a=r[r.length-1]),a&&(e.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=n(e.video),H("chrome: "+JSON.stringify(e)),i(e)}))}e.video=n(e.video)}return H("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function q(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function K(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else N(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function W(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function z(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const n=function(e){r(o(i(e)))};return t.apply(this,[n,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])})).then(r,n)}}function Q(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>J(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),N(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>J(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,n;return this.getSenders().forEach((r=>{r.track===e&&(t?n=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?n=!0:r=t),t.track===e))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function Y(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function Z(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Y(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[r.id];if(i)i.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=s.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function X(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function $(e,t){N(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var ee=Object.freeze({__proto__:null,shimMediaStream:q,shimOnTrack:K,shimGetSendersWithDtmf:W,shimGetStats:z,shimSenderReceiverGetStats:Q,shimAddTrackRemoveTrackWithNative:Y,shimAddTrackRemoveTrack:Z,shimPeerConnection:X,fixNegotiationNeeded:$,shimGetUserMedia:G,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{const n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var te,re,ne=(te=function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:r[t[n]]=t[n+1]}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),n+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach((function(e){n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&c&&n.push({ssrc:c});var l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,n.forEach((function(e){e.maxBitrate=l}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};if(t.matchPrefix(e,"a=sctpmap:").length>0){var a=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,n,i){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t},te(re={exports:{}},re.exports),re.exports);function ie(e,t,r,n,i){var o=ne.writeRtpDescription(e.kind,t);if(o+=ne.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=ne.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":i||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var s="msid:"+(n?n.id:"-")+" "+a+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+ne.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+ne.localCName+"\r\n"),o}function oe(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},n=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++)if(t[r].payloadType===e||t[r].preferredPayloadType===e)return t[r]},i=function(e,t,r,i){var o=n(e.parameters.apt,r),a=n(t.parameters.apt,i);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach((function(n){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(n.name.toLowerCase()===a.name.toLowerCase()&&n.clockRate===a.clockRate){if("rtx"===n.name.toLowerCase()&&n.parameters&&a.parameters.apt&&!i(n,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(n.numChannels,a.numChannels),r.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter((function(e){for(var t=0;t<n.rtcpFeedback.length;t++)if(n.rtcpFeedback[t].type===e.type&&n.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var n=0;n<t.headerExtensions.length;n++){var i=t.headerExtensions[n];if(e.uri===i.uri){r.headerExtensions.push(i);break}}})),r}function ae(e,t,r){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(r)}function se(e,t){var r=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return r||e.addRemoteCandidate(t),!r}function ce(e,t){var r=new Error(t);return r.name=e,r.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],r}var ue=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function n(t,r,n,i){var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=i,e.setTimeout((function(){t._dispatchEvent("track",o)}))}var i=function(r){var n=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){n[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",r=JSON.parse(JSON.stringify(r||{})),this.usingBundle="max-bundle"===r.bundlePolicy,"negotiate"===r.rtcpMuxPolicy)throw ce("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(r.rtcpMuxPolicy||(r.rtcpMuxPolicy="require"),r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all"}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced"}if(r.iceServers=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof n;return i&&(n=[n]),n=n.filter((function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||r?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(r=!0,!0)})),delete e.url,e.urls=i?n[0]:n,!!n.length}}))}(r.iceServers||[],t),this._iceGatherers=[],r.iceCandidatePoolSize)for(var o=r.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=ne.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0,n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&r)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();n.iceTransport=i.iceTransport,n.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(n),n},i.prototype.addTrack=function(t,r){if(this._isClosed)throw ce("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var n;if(this.transceivers.find((function(e){return e.track===t})))throw ce("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(n=this.transceivers[i]);return n||(n=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),n.track=t,n.stream=r,n.rtpSender=new e.RTCRtpSender(t,n.dtlsTransport),n.rtpSender},i.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach((function(t){r.addTrack(t,e)}));else{var n=e.clone();e.getTracks().forEach((function(e,t){var r=n.getTracks()[t];e.addEventListener("enabled",(function(e){r.enabled=e.enabled}))})),n.getTracks().forEach((function(e){r.addTrack(e,n)}))}},i.prototype.removeTrack=function(t){if(this._isClosed)throw ce("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var r=this.transceivers.find((function(e){return e.rtpSender===t}));if(!r)throw ce("InvalidAccessError","Sender was not created by this connection.");var n=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(n)&&this.localStreams.indexOf(n)>-1&&this.localStreams.splice(this.localStreams.indexOf(n),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var r=t.getSenders().find((function(t){return t.track===e}));r&&t.removeTrack(r)}))},i.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},i.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},i.prototype._createIceGatherer=function(t,r){var n=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||0===Object.keys(e.candidate).length;i.state=r?"completed":"gathering",null!==n.transceivers[t].bufferedCandidateEvents&&n.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,r){var n=this,i=this.transceivers[r].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),i.onlocalcandidate=function(e){if(!(n.usingBundle&&r>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:r};var a=e.candidate,s=!a||0===Object.keys(a).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),a.component=1,a.ufrag=i.getLocalParameters().usernameFragment;var c=ne.writeCandidate(a);o.candidate=Object.assign(o.candidate,ne.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var u=ne.getMediaSections(n._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",n._localDescription.sdp=ne.getDescription(n._localDescription.sdp)+u.join("");var l=n.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==n.iceGatheringState&&(n.iceGatheringState="gathering",n._emitGatheringStateChange()),s||n._dispatchEvent("icecandidate",o),l&&(n._dispatchEvent("icecandidate",new Event("icecandidate")),n.iceGatheringState="complete",n._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var n=new e.RTCDtlsTransport(r);return n.ondtlsstatechange=function(){t._updateConnectionState()},n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:n}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var n=this.transceivers[e].dtlsTransport;n&&(delete n.ondtlsstatechange,delete n.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,r,n){var i=oe(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:ne.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),n&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,r,n=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(ce("TypeError",'Unsupported type "'+e.type+'"'));if(!ae("setLocalDescription",e.type,n.signalingState)||n._isClosed)return Promise.reject(ce("InvalidStateError","Can not set local "+e.type+" in state "+n.signalingState));if("offer"===e.type)t=ne.splitSections(e.sdp),r=t.shift(),t.forEach((function(e,t){var r=ne.parseRtpParameters(e);n.transceivers[t].localCapabilities=r})),n.transceivers.forEach((function(e,t){n._gather(e.mid,t)}));else if("answer"===e.type){t=ne.splitSections(n._remoteDescription.sdp),r=t.shift();var i=ne.matchPrefix(r,"a=ice-lite").length>0;t.forEach((function(e,t){var o=n.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,l=o.remoteCapabilities;if(!(ne.isRejected(e)&&0===ne.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var d=ne.getIceParameters(e,r),_=ne.getDtlsParameters(e,r);i&&(_.role="server"),n.usingBundle&&0!==t||(n._gather(o.mid,t),"new"===s.state&&s.start(a,d,i?"controlling":"controlled"),"new"===c.state&&c.start(_));var p=oe(u,l);n._transceive(o,p.codecs.length>0,!1)}}))}return n._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?n._updateSignalingState("have-local-offer"):n._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var o=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(ce("TypeError",'Unsupported type "'+i.type+'"'));if(!ae("setRemoteDescription",i.type,o.signalingState)||o._isClosed)return Promise.reject(ce("InvalidStateError","Can not set remote "+i.type+" in state "+o.signalingState));var a={};o.remoteStreams.forEach((function(e){a[e.id]=e}));var s=[],c=ne.splitSections(i.sdp),u=c.shift(),l=ne.matchPrefix(u,"a=ice-lite").length>0,d=ne.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=d;var _=ne.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!_&&_.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(n,c){var _=ne.splitLines(n),p=ne.getKind(n),f=ne.isRejected(n)&&0===ne.matchPrefix(n,"a=bundle-only").length,b=_[0].substr(2).split(" ")[2],m=ne.getDirection(n,u),h=ne.parseMsid(n),g=ne.getMid(n)||ne.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===b||"UDP/DTLS/SCTP"===b))o.transceivers[c]={mid:g,kind:p,protocol:b,rejected:!0};else{var v,R,S,y,T,E,O,C,I;!f&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(p,!0));var L,P,A=ne.parseRtpParameters(n);f||(L=ne.getIceParameters(n,u),(P=ne.getDtlsParameters(n,u)).role="client"),O=ne.parseRtpEncodingParameters(n);var w=ne.parseRtcpParameters(n),k=ne.matchPrefix(n,"a=end-of-candidates",u).length>0,D=ne.matchPrefix(n,"a=candidate:").map((function(e){return ne.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!f&&d&&c>0&&o.transceivers[c]&&(o._disposeIceAndDtlsTransports(c),o.transceivers[c].iceGatherer=o.transceivers[0].iceGatherer,o.transceivers[c].iceTransport=o.transceivers[0].iceTransport,o.transceivers[c].dtlsTransport=o.transceivers[0].dtlsTransport,o.transceivers[c].rtpSender&&o.transceivers[c].rtpSender.setTransport(o.transceivers[0].dtlsTransport),o.transceivers[c].rtpReceiver&&o.transceivers[c].rtpReceiver.setTransport(o.transceivers[0].dtlsTransport)),"offer"!==i.type||f){if("answer"===i.type&&!f){R=(v=o.transceivers[c]).iceGatherer,S=v.iceTransport,y=v.dtlsTransport,T=v.rtpReceiver,E=v.sendEncodingParameters,C=v.localCapabilities,o.transceivers[c].recvEncodingParameters=O,o.transceivers[c].remoteCapabilities=A,o.transceivers[c].rtcpParameters=w,D.length&&"new"===S.state&&(!l&&!k||d&&0!==c?D.forEach((function(e){se(v.iceTransport,e)})):S.setRemoteCandidates(D)),d&&0!==c||("new"===S.state&&S.start(R,L,"controlling"),"new"===y.state&&y.start(P)),!oe(v.localCapabilities,v.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&v.sendEncodingParameters[0].rtx&&delete v.sendEncodingParameters[0].rtx,o._transceive(v,"sendrecv"===m||"recvonly"===m,"sendrecv"===m||"sendonly"===m),!T||"sendrecv"!==m&&"sendonly"!==m?delete v.rtpReceiver:(I=T.track,h?(a[h.stream]||(a[h.stream]=new e.MediaStream),r(I,a[h.stream]),s.push([I,T,a[h.stream]])):(a.default||(a.default=new e.MediaStream),r(I,a.default),s.push([I,T,a.default])))}}else{(v=o.transceivers[c]||o._createTransceiver(p)).mid=g,v.iceGatherer||(v.iceGatherer=o._createIceGatherer(c,d)),D.length&&"new"===v.iceTransport.state&&(!k||d&&0!==c?D.forEach((function(e){se(v.iceTransport,e)})):v.iceTransport.setRemoteCandidates(D)),C=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(C.codecs=C.codecs.filter((function(e){return"rtx"!==e.name}))),E=v.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var N,M=!1;if("sendrecv"===m||"sendonly"===m){if(M=!v.rtpReceiver,T=v.rtpReceiver||new e.RTCRtpReceiver(v.dtlsTransport,p),M)I=T.track,h&&"-"===h.stream||(h?(a[h.stream]||(a[h.stream]=new e.MediaStream,Object.defineProperty(a[h.stream],"id",{get:function(){return h.stream}})),Object.defineProperty(I,"id",{get:function(){return h.track}}),N=a[h.stream]):(a.default||(a.default=new e.MediaStream),N=a.default)),N&&(r(I,N),v.associatedRemoteMediaStreams.push(N)),s.push([I,T,N])}else v.rtpReceiver&&v.rtpReceiver.track&&(v.associatedRemoteMediaStreams.forEach((function(t){var r=t.getTracks().find((function(e){return e.id===v.rtpReceiver.track.id}));r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)})),v.associatedRemoteMediaStreams=[]);v.localCapabilities=C,v.remoteCapabilities=A,v.rtpReceiver=T,v.rtcpParameters=w,v.sendEncodingParameters=E,v.recvEncodingParameters=O,o._transceive(o.transceivers[c],!1,M)}}})),void 0===o._dtlsRole&&(o._dtlsRole="offer"===i.type?"active":"passive"),o._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?o._updateSignalingState("have-remote-offer"):o._updateSignalingState("stable"),Object.keys(a).forEach((function(t){var r=a[t];if(r.getTracks().length){if(-1===o.remoteStreams.indexOf(r)){o.remoteStreams.push(r);var i=new Event("addstream");i.stream=r,e.setTimeout((function(){o._dispatchEvent("addstream",i)}))}s.forEach((function(e){var t=e[0],i=e[1];r.id===e[2].id&&n(o,t,i,[r])}))}})),s.forEach((function(e){e[2]||n(o,e[0],e[1],[])})),e.setTimeout((function(){o&&o.transceivers&&o.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},i.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(ce("InvalidStateError","Can not call createOffer after close"));var n=r.transceivers.filter((function(e){return"audio"===e.kind})).length,i=r.transceivers.filter((function(e){return"video"===e.kind})).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(n=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(i=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(r.transceivers.forEach((function(e){"audio"===e.kind?--n<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)}));n>0||i>0;)n>0&&(r._createTransceiver("audio"),n--),i>0&&(r._createTransceiver("video"),i--);var a=ne.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach((function(n,i){var o=n.track,a=n.kind,s=n.mid||ne.generateIdentifier();n.mid=s,n.iceGatherer||(n.iceGatherer=r._createIceGatherer(i,r.usingBundle));var c=e.RTCRtpSender.getCapabilities(a);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),n.remoteCapabilities&&n.remoteCapabilities.codecs&&n.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(n.remoteCapabilities&&n.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=n.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),n.wantReceive&&(n.rtpReceiver=new e.RTCRtpReceiver(n.dtlsTransport,a)),n.localCapabilities=c,n.sendEncodingParameters=u})),"max-compat"!==r._config.bundlePolicy&&(a+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n",r.transceivers.forEach((function(e,t){a+=ie(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),a+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==t&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,a+="a="+ne.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(a+="a=end-of-candidates\r\n"))}));var s=new e.RTCSessionDescription({type:"offer",sdp:a});return Promise.resolve(s)},i.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(ce("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(ce("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var n=ne.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(n+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),n+="a=ice-options:trickle\r\n";var i=ne.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach((function(e,o){if(!(o+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?n+="m=application 0 DTLS/SCTP 5000\r\n":n+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?n+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(n+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(n+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var a;if(e.stream)"audio"===e.kind?a=e.stream.getAudioTracks()[0]:"video"===e.kind&&(a=e.stream.getVideoTracks()[0]),a&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var s=oe(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,n+=ie(e,s,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(n+="a=rtcp-rsize\r\n")}}));var o=new e.RTCSessionDescription({type:"answer",sdp:n});return Promise.resolve(o)},i.prototype.addIceCandidate=function(e){var t,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(n,i){if(!r._remoteDescription)return i(ce("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var a=0;a<r.transceivers.length;a++)if(r.transceivers[a].mid===e.sdpMid){o=a;break}var s=r.transceivers[o];if(!s)return i(ce("OperationError","Can not add ICE candidate"));if(s.rejected)return n();var c=Object.keys(e.candidate).length>0?ne.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return n();if(c.component&&1!==c.component)return n();if((0===o||o>0&&s.iceTransport!==r.transceivers[0].iceTransport)&&!se(s.iceTransport,c))return i(ce("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=ne.getMediaSections(r._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=ne.getDescription(r._remoteDescription.sdp)+t.join("")}else for(var l=0;l<r.transceivers.length&&(r.transceivers[l].rejected||(r.transceivers[l].iceTransport.addRemoteCandidate({}),(t=ne.getMediaSections(r._remoteDescription.sdp))[l]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=ne.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));l++);n()}))},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var r=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?r=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(r=e.rtpReceiver)})),!r)throw ce("InvalidAccessError","Invalid selector.");return r.getStats()}var n=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&n.push(e[t].getStats())}))})),Promise.all(n).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var r=e[t];if(r&&r.prototype&&r.prototype.getStats){var n=r.prototype.getStats;r.prototype.getStats=function(){return n.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(r){var n;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(n=e[r]).type]||n.type,t.set(r,e[r])})),t}))}}}));var o=["createOffer","createAnswer"];return o.forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),i};function le(e){const t=e&&e.navigator,r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e).catch((e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e))))}}function de(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function _e(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const r=new Event("enabled");r.enabled=e,this.dispatchEvent(r)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const r=ue(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e){let t=!1;return(e=JSON.parse(JSON.stringify(e))).filter((e=>{if(e&&(e.urls||e.url)){let r=e.urls||e.url;e.url&&!e.urls&&B("RTCIceServer.url","RTCIceServer.urls");const n="string"==typeof r;return n&&(r=[r]),r=r.filter((e=>{if(0===e.indexOf("stun:"))return!1;const r=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return r&&!t?(t=!0,!0):r&&!t})),delete e.url,e.urls=n?r[0]:r,!!r.length}}))}(e.iceServers,t.version),j("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function pe(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var fe=Object.freeze({__proto__:null,shimPeerConnection:_e,shimReplaceTrack:pe,shimGetUserMedia:le,shimGetDisplayMedia:de});function be(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){B("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},n&&n.prototype.getSettings){const t=n.prototype.getSettings;n.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(n&&n.prototype.applyConstraints){const t=n.prototype.applyConstraints;n.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function me(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function he(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return n.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(i,o)}}function ge(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function ve(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),N(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Re(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){B("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function Se(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function ye(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const n=t.apply(this,arguments);if(r){const{sender:t}=n,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return n})}function Te(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Ee(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function Oe(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var Ce=Object.freeze({__proto__:null,shimOnTrack:me,shimPeerConnection:he,shimSenderGetStats:ge,shimReceiverGetStats:ve,shimRemoveStream:Re,shimRTCDataChannel:Se,shimAddTransceiver:ye,shimGetParameters:Te,shimCreateOffer:Ee,shimCreateAnswer:Oe,shimGetUserMedia:be,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function Ie(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))})}}function Le(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}))}),t.apply(e,arguments)}}}function Pe(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){const n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}function Ae(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(we(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function we(e){return e&&void 0!==e.video?Object.assign({},e,{video:F(e.video)}):e}function ke(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let n=e.iceServers[r];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(B("RTCIceServer.url","RTCIceServer.urls"),n=JSON.parse(JSON.stringify(n)),n.urls=n.url,delete n.url,t.push(n)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function De(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Ne(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}function Me(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Ue=Object.freeze({__proto__:null,shimLocalStreamsAPI:Ie,shimRemoteStreamsAPI:Le,shimCallbacksAPI:Pe,shimGetUserMedia:Ae,shimConstraints:we,shimRTCIceServerUrls:ke,shimTrackEventTransceiver:De,shimCreateOfferLegacy:Ne,shimAudioContext:Me});function je(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),n=ne.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,N(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function Be(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=ne.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=ne.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r}(arguments[0]),r=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r}(e),n=function(e,r){let n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);const i=ne.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n}(arguments[0],e);let i;i=0===r&&0===n?Number.POSITIVE_INFINITY:0===r||0===n?Math.max(r,n):Math.min(r,n);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return r.apply(this,arguments)}}function xe(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},N(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function Fe(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function Ve(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function Je(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var He=Object.freeze({__proto__:null,shimRTCIceCandidate:je,shimMaxMessageSize:Be,shimSendThrowTypeError:xe,shimConnectionState:Fe,removeExtmapAllowMixed:Ve,shimAddIceCandidateNullOrEmpty:Je});const Ge=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const r=j,n=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=D(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=D(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.mediaDevices&&r.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=D(r.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=D(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:n,commonShim:He,extractVersion:D,disableLog:M,disableWarnings:U};switch(n.browser){case"chrome":if(!ee||!X||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=ee,Je(e,n),G(e,n),q(e),X(e,n),K(e),Z(e,n),W(e),z(e),Q(e),$(e,n),je(e),Fe(e),Be(e,n),xe(e),Ve(e,n);break;case"firefox":if(!Ce||!he||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=Ce,Je(e,n),be(e,n),he(e,n),me(e),Re(e),ge(e),ve(e),Se(e),ye(e),Te(e),Ee(e),Oe(e),je(e),Fe(e),Be(e,n),xe(e);break;case"edge":if(!fe||!_e||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),i;r("adapter.js shimming edge."),i.browserShim=fe,le(e),de(e),_e(e,n),pe(e),Be(e,n),xe(e);break;case"safari":if(!Ue||!t.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=Ue,Je(e,n),ke(e),Ne(e),Pe(e),Ie(e),Le(e),De(e),Ae(e),Me(e),je(e),Be(e,n),xe(e),Ve(e,n);break;default:r("Unsupported browser!")}return i}({window:"undefined"==typeof window?void 0:window});var qe,Ke,We;!function(e){e.FPS_10="FPS_10",e.FPS_15="FPS_15",e.FPS_24="FPS_24",e.FPS_30="FPS_30"}(qe||(qe={})),function(e){e.W176_H132="W176_H132",e.W176_H144="W176_H144",e.W180_H180="W180_H180",e.W240_H180="W240_H180",e.W240_H240="W240_H240",e.W256_H144="W256_H144",e.W320_H180="W320_H180",e.W320_H240="W320_H240",e.W360_H360="W360_H360",e.W480_H270="W480_H270",e.W480_H360="W480_H360",e.W480_H480="W480_H480",e.W640_H360="W640_H360",e.W640_H480="W640_H480",e.W720_H480="W720_H480",e.W848_H480="W848_H480",e.W960_H540="W960_H540",e.W960_H720="W960_H720",e.W1280_H720="W1280_H720",e.W1920_H1080="W1920_H1080"}(Ke||(Ke={}));var ze,Qe=((We={})[Ke.W176_H132]={width:176,height:132,maxBitrate:150,minBitrate:80},We[Ke.W176_H144]={width:176,height:144,maxBitrate:150,minBitrate:80},We[Ke.W180_H180]={width:180,height:180,maxBitrate:200,minBitrate:100},We[Ke.W240_H180]={width:240,height:180,maxBitrate:240,minBitrate:120},We[Ke.W240_H240]={width:240,height:240,maxBitrate:280,minBitrate:120},We[Ke.W256_H144]={width:256,height:144,maxBitrate:240,minBitrate:120},We[Ke.W320_H180]={width:320,height:180,maxBitrate:280,minBitrate:120},We[Ke.W320_H240]={width:320,height:240,maxBitrate:400,minBitrate:120},We[Ke.W360_H360]={width:360,height:360,maxBitrate:520,minBitrate:140},We[Ke.W480_H270]={width:480,height:270,maxBitrate:500,minBitrate:150},We[Ke.W480_H360]={width:480,height:360,maxBitrate:650,minBitrate:150},We[Ke.W480_H480]={width:480,height:480,maxBitrate:800,minBitrate:180},We[Ke.W640_H360]={width:640,height:360,maxBitrate:800,minBitrate:180},We[Ke.W640_H480]={width:640,height:480,maxBitrate:900,minBitrate:200},We[Ke.W720_H480]={width:720,height:480,maxBitrate:1e3,minBitrate:200},We[Ke.W848_H480]={width:848,height:480,maxBitrate:1860,minBitrate:200},We[Ke.W960_H540]={width:960,height:540,maxBitrate:1500,minBitrate:250},We[Ke.W960_H720]={width:960,height:720,maxBitrate:2e3,minBitrate:250},We[Ke.W1280_H720]={width:1280,height:720,maxBitrate:2200,minBitrate:250},We[Ke.W1920_H1080]={width:1920,height:1080,maxBitrate:4e3,minBitrate:400},We),Ye=function(e){var t={192:180,368:360,1088:1080};return t[e]?t[e]:e},Ze={10:1,15:1,24:1.5,30:1.5};!function(e){e[e.SUCCESS=1e4]="SUCCESS",e[e.PB_ERROR=40001]="PB_ERROR",e[e.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",e[e.PARAMS_ERROR=50001]="PARAMS_ERROR",e[e.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",e[e.NOT_IN_ROOM=50003]="NOT_IN_ROOM",e[e.SERVICE_INVALID=50004]="SERVICE_INVALID",e[e.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",e[e.SIGNAL_ERROR=53001]="SIGNAL_ERROR",e[e.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",e[e.REQUEST_FAILED=53004]="REQUEST_FAILED",e[e.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",e[e.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",e[e.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",e[e.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",e[e.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",e[e.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",e[e.BROWSER_PERMISSION_DENIED=53012]="BROWSER_PERMISSION_DENIED",e[e.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",e[e.INVALID_TAGS=53014]="INVALID_TAGS",e[e.INVALID_USER_ID=53015]="INVALID_USER_ID",e[e.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",e[e.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",e[e.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",e[e.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",e[e.TRACK_NOT_READY=53020]="TRACK_NOT_READY",e[e.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",e[e.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",e[e.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",e[e.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",e[e.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",e[e.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",e[e.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",e[e.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",e[e.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",e[e.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM",e[e.SOME_TRACKS_PUBLISH_FAILED=53031]="SOME_TRACKS_PUBLISH_FAILED",e[e.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO=53032]="MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO",e[e.JWT_TIME_OUT=1004]="JWT_TIME_OUT",e[e.SYSTEM_PERMISSION_DENIED=53033]="SYSTEM_PERMISSION_DENIED",e[e.PUBLISH_TRACKS_IS_INVALID=53034]="PUBLISH_TRACKS_IS_INVALID",e[e.COMMAND_EXCUTE_FAILED=53035]="COMMAND_EXCUTE_FAILED",e[e.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH=53036]="APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH",e[e.LOAD_3A_MODULE_FAILED=53037]="LOAD_3A_MODULE_FAILED",e[e.DATACHANNEL_OPEN_TIMEOUT=53038]="DATACHANNEL_OPEN_TIMEOUT",e[e.SUB_VIDEO_TIMEOUT=53039]="SUB_VIDEO_TIMEOUT",e[e.SET_LOCAL_DESCRIPTION_FAILED=53040]="SET_LOCAL_DESCRIPTION_FAILED",e[e.SUB_VIDEO_EXPIRED=53041]="SUB_VIDEO_EXPIRED"}(ze||(ze={}));var Xe={getCameras:function(){return C(void 0,void 0,void 0,(function(){return I(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"videoinput"===e.kind}))]}}))}))},getMicrophones:function(){return C(void 0,void 0,void 0,(function(){return I(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"audioinput"===e.kind}))]}}))}))},getSpeakers:function(){return C(void 0,void 0,void 0,(function(){return I(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"audiooutput"===e.kind}))]}}))}))}},$e=function(){function e(){}return Object.defineProperty(e,"getMemo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._memo||(this._memo={}),window.__memo__=this._memo,this._memo}}),Object.defineProperty(e,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._memo={}}}),Object.defineProperty(e,"_memo",{enumerable:!0,configurable:!0,writable:!0,value:{}}),e}();function et(e){let t=e.length;for(;--t>=0;)e[t]=0}const tt=256,rt=286,nt=30,it=15,ot=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),at=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),st=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ct=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ut=new Array(576);et(ut);const lt=new Array(60);et(lt);const dt=new Array(512);et(dt);const _t=new Array(256);et(_t);const pt=new Array(29);et(pt);const ft=new Array(nt);function bt(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let mt,ht,gt;function vt(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}et(ft);const Rt=e=>e<256?dt[e]:dt[256+(e>>>7)],St=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},yt=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,St(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)},Tt=(e,t,r)=>{yt(e,r[2*t],r[2*t+1])},Et=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},Ot=(e,t,r)=>{const n=new Array(16);let i,o,a=0;for(i=1;i<=it;i++)a=a+r[i-1]<<1,n[i]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=Et(n[t]++,t))}},Ct=e=>{let t;for(t=0;t<rt;t++)e.dyn_ltree[2*t]=0;for(t=0;t<nt;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},It=e=>{e.bi_valid>8?St(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Lt=(e,t,r,n)=>{const i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]},Pt=(e,t,r)=>{const n=e.heap[r];let i=r<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Lt(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Lt(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n},At=(e,t,r)=>{let n,i,o,a,s=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+s++],n+=(255&e.pending_buf[e.sym_buf+s++])<<8,i=e.pending_buf[e.sym_buf+s++],0===n?Tt(e,i,t):(o=_t[i],Tt(e,o+tt+1,t),a=ot[o],0!==a&&(i-=pt[o],yt(e,i,a)),n--,o=Rt(n),Tt(e,o,r),a=at[o],0!==a&&(n-=ft[o],yt(e,n,a)))}while(s<e.sym_next);Tt(e,256,t)},wt=(e,t)=>{const r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,c,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<o;a++)0!==r[2*a]?(e.heap[++e.heap_len]=u=a,e.depth[a]=0):r[2*a+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=u<2?++u:0,r[2*c]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=n[2*c+1]);for(t.max_code=u,a=e.heap_len>>1;a>=1;a--)Pt(e,r,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Pt(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,r[2*c]=r[2*a]+r[2*s],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,r[2*a+1]=r[2*s+1]=c,e.heap[1]=c++,Pt(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,l,d,_,p,f,b=0;for(_=0;_<=it;_++)e.bl_count[_]=0;for(r[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],_=r[2*r[2*l+1]+1]+1,_>c&&(_=c,b++),r[2*l+1]=_,l>n||(e.bl_count[_]++,p=0,l>=s&&(p=a[l-s]),f=r[2*l],e.opt_len+=f*(_+p),o&&(e.static_len+=f*(i[2*l+1]+p)));if(0!==b){do{for(_=c-1;0===e.bl_count[_];)_--;e.bl_count[_]--,e.bl_count[_+1]+=2,e.bl_count[c]--,b-=2}while(b>0);for(_=c;0!==_;_--)for(l=e.bl_count[_];0!==l;)d=e.heap[--u],d>n||(r[2*d+1]!==_&&(e.opt_len+=(_-r[2*d+1])*r[2*d],r[2*d+1]=_),l--)}})(e,t),Ot(r,u,e.bl_count)},kt=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))},Dt=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{Tt(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(Tt(e,i,e.bl_tree),s--),Tt(e,16,e.bl_tree),yt(e,s-3,2)):s<=10?(Tt(e,17,e.bl_tree),yt(e,s-3,3)):(Tt(e,18,e.bl_tree),yt(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}};let Nt=!1;const Mt=(e,t,r,n)=>{yt(e,0+(n?1:0),3),It(e),St(e,r),St(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var Ut=(e,t,r,n)=>{let i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<tt;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),wt(e,e.l_desc),wt(e,e.d_desc),a=(e=>{let t;for(kt(e,e.dyn_ltree,e.l_desc.max_code),kt(e,e.dyn_dtree,e.d_desc.max_code),wt(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ct[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?Mt(e,t,r,n):4===e.strategy||o===i?(yt(e,2+(n?1:0),3),At(e,ut,lt)):(yt(e,4+(n?1:0),3),((e,t,r,n)=>{let i;for(yt(e,t-257,5),yt(e,r-1,5),yt(e,n-4,4),i=0;i<n;i++)yt(e,e.bl_tree[2*ct[i]+1],3);Dt(e,e.dyn_ltree,t-1),Dt(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),At(e,e.dyn_ltree,e.dyn_dtree)),Ct(e),n&&It(e)},jt={_tr_init:e=>{Nt||((()=>{let e,t,r,n,i;const o=new Array(16);for(r=0,n=0;n<28;n++)for(pt[n]=r,e=0;e<1<<ot[n];e++)_t[r++]=n;for(_t[r-1]=n,i=0,n=0;n<16;n++)for(ft[n]=i,e=0;e<1<<at[n];e++)dt[i++]=n;for(i>>=7;n<nt;n++)for(ft[n]=i<<7,e=0;e<1<<at[n]-7;e++)dt[256+i++]=n;for(t=0;t<=it;t++)o[t]=0;for(e=0;e<=143;)ut[2*e+1]=8,e++,o[8]++;for(;e<=255;)ut[2*e+1]=9,e++,o[9]++;for(;e<=279;)ut[2*e+1]=7,e++,o[7]++;for(;e<=287;)ut[2*e+1]=8,e++,o[8]++;for(Ot(ut,287,o),e=0;e<nt;e++)lt[2*e+1]=5,lt[2*e]=Et(e,5);mt=new bt(ut,ot,257,rt,it),ht=new bt(lt,at,0,nt,it),gt=new bt(new Array(0),st,0,19,7)})(),Nt=!0),e.l_desc=new vt(e.dyn_ltree,mt),e.d_desc=new vt(e.dyn_dtree,ht),e.bl_desc=new vt(e.bl_tree,gt),e.bi_buf=0,e.bi_valid=0,Ct(e)},_tr_stored_block:Mt,_tr_flush_block:Ut,_tr_tally:(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(_t[r]+tt+1)]++,e.dyn_dtree[2*Rt(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{yt(e,2,3),Tt(e,256,ut),(e=>{16===e.bi_valid?(St(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Bt=(e,t,r,n)=>{let i=65535&e,o=e>>>16&65535,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{i=i+t[n++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16};const xt=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var Ft=(e,t,r,n)=>{const i=xt,o=n+r;e^=-1;for(let r=n;r<o;r++)e=e>>>8^i[255&(e^t[r])];return~e},Vt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Jt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Ht,_tr_stored_block:Gt,_tr_flush_block:qt,_tr_tally:Kt,_tr_align:Wt}=jt,{Z_NO_FLUSH:zt,Z_PARTIAL_FLUSH:Qt,Z_FULL_FLUSH:Yt,Z_FINISH:Zt,Z_BLOCK:Xt,Z_OK:$t,Z_STREAM_END:er,Z_STREAM_ERROR:tr,Z_DATA_ERROR:rr,Z_BUF_ERROR:nr,Z_DEFAULT_COMPRESSION:ir,Z_FILTERED:or,Z_HUFFMAN_ONLY:ar,Z_RLE:sr,Z_FIXED:cr,Z_DEFAULT_STRATEGY:ur,Z_UNKNOWN:lr,Z_DEFLATED:dr}=Jt,_r=258,pr=262,fr=42,br=113,mr=666,hr=(e,t)=>(e.msg=Vt[t],t),gr=e=>2*e-(e>4?9:0),vr=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Rr=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do{r=e.head[--n],e.head[n]=r>=i?r-i:0}while(--t);t=i,n=t;do{r=e.prev[--n],e.prev[n]=r>=i?r-i:0}while(--t)};let Sr=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const yr=e=>{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},Tr=(e,t)=>{qt(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,yr(e.strm)},Er=(e,t)=>{e.pending_buf[e.pending++]=t},Or=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Cr=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),1===e.state.wrap?e.adler=Bt(e.adler,t,i,r):2===e.state.wrap&&(e.adler=Ft(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},Ir=(e,t)=>{let r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-pr?e.strstart-(e.w_size-pr):0,u=e.window,l=e.w_mask,d=e.prev,_=e.strstart+_r;let p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(r=t,u[r+a]===f&&u[r+a-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<_);if(n=_r-(_-o),o=_-_r,n>a){if(e.match_start=t,a=n,n>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=d[t&l])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead},Lr=e=>{const t=e.w_size;let r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-pr)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Rr(e),n+=t),0===e.strm.avail_in)break;if(r=Cr(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Sr(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Sr(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<pr&&0!==e.strm.avail_in)},Pr=(e,t)=>{let r,n,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,r>n+e.strm.avail_in&&(r=n+e.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&t!==Zt||t===zt||r!==n+e.strm.avail_in))break;a=t===Zt&&r===n+e.strm.avail_in?1:0,Gt(e,0,0,a),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,yr(e.strm),n&&(n>r&&(n=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,r-=n),r&&(Cr(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==zt&&t!==Zt&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(Cr(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=o||(n||t===Zt)&&t!==zt&&0===e.strm.avail_in&&n<=i)&&(r=n>i?i:n,a=t===Zt&&0===e.strm.avail_in&&r===n?1:0,Gt(e,e.block_start,r,a),e.block_start+=r,yr(e.strm)),a?3:1)},Ar=(e,t)=>{let r,n;for(;;){if(e.lookahead<pr){if(Lr(e),e.lookahead<pr&&t===zt)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=Sr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-pr&&(e.match_length=Ir(e,r)),e.match_length>=3)if(n=Kt(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Sr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Sr(e,e.ins_h,e.window[e.strstart+1]);else n=Kt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Tr(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Zt?(Tr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Tr(e,!1),0===e.strm.avail_out)?1:2},wr=(e,t)=>{let r,n,i;for(;;){if(e.lookahead<pr){if(Lr(e),e.lookahead<pr&&t===zt)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=Sr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-pr&&(e.match_length=Ir(e,r),e.match_length<=5&&(e.strategy===or||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=Kt(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=Sr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(Tr(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=Kt(e,0,e.window[e.strstart-1]),n&&Tr(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Kt(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Zt?(Tr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Tr(e,!1),0===e.strm.avail_out)?1:2};function kr(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}const Dr=[new kr(0,0,0,0,Pr),new kr(4,4,8,4,Ar),new kr(4,5,16,8,Ar),new kr(4,6,32,32,Ar),new kr(4,4,16,16,wr),new kr(8,16,32,32,wr),new kr(8,16,128,128,wr),new kr(8,32,128,256,wr),new kr(32,128,258,1024,wr),new kr(32,258,258,4096,wr)];function Nr(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=dr,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),vr(this.dyn_ltree),vr(this.dyn_dtree),vr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),vr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),vr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Mr=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==fr&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==br&&t.status!==mr?1:0},Ur=e=>{if(Mr(e))return hr(e,tr);e.total_in=e.total_out=0,e.data_type=lr;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?fr:br,e.adler=2===t.wrap?0:1,t.last_flush=-2,Ht(t),$t},jr=e=>{const t=Ur(e);var r;return t===$t&&((r=e.state).window_size=2*r.w_size,vr(r.head),r.max_lazy_match=Dr[r.level].max_lazy,r.good_match=Dr[r.level].good_length,r.nice_match=Dr[r.level].nice_length,r.max_chain_length=Dr[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},Br=(e,t,r,n,i,o)=>{if(!e)return tr;let a=1;if(t===ir&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||r!==dr||n<8||n>15||t<0||t>9||o<0||o>cr||8===n&&1!==a)return hr(e,tr);8===n&&(n=9);const s=new Nr;return e.state=s,s.strm=e,s.status=fr,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=o,s.method=r,jr(e)};var xr={deflateInit:(e,t)=>Br(e,t,dr,15,8,ur),deflateInit2:Br,deflateReset:jr,deflateResetKeep:Ur,deflateSetHeader:(e,t)=>Mr(e)||2!==e.state.wrap?tr:(e.state.gzhead=t,$t),deflate:(e,t)=>{if(Mr(e)||t>Xt||t<0)return e?hr(e,tr):tr;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===mr&&t!==Zt)return hr(e,0===e.avail_out?nr:tr);const n=r.last_flush;if(r.last_flush=t,0!==r.pending){if(yr(e),0===e.avail_out)return r.last_flush=-1,$t}else if(0===e.avail_in&&gr(t)<=gr(n)&&t!==Zt)return hr(e,nr);if(r.status===mr&&0!==e.avail_in)return hr(e,nr);if(r.status===fr&&0===r.wrap&&(r.status=br),r.status===fr){let t=dr+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=ar||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=n<<6,0!==r.strstart&&(t|=32),t+=31-t%31,Or(r,t),0!==r.strstart&&(Or(r,e.adler>>>16),Or(r,65535&e.adler)),e.adler=1,r.status=br,yr(e),0!==r.pending)return r.last_flush=-1,$t}if(57===r.status)if(e.adler=0,Er(r,31),Er(r,139),Er(r,8),r.gzhead)Er(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Er(r,255&r.gzhead.time),Er(r,r.gzhead.time>>8&255),Er(r,r.gzhead.time>>16&255),Er(r,r.gzhead.time>>24&255),Er(r,9===r.level?2:r.strategy>=ar||r.level<2?4:0),Er(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Er(r,255&r.gzhead.extra.length),Er(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=Ft(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(Er(r,0),Er(r,0),Er(r,0),Er(r,0),Er(r,0),Er(r,9===r.level?2:r.strategy>=ar||r.level<2?4:0),Er(r,3),r.status=br,yr(e),0!==r.pending)return r.last_flush=-1,$t;if(69===r.status){if(r.gzhead.extra){let t=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=Ft(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=i,yr(e),0!==r.pending)return r.last_flush=-1,$t;t=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>t&&(e.adler=Ft(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=Ft(e.adler,r.pending_buf,r.pending-n,n)),yr(e),0!==r.pending)return r.last_flush=-1,$t;n=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Er(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=Ft(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=Ft(e.adler,r.pending_buf,r.pending-n,n)),yr(e),0!==r.pending)return r.last_flush=-1,$t;n=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Er(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=Ft(e.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(yr(e),0!==r.pending))return r.last_flush=-1,$t;Er(r,255&e.adler),Er(r,e.adler>>8&255),e.adler=0}if(r.status=br,yr(e),0!==r.pending)return r.last_flush=-1,$t}if(0!==e.avail_in||0!==r.lookahead||t!==zt&&r.status!==mr){let n=0===r.level?Pr(r,t):r.strategy===ar?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(Lr(e),0===e.lookahead)){if(t===zt)return 1;break}if(e.match_length=0,r=Kt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Tr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Zt?(Tr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Tr(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===sr?((e,t)=>{let r,n,i,o;const a=e.window;for(;;){if(e.lookahead<=_r){if(Lr(e),e.lookahead<=_r&&t===zt)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){o=e.strstart+_r;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=_r-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=Kt(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Kt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Tr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Zt?(Tr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Tr(e,!1),0===e.strm.avail_out)?1:2})(r,t):Dr[r.level].func(r,t);if(3!==n&&4!==n||(r.status=mr),1===n||3===n)return 0===e.avail_out&&(r.last_flush=-1),$t;if(2===n&&(t===Qt?Wt(r):t!==Xt&&(Gt(r,0,0,!1),t===Yt&&(vr(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),yr(e),0===e.avail_out))return r.last_flush=-1,$t}return t!==Zt?$t:r.wrap<=0?er:(2===r.wrap?(Er(r,255&e.adler),Er(r,e.adler>>8&255),Er(r,e.adler>>16&255),Er(r,e.adler>>24&255),Er(r,255&e.total_in),Er(r,e.total_in>>8&255),Er(r,e.total_in>>16&255),Er(r,e.total_in>>24&255)):(Or(r,e.adler>>>16),Or(r,65535&e.adler)),yr(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?$t:er)},deflateEnd:e=>{if(Mr(e))return tr;const t=e.state.status;return e.state=null,t===br?hr(e,rr):$t},deflateSetDictionary:(e,t)=>{let r=t.length;if(Mr(e))return tr;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==fr||n.lookahead)return tr;if(1===i&&(e.adler=Bt(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){0===i&&(vr(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(r-n.w_size,r),0),t=e,r=n.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,Lr(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=Sr(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,Lr(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,n.wrap=i,$t},deflateInfo:"pako deflate (from Nodeca project)"};const Fr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Vr=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)Fr(r,t)&&(e[t]=r[t])}}return e},Jr=e=>{let t=0;for(let r=0,n=e.length;r<n;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];r.set(i,n),n+=i.length}return r};let Hr=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Hr=!1}const Gr=new Uint8Array(256);for(let e=0;e<256;e++)Gr[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Gr[254]=Gr[254]=1;var qr=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),o=0,i=0;o<s;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},Kr=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){o[i++]=t;continue}let a=Gr[t];if(a>4)o[i++]=65533,n+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&n<r;)t=t<<6|63&e[n++],a--;a>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Hr)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r})(o,i)},Wr=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Gr[e[r]]>t?r:t};var zr=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Qr=Object.prototype.toString,{Z_NO_FLUSH:Yr,Z_SYNC_FLUSH:Zr,Z_FULL_FLUSH:Xr,Z_FINISH:$r,Z_OK:en,Z_STREAM_END:tn,Z_DEFAULT_COMPRESSION:rn,Z_DEFAULT_STRATEGY:nn,Z_DEFLATED:on}=Jt;function an(e){this.options=Vr({level:rn,method:on,chunkSize:16384,windowBits:15,memLevel:8,strategy:nn},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zr,this.strm.avail_out=0;let r=xr.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==en)throw new Error(Vt[r]);if(t.header&&xr.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?qr(t.dictionary):"[object ArrayBuffer]"===Qr.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=xr.deflateSetDictionary(this.strm,e),r!==en)throw new Error(Vt[r]);this._dict_set=!0}}function sn(e,t){const r=new an(t);if(r.push(e,!0),r.err)throw r.msg||Vt[r.err];return r.result}an.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?$r:Yr,"string"==typeof e?r.input=qr(e):"[object ArrayBuffer]"===Qr.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===Zr||o===Xr)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=xr.deflate(r,o),i===tn)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=xr.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===en;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},an.prototype.onData=function(e){this.chunks.push(e)},an.prototype.onEnd=function(e){e===en&&(this.result=Jr(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var cn={Deflate:an,deflate:sn,deflateRaw:function(e,t){return(t=t||{}).raw=!0,sn(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,sn(e,t)},constants:Jt};const un=16209;var ln=function(e,t){let r,n,i,o,a,s,c,u,l,d,_,p,f,b,m,h,g,v,R,S,y,T,E,O;const C=e.state;r=e.next_in,E=e.input,n=r+(e.avail_in-5),i=e.next_out,O=e.output,o=i-(t-e.avail_out),a=i+(e.avail_out-257),s=C.dmax,c=C.wsize,u=C.whave,l=C.wnext,d=C.window,_=C.hold,p=C.bits,f=C.lencode,b=C.distcode,m=(1<<C.lenbits)-1,h=(1<<C.distbits)-1;e:do{p<15&&(_+=E[r++]<<p,p+=8,_+=E[r++]<<p,p+=8),g=f[_&m];t:for(;;){if(v=g>>>24,_>>>=v,p-=v,v=g>>>16&255,0===v)O[i++]=65535&g;else{if(!(16&v)){if(64&v){if(32&v){C.mode=16191;break e}e.msg="invalid literal/length code",C.mode=un;break e}g=f[(65535&g)+(_&(1<<v)-1)];continue t}for(R=65535&g,v&=15,v&&(p<v&&(_+=E[r++]<<p,p+=8),R+=_&(1<<v)-1,_>>>=v,p-=v),p<15&&(_+=E[r++]<<p,p+=8,_+=E[r++]<<p,p+=8),g=b[_&h];;){if(v=g>>>24,_>>>=v,p-=v,v=g>>>16&255,16&v){if(S=65535&g,v&=15,p<v&&(_+=E[r++]<<p,p+=8,p<v&&(_+=E[r++]<<p,p+=8)),S+=_&(1<<v)-1,S>s){e.msg="invalid distance too far back",C.mode=un;break e}if(_>>>=v,p-=v,v=i-o,S>v){if(v=S-v,v>u&&C.sane){e.msg="invalid distance too far back",C.mode=un;break e}if(y=0,T=d,0===l){if(y+=c-v,v<R){R-=v;do{O[i++]=d[y++]}while(--v);y=i-S,T=O}}else if(l<v){if(y+=c+l-v,v-=l,v<R){R-=v;do{O[i++]=d[y++]}while(--v);if(y=0,l<R){v=l,R-=v;do{O[i++]=d[y++]}while(--v);y=i-S,T=O}}}else if(y+=l-v,v<R){R-=v;do{O[i++]=d[y++]}while(--v);y=i-S,T=O}for(;R>2;)O[i++]=T[y++],O[i++]=T[y++],O[i++]=T[y++],R-=3;R&&(O[i++]=T[y++],R>1&&(O[i++]=T[y++]))}else{y=i-S;do{O[i++]=O[y++],O[i++]=O[y++],O[i++]=O[y++],R-=3}while(R>2);R&&(O[i++]=O[y++],R>1&&(O[i++]=O[y++]))}break}if(64&v){e.msg="invalid distance code",C.mode=un;break e}g=b[(65535&g)+(_&(1<<v)-1)]}}break}}while(r<n&&i<a);R=p>>3,r-=R,p-=R<<3,_&=(1<<p)-1,e.next_in=r,e.next_out=i,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=i<a?a-i+257:257-(i-a),C.hold=_,C.bits=p};const dn=15,_n=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),pn=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),fn=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),bn=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var mn=(e,t,r,n,i,o,a,s)=>{const c=s.bits;let u,l,d,_,p,f,b=0,m=0,h=0,g=0,v=0,R=0,S=0,y=0,T=0,E=0,O=null;const C=new Uint16Array(16),I=new Uint16Array(16);let L,P,A,w=null;for(b=0;b<=dn;b++)C[b]=0;for(m=0;m<n;m++)C[t[r+m]]++;for(v=c,g=dn;g>=1&&0===C[g];g--);if(v>g&&(v=g),0===g)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(h=1;h<g&&0===C[h];h++);for(v<h&&(v=h),y=1,b=1;b<=dn;b++)if(y<<=1,y-=C[b],y<0)return-1;if(y>0&&(0===e||1!==g))return-1;for(I[1]=0,b=1;b<dn;b++)I[b+1]=I[b]+C[b];for(m=0;m<n;m++)0!==t[r+m]&&(a[I[t[r+m]]++]=m);if(0===e?(O=w=a,f=20):1===e?(O=_n,w=pn,f=257):(O=fn,w=bn,f=0),E=0,m=0,b=h,p=o,R=v,S=0,d=-1,T=1<<v,_=T-1,1===e&&T>852||2===e&&T>592)return 1;for(;;){L=b-S,a[m]+1<f?(P=0,A=a[m]):a[m]>=f?(P=w[a[m]-f],A=O[a[m]-f]):(P=96,A=0),u=1<<b-S,l=1<<R,h=l;do{l-=u,i[p+(E>>S)+l]=L<<24|P<<16|A}while(0!==l);for(u=1<<b-1;E&u;)u>>=1;if(0!==u?(E&=u-1,E+=u):E=0,m++,0==--C[b]){if(b===g)break;b=t[r+a[m]]}if(b>v&&(E&_)!==d){for(0===S&&(S=v),p+=h,R=b-S,y=1<<R;R+S<g&&(y-=C[R+S],!(y<=0));)R++,y<<=1;if(T+=1<<R,1===e&&T>852||2===e&&T>592)return 1;d=E&_,i[d]=v<<24|R<<16|p-o}}return 0!==E&&(i[p+E]=b-S<<24|64<<16),s.bits=v,0};const{Z_FINISH:hn,Z_BLOCK:gn,Z_TREES:vn,Z_OK:Rn,Z_STREAM_END:Sn,Z_NEED_DICT:yn,Z_STREAM_ERROR:Tn,Z_DATA_ERROR:En,Z_MEM_ERROR:On,Z_BUF_ERROR:Cn,Z_DEFLATED:In}=Jt,Ln=16180,Pn=16190,An=16191,wn=16192,kn=16194,Dn=16199,Nn=16200,Mn=16206,Un=16209,jn=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Bn(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const xn=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Ln||t.mode>16211?1:0},Fn=e=>{if(xn(e))return Tn;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Ln,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Rn},Vn=e=>{if(xn(e))return Tn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Fn(e)},Jn=(e,t)=>{let r;if(xn(e))return Tn;const n=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Tn:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Vn(e))},Hn=(e,t)=>{if(!e)return Tn;const r=new Bn;e.state=r,r.strm=e,r.window=null,r.mode=Ln;const n=Jn(e,t);return n!==Rn&&(e.state=null),n};let Gn,qn,Kn=!0;const Wn=e=>{if(Kn){Gn=new Int32Array(512),qn=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(mn(1,e.lens,0,288,Gn,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;mn(2,e.lens,0,32,qn,0,e.work,{bits:5}),Kn=!1}e.lencode=Gn,e.lenbits=9,e.distcode=qn,e.distbits=5},zn=(e,t,r,n)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(t.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(t.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var Qn={inflateReset:Vn,inflateReset2:Jn,inflateResetKeep:Fn,inflateInit:e=>Hn(e,15),inflateInit2:Hn,inflate:(e,t)=>{let r,n,i,o,a,s,c,u,l,d,_,p,f,b,m,h,g,v,R,S,y,T,E=0;const O=new Uint8Array(4);let C,I;const L=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(xn(e)||!e.output||!e.input&&0!==e.avail_in)return Tn;r=e.state,r.mode===An&&(r.mode=wn),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,d=s,_=c,T=Rn;e:for(;;)switch(r.mode){case Ln:if(0===r.wrap){r.mode=wn;break}for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,O[0]=255&u,O[1]=u>>>8&255,r.check=Ft(r.check,O,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=Un;break}if((15&u)!==In){e.msg="unknown compression method",r.mode=Un;break}if(u>>>=4,l-=4,y=8+(15&u),0===r.wbits&&(r.wbits=y),y>15||y>r.wbits){e.msg="invalid window size",r.mode=Un;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&u?16189:An,u=0,l=0;break;case 16181:for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==In){e.msg="unknown compression method",r.mode=Un;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=Un;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(O[0]=255&u,O[1]=u>>>8&255,r.check=Ft(r.check,O,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(O[0]=255&u,O[1]=u>>>8&255,O[2]=u>>>16&255,O[3]=u>>>24&255,r.check=Ft(r.check,O,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(O[0]=255&u,O[1]=u>>>8&255,r.check=Ft(r.check,O,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(O[0]=255&u,O[1]=u>>>8&255,r.check=Ft(r.check,O,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(p=r.length,p>s&&(p=s),p&&(r.head&&(y=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+p),y)),512&r.flags&&4&r.wrap&&(r.check=Ft(r.check,n,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===s)break e;p=0;do{y=n[o+p++],r.head&&y&&r.length<65536&&(r.head.name+=String.fromCharCode(y))}while(y&&p<s);if(512&r.flags&&4&r.wrap&&(r.check=Ft(r.check,n,p,o)),s-=p,o+=p,y)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===s)break e;p=0;do{y=n[o+p++],r.head&&y&&r.length<65536&&(r.head.comment+=String.fromCharCode(y))}while(y&&p<s);if(512&r.flags&&4&r.wrap&&(r.check=Ft(r.check,n,p,o)),s-=p,o+=p,y)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=Un;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=An;break;case 16189:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}e.adler=r.check=jn(u),u=0,l=0,r.mode=Pn;case Pn:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,yn;e.adler=r.check=1,r.mode=An;case An:if(t===gn||t===vn)break e;case wn:if(r.last){u>>>=7&l,l-=7&l,r.mode=Mn;break}for(;l<3;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(Wn(r),r.mode=Dn,t===vn){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=Un}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=Un;break}if(r.length=65535&u,u=0,l=0,r.mode=kn,t===vn)break e;case kn:r.mode=16195;case 16195:if(p=r.length,p){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;i.set(n.subarray(o,o+p),a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=An;break;case 16196:for(;l<14;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Un;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.lens[L[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[L[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,C={bits:r.lenbits},T=mn(0,r.lens,0,19,r.lencode,0,r.work,C),r.lenbits=C.bits,T){e.msg="invalid code lengths set",r.mode=Un;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;E=r.lencode[u&(1<<r.lenbits)-1],m=E>>>24,h=E>>>16&255,g=65535&E,!(m<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(g<16)u>>>=m,l-=m,r.lens[r.have++]=g;else{if(16===g){for(I=m+2;l<I;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(u>>>=m,l-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=Un;break}y=r.lens[r.have-1],p=3+(3&u),u>>>=2,l-=2}else if(17===g){for(I=m+3;l<I;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=m,l-=m,y=0,p=3+(7&u),u>>>=3,l-=3}else{for(I=m+7;l<I;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=m,l-=m,y=0,p=11+(127&u),u>>>=7,l-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Un;break}for(;p--;)r.lens[r.have++]=y}}if(r.mode===Un)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=Un;break}if(r.lenbits=9,C={bits:r.lenbits},T=mn(1,r.lens,0,r.nlen,r.lencode,0,r.work,C),r.lenbits=C.bits,T){e.msg="invalid literal/lengths set",r.mode=Un;break}if(r.distbits=6,r.distcode=r.distdyn,C={bits:r.distbits},T=mn(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,C),r.distbits=C.bits,T){e.msg="invalid distances set",r.mode=Un;break}if(r.mode=Dn,t===vn)break e;case Dn:r.mode=Nn;case Nn:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,ln(e,_),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,r.mode===An&&(r.back=-1);break}for(r.back=0;E=r.lencode[u&(1<<r.lenbits)-1],m=E>>>24,h=E>>>16&255,g=65535&E,!(m<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(h&&!(240&h)){for(v=m,R=h,S=g;E=r.lencode[S+((u&(1<<v+R)-1)>>v)],m=E>>>24,h=E>>>16&255,g=65535&E,!(v+m<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=m,l-=m,r.back+=m,r.length=g,0===h){r.mode=16205;break}if(32&h){r.back=-1,r.mode=An;break}if(64&h){e.msg="invalid literal/length code",r.mode=Un;break}r.extra=15&h,r.mode=16201;case 16201:if(r.extra){for(I=r.extra;l<I;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;E=r.distcode[u&(1<<r.distbits)-1],m=E>>>24,h=E>>>16&255,g=65535&E,!(m<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(!(240&h)){for(v=m,R=h,S=g;E=r.distcode[S+((u&(1<<v+R)-1)>>v)],m=E>>>24,h=E>>>16&255,g=65535&E,!(v+m<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=m,l-=m,r.back+=m,64&h){e.msg="invalid distance code",r.mode=Un;break}r.offset=g,r.extra=15&h,r.mode=16203;case 16203:if(r.extra){for(I=r.extra;l<I;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Un;break}r.mode=16204;case 16204:if(0===c)break e;if(p=_-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Un;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),b=r.window}else b=i,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{i[a++]=b[f++]}while(--p);0===r.length&&(r.mode=Nn);break;case 16205:if(0===c)break e;i[a++]=r.length,c--,r.mode=Nn;break;case Mn:if(r.wrap){for(;l<32;){if(0===s)break e;s--,u|=n[o++]<<l,l+=8}if(_-=c,e.total_out+=_,r.total+=_,4&r.wrap&&_&&(e.adler=r.check=r.flags?Ft(r.check,i,_,a-_):Bt(r.check,i,_,a-_)),_=c,4&r.wrap&&(r.flags?u:jn(u))!==r.check){e.msg="incorrect data check",r.mode=Un;break}u=0,l=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=Un;break}u=0,l=0}r.mode=16208;case 16208:T=Sn;break e;case Un:T=En;break e;case 16210:return On;default:return Tn}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,(r.wsize||_!==e.avail_out&&r.mode<Un&&(r.mode<Mn||t!==hn))&&zn(e,e.output,e.next_out,_-e.avail_out),d-=e.avail_in,_-=e.avail_out,e.total_in+=d,e.total_out+=_,r.total+=_,4&r.wrap&&_&&(e.adler=r.check=r.flags?Ft(r.check,i,_,e.next_out-_):Bt(r.check,i,_,e.next_out-_)),e.data_type=r.bits+(r.last?64:0)+(r.mode===An?128:0)+(r.mode===Dn||r.mode===kn?256:0),(0===d&&0===_||t===hn)&&T===Rn&&(T=Cn),T},inflateEnd:e=>{if(xn(e))return Tn;let t=e.state;return t.window&&(t.window=null),e.state=null,Rn},inflateGetHeader:(e,t)=>{if(xn(e))return Tn;const r=e.state;return 2&r.wrap?(r.head=t,t.done=!1,Rn):Tn},inflateSetDictionary:(e,t)=>{const r=t.length;let n,i,o;return xn(e)?Tn:(n=e.state,0!==n.wrap&&n.mode!==Pn?Tn:n.mode===Pn&&(i=1,i=Bt(i,t,r,0),i!==n.check)?En:(o=zn(e,t,r,r),o?(n.mode=16210,On):(n.havedict=1,Rn)))},inflateInfo:"pako inflate (from Nodeca project)"};var Yn=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Zn=Object.prototype.toString,{Z_NO_FLUSH:Xn,Z_FINISH:$n,Z_OK:ei,Z_STREAM_END:ti,Z_NEED_DICT:ri,Z_STREAM_ERROR:ni,Z_DATA_ERROR:ii,Z_MEM_ERROR:oi}=Jt;function ai(e){this.options=Vr({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zr,this.strm.avail_out=0;let r=Qn.inflateInit2(this.strm,t.windowBits);if(r!==ei)throw new Error(Vt[r]);if(this.header=new Yn,Qn.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=qr(t.dictionary):"[object ArrayBuffer]"===Zn.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Qn.inflateSetDictionary(this.strm,t.dictionary),r!==ei)))throw new Error(Vt[r])}ai.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?$n:Xn,"[object ArrayBuffer]"===Zn.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=Qn.inflate(r,a),o===ri&&i&&(o=Qn.inflateSetDictionary(r,i),o===ei?o=Qn.inflate(r,a):o===ii&&(o=ri));r.avail_in>0&&o===ti&&r.state.wrap>0&&0!==e[r.next_in];)Qn.inflateReset(r),o=Qn.inflate(r,a);switch(o){case ni:case ii:case ri:case oi:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===ti))if("string"===this.options.to){let e=Wr(r.output,r.next_out),t=r.next_out-e,i=Kr(r.output,e);r.next_out=t,r.avail_out=n-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==ei||0!==s){if(o===ti)return o=Qn.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},ai.prototype.onData=function(e){this.chunks.push(e)},ai.prototype.onEnd=function(e){e===ei&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Jr(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const{Deflate:si,deflate:ci,deflateRaw:ui,gzip:li}=cn;var di=li;var _i,pi=-1,fi=function(){function e(){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:null})}return Object.defineProperty(e.prototype,"setLogger",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger=e}}),Object.defineProperty(e.prototype,"getLogger",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._logger}}),Object.defineProperty(e.prototype,"createTraceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return(null===(e=this._logger)||void 0===e?void 0:e.createTraceId())||"".concat(Date.now())}}),Object.defineProperty(e.prototype,"debug",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;null===(n=this._logger)||void 0===n||n.debug(e,t,r)}}),Object.defineProperty(e.prototype,"info",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;null===(n=this._logger)||void 0===n||n.info(e,t,r)}}),Object.defineProperty(e.prototype,"warn",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;null===(n=this._logger)||void 0===n||n.warn(e,t,r)}}),Object.defineProperty(e.prototype,"error",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;null===(n=this._logger)||void 0===n||n.error(e,t,r)}}),Object.defineProperty(e.prototype,"__statistics",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;null===(n=this._logger)||void 0===n||n.__statistics(e,t,r)}}),Object.defineProperty(e,"setLogger",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger=e}}),Object.defineProperty(e,"getLogger",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._logger}}),Object.defineProperty(e,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:null}),e}(),bi=new fi,mi=function(){function e(){var e=this;Object.defineProperty(this,"_hostList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_iceCallback",{enumerable:!0,configurable:!0,writable:!0,value:function(t){return C(e,void 0,void 0,(function(){var e,r;return I(this,(function(n){if(t.candidate){if(""===t.candidate.candidate)return[2];e=t.candidate,r={type:e.type,foundation:e.foundation,protocol:e.protocol,address:e.address,port:e.port,priority:this._formatPriority(e.priority)},this._hostList.push(r)}return[2]}))}))}}),Object.defineProperty(this,"_gatheringStateChange",{enumerable:!0,configurable:!0,writable:!0,value:function(){var t,r;"complete"===(null===(t=e._peer)||void 0===t?void 0:t.iceGatheringState)&&(null===(r=e._peer)||void 0===r||r.close(),e._peer=null)}}),Object.defineProperty(this,"_iceCandidateError",{enumerable:!0,configurable:!0,writable:!0,value:function(t){var r;bi.error(T.L_GET_LOCAL_SRFLX_ADDRESS_PEER_E,JSON.stringify({execute:"_iceCandidateError",stack:t.stack})),null===(r=e._peer)||void 0===r||r.close(),e._peer=null}})}return Object.defineProperty(e.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i;return I(this,(function(o){switch(o.label){case 0:t={iceServers:[{urls:[e]}],iceTransportPolicy:"all"},r={offerToReceiveAudio:1},o.label=1;case 1:return o.trys.push([1,3,,4]),this._peer=new RTCPeerConnection(t),this._peer.onicecandidate=this._iceCallback,this._peer.onicegatheringstatechange=this._gatheringStateChange,this._peer.onicecandidateerror=this._iceCandidateError,[4,this._peer.createOffer(r)];case 2:return n=o.sent(),[3,4];case 3:return i=o.sent(),bi.error(T.L_GET_LOCAL_SRFLX_ADDRESS_PEER_E,JSON.stringify({execute:"start",stack:i.stack})),[2];case 4:return this._peer.setLocalDescription(n),[2]}}))}))}}),Object.defineProperty(e.prototype,"_formatPriority",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[e>>24,e>>8&65535,255&e].join(" | ")}}),Object.defineProperty(e.prototype,"getSrflxAddress",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e=this;return I(this,(function(t){return[2,new Promise((function(t,r){e._getAsyncHostList(t,r)}))]}))}))}}),Object.defineProperty(e.prototype,"_getAsyncHostList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;setTimeout((function(){var n;if(r._peer)r._getAsyncHostList(e,t);else{var i=(null===(n=r._hostList.filter((function(e){return"srflx"===e.type&&"udp"===e.protocol}))[0])||void 0===n?void 0:n.address)||"";e(i)}}),100)}}),e}();!function(e){e[e.Debug=4]="Debug",e[e.Info=3]="Info",e[e.Warning=2]="Warning",e[e.Error=1]="Error"}(_i||(_i={}));var hi,gi,vi=new(function(){function e(){Object.defineProperty(this,"openedLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.openedLevel=window.localStorage.getItem("__rtc_debugger_opened__")}return Object.defineProperty(e.prototype,"debug",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.openedLevel&&Number(this.openedLevel)>=_i.Debug&&console.log.apply(console,A(["%c*====rtc debugger====* ","color: grey"],P(e),!1))}}),Object.defineProperty(e.prototype,"info",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.openedLevel&&Number(this.openedLevel)>=_i.Info&&console.log.apply(console,A(["%c*====rtc debugger====* ","color: blue"],P(e),!1))}}),Object.defineProperty(e.prototype,"warn",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.openedLevel&&Number(this.openedLevel)>=_i.Warning&&console.log.apply(console,A(["%c*====rtc debugger====* ","color: yellow"],P(e),!1))}}),Object.defineProperty(e.prototype,"error",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.openedLevel&&Number(this.openedLevel)>=_i.Error&&console.log.apply(console,A(["%c*====rtc debugger====* ","color: red"],P(e),!1))}}),e}()),Ri=function(){return"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)}))},Si=function(t,r,n,i){return C(void 0,void 0,void 0,(function(){var o;return I(this,(function(a){switch(a.label){case 0:return o=[],[4,new Promise((function(t){setTimeout((function(){t({code:ze.SUCCESS})}),500);var a=0;r.map((function(s){return C(void 0,void 0,void 0,(function(){var c,u,l;return I(this,(function(d){switch(d.label){case 0:return c=s.detectorAddr.replace(/^(https?:\/\/)?/,"https://"),u="".concat(c,"/rtc/detector/ping?t=").concat((p=9999,(_=1e3)+Math.floor(Math.random()*(p-_)))),l={jwt:i},[4,n.httpReq({url:u,body:JSON.stringify(l),timeout:5e3,method:e.POST})];case 1:return 200===d.sent().status&&o.push(s.clusterId),++a>=r.length&&t({code:ze.SUCCESS}),[2]}var _,p}))}))}))})).catch((function(e){t.error(T.L_SDK_EXECUTE_E,JSON.stringify({execute:"getFastMediaUrl",error:e}))}))];case 1:return a.sent(),[2,o]}}))}))},yi=function(e){return e&&e.jwt||""},Ti=function(r,n,i){return C(void 0,void 0,void 0,(function(){var o,a,s,c,u,l,d,_,p,f,b,m,h,g;return I(this,(function(v){switch(v.label){case 0:return o=function(e,t){var r,n;if(!t)return"";try{n=JSON.parse(t.voipCallInfo||'{ "strategy": 0 }')}catch(r){return e.warn(T.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O,"parse `voipCallInfo` of navi failed: ".concat(t.voipCallInfo)),""}if(0===n.strategy)return"";var i=null===(r=n.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!i||0===i.length)return"";var o=i[0];return o.detectorManager?o.detectorManager:""}(n,i),a=yi(i),s=null,c=120,u=0,l="",(d=(i||{}).rtcStunServers)?(_=new mi,p=null===(g=Ao(d))||void 0===g?void 0:g[0],_.start("stun:".concat(p.host,":").concat(p.port)),[4,_.getSrflxAddress()]):[3,2];case 1:l=v.sent(),n.info(T.L_LOCAL_SRFLX_ADDRESS_O,l),v.label=2;case 2:return f={jwt:a},o?[4,r.httpReq({url:"".concat(o,"/rtc/detector/servers"),body:JSON.stringify(f),headers:O(O({},{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(Ro.browser,"|").concat(Ro.version),ClientVersion:"5.7.3-enterprise-alpha.8","Client-Session-Id":Ri(),"Request-Id":Date.now().toString()}),{"Client-Ip":l}),method:e.POST})]:[3,8];case 3:b=v.sent(),v.label=4;case 4:return v.trys.push([4,7,,8]),m=b.data&&JSON.parse(b.data).detectorAddrs,c=b.data&&JSON.parse(b.data).clientDetectMinute,u=b.data&&JSON.parse(b.data).resultCode,n.info(T.L_GET_MEDIA_SERVICE_LIST_O,b.data),m&&t(m)?[4,Si(n,m,r,a)]:[3,6];case 5:s=v.sent(),v.label=6;case 6:return[3,8];case 7:return h=v.sent(),n.error(T.L_SDK_EXECUTE_E,JSON.stringify({execute:"getDetectorUrls",error:h})),[3,8];case 8:return[2,{fastMediaUrl:s,clientDetectMinute:c,status:u}]}}))}))},Ei=function(t,r,n){return void 0===n&&(n={platform:"PC",version:"1.0.1",device:Po()}),C(void 0,void 0,void 0,(function(){var i,o;return I(this,(function(a){switch(a.label){case 0:return i=$e.getMemo(),o=/Electron/.test(navigator.userAgent),[4,t.httpReq({url:"".concat("https://rtc-quantum-test.rongcloud.net/rtc/config/agent/sdk/v1","?platform=").concat(o?n.platform:"Web","&version=").concat(n.version,"&device=").concat(n.device,"&uid=").concat(r.getCurrentId()),method:e.GET}).then((function(e){if(vi.info("getRTCConfig: response",e),200===e.status){No(e.data);var t=Ao(e.data);return i.group=null==t?void 0:t.group,t}}))];case 1:return[2,a.sent()]}}))}))};!function(e){e.Exchange_KV="Exchange_KV",e.Exchange_SDP_Crypto="Exchange_SDP_Crypto",e.Exchange_SDP_Ext="Exchange_SDP_Ext",e.Exchange_SDP_SSRC="Exchange_SDP_SSRC",e.Exchange_SDP_Stream="Exchange_SDP_Stream",e.Exchange_SDP_Codec="Exchange_SDP_Codec",e.Exchange_SDP_Media="Exchange_SDP_Media",e.Exchange_SDP_Mid="Exchange_SDP_Mid",e.Exchange_SDP="Exchange_SDP",e.Exchange_Sub_Stream="Exchange_Sub_Stream",e.Exchange_Active_Audio="Exchange_Active_Audio",e.Exchange_Request="Exchange_Request",e.Exchange_Response="Exchange_Response"}(gi||(gi={}));var Oi,Ci,Ii=((hi={})[gi.Exchange_KV]=["key","value"],hi[gi.Exchange_SDP_Crypto]=["tp","line"],hi[gi.Exchange_SDP_Ext]=["sal","absts","tccno"],hi[gi.Exchange_SDP_SSRC]=["main","fec","fid"],hi[gi.Exchange_SDP_Stream]=["tag","mid","meid","ssrc"],hi[gi.Exchange_SDP_Codec]=["tp","payload","feedbackTypes","formatParameters"],hi[gi.Exchange_SDP_Media]=["ext","codecs","streams"],hi[gi.Exchange_SDP_Mid]=["id","status","mediaType"],hi[gi.Exchange_SDP]=["sid","ifrag","ipwd","setup","crypto","fingerprint","dataFormat","candidates","tag","mids","audioMedia","videoMedia"],hi[gi.Exchange_Sub_Stream]=["meid","userId","tag","audioSSRC","videoSSRC","videoSimulcast"],hi[gi.Exchange_Active_Audio]=["mslabel","ssrc"],hi[gi.Exchange_Request]=["sdp","subStreamList","roomType","xorMode","meid","snui"],hi[gi.Exchange_Response]=["code","msg","sdp","rtcFinger","xorMode","udpObfuscationKey","snui","clusterId","activeAudioList"],hi),Li="\npackage Modules;\nmessage probuf {\n // KV 数据结构\n message ".concat(gi.Exchange_KV,"\n {\n required string key=1;\n required string value=2;\n }\n\n // Crypto 数据结构\n message ").concat(gi.Exchange_SDP_Crypto,"\n {\n optional int32 tp=1;\n optional string line=2;\n }\n\n // Crypto 数据结构\n message ").concat(gi.Exchange_SDP_Ext,"\n {\n optional int32 sal=1;\n optional int32 absts=2;\n optional int32 tccno=3;\n }\n\n // SSRC 数据结构\n message ").concat(gi.Exchange_SDP_SSRC,"\n {\n optional int64 main=1;\n optional int64 fec=2;\n optional int64 fid=3;\n }\n\n // Stream 数据结构\n message ").concat(gi.Exchange_SDP_Stream,"\n {\n optional string tag=1; //默认值,不传\n optional string mid=2; //PC专有,Remote Stream 使用\n optional string meid=3; //Remote Stream 使用\n optional ").concat(gi.Exchange_SDP_SSRC," ssrc=4;\n }\n\n // Codec 数据结构\n message ").concat(gi.Exchange_SDP_Codec,"\n {\n optional int32 tp=1;\n optional string payload=2;\n repeated string feedbackTypes=3;\n repeated ").concat(gi.Exchange_KV," formatParameters=4;\n }\n\n // Media 数据结构\n message ").concat(gi.Exchange_SDP_Media,"\n {\n optional ").concat(gi.Exchange_SDP_Ext," ext=1;\n repeated ").concat(gi.Exchange_SDP_Codec," codecs=2;\n repeated ").concat(gi.Exchange_SDP_Stream," streams=3;\n }\n\n // mid 数据结构,PC 专有\n message ").concat(gi.Exchange_SDP_Mid,"\n {\n optional string id=1;\n optional string status=2;\n optional int32 mediaType=3;\n }\n\n // SDP\n message ").concat(gi.Exchange_SDP,"\n {\n optional string sid=1; //local offer\n optional string ifrag=2; \n optional string ipwd=3;\n optional string setup=4; //PC专有\n optional ").concat(gi.Exchange_SDP_Crypto," crypto=5;\n optional string fingerprint=6; //PC专有\n optional int32 dataFormat=7; \n repeated string candidates=8; //remote answer\n optional string tag=9; //传当默认流的tag, 没有下划线\n repeated ").concat(gi.Exchange_SDP_Mid," mids=10; //PC专有\n optional ").concat(gi.Exchange_SDP_Media," audioMedia=11;\n optional ").concat(gi.Exchange_SDP_Media," videoMedia=12;\n }\n\n // 订阅流信息\n message ").concat(gi.Exchange_Sub_Stream,"\n {\n optional string meid=1;\n optional string userId=2;\n optional string tag=3; //默认tag不传\n optional int32 audioSSRC=4;\n optional int32 videoSSRC=5;\n optional int32 videoSimulcast=6;\n }\n\n // Active Audio 信息\n message ").concat(gi.Exchange_Active_Audio,"\n {\n optional string mslabel=1;\n optional int64 ssrc=2;\n }\n\n //Exchange Request\n message ").concat(gi.Exchange_Request," {\n optional ").concat(gi.Exchange_SDP," sdp=1;\n repeated ").concat(gi.Exchange_Sub_Stream," subStreamList=2;\n optional int32 roomType=3;\n optional int32 xorMode=4;\n optional string meid=5;\n optional int32 snui=6;\n }\n\n //Exchange Response\n message ").concat(gi.Exchange_Response," {\n optional int32 code = 1;\n optional string msg = 2;\n optional ").concat(gi.Exchange_SDP," sdp=3;\n optional string rtcFinger=4; //Meeting\n optional int32 xorMode=5;\n optional string udpObfuscationKey=6;\n optional int32 snui=7;\n optional string clusterId=8;\n repeated ").concat(gi.Exchange_Active_Audio," activeAudioList=9;\n }\n}\n");!function(e){e.GET="GET",e.POST="POST"}(Oi||(Oi={})),function(e){e[e.arrayBuffer=1]="arrayBuffer",e[e.blob=2]="blob",e[e.clone=3]="clone",e[e.formData=4]="formData",e[e.json=5]="json",e[e.text=6]="text"}(Ci||(Ci={}));var Pi,Ai,wi,ki,Di=function(e){if(!e)return vi.error("httpRequest: option not found"),Promise.reject("httpRequest: option not found");var t=e,r=t.url,n=t.method;t.query;var i=t.headers,o=t.body,a=t.timeout,s=t.dataType,c=t.cache,u=t.credentials,l=t.integrity,d=t.keepalive,_=t.mode;t.priority;var p=t.redirect,f=t.referrer,b=t.referrerPolicy,m=t.signal;if(!r)return vi.error("httpRequest: url invaild"),Promise.reject("httpRequest: url invaild");var h=new Promise((function(e,t){setTimeout((function(){t("timeout")}),a),fetch(r,{method:n,body:n===Oi.GET?void 0:o,headers:i,cache:c,credentials:u,integrity:l,keepalive:d,mode:_,redirect:p,referrer:f,referrerPolicy:b,signal:m}).then((function(t){return C(void 0,void 0,void 0,(function(){var r,n;return I(this,(function(i){switch(i.label){case 0:if(vi.debug("httpRequest response: ",t),r=t.status,!t.ok)return[3,15];switch(s){case Ci.arrayBuffer:return[3,1];case Ci.blob:return[3,3];case Ci.clone:return[3,5];case Ci.formData:return[3,7];case Ci.text:return[3,9];case Ci.json:return[3,11]}return[3,13];case 1:return[4,t.arrayBuffer()];case 2:case 4:case 6:case 8:case 10:case 12:case 14:return n=i.sent(),[3,15];case 3:return[4,t.blob()];case 5:return[4,t.clone()];case 7:return[4,t.formData()];case 9:return[4,t.text()];case 11:case 13:return[4,t.json()];case 15:return e({status:r,data:n}),[2]}}))}))})).catch((function(e){t(e)}))})).catch((function(e){return{status:0,data:e}}));return h},Ni=function(e){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(Ro.browser,"|").concat(Ro.version),ClientVersion:"5.7.3-enterprise-alpha.8","Client-Session-Id":Ri(),"Request-Id":Date.now().toString(),meid:bo(e)}},Mi=function(){function t(e,r,n,o){void 0===o&&(o=5e3),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_msUrl",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_msInNavi",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_failedMs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rtcFinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clusterId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_msList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_refetchNaviInfoCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_qualityMsList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_customParams",{enumerable:!0,configurable:!0,writable:!0,value:""}),this._logger=this._context.logger;var a=localStorage.getItem("__fast_media_url__");t.msInDetector=a?JSON.parse(a):[],t.isDetector||r.getConnectionStatus()!==i.CONNECTED||this.detectorMediaSever()}return Object.defineProperty(t.prototype,"setCustomExtendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._customParams=e}}),Object.defineProperty(t.prototype,"getCustomExtendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._customParams}}),Object.defineProperty(t.prototype,"detectorMediaSever",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!1);var n=this._context.getNaviInfo();if(t.jwtToken=(null==n?void 0:n.jwt)||"",!this._msUrl){var i=Date.now(),o=t.detectValidMinute+t.detectorTime>i;e&&(o=!1),t.isDetector=o,!o&&n&&r(n)&&(this._msList=[],this._getDetectorUrls(n))}}}),Object.defineProperty(t.prototype,"_getDetectorUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r;return C(this,void 0,void 0,(function(){var n,i,o,a=this;return I(this,(function(s){switch(s.label){case 0:return t.isDetector?[2]:(t.isDetector=!0,[4,Ti(this._runtime,this._logger,e)]);case 1:return n=s.sent(),i=n.fastMediaUrl,o=n.clientDetectMinute,n.status===ze.JWT_TIME_OUT&&(this._refetchNaviInfoCount=this._refetchNaviInfoCount<10?this._refetchNaviInfoCount+1:10,setTimeout((function(){return C(a,void 0,void 0,(function(){return I(this,(function(e){switch(e.label){case 0:return[4,this._context.getPluginContext().refetchNaviInfo()];case 1:return e.sent(),this.detectorMediaSever(),[2]}}))}))}),1e3*this._refetchNaviInfoCount)),this._refetchNaviInfoCount=0,null===(r=this._context.logger)||void 0===r||r.info(T.L_FAST_MEDIA_URL,JSON.stringify(i||[])),i&&i.length>0&&(localStorage.setItem("__fast_media_url__",JSON.stringify(i)),t.msInDetector=i||[],t.detectorTime=Date.now(),t.detectValidMinute=60*o*1e3,this.setMediaServiceList()),[2]}}))}))}}),Object.defineProperty(t.prototype,"getNaviMS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msUrl?[this._msUrl]:(n(this._msList)&&!this._clusterId||(this._msList=this.setMediaServiceList()),this._msList)}}),Object.defineProperty(t.prototype,"setMediaServiceList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r,i,o=[];return this._clusterId&&(this._clusterId=this._clusterId.replace(/^(https?:\/\/)?/,"https://"),this._msList.push(this._clusterId)),n(t.msInDetector)&&(t.msInDetector=t.msInDetector.map((function(e){return e.replace(/^(https?:\/\/)?/,"https://")})),this._msList.push(t.msInDetector[0]),o=t.msInDetector.concat().splice(1,t.msInDetector.length-1)),0===this._msInNavi.length&&(0===this._failedMs.length?(e=this._msInNavi).push.apply(e,A([],P(function(e,t){var r,n;if(!e)return[];try{n=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(r){return t.warn(T.L_PARSE_VOIP_SERVER_CONF_E,e.voipCallInfo),[]}if(0===n.strategy)return[];var i=null===(r=n.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!i||0===i.length)return[];var o=i[0],a=[];return o.mediaServer&&a.push(o.mediaServer.replace(/^(https?:\/\/)?/,"https://")),o.backupMediaServer&&o.backupMediaServer.forEach((function(e){a.push(e.replace(/^(https?:\/\/)?/,"https://"))})),a}(this._context.getNaviInfo(),this._logger)),!1)):((r=this._msInNavi).push.apply(r,A([],P(this._failedMs),!1)),this._failedMs.length=0)),i=this._msInNavi.concat().splice(1,this._msInNavi.length-1),this._msList.push(this._msInNavi[0]),this._msList=A(A(A([],P(this._msList),!1),P(o),!1),P(i),!1),this._msList=A([],P(new Set(this._msList)),!1),this._logger.info(T.L_MEDIA_SERVICE_MSLIST_CHANGE_O,"MediaServiceList msList -> ".concat(JSON.stringify(this._msList))),this._msList=[this._msList[0]],this._msList}}),Object.defineProperty(t.prototype,"clearCacheMsList",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._msList=[],this._clusterId="",t.msInDetector=[]}}),Object.defineProperty(t.prototype,"clearClusterId",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._clusterId="",this._msList=[]}}),Object.defineProperty(t.prototype,"_openGzip",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var r=JSON.stringify(t),n=r.length,i=new Uint8Array(n),o=0;o<n;o++)i[o]=r.charCodeAt(o);var a;return{headers:e=O(O({},e),{"Content-Encoding":"gzip","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}),body:t=di(i,a)}}}),Object.defineProperty(t.prototype,"_dealRequestSuccessResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Ao(e);return i.rtcFinger&&(this._rtcFinger=i.rtcFinger),i.clusterId&&(this._clusterId=i.clusterId),this._logger.info(T.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:E.SUCCEEDED,url:t}),r),{code:ze.SUCCESS,data:i,qualityMsList:this._qualityMsList}}}),Object.defineProperty(t.prototype,"_request",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i,o){return C(this,void 0,void 0,(function(){var a,s,c,u,l,d,_,p,f,b,m,h,g,v,R,S,y;return I(this,(function(C){switch(C.label){case 0:if(this._qualityMsList=[],a=this._context.getNaviInfo(),s=(null==a?void 0:a.openGzip)||!1,c=s?this._openGzip(r,n):{headers:r,body:n},u=c.headers,l=c.body,0===(d=this.getNaviMS()).length)return this._logger.error(T.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:E.FAILED,code:ze.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),i),[2,{code:ze.NOT_OPEN_VIDEO_AUDIO_SERVER}];this._rtcFinger&&(l.rtcFinger=this._rtcFinger),_=0,C.label=1;case 1:return _<d.length?(p=Date.now(),f="",f=this._context.staticMediaServerUrl?"".concat(this._context.staticMediaServerUrl).concat(t):"".concat(d[_]).concat(t),b=Ni(this._context.getCurrentId()),m=O(O({},b),u),h=/x-www-form-urlencoded/.test(m["Content-Type"])?l:JSON.stringify(l),g=b["Request-Id"],this._logger.info(T.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:f,"Request-Id":g}),i),[4,this._runtime.httpReq({url:f,body:h,headers:m,method:e.POST,timeout:(null==a?void 0:a.timeOut)||this._timeout})]):[3,4];case 2:if(v=C.sent(),R=v.status,S=v.data,o&&this._qualityMsList.push({rsdur:Date.now()-p,rsid:g,rscod:200===R?ze.SUCCESS:ze.REQUEST_FAILED,msa:f}),200===R)return[2,this._dealRequestSuccessResult(S,f,i)];(y=this._failedMs).push.apply(y,A([],P(this._msInNavi.splice(_,1)),!1)),this._logger.error(T.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:E.FAILED,msg:"request error -> Request-Id: ".concat(g,", status: ").concat(R,", url: ").concat(f),timeout:(null==a?void 0:a.timeOut)||this._timeout}),i),C.label=3;case 3:return _+=1,[3,1];case 4:return[2,{code:ze.REQUEST_FAILED,qualityMsList:this._qualityMsList}]}}))}))}}),Object.defineProperty(t.prototype,"_requestMini",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o,a;return C(this,void 0,void 0,(function(){var s,c,u,l,d,_,p,f,b,m,h,g,v;return I(this,(function(R){switch(R.label){case 0:if(this._qualityMsList=[],s=this._context.getNaviInfo(),0===(c=this.getNaviMS()).length)return this._logger.error(T.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:E.FAILED,code:ze.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),n),[2,{code:ze.NOT_OPEN_VIDEO_AUDIO_SERVER}];this._rtcFinger&&(r.rtcFinger=this._rtcFinger),u=0,R.label=1;case 1:return u<c.length?(l=Date.now(),d="",d=this._context.staticMediaServerUrl?"".concat(this._context.staticMediaServerUrl).concat(e):"".concat(c[u]).concat(e),_=Ni(this._context.getCurrentId()),p=O(O({},_),t),/x-www-form-urlencoded/.test(p["Content-Type"])||JSON.stringify(r),f=_["Request-Id"],this._logger.info(T.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:d,"Request-Id":f}),n),[4,Di({url:d,body:r,headers:{"Content-Type":"application/octet-stream","Cache-Control":"no-cache",Token:p.Token,Roomid:p.RoomId,"App-Key":p["App-Key"],"Request-Id":p["Request-Id"],ClientVersion:p.ClientVersion},method:Oi.POST,timeout:(null==s?void 0:s.timeOut)||this._timeout,dataType:Ci.arrayBuffer})]):[3,4];case 2:if(b=R.sent(),m=b.status,h=b.data,i&&this._qualityMsList.push({rsdur:Date.now()-l,rsid:f,rscod:200===m?ze.SUCCESS:ze.REQUEST_FAILED,msa:d}),200===m)return g=null===(a=null===(o=this._context.miniSDPCodec)||void 0===o?void 0:o.decode(gi.Exchange_Response,h))||void 0===a?void 0:a.encodeJSON(),[2,this._dealRequestSuccessResult(g,d,n,!0)];(v=this._failedMs).push.apply(v,A([],P(this._msInNavi.splice(u,1)),!1)),this._logger.error(T.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:E.FAILED,msg:"request error -> Request-Id: ".concat(f,", status: ").concat(m,", url: ").concat(d),timeout:(null==s?void 0:s.timeOut)||this._timeout}),n),R.label=3;case 3:return u+=1,[3,1];case 4:return[2,{code:ze.REQUEST_FAILED}]}}))}))}}),Object.defineProperty(t.prototype,"exchange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var i,o;return I(this,(function(a){switch(a.label){case 0:return(i=$e.getMemo()).sendQos=!1,[4,this._request("/rtc/media/client/call/exchange",e,t,r,n)];case 1:return o=a.sent(),i.sendQos=!0,[2,o]}}))}))}}),Object.defineProperty(t.prototype,"meetingSubExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i;return I(this,(function(o){switch(o.label){case 0:return(n=$e.getMemo()).sendQos=!1,[4,this._request("/rtc/media/client/bigroom/exchange",e,t,r)];case 1:return i=o.sent(),n.sendQos=!0,[2,i]}}))}))}}),Object.defineProperty(t.prototype,"miniSDPExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;return C(this,void 0,void 0,(function(){var i,o,a;return I(this,(function(s){switch(s.label){case 0:return(i=$e.getMemo()).sendQos=!1,o=null===(n=this._context.miniSDPCodec)||void 0===n?void 0:n.encode(gi.Exchange_Request,t),[4,this._requestMini("/rtc/media/v2/pb/call",e,o,r,void 0)];case 1:return a=s.sent(),i.sendQos=!0,[2,a]}}))}))}}),Object.defineProperty(t.prototype,"meetingSubExit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){switch(t.label){case 0:return[4,this._request("/rtc/media/client/bigroom/exit",e,{})];case 1:return[2,t.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return I(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),[4,this._request("/rtc/media/exit",e,{},t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t,"isDetector",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(t,"msInDetector",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"detectorTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"detectValidMinute",{enumerable:!0,configurable:!0,writable:!0,value:72e5}),Object.defineProperty(t,"jwtToken",{enumerable:!0,configurable:!0,writable:!0,value:""}),t}();!function(e){e[e.Error=0]="Error",e[e.Resume=1]="Resume"}(Pi||(Pi={})),function(e){e[e.RCRTCStreamCodeDefault=0]="RCRTCStreamCodeDefault",e[e.RCRTCStreamCodeCantRecordAudioData=1]="RCRTCStreamCodeCantRecordAudioData"}(Ai||(Ai={})),function(e){e[e.Low=0]="Low",e[e.Normal=1]="Normal"}(wi||(wi={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(ki||(ki={}));var Ui,ji,Bi,xi=function(e){function t(t,r,n,i,o,a,s,c){void 0===c&&(c=Ri());var u=e.call(this)||this;return Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"_tag",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(u,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_meid",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"_kind",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_isLocalTrack",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"uuid",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"_localMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_remoteMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_streamId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_msTrack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_msStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"DataTrackId",{enumerable:!0,configurable:!0,writable:!0,value:"data-track-id"}),Object.defineProperty(u,"_code",{enumerable:!0,configurable:!0,writable:!0,value:Ai.RCRTCStreamCodeDefault}),Object.defineProperty(u,"_element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),u._streamId=[u._meid||u._userId||u._roomId,u._tag].join("_"),u._id=[u._streamId,u.isAudioTrack()?0:1].join("_"),u}return y(t,e),Object.defineProperty(t.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._streamId}}),Object.defineProperty(t.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._id}}),Object.defineProperty(t.prototype,"getUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._userId}}),Object.defineProperty(t.prototype,"getMeid",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._meid}}),Object.defineProperty(t.prototype,"__innerGetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msTrack}}),Object.defineProperty(t.prototype,"streamTrack",{get:function(){return this._msTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getTag",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._tag}}),Object.defineProperty(t.prototype,"isLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isLocalTrack}}),Object.defineProperty(t.prototype,"isVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"video"===this._kind}}),Object.defineProperty(t.prototype,"isAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"audio"===this._kind}}),Object.defineProperty(t.prototype,"isReady",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return"live"===(null===(e=this._msTrack)||void 0===e?void 0:e.readyState)}}),Object.defineProperty(t.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;this._msTrack=e,this._localMuted=!(null==e?void 0:e.enabled),this._setLocalMuted(this._localMuted);var r=this._msStream=this._msStream||new MediaStream,n=r.getTracks()[0];n&&r.removeTrack(n),this._isLocalTrack||this._logger.warn(T.L_INNER_SET_TRACK_O,"trackId: ".concat(this._id,", track: ").concat(e?e.id:"undefined")),e?r.addTrack(e):this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(null===(t=this._logger)||void 0===t||t.info(T.L_REMOVE_SRC_OBJECT_O,"exec: __innerSetMediaStreamTrack -> ".concat(this.getTrackId())),this._element.pause(),this._element.srcObject=null,this._element=void 0)}}),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){return this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e,[2,ze.SUCCESS]}))}))}}),Object.defineProperty(t.prototype,"mute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return I(this,(function(e){return[2,this._setLocalMuted(!0)]}))}))}}),Object.defineProperty(t.prototype,"unmute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return I(this,(function(e){return[2,this._setLocalMuted(!1)]}))}))}}),Object.defineProperty(t.prototype,"isLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._localMuted}}),Object.defineProperty(t.prototype,"isOwnerMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteMuted}}),Object.defineProperty(t.prototype,"isDeviceAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!0}}),Object.defineProperty(t.prototype,"updateDeviceAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._code=e}}),Object.defineProperty(t.prototype,"getDeviceAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return void 0===e&&(e=!1),e?this._code:Ai.RCRTCStreamCodeDefault}}),Object.defineProperty(t.prototype,"_validateVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e?void 0:e.volume){if(!o(null==e?void 0:e.volume))return this._logger.error(T.L_TRACK_PLAY_E,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> options.volume not a number"})),{code:ze.PARAMS_ERROR};(null==e?void 0:e.volume)<0&&(e.volume=0,this._logger.warn(T.L_TRACK_PLAY_E,JSON.stringify({status:E.FAILED,msg:"params error -> options.volume < 0",tips:"the valid range of options.volume is 0-100, the value of volume has been set 0"}))),(null==e?void 0:e.volume)>100&&(e.volume=100,this._logger.warn(T.L_TRACK_PLAY_E,JSON.stringify({status:E.FAILED,msg:"params error -> options.volume > 100",tips:"the valid range of options.volume is 0-100, the value of volume has been set 100"})))}}}),Object.defineProperty(t.prototype,"_validatePlayOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n;return I(this,(function(i){switch(i.label){case 0:return this._msTrack?("ended"===this._msTrack.readyState&&this._logger.warn(T.L_TRACK_PLAY_E,"track readyState is ended -> id: ".concat(this._id)),(r=this._validateVolume(t))?[2,r]:(null==t?void 0:t.audioDeviceId)?[4,Xe.getSpeakers()]:[3,2]):(this._logger.error(T.L_TRACK_PLAY_E,JSON.stringify({status:E.FAILED,code:ze.TRACK_NOT_READY,kind:this._kind,msg:"the track is not ready to play -> id: ".concat(this._id)})),[2,{code:ze.TRACK_NOT_READY}]);case 1:if(n=i.sent().map((function(e){return e.deviceId})),!n.includes(t.audioDeviceId))return this._logger.error(T.L_TRACK_PLAY_E,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> options.audioDeviceId"})),[2,{code:ze.PARAMS_ERROR}];i.label=2;case 2:return!this.isVideoTrack()||e&&(e instanceof HTMLVideoElement||this._validateVideoNodeName(e))?[2]:(this._logger.error(T.L_TRACK_PLAY_E,JSON.stringify({status:E.FAILED,code:ze.VIDEO_TRACK_MISS_MEDIA_ELEMENT,kind:this._kind,msg:"params element is not a HTMLVideoElement"})),[2,{code:ze.VIDEO_TRACK_MISS_MEDIA_ELEMENT}])}}))}))}}),Object.defineProperty(t.prototype,"_setPlayAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return C(this,void 0,void 0,(function(){return I(this,(function(n){switch(n.label){case 0:return e&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),!(null==t?void 0:t.audioDeviceId)||e?[3,2]:[4,this._element.setSinkId(t.audioDeviceId)];case 1:n.sent(),n.label=2;case 2:return e||!(null==t?void 0:t.volume)&&0!==(null==t?void 0:t.volume)||(this._element.volume=t.volume/100),null===(r=this._element)||void 0===r||r.setAttribute(this.DataTrackId,this.getTrackId()),[2]}}))}))}}),Object.defineProperty(t.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i;return C(this,void 0,void 0,(function(){var o,a,s,c,u,l=this;return I(this,(function(d){switch(d.label){case 0:return o=$e.getMemo(),a=so(this._id).identifier,s=null===(r=o.meidToUserIdMap)||void 0===r?void 0:r[a],null===(n=this._logger)||void 0===n||n.info(T.L_TRACK_PLAY_O,JSON.stringify({elementId:null==e?void 0:e.id,kind:null!==(i=this._kind)&&void 0!==i?i:"",options:t,msg:"start play trackId: ".concat(this._id," by user: ").concat(s)})),[4,this._validatePlayOptions(e,t)];case 1:return(c=d.sent())?[2,c]:(u=this.isVideoTrack(),this._element=u?e:new Audio,this._localMuted&&this._setLocalMuted(!1),this._element.srcObject&&this._element.srcObject===this._msStream||this._element.pause(),this._element.onloadstart=function(e){var t,r,n;null===(t=l._logger)||void 0===t||t.info(T.L_TRACK_LOAD_START_O,JSON.stringify({status:E.INFO,kind:null!==(r=l._kind)&&void 0!==r?r:"",msg:"HTMLMediaElement onloadstart -> id: ".concat(null===(n=e.target)||void 0===n?void 0:n.id,", trackId: ").concat(l._id," by user: ").concat(s)}))},this._element.ondurationchange=function(e){var t,r,n;null===(t=l._logger)||void 0===t||t.info(T.L_TRACK_DURATION_CHANGE_O,JSON.stringify({status:E.INFO,kind:null!==(r=l._kind)&&void 0!==r?r:"",msg:"HTMLMediaElement ondurationchange -> id: ".concat(null===(n=e.target)||void 0===n?void 0:n.id,", trackId: ").concat(l._id," by user: ").concat(s)}))},this._element.onloadedmetadata=function(e){var t,r,n;null===(t=l._logger)||void 0===t||t.info(T.L_TRACK_LOADED_META_DATA_O,JSON.stringify({status:E.INFO,kind:null!==(r=l._kind)&&void 0!==r?r:"",msg:"HTMLMediaElement onloadedmetadata -> id: ".concat(null===(n=e.target)||void 0===n?void 0:n.id,", trackId: ").concat(l._id," by user: ").concat(s)}))},this._element.onloadeddata=function(e){var t,r,n;null===(t=l._logger)||void 0===t||t.info(T.L_TRACK_LOADED_DATA_O,JSON.stringify({status:E.INFO,kind:null!==(r=l._kind)&&void 0!==r?r:"",msg:"HTMLMediaElement onloadeddata -> id: ".concat(null===(n=e.target)||void 0===n?void 0:n.id,", trackId: ").concat(l._id," by user: ").concat(s)}))},this._element.onabort=function(e){var t,r,n;null===(t=l._logger)||void 0===t||t.info(T.L_TRACK_ABORT_O,JSON.stringify({status:E.INFO,kind:null!==(r=l._kind)&&void 0!==r?r:"",msg:"HTMLMediaElement onabort -> id: ".concat(null===(n=e.target)||void 0===n?void 0:n.id,", trackId: ").concat(l._id," by user: ").concat(s)}))},this._element.oncanplay=function(e){return C(l,void 0,void 0,(function(){var r,n,i,o,a,c,l,d,_,p,f;return I(this,(function(b){switch(b.label){case 0:null===(n=this._logger)||void 0===n||n.info(T.L_TRACK_CANPLAY_O,JSON.stringify({status:E.INFO,kind:null!==(i=this._kind)&&void 0!==i?i:"",msg:"HTMLMediaElement oncanplay -> id: ".concat(null===(o=e.target)||void 0===o?void 0:o.id,", trackId: ").concat(this._id," by user: ").concat(s)})),b.label=1;case 1:return b.trys.push([1,5,,6]),!(null==t?void 0:t.audioDeviceId)||u?[3,3]:[4,this._element.setSinkId(t.audioDeviceId)];case 2:b.sent(),b.label=3;case 3:return[4,null===(a=this._element)||void 0===a?void 0:a.play()];case 4:return b.sent(),[3,6];case 5:return"No permission to use requested device"===(r=b.sent()).message?(null===(c=this._logger)||void 0===c||c.error(T.L_TRACK_PLAY_E,JSON.stringify({status:E.FAILED,kind:null!==(l=this._kind)&&void 0!==l?l:"",code:ze.NO_PERMISSION_TO_USE_REQUESTED_DEVICE,msg:"setSinkId failed, error msg: ".concat(r.message," -> id: ").concat(null===(d=e.target)||void 0===d?void 0:d.id,", trackId: ").concat(this._id," by user: ").concat(s)})),[2]):(null===(_=this._logger)||void 0===_||_.error(T.L_TRACK_PLAY_E,JSON.stringify({status:E.FAILED,code:ze.TRACK_PLAY_ERROR,kind:null!==(p=this._kind)&&void 0!==p?p:"",msg:"play error, error msg: ".concat(r.message," -> id: ").concat(null===(f=e.target)||void 0===f?void 0:f.id,", trackId: ").concat(this._id," by user: ").concat(s)})),[3,6]);case 6:return[2]}}))}))},this._element.onvolumechange=function(e){var t,r,n,i=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));null===(r=l._logger)||void 0===r||r.info(T.L_TRACK_VOLUME_CHANGE_O,JSON.stringify({status:E.INFO,msg:"HTMLMediaElement onvolumechange -> id: ".concat(null===(n=e.target)||void 0===n?void 0:n.id,", volume: ").concat(i,", trackId: ").concat(l._id," by user: ").concat(s)}))},this._element.srcObject=this._msStream,this._element.autoplay=!0,[4,this._setPlayAttrs(u,t)]);case 2:return d.sent(),[2,{code:ze.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"__innerDestroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.__innerSetMediaStreamTrack(void 0)}}),Object.defineProperty(t.prototype,"__releaseMediaElement",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(null===(e=this._logger)||void 0===e||e.info(T.L_REMOVE_SRC_OBJECT_O,JSON.stringify({exec:"__releaseMediaElement",trackId:this.getTrackId(),dataTrackId:this.DataTrackId})),this._element.pause(),this._element.remove(),this._element.srcObject=null,this._element=void 0)}}),Object.defineProperty(t.prototype,"_validateVideoNodeName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()}}),Object.defineProperty(t.prototype,"__updateStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._streamId=uo(e,this._tag)}}),Object.defineProperty(t.prototype,"__updateId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._id=lo(e,this._tag,this.isAudioTrack()?0:1)}}),Object.defineProperty(t.prototype,"__updateMeid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._meid=e}}),Object.defineProperty(t,"__INNER_DECODE_FIRST__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-decode-first"}),t}(a);!function(e){e.Speech="Speech",e.Music="Music",e.MusicHigh="MusicHigh"}(Bi||(Bi={}));var Fi,Vi=((Ui={})[Bi.Music]={max:64,min:64},Ui[Bi.MusicHigh]={max:128,min:128},Ui[Bi.Speech]={max:32,min:32},Ui);!function(e){e.LEVEL0="LEVEL0",e.LEVEL1="LEVEL1",e.LEVEL2="LEVEL2",e.LEVEL3="LEVEL3",e.LEVEL4="LEVEL4",e.LEVEL5="LEVEL5"}(Fi||(Fi={}));var Ji,Hi=((ji={})[Fi.LEVEL0]={max:150,min:80},ji[Fi.LEVEL1]={max:280,min:120},ji[Fi.LEVEL2]={max:650,min:150},ji[Fi.LEVEL3]={max:1e3,min:200},ji[Fi.LEVEL4]={max:2200,min:250},ji[Fi.LEVEL5]={max:4e3,min:400},ji),Gi=function(){function e(){}return Object.defineProperty(e,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s;return I(this,(function(c){switch(c.label){case 0:r=new AudioContext({sampleRate:44100}),c.label=1;case 1:return c.trys.push([1,5,,6]),[4,r.audioWorklet.addModule(e.SCRIPT_URL)];case 2:return c.sent(),[4,fetch(e.WASM_URL,{cache:"force-cache",credentials:"same-origin"})];case 3:return[4,c.sent().arrayBuffer()];case 4:return n=c.sent(),[3,6];case 5:return c.sent(),[2,{code:ze.LOAD_3A_MODULE_FAILED}];case 6:return i=r.createMediaStreamSource(new MediaStream([t])),o=new AudioWorkletNode(r,"process-worklet",{numberOfInputs:1,numberOfOutputs:1,outputChannelCount:[1],processorOptions:{binary:n}}),a=r.createMediaStreamDestination(),i.connect(o).connect(a),s=a.stream.getAudioTracks()[0],e._maps.set(t.id,r),[2,{code:ze.SUCCESS,track:s}]}}))}))}}),Object.defineProperty(e,"release3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e._maps.get(t.id);r&&(r.close(),e._maps.delete(t.id))}}),Object.defineProperty(e,"WASM_URL",{enumerable:!0,configurable:!0,writable:!0,value:"https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.2/AudioProcessing.wasm"}),Object.defineProperty(e,"SCRIPT_URL",{enumerable:!0,configurable:!0,writable:!0,value:"https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.2/process-worklet.js"}),Object.defineProperty(e,"_maps",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),e}(),qi=function(e){function t(t,r,n,i,o,a,s){var c=e.call(this,t,r,n,i,o,!0,void 0,s)||this;return Object.defineProperty(c,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_isPause",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_isPublished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_bitrateInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),c.__innerSetMediaStreamTrack(a),a.onended=function(){a.onended=null,c._onTrackEnded()},c}return y(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(t.EVENT_LOCAL_TRACK_END,this),this.removeAll(t.EVENT_LOCAL_TRACK_END)}}),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this;return new Promise((function(i,o){var a,s=n._localMuted!==r;null===(a=n._logger)||void 0===a||a.info(T.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({localMuted:r,trackId:n._id})),e.prototype._setLocalMuted.call(n,r),n._remoteMuted=n._localMuted,i(ze.SUCCESS),s&&n.emit(t.__INNER_EVENT_MUTED_CHANGE__,n,i)}))}}),Object.defineProperty(t.prototype,"updateDeviceAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(r){e.prototype.updateDeviceAvailable.call(this,r),this.emit(t.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this,r)}}),Object.defineProperty(t.prototype,"onlyMute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return I(this,(function(e){return[2,this.__setLocalMuted(!0)]}))}))}}),Object.defineProperty(t.prototype,"onlyUnmute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return I(this,(function(e){return[2,this.__setLocalMuted(!1)]}))}))}}),Object.defineProperty(t.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r,n=$e.getMemo(),i=n.naviInfo;return-1===((null==i?void 0:i.pauseVideoDelayMs)||-1)||(!n.crtRoom||(null===(r=this._logger)||void 0===r||r.info(T.L_PAUSE_VIDEO_T,JSON.stringify({userId:this.getUserId(),trackId:this.getTrackId()})),this._isPause=e,this.emit(t.__INNER_EVENT_SEND_CHANGE__,this,e),!0))}}),Object.defineProperty(t.prototype,"isPause",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isPause}}),Object.defineProperty(t.prototype,"__setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r;return e.prototype._setLocalMuted.call(this,t),this._remoteMuted=this._localMuted,null===(r=this._logger)||void 0===r||r.info(T.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({localMuted:t,trackId:this._id})),Promise.resolve(ze.SUCCESS)}}),Object.defineProperty(t.prototype,"__innerSetPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isPublished=e}}),Object.defineProperty(t.prototype,"isPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isPublished}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r,n;this._isDestroyed||(null===(r=this._logger)||void 0===r||r.info(T.L_LOCAL_TRACK_DESTROY_O,JSON.stringify({trackId:this._id,uuid:this.uuid})),this._isDestroyed=!0,this._isPause=!1,null===(n=this._msTrack)||void 0===n||n.stop(),e.prototype.__innerDestroy.call(this),this.isAudioTrack()&&e.prototype.__releaseMediaElement.call(this),this._isPublished&&this.emit(t.__INNER_EVENT_DESTROY__,this))}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i,a;if(void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),!o(e)||!o(t)||!o(r)||e<=0||t<=0||e<t)null===(i=this._logger)||void 0===i||i.error(T.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:E.FAILED,msg:"params error -> max: ".concat(e,",min: ").concat(t,", start: ").concat(r),trackId:this._id}));else{null===(a=this._logger)||void 0===a||a.info(T.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:E.SUCCEEDED,max:e,min:t,start:r,trackId:this._id}));var s=$e.getMemo();s.startBitrate?s.startBitrate[this.getTrackId()]=r:s.startBitrate=((n={})[this.getTrackId()]=r,n),this._bitrateInfo={max:e,min:t,start:r}}}}),Object.defineProperty(t.prototype,"getBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r,n,i,o,a,s,c,u=0,l=0,d=0;return(null===(r=this._msTrack)||void 0===r?void 0:r.kind)===ki.VIDEO?(u=(e=oo(this._msTrack)).min,l=e.max):(null===(n=this._msTrack)||void 0===n?void 0:n.kind)===ki.AUDIO&&(u=(t={min:32,max:32}).min,l=t.max),(null===(i=this._bitrateInfo)||void 0===i?void 0:i.max)&&(d=.7*(null===(o=this._bitrateInfo)||void 0===o?void 0:o.max)),{min:(null===(a=this._bitrateInfo)||void 0===a?void 0:a.min)||u,max:(null===(s=this._bitrateInfo)||void 0===s?void 0:s.max)||l,start:(null===(c=this._bitrateInfo)||void 0===c?void 0:c.start)||d}}}),Object.defineProperty(t.prototype,"__updateInnerDataByMeid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){e.prototype.__updateStreamId.call(this,t),e.prototype.__updateId.call(this,t),e.prototype.__updateMeid.call(this,t)}}),Object.defineProperty(t,"EVENT_LOCAL_TRACK_END",{enumerable:!0,configurable:!0,writable:!0,value:"local-track-end"}),Object.defineProperty(t,"__INNER_EVENT_MUTED_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-muted-change"}),Object.defineProperty(t,"__INNER_EVENT_SEND_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-send-change"}),Object.defineProperty(t,"__INNER_EVENT_DESTROY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-destroy"}),Object.defineProperty(t,"__INNER_EVENT_DEVICE_STATUS_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-device-status-change"}),t}(xi),Ki=function(e){function t(t,r,n,i,o,a){var s=e.call(this,t,r,n,i,"audio",o,a)||this;return Object.defineProperty(s,"_audioLevelMonitorTrack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_audioLevelMonitorTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_audioLevelAnalyser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_audioLevelMonitorGap",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),s._audioLevelMonitorTrack=o.clone(),s._createMonitor(),s}return y(t,e),Object.defineProperty(t.prototype,"__innerSetPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(t){e.prototype.__innerSetPublished.call(this,t)}}),Object.defineProperty(t.prototype,"_createMonitor",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(AudioContext){var e=new AudioContext,t=new MediaStream;t.addTrack(this._audioLevelMonitorTrack);var r=e.createMediaStreamSource(t),n=e.createAnalyser();n.fftSize=256,r.connect(n),this._audioLevelAnalyser=n,this._check()}else this._logger.warn(T.L_NOT_SUPPORT_AUDIO_LEVEL_MONITOR_O)}}),Object.defineProperty(t.prototype,"_getVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Uint8Array(e.frequencyBinCount);e.getByteFrequencyData(t);for(var r=0,n=0;n<t.length;n++)r+=t[n];return r/t.length/255*100}}),Object.defineProperty(t.prototype,"_check",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(this._audioLevelAnalyser){var t=$e.getMemo();clearInterval(this._audioLevelMonitorTimer);var r=0,n=[];this._audioLevelMonitorTimer=setInterval((function(){r++;var i=e._getVolume(e._audioLevelAnalyser);i<.1&&void 0!==t.audioRecordInputZeroCount?t.audioRecordInputZeroCount+=1:t.audioRecordInputZeroCount=i<.1?1:0,vi.debug("audioLevelMonitor: ","current: ",i),t.micAudioLevel=i,n.push(i),r/10==0&&(e._logger.debug(T.L_COLLECT_VOLUME_O,JSON.stringify({volumeList:n})),r=0,n=[])}),this._audioLevelMonitorGap),vi.debug("start audioLevelMonitor interval: ",this._audioLevelMonitorTimer)}}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){vi.debug("destroy audioLevelMonitor interval: ",this._audioLevelMonitorTimer),clearInterval(this._audioLevelMonitorTimer),this._audioLevelMonitorTrack.stop(),e.prototype.destroy.call(this)}}),Object.defineProperty(t.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(s("audioBitrate",e,(function(e){return e in Bi}))){var t=Vi[e];this.setBitrate(t.max,t.min,t.start||.7*t.max)}else this._logger.warn(T.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:E.FAILED,msg:"params error -> params type is RCAudioBitrate"}))}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=P(r,2),o=i[0],a=void 0===o?1:o,s=i[1],c=void 0===s?.7*t||1:s;e.prototype.setBitrate.call(this,t,a,c)}}),Object.defineProperty(t.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(t){e.prototype.__innerSetMediaStreamTrack.call(this,t)}}),t}(qi),Wi=function(e){function t(t,r,n,i,o,a,s){void 0===a&&(a=!1);var c=e.call(this,t,r,n,i,"video",o,s)||this;return Object.defineProperty(c,"_isTiny",{enumerable:!0,configurable:!0,writable:!0,value:a}),c}return y(t,e),Object.defineProperty(t.prototype,"__isTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isTiny}}),Object.defineProperty(t.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t=e.prototype.getStreamId.call(this);return this._isTiny?"".concat(t,"_tiny"):t}}),Object.defineProperty(t.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t=e.prototype.getTrackId.call(this);return this._isTiny?"".concat(t,"_tiny"):t}}),Object.defineProperty(t.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;if(s("videoBitrate",e,(function(e){return e in Fi}))){var r=Hi[e];this.setBitrate(r.max,r.min,r.start||.7*r.max)}else null===(t=this._logger)||void 0===t||t.warn(T.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:E.FAILED,msg:"params error -> params type is RCVideoBitrate"}))}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=P(r,2),o=i[0],a=void 0===o?1:o,s=i[1],c=void 0===s?.7*t||1:s;e.prototype.setBitrate.call(this,t,a,c)}}),t}(qi),zi=function(e){function t(r,n,i,o,a,s,c){var u=e.call(this,r,n,i,o,a,s)||this;return Object.defineProperty(u,"_resource",{enumerable:!0,configurable:!0,writable:!0,value:c}),t._innerSetMapping(u.getTrackId(),c),u}return y(t,e),Object.defineProperty(t,"_innerSetMapping",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._mapping.get(t)||[];r.push(e),this._mapping.set(t,r)}}),Object.defineProperty(t,"_innerRemoveMapping",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i=null===(r=this._mapping.get(t))||void 0===r?void 0:r.filter((function(t){return t!==e}));i&&i.length>0?this._mapping.set(t,i):(this._mapping.delete(t),t.pause(),t.src="",null===(n=t.parentNode)||void 0===n||n.removeChild(t))}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAudioTrack()&&this.mute(),t._innerRemoveMapping(this.getTrackId(),this._resource),e.prototype.destroy.call(this)}}),Object.defineProperty(t,"_mapping",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),t}(qi),Qi=function(e){function t(t,r,n,i,o,a){return e.call(this,t,r,n,i,"video",o,a)||this}return y(t,e),t}(zi),Yi=function(e){function t(t,r,n,i,o,a){return e.call(this,t,r,n,i,"audio",o,a)||this}return y(t,e),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return C(this,void 0,void 0,(function(){return I(this,(function(r){return this._resource&&(this._resource.muted=t),[2,e.prototype._setLocalMuted.call(this,t)]}))}))}}),Object.defineProperty(t.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return I(this,(function(e){switch(e.label){case 0:return[4,this._setLocalMuted(!1)];case 1:return e.sent(),[2,Promise.resolve({code:ze.SUCCESS})]}}))}))}}),t}(zi),Zi=function(e){function t(t,r,n,i,o,a){var s=e.call(this,t,r,n,i,o,a)||this;return Object.defineProperty(s,"_originTrack",{enumerable:!0,configurable:!0,writable:!0,value:null}),s}return y(t,e),Object.defineProperty(t.prototype,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t,r;return I(this,(function(n){switch(n.label){case 0:return this._logger.info(T.A_APPLY_3A_NOISE_WORKLET_T),this._originTrack?(this._logger.warn(T.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:E.FAILED,msg:"3A noise module already applied"})),[2,{code:ze.SUCCESS}]):!this._msTrack||this.isDestroyed()?(this._logger.warn(T.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:E.FAILED,msg:"track not ready"})),[2,{code:ze.TRACK_NOT_READY}]):this.isPublished()?(this._logger.warn(T.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:E.FAILED,msg:"track already published"})),[2,{code:ze.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH}]):[4,Gi.apply3ANoiseWorklet(this._msTrack)];case 1:return e=n.sent(),t=e.code,r=e.track,t===ze.SUCCESS&&r?(this._originTrack=this._msTrack,this._msTrack=r,this._logger.info(T.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:E.SUCCEEDED})),[2,{code:ze.SUCCESS}]):(this._logger.warn(T.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:E.FAILED,msg:"apply 3A noise module failed: ".concat(t)})),[2,{code:t}])}}))}))}}),Object.defineProperty(t.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(t){!t&&this._originTrack&&(Gi.release3ANoiseWorklet(this._originTrack),this._originTrack.stop(),this._originTrack=null),e.prototype.__innerSetMediaStreamTrack.call(this,t)}}),t}(Ki),Xi=function(e){function t(t,r,n,i,o,a){return e.call(this,t,r,n,i,o,!1,a)||this}return y(t,e),t}(Wi),$i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return y(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(qi.__INNER_EVENT_DESTROY__,this)}}),t}(Wi),eo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return y(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(qi.__INNER_EVENT_DESTROY__,this)}}),t}(Ki);!function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.CROSS_LIVE=8]="CROSS_LIVE",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL",e[e.MEETING=6]="MEETING",e[e.NEW_MEETING=9]="NEW_MEETING",e[e.GROUP_CALL=10]="GROUP_CALL"}(Ji||(Ji={}));var to=function(e){var t,r=null===(t=$e.getMemo().crtRoom)||void 0===t?void 0:t.getCrtUserId();return JSON.stringify(e.map((function(e){return O(O({},e),{msid:uo(r,co(e.nmsid||e.msid).tag),nmsid:e.nmsid||e.msid,meid:co(e.nmsid||e.msid).identifier})})))},ro=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},no=function(e){if(void 0===e)return 0;if(o(e))return e;var t=e;return t.exact||t.ideal||t.max||0},io=function(e){var t=e.getSettings(),r=e.getConstraints();return{width:no(r.width)||t.width||0,height:no(r.height)||t.height||0,frameRate:t.frameRate||no(r.frameRate)}},oo=function(e){var t=io(e),r=t.width,n=t.height,i=t.frameRate,o=function(e,t){e=Ye(e),t=Ye(t);var r=Qe["W".concat(e,"_H").concat(t)];if(r)return r;var n=e*t;return Object.keys(Qe).map((function(e){return Qe[e]})).sort((function(e,t){return e.height*e.width-t.width*t.height})).filter((function(e){return e.height*e.width>=n}))[0]||Qe.W1920_H1080}(r||1920,n||1080),a=function(e){var t=Number.MAX_VALUE,r=1;for(var n in Ze){var i=Math.abs(e-parseInt(n));i<t&&(t=i,r=Ze[n])}return r}(i);return{min:o.minBitrate*a,max:o.maxBitrate*a}},ao=function(e){return[e.nmsid||e.msid,e.mediaType].join("_")},so=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),identifier:t.join("_")}},co=function(e){var t=e.split("_");return{tag:t.pop(),identifier:t.join("_")}},uo=function(e,t){return void 0===t&&(t=nu.DEFAULT),[e,t].join("_")},lo=function(e,t,r){return void 0===t&&(t=nu.DEFAULT),"".concat(e,"_").concat(t,"_").concat(r)},_o=function(e){return e.map((function(e){return O({},e)}))},po=function(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!1),e=e.slice();var i=[],o=[],a=[],s=[],c=$e.getMemo();return t.forEach((function(t){var o,u,l=ao(t),d=e.findIndex((function(e){return ao(e)===l}));if(r&&(d=e.findIndex((function(e){return e.uri===t.uri}))),-1===d){var _=JSON.parse(t.uri),p=_.ssrc,f=_.resourceId,b=_.meid,m=_.mediaType,h=_.tag,g=_.userId;f||(f=lo(b||g,h,m));var v=null===(u=c.prePubUserBySSRC)||void 0===u?void 0:u[p];return v&&(c.replacePreTrackIdMap=O(O({},c.replacePreTrackIdMap),((o={})[f]=lo(v.meid,void 0,t.mediaType),o))),void i.push(t)}var R=e[d];void 0!==(null==R?void 0:R.state)&&R.state!==t.state?a.push(t):void 0!==(null==R?void 0:R.code)&&R.code!==t.code?s.push(t):(R.uri!==t.uri||n)&&i.push(t),e.splice(d,1)})),o.push.apply(o,A([],P(e),!1)),{publishedList:i,unpublishedList:o,modifiedList:a,deviceChangedList:s}},fo=function(){return"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)}))},bo=function(e){var t,r=window.localStorage.getItem("__meid_".concat(e,"__"));return r||(t=fo(),(t="".concat(t.replace(/-/g,""))).length>32&&(t=t.slice(0,32)),mo(r=t,e)),r},mo=function(e,t){return window.localStorage.setItem("__meid_".concat(t,"__"),e),!0},ho=function(e){if(Qe[e]){var t=Qe[e];return{width:t.width,height:t.height}}var r=P(e.split("_").map((function(e){return parseInt(e.replace(/[^\d]/g,""))})),2);return{width:r[0],height:r[1]}},go=function(e){return!!Ke[e]},vo=function(e){return parseInt(e.replace("FPS_",""))},Ro=function(){var e=Ge.browserDetails;return{browser:e.browser,version:e.version,supportsUnifiedPlan:!1!==e.supportsUnifiedPlan}}();function So(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function yo(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var To,Eo=function(e){return"[object Null]"===Object.prototype.toString.call(e)},Oo=function(e,t,r,n){var i={},o=Object.keys(e.users);return o.length&&o.forEach((function(o){var a=[],s=e.users[o];if(s.extra){var c=JSON.parse(s.extra).roomId;if(t!==c)return}if(s.uris)try{a.push.apply(a,A([],P(JSON.parse(s.uris)),!1))}catch(e){r.warn(T.L_PARSE_ROOMDATA_URIS_R,"invalid user data -> userId: ".concat(o,", userData: ").concat(s),n)}i[o]=a})),i},Co=function(e,t){for(var r=!1,n=0,i=0;i<t.length;i++){var o=t[i];if("".concat(e.nmsid||e.msid,"_").concat(e.mediaType)==="".concat(o.nmsid||o.msid,"_").concat(o.mediaType)){r=!0,n=i;break}}return{isInclude:r,index:n}},Io=function(e){return e instanceof xi?e.getTrackId():e.track.getTrackId()},Lo=function(e){if(!c(e)||void 0===e.low||void 0===e.high)return e;var t=e.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(t.length,"}$")),t),16)},Po=function(){var e=navigator.userAgent.toLowerCase(),t=/macintosh|mac os x/i.test(navigator.userAgent);return e.indexOf("win32")>=0||e.indexOf("wow32")>=0||e.indexOf("win64")>=0||e.indexOf("wow64")>=0?"windows":t?"MacOS":"unknown"},Ao=function(e){var t={};if(null==e)return t;if("string"!=typeof e)return e;try{t=JSON.parse(e)}catch(e){return t}return t};!function(e){e.PNG="png",e.JPG="jpg",e.GIF="gif",e.ICO="ico",e.BMP="bmp",e.WEBP="webp",e.SVG="svg"}(To||(To={})),To.PNG,To.JPG,To.GIF,To.ICO,To.BMP,To.WEBP,To.SVG;var wo,ko,Do=function(e){var t=Ji.GROUP_CALL;switch(e){case Ji.CALL:t=Ji.CALL;break;case Ji.MEETING:t=Ji.NEW_MEETING;break;case Ji.GROUP_CALL:t=Ji.GROUP_CALL}return t},No=function(e){return window.sessionStorage.setItem("__rtc_config__",e)},Mo=function(){return"function"==typeof RTCRtpSender.prototype.createEncodedStreams&&"function"==typeof RTCRtpReceiver.prototype.createEncodedStreams};!function(e){e.PUBLISH="RCRTC:PublishResource",e.UNPUBLISH="RCRTC:UnpublishResource",e.MODIFY="RCRTC:ModifyResource",e.TOTAL_CONTENT_RESOURCE="RCRTC:TotalContentResources",e.STATE="RCRTC:state",e.ROOM_NOTIFY="RCRTC:RoomNtf",e.USER_NOTIFY="RCRTC:UserNtf",e.KICK="RCRTC:kick",e.PK_INVITE="RCRTC:invite",e.PK_INVITE_TIMEOUT="RCRTC:inviteTimeout",e.PK_CANCEL_INVITE="RCRTC:cancelInvite",e.PK_INVITE_ANSWER="RCRTC:answerInvite",e.PK_END="RCRTC:endInvite",e.OTHER_ROOM_OFFLINE="RCRTC:otherRoomOffline",e.ROOM_TASK_FINISH="RCRTC:roomTaskFinish"}(wo||(wo={})),function(e){e.SUCCESS="Success",e.FAIL="Fail"}(ko||(ko={}));var Uo,jo=function(){function e(e,t,r,n){void 0===n&&(n=5e3),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomMode",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_gap",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_pingResultCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_version",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_kickOffByServer",{enumerable:!0,configurable:!0,writable:!0,value:!1})}return Object.defineProperty(e.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;this._started||(e<15e3&&(e=15e3),null===(r=null===(t=this._context)||void 0===t?void 0:t.logger)||void 0===r||r.info(T.L_PINGER_START_O,JSON.stringify({interval:this._gap,offlineKickTime:e})),this._started=!0,this._checkAlive(e))}}),Object.defineProperty(e.prototype,"_sendPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._context.rtcPing(t._roomId,t._roomMode).then((function(e){var n=e.code;n===u.SUCCESS&&(t._pingResultCount=0),40003===n&&(t._pingResultCount=Number.MAX_SAFE_INTEGER,t._kickOffByServer=!0),r(e)})).catch((function(n){var i,o;null===(o=null===(i=t._context)||void 0===i?void 0:i.logger)||void 0===o||o.error(T.L_PINGER_SEND_RTCPING_R,JSON.stringify({status:E.FAILED,msg:n}),e),r({code:u.RC_PING_EXCEED_LIMIT})})),setTimeout(r,3e4,{code:u.TIMEOUT})}))}}),Object.defineProperty(e.prototype,"_checkAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n;return C(this,void 0,void 0,(function(){var i,o,a,s=this;return I(this,(function(c){return i=this._context.logger,o=i.createTraceId(),this._pingResultCount++,this._sendPing(o).then((function(e){var t=e.data;t&&(s._version=t.version)})),this._pingResultCount<e/this._gap&&!this._kickOffByServer?(null===(t=this.onPingResult)||void 0===t||t.call(this,ko.SUCCESS,this._version),this._timer=setTimeout((function(){return s._checkAlive(e)}),this._gap),[2]):(i.warn(T.L_PINGER_SEND_RTCPING_E,JSON.stringify({roomId:this._roomId,status:E.FAILED}),o),this._started&&(null===(r=this.onPingResult)||void 0===r||r.call(this,ko.FAIL)),this.stop(),a=this._kickOffByServer?"":"ping timeout",null===(n=this.onFailed)||void 0===n||n.call(this,this._kickOffByServer,void 0,a),[2])}))}))}}),Object.defineProperty(e.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;this._started&&(null===(t=null===(e=this._context)||void 0===e?void 0:e.logger)||void 0===t||t.info(T.L_PINGER_STOP_O),this._started=!1,this._timer&&(clearTimeout(this._timer),this._timer=null))}}),e}();!function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}(Uo||(Uo={}));var Bo,xo=function(e,t){return Math.round(8*t/e)},Fo=function(e,t){void 0===t&&(t=2);var r=Math.pow(10,t);return Math.min(Math.round(e*r)/r,1)},Vo=function(e,t){void 0===t&&(t=2),e>1&&(e=1);var r=Math.pow(10,t);return Math.round(e*r)},Jo=function(e,t,r,n){if(0===t||e<0||t<0)return 0;if(!r||!n)return Fo(e/t,3);var i=t-n;if(0===i)return 1;var o=e-r;return o<0||i<0?0:Fo(o/i,3)},Ho=function(e){var t=e.jitter,r=e.rtt,n=e.packetsLostRate;return!Eo(t)||!Eo(r)||0!==n},Go=function(e){var t=0;if("number"==typeof e){var r=e>1?1:e;t=32767*r<32?0:20*Math.log10(32767*r)}return Math.floor(t)};!function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_VIDEO=2]="AUDIO_VIDEO"}(Bo||(Bo={}));var qo,Ko=function(){function e(){}return Object.defineProperty(e,"getInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._instance||(this._instance=new Map([["sourceIdForPublishMap",new Map],["sourceIdForSubscribeMap",new Map]])),this._instance}}),Object.defineProperty(e,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._instance=new Map([["sourceIdForPublishMap",new Map],["sourceIdForSubscribeMap",new Map]])}}),Object.defineProperty(e,"_instance",{enumerable:!0,configurable:!0,writable:!0,value:new Map([["sourceIdForPublishMap",new Map],["sourceIdForSubscribeMap",new Map]])}),e}();!function(e){e.TRACK="track",e.STREAM="stream",e.MEDIASOURCE="media-source",e.INBOUNDRTP="inbound-rtp",e.OUTBOUNDRTP="outbound-rtp",e.REMOTEINBOUNDRTP="remote-inbound-rtp",e.PEERCONNECTION="peer-connection",e.TRANSPORT="transport",e.CERTIFICATE="certificate",e.CANDIDATEPAIR="candidate-pair",e.REMOTECANDIDATE="remote-candidate",e.LOCALCANDIDATE="local-candidate"}(qo||(qo={}));var Wo,zo=function(){function e(e,t,r,n,i,o){Object.defineProperty(this,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_sdpSemantics",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_latestPacketsSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestPacketsRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._sdpStrategy.getTrackIdByMid(e)}}),Object.defineProperty(e.prototype,"updateBytesSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];n=t-o.bytesSent,i=r-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:r}}else n=t,i=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:r};return xo(i,n)}}),Object.defineProperty(e.prototype,"updateBytesRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];n=t-o.bytesRecv,i=r-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r}}else n=t,i=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r};return xo(i,n)}}),Object.defineProperty(e.prototype,"updateSenderPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i=$e.getMemo();if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var o=this._latestPacketsSent[e],a=o.packetsLost,s=o.packetsSent;i.sumPacketsSent+=r,i.sumPrePacketsSent+=s||0,i.sumPacketsSentLost+=t,i.sumPrePacketsSentLost+=a||0,n=Jo(t,r,a,s),this._latestPacketsSent[e]={packetsLost:t,packetsSent:(a||0)<t?r:s}}else n=Jo(t,r),this._latestPacketsSent[e]={packetsLost:t,packetsSent:r};return n}}),Object.defineProperty(e.prototype,"updateReceiverPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i=$e.getMemo();if(this._latestPacketsRecv[e]){var o=this._latestPacketsRecv[e],a=o.packetsLost,s=o.packetsRecv;i.sumPacketsRecv+=r,i.sumPrePacketsRecv+=s||0,i.sumPacketsRecvLost+=t,i.sumPrePacketsRecvLost+=a||0,n=Jo(t,r+t,a,s+a)}else n=Jo(t,r);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:r},n}}),Object.defineProperty(e.prototype,"clearLatestpacketsSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){if(parseInt(e.split("_").pop())===Bo.VIDEO_ONLY){var r="".concat(e,"_tiny");delete t._latestPacketsSent[r],delete t._latestBytesSent[r]}delete t._latestPacketsSent[e],delete t._latestBytesSent[e]}))}}),Object.defineProperty(e.prototype,"clearLatestPacketsRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){delete t._latestPacketsRecv[e],delete t._latestBytesRecv[e]}))}}),Object.defineProperty(e.prototype,"parseRTCStatsReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n={};try{for(var i=L(e.entries()),o=i.next();!o.done;o=i.next()){var a=P(o.value,2),s=a[0],c=a[1];n[s]=c}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}}),Object.defineProperty(e.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={senders:[],receivers:[]};return this._logger.info(T.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O,JSON.stringify({status:E.SUCCEEDED,stats:e,reports:t})),t}}),Object.defineProperty(e.prototype,"getAudioLevelList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[]}}),Object.defineProperty(e.prototype,"isValidTranceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i="outbound-rtp"===t?null===(r=this._rtcPeerConn.currentLocalDescription)||void 0===r?void 0:r.sdp:null===(n=this._rtcPeerConn.currentRemoteDescription)||void 0===n?void 0:n.sdp,o=e.ssrc;return!(null==i?void 0:i.split("\r\nm=").some((function(e){return e.includes(o)&&e.includes("a=inactive")})))}}),Object.defineProperty(e.prototype,"formatStateData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Object.values(e).reduce((function(e,t){return t.type===qo.REMOTEINBOUNDRTP?(e.remoteInbound.push(t),e):t.type===qo.INBOUNDRTP?(e.inbound.push(t),e):t.type===qo.OUTBOUNDRTP?(e.outbound.push(t),e):t.type===qo.TRANSPORT?(e.transport.push(t),e):t.type===qo.PEERCONNECTION?(e.connection.push(t),e):e}),{outbound:[],remoteInbound:[],inbound:[],transport:[],connection:[]})}}),Object.defineProperty(e,"formatSourceIdMapFromSdp",{enumerable:!0,configurable:!0,writable:!0,value:function(e,t){var r=Ko.getInstance(),n=null==e?void 0:e.match(/a=ssrc:(.*) msid:(.*?) /gi);if(n){if("publish"===t){var i=r.get("sourceIdForPublishMap");null==i||i.clear(),n.forEach((function(e){var t=P(e.split(" ").map((function(e){return e.split(":")[1]})),2),r=t[0],n=t[1];null==i||i.set(r,n)}))}if("subscribe"===t){var o=r.get("sourceIdForSubscribeMap");null==o||o.clear(),n.forEach((function(e){var t=P(e.split(" ").map((function(e){return e.split(":")[1]})),2),r=t[0],n=t[1];null==o||o.set(r,n)}))}}}}),e}(),Qo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return y(t,e),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=this.formatStateData(e),i=n.outbound,o=n.remoteInbound,a=n.inbound,s=n.transport,c=n.connection,u=$e.getMemo();u.sumPacketsSent=0,u.sumPrePacketsSent=0,u.sumPacketsSentLost=0,u.sumPrePacketsSentLost=0,u.sumPacketsRecv=0,u.sumPrePacketsRecv=0,u.sumPacketsRecvLost=0,u.sumPrePacketsRecvLost=0;var l={senders:[],receivers:[]},d=Math.floor(c[0].timestamp);l.timestamp=d;var _=0,p=0;_=(t=this.pickOutbound(i,e,_,d,p)).totalPacketsLost,p=t.bitrateSend,l.senders=t.senders,o.length>0&&l.senders.length>0&&this.pickRemoteInbound(o,l.senders,e);var f=0;if(_=(r=this.pickInbound(a,e,_,d,f)).totalPacketsLost,f=r.bitrateRecv,l.receivers=r.receivers,s.length>0){var b=s[0];this.pickRtcTransport(b,e,l,f,p,_)}return l}}),Object.defineProperty(t.prototype,"pickRtcTransport",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=e.selectedCandidatePairId;if(a){var s=t[a],c=s.availableOutgoingBitrate,u=s.availableIncomingBitrate,l=s.currentRoundTripTime,d=s.localCandidateId,_=s.remoteCandidateId,p=t[d],f=p.ip,b=p.port,m=p.networkType,h=t[_],g=h.ip,v=h.port,R=h.protocol;r.iceCandidatePair={IP:f,port:b,networkType:m,remoteIP:g,remotePort:v,protocol:R,bitrateRecv:n,bitrateSend:i,rtt:1e3*l,availableOutgoingBitrate:c,availableIncomingBitrate:u,totalPacketsLost:o},r.receivers.forEach((function(e){e.rtt=1e3*l}))}}}),Object.defineProperty(t.prototype,"pickRemoteInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;e.forEach((function(e){var i,o=e.localId,a=e.jitter,s=e.roundTripTime,c=e.packetsLost,u=t.filter((function(e){return e.id===o}))[0];if(u&&!Ho(u)){var l=null===(i=n._store)||void 0===i?void 0:i.getTrackIdBySSRC(r[u.id].ssrc);u.jitter=Math.round(1e3*a),u.rtt=s;var d=n._latestPacketsSent[l].crtPacketsSent;u.packetsLostRate=n.updateSenderPacketsLost(l,c,d)}}))}}),Object.defineProperty(t.prototype,"_getOutboundVideoAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o,a,s,c=e.framesPerSecond,u=e.frameWidth,l=e.frameHeight;return"video"!==r||u||l||c||(u=(null===(o=t[n])||void 0===o?void 0:o.frameWidth)||t[i].width,l=(null===(a=t[n])||void 0===a?void 0:a.frameHeight)||t[i].height,c=(null===(s=t[i])||void 0===s?void 0:s.framesPerSecond)||null),{frameRate:c,frameWidth:u,frameHeight:l}}}),Object.defineProperty(t.prototype,"pickOutbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this,a=[];return e.forEach((function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"outbound-rtp")){var c=e.id,u=e.kind,l=e.mediaSourceId,d=e.remoteId,_=e.packetsSent,p=e.bytesSent,f=e.encoderImplementation,b=e.pliCount,m=e.nackCount,h=e.mid,g=e.ssrc,v=e.framesEncoded,R=e.qpSum,S=e.googActualEncBitrate,y=e.rongFecBitrate,T=e.googTargetEncBitrate,E=e.googRetransmitBitrate,O=e.trackId;if(void 0!==h&&(O=o.getTrackIdByMid(h)),O){var C=o._getOutboundVideoAttrs(e,t,u,O,l),I=C.frameRate,L=C.frameWidth,P=C.frameHeight,A=t[d],w=null,k=null,D=0;A&&(w=A.jitter,k=A.roundTripTime,D=A.packetsLost),r+=D;var N=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc);if(N){var M=l?t[l].audioLevel:t[O].audioLevel,U=0;!o._latestPacketsSent[N]&&(o._latestPacketsSent[N]={}),A?U=o.updateSenderPacketsLost(N,D,_):o._latestPacketsSent[N].crtPacketsSent=_;var j=o.updateBytesSent(N,p,n);j<0&&(j=0),i+=j,a.push({id:c,trackId:N,kind:u,packetsLostRate:U,remoteResource:!1,audioLevel:M||0===M?Vo(M):null,audioDB:Go(M),frameWidth:L,frameHeight:P,frameRate:I,bitrate:j,jitter:w?Math.round(1e3*w):w,rtt:k?Math.round(1e3*k):k,encoderImplementation:f,pliCount:b,nackCount:m,googFirsSent:pi,samplingRate:pi,googRenderDelayMs:pi,trackState:pi,ssrc:String(g),framesEncoded:v,bytesSent:p,packetsLost:D,qpSum:R,googActualEncBitrate:S,rongFecBitrate:y,googTargetEncBitrate:T,googRetransmitBitrate:E})}}}})),{totalPacketsLost:r,bitrateSend:i,senders:a}}}),Object.defineProperty(t.prototype,"_getInboundMediaAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o,a,s,c=e.frameWidth,u=e.frameHeight,l=e.audioLevel;return"video"===i?c||u||(c=(null===(o=t[r])||void 0===o?void 0:o.frameWidth)||t[n].width,u=(null===(a=t[r])||void 0===a?void 0:a.frameHeight)||t[n].height):l||(l=(null===(s=t[r])||void 0===s?void 0:s.audioLevel)||t[n].audioLevel),{frameWidth:c,frameHeight:u,audioLevel:l}}}),Object.defineProperty(t.prototype,"pickInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this,a=[];return e.forEach((function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"inbound-rtp")){var c=e.packetsLost,u=e.packetsReceived,l=e.jitter,d=e.bytesReceived,_=e.framesPerSecond,p=e.kind,f=e.codecImplementationName,b=e.nackCount,m=e.pliCount,h=e.mid,g=e.id,v=e.ssrc,R=e.freezeCount,S=e.totalFreezesDuration,y=e.totalPausesDuration,T=e.pauseCount,E=e.qosFrozenCnt,O=e.qosFrozenDur,C=e.qosCDur,I=e.qosWithPLCFrozenCnt,L=e.qosWithPLCFrozenDur,P=e.trackId;if(void 0!==h&&(P=o.getTrackIdByMid(h)),P){var A=o._getInboundMediaAttrs(e,t,P,g,p),w=A.frameWidth,k=A.frameHeight,D=A.audioLevel;r+=c;var N=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc),M=o.updateReceiverPacketsLost(N,c,u),U=o.updateBytesRecv(N,d,n);U<0&&(U=0),i+=U,a.push({trackId:N,kind:p,packetsLostRate:M,remoteResource:!0,audioLevel:D||0===D?Vo(D):null,audioDB:Go(D),frameWidth:w,frameHeight:k,frameRate:_,bitrate:U,jitter:l?Math.round(1e3*l):0,codecImplementationName:f,nackCount:b,pliCount:m,rtt:null,samplingRate:pi,googFirsReceived:pi,googRenderDelayMs:pi,trackState:pi,ssrc:String(v),freezeCount:R,totalFreezesDuration:S,totalPausesDuration:y,pauseCount:T,bytesReceived:d,packetsLost:c,packetsReceived:u,qosFrozenCnt:E,qosFrozenDur:O,qosCDur:C,qosWithPLCFrozenCnt:I,qosWithPLCFrozenDur:L})}}})),{totalPacketsLost:r,bitrateRecv:i,receivers:a}}}),Object.defineProperty(t.prototype,"getAudioLevelList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=[],n=this.formatStateData(e),i=n.outbound,o=n.inbound;return i.filter((function(e){return"audio"===(null==e?void 0:e.kind)})).forEach((function(n){var i,o;if("unified-plan"!==t._sdpSemantics||t.isValidTranceiver(n,"outbound-rtp")){var a=n.mediaSourceId,s=n.trackId;n.kind;var c=null===(i=t._store)||void 0===i?void 0:i.getTrackIdBySSRC(n.ssrc),u=a&&e[a]?e[a].audioLevel:(null===(o=e[s])||void 0===o?void 0:o.audioLevel)||null;c&&r.push({trackId:c,audioLevel:u||0===u?Vo(u):null})}})),o.filter((function(e){return"audio"===(null==e?void 0:e.kind)})).forEach((function(n){var i;if("unified-plan"!==t._sdpSemantics||t.isValidTranceiver(n,"inbound-rtp")){var o=n.trackId,a=n.audioLevel||e[o].audioLevel,s=null===(i=t._store)||void 0===i?void 0:i.getTrackIdBySSRC(n.ssrc);s&&r.push({trackId:s,audioLevel:a||0===a?Vo(a):null})}})),r}}),t}(zo),Yo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return y(t,e),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,r)){var i=e.kind,o=e.bytesSent,a=e.packetsSent,s=e.bitrateMean,c=e.framerateMean,u=e.nackCount,l=e.pliCount,d=e.remoteId,_=d?t[d]:{jitter:null,roundTripTime:null,packetsLost:0},p=_.jitter,f=_.roundTripTime,b=_.packetsLost,m=null===(n=this._store)||void 0===n?void 0:n.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=b;var h=0;!this._latestPacketsSent[m]&&(this._latestPacketsSent[m]={}),d?h=this.updateSenderPacketsLost(m,b,a):this._latestPacketsSent[m].crtPacketsSent=a;var g=0;"video"===i?s&&(g=Math.floor(s/1e3)):g=this.updateBytesSent(m,o,this._reportsData.timestamp),g<0&&(g=0),this._bitrateSend+=g,this._reportsData.senders.push({trackId:m,kind:i,packetsLostRate:h,remoteResource:!1,audioLevel:null,audioDB:0,frameWidth:null,frameHeight:null,frameRate:Math.floor(c),bitrate:g,jitter:p?Math.round(1e3*p):null,rtt:f,encoderImplementation:null,pliCount:l,nackCount:u,googFirsSent:pi,samplingRate:pi,googRenderDelayMs:pi,trackState:pi,qpSum:pi})}}}),Object.defineProperty(t.prototype,"_addSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=t.localId,i=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e[n].ssrc),o=this._reportsData.senders.filter((function(e){return e.trackId===i}))[0];o&&Ho(o)&&(o.jitter=Math.round(1e3*t.jitter),o.rtt=t.rtt,o.packetsLostRate=this.updateSenderPacketsLost(i,t.packetsLost,this._latestPacketsSent[i].crtPacketsSent))}}),Object.defineProperty(t.prototype,"_pickReceiverData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,t)){var n=e.packetsLost,i=e.bytesReceived,o=e.packetsReceived,a=e.jitter,s=e.framerateMean,c=e.kind,u=e.bitrateMean,l=e.nackCount,d=e.pliCount,_=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=n;var p=this.updateReceiverPacketsLost(_,n,o),f=0;"video"===c?u&&(f=Math.floor(u/1e3)):f=this.updateBytesRecv(_,i,this._reportsData.timestamp),f<0&&(f=0),this._bitrateRecv+=f,this._reportsData.receivers.push({trackId:_,kind:c,packetsLostRate:p,remoteResource:!0,audioLevel:null,audioDB:0,frameWidth:null,frameHeight:null,frameRate:Math.floor(s),bitrate:f,jitter:a?Math.round(1e3*a):null,codecImplementationName:null,nackCount:l,pliCount:d,rtt:null,samplingRate:pi,googFirsReceived:pi,googRenderDelayMs:pi,trackState:pi,packetsLost:n,packetsReceived:o})}}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e[t.localCandidateId],n=r.address,i=r.port,o=e[t.remoteCandidateId],a=o.address,s=o.port,c=o.protocol;this._reportsData.iceCandidatePair={IP:n,port:i,networkType:null,remoteIP:a,remotePort:s,protocol:c,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:this._totalPacketsLost}}}),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=+new Date;for(var r in this._reportsData={senders:[],receivers:[],timestamp:t},this._totalPacketsLost=0,this._bitrateRecv=0,this._bitrateSend=0,e){var n=e[r],i=n.type;"outbound-rtp"===i&&this._pickSenderData(n,e,i),"remote-inbound-rtp"===i&&this._addSenderData(e,n),"inbound-rtp"===i&&this._pickReceiverData(n,i),"candidate-pair"===i&&"succeeded"===n.state&&this._pickIceCandidatePair(e,n)}return this._reportsData}}),t}(zo),Zo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return y(t,e),Object.defineProperty(t.prototype,"_pickReceiverData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var t;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"inbound-rtp")){var n=e.packetsLost,i=e.packetsReceived,o=e.jitter,a=e.bytesReceived,s=e.mediaType,c=e.nackCount,u=e.pliCount,l=e.audioLevel,d=e.frameHeight,_=e.frameWidth,p=null===(t=r._store)||void 0===t?void 0:t.getTrackIdBySSRC(e.ssrc);if(p){r._totalPacketsLost+=n;var f=r.updateReceiverPacketsLost(p,n,i),b=r.updateBytesRecv(p,a,r._reportsData.timestamp);b<0&&(b=0),r._bitrateRecv+=b,r._reportsData.receivers.push({trackId:p,kind:s,packetsLostRate:f,remoteResource:!0,audioLevel:l||0===l?Vo(l):null,audioDB:Go(l),frameWidth:_,frameHeight:d,frameRate:null,bitrate:b,jitter:o?Math.round(1e3*o):o,codecImplementationName:null,nackCount:c,pliCount:u,rtt:null,samplingRate:pi,googFirsReceived:pi,googRenderDelayMs:pi,trackState:pi,packetsLost:n,packetsReceived:i})}}}))}}),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var n;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"outbound-rtp")){var i=null===(n=r._store)||void 0===n?void 0:n.getTrackIdBySSRC(e.ssrc),o=e.kind,a=e.bytesSent,s=e.pliCount,c=e.nackCount,u=e.audioLevel,l=e.frameHeight,d=e.frameWidth,_=e.codecId,p=e.remoteId,f=e.packetsSent;if(i){var b=t[p],m=null,h=null,g=0;b&&(m=b.jitter,h=b.roundTripTime,g=b.packetsLost),r._totalPacketsLost+=g;var v=0;!r._latestPacketsSent[i]&&(r._latestPacketsSent[i]={}),b?v=r.updateSenderPacketsLost(i,g,f):r._latestPacketsSent[i].crtPacketsSent=f;var R=r.updateBytesSent(i,a,r._reportsData.timestamp);R<0&&(R=0),r._bitrateSend+=R,r._reportsData.senders.push({trackId:i,kind:o,packetsLostRate:v,remoteResource:!1,audioLevel:u||0===u?Vo(u):null,audioDB:Go(u),frameWidth:d,frameHeight:l,frameRate:null,bitrate:R,jitter:m?Math.round(1e3*m):m,rtt:h?Math.round(1e3*h):h,encoderImplementation:t[_].mimeType,pliCount:s,nackCount:c,googFirsSent:pi,samplingRate:pi,googRenderDelayMs:pi,trackState:pi,qpSum:pi})}}}))}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.selectedCandidatePairId;if(r){var n=t[r],i=n.availableOutgoingBitrate,o=n.availableIncomingBitrate,a=n.currentRoundTripTime,s=n.localCandidateId,c=n.remoteCandidateId,u=t[s],l=u.address,d=u.port,_=t[c],p=_.address,f=_.port,b=_.protocol;this._reportsData.iceCandidatePair={IP:l||null,port:d,networkType:null,remoteIP:p,remotePort:f,protocol:b,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:1e3*a,availableOutgoingBitrate:i,availableIncomingBitrate:o,totalPacketsLost:this._totalPacketsLost},this._reportsData.receivers.forEach((function(e){e.rtt=a}))}}}),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.formatStateData(e),r=t.outbound,n=t.inbound,i=t.transport;t.connection,this._reportsData={senders:[],receivers:[]};var o=Math.floor(e.RTCPeerConnection.timestamp);if(this._reportsData.timestamp=o,this._totalPacketsLost=0,this._bitrateSend=0,this._bitrateRecv=0,this._pickSenderData(r,e),this._pickReceiverData(n,e),i.length>0){var a=i[0];this._pickIceCandidatePair(a,e)}return this._reportsData}}),Object.defineProperty(t.prototype,"getAudioLevelList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=[],n=Object.keys(e);return n.filter((function(e){return/^RTCOutboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(n){var i,o=e[n];if("unified-plan"!==t._sdpSemantics||t.isValidTranceiver(o,"outbound-rtp")){var a=o.trackId;if("video"!==o.mediaType){var s=null===(i=t._store)||void 0===i?void 0:i.getTrackIdBySSRC(o.ssrc),c=e[a];r.push({trackId:s,audioLevel:c||0===c?Vo(c):null})}}})),n.filter((function(e){return/^RTCInboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(n){var i,a,s,c,u=e[n];if("unified-plan"!==t._sdpSemantics||t.isValidTranceiver(u,"inbound-rtp")){var l=u.trackId,d=u.mediaType;if(l&&"video"!==d){var _=e[l].audioLevel;if(o(_)){var p=$e.getMemo();p.senderAudioLevel={min:Math.min(_,(null===(i=null==p?void 0:p.senderAudioLevel)||void 0===i?void 0:i.min)||0),max:Math.max(_,(null===(a=null==p?void 0:p.senderAudioLevel)||void 0===a?void 0:a.max)||0),count:(((null===(s=null==p?void 0:p.senderAudioLevel)||void 0===s?void 0:s.count)||0)+1)%10},0===p.senderAudioLevel.count&&(bi.info(T.L_AUDIO_LEVEL_O,JSON.stringify({audioLevel:{min:p.senderAudioLevel.min,max:p.senderAudioLevel.max}})),p.senderAudioLevel={min:0,max:0,count:0})}var f=null===(c=t._store)||void 0===c?void 0:c.getTrackIdBySSRC(u.ssrc);r.push({trackId:f,audioLevel:_||0===_?Vo(_):null})}}})),r}}),t}(zo),Xo=function(){function e(e,t,r){Object.defineProperty(this,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"SDPHeader",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"videoStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"audioStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]});var n=this.getStreamIndex();this.spliteStreams(n)}return Object.defineProperty(e.prototype,"videoSdps",{get:function(){return this.videoStreams.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioSdps",{get:function(){return this.audioStreams.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"trimBlankLine",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.replace(/\n\r\s*\r\n/g,"\r\n").replace(/\s+\r\n/g,"\r\n")}}),Object.defineProperty(e.prototype,"getStreamIndex",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=new RegExp("m=(?:video|audio)","img"),t=new Set([0]),r=e.exec(this.SDP);null!==r;)t.add(null==r?void 0:r.index),r=e.exec(this.SDP);return t.add(this.SDP.length),A([],P(t),!1)}}),Object.defineProperty(e.prototype,"spliteStreams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.SDPHeader=this.SDP.substring(e[0],e[1]).replace(/\r\ns=-/g,"\r\ns=".concat((new Date).valueOf()));for(var t=1;t<e.length;t++){var r=this.SDP.substring(e[t],e[t+1]);/^\bm=video\b/.test(r)?this.videoStreams.push(r):this.audioStreams.push(r)}}}),Object.defineProperty(e,"clearInactiveOrRecvonly",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return/\ba=(recvonly|inactive)\b/.test(e)?e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,""):e}}),Object.defineProperty(e.prototype,"setHeaderBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.SDPHeader=this.SDPHeader.replace(/(\r\ns=[^\r\n]+)/gi,"$1\r\nc=IN IP4 0.0.0.0\r\nb=AS:".concat(t*e.KBitrate,"\r\nb=TIAS:").concat(t*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"setAudiosBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.audioStreams=this.audioStreams.map((function(r){return t.setAudioItemBitrate(r,e)})),this}}),Object.defineProperty(e.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(n){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(n)?r.setAudioItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setAudioBitrateWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(n){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(n)?r.setAudioItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setAudioItemBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bmaxaveragebitrate\b/gi.test(t)){var n=["$1","maxaveragebitrate=".concat(r.max*e.Bitrate)];t=t.replace(/(\buseinbandfec=[^\r\n]+)/gi,n.join(";"))}return t}}),Object.defineProperty(e.prototype,"addAudioBlineAS",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(r.max*e.KBitrate,"\r\nb=TIAS:").concat(r.max*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"setVideosBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.videoStreams=this.videoStreams.map((function(r){return t.setVideoItemBitrate(r,e)})),this}}),Object.defineProperty(e.prototype,"setVideoBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map((function(n){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(n)?r.setVideoItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setVideoBitrateWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map((function(n){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(n)?r.setVideoItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setVideoItemBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bx-google-max-bitrate\b/.test(t)){var n=["$1","x-google-max-bitrate=".concat(r.max*e.KBitrate),"x-google-min-bitrate=".concat(r.min*e.KBitrate),"x-google-start-bitrate=".concat(r.start||r.max*e.KBitrate*.7)];t=t.replace(/(\bprofile-level-id=42[e0]01f\b)/gi,n.join(";"))}return t}}),Object.defineProperty(e.prototype,"addVideoBlineAS",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(r.max*e.KBitrate,"\r\nb=TIAS:").concat(r.max*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"clearnSsrcWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(n){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(n)?r.clearSSRC(n,t):n})),this.videoStreams=this.videoStreams.map((function(n){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(n)?r.clearSSRC(n,t):n})),this}}),Object.defineProperty(e.prototype,"clearSSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(t===ta.SENDONLY&&/\ba=sendonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===ta.RECVONLY&&/\ba=recvonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===ta.INACTIVE&&/\ba=inactive\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");return e}}),Object.defineProperty(e,"Bitrate",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),Object.defineProperty(e,"KBitrate",{enumerable:!0,configurable:!0,writable:!0,value:1}),e}(),$o=function(){function e(){}return Object.defineProperty(e,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._audioEncoder=e.encodeAudio,this._audioDecoder=e.decodeAudio,this._videoEncoder=e.encodeVideo,this._videoDecoder=e.decodeVideo,this._logger=t}}),Object.defineProperty(e,"isInit",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!(this._audioEncoder&&this._audioDecoder&&this._videoEncoder&&this._videoDecoder)}}),Object.defineProperty(e,"decodeAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._audioDecoder(e)}catch(t){return this._logger.error(T.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"encodeAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._audioEncoder(e)}catch(t){return this._logger.error(T.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"decodeVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._videoDecoder(e)}catch(t){return this._logger.error(T.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"encodeVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._videoEncoder(e)}catch(t){return this._logger.error(T.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}),e}();!function(e){e[e.NB=0]="NB",e[e.MB=1]="MB",e[e.WB=2]="WB",e[e.SWB=3]="SWB",e[e.FB=4]="FB"}(Wo||(Wo={})),Wo.NB,Wo.NB,Wo.NB,Wo.NB,Wo.MB,Wo.MB,Wo.MB,Wo.MB,Wo.WB,Wo.WB,Wo.WB,Wo.WB,Wo.SWB,Wo.SWB,Wo.FB,Wo.FB,Wo.NB,Wo.NB,Wo.NB,Wo.NB,Wo.WB,Wo.WB,Wo.WB,Wo.WB,Wo.SWB,Wo.SWB,Wo.SWB,Wo.SWB,Wo.FB,Wo.FB,Wo.FB,Wo.FB;var ea,ta,ra=function(){function e(){}return Object.defineProperty(e,"splitSections",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.split("\nm=").map((function(e,t){return"".concat((t>0?"m=".concat(e):e).trim(),"\r\n")}))}}),Object.defineProperty(e,"getMediaSections",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.splitSections(t);return r.shift(),r}}),Object.defineProperty(e,"parseExtmap",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}}}),Object.defineProperty(e,"splitLines",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.trim().split("\n").map((function(e){return e.trim()}))}}),Object.defineProperty(e,"parseMLine",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.splitLines(t)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}}}),Object.defineProperty(e,"matchPrefix",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.splitLines(t).filter((function(e){return 0===e.indexOf(r)}))}}),Object.defineProperty(e,"parseMsid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,n=e.matchPrefix(t,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=e.matchPrefix(t,"a=ssrc:").map((function(t){return e.parseSsrcMedia(t)})).filter((function(e){return"msid"===e.attribute}));return i.length>0&&i[0].value?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:{stream:"",track:""}}}),Object.defineProperty(e,"parseSsrcMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r}}),Object.defineProperty(e,"getMid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.matchPrefix(t,"a=mid:")[0];if(r)return r.substr(6)}}),Object.defineProperty(e,"splitNaluData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Uint8Array(e),r=0;if(this.isIFrame(t)){var n=t.join(","),i=n.indexOf("0,0,0,1,101");-1===i&&(i=n.indexOf("0,0,0,1,37")),r=n.substring(0,i).split(",").length-1+4+8}else r=12;return{header:t.slice(0,r),payloadData:t.slice(r)}}}),Object.defineProperty(e,"deal0x03",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=[];return r="encode"===t?e.join(",").replaceAll(",0,0,1,",",0,0,3,1,").split(",").map((function(e){return Number(e)})):e.join(",").replaceAll(",0,0,3,1,",",0,0,1,").split(",").map((function(e){return Number(e)})),new Uint8Array(r)}}),Object.defineProperty(e,"isIFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.join("").startsWith("0001103");return t||(t=e.join("").startsWith("000139")),t}}),e}();!function(e){e.PLANB="plan-b",e.UNIFIEDPLAN="unified-plan"}(ea||(ea={})),function(e){e.SENDONLY="sendonly",e.RECVONLY="recvonly",e.INACTIVE="inactive"}(ta||(ta={}));var na,ia=function(){function e(e,t,r){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_useEncrypt",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_outboundStreams",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e,"setSdpSemantics",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Ro.browser,n=Ro.version,i=Ro.supportsUnifiedPlan;if(t.info(T.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O,JSON.stringify({sdpSemantics:e,supportsUnifiedPlan:i,browser:r,version:n})),i)return/chrome/i.test(r)?n?void(this._sdpSemantics=n>92?"unified-plan":n<72?"plan-b":e):void(this._sdpSemantics="unified-plan"):void(/firefox/i.test(r)?this._sdpSemantics="unified-plan":/safari/i.test(r)?this._sdpSemantics=n<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan");this._sdpSemantics="plan-b"}}),Object.defineProperty(e,"getSdpSemantics",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e._sdpSemantics}}),Object.defineProperty(e.prototype,"getOutboundVideoInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._outboundStreams){var r=this._outboundStreams[t].getVideoTracks()[0];if(r){var n=/_tiny$/.test(t),i=io(r),o=i.width,a=i.height;e.push({trackId:r.id,simulcast:n?Uo.TINY:Uo.NORMAL,resolution:"".concat(o,"x").concat(a)})}}return e}}),Object.defineProperty(e.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return C(this,void 0,void 0,(function(){var r;return I(this,(function(n){switch(n.label){case 0:e=Xo.trimBlankLine(e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._peer.setRemoteDescription({type:"answer",sdp:e})];case 2:return n.sent(),[3,4];case 3:return r=n.sent(),null===(t=this._logger)||void 0===t||t.info(T.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:E.FAILED,iceConnectionStatus:this._peer.iceConnectionState,sdp:e,msg:r})),[2,ze.SET_REMOTE_DESCRIPTION_FAILED];case 4:return this._logger.info(T.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:E.SUCCEEDED,sdp:e})),[2,ze.SUCCESS]}}))}))}}),Object.defineProperty(e.prototype,"getStatParsr",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return/chrome/i.test(Ro.browser)?new Qo(this,e,this._logger,t,r,n):/Firefox/i.test(Ro.browser)?new Yo(this,e,this._logger,t,r,n):/Safari/i.test(Ro.browser)?new Zo(this,e,this._logger,t,r,n):null}}),Object.defineProperty(e.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return null}}),Object.defineProperty(e.prototype,"resetSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xo.trimBlankLine(e)}}),Object.defineProperty(e.prototype,"getRemoteSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return null===(e=this._peer.remoteDescription)||void 0===e?void 0:e.sdp}}),Object.defineProperty(e.prototype,"_setupSenderTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),r=t.readable,n=t.writable,i=new TransformStream({transform:this._encodeRtpChunk.bind(this,e)});r.pipeThrough(i).pipeTo(n)}}}),Object.defineProperty(e.prototype,"_setupReceiverTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),r=t.readable,n=t.writable,i=new TransformStream({transform:this._decodeRtpChunk.bind(this,e)});r.pipeThrough(i).pipeTo(n)}}}),Object.defineProperty(e.prototype,"_encodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ra.splitNaluData(e),r=t.header,n=t.payloadData,i=$o.encodeVideo(n),o=ra.deal0x03(i,"encode");return new Uint8Array(A(A([],P(r),!1),P(o),!1)).buffer}}),Object.defineProperty(e.prototype,"_decodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ra.splitNaluData(e),r=t.header,n=t.payloadData,i=ra.deal0x03(n,"decode"),o=$o.decodeVideo(i);return new Uint8Array(A(A([],P(r),!1),P(o),!1)).buffer}}),Object.defineProperty(e.prototype,"_handleAudioREDFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=function(e){for(var t=[],r=0;;){var n,i=!(e[r]>>7),o=127&e[r],a=void 0,s=void 0,c=void 0;if(i?(a=0,s=e.byteLength-(t.length>0?t.map((function(e){return 4+e.block.byteLength})).reduce((function(e,t){return e+t})):0)-1,c=e.slice(r,r+1),r+=1):(a=(e[r+1]<<6)+(e[r+2]>>2),s=((3&e[r+2])<<8)+e[r+3],c=e.slice(r,r+4),r+=4),n=new Uint8Array(s),t.push({timestampOffset:a,header:c,block:n,isPrimary:i,blockPType:o}),i)break}return t.forEach((function(t){var n=t.block.byteLength,i=e.slice(r,r+n);t.block.set(i),r+=n})),t}(new Uint8Array(e)),n=[],i=[],o=0;r.forEach((function(e){var r="decode"===t?$o.decodeAudio(e.block):$o.encodeAudio(e.block);if(r.byteLength!==e.block.byteLength&&!e.isPrimary){var a=P(e.header,4),s=a[2],c=a[3];s=(s>>2<<2)+r.byteLength>>8,c=255&r.byteLength,e.header=new Uint8Array([e.header[0],e.header[1],s,c])}e.block=r,o+=e.block.byteLength+e.header.byteLength,n.push(e.header),i.push(e.block)}));var a=new Uint8Array(o),s=0;return A(A([],P(n),!1),P(i),!1).forEach((function(e){a.set(e,s),s+=e.byteLength})),a.buffer}}),Object.defineProperty(e.prototype,"_handleOpusFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=new Uint8Array(e);return("encode"===t?$o.encodeAudio(r):$o.decodeAudio(r)).buffer}}),Object.defineProperty(e.prototype,"_encodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._encodeVideoFrame(n);else{var i=t.getMetadata().mimeType;"audio/red"===i?t.data=this._handleAudioREDFrame(n,"encode"):"audio/opus"===i?t.data=this._handleOpusFrame(n,"encode"):console.error("Unsupport audio type: ".concat(i))}r.enqueue(t)}}),Object.defineProperty(e.prototype,"_decodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._decodeVideoFrame(n);else{var i=t.getMetadata().mimeType;"audio/red"===i?t.data=this._handleAudioREDFrame(n,"decode"):"audio/opus"===i?t.data=this._handleOpusFrame(n,"decode"):console.error("Unsupport audio type: ".concat(i))}r.enqueue(t)}}),e}(),oa=function(e){function t(t,r){var n=e.call(this,r,ea.PLANB,t)||this;return Object.defineProperty(n,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return y(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];A(A([],P(this.audioStreams),!1),P(this.videoStreams),!1).forEach((function(t){var r=t.match(/\ba=mid:(video|audio)\b/),n=Xo.clearInactiveOrRecvonly(t);r&&r[1]===ki.AUDIO&&(e[1]=n),r&&r[1]===ki.VIDEO&&(e[2]=n)}));var t=e.join("");return Xo.trimBlankLine(t)}}),Object.defineProperty(t.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(T.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Audio Bitrate With Stream Id"),this}}),Object.defineProperty(t.prototype,"setVideoBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(T.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Video Bitrate With Stream Id"),this}}),t}(Xo),aa=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"senders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_maxBitrate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(t,"_minBitrate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(t,"_startBitrate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t}return y(t,e),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._localTracks.includes(e)||this._localTracks.push(e);var t=e.getStreamId(),r=e.__innerGetMediaStreamTrack(),n=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);n.getTracks().forEach((function(e){e.kind===r.kind&&n.removeTrack(e)})),n.addTrack(r);var i=e.getTrackId(),o=this.senders[i];o?o.replaceTrack(r):(this.senders[i]=this._peer.addTrack(r,n),Object.defineProperty(r,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}))}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._localTracks.findIndex((function(t){return t===e}));t>=0&&this._localTracks.splice(t,1);var r=e.getTrackId(),n=this.senders[r];n&&(n.replaceTrack(null),this._peer.removeTrack(n),delete this.senders[r])}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._maxBitrate=e,this._minBitrate=t,this._startBitrate=r||.7*e}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i;return I(this,(function(o){switch(o.label){case 0:return[4,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0})];case 1:for(n in r=o.sent(),this._outboundStreams)i=this._outboundStreams[n].id,r.sdp=r.sdp.replace(new RegExp(i,"g"),n);return null==t||t.forEach((function(e){var t,n,i,o=e.mediaType,a=e.ssrc,s=e.msid;if(o===Bo.AUDIO_ONLY){var c="m=audio.*?a=ssrc:(\\d+)? msid:".concat(s," "),u=new RegExp(c,"ims");i=null===(t=r.sdp.match(u))||void 0===t?void 0:t[1]}else if(o===Bo.VIDEO_ONLY){c="m=video.*?a=ssrc:(\\d+)? msid:".concat(s," "),u=new RegExp(c,"ims");i=null===(n=r.sdp.match(u))||void 0===n?void 0:n[1]}if(i){var l=new RegExp(i,"ig");r.sdp=r.sdp.replace(l,a)}})),r.sdp&&(r.sdp=this.resetSdp(r.sdp)),[4,this._peer.setLocalDescription(r)];case 2:return o.sent(),[2,{type:"offer",semantics:"plan-b",sdp:r.sdp}]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return t=this.resetSdp(t),e.prototype.setRemoteAnswer.call(this,t)}}),Object.defineProperty(t.prototype,"resetSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new oa(this._logger,e),r={max:0,min:0},n={max:0,min:0};return this._localTracks.forEach((function(e){var t=e.getBitrate(),i=t.min,o=t.max,a=t.start;e.isAudioTrack()&&(n.max=n.max<o?o:n.max,n.min=n.min>i?i:n.min,n.max===o?n.start=a:n.start=.7*n.max),e.isVideoTrack()&&(r.max=r.max<o?o:r.max,r.min=r.min>i?i:r.min,r.max===o?r.start=a:r.start=.7*r.max)})),t.setAudiosBitrate(n),t.setVideosBitrate(r),t.stringify()}}),t}(ia),sa=function(e){function t(t,r){return e.call(this,r,ea.UNIFIEDPLAN,t)||this}return y(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];A(A([],P(this.audioStreams),!1),P(this.videoStreams),!1).forEach((function(t){var r=t.match(/\ba=mid:(\d+)\b/);r&&r[1]&&(e[+r[1]+1]=t)})),this.SDPHeader="",this.videoStreams=[],this.audioStreams=[];var t=e.join("");return Xo.trimBlankLine(t)}}),t}(Xo),ca=function(){function e(){Object.defineProperty(this,"__streams",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}return Object.defineProperty(e,"getInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e.instance||(e.instance=new e),e.instance}}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.__streams.set(e,t),t}}),Object.defineProperty(e.prototype,"pickup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.__streams.get(e)}}),Object.defineProperty(e.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.__streams.delete(e)}}),Object.defineProperty(e.prototype,"streams",{get:function(){var e,t,r=new Map;try{for(var n=L(this.__streams.keys()),i=n.next();!i.done;i=n.next()){var o=i.value;r.set(o,this.pickup(o))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},enumerable:!1,configurable:!0}),e}();!function(e){e[e.SERVER_KICK=1]="SERVER_KICK",e[e.OTHER_KICK=2]="OTHER_KICK",e[e.IM_DISCONNECTED=3]="IM_DISCONNECTED",e[e.IM_LOGOUT=4]="IM_LOGOUT",e[e.OTHER_CLIENT_IM_CONNECTED=5]="OTHER_CLIENT_IM_CONNECTED",e[e.RTC_INNER_KICK=6]="RTC_INNER_KICK"}(na||(na={}));var ua,la,da,_a,pa,fa,ba=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_sendTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_recvAudio",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvVideo",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_subedTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"midMsid",{enumerable:!0,configurable:!0,writable:!0,value:{}}),t}return y(t,e),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(T.L_FUNCTION_IS_UNAVAILABLE,"the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}}),Object.defineProperty(t.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t in this._sendTransceiver){if(this._sendTransceiver[t].mid===e)return t}for(var t in this._recvTransceiver){if(this._recvTransceiver[t].mid===e)return t}return null}}),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=e.getTrackId(),n=e.getStreamId(),i=e.__innerGetMediaStreamTrack();this._localTracks[r]=e;var o=this._outboundStreams[n]||(this._outboundStreams[n]=new MediaStream);o.getTracks().forEach((function(e){e.kind===i.kind&&o.removeTrack(e)})),o.addTrack(i);var a=this._sendTransceiver[r];if(a)a.sender.replaceTrack(i),a.direction="sendonly";else{var s=this._sendTransceiver[r]=this._peer.addTransceiver(i,{direction:"sendonly",streams:[o]});this._setupSenderTransform(s.sender)}ca.getInstance().push(r,{msid:n,id:this._outboundStreams[n].id,kind:null===(t=e.streamTrack)||void 0===t?void 0:t.kind})}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.getTrackId(),r=e.getStreamId();delete this._localTracks[t];var n=this._sendTransceiver[t];if(n){"closed"!==this._peer.connectionState&&(n.direction="inactive",this._peer.removeTrack(n.sender),n.sender.replaceTrack(null));var i=this._outboundStreams[r];(e.isAudioTrack()?i.getAudioTracks():i.getVideoTracks()).forEach((function(e){return i.removeTrack(e)}));var o=this._sendTransceiver["".concat(t,"_tiny")];if(o&&"inactive"!==o.direction&&"closed"!==this._peer.connectionState){o.direction="inactive";var a=o.sender,s=a.track;this._peer.removeTrack(a),a.replaceTrack(null),this._outboundStreams["".concat(r,"_tiny")].removeTrack(s),s.stop()}}}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=so(e).mediaType;this._recvTransceiver[e]=t;var n=r===Bo.AUDIO_ONLY?this._recvAudio:this._recvVideo,i=n.findIndex((function(e){return e===t}));i>=0&&n.splice(i,1)}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=$e.getMemo(),n=e.slice(),i=this._subedTracks.slice();this._subedTracks=e.slice();for(var o=function(e){var t=n[e],r=i.findIndex((function(e){return e===t}));r>=0&&(n.splice(e,1),i.splice(r,1))},a=n.length-1;a>=0;a-=1)o(a);i.length&&i.forEach((function(e){var r=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var n=t._recvTransceiver[r];n&&(n.direction="inactive")}));var s={audio:0,video:0};n.length&&n.forEach((function(e){var n,i=e.isAudioTrack()?"audio":"video",o=e.getTrackId(),a=null===(n=r.replacePreTrackIdMap)||void 0===n?void 0:n[o];a&&(o=a);var c=t._recvTransceiver[o];c?c.direction="recvonly":s[i]+=1}));for(a=this._recvAudio.length;a<s.audio;a+=1){var c=this._peer.addTransceiver("audio",{direction:"recvonly"});this._recvAudio.push(c),this._setupReceiverTransform(c.receiver)}for(a=this._recvVideo.length;a<s.video;a+=1){c=this._peer.addTransceiver("video",{direction:"recvonly"});this._recvVideo.push(c),this._setupReceiverTransform(c.receiver)}}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u;return I(this,(function(l){switch(l.label){case 0:i="",l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this._peer.createOffer({iceRestart:e})];case 2:return n=l.sent(),i=n.sdp,[3,4];case 3:return o=l.sent(),this._logger.error(T.L_PEER_CREATE_OFFER_E,JSON.stringify({sdp:n,errorStack:o.stack})),a=$e.getMemo(),null===(r=a.crtRoom)||void 0===r||r.mockKickOff(!1,na.RTC_INNER_KICK),[3,4];case 4:for(s in this._outboundStreams)c=this._outboundStreams[s].id,i=i.replace(new RegExp(c,"g"),s);(i=(i=this.resetOfferSdp(i)).replace(/(a=ice-options:trickle)/g,"$1\r\na=ice-options:renomination")).includes("a=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=rtcp-fb:111 nack\r\na=rtcp-fb:111 nack pli")||(i=i.replace(/(a=rtpmap:111 opus\/48000\/2\r\na=rtcp-fb:111 transport-cc)/g,"$1\r\na=rtcp-fb:111 nack\r\na=rtcp-fb:111 nack pli")),null==t||t.forEach((function(e){var t,r,n,o=e.mediaType,a=e.msid,s=e.ssrc;if(o===Bo.AUDIO_ONLY){var c="m=audio.*?a=ssrc:(\\d+)? msid:".concat(a," "),u=new RegExp(c,"ims");n=null===(t=i.match(u))||void 0===t?void 0:t[1]}else if(o===Bo.VIDEO_ONLY){c="m=video.*?a=ssrc:(\\d+)? msid:".concat(a," "),u=new RegExp(c,"ims");n=null===(r=i.match(u))||void 0===r?void 0:r[1]}if(n){var l=new RegExp(n,"ig");i=i.replace(l,s)}})),n.sdp=i,l.label=5;case 5:return l.trys.push([5,7,,8]),[4,this._peer.setLocalDescription(n)];case 6:return l.sent(),[3,8];case 7:return u=l.sent(),this._logger.error(T.L_PEER_SET_LOCAL_DESC_E,JSON.stringify({sdp:n,errorStack:u.stack})),[3,8];case 8:return[2,{type:"offer",semantics:"unified-plan",sdp:i}]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){t=this.resetAnswerSdp(t);var r=/[\r\n]+\r\n[\r\n]+/g;return r.test(t)&&(t=t.replace(r,"\r\n")),e.prototype.setRemoteAnswer.call(this,t)}}),Object.defineProperty(t.prototype,"_genarateMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=null;return ra.getMediaSections(e).forEach((function(e){ra.parseExtmap(e);var i=ra.parseMLine(e).kind,o=ra.parseMsid(e).stream,a=ra.getMid(e);"video"===r?/tiny$/.test(o)?o=o.replace(/tiny$/gi,"1_tiny"):o+="_1":o+="_0",o===t&&r===i&&a&&(n=a)})),n}}),Object.defineProperty(t.prototype,"_setSenderTransceiverBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._localTracks[t],o=null==i?void 0:i.getBitrate();n===ki.AUDIO&&o&&e.setAudioBitrateWithMid(o,r),n===ki.VIDEO&&o&&e.setVideoBitrateWithMid(o,r)}}),Object.defineProperty(t.prototype,"_resetSenderTransceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;for(var n in this._sendTransceiver){var i=this._sendTransceiver[n],o=null===(r=i.sender.track)||void 0===r?void 0:r.kind,a=i.direction,s=i.mid;s||(s=this._genarateMid(e,n,o)),s&&(a===ta.SENDONLY&&this._setSenderTransceiverBitrate(t,n,s,o),a===ta.INACTIVE&&t.clearnSsrcWithMid(s,ta.INACTIVE))}}}),Object.defineProperty(t.prototype,"_resetRecvTransceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t in this._recvTransceiver){var r=this._recvTransceiver[t],n=r.direction,i=r.mid;i&&n===ta.INACTIVE&&e.clearnSsrcWithMid(i,ta.RECVONLY)}}}),Object.defineProperty(t.prototype,"resetOfferSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new sa(this._logger,e);return this._resetSenderTransceiver(e,t),this._resetRecvTransceiver(t),t.stringify()}}),Object.defineProperty(t.prototype,"resetAnswerSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=new sa(this._logger,e);for(var n in this._sendTransceiver){var i=this._sendTransceiver[n],o=i.mid;if(o){var a=this._localTracks[n],s=null==a?void 0:a.getBitrate(),c=null===(t=i.sender.track)||void 0===t?void 0:t.kind;c===ki.AUDIO&&s&&r.setAudioBitrateWithMid(s,o),c===ki.VIDEO&&s&&r.setVideoBitrateWithMid(s,o)}}return r.stringify()}}),t}(ia);!function(e){e.VP8="VP8",e.VP9="VP9",e.H264="H264"}(ua||(ua={})),function(e){
|
|
2
|
-
/*!
|
|
3
|
-
Excellent, 80% ~ 100%
|
|
4
|
-
*/
|
|
5
|
-
e[e.RCRTCNetworkQualityTypeExcellent=1]="RCRTCNetworkQualityTypeExcellent",
|
|
6
|
-
/*!
|
|
7
|
-
Good, 60% ~ 80%
|
|
8
|
-
*/
|
|
9
|
-
e[e.RCRTCNetworkQualityTypeGood=2]="RCRTCNetworkQualityTypeGood",
|
|
10
|
-
/*!
|
|
11
|
-
Poor, 40% ~ 60%
|
|
12
|
-
*/
|
|
13
|
-
e[e.RCRTCNetworkQualityTypePoor=3]="RCRTCNetworkQualityTypePoor",
|
|
14
|
-
/*!
|
|
15
|
-
Bad, 20% ~ 40%
|
|
16
|
-
*/
|
|
17
|
-
e[e.RCRTCNetworkQualityTypeBad=4]="RCRTCNetworkQualityTypeBad",
|
|
18
|
-
/*!
|
|
19
|
-
VBad, 1% ~ 20%
|
|
20
|
-
*/
|
|
21
|
-
e[e.RCRTCNetworkQualityTypeVBad=5]="RCRTCNetworkQualityTypeVBad",
|
|
22
|
-
/*!
|
|
23
|
-
Down, 0%
|
|
24
|
-
*/
|
|
25
|
-
e[e.RCRTCNetworkQualityTypeDown=6]="RCRTCNetworkQualityTypeDown"}(la||(la={})),function(e){e[e.NetworkNone=0]="NetworkNone",e[e.NetworkResume=1]="NetworkResume",e[e.NetworkUnavailable=2]="NetworkUnavailable"}(da||(da={})),function(e){e[e.VideoNone=0]="VideoNone",e[e.VideoResume=1]="VideoResume",e[e.VideoStandstill=2]="VideoStandstill"}(_a||(_a={})),function(e){e[e.AudioNone=0]="AudioNone",e[e.AudioResume=1]="AudioResume",e[e.AudioStandstill=2]="AudioStandstill"}(pa||(pa={})),function(e){e.None="None",e.Wifi="Wifi",e.Ethernet="Ethernet"}(fa||(fa={}));var ma,ha,ga,va,Ra=function(e){function t(t,r,n,i,o,a){void 0===a&&(a=!1);var s=e.call(this)||this;Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"_reTryExchange",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_store",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"senderAndReciveSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(s,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"reportParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"pubLocalTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(s,"_reTryExchangeTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(s,"_reportStatsTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(s,"_reportR3R4ToPolarisTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(s,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_formatStatsData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(s,"_historyAudioLevelMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(s,"_inRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_firstConnectFromPub",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(s,"_isSave",{enumerable:!0,configurable:!0,writable:!0,value:!1}),$e.getMemo();var c=ia.getSdpSemantics(),u="unified-plan"===c&&a&&Mo()&&$o.isInit(),l=s._rtcPeerConn=new RTCPeerConnection({sdpSemantics:c,encodedInsertableStreams:u});return s._sdpStrategy="plan-b"===c?new aa(s._logger,l,!1):new ba(s._logger,l,u),s._rtcPeerConn.oniceconnectionstatechange=s._onICEConnectionStateChange.bind(s),s._rtcPeerConn.onconnectionstatechange=s._onConnectionStateChange.bind(s),s._rtcPeerConn.ontrack=s._onTrackReady.bind(s),s.reportParser=s._sdpStrategy.getStatParsr(s._rtcPeerConn,c,s._currentUserId,s._store),s}return y(t,e),Object.defineProperty(t.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.values(this.pubLocalTracks)}}),Object.defineProperty(t.prototype,"_onConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._logger.info(T.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S,"state: ".concat(this._rtcPeerConn.connectionState))}}),Object.defineProperty(t.prototype,"startAutoExecute",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.stopAutoExecute(),this._reportStatsTimer=setTimeout((function(){t._reportHandle(),t.startAutoExecute(e)}),e)}}),Object.defineProperty(t.prototype,"stopAutoExecute",{enumerable:!1,configurable:!0,writable:!0,value:function(){clearTimeout(this._reportStatsTimer)}}),Object.defineProperty(t.prototype,"_onICEConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r,n;return C(this,void 0,void 0,(function(){var i,o,a;return I(this,(function(s){switch(s.label){case 0:return i=this._rtcPeerConn.iceConnectionState,this._logger.info(T.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S,JSON.stringify({iceConnectionState:i})),[4,this._getStatsData()];case 1:o=s.sent(),a=o?this._createRCRTCStateReport(o).iceCandidatePair:null,this.emit(t.__INNER_ICE_STATE_CHANGE__,{status:i,time:Date.now(),iceCandidatePair:a}),"connected"===i?(this.emit(t.__INNER_ICE_CONNECTED__,this._firstConnectFromPub),this.startAutoExecute(1e3)):"failed"!==i&&"disconnected"!==i||this._handleRetry();try{null===(r=null===(e=this._reportListener)||void 0===e?void 0:e.onICEConnectionStateChange)||void 0===r||r.call(e,i)}catch(e){null===(n=this._logger)||void 0===n||n.error(T.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R,JSON.stringify({status:E.FAILED,msg:e}))}return[2]}}))}))}}),Object.defineProperty(t.prototype,"_handleRetry",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t=this;return I(this,(function(r){switch(r.label){case 0:return this._inRetry?[2]:(this.clearReTryExchangeTimer(),this._inRetry=!0,[4,this._reTryExchange()]);case 1:return e=r.sent().code,this._inRetry=!1,e===ze.SUCCESS?[2]:(this._reTryExchangeTimer=setTimeout((function(){return t._handleRetry()}),15e3),[2])}}))}))}}),Object.defineProperty(t.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.streams.length){var r=e.streams[0].id,n=e.receiver.track,i=[r,"audio"===n.kind?Bo.AUDIO_ONLY:Bo.VIDEO_ONLY].join("_");n.trackId||Object.defineProperty(n,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}),this._updateRecvTransceiverMap(i,e.transceiver),this.emit(t.__INNER_EVENT_TRACK_READY__,e)}}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){return I(this,(function(n){return this._sdpStrategy.setBitrate(e,t,r),this._logger.info(T.L_RTC_PEER_CONNECTION_SET_BITRATE_O,JSON.stringify({status:E.SUCCEEDED,max:e,min:t,start:r})),[2]}))}))}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r;return I(this,(function(n){switch(n.label){case 0:return[4,this._sdpStrategy.createOffer(e,t)];case 1:return r=n.sent(),this._logger.info(T.L_RTC_PEER_CONNECTION_CREATE_OFFER_O,JSON.stringify({iceRestart:e,offerSDP:r.sdp,sdpDemantics:r.semantics})),[2,r]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t=!1),C(this,void 0,void 0,(function(){return I(this,(function(r){return this._firstConnectFromPub=t,[2,this._sdpStrategy.setRemoteAnswer(e)]}))}))}}),Object.defineProperty(t.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.pubLocalTracks[e]||null}}),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(qi.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(qi.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.off(qi.__INNER_EVENT_SEND_CHANGE__,this._onLocalTrackSent,this),e.off(qi.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this._onLocalTrackDeviceStatusChanged,this),e.on(qi.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(qi.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(qi.__INNER_EVENT_SEND_CHANGE__,this._onLocalTrackSent,this),e.on(qi.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this._onLocalTrackDeviceStatusChanged,this),this._logger.info(T.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O,JSON.stringify({trackId:e.getTrackId()}))}}),Object.defineProperty(t.prototype,"removeLocalTrackById",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getLocalTrack(e);t?(this._logger.info(T.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:E.SUCCEEDED,trackId:e})),this.removeLocalTrack(t)):this._logger.warn(T.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:E.FAILED,msg:"track not found",trackId:e}))}}),Object.defineProperty(t.prototype,"removeAllLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Object.keys(this.pubLocalTracks).forEach((function(t){/_tiny$/.test(t)||e.removeLocalTrackById(t)}))}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.getTrackId();delete this.pubLocalTracks[t],this._sdpStrategy.removeLocalTrack(e),e.__innerSetPublished(!1),e.off(qi.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(qi.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.off(qi.__INNER_EVENT_SEND_CHANGE__,this._onLocalTrackSent,this),e.off(qi.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this._onLocalTrackDeviceStatusChanged,this);var r="".concat(t,"_tiny"),n=this.getLocalTrack(r);n&&(this._sdpStrategy.removeLocalTrack(n),delete this.pubLocalTracks[r],n.destroy()),this._logger.info(T.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O,JSON.stringify({trackId:t}))}}),Object.defineProperty(t.prototype,"_updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_UPDATE_SUB_REMOTE_TRACKS_O,JSON.stringify({tracks:e.map(Io)})),this._sdpStrategy.updateSubRemoteTracks(e)}}),Object.defineProperty(t.prototype,"getOutboundVideoInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sdpStrategy.getOutboundVideoInfo()}}),Object.defineProperty(t.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));r&&(r.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(qi.__INNER_EVENT_MUTED_CHANGE__,e,t)}}),Object.defineProperty(t.prototype,"_onLocalTrackDeviceStatusChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));r&&r.updateDeviceAvailable(t),this.emit(qi.__INNER_EVENT_DEVICE_STATUS_CHANGE__,e,t)}}),Object.defineProperty(t.prototype,"_onLocalTrackSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.emit(qi.__INNER_EVENT_SEND_CHANGE__,e,t)}}),Object.defineProperty(t.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.emit(qi.__INNER_EVENT_DESTROY__,e)}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(t.prototype,"_createSenderReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=$e.getMemo(),r=[];return e.forEach((function(e){var n,i,o=e.trackId,a=e.kind,s=e.packetsLostRate,c=e.remoteResource,u=e.bitrate,l=e.jitter,d=e.networkQuality,_=e.audioDB,p={trackId:o,kind:a,packetsLostRate:s,remoteResource:c,bitrate:u,jitter:l,rtt:e.rtt,networkQuality:d,userId:null===(n=t.meidToUserIdMap)||void 0===n?void 0:n[so(o).identifier],audioDB:_};if((e.audioLevel||0===e.audioLevel)&&(p.audioLevel=e.audioLevel),e.frameWidth&&(p.frameWidth=e.frameWidth),e.frameHeight&&(p.frameHeight=e.frameHeight),e.frameRate&&(p.frameRate=e.frameRate),e.trackId){var f=e.trackId;e.trackId.includes("tiny")&&(f=e.trackId.replace("_tiny",""));var b=so(f).identifier,m=null===(i=t.meidToUserIdMap)||void 0===i?void 0:i[b];e.userId=m,r.push(O(O({},p),{userId:m}))}})),r}}),Object.defineProperty(t.prototype,"_createReceiverReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=$e.getMemo(),r=[];return e.forEach((function(e){var n,i,o=e.trackId,a=e.kind,s=e.packetsLostRate,c=e.remoteResource,u=e.bitrate,l=e.jitter,d=e.networkQuality,_=e.audioDB,p={trackId:o,kind:a,packetsLostRate:s,remoteResource:c,bitrate:u,jitter:l,networkQuality:d,userId:null===(n=t.meidToUserIdMap)||void 0===n?void 0:n[so(o).identifier],audioDB:_};if((e.audioLevel||0===e.audioLevel)&&(p.audioLevel=e.audioLevel),e.frameWidth&&(p.frameWidth=e.frameWidth),e.frameHeight&&(p.frameHeight=e.frameHeight),e.frameRate&&(p.frameRate=e.frameRate),e.trackId){var f=so(e.trackId).identifier,b=null===(i=t.meidToUserIdMap)||void 0===i?void 0:i[f];e.userId=b,r.push(O({},p))}})),r}}),Object.defineProperty(t.prototype,"_createRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.timestamp,r=e.iceCandidatePair,n=e.senders,i=e.receivers;for(var o in(null==r?void 0:r.totalPacketsLost)&&(null==r||delete r.totalPacketsLost),r)Eo(r[o])&&delete r[o];return{timestamp:t,iceCandidatePair:r,senders:this._createSenderReport(n),receivers:this._createReceiverReport(i)}}}),Object.defineProperty(t.prototype,"_getStatsData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return C(this,void 0,void 0,(function(){var r,n,i;return I(this,(function(o){switch(o.label){case 0:return this._formatStatsData=null,r=null,[4,this._rtcPeerConn.getStats()];case 1:return n=o.sent(),r=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(n),i=null===(t=this.reportParser)||void 0===t?void 0:t.formatRCRTCStateReport(r),this._formatStatsData=i,[2,i]}}))}))}}),Object.defineProperty(t.prototype,"_reportHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r,n;return C(this,void 0,void 0,(function(){var i,a,s,c,u=this;return I(this,(function(l){switch(l.label){case 0:return i=$e.getMemo(),[4,this._getStatsData()];case 1:if(!(a=l.sent()))return[2];if((s=this._createRCRTCStateReport(a)).senders.forEach((function(e){var t=so(e.trackId),r=t.tag,n=t.mediaType;r===nu.DEFAULT&&n===Bo.AUDIO_ONLY&&(e.detectAudioLevel=i.micAudioLevel)})),null===(e=this._store)||void 0===e?void 0:e.isMeetingMode)return $e.getMemo().pubReportData=s,[2];try{null===(n=null===(r=this._reportListener)||void 0===r?void 0:r.onStateReport)||void 0===n||n.call(r,JSON.parse(JSON.stringify(s)))}catch(e){this._logger.error(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}return c=A(A([],P(a.receivers),!1),P(a.senders),!1).filter((function(e){return!("audio"!==e.kind)})).map((function(e){var t;if(o(e.audioLevel)){var r=u._historyAudioLevelMap[e.trackId];r?(r.length>3&&r.splice(0,1),r.push(e.audioLevel||0)):r=u._historyAudioLevelMap[e.trackId]=[e.audioLevel||0];var n=r.reduce((function(e,t){return e+t}),0)/r.length;return{trackId:e.trackId,audioLevel:n}}u._historyAudioLevelMap[e.trackId]=[];var i=e.trackId;e.trackId.includes("tiny")&&(i=e.trackId.replace("_tiny",""));var a=so(i).identifier,s=null===(t=u._store)||void 0===t?void 0:t.getUserIdByMeid(a);return{trackId:e.trackId,audioLevel:e.audioLevel,userId:s}})),this.emit(t.__INNER_AUDIOLEVEL_CHANGE__,c),[2]}}))}))}}),Object.defineProperty(t.prototype,"_calculateNetworkStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i,o,a,s,c,u,l,d,_,p=$e.getMemo(),f=0,b=0,m=0;!1===p.pubPeerUseabled&&(b+=1),!1===p.subPeerUseabled&&(m+=1);var h=e.senders.filter((function(e){return!e.networkQuality||e.networkQuality<la.RCRTCNetworkQualityTypeVBad})),g=e.receivers.filter((function(e){return!e.networkQuality||e.networkQuality<la.RCRTCNetworkQualityTypeVBad}));0===h.length&&0!==e.senders.length&&(b+=1),0===g.length&&0!==e.receivers.length&&(m+=1),b>0&&m>0&&(f+=1);var v=[],R=[],S=[];R=p.sendNetworkStatusList?A(A([],P(p.sendNetworkStatusList.slice(-4)),!1),[b],!1):[b],S=p.recvNetworkStatusList?A(A([],P(p.recvNetworkStatusList.slice(-4)),!1),[m],!1):[m],v=p.networkStatusList?A(A([],P(p.networkStatusList.slice(-4)),!1),[f],!1):[f],p.networkStatusList=v,p.sendNetworkStatusList=R,p.recvNetworkStatusList=S;var y=5===v.length&&v.filter((function(e){return e>0})).length>=3,E=5===R.length&&R.filter((function(e){return e>0})).length>=3,O=5===S.length&&S.filter((function(e){return e>0})).length>=3;E&&p.sendNetworkUnAvailabled!==E?(null===(r=null===(t=this._reportListener)||void 0===t?void 0:t.onSendConnnectionLost)||void 0===r||r.call(t,da.NetworkUnavailable),p.sendQos=!1,this._logger.info(T.L_SEND_CONNECTION_LOST_O,JSON.stringify({status:da.NetworkUnavailable,sendNetworkStatusList:R}))):p.sendNetworkUnAvailabled&&p.sendNetworkUnAvailabled!==E&&(null===(i=null===(n=this._reportListener)||void 0===n?void 0:n.onSendConnnectionLost)||void 0===i||i.call(n,da.NetworkResume),p.sendQos=!0,this._logger.info(T.L_SEND_CONNECTION_LOST_O,JSON.stringify({status:da.NetworkUnavailable,sendNetworkStatusList:R}))),O&&p.recvNetworkUnAvailabled!==O?(null===(a=null===(o=this._reportListener)||void 0===o?void 0:o.onRecvConnnectionLost)||void 0===a||a.call(o,da.NetworkUnavailable),this._logger.info(T.L_RECV_CONNECTION_LOST_O,JSON.stringify({status:da.NetworkUnavailable,recvNetworkStatusList:S}))):p.recvNetworkUnAvailabled&&p.recvNetworkUnAvailabled!==O&&(null===(c=null===(s=this._reportListener)||void 0===s?void 0:s.onRecvConnnectionLost)||void 0===c||c.call(s,da.NetworkResume),this._logger.info(T.L_RECV_CONNECTION_LOST_O,JSON.stringify({status:da.NetworkUnavailable,recvNetworkStatusList:S}))),y&&p.networkUnAvailabled!==y?(null===(l=null===(u=this._reportListener)||void 0===u?void 0:u.onConnectionLost)||void 0===l||l.call(u,da.NetworkUnavailable),this._logger.info(T.L_CONNECTION_LOST_O,JSON.stringify({status:da.NetworkUnavailable,networkStatusList:v}))):p.networkUnAvailabled&&p.networkUnAvailabled!==y&&(null===(_=null===(d=this._reportListener)||void 0===d?void 0:d.onConnectionLost)||void 0===_||_.call(d,da.NetworkResume),this._logger.info(T.L_CONNECTION_LOST_O,JSON.stringify({status:da.NetworkResume,networkStatusList:v}))),p.networkUnAvailabled=y,p.sendNetworkUnAvailabled=E,p.recvNetworkUnAvailabled=O}}),Object.defineProperty(t.prototype,"_sendR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return C(this,void 0,void 0,(function(){var r,n,i,o;return I(this,(function(a){switch(a.label){case 0:return r=this._formatStatsData,n=$e.getMemo(),i=null==n?void 0:n.subPolarisReportData,r?((o={timestamp:r.timestamp,iceCandidatePair:r.iceCandidatePair,senders:A(A([],P(r.senders),!1),P((null==i?void 0:i.senders)||[]),!1),receivers:A(A([],P(r.receivers),!1),P((null==i?void 0:i.receivers)||[]),!1)}).receivers.length+o.senders.length>this.senderAndReciveSize&&(o.receivers=o.receivers.slice(0,this.senderAndReciveSize)),o.senders.length||o.receivers.length?[4,null===(t=this._polarisReport)||void 0===t?void 0:t.sendR3R4Data(o,e)]:[3,2]):[2,!0];case 1:a.sent(),a.label=2;case 2:return[2]}}))}))}}),Object.defineProperty(t.prototype,"__reportR3R4ToPolaris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e=this;return I(this,(function(t){return clearTimeout(this._reportR3R4ToPolarisTimer),this._isDestroyed||(this._reportR3R4ToPolarisTimer=setTimeout((function(){return C(e,void 0,void 0,(function(){return I(this,(function(e){return this._sendR3R4Data(this._isSave),this._isSave=!this._isSave,this.__reportR3R4ToPolaris(),[2]}))}))}),2e3)),[2]}))}))}}),Object.defineProperty(t.prototype,"getRTCPeerConn",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rtcPeerConn}}),Object.defineProperty(t.prototype,"getCapabilitiesCodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;void 0===e&&(e=ua.H264);var r=(null===(t=RTCRtpSender.getCapabilities("video"))||void 0===t?void 0:t.codecs)||[];if(r){var n=null;switch(e){case ua.VP8:case ua.VP9:n=r.find((function(t){return t.mimeType.match(e)}));break;case ua.H264:n=r.find((function(t){var r;return t.mimeType.match(e)&&(null===(r=t.sdpFmtpLine)||void 0===r?void 0:r.match("42e01f"))}))}r=r.filter((function(e){return e!==n})),r=A([n],P(r),!1)}return r}}),Object.defineProperty(t.prototype,"setEncoderPreferences",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r;return I(this,(function(n){return t=this.getRTCPeerConn(),r=this.getCapabilitiesCodes(e),this._logger.info(T.L_SET_ENCODER_PREFERENCES_S,JSON.stringify({status:E.SUCCEEDED,codecCap:r})),t.getTransceivers().forEach((function(e){var t;"video"===(null===(t=e.sender.track)||void 0===t?void 0:t.kind)&&e.setCodecPreferences(r)})),[2]}))}))}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.clear(),this.clearReTryExchangeTimer(),clearTimeout(this._reportR3R4ToPolarisTimer),this.stopAutoExecute(),this.registerReportListener(null),this._rtcPeerConn.close(),this._isDestroyed=!0,this.reportParser=null,this._logger.info(T.L_RTC_PEER_CONNECTION_DESTROY_O,JSON.stringify({status:E.SUCCEEDED}))}}),Object.defineProperty(t.prototype,"clearReTryExchangeTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){clearInterval(this._reTryExchangeTimer),this._reTryExchangeTimer=null}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(t.prototype,"getRemoteSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sdpStrategy.getRemoteSdp()}}),Object.defineProperty(t.prototype,"getSenders",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rtcPeerConn.getSenders()}}),Object.defineProperty(t.prototype,"getSenderByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSenders().filter((function(t){var r;return(null===(r=t.track)||void 0===r?void 0:r.id)===e}))[0];return t}}),Object.defineProperty(t.prototype,"disableSenderEncodingsByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e){var t=this.getSenderByTrackId(e);if(t){var r=t.getParameters(),n=O(O({},r),{encodings:r.encodings.map((function(e){return O(O({},e),{active:!1})}))});t.setParameters(n)}}}}),Object.defineProperty(t.prototype,"enableSenderEncodingsByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e){var t=this.getSenderByTrackId(e);if(t){var r=t.getParameters(),n=O(O({},r),{encodings:r.encodings.map((function(e){return O(O({},e),{active:!0})}))});t.setParameters(n)}}}}),Object.defineProperty(t,"__INNER_EVENT_TRACK_READY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-track-ready"}),Object.defineProperty(t,"__INNER_AUDIOLEVEL_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-audio-level-change"}),Object.defineProperty(t,"__INNER_ICE_STATE_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-state-change"}),Object.defineProperty(t,"__INNER_ICE_CONNECTED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-connected"}),t}(a);!function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE",e[e.STAT_NONE=-1]="STAT_NONE"}(ma||(ma={})),function(e){e[e.Meeting=1]="Meeting"}(ha||(ha={})),function(e){e[e.NOT_REPORT=-1]="NOT_REPORT",e[e.REPORT_SUCCESS=1e4]="REPORT_SUCCESS",e[e.REPORT_FAIL=0]="REPORT_FAIL",e[e.PB_ERROR=40001]="PB_ERROR"}(ga||(ga={})),function(e){e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R3R4="R3R4"}(va||(va={}));var Sa,ya,Ta=function(){function e(e,t,r,n,i){void 0===i&&(i=ha.Meeting),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_crtRTCRoom",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:i})}return Object.defineProperty(e.prototype,"_send",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){switch(t.label){case 0:return this._context.getConnectionStatus()!==i.CONNECTED?[2,ga.NOT_REPORT]:[4,this._context.setRTCState(this._roomId,e)];case 1:return t.sent()===u.SUCCESS?[2,ga.REPORT_SUCCESS]:[2,ga.REPORT_FAIL]}}))}))}}),Object.defineProperty(e.prototype,"_getClientID",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=function(){var e=fo();return e="".concat(e.replace(/-/g,""),"0"),(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),r=t.length+1,n=+e,i=[];do{var o=n%r;n=(n-o)/r,i.unshift(t[o])}while(n);return i.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e}(),this._runtime.localStorage.setItem(e,t)),t}}),Object.defineProperty(e.prototype,"_getRealResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,r=e.indexOf("_tiny");return r>-1&&(t=e.slice(0,r)),t}}),Object.defineProperty(e.prototype,"_getPolarisTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="",r=e.split("_");if(e.includes("_tiny")){var n=r.pop(),i=parseInt(r.pop())===Bo.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,n,i].join("_")}else{i=parseInt(r.pop())===Bo.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,i].join("_")}return t}}),Object.defineProperty(e.prototype,"sendR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a,s,c,u,l,d=this;return I(this,(function(_){switch(_.label){case 0:return t=e.iceCandidatePair,r=e.senders,n=e.receivers,i={bitrateSend:(null==t?void 0:t.bitrateSend)||pi,bitrateRecv:(null==t?void 0:t.bitrateRecv)||pi,networkType:(null==t?void 0:t.networkType)||"unknown",rtt:(null==t?void 0:t.rtt)||pi,localAddress:"".concat((null==t?void 0:t.IP)||pi,":").concat(null==t?void 0:t.port),remoteAddress:"".concat(null==t?void 0:t.remoteIP,":").concat(null==t?void 0:t.remotePort),receiveBand:(null==t?void 0:t.availableIncomingBitrate)||pi,sendBand:(null==t?void 0:t.availableOutgoingBitrate)||pi,packetsLost:(null==t?void 0:t.totalPacketsLost)||pi,deviceId:this._context.getCurrentId()},o="R3\t".concat(i.bitrateSend,"\t-1\t-1\t-1\t").concat(i.networkType,"\t").concat(i.rtt,"\t").concat(i.localAddress,"\t").concat(i.receiveBand,"\t").concat(i.sendBand,"\t").concat(i.packetsLost,"\t").concat(i.deviceId,"\r"),a="R4\t".concat(i.bitrateRecv,"\t-1\t-1\t-1\t").concat(i.networkType,"\t").concat(i.rtt,"\t").concat(i.localAddress,"\t").concat(i.receiveBand,"\t").concat(i.sendBand,"\t").concat(i.packetsLost,"\t").concat(i.deviceId,"\r"),s=r.map((function(e){var t,r=e.trackId,n=e.audioLevel,i=e.samplingRate,o=e.bitrate,a=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,_=e.jitter,p=e.nackCount,f=e.pliCount,b=e.rtt,m=e.googFirsSent,h=e.encoderImplementation,g=d._getPolarisTrackId(r),v=d._getRealResourceId(r);return{trackId:g,googCodecName:h||String(pi),audioLevel:n||0===n?n:pi,bitrate:o||0===o?o:pi,packetsLostRate:a||0===a?a:pi,frameRate:s||pi,resolution:c&&u?"".concat(c," * ").concat(u):"".concat(pi),jitter:_||pi,nackCount:p||0===p?p:pi,pliCount:f||0===f?f:pi,rtt:b||pi,googFirsSent:m,samplingRate:i,googRenderDelayMs:l,encoderImplementation:h||String(pi),trackState:(null===(t=d._crtRTCRoom.getLocalTrack(v))||void 0===t?void 0:t.isLocalMuted())?ma.DISABLE:ma.ENABLE}})),c=n.filter((function(e){return!!e.trackId})).map((function(e){var t,r=e.trackId,n=e.audioLevel,i=e.samplingRate,o=e.bitrate,a=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,_=e.jitter,p=e.nackCount,f=e.pliCount,b=e.rtt,m=e.googFirsReceived,h=e.codecImplementationName,g=d._getPolarisTrackId(r),v=d._getRealResourceId(r);return{trackId:g,googCodecName:h||String(pi),audioLevel:n||0===n?n:pi,bitrate:o||0===o?o:pi,packetsLostRate:a||0===a?a:pi,frameRate:s||pi,resolution:c&&u?"".concat(c," * ").concat(u):"".concat(pi),jitter:_||pi,nackCount:p||0===p?p:pi,pliCount:f||0===f?f:pi,rtt:b||pi,googFirsReceived:m,samplingRate:i,googRenderDelayMs:l,codecImplementationName:h||String(pi),trackState:(null===(t=d._crtRTCRoom.getRemoteTrack(v))||void 0===t?void 0:t.isLocalMuted())?ma.DISABLE:ma.ENABLE}})),u=ga.REPORT_FAIL,o+=s.map((function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsSent,"\t").concat(e.encoderImplementation,"\t").concat(e.trackState)})).join("\n"),e.senders.length?[4,this._send("".concat(o,"\r").concat(this._userRole))]:[3,2];case 1:u=_.sent(),_.label=2;case 2:return l=ga.REPORT_FAIL,a+=c.map((function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsReceived,"\t").concat(e.codecImplementationName,"\t").concat(e.trackState)})).join("\n"),e.receivers.length?[4,this._send("".concat(a,"\r").concat(this._userRole))]:[3,4];case 3:l=_.sent(),_.label=4;case 4:return u!==ga.REPORT_SUCCESS&&l!==ga.REPORT_SUCCESS?[2,ga.REPORT_FAIL]:[2,ga.REPORT_SUCCESS]}}))}))}}),Object.defineProperty(e.prototype,"sendR1",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._context.getCoreVersion(),t=navigator.platform,r=Ro.browser,n=Ro.version,i=this._getClientID(),o="R1\t".concat("5.7.3-enterprise-alpha.8","\t").concat(e,"\t").concat("web","\t").concat(t,"\t").concat(-1,"\t").concat(r,"\t").concat(n,"\t").concat(i,"\t").concat(this._userRole);this._send(o)}}),Object.defineProperty(e.prototype,"sendR2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this._getClientID(),i="R2\t".concat(e,"\t").concat(t,"\t").concat(n,"\r").concat(r.join("\t"),"\r").concat(this._userRole);this._send(i)}}),e}();!function(e){e[e.new=0]="new",e[e.checking=1]="checking",e[e.connected=2]="connected",e[e.completed=3]="completed",e[e.failed=4]="failed",e[e.disconnected=5]="disconnected",e[e.closed=6]="closed"}(Sa||(Sa={})),function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}(ya||(ya={}));var Ea,Oa,Ca,Ia=function(){function e(){Object.defineProperty(this,"_locked",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_database",{enumerable:!0,configurable:!0,writable:!0,value:null})}return Object.defineProperty(e.prototype,"open",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=indexedDB.open("QosDataBase");t.onerror=function(e){bi.error(T.L_DATA_BASE_E,"indexedDB open error: QosDataBase -> errorCode: ".concat(e.target.errorCode))},t.onsuccess=function(t){bi.info(T.L_DATA_BASE_O,"indexedDB open success: QosDataBase"),e._database=t.target.result,e._locked=!1},t.onupgradeneeded=function(t){bi.info(T.L_DATA_BASE_O,"indexedDB upgrade: QosDataBase"),e._database=t.target.result,e._database.createObjectStore("reportData",{keyPath:"time",autoIncrement:!0})}}}),Object.defineProperty(e.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this._locked?(bi.warn(T.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(r){var n=t._database.transaction(["reportData"],"readwrite").objectStore("reportData").add(e);n.onsuccess=function(){r({status:!0})},n.onerror=function(){r({status:!1})}}))}}),Object.defineProperty(e.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this._locked?(bi.warn(T.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(r){var n=IDBKeyRange.upperBound(e),i=t._database.transaction(["reportData"],"readwrite").objectStore("reportData").get(n);i.onsuccess=function(e){var t;r({status:!0,data:null===(t=e.target)||void 0===t?void 0:t.result})},i.onerror=function(){r({status:!1})}}))}}),Object.defineProperty(e.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this._locked?(bi.warn(T.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(r){var n=t._database.transaction(["reportData"],"readwrite").objectStore("reportData").put(e);n.onsuccess=function(){r({status:!0})},n.onerror=function(){r({status:!1})}}))}}),Object.defineProperty(e.prototype,"del",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this._locked?(bi.warn(T.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(r){var n=t._database.transaction(["reportData"],"readwrite").objectStore("reportData").delete(e);n.onsuccess=function(){r({status:!0})},n.onerror=function(){r({status:!1})}}))}}),Object.defineProperty(e.prototype,"delAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this._locked?(bi.warn(T.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(t){var r=IDBKeyRange.upperBound(Date.now()),n=e._database.transaction(["reportData"],"readwrite").objectStore("reportData").delete(r);n.onsuccess=function(e){t({status:!0})},n.onerror=function(){t({status:!1})}}))}}),Object.defineProperty(e.prototype,"getAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this._locked?(bi.warn(T.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(t){var r=e._database.transaction(["reportData"],"readwrite").objectStore("reportData").getAll();r.onsuccess=function(e){t({status:!0,data:e.target.result})},r.onerror=function(){t({status:!1})}}))}}),e}(),La=function(){function e(){Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_locked",{enumerable:!0,configurable:!0,writable:!0,value:!1})}return Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._queue.push(e),this._execute()}}),Object.defineProperty(e.prototype,"_execute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return I(this,(function(e){switch(e.label){case 0:return this._queue.length>0&&!this._locked?(this._locked=!0,[4,this._queue.shift()()]):[3,2];case 1:e.sent(),this._locked=!1,this._execute(),e.label=2;case 2:return[2]}}))}))}}),e}(),Pa=function(){function e(t,r,n,i,o){void 0===o&&(o=ha.Meeting),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_crtRTCRoom",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_polarisSignalReporter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_useHttp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"timesOfR3Report",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"timesOfR4Report",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_sequenceId",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_database",{enumerable:!0,configurable:!0,writable:!0,value:new Ia}),Object.defineProperty(this,"_localQosDataQueue",{enumerable:!0,configurable:!0,writable:!0,value:new La});var a=$e.getMemo(),s=this._context.getNaviInfo();e.logServer=null==s?void 0:s.logServer,e.dc=null==s?void 0:s.dc,this._polarisSignalReporter=new Ta(t,r,n,i,o),this._database.open(),a.database=this._database}return Object.defineProperty(e.prototype,"_send",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){var i,o;return C(this,void 0,void 0,(function(){var a,s;return I(this,(function(c){switch(c.label){case 0:return(a=e.logServer)&&this._useHttp?[4,this._context.setRTCStateByHttp(a,this._runtime,t,r,n)]:[2,ga.REPORT_FAIL];case 1:return(s=c.sent())===ga.REPORT_SUCCESS?[2,ga.REPORT_SUCCESS]:s===ze.JWT_TIME_OUT?[2,ga.REPORT_FAIL]:s===ga.REPORT_FAIL||s===ga.PB_ERROR?(null===(o=null===(i=this._context)||void 0===i?void 0:i.logger)||void 0===o||o.info(T.L_HTTP_POLARIS_REPORT_FAIL_O,"send data fail -> code: ".concat(s)),[2,ga.REPORT_FAIL]):[2,ga.REPORT_FAIL]}}))}))}}),Object.defineProperty(e.prototype,"reportLocalQosDataToPolaris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t,r,n,i,o,a,s,c,u;return I(this,(function(l){switch(l.label){case 0:return[4,this._database.getAll()];case 1:if(e=l.sent(),t=e.status,r=e.data,t&&0===(null==r?void 0:r.length))return[2];this._database.delAll(),n={},t&&(null==r||r.forEach((function(e){n[e.roomId]=A(A([],P(n[e.roomId]||[]),!1),[e],!1)}))),i=Object.keys(n);try{for(o=L(i),a=o.next();!a.done;a=o.next())s=a.value,this._sendLocalQosData(n[s])}catch(e){c={error:e}}finally{try{a&&!a.done&&(u=o.return)&&u.call(o)}finally{if(c)throw c.error}}return[2]}}))}))}}),Object.defineProperty(e.prototype,"_sendLocalQosData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=0,i=[];try{for(var o=L(e),a=o.next();!a.done;a=o.next()){var s=a.value;i.push(s),(n+=s.byteLength)>=503316.48&&(this._sendLocalQosSliceData(i),i=[],n=0)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}n>0&&this._sendLocalQosSliceData(i)}}),Object.defineProperty(e.prototype,"_sendLocalQosSliceData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r=this;return I(this,(function(n){return t=function(){return C(r,void 0,void 0,(function(){var t=this;return I(this,(function(r){switch(r.label){case 0:return[4,this.sendLocalQosData(e)];case 1:return r.sent()!==ga.REPORT_SUCCESS&&e.forEach((function(e){t._database.put(e)})),[2]}}))}))},this._localQosDataQueue.push(t),[2]}))}))}}),Object.defineProperty(e.prototype,"_refetchNaviInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var t,r,n;return I(this,(function(i){switch(i.label){case 0:return[4,(o=this._context,C(void 0,void 0,void 0,(function(){var e;return I(this,(function(t){switch(t.label){case 0:return[4,o.getPluginContext().refetchNaviInfo()];case 1:return t.sent(),[2,{naviInfo:e=o.getNaviInfo(),jwt:yi(e)}]}}))})))];case 1:return t=i.sent(),r=t.jwt,n=t.naviInfo,Mi.jwtToken=r,e.logServer=null==n?void 0:n.logServer,e.dc=null==n?void 0:n.dc,[2]}var o}))}))}}),Object.defineProperty(e.prototype,"_getRealResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,r=e.indexOf("_tiny");return r>-1&&(t=e.slice(0,r)),t}}),Object.defineProperty(e.prototype,"_getPolarisTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="",r=e.split("_");if(e.includes("_tiny")){var n=r.pop(),i=parseInt(r.pop())===Bo.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,n,i].join("_")}else{i=parseInt(r.pop())===Bo.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,i].join("_")}return t}}),Object.defineProperty(e.prototype,"_formatReportBaseData",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,n,i=$e.getMemo();return{type:t,appKey:this._context.getAppkey(),sessionId:this._crtRTCRoom.getSessionId(),roomId:this._roomId,roomCreateTime:this._context.roomCreateTime||0,userId:this._context.getCurrentId(),userRole:this._userRole,joinTime:this._context.userJoinTime||0,signalDataCenter:e.dc||"",iceStatus:Sa[null===(r=i.iceNewStatusData)||void 0===r?void 0:r.status],subIceStatus:Sa[null===(n=i.subIceNewStatusData)||void 0===n?void 0:n.status]}}}),Object.defineProperty(e.prototype,"_formatReportData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=this._formatReportBaseData(e),i={};switch(e){case va.R1:i=this._formatR1Data();break;case va.R2:i=this._formatR2Data(t);break;case va.R3:case va.R4:case va.R3R4:i=this._formatR3R4Data(e,t)}return O(O({},n),((r={})[{R1:"r1Info",R2:"r2Info",R3:"r3Info",R4:"r4Info",R3R4:"r3r4Info"}[e]]=i,r))}}),Object.defineProperty(e.prototype,"_formatR1Data",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{joinTime:this._context.userJoinTime||0,rtcVersion:"5.7.3-enterprise-alpha.8",imVersion:this._context.getCoreVersion(),platform:"web",device:navigator.platform,os:String(pi),browserName:Ro.browser,browserVersion:String(Ro.version),receiveTime:Date.now()}}}),Object.defineProperty(e.prototype,"_formatR2Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=$e.getMemo(),n=e.action,i=e.status,o=e.trackIds,a=so(o[0]).identifier;return{joinTime:this._context.userJoinTime||0,sendTime:Date.now(),rtcActionType:n,rtcActionStatus:i,trackId:o,receiveTime:Date.now(),userId:n===ya.SUBSCRIBE?null===(t=r.meidToUserIdMap)||void 0===t?void 0:t[a]:""}}}),Object.defineProperty(e.prototype,"_formatR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i=this,a=$e.getMemo(),s=t.iceCandidatePair,c=t.senders,u=t.receivers,l=0,d=[],_=[],p=[],f=[],b=[];return e===va.R3?(this.timesOfR3Report+=1,l=(null==s?void 0:s.bitrateSend)||pi,d=c.map((function(e){var t,r=e.trackId,n=e.audioLevel,o=e.samplingRate,a=e.bitrate,s=e.packetsLostRate,c=e.frameRate,u=e.frameWidth,l=e.frameHeight,d=e.googRenderDelayMs,_=e.jitter,p=e.nackCount,f=e.pliCount,b=e.rtt,m=e.googFirsSent,h=e.encoderImplementation;e.ssrc;var g=e.framesEncoded;e.qpSum;var v=i._getPolarisTrackId(r),R=i._getRealResourceId(r);return{trackId:v,userId:i._crtRTCRoom.getCrtUserId(),codeName:h||String(pi),volume:String(n||0===n?n:pi),samplingRate:o||pi,bitRate:a||0===a?a:pi,packetLossRate:s||0===s?s:pi,frameRate:c||pi,resolution:u&&l?"".concat(u," * ").concat(l):"".concat(pi),blockTime:d,jitterData:_||pi,nAckCount:String(p||0===p?p:pi),pliCount:String(f||0===f?f:pi),googleRTTTotalTime:b||pi,isReceiveFirstFrameRate:m,codeType:h||String(pi),isEnabled:(null===(t=i._crtRTCRoom.getLocalTrack(R))||void 0===t?void 0:t.isLocalMuted())?ma.DISABLE:ma.ENABLE,googTargetEncBitrate:-1,googActualEncBitrate:-1,googRetransmitBitrate:-1,rongFecBitrate:-1,framesEncoded:g,googFrameRateInput:-1,framesDroppedByCapturer:-1,framesDroppedByBwLimit:-1,framesDroppedByEncoderQueue:-1,framesDroppedByEncoder:-1,packetsFractionLost:-1}}))):e===va.R4?(this.timesOfR3Report+=1,l=(null==s?void 0:s.bitrateRecv)||pi,d=u.filter((function(e){return!!e.trackId})).map((function(e){var t,r,n=e.trackId,o=e.audioLevel,s=e.samplingRate,c=e.bitrate,u=e.packetsLostRate,l=e.frameRate,d=e.frameWidth,_=e.frameHeight,p=e.googRenderDelayMs,f=e.jitter,b=e.nackCount,m=e.pliCount,h=e.rtt,g=e.googFirsReceived,v=e.codecImplementationName;e.ssrc;var R=e.totalFreezesDuration,S=e.freezeCount,y=e.totalPausesDuration,T=e.pauseCount,E=e.packetsLost,O=e.packetsReceived,C=i._getPolarisTrackId(n),I=i._getRealResourceId(n);return{trackId:C,userId:null===(t=a.meidToUserIdMap)||void 0===t?void 0:t[so(C).identifier],codeName:v||String(pi),volume:String(o||0===o?o:pi),samplingRate:s||pi,bitRate:c||0===c?c:pi,packetLossRate:u||0===u?u:pi,frameRate:l||pi,resolution:d&&_?"".concat(d," * ").concat(_):"".concat(pi),blockTime:p,jitterData:f||pi,nAckCount:String(b||0===b?b:pi),pliCount:String(m||0===m?m:pi),googleRTTTotalTime:h||pi,isReceiveFirstFrameRate:g,codeType:v||String(pi),isEnabled:(null===(r=i._crtRTCRoom.getRemoteTrack(I))||void 0===r?void 0:r.isLocalMuted())?ma.DISABLE:ma.ENABLE,googFrameRateDecoded:-1,retransmitBytes:-1,FECBytes:-1,googFrameRateOutput:-1,googFirstFrameReceivedToDecodedMs:-1,googFirsSent:-1,freezeCount:S,freezesDurationMs:R,pausesDurationMs:y,totalSamplesDuration:-1,rongE2eDelayMs:-1,CurrentDelayMs:-1,googTargetDelayMs:-1,googJitterBufferMs:-1,rongAvSyncMs:-1,googDecodingPLC:-1,googDecodingPLCCNG:-1,googExpandRate:-1,googSpeechExpandRate:-1,googAccelerateRate:-1,rongFirstFrameStartedToDecodeMs:-1,googNackMaxContSeqsSent:-1,googNackSeqsSent:-1,googNackUniqueSeqsSent:-1,discardedPackets:-1,recvFrameCleanCount:-1,packetLossFraction:-1,pausesCount:T,framesDurationsMs:-1,googMaxDecodeMs:-1,packetsFractionLost:E,muteRate:-1,googPreemptiveExpandRate:-1,googPreferredJitterBufferMs:-1,rongPlcMs:-1,googDecodingNormal:-1,packetsReceived:O}}))):e===va.R3R4&&(u.forEach((function(e){var t,r,n;if(e.trackId){var c=e.trackId,u=e.audioLevel,l=e.samplingRate,d=e.bitrate,_=e.packetsLostRate,p=e.frameRate,m=e.frameWidth,h=e.frameHeight,g=e.googRenderDelayMs,v=e.jitter,R=e.nackCount,S=e.pliCount,y=e.rtt,T=e.googFirsReceived,E=e.codecImplementationName,O=e.ssrc,C=e.totalFreezesDuration,I=e.freezeCount,L=e.totalPausesDuration,P=e.pauseCount;e.packetsLost;var A=e.packetsReceived,w=e.bytesReceived,k=e.qosFrozenCnt,D=e.qosFrozenDur,N=e.qosCDur,M=e.qosWithPLCFrozenCnt,U=e.qosWithPLCFrozenDur,j=i._getPolarisTrackId(c),B=i._getRealResourceId(c),x={trackId:j,userId:null===(t=a.meidToUserIdMap)||void 0===t?void 0:t[so(j).identifier],codeName:E||String(pi),volume:String(u||0===u?u:pi),samplingRate:l||pi,bitRate:d||0===d?d:pi,packetLossRate:_||0===_?_:pi,frameRate:p||pi,resolution:m&&h?"".concat(m," * ").concat(h):"".concat(pi),blockTime:g,jitterData:v||pi,nAckCount:String(R||0===R?R:pi),pliCount:String(S||0===S?S:pi),googleRTTTotalTime:y||pi,isReceiveFirstFrameRate:T,codeType:E||String(pi),isEnabled:(null===(r=i._crtRTCRoom.getRemoteTrack(B))||void 0===r?void 0:r.isLocalMuted())?ma.DISABLE:ma.ENABLE,streamCode:null===(n=i._crtRTCRoom.getRemoteTrack(B))||void 0===n?void 0:n.getDeviceAvailable(!0)};e.kind===ki.AUDIO&&f.push({streamInfo:x,ssrc:Number(O)||pi,bytesReceived:w||pi,retransmitBytes:pi,packetsReceived:A||pi,rongE2eDelayMs:pi,googDecodingPLC:pi,decodingNormal:pi,muteRate:pi,googDecodingPLCCNG:pi,googExpandRate:pi,googSpeechExpandRate:pi,googAccelerateRate:pi,googPreemptiveExpandRate:pi,googNackMaxContSeqsSent:pi,googPacketLostRate:pi,googNackSeqsSent:pi,googJitterBufferMs:pi,googCurrentDelayMs:pi,freezesDurationMs:C||pi,rongPlcMs:pi,totalSamplesDuration:pi,maxSeqNum:pi,cdur:o(N)?N:pi,frdur:pi,audioFrozenDur:o(D)?D:pi,audioFrozenCnt:o(k)?k:pi,audioFrozenDurWithPlc:o(U)?U:pi,audioFrozenCntWithPlc:o(M)?M:pi}),e.kind===ki.VIDEO&&b.push({streamInfo:x,ssrc:Number(O)||pi,bytesReceived:w||pi,retransmitBytes:pi,FECBytes:pi,googFrameRateInput:pi,googFrameRateDecoded:pi,googFrameRateOutput:pi,googFirstFrameReceivedToDecodedMs:pi,googNackMaxContSeqsSent:pi,googPacketLostRate:pi,googNackSeqsSent:pi,packetsReceived:A||pi,rongFirstFrameStartedToDecodeMs:pi,packetLoss:(null==s?void 0:s.totalPacketsLost)||pi,freezeCount:I||pi,freezesDurationMs:C||pi,pausesCount:P||pi,pausesDurationMs:L||pi,googMaxDecodeMs:pi,rongE2eDelayMs:pi,googCurrentDelayMs:pi,googTargetDelayMs:pi,googJitterBufferMs:pi,rongAvSyncMs:pi,discardedPackets:pi,recvFrameCleanCount:pi,cdur:o(N)?N:pi,frdur:pi,videoFrozenDur:o(D)?D:pi,videoFrozenCnt:o(k)?k:pi})}})),c.forEach((function(e){var t,r,n;if(e.trackId){var o=e.trackId,s=e.audioLevel,c=e.samplingRate,u=e.bitrate,l=e.packetsLostRate,d=e.frameRate,f=e.frameWidth,b=e.frameHeight,m=e.googRenderDelayMs,h=e.jitter,g=e.nackCount,v=e.pliCount,R=e.rtt,S=e.googFirsSent,y=e.encoderImplementation,T=e.ssrc,E=e.framesEncoded,O=e.bytesSent,C=e.packetsLost,I=e.qpSum,L=e.googActualEncBitrate,P=e.rongFecBitrate,A=e.googTargetEncBitrate,w=e.googRetransmitBitrate,k=i._getPolarisTrackId(o),D=i._crtRTCRoom.getLocalTrack(e.trackId),N={trackId:k,userId:i._crtRTCRoom.getCrtUserId(),codeName:y||String(pi),volume:String(s||0===s?s:pi),samplingRate:c||pi,bitRate:u||0===u?u:pi,packetLossRate:l||0===l?l:pi,frameRate:d||pi,resolution:f&&b?"".concat(f," * ").concat(b):"".concat(pi),blockTime:m,jitterData:h||pi,nAckCount:String(g||0===g?g:pi),pliCount:String(v||0===v?v:pi),googleRTTTotalTime:R||pi,isReceiveFirstFrameRate:S,codeType:y||String(pi),isEnabled:(null===(t=i._crtRTCRoom.getLocalTrack(e.trackId))||void 0===t?void 0:t.isLocalMuted())?ma.DISABLE:ma.ENABLE,isActive:(null==D?void 0:D.isPause())?0:1,streamCode:null==D?void 0:D.getDeviceAvailable(!0)};e.kind===ki.AUDIO&&_.push({streamInfo:N,ssrc:Number(T)||pi,bytesSent:O||pi,googTargetEncBitrate:A||pi,googActualEncBitrate:L||pi,googRetransmitBitrate:w||pi,maxSeqNum:pi}),e.kind===ki.VIDEO&&p.push({streamInfo:N,ssrc:Number(T)||pi,bytesSent:O||pi,packetsFractionLost:C||pi,googTargetEncBitrate:A||pi,googActualEncBitrate:L||pi,googRetransmitBitrate:w||pi,rongFecBitrate:P||pi,framesEncoded:E||pi,framesDroppedByCapturer:pi,framesDroppedByBwLimit:pi,framesDroppedByEncoderQueue:pi,framesDroppedByEncoder:pi,googFrameRateInput:pi,videoQp:I||pi,enableVirtualBG:a.openVirtualBG&&((null===(r=a.openBG)||void 0===r?void 0:r[D.uuid])||(null===(n=a.openBlur)||void 0===n?void 0:n[D.uuid]))?1:0})}}))),{info:{joinTime:this._context.userJoinTime||0,receiveTime:Date.now(),totalBitRate:l,appCPUUsage:-1,systemCPUUsage:-1,systemCPUFrequency:-1,networkStatus:(null==s?void 0:s.networkType)||"unknown",googleRTTNetwork:(null==s?void 0:s.rtt)?parseFloat("".concat(null==s?void 0:s.rtt)):pi,ipAddress:"".concat((null==s?void 0:s.IP)||pi,":").concat(null==s?void 0:s.port),useReceiveBroadBand:String((null==s?void 0:s.availableIncomingBitrate)||pi),useSendBroadBand:String((null==s?void 0:s.availableOutgoingBitrate)||pi),packetLossCount:String((null==s?void 0:s.totalPacketsLost)||pi),streams:d,googTargetEncBitrate:-1,googRetransmitBitrate:-1,googTransmitBitrate:-1,googBucketDelay:-1,upLinkLossrate:-1,rongNetOffsetMs:-1,rongPreBweBps:-1,rongAvgRttMs:-1,sendAudioStreams:_,sendVideoStreams:p,recvAudioStreams:f,recvVideoStreams:b,rtcVersion:"5.7.3-enterprise-alpha.8",imVersion:this._context.getCoreVersion(),platform:"web",iceStatus:Sa[null===(r=a.iceNewStatusData)||void 0===r?void 0:r.status],subIceStatus:Sa[null===(n=a.subIceNewStatusData)||void 0===n?void 0:n.status],xorMode:0,startAudioDeviceCount:-1,sequenceId:-1,rongMaxRttMs:-1,iceDecoupleMode:0,remoteAddress:localStorage.getItem("__fast_media_url__")||"",deviceInfo:"",group:a.group||""}}}}),Object.defineProperty(e.prototype,"sendR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t=!1),C(this,void 0,void 0,(function(){var r,n;return I(this,(function(i){return r="".concat(this._sequenceId++),n=this._formatReportData(va.R3R4,e),this._context.saveRTCState(n,va.R3R4,r),t||this.reportLocalQosDataToPolaris(),[2,ga.REPORT_SUCCESS]}))}))}}),Object.defineProperty(e.prototype,"sendLocalQosData",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,n;return C(this,void 0,void 0,(function(){var i,o;return I(this,(function(a){switch(a.label){case 0:return(i=e.logServer)&&this._useHttp?!1===$e.getMemo().sendQos?[2,ga.REPORT_FAIL]:[4,this._context.setRTCQosDataByHttp(i,this._runtime,t)]:[2,ga.REPORT_FAIL];case 1:return(o=a.sent())===ga.REPORT_SUCCESS?[2,ga.REPORT_SUCCESS]:(null===(n=null===(r=this._context)||void 0===r?void 0:r.logger)||void 0===n||n.info(T.L_HTTP_POLARIS_REPORT_FAIL_O,"send data fail -> code: ".concat(o)),[2,ga.REPORT_FAIL])}}))}))}}),Object.defineProperty(e.prototype,"sendR1",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e;return I(this,(function(t){switch(t.label){case 0:return e=this._formatReportData(va.R1),[4,this._send(e,va.R1,"".concat(this._sequenceId++))];case 1:return t.sent(),[2]}}))}))}}),Object.defineProperty(e.prototype,"sendR2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n;return I(this,(function(i){switch(i.label){case 0:return n=this._formatReportData(va.R2,{action:e,status:t,trackIds:r}),[4,this._send(n,va.R2,"".concat(this._sequenceId++))];case 1:return i.sent(),[2]}}))}))}}),e}(),Aa=function(){function e(e,t){Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_audioLevelChangeHandler",{enumerable:!0,configurable:!0,writable:!0,value:null})}return Object.defineProperty(e.prototype,"audioLevelReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;if(this._audioLevelChangeHandler){var r=[],n=$e.getMemo();e.forEach((function(e){var i,o=so(e.trackId).identifier,a=null===(i=n.meidToUserIdMap)||void 0===i?void 0:i[o],s=t._store.crtUserId===a?t._peer.getLocalTrack(e.trackId):t._store.getRemoteTrack(e.trackId);s&&r.push({track:s,audioLevel:e.audioLevel||0,userId:a,detectAudioLevel:n.micAudioLevel})})),this._audioLevelChangeHandler(r)}}}),Object.defineProperty(e.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._audioLevelChangeHandler=e}}),e}();!function(e){e.UNPUBLISH_PREV="UnpublishPrevCommand",e.PULL_RTCROOM_STATUS="PullRTCRoomStatusCommand",e.JOINROOM="JoinRoomCommand",e.MeetingJoinRoomCommand="MeetingJoinRoomCommand",e.MeetingAudioSubCommand="MeetingAudioSubCommand",e.MeetingVideoSubCommand="MeetingVideoSubCommand",e.MeetingVideoUnsubCommand="MeetingVideoUnsubCommand",e.MeetingUpdateVideoSubListCommand="MeetingUpdateVideoSubListCommand",e.MeetingUnsubCommand="MeetingUnsubCommand",e.PARSE_REMOTERES="ParseRemoteResCommand",e.PARSE_USERSTATE="ParseUserStateCommand",e.LOCAL_TRACK_MUTE="LocalTrackMuteCommand",e.LOCAL_TRACK_DEVICE_STATUS_CHANGE_MUTE="LocalTrackDeviceStatusChangeCommand",e.PUBLISH="PublishCommand",e.RETRY_EXCHANGE="RetryExchangeCommand",e.UNPUBLISH="UnpublishCommand",e.SUBSCRIBE="SubscribeCommand",e.ASYNC_COMMAND="AsyncCommand",e.UNSUBSCRIBE="UnsubscribeCommand",e.UPDATE_SUBSCRIBE_LIST="UpdateSubscribeListCommand",e.ON_SIGNAL_RECONNECTED="OnSignalReconnectedCommand",e.UNKNOWN="Unknown",e.MOCKJOINROOM="MockJoinRoomCommand",e.PUBLISH_AND_SUBSCRIBE="PublishAndSubscribeCommand",e.JOIN_MEETING_AND_ROOM="JoinMeetingAndRoomCommand",e.SubPeerReconnectCommand="SubPeerReconnectCommand",e.PULL_MEETING_AND_RTCROOM_STATUS="PullMeetingAndRTCRoomCommand",e.CONNECT_MEDIA_SERVER="connectMediaServerCommand",e.DISCONNECT_MEDIA_SERVER="disconnectMediaServerCommand",e.PULL_JOIN_MEETING_STATUS="pullJoinMeetingStatusCommand"}(Ea||(Ea={})),function(e){e[e.LOW=0]="LOW",e[e.NORMAL=1]="NORMAL",e[e.HIGH=2]="HIGH"}(Oa||(Oa={})),function(e){e[e.Destroy=40400]="Destroy"}(Ca||(Ca={}));var wa,ka=function(){function e(){}return Object.defineProperty(e.prototype,"priority",{get:function(){return Oa.LOW},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kind",{get:function(){return Ea.UNKNOWN},enumerable:!1,configurable:!0}),e}(),Da=function(){function e(e,t,r,n){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"abortCode",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_busy",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1})}return Object.defineProperty(e.prototype,"_next",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._busy=!1,this._execute()}}),Object.defineProperty(e.prototype,"_execute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t,r,n,i,o;return I(this,(function(a){switch(a.label){case 0:if(this._isDestroyed||this._busy||0===this._queue.length)return[2];this._busy=!0,e=this._queue.shift(),t=e.command,r=e.resolve,i=this._logger.createTraceId(),a.label=1;case 1:return a.trys.push([1,3,,4]),this._logger.info(T.L_INVOKER_EXECUTE_T,"kind: ".concat(t.kind,", length: ").concat(this._queue.length),i),[4,t.execute(this._context,this._store,this)];case 2:return n=a.sent(),[3,4];case 3:return a.sent(),this._logger.error(T.L_INVOKER_EXECUTE_R,t.kind,i),this._next(),[2];case 4:return(o=n.code)!==ze.SUCCESS&&o!==u.SUCCESS?this._logger.warn(T.L_INVOKER_EXECUTE_R,"code: ".concat(o,", kind: ").concat(t.kind),i):this._logger.info(T.L_INVOKER_EXECUTE_R,"kind: ".concat(t.kind,", Done"),i),r(n),this._next(),[2]}}))}))}}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t=this;return I(this,(function(r){return[2,new Promise((function(r){if(t._logger.info(T.L_INVOKER_PUSH_O,JSON.stringify({isDestroyed:t._isDestroyed,kind:e.kind,length:t._queue.length})),t._isDestroyed)r({code:ze.NOT_IN_ROOM});else{var n=e.priority;if(n===Oa.LOW)t._queue.push({command:e,resolve:r});else{var i=t._queue.findIndex((function(e){return e.command.priority<n})),o=-1===i?t._queue.length-1:i;t._queue.splice(o,0,{command:e,resolve:r})}setTimeout((function(){t._execute()}),0)}}))]}))}))}}),Object.defineProperty(e.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(e.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._isDestroyed||(this._logger.info(T.L_INVOKER_DESTROY_O,JSON.stringify({isDestroyed:this._isDestroyed})),this._isDestroyed=!0,this._queue.forEach((function(t){t.resolve({code:e.abortCode})})),this._queue.length=0)}}),e}(),Na=function(e){function t(t,r){return e.call(this,t.logger,t,r,ze.ROOM_HAS_BEEN_DESTROYED)||this}return y(t,e),Object.defineProperty(t.prototype,"store",{get:function(){return this._context.store},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype.destroy.call(this),this._store.removeRemoteTracks()}}),t}(Da),Ma=function(e){function t(t,r,n,i,o,a){var s=e.call(this,t,r,n,i,o,!1,a)||this;return Object.defineProperty(s,"_isSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_isPreSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),s}return y(t,e),Object.defineProperty(t.prototype,"__innerSetRemoteMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._remoteMuted=e}}),Object.defineProperty(t.prototype,"__innerSetSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isSubscribed=e}}),Object.defineProperty(t.prototype,"isSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isSubscribed}}),Object.defineProperty(t.prototype,"__innerSetPreSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isPreSubscribed=e}}),Object.defineProperty(t.prototype,"isPreSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isPreSubscribed}}),t}(xi),Ua=function(e){function t(t,r,n,i,o){return e.call(this,t,r,n,i,"audio",o)||this}return y(t,e),Object.defineProperty(t.prototype,"getVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return 100*((null===(e=this._element)||void 0===e?void 0:e.volume)||0)}}),t}(Ma),ja=function(e){function t(t,r,n,i,o){var a=e.call(this,t,r,n,i,"video",o)||this;return Object.defineProperty(a,"_isSubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),a}return y(t,e),Object.defineProperty(t.prototype,"__innerSetIsTinyTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isSubTiny=e}}),Object.defineProperty(t.prototype,"isSubTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isSubTiny}}),t}(Ma);!function(e){e.Muted="muted"}(wa||(wa={}));var Ba,xa=function(){function e(){Object.defineProperty(this,"_retryTimerMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_retryLockMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_retryGap",{enumerable:!0,configurable:!0,writable:!0,value:2e3}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:5e3}),Object.defineProperty(this,"_retrySignalMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}return Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._getQueue(e.name);t.push(e.execute),this._setQueue(e.name,t),this.retry(e.name)}}),Object.defineProperty(e.prototype,"retry",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;if(!this._getLocked(e)){this._lock(e);var r=this._retryTimerMap.get(e);r&&(clearTimeout(r),this._clearTimer(e));var n,i=this._getQueue(e),o=i.shift();if(o)Promise.any([(n=this._timeout,new Promise((function(e){setTimeout((function(){e(u.TIMEOUT)}),n)}))),o()]).then((function(n){if(t._unlock(e),i.length>0){var a=i.pop();i.length=0,i.push(a),t.retry(e)}else n!==u.SUCCESS&&(i.push(o),r=setTimeout((function(){t.retry(e)}),t._retryGap),t._setTimer(e,r))}));else this._unlock(e)}}}),Object.defineProperty(e.prototype,"_lock",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._retryLockMap.set(e,!0)}}),Object.defineProperty(e.prototype,"_unlock",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._retryLockMap.set(e,!1)}}),Object.defineProperty(e.prototype,"_getLocked",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._retryLockMap.get(e)}}),Object.defineProperty(e.prototype,"_getQueue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._retrySignalMap.get(e)||[]}}),Object.defineProperty(e.prototype,"_setQueue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._retrySignalMap.set(e,t)}}),Object.defineProperty(e.prototype,"_clearTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._retryTimerMap.delete(e)}}),Object.defineProperty(e.prototype,"_setTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._retryTimerMap.set(e,t)}}),e}(),Fa=function(){function e(e,t,r,n,i,o,a,s,c,u){void 0===c&&(c=!1),void 0===u&&(u=!1),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"roomMode",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"isUpgrade",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"isMainRoom",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"isMeetingMode",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"is1v1CallMode",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_roomResources",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_collectSubscribeList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_token",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_trackIdSSRCMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_roomStatusVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"retrySignalingMannger",{enumerable:!0,configurable:!0,writable:!0,value:new xa}),Object.defineProperty(this,"_meidToUserIdMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_userIdToMeidMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_supportNtf",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"meetingAudioSubCommandStamp",{enumerable:!0,configurable:!0,writable:!0,value:0})}return Object.defineProperty(e.prototype,"getResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._roomResources[e]}}),Object.defineProperty(e.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._remoteTracks[e]}}),Object.defineProperty(e.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];for(var r in this._remoteTracks){var n=this._remoteTracks[r];n.getUserId()===e&&t.push(n)}return t}}),Object.defineProperty(e.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteTracks}}),Object.defineProperty(e.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(e.prototype,"getAllUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.keys(this._roomResources)}}),Object.defineProperty(e.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this.getAllUserIds().filter((function(t){return t!==e.crtUserId}))}}),Object.defineProperty(e.prototype,"getSubscribedList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subscribedList}}),Object.defineProperty(e.prototype,"getCollectSubscribeList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._collectSubscribeList}}),Object.defineProperty(e.prototype,"getPublishedResourceByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=so(e).identifier,n=this.getUserIdByMeid(r);return null===(t=this._roomResources[n])||void 0===t?void 0:t.find((function(t){return ao(t)===e}))}}),Object.defineProperty(e.prototype,"getToken",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._token}}),Object.defineProperty(e.prototype,"getRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomStatusVersion}}),Object.defineProperty(e.prototype,"getTrackIdBySSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._trackIdSSRCMap.get(e)}}),Object.defineProperty(e.prototype,"getRTCRequestHeader",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{"App-Key":this.appkey,RoomId:this.roomId,Token:this._token,RoomType:this.roomMode,UserId:this.crtUserId,"Client-Session-Id":this.clientSessionId}}}),Object.defineProperty(e.prototype,"getSupportNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._supportNtf}}),Object.defineProperty(e.prototype,"getUserIdByMeid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._meidToUserIdMap[e]}}),Object.defineProperty(e.prototype,"getMeidByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._userIdToMeidMap[e]}}),Object.defineProperty(e.prototype,"setRelationshipMapBetweenUserIdAndMeid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=$e.getMemo();this._meidToUserIdMap[e]=t,this._userIdToMeidMap[t]=e,r.meidToUserIdMap=this._meidToUserIdMap,r._userIdToMeidMap=this._userIdToMeidMap}}),Object.defineProperty(e.prototype,"setTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=$e.getMemo(),n=t.includes("_tiny"),i=t;n&&(i=t.slice(0,-5));var o=so(i),a=o.identifier,s=o.mediaType,c=o.tag,u=n?"".concat(uo(a,c),"_tiny"):uo(a,c);a===bo(this.crtUserId)&&(r.myFirstPublishResources?r.myFirstPublishResources.filter((function(e){return e.mediaType===s&&e.msid===u}))[0]||r.myFirstPublishResources.push({mediaType:s,msid:u,ssrc:String(e)}):r.myFirstPublishResources=[{mediaType:s,msid:u,ssrc:String(e)}]);this._trackIdSSRCMap.set(e,t)}}),Object.defineProperty(e.prototype,"setMeetingAudioSubCommandStamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.meetingAudioSubCommandStamp=e}}),e}(),Va=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return y(t,e),Object.defineProperty(t.prototype,"_updateTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Object.values(this._roomResources).forEach((function(t){t.forEach((function(t){var r,n=JSON.parse(t.uri),i=n.ssrc,o=n.tag,a=n.meid,s=n.mediaType,c=n.resourceId,u=n.userId;r=c||lo(a||u,o,s),e.setTrackIdSSRCMap(i,r)}))}))}}),Object.defineProperty(t.prototype,"_initRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=$e.getMemo();this.setRelationshipMapBetweenUserIdAndMeid(bo(this.crtUserId),this.crtUserId);var r=function(r){var i=n._roomResources[r];if(r===n.crtUserId||0===i.length)return"continue";i.forEach((function(n){var i,o,a=ao(n);if(!e._remoteTracks[a]){var s=n.ssrc;if(s){var c=null===(o=t.prePubUserBySSRC)||void 0===o?void 0:o[s];c&&(t.replacePreTrackIdMap=O(O({},t.replacePreTrackIdMap),((i={})[a]=lo(c.meid,void 0,n.mediaType),i)))}var u=so(a),l=u.tag,d=u.identifier,_=u.mediaType;e.setRelationshipMapBetweenUserIdAndMeid(d,r);var p=_===Bo.AUDIO_ONLY?new Ua(e._logger,l,r,d):new ja(e._logger,l,r,d);p.__innerSetRemoteMuted(0===n.state),p.updateDeviceAvailable(n.code||Ai.RCRTCStreamCodeDefault),e._remoteTracks[a]=p}}))},n=this;for(var i in this._roomResources)r(i)}}),Object.defineProperty(t.prototype,"initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._sessionId=e.sessionId,this._token=e.token,this._roomStatusVersion=Lo(e.version),this._roomResources=Oo(e,this.roomId,this._logger,t),this._updateTrackIdSSRCMap(),this._initRemoteTracks(),this.setResourcesByUserId(this.crtUserId,this.getResourcesByUserId(this.crtUserId)||[]),this._logger.info(T.L_PARSE_ROOMDATA_URIS_R,"room data -> ".concat(JSON.stringify(this._roomResources)),t)}}),Object.defineProperty(t.prototype,"assignRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){Object.assign(this._roomResources,e),this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"setResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._roomResources[e]=t,this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"removeRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){delete this._remoteTracks[e]}}),Object.defineProperty(t.prototype,"removeResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){delete this._roomResources[e],this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"addRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._remoteTracks[e.getTrackId()]=e}}),Object.defineProperty(t.prototype,"removeRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._remoteTracks);e.length&&(e.forEach((function(e){e.isAudioTrack()&&e.__releaseMediaElement()})),this._remoteTracks={})}}),Object.defineProperty(t.prototype,"resetSubscribedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(t=this._subscribedList).splice.apply(t,A([0,this._subscribedList.length],P(e),!1)),this.resetCollectSubscribeList(e)}}),Object.defineProperty(t.prototype,"resetCollectSubscribeList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(t=this._collectSubscribeList).splice.apply(t,A([0,this._collectSubscribeList.length],P(e),!1))}}),Object.defineProperty(t.prototype,"setRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._roomStatusVersion=Lo(e)}}),t}(Fa),Ja=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.UNPUBLISH_PREV},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s;return I(this,(function(c){switch(c.label){case 0:return r=e.logger,n=e.context,i=t.getResourcesByUserId(t.crtUserId),o=i.slice(),i.length=0,a=r.createTraceId(),r.info(T.L_UNPUBLISH_PREV_COMMAND_T,JSON.stringify({resource:o}),a),[4,n.setRTCTotalRes(t.roomId,to([]),wo.TOTAL_CONTENT_RESOURCE)];case 1:return(s=c.sent())!==u.SUCCESS?r.error(T.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:E.FAILED,code:s}),a):r.info(T.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:E.SUCCEEDED}),a),[2,{code:ze.SUCCESS}]}}))}))}}),t}(ka),Ha=function(e){function t(t,r,n,i,o,a){var s=e.call(this)||this;return Object.defineProperty(s,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.JOINROOM},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(e.getConnectionStatus()!==i.CONNECTED)return t.error(r,JSON.stringify({status:E.FAILED,code:ze.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:ze.SIGNAL_DISCONNECTED};if(e.getNaviInfo(),!s("roomId",this.roomId,l,!0))return t.error(r,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:ze.PARAMS_ERROR};if(!s("roomType",this.roomType,(function(e){return void 0!==Ji[e]})))return t.error(r,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:ze.PARAMS_ERROR};if(!s("outerUserDatas",this.outerUserDatas,c,!1))return t.error(r,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:ze.PARAMS_ERROR};if(this.outerUserDatas&&!Object.keys(this.outerUserDatas).every((function(e){return s("outerUserDatas.".concat(e),n.outerUserDatas[e],d,!0)})))return t.error(r,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:ze.PARAMS_ERROR};return{code:ze.SUCCESS}}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,l,d,_,p,f,b;return I(this,(function(m){switch(m.label){case 0:return n=Date.now(),i=e.context,o=e.service,a=e.logger,s=e.reportMediaActionLogger,c=T.L_RTC_CLIENT_JOIN_RTC_ROOM_R,(l=this._validateParams(i,a,c).code)!==ze.SUCCESS?[2,{code:l}]:(o.detectorMediaSever(),o.getNaviMS().length?(d=t.getSupportNtf(),[4,i.joinRTCRoom(this.roomId,this.roomType,this.joinType,this.innerUserDatas,this.outerUserDatas,d)]):(a.error(c,JSON.stringify({status:E.FAILED,code:ze.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),[2,{code:ze.NOT_OPEN_VIDEO_AUDIO_SERVER}]));case 1:return _=m.sent(),p=_.code,f=_.data,s.reportQualityJoinRoomData(n,p,this.roomType,null==f?void 0:f.sessionId),p===u.SUCCESS&&f?(t.initWithRoomData(f,this.traceId),t.getResourcesByUserId(t.crtUserId).length>0&&r.push(new Ja),a.info(c,JSON.stringify({status:E.SUCCEEDED,userId:t.crtUserId,roomId:this.roomId}),this.traceId),[2,{code:ze.SUCCESS,data:f}]):(b=40032===p?ze.SIGNAL_JOIN_RTC_ROOM_REFUSED:p,a.error(c,JSON.stringify({status:E.FAILED,code:b,msg:"joinRoom failed"}),this.traceId),[2,{code:b}])}}))}))}}),t}(ka),Ga="PEER_CONNECTION_CLOSED_BY_EXCEPTION",qa="USER_JOIN",Ka="USER_LEAVE",Wa="TRACKS_PUBLISH",za="TRACKS_UNPUBLISH",Qa="AUDIO_MUTE_CHANGE",Ya="VIDEO_MUTE_CHANGE",Za="USER_STATE_CHANGE",Xa="TRACKS_DEVICE_CHANGE",$a=function(e){function t(t,r,n,i,o,a,s,c,u){var l=e.call(this)||this;return Object.defineProperty(l,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(l,"service",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(l,"context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(l,"runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(l,"peer",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(l,"store",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(l,"polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(l,"reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(l,"subPeer",{enumerable:!0,configurable:!0,writable:!0,value:u}),l}return y(t,e),t}(a),es=function(e){function t(t,r){void 0===r&&(r=!1);var n=e.call(this)||this;return Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"ignoreCheck",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.MeetingUpdateVideoSubListCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l,d,_,p,f;return I(this,(function(b){switch(b.label){case 0:if(e.logger,r=e.subPeer,!this.ignoreCheck&&(n=[],i=this.tracks.map((function(e){return e instanceof Ma?(n.push({subTiny:!1,track:e}),e):(n.push(e),e.track)})),o=t.getSubscribedList().filter((function(e){return e.track.isVideoTrack()})),i.length===o.length&&i.every((function(e){return e.isSubscribed()}))&&n.every((function(e){return e.subTiny===e.track.isSubTiny()}))))return[2,{code:ze.SUCCESS}];for(_ in a=[],this.tracks.forEach((function(e){var r=e instanceof Ma?{subTiny:!1,track:e}:e,n=r.subTiny,i=r.track;t.getPublishedResourceByTrackId(i.getTrackId())&&i.isVideoTrack()&&a.push({mslabel:i.getStreamId(),simulcast:!!n,uri:t.getPublishedResourceByTrackId(i.getTrackId()).uri,userId:i.getUserId()})})),s=t.getRemoteTracks(),c=function(e){var t=s[e];if(t.isAudioTrack())return"continue";a.every((function(e){return e.mslabel!==t.getStreamId()}))&&t.__innerSetMediaStreamTrack(void 0)},s)c(_);for(_ in u=[],l=[],this.tracks.forEach((function(e){var t=e instanceof Ma?{track:e}:e;u.push(t)})),d=function(e){var t=s[e];if(t.isAudioTrack())return"continue";var r=u.some((function(e){return e.track===t}));t.__innerSetSubscribed(r);var n=a.some((function(t){return"".concat(t.mslabel,"_1")===e&&t.simulcast}));t.__innerSetIsTinyTrack(n)},s)d(_);return(p=t.getSubscribedList().filter((function(e){return e.track.isAudioTrack()}))).push.apply(p,A([],P(u),!1)),t.resetSubscribedList(p),[4,r.updateVideoSubList(a)];case 1:return(f=b.sent().code)!==ze.SUCCESS?[2,{code:f}]:[2,{code:f,failedList:l}]}}))}))}}),t}(ka),ts=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.MeetingVideoUnsubCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o=this;return I(this,(function(a){return n=t.getSubscribedList().filter((function(e){return e.track.isVideoTrack()})),i=n.filter((function(e){return!o.tracks.includes(e.track)})),n.length===i.length?[2,{code:ze.SUCCESS}]:[2,new es(i).execute(e,t,r)]}))}))}}),t}(ka),rs=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.MeetingUnsubCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o;return I(this,(function(a){switch(a.label){case 0:return n=e.subPeer,i=[],o=[],this.tracks.forEach((function(e){e.isAudioTrack()?o.push(e):i.push(e)})),[4,n.removeAudioSubList(o.map((function(e){return e.getStreamId()})))];case 1:return a.sent(),[2,new ts(i).execute(e,t,r)]}}))}))}}),t}(ka);!function(e){e.BEGIN="begin",e.END="end"}(Ba||(Ba={}));var ns,is,os,as=function(e){function t(t,r,n,i){var o=e.call(this)||this;return Object.defineProperty(o,"reqBody",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"isNeedUpdateMsas",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"pbMode",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return y(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var r,n,i,o,a;return I(this,(function(s){switch(s.label){case 0:return r=e.service,e.context,this.pbMode?[3,2]:[4,r.exchange(t.getRTCRequestHeader(),this.reqBody,this.traceId,this.isNeedUpdateMsas)];case 1:return n=s.sent(),[3,4];case 2:return[4,r.miniSDPExchange(t.getRTCRequestHeader(),this.reqBody,this.traceId)];case 3:n=s.sent(),s.label=4;case 4:return i=n.code,o=n.data,a=n.qualityMsList,[2,{code:i,data:{data:o,qualityMsList:a}}]}}))}))}}),t}(ka);!function(e){e[e["UDP/TLS/RTP/SAVPF"]=0]="UDP/TLS/RTP/SAVPF",e[e["RTP/AVPF"]=1]="RTP/AVPF",e[e["RTP/SAVPF"]=2]="RTP/SAVPF"}(ns||(ns={})),function(e){e[e.opus=0]="opus",e[e.PCMU=1]="PCMU",e[e.red=10]="red"}(is||(is={})),function(e){e[e.H264=0]="H264",e[e.VP8=1]="VP8",e[e.rtx=2]="rtx",e[e["flexfec-03"]=11]="flexfec-03"}(os||(os={}));var ss,cs=function(e){var t,r,n=JSON.stringify(e),i=$e.getMemo(),o=[];o.push(us());try{for(var a=L(i.answerInfo.midMap),s=a.next();!s.done;s=a.next()){var c=P(s.value,2),u=c[0],l=c[1],d=l.direction,_=l.msid,p=l.mediaType;"audio"===p?o.push(ds(e,{mid:u,msid:_,direction:d,mediaType:p})):"video"===p&&o.push(hs(e,{mid:u,msid:_,direction:d,mediaType:p}))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}var f=o.join("").replace(/\n+/g,"\n");return vi.info("miniSDPToAnswer: ",Ao(n),f),f},us=function(){var e,t,r=$e.getMemo();return"v=0\no=- 0 0 IN IP4 ".concat(null===(e=r.answerInfo)||void 0===e?void 0:e.ipAddr,"\ns=MediaServer4.0\nt=0 0\na=group:BUNDLE ").concat(null===(t=r.answerInfo)||void 0===t?void 0:t.groupBundle,"\na=msid-semantic: WMS *\n")},ls=function(e){var t="sendrecv";switch(e){case"sendonly":t="recvonly";break;case"recvonly":t="sendonly";break;default:t=e}return t},ds=function(e,t){var r,n,i,o,a,s,c,u=$e.getMemo(),l=ls(t.direction),d="m=audio 40001 ".concat(ns[e.dataFormat]," ").concat(null===(r=e.audioMedia)||void 0===r?void 0:r.codecs.map((function(e){return e.payload})).join(" "),"\nc=IN IP4 ").concat(null===(n=u.answerInfo)||void 0===n?void 0:n.ipAddr,"\na=rtcp:40001 IN IP4 ").concat(null===(i=u.answerInfo)||void 0===i?void 0:i.ipAddr,"\na=ice-ufrag:").concat(e.ifrag,"\na=ice-pwd:").concat(e.ipwd,"\na=ice-lite\na=fingerprint:").concat(e.fingerprint,"\na=candidate:").concat(e.candidates[0],"\na=candidate:").concat(e.candidates[1],"\na=setup:").concat(e.setup,"\na=mid:").concat(t.mid,"\n").concat(_s(e.audioMedia.ext),"\na=").concat(l,"\na=rtcp-mux\n").concat(ps(e),"\n").concat(fs(e),"\n").concat(bs(e),"\n");if("recvonly"!==l&&"inactive"!==l){var _=void 0;if(t.msid){var p=e.audioMedia.streams.findIndex((function(r){return"".concat(r.meid,"_").concat(r.tag||e.tag)===t.msid}));-1!==p&&(_=P(e.audioMedia.streams.splice(p,1),1)[0])}else _=e.audioMedia.streams.shift();if(_){var f=null===(a=null===(o=u.answerInfo)||void 0===o?void 0:o.midMap)||void 0===a?void 0:a.get(t.mid),b="".concat(_.meid,"_").concat(_.tag||e.tag);null===(c=null===(s=u.answerInfo)||void 0===s?void 0:s.midMap)||void 0===c||c.set(t.mid,O(O({},f),{msid:b})),d+=ms(_,b)}}return d},_s=function(e){var t="";return e.sal&&(t+="a=extmap:".concat(e.sal," urn:ietf:params:rtp-hdrext:ssrc-audio-level\n")),e.absts&&(t+="a=extmap:".concat(e.absts," http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\n")),e.tccno&&(t+="a=extmap:".concat(e.tccno," http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\n")),t},ps=function(e){var t=e.audioMedia.codecs.filter((function(e){return e.tp===is.red}))[0];if(t){var r=t.formatParameters.reduce((function(e,t){return"none"===t.key?""===e?"".concat(t.value):"".concat(t.value,";").concat(e):e=""===e?"".concat(t.key,"=").concat(t.value):"".concat(e,";").concat(t.key,"=").concat(t.value)}),"");return"a=rtpmap:".concat(t.payload," red/48000/2\na=fmtp:").concat(t.payload," ").concat(r,"\n")}return""},fs=function(e){var t=e.audioMedia.codecs.filter((function(e){return e.tp===is.opus}))[0];return t?"a=rtpmap:".concat(t.payload," opus/48000/2\na=rtcp-fb:").concat(t.payload," nack\na=fmtp:").concat(t.payload," minptime=10;useinbandfec=1;maxaveragebitrate=32000\n"):""},bs=function(e){var t=e.audioMedia.codecs.filter((function(e){return e.tp===is.PCMU}))[0];return t?"a=rtpmap:".concat(t.payload," PCMU/8000\n"):""},ms=function(e,t){var r,n=$e.getMemo();return"a=msid:".concat(t," ").concat(t,"_audio\na=ssrc:").concat(e.ssrc.main," cname:").concat(null===(r=n.answerInfo)||void 0===r?void 0:r.uid,"\na=ssrc:").concat(e.ssrc.main," msid:").concat(t," ").concat(t,"_audio\na=ssrc:").concat(e.ssrc.main," mslabel:").concat(t,"\na=ssrc:").concat(e.ssrc.main," label:").concat(t,"_audio\n")},hs=function(e,t){var r,n,i,o,a,s,c,u=$e.getMemo(),l=ls(t.direction),d="m=video 40001 ".concat(ns[e.dataFormat]," ").concat(e.videoMedia.codecs.map((function(e){return e.payload})).join(" "),"\nc=IN IP4 ").concat(null===(r=u.answerInfo)||void 0===r?void 0:r.ipAddr,"\na=rtcp:40001 IN IP4 ").concat(null===(n=u.answerInfo)||void 0===n?void 0:n.ipAddr,"\na=ice-ufrag:").concat(e.ifrag,"\na=ice-pwd:").concat(e.ipwd,"\na=ice-lite\na=fingerprint:").concat(e.fingerprint,"\na=setup:").concat(e.setup,"\na=mid:").concat(t.mid,"\n").concat(function(e){var t;return null===(t=e.candidates)||void 0===t||t.forEach((function(e){})),""}(e),"\n").concat(_s(e.videoMedia.ext),"\na=").concat(l,"\na=rtcp-mux\n").concat(gs(e),"\n").concat(vs(e),"\n").concat(Rs(e,null===(i=e.videoMedia.codecs.filter((function(e){return e.tp===os.H264}))[0])||void 0===i?void 0:i.payload),"\n");if("recvonly"!==l&&"inactive"!==l){var _=void 0;if(t.msid){var p=e.videoMedia.streams.findIndex((function(r){return"".concat(r.meid,"_").concat(r.tag||e.tag)===t.msid}));-1!==p&&(_=P(e.videoMedia.streams.splice(p,1),1)[0])}else _=e.videoMedia.streams.shift();if(_){var f=null===(a=null===(o=u.answerInfo)||void 0===o?void 0:o.midMap)||void 0===a?void 0:a.get(t.mid),b="".concat(_.meid,"_").concat(_.tag||e.tag);null===(c=null===(s=u.answerInfo)||void 0===s?void 0:s.midMap)||void 0===c||c.set(t.mid,O(O({},f),{msid:b})),d+=Ss(_,b)}}return d},gs=function(e){var t=e.videoMedia.codecs.filter((function(e){return e.tp===os.H264}))[0];if(t){var r=t.formatParameters.reduce((function(e,t){return""===e?"".concat(t.key,"=").concat(t.value):e="".concat(e,";").concat(t.key,"=").concat(t.value)}),"");return"a=rtpmap:".concat(t.payload," H264/90000\na=rtcp-fb:").concat(t.payload," ccm fir\na=rtcp-fb:").concat(t.payload," nack\na=rtcp-fb:").concat(t.payload," nack pli\na=rtcp-fb:").concat(t.payload," goog-remb\na=fmtp:").concat(t.payload," ").concat(r,"\n")}return""},vs=function(e){var t=e.videoMedia.codecs.filter((function(e){return e.tp===os["flexfec-03"]}))[0];return t?"a=rtpmap:".concat(t.payload," flexfec-03/90000\na=fmtp:").concat(t.payload," repair-window=10000000\n"):""},Rs=function(e,t){var r=e.videoMedia.codecs.filter((function(e){return e.tp===os.rtx}))[0];return console.log("getRtxTemplate",r,t),r&&t?"a=rtpmap:".concat(r.payload," rtx/90000\na=fmtp:").concat(r.payload," apt=").concat(t,"\n"):""},Ss=function(e,t){var r,n,i,o=$e.getMemo();return"a=msid:".concat(t," ").concat(t,"_video\na=ssrc-group:FID ").concat(e.ssrc.main," ").concat(e.ssrc.fid,"\na=ssrc-group:FEC-FR ").concat(e.ssrc.main," ").concat(e.ssrc.fec,"\na=ssrc:").concat(e.ssrc.main," cname:").concat(null===(r=o.answerInfo)||void 0===r?void 0:r.uid,"\na=ssrc:").concat(e.ssrc.main," msid:").concat(t," ").concat(t,"_video\na=ssrc:").concat(e.ssrc.main," mslabel:").concat(t,"\na=ssrc:").concat(e.ssrc.main," label:").concat(t,"_video\na=ssrc:").concat(e.ssrc.fid," cname:").concat(null===(n=o.answerInfo)||void 0===n?void 0:n.uid,"\na=ssrc:").concat(e.ssrc.fid," msid:").concat(t," ").concat(t,"_video\na=ssrc:").concat(e.ssrc.fid," mslabel:").concat(t,"\na=ssrc:").concat(e.ssrc.fid," label:").concat(t,"_video\na=ssrc:").concat(e.ssrc.fec," cname:").concat(null===(i=o.answerInfo)||void 0===i?void 0:i.uid,"\na=ssrc:").concat(e.ssrc.fec," msid:").concat(t," ").concat(t,"_video\na=ssrc:").concat(e.ssrc.fec," mslabel:").concat(t,"\na=ssrc:").concat(e.ssrc.fec," label:").concat(t,"_video\n")},ys=function(){return C(void 0,void 0,void 0,(function(){var e,t,r,n;return I(this,(function(i){switch(i.label){case 0:return(e=$e.getMemo()).miniSDPTemplate?[3,2]:((t=new RTCPeerConnection).addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"}),[4,t.createOffer()]);case 1:r=i.sent(),n=r.sdp,t.close(),t=null,e.miniSDPTemplate={audioMedia:Os(n),videoMedia:Cs(n)},i.label=2;case 2:return[2,e.miniSDPTemplate]}}))}))},Ts=function(e){var t,r,n,i,o,a,s,c,u,l,d,_,p,f,b,m,h,g;if(e){var v,R,S=$e.getMemo();e.includes("m=audio ")?v=Os(e):(ys(),v=null===(t=S.miniSDPTemplate)||void 0===t?void 0:t.audioMedia),(null==e?void 0:e.includes("m=video "))?R=Cs(e):(ys(),R=null===(r=S.miniSDPTemplate)||void 0===r?void 0:r.videoMedia);var y=P(e.split("m=")),T=y[0],E=y.slice(1),C=null===(n=T.match(/o=.* IN IP4 (.*)/im))||void 0===n?void 0:n[1],I=null===(i=T.match(/a=group:BUNDLE (.+)/im))||void 0===i?void 0:i[1],L=null===(o=T.match(/a=msid-semantic: WMS (.+)/im))||void 0===o?void 0:o[1],A=null===(a=null==T?void 0:T.match(/o=.*? (\d+) /im))||void 0===a?void 0:a[1],w=null===(c=null===(s=E[0])||void 0===s?void 0:s.match(/a=ice-ufrag:(.+)/im))||void 0===c?void 0:c[1],k=null===(l=null===(u=E[0])||void 0===u?void 0:u.match(/a=ice-pwd:(.+)/im))||void 0===l?void 0:l[1],D=null===(_=null===(d=E[0])||void 0===d?void 0:d.match(/a=setup:(.+)/im))||void 0===_?void 0:_[1],N=null===(f=null===(p=E[0])||void 0===p?void 0:p.match(/a=fingerprint:(.+)/im))||void 0===f?void 0:f[1],M=null===(m=null===(b=E[0])||void 0===b?void 0:b.match(/(audio|video) \d+ ([A-Z/]+) /im))||void 0===m?void 0:m[2],U=/a=ssrc:(\d+) cname:/im,j=/a=ssrc-group:FID (\d+) (\d+)/im,B=/a=ssrc-group:FEC-FR (\d+) (\d+)/im,x=null===(h=null==S?void 0:S.answerInfo)||void 0===h?void 0:h.midMap;x||(x=new Map),E.forEach((function(e){var t,r,n,i,o,a,s,c,u=null===(n=e.match(/a=mid:(\d+)/im))||void 0===n?void 0:n[1],l=null===(i=e.match(/a=(inactive|sendonly|recvonly|sendrecv)/im))||void 0===i?void 0:i[1];if(e.includes("audio")){var d=null===(o=e.match(U))||void 0===o?void 0:o[1],_=new RegExp("a=ssrc:".concat(d," msid:(.*) "),"im"),p=null===(a=e.match(_))||void 0===a?void 0:a[1];if(x.get(u)||x.set(u,{mid:u,direction:l,msid:p,mediaType:"audio"}),d){var f=co(p||"").tag;S.trackIdToSsrc=O(O({},S.trackIdToSsrc),((t={})["".concat(p,"_0")]=d,t)),f!==nu.DEFAULT?v.streams.push({tag:f,ssrc:{main:d}}):v.streams.push({ssrc:{main:d}})}}if(e.includes("video")){var b=P(e.match(j)||[],3),m=(d=b[1],b[2]),h=null===(s=e.match(B))||void 0===s?void 0:s[2];_=new RegExp("a=ssrc:".concat(d," msid:(.*) "),"im"),p=null===(c=e.match(_))||void 0===c?void 0:c[1];if(x.get(u)||x.set(u,{mid:u,direction:l,msid:p,mediaType:"video"}),d){f=void 0;if(null==p?void 0:p.includes("_tiny")){var g=p.split("_");f="".concat(g[g.length-2],"_tiny")}else f=co(p||"").tag;S.trackIdToSsrc=O(O({},S.trackIdToSsrc),((r={})["".concat(p,"_1")]=d,r)),f!==nu.DEFAULT?R.streams.push({tag:f,ssrc:{main:d,fec:h,fid:m}}):R.streams.push({ssrc:{main:d,fec:h,fid:m}})}}}));var F={uid:null===(g=S.crtRoom)||void 0===g?void 0:g.getCrtUserId(),ipAddr:C,groupBundle:I,semantic:L,midMap:x},V={sid:A,ifrag:w,ipwd:k,setup:D,crypto:undefined,fingerprint:N,candidates:[],dataFormat:ns[M],tag:nu.DEFAULT,audioMedia:v,videoMedia:R};return S.answerInfo=F,vi.info("offerToMiniSDP: ",e,V,F),V}},Es=function(e,t,r){var n,i,o,a;if(t.test(e)){var s=null===(n=null==e?void 0:e.match(t))||void 0===n?void 0:n[1],c=null===(i=null==e?void 0:e.match(t))||void 0===i?void 0:i[2],u=void 0;u=r===Bo.AUDIO_ONLY?function(e){var t;switch(e){case"red":t=is.red;break;case"opus":default:t=is.opus;break;case"PCMU":t=is.PCMU}return t}(c):function(e){var t;switch(e){case"H264":default:t=os.H264;break;case"VP8":t=os.VP8;break;case"flexfec-03":t=os["flexfec-03"];break;case"rtx":t=os.rtx}return t}(c);var l={tp:u,payload:s,feedbackTypes:[],formatParameters:[]},d=new RegExp("a=fmtp:".concat(s," (.*$)"),"im"),_=null===(o=null==e?void 0:e.match(d))||void 0===o?void 0:o[1];return null===(a=null==_?void 0:_.split(";"))||void 0===a||a.forEach((function(e){var t=P(e.split("="),2),r=t[0],n=t[1];""!==r&&(void 0===n?l.formatParameters.push({key:"none",value:r}):l.formatParameters.push({key:r,value:n}))})),l}},Os=function(e){var t,r,n,i;if(!e)return{ext:{},codecs:[],streams:[]};var o=null===(t=null==(e+="m=a")?void 0:e.match(/m=audio.*?m=(a|v)/ims))||void 0===t?void 0:t[0],a={sal:Number(null===(r=null==o?void 0:o.match(/a=extmap:(\d+) urn:ietf:params:rtp-hdrext:ssrc-audio-level/im))||void 0===r?void 0:r[1]),absts:Number(null===(n=null==o?void 0:o.match(/a=extmap:(\d+) http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time/im))||void 0===n?void 0:n[1]),tccno:Number(null===(i=null==o?void 0:o.match(/a=extmap:(\d+) http:\/\/www.ietf.org\/id\/draft-holmer-rmcat-transport-wide-cc-extensions-01/im))||void 0===i?void 0:i[1])},s=[],c=Es(o,/a=rtpmap:(\d+) .*(red)\/48000\/2/im,0);c&&s.push(c);var u=Es(o,/a=rtpmap:(\d+) .*(opus)\/48000\/2/im,0);u&&s.push(u);var l=Es(o,/a=rtpmap:(\d+) .*(PCMU)\/8000/im,0);return l&&s.push(l),{ext:a,codecs:s,streams:[]}},Cs=function(e){var t,r,n,i,o;if(!e)return{ext:{},codecs:[],streams:[]};var a=null===(t=null==(e+="m=a")?void 0:e.match(/m=video.*?m=(a|v)/ims))||void 0===t?void 0:t[0],s={absts:Number(null===(r=null==a?void 0:a.match(/a=extmap:(\d+) http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time/im))||void 0===r?void 0:r[1]),tccno:Number(null===(n=null==a?void 0:a.match(/a=extmap:(\d+) http:\/\/www.ietf.org\/id\/draft-holmer-rmcat-transport-wide-cc-extensions-01/im))||void 0===n?void 0:n[1])},c=[],u=null===(i=null==a?void 0:a.match(/a=fmtp:(\d+) .*(profile-level-id=42e01f|packetization-mode=1).*(profile-level-id=42e01f|packetization-mode=1).*(\n|\r\n|\r|\n\r)/im))||void 0===i?void 0:i[1],l=new RegExp("a=rtpmap:(".concat(u,") (H264)/90000"),"im"),d=Es(a,l,1);d&&c.push(d);var _=new RegExp("a=fmtp:(\\d+) apt=".concat(u),"im"),p=null===(o=null==a?void 0:a.match(_))||void 0===o?void 0:o[1],f=new RegExp("a=rtpmap:(".concat(p,") (rtx)/90000"),"im"),b=Es(a,f,1);b&&c.push(b);var m=Es(a,/a=rtpmap:(\d+) (flexfec-03)\/90000/im,1);return m&&c.push(m),{ext:s,codecs:c,streams:[]}},Is=function(e,t){var r,n=$e.getMemo(),i=new Map;null===(r=e.preSubList)||void 0===r||r.forEach((function(e){var t=e.msid;if(t){var r=co(e.msid),n=r.identifier,o=r.tag,a=i.get(t),s=void 0;s=e.mediaType===Bo.AUDIO_ONLY?O(O({},a),{meid:n,userId:e.userId,tag:o,audioSSRC:Number(e.ssrc)}):O(O({},a),{meid:n,userId:e.userId,tag:o,videoSSRC:Number(e.ssrc),videoSimulcast:e.simulcast}),i.set(t,s)}}));var o={sdp:Ts(e.sdp.sdp),subStreamList:A([],P(i.values()),!1),roomType:Do(n.roomType),meid:bo(t),snui:e.snui};return vi.debug("miniSDPExchangeParams: ",o),o};!function(e){e.PUB="pub",e.UNPUB="unpub",e.SUB="sub",e.UNSUB="unsub"}(ss||(ss={}));var Ls=function(e){function r(t,r,n,i,o,a){void 0===i&&(i=ss.SUB),void 0===a&&(a=0);var s=e.call(this)||this;return Object.defineProperty(s,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"fromCommand",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"unsubTracks",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"reTry",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(s,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(s,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),s}return y(r,e),Object.defineProperty(r.prototype,"kind",{get:function(){return Ea.UPDATE_SUBSCRIBE_LIST},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"_dealSubscribeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=null==n?void 0:n.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),o=r.filter((function(e){return!(null==i?void 0:i.includes(e.track.getTrackId()))})),a=r.filter((function(e){return null==i?void 0:i.includes(e.track.getTrackId())})),s=null==o?void 0:o.map((function(e){return e.track.getTrackId()}));t.info(T.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:E.SUCCEEDED,subSuccessTrackIds:s,failedList:a}),this.traceId);var c=e.getRemoteTracks(),u=function(e){var t=o.some((function(t){return t.track.getTrackId()===e}));c[e].__innerSetSubscribed(t);var r=o.some((function(t){return t.track.getTrackId()===e&&t.subTiny}));c[e].isVideoTrack()&&c[e].__innerSetIsTinyTrack(r)};for(var l in c)u(l);return e.resetSubscribedList(o),a}}),Object.defineProperty(r.prototype,"_getParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this,i=r.map((function(e){return e instanceof Ma?{track:e}:O({},e)})),o={};return i=i.filter((function(r){var i=r.track.getTrackId();return e.getRemoteTrack(i)?!o[i]&&(o[i]=!0,!0):(t.warn(T.L_UPDATE_SUBSCRIBELIST_COMMAND_P,"track cannot found in room -> trackId: ".concat(i),n.traceId),!1)})).map((function(e){return O({},e)}))}}),Object.defineProperty(r.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return s("tracks",r,(function(){return t(r)&&r.every((function(e){return e instanceof Ma||e.track instanceof Ma}))}),!0)?{code:ze.SUCCESS}:(e.warn(T.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"tracks is invalid"}),this.traceId),{code:ze.PARAMS_ERROR})}}),Object.defineProperty(r.prototype,"_reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){(null==r?void 0:r.length)&&e.reportPubOrSubQualityData(this.fromCommand,this._actionStartTime,r,t,this._trackMediaMap)}}),Object.defineProperty(r.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var i,o,a,s,c;return C(this,void 0,void 0,(function(){var u,l,d,_,p,f,b,m,h,g,v,R,S,y,C,L,P,A,w,k,D,N,M,U,j,B,x,F,V,J,H,G,q,K,W=this;return I(this,(function(I){switch(I.label){case 0:if(u=e.logger,l=e.peer,d=e.reportMediaActionLogger,this._actionStartTime=Date.now(),p=(_=this).tracks,f=_.forceReq,b=_.reTry,m=_.traceId,h=_.fromCommand,g=_.unsubTracks,v=t.roomId,R=$e.getMemo(),u.info(T.L_UPDATE_SUBSCRIBELIST_COMMAND_T,"roomId: ".concat(v,", forceReq: ").concat(f,", trackIds: ").concat(p.map(Io)),this.traceId),(S=this._validateParams(u,p).code)!==ze.SUCCESS)return[2,{code:S}];if(y=this._getParams(t,u,p),C=t.getSubscribedList().map((function(e){return O({},e)})),!f){if(!Bs(y,C))return u.warn(T.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:E.SUCCEEDED,msg:"subscribe list unchanged"}),this.traceId),[2,{code:ze.SUCCESS}];C.length&&(L=C.map((function(e){return e.track})),u.warn(T.L_CLEAR_UNSUBSCRIBE_LIST_O,JSON.stringify({list:L.map((function(e){return e.getTrackId()}))}),this.traceId),P=t.getSubscribedList().filter((function(e){return!L.includes(e.track)})),t.resetSubscribedList(P))}return l.__reportR3R4ToPolaris(),l.clearReTryExchangeTimer(),l.updateSubRemoteTracks(y.map((function(e){return e.track}))),[4,ws(y,!1,e)];case 1:return A=I.sent(),w=null===(o=null===(i=Ao(R.rtcConfig))||void 0===i?void 0:i.rtc)||void 0===o?void 0:o.config,k=(null===(a=Ao(null==w?void 0:w.exchangeSetting))||void 0===a?void 0:a.mode)||!0,D=k?Is(O(O({},A),{snui:0}),t.crtUserId):O(O({},A),{snui:0}),[4,new as(D,this.traceId,!0,k).execute(e,t,n)];case 2:return N=I.sent(),p.forEach((function(e){var t=e instanceof Ma?e.getTrackId():e.track.getTrackId();W._trackMediaMap[t]=N.data.qualityMsList||[]})),M=this.fromCommand===ss.SUB?p:this.unsubTracks,N.code!==ze.SUCCESS?(this._reportPubOrSubQualityData(d,N.code,M),u.error(T.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:E.FAILED,code:N.code}),this.traceId),[2,{code:N.code}]):(F=0,k?(H=null===(s=N.data)||void 0===s?void 0:s.data,U=H.sdp,j=H.code,H.msg,G=H.snui,F=void 0===G?0:G,B=cs(U)):(q=null===(c=N.data)||void 0===c?void 0:c.data,U=q.sdp,j=q.resultCode,q.message,q.subscribedList,x=q.subscribeErrorList,K=q.snui,F=void 0===K?0:K,B=U.sdp),R.snui=F,j!==ze.SUCCESS?(this._reportPubOrSubQualityData(d,j,M),u.error(T.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:E.FAILED,code:j}),this.traceId),[2,{code:j}]):x&&x.length>0&&b>0&&x.some((function(e){return e.IsRetry}))?[2,new r(p,!0,m,h,g,b-1).execute(e,t,n)]:[4,l.setRemoteAnswer(B)]);case 3:return V=I.sent(),this._reportPubOrSubQualityData(d,V,M),V!==ze.SUCCESS?[2,{code:V}]:(zo.formatSourceIdMapFromSdp(B,"subscribe"),[2,(J=this._dealSubscribeResult(t,u,y,x)).length?{code:ze.SUCCESS,failedList:J}:{code:ze.SUCCESS}])}}))}))}}),r}(ka),Ps=function(e){function r(t,r){var n=e.call(this)||this;return Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return y(r,e),Object.defineProperty(r.prototype,"kind",{get:function(){return Ea.UNSUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){return C(this,void 0,void 0,(function(){var i,o,a,c;return I(this,(function(u){return i=e.logger,o=e.polarisReport,a=this.tracks,s("tracks",a,(function(){return t(a)&&a.length>0&&a.every((function(e){return e instanceof Ma}))}),!0)?(i.info(T.L_ABSTRACT_ROOM_UNSUBSCRIBE_T,JSON.stringify({unSubscribeTrackIds:a.map(Io)}),this.traceId),c=r.getSubscribedList().map((function(e){return O({},e)})).filter((function(e){return!a.includes(e.track)})),a.forEach((function(e){o.sendR2(ya.SUBSCRIBE,Ba.END,[e.getTrackId()])})),[2,new Ls(c,!1,this.traceId,ss.UNSUB,this.tracks).execute(e,r,n)]):(i.warn(T.L_ABSTRACT_ROOM_UNSUBSCRIBE_E,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:ze.PARAMS_ERROR}])}))}))}}),r}(ka),As=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return y(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o;return I(this,(function(a){switch(a.label){case 0:return n=e.logger,i=this.tracks,o=n.createTraceId(),n.info(T.L_USER_LEFT_UNSUBSCRIBE_O,void 0,o),t.isMeetingMode?[4,new rs(i).execute(e,t,r)]:[3,2];case 1:return a.sent(),[3,4];case 2:return[4,new Ps(i,o).execute(e,t,r)];case 3:a.sent(),a.label=4;case 4:return i.forEach((function(e){e.__innerDestroy(),t.removeRemoteTrack(e.getTrackId())})),e.emit(za,i),[2,{code:ze.SUCCESS}]}}))}))}}),t}(ka);function ws(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,l;return I(this,(function(d){switch(d.label){case 0:return n=r.peer,i=r.store,o=r.service,a=$e.getMemo(),s=i.isMeetingMode,c=a.myFirstPublishResources||[],[4,n.createOffer(t,c)];case 1:return u=d.sent(),l={sdp:u,extend:JSON.stringify({customParams:o.getCustomExtendInfo(),resolutionInfo:n.getOutboundVideoInfo()}),subscribeList:s?e.filter((function(e){var t=e.track.getTrackId(),r=so(t).identifier,n=i.getUserIdByMeid(r),o=i.getResourcesByUserId(n);if(!o)return!1;var a=o.filter((function(e){return t==="".concat(e.nmsid||e.msid,"_").concat(e.mediaType)})).length;return a})).map((function(e){return{simulcast:e.subTiny?Uo.TINY:Uo.NORMAL,resolution:"",uri:i.getPublishedResourceByTrackId(e.track.getTrackId()).uri}})):void 0,preSubList:s?void 0:e.filter((function(e){var t=e.track.getTrackId(),r=so(t).identifier,n=i.getUserIdByMeid(r),o=i.getResourcesByUserId(n);if(!o)return!1;var a=o.filter((function(e){return t==="".concat(e.nmsid||e.msid,"_").concat(e.mediaType)})).length;return a})).map((function(e){var t,r=i.getPublishedResourceByTrackId(e.track.getTrackId()),n=e.subTiny?Uo.TINY:Uo.NORMAL,o=(null==r?void 0:r.uri)||"{}",s=JSON.parse(o),c=s.serverId,u=s.userTimestamp,l=s.ssrc,d=so(e.track.getTrackId()).identifier,_=i.getUserIdByMeid(d),p=null===(t=a.replacePreTrackIdMap)||void 0===t?void 0:t[e.track.getTrackId()],f=p&&uo(so(p).identifier);return{simulcast:n,serverId:c,userTimestamp:u,msid:(null==r?void 0:r.nmsid)||(null==r?void 0:r.msid),mediaType:null==r?void 0:r.mediaType,userId:_,ssrc:l,replaceMsid:f,meid:(null==r?void 0:r.nmsid)&&(null==r?void 0:r.meid)}})),switchstream:!1,capabilityVersion:1},[2,l]}}))}))}function ks(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c;return I(this,(function(u){switch(u.label){case 0:return n=r.peer,i=r.store,r.service,o=$e.getMemo(),a=o.myFirstPublishResources||[],[4,n.createOffer(t,a)];case 1:return s=u.sent(),c={sdp:s,extend:JSON.stringify({resolutionInfo:n.getOutboundVideoInfo()}),preSubList:e.filter((function(e){var t=e.track.getTrackId(),r=so(t).identifier,n=i.getUserIdByMeid(r),o=i.getResourcesByUserId(n);if(!o)return!1;var a=o.filter((function(e){return t==="".concat(e.nmsid||e.msid,"_").concat(e.mediaType)})).length;return a})).map((function(e){var t,r=i.getPublishedResourceByTrackId(e.track.getTrackId()),n=e.subTiny?Uo.TINY:Uo.NORMAL,a=(null==r?void 0:r.uri)||"{}",s=JSON.parse(a),c=s.serverId,u=s.userTimestamp,l=s.ssrc,d=so(e.track.getTrackId()).identifier,_=i.getUserIdByMeid(d),p=null===(t=o.replacePreTrackIdMap)||void 0===t?void 0:t[e.track.getTrackId()],f=p&&uo(so(p).identifier);return{simulcast:n,serverId:c,userTimestamp:u,msid:(null==r?void 0:r.nmsid)||(null==r?void 0:r.msid),mediaType:null==r?void 0:r.mediaType,userId:_,ssrc:l,replaceMsid:f,meid:(null==r?void 0:r.nmsid)&&(null==r?void 0:r.meid)}}))},[2,c]}}))}))}var Ds=function(e,t,r,n){return C(void 0,void 0,void 0,(function(){var i,o,a,s,c,u,l;return I(this,(function(d){switch(d.label){case 0:for(a in i=e.crtUserId,o=[],n)o.push(a);s=0,d.label=1;case 1:return s<o.length?(c=o[s])===i?[3,3]:(u=n[c]).length?(l=u.map((function(t){return e.getRemoteTrack(ao(t))})),[4,new As(l).execute(t,e,r)]):[3,3]:[3,4];case 2:d.sent(),d.label=3;case 3:return s++,[3,1];case 4:return[2]}}))}))};function Ns(e,t,r,n,i){return C(this,void 0,void 0,(function(){var o,a,s,c,u,l,d,_,p,f,b,m,h,g,v,R,S,y,T,E;return I(this,(function(O){switch(O.label){case 0:for(o=r.logger,a=t.roomId,t.crtUserId,t.roomMode,s=[],c={},u={},l={},d={},_=Oo(e,a,o,i),p=Object.keys(_),f=t.getAllUserIds(),b=p.length-1;b>=0;b-=1)m=p[b],-1!==(h=f.indexOf(m))?(g=t.getResourcesByUserId(m),v=_[m],R=po(g,v,!0),S=R.publishedList,y=R.modifiedList,T=R.unpublishedList,E=R.deviceChangedList,c[m]=_o(S),u[m]=_o(T),l[m]=_o(y),d[m]=_o(E),f.splice(h,1)):(s.push(m),c[m]=_o(_[m]));return f.length&&f.forEach((function(e){t.removeResourcesByUserId(e)})),t.assignRoomData(_),f.length?[4,Ms(f,r,t,n,i)]:[3,2];case 1:O.sent(),r.emit(Ka,f),O.label=2;case 2:return s.length&&r.emit(qa,s),[4,Ds(t,r,n,u)];case 3:return O.sent(),function(e,t,r){var n=t.logger;Object.keys(r).forEach((function(i){var o=r[i];if(0!==o.length){var a=o.map((function(t){var r=ao(t),i=so(r),o=i.identifier,a=i.tag,s=i.mediaType,c=e.getUserIdByMeid(o),u=s===Bo.AUDIO_ONLY?new Ua(n,a,c,o):new ja(n,a,c,o);return e.addRemoteTrack(u),u.__innerSetRemoteMuted(0===t.state),u.updateDeviceAvailable(t.code||Ai.RCRTCStreamCodeDefault),u}));t.emit(Wa,a)}}))}(t,r,c),function(e,t,r){Object.keys(r).forEach((function(n){r[n].forEach((function(r){var n=ao(r),i=e.getRemoteTrack(n);i.__innerSetRemoteMuted(0===r.state),i.isAudioTrack()?t.emit(Qa,i):t.emit(Ya,i)}))}))}(t,r,l),function(e,t,r){Object.keys(r).forEach((function(n){var i=r[n];if(0!==i.length){var o=i.map((function(t){var r=ao(t),n=e.getRemoteTrack(r);return n.updateDeviceAvailable(t.code||Ai.RCRTCStreamCodeDefault),{track:n,status:t.code}}));t.emit(Xa,o)}}))}(t,r,d),[2]}}))}))}function Ms(e,t,r,n,i){return C(this,void 0,void 0,(function(){var o,a,s,c;return I(this,(function(u){switch(u.label){case 0:return o=[],a=[],s=r.isMeetingMode,c=t.logger,e.forEach((function(e){o.push.apply(o,A([],P(r.getRemoteTracksByUserId(e)),!1)),a.push(e)})),o.length?(c.info(T.L_RES_UNPUB_UNSUBSCRIBE_O,void 0,i),s?[4,new rs(o).execute(t,r,n)]:[3,2]):[3,5];case 1:return u.sent(),[3,4];case 2:return[4,new Ps(o,i).execute(t,r,n)];case 3:u.sent(),u.label=4;case 4:o.forEach((function(e){return r.removeRemoteTrack(e.getTrackId())})),u.label=5;case 5:return a.length&&a.forEach((function(e){return r.removeResourcesByUserId(e)})),[2]}}))}))}var Us,js=function(e,t,r){var n=e.split("\r\nm"),i=r===Bo.AUDIO_ONLY?"audio":"video",o=n.filter((function(e){return e.includes("=".concat(i))&&e.includes(t)}))[0],a=new RegExp("a=ssrc:(.*?) msid:".concat(t)),s=o.match(a);return s?s[1]:""},Bs=function(e,t){var r=!1;return e.forEach((function(e){var n=t.findIndex((function(t){return t.track.getTrackId()===e.track.getTrackId()}));-1!==n?t.splice(n,1)[0].subTiny!==e.subTiny&&(r=!0):r=!0})),t.length&&(r=!0),r},xs=function(e){function t(t,r){var n=e.call(this)||this;return Object.defineProperty(n,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.PARSE_USERSTATE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Oa.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_dealAddUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=e.getResourcesByUserId(n),o=null==i?void 0:i.every((function(e){return void 0===Ao(e.uri).state}));i&&!o||(r.joined.push(n),t.info(T.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:n,msg:"user joined"}),this.traceId)),e.setResourcesByUserId(n,i||[])}}),Object.defineProperty(t.prototype,"_dealReduceUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){t.info(T.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:n,msg:"user left"}),this.traceId),r.left.push(n)}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s=this;return I(this,(function(c){switch(c.label){case 0:return n=e.logger,i={joined:[],left:[],upgrade:[],downgrade:[]},0===(o=this.msgContent.users).length?[2,{code:ze.SUCCESS,data:i}]:(o.forEach((function(e){var r=e.userId;0===Number(e.state)?s._dealAddUser(t,n,i,r):s._dealReduceUser(t,n,i,r)})),(a=A(A([],P(i.left),!1),P(i.downgrade),!1)).length?[4,Ms(a,e,t,r,this.traceId)]:[3,2]);case 1:c.sent(),c.label=2;case 2:return[2,{code:ze.SUCCESS,data:i}]}}))}))}}),t}(ka),Fs=function(e){function t(t,r,n,i,o){var a=e.call(this)||this;return Object.defineProperty(a,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"senderId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"sentTime",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_publishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_unpublishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_modifiedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_deviceChangedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_nowResources",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.PARSE_REMOTERES},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Oa.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_dealPublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,l,d,_,p,f=this;return I(this,(function(b){switch(b.label){case 0:return n=e.logger,i=e.reportMediaActionLogger,o=this.senderId,a=t.getResourcesByUserId(o)||[],s=this._nowResources.map(ao),c=[],u=[],this._publishedList.forEach((function(e){var r=ao(e),i=s.indexOf(r),o=so(r),a=o.identifier,l=o.tag,d=o.mediaType,_=t.getUserIdByMeid(a);i>-1?f._nowResources[i]=e:f._nowResources.push(e);var p=t.getRemoteTrack(r);p?c.push(p):(p=d===Bo.AUDIO_ONLY?new Ua(n,l,_,a):new ja(n,l,_,a),t.addRemoteTrack(p),u.push(p)),p.__innerSetRemoteMuted(0===e.state),p.updateDeviceAvailable(e.code||Ai.RCRTCStreamCodeDefault)})),c.length?(t.setResourcesByUserId(o,a),l=c.map((function(e){return e.getTrackId()})),d=void 0,t.isMeetingMode?(_=t.getSubscribedList().map((function(e){return O({},e)})).filter((function(e){return!c.includes(e.track)&&e.track.isVideoTrack()})),[4,new es(A(A([],P(c),!1),P(_),!1),!0).execute(e,t,r)]):[3,2]):[3,5];case 1:return d=b.sent(),[3,4];case 2:return n.info(T.L_PARSE_REMOTE_RES_COMMAND_P,JSON.stringify({exce:"UpdateSubscribeListCommand",list:c.map(Io)}),this.traceId),_=t.getSubscribedList().map((function(e){return O({},e)})).filter((function(e){return!c.includes(e.track)})),[4,new Ls(A(A([],P(c),!1),P(_),!1),!0,this.traceId).execute(e,t,r)];case 3:d=b.sent(),b.label=4;case 4:(p=d.code)!==ze.SUCCESS&&n.error(T.L_RESUB_REPUB_RES_R,JSON.stringify({status:E.FAILED,trackIds:l,code:p}),this.traceId),b.label=5;case 5:return u.length>0&&e.emit(Wa,u),i.reportQualityRecvPubMsgData(this.sentTime,this.senderId),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a;return I(this,(function(s){switch(s.label){case 0:for(n=this._unpublishedList.map(ao),i=this._nowResources.length-1;i>=0;i-=1)o=this._nowResources[i],n.includes(ao(o))&&this._nowResources.splice(i,1);return a=this._unpublishedList.map((function(e){var r=ao(e);return t.getRemoteTrack(r)})).filter((function(e){return e})),[4,new As(a).execute(e,t,r)];case 1:return s.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealModifiedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l;return I(this,(function(d){r=this._nowResources.map(ao);try{for(n=L(this._modifiedList),i=n.next();!i.done;i=n.next())o=i.value,a=ao(o),s=r.indexOf(a),this._nowResources[s].state=o.state,(c=t.getRemoteTrack(a)).__innerSetRemoteMuted(0===o.state),c.isAudioTrack()?e.emit(Qa,c):e.emit(Ya,c)}catch(e){u={error:e}}finally{try{i&&!i.done&&(l=n.return)&&l.call(n)}finally{if(u)throw u.error}}return[2]}))}))}}),Object.defineProperty(t.prototype,"_dealDeviceChangedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l,d;return I(this,(function(_){r=this._nowResources.map(ao),n=[];try{for(i=L(this._deviceChangedList),o=i.next();!o.done;o=i.next())a=o.value,s=ao(a),c=r.indexOf(s),this._nowResources[c].code=a.code,u=t.getRemoteTrack(s),n.push({track:u,status:a.code}),u.updateDeviceAvailable(a.code||Ai.RCRTCStreamCodeDefault)}catch(e){l={error:e}}finally{try{o&&!o.done&&(d=i.return)&&d.call(i)}finally{if(l)throw l.error}}return e.emit(Xa,n),[2]}))}))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,l,d=this;return I(this,(function(_){switch(_.label){case 0:if((n=this.msgContent.uris).forEach((function(e){t.setRelationshipMapBetweenUserIdAndMeid(co(e.nmsid||e.msid).identifier,d.senderId)})),this._publishedList=[],this._unpublishedList=[],this._modifiedList=[],this._deviceChangedList=[],o=this.senderId,a=this.messageType,!t.getRemoteUserIds().includes(o))return[2,{code:ze.SUCCESS}];if(this._nowResources=t.getResourcesByUserId(o)||[],a===wo.TOTAL_CONTENT_RESOURCE)i=po(this._nowResources,n),(s=this._publishedList).push.apply(s,A([],P(i.publishedList),!1)),(c=this._unpublishedList).push.apply(c,A([],P(i.unpublishedList),!1)),(u=this._modifiedList).push.apply(u,A([],P(i.modifiedList),!1)),(l=this._deviceChangedList).push.apply(l,A([],P(i.deviceChangedList),!1));return this._unpublishedList.length>0?[4,this._dealUnpublishList(e,t,r)]:[3,2];case 1:_.sent(),_.label=2;case 2:return this._publishedList.length>0?[4,this._dealPublishList(e,t,r)]:[3,4];case 3:_.sent(),_.label=4;case 4:return this._modifiedList.length>0?[4,this._dealModifiedList(e,t)]:[3,6];case 5:_.sent(),_.label=6;case 6:return this._deviceChangedList.length>0?[4,this._dealDeviceChangedList(e,t)]:[3,8];case 7:_.sent(),_.label=8;case 8:return t.setResourcesByUserId(o,this._nowResources),[2,{code:ze.SUCCESS}]}}))}))}}),t}(ka),Vs=function(e){function r(t,r,n){var i=e.call(this)||this;return Object.defineProperty(i,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return y(r,e),Object.defineProperty(r.prototype,"kind",{get:function(){return Ea.SUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){return C(this,void 0,void 0,(function(){var i,o,a,c,u,l,d,_,p;return I(this,(function(f){return i=e.logger,o=e.polarisReport,c=(a=this).tracks,u=a.forceReq,s("tracks",c,(function(){return t(c)&&c.length>0&&c.every((function(e){return e instanceof Ma||e.track instanceof Ma}))}),!0)?(i.info(T.L_ABSTRACT_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:c.map(Io),forceReq:u}),this.traceId),l=r.getSubscribedList().map((function(e){return O({},e)})),d=c.map((function(e){return e instanceof Ma?{track:e}:e})),_=!1,p=[],d.forEach((function(e){var t=e.track.getTrackId();p.push(t);var r=l.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:l.push(e),_=!0)})),_||u?(o.sendR2(ya.SUBSCRIBE,Ba.BEGIN,p),[2,new Ls(l,!0,this.traceId,void 0,void 0,2).execute(e,r,n)]):(i.warn(T.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:E.SUCCEEDED,msg:"repeat subscribe"}),this.traceId),[2,{code:ze.SUCCESS}])):(i.error(T.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:ze.PARAMS_ERROR}])}))}))}}),r}(ka),Js=function(e){function r(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(r,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),r}return y(r,e),Object.defineProperty(r.prototype,"kind",{get:function(){return Ea.PUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"_removePubFailedTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var n=e instanceof qi?e:e.track;r._logger.debug(T.L_ABSTRACT_ROOM_PUBLISH_P,"remove pub failed track from peerconnection -> trackId: ".concat(n.getTrackId()),r._traceId),t.removeLocalTrackById(n.getTrackId())}))}}),Object.defineProperty(r.prototype,"_addLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,l,d,_,p,f,b,m,h,g,v,R,S;return I(this,(function(y){switch(y.label){case 0:n=[],y.label=1;case 1:y.trys.push([1,11,12,13]),i=L(e),o=i.next(),y.label=2;case 2:if(o.done)return[3,10];if(a=o.value,c=(s=a instanceof qi?{pubTiny:!1,track:a}:a).track,u=s.pubTiny,!c.isVideoTrack())return[3,8];if(!u||!/chrome/i.test(Ro.browser))return[3,7];l=void 0,y.label=3;case 3:return y.trys.push([3,5,,6]),l=c.__innerGetMediaStreamTrack().clone(),d=u.frameRate||qe.FPS_15,_=u.resolution||Ke.W176_H144,p=ho(_),f=p.width,b=p.height,m=vo(d),[4,l.applyConstraints({width:f,height:b,frameRate:m})];case 4:return y.sent(),[3,6];case 5:return h=y.sent(),null==l||l.stop(),this._logger.warn(T.L_ABSTRACT_ROOM_PUBLISH_E,"pubTiny failed -> id: ".concat(c.getTrackId(),", msg: ").concat(h.message),this._traceId),[3,10];case 6:return g=new Wi(this._logger,c.getTag(),c.getUserId(),c.getMeid(),l,!0),n.push(g),t.addLocalTrack(g),[3,8];case 7:null===(r=this._logger)||void 0===r||r.info(T.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({msg:"Non chrome does not support tiny track"}),this._traceId),y.label=8;case 8:t.addLocalTrack(c),y.label=9;case 9:return o=i.next(),[3,2];case 10:return[3,13];case 11:return v=y.sent(),R={error:v},[3,13];case 12:try{o&&!o.done&&(S=i.return)&&S.call(i)}finally{if(R)throw R.error}return[7];case 13:return[2,n]}}))}))}}),Object.defineProperty(r.prototype,"__publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,o,a,s,c,u,l,d,_,p;return C(this,void 0,void 0,(function(){var f,b,m,h,g,v,R,S,y,C,L,w,k,D,N,M,U,j,B,x,F,V,J,H,G,q,K=this;return I(this,(function(I){switch(I.label){case 0:return f=$e.getMemo(),b=e.peer,m=e.reportMediaActionLogger,h=t.roomId,g=[],r.forEach((function(e){var t=(e instanceof qi?{track:e}:e).track;g.push(t)})),r.sort((function(e,t){return(e instanceof qi?{track:e}:e).track.getBitrate().max-(t instanceof qi?{track:t}:t).track.getBitrate().max})),b.getLocalTracks().length+function(e,t){var r=0;return e.forEach((function(e){var n=e instanceof qi?e.getTrackId():e.track.getTrackId();t.getLocalTrack(n)||(e instanceof qi?r++:e.pubTiny&&e.track.isVideoTrack()&&(r+=2))})),r}(r,b)>10?(null===(i=this._logger)||void 0===i||i.error(T.L_ABSTRACT_ROOM_PUBLISH_P,JSON.stringify({status:E.FAILED,code:ze.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:r.map(Io),msg:"publish track limit exceeded"}),this._traceId),[2,{code:ze.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:g}]):(null===(o=this._logger)||void 0===o||o.info(T.L_ABSTRACT_ROOM_PUBLISH_P,"publish tracks -> roomId: ".concat(h,", tracks: ").concat(r.map(Io)),this._traceId),[4,this._addLocalTracks(r,b)]);case 1:return v=I.sent(),b.clearReTryExchangeTimer(),R=t.isMeetingMode?[]:t.getSubscribedList(),b.getLocalTracks().forEach((function(e){e.emit(qi.__INNER_EVENT_SEND_CHANGE__,e,e.isPause())})),[4,ws(R,!1,e)];case 2:return S=I.sent(),zo.formatSourceIdMapFromSdp(S.sdp.sdp,"publish"),y=null===(s=null===(a=Ao(f.rtcConfig))||void 0===a?void 0:a.rtc)||void 0===s?void 0:s.config,C=(null===(c=Ao(null==y?void 0:y.exchangeSetting))||void 0===c?void 0:c.mode)||!0,L=C?Is(O(O({},S),{snui:0}),t.crtUserId):O(O({},S),{snui:0}),[4,new as(L,this._traceId,!0,C).execute(e,t,n)];case 3:return w=I.sent(),g.forEach((function(e){var t=e.getTrackId();K._trackMediaMap[t]=w.data.qualityMsList||[]})),w.code!==ze.SUCCESS?(m.reportPubOrSubQualityData(ss.PUB,this._actionStartTime,g,w.code,this._trackMediaMap),null===(u=this._logger)||void 0===u||u.error(T.L_ABSTRACT_ROOM_PUBLISH_P,JSON.stringify({status:E.FAILED,tracks:r.map(Io),code:w.code,msg:"exchange failed"}),this._traceId),this._removePubFailedTracks(r,b),[2,{code:w.code,tracks:g}]):(U=0,C?(J=null===(l=w.data)||void 0===l?void 0:l.data,k=J.sdp,D=J.code,N=J.msg,H=J.snui,U=void 0===H?0:H,M=cs(k)):(G=null===(d=w.data)||void 0===d?void 0:d.data,k=G.sdp,D=G.resultCode,N=G.message,q=G.snui,U=void 0===q?0:q,M=k.sdp),f.snui=U,D!==ze.SUCCESS?(m.reportPubOrSubQualityData(ss.PUB,this._actionStartTime,g,D,this._trackMediaMap),this._logger.error(T.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:E.FAILED,trackIds:r.map(Io),code:D,msg:"exchange inner failed: ".concat(N)}),this._traceId),this._removePubFailedTracks(r,b),[2,{code:D,tracks:g}]):(m.setPubOrSubSuccessTime(Date.now()),[4,b.setRemoteAnswer(M,!0)]));case 4:return(j=I.sent())!==ze.SUCCESS?(m.reportPubOrSubQualityData(ss.PUB,this._actionStartTime,g,j,this._trackMediaMap),this._logger.error(T.L_ABSTRACT_ROOM_PUBLISH_P,JSON.stringify({status:E.FAILED,trackIds:r.map(Io),code:j,msg:"set remote answer error"}),this._traceId),[2,{code:j,tracks:g}]):(v.length&&this._updateTinyTrackIdSSRCMap(t,S.sdp.sdp,v),C?(x=null===(p=w.data)||void 0===p?void 0:p.data,F=[],V=b.getLocalTracks().filter((function(e){return e.isPublished()})),A(A([],P(g),!1),P(V),!1).forEach((function(e){var t,r=null===(t=f.trackIdToSsrc)||void 0===t?void 0:t[e.getTrackId()],n=e.isAudioTrack()?0:1,i=e.getMeid(),o=e.getTag();F.push({mediaType:n,msid:e.getStreamId(),ssrc:r,uri:JSON.stringify({meid:i,ssrc:Number(r),mediaType:n,tag:o,userId:e.getUserId(),resourceId:lo(i,o,n)}),nmsid:"".concat(i,"_").concat(o),meid:i})})),B={code:w.code,data:{resultCode:D,message:N,"Request-Id":null==x?void 0:x["Request-Id"],clusterId:null==x?void 0:x.clusterId,publishList:F,roomId:"",sdp:{type:"answer",sdp:M},snui:x.snui},tracks:g}):B={code:w.code,data:null===(_=w.data)||void 0===_?void 0:_.data,tracks:g},[2,B])}}))}))}}),Object.defineProperty(r.prototype,"_updateTinyTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){r.forEach((function(r){var n=js(t,r.getStreamId(),Bo.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(n),r.getTrackId())}))}}),Object.defineProperty(r.prototype,"_dealPublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,l,d,_,p,f,b,m,h,g;return I(this,(function(v){switch(v.label){case 0:return n=r.polarisReport,i=r.context,o=r.peer,a=r.reportMediaActionLogger,s=r.logger,c=t.crtUserId,l=t.roomId,d=t.getResourcesByUserId(c),_=A([],P(d),!1),p=e.tracks,e.code!==ze.SUCCESS?[2,{code:e.code}]:(f=e.data.publishList,f.map((function(e){return O(O({tag:co(e.nmsid||e.msid).tag,state:o.getLocalTrack(ao(e)).isLocalMuted()?0:1},e),{code:o.getLocalTrack(ao(e)).getDeviceAvailable(!0)||Ai.RCRTCStreamCodeDefault})})).forEach((function(e){var t=Co(e,_),r=t.isInclude,n=t.index;r?_.splice(n,1,e):_.push(e)})),b=po(d,_).publishedList,m=Date.now(),[4,i.setRTCTotalRes(l,to(_),wo.TOTAL_CONTENT_RESOURCE)]);case 1:return h=v.sent(),a.reportPubOrSubQualityData(ss.PUB,this._actionStartTime,p,h,this._trackMediaMap,[{dur:Date.now()-m,cod:h}]),h!==u.SUCCESS?(s.error(T.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:E.FAILED,code:h,msg:"send publish streams notification failed"}),this._traceId),[2,{code:ze.SIGNAL_ERROR}]):(t.setResourcesByUserId(c,_),g=b.map((function(e){return ao(e)})),n.sendR2(ya.PUBLISH,Ba.BEGIN,g),b.forEach((function(e){o.getLocalTrack("".concat(e.nmsid||e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)})),[2,{code:ze.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){return C(this,void 0,void 0,(function(){var i,o,a,c,u=this;return I(this,(function(l){switch(l.label){case 0:return i=e.logger,o=e.peer,this._traceId=i.createTraceId(),this._logger=i,this._actionStartTime=Date.now(),a=this.tracks,s("tracks",a,(function(){return t(a)&&a.length>0&&a.every((function(e){return e instanceof qi||e.track instanceof qi}))}),!0)?(i.info(T.L_ABSTRACT_ROOM_PUBLISH_T,JSON.stringify({trackIds:a.map(Io)})),(a=a.filter((function(e){var t=(e instanceof qi?{track:e}:e).track,r=t.isDestroyed();return r&&i.warn(T.L_ABSTRACT_ROOM_PUBLISH_P,JSON.stringify({msg:"track -> ".concat(t.getTrackId()," has beem destroyed")}),u._traceId),!r}))).length?(o.__reportR3R4ToPolaris(),o.clearReTryExchangeTimer(),[4,this.__publish(e,r,a,n)]):(i.error(T.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:E.FAILED,code:ze.PUBLISH_TRACKS_IS_INVALID,msg:"params tracks is empty"}),this._traceId),[2,{code:ze.PUBLISH_TRACKS_IS_INVALID}])):(i.error(T.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> tracks"}),this._traceId),[2,{code:ze.PARAMS_ERROR}]);case 1:return c=l.sent(),[4,this._dealPublishRes(c,r,e)];case 2:return[2,l.sent()]}}))}))}}),r}(ka),Hs=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(r,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),r}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.UNPUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"__unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,o,a;return C(this,void 0,void 0,(function(){var s,c,u,l,d,_,p,f,b,m,h,g,v,R,S,y,C,L,P,A,w,k,D,N,M=this;return I(this,(function(I){switch(I.label){case 0:return s=e.peer,c=e.polarisReport,u=e.logger,l=e.reportMediaActionLogger,d=$e.getMemo(),_=n.map((function(e){return e.getTrackId()})),0===_.map(t.getPublishedResourceByTrackId.bind(t)).filter((function(e){return!!e})).length?[2,{code:ze.SUCCESS,tracks:n}]:(_.forEach((function(e){return s.removeLocalTrackById(e)})),c.sendR2(ya.PUBLISH,Ba.END,_),s.clearReTryExchangeTimer(),[4,ws(t.getSubscribedList(),!1,e)]);case 1:return p=I.sent(),f=null===(o=null===(i=Ao(d.rtcConfig))||void 0===i?void 0:i.rtc)||void 0===o?void 0:o.config,b=(null===(a=Ao(null==f?void 0:f.exchangeSetting))||void 0===a?void 0:a.mode)||!0,m=b?Is(O(O({},p),{snui:0}),t.crtUserId):O(O({},p),{snui:0}),[4,new as(m,this._traceId,!0,b).execute(e,t,r)];case 2:return h=I.sent(),n.forEach((function(e){var t=e.getTrackId();M._trackMediaMap[t]=h.data.qualityMsList||[]})),h.code!==ze.SUCCESS?(l.reportPubOrSubQualityData(ss.UNPUB,this._actionStartTime,n,h.code,this._trackMediaMap),u.error(T.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:E.FAILED,code:h.code,trackIds:n.map(Io),msg:"exchange failed"}),this._traceId),[2,{code:h.code,tracks:n}]):(y=0,b?(w=h.data.data,g=w.sdp,v=w.code,R=w.msg,k=w.snui,y=void 0===k?0:k,S=cs(g)):(D=h.data.data,g=D.sdp,v=D.resultCode,R=D.message,N=D.snui,y=void 0===N?0:N,S=g.sdp),d.snui=y,v!==ze.SUCCESS?(l.reportPubOrSubQualityData(ss.UNPUB,this._actionStartTime,n,v,this._trackMediaMap),u.error(T.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:E.FAILED,code:v,trackIds:n.map(Io),msg:"exchange inner failed: ".concat(R)}),this._traceId),[2,{code:v,tracks:n}]):(L=s.getLocalTracks().filter((function(e){return!e.isVideoTrack()||!e.__isTiny()})),b?(P=h.data.data,A=[],L.forEach((function(e){var t,r=null===(t=d.trackIdToSsrc)||void 0===t?void 0:t[e.getTrackId()],n=e.isAudioTrack()?0:1,i=e.getMeid(),o=e.getTag();A.push({mediaType:n,msid:e.getStreamId(),ssrc:r,uri:JSON.stringify({meid:i,ssrc:Number(r),mediaType:n,tag:o,userId:e.getUserId(),resourceId:lo(i,o,n)}),nmsid:"".concat(i,"_").concat(o),meid:i})})),C={code:h.code,data:{resultCode:v,message:R,"Request-Id":null==P?void 0:P["Request-Id"],clusterId:null==P?void 0:P.clusterId,publishList:A,roomId:"",sdp:{type:"answer",sdp:S},snui:P.snui},tracks:n}):C={code:h.code,data:h.data.data,tracks:n},[2,C]))}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,l,d,_,p,f,b,m,h,g,v,R;return I(this,(function(S){switch(S.label){case 0:return n=e.context,i=e.logger,o=e.peer,a=e.reportMediaActionLogger,s=n.getCurrentId(),c=t.roomId,l=[],d=r.tracks,_=r.code,p=r.data,_!==ze.SUCCESS?(i.error(T.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({code:_,msg:"unpublish failed"}),this._traceId),[2,{code:_}]):p?(f=d.map((function(e){return e.getTrackId()})),b=f.map(t.getPublishedResourceByTrackId.bind(t)).filter((function(e){return!!e})),l.push.apply(l,A([],P(b),!1)),m=t.getResourcesByUserId(s),h=m.filter((function(e){return!l.includes(e)})),g=Date.now(),[4,n.setRTCTotalRes(c,to(h),wo.TOTAL_CONTENT_RESOURCE)]):(i.info(T.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:E.SUCCEEDED,msg:"unpublish list is empty "})),[2,{code:ze.SUCCESS}]);case 1:return v=S.sent(),a.reportPubOrSubQualityData(ss.UNPUB,this._actionStartTime,d,v,this._trackMediaMap,[{dur:Date.now()-g,cod:v}]),v!==u.SUCCESS?(i.error(T.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:E.FAILED,code:v,msg:"send unpublish notification failed"}),this._traceId),[2,{code:ze.SIGNAL_ERROR}]):(i.info(T.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:E.SUCCEEDED,code:ze.SUCCESS,msg:"unpublish success",unPubResourceIds:f}),this._traceId),R=r.data.sdp,[4,o.setRemoteAnswer(R.sdp)]);case 2:return S.sent(),t.setResourcesByUserId(s,h),[2,{code:ze.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a;return I(this,(function(c){switch(c.label){case 0:return n=e.logger,this._actionStartTime=Date.now(),i=t.crtUserId,o=this.tracks,this._traceId=n.createTraceId(),s("tracks",o,(function(){return o.every((function(e){return e.getUserId()===i&&e instanceof qi}))}),!0)?(n.info(T.L_ABSTRACT_ROOM_UNPUBLISH_T,JSON.stringify({trackIds:o.map(Io)})),[4,this.__unpublish(e,t,r,o)]):(n.error(T.L_ABSTRACT_ROOM_UNPUBLISH_E,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> tracks"})),[2,{code:ze.PARAMS_ERROR}]);case 1:return a=c.sent(),[4,this._dealUnpublishRes(e,t,a)];case 2:return[2,c.sent()]}}))}))}}),t}(ka),Gs=function(e){function r(t,r,n,i,o){var a=e.call(this)||this;return Object.defineProperty(a,"localTracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"isPre",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"isSpread",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),a}return y(r,e),Object.defineProperty(r.prototype,"kind",{get:function(){return Ea.PUBLISH_AND_SUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"__publishAndSubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o,a,s,c,u,l,d,_;return C(this,void 0,void 0,(function(){var p,f,b,m,h,g,v,R,S,y,C,w,k,D,N,M,U,j,B,x,F,V,J,H,G,q,K,W,z,Q,Y,Z,X,$,ee,te,re,ne,ie,oe,ae,se,ce,ue,le,de,_e,pe,fe,be,me=this;return I(this,(function(I){switch(I.label){case 0:if(p=$e.getMemo(),f=e.peer,b=e.logger,e.context,m=t.roomId,h=[],r.forEach((function(e){var r=(e instanceof qi?{track:e}:e).track,n=bo(t.crtUserId);r.__updateInnerDataByMeid(n),h.push(r)})),r.sort((function(e,t){return(e instanceof qi?{track:e}:e).track.getBitrate().max-(t instanceof qi?{track:t}:t).track.getBitrate().max})),f.getLocalTracks().length>10)return b.error(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,JSON.stringify({status:E.FAILED,code:ze.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:r.map(Io),msg:"publish track limit exceeded"}),this.traceId),[2,{code:ze.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:h}];b.info(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,"publish tracks -> roomId: ".concat(m,", tracks: ").concat(r.map(Io)),this.traceId),g=[],I.label=1;case 1:I.trys.push([1,11,12,13]),v=L(r),R=v.next(),I.label=2;case 2:if(R.done)return[3,10];if(S=R.value,C=(y=S instanceof qi?{pubTiny:!1,track:S}:S).track,w=y.pubTiny,C.isPublished())return[3,9];if(!C.isVideoTrack())return[3,8];if(!w||!/chrome/i.test(Ro.browser))return[3,7];k=void 0,I.label=3;case 3:return I.trys.push([3,5,,6]),k=C.__innerGetMediaStreamTrack().clone(),D=w.frameRate||qe.FPS_15,N=w.resolution||Ke.W176_H144,M=ho(N),U=M.width,j=M.height,B=vo(D),[4,k.applyConstraints({width:U,height:j,frameRate:B})];case 4:return I.sent(),[3,6];case 5:return x=I.sent(),null==k||k.stop(),b.warn(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,"pubTiny failed -> id: ".concat(C.getTrackId(),", msg: ").concat(x.message),this.traceId),[3,10];case 6:return F=new Wi(b,C.getTag(),C.getUserId(),C.getMeid(),k,!0),g.push(F),f.addLocalTrack(F),[3,8];case 7:b.info(T.L_ABSTRACT_ROOM_PUBLISH_P,JSON.stringify({msg:"Non chrome does not support tiny track"}),this.traceId),I.label=8;case 8:f.addLocalTrack(C),I.label=9;case 9:return R=v.next(),[3,2];case 10:return[3,13];case 11:return V=I.sent(),le={error:V},[3,13];case 12:try{R&&!R.done&&(de=v.return)&&de.call(v)}finally{if(le)throw le.error}return[7];case 13:return f.clearReTryExchangeTimer(),t.getSubscribedList(),J=n.map((function(e){return e instanceof Ma?{track:e}:O({},e)})),H={},J=J.filter((function(e){var r=e.track.getTrackId();return t.getRemoteTrack(r)?!H[r]&&(H[r]=!0,!0):(b.warn(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,"track cannot found in room -> trackId: ".concat(r),me.traceId),!1)})).map((function(e){return O({},e)})),f.updateSubRemoteTracks(J.map((function(e){return e.track}))),[4,ks(J,!1,e)];case 14:return G=I.sent(),q=t.getRemoteUserIds(),K=null===(o=t.getResourcesByUserId(q[0]))||void 0===o?void 0:o.every((function(e){return void 0===e.state})),this.isPre&&K?f.getLocalTracks().forEach((function(e){var t;f.disableSenderEncodingsByTrackId(null===(t=e.__innerGetMediaStreamTrack())||void 0===t?void 0:t.id)})):f.getLocalTracks().forEach((function(e){e.emit(qi.__INNER_EVENT_SEND_CHANGE__,e,e.isPause())})),zo.formatSourceIdMapFromSdp(G.sdp.sdp,"publish"),W=null===(s=null===(a=Ao(p.rtcConfig))||void 0===a?void 0:a.rtc)||void 0===s?void 0:s.config,z=(null===(c=Ao(null==W?void 0:W.exchangeSetting))||void 0===c?void 0:c.mode)||!0,Q=z?Is(O(O({},G),{snui:0}),t.crtUserId):O(O({},G),{snui:0}),[4,new as(Q,this.traceId,!0,z).execute(e,t,i)];case 15:if((Y=I.sent()).code!==ze.SUCCESS)return b.error(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,JSON.stringify({status:E.FAILED,publishTracks:r.map(Io),code:Y.code,msg:"exchange failed"}),this.traceId),this._removePubFailedTracks(r,f,t),[2,{code:Y.code,tracks:h}];if(te=0,z?(_e=null===(u=Y.data)||void 0===u?void 0:u.data,Z=_e.sdp,X=_e.code,$=_e.msg,pe=_e.snui,te=void 0===pe?0:pe,ee=cs(Z)):(fe=null===(l=Y.data)||void 0===l?void 0:l.data,Z=fe.sdp,X=fe.resultCode,$=fe.message,be=fe.snui,te=void 0===be?0:be,ee=Z.sdp),p.snui=te,J.map((function(e){return e.track.getTrackId()})),X!==ze.SUCCESS)return b.error(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,JSON.stringify({status:E.FAILED,trackIds:r.map(Io),code:X,msg:"exchange inner failed: ".concat($)}),this.traceId),this._removePubFailedTracks(r,f,t),[2,{code:X,tracks:h}];for(ie in zo.formatSourceIdMapFromSdp(ee,"subscribe"),re=t.getRemoteTracks(),ne=function(e){var t=n.some((function(t){return Io(t)===e}));re[e].__innerSetSubscribed(t),re[e].__innerSetPreSubscribed(!0);var r=n.some((function(t){return Io(t)===e&&t instanceof Ma||t.subTiny}));re[e].isVideoTrack()&&re[e].__innerSetIsTinyTrack(r)},re)ne(ie);return t.resetSubscribedList(n.map((function(e){return e instanceof Ma?{track:e}:e}))),[4,f.setRemoteAnswer(ee)];case 16:return(oe=I.sent())!==ze.SUCCESS?(b.error(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,JSON.stringify({status:E.FAILED,publishTrackIds:r.map(Io),subscribeTrackIds:n.map(Io),code:oe,msg:"set remote answer error"}),this.traceId),[2,{code:oe,tracks:h}]):(g.length&&this._updateTinyTrackIdSSRCMap(t,G.sdp.sdp,g),z?(se=null===(_=Y.data)||void 0===_?void 0:_.data,ce=[],ue=f.getLocalTracks().filter((function(e){return e.isPublished()})),A(A([],P(h),!1),P(ue),!1).forEach((function(e){var t,r=null===(t=p.trackIdToSsrc)||void 0===t?void 0:t[e.getTrackId()],n=e.isAudioTrack()?0:1,i=e.getMeid(),o=e.getTag();ce.push({mediaType:n,msid:e.getStreamId(),ssrc:r,uri:JSON.stringify({meid:i,ssrc:Number(r),mediaType:n,tag:o,userId:e.getUserId(),resourceId:lo(i,o,n)}),nmsid:"".concat(i,"_").concat(o),meid:i})})),ae={code:Y.code,data:{resultCode:X,message:$,"Request-Id":null==se?void 0:se["Request-Id"],clusterId:null==se?void 0:se.clusterId,publishList:ce,roomId:"",sdp:{type:"answer",sdp:ee},snui:se.snui},tracks:h}):ae={code:Y.code,data:null===(d=Y.data)||void 0===d?void 0:d.data,tracks:h},[2,ae])}}))}))}}),Object.defineProperty(r.prototype,"_updateTinyTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){r.forEach((function(r){var n=js(t,r.getStreamId(),Bo.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(n),r.getTrackId())}))}}),Object.defineProperty(r.prototype,"_removePubFailedTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;e.forEach((function(e){var r=e instanceof qi?e:e.track;n._logger.debug(T.L_ABSTRACT_ROOM_PUBLISH_P,"remove pub failed track from peerconnection -> trackId: ".concat(r.getTrackId()),n.traceId),t.removeLocalTrackById(r.getTrackId())}))}}),Object.defineProperty(r.prototype,"_dealPubAndSubRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c,l,d,_,p,f,b,m,h,g,v;return I(this,(function(R){switch(R.label){case 0:return i=r.peer,o=r.context,a=r.logger,s=r.polarisReport,c=t.crtUserId,l=t.roomId,d=[],_=t.getResourcesByUserId(c),p=A([],P(_),!1),e.code!==ze.SUCCESS?(f=e.tracks,d.push({code:e.code,tracks:f}),[2,{code:e.code}]):(b=e.data.publishList,b.map((function(e){return O(O({tag:co(e.nmsid||e.msid).tag,state:i.getLocalTrack(ao(e)).isLocalMuted()?0:1},e),{code:i.getLocalTrack(ao(e)).getDeviceAvailable(!0)||Ai.RCRTCStreamCodeDefault})})).forEach((function(e){var t=Co(e,p),r=t.isInclude,n=t.index;r?p.splice(n,1,e):p.push(e)})),m=po(_,p).publishedList,n?[4,o.setRTCTotalRes(l,to(p),wo.TOTAL_CONTENT_RESOURCE)]:[3,2]);case 1:if((h=R.sent())!==u.SUCCESS)return a.error(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R,JSON.stringify({status:E.FAILED,code:h,msg:"send publish streams notification failed"}),this.traceId),[2,{code:ze.SIGNAL_ERROR}];R.label=2;case 2:return t.setResourcesByUserId(c,p),g=m.map((function(e){return ao(e)})),s.sendR2(ya.PUBLISH,Ba.BEGIN,g),m.forEach((function(e){i.getLocalTrack("".concat(e.nmsid||e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)})),a.info(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R,JSON.stringify({status:E.SUCCEEDED,code:d.length?ze.SOME_TRACKS_PUBLISH_FAILED:ze.SUCCESS,pubSuccessTrackIds:g}),this.traceId),v={code:ze.SUCCESS},d.length&&(v.failedTracks=d,v.code=ze.REQUEST_FAILED),[2,v]}}))}))}}),Object.defineProperty(r.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){return C(this,void 0,void 0,(function(){var i,o,a,c,u,l,d=this;return I(this,(function(_){switch(_.label){case 0:return i=e.logger,a=(o=this).localTracks,c=o.remoteTracks,u=r.roomId,this._logger=i,i.info(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_T,JSON.stringify({localTrackIds:a.map(Io),remoteTrackIds:c.map(Io),roomId:u}),this.traceId),s("tracks",a,(function(){return t(a)&&a.every((function(e){return e instanceof qi||e.track instanceof qi}))}),!0)?s("tracks",c,(function(){return t(c)&&c.every((function(e){return e instanceof Ma||e.track instanceof Ma}))}),!0)?(a=a.filter((function(e){var t=(e instanceof qi?{track:e}:e).track,r=t.isDestroyed();return r&&i.warn(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R,JSON.stringify({msg:"localTracks -> ".concat(t.getTrackId()," has beem destroyed")}),d.traceId),!r})),[4,this.__publishAndSubscribe(e,r,a,c,n)]):(i.warn(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> remoteTracks"}),this.traceId),[2,{code:ze.PARAMS_ERROR}]):(i.error(T.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> localTracks"}),this.traceId),[2,{code:ze.PARAMS_ERROR}]);case 1:return l=_.sent(),[4,this._dealPubAndSubRes(l,r,e,this.isSpread)];case 2:return[2,_.sent()]}}))}))}}),r}(ka),qs=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.LOCAL_TRACK_MUTE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l,d,_,p,f,b,m,h,g;return I(this,(function(v){r=e.logger,n=e.context,i=this.localTrack,o=i.getTrackId(),a=t.crtUserId,s=t.roomId,c=!i.isLocalMuted(),u=r.createTraceId(),r.info(T.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T,JSON.stringify({enabled:c,trackId:this.localTrack.getTrackId()}),u),l=[{resourceId:o,enabled:c}],d=t.getResourcesByUserId(a),_=[],p=function(e){var t=ao(e),r=l.findIndex((function(e){return e.resourceId===t}));if(r>=0){var n=l[r].enabled;return e.state=n?1:0,_.push(e),"break"}};try{for(f=L(d),b=f.next();!b.done&&(m=b.value,"break"!==p(m));b=f.next());}catch(e){h={error:e}}finally{try{b&&!b.done&&(g=f.return)&&g.call(f)}finally{if(h)throw h.error}}return t.retrySignalingMannger.push({name:wa.Muted,execute:function(){return n.setRTCTotalRes(s,to(d),wo.TOTAL_CONTENT_RESOURCE)}}),r.info(T.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:E.SUCCEEDED}),u),[2,{code:ze.SUCCESS}]}))}))}}),t}(ka),Ks=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.RETRY_EXCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Oa.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i,o,a;return C(this,void 0,void 0,(function(){var s,c,u,l,d,_,p,f,b,m,h,g,v,R,S,y,E,C,L,P,A,w,k,D;return I(this,(function(I){switch(I.label){case 0:return s=e.logger,c=e.peer,u=e.context,l=$e.getMemo(),d=s.createTraceId(),s.info(T.L_RETRY_EXCHANGE_COMMAND_T),_=u.getCurrentId(),[4,ws(t.isMeetingMode?[]:t.getSubscribedList(),!0,e)];case 1:return p=I.sent(),f=null===(i=null===(n=Ao(l.rtcConfig))||void 0===n?void 0:n.rtc)||void 0===i?void 0:i.config,b=(null===(o=Ao(null==f?void 0:f.exchangeSetting))||void 0===o?void 0:o.mode)||!0,m=b?Is(O(O({},p),{snui:0}),t.crtUserId):O(O({},p),{snui:0}),[4,new as(m,d,!1,b).execute(e,t,r)];case 2:return(h=I.sent()).code!==ze.SUCCESS?[2,{code:h.code}]:(S=0,b?(A=h.data.data,g=A.sdp,v=A.code,w=A.snui,S=void 0===w?0:w,R=cs(g)):(k=h.data.data,g=k.sdp,v=k.resultCode,D=k.snui,S=void 0===D?0:D,R=g.sdp),l.snui=S,v!==ze.SUCCESS?[2,{code:v}]:(c.clearReTryExchangeTimer(),[4,c.setRemoteAnswer(R)]));case 3:return(y=I.sent())!==ze.SUCCESS?[2,{code:y}]:(E=(null===(a=h.data.data)||void 0===a?void 0:a.publishList)||[],b&&c.getLocalTracks().filter((function(e){return e.isPublished()})).forEach((function(e){var t,r=null===(t=l.trackIdToSsrc)||void 0===t?void 0:t[e.getTrackId()],n=e.isAudioTrack()?0:1,i=e.getMeid(),o=e.getTag();E.push({mediaType:n,msid:e.getStreamId(),ssrc:r,uri:JSON.stringify({meid:i,ssrc:Number(r),mediaType:n,tag:o,userId:e.getUserId(),resourceId:lo(i,o,n)}),nmsid:"".concat(i,"_").concat(o),meid:i})})),C=this._diffPublishListChange(E,t,c,_,b),L=C.plus,P=C.minus,L.length||P.length?[4,this._spreadPublishListUri(e,_,d)]:[3,5]);case 4:I.sent(),I.label=5;case 5:return[2,{code:ze.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"_diffPublishListChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){void 0===i&&(i=!1);var o=t.getResourcesByUserId(n),a=JSON.parse(JSON.stringify(o));e.forEach((function(e){var t,n=e.mediaType,i=e.msid,o=a.findIndex((function(e){var t=e.mediaType,r=e.msid;return n===t&&i===r}));if(-1===o){var s=O(O({tag:i.split("_").pop(),state:(null===(t=r.getLocalTrack(ao(e)))||void 0===t?void 0:t.isLocalMuted)?0:1},e),{code:r.getLocalTrack(ao(e)).getDeviceAvailable(!0)||Ai.RCRTCStreamCodeDefault});a.push(s)}else a[o].uri=e.uri}));var s=po(o,a,!0,i),c=s.publishedList,u=s.unpublishedList;return t.setResourcesByUserId(n,a),{plus:c,minus:u}}}),Object.defineProperty(t.prototype,"_spreadPublishListUri",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a;return I(this,(function(s){switch(s.label){case 0:return n=e.store,i=e.logger,o=e.context,a=n.getResourcesByUserId(t),i.info(T.L_RETRY_EXCHANGE_SPREAD_T,JSON.stringify({allPublishList:a}),r),[4,o.setRTCTotalRes(n.roomId,to(a),wo.TOTAL_CONTENT_RESOURCE)];case 1:return s.sent()===u.SUCCESS?i.info(T.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(E.SUCCEEDED),r):i.error(T.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(E.FAILED),r),[2]}}))}))}}),t}(ka);!function(e){e[e.JOIN=0]="JOIN",e[e.LEAVE=1]="LEAVE",e[e.OFFLINE=2]="OFFLINE",e[e.RESOURCECHANGE=3]="RESOURCECHANGE"}(Us||(Us={}));var Ws,zs=function(e){function t(t,r,n,i){var o=e.call(this)||this;return Object.defineProperty(o,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"_context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"_targetPullVersion",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.PULL_RTCROOM_STATUS},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,l,d,_,p,f,b,m,h,g,v,R,S,y,O,C;return I(this,(function(I){switch(I.label){case 0:return n=e.logger,i=t.getRoomStatusVersion(),n.info(T.L_PULL_ROOM_STATUS_T,JSON.stringify({roomId:this._roomId,localVersion:i}),this._traceId),this._targetPullVersion&&this._targetPullVersion<=i?(n.info(T.L_PULL_ROOM_STATUS_R,JSON.stringify({status:E.SUCCEEDED,msg:"the roomData has been pulled",localVersion:i,targetPullVersion:this._targetPullVersion}),this._traceId),[2,{code:u.SUCCESS}]):[4,this._context.pullRTCRoomStatus(this._roomId,i)];case 1:return o=I.sent(),a=o.code,s=o.data,a!==u.SUCCESS?(n.info(T.L_PULL_ROOM_STATUS_R,JSON.stringify({status:E.FAILED,code:a}),this._traceId),[2,{code:a}]):(l=(c=s).bFullStatus,d=c.version,_=c.usersData,p=c.roomStatus,n.info(T.L_PULL_ROOM_STATUS_R,JSON.stringify({bFullStatus:l,version:Lo(d),usersData:_,roomStatus:p}),this._traceId),t.setRoomStatusVersion(d),l?(f=function(e){var t={users:{}};return e.forEach((function(e){var r,n=e.userId,i=e.userData;t.users[n]={};var o=null===(r=i.filter((function(e){return"uris"===e.key}))[0])||void 0===r?void 0:r.value;t.users[n]={uris:o}})),{urisData:t}}(_).urisData,[4,Ns(f,t,e,r,this._traceId)]):[3,3]);case 2:return I.sent(),[2,{code:a}];case 3:I.trys.push([3,10,11,12]),b=L(p),m=b.next(),I.label=4;case 4:return m.done?[3,9]:(h=m.value).event!==Us.RESOURCECHANGE?[3,6]:(g=function(e){var t,r=e.userId,n=e.userData,i=function(e){return e.some((function(e){return"uris"===e.key}))}(n);if(i){var o=null===(t=n.filter((function(e){return"uris"===e.key}))[0])||void 0===t?void 0:t.value;return{userId:r,content:{uris:o?JSON.parse(o):[]}}}}(h),g?(R=g.content,(v=g.userId)===t.crtUserId?[3,8]:(n.info(T.L_PULL_ROOM_STATUS_P,JSON.stringify(R),this._traceId),[4,new Fs(R,wo.TOTAL_CONTENT_RESOURCE,v,this._traceId).execute(e,t,r)])):[3,8]);case 5:return I.sent(),[3,8];case 6:return R=function(e){var t,r=e.userId,n=e.userData,i=e.event,o=e.switchRoleType;return{users:[{userId:r,extra:null===(t=n.filter((function(e){return"extra"===e.key}))[0])||void 0===t?void 0:t.value,state:i,switchRoleType:o}]}}(h),[4,new xs(R,this._traceId).execute(e,t,r)];case 7:S=I.sent().data,e.emit(Za,S),I.label=8;case 8:return m=b.next(),[3,4];case 9:return[3,12];case 10:return y=I.sent(),O={error:y},[3,12];case 11:try{m&&!m.done&&(C=b.return)&&C.call(b)}finally{if(O)throw O.error}return[7];case 12:return[2,{code:a}]}}))}))}}),t}(ka),Qs=function(e){function t(){return e.call(this)||this}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.ON_SIGNAL_RECONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Oa.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c;return I(this,(function(l){switch(l.label){case 0:return n=e.logger,i=e.peer,o=e.context,a=t.roomId,s=t.roomMode,c=n.createTraceId(),n.info(T.L_ABSTRACT_ROOM_IM_RECONNECTED_T,void 0,c),"closed"===i.getRTCPeerConn().connectionState?(n.error(T.L_ABSTRACT_ROOM_IM_RECONNECTED_R,"RTCPeerConnection closed. Please rejoin room to restore services",c),e.emit(Ga),[2,{code:ze.SUCCESS}]):[4,o.rtcPing(a,s)];case 1:return l.sent().code,[4,this._joinRoom(e,t,r,c)];case 2:return l.sent()!==u.SUCCESS?[3,4]:[4,this._restoreMediaServer(e,t,r)];case 3:l.sent(),l.label=4;case 4:return[3,7];case 5:return[4,new zs(a,c,o).execute(e,t,r)];case 6:l.sent(),l.label=7;case 7:return[2,{code:ze.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"_joinRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c;return I(this,(function(l){switch(l.label){case 0:return i=e.context,o=e.logger,[4,i.joinRTCRoom(t.roomId,t.roomMode)];case 1:return a=l.sent(),s=a.code,c=a.data,s!==u.SUCCESS?(o.error(T.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:E.FAILED,code:s,msg:"im reconnect joinRTCRoom failed"}),n),[2]):c?[4,Ns(c,t,e,r,n)]:(o.info(T.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:E.FAILED,msg:"im reconnect joinRTCRoom, roomData is empty"}),n),[2]);case 2:return l.sent(),o.info(T.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:E.SUCCEEDED,roomData:c}),n),[2,s]}}))}))}}),Object.defineProperty(t.prototype,"_restoreMediaServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i;return I(this,(function(o){switch(o.label){case 0:return n=e.peer.getLocalTracks(),i=Object.values(t.getRemoteTracks()).filter((function(e){return!!e.isSubscribed()})),n.length?[4,new Js(n).execute(e,t,r)]:[3,2];case 1:o.sent(),o.label=2;case 2:return n.length||!i.length?[3,4]:[4,new Vs(i,!0).execute(e,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))}}),t}(ka);!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(Ws||(Ws={}));var Ys,Zs,Xs,$s=function(e){function t(t,r){var n=e.call(this)||this;return Object.defineProperty(n,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"status",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.LOCAL_TRACK_DEVICE_STATUS_CHANGE_MUTE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l,d,_,p,f,b,m,h;return I(this,(function(g){r=e.logger,n=e.context,i=this.localTrack,o=i.getTrackId(),a=t.crtUserId,s=t.roomId,c=i.getDeviceAvailable(!0),u=r.createTraceId(),r.info(T.L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_T,JSON.stringify({status:c,trackId:this.localTrack.getTrackId()}),u),l=t.getResourcesByUserId(a),d=[];try{for(_=L(l),p=_.next();!p.done;p=_.next())if(f=p.value,b=ao(f),o===b){f.code=c,d.push(f);break}}catch(e){m={error:e}}finally{try{p&&!p.done&&(h=_.return)&&h.call(_)}finally{if(m)throw m.error}}return t.retrySignalingMannger.push({name:wa.Muted,execute:function(){return n.setRTCTotalRes(s,to(l),wo.TOTAL_CONTENT_RESOURCE)}}),r.info(T.L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_R,void 0,u),[2,{code:ze.SUCCESS}]}))}))}}),t}(ka),ec=1,tc=5,rc=function(){function e(e,t,r,n){var i=this;Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_baseReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_networkReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pubOrSubSuccessTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_peerCStatus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reportQualityJoinRoomData",{enumerable:!0,configurable:!0,writable:!0,value:function(e,t,r,n){i._baseReportData=Object.assign(i._baseReportData,{snid:n});var o=O(O(O({},i._baseReportData),i._networkReportData),{cod:t,time:e,dur:Date.now()-e,rtp:r});i._logger.__statistics(T.L_QS_JOIN_ROOM_S,JSON.stringify(o))}}),this._baseReportData={rid:this._roomId,csnid:this._clientSessionId,snid:"",time:Date.now(),uid:this._userId},this._networkReportData={cr:"unknown",net:"unknown"}}return Object.defineProperty(e.prototype,"reportQualityKickedData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=O(O(O({},this._baseReportData),this._networkReportData),{time:Date.now(),cod:e===na.OTHER_KICK?tc:ec});this._logger.__statistics(T.L_QS_KICKED_S,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=this;r.forEach((function(r){var s,c,u=r instanceof qi||r instanceof Ma?r:r.track,l=u.getTrackId(),d=so(l).mediaType,_=!1;_=u instanceof qi?!!u.isVideoTrack()&&(null===(c=(s=u).__isTiny)||void 0===c?void 0:c.call(s)):r.subTiny||!1;var p=O(O(O({},a._baseReportData),a._networkReportData),{resid:l,mtp:d,smct:_?Uo.TINY:Uo.NORMAL,stp:"Rongcloud"!==u.getTag()?1:0,cod:n,msas:i?i[l]:[],sigs:o,time:Date.now(),dur:Date.now()-t});switch(e){case"pub":a._logger.__statistics(T.L_QS_PUBLISH_S,JSON.stringify(p));break;case"unpub":a._logger.__statistics(T.L_QS_UNPUBLISH_S,JSON.stringify(p));break;case"sub":a._logger.__statistics(T.L_QS_SUBSCRIBE_S,JSON.stringify(p));break;case"unsub":a._logger.__statistics(T.L_QS_UNSUBSCRIBE_S,JSON.stringify(p))}}))}}),Object.defineProperty(e.prototype,"reportQualityRecvPubMsgData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=O(O(O({},this._baseReportData),this._networkReportData),{puid:t,time:Date.now(),dur:Date.now()-e});this._logger.__statistics(T.L_QS_RECV_PUB_MSG_S,JSON.stringify(r))}}),Object.defineProperty(e.prototype,"setPubOrSubSuccessTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pubOrSubSuccessTime=e}}),Object.defineProperty(e.prototype,"reportIceFirstConnectData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=O(O(O({},this._baseReportData),this._networkReportData),{time:this._pubOrSubSuccessTime,dur:Date.now()-this._pubOrSubSuccessTime}),r="pub"===e?T.L_QS_PUB_ICE_STATUS_S:T.L_QS_SUB_ICE_STATUS_S;this._logger.__statistics(r,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"recordQualityIceStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this._peerCStatus||{},i=n.status,o=n.time;if(o){var a=e.IP,s=e.port,c=e.networkType,u=e.remoteIP,l=e.remotePort,d=O(O(O({},this._baseReportData),this._networkReportData),{dur:r-o,time:r,pices:Sa[i],ices:Sa[t],rcdts:[{ip:"".concat(u,":").concat(l)}],lcdts:[{ip:"".concat(a,":").concat(s),nttp:c}],cncdts:[]});this._logger.__statistics(T.L_QS_ICE_STATUS_S,JSON.stringify(d)),this._peerCStatus={status:t,time:r}}else this._peerCStatus={status:t,time:r}}}),e}(),nc="evt-leave",ic=function(e){function t(t,r,n,i,o,a,s,c,u,l,d){void 0===u&&(u=Ri()),void 0===l&&(l=!1);var _=e.call(this)||this;Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(_,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_service",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(_,"_pinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_peerConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_trackSentTimer",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(_,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null});var p=_._logger=_._context.logger;_._reportMediaActionLogger=new rc(p,_._roomId,_._clientSessionId,_._context.getCurrentId()),_._polarisReport=new Pa(_._context,_._runtime,_._roomId,_);var f=_._context.getCurrentId(),b=new Va(p,u,_._context.getAppkey(),n,f,i,s,c,!1,d),m=_._peerConnection=new Ra(p,_._reTryExchange.bind(_),f,b,_._polarisReport,l);_._setPeerConnectionListener();var h=_._executeCtx=new $a(p,_._service,t,r,m,b,_._polarisReport,_._reportMediaActionLogger);return _.setCommandEventListener(),_._invoker=new Na(h,b),_._store=_._invoker.store,_._audioLevelReport=new Aa(_._store,m),m.on(Ra.__INNER_AUDIOLEVEL_CHANGE__,_._audioLevelReport.audioLevelReport,_._audioLevelReport),_._pinger=new jo(_._context,_._roomId,i,_._initOptions.pingGap),_._pinger.onFailed=_.__kickoff.bind(_),_._pinger.onPingResult=_._handlePingResult.bind(_),_._context.registerRTCSignalListener((function(e){return C(_,void 0,void 0,(function(){var t,r,n,i,o;return I(this,(function(a){if(t=this._context.decodeRtcNotify(e),r=t.time,n=t.type,i=t.roomId,o=p.createTraceId(),this._invoker.isDestroyed())return p.info(T.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:n,time:r,roomId:i})),[2];if(2===n){if(i!==this._roomId)return[2];p.info(T.L_RTCNTF_PULL_ROOM_STATUS_O,null,o),this._startPullRTCRoomStatus(i,o,r)}return[2]}))}))})),_}return y(t,e),Object.defineProperty(t.prototype,"_setPeerConnectionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._peerConnection;t.on(Ra.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(qi.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(qi.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(Ra.__INNER_ICE_CONNECTED__,(function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")}),this),t.on(Ra.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,n=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,r,n)}))}}),Object.defineProperty(t.prototype,"setCommandEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._executeCtx;e.on(Ga,this._rtcpeerClosed,this),e.on(qa,this._callAppListener.bind(this,"onUserJoin"),this),e.on(Ka,this._callAppListener.bind(this,"onUserLeave"),this),e.on(Wa,this._onTrackPublish,this),e.on(za,this._onTrackUnpublish,this),e.on(Qa,this._onAudioMuteChange,this),e.on(Ya,this._onVideoMuteChange,this),e.on(Za,this._dealUserAppListener,this),e.on(Xa,this._onTrackDeviceStatusChange,this)}}),Object.defineProperty(t.prototype,"_startPullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){return I(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new zs(e,t,this._context,r))];case 1:return n.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===e&&(e=Ji.RTC),C(this,void 0,void 0,(function(){var o,a,s;return I(this,(function(c){switch(c.label){case 0:return[4,this._invoker.push(new Ha(this._roomId,e,t,r,n,i))];case 1:return o=c.sent(),a=o.code,s=o.data,a!==ze.SUCCESS?[2,{code:a}]:(this._initWithRoomData(s.offlineKickTime),[2,{code:a,data:s}])}}))}))}}),Object.defineProperty(t.prototype,"_initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pinger.start(1e3*e),this._polarisReport.sendR1()}}),Object.defineProperty(t.prototype,"_handlePingResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(e===ko.SUCCESS){var r=this._store.getRoomStatusVersion(),n=String(t).length-String(r).length;if(n<0?t&&(t*=Math.pow(10,n)):r&&(r*=Math.pow(10,n)),t>r){var i=this._logger.createTraceId();this._logger.info(T.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),i),this._startPullRTCRoomStatus(this._roomId,i,t)}}this._callAppListener("onPing",e)}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(T.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),_("max",e,(function(e){return o(e)&&e>Math.max(t||1,200)}),!0),_("min",t,(function(t){return o(t)&&t>=1&&(!o(e)||t<e)}),!0),_("start",r,(function(r){return o(r)&&r>t&&r<=e})),this._peerConnection.setBitrate(e,t,r)}}),Object.defineProperty(t.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.streams[0].id,r=e.receiver.track,n=[t,"audio"===r.kind?Bo.AUDIO_ONLY:Bo.VIDEO_ONLY].join("_"),i=this._store.getRemoteTrack(n);i?i.isReady()?i.__innerSetMediaStreamTrack(r):(i.__innerSetMediaStreamTrack(r),this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onTrackReady",trackId:i.getTrackId()})),this._callAppListener("onTrackReady",i)):this._logger.warn(T.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(r.id))}}),Object.defineProperty(t.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=null===(t=this._appListener)||void 0===t?void 0:t[e];if(i)try{i.apply(void 0,A([],P(r),!1))}catch(e){this._logger.error(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}}),Object.defineProperty(t.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackUnpublish",e)}}),Object.defineProperty(t.prototype,"_onTrackDeviceStatusChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onTrackDeviceStatusChange",tracks:null==e?void 0:e.map((function(e){var t;return{trackId:null===(t=null==e?void 0:e.track)||void 0===t?void 0:t.getTrackId(),status:null==e?void 0:e.status}}))}))}}),Object.defineProperty(t.prototype,"__parseInnerMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.targetId;if(e.conversationType,r===this._roomId){this._logger.info(T.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var n=e.content;switch(e.messageType){case wo.KICK:this.__kickoff(!0,n);break;case wo.STATE:this._stateHandle(n,t);break;case wo.MODIFY:case wo.PUBLISH:case wo.UNPUBLISH:case wo.TOTAL_CONTENT_RESOURCE:this._resourceHandle(n,e.messageType,e.senderUserId,e.sentTime,t);break;case wo.ROOM_NOTIFY:this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case wo.USER_NOTIFY:this._logger.warn(T.L_OLD_DAILY_RECORD_O,"TODO: ".concat(wo.USER_NOTIFY));break;case wo.PK_INVITE:case wo.PK_CANCEL_INVITE:case wo.PK_INVITE_TIMEOUT:case wo.PK_INVITE_ANSWER:case wo.PK_END:case wo.OTHER_ROOM_OFFLINE:default:this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,n,e.senderUserId,e.messageUId)}}else this._logger.warn(T.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:E.FAILED,message:"roomId is different, msg roomId-> ".concat(r,", this._roomId-> ").concat(this._roomId," ")}),t)}}),Object.defineProperty(t.prototype,"__kickoff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i=this;return I(this,(function(o){return this._invoker.isDestroyed()||(this._logger.warn(T.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(nc),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach((function(e){e.userId===i._context.getCurrentId()&&(n=e.type,r=e.kickExtra,i._reportMediaActionLogger.reportQualityKickedData(n))})),this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onKickOff",byServer:e,kickType:n,kickExtra:r})),this._callAppListener("onKickOff",e,n,r)),[2]}))}))}}),Object.defineProperty(t.prototype,"mockKickOff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.__kickoff(e,{users:[{userId:this.getCrtUserId(),type:t}]})}}),Object.defineProperty(t.prototype,"_rtcpeerClosed",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(nc),this._leaveHandle(!0),this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}}),Object.defineProperty(t.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return C(this,void 0,void 0,(function(){var o;return I(this,(function(a){return o=e.uris,e.ignore||!o||this._invoker.push(new Fs(e,t,r,i,n)),[2]}))}))}}),Object.defineProperty(t.prototype,"_onTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackPublish",e)}}),Object.defineProperty(t.prototype,"_stateHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i;return I(this,(function(o){switch(o.label){case 0:return[4,this._invoker.push(new xs(e,t))];case 1:return r=o.sent(),n=r.code,i=r.data,n===ze.SUCCESS&&this._dealUserAppListener(i),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUserAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=e.left,n=e.joined,i=$e.getMemo(),o=A([],P(n),!1),a=A([],P(r),!1);if(o.length>0){this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onUserJoin",allJoined:o}));var s=i.crtRoom,c=null==s?void 0:s.getRemoteUserIds();if(0!==(null==c?void 0:c.length)){var u=null==s?void 0:s.getLocalTracks();null==u||u.forEach((function(e){var r;t._peerConnection.enableSenderEncodingsByTrackId(null===(r=e.__innerGetMediaStreamTrack())||void 0===r?void 0:r.id)}))}this._callAppListener("onUserJoin",o)}a.length>0&&(a.length&&this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onUserLeave",allLeft:a})),this._callAppListener("onUserLeave",a))}}),Object.defineProperty(t.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(t.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(t.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getRemoteUserIds()}}),Object.defineProperty(t.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach((function(r){t.push.apply(t,A([],P(e.getRemoteTracksByUserId(r)),!1))})),t}}),Object.defineProperty(t.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTracksByUserId(e)}}),Object.defineProperty(t.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getSessionId()}}),Object.defineProperty(t.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n;return I(this,(function(i){switch(i.label){case 0:return r=this._logger.createTraceId(),this._logger.info(T.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:e,content:t}),r),[4,this._context.sendMessage(p.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0})];case 1:return(n=i.sent().code)!==u.SUCCESS?(this._logger.error(T.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:E.FAILED,code:n}),r),[2,{code:ze.SIGNAL_ERROR}]):(this._logger.info(T.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:E.SUCCEEDED,name:e,content:t}),r),[2,{code:ze.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"setRoomAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),C(this,void 0,void 0,(function(){var i,o;return I(this,(function(a){switch(a.label){case 0:return i=this._logger.createTraceId(),this._logger.info(T.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,key:e,value:t,message:r,isInner:n}),i),[4,this._context.setRTCData(this._roomId,e,t,n,Ws.ROOM,r)];case 1:return(o=a.sent())!==u.SUCCESS?(this._logger.error(T.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:E.FAILED,code:o}),i),[2,{code:ze.SIGNAL_ERROR}]):(this._logger.info(T.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:E.SUCCEEDED,roomId:this._roomId,key:e,value:t,message:r,isInner:n}),i),[2,{code:ze.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"deleteRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),C(this,void 0,void 0,(function(){var n,i;return I(this,(function(o){switch(o.label){case 0:return n=this._logger.createTraceId(),this._logger.info(T.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:e,message:t,isInner:r}),n),[4,this._context.removeRTCData(this._roomId,e,r,Ws.ROOM,t)];case 1:return(i=o.sent())!==u.SUCCESS?(this._logger.error(T.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:E.FAILED,code:i}),n),[2,{code:ze.SIGNAL_ERROR}]):(this._logger.info(T.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:E.SUCCEEDED,roomId:this._roomId,keys:e,message:t,isInner:r}),n),[2,{code:ze.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"getRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=!1),C(this,void 0,void 0,(function(){var r,n,i,o;return I(this,(function(a){switch(a.label){case 0:return r=this._logger.createTraceId(),this._logger.info(T.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:e,isInner:t}),r),[4,this._context.getRTCData(this._roomId,e,t,Ws.ROOM)];case 1:return n=a.sent(),i=n.code,o=n.data,i!==u.SUCCESS?(this._logger.error(T.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(i),r),[2,{code:ze.SIGNAL_ERROR}]):(this._logger.info(T.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:E.SUCCEEDED,data:o}),r),[2,{code:ze.SUCCESS,data:o}])}}))}))}}),Object.defineProperty(t.prototype,"_setUserAttributeValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,Ws.PERSON,r)}}),Object.defineProperty(t.prototype,"_deleteUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,Ws.PERSON,t)}}),Object.defineProperty(t.prototype,"_getUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._context.getRTCData(this._roomId,e,!1,Ws.PERSON)}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.isDestroyed()}}),Object.defineProperty(t.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._leaveHandle(e)}}),Object.defineProperty(t.prototype,"__destroyMock",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._leaveHandleMock()}}),Object.defineProperty(t.prototype,"_muteRemoteTracksBeforeQuit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._store.getRemoteTracks());e.length&&e.forEach((function(e){return e.mute()}))}}),Object.defineProperty(t.prototype,"_leaveHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){switch(t.label){case 0:return this._invoker.isDestroyed()?[2]:($e.destroy(),this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),e?[4,this._context.quitRTCRoom(this._roomId)]:[3,2]);case 1:t.sent(),t.label=2;case 2:return this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())];case 3:return t.sent(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_leaveHandleMock",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return I(this,(function(e){switch(e.label){case 0:return this._invoker.isDestroyed()?[2]:($e.destroy(),this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())]);case 1:return e.sent(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_releasePCManager",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._peerConnection;e.off(qi.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(qi.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.off(qi.__INNER_EVENT_SEND_CHANGE__,this._onLocalTrackSent,this),e.off(qi.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this._onLocalTrackDeviceStatusChanged,this),e.removeAllLocalTrack(),e.clear(),e.destroy()}}),Object.defineProperty(t.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e instanceof Wi&&e.__isTiny()||this.unpublish([e])}}),Object.defineProperty(t.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r;return I(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new qs(e))];case 1:return r=n.sent().code,t(r),[2]}}))}))}}),Object.defineProperty(t.prototype,"_onLocalTrackDeviceStatusChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._invoker.push(new $s(e,t))}}),Object.defineProperty(t.prototype,"_onLocalTrackSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=this,i=null===(r=e.__innerGetMediaStreamTrack())||void 0===r?void 0:r.id;i&&clearTimeout(this._trackSentTimer[i]);var o=this._context.getNaviInfo(),a=(null==o?void 0:o.pauseVideoDelayMs)||-1;-1!==a&&i&&(t?this._trackSentTimer[i]=setTimeout((function(){n._logger.info(T.L_PAUSE_VIDEO_R,JSON.stringify({userId:e.getUserId(),trackId:e.getTrackId(),state:!0})),n._peerConnection.disableSenderEncodingsByTrackId(i)}),a):(this._logger.info(T.L_PAUSE_VIDEO_R,JSON.stringify({userId:e.getUserId(),trackId:e.getTrackId(),state:!1})),this._peerConnection.enableSenderEncodingsByTrackId(i)))}}),Object.defineProperty(t.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){return[2,this._invoker.push(new Js(e))]}))}))}}),Object.defineProperty(t.prototype,"publishAndSubscribeStreams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!0),C(this,void 0,void 0,(function(){return I(this,(function(i){return[2,this._invoker.push(new Gs(e,t,void 0,r,n))]}))}))}}),Object.defineProperty(t.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Ks)}}),Object.defineProperty(t.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){return[2,this._invoker.push(new Hs(e))]}))}))}}),Object.defineProperty(t.prototype,"_getResourceById",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getPublishedResourceByTrackId(e)}}),Object.defineProperty(t.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=so(e).identifier,n=this._store.getUserIdByMeid(r);return!!(null===(t=this._store.getResourcesByUserId(n))||void 0===t?void 0:t.find((function(t){return ao(t)===e})))}}),Object.defineProperty(t.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){return[2,this._invoker.push(new Vs(e,void 0,void 0))]}))}))}}),Object.defineProperty(t.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return I(this,(function(r){return t=this._logger.createTraceId(),this._logger.info(T.L_APP_CALL_UNSUBSCRIBE_O,void 0,t),[2,this._invoker.push(new Ps(e,t))]}))}))}}),Object.defineProperty(t.prototype,"updateSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t=!0),C(this,void 0,void 0,(function(){return I(this,(function(r){return[2,this._invoker.push(new Ls(e,t,this._logger.createTraceId(),void 0,void 0,2))]}))}))}}),Object.defineProperty(t.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._peerConnection.getLocalTrack(e)}}),Object.defineProperty(t.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._peerConnection.getLocalTracks()}}),Object.defineProperty(t.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTrack(e)||null}}),Object.defineProperty(t.prototype,"subscribedTracks",{get:function(){return this._store.getSubscribedList().slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,listener:e&&Object.keys(e)})),this._appListener=e}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;null===(r=null===(t=this._context)||void 0===t?void 0:t.logger)||void 0===r||r.info(T.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,listener:e&&Object.keys(e)})),this._peerConnection.registerReportListener(e)}}),Object.defineProperty(t.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n;null===(n=null===(r=this._context)||void 0===r?void 0:r.logger)||void 0===n||n.info(T.L_ABSTRACT_ROOM_AUDIO_LEVEL_O,JSON.stringify({status:E.SUCCEEDED,handler:null==e?void 0:e.name,gap:t})),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(t.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._invoker.push(new Qs)}}),Object.defineProperty(t.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}}),Object.defineProperty(t.prototype,"_onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}}),Object.defineProperty(t.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._clientSessionId}}),t}(a),oc=function(e){function t(t,r,n,i,o,a,s,c){return void 0===a&&(a=Ji.RTC),void 0===s&&(s=!1),void 0===c&&(c=!1),e.call(this,t,r,n,a,i,o,!1,!1,Ri(),s,c)||this}return y(t,e),t}(ic),ac=function(e){function t(t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=0);var o=e.call(this)||this;return Object.defineProperty(o,"list",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"tryCount",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:i}),o.tryCount>0&&o.logger.warn(T.L_RETRY_SUB_AUDIO_O,JSON.stringify({list:o.list,tryCount:o.tryCount,version:o.timestamp})),o}return y(t,e),Object.defineProperty(t.prototype,"priority",{get:function(){return Oa.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.MeetingAudioSubCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,d,_,p=this;return I(this,(function(f){switch(f.label){case 0:for(e.logger,i=e.subPeer,o=r.crtUserId,a=this.list.length-1;a>=0;a-=1)s=co(this.list[a].mslabel).identifier,r.getUserIdByMeid(s)===o&&this.list.splice(a,1);return c=[],u=[],l=[],this.list.forEach((function(e){var t="".concat(e.mslabel,"_0"),n=r.getRemoteTrack(t);n?(u.push(e),l.push(n)):c.push(e)})),r.meetingAudioSubCommandStamp>this.timestamp?[2,{code:ze.SUCCESS}]:(c.length&&this.tryCount<10&&setTimeout((function(){n.push(new t(c,p.logger,p.tryCount+1,p.timestamp))}),100+150*this.tryCount),0===u.length?[2,{code:ze.SUCCESS}]:[4,i.addAudioSubList(u)]);case 1:return d=f.sent(),_=r.getSubscribedList().slice(),l.forEach((function(e){e.__innerSetSubscribed(!0),_.every((function(t){return t.track.getTrackId()!==e.getTrackId()}))&&_.push({track:e})})),r.resetSubscribedList(_),[2,{code:d}]}}))}))}}),t}(ka),sc=function(e){function t(t,r,n,i,o){var a=e.call(this)||this;return Object.defineProperty(a,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:Ji.RTC}),a}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.MeetingJoinRoomCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(e.getConnectionStatus()!==i.CONNECTED)return t.error(r,JSON.stringify({status:E.FAILED,code:ze.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:ze.SIGNAL_DISCONNECTED};if(e.getNaviInfo(),!s("roomId",this.roomId,l,!0))return t.error(r,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:ze.PARAMS_ERROR};if(!s("roomType",this.roomType,(function(e){return void 0!==Ji[e]})))return t.error(r,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:ze.PARAMS_ERROR};if(!s("outerUserDatas",this.outerUserDatas,c,!1))return t.error(r,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:ze.PARAMS_ERROR};if(this.outerUserDatas&&!Object.keys(this.outerUserDatas).every((function(e){return s("outerUserDatas.".concat(e),n.outerUserDatas[e],d,!0)})))return t.error(r,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:ze.PARAMS_ERROR};return{code:ze.SUCCESS}}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,l,d,_,p,f,b,m,h,g,v,R,S;return I(this,(function(y){switch(y.label){case 0:return n=Date.now(),i=e.context,o=e.service,a=e.subPeer,s=e.logger,c=e.reportMediaActionLogger,l=T.L_RTC_CLIENT_JOIN_RTC_ROOM_R,(d=this._validateParams(i,s,l).code)!==ze.SUCCESS?[2,{code:d}]:(o.detectorMediaSever(),o.getNaviMS().length?(_=t.getSupportNtf(),[4,i.joinRTCRoom(this.roomId,this.roomType,this.joinType,this.innerUserDatas,this.outerUserDatas,_)]):(s.error(l,JSON.stringify({status:E.FAILED,code:ze.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),[2,{code:ze.NOT_OPEN_VIDEO_AUDIO_SERVER}]));case 1:return p=y.sent(),f=p.code,b=p.data,c.reportQualityJoinRoomData(n,f,this.roomType,null==b?void 0:b.sessionId),f===u.SUCCESS&&b?(t.initWithRoomData(b,this.traceId),h=[],t.getRemoteUserIds().forEach((function(e){var r=t.getRemoteTracksByUserId(e).filter((function(e){return e.isAudioTrack()})).map((function(e){return t.getPublishedResourceByTrackId(e.getTrackId())})).map((function(e){return{uri:e.uri}}));h.push.apply(h,A([],P(r),!1))})),[4,a.exchangeDatachannel(h,!1)]):(m=40032===f?ze.SIGNAL_JOIN_RTC_ROOM_REFUSED:f,s.error(l,JSON.stringify({status:E.FAILED,code:m,msg:"joinRoom failed"}),this.traceId),[2,{code:m}]);case 2:return g=y.sent(),v=g.code,R=g.activeAudioList,v!==ze.SUCCESS?[2,{code:v}]:(t.getResourcesByUserId(t.crtUserId).length>0&&r.push(new Ja),S=Date.now(),t.setMeetingAudioSubCommandStamp(S),R.length>0&&r.push(new ac(R,s,0,S)),s.info(l,JSON.stringify({status:E.SUCCEEDED,userId:t.crtUserId,roomId:this.roomId}),this.traceId),[2,{code:ze.SUCCESS,data:b}])}}))}))}}),t}(ka);!function(e){e[e.SSRC=1]="SSRC",e[e.MediaResource=2]="MediaResource",e[e.VideoResourceInfo=3]="VideoResourceInfo",e[e.VideoOperReq=4]="VideoOperReq",e[e.MediaOperErrInfo=5]="MediaOperErrInfo",e[e.VideoOperRes=6]="VideoOperRes",e[e.AudioNtf=7]="AudioNtf",e[e.AudioNtfAck=8]="AudioNtfAck",e[e.DataChannelOpen=13]="DataChannelOpen"}(Zs||(Zs={})),function(e){e.SSRC="SSRC",e.MediaResource="MediaResource",e.VideoResourceInfo="VideoResourceInfo",e.VideoOperReq="VideoOperReq",e.MediaOperErrInfo="MediaOperErrInfo",e.VideoOperRes="VideoOperRes",e.AudioNtf="AudioNtf",e.AudioNtfAck="AudioNtfAck",e.DataChannelOpen="DataChannelOpen"}(Xs||(Xs={}));var cc,uc,lc,dc,_c,pc=((Ys={})[Xs.SSRC]=["ssrc","cname","mslabel","label","rtcSSRC","fecSSRC"],Ys[Xs.MediaResource]=["ssrc","userId"],Ys[Xs.VideoResourceInfo]=["userId","mslabel","uri","simulcast","rtxSSRC","fecSSRC"],Ys[Xs.VideoOperReq]=["requestId","videoList"],Ys[Xs.MediaOperErrInfo]=["userId","mslabel","code","message"],Ys[Xs.VideoOperRes]=["requestId","code","message","videoList","errList"],Ys[Xs.AudioNtf]=["requestId","audioList"],Ys[Xs.AudioNtfAck]=["requestId"],Ys[Xs.DataChannelOpen]=["timeStamp"],Ys),fc="\npackage Modules;\nmessage probuf {\n message ".concat(Xs.SSRC," {\n optional uint64 ssrc = 1;\n optional string cname = 2;\n optional string mslabel = 3;\n optional string label = 4;\n optional uint64 rtxSSRC = 5; \n optional uint64 fecSSRC = 6;\n }\n message ").concat(Xs.MediaResource," {\n optional string userId = 1;\n optional ").concat(Xs.SSRC," ssrc = 2;\n }\n message ").concat(Xs.VideoResourceInfo," {\n optional string userId = 1;\n optional string mslabel = 2;\n optional string uri = 3;\n optional bool simulcast = 4;\n optional uint64 rtxSSRC = 5;\n optional uint64 fecSSRC = 6;\n }\n message ").concat(Xs.VideoOperReq," {\n optional string requestId = 1;\n repeated ").concat(Xs.VideoResourceInfo," videoList = 2;\n optional uint64 timeStamp = 3;\n }\n message ").concat(Xs.MediaOperErrInfo," {\n optional string userId = 1;\n optional string mslabel = 2;\n optional uint32 code = 3;\n optional string message = 4;\n }\n message ").concat(Xs.VideoOperRes," {\n optional string requestId = 1;\n optional uint32 code = 2;\n optional string message = 3;\n repeated ").concat(Xs.MediaResource," videoList = 4;\n repeated ").concat(Xs.MediaOperErrInfo," errList = 5;\n optional uint64 timeStamp = 6;\n }\n message ").concat(Xs.AudioNtf," {\n optional string requestId = 1;\n repeated ").concat(Xs.MediaResource," audioList = 2;\n optional uint64 timeStamp = 3;\n }\n message ").concat(Xs.AudioNtfAck," {\n optional string requestId = 1;\n optional uint64 timeStamp = 2;\n }\n message ").concat(Xs.DataChannelOpen," {\n optional uint64 timeStamp = 1;\n }\n}\n"),bc=function(){function e(e){Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:e})}return Object.defineProperty(e.prototype,"addAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"removeAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"createOfferTemplate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"parseAnswerTemplate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"updateVideoSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"setDescriptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){throw new Error("Method not implemented.")}}),e}(),mc=function(){function e(){Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_locked",{enumerable:!0,configurable:!0,writable:!0,value:!1})}return Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._queue.push(e),this._execute()}}),Object.defineProperty(e.prototype,"_execute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return I(this,(function(e){switch(e.label){case 0:return this._queue.length>0&&!this._locked?(this._locked=!0,[4,this._queue.shift()()]):[3,2];case 1:e.sent(),this._locked=!1,this._execute(),e.label=2;case 2:return[2]}}))}))}}),e}(),hc=function(){function e(e,t){Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_answerHeader",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_answerSectionApp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_answerSectionAudio",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_answerSectionVideo",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_crtSubAudioList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_crtSubVideoList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_setDescriptionsQueue",{enumerable:!0,configurable:!0,writable:!0,value:new mc})}return Object.defineProperty(e.prototype,"createOfferTemplate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n;return C(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,d;return I(this,(function(_){switch(_.label){case 0:if(o="",a="",e)return[3,12];_.label=1;case 1:return _.trys.push([1,3,,4]),[4,this._peer.createOffer()];case 2:return i=_.sent(),[3,4];case 3:return s=_.sent(),this._logger.error(T.L_SUB_PEER_CREATE_OFFER_E,JSON.stringify({sdp:i,errorStack:s.stack})),d=$e.getMemo(),null===(t=d.crtRoom)||void 0===t||t.mockKickOff(!1,na.RTC_INNER_KICK),[3,4];case 4:return _.trys.push([4,6,,7]),[4,this._peer.setLocalDescription(i)];case 5:return _.sent(),[3,7];case 6:return c=_.sent(),this._logger.error(T.L_SUB_PEER_SET_LOCAL_DESC_E,JSON.stringify({sdp:i,errorStack:c.stack})),[3,7];case 7:this._peer.addTransceiver("audio",{direction:"inactive"}),this._peer.addTransceiver("video",{direction:"inactive"}),_.label=8;case 8:return _.trys.push([8,10,,11]),[4,this._peer.createOffer()];case 9:return i=_.sent(),(null==(a=i.sdp)?void 0:a.includes("a=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=rtcp-fb:111 nack\r\na=rtcp-fb:111 nack pli"))||(a=null==a?void 0:a.replace(/(a=rtpmap:111 opus\/48000\/2\r\na=rtcp-fb:111 transport-cc)/g,"$1\r\na=rtcp-fb:111 nack\r\na=rtcp-fb:111 nack pli")),o=a,[3,11];case 10:return u=_.sent(),this._logger.error(T.L_SUB_PEER_CREATE_OFFER_E,JSON.stringify({sdp:i,errorStack:u.stack})),d=$e.getMemo(),null===(r=d.crtRoom)||void 0===r||r.mockKickOff(!1,na.RTC_INNER_KICK),[3,11];case 11:return[3,15];case 12:return _.trys.push([12,14,,15]),[4,this._peer.createOffer({iceRestart:!0})];case 13:return i=_.sent(),(null==(a=i.sdp)?void 0:a.includes("a=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=rtcp-fb:111 nack\r\na=rtcp-fb:111 nack pli"))||(a=null==a?void 0:a.replace(/(a=rtpmap:111 opus\/48000\/2\r\na=rtcp-fb:111 transport-cc)/g,"$1\r\na=rtcp-fb:111 nack\r\na=rtcp-fb:111 nack pli")),o=this._transOffer2Template(a),[3,15];case 14:return l=_.sent(),this._logger.error(T.L_SUB_PEER_CREATE_OFFER_E,JSON.stringify({sdp:i,errorStack:l.stack})),d=$e.getMemo(),null===(n=d.crtRoom)||void 0===n||n.mockKickOff(!1,na.RTC_INNER_KICK),[3,15];case 15:return this._logger.info(T.L_SUB_PEER_SET_OFFER_O,a),[2,{type:"offer",sdp:a,semantics:"unified-plan",template:o}]}}))}))}}),Object.defineProperty(e.prototype,"_transOffer2Template",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"".concat(e.replace(/a=group:BUNDLE(\s\d+)+/,"a=group:BUNDLE 0 1 2").split(/\r\n(?=m=)/).slice(0,4).join("\r\n"),"\r\n")}}),Object.defineProperty(e.prototype,"setDescriptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i;return I(this,(function(o){switch(o.label){case 0:return[4,this._peer.setLocalDescription({type:"offer",sdp:t.sdp})];case 1:return o.sent(),e?[3,3]:[4,this._peer.setRemoteDescription({type:"answer",sdp:r})];case 2:case 4:return o.sent(),this._logger.info(T.L_SUB_PEER_SET_REMOTE_DESC_O,r),[2];case 3:return n=this._crtSubAudioList.map((function(e){return O({},e)})),i=this._crtSubVideoList.map((function(e){return O({},e)})),r=this._generateSDPAnswer(t.sdp.match(/a=group:BUNDLE(\s\d+)+/)[0],n,i),[4,this._peer.setRemoteDescription({type:"answer",sdp:r})]}}))}))}}),Object.defineProperty(e.prototype,"parseAnswerTemplate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;t=P(e.split(/\r\n(?=$|m=)/),4),this._answerHeader=t[0],this._answerSectionApp=t[1],this._answerSectionAudio=t[2],this._answerSectionVideo=t[3]}}),Object.defineProperty(e.prototype,"addAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r=this;return I(this,(function(n){return t=!1,e.forEach((function(e){var n=e.ssrc,i=e.mslabel,o=r._crtSubAudioList.findIndex((function(e){return e.mslabel===i}));-1===o?(r._crtSubAudioList.push(O(O({},e),{cancel:!1})),t=!0):n!==r._crtSubAudioList[o].ssrc&&(r._crtSubAudioList[o]=O(O({},e),{cancel:!1}),t=!0)})),t?[2,this._setDescriptions()]:[2,ze.SUCCESS]}))}))}}),Object.defineProperty(e.prototype,"removeAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){switch(t.label){case 0:return this._crtSubAudioList.forEach((function(t){t.cancel||(t.cancel=e.some((function(e){return t.mslabel===e})))})),[4,this._setDescriptions()];case 1:return t.sent(),[2]}}))}))}}),Object.defineProperty(e.prototype,"updateVideoSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=function(t){var r=n._crtSubVideoList[t],i=e.findIndex((function(e){return e.mslabel===r.mslabel}));-1===i?r.cancel=!0:n._crtSubVideoList[t]=O(O({},e.splice(i,1)[0]),{cancel:!1})},n=this,i=this._crtSubVideoList.length-1;i>=0;i-=1)r(i);return e.length&&(t=this._crtSubVideoList).push.apply(t,A([],P(e.map((function(e){return O(O({},e),{cancel:!1})}))),!1)),this._setDescriptions()}}),Object.defineProperty(e.prototype,"_setDescriptions",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e=this;return I(this,(function(t){return[2,new Promise((function(t){var r=e._crtSubAudioList.map((function(e){return O({},e)})),n=e._crtSubVideoList.map((function(e){return O({},e)})),i=e._crtSubAudioList.map((function(e){return O({},e)})),o=e._crtSubVideoList.map((function(e){return O({},e)}));e._setDescriptionsQueue.push((function(){return C(e,void 0,void 0,(function(){var e,a,s,c,u,l,d,_=this;return I(this,(function(p){switch(p.label){case 0:this._peer.getTransceivers().forEach((function(e){var t="audio"===e.receiver.track.kind?r.shift():n.shift();t&&(e.direction=t.cancel?"inactive":"recvonly")})),r.forEach((function(e){_._peer.addTransceiver("audio",{direction:e.cancel?"inactive":"recvonly"})})),n.forEach((function(e){_._peer.addTransceiver("video",{direction:e.cancel?"inactive":"recvonly"})})),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this._peer.createOffer()];case 2:return e=p.sent(),[3,4];case 3:return a=p.sent(),this._logger.error(T.L_SUB_PEER_CREATE_OFFER_E,JSON.stringify({offer:e,errorStack:a.stack})),s=$e.getMemo(),null===(d=s.crtRoom)||void 0===d||d.mockKickOff(!1,na.RTC_INNER_KICK),[2,t(ze.CREATE_OFFER_FAILED)];case 4:return p.trys.push([4,6,,7]),[4,this._peer.setLocalDescription(e)];case 5:return p.sent(),[3,7];case 6:return c=p.sent(),this._logger.error(T.L_SUB_PEER_SET_LOCAL_DESC_E,JSON.stringify({offer:e,errorStack:c.stack})),[2,t(ze.SET_LOCAL_DESCRIPTION_FAILED)];case 7:this._logger.info(T.L_SUB_PEER_SET_OFFER_O,null==e?void 0:e.sdp),u=this._generateSDPAnswer(e.sdp.match(/a=group:BUNDLE(\s\d+)+/)[0],i,o),p.label=8;case 8:return p.trys.push([8,10,,11]),[4,this._peer.setRemoteDescription({type:"answer",sdp:u})];case 9:return p.sent(),[3,11];case 10:return l=p.sent(),this._logger.error(T.L_SUB_PEER_SET_REMOTE_DESC_E,JSON.stringify({sdp:u,errorStack:l.stack})),[2,t(ze.SET_REMOTE_DESCRIPTION_FAILED)];case 11:return this._logger.info(T.L_SUB_PEER_SET_REMOTE_DESC_O,u),[2,t(ze.SUCCESS)]}}))}))}))}))]}))}))}}),Object.defineProperty(e.prototype,"_generateSDPAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this,i=this._peer.getTransceivers().map((function(e){var i="video"===e.receiver.track.kind,o=e.mid;return i?n._formatVideoSec(o,r.shift()):n._formatAudioSec(o,t.shift())}));return A(A([this._answerHeader.replace(/a=group:BUNDLE(\s\d+)+/,e),this._answerSectionApp],P(i),!1),[""],!1).join("\r\n")}}),Object.defineProperty(e.prototype,"_formatVideoSec",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._answerSectionVideo.replace(/a=mid:\d+/,"a=mid:".concat(e));if(!t)return r;var n=t.fecSSRC,i=void 0===n?0:n,o=t.cname,a=t.mslabel,s=t.label,c=t.ssrc,u=t.cancel,l=t.rtxSSRC,d=void 0===l?0:l;return r=r.replace("a=inactive","a=".concat(u?"inactive":"sendonly","\r\na=msid:").concat(a," ").concat(s)),d&&i?[r,"a=ssrc-group:FID ".concat(c," ").concat(d),"a=ssrc-group:FEC-FR ".concat(c," ").concat(i),"a=ssrc:".concat(c," cname:").concat(o),"a=ssrc:".concat(c," msid:").concat(a," ").concat(s),"a=ssrc:".concat(c," mslabel:").concat(a),"a=ssrc:".concat(c," label:").concat(s),"a=ssrc:".concat(d," cname:").concat(o),"a=ssrc:".concat(d," msid:").concat(a," ").concat(s),"a=ssrc:".concat(d," mslabel:").concat(a),"a=ssrc:".concat(d," label:").concat(s),"a=ssrc:".concat(i," cname:").concat(o),"a=ssrc:".concat(i," msid:").concat(a," ").concat(s),"a=ssrc:".concat(i," mslabel:").concat(a),"a=ssrc:".concat(i," label:").concat(s)].join("\r\n"):d?[r,"a=ssrc-group:FID ".concat(c," ").concat(d),"a=ssrc:".concat(c," cname:").concat(o),"a=ssrc:".concat(c," msid:").concat(a," ").concat(s),"a=ssrc:".concat(c," mslabel:").concat(a),"a=ssrc:".concat(c," label:").concat(s),"a=ssrc:".concat(d," cname:").concat(o),"a=ssrc:".concat(d," msid:").concat(a," ").concat(s),"a=ssrc:".concat(d," mslabel:").concat(a),"a=ssrc:".concat(d," label:").concat(s)].join("\r\n"):i?[r,"a=ssrc-group:FEC-FR ".concat(c," ").concat(i),"a=ssrc:".concat(c," cname:").concat(o),"a=ssrc:".concat(c," msid:").concat(a," ").concat(s),"a=ssrc:".concat(c," mslabel:").concat(a),"a=ssrc:".concat(c," label:").concat(s),"a=ssrc:".concat(i," cname:").concat(o),"a=ssrc:".concat(i," msid:").concat(a," ").concat(s),"a=ssrc:".concat(i," mslabel:").concat(a),"a=ssrc:".concat(i," label:").concat(s)].join("\r\n"):[r,"a=ssrc:".concat(c," cname:").concat(o),"a=ssrc:".concat(c," msid:").concat(a," ").concat(s),"a=ssrc:".concat(c," mslabel:").concat(a),"a=ssrc:".concat(c," label:").concat(s)].join("\r\n")}}),Object.defineProperty(e.prototype,"_formatAudioSec",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._answerSectionAudio.replace(/a=mid:\d+/,"a=mid:".concat(e));if(!t)return r;var n=t.ssrc,i=t.mslabel,o=t.label,a=t.cname,s=t.cancel;return[r=r.replace("a=inactive","a=".concat(s?"inactive":"sendonly","\r\na=msid:").concat(i," ").concat(o)),"a=ssrc:".concat(n," cname:").concat(a),"a=ssrc:".concat(n," msid:").concat(i," ").concat(o),"a=ssrc:".concat(n," mslabel:").concat(i),"a=ssrc:".concat(n," label:").concat(o)].join("\r\n")}}),e}(),gc="audio_ntf",vc="inner_track_ready",Rc="sub_ice_connection_change",Sc="inner_audio_level_change",yc="inner_report_data",Tc="sub_ice_datachannel_open",Ec=function(e){function t(t,r,n,i,o,a,s){void 0===s&&(s=!1);var c=e.call(this)||this;Object.defineProperty(c,"_service",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(c,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(c,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(c,"_store",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(c,"_codec",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(c,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(c,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"reportParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"_datachannel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"_sdpProxy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"_reportStatsTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_reportR3R4ToPolarisTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_formatStatsData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_historyAudioLevelMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(c,"_trackIdToSSRC",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(c,"_maxRequestId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(c,"_rtcFinger",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(c,"_videoSubMaps",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(c,"_DCError",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_stateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null});var u=ia.getSdpSemantics(),l="unified-plan"===u&&s&&Mo()&&$o.isInit(),d=c._peer=new RTCPeerConnection({sdpSemantics:u,encodedInsertableStreams:l});return c._sdpStrategy="plan-b"===u?new aa(c._logger,d,!1):new ba(c._logger,d,l),c._peer.oniceconnectionstatechange=c._onICEConnectionStateChange.bind(c),c._peer.onconnectionstatechange=c._onConnectionStateChange.bind(c),c._peer.ontrack=c._onTrackReady.bind(c),c.reportParser=c._sdpStrategy.getStatParsr(c._peer,u,c._currentUserId,c._store),c._sdpProxy="plan-b"===u?new bc(c._peer):new hc(c._peer,c._logger),c._createDataChannel(),c}return y(t,e),Object.defineProperty(t.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.streams.length){var t=e.streams[0].id,r=e.receiver.track,n=[t,"audio"===r.kind?Bo.AUDIO_ONLY:Bo.VIDEO_ONLY].join("_");r.trackId||Object.defineProperty(r,"trackId",{value:n,writable:!1,enumerable:!1,configurable:!1}),this.emit(vc,e)}}}),Object.defineProperty(t.prototype,"_onICEConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._peer.iceConnectionState;if(this._logger.info(T.L_SUB_ICE_CONNECTION_S,e),"connected"===e)this._startStateTimer();this.emit(Rc,this._peer.iceConnectionState)}}),Object.defineProperty(t.prototype,"_onConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._logger.info(T.L_SUB_CONNECTION_S,this._peer.connectionState)}}),Object.defineProperty(t.prototype,"_onDataChannelClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._logger.info(T.L_DATACHANNEL_CLOSE_O)}}),Object.defineProperty(t.prototype,"_onDataChannelError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.debug(T.L_DATACHANNEL_E,e.toString())}}),Object.defineProperty(t.prototype,"_recvHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Uint8Array(e),r=P(t.slice(0,4),4);r[0],r[1];var n=(r[2]<<8)+r[3],i=t.slice(4),o=null;switch([Zs.VideoOperRes,Zs.AudioNtf].includes(n)&&(o=this._codec.decode(Zs[n],i)),this._logger.info(T.L_DATACHANNEL_RECV_MSG_O,JSON.stringify({type:n,data:o})),n){case Zs.VideoOperRes:this._onSubVideoRes(o);break;case Zs.AudioNtf:this._onAudioNtf(o);break;case Zs.DataChannelOpen:this._onDCReopen()}}}),Object.defineProperty(t.prototype,"_onAudioNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=e.requestId,n=e.audioList;this.sendonly(Zs.AudioNtfAck,this._codec.encode(Xs.AudioNtfAck,{requestId:r}));var i=[];n.forEach((function(e){var r,n;e.userId!==(null===(r=t._store)||void 0===r?void 0:r.crtUserId)&&(i.push(e),null===(n=t._store)||void 0===n||n.setTrackIdSSRCMap(Number(e.ssrc.ssrc),lo(t._store.getMeidByUserId(e.userId),nu.DEFAULT,Bo.AUDIO_ONLY)))})),this.emit(gc,i)}}),Object.defineProperty(t.prototype,"_sendVideoReq",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this._maxRequestId=parseInt(e)>parseInt(this._maxRequestId)?e:this._maxRequestId,new Promise((function(n){r._videoSubMaps[e]=n,r.sendonly(Zs.VideoOperReq,t)}))}}),Object.defineProperty(t.prototype,"_onSubVideoRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.requestId,r=this._videoSubMaps[t];if(r){if(delete this._videoSubMaps[t],parseInt(t)<parseInt(this._maxRequestId))return r({code:ze.SUB_VIDEO_EXPIRED});r(e)}}}),Object.defineProperty(t.prototype,"_onDCReopen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._DCError&&this.emit(Tc),this._DCError=!1}}),Object.defineProperty(t.prototype,"sendonly",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=A([0,0,0,e],P(new Uint8Array(t)),!1);try{this._datachannel.send(new Uint8Array(r).buffer)}catch(e){f.info(T.L_DATACHANNEL_E,JSON.stringify({stack:e.stack,msg:"send data error in datachannel"}))}}}),Object.defineProperty(t.prototype,"_createDataChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._datachannel=this._peer.createDataChannel("rc-datachannel",{ordered:!1,negotiated:!0,id:0}),this._datachannel.binaryType="arraybuffer",this._datachannel.onmessage=function(t){return e._recvHandler(t.data)},this._datachannel.onclose=this._onDataChannelClose.bind(this),this._datachannel.onerror=this._onDataChannelError.bind(this)}}),Object.defineProperty(t.prototype,"_dataChannelReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),C(this,void 0,void 0,(function(){var i,o=this;return I(this,(function(a){switch(a.label){case 0:return"open"!==this._datachannel.readyState?[3,2]:[4,this._sdpProxy.setDescriptions(e,t,r.sdp)];case 1:return a.sent(),n&&(this._DCError=!0),[2,ze.SUCCESS];case 2:return i=new Promise((function(e){setTimeout((function(){o._datachannel.onopen=null,e(ze.DATACHANNEL_OPEN_TIMEOUT)}),1e4),o._datachannel.onopen=function(){e(ze.SUCCESS)}})),[4,this._sdpProxy.setDescriptions(e,t,r.sdp)];case 3:return a.sent(),[2,i]}}))}))}}),Object.defineProperty(t.prototype,"exchangeDatachannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,l,d,_,p,f,b,m,h,g;return I(this,(function(v){switch(v.label){case 0:return n=$e.getMemo(),[4,this._sdpProxy.createOfferTemplate(t)];case 1:return i=v.sent(),o=i.template,a=i.semantics,[4,this._service.meetingSubExchange(this._store.getRTCRequestHeader(),{sdp:{type:"offer",sdp:o,semantics:a},subscribeList:e,snui:0},this._logger.createTraceId())];case 2:return s=v.sent(),c=s.code,u=s.data,c!==ze.SUCCESS?[2,{code:c}]:(d=(l=u).sdp,_=l.resultCode,p=l.rtcFinger,f=l.snui,b=void 0===f?0:f,n.snui=b,_!==ze.SUCCESS?[2,{code:_}]:(this._sdpProxy.parseAnswerTemplate(d.sdp),m=""!==this._rtcFinger&&this._rtcFinger!==p,this._rtcFinger=p,[4,this._dataChannelReady(t,i,d,m)]));case 3:return(h=v.sent())!==ze.SUCCESS?(this._logger.warn(T.L_DATACHANNEL_OPEN_FAILED_O,h),[2,{code:h}]):(this._logger.info(T.L_DATACHANNEL_OPEN_O),g=(null===(r=u.activeAudioList)||void 0===r?void 0:r.map((function(e){return O(O({},e),{cname:e.cname||e.userId||"-",label:e.label||"".concat(e.mslabel,"_audio")})})))||[],[2,{code:ze.SUCCESS,activeAudioList:g}])}}))}))}}),Object.defineProperty(t.prototype,"addAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._sdpProxy.addAudioSubList(e)}}),Object.defineProperty(t.prototype,"removeAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._sdpProxy.removeAudioSubList(e)}}),Object.defineProperty(t.prototype,"updateVideoSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a=this;return I(this,(function(s){switch(s.label){case 0:return t=Date.now().toString(),this._logger.info(T.L_SEND_VIDEO_SUB_REQ_T,"reqId: ".concat(t,", list: ").concat(e.map((function(e){return e.mslabel})))),r=this._codec.encode(Xs.VideoOperReq,{requestId:t,videoList:e.map((function(e){var t=e.uri&&JSON.parse(e.uri);return a._codec.encode(Xs.VideoResourceInfo,O(O({},e),{rtxSSRC:Number(t.ssrc)+1,fecSSRC:Number(t.ssrc)+2}),!0)}))}),n=e.map((function(e){var t,r,n=e.uri&&JSON.parse(e.uri);return a._trackIdToSSRC[e.mslabel]={ssrc:n.ssrc,rtxSSRC:Number(n.ssrc)+1,fecSSRC:Number(n.ssrc)+2},{userId:e.userId,ssrc:{ssrc:n.ssrc,cname:e.userId,mslabel:e.mslabel,label:"".concat(e.mslabel,"_video"),rtxSSRC:null===(t=a._trackIdToSSRC[e.mslabel])||void 0===t?void 0:t.rtxSSRC,fecSSRC:null===(r=a._trackIdToSSRC[e.mslabel])||void 0===r?void 0:r.fecSSRC}}})),i=[],[4,this._sdpProxy.updateVideoSubList(n.map((function(e){return e.ssrc})))];case 1:return(o=s.sent())!==ze.SUCCESS?[2,{code:o}]:(this._differSubList(t,r),this._logger.info(T.L_SEND_VIDEO_SUB_REQ_R,"reqId: ".concat(t,", code: ").concat(ze.SUCCESS)),[2,{code:ze.SUCCESS,videoList:n,errList:i}])}}))}))}}),Object.defineProperty(t.prototype,"_differSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s=this;return I(this,(function(c){switch(c.label){case 0:return[4,this._sendVideoReq(e,t)];case 1:return r=c.sent(),n=r.code,i=r.videoList,o=r.errList,n===ze.SUB_VIDEO_EXPIRED?(this._logger.info(T.L_SEND_VIDEO_SUB_REQ_E,"reqId: ".concat(e,", code: ").concat(ze.SUB_VIDEO_EXPIRED)),[2]):o&&o.length>0?(setTimeout((function(){s._differSubList(e,t)}),1e3),[2]):(a=(null==i?void 0:i.filter((function(e){var t,r,n;return!(e.ssrc.rtxSSRC!==(null===(t=s._trackIdToSSRC[e.ssrc.mslabel])||void 0===t?void 0:t.rtxSSRC)||e.ssrc.ssrc!==(null===(r=s._trackIdToSSRC[e.ssrc.mslabel])||void 0===r?void 0:r.ssrc)||e.ssrc.fecSSRC!==(null===(n=s._trackIdToSSRC[e.ssrc.mslabel])||void 0===n?void 0:n.fecSSRC))})))||[],a.length===(null==i?void 0:i.length)?[3,4]:[4,this._sdpProxy.updateVideoSubList(a.map((function(e){return e.ssrc})))]);case 2:return c.sent(),[4,this._sdpProxy.updateVideoSubList(i.map((function(e){var t,r;return s._trackIdToSSRC[e.ssrc.mslabel]={ssrc:e.ssrc.ssrc,rtxSSRC:null===(t=s._trackIdToSSRC[e.ssrc.mslabel])||void 0===t?void 0:t.rtxSSRC,fecSSRC:null===(r=s._trackIdToSSRC[e.ssrc.mslabel])||void 0===r?void 0:r.fecSSRC},e.ssrc})))];case 3:c.sent(),c.label=4;case 4:return[2]}}))}))}}),Object.defineProperty(t.prototype,"close",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._stopStateTimer(),this._datachannel.close(),this._peer.close()}}),Object.defineProperty(t.prototype,"_startStateTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.reportParser&&(this._stopStateTimer(),this._stateTimer=setTimeout((function(){e._reportHandle(),e._startStateTimer()}),1e3))}}),Object.defineProperty(t.prototype,"_stopStateTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._stateTimer&&(clearTimeout(this._stateTimer),this._stateTimer=null)}}),Object.defineProperty(t.prototype,"_createSenderReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=$e.getMemo(),r=[];return e.forEach((function(e){var n,i,o=e.trackId,a=e.kind,s=e.packetsLostRate,c=e.remoteResource,u=e.bitrate,l=e.jitter,d=e.networkQuality,_=e.audioDB,p={trackId:o,kind:a,packetsLostRate:s,remoteResource:c,bitrate:u,jitter:l,rtt:e.rtt,networkQuality:d,userId:null===(n=t.meidToUserIdMap)||void 0===n?void 0:n[so(o).identifier],audioDB:_};if((e.audioLevel||0===e.audioLevel)&&(p.audioLevel=e.audioLevel),e.frameWidth&&(p.frameWidth=e.frameWidth),e.frameHeight&&(p.frameHeight=e.frameHeight),e.frameRate&&(p.frameRate=e.frameRate),e.trackId){var f=e.trackId;e.trackId.includes("tiny")&&(f=e.trackId.replace("_tiny",""));var b=so(f).identifier,m=null===(i=t.meidToUserIdMap)||void 0===i?void 0:i[b];e.userId=m,r.push(O(O({},p),{userId:m}))}})),r}}),Object.defineProperty(t.prototype,"_createReceiverReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=$e.getMemo(),r=[];return e.forEach((function(e){var n,i,o=e.trackId,a=e.kind,s=e.packetsLostRate,c=e.remoteResource,u=e.bitrate,l=e.jitter,d=e.networkQuality,_=e.audioDB,p={trackId:o,kind:a,packetsLostRate:s,remoteResource:c,bitrate:u,jitter:l,networkQuality:d,userId:null===(n=t.meidToUserIdMap)||void 0===n?void 0:n[so(o).identifier],audioDB:_};if((e.audioLevel||0===e.audioLevel)&&(p.audioLevel=e.audioLevel),e.frameWidth&&(p.frameWidth=e.frameWidth),e.frameHeight&&(p.frameHeight=e.frameHeight),e.frameRate&&(p.frameRate=e.frameRate),e.trackId){var f=so(e.trackId).identifier,b=null===(i=t.meidToUserIdMap)||void 0===i?void 0:i[f];e.userId=b,r.push(O({},p))}})),r}}),Object.defineProperty(t.prototype,"_createRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.timestamp,r=e.iceCandidatePair,n=e.senders,i=e.receivers;for(var o in(null==r?void 0:r.totalPacketsLost)&&(null==r||delete r.totalPacketsLost),r)b(r[o])&&delete r[o];return{timestamp:t,iceCandidatePair:r,senders:this._createSenderReport(n),receivers:this._createReceiverReport(i)}}}),Object.defineProperty(t.prototype,"_getStatsData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return C(this,void 0,void 0,(function(){var r,n,i;return I(this,(function(o){switch(o.label){case 0:return this._formatStatsData=null,r=null,[4,this._peer.getStats()];case 1:return n=o.sent(),r=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(n),i=null===(t=this.reportParser)||void 0===t?void 0:t.formatRCRTCStateReport(r),this._formatStatsData=i,[2,i]}}))}))}}),Object.defineProperty(t.prototype,"_reportHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r;return C(this,void 0,void 0,(function(){var n,i,a,s,c,u,l,d=this;return I(this,(function(_){switch(_.label){case 0:return n=$e.getMemo(),[4,this._getStatsData()];case 1:return(i=_.sent())?(n.subPolarisReportData=i,a=n.pubReportData,s=this._createRCRTCStateReport(i),c={timestamp:s.timestamp,iceCandidatePair:O(O({},s.iceCandidatePair),{bitrateSend:null===(e=null==a?void 0:a.iceCandidatePair)||void 0===e?void 0:e.bitrateSend}),senders:A(A([],P(s.senders),!1),P((null==a?void 0:a.senders)||[]),!1),receivers:A(A([],P(s.receivers),!1),P((null==a?void 0:a.receivers)||[]),!1)},u=A(A([],P(c.receivers),!1),P(c.senders),!1).filter((function(e){return!("audio"!==e.kind)})).map((function(e){var t;if(o(e.audioLevel)){var r=d._historyAudioLevelMap[e.trackId];r?(r.length>3&&r.splice(0,1),r.push(e.audioLevel||0)):r=d._historyAudioLevelMap[e.trackId]=[e.audioLevel||0];var n=r.reduce((function(e,t){return e+t}),0)/r.length;return{trackId:e.trackId,audioLevel:n}}d._historyAudioLevelMap[e.trackId]=[];var i=e.trackId;e.trackId.includes("tiny")&&(i=e.trackId.replace("_tiny",""));var a=so(i).identifier,s=null===(t=d._store)||void 0===t?void 0:t.getUserIdByMeid(a);return{trackId:e.trackId,audioLevel:e.audioLevel,userId:s}})),this.emit(Sc,u),l=O(O({},c),{senders:null===(t=c.senders)||void 0===t?void 0:t.map((function(e){var t,r=e.trackId;e.trackId.includes("tiny")&&(r=e.trackId.replace("_tiny",""));var n=so(r).identifier,i=null===(t=d._store)||void 0===t?void 0:t.getUserIdByMeid(n);if("video"===e.kind)return O(O({},e),{userId:i});var o=u.filter((function(t){return e.trackId===t.trackId}))[0];return O(O({},e),{audioLevel:null==o?void 0:o.audioLevel,userId:i})})),receivers:null===(r=c.receivers)||void 0===r?void 0:r.map((function(e){var t,r=so(e.trackId).identifier,i=null===(t=n.meidToUserIdMap)||void 0===t?void 0:t[r];if("video"===e.kind)return O(O({},e),{userId:i});var o=u.filter((function(t){return e.trackId===t.trackId}))[0];return O(O({},e),{audioLevel:null==o?void 0:o.audioLevel,userId:i})}))}),this.emit(yc,JSON.parse(JSON.stringify(l))),[2]):[2]}}))}))}}),Object.defineProperty(t.prototype,"getPeerConnectionState",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._peer.connectionState}}),t}(a),Oc=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.MeetingVideoSubCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o;return I(this,(function(a){return n=t.getSubscribedList().filter((function(e){return e.track.isVideoTrack()})),i=this.tracks.map((function(e){return e instanceof Ma?{track:e}:e})),o=!1,i.forEach((function(e){var t=e.track.getTrackId(),r=n.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:e.track.isVideoTrack()&&n.push(e),o=!0)})),o?[2,new es(n).execute(e,t,r)]:[2,{code:ze.SUCCESS}]}))}))}}),t}(ka),Cc=function(e){function t(){return e.call(this)||this}return y(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Ea.SubPeerReconnectCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Oa.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,d;return I(this,(function(_){switch(_.label){case 0:return i=e.subPeer,o=e.logger,a=r.getSubscribedList().map((function(e){return r.getPublishedResourceByTrackId(e.track.getTrackId())})).filter((function(e){return e&&e.mediaType===Bo.AUDIO_ONLY})).map((function(e){return{uri:e.uri,simulcast:e.simulcast}})),[4,i.exchangeDatachannel(a,!0)];case 1:return s=_.sent(),c=s.code,u=s.activeAudioList,c!==ze.SUCCESS?(vi.error("ice retry 15s: ",i.getPeerConnectionState()),setTimeout((function(){return n.push(new t)}),15e3),[2,{code:c}]):(setTimeout((function(){vi.error("ice retry 5s: ",i.getPeerConnectionState()),"connected"!==i.getPeerConnectionState()&&n.push(new t)}),5e3),u.length?(l=Date.now(),r.setMeetingAudioSubCommandStamp(l),[4,new ac(u,o,0,l).execute(e,r,n)]):[3,3]);case 2:_.sent(),_.label=3;case 3:return(d=r.getSubscribedList().filter((function(e){return e.track.isVideoTrack()}))).length?[4,new es(d,!0).execute(e,r,n)]:[3,5];case 4:_.sent(),_.label=5;case 5:return[2,{code:c}]}}))}))}}),t}(ka),Ic="evt-leave",Lc=function(e){function t(t,r,n,i,o,a,s,c){void 0===a&&(a=Ri()),void 0===s&&(s=!1);var u=e.call(this)||this;Object.defineProperty(u,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(u,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_service",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"version",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"_pinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_peerConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_subPeer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_trackSentTimer",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(u,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null});var l=Ji.MEETING,d=u._logger=u._context.logger;u._reportMediaActionLogger=new rc(d,u._roomId,u._clientSessionId,u._context.getCurrentId()),u._polarisReport=new Pa(u._context,u._runtime,u._roomId,u);var _=u._context.getCurrentId(),p=new Va(d,a,u._context.getAppkey(),n,_,l,!1,!1,!0,!1),f=u._peerConnection=new Ra(d,u._reTryExchange.bind(u),_,p,u._polarisReport,s);u._setPeerConnectionListener();var b=u._subPeer=new Ec(u._service,u._logger,_,p,u._context.createCodec(pc,fc),u._polarisReport,s);u._setSubPeerConnectionListener();var m=u._executeCtx=new $a(d,u._service,t,r,f,p,u._polarisReport,u._reportMediaActionLogger,b);return u.setCommandEventListener(),u._invoker=new Na(m,p),u._store=u._invoker.store,u._pinger=new jo(u._context,u._roomId,l,u._initOptions.pingGap),u._pinger.onFailed=u.__kickoff.bind(u),u._pinger.onPingResult=u._handlePingResult.bind(u),u._context.registerRTCSignalListener((function(e){return C(u,void 0,void 0,(function(){var t,r,n,i,o;return I(this,(function(a){if(t=this._context.decodeRtcNotify(e),r=t.time,n=t.type,i=t.roomId,o=d.createTraceId(),this._invoker.isDestroyed())return d.info(T.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:n,time:r,roomId:i})),[2];switch(n){case 0:break;case 2:if(i!==this._roomId)return[2];d.info(T.L_RTCNTF_PULL_ROOM_STATUS_O,null,o),this._startPullRTCRoomStatus(i,o,r)}return[2]}))}))})),u}return y(t,e),Object.defineProperty(t.prototype,"_setPeerConnectionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._peerConnection;t.on(Ra.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(qi.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(qi.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(Ra.__INNER_ICE_CONNECTED__,(function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")}),this),t.on(Ra.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,n=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,r,n)}))}}),Object.defineProperty(t.prototype,"_setSubPeerConnectionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._subPeer;e.on(gc,this._onAudioNtf.bind(this)),e.on(vc,this._onTrackReady.bind(this)),e.on(Rc,this._onSubICEConnectionStateChange.bind(this)),e.on(Sc,this._onSubAudioLevelReport,this),e.on(yc,this._onSubStatsReport,this),e.on(Tc,this._reupdateSubList.bind(this))}}),Object.defineProperty(t.prototype,"setCommandEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._executeCtx;e.on(Ga,this._rtcpeerClosed,this),e.on(qa,this._callAppListener.bind(this,"onUserJoin"),this),e.on(Ka,this._callAppListener.bind(this,"onUserLeave"),this),e.on(Wa,this._onTrackPublish,this),e.on(za,this._onTrackUnpublish,this),e.on(Qa,this._onAudioMuteChange,this),e.on(Ya,this._onVideoMuteChange,this),e.on(Za,this._dealUserAppListener,this),e.on(Xa,this._onTrackDeviceStatusChange,this)}}),Object.defineProperty(t.prototype,"_pullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return new zs(e,t,this._context,r)}}),Object.defineProperty(t.prototype,"_startPullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){return I(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(this._pullRTCRoomStatus(e,t,r))];case 1:return n.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var i,o,a;return I(this,(function(s){switch(s.label){case 0:return[4,this._invoker.push(new sc(this._roomId,e,t,r,n))];case 1:return i=s.sent(),o=i.code,a=i.data,o!==ze.SUCCESS?[2,{code:o}]:(this._initWithRoomData(a.offlineKickTime),[2,{code:o,data:a}])}}))}))}}),Object.defineProperty(t.prototype,"_initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;this._pinger.start(1e3*e),null===(t=this._polarisReport)||void 0===t||t.sendR1()}}),Object.defineProperty(t.prototype,"_handlePingResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i,o;if(e===ko.SUCCESS){var a=this._store.getRoomStatusVersion(),s=String(t).length-String(a).length;if(s<0?t&&(t*=Math.pow(10,s)):a&&(a*=Math.pow(10,s)),t>a){var c=null===(n=null===(r=this._context)||void 0===r?void 0:r.logger)||void 0===n?void 0:n.createTraceId();null===(o=null===(i=this._context)||void 0===i?void 0:i.logger)||void 0===o||o.info(T.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),c),this._startPullRTCRoomStatus(this._roomId,c,t)}}this._callAppListener("onPing",e)}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(T.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),_("max",e,(function(e){return o(e)&&e>Math.max(t||1,200)}),!0),_("min",t,(function(t){return o(t)&&t>=1&&(!o(e)||t<e)}),!0),_("start",r,(function(r){return o(r)&&r>t&&r<=e})),this._peerConnection.setBitrate(e,t,r)}}),Object.defineProperty(t.prototype,"_onSubICEConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;$e.getMemo();try{null===(r=null===(t=this._reportListener)||void 0===t?void 0:t.onICEConnectionStateChange)||void 0===r||r.call(t,e,"sub")}catch(e){this._context.logger.error(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,e.stack)}"failed"!==e&&"disconnected"!==e||this._invoker.push(new Cc)}}),Object.defineProperty(t.prototype,"_onSubAudioLevelReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;null===(t=this._audioLevelReport)||void 0===t||t.audioLevelReport(e)}}),Object.defineProperty(t.prototype,"_onSubStatsReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;try{null===(r=null===(t=this._reportListener)||void 0===t?void 0:t.onStateReport)||void 0===r||r.call(t,e)}catch(e){this._context.logger.error(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,e.stack)}}}),Object.defineProperty(t.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.streams[0].id,r=e.receiver.track,n=[t,"audio"===r.kind?Bo.AUDIO_ONLY:Bo.VIDEO_ONLY].join("_"),i=this._store.getRemoteTrack(n);i?i.isReady()?i.__innerSetMediaStreamTrack(r):(i.__innerSetMediaStreamTrack(r),this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onTrackReady",trackId:i.getTrackId()})),this._callAppListener("onTrackReady",i)):this._logger.warn(T.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(r.id))}}),Object.defineProperty(t.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=null===(t=this._appListener)||void 0===t?void 0:t[e];if(i)try{i.apply(void 0,A([],P(r),!1))}catch(e){this._logger.error(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}}),Object.defineProperty(t.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackUnpublish",e)}}),Object.defineProperty(t.prototype,"_onTrackDeviceStatusChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onTrackDeviceStatusChange",tracks:null==e?void 0:e.map((function(e){var t;return{trackId:null===(t=null==e?void 0:e.track)||void 0===t?void 0:t.getTrackId(),status:null==e?void 0:e.status}}))}))}}),Object.defineProperty(t.prototype,"__parseInnerMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.targetId;if(e.conversationType,r===this._roomId){this._logger.info(T.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var n=e.content;switch(e.messageType){case wo.KICK:this.__kickoff(!0,n);break;case wo.STATE:this._stateHandle(n,t);break;case wo.MODIFY:case wo.PUBLISH:case wo.UNPUBLISH:case wo.TOTAL_CONTENT_RESOURCE:this._resourceHandle(n,e.messageType,e.senderUserId,e.sentTime,t);break;case wo.ROOM_NOTIFY:this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case wo.USER_NOTIFY:this._logger.warn(T.L_OLD_DAILY_RECORD_O,"TODO: ".concat(wo.USER_NOTIFY));break;case wo.PK_INVITE:case wo.PK_CANCEL_INVITE:case wo.PK_INVITE_TIMEOUT:case wo.PK_INVITE_ANSWER:case wo.PK_END:case wo.OTHER_ROOM_OFFLINE:default:this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,n,e.senderUserId,e.messageUId)}}else this._logger.warn(T.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:E.FAILED,message:"roomId is different, msg roomId-> ".concat(r,", this._roomId-> ").concat(this._roomId," ")}),t)}}),Object.defineProperty(t.prototype,"__kickoff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i=this;return I(this,(function(o){return this._invoker.isDestroyed()||(this._logger.warn(T.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(Ic),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach((function(e){e.userId===i._context.getCurrentId()&&(n=e.type,r=e.kickExtra,i._reportMediaActionLogger.reportQualityKickedData(n))})),this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onKickOff",byServer:e,kickType:n,kickExtra:r})),this._callAppListener("onKickOff",e,n,r)),[2]}))}))}}),Object.defineProperty(t.prototype,"mockKickOff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.__kickoff(e,{users:[{userId:this.getCrtUserId(),type:t}]})}}),Object.defineProperty(t.prototype,"_rtcpeerClosed",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(Ic),this._leaveHandle(!0),this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}}),Object.defineProperty(t.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return C(this,void 0,void 0,(function(){var o;return I(this,(function(a){return o=e.uris,e.ignore||!o||this._invoker.push(new Fs(e,t,r,i,n)),[2]}))}))}}),Object.defineProperty(t.prototype,"_onTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;null===(r=null===(t=this._context)||void 0===t?void 0:t.logger)||void 0===r||r.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackPublish",e)}}),Object.defineProperty(t.prototype,"_stateHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i;return I(this,(function(o){switch(o.label){case 0:return[4,this._invoker.push(new xs(e,t))];case 1:return r=o.sent(),n=r.code,i=r.data,n===ze.SUCCESS&&this._dealUserAppListener(i),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUserAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.left,r=A([],P(e.joined),!1),n=A([],P(t),!1);r.length>0&&(this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onUserJoin",allJoined:r})),this._callAppListener("onUserJoin",r)),n.length>0&&(n.length&&this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onUserLeave",allLeft:n})),this._callAppListener("onUserLeave",n))}}),Object.defineProperty(t.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(t.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(t.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getRemoteUserIds()}}),Object.defineProperty(t.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach((function(r){t.push.apply(t,A([],P(e.getRemoteTracksByUserId(r)),!1))})),t}}),Object.defineProperty(t.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTracksByUserId(e)}}),Object.defineProperty(t.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getSessionId()}}),Object.defineProperty(t.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n;return I(this,(function(i){switch(i.label){case 0:return r=this._logger.createTraceId(),this._logger.info(T.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:e,content:t}),r),[4,this._context.sendMessage(p.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0})];case 1:return(n=i.sent().code)!==u.SUCCESS?(this._logger.error(T.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:E.FAILED,code:n}),r),[2,{code:ze.SIGNAL_ERROR}]):(this._logger.info(T.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:E.SUCCEEDED,name:e,content:t}),r),[2,{code:ze.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"setRoomAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),C(this,void 0,void 0,(function(){var i,o;return I(this,(function(a){switch(a.label){case 0:return i=this._logger.createTraceId(),this._logger.info(T.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,key:e,value:t,message:r,isInner:n}),i),[4,this._context.setRTCData(this._roomId,e,t,n,Ws.ROOM,r)];case 1:return(o=a.sent())!==u.SUCCESS?(this._logger.error(T.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:E.FAILED,code:o}),i),[2,{code:ze.SIGNAL_ERROR}]):(this._logger.info(T.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:E.SUCCEEDED,roomId:this._roomId,key:e,value:t,message:r,isInner:n}),i),[2,{code:ze.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"deleteRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),C(this,void 0,void 0,(function(){var n,i;return I(this,(function(o){switch(o.label){case 0:return n=this._logger.createTraceId(),this._logger.info(T.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:e,message:t,isInner:r}),n),[4,this._context.removeRTCData(this._roomId,e,r,Ws.ROOM,t)];case 1:return(i=o.sent())!==u.SUCCESS?(this._logger.error(T.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:E.FAILED,code:i}),n),[2,{code:ze.SIGNAL_ERROR}]):(this._logger.info(T.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:E.SUCCEEDED,roomId:this._roomId,keys:e,message:t,isInner:r}),n),[2,{code:ze.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"getRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=!1),C(this,void 0,void 0,(function(){var r,n,i,o;return I(this,(function(a){switch(a.label){case 0:return r=this._logger.createTraceId(),this._logger.info(T.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:e,isInner:t}),r),[4,this._context.getRTCData(this._roomId,e,t,Ws.ROOM)];case 1:return n=a.sent(),i=n.code,o=n.data,i!==u.SUCCESS?(this._logger.error(T.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(i),r),[2,{code:ze.SIGNAL_ERROR}]):(this._logger.info(T.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:E.SUCCEEDED,data:o}),r),[2,{code:ze.SUCCESS,data:o}])}}))}))}}),Object.defineProperty(t.prototype,"_setUserAttributeValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,Ws.PERSON,r)}}),Object.defineProperty(t.prototype,"_deleteUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,Ws.PERSON,t)}}),Object.defineProperty(t.prototype,"_getUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._context.getRTCData(this._roomId,e,!1,Ws.PERSON)}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.isDestroyed()}}),Object.defineProperty(t.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._leaveHandle(e)}}),Object.defineProperty(t.prototype,"__destroyMock",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._leaveHandleMock()}}),Object.defineProperty(t.prototype,"_muteRemoteTracksBeforeQuit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._store.getRemoteTracks());e.length&&e.forEach((function(e){return e.mute()}))}}),Object.defineProperty(t.prototype,"_leaveHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){switch(t.label){case 0:return this._invoker.isDestroyed()?[2]:($e.destroy(),this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),e?[4,this._context.quitRTCRoom(this._roomId)]:[3,2]);case 1:t.sent(),t.label=2;case 2:return this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())];case 3:return t.sent(),this._subPeer.close(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_leaveHandleMock",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return I(this,(function(e){switch(e.label){case 0:return this._invoker.isDestroyed()?[2]:($e.destroy(),this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())]);case 1:return e.sent(),this._subPeer.close(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_releasePCManager",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._peerConnection;e.off(qi.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(qi.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.off(qi.__INNER_EVENT_SEND_CHANGE__,this._onLocalTrackSent,this),e.off(qi.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this._onLocalTrackDeviceStatusChanged,this),e.removeAllLocalTrack(),e.clear(),e.destroy()}}),Object.defineProperty(t.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e instanceof Wi&&e.__isTiny()||this.unpublish([e])}}),Object.defineProperty(t.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r;return I(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new qs(e))];case 1:return r=n.sent().code,t(r),[2]}}))}))}}),Object.defineProperty(t.prototype,"_onLocalTrackDeviceStatusChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._invoker.push(new $s(e,t))}}),Object.defineProperty(t.prototype,"_onLocalTrackSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=this,i=null===(r=e.__innerGetMediaStreamTrack())||void 0===r?void 0:r.id;i&&clearTimeout(this._trackSentTimer[i]);var o=this._context.getNaviInfo(),a=(null==o?void 0:o.pauseVideoDelayMs)||-1;-1!==a&&i&&(t?this._trackSentTimer[i]=setTimeout((function(){n._logger.info(T.L_PAUSE_VIDEO_R,JSON.stringify({userId:e.getUserId(),trackId:e.getTrackId(),state:!0})),n._peerConnection.disableSenderEncodingsByTrackId(i)}),a):(this._logger.info(T.L_PAUSE_VIDEO_R,JSON.stringify({userId:e.getUserId(),trackId:e.getTrackId(),state:!1})),this._peerConnection.enableSenderEncodingsByTrackId(i)))}}),Object.defineProperty(t.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){return[2,this._invoker.push(new Js(e))]}))}))}}),Object.defineProperty(t.prototype,"_onAudioNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Date.now();this._invoker.store.setMeetingAudioSubCommandStamp(t),this._invoker.push(new ac(e.map((function(e){return e.ssrc})),this._context.logger,0,t))}}),Object.defineProperty(t.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return I(this,(function(e){return[2,this._invoker.push(new Ks)]}))}))}}),Object.defineProperty(t.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){return[2,this._invoker.push(new Hs(e))]}))}))}}),Object.defineProperty(t.prototype,"_getResourceById",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getPublishedResourceByTrackId(e)}}),Object.defineProperty(t.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=so(e).identifier,n=this._store.getUserIdByMeid(r);return!!(null===(t=this._store.getResourcesByUserId(n))||void 0===t?void 0:t.find((function(t){return ao(t)===e})))}}),Object.defineProperty(t.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){return 0===(e=e.filter((function(e){return e instanceof Ma?e instanceof ja:e.track instanceof ja}))).length?[2,{code:ze.SUCCESS}]:[2,this._invoker.push(new Oc(e))]}))}))}}),Object.defineProperty(t.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return I(this,(function(r){return 0===(t=e.filter((function(e){return e instanceof ja}))).length?[2,{code:ze.SUCCESS}]:[2,this._invoker.push(new ts(t))]}))}))}}),Object.defineProperty(t.prototype,"updateSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return I(this,(function(t){return 0===(e=e.filter((function(e){return e instanceof Ma?e instanceof ja:e.track instanceof ja}))).length?[2,{code:ze.SUCCESS}]:[2,this._invoker.push(new es(e))]}))}))}}),Object.defineProperty(t.prototype,"_reupdateSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getRemoteTracks().filter((function(e){return e.isVideoTrack()}));return this._invoker.push(new es(e,!0))}}),Object.defineProperty(t.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._peerConnection.getLocalTrack(e)}}),Object.defineProperty(t.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._peerConnection.getLocalTracks()}}),Object.defineProperty(t.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTrack(e)||null}}),Object.defineProperty(t.prototype,"subscribedTracks",{get:function(){return this._store.getSubscribedList().slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,listener:e&&Object.keys(e)})),this._appListener=e}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,listener:e&&Object.keys(e)})),this._reportListener=e,this._peerConnection.registerReportListener(e)}}),Object.defineProperty(t.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(T.L_ABSTRACT_ROOM_AUDIO_LEVEL_O,JSON.stringify({status:E.SUCCEEDED,handler:null==e?void 0:e.name,gap:t})),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(t.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._invoker.push(new Qs)}}),Object.defineProperty(t.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}}),Object.defineProperty(t.prototype,"_onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:E.SUCCEEDED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}}),Object.defineProperty(t.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._clientSessionId}}),t}(a),Pc=function(){function e(e){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_audioDeviceStatusCheckTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_currentAudioRecordStatus",{enumerable:!0,configurable:!0,writable:!0,value:Pi.Resume}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isElectron",{enumerable:!0,configurable:!0,writable:!0,value:/Electron/.test(navigator.userAgent)}),this._logger=e.logger}return Object.defineProperty(e.prototype,"_getMediaStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t="getUserMedia"),C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c;return I(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),r=this.setConstraintsConfig(e),[4,navigator.mediaDevices[t](r)];case 1:return n=u.sent(),"getDisplayMedia"===t?[2,{code:ze.SUCCESS,stream:n}]:(i=n.getAudioTracks()[0],o=n.getVideoTracks()[0],a=void 0,s=new MediaStream,i&&s.addTrack(i),o&&(a=Ri(),s.addTrack(o)),[2,{code:ze.SUCCESS,stream:s,uuid:{audioTrackUUID:undefined,videoTrackUUID:a}}]);case 2:return"Permission denied"===(c=u.sent()).message?[2,{code:ze.BROWSER_PERMISSION_DENIED}]:"Permission denied by system"===c.message?[2,{code:ze.SYSTEM_PERMISSION_DENIED}]:(this._logger.error(T.L_GET_USER_MEDIA_E,JSON.stringify({error:c})),[3,3]);case 3:return[2,{code:"getUserMedia"===t?ze.GET_USER_MEDIA_FAILED:ze.GET_DISPLAY_MEDIA_FAILED}]}}))}))}}),Object.defineProperty(e.prototype,"_getMediaStreamErrorReason",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="";switch(e){case ze.BROWSER_PERMISSION_DENIED:t="Permission denied";break;case ze.SYSTEM_PERMISSION_DENIED:t="Permission denied by system";break;case ze.GET_USER_MEDIA_FAILED:t="getUserMedia failed";break;case ze.GET_DISPLAY_MEDIA_FAILED:t="getDisplayMedia failed"}return t}}),Object.defineProperty(e.prototype,"setConstraintsConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e?void 0:e.audio){"boolean"==typeof e.audio&&(e.audio={});var t=navigator.mediaDevices.getSupportedConstraints();t.noiseSuppression&&(e.audio.noiseSuppression=!!t.noiseSuppression),t.autoGainControl&&(e.audio.autoGainControl=!!t.autoGainControl),t.echoCancellation&&(e.audio.echoCancellation=!!t.echoCancellation),this._logger.info(T.L_SET_AUDIO_CONSTRAINTS_O,"browser supported -> ".concat(JSON.stringify(t)))}return e}}),Object.defineProperty(e.prototype,"_check",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=$e.getMemo();t.audioRecordInputZeroCount=0,this._currentAudioRecordStatus=Pi.Resume,clearInterval(this._audioDeviceStatusCheckTimer),this._audioDeviceStatusCheckTimer=setInterval((function(){var r,n,i,o,a=null===(r=t.crtRoom)||void 0===r?void 0:r.getLocalTracks().filter((function(e){return e.isAudioTrack()&&e.getTag()===nu.DEFAULT}))[0];if(a){var s=(null===(n=null==a?void 0:a.__innerGetMediaStreamTrack())||void 0===n?void 0:n.label)||"",c=(null===(o=null===(i=null==a?void 0:a.__innerGetMediaStreamTrack())||void 0===i?void 0:i.getSettings())||void 0===o?void 0:o.deviceId)||"";if(t.audioRecordInputZeroCount>=2&&e._currentAudioRecordStatus===Pi.Resume){e._currentAudioRecordStatus=Pi.Error,vi.debug("audio device error: ",{deviceName:s,deviceId:c});var u=(null==a?void 0:a.getDeviceAvailable(!0))|Ai.RCRTCStreamCodeCantRecordAudioData;null==a||a.updateDeviceAvailable(u)}else if(0===t.audioRecordInputZeroCount&&e._currentAudioRecordStatus===Pi.Error){e._currentAudioRecordStatus=Pi.Resume,vi.debug("audio device resume: ",{deviceName:s,deviceId:c});u=(null==a?void 0:a.getDeviceAvailable(!0))&~Ai.RCRTCStreamCodeCantRecordAudioData;null==a||a.updateDeviceAvailable(u)}}}),1e3)}}),Object.defineProperty(e.prototype,"createMicrophoneAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e=nu.DEFAULT),C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l;return I(this,(function(d){switch(d.label){case 0:return ro(e)?(r=this._context.getCurrentId())?[4,this._getMediaStream({audio:{deviceId:null==t?void 0:t.micphoneId,sampleRate:null==t?void 0:t.sampleRate,noiseSuppression:null==t?void 0:t.noiseSuppression,echoCancellation:null==t?void 0:t.echoCancellation,autoGainControl:null==t?void 0:t.autoGainControl}})]:(this._logger.error(T.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_USER_ID,msg:"invalid IM connection,invalid userId",options:t})),[2,{code:ze.INVALID_USER_ID}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_TAGS,msg:"invalid tag",options:t})),[2,{code:ze.INVALID_TAGS}]);case 1:return n=d.sent(),i=n.stream,o=n.code,a=n.uuid,s=(a||{}).audioTrackUUID,o!==ze.SUCCESS?(this._logger.error(T.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:E.FAILED,code:o,msg:this._getMediaStreamErrorReason(o),options:t})),[2,{code:o}]):(c=i.getAudioTracks()[0],u=null,l=bo(this._context.getCurrentId()),u=new Zi(this._logger,e,r,l,c,s),this._logger.info(T.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:E.SUCCEEDED,trackId:u.getTrackId(),options:t})),[2,{code:o,track:u}])}}))}))}}),Object.defineProperty(e.prototype,"createCameraVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e=nu.DEFAULT),C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l,d,_,p,f,b,m,h,g;return I(this,(function(v){switch(v.label){case 0:return ro(e)?(r=this._context.getCurrentId())?(n=go(null==t?void 0:t.resolution)?t.resolution:Ke.W640_H480,i=ho(n),o=i.width,a=i.height,[4,this._getMediaStream({video:{deviceId:null==t?void 0:t.cameraId,frameRate:vo((null==t?void 0:t.frameRate)||qe.FPS_15),width:o,height:a,facingMode:null==t?void 0:t.faceMode}})]):(this._logger.error(T.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_USER_ID,msg:"invalid IM connection,invalid userId",options:t})),[2,{code:ze.INVALID_USER_ID}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_TAGS,msg:"invalid tag",options:t})),[2,{code:ze.INVALID_TAGS}]);case 1:return s=v.sent(),c=s.stream,u=s.code,l=s.uuid,d=(l||{}).videoTrackUUID,u!==ze.SUCCESS?(this._logger.error(T.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:E.FAILED,code:u,msg:this._getMediaStreamErrorReason(u),options:t})),[2,{code:u}]):(_=c.getVideoTracks()[0],p=bo(this._context.getCurrentId()),f=new Xi(this._logger,e,r,p,_,d),(null==t?void 0:t.bitrate)&&(b=t.bitrate,m=b.max,h=b.min,g=b.start,f.setBitrate(m,h,g)),this._logger.info(T.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:E.SUCCEEDED,trackId:f.getTrackId(),options:t})),[2,{code:u,track:f}])}}))}))}}),Object.defineProperty(e.prototype,"createMicrophoneAndCameraTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i,o;return void 0===e&&(e=nu.DEFAULT),C(this,void 0,void 0,(function(){var a,s,c,u,l,d,_,p,f,b,m,h,g,v,R,S=this;return I(this,(function(y){switch(y.label){case 0:return a=[],ro(e)?(s=this._context.getCurrentId())?(c=go(null===(r=null==t?void 0:t.video)||void 0===r?void 0:r.resolution)?t.video.resolution:Ke.W640_H480,u=ho(c),l=u.width,d=u.height,_=null==t?void 0:t.audio,[4,this._getMediaStream({video:{deviceId:null===(n=null==t?void 0:t.video)||void 0===n?void 0:n.cameraId,frameRate:vo((null===(i=null==t?void 0:t.video)||void 0===i?void 0:i.frameRate)||qe.FPS_15),width:l,height:d,facingMode:null===(o=null==t?void 0:t.video)||void 0===o?void 0:o.faceMode},audio:{deviceId:null==_?void 0:_.micphoneId,sampleRate:null==_?void 0:_.sampleRate,noiseSuppression:null==_?void 0:_.noiseSuppression,echoCancellation:null==_?void 0:_.echoCancellation,autoGainControl:null==_?void 0:_.autoGainControl}})]):(this._logger.error(T.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_USER_ID,msg:"invalid IM connection,invalid userId",options:t})),[2,{code:ze.INVALID_USER_ID,tracks:a}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_TAGS,msg:"invalid tag",options:t})),[2,{code:ze.INVALID_TAGS,tracks:a}]);case 1:return p=y.sent(),f=p.stream,b=p.code,m=p.uuid,g=(h=m||{}).audioTrackUUID,v=h.videoTrackUUID,b!==ze.SUCCESS?(this._logger.error(T.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:E.FAILED,code:b,msg:this._getMediaStreamErrorReason(b),options:t})),[2,{code:b,tracks:a}]):(R=bo(this._context.getCurrentId()),f.getTracks().forEach((function(r){var n,i;if("video"===r.kind){var o=new Xi(S._logger,e,s,R,r,v);if(null===(n=null==t?void 0:t.video)||void 0===n?void 0:n.bitrate){var c=null===(i=t.video)||void 0===i?void 0:i.bitrate,u=c.max,l=c.min,d=c.start;o.setBitrate(u,l,d)}a.push(o)}else a.unshift(new Zi(S._logger,e,s,R,r,g))})),this._logger.info(T.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:E.SUCCEEDED,trackIds:a.map((function(e){return e.getTrackId()})),options:t})),[2,{code:b,tracks:a}])}}))}))}}),Object.defineProperty(e.prototype,"createScreenVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),C(this,void 0,void 0,(function(){var r;return I(this,(function(n){switch(n.label){case 0:return[4,this._createScreenTracks(e,!1,T.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,t)];case 1:return(r=n.sent()).code===ze.SUCCESS?[2,{code:r.code,track:r.tracks[0]}]:[2,r]}}))}))}}),Object.defineProperty(e.prototype,"createScreenWithAudioTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),C(this,void 0,void 0,(function(){return I(this,(function(r){return[2,this._createScreenTracks(e,!0,T.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O,t)]}))}))}}),Object.defineProperty(e.prototype,"_createScreenTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,d,_,p,f,b,m;return I(this,(function(h){switch(h.label){case 0:return i=bo(this._context.getCurrentId()),ro(e)?(o=this._context.getCurrentId())?yo()?(a=/macintosh|mac os x/i.test(navigator.userAgent),s=(!this._isElectron||!a)&&t,c=go(null==n?void 0:n.resolution)?n.resolution:Ke.W1280_H720,this._isElectron?[4,this._createElectronScreenStream(t,r,c,null==n?void 0:n.chromeMediaSourceId)]:[3,2]):(this._logger.error(T.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.BROWSER_NOT_SUPPORT,msg:"browser not support"})),[2,{code:ze.BROWSER_NOT_SUPPORT}]):(this._logger.error(r,JSON.stringify({status:E.FAILED,code:ze.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:ze.INVALID_USER_ID}]):(this._logger.error(r,JSON.stringify({status:E.FAILED,code:ze.INVALID_TAGS,msg:"invalid tag"})),[2,{code:ze.INVALID_TAGS}]);case 1:return _=h.sent(),[3,4];case 2:return[4,this._createWebScreenStream(t,c,null==n?void 0:n.frameRate)];case 3:_=h.sent(),h.label=4;case 4:return l=(u=_).stream,(d=u.code)!==ze.SUCCESS?(this._logger.error(r,JSON.stringify({status:E.FAILED,code:d,msg:this._getMediaStreamErrorReason(d)})),[2,{code:d}]):(p=l.getVideoTracks()[0],f=new $i(this._logger,e,o,i,p),b=[f],s&&(m=l.getAudioTracks()[0])&&b.push(new eo(this._logger,e,o,i,m)),this._logger.info(r,JSON.stringify({status:E.SUCCEEDED,trackIds:b.map((function(e){return e.getTrackId()}))})),[2,{code:d,tracks:b}])}}))}))}}),Object.defineProperty(e.prototype,"_createElectronScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,o;return C(this,void 0,void 0,(function(){var a,s,c,u,l,_,p;return I(this,(function(f){return a=/macintosh|mac os x/i.test(navigator.userAgent),this._isElectron&&a&&e&&this._logger.warn(t,JSON.stringify({status:E.INFO,code:ze.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO,msg:"mac in electron not support screen share with audio"})),s=(!this._isElectron||!a)&&e,!this._isElectron||h(n)||d(n)?(c=ho(r),u=c.width,l=c.height,_={mandatory:{chromeMediaSourceId:n,chromeMediaSource:"desktop",minWidth:u,maxWidth:u,minHeight:l,maxHeight:l}},n&&(null===(i=_.mandatory)||void 0===i||delete i.chromeMediaSourceId),p=null,s&&this._isElectron&&(null===(o=_.mandatory)||void 0===o||delete o.chromeMediaSourceId,p={mandatory:{chromeMediaSource:"desktop"}}),[2,this._getMediaStream({video:_,audio:p||s},"getUserMedia")]):(this._logger.error(t,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> options.chromeMediaSourceId type is string"})),[2,{code:ze.PARAMS_ERROR}])}))}))}}),Object.defineProperty(e.prototype,"_createWebScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a;return I(this,(function(s){return n=ho(t),i=n.width,o=n.height,a={frameRate:vo(r||qe.FPS_15),width:i,height:o},[2,this._getMediaStream({video:a,audio:e},"getDisplayMedia")]}))}))}}),Object.defineProperty(e.prototype,"createLocalAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i;return I(this,(function(o){return r=bo(this._context.getCurrentId()),ro(e)?t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind?(n=this._context.getCurrentId())?(i=new Ki(this._logger,e,n,r,t),this._logger.info(T.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:E.SUCCEEDED,trackId:i.getTrackId()})),[2,{code:ze.SUCCESS,track:i}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:ze.INVALID_USER_ID}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not audio"})),[2,{code:ze.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_TAGS,msg:"invalid tag"})),[2,{code:ze.INVALID_TAGS}])}))}))}}),Object.defineProperty(e.prototype,"createLocalVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i;return I(this,(function(o){return r=bo(this._context.getCurrentId()),ro(e)?t&&t instanceof MediaStreamTrack&&"video"===t.kind?(n=this._context.getCurrentId())?(i=new Wi(this._logger,e,n,r,t),this._logger.info(T.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:E.SUCCEEDED,trackId:i.getTrackId()})),[2,{code:ze.SUCCESS,track:i}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:ze.INVALID_USER_ID}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not video"})),[2,{code:ze.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_TAGS,msg:"invalid tag"})),[2,{code:ze.INVALID_TAGS}])}))}))}}),Object.defineProperty(e.prototype,"_validateCreateLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!ro(e))return this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_TAGS,msg:"invalid tag"})),{code:ze.INVALID_TAGS,tracks:[]};if(!So())return this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.BROWSER_NOT_SUPPORT,msg:"browser not support"})),{code:ze.BROWSER_NOT_SUPPORT,tracks:[]};var r=t instanceof File?URL.createObjectURL(t):t;return m(r)||/^blob:/.test(r)?this._context.getCurrentId()?{code:ze.SUCCESS,tracks:[],url:r}:(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),{code:ze.INVALID_USER_ID,tracks:[]}):(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> file"})),{code:ze.PARAMS_ERROR,tracks:[]})}}),Object.defineProperty(e.prototype,"createLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s=this;return I(this,(function(c){return i=bo(this._context.getCurrentId()),(o=this._validateCreateLocalFileTracks(t,r)).code!==ze.SUCCESS?[2,o]:(a=this._context.getCurrentId(),[2,new Promise((function(r){var c=document.createElement("video");(null==n?void 0:n.withoutAudio)&&(c.muted=!0),c.onloadedmetadata=function(){return C(s,void 0,void 0,(function(){var o,s,u,l,d,_;return I(this,(function(p){o=[];try{u=c.mozCaptureStream?"mozCaptureStream":"captureStream",s=c[u]()}catch(e){this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.CREATE_FILE_TRACK_FAILED,msg:"captureSteam error -> ".concat(JSON.stringify(e))})),r({code:ze.CREATE_FILE_TRACK_FAILED,tracks:o})}return l=P(e.getTracksWithOptions(s,n),2),d=l[0],_=l[1],d&&o.push(new Yi(this._logger,t,a,i,d,c)),_&&o.push(new Qi(this._logger,t,a,i,_,c)),0===o.length&&(c.pause(),c.src=""),c.onerror=null,this._logger.info(T.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:E.SUCCEEDED,trackIds:o.map((function(e){return e.getTrackId()}))})),r({code:ze.SUCCESS,tracks:o}),[2]}))}))},c.onerror=function(){s._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.CREATE_FILE_TRACK_FAILED,msg:"Failed to create file stream, video onerror"})),r({code:ze.CREATE_FILE_TRACK_FAILED,tracks:[]})},c.src=o.url,c.loop=!0,c.play()}))])}))}))}}),Object.defineProperty(e.prototype,"createLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c,u;return I(this,(function(l){return i=[],o=bo(this._context.getCurrentId()),ro(t)?r instanceof MediaStream?(a=this._context.getCurrentId())?(s=P(e.getTracksWithOptions(r,n),2),c=s[0],u=s[1],c&&i.push(new Ki(this._logger,t,a,o,c)),u&&i.push(new Wi(this._logger,t,a,o,u)),this._logger.info(T.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:E.SUCCEEDED,trackIds:i.map((function(e){return e.getTrackId()}))})),[2,{code:ze.SUCCESS,tracks:i}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:ze.INVALID_USER_ID,tracks:i}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.PARAMS_ERROR,msg:"params error -> stream"})),[2,{code:ze.PARAMS_ERROR,tracks:i}]):(this._logger.error(T.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:E.FAILED,code:ze.INVALID_TAGS,msg:"invalid tag"})),[2,{code:ze.INVALID_TAGS,tracks:i}])}))}))}}),Object.defineProperty(e,"getTracksWithOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=[];return r[0]=(null==t?void 0:t.withoutAudio)?void 0:e.getAudioTracks()[0],r[1]=(null==t?void 0:t.withoutVideo)?void 0:e.getVideoTracks()[0],r}}),e}(),Ac=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_crtRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),ia.setSdpSemantics(n.sdpSemantics||"unified-plan",i._logger),i._service=new Mi(i._runtime,i._context,i._options.mediaServer,i._options.timeout),i._context.registerConnectionStateChangeListener(i._onIMStatusChange.bind(i)),i._context.registerDestroyListener(i._onIMUninit.bind(i)),i._context.registerMessageListener(i._handleMessage.bind(i)),i._context.getPluginContext().onnavidatachange=i.naviDataChange.bind(i),i}return y(t,e),Object.defineProperty(t.prototype,"_handleMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.conversationType!==p.RTC_ROOM)return!1;var t=this._logger.createTraceId();return this._logger.info(T.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:E.SUCCEEDED,message:e}),t),this._crtRoom?(this._crtRoom.__parseInnerMessage(e,t),!0):(this._logger.warn(T.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:E.FAILED,message:"the crtRoom is empty"}),t),!0)}}),Object.defineProperty(t.prototype,"naviDataChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(T.L_RTC_CLIENT_NAVI_CHANGE_O,"on navi change data => ".concat(JSON.stringify(e))),this._service.detectorMediaSever(),Pa.logServer=null==e?void 0:e.logServer,Pa.dc=null==e?void 0:e.dc}}),Object.defineProperty(t.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(t.prototype,"setCustomExtendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._logger.info(T.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_T,"info: ".concat(e)),d(e)?(this._service.setCustomExtendInfo(e),this._logger.info(T.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_R,"code: ".concat(ze.SUCCESS)),{code:ze.SUCCESS}):(this._logger.info(T.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_R,"code: ".concat(ze.PARAMS_ERROR)),{code:ze.PARAMS_ERROR})}}),Object.defineProperty(t.prototype,"joinCrossRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=Ji.CROSS_MUTI),C(this,void 0,void 0,(function(){return I(this,(function(n){return console.warn("joinCrossRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{joinType:t,userData:r,mode:Ji.CROSS_MUTI})]}))}))}}),Object.defineProperty(t.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=Ji.RTC),C(this,void 0,void 0,(function(){return I(this,(function(n){return console.warn("joinRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{mode:i,joinType:t,userData:r})]}))}))}}),Object.defineProperty(t.prototype,"joinRTCRoomWithOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,a=this;return I(this,(function(s){switch(s.label){case 0:return r=this._logger.createTraceId(),(n=$e.getMemo()).roomType=null==t?void 0:t.mode,this._logger.info(T.L_RTC_CLIENT_JOIN_RTC_ROOM_T,JSON.stringify({roomId:e,options:t}),r),this._crtRoom?(this._logger.error(T.L_RTC_CLIENT_JOIN_RTC_ROOM_R,JSON.stringify({status:E.FAILED,code:ze.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:ze.REPERT_JOIN_ROOM}]):[4,(i=this._crtRoom=new oc(this._context,this._runtime,e,this._service,this._options,null==t?void 0:t.mode,null==t?void 0:t.encrypt)).__innerInit(null==t?void 0:t.mode,null==t?void 0:t.joinType,void 0,null==t?void 0:t.userData,r)];case 1:return(o=s.sent().code)!==ze.SUCCESS?(this._crtRoom=null,[2,{code:o}]):(i.once(nc,(function(){a._service.clearClusterId(),Ei(a._runtime,a._context),a._crtRoom=null})),n.crtRoom=i,this._joinRoomSucceed(),[2,{code:o,room:i,userIds:i.getRemoteUserIds(),tracks:i.getRemoteTracks()}])}}))}))}}),Object.defineProperty(t.prototype,"joinMeetingRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),C(this,void 0,void 0,(function(){var i,o,a,s,c=this;return I(this,(function(u){switch(u.label){case 0:return i=this._logger.createTraceId(),(o=$e.getMemo()).roomType=Ji.MEETING,this._logger.info(T.L_RTC_JOIN_MEETING_ROOM_T,JSON.stringify({roomId:e,joinType:t,outerUserDatas:r}),i),this._crtRoom?(this._logger.error(T.L_RTC_JOIN_MEETING_ROOM_R,JSON.stringify({status:E.FAILED,code:ze.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),i),[2,{code:ze.REPERT_JOIN_ROOM}]):[4,(a=this._crtRoom=new Lc(this._context,this._runtime,e,this._service,this._options,Ri(),n)).__innerInit(t,void 0,r,i)];case 1:return(s=u.sent().code)!==ze.SUCCESS?(this._crtRoom=null,[2,{code:s}]):(a.once(nc,(function(){c._service.clearClusterId(),Ei(c._runtime,c._context),c._crtRoom=null})),o.crtRoom=a,this._joinRoomSucceed(),[2,{code:s,room:a,userIds:a.getRemoteUserIds(),tracks:a.getRemoteTracks()}])}}))}))}}),Object.defineProperty(t.prototype,"_onIMStatusChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._logger.info(T.L_RTC_CLIENT_IM_CONNECTION_STATE_S,JSON.stringify({status:e,code:t,desc:i[e]})),e===i.DISCONNECTED){if(this._crtRoom){var r=na.IM_DISCONNECTED;t===u.RC_DISCONN_KICK?r=na.OTHER_CLIENT_IM_CONNECTED:2===t&&(r=na.IM_LOGOUT),this._crtRoom.__kickoff(!0,{users:[{userId:this._context.getCurrentId(),type:r}]})}}else e===i.CONNECTED&&this._service.detectorMediaSever();this._crtRoom&&(Ei(this._runtime,this._context),this._service.detectorMediaSever(!0),this._crtRoom.__onReconnected())}}),Object.defineProperty(t.prototype,"_onIMUninit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;this._logger.info(T.L_RTC_CLIENT_DESTROY_S,JSON.stringify({msg:"User destroys IM client"})),t=this._context.getCurrentId(),window.localStorage.removeItem("__meid_".concat(t,"__")),null===(e=this._crtRoom)||void 0===e||e.__destroy(!0)}}),Object.defineProperty(t.prototype,"leaveRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return I(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(T.L_RTC_CLIENT_LEAVE_ROOM_T,JSON.stringify({roomId:e.getRoomId()}),t),this._crtRoom?[4,this._crtRoom.__destroy(!0)]:(this._logger.warn(T.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:E.FAILED,msg:"Room does not exist, without leave"}),t),[2,{code:ze.SUCCESS}]);case 1:return r.sent(),this._service.detectorMediaSever(!0),this._logger.info(T.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:E.SUCCEEDED,roomId:this._crtRoom.getRoomId()}),t),this._crtRoom=null,[2,{code:ze.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t,r,n,i;return I(this,(function(o){switch(o.label){case 0:return e=this._logger.createTraceId(),t=this._context.getCurrentId(),this._logger.info(T.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T,JSON.stringify({userId:t}),e),[4,this._context.getRTCJoinedUserInfo(t)];case 1:return r=o.sent(),n=r.code,i=r.data,n!==u.SUCCESS?(this._logger.error(T.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:E.FAILED,code:n}),e),[2,{code:n}]):(this._logger.info(T.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:E.SUCCEEDED,roomInfo:i}),e),[2,{code:ze.SUCCESS,data:i}])}}))}))}}),Object.defineProperty(t.prototype,"setMediaServerUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e){""===e&&this._service.clearCacheMsList(),this._context.setMediaServerUrl(e)}}),Object.defineProperty(t.prototype,"createCodec",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.createCodec(e,t)}}),Object.defineProperty(t.prototype,"rtcSignaling",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){return I(this,(function(i){return[2,this._context.rtcSignaling(e,t,r,n)]}))}))}}),Object.defineProperty(t.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getPluginContext().getDeviceId()}}),Object.defineProperty(t.prototype,"getIMStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getConnectionStatus()}}),Object.defineProperty(t.prototype,"getVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Ke["W_".concat(e,"H_").concat(t)];return r||Ke.W640_H360}}),Object.defineProperty(t.prototype,"getVideoFps",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=qe["FPS_".concat(e)];return t||qe.FPS_15}}),Object.defineProperty(t.prototype,"setAudioRecordStatusListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._context.registerAudioRecordStatusChangedListener(e)}}),Object.defineProperty(t.prototype,"_joinRoomSucceed",{enumerable:!1,configurable:!0,writable:!0,value:function(){$e.getMemo().rtcConfig=window.sessionStorage.getItem("__rtc_config__")}}),t}(Pc);!function(e){e[e.CROP=1]="CROP",e[e.WHOLE=2]="WHOLE"}(cc||(cc={})),function(e){e[e.CUSTOMIZE=1]="CUSTOMIZE",e[e.SUSPENSION=2]="SUSPENSION",e[e.ADAPTATION=3]="ADAPTATION"}(uc||(uc={})),function(e){e[e.CROP=1]="CROP",e[e.WHOLE=2]="WHOLE"}(lc||(lc={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(dc||(dc={}));var wc,kc="rtcRJoin_data",Dc="rtcRExit",Nc="rtcRInfo",Mc="rtcUData",Uc="rtcUDel",jc="rtcSetData",Bc="userSetData",xc="rtcQryData",Fc="rtcDelData",Vc="rtcToken",Jc="rtcUserState",Hc="rtcUList",Gc="rtcPullKv",qc="rtcQueryJoined",Kc="rtcPullRoomStatus",Wc="reportsdk",zc="rtcPing";!function(e){e.RtcInput="RtcInput",e.RtcOutput="RtcOutput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcRoomStatusInput="RtcRoomStatusInput",e.RtcRoomStatusOutput="RtcRoomStatusOutput",e.RtcReportSDKInput="RtcReportSDKInput",e.RtcPBPolaris="RCRTCPBPolaris",e.RtcPBR1Info="RCRTCPBR1Info",e.RtcPBR2Info="RCRTCPBR2Info",e.RtcPBR3Info="RCRTCPBR3Info",e.RtcPBR4Info="RCRTCPBR4Info",e.RtcPBStatusInfo="RCRTCPBStatusInfo",e.RtcPBStreamInfo="RCRTCPBStreamInfo",e.RCRTCPBPolarisCombine="RCRTCPBPolarisCombine",e.RCRTCPBReceiveAudioInfo="RCRTCPBReceiveAudioInfo",e.RCRTCPBSendAudioInfo="RCRTCPBSendAudioInfo",e.RCRTCPBSendVideoInfo="RCRTCPBSendVideoInfo",e.RCRTCPBReceiveVideoInfo="RCRTCPBReceiveVideoInfo",e.RCRTCPBR3R4Info="RCRTCPBR3R4Info",e.RtcPBCallAndJoinRoomReq="Call_CallAndJoinRoomReq",e.RtcPBJoinRoomReq="Call_JoinRoomReq",e.RtcPBStream="Call_StreamRes",e.RtcPBCallAndJoinRoomRes="Call_CallAndJoinRoomResp",e.RtcPBAcceptAndJoinRoomReq="Call_CallAndJoinRoomReq",e.RtcPBAcceptAndJoinRoomRes="Call_CallAndJoinRoomResp",e.RtcPBJoinRoomRes="Call_JoinRoomResp",e.RtcPBHangupAndExitRoomReq="Call_CallAndExitRoomReq",e.RtcPBHangupAndExitRoomRes="Call_CallAndExitRoomResp",e.JoinMeetingAndRoomReq="Meeting_JoinMeetingAndRoomReq",e.JoinRoomReq="Meeting_JoinRoomReq",e.JoinMeetingAndRoomResp="Meeting_JoinMeetingAndRoomResp",e.QuickMeetingAndRoomResp="Meeting_QuickMeetingAndRoomResp",e.JoinRoomResp="Meeting_JoinRoomResp",e.RtcRoomUserState="Meeting_RtcRoomUserState",e.LeaveMeetingAndRoomReq="Meeting_LeaveMeetingAndRoomReq",e.GetMeetingAndRoomStateReq="Meeting_GetMeetingAndRoomStateReq",e.GetMeetingAndRoomStateResp="Meeting_GetMeetingAndRoomStateResp",e.GetJoinMeetingStateReq="Meeting_PullJoinMeetingDataReq",e.GetJoinMeetingStateResp="Meeting_PullJoinMeetingDataResp",e.GetRtcRoomStateResp="Meeting_GetRtcRoomStateResp"}(wc||(wc={}));var Qc,Yc=((_c={})[wc.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas","supportNtf"],_c[wc.RtcOutput]=["version"],_c[wc.RtcUserListOutput]=["users","token","sessionId","roomInfo","version","meid"],_c[wc.SetUserStatusInput]=["status"],_c[wc.RtcSetDataInput]=["interior","target","key","value","objectName","content"],_c[wc.RtcUserSetDataInput]=["valueInfo","objectName","content"],_c[wc.RtcDataInput]=["interior","target","key","objectName","content"],_c[wc.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],_c[wc.MCFollowInput]=["state"],_c[wc.RtcTokenOutput]=["rtcToken"],_c[wc.RtcQryOutput]=["outInfo"],_c[wc.RtcQryUserOutDataInput]=["userId"],_c[wc.RtcUserOutDataOutput]=["user"],_c[wc.RtcQueryListInput]=["order"],_c[wc.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],_c[wc.RtcValueInfo]=["key","value"],_c[wc.RtcKeyDeleteInput]=["key"],_c[wc.RtcNotifyMsg]=["type","time","roomId","openConnection"],_c[wc.RtcPullKV]=["timestamp","roomId"],_c[wc.RtcKVOutput]=["entries","bFullUpdate","syncTime"],_c[wc.RtcQueryUserJoinedInput]=["userId"],_c[wc.RtcQueryUserJoinedOutput]=["info"],_c[wc.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],_c[wc.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],_c[wc.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],_c[wc.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],_c[wc.RtcRoomStatusInput]=["version"],_c[wc.RtcRoomStatusOutput]=["bFullStatus","version","usersData","roomStatus"],_c[wc.RtcReportSDKInput]=["sdkInfo"],_c[wc.RtcPBPolaris]=["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info"],_c[wc.RtcPBR1Info]=["joinTime","rtcVersion","imVersion","platform","device","os","browserName","browserVersion","receiveTime","sequenceId"],_c[wc.RtcPBR2Info]=["joinTime","sendTime","rtcActionType","rtcActionStatus","trackId","receiveTime","userId","sequenceId"],_c[wc.RtcPBR3Info]=["info"],_c[wc.RtcPBR4Info]=["info"],_c[wc.RtcPBStatusInfo]=["joinTime","receiveTime","totalBitRate","appCPUUsage","systemCPUUsage","systemCPUFrequency","networkStatus","googleRTTNetwork","ipAddress","useReceiveBroadBand","useSendBroadBand","packetLossCount","streams","googTargetEncBitrate","googRetransmitBitrate","googTransmitBitrate","googBucketDelay","upLinkLossrate","rongNetOffsetMs","rongPreBweBps","rongAvgRttMs","sendAudioStreams","sendVideoStreams","recvAudioStreams","recvVideoStreams","rtcVersion","imVersion","platform","iceStatus","xorMode","subIceStatus","startAudioDeviceCount","sequenceId","rongMaxRttMs","iceDecoupleMode","remoteAddress","deviceInfo","group","micphoneVolume","speakerVolume"],_c[wc.RtcPBStreamInfo]=["trackId","codeName","volume","samplingRate","bitRate","packetLossRate","frameRate","resolution","blockTime","jitterData","nAckCount","pliCount","googleRTTTotalTime","isReceiveFirstFrameRate","codeType","isEnabled","userId","state","isActive","streamCode"],_c[wc.RCRTCPBPolarisCombine]=["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info","r3r4Info","requestId","roomType"],_c[wc.RCRTCPBReceiveAudioInfo]=["streamInfo","ssrc","bytesReceived","retransmitBytes","packetsReceived","rongE2eDelayMs","googDecodingPLC","decodingNormal","muteRate","googDecodingPLCCNG","googExpandRate","googSpeechExpandRate","googAccelerateRate","googPreemptiveExpandRate","googNackMaxContSeqsSent","googPacketLostRate","googNackSeqsSent","googJitterBufferMs","googCurrentDelayMs","freezesDurationMs","rongPlcMs","totalSamplesDuration","maxSeqNum","cdur","audioFrozenDur","audioFrozenCnt","rxQuality","googPreferredJitterBufferMs","googDecodeLostDurationMs","googReportDurationMs","audioPlayFrameRate","audioFecReceived","audioFecDecoded","googMaxJitterBufferSizeMs","googMaxIatMs","googMeanIatMs","googStddevIatMs","audioFrozenDurWithPlc","audioFrozenCntWithPlc","audioFrozenDurWithout3K","audioFrozenCntWithout3K","cdurWithout3K"],_c[wc.RCRTCPBSendAudioInfo]=["streamInfo","ssrc","bytesSent","googTargetEncBitrate","googActualEncBitrate","googRetransmitBitrate","maxSeqNum","txQuality","encodeDurationMs","audioCaptureFrameRate","audioEncodeFrameRate"],_c[wc.RCRTCPBSendVideoInfo]=["streamInfo","ssrc","bytesSent","packetsFractionLost","googTargetEncBitrate","googActualEncBitrate","googRetransmitBitrate","rongFecBitrate","framesEncoded","framesDroppedByCapturer","framesDroppedByBwLimit","framesDroppedByEncoderQueue","framesDroppedByEncoder","googFrameRateInput","videoQp","inputResolution","txQuality","videoMaxEncodeCostTime","videoEncodeFrameRate","googActualTargetEncBitrate","videoDeviceInterrupted","enableVirtualBG"],_c[wc.RCRTCPBReceiveVideoInfo]=["streamInfo","ssrc","bytesReceived","retransmitBytes","FECBytes","googFrameRateInput","googFrameRateDecoded","googFrameRateOutput","googFirstFrameReceivedToDecodedMs","googNackMaxContSeqsSent","googPacketLostRate","googNackSeqsSent","packetsReceived","rongFirstFrameStartedToDecodeMs","packetLoss","freezeCount","freezesDurationMs","pausesCount","pausesDurationMs","googMaxDecodeMs","rongE2eDelayMs","googCurrentDelayMs","googTargetDelayMs","googJitterBufferMs","rongAvSyncMs","discardedPackets","recvFrameCleanCount","cdur","videoFrozenDur","videoFrozenCnt","rxQuality","videoDecodeDropCount","videoMaxDecodeCostTime","videoFrozenDurWithout3K","videoFrozenCntWithout3K","videoFrozenCdurWithout3K"],_c[wc.RCRTCPBR3R4Info]=["info"],_c[wc.RtcPBCallAndJoinRoomReq]=["callReq","joinRoomReq"],_c[wc.RtcPBJoinRoomReq]=["streamResList"],_c[wc.RtcPBStream]=["userId","mediaType","ssrc","deviceStreamRes"],_c[wc.RtcPBCallAndJoinRoomRes]=["callResp","joinRoomResp"],_c[wc.RtcPBJoinRoomRes]=["roomId","roomUserList","streamResList","token","sessionId","offlineKickTime","roomCreateTime","userJoinTime","dataVersion"],_c[wc.RtcPBHangupAndExitRoomReq]=["callReq"],_c[wc.RtcPBHangupAndExitRoomRes]=["callResp","exitRoomResp"],_c[wc.JoinMeetingAndRoomReq]=["joinMeetingReq","joinRoomReq"],_c[wc.JoinRoomReq]=["pullModel"],_c[wc.JoinMeetingAndRoomResp]=["joinMeetingResp","joinRoomResp","maxTime","hasMore","maxJoinIndex"],_c[wc.QuickMeetingAndRoomResp]=["joinMeetingResp","joinRoomResp","maxTime","hasMore"],_c[wc.JoinRoomResp]=["roomId","token","sessionId","offlineKickTime","roomCreateTime","userJoinTime","rtcRoomUserState","openConnection"],_c[wc.RtcRoomUserState]=["userId","rtcValueInfo","syncTime"],_c[wc.LeaveMeetingAndRoomReq]=["leaveMeetingReq","leaveRoomReq"],_c[wc.GetMeetingAndRoomStateReq]=["meetingId","syncTime"],_c[wc.GetMeetingAndRoomStateResp]=["getMeetingStateResp","getRtcRoomStateResp","maxTime","hasMore"],_c[wc.GetJoinMeetingStateReq]=["meetingId","syncTime","joinIndex"],_c[wc.GetJoinMeetingStateResp]=["getMeetingStateResp","getRtcRoomStateResp","maxTime","maxJoinIndex","hasMore"],_c[wc.GetRtcRoomStateResp]=["rtcRoomUserState","leaveUserIds"],_c),Zc="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ".concat(wc.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(wc.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(wc.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(wc.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(wc.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(wc.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(wc.RtcRoomStatusInput,"{ // rtc 和 living room 拉房间资源状态使用的参数\n required int64 version =1; //当前客户端最大的房间状态的version\n }\n message ").concat(wc.RtcRoomStatusOutput,"{ // rtc 和 living room 拉房间资源状态返回的数据\n required bool bFullStatus =1; //标识此次给的数据是否是全量数据\n required int64 version =2; //当前获取后房间的最大版本号\n repeated RtcUserInfo usersData=3;//如果是全量数据,这个不为空,给的是房间全部的人以及发布的资源\n repeated RtcRoomStatus roomStatus=4;//房间增量数据\n }\n message RtcRoomStatus{ //房间状态变动\n required string userId = 1;//用户ID\n required int32 event = 2;//房间状态变更的event(人员加入/退出/离线/发布资源) (0:加入;1:离开;2:离线;3:资源变动) \n required int64 time = 3;//本次变更的版本号\n repeated RtcValueInfo userData = 4;//用户变更的资源(event为0或者3时可能有值)\n optional int32 switchRoleType = 5;//如果是切换角色导致的加入房间或退出房间的类型\n optional string extra = 6;\n }\n message ").concat(wc.RtcUserListOutput,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n repeated string codeFormat = 8; //当前房间用户支持的编码交集\n optional int64 roomCreateTime = 9;//房间创建时间\n optional int64 userJoinTime = 10;//用户加入房间\n optional int64 version = 11;//当前房间的版本号\n optional string meid=12;\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat(wc.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(wc.RtcInput,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(wc.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(wc.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n optional bool supportNtf = 9; //是否支持房间状态的变更通过通知拉取的方式获取\n }\n message ").concat(wc.RtcQryOutput,"{\n repeated ").concat(wc.RtcValueInfo," outInfo=1;\n }\n message ").concat(wc.RtcDataInput,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(wc.RtcSetDataInput,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(wc.RtcUserSetDataInput," {\n repeated ").concat(wc.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(wc.RtcValueInfo," content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message ").concat(wc.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(wc.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(wc.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(wc.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(wc.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(wc.RtcNotifyMsg," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n optional int32 openConnection = 4;\n }\n message ").concat(wc.RtcPullKV,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat(wc.RtcKVOutput,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(wc.RtcQueryUserJoinedInput,"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat(wc.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(wc.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n optional string sessionId=4;\n optional int64 roomCreateTime = 5;//房间创建时间\n optional int64 userJoinTime = 6;//用户加入房间\n }\n message ").concat(wc.RtcInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(wc.RtcCancelInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(wc.RtcInviteAnswerInput,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(wc.RtcEndInviteInput,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(wc.RtcReportSDKInput,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n // ---- 北极星数据上报 -------\n message ').concat(wc.RtcPBPolaris," {\n required string type = 1;//上报数据类型 R1-R4\n required string appKey = 2;\n required string sessionId = 3;//房间通话id\n required string roomId = 4;\n required int64 roomCreateTime = 5;//房间创建时间\n required string userId = 6;\n required int32 userRole = 7;\n required int64 joinTime = 8;\n required string signalDataCenter = 9;//signal数据中心\n optional ").concat(wc.RtcPBR1Info," r1Info = 10;\n optional ").concat(wc.RtcPBR2Info," r2Info = 11;\n optional ").concat(wc.RtcPBR3Info," r3Info = 12;\n optional ").concat(wc.RtcPBR4Info," r4Info = 13;\n }\n message ").concat(wc.RtcPBR1Info," {\n required int64 joinTime = 1;//用户加入房间的时间\n required string rtcVersion = 2;//Rtc版本号\n required string imVersion = 3;//IM SDK 版本\n required string platform = 4;//平台(如:Android、iOS、Web)\n required string device = 5; //设备信息(手机名称+型号)\n required string os = 6;//系统版本(手机系统版本)\n optional string browserName = 7; //浏览器名称, 没有用 -1 表示\n optional string browserVersion = 8;//浏览器版本, 没有用 -1 表示\n optional int64 receiveTime = 9; // 发送数据的时间\n optional int64 sequenceId = 10;//第一次上报时候生成的连续Id\n }\n message ").concat(wc.RtcPBR2Info," {\n required int64 joinTime = 1;\n required int64 sendTime = 2;\n required string rtcActionType = 3;//发布类型 subscribe : 订阅 publish : 发布\n required string rtcActionStatus = 4;//发布状态 begin : 开始 tend : 结束\n repeated string trackId = 5;\n optional int64 receiveTime = 6; // 发送数据的时间\n optional string userId = 7;//远端用户 Id\n optional int64 sequenceId = 8;//第一次上报时候生成的连续Id\n }\n message ").concat(wc.RtcPBR3Info," {\n required ").concat(wc.RtcPBStatusInfo," info = 1;\n }\n message ").concat(wc.RtcPBR4Info," {\n required ").concat(wc.RtcPBStatusInfo," info = 1;\n }\n message ").concat(wc.RtcPBStatusInfo," {\n optional int64 joinTime = 1;//用户加入房间的时间\n optional int64 receiveTime = 2;//用户发布数据流的时间(毫秒),暂时由客户端生成,后期如果有问题服务端做兜底处理\n optional int64 totalBitRate = 3;//总码率\n optional float appCPUUsage = 4;//APP CPU占用率\n optional float systemCPUUsage = 5;////系统 CPU占用率\n optional float systemCPUFrequency = 6;//系统CPU频率 (安卓8.0以上)\n optional string networkStatus = 7;//实时网络状态(2g、3g、4g、wifi)\n optional int32 googleRTTNetwork = 8;//Goog rtt 网络延迟\n optional string ipAddress = 9; //本地ip地址\n optional string useReceiveBroadBand = 10; //可接收带宽(单位: bit)\n optional string useSendBroadBand = 11;//可用发送带宽(单位: bit)\n optional string packetLossCount = 12;//丢包数\n repeated ").concat(wc.RtcPBStreamInfo," streams = 13;\n optional int64 googTargetEncBitrate = 14;//总的视频编码码率\n optional int64 googRetransmitBitrate = 15;//总视频重传码率\n optional int64 googTransmitBitrate = 16;//实际视频发送总码率\n optional int64 googBucketDelay = 17;//发送缓冲延时\n optional float upLinkLossrate = 18;//上行丢包率\n optional int64 rongNetOffsetMs = 19;//Ntp offset\n optional int64 rongPreBweBps = 20;//Pre bwe\n optional int64 rongAvgRttMs = 21;//平均往返延时\n repeated RCRTCPBSendAudioInfo sendAudioStreams = 22;//音频发送\n repeated RCRTCPBSendVideoInfo sendVideoStreams = 23;//视频发送\n repeated RCRTCPBReceiveAudioInfo recvAudioStreams = 24;//音频接收\n repeated RCRTCPBReceiveVideoInfo recvVideoStreams = 25;//视频接收\n optional string rtcVersion = 26;//RTC版本号\n optional string imVersion = 27;//IM版本号\n optional string platform = 28;//客户端平台\n optional int64 iceStatus = 29;//ICE状态\n optional int64 xorMode = 30;//混淆模式\n optional int64 subIceStatus = 31;//PC meeting模式的下行ice状态\n optional int64 startAudioDeviceCount = 32;//音频设备启动的次数 \n optional int64 sequenceId = 33;//第一次上报时候生成的连续Id\n optional int64 rongMaxRttMs = 34;//最大往返延时\n optional int64 iceDecoupleMode = 35;//ICE解耦模式\n optional string remoteAddress = 36;//服务器ip地址 \n optional string deviceInfo = 37;//设备信息\n optional string group = 38;//配置服务所属group\n optional int64 micphoneVolume = 39; //micphone音量\n optional int64 speakerVolume = 40; //speaker音量\n }\n message ").concat(wc.RtcPBStreamInfo," {\n required string trackId = 1;\n optional string codeName = 2;//编解码名称\n optional string volume = 3;//音频播放音量\n optional int64 samplingRate = 4; //音频采样率\n optional float bitRate = 5;//下行码率\n optional float packetLossRate = 6;\n optional int64 frameRate = 7;//视频接收帧率(单位:fps)\n optional string resolution = 8;//视频分辨率(格式:640*480)\n optional int64 blockTime = 9;//接收卡顿(间隔时间, 单位: ms)\n optional int64 jitterData = 10;//jitter数据抖动\n optional string nAckCount = 11;//nack数量\n optional string pliCount = 12; //PLI请求数\n optional int64 googleRTTTotalTime = 13; //googRtt往返时长\n optional int64 isReceiveFirstFrameRate = 14;//第一个关键帧是否正常收到\n optional string codeType = 15;//编码方式\n optional int64 isEnabled = 16; //track状态是否可用/track是否mute\n optional string userId = 17;\n optional int64 state = 18;//设备开关状态(0:关闭、1:开启) \n optional int64 isActive = 19; // sender发送数据状态,0-false、1-true\n optional int64 streamCode = 20; //远端流采集状态 0-正常,1-异常\n }\n message ").concat(wc.RCRTCPBReceiveAudioInfo," {\n optional ").concat(wc.RtcPBStreamInfo," streamInfo = 1;\n optional int64 ssrc = 2;\n optional int64 bytesReceived = 3;\n optional int64 retransmitBytes = 4;\n optional int64 packetsReceived = 5;\n optional int64 rongE2eDelayMs = 6;//端到端延时\n optional int64 googDecodingPLC = 7; // PLC样点数 音频plc样点(反应卡顿情况)\n optional int64 decodingNormal = 8;\n optional float muteRate = 9;\n optional int64 googDecodingPLCCNG = 10; // PLC次数\n optional float googExpandRate = 11; // 拉伸比率\n optional float googSpeechExpandRate = 12; // 语音拉伸比率\n optional float googAccelerateRate = 13; // 加速比率\n optional float googPreemptiveExpandRate = 14;\n optional int64 googNackMaxContSeqsSent = 15;//近500个包,连续最长请求重传的数目\n optional float googPacketLostRate = 16; //统计周期内的丢包比率\n optional int64 googNackSeqsSent = 17; //累计重传请求包的次数,一个包可能被多次重传\n optional int64 googJitterBufferMs = 18; // 抖动延时\n optional int64 googCurrentDelayMs = 19; // 当前延时\n optional int64 freezesDurationMs = 20; // 总卡顿时长\n optional int64 rongPlcMs = 21; //通话以来,累计PLC时长\n optional float totalSamplesDuration = 22; // 总时长\n optional int64 maxSeqNum = 23;\n optional int64 cdur = 24;//通话时长,单位毫秒\n optional int64 audioFrozenDur = 25; //卡顿时长,单位毫秒,音频卡顿时长增量 \n optional int64 audioFrozenCnt = 26; //音频卡顿次数增量\n optional float rxQuality = 27; //接收网络质量\n optional int64 googPreferredJitterBufferMs = 28; // 目标延时\n optional int64 googDecodeLostDurationMs = 29; // 丢字时长\n optional int64 googReportDurationMs = 30; // 上报周期\n optional int64 audioPlayFrameRate = 31; // 音频播放帧率\n optional int64 audioFecReceived = 32; //周期内收到的音频fec包数\n optional int64 audioFecDecoded = 33; //周期内实际用于音频解码fec包数\n optional int64 googMaxJitterBufferSizeMs = 34;//音频抖动缓冲区最大时长\n optional int64 googMaxIatMs = 35;//音频IAT最大时长\n optional int64 googMeanIatMs = 36;//音频IAT均值时长\n optional int64 googStddevIatMs = 37;//音频IAT标准差时长\n optional int64 audioFrozenDurWithPlc = 38; //包含PLC帧的卡顿时长,单位毫秒,音频卡顿时长增量 \n optional int64 audioFrozenCntWithPlc = 39; //包含PLC帧音频卡顿次数增量 \n optional int64 audioFrozenDurWithout3K = 40; //不包含cdur>3000的音频卡顿时长,单位毫秒,音频卡顿时长增量 \n optional int64 audioFrozenCntWithout3K = 41; //不包含cdur>3000音频卡顿次数增量\n optional int64 cdurWithout3K = 42; //不包含cdur>3000的通话时长,单位毫秒\n }\n message ").concat(wc.RCRTCPBReceiveVideoInfo," {\n optional ").concat(wc.RtcPBStreamInfo," streamInfo = 1;\n optional int64 ssrc = 2;\n optional int64 bytesReceived = 3;\n optional int64 retransmitBytes = 4;\n optional int64 FECBytes = 5;\n optional int64 googFrameRateInput = 6;\n optional int64 googFrameRateDecoded = 7; //视频解码帧率\n optional int64 googFrameRateOutput = 8; //视频渲染帧率\n optional int64 googFirstFrameReceivedToDecodedMs = 9;// 第一帧从接收到解码延时\n optional int64 googNackMaxContSeqsSent = 10;//近500个包,连续最长请求重传的数目\n optional float googPacketLostRate = 11; //统计周期内的丢包比率\n optional int64 googNackSeqsSent = 12; //累计重传请求包的次数,一个包可能被多次重传\n optional int64 packetsReceived = 13;//累计收包数目\n optional int64 rongFirstFrameStartedToDecodeMs = 14; //第一帧从流建立到解码延时\n optional int64 packetLoss = 15; //累计收包数目\n optional int64 freezeCount = 16; // 卡顿次数\n optional int64 freezesDurationMs = 17; // 总卡顿时长\n optional int64 pausesCount = 18; //总暂停次数\n optional int64 pausesDurationMs = 19; // 总暂停时长\n optional int64 googMaxDecodeMs = 20;//近10s最大解码时长(95分位)\n optional int64 rongE2eDelayMs = 21;//端到端延时\n optional int64 googCurrentDelayMs = 22; // 当前延时\n optional int64 googTargetDelayMs = 23; // 目标延时\n optional int64 googJitterBufferMs = 24; // 抖动延时\n optional int64 rongAvSyncMs = 25; // 音视频同步偏差\n optional int64 discardedPackets = 26;//解码前累计主动丢弃帧数目\n optional int64 recvFrameCleanCount = 27; //累计清空frames(解码前的缓冲区)次数\n optional int64 cdur = 28;//通话时长,单位毫秒\n optional int64 videoFrozenDur = 29;//卡顿时长,单位毫秒,视频卡顿时长增量\n optional int64 videoFrozenCnt = 30; //视频卡顿次数增量\n optional float rxQuality = 31; //接收网络质量\n optional int64 videoDecodeDropCount = 32; //视频解码掉帧数\n optional int64 videoMaxDecodeCostTime = 33; //视频解码最大耗时\n optional int64 videoFrozenDurWithout3K = 34; //不包含cdur>3000的视频卡顿时长,单位毫秒,视频卡顿时长增量 \n optional int64 videoFrozenCntWithout3K = 35; //不包含cdur>3000视频卡顿次数增量\n optional int64 videoFrozenCdurWithout3K = 36; //不包含cdur>3000的通话时长,单位毫秒\n }\n message ").concat(wc.RCRTCPBSendAudioInfo," {\n optional ").concat(wc.RtcPBStreamInfo," streamInfo = 1;\n optional int64 ssrc = 2;\n optional int64 bytesSent = 3;\n optional int64 googTargetEncBitrate = 4;\n optional int64 googActualEncBitrate = 5;\n optional int64 googRetransmitBitrate = 6;\n optional int64 maxSeqNum = 7;\n optional float txQuality = 8;\n optional int64 encodeDurationMs = 9; //音频编码耗时\n optional int64 audioCaptureFrameRate = 10; //音频采集帧率 \n optional int64 audioEncodeFrameRate = 11; //音频编码帧率\n }\n message ").concat(wc.RCRTCPBSendVideoInfo," {\n optional ").concat(wc.RtcPBStreamInfo," streamInfo = 1;\n optional int64 ssrc = 2;\n optional int64 bytesSent = 3;\n optional float packetsFractionLost = 4; \n optional int64 googTargetEncBitrate = 5;\n optional int64 googActualEncBitrate = 6;\n optional int64 googRetransmitBitrate = 7;\n optional int64 rongFecBitrate = 8;\n optional int64 framesEncoded = 9;\n optional int64 framesDroppedByCapturer = 10;\n optional int64 framesDroppedByBwLimit = 11;\n optional int64 framesDroppedByEncoderQueue = 12;\n optional int64 framesDroppedByEncoder = 13;\n optional int64 googFrameRateInput = 14;\n optional int64 videoQp = 15;\n optional string inputResolution = 16;\n optional float txQuality = 17;\n optional int64 videoMaxEncodeCostTime = 18;\n optional int64 videoEncodeFrameRate = 19;\n optional int64 googActualTargetEncBitrate = 20;\n optional int64 videoDeviceInterrupted = 21;\n optional int64 enableVirtualBG = 22;\n }\n message ").concat(wc.RCRTCPBR3R4Info," {\n required ").concat(wc.RtcPBStatusInfo," info = 1;\n }\n message ").concat(wc.RCRTCPBPolarisCombine," {\n required string type = 1;//上报数据类型 R1-R4, R1:加入房间动作, R2:发布/订阅动作, R3:发送, R4:接收, R3R4:发布+订阅\n required string appKey = 2;\n required string sessionId = 3;//房间通话id\n required string roomId = 4;\n required int64 roomCreateTime = 5;//房间创建时间\n required string userId = 6;\n required int64 userRole = 7;\n required int64 joinTime = 8;\n required string signalDataCenter = 9;//signal数据中心\n optional RCRTCPBR1Info r1Info = 10;\n optional RCRTCPBR2Info r2Info = 11;\n repeated RCRTCPBR3R4Info r3r4Info = 12;\n optional int64 requestId = 13;\n optional int64 roomType = 14;\n }\n // ---- 北极星数据上报 -------\n // ---- 1v1呼叫并加入房间 ----\n message Call_CallAndJoinRoomReq{ \n required bytes callReq=1; // 加入call参数\n optional bytes joinRoomReq=2; // 加入RTC房间参数\n }\n message Call_JoinRoomReq{ \n repeated Call_StreamRes streamResList=1; \n }\n message Call_StreamRes{ \n required string userId=1;\n required int32 mediaType=2; \n required int32 ssrc=3; //上行不填写,下行如果符合分配规则填写,否则不填写\n repeated Call_DeviceStreamRes deviceStreamRes=4;\n }\n message Call_CallAndJoinRoomResp{ \n required bytes callResp=1; //GroupCallLib 使用\n required bytes joinRoomResp=2; //RongRTCLib 使用\n }\n message Call_JoinRoomResp{ //RongRTCLib 使用\n required string roomId=1;\n repeated RtcUserInfo roomUserList=2;\n repeated Call_StreamRes streamResList=3;\n optional string token=4;\n optional string sessionId=5;\n optional int32 offlineKickTime=6;\n optional int64 roomCreateTime=7;\n optional int64 userJoinTime=8;\n optional int64 dataVersion=9;//当前房间的版本号,用于标识增量更新数据的版本\n }\n message Call_CallAndExitRoomReq{ \n required bytes callReq=1; \n }\n message Call_CallAndExitRoomResp{ \n required bytes callResp=1; \n optional bytes exitRoomResp=2; \n }\n message Call_DeviceStreamRes{\n required int32 ssrc=1;\n required string meid=2; //新增字段,使用 UUID\n }\n // ---- 1v1呼叫并加入房间 ----\n // ---- 加入Meeting和Room开始 ----\n message Meeting_JoinMeetingAndRoomReq{ \n required bytes joinMeetingReq=1; \n optional bytes joinRoomReq=2; \n }\n message Meeting_JoinRoomReq{\n required int32 pullModel=1;\n }\n message Meeting_JoinMeetingAndRoomResp{ \n required bytes joinMeetingResp=1 ;\n required bytes joinRoomResp=2 ;\n required int64 maxTime=3;\n optional int32 hasMore= 4;\n required int32 maxJoinIndex = 5;\n }\n message Meeting_QuickMeetingAndRoomResp{ \n required bytes joinMeetingResp=1;\n required bytes joinRoomResp=2;\n required int64 maxTime=3;\n optional int32 hasMore= 4;\n }\n message ").concat(wc.JoinRoomResp," { \n required string roomId=1;\n optional string token=2;\n optional string sessionId=3; \n optional int32 offlineKickTime=4;\n optional int64 roomCreateTime=5; \n optional int64 userJoinTime=6;\n repeated ").concat(wc.RtcRoomUserState," rtcRoomUserState = 7;\n optional int32 openConnection=8;\n }\n message ").concat(wc.RtcRoomUserState," { \n required string userId = 1;\n repeated ").concat(wc.RtcValueInfo," userRtcKv= 2; \n required int64 syncTime= 3;\n }\n message ").concat(wc.LeaveMeetingAndRoomReq," { \n required bytes leaveMeetingReq=1; \n optional bytes leaveRoomReq=2; \n }\n message LeaveMeetingReq { \n required string mSeqId= 1; \n required string meetingCode= 2; \n }\n message Meeting_PullJoinMeetingDataReq{\n required string meetingId = 1;\n required int64 syncTime = 2;\n required int32 joinIndex = 3;\n }\n message Meeting_PullJoinMeetingDataResp{\n required bytes getMeetingStateResp = 1 ;\n required bytes getRtcRoomStateResp = 2 ;\n required int64 maxTime = 3;\n required int32 maxJoinIndex = 4;\n required int32 hasMore = 5;\n }\n message ").concat(wc.GetMeetingAndRoomStateReq," { \n required string meetingId= 1; \n required int64 syncTime= 2; \n }\n message ").concat(wc.GetRtcRoomStateResp,"{ \n repeated ").concat(wc.RtcRoomUserState," rtcRoomUserState=1;\n repeated string leaveUserIds=2;\n }\n message ").concat(wc.GetMeetingAndRoomStateResp,"{ \n required bytes getMeetingStateResp=1;\n required bytes getRtcRoomStateResp=2;\n required int64 maxTime=3;\n required int32 hasMore=4;\n }\n // ---- 加入Meeting和Room结束 ----\n}\n"),Xc=function(e,t,r,n,i,o){var a=n?Object.keys(n).map((function(t){return e.encode(wc.RtcValueInfo,{key:t,value:n[t]},!0)})):void 0,s=i?Object.keys(i).map((function(t){return e.encode(wc.RtcValueInfo,{key:t,value:i[t]},!0)})):void 0;return e.encode(wc.RtcInput,{roomType:t,joinType:r,innerDatas:a,outerDatas:s,supportNtf:o})},$c=function(e,t){var r=e.decode(wc.RtcUserListOutput,t),n=r.users,i=r.token,o=r.sessionId,a=r.roomInfo,s=r.entries,c=r.offlineKickTime,u=void 0===c?60:c,l=r.codeFormat,d=r.roomCreateTime,_=r.userJoinTime,p=r.version,f=r.meid,b={};return g(n,(function(e){var t=e.userId,r=e.userData,n={};g(r,(function(e){var t=e.key,r=e.value;n[t]=r})),b[t]=n})),{users:b,token:i,sessionId:o,roomInfo:a,kvEntries:s,offlineKickTime:u,codeFormat:l,roomCreateTime:Lo(d),userJoinTime:Lo(_),version:p,meid:f}},eu=function(e,t,r,n,i,o){var a,s,c,u,l,d=$e.getMemo(),_=t.type,p=t.appKey,f=t.sessionId,b=t.roomId,m=t.roomCreateTime,h=t.userId,g=t.userRole,v=t.joinTime,R=t.signalDataCenter,S=t.r1Info,y=t.r2Info,T=t.r3Info,E=t.r4Info,C=t.r3r4Info,I={type:_,appKey:p,sessionId:f,roomId:b,roomCreateTime:m,userId:h,userRole:g,joinTime:v,signalDataCenter:R,iceStatus:t.iceStatus,xorMode:t.xorMode,subIceStatus:t.subIceStatus},L=Do(d.roomType);if(r===va.R1&&S){var P=e.encode(wc.RtcPBR1Info,S,!0),A=e.encode(wc.RCRTCPBPolarisCombine,O(O({},I),{r1Info:P,requestId:i,roomType:L}));if(!o)return A;null===(a=d.database)||void 0===a||a.put(O(O({time:Number(i),roomType:L},I),{data:P,byteLength:A.byteLength}))}if(r===va.R2&&y){var w=e.encode(wc.RtcPBR2Info,y,!0);A=e.encode(wc.RCRTCPBPolarisCombine,O(O({},I),{r2Info:w,requestId:i,roomType:L}));if(!o)return A;null===(s=d.database)||void 0===s||s.put(O(O({time:Number(i),roomType:L},I),{data:w,byteLength:A.byteLength}))}if(r===va.R3&&T){var k=(j=T.info).streams,D=Array.isArray(k)&&k.map((function(t){return t&&e.encode(wc.RtcPBStreamInfo,t,!0)})),N=e.encode(wc.RtcPBStatusInfo,O(O({},j),{streams:D,sequenceId:n}),!0),M=e.encode(wc.RtcPBR3Info,{info:N},!0);A=e.encode(wc.RCRTCPBPolarisCombine,O(O({},I),{r3Info:[M],requestId:i,roomType:L}));if(!o)return A;null===(c=d.database)||void 0===c||c.put(O(O({time:Number(i),roomType:L},I),{data:M,byteLength:A.byteLength}))}if(r===va.R4&&E){k=(j=E.info).streams,D=Array.isArray(k)&&k.map((function(t){return t&&e.encode(wc.RtcPBStreamInfo,t,!0)})),N=e.encode(wc.RtcPBStatusInfo,O(O({},j),{streams:D,sequenceId:n}),!0);var U=e.encode(wc.RtcPBR4Info,{info:N},!0);A=e.encode(wc.RCRTCPBPolarisCombine,O(O({},I),{r4Info:[U],requestId:i,roomType:L}));if(!o)return A;null===(u=d.database)||void 0===u||u.put(O(O({time:Number(i),roomType:L},I),{data:U,byteLength:A.byteLength}))}if(r===va.R3R4&&C){k=(j=C.info).streams;var j,B=j.recvVideoStreams,x=j.recvAudioStreams,F=j.sendAudioStreams,V=j.sendVideoStreams,J=(D=Array.isArray(k)&&k.map((function(t){return t&&e.encode(wc.RtcPBStreamInfo,t,!0)})),Array.isArray(B)&&B.map((function(t){return t&&e.encode(wc.RCRTCPBReceiveVideoInfo,t,!0)}))),H=Array.isArray(x)&&x.map((function(t){return t&&e.encode(wc.RCRTCPBReceiveAudioInfo,t,!0)})),G=Array.isArray(F)&&F.map((function(t){return t&&e.encode(wc.RCRTCPBSendAudioInfo,t,!0)})),q=Array.isArray(V)&&V.map((function(t){return t&&e.encode(wc.RCRTCPBSendVideoInfo,t,!0)})),K=(N=e.encode(wc.RtcPBStatusInfo,O(O({},j),{streams:D,recvVideoStreams:J,recvAudioStreams:H,sendAudioStreams:G,sendVideoStreams:q,sequenceId:n,micphoneVolume:d.micphoneVolume,speakerVolume:d.speakerVolume}),!0),e.encode(wc.RCRTCPBR3R4Info,{info:N},!0));A=e.encode(wc.RCRTCPBPolarisCombine,O(O({},I),{r3r4Info:[K],requestId:i,roomType:L}));if(!o)return A;null===(l=d.database)||void 0===l||l.put(O(O({time:Number(i),roomType:L},I),{data:K,byteLength:A.byteLength}))}},tu=function(){function t(e,t,r){Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"codec",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomCreateTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userJoinTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"staticMediaServerUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"miniSDPCodec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onAudioRecordStatusChanged",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.miniSDPCodec=this.createCodec(Ii,Li)}return Object.defineProperty(t.prototype,"createCodec",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.context.createCodec(e,t)}}),Object.defineProperty(t.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return C(this,void 0,void 0,(function(){var a,s,c,l,d,_,p,f,b,m,h,g,v,R,S;return I(this,(function(y){switch(y.label){case 0:return a=Xc(this.codec,t,r,n,i,o),[4,this.context.rtcSignaling(e,kc,!0,a)];case 1:return s=y.sent(),c=s.code,l=s.buffer,c===u.SUCCESS&&l?(d=$c(this.codec,l),_=d.users,p=d.token,f=d.sessionId,b=d.roomInfo,m=d.kvEntries,h=d.offlineKickTime,g=d.roomCreateTime,v=d.userJoinTime,R=d.version,S=d.meid,this.roomCreateTime=g,this.userJoinTime=v,[2,{code:c,data:{users:_,token:p,sessionId:f,roomInfo:b,kvEntries:m,offlineKickTime:h,version:R,meid:S}}]):[2,{code:c,data:d}]}}))}))}}),Object.defineProperty(t.prototype,"quitRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return I(this,(function(r){switch(r.label){case 0:return t=this.codec.encode(wc.SetUserStatusInput,{status:0}),[4,this.context.rtcSignaling(e,Dc,!0,t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o;return I(this,(function(a){switch(a.label){case 0:return t=this.codec.encode(wc.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(e,Nc,!0,t)];case 1:return r=a.sent(),n=r.code,i=r.buffer,n===u.SUCCESS&&i&&(o=this.codec.decode(wc.RtcRoomInfoOutput,i)),[2,{code:n,data:o}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a;return I(this,(function(s){switch(s.label){case 0:return t=this.codec.encode(wc.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(e,Mc,!0,t)];case 1:return r=s.sent(),n=r.code,i=r.buffer,n===u.SUCCESS&&i&&(a=$c(this.codec,i),o={users:a.users}),[2,{code:n,data:o}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(t.prototype,"removeRTCUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r;return I(this,(function(n){switch(n.label){case 0:return r=this.codec.encode(wc.RtcKeyDeleteInput,{key:t}),[4,this.context.rtcSignaling(e,Uc,!1,r)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return C(this,void 0,void 0,(function(){var a;return I(this,(function(s){switch(s.label){case 0:return a=this.codec.encode(wc.RtcSetDataInput,{interior:n,target:i,key:t,value:r,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.context.rtcSignaling(e,jc,!1,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCTotalRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i;return I(this,(function(o){switch(o.label){case 0:return n={objectName:r,content:[],valueInfo:[this.codec.encode(wc.RtcValueInfo,{key:"uris",value:t},!0)]},vi.info("setRTCTotalRes: ",n),i=this.codec.encode(wc.RtcUserSetDataInput,n),[4,this.context.rtcSignaling(e,Bc,!0,i)];case 1:return[2,o.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c,l;return I(this,(function(d){switch(d.label){case 0:return i=this.codec.encode(wc.RtcDataInput,{interior:r,target:n,key:t}),[4,this.context.rtcSignaling(e,xc,!0,i)];case 1:return o=d.sent(),a=o.code,s=o.buffer,a===u.SUCCESS&&s?(c=this.codec.decode(wc.RtcQryOutput,s).outInfo,l={},c.forEach((function(e){l[e.key]=e.value})),[2,{code:a,data:l}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"removeRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return C(this,void 0,void 0,(function(){var o;return I(this,(function(a){switch(a.label){case 0:return o=this.codec.encode(wc.RtcDataInput,{interior:r,target:n,key:t,objectName:(null==i?void 0:i.name)||"",content:(null==i?void 0:i.content)||""}),[4,this.context.rtcSignaling(e,Fc,!1,o)];case 1:return[2,a.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCOutData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){return I(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(t.prototype,"getRTCOutData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){return I(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(t.prototype,"getRTCToken",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s;return I(this,(function(c){switch(c.label){case 0:return n=Xc(this.codec,t,r),[4,this.context.rtcSignaling(e,Vc,!0,n)];case 1:return i=c.sent(),o=i.code,a=i.buffer,o===u.SUCCESS&&a?(s=this.codec.decode(wc.RtcTokenOutput,a).rtcToken,[2,{code:o,data:{rtcToken:s}}]):[2,{code:o}]}}))}))}}),Object.defineProperty(t.prototype,"setRTCState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r;return I(this,(function(n){switch(n.label){case 0:return r=this.codec.encode(wc.MCFollowInput,{state:t}),[4,this.context.rtcSignaling(e,Jc,!0,r)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCStateByHttp",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i,o){return C(this,void 0,void 0,(function(){var a,s,c,u,l;return I(this,(function(d){switch(d.label){case 0:if(a="".concat(Date.now()),s=$e.getMemo(),!(c=eu(this.codec,n,i,o,a,!1===s.sendQos)))return[2,ga.REPORT_SUCCESS];u=t,/^https:\/\//.test(t)||(u="https://".concat(t)),d.label=1;case 1:return d.trys.push([1,3,,4]),[4,r.httpReq({url:"".concat(u,"/rtc/logserver/v2/polaris"),body:c,method:e.POST,headers:{jwt:Mi.jwtToken,"Request-Id":a,"Sequence-Id":o,UserId:this.getCurrentId()},timeout:2e3})];case 2:if(!(l=d.sent()).data)throw new Error("http request fail");return[2,JSON.parse(l.data).resultCode];case 3:return d.sent(),[2,ga.REPORT_FAIL];case 4:return[2]}}))}))}}),Object.defineProperty(t.prototype,"setRTCQosDataByHttp",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,d,_,p,f,b,m,h,g,v,R,S,y,T,E,O;return I(this,(function(C){switch(C.label){case 0:switch(i="".concat(Date.now()),o=n[0],a=o.time,s=o.type,c=o.appKey,u=o.sessionId,l=o.roomId,d=o.roomCreateTime,_=o.userId,p=o.userRole,f=o.joinTime,b=o.signalDataCenter,m=o.iceStatus,h=o.xorMode,g=o.subIceStatus,v=o.roomType,R="",s){case va.R1:R="r1Info";break;case va.R2:R="r2Info";break;case va.R3:R="r3Info";break;case va.R4:R="r4Info";break;case va.R3R4:R="r3r4Info"}(O={time:a,type:s,appKey:c,sessionId:u,roomId:l,roomCreateTime:d,userId:_,userRole:p,joinTime:f,signalDataCenter:b,iceStatus:m,xorMode:h,subIceStatus:g,roomType:v})[R]=[],S=O,n.forEach((function(e){var t;null===(t=S[R])||void 0===t||t.push(e.data)})),y=this.codec.encode(wc.RCRTCPBPolarisCombine,S),T=t,/^https:\/\//.test(t)||(T="https://".concat(t)),C.label=1;case 1:return C.trys.push([1,3,,4]),[4,r.httpReq({url:"".concat(T,"/rtc/logserver/polaris/v2"),body:y,method:e.POST,headers:{jwt:Mi.jwtToken,"Request-Id":i,UserId:this.getCurrentId()},timeout:2e3})];case 2:if(!(E=C.sent()).data)throw new Error("http request fail");return[2,JSON.parse(E.data).resultCode];case 3:return C.sent(),[2,ga.REPORT_FAIL];case 4:return[2]}}))}))}}),Object.defineProperty(t.prototype,"saveRTCState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n="".concat(Date.now());eu(this.codec,e,t,r,n,!0)}}),Object.defineProperty(t.prototype,"getRTCUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o;return I(this,(function(a){switch(a.label){case 0:return t=this.codec.encode(wc.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(e,Hc,!0,t)];case 1:return r=a.sent(),n=r.code,i=r.buffer,n===u.SUCCESS&&i?(o=$c(this.codec,i),[2,{code:n,data:o}]):[2,{code:n}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCJoinedUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o;return I(this,(function(a){switch(a.label){case 0:return t=this.codec.encode(wc.RtcQueryUserJoinedInput,{userId:e}),[4,this.context.rtcSignaling("",qc,!0,t)];case 1:return r=a.sent(),n=r.code,i=r.buffer,n===u.SUCCESS&&i?(o=this.codec.decode(wc.RtcQueryUserJoinedOutput,i).info||[],[2,{code:n,data:o.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:Lo(e.joinTime)}}))}]):[2,{code:n}]}}))}))}}),Object.defineProperty(t.prototype,"pullRTCRoomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a,s;return I(this,(function(c){switch(c.label){case 0:return t=this.codec.encode(wc.RtcPullKV,{timestamp:0,roomId:e}),[4,this.context.rtcSignaling(e,Gc,!0,t)];case 1:return r=c.sent(),n=r.code,i=r.buffer,n!==u.SUCCESS?[2,{code:n}]:(o=this.codec.decode(wc.RtcKVOutput,i),a=o.entries,s=o.syncTime,a=(a||[]).map((function(e){return O(O({},e),{timestamp:Lo(e.timestamp)})})),[2,{code:n,data:{kvEntries:a,syncTime:Lo(s)}}])}}))}))}}),Object.defineProperty(t.prototype,"pullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,a;return I(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(wc.RtcRoomStatusInput,{version:t}),[4,this.context.rtcSignaling(e,Kc,!0,r)];case 1:return n=s.sent(),i=n.code,o=n.buffer,i!==u.SUCCESS?[2,{code:i}]:(a=this.codec.decode(wc.RtcRoomStatusOutput,o),[2,{code:i,data:a}])}}))}))}}),Object.defineProperty(t.prototype,"decodeRtcNotify",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.decode(wc.RtcNotifyMsg,e),r=t.time,n=t.type,i=t.roomId,o=t.openConnection;return{time:Lo(r),type:n,roomId:i,openConnection:o}}}),Object.defineProperty(t.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getCurrentId()}}),Object.defineProperty(t.prototype,"getNaviInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getNaviInfo()}}),Object.defineProperty(t.prototype,"getConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getConnectionStatus()}}),Object.defineProperty(t.prototype,"getAppkey",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getAppkey()}}),Object.defineProperty(t.prototype,"webRtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s;return I(this,(function(c){switch(c.label){case 0:return n=this.codec.encode(wc.RtcInput,{roomType:t,broadcastType:r}),[4,this.context.rtcSignaling(e,zc,!0,n)];case 1:return i=c.sent(),o=i.code,a=i.buffer,o!==u.SUCCESS?[2,{code:o}]:((s=this.codec.decode(wc.RtcOutput,a)).version=Lo(s.version),[2,{code:o,data:s}])}}))}))}}),Object.defineProperty(t.prototype,"rtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return/Electron/.test(navigator.userAgent)?this.context.rtcPingResVersion(e,t,r):this.webRtcPing(e,t,r)}}),Object.defineProperty(t.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this.context.sendMessage(e,t,r)}}),Object.defineProperty(t.prototype,"registerRTCSignalListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.registerRTCSignalListener(e)}}),Object.defineProperty(t.prototype,"registerConnectionStateChangeListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.onconnectionstatechange=e}}),Object.defineProperty(t.prototype,"registerDisconnectListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.ondisconnect=e}}),Object.defineProperty(t.prototype,"registerDestroyListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.ondestroy=e}}),Object.defineProperty(t.prototype,"registerMessageListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.onmessage=e}}),Object.defineProperty(t.prototype,"getCoreVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getCoreVersion()}}),Object.defineProperty(t.prototype,"getPluginContext",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context}}),Object.defineProperty(t.prototype,"reportSDKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.encode(wc.RtcReportSDKInput,{sdkInfo:JSON.stringify(e)});this.context.rtcSignaling("",Wc,!0,t)}}),Object.defineProperty(t.prototype,"setMediaServerUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e){m(e)?this.staticMediaServerUrl=e:this.staticMediaServerUrl=""}}),Object.defineProperty(t.prototype,"rtcSignaling",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.context.rtcSignaling(e,t,r,n)}}),Object.defineProperty(t.prototype,"registerAudioRecordStatusChangedListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.onAudioRecordStatusChanged=e}}),t}();!function(e){e.RTC="RTC"}(Qc||(Qc={})),v.add("rtclib","5.7.3-enterprise-alpha.8");var ru={tag:"RCRTC",verify:function(e){return"undefined"==typeof isSecureContext||isSecureContext?!!v.validEngine("5.8.2")||(console.error("The current engine version '".concat(v.getInfo().engine,"' error, plugin-rtc required engine version at least '").concat("5.8.2","'.")),!1):(console.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(e,t,r){void 0===r&&(r={});var n=e.createLogger("RCRTC",Qc.RTC);if(r.logLevel&&n.setOutputLevel(r.logLevel),n.warn(T.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.7.3-enterprise-alpha.8",Commit:"fba7e0473175dc16d136137de9900faf1ae6a3f6","browserInfo.browser":Ro.browser,"browserInfo.supportsUnifiedPlan":Ro.supportsUnifiedPlan,"browserInfo.version":Ro.version})),_("options",r,R.OBJECT,!0),_("options.mediaServer",r.mediaServer,(function(e){return!(!m(e)||"https:"===location.protocol&&!/^https/.test(e))})),_("options.timeout",r.timeout,(function(e){return o(e)&&e>=5e3&&e<=3e4})),_("options.pingGap",r.pingGap,(function(e){return o(e)&&e>=3e3&&e<=1e4})),null==r?void 0:r.AAAWorklet){_("options.AAAWorklet",r.AAAWorklet,R.OBJECT,!0);var a=r.AAAWorklet,s=a.scriptUrl,c=a.wasmUrl;_("AAAWorklet.scriptUrl",s,R.STRING,!0),_("AAAWorklet.wasmUrl",c,R.STRING,!0),Gi.SCRIPT_URL=s,Gi.WASM_URL=c}r.encryptor&&(_("options.encrypt",r.encryptor,R.OBJECT,!0),_("options.encrypt.decodeAudio",r.encryptor.decodeAudio,(function(e){return"function"==typeof e}),!0),_("options.encrypt.decodeVideo",r.encryptor.decodeVideo,(function(e){return"function"==typeof e}),!0),_("options.encrypt.encodeAudio",r.encryptor.encodeAudio,(function(e){return"function"==typeof e}),!0),_("options.encrypt.encodeVideo",r.encryptor.encodeVideo,(function(e){return"function"==typeof e}),!0),$o.init(r.encryptor,n));var u=new tu(e,n,e.createCodec(Yc,Zc));return e.getConnectionStatus()===i.CONNECTED&&Ei(t,u),new Ac(u,t,r)}},nu={DEFAULT:"RongCloudRTC"},iu={transResolution:ho,transFrameRate:vo,parseTrackId:so,ifSupportLocalFileTrack:So,ifSupportScreenShare:yo};export{cc as BackgroundPictureFillMode,uc as MixLayoutMode,lc as MixVideoRenderMode,ic as RCAbstractRoom,Bi as RCAudioBitrate,Xi as RCCameraVideoTrack,qe as RCFrameRate,na as RCKickReason,Ki as RCLocalAudioTrack,Yi as RCLocalFileAudioTrack,zi as RCLocalFileTrack,Qi as RCLocalFileVideoTrack,qi as RCLocalTrack,Wi as RCLocalVideoTrack,Pc as RCMediaStreamCapture,Bo as RCMediaType,Lc as RCMeetingRoom,Zi as RCMicphoneAudioTrack,Pi as RCRTCAudioRecordStatus,wi as RCRTCAudioRecordVolumeStatus,pa as RCRTCAudioStuckStatus,Ac as RCRTCClient,ze as RCRTCCode,la as RCRTCNetworkQualityType,da as RCRTCNetworkStatus,fa as RCRTCNetworkType,ko as RCRTCPingResult,oc as RCRTCRoom,Ai as RCRTCStreamCode,_a as RCRTCVideoStuckStatus,Ua as RCRemoteAudioTrack,Ma as RCRemoteTrack,ja as RCRemoteVideoTrack,Ke as RCResolution,eo as RCScreenAudioTrack,$i as RCScreenVideoTrack,nu as RCTag,xi as RCTrack,Fi as RCVideoBitrate,dc as RTCJoinType,Ji as RTCMode,Xe as device,iu as helper,ru as installer};
|
|
1
|
+
import{isNumber as e,EventEmitter as t,validate as r,isObject as n,ErrorCode as i,isArray as o,HttpMethod as a,notEmptyObject as s,notEmptyArray as c,RCConnectionStatus as u,notEmptyString as l,isString as _,RTCMode as d,assert as f,ConversationType as p,isHttpUrl as h,isBoolean as b,isUndefined as g,forEach as m,VersionManage as v,AssertRules as R}from"@rongcloud/engine";var O=function(e,t){return O=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])},O(e,t)};function E(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}O(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var I,S,T,y=function(){return y=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},y.apply(this,arguments)};function C(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function L(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function P(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function N(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function A(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e[e.SUCCESS=1e4]="SUCCESS",e[e.PB_ERROR=40001]="PB_ERROR",e[e.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",e[e.PARAMS_ERROR=50001]="PARAMS_ERROR",e[e.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",e[e.NOT_IN_ROOM=50003]="NOT_IN_ROOM",e[e.SERVICE_INVALID=50004]="SERVICE_INVALID",e[e.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",e[e.SIGNAL_ERROR=53001]="SIGNAL_ERROR",e[e.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",e[e.REQUEST_FAILED=53004]="REQUEST_FAILED",e[e.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",e[e.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",e[e.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",e[e.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",e[e.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",e[e.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",e[e.BROWSER_PERMISSION_DENIED=53012]="BROWSER_PERMISSION_DENIED",e[e.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",e[e.INVALID_TAGS=53014]="INVALID_TAGS",e[e.INVALID_USER_ID=53015]="INVALID_USER_ID",e[e.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",e[e.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",e[e.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",e[e.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",e[e.TRACK_NOT_READY=53020]="TRACK_NOT_READY",e[e.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",e[e.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",e[e.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",e[e.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",e[e.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",e[e.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",e[e.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",e[e.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",e[e.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",e[e.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM",e[e.SOME_TRACKS_PUBLISH_FAILED=53031]="SOME_TRACKS_PUBLISH_FAILED",e[e.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO=53032]="MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO",e[e.JWT_TIME_OUT=1004]="JWT_TIME_OUT",e[e.SYSTEM_PERMISSION_DENIED=53033]="SYSTEM_PERMISSION_DENIED",e[e.PUBLISH_TRACKS_IS_INVALID=53034]="PUBLISH_TRACKS_IS_INVALID",e[e.TRACK_READYSTATE_IS_ENDED=53035]="TRACK_READYSTATE_IS_ENDED",e[e.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH=53036]="APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH",e[e.LOAD_3A_MODULE_FAILED=53037]="LOAD_3A_MODULE_FAILED"}(I||(I={})),function(e){e.L_INDEX_INSTALL_RTC_PLUGIN_O="L-index_install_rtc_plugin-O",e.L_RTC_CLIENT_IM_CONNECTION_STATE_S="L-rtc_client_im_connection_state-S",e.L_RTC_CLIENT_MESSAGE_O="L-rtc_client_message-O",e.L_RTC_CLIENT_DESTROY_S="L-rtc_client_destroy-S",e.L_RTC_CLIENT_JOIN_RTC_ROOM_T="L-rtc_client_join_rtc_room-T",e.L_RTC_CLIENT_JOIN_RTC_ROOM_O="L-rtc_client_join_rtc_room-O",e.L_RTC_CLIENT_JOIN_RTC_ROOM_R="L-rtc_client_join_rtc_room-R",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_T="L-rtc_client_join_living_room-T",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_R="L-rtc_client_join_living_room-R",e.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_T="L-rtc_client_set_custom_extend_info-T",e.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_R="L-rtc_client_set_custom_extend_info-R",e.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O="L-rtc_client_get_audience_client-O",e.L_RTC_CLIENT_LEAVE_ROOM_T="L-rtc_client_leave_room-T",e.L_RTC_CLIENT_LEAVE_ROOM_R="L-rtc_client_leave_room-R",e.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O="L-rtc_client_create_microphone_audio_track-O",e.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O="L-rtc_client_create_camera_video_track-O",e.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O="L-rtc_client_create_microphone_and_camera_tracks-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O="L-rtc_client_create_screen_video_track-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O="L-rtc_client_create_screen_video_and_audio_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O="L-rtc_client_create_local_audio_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O="L-rtc_client_create_local_video_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O="L-rtc_client_create_local_file_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O="L-rtc_client_create_local_tracks-O",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T="L-rtc_client_join_living_room_as_audience-T",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R="L-rtc_client_join_living_room_as_audience_R",e.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_T="L-rtc_client_leave_living_room_as_audience-T",e.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R="L-rtc_client_leave_living_room_as_audience-R",e.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T="L-rtc_client_upgrade_to_anchor_room-T",e.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R="L-rtc_client_upgrade_to_anchor_room-R",e.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T="L-rtc_client_downgrade_to_audience_room-T",e.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R="L-rtc_client_downgrade_to_audience_room-R",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T="L-rtc_client_get_joined_room_info-T",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R="L-rtc_client_get_joined_room_info-R",e.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O="L-audinence_client_call_onTrackReady-O",e.L_AUDIENCE_CLIENT_SUBSCRIBE_T="L-audinence_client_subscribe-T",e.L_AUDIENCE_CLIENT_SUBSCRIBE_R="L-audinence_client_subscribe-R",e.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T="L-audinence_client_unsubscribe-T",e.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R="L-audinence_client_unsubscribe-R",e.L_PINGER_START_O="L-pinger_start-O",e.L_PINGER_STOP_O="L-pinger_stop-O",e.L_PINGER_SEND_RTCPING_E="L-pinger_send_rtcping-E",e.L_ABSTRACT_ROOM_SEND_MESSAGE_T="L-abstract_room_send_message-T",e.L_ABSTRACT_ROOM_SEND_MESSAGE_R="L-abstract_room_send_message-R",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T="L-abstract_room_set_room_attribute-T",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R="L-abstract_room_set_room_attribute_R",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T="L-abstract_room_delete_room_attribute_T",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R="L-abstract_room_delete_room_attribute_R",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T="L-abstract_room_get_room_attribute_T",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R="L-abstract_room_get_room_attribute_R",e.L_ABSTRACT_ROOM_PUBLISH_T="L-abstract_room_publish-T",e.L_ABSTRACT_ROOM_PUBLISH_R="L-abstract_room_publish-R",e.L_ABSTRACT_ROOM_PUBLISH_E="L-abstract_room_publish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_T="L-abstract_room_unpublish-T",e.L_ABSTRACT_ROOM_UNPUBLISH_R="L-abstract_room_unpublish-R",e.L_ABSTRACT_ROOM_UNPUBLISH_E="L-abstract_room_unpublish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_P="L-abstract_room_unpublish-P",e.L_ABSTRACT_ROOM_SUBSCRIBE_T="L-abstract_room_subscribe-T",e.L_ABSTRACT_ROOM_SUBSCRIBE_R="L-abstract_room_subscribe-R",e.L_ABSTRACT_ROOM_SUBSCRIBE_E="L-abstract_room_subscribe-E",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_T="L-abstract_room_unsubscribe-T",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_R="L-abstract_room_unsubscribe-R",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_E="L-abstract_room_unsubscribe-E",e.L_APP_CALL_UNSUBSCRIBE_O="L-app_call_unsubscribe-O",e.L_USER_LEFT_UNSUBSCRIBE_O="L-user_left_unsubscribe-O",e.L_RES_UNPUB_UNSUBSCRIBE_O="L-res_unpub_unsubscribe-O",e.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O="L-abstract_room_register_room_event_listener-O",e.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O="L-abstract_room_register_report_listener-O",e.L_ABSTRACT_ROOM_AUDIO_LEVEL_O="L-abstract_room_audio_level-O",e.L_ABSTRACT_ROOM_IM_RECONNECTED_T="L-abstract_room_im_reconnected-T",e.L_ABSTRACT_ROOM_IM_RECONNECTED_R="L-abstract_room_im_reconnected-R",e.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O="L-abstract_room_call_app_listener-O",e.L_ABSTRACT_ROOM_SETBITRATE_O="L-abstract_room_setBitrate-O",e.L_ABSTRACT_ROOM_ONTRACKREADY_O="L-abstract_room_onTrackReady-O",e.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O="L-abstract_room_receive_message-O",e.L_ABSTRACT_ROOM_ONKICKOFF_O="L-abstract_room_onKickoff-O",e.L_LIVING_ROOM_RECONNECTED_T="L-living_room_reconnected-T",e.L_LIVING_ROOM_RECONNECTED_R="L-living_room_reconnected-R",e.L_LIVING_ROOM_ENABLE_INNER_CDN_T="L-living_room_enable_inner_cdn-T",e.L_LIVING_ROOM_ENABLE_INNER_CDN_R="L-living_room_enable_inner_cdn-R",e.L_LIVING_ROOM_SPREAD_CDN_INFO_T="L-living_room_spread_cdn_info-T",e.L_LIVING_ROOM_SPREAD_CDN_INFO_R="L-living_room_spread_cdn_info-R",e.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T="L-living_room_set_room_cdn_info-T",e.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R="L-living_room_set_room_cdn_info-R",e.L_LIVING_ROOM_JOINED_PK_ROOM_T="L-living_room_joined_pk_room-T",e.L_LIVING_ROOM_JOINED_PK_ROOM_R="L-living_room_joined_pk_room-R",e.L_LIVING_ROOM_LEAVE_PK_ROOM_T="L-living_room_leave_pk_room-T",e.L_LIVING_ROOM_LEAVE_PK_ROOM_R="L-living_room_leave_pk_room-R",e.L_APP_CALL_LEAVE_PK_ROOM_O="L-app_call_leave_pk_room-O",e.L_QUIT_PK_LEAVE_PK_ROOM_O="L-quit_pk_leave_pk_room-O",e.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O="L-living_room_get_room_pk_handler-O",e.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O="L-living_room_get_mcu_config_builder-O",e.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O="L-living_room_quit_all_pk_room-O",e.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O="L-living_pk_handler_register_room_pk_event_listener-O",e.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O="L-living_pk_handler_call_app_listener-O",e.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T="L-living_pk_handler_request_join_other_room-T",e.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R="L-living_pk_handler_request_join_other_room-R",e.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T="L-living_pk_handler_cancel_request_join_other_room-T",e.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R="L-living_pk_handler_cancel_request_join_other_room-R",e.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T="L-living_pk_handler_response_join_other_room-T",e.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R="L-living_pk_handler_response_join_other_room-R",e.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T="L-living_pk_handler_join_other_room-T",e.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R="L-living_pk_handler_join_other_room-R",e.L_LIVING_PK_HANDLER_LEAVE_OTHER_ROOM_T="L-living_pk_handler_leave_other_room-T",e.L_LIVING_PK_HANDLER_LEAVE_OTHER_ROOM_R="L-living_pk_handler_leave_other_room-R",e.L_QUIT_PK_T="L-quit_pk-T",e.L_QUIT_PK_R="L-quit_pk-R",e.L_EXCHANGE_WITH_PUSHOTHERROOM_T="L-exchange_with_pushotherroom-T",e.L_EXCHANGE_WITH_PUSHOTHERROOM_R="L-exchange_with_pushotherroom-R",e.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O="L-audience_living_room_call_app_listener-O",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_O="L-audience_living_room_pull_kvEntries-O",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T="L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R="L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R",e.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P="L-audience_living_room_singal_data_change-P",e.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T="L-audience_living_room_get_cdn_play_url-T",e.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R="L-audience_living_room_get_cdn_play_url-R",e.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T="L-audience_living_room_subscribe-T",e.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R="L-audience_living_room_subscribe-R",e.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T="L-audience_living_room_unsubscribe-T",e.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R="L-audience_living_room_unsubscribe-R",e.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T="L-audience_living_room_update_subscribeList-T",e.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R="L-audience_living_room_update_subscribeList-R",e.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O="L-audience_living_room_onTrackReady-O",e.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R="L-audience_living_room_im_reconnected-R",e.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T="L-audience_living_room_im_reconnected-T",e.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O="L-mcu_config_builder_set_host_video_track-O",e.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O="L-mcu_config_builder_set_mix_layout_mode-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O="L-mcu_config_builder_set_output_video_resolution-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O="L-mcu_config_builder_set_output_video_fps-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O="L-mcu_config_builder_set_output_video_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O="L-mcu_config_builder_set_output_tiny_video_resolution-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O="L-mcu_config_builder_set_output_tiny_video_fps-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O="L-mcu_config_builder_set_output_tiny_video_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O="L-mcu_config_builder_set_output_video_render_mode-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O="L-mcu_config_builder_set_output_audio_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O="L-mcu_config_builder_set_output_background_color-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_add_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_remove_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_clear_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O="L-mcu_config_builder_set_output_background_picture-fill-mode-O",e.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_add_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_remove_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_CLEAR_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_clear_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_add_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_remove_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_clear_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_set_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_add_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_remove_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_clear_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_RESET_O="L-mcu_config_builder_reset-O",e.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O="L-mcu_config_builder_add_single_water_mark-O",e.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O="L-mcu_config_builder_remove_single_water_mark-O",e.L_MCU_CONFIG_BUILDER_CLEAR_SINGLE_WATER_MARK_O="L-mcu_config_builder_clear_single_water_mark-O",e.L_MEDIA_SERVICE_SET_MCU_CONFIG_T="L-media_service_set_mcu_config-T",e.L_MEDIA_SERVICE_SET_MCU_CONFIG_R="L-media_service_set_mcu_config-R",e.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T="L-media_service_get_cnd_resource_info-T",e.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R="L-media_service_get_cnd_resource_info-R",e.L_MEDIA_SERVICE_MSLIST_CHANGE_O="L-media_service_msList_change-O",e.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O="L-media_service_parse_navi_callvoip_info-O",e.L_MEDIA_SERVICE_REQUEST_T="L-media_service_request-T",e.L_MEDIA_SERVICE_REQUEST_R="L-media_service_request-R",e.L_LOCAL_TRACK_DESTROY_O="L-loacl_track_destroy-O",e.L_LOCAL_TRACK_SET_BITRATE_O="L-loacl_track_set_bitrate-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_O="L-loacl_track_set_local_muted-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T="L-loacl_track_set_local_muted_spread-T",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R="L-loacl_track_set_local_muted_spread-R",e.L_TRACK_PLAY_O="L-track_play-O",e.L_TRACK_PLAY_E="L-track_play-E",e.L_TRACK_LOAD_START_O="L-track_load_start-O",e.L_TRACK_DURATION_CHANGE_O="L-track_duration_change-O",e.L_TRACK_LOADED_META_DATA_O="L-track_loaded_meta_data-O",e.L_TRACK_LOADED_DATA_O="L-track_loaded_data-O",e.L_TRACK_ABORT_O="L-track_abort-O",e.L_TRACK_VOLUME_CHANGE_O="L-track_volume_change-O",e.L_TRACK_CANPLAY_O="L-track_canplay-O",e.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O="L-abstract_stat_parser_format_rtc_state_report-O",e.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O="L-a_sdp_strategy_set_sdp_semantics-O",e.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O="L-a_sdp_strategy_set_remote_answer-O",e.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O="L-rtc_peer_connection_add_local_track-O",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S="L-rtc_peer_connection_ice_connection_state-S",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R="L-rtc_peer_connection_ice_connection_state_report-R",e.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S="L-rtc_peer_connection_connection_state-S",e.L_RTC_PEER_CONNECTION_SET_BITRATE_O="L-rtc_peer_connection_set_bitrate-O",e.L_RTC_PEER_CONNECTION_CREATE_OFFER_O="L-rtc_peer_connection_create_offer-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O="L-rtc_peer_connection_remove_local_track_by_id-O",e.L_RTC_PEER_CONNECTION_REMOVE_ALL_LOCAL_TRACK_O="L-rtc_peer_connection_remove_all_local_track-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O="L-rtc_peer_connection_remove_local_track-O",e.L_RTC_PEER_CONNECTION_DESTROY_O="L-rtc_peer_connection_destroy-O",e.L_RTC_SET_RECOMMEND_BITRATE_O="L_rtc_set_recommend_bitrate_O",e.L_RTC_3ANOISE_NODE_O="L_RTC_AAAnoiseNode_O",e.L_RTC_3ANOISE_NODE_E="L_RTC_AAAnoiseNode_E",e.L_RTC_3ANOISE_NODE_STOP_O="L_RTC_AAAnoiseNode_Stop_O",e.L_QS_JOIN_ROOM_S="RTC-joinRoomRtc-S",e.L_QS_SUBSCRIBE_S="RTC-subscribe-S",e.L_QS_UNSUBSCRIBE_S="RTC-unsubscribe-S",e.L_QS_PUBLISH_S="RTC-publishRtc-S",e.L_QS_UNPUBLISH_S="RTC-unpublishRtc-S",e.L_QS_ICE_STATUS_S="RTC-iceStatus-S",e.L_QS_KICKED_S="RTC-forcedOffline-S",e.L_QS_PUB_ICE_STATUS_S="RTC-pubIceConnected-S",e.L_QS_SUB_ICE_STATUS_S="RTC-subIceConnected-S",e.L_QS_RECV_PUB_MSG_S="RTC-recvPubMsg-S",e.L_SET_ENCODER_PREFERENCES_S="RTC-set_Encoder_Preferences-S",e.L_RTCNTF_PULL_ROOM_STATUS_O="L-rtcntf_pull_room_status-O",e.L_RTCPING_PULL_ROOM_STATUS_O="L-rtcping_pull_room_status-O",e.L_PULL_ROOM_STATUS_T="L-pull_room_status-T",e.L_PULL_ROOM_STATUS_R="L-pull_room_status-R",e.L_OLD_DAILY_RECORD_O="L-old_daily_record-O",e.L_REMOTE_USER_JOINED_RESOURCES_O="L-remote_user_joined_resources-O",e.L_REMOTE_USER_STATE_HANDLE_O="L-remote_user_state_handle-O",e.L_UPDATE_SUBSCRIBELIST_COMMAND_T="L-update_subscribeList_command-T",e.L_UPDATE_SUBSCRIBELIST_COMMAND_P="L-update_subscribeList_command-P",e.L_UPDATE_SUBSCRIBELIST_COMMAND_R="L-update_subscribeList_command-R",e.L_RTC_CLIENT_NAVI_CHANGE_O="L-rtc_client_navi_change-O",e.L_UNPUBLISH_PREV_COMMAND_T="L-unpublish_prev_command-T",e.L_UNPUBLISH_PREV_COMMAND_R="L-unpublish_prev_command-R",e.L_RETRY_EXCHANGE_COMMAND_T="L-retry_exchange_command-T",e.L_RETRY_EXCHANGE_SPREAD_T="L-retry_exchange_spread-T",e.L_RETRY_EXCHANGE_SPREAD_R="L-retry_exchange_spread-R",e.L_PARSE_USERSTATE_COMMAND_R="L-parse_userstate_command-R",e.L_RESUB_REPUB_RES_R="L-resub_repub_res-R",e.L_PARSE_ROOMDATA_URIS_R="L-parse_roomdata_uris-R",e.L_SET_AUDIO_CONSTRAINTS_O="L-set_audio_constraints-O",e.L_FUNCTION_IS_UNAVAILABLE="L-function_is_unavailable",e.L_CLEAR_UNSUBSCRIBE_LIST_O="L-clear_unsubscribe_list-O",e.L_INVOKER_PUSH_O="L-invoker_push-O",e.L_INVOKER_EXECUTE_T="L-invoker_execute-T",e.L_INVOKER_EXECUTE_R="L-invoker_execute-R",e.L_INVOKER_DESTROY_O="L-invoker_destroy-R",e.L_PARSE_VOIP_SERVER_CONF_E="L_PARSE_VOIP_SERVER_CONF_E",e.L_GET_MEDIA_STREAM_E="L_GET_MEDIA_STREAM_E",e.L_INNER_SET_TRACK_O="L_INNER_SET_TRACK_O",e.A_APPLY_3A_NOISE_WORKLET_T="A-apply_3a_noise_worklet-T",e.A_APPLY_3A_NOISE_WORKLET_R="A-apply_3a_noise_worklet-R",e.L_ENCRYPTOR_ENCODE_E="L-encryptor_encode-E",e.L_ENCRYPTOR_DECODE_E="L-encryptor_decode-E"}(S||(S={})),function(e){e.FAILED="fail",e.SUCCESSED="success",e.TIMEOUT="timeout",e.INFO="info"}(T||(T={}));let w=!0,D=!0;function U(e,t,r){const n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function k(e,t,r){if(!e.RTCPeerConnection)return;const n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};const o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function M(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(w=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function j(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(D=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function B(){if("object"==typeof window){if(w)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function x(e,t){D&&console.warn(e+" is deprecated, please use "+t+" instead.")}function V(e){return"[object Object]"===Object.prototype.toString.call(e)}function F(e){return V(e)?Object.keys(e).reduce((function(t,r){const n=V(e[r]),i=n?F(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})}),{}):e}function J(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?J(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{J(e,e.get(t),r)}))})))}function G(e,t,r){const n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===n&&r.trackId===t.id&&J(e,r,i)}))})),i}const H=B;function K(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[i("min",r)]=n.ideal,t.optional.push(e),e={},e[i("max",r)]=n.ideal,t.optional.push(e)):(e[i("",r)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const a=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||a)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let a=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!a&&r.length&&t.includes("back")&&(a=r[r.length-1]),a&&(e.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=n(e.video),H("chrome: "+JSON.stringify(e)),i(e)}))}e.video=n(e.video)}return H("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function W(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Y(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else k(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function z(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function q(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const n=function(e){r(o(i(e)))};return t.apply(this,[n,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])})).then(r,n)}}function Q(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>G(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),k(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>G(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,n;return this.getSenders().forEach((r=>{r.track===e&&(t?n=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?n=!0:r=t),t.track===e))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function Z(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function X(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Z(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[r.id];if(i)i.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=s.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function $(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function ee(e,t){k(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var te=Object.freeze({__proto__:null,shimMediaStream:W,shimOnTrack:Y,shimGetSendersWithDtmf:z,shimGetStats:q,shimSenderReceiverGetStats:Q,shimAddTrackRemoveTrackWithNative:Z,shimAddTrackRemoveTrack:X,shimPeerConnection:$,fixNegotiationNeeded:ee,shimGetUserMedia:K,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{const n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var re,ne,ie=(re=function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:r[t[n]]=t[n+1]}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),n+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach((function(e){n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&c&&n.push({ssrc:c});var l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,n.forEach((function(e){e.maxBitrate=l}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};if(t.matchPrefix(e,"a=sctpmap:").length>0){var a=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,n,i){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t},re(ne={exports:{}},ne.exports),ne.exports);function oe(e,t,r,n,i){var o=ie.writeRtpDescription(e.kind,t);if(o+=ie.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=ie.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":i||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var s="msid:"+(n?n.id:"-")+" "+a+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+ie.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+ie.localCName+"\r\n"),o}function ae(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},n=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++)if(t[r].payloadType===e||t[r].preferredPayloadType===e)return t[r]},i=function(e,t,r,i){var o=n(e.parameters.apt,r),a=n(t.parameters.apt,i);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach((function(n){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(n.name.toLowerCase()===a.name.toLowerCase()&&n.clockRate===a.clockRate){if("rtx"===n.name.toLowerCase()&&n.parameters&&a.parameters.apt&&!i(n,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(n.numChannels,a.numChannels),r.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter((function(e){for(var t=0;t<n.rtcpFeedback.length;t++)if(n.rtcpFeedback[t].type===e.type&&n.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var n=0;n<t.headerExtensions.length;n++){var i=t.headerExtensions[n];if(e.uri===i.uri){r.headerExtensions.push(i);break}}})),r}function se(e,t,r){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(r)}function ce(e,t){var r=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return r||e.addRemoteCandidate(t),!r}function ue(e,t){var r=new Error(t);return r.name=e,r.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],r}var le=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function n(t,r,n,i){var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=i,e.setTimeout((function(){t._dispatchEvent("track",o)}))}var i=function(r){var n=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){n[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",r=JSON.parse(JSON.stringify(r||{})),this.usingBundle="max-bundle"===r.bundlePolicy,"negotiate"===r.rtcpMuxPolicy)throw ue("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(r.rtcpMuxPolicy||(r.rtcpMuxPolicy="require"),r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all"}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced"}if(r.iceServers=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof n;return i&&(n=[n]),n=n.filter((function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||r?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(r=!0,!0)})),delete e.url,e.urls=i?n[0]:n,!!n.length}}))}(r.iceServers||[],t),this._iceGatherers=[],r.iceCandidatePoolSize)for(var o=r.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=ie.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0,n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&r)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();n.iceTransport=i.iceTransport,n.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(n),n},i.prototype.addTrack=function(t,r){if(this._isClosed)throw ue("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var n;if(this.transceivers.find((function(e){return e.track===t})))throw ue("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(n=this.transceivers[i]);return n||(n=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),n.track=t,n.stream=r,n.rtpSender=new e.RTCRtpSender(t,n.dtlsTransport),n.rtpSender},i.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach((function(t){r.addTrack(t,e)}));else{var n=e.clone();e.getTracks().forEach((function(e,t){var r=n.getTracks()[t];e.addEventListener("enabled",(function(e){r.enabled=e.enabled}))})),n.getTracks().forEach((function(e){r.addTrack(e,n)}))}},i.prototype.removeTrack=function(t){if(this._isClosed)throw ue("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var r=this.transceivers.find((function(e){return e.rtpSender===t}));if(!r)throw ue("InvalidAccessError","Sender was not created by this connection.");var n=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(n)&&this.localStreams.indexOf(n)>-1&&this.localStreams.splice(this.localStreams.indexOf(n),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var r=t.getSenders().find((function(t){return t.track===e}));r&&t.removeTrack(r)}))},i.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},i.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},i.prototype._createIceGatherer=function(t,r){var n=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||0===Object.keys(e.candidate).length;i.state=r?"completed":"gathering",null!==n.transceivers[t].bufferedCandidateEvents&&n.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,r){var n=this,i=this.transceivers[r].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),i.onlocalcandidate=function(e){if(!(n.usingBundle&&r>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:r};var a=e.candidate,s=!a||0===Object.keys(a).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),a.component=1,a.ufrag=i.getLocalParameters().usernameFragment;var c=ie.writeCandidate(a);o.candidate=Object.assign(o.candidate,ie.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var u=ie.getMediaSections(n._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",n._localDescription.sdp=ie.getDescription(n._localDescription.sdp)+u.join("");var l=n.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==n.iceGatheringState&&(n.iceGatheringState="gathering",n._emitGatheringStateChange()),s||n._dispatchEvent("icecandidate",o),l&&(n._dispatchEvent("icecandidate",new Event("icecandidate")),n.iceGatheringState="complete",n._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var n=new e.RTCDtlsTransport(r);return n.ondtlsstatechange=function(){t._updateConnectionState()},n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:n}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var n=this.transceivers[e].dtlsTransport;n&&(delete n.ondtlsstatechange,delete n.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,r,n){var i=ae(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:ie.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),n&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,r,n=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(ue("TypeError",'Unsupported type "'+e.type+'"'));if(!se("setLocalDescription",e.type,n.signalingState)||n._isClosed)return Promise.reject(ue("InvalidStateError","Can not set local "+e.type+" in state "+n.signalingState));if("offer"===e.type)t=ie.splitSections(e.sdp),r=t.shift(),t.forEach((function(e,t){var r=ie.parseRtpParameters(e);n.transceivers[t].localCapabilities=r})),n.transceivers.forEach((function(e,t){n._gather(e.mid,t)}));else if("answer"===e.type){t=ie.splitSections(n._remoteDescription.sdp),r=t.shift();var i=ie.matchPrefix(r,"a=ice-lite").length>0;t.forEach((function(e,t){var o=n.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,l=o.remoteCapabilities;if(!(ie.isRejected(e)&&0===ie.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var _=ie.getIceParameters(e,r),d=ie.getDtlsParameters(e,r);i&&(d.role="server"),n.usingBundle&&0!==t||(n._gather(o.mid,t),"new"===s.state&&s.start(a,_,i?"controlling":"controlled"),"new"===c.state&&c.start(d));var f=ae(u,l);n._transceive(o,f.codecs.length>0,!1)}}))}return n._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?n._updateSignalingState("have-local-offer"):n._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var o=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(ue("TypeError",'Unsupported type "'+i.type+'"'));if(!se("setRemoteDescription",i.type,o.signalingState)||o._isClosed)return Promise.reject(ue("InvalidStateError","Can not set remote "+i.type+" in state "+o.signalingState));var a={};o.remoteStreams.forEach((function(e){a[e.id]=e}));var s=[],c=ie.splitSections(i.sdp),u=c.shift(),l=ie.matchPrefix(u,"a=ice-lite").length>0,_=ie.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=_;var d=ie.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!d&&d.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(n,c){var d=ie.splitLines(n),f=ie.getKind(n),p=ie.isRejected(n)&&0===ie.matchPrefix(n,"a=bundle-only").length,h=d[0].substr(2).split(" ")[2],b=ie.getDirection(n,u),g=ie.parseMsid(n),m=ie.getMid(n)||ie.generateIdentifier();if(p||"application"===f&&("DTLS/SCTP"===h||"UDP/DTLS/SCTP"===h))o.transceivers[c]={mid:m,kind:f,protocol:h,rejected:!0};else{var v,R,O,E,I,S,T,y,C;!p&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(f,!0));var L,P,N=ie.parseRtpParameters(n);p||(L=ie.getIceParameters(n,u),(P=ie.getDtlsParameters(n,u)).role="client"),T=ie.parseRtpEncodingParameters(n);var A=ie.parseRtcpParameters(n),w=ie.matchPrefix(n,"a=end-of-candidates",u).length>0,D=ie.matchPrefix(n,"a=candidate:").map((function(e){return ie.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!p&&_&&c>0&&o.transceivers[c]&&(o._disposeIceAndDtlsTransports(c),o.transceivers[c].iceGatherer=o.transceivers[0].iceGatherer,o.transceivers[c].iceTransport=o.transceivers[0].iceTransport,o.transceivers[c].dtlsTransport=o.transceivers[0].dtlsTransport,o.transceivers[c].rtpSender&&o.transceivers[c].rtpSender.setTransport(o.transceivers[0].dtlsTransport),o.transceivers[c].rtpReceiver&&o.transceivers[c].rtpReceiver.setTransport(o.transceivers[0].dtlsTransport)),"offer"!==i.type||p){if("answer"===i.type&&!p){R=(v=o.transceivers[c]).iceGatherer,O=v.iceTransport,E=v.dtlsTransport,I=v.rtpReceiver,S=v.sendEncodingParameters,y=v.localCapabilities,o.transceivers[c].recvEncodingParameters=T,o.transceivers[c].remoteCapabilities=N,o.transceivers[c].rtcpParameters=A,D.length&&"new"===O.state&&(!l&&!w||_&&0!==c?D.forEach((function(e){ce(v.iceTransport,e)})):O.setRemoteCandidates(D)),_&&0!==c||("new"===O.state&&O.start(R,L,"controlling"),"new"===E.state&&E.start(P)),!ae(v.localCapabilities,v.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&v.sendEncodingParameters[0].rtx&&delete v.sendEncodingParameters[0].rtx,o._transceive(v,"sendrecv"===b||"recvonly"===b,"sendrecv"===b||"sendonly"===b),!I||"sendrecv"!==b&&"sendonly"!==b?delete v.rtpReceiver:(C=I.track,g?(a[g.stream]||(a[g.stream]=new e.MediaStream),r(C,a[g.stream]),s.push([C,I,a[g.stream]])):(a.default||(a.default=new e.MediaStream),r(C,a.default),s.push([C,I,a.default])))}}else{(v=o.transceivers[c]||o._createTransceiver(f)).mid=m,v.iceGatherer||(v.iceGatherer=o._createIceGatherer(c,_)),D.length&&"new"===v.iceTransport.state&&(!w||_&&0!==c?D.forEach((function(e){ce(v.iceTransport,e)})):v.iceTransport.setRemoteCandidates(D)),y=e.RTCRtpReceiver.getCapabilities(f),t<15019&&(y.codecs=y.codecs.filter((function(e){return"rtx"!==e.name}))),S=v.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var U,k=!1;if("sendrecv"===b||"sendonly"===b){if(k=!v.rtpReceiver,I=v.rtpReceiver||new e.RTCRtpReceiver(v.dtlsTransport,f),k)C=I.track,g&&"-"===g.stream||(g?(a[g.stream]||(a[g.stream]=new e.MediaStream,Object.defineProperty(a[g.stream],"id",{get:function(){return g.stream}})),Object.defineProperty(C,"id",{get:function(){return g.track}}),U=a[g.stream]):(a.default||(a.default=new e.MediaStream),U=a.default)),U&&(r(C,U),v.associatedRemoteMediaStreams.push(U)),s.push([C,I,U])}else v.rtpReceiver&&v.rtpReceiver.track&&(v.associatedRemoteMediaStreams.forEach((function(t){var r=t.getTracks().find((function(e){return e.id===v.rtpReceiver.track.id}));r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)})),v.associatedRemoteMediaStreams=[]);v.localCapabilities=y,v.remoteCapabilities=N,v.rtpReceiver=I,v.rtcpParameters=A,v.sendEncodingParameters=S,v.recvEncodingParameters=T,o._transceive(o.transceivers[c],!1,k)}}})),void 0===o._dtlsRole&&(o._dtlsRole="offer"===i.type?"active":"passive"),o._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?o._updateSignalingState("have-remote-offer"):o._updateSignalingState("stable"),Object.keys(a).forEach((function(t){var r=a[t];if(r.getTracks().length){if(-1===o.remoteStreams.indexOf(r)){o.remoteStreams.push(r);var i=new Event("addstream");i.stream=r,e.setTimeout((function(){o._dispatchEvent("addstream",i)}))}s.forEach((function(e){var t=e[0],i=e[1];r.id===e[2].id&&n(o,t,i,[r])}))}})),s.forEach((function(e){e[2]||n(o,e[0],e[1],[])})),e.setTimeout((function(){o&&o.transceivers&&o.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},i.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(ue("InvalidStateError","Can not call createOffer after close"));var n=r.transceivers.filter((function(e){return"audio"===e.kind})).length,i=r.transceivers.filter((function(e){return"video"===e.kind})).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(n=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(i=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(r.transceivers.forEach((function(e){"audio"===e.kind?--n<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)}));n>0||i>0;)n>0&&(r._createTransceiver("audio"),n--),i>0&&(r._createTransceiver("video"),i--);var a=ie.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach((function(n,i){var o=n.track,a=n.kind,s=n.mid||ie.generateIdentifier();n.mid=s,n.iceGatherer||(n.iceGatherer=r._createIceGatherer(i,r.usingBundle));var c=e.RTCRtpSender.getCapabilities(a);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),n.remoteCapabilities&&n.remoteCapabilities.codecs&&n.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(n.remoteCapabilities&&n.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=n.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),n.wantReceive&&(n.rtpReceiver=new e.RTCRtpReceiver(n.dtlsTransport,a)),n.localCapabilities=c,n.sendEncodingParameters=u})),"max-compat"!==r._config.bundlePolicy&&(a+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n",r.transceivers.forEach((function(e,t){a+=oe(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),a+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==t&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,a+="a="+ie.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(a+="a=end-of-candidates\r\n"))}));var s=new e.RTCSessionDescription({type:"offer",sdp:a});return Promise.resolve(s)},i.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(ue("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(ue("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var n=ie.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(n+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),n+="a=ice-options:trickle\r\n";var i=ie.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach((function(e,o){if(!(o+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?n+="m=application 0 DTLS/SCTP 5000\r\n":n+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?n+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(n+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(n+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var a;if(e.stream)"audio"===e.kind?a=e.stream.getAudioTracks()[0]:"video"===e.kind&&(a=e.stream.getVideoTracks()[0]),a&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var s=ae(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,n+=oe(e,s,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(n+="a=rtcp-rsize\r\n")}}));var o=new e.RTCSessionDescription({type:"answer",sdp:n});return Promise.resolve(o)},i.prototype.addIceCandidate=function(e){var t,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(n,i){if(!r._remoteDescription)return i(ue("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var a=0;a<r.transceivers.length;a++)if(r.transceivers[a].mid===e.sdpMid){o=a;break}var s=r.transceivers[o];if(!s)return i(ue("OperationError","Can not add ICE candidate"));if(s.rejected)return n();var c=Object.keys(e.candidate).length>0?ie.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return n();if(c.component&&1!==c.component)return n();if((0===o||o>0&&s.iceTransport!==r.transceivers[0].iceTransport)&&!ce(s.iceTransport,c))return i(ue("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=ie.getMediaSections(r._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=ie.getDescription(r._remoteDescription.sdp)+t.join("")}else for(var l=0;l<r.transceivers.length&&(r.transceivers[l].rejected||(r.transceivers[l].iceTransport.addRemoteCandidate({}),(t=ie.getMediaSections(r._remoteDescription.sdp))[l]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=ie.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));l++);n()}))},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var r=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?r=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(r=e.rtpReceiver)})),!r)throw ue("InvalidAccessError","Invalid selector.");return r.getStats()}var n=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&n.push(e[t].getStats())}))})),Promise.all(n).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var r=e[t];if(r&&r.prototype&&r.prototype.getStats){var n=r.prototype.getStats;r.prototype.getStats=function(){return n.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(r){var n;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(n=e[r]).type]||n.type,t.set(r,e[r])})),t}))}}}));var o=["createOffer","createAnswer"];return o.forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),i};function _e(e){const t=e&&e.navigator,r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e).catch((e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e))))}}function de(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function fe(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const r=new Event("enabled");r.enabled=e,this.dispatchEvent(r)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const r=le(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e){let t=!1;return(e=JSON.parse(JSON.stringify(e))).filter((e=>{if(e&&(e.urls||e.url)){let r=e.urls||e.url;e.url&&!e.urls&&x("RTCIceServer.url","RTCIceServer.urls");const n="string"==typeof r;return n&&(r=[r]),r=r.filter((e=>{if(0===e.indexOf("stun:"))return!1;const r=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return r&&!t?(t=!0,!0):r&&!t})),delete e.url,e.urls=n?r[0]:r,!!r.length}}))}(e.iceServers,t.version),B("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function pe(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var he=Object.freeze({__proto__:null,shimPeerConnection:fe,shimReplaceTrack:pe,shimGetUserMedia:_e,shimGetDisplayMedia:de});function be(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){x("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},n&&n.prototype.getSettings){const t=n.prototype.getSettings;n.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(n&&n.prototype.applyConstraints){const t=n.prototype.applyConstraints;n.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function ge(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function me(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return n.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(i,o)}}function ve(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Re(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),k(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Oe(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){x("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function Ee(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Ie(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const n=t.apply(this,arguments);if(r){const{sender:t}=n,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return n})}function Se(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Te(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function ye(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var Ce=Object.freeze({__proto__:null,shimOnTrack:ge,shimPeerConnection:me,shimSenderGetStats:ve,shimReceiverGetStats:Re,shimRemoveStream:Oe,shimRTCDataChannel:Ee,shimAddTransceiver:Ie,shimGetParameters:Se,shimCreateOffer:Te,shimCreateAnswer:ye,shimGetUserMedia:be,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function Le(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))})}}function Pe(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}))}),t.apply(e,arguments)}}}function Ne(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){const n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}function Ae(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(we(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function we(e){return e&&void 0!==e.video?Object.assign({},e,{video:F(e.video)}):e}function De(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let n=e.iceServers[r];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(x("RTCIceServer.url","RTCIceServer.urls"),n=JSON.parse(JSON.stringify(n)),n.urls=n.url,delete n.url,t.push(n)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Ue(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function ke(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}function Me(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var je=Object.freeze({__proto__:null,shimLocalStreamsAPI:Le,shimRemoteStreamsAPI:Pe,shimCallbacksAPI:Ne,shimGetUserMedia:Ae,shimConstraints:we,shimRTCIceServerUrls:De,shimTrackEventTransceiver:Ue,shimCreateOfferLegacy:ke,shimAudioContext:Me});function Be(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),n=ie.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,k(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function xe(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=ie.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=ie.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r}(arguments[0]),r=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r}(e),n=function(e,r){let n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);const i=ie.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n}(arguments[0],e);let i;i=0===r&&0===n?Number.POSITIVE_INFINITY:0===r||0===n?Math.max(r,n):Math.min(r,n);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return r.apply(this,arguments)}}function Ve(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},k(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function Fe(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function Je(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function Ge(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var He=Object.freeze({__proto__:null,shimRTCIceCandidate:Be,shimMaxMessageSize:xe,shimSendThrowTypeError:Ve,shimConnectionState:Fe,removeExtmapAllowMixed:Je,shimAddIceCandidateNullOrEmpty:Ge});const Ke=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const r=B,n=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=U(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=U(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.mediaDevices&&r.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=U(r.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=U(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:n,commonShim:He,extractVersion:U,disableLog:M,disableWarnings:j};switch(n.browser){case"chrome":if(!te||!$||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=te,Ge(e,n),K(e,n),W(e),$(e,n),Y(e),X(e,n),z(e),q(e),Q(e),ee(e,n),Be(e),Fe(e),xe(e,n),Ve(e),Je(e,n);break;case"firefox":if(!Ce||!me||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=Ce,Ge(e,n),be(e,n),me(e,n),ge(e),Oe(e),ve(e),Re(e),Ee(e),Ie(e),Se(e),Te(e),ye(e),Be(e),Fe(e),xe(e,n),Ve(e);break;case"edge":if(!he||!fe||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),i;r("adapter.js shimming edge."),i.browserShim=he,_e(e),de(e),fe(e,n),pe(e),xe(e,n),Ve(e);break;case"safari":if(!je||!t.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=je,Ge(e,n),De(e),ke(e),Ne(e),Le(e),Pe(e),Ue(e),Ae(e),Me(e),Be(e),xe(e,n),Ve(e),Je(e,n);break;default:r("Unsupported browser!")}return i}({window:"undefined"==typeof window?void 0:window});var We,Ye,ze,qe;!function(e){e.FPS_10="FPS_10",e.FPS_15="FPS_15",e.FPS_24="FPS_24",e.FPS_30="FPS_30"}(We||(We={})),function(e){e.W176_H132="W176_H132",e.W176_H144="W176_H144",e.W180_H180="W180_H180",e.W240_H180="W240_H180",e.W240_H240="W240_H240",e.W256_H144="W256_H144",e.W320_H180="W320_H180",e.W320_H240="W320_H240",e.W360_H360="W360_H360",e.W480_H360="W480_H360",e.W480_H480="W480_H480",e.W640_H360="W640_H360",e.W640_H480="W640_H480",e.W720_H480="W720_H480",e.W848_H480="W848_H480",e.W960_H720="W960_H720",e.W1280_H720="W1280_H720",e.W1920_H1080="W1920_H1080",e.W144_H176="W144_H176",e.W144_H256="W144_H256",e.W180_H240="W180_H240",e.W180_H320="W180_H320",e.W240_H320="W240_H320",e.W360_H480="W360_H480",e.W360_H640="W360_H640",e.W480_H640="W480_H640",e.W480_H720="W480_H720",e.W480_H848="W480_H848",e.W720_H1280="W720_H1280",e.W720_H960="W720_H960",e.W1080_H1920="W1080_H1920"}(Ye||(Ye={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_VIDEO=2]="AUDIO_VIDEO"}(ze||(ze={}));var Qe,Ze=((qe={})[Ye.W176_H132]={width:176,height:132,maxBitrate:150,minBitrate:80},qe[Ye.W176_H144]={width:176,height:144,maxBitrate:150,minBitrate:80},qe[Ye.W180_H180]={width:180,height:180,maxBitrate:200,minBitrate:100},qe[Ye.W240_H180]={width:240,height:180,maxBitrate:240,minBitrate:120},qe[Ye.W240_H240]={width:240,height:240,maxBitrate:280,minBitrate:120},qe[Ye.W256_H144]={width:256,height:144,maxBitrate:240,minBitrate:120},qe[Ye.W320_H180]={width:320,height:180,maxBitrate:280,minBitrate:120},qe[Ye.W320_H240]={width:320,height:240,maxBitrate:400,minBitrate:120},qe[Ye.W360_H360]={width:360,height:360,maxBitrate:520,minBitrate:140},qe[Ye.W480_H360]={width:480,height:360,maxBitrate:650,minBitrate:150},qe[Ye.W480_H480]={width:480,height:480,maxBitrate:800,minBitrate:180},qe[Ye.W640_H360]={width:640,height:360,maxBitrate:800,minBitrate:180},qe[Ye.W640_H480]={width:640,height:480,maxBitrate:900,minBitrate:200},qe[Ye.W720_H480]={width:720,height:480,maxBitrate:1e3,minBitrate:200},qe[Ye.W848_H480]={width:848,height:480,maxBitrate:1860,minBitrate:200},qe[Ye.W960_H720]={width:960,height:720,maxBitrate:2e3,minBitrate:250},qe[Ye.W1280_H720]={width:1280,height:720,maxBitrate:2200,minBitrate:250},qe[Ye.W1920_H1080]={width:1920,height:1080,maxBitrate:4e3,minBitrate:400},qe[Ye.W144_H176]={width:144,height:176,maxBitrate:150,minBitrate:80},qe[Ye.W144_H256]={width:144,height:256,maxBitrate:240,minBitrate:120},qe[Ye.W180_H240]={width:180,height:240,maxBitrate:240,minBitrate:120},qe[Ye.W180_H320]={width:180,height:320,maxBitrate:280,minBitrate:120},qe[Ye.W240_H320]={width:240,height:320,maxBitrate:400,minBitrate:120},qe[Ye.W360_H480]={width:360,height:480,maxBitrate:650,minBitrate:150},qe[Ye.W360_H640]={width:360,height:640,maxBitrate:800,minBitrate:180},qe[Ye.W480_H640]={width:480,height:640,maxBitrate:900,minBitrate:200},qe[Ye.W480_H720]={width:480,height:720,maxBitrate:1e3,minBitrate:200},qe[Ye.W480_H848]={width:480,height:848,maxBitrate:1860,minBitrate:930},qe[Ye.W720_H1280]={width:720,height:1280,maxBitrate:2200,minBitrate:250},qe[Ye.W720_H960]={width:720,height:960,maxBitrate:2760,minBitrate:910},qe[Ye.W1080_H1920]={width:1080,height:1920,maxBitrate:4e3,minBitrate:400},qe),Xe=function(e){var t={192:180,368:360,1088:1080};return t[e]?t[e]:e},$e=function(e,t){e=Xe(e),t=Xe(t);var r=Ze["W".concat(e,"_H").concat(t)];if(r)return r;var n=e*t;return Object.keys(Ze).map((function(e){return Ze[e]})).sort((function(e,t){return e.height*e.width-t.width*t.height})).filter((function(e){return e.height*e.width>=n}))[0]||Ze.W1920_H1080},et={10:1,15:1,24:1.5,30:1.5},tt=function(e){var t=Number.MAX_VALUE,r=1;for(var n in et){var i=Math.abs(e-parseInt(n));i<t&&(t=i,r=et[n])}return r},rt={getCameras:function(){return C(void 0,void 0,void 0,(function(){return L(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"videoinput"===e.kind}))]}}))}))},getMicrophones:function(){return C(void 0,void 0,void 0,(function(){return L(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"audioinput"===e.kind}))]}}))}))},getSpeakers:function(){return C(void 0,void 0,void 0,(function(){return L(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"audiooutput"===e.kind}))]}}))}))}};!function(e){e.AUDIO="audio",e.VIDEO="video"}(Qe||(Qe={}));var nt,it,ot,at=function(t){function r(e,r,n,i,o,a){var s=t.call(this)||this;return Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(s,"_tag",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_kind",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_isLocalTrack",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(s,"_localMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_remoteMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_streamId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_msTrack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_msStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"DataTrackId",{enumerable:!0,configurable:!0,writable:!0,value:"data-track-id"}),Object.defineProperty(s,"_element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),s._streamId=[s._userId||s._roomId,s._tag].join("_"),s._id=[s._streamId,s.isAudioTrack()?0:1].join("_"),s}return E(r,t),Object.defineProperty(r.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._streamId}}),Object.defineProperty(r.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._id}}),Object.defineProperty(r.prototype,"getUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._userId}}),Object.defineProperty(r.prototype,"__innerGetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msTrack}}),Object.defineProperty(r.prototype,"streamTrack",{get:function(){return this._msTrack},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"getTag",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._tag}}),Object.defineProperty(r.prototype,"isLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isLocalTrack}}),Object.defineProperty(r.prototype,"isVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"video"===this._kind}}),Object.defineProperty(r.prototype,"isAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"audio"===this._kind}}),Object.defineProperty(r.prototype,"isReady",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return"live"===(null===(e=this._msTrack)||void 0===e?void 0:e.readyState)}}),Object.defineProperty(r.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._msTrack=e,this._setLocalMuted(this._localMuted);var t=this._msStream=this._msStream||new MediaStream,r=t.getTracks()[0];r&&t.removeTrack(r),this._isLocalTrack||this._logger.warn(S.L_INNER_SET_TRACK_O,"trackId: ".concat(this._id,", track: ").concat(e?e.id:"undefined")),e?t.addTrack(e):this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(this._element.pause(),this._element.srcObject=null)}}),Object.defineProperty(r.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return L(this,(function(t){return this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e,[2,I.SUCCESS]}))}))}}),Object.defineProperty(r.prototype,"mute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return L(this,(function(e){return[2,this._setLocalMuted(!0)]}))}))}}),Object.defineProperty(r.prototype,"unmute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return L(this,(function(e){return[2,this._setLocalMuted(!1)]}))}))}}),Object.defineProperty(r.prototype,"isLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._localMuted}}),Object.defineProperty(r.prototype,"isMCUTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Boolean(this._roomId)}}),Object.defineProperty(r.prototype,"isOwnerMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteMuted}}),Object.defineProperty(r.prototype,"_validateVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(null==t?void 0:t.volume){if(!e(null==t?void 0:t.volume))return this._logger.error(S.L_TRACK_PLAY_E,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> options.volume not a number"})),{code:I.PARAMS_ERROR};(null==t?void 0:t.volume)<0&&(t.volume=0,this._logger.warn(S.L_TRACK_PLAY_E,JSON.stringify({status:T.FAILED,msg:"params error -> options.volume < 0",tips:"the valid range of options.volume is 0-100, the value of volume has been set 0"}))),(null==t?void 0:t.volume)>100&&(t.volume=100,this._logger.warn(S.L_TRACK_PLAY_E,JSON.stringify({status:T.FAILED,msg:"params error -> options.volume > 100",tips:"the valid range of options.volume is 0-100, the value of volume has been set 100"})))}}}),Object.defineProperty(r.prototype,"_validatePlayOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n;return L(this,(function(i){switch(i.label){case 0:return this._msTrack?("ended"===this._msTrack.readyState&&this._logger.warn(S.L_TRACK_PLAY_E,"track readyState is ended -> id: ".concat(this._id)),(r=this._validateVolume(t))?[2,r]:(null==t?void 0:t.audioDeviceId)?[4,rt.getSpeakers()]:[3,2]):(this._logger.error(S.L_TRACK_PLAY_E,JSON.stringify({status:T.FAILED,code:I.TRACK_NOT_READY,kind:this._kind,msg:"the track is not ready to play -> id: ".concat(this._id)})),[2,{code:I.TRACK_NOT_READY}]);case 1:if(n=i.sent().map((function(e){return e.deviceId})),!n.includes(t.audioDeviceId))return this._logger.error(S.L_TRACK_PLAY_E,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> options.audioDeviceId"})),[2,{code:I.PARAMS_ERROR}];i.label=2;case 2:return!this.isVideoTrack()||e&&(e instanceof HTMLVideoElement||this._validateVideoNodeName(e))?[2]:(this._logger.error(S.L_TRACK_PLAY_E,JSON.stringify({status:T.FAILED,code:I.VIDEO_TRACK_MISS_MEDIA_ELEMENT,kind:this._kind,msg:"params element is not a HTMLVideoElement"})),[2,{code:I.VIDEO_TRACK_MISS_MEDIA_ELEMENT}])}}))}))}}),Object.defineProperty(r.prototype,"_setPlayAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return C(this,void 0,void 0,(function(){return L(this,(function(n){switch(n.label){case 0:return e&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),!(null==t?void 0:t.audioDeviceId)||e?[3,2]:[4,this._element.setSinkId(t.audioDeviceId)];case 1:n.sent(),n.label=2;case 2:return e||!(null==t?void 0:t.volume)&&0!==(null==t?void 0:t.volume)||(this._element.volume=t.volume/100),null===(r=this._element)||void 0===r||r.setAttribute(this.DataTrackId,this.getTrackId()),[2]}}))}))}}),Object.defineProperty(r.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i=this;return L(this,(function(o){switch(o.label){case 0:return this._logger.info(S.L_TRACK_PLAY_O,JSON.stringify({elementId:null==e?void 0:e.id,trackId:this._id,kind:this._kind,options:t?{volume:null==t?void 0:t.volume,audioDeviceId:t.audioDeviceId}:void 0})),[4,this._validatePlayOptions(e,t)];case 1:return(r=o.sent())?[2,r]:(n=this.isVideoTrack(),this._element=n?e:this._element||new Audio,this._localMuted&&this._setLocalMuted(!1),this._element.srcObject&&this._element.srcObject===this._msStream||this._element.pause(),this._element.onloadstart=function(e){var t;i._logger.info(S.L_TRACK_LOAD_START_O,JSON.stringify({status:T.INFO,kind:i._kind,msg:"HTMLMediaElement onloadstart -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id)}))},this._element.ondurationchange=function(e){var t;i._logger.info(S.L_TRACK_DURATION_CHANGE_O,JSON.stringify({status:T.INFO,kind:i._kind,msg:"HTMLMediaElement ondurationchange -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id)}))},this._element.onloadedmetadata=function(e){var t;i._logger.info(S.L_TRACK_LOADED_META_DATA_O,JSON.stringify({status:T.INFO,kind:i._kind,msg:"HTMLMediaElement onloadedmetadata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id)}))},this._element.onloadeddata=function(e){var t;i._logger.info(S.L_TRACK_LOADED_DATA_O,JSON.stringify({status:T.INFO,kind:i._kind,msg:"HTMLMediaElement onloadeddata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id)}))},this._element.onabort=function(e){var t;i._logger.info(S.L_TRACK_ABORT_O,JSON.stringify({status:T.INFO,kind:i._kind,msg:"HTMLMediaElement onabort -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id)}))},this._element.oncanplay=function(e){return C(i,void 0,void 0,(function(){var r,i,o;return L(this,(function(a){switch(a.label){case 0:this._logger.info(S.L_TRACK_CANPLAY_O,JSON.stringify({status:T.INFO,kind:this._kind,msg:"HTMLMediaElement oncanplay -> id: ".concat(null===(i=e.target)||void 0===i?void 0:i.id,", trackId: ").concat(this._id)})),a.label=1;case 1:return a.trys.push([1,5,,6]),!(null==t?void 0:t.audioDeviceId)||n?[3,3]:[4,this._element.setSinkId(t.audioDeviceId)];case 2:a.sent(),a.label=3;case 3:return[4,null===(o=this._element)||void 0===o?void 0:o.play()];case 4:return a.sent(),[3,6];case 5:return"No permission to use requested device"===(r=a.sent()).message?(this._logger.error(S.L_TRACK_PLAY_E,JSON.stringify({status:T.FAILED,kind:this._kind,code:I.NO_PERMISSION_TO_USE_REQUESTED_DEVICE,msg:"setSinkId failed, error msg: ".concat(r.message)})),[2]):(this._logger.error(S.L_TRACK_PLAY_E,JSON.stringify({status:T.FAILED,code:I.TRACK_PLAY_ERROR,kind:this._kind,msg:"play error, error msg: ".concat(r.message)})),[3,6]);case 6:return[2]}}))}))},this._element.onvolumechange=function(e){var t,r,n=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));i._logger.info(S.L_TRACK_VOLUME_CHANGE_O,JSON.stringify({status:T.INFO,msg:"HTMLMediaElement onvolumechange -> id: ".concat(null===(r=e.target)||void 0===r?void 0:r.id,", volume: ").concat(n,", trackId: ").concat(i._id)}))},this._element.srcObject=this._msStream,this._element.autoplay=!0,[4,this._setPlayAttrs(n,t)]);case 2:return o.sent(),[2,{code:I.SUCCESS}]}}))}))}}),Object.defineProperty(r.prototype,"__innerDestroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.__innerSetMediaStreamTrack(void 0)}}),Object.defineProperty(r.prototype,"__releaseMediaElement",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(this._element.remove(),this._element.srcObject=null)}}),Object.defineProperty(r.prototype,"_validateVideoNodeName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()}}),r}(t);!function(e){e.Speech="Speech",e.Music="Music",e.MusicHigh="MusicHigh"}(ot||(ot={}));var st,ct=((nt={})[ot.Music]={max:64,min:64},nt[ot.MusicHigh]={max:128,min:128},nt[ot.Speech]={max:32,min:32},nt);!function(e){e.LEVEL0="LEVEL0",e.LEVEL1="LEVEL1",e.LEVEL2="LEVEL2",e.LEVEL3="LEVEL3",e.LEVEL4="LEVEL4",e.LEVEL5="LEVEL5"}(st||(st={}));var ut=((it={})[st.LEVEL0]={max:150,min:80},it[st.LEVEL1]={max:280,min:120},it[st.LEVEL2]={max:650,min:150},it[st.LEVEL3]={max:1e3,min:200},it[st.LEVEL4]={max:2200,min:250},it[st.LEVEL5]={max:4e3,min:400},it),lt=function(){function e(){}return Object.defineProperty(e,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s;return L(this,(function(c){switch(c.label){case 0:r=new AudioContext({sampleRate:44100}),c.label=1;case 1:return c.trys.push([1,5,,6]),[4,r.audioWorklet.addModule(e.SCRIPT_URL)];case 2:return c.sent(),[4,fetch(e.WASM_URL,{cache:"force-cache",credentials:"same-origin"})];case 3:return[4,c.sent().arrayBuffer()];case 4:return n=c.sent(),[3,6];case 5:return c.sent(),[2,{code:I.LOAD_3A_MODULE_FAILED}];case 6:return i=r.createMediaStreamSource(new MediaStream([t])),o=new AudioWorkletNode(r,"process-worklet",{numberOfInputs:1,numberOfOutputs:1,outputChannelCount:[1],processorOptions:{binary:n}}),a=r.createMediaStreamDestination(),i.connect(o).connect(a),s=a.stream.getAudioTracks()[0],e._maps.set(t.id,r),[2,{code:I.SUCCESS,track:s}]}}))}))}}),Object.defineProperty(e,"release3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e._maps.get(t.id);r&&(r.close(),e._maps.delete(t.id))}}),Object.defineProperty(e,"WASM_URL",{enumerable:!0,configurable:!0,writable:!0,value:"https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.2/AudioProcessing.wasm"}),Object.defineProperty(e,"SCRIPT_URL",{enumerable:!0,configurable:!0,writable:!0,value:"https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.2/process-worklet.js"}),Object.defineProperty(e,"_maps",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),e}(),_t=function(t){function r(e,r,n,i,o){var a=t.call(this,e,r,n,i,!0)||this;return Object.defineProperty(a,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_isPublished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_bitrateInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a.__innerSetMediaStreamTrack(o),o.onended=function(){o.onended=null,a._onTrackEnded()},a}return E(r,t),Object.defineProperty(r.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(r.EVENT_LOCAL_TRACK_END,this),this.removeAll(r.EVENT_LOCAL_TRACK_END)}}),Object.defineProperty(r.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;return new Promise((function(i){var o=n._localMuted!==e;t.prototype._setLocalMuted.call(n,e),n._remoteMuted=n._localMuted,o&&n._isPublished?n.emit(r.__INNER_EVENT_MUTED_CHANGE__,n,i):i(I.SUCCESS),n._logger.info(S.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({enable:e,trackId:n._id}))}))}}),Object.defineProperty(r.prototype,"__innerSetPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isPublished=e}}),Object.defineProperty(r.prototype,"isPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isPublished}}),Object.defineProperty(r.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this._isDestroyed||(this._logger.info(S.L_LOCAL_TRACK_DESTROY_O,this._id),this._isDestroyed=!0,null===(e=this._msTrack)||void 0===e||e.stop(),t.prototype.__innerDestroy.call(this),this.isAudioTrack()&&t.prototype.__releaseMediaElement.call(this),this._isPublished&&this.emit(r.__INNER_EVENT_DESTROY__,this))}}),Object.defineProperty(r.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(r.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){void 0===t&&(t=0),void 0===r&&(r=0),void 0===n&&(n=0),!e(t)||!e(r)||!e(n)||t<=0||r<=0||t<r?this._logger.error(S.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:T.FAILED,msg:"params error -> max: ".concat(t,",min: ").concat(r,", start: ").concat(n),trackId:this._id})):(this._logger.info(S.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:T.SUCCESSED,max:t,min:r,start:n,trackId:this._id})),this._bitrateInfo={max:t,min:r,start:n})}}),Object.defineProperty(r.prototype,"getBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r,n,i,o,a,s,c,u=0,l=0,_=0;return(null===(r=this._msTrack)||void 0===r?void 0:r.kind)===Qe.VIDEO?(u=(e=Pt(this._msTrack)).min,l=e.max):(null===(n=this._msTrack)||void 0===n?void 0:n.kind)===Qe.AUDIO&&(u=(t={min:32,max:32}).min,l=t.max),(null===(i=this._bitrateInfo)||void 0===i?void 0:i.max)&&(_=.7*(null===(o=this._bitrateInfo)||void 0===o?void 0:o.max)),{min:(null===(a=this._bitrateInfo)||void 0===a?void 0:a.min)||u,max:(null===(s=this._bitrateInfo)||void 0===s?void 0:s.max)||l,start:(null===(c=this._bitrateInfo)||void 0===c?void 0:c.start)||_}}}),Object.defineProperty(r,"EVENT_LOCAL_TRACK_END",{enumerable:!0,configurable:!0,writable:!0,value:"local-track-end"}),Object.defineProperty(r,"__INNER_EVENT_MUTED_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-muted-change"}),Object.defineProperty(r,"__INNER_EVENT_DESTROY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-destroy"}),r}(at),dt=function(e){function t(t,r,n,i){return e.call(this,t,r,n,"audio",i)||this}return E(t,e),Object.defineProperty(t.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(r("audioBitrate",e,(function(e){return e in ot}))){var t=ct[e];this.setBitrate(t.max,t.min,t.start||.7*t.max)}else this._logger.warn(S.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:T.FAILED,msg:"params error -> params type is RCAudioBitrate"}))}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=N(r,2),o=i[0],a=void 0===o?1:o,s=i[1],c=void 0===s?.7*t||1:s;e.prototype.setBitrate.call(this,t,a,c)}}),t}(_t),ft=function(e){function t(t,r,n,i,o){void 0===o&&(o=!1);var a=e.call(this,t,r,n,"video",i)||this;return Object.defineProperty(a,"_isTiny",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return E(t,e),Object.defineProperty(t.prototype,"__isTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isTiny}}),Object.defineProperty(t.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t=e.prototype.getStreamId.call(this);return this._isTiny?"".concat(t,"_tiny"):t}}),Object.defineProperty(t.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t=e.prototype.getTrackId.call(this);return this._isTiny?"".concat(t,"_tiny"):t}}),Object.defineProperty(t.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(r("videoBitrate",e,(function(e){return e in st}))){var t=ut[e];this.setBitrate(t.max,t.min,t.start||.7*t.max)}else this._logger.warn(S.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:T.FAILED,msg:"params error -> params type is RCVideoBitrate"}))}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=N(r,2),o=i[0],a=void 0===o?1:o,s=i[1],c=void 0===s?.7*t||1:s;e.prototype.setBitrate.call(this,t,a,c)}}),t}(_t),pt=function(e){function t(r,n,i,o,a,s){var c=e.call(this,r,n,i,o,a)||this;return Object.defineProperty(c,"_resource",{enumerable:!0,configurable:!0,writable:!0,value:s}),t._innerSetMapping(c.getTrackId(),s),c}return E(t,e),Object.defineProperty(t,"_innerSetMapping",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._mapping.get(t)||[];r.push(e),this._mapping.set(t,r)}}),Object.defineProperty(t,"_innerRemoveMapping",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i=null===(r=this._mapping.get(t))||void 0===r?void 0:r.filter((function(t){return t!==e}));i&&i.length>0?this._mapping.set(t,i):(this._mapping.delete(t),t.pause(),t.src="",null===(n=t.parentNode)||void 0===n||n.removeChild(t))}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAudioTrack()&&this.mute(),t._innerRemoveMapping(this.getTrackId(),this._resource),e.prototype.destroy.call(this)}}),Object.defineProperty(t,"_mapping",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),t}(_t),ht=function(e){function t(t,r,n,i,o){return e.call(this,t,r,n,"video",i,o)||this}return E(t,e),t}(pt),bt=function(e){function t(t,r,n,i,o){return e.call(this,t,r,n,"audio",i,o)||this}return E(t,e),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return C(this,void 0,void 0,(function(){return L(this,(function(r){return this._resource&&(this._resource.muted=t),[2,e.prototype._setLocalMuted.call(this,t)]}))}))}}),Object.defineProperty(t.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return L(this,(function(e){switch(e.label){case 0:return[4,this._setLocalMuted(!1)];case 1:return[2,{code:e.sent()}]}}))}))}}),t}(pt),gt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_originTrack",{enumerable:!0,configurable:!0,writable:!0,value:null}),t}return E(t,e),Object.defineProperty(t.prototype,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t,r;return L(this,(function(n){switch(n.label){case 0:return this._logger.info(S.A_APPLY_3A_NOISE_WORKLET_T),this._originTrack?(this._logger.warn(S.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:T.FAILED,msg:"3A noise module already applied"})),[2,{code:I.SUCCESS}]):!this._msTrack||this.isDestroyed()?(this._logger.warn(S.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:T.FAILED,msg:"track not ready"})),[2,{code:I.TRACK_NOT_READY}]):this.isPublished()?(this._logger.warn(S.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:T.FAILED,msg:"track already published"})),[2,{code:I.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH}]):[4,lt.apply3ANoiseWorklet(this._msTrack)];case 1:return e=n.sent(),t=e.code,r=e.track,t===I.SUCCESS&&r?(this._originTrack=this._msTrack,this._msTrack=r,this._logger.info(S.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:T.SUCCESSED})),[2,{code:I.SUCCESS}]):(this._logger.warn(S.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:T.FAILED,msg:"apply 3A noise module failed: ".concat(t)})),[2,{code:t}])}}))}))}}),Object.defineProperty(t.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(t){!t&&this._originTrack&&(lt.release3ANoiseWorklet(this._originTrack),this._originTrack.stop(),this._originTrack=null),e.prototype.__innerSetMediaStreamTrack.call(this,t)}}),t}(dt),mt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E(t,e),t}(ft),vt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(_t.__INNER_EVENT_DESTROY__,this)}}),t}(ft),Rt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(_t.__INNER_EVENT_DESTROY__,this)}}),t}(dt),Ot=function(e){function t(t,r,n,i,o){var a=e.call(this,t,r,n,i,!1,o)||this;return Object.defineProperty(a,"_isSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),a}return E(t,e),Object.defineProperty(t.prototype,"__innerSetRemoteMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._remoteMuted=e}}),Object.defineProperty(t.prototype,"__innerSetSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isSubscribed=e}}),Object.defineProperty(t.prototype,"isSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isSubscribed}}),t}(at),Et=function(e){function t(t,r,n,i){return e.call(this,t,r,n,"audio",i)||this}return E(t,e),Object.defineProperty(t.prototype,"getVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return 100*((null===(e=this._element)||void 0===e?void 0:e.volume)||0)}}),t}(Ot),It=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n,"video",i)||this;return Object.defineProperty(o,"_isSubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),o}return E(t,e),Object.defineProperty(t.prototype,"__innerSetIsTinyTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isSubTiny=e}}),Object.defineProperty(t.prototype,"isSubTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isSubTiny}}),t}(Ot),St=function(e,t){return{name:e,content:JSON.stringify({uris:t,ignore:!0})}},Tt=function(e){return JSON.stringify(e)},yt=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},Ct=function(t){if(void 0===t)return 0;if(e(t))return t;var r=t;return r.exact||r.ideal||r.max||0},Lt=function(e){var t=e.getSettings(),r=e.getConstraints();return{width:Ct(r.width)||t.width||0,height:Ct(r.height)||t.height||0,frameRate:t.frameRate||Ct(r.frameRate)}},Pt=function(e){var t=Lt(e),r=t.width,n=t.height,i=t.frameRate,o=$e(r||1920,n||1080),a=tt(i);return{min:o.minBitrate*a,max:o.maxBitrate*a}},Nt=function(e){return[e.msid,e.mediaType].join("_")},At=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},wt=function(e,t){return[e,t].join("_")},Dt=function(e){return e.map((function(e){return y({},e)}))},Ut=function(e,t,r){void 0===r&&(r=!1),e=e.slice();var n=[],i=[],o=[];return t.forEach((function(t){var i=Nt(t),a=e.findIndex((function(e){return Nt(e)===i}));if(r&&(a=e.findIndex((function(e){return e.uri===t.uri}))),-1!==a){var s=e[a];s.uri!==t.uri?n.push(t):s.state!==t.state&&o.push(t),e.splice(a,1)}else n.push(t)})),i.push.apply(i,A([],N(e),!1)),{publishedList:n,unpublishedList:i,modifiedList:o}},kt=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,n=+e,i=[];do{var o=n%r;n=(n-o)/r,i.unshift(t[o])}while(n);return i.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e},Mt=function(e){if(Ze[e]){var t=Ze[e];return{width:t.width,height:t.height}}var r=N(e.split("_").map((function(e){return parseInt(e.replace(/[^\d]/g,""))})),2);return{width:r[0],height:r[1]}},jt=function(e){return!!Ye[e]},Bt=function(e){return!!We[e]},xt=function(e){return parseInt(e.replace("FPS_",""))},Vt=function(){var e=Ke.browserDetails;return{browser:e.browser,version:e.version,supportsUnifiedPlan:!1!==e.supportsUnifiedPlan}}();function Ft(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function Jt(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var Gt,Ht,Kt=function(e){return"[object Null]"===Object.prototype.toString.call(e)},Wt=function(e,t,r,n){var i={},o=Object.keys(e.users);return o.length&&o.forEach((function(o){var a=[],s=e.users[o];if(s.extra){var c=JSON.parse(s.extra).roomId;if(t!==c)return}if(s.uris)try{a.push.apply(a,A([],N(JSON.parse(s.uris)),!1))}catch(e){r.warn(S.L_PARSE_ROOMDATA_URIS_R,"invalid user data -> userId: ".concat(o,", userData: ").concat(s),n)}i[o]=a})),i},Yt=function(e){return e instanceof at?e.getTrackId():e.track.getTrackId()},zt=function(e){if(!n(e)||void 0===e.low||void 0===e.high)return e;var t=e.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(t.length,"}$")),t),16)};!function(e){e.PUBLISH="RCRTC:PublishResource",e.UNPUBLISH="RCRTC:UnpublishResource",e.MODIFY="RCRTC:ModifyResource",e.TOTAL_CONTENT_RESOURCE="RCRTC:TotalContentResources",e.STATE="RCRTC:state",e.ROOM_NOTIFY="RCRTC:RoomNtf",e.USER_NOTIFY="RCRTC:UserNtf",e.KICK="RCRTC:kick",e.PK_INVITE="RCRTC:invite",e.PK_INVITE_TIMEOUT="RCRTC:inviteTimeout",e.PK_CANCEL_INVITE="RCRTC:cancelInvite",e.PK_INVITE_ANSWER="RCRTC:answerInvite",e.PK_END="RCRTC:endInvite",e.OTHER_ROOM_OFFLINE="RCRTC:otherRoomOffline",e.ROOM_TASK_FINISH="RCRTC:roomTaskFinish"}(Gt||(Gt={})),function(e){e.SUCCESS="Success",e.FAIL="Fail"}(Ht||(Ht={}));var qt=function(){function e(e,t,r,n){void 0===n&&(n=5e3),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomMode",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_gap",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_latestTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onPingResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._logger=this._context.logger}return Object.defineProperty(e.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._started||(e<15e3&&(e=15e3),this._logger.info(S.L_PINGER_START_O,JSON.stringify({interval:this._gap,offlineKickTime:e})),this._started=!0,this._checkAlive(e))}}),Object.defineProperty(e.prototype,"_sendPing",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){e._context.rtcPing(e._roomId,e._roomMode).then(t),setTimeout(t,5e3,{code:i.TIMEOUT})}))}}),Object.defineProperty(e.prototype,"_checkAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,o,a,s,c=this;return L(this,(function(u){switch(u.label){case 0:return t=this._context.logger,r=t.createTraceId(),[4,this._sendPing()];case 1:return n=u.sent(),o=n.code,a=n.data,this._started?(s=Date.now(),o===i.SUCCESS?(this._latestTimestamp=s,this.onPingResult(Ht.SUCCESS,a.version),this._timer=setTimeout((function(){return c._checkAlive(e)}),this._gap),[2]):(t.error(S.L_PINGER_SEND_RTCPING_E,JSON.stringify({roomId:this._roomId,code:o}),r),this.onPingResult(Ht.FAIL),40003===o||s-this._latestTimestamp>e?(this.stop(),this.onFailed(40003===o),[2]):(this._timer=setTimeout((function(){return c._checkAlive(e)}),this._gap),[2]))):[2]}}))}))}}),Object.defineProperty(e.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._started&&(this._logger.info(S.L_PINGER_STOP_O),this._started=!1,this._timer&&(clearTimeout(this._timer),this._timer=null))}}),e}();function Qt(e){let t=e.length;for(;--t>=0;)e[t]=0}const Zt=256,Xt=286,$t=30,er=15,tr=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),rr=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),nr=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ir=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),or=new Array(576);Qt(or);const ar=new Array(60);Qt(ar);const sr=new Array(512);Qt(sr);const cr=new Array(256);Qt(cr);const ur=new Array(29);Qt(ur);const lr=new Array($t);function _r(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let dr,fr,pr;function hr(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}Qt(lr);const br=e=>e<256?sr[e]:sr[256+(e>>>7)],gr=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},mr=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,gr(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)},vr=(e,t,r)=>{mr(e,r[2*t],r[2*t+1])},Rr=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},Or=(e,t,r)=>{const n=new Array(16);let i,o,a=0;for(i=1;i<=er;i++)a=a+r[i-1]<<1,n[i]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=Rr(n[t]++,t))}},Er=e=>{let t;for(t=0;t<Xt;t++)e.dyn_ltree[2*t]=0;for(t=0;t<$t;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Ir=e=>{e.bi_valid>8?gr(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Sr=(e,t,r,n)=>{const i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]},Tr=(e,t,r)=>{const n=e.heap[r];let i=r<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Sr(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Sr(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n},yr=(e,t,r)=>{let n,i,o,a,s=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+s++],n+=(255&e.pending_buf[e.sym_buf+s++])<<8,i=e.pending_buf[e.sym_buf+s++],0===n?vr(e,i,t):(o=cr[i],vr(e,o+Zt+1,t),a=tr[o],0!==a&&(i-=ur[o],mr(e,i,a)),n--,o=br(n),vr(e,o,r),a=rr[o],0!==a&&(n-=lr[o],mr(e,n,a)))}while(s<e.sym_next);vr(e,256,t)},Cr=(e,t)=>{const r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,c,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<o;a++)0!==r[2*a]?(e.heap[++e.heap_len]=u=a,e.depth[a]=0):r[2*a+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=u<2?++u:0,r[2*c]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=n[2*c+1]);for(t.max_code=u,a=e.heap_len>>1;a>=1;a--)Tr(e,r,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Tr(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,r[2*c]=r[2*a]+r[2*s],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,r[2*a+1]=r[2*s+1]=c,e.heap[1]=c++,Tr(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,l,_,d,f,p,h=0;for(d=0;d<=er;d++)e.bl_count[d]=0;for(r[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],d=r[2*r[2*l+1]+1]+1,d>c&&(d=c,h++),r[2*l+1]=d,l>n||(e.bl_count[d]++,f=0,l>=s&&(f=a[l-s]),p=r[2*l],e.opt_len+=p*(d+f),o&&(e.static_len+=p*(i[2*l+1]+f)));if(0!==h){do{for(d=c-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(d=c;0!==d;d--)for(l=e.bl_count[d];0!==l;)_=e.heap[--u],_>n||(r[2*_+1]!==d&&(e.opt_len+=(d-r[2*_+1])*r[2*_],r[2*_+1]=d),l--)}})(e,t),Or(r,u,e.bl_count)},Lr=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))},Pr=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{vr(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(vr(e,i,e.bl_tree),s--),vr(e,16,e.bl_tree),mr(e,s-3,2)):s<=10?(vr(e,17,e.bl_tree),mr(e,s-3,3)):(vr(e,18,e.bl_tree),mr(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}};let Nr=!1;const Ar=(e,t,r,n)=>{mr(e,0+(n?1:0),3),Ir(e),gr(e,r),gr(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var wr=(e,t,r,n)=>{let i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<Zt;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Cr(e,e.l_desc),Cr(e,e.d_desc),a=(e=>{let t;for(Lr(e,e.dyn_ltree,e.l_desc.max_code),Lr(e,e.dyn_dtree,e.d_desc.max_code),Cr(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ir[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?Ar(e,t,r,n):4===e.strategy||o===i?(mr(e,2+(n?1:0),3),yr(e,or,ar)):(mr(e,4+(n?1:0),3),((e,t,r,n)=>{let i;for(mr(e,t-257,5),mr(e,r-1,5),mr(e,n-4,4),i=0;i<n;i++)mr(e,e.bl_tree[2*ir[i]+1],3);Pr(e,e.dyn_ltree,t-1),Pr(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),yr(e,e.dyn_ltree,e.dyn_dtree)),Er(e),n&&Ir(e)},Dr={_tr_init:e=>{Nr||((()=>{let e,t,r,n,i;const o=new Array(16);for(r=0,n=0;n<28;n++)for(ur[n]=r,e=0;e<1<<tr[n];e++)cr[r++]=n;for(cr[r-1]=n,i=0,n=0;n<16;n++)for(lr[n]=i,e=0;e<1<<rr[n];e++)sr[i++]=n;for(i>>=7;n<$t;n++)for(lr[n]=i<<7,e=0;e<1<<rr[n]-7;e++)sr[256+i++]=n;for(t=0;t<=er;t++)o[t]=0;for(e=0;e<=143;)or[2*e+1]=8,e++,o[8]++;for(;e<=255;)or[2*e+1]=9,e++,o[9]++;for(;e<=279;)or[2*e+1]=7,e++,o[7]++;for(;e<=287;)or[2*e+1]=8,e++,o[8]++;for(Or(or,287,o),e=0;e<$t;e++)ar[2*e+1]=5,ar[2*e]=Rr(e,5);dr=new _r(or,tr,257,Xt,er),fr=new _r(ar,rr,0,$t,er),pr=new _r(new Array(0),nr,0,19,7)})(),Nr=!0),e.l_desc=new hr(e.dyn_ltree,dr),e.d_desc=new hr(e.dyn_dtree,fr),e.bl_desc=new hr(e.bl_tree,pr),e.bi_buf=0,e.bi_valid=0,Er(e)},_tr_stored_block:Ar,_tr_flush_block:wr,_tr_tally:(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(cr[r]+Zt+1)]++,e.dyn_dtree[2*br(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{mr(e,2,3),vr(e,256,or),(e=>{16===e.bi_valid?(gr(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Ur=(e,t,r,n)=>{let i=65535&e,o=e>>>16&65535,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{i=i+t[n++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16};const kr=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var Mr=(e,t,r,n)=>{const i=kr,o=n+r;e^=-1;for(let r=n;r<o;r++)e=e>>>8^i[255&(e^t[r])];return~e},jr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Br={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:xr,_tr_stored_block:Vr,_tr_flush_block:Fr,_tr_tally:Jr,_tr_align:Gr}=Dr,{Z_NO_FLUSH:Hr,Z_PARTIAL_FLUSH:Kr,Z_FULL_FLUSH:Wr,Z_FINISH:Yr,Z_BLOCK:zr,Z_OK:qr,Z_STREAM_END:Qr,Z_STREAM_ERROR:Zr,Z_DATA_ERROR:Xr,Z_BUF_ERROR:$r,Z_DEFAULT_COMPRESSION:en,Z_FILTERED:tn,Z_HUFFMAN_ONLY:rn,Z_RLE:nn,Z_FIXED:on,Z_DEFAULT_STRATEGY:an,Z_UNKNOWN:sn,Z_DEFLATED:cn}=Br,un=258,ln=262,_n=42,dn=113,fn=666,pn=(e,t)=>(e.msg=jr[t],t),hn=e=>2*e-(e>4?9:0),bn=e=>{let t=e.length;for(;--t>=0;)e[t]=0},gn=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do{r=e.head[--n],e.head[n]=r>=i?r-i:0}while(--t);t=i,n=t;do{r=e.prev[--n],e.prev[n]=r>=i?r-i:0}while(--t)};let mn=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const vn=e=>{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},Rn=(e,t)=>{Fr(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,vn(e.strm)},On=(e,t)=>{e.pending_buf[e.pending++]=t},En=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},In=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),1===e.state.wrap?e.adler=Ur(e.adler,t,i,r):2===e.state.wrap&&(e.adler=Mr(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},Sn=(e,t)=>{let r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-ln?e.strstart-(e.w_size-ln):0,u=e.window,l=e.w_mask,_=e.prev,d=e.strstart+un;let f=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(r=t,u[r+a]===p&&u[r+a-1]===f&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<d);if(n=un-(d-o),o=d-un,n>a){if(e.match_start=t,a=n,n>=s)break;f=u[o+a-1],p=u[o+a]}}}while((t=_[t&l])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead},Tn=e=>{const t=e.w_size;let r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ln)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),gn(e),n+=t),0===e.strm.avail_in)break;if(r=In(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=mn(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=mn(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<ln&&0!==e.strm.avail_in)},yn=(e,t)=>{let r,n,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,r>n+e.strm.avail_in&&(r=n+e.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&t!==Yr||t===Hr||r!==n+e.strm.avail_in))break;a=t===Yr&&r===n+e.strm.avail_in?1:0,Vr(e,0,0,a),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,vn(e.strm),n&&(n>r&&(n=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,r-=n),r&&(In(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==Hr&&t!==Yr&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(In(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=o||(n||t===Yr)&&t!==Hr&&0===e.strm.avail_in&&n<=i)&&(r=n>i?i:n,a=t===Yr&&0===e.strm.avail_in&&r===n?1:0,Vr(e,e.block_start,r,a),e.block_start+=r,vn(e.strm)),a?3:1)},Cn=(e,t)=>{let r,n;for(;;){if(e.lookahead<ln){if(Tn(e),e.lookahead<ln&&t===Hr)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=mn(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-ln&&(e.match_length=Sn(e,r)),e.match_length>=3)if(n=Jr(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=mn(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=mn(e,e.ins_h,e.window[e.strstart+1]);else n=Jr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Rn(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Yr?(Rn(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Rn(e,!1),0===e.strm.avail_out)?1:2},Ln=(e,t)=>{let r,n,i;for(;;){if(e.lookahead<ln){if(Tn(e),e.lookahead<ln&&t===Hr)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=mn(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-ln&&(e.match_length=Sn(e,r),e.match_length<=5&&(e.strategy===tn||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=Jr(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=mn(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(Rn(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=Jr(e,0,e.window[e.strstart-1]),n&&Rn(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Jr(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Yr?(Rn(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Rn(e,!1),0===e.strm.avail_out)?1:2};function Pn(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}const Nn=[new Pn(0,0,0,0,yn),new Pn(4,4,8,4,Cn),new Pn(4,5,16,8,Cn),new Pn(4,6,32,32,Cn),new Pn(4,4,16,16,Ln),new Pn(8,16,32,32,Ln),new Pn(8,16,128,128,Ln),new Pn(8,32,128,256,Ln),new Pn(32,128,258,1024,Ln),new Pn(32,258,258,4096,Ln)];function An(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=cn,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),bn(this.dyn_ltree),bn(this.dyn_dtree),bn(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),bn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),bn(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const wn=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==_n&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==dn&&t.status!==fn?1:0},Dn=e=>{if(wn(e))return pn(e,Zr);e.total_in=e.total_out=0,e.data_type=sn;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?_n:dn,e.adler=2===t.wrap?0:1,t.last_flush=-2,xr(t),qr},Un=e=>{const t=Dn(e);var r;return t===qr&&((r=e.state).window_size=2*r.w_size,bn(r.head),r.max_lazy_match=Nn[r.level].max_lazy,r.good_match=Nn[r.level].good_length,r.nice_match=Nn[r.level].nice_length,r.max_chain_length=Nn[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},kn=(e,t,r,n,i,o)=>{if(!e)return Zr;let a=1;if(t===en&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||r!==cn||n<8||n>15||t<0||t>9||o<0||o>on||8===n&&1!==a)return pn(e,Zr);8===n&&(n=9);const s=new An;return e.state=s,s.strm=e,s.status=_n,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=o,s.method=r,Un(e)};var Mn={deflateInit:(e,t)=>kn(e,t,cn,15,8,an),deflateInit2:kn,deflateReset:Un,deflateResetKeep:Dn,deflateSetHeader:(e,t)=>wn(e)||2!==e.state.wrap?Zr:(e.state.gzhead=t,qr),deflate:(e,t)=>{if(wn(e)||t>zr||t<0)return e?pn(e,Zr):Zr;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===fn&&t!==Yr)return pn(e,0===e.avail_out?$r:Zr);const n=r.last_flush;if(r.last_flush=t,0!==r.pending){if(vn(e),0===e.avail_out)return r.last_flush=-1,qr}else if(0===e.avail_in&&hn(t)<=hn(n)&&t!==Yr)return pn(e,$r);if(r.status===fn&&0!==e.avail_in)return pn(e,$r);if(r.status===_n&&0===r.wrap&&(r.status=dn),r.status===_n){let t=cn+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=rn||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=n<<6,0!==r.strstart&&(t|=32),t+=31-t%31,En(r,t),0!==r.strstart&&(En(r,e.adler>>>16),En(r,65535&e.adler)),e.adler=1,r.status=dn,vn(e),0!==r.pending)return r.last_flush=-1,qr}if(57===r.status)if(e.adler=0,On(r,31),On(r,139),On(r,8),r.gzhead)On(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),On(r,255&r.gzhead.time),On(r,r.gzhead.time>>8&255),On(r,r.gzhead.time>>16&255),On(r,r.gzhead.time>>24&255),On(r,9===r.level?2:r.strategy>=rn||r.level<2?4:0),On(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(On(r,255&r.gzhead.extra.length),On(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=Mr(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(On(r,0),On(r,0),On(r,0),On(r,0),On(r,0),On(r,9===r.level?2:r.strategy>=rn||r.level<2?4:0),On(r,3),r.status=dn,vn(e),0!==r.pending)return r.last_flush=-1,qr;if(69===r.status){if(r.gzhead.extra){let t=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=Mr(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=i,vn(e),0!==r.pending)return r.last_flush=-1,qr;t=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>t&&(e.adler=Mr(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=Mr(e.adler,r.pending_buf,r.pending-n,n)),vn(e),0!==r.pending)return r.last_flush=-1,qr;n=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,On(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=Mr(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=Mr(e.adler,r.pending_buf,r.pending-n,n)),vn(e),0!==r.pending)return r.last_flush=-1,qr;n=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,On(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=Mr(e.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(vn(e),0!==r.pending))return r.last_flush=-1,qr;On(r,255&e.adler),On(r,e.adler>>8&255),e.adler=0}if(r.status=dn,vn(e),0!==r.pending)return r.last_flush=-1,qr}if(0!==e.avail_in||0!==r.lookahead||t!==Hr&&r.status!==fn){let n=0===r.level?yn(r,t):r.strategy===rn?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(Tn(e),0===e.lookahead)){if(t===Hr)return 1;break}if(e.match_length=0,r=Jr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Rn(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Yr?(Rn(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Rn(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===nn?((e,t)=>{let r,n,i,o;const a=e.window;for(;;){if(e.lookahead<=un){if(Tn(e),e.lookahead<=un&&t===Hr)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){o=e.strstart+un;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=un-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=Jr(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Jr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Rn(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Yr?(Rn(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Rn(e,!1),0===e.strm.avail_out)?1:2})(r,t):Nn[r.level].func(r,t);if(3!==n&&4!==n||(r.status=fn),1===n||3===n)return 0===e.avail_out&&(r.last_flush=-1),qr;if(2===n&&(t===Kr?Gr(r):t!==zr&&(Vr(r,0,0,!1),t===Wr&&(bn(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),vn(e),0===e.avail_out))return r.last_flush=-1,qr}return t!==Yr?qr:r.wrap<=0?Qr:(2===r.wrap?(On(r,255&e.adler),On(r,e.adler>>8&255),On(r,e.adler>>16&255),On(r,e.adler>>24&255),On(r,255&e.total_in),On(r,e.total_in>>8&255),On(r,e.total_in>>16&255),On(r,e.total_in>>24&255)):(En(r,e.adler>>>16),En(r,65535&e.adler)),vn(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?qr:Qr)},deflateEnd:e=>{if(wn(e))return Zr;const t=e.state.status;return e.state=null,t===dn?pn(e,Xr):qr},deflateSetDictionary:(e,t)=>{let r=t.length;if(wn(e))return Zr;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==_n||n.lookahead)return Zr;if(1===i&&(e.adler=Ur(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){0===i&&(bn(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(r-n.w_size,r),0),t=e,r=n.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,Tn(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=mn(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,Tn(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,n.wrap=i,qr},deflateInfo:"pako deflate (from Nodeca project)"};const jn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Bn=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)jn(r,t)&&(e[t]=r[t])}}return e},xn=e=>{let t=0;for(let r=0,n=e.length;r<n;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];r.set(i,n),n+=i.length}return r};let Vn=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Vn=!1}const Fn=new Uint8Array(256);for(let e=0;e<256;e++)Fn[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Fn[254]=Fn[254]=1;var Jn=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),o=0,i=0;o<s;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},Gn=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){o[i++]=t;continue}let a=Fn[t];if(a>4)o[i++]=65533,n+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&n<r;)t=t<<6|63&e[n++],a--;a>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Vn)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r})(o,i)},Hn=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Fn[e[r]]>t?r:t};var Kn=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Wn=Object.prototype.toString,{Z_NO_FLUSH:Yn,Z_SYNC_FLUSH:zn,Z_FULL_FLUSH:qn,Z_FINISH:Qn,Z_OK:Zn,Z_STREAM_END:Xn,Z_DEFAULT_COMPRESSION:$n,Z_DEFAULT_STRATEGY:ei,Z_DEFLATED:ti}=Br;function ri(e){this.options=Bn({level:$n,method:ti,chunkSize:16384,windowBits:15,memLevel:8,strategy:ei},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Kn,this.strm.avail_out=0;let r=Mn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Zn)throw new Error(jr[r]);if(t.header&&Mn.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Jn(t.dictionary):"[object ArrayBuffer]"===Wn.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=Mn.deflateSetDictionary(this.strm,e),r!==Zn)throw new Error(jr[r]);this._dict_set=!0}}function ni(e,t){const r=new ri(t);if(r.push(e,!0),r.err)throw r.msg||jr[r.err];return r.result}ri.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?Qn:Yn,"string"==typeof e?r.input=Jn(e):"[object ArrayBuffer]"===Wn.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===zn||o===qn)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=Mn.deflate(r,o),i===Xn)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=Mn.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Zn;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},ri.prototype.onData=function(e){this.chunks.push(e)},ri.prototype.onEnd=function(e){e===Zn&&(this.result=xn(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ii={Deflate:ri,deflate:ni,deflateRaw:function(e,t){return(t=t||{}).raw=!0,ni(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,ni(e,t)},constants:Br};const oi=16209;var ai=function(e,t){let r,n,i,o,a,s,c,u,l,_,d,f,p,h,b,g,m,v,R,O,E,I,S,T;const y=e.state;r=e.next_in,S=e.input,n=r+(e.avail_in-5),i=e.next_out,T=e.output,o=i-(t-e.avail_out),a=i+(e.avail_out-257),s=y.dmax,c=y.wsize,u=y.whave,l=y.wnext,_=y.window,d=y.hold,f=y.bits,p=y.lencode,h=y.distcode,b=(1<<y.lenbits)-1,g=(1<<y.distbits)-1;e:do{f<15&&(d+=S[r++]<<f,f+=8,d+=S[r++]<<f,f+=8),m=p[d&b];t:for(;;){if(v=m>>>24,d>>>=v,f-=v,v=m>>>16&255,0===v)T[i++]=65535&m;else{if(!(16&v)){if(64&v){if(32&v){y.mode=16191;break e}e.msg="invalid literal/length code",y.mode=oi;break e}m=p[(65535&m)+(d&(1<<v)-1)];continue t}for(R=65535&m,v&=15,v&&(f<v&&(d+=S[r++]<<f,f+=8),R+=d&(1<<v)-1,d>>>=v,f-=v),f<15&&(d+=S[r++]<<f,f+=8,d+=S[r++]<<f,f+=8),m=h[d&g];;){if(v=m>>>24,d>>>=v,f-=v,v=m>>>16&255,16&v){if(O=65535&m,v&=15,f<v&&(d+=S[r++]<<f,f+=8,f<v&&(d+=S[r++]<<f,f+=8)),O+=d&(1<<v)-1,O>s){e.msg="invalid distance too far back",y.mode=oi;break e}if(d>>>=v,f-=v,v=i-o,O>v){if(v=O-v,v>u&&y.sane){e.msg="invalid distance too far back",y.mode=oi;break e}if(E=0,I=_,0===l){if(E+=c-v,v<R){R-=v;do{T[i++]=_[E++]}while(--v);E=i-O,I=T}}else if(l<v){if(E+=c+l-v,v-=l,v<R){R-=v;do{T[i++]=_[E++]}while(--v);if(E=0,l<R){v=l,R-=v;do{T[i++]=_[E++]}while(--v);E=i-O,I=T}}}else if(E+=l-v,v<R){R-=v;do{T[i++]=_[E++]}while(--v);E=i-O,I=T}for(;R>2;)T[i++]=I[E++],T[i++]=I[E++],T[i++]=I[E++],R-=3;R&&(T[i++]=I[E++],R>1&&(T[i++]=I[E++]))}else{E=i-O;do{T[i++]=T[E++],T[i++]=T[E++],T[i++]=T[E++],R-=3}while(R>2);R&&(T[i++]=T[E++],R>1&&(T[i++]=T[E++]))}break}if(64&v){e.msg="invalid distance code",y.mode=oi;break e}m=h[(65535&m)+(d&(1<<v)-1)]}}break}}while(r<n&&i<a);R=f>>3,r-=R,f-=R<<3,d&=(1<<f)-1,e.next_in=r,e.next_out=i,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=i<a?a-i+257:257-(i-a),y.hold=d,y.bits=f};const si=15,ci=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ui=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),li=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),_i=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var di=(e,t,r,n,i,o,a,s)=>{const c=s.bits;let u,l,_,d,f,p,h=0,b=0,g=0,m=0,v=0,R=0,O=0,E=0,I=0,S=0,T=null;const y=new Uint16Array(16),C=new Uint16Array(16);let L,P,N,A=null;for(h=0;h<=si;h++)y[h]=0;for(b=0;b<n;b++)y[t[r+b]]++;for(v=c,m=si;m>=1&&0===y[m];m--);if(v>m&&(v=m),0===m)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(g=1;g<m&&0===y[g];g++);for(v<g&&(v=g),E=1,h=1;h<=si;h++)if(E<<=1,E-=y[h],E<0)return-1;if(E>0&&(0===e||1!==m))return-1;for(C[1]=0,h=1;h<si;h++)C[h+1]=C[h]+y[h];for(b=0;b<n;b++)0!==t[r+b]&&(a[C[t[r+b]]++]=b);if(0===e?(T=A=a,p=20):1===e?(T=ci,A=ui,p=257):(T=li,A=_i,p=0),S=0,b=0,h=g,f=o,R=v,O=0,_=-1,I=1<<v,d=I-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){L=h-O,a[b]+1<p?(P=0,N=a[b]):a[b]>=p?(P=A[a[b]-p],N=T[a[b]-p]):(P=96,N=0),u=1<<h-O,l=1<<R,g=l;do{l-=u,i[f+(S>>O)+l]=L<<24|P<<16|N}while(0!==l);for(u=1<<h-1;S&u;)u>>=1;if(0!==u?(S&=u-1,S+=u):S=0,b++,0==--y[h]){if(h===m)break;h=t[r+a[b]]}if(h>v&&(S&d)!==_){for(0===O&&(O=v),f+=g,R=h-O,E=1<<R;R+O<m&&(E-=y[R+O],!(E<=0));)R++,E<<=1;if(I+=1<<R,1===e&&I>852||2===e&&I>592)return 1;_=S&d,i[_]=v<<24|R<<16|f-o}}return 0!==S&&(i[f+S]=h-O<<24|64<<16),s.bits=v,0};const{Z_FINISH:fi,Z_BLOCK:pi,Z_TREES:hi,Z_OK:bi,Z_STREAM_END:gi,Z_NEED_DICT:mi,Z_STREAM_ERROR:vi,Z_DATA_ERROR:Ri,Z_MEM_ERROR:Oi,Z_BUF_ERROR:Ei,Z_DEFLATED:Ii}=Br,Si=16180,Ti=16190,yi=16191,Ci=16192,Li=16194,Pi=16199,Ni=16200,Ai=16206,wi=16209,Di=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Ui(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ki=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Si||t.mode>16211?1:0},Mi=e=>{if(ki(e))return vi;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Si,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,bi},ji=e=>{if(ki(e))return vi;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Mi(e)},Bi=(e,t)=>{let r;if(ki(e))return vi;const n=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?vi:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,ji(e))},xi=(e,t)=>{if(!e)return vi;const r=new Ui;e.state=r,r.strm=e,r.window=null,r.mode=Si;const n=Bi(e,t);return n!==bi&&(e.state=null),n};let Vi,Fi,Ji=!0;const Gi=e=>{if(Ji){Vi=new Int32Array(512),Fi=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(di(1,e.lens,0,288,Vi,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;di(2,e.lens,0,32,Fi,0,e.work,{bits:5}),Ji=!1}e.lencode=Vi,e.lenbits=9,e.distcode=Fi,e.distbits=5},Hi=(e,t,r,n)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(t.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(t.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var Ki={inflateReset:ji,inflateReset2:Bi,inflateResetKeep:Mi,inflateInit:e=>xi(e,15),inflateInit2:xi,inflate:(e,t)=>{let r,n,i,o,a,s,c,u,l,_,d,f,p,h,b,g,m,v,R,O,E,I,S=0;const T=new Uint8Array(4);let y,C;const L=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ki(e)||!e.output||!e.input&&0!==e.avail_in)return vi;r=e.state,r.mode===yi&&(r.mode=Ci),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,_=s,d=c,I=bi;e:for(;;)switch(r.mode){case Si:if(0===r.wrap){r.mode=Ci;break}for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,T[0]=255&u,T[1]=u>>>8&255,r.check=Mr(r.check,T,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=wi;break}if((15&u)!==Ii){e.msg="unknown compression method",r.mode=wi;break}if(u>>>=4,l-=4,E=8+(15&u),0===r.wbits&&(r.wbits=E),E>15||E>r.wbits){e.msg="invalid window size",r.mode=wi;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&u?16189:yi,u=0,l=0;break;case 16181:for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==Ii){e.msg="unknown compression method",r.mode=wi;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=wi;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(T[0]=255&u,T[1]=u>>>8&255,r.check=Mr(r.check,T,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(T[0]=255&u,T[1]=u>>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,r.check=Mr(r.check,T,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(T[0]=255&u,T[1]=u>>>8&255,r.check=Mr(r.check,T,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(T[0]=255&u,T[1]=u>>>8&255,r.check=Mr(r.check,T,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(f=r.length,f>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+f),E)),512&r.flags&&4&r.wrap&&(r.check=Mr(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&4&r.wrap&&(r.check=Mr(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&4&r.wrap&&(r.check=Mr(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=wi;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=yi;break;case 16189:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}e.adler=r.check=Di(u),u=0,l=0,r.mode=Ti;case Ti:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,mi;e.adler=r.check=1,r.mode=yi;case yi:if(t===pi||t===hi)break e;case Ci:if(r.last){u>>>=7&l,l-=7&l,r.mode=Ai;break}for(;l<3;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(Gi(r),r.mode=Pi,t===hi){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=wi}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=wi;break}if(r.length=65535&u,u=0,l=0,r.mode=Li,t===hi)break e;case Li:r.mode=16195;case 16195:if(f=r.length,f){if(f>s&&(f=s),f>c&&(f=c),0===f)break e;i.set(n.subarray(o,o+f),a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=yi;break;case 16196:for(;l<14;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=wi;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.lens[L[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[L[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,y={bits:r.lenbits},I=di(0,r.lens,0,19,r.lencode,0,r.work,y),r.lenbits=y.bits,I){e.msg="invalid code lengths set",r.mode=wi;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;S=r.lencode[u&(1<<r.lenbits)-1],b=S>>>24,g=S>>>16&255,m=65535&S,!(b<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(m<16)u>>>=b,l-=b,r.lens[r.have++]=m;else{if(16===m){for(C=b+2;l<C;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(u>>>=b,l-=b,0===r.have){e.msg="invalid bit length repeat",r.mode=wi;break}E=r.lens[r.have-1],f=3+(3&u),u>>>=2,l-=2}else if(17===m){for(C=b+3;l<C;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=b,l-=b,E=0,f=3+(7&u),u>>>=3,l-=3}else{for(C=b+7;l<C;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=b,l-=b,E=0,f=11+(127&u),u>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=wi;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===wi)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=wi;break}if(r.lenbits=9,y={bits:r.lenbits},I=di(1,r.lens,0,r.nlen,r.lencode,0,r.work,y),r.lenbits=y.bits,I){e.msg="invalid literal/lengths set",r.mode=wi;break}if(r.distbits=6,r.distcode=r.distdyn,y={bits:r.distbits},I=di(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,y),r.distbits=y.bits,I){e.msg="invalid distances set",r.mode=wi;break}if(r.mode=Pi,t===hi)break e;case Pi:r.mode=Ni;case Ni:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,ai(e,d),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,r.mode===yi&&(r.back=-1);break}for(r.back=0;S=r.lencode[u&(1<<r.lenbits)-1],b=S>>>24,g=S>>>16&255,m=65535&S,!(b<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(g&&!(240&g)){for(v=b,R=g,O=m;S=r.lencode[O+((u&(1<<v+R)-1)>>v)],b=S>>>24,g=S>>>16&255,m=65535&S,!(v+b<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=b,l-=b,r.back+=b,r.length=m,0===g){r.mode=16205;break}if(32&g){r.back=-1,r.mode=yi;break}if(64&g){e.msg="invalid literal/length code",r.mode=wi;break}r.extra=15&g,r.mode=16201;case 16201:if(r.extra){for(C=r.extra;l<C;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;S=r.distcode[u&(1<<r.distbits)-1],b=S>>>24,g=S>>>16&255,m=65535&S,!(b<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(!(240&g)){for(v=b,R=g,O=m;S=r.distcode[O+((u&(1<<v+R)-1)>>v)],b=S>>>24,g=S>>>16&255,m=65535&S,!(v+b<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=b,l-=b,r.back+=b,64&g){e.msg="invalid distance code",r.mode=wi;break}r.offset=m,r.extra=15&g,r.mode=16203;case 16203:if(r.extra){for(C=r.extra;l<C;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=wi;break}r.mode=16204;case 16204:if(0===c)break e;if(f=d-c,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=wi;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),h=r.window}else h=i,p=a-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do{i[a++]=h[p++]}while(--f);0===r.length&&(r.mode=Ni);break;case 16205:if(0===c)break e;i[a++]=r.length,c--,r.mode=Ni;break;case Ai:if(r.wrap){for(;l<32;){if(0===s)break e;s--,u|=n[o++]<<l,l+=8}if(d-=c,e.total_out+=d,r.total+=d,4&r.wrap&&d&&(e.adler=r.check=r.flags?Mr(r.check,i,d,a-d):Ur(r.check,i,d,a-d)),d=c,4&r.wrap&&(r.flags?u:Di(u))!==r.check){e.msg="incorrect data check",r.mode=wi;break}u=0,l=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=wi;break}u=0,l=0}r.mode=16208;case 16208:I=gi;break e;case wi:I=Ri;break e;case 16210:return Oi;default:return vi}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,(r.wsize||d!==e.avail_out&&r.mode<wi&&(r.mode<Ai||t!==fi))&&Hi(e,e.output,e.next_out,d-e.avail_out),_-=e.avail_in,d-=e.avail_out,e.total_in+=_,e.total_out+=d,r.total+=d,4&r.wrap&&d&&(e.adler=r.check=r.flags?Mr(r.check,i,d,e.next_out-d):Ur(r.check,i,d,e.next_out-d)),e.data_type=r.bits+(r.last?64:0)+(r.mode===yi?128:0)+(r.mode===Pi||r.mode===Li?256:0),(0===_&&0===d||t===fi)&&I===bi&&(I=Ei),I},inflateEnd:e=>{if(ki(e))return vi;let t=e.state;return t.window&&(t.window=null),e.state=null,bi},inflateGetHeader:(e,t)=>{if(ki(e))return vi;const r=e.state;return 2&r.wrap?(r.head=t,t.done=!1,bi):vi},inflateSetDictionary:(e,t)=>{const r=t.length;let n,i,o;return ki(e)?vi:(n=e.state,0!==n.wrap&&n.mode!==Ti?vi:n.mode===Ti&&(i=1,i=Ur(i,t,r,0),i!==n.check)?Ri:(o=Hi(e,t,r,r),o?(n.mode=16210,Oi):(n.havedict=1,bi)))},inflateInfo:"pako inflate (from Nodeca project)"};var Wi=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Yi=Object.prototype.toString,{Z_NO_FLUSH:zi,Z_FINISH:qi,Z_OK:Qi,Z_STREAM_END:Zi,Z_NEED_DICT:Xi,Z_STREAM_ERROR:$i,Z_DATA_ERROR:eo,Z_MEM_ERROR:to}=Br;function ro(e){this.options=Bn({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Kn,this.strm.avail_out=0;let r=Ki.inflateInit2(this.strm,t.windowBits);if(r!==Qi)throw new Error(jr[r]);if(this.header=new Wi,Ki.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Jn(t.dictionary):"[object ArrayBuffer]"===Yi.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Ki.inflateSetDictionary(this.strm,t.dictionary),r!==Qi)))throw new Error(jr[r])}ro.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?qi:zi,"[object ArrayBuffer]"===Yi.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=Ki.inflate(r,a),o===Xi&&i&&(o=Ki.inflateSetDictionary(r,i),o===Qi?o=Ki.inflate(r,a):o===eo&&(o=Xi));r.avail_in>0&&o===Zi&&r.state.wrap>0&&0!==e[r.next_in];)Ki.inflateReset(r),o=Ki.inflate(r,a);switch(o){case $i:case eo:case Xi:case to:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===Zi))if("string"===this.options.to){let e=Hn(r.output,r.next_out),t=r.next_out-e,i=Gn(r.output,e);r.next_out=t,r.avail_out=n-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==Qi||0!==s){if(o===Zi)return o=Ki.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},ro.prototype.onData=function(e){this.chunks.push(e)},ro.prototype.onEnd=function(e){e===Qi&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=xn(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const{Deflate:no,deflate:io,deflateRaw:oo,gzip:ao}=ii;var so=ao;var co,uo=-1,lo=function(){return"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)}))},_o=function(e,t,r){return C(void 0,void 0,void 0,(function(){var n;return L(this,(function(i){return n=[],[2,new Promise((function(i,o){e.forEach((function(e){return C(void 0,void 0,void 0,(function(){var o,s,c;return L(this,(function(u){switch(u.label){case 0:return o=e.detectorAddr.replace(/^(https?:\/\/)?/,"https://"),s="".concat(o,"/rtc/detector/ping?t=").concat((_=9999,(l=1e3)+Math.floor(Math.random()*(_-l)))),c={jwt:r},[4,t.httpReq({url:s,body:JSON.stringify(c),timeout:5e3,method:a.POST})];case 1:return 200===u.sent().status&&n.push(e.clusterId),i(n),[2]}var l,_}))}))}))}))]}))}))},fo=function(e,t,r){return C(void 0,void 0,void 0,(function(){var n,i,s,c,u,l,_,d;return L(this,(function(f){switch(f.label){case 0:return n=function(e,t){var r,n;if(!t)return"";try{n=JSON.parse(t.voipCallInfo||'{ "strategy": 0 }')}catch(r){return e.warn(S.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O,"parse `voipCallInfo` of navi failed: ".concat(t.voipCallInfo)),""}if(0===n.strategy)return"";var i=null===(r=n.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!i||0===i.length)return"";var o=i[0];return o.detectorManager?o.detectorManager:""}(t,r),i=(p=r)&&p.jwt||"",s=null,c=120,u=0,l={jwt:i},n&&i?[4,e.httpReq({url:"".concat(n,"/rtc/detector/servers"),body:JSON.stringify(l),headers:{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(Vt.browser,"|").concat(Vt.version),ClientVersion:"5.7.3-enterprise-lz-alpha.1","Client-Session-Id":lo(),"Request-Id":Date.now().toString()},method:a.POST})]:[3,3];case 1:return _=f.sent(),d=_.data&&JSON.parse(_.data).detectorAddrs,c=_.data&&JSON.parse(_.data).clientDetectMinute,u=_.data&&JSON.parse(_.data).resultCode,d&&o(d)?[4,_o(d,e,i)]:[3,3];case 2:s=f.sent(),f.label=3;case 3:return[2,{fastMediaUrl:s,clientDetectMinute:c,status:u}]}var p}))}))},po=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(Vt.browser,"|").concat(Vt.version),ClientVersion:"5.7.3-enterprise-lz-alpha.1","Client-Session-Id":lo(),"Request-Id":Date.now().toString()}},ho=function(){function e(t,r,n,i){void 0===i&&(i=5e3),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_msUrl",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_msInNavi",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_failedMs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rtcFinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clusterId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_configUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_msList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_qualityMsList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_customParams",{enumerable:!0,configurable:!0,writable:!0,value:""}),this._logger=this._context.logger,e.isDetector||r.getConnectionStatus()!==u.CONNECTED||this.detectorMediaSever()}return Object.defineProperty(e.prototype,"setCustomExtendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._customParams=e}}),Object.defineProperty(e.prototype,"getCustomExtendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._customParams}}),Object.defineProperty(e.prototype,"detectorMediaSever",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t=this._context.getNaviInfo();if(e.jwtToken=(null==t?void 0:t.jwt)||"",!this._msUrl){var r=Date.now(),n=e.detectValidMinute+e.detectorTime>r;e.isDetector=n,!n&&t&&s(t)&&(this._msList=[],this._getDetectorUrls(t))}}}),Object.defineProperty(e.prototype,"_getDetectorUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return C(this,void 0,void 0,(function(){var r,n,i;return L(this,(function(o){switch(o.label){case 0:return e.isDetector?[2]:(e.isDetector=!0,[4,fo(this._runtime,this._logger,t)]);case 1:return r=o.sent(),n=r.fastMediaUrl,i=r.clientDetectMinute,r.status!==I.JWT_TIME_OUT?[3,3]:[4,this._context.getPluginContext().refetchNaviInfo()];case 2:o.sent(),this.detectorMediaSever(),o.label=3;case 3:return e.msInDetector=n||[],e.detectorTime=Date.now(),e.detectValidMinute=60*i*1e3,[2]}}))}))}}),Object.defineProperty(e.prototype,"getNaviMS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msUrl?[this._msUrl]:(c(this._msList)&&!this._clusterId||(this._msList=this.setMediaServiceList()),this._msList)}}),Object.defineProperty(e.prototype,"setMediaServiceList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t,r,n,i=[];return this._clusterId&&(this._clusterId=this._clusterId.replace(/^(https?:\/\/)?/,"https://"),this._msList.unshift(this._clusterId)),c(e.msInDetector)&&(e.msInDetector=e.msInDetector.map((function(e){return e.replace(/^(https?:\/\/)?/,"https://")})),this._msList.push(e.msInDetector[0]),i=e.msInDetector.concat().splice(1,e.msInDetector.length-1)),0===this._msInNavi.length&&(0===this._failedMs.length?(t=this._msInNavi).push.apply(t,A([],N(function(e,t){var r,n;if(!e)return[];try{n=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(r){return t.warn(S.L_PARSE_VOIP_SERVER_CONF_E,e.voipCallInfo),[]}if(0===n.strategy)return[];var i=null===(r=n.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!i||0===i.length)return[];var o=i[0],a=[];return o.mediaServer&&a.push(o.mediaServer.replace(/^(https?:\/\/)?/,"https://")),o.backupMediaServer&&o.backupMediaServer.forEach((function(e){a.push(e.replace(/^(https?:\/\/)?/,"https://"))})),a}(this._context.getNaviInfo(),this._logger)),!1)):((r=this._msInNavi).push.apply(r,A([],N(this._failedMs),!1)),this._failedMs.length=0)),n=this._msInNavi.concat().splice(1,this._msInNavi.length-1),this._msList.push(this._msInNavi[0]),this._msList=A(A(A([],N(this._msList),!1),N(i),!1),N(n),!1),this._msList=A([],N(new Set(this._msList)),!1),this._logger.info(S.L_MEDIA_SERVICE_MSLIST_CHANGE_O,"MediaServiceList msList -> ".concat(JSON.stringify(this._msList))),this._msList}}),Object.defineProperty(e.prototype,"_openGzip",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var r=JSON.stringify(t),n=r.length,i=new Uint8Array(n),o=0;o<n;o++)i[o]=r.charCodeAt(o);var a;return{headers:e=y(y({},e),{"Content-Encoding":"gzip","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}),body:t=so(i,a)}}}),Object.defineProperty(e.prototype,"_dealRequestSuccessResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=JSON.parse(e);return n.rtcFinger&&(this._rtcFinger=n.rtcFinger),n.clusterId&&(this._clusterId=n.clusterId),this._logger.info(S.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:T.SUCCESSED,url:t}),r),{code:I.SUCCESS,data:n,qualityMsList:this._qualityMsList}}}),Object.defineProperty(e.prototype,"_request",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o;return C(this,void 0,void 0,(function(){var s,c,u,l,_,d,f,p,h,b,g,m,v,R,O,E;return L(this,(function(C){switch(C.label){case 0:if(this._qualityMsList=[],s=(null===(o=this._context.getNaviInfo())||void 0===o?void 0:o.openGzip)||!1,c=s?this._openGzip(t,r):{headers:t,body:r},u=c.headers,l=c.body,0===(_=this.getNaviMS()).length)return this._logger.error(S.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:T.FAILED,code:I.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),n),[2,{code:I.NOT_OPEN_VIDEO_AUDIO_SERVER}];this._rtcFinger&&(l.rtcFinger=this._rtcFinger),d=0,C.label=1;case 1:return d<_.length?(f=Date.now(),p="".concat(_[d]).concat(e),h=po(),b=y(y({},h),u),g=/x-www-form-urlencoded/.test(b["Content-Type"])?l:JSON.stringify(l),m=h["Request-Id"],this._logger.info(S.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:p,"Request-Id":m}),n),[4,this._runtime.httpReq({url:p,body:g,headers:b,method:a.POST,timeout:this._timeout})]):[3,4];case 2:if(v=C.sent(),R=v.status,O=v.data,i&&this._qualityMsList.push({rsdur:Date.now()-f,rsid:m,rscod:200===R?I.SUCCESS:I.REQUEST_FAILED,msa:p}),200===R)return[2,this._dealRequestSuccessResult(O,p,n)];(E=this._failedMs).push.apply(E,A([],N(this._msInNavi.splice(d,1)),!1)),this._logger.error(S.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:T.FAILED,msg:"request error -> Request-Id: ".concat(m,", status: ").concat(R,", url: ").concat(p),timeout:this._timeout}),n),C.label=3;case 3:return d+=1,[3,1];case 4:return[2,{code:I.REQUEST_FAILED,qualityMsList:this._qualityMsList}]}}))}))}}),Object.defineProperty(e.prototype,"exchange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i;return C(this,void 0,void 0,(function(){var o,a;return L(this,(function(s){switch(s.label){case 0:return[4,this._request("/exchange",e,t,r,n)];case 1:return(o=s.sent()).code===I.SUCCESS&&(null===(i=o.data)||void 0===i?void 0:i.resultCode)===I.SUCCESS&&(a=o.data.urls)&&(this._configUrl=a.configUrl),[2,o]}}))}))}}),Object.defineProperty(e.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return L(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),[4,this._request("/exit",e,{},t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"broadcastSubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._logger.createTraceId();return this._request("/broadcast/subscribe",e,t,r,!0)}}),Object.defineProperty(e.prototype,"broadcastExit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return L(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),[4,this._request("/broadcast/exit",e,{},t,!0)];case 1:return[2,{code:r.sent().code}]}}))}))}}),Object.defineProperty(e.prototype,"setMcuConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,s,c,u,l,_,d,f;return L(this,(function(p){switch(p.label){case 0:return r=this._logger.createTraceId(),this._logger.info(S.L_MEDIA_SERVICE_SET_MCU_CONFIG_T,JSON.stringify({body:t}),r),this._configUrl?(n="".concat(this._configUrl.replace(/^(https?:\/\/)?/,"https://"),"/server/mcu/config"),i=po(),o=y(y({},i),e),s=JSON.stringify(t),c=i["Request-Id"],[4,this._runtime.httpReq({url:n,headers:o,body:s,method:a.POST})]):(this._logger.error(S.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:T.FAILED,code:I.MCU_SERVER_NOT_FOUND,msg:"MCU server not found"}),r),[2,{code:I.MCU_SERVER_NOT_FOUND}]);case 1:return u=p.sent(),l=u.status,_=u.data,200===l?(d=JSON.parse(_),(f=d.resultCode)===I.SUCCESS?this._logger.info(S.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:T.SUCCESSED,"Request-Id":c}),r):this._logger.warn(S.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({code:f,"Request-Id":c}),r),[2,{code:f,res:d}]):(this._logger.error(S.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:T.FAILED,code:I.REQUEST_FAILED,msg:"request error -> Request-Id: ".concat(c,", status: ").concat(l,", url: ").concat(n)}),r),[2,{code:I.REQUEST_FAILED}])}}))}))}}),Object.defineProperty(e.prototype,"getCDNResourceInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,s,c,u,l;return L(this,(function(_){switch(_.label){case 0:return n=po(),i=y(y({},n),e),o=n["Request-Id"],this._logger.info(S.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T,"Request-Id: ".concat(o,", url: ").concat(t),r),[4,this._runtime.httpReq({url:t,headers:i,method:a.GET})];case 1:return s=_.sent(),c=s.status,u=s.data,200===c?(l=JSON.parse(u),this._logger.info(S.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:T.SUCCESSED,cdnPlayerUrl:null==l?void 0:l.data.pull_url}),r),[2,{code:l.resultCode,res:l}]):(this._logger.info(S.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:T.FAILED,code:I.REQUEST_FAILED}),r),[2,{code:I.REQUEST_FAILED}])}}))}))}}),Object.defineProperty(e,"isDetector",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(e,"msInDetector",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(e,"detectorTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(e,"detectValidMinute",{enumerable:!0,configurable:!0,writable:!0,value:72e5}),Object.defineProperty(e,"jwtToken",{enumerable:!0,configurable:!0,writable:!0,value:""}),e}();!function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}(co||(co={}));var bo,go=function(e,t){return Math.round(8*t/e)},mo=function(e,t){void 0===t&&(t=2);var r=Math.pow(10,t);return Math.round(e*r)/r},vo=function(e,t){void 0===t&&(t=2),e>1&&(e=1);var r=Math.pow(10,t);return Math.round(e*r)},Ro=function(e,t,r,n){if(0===t)return 0;if(!n)return mo(e/t,3);var i=t-n;if(0===i)return 1;var o=e-r;return o<0||i<0?0:mo(o/i,3)},Oo=function(e){var t=e.jitter,r=e.rtt,n=e.packetsLostRate;return!Kt(t)||!Kt(r)||0!==n};!function(e){e.TRACK="track",e.STREAM="stream",e.MEDIASOURCE="media-source",e.INBOUNDRTP="inbound-rtp",e.OUTBOUNDRTP="outbound-rtp",e.REMOTEINBOUNDRTP="remote-inbound-rtp",e.PEERCONNECTION="peer-connection",e.TRANSPORT="transport",e.CERTIFICATE="certificate",e.CANDIDATEPAIR="candidate-pair",e.REMOTECANDIDATE="remote-candidate",e.LOCALCANDIDATE="local-candidate"}(bo||(bo={}));var Eo,Io=function(){function e(e,t,r,n,i,o){Object.defineProperty(this,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_sdpSemantics",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_latestPacketsSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestPacketsRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._sdpStrategy.getTrackIdByMid(e)}}),Object.defineProperty(e.prototype,"updateBytesSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];n=t-o.bytesSent,i=r-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:r}}else n=t,i=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:r};return go(i,n)}}),Object.defineProperty(e.prototype,"updateBytesRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];n=t-o.bytesRecv,i=r-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r}}else n=t,i=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r};return go(i,n)}}),Object.defineProperty(e.prototype,"updateSenderPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var i=this._latestPacketsSent[e],o=i.packetsLost,a=i.packetsSent;n=Ro(t,r,o,a),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?a:r}else n=Ro(t,r),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=r;return n}}),Object.defineProperty(e.prototype,"updateReceiverPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;if(this._latestPacketsRecv[e]){var i=this._latestPacketsRecv[e],o=i.packetsLost,a=i.packetsRecv;n=Ro(t,r+t,o,a+o)}else n=Ro(t,r);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:r},n}}),Object.defineProperty(e.prototype,"clearLatestpacketsSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){if(parseInt(e.split("_").pop())===ze.VIDEO_ONLY){var r="".concat(e,"_tiny");delete t._latestPacketsSent[r],delete t._latestBytesSent[r]}delete t._latestPacketsSent[e],delete t._latestBytesSent[e]}))}}),Object.defineProperty(e.prototype,"clearLatestPacketsRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){delete t._latestPacketsRecv[e],delete t._latestBytesRecv[e]}))}}),Object.defineProperty(e.prototype,"parseRTCStatsReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n={};try{for(var i=P(e.entries()),o=i.next();!o.done;o=i.next()){var a=N(o.value,2),s=a[0],c=a[1];/codec/gi.test(c)&&s.includes("RTCCodec_")||(n[s]=c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}}),Object.defineProperty(e.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={senders:[],receivers:[]};return this._logger.info(S.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O,JSON.stringify({status:T.SUCCESSED,stats:e,reports:t})),t}}),Object.defineProperty(e.prototype,"isValidTranceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i="outbound-rtp"===t?null===(r=this._rtcPeerConn.currentLocalDescription)||void 0===r?void 0:r.sdp:null===(n=this._rtcPeerConn.currentRemoteDescription)||void 0===n?void 0:n.sdp,o=e.ssrc;return!(null==i?void 0:i.split("\r\nm=").some((function(e){return e.includes(o)&&e.includes("a=inactive")})))}}),Object.defineProperty(e.prototype,"formatStateData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Object.values(e).reduce((function(e,t){return t.type===bo.REMOTEINBOUNDRTP?(e.remoteInbound.push(t),e):t.type===bo.INBOUNDRTP?(e.inbound.push(t),e):t.type===bo.OUTBOUNDRTP?(e.outbound.push(t),e):t.type===bo.TRANSPORT?(e.transport.push(t),e):t.type===bo.PEERCONNECTION?(e.connection.push(t),e):e}),{outbound:[],remoteInbound:[],inbound:[],transport:[],connection:[]})}}),e}(),So=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E(t,e),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=this.formatStateData(e),i=n.outbound,o=n.remoteInbound,a=n.inbound,s=n.transport,c=n.connection,u={senders:[],receivers:[]},l=Math.floor(c[0].timestamp);u.timestamp=l;var _=0,d=0;_=(t=this.pickOutbound(i,e,_,l,d)).totalPacketsLost,d=t.bitrateSend,u.senders=t.senders,o.length>0&&u.senders.length>0&&this.pickRemoteInbound(o,u.senders,e);var f=0;if(_=(r=this.pickInbound(a,e,_,l,f)).totalPacketsLost,f=r.bitrateRecv,u.receivers=r.receivers,s.length>0){var p=s[0];this.pickRtcTransport(p,e,u,f,d,_)}return u}}),Object.defineProperty(t.prototype,"pickRtcTransport",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=e.selectedCandidatePairId;if(a){var s=t[a],c=s.availableOutgoingBitrate,u=s.availableIncomingBitrate,l=s.currentRoundTripTime,_=s.localCandidateId,d=s.remoteCandidateId,f=t[_],p=f.ip,h=f.port,b=f.networkType,g=t[d],m=g.ip,v=g.port,R=g.protocol;r.iceCandidatePair={IP:p,port:h,networkType:b,remoteIP:m,remotePort:v,protocol:R,bitrateRecv:n,bitrateSend:i,rtt:1e3*l,availableOutgoingBitrate:c,availableIncomingBitrate:u,totalPacketsLost:o},r.receivers.forEach((function(e){e.rtt=1e3*l}))}}}),Object.defineProperty(t.prototype,"pickRemoteInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;e.forEach((function(e){var i,o=e.localId,a=e.jitter,s=e.roundTripTime,c=e.packetsLost,u=t.filter((function(e){return e.id===o}))[0];if(u&&!Oo(u)){var l=null===(i=n._store)||void 0===i?void 0:i.getTrackIdBySSRC(r[u.id].ssrc);u.jitter=Math.round(1e3*a),u.rtt=s;var _=n._latestPacketsSent[l].crtPacketsSent;u.packetsLostRate=n.updateSenderPacketsLost(l,c,_)}}))}}),Object.defineProperty(t.prototype,"_getOutboundVideoAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o,a,s,c=e.framesPerSecond,u=e.frameWidth,l=e.frameHeight;return"video"!==r||u||l||c||(u=(null===(o=t[n])||void 0===o?void 0:o.frameWidth)||t[i].width,l=(null===(a=t[n])||void 0===a?void 0:a.frameHeight)||t[i].height,c=(null===(s=t[i])||void 0===s?void 0:s.framesPerSecond)||null),{frameRate:c,frameWidth:u,frameHeight:l}}}),Object.defineProperty(t.prototype,"pickOutbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this,a=[];return e.forEach((function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"outbound-rtp")){var c=e.id,u=e.kind,l=e.mediaSourceId,_=e.remoteId,d=e.packetsSent,f=e.bytesSent,p=e.encoderImplementation,h=e.pliCount,b=e.nackCount,g=e.mid,m=e.trackId;if(void 0!==g&&(m=o.getTrackIdByMid(g)),m){var v=o._getOutboundVideoAttrs(e,t,u,m,l),R=v.frameRate,O=v.frameWidth,E=v.frameHeight,I=t[_],S=null,T=null,y=0;I&&(S=I.jitter,T=I.roundTripTime,y=I.packetsLost),r+=y;var C=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc);if(C){var L=l?t[l].audioLevel:t[m].audioLevel,P=0;!o._latestPacketsSent[C]&&(o._latestPacketsSent[C]={}),I?P=o.updateSenderPacketsLost(C,y,d):o._latestPacketsSent[C].crtPacketsSent=d;var N=o.updateBytesSent(C,f,n);N<0&&(N=0),i+=N,a.push({id:c,trackId:C,kind:u,packetsLostRate:P,remoteResource:!1,audioLevel:L||0===L?vo(L):null,frameWidth:O,frameHeight:E,frameRate:R,bitrate:N,jitter:S?Math.round(1e3*S):S,rtt:T?Math.round(1e3*T):T,encoderImplementation:p,pliCount:h,nackCount:b,googFirsSent:uo,samplingRate:uo,googRenderDelayMs:uo,trackState:uo})}}}})),{totalPacketsLost:r,bitrateSend:i,senders:a}}}),Object.defineProperty(t.prototype,"_getInboundMediaAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o,a,s,c=e.frameWidth,u=e.frameHeight,l=e.audioLevel;return"video"===i?c||u||(c=(null===(o=t[r])||void 0===o?void 0:o.frameWidth)||t[n].width,u=(null===(a=t[r])||void 0===a?void 0:a.frameHeight)||t[n].height):l||(l=(null===(s=t[r])||void 0===s?void 0:s.audioLevel)||t[n].audioLevel),{frameWidth:c,frameHeight:u,audioLevel:l}}}),Object.defineProperty(t.prototype,"pickInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this,a=[];return e.forEach((function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"inbound-rtp")){var c=e.packetsLost,u=e.packetsReceived,l=e.jitter,_=e.bytesReceived,d=e.framesPerSecond,f=e.kind,p=e.codecImplementationName,h=e.nackCount,b=e.pliCount,g=e.mid,m=e.id,v=e.trackId;if(void 0!==g&&(v=o.getTrackIdByMid(g)),v){var R=o._getInboundMediaAttrs(e,t,v,m,f),O=R.frameWidth,E=R.frameHeight,I=R.audioLevel;r+=c;var S=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc),T=o.updateReceiverPacketsLost(S,c,u),y=o.updateBytesRecv(S,_,n);y<0&&(y=0),i+=y,a.push({trackId:S,kind:f,packetsLostRate:T,remoteResource:!0,audioLevel:I||0===I?vo(I):null,frameWidth:O,frameHeight:E,frameRate:d,bitrate:y,jitter:l?Math.round(1e3*l):0,codecImplementationName:p,nackCount:h,pliCount:b,rtt:null,samplingRate:uo,googFirsReceived:uo,googRenderDelayMs:uo,trackState:uo})}}})),{totalPacketsLost:r,bitrateRecv:i,receivers:a}}}),t}(Io),To=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return E(t,e),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,r)){var i=e.kind,o=e.bytesSent,a=e.packetsSent,s=e.bitrateMean,c=e.framerateMean,u=e.nackCount,l=e.pliCount,_=e.remoteId,d=_?t[_]:{jitter:null,roundTripTime:null,packetsLost:0},f=d.jitter,p=d.roundTripTime,h=d.packetsLost,b=null===(n=this._store)||void 0===n?void 0:n.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=h;var g=0;!this._latestPacketsSent[b]&&(this._latestPacketsSent[b]={}),_?g=this.updateSenderPacketsLost(b,h,a):this._latestPacketsSent[b].crtPacketsSent=a;var m=0;"video"===i?s&&(m=Math.floor(s/1e3)):m=this.updateBytesSent(b,o,this._reportsData.timestamp),m<0&&(m=0),this._bitrateSend+=m,this._reportsData.senders.push({trackId:b,kind:i,packetsLostRate:g,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(c),bitrate:m,jitter:f?Math.round(1e3*f):null,rtt:p,encoderImplementation:null,pliCount:l,nackCount:u,googFirsSent:uo,samplingRate:uo,googRenderDelayMs:uo,trackState:uo})}}}),Object.defineProperty(t.prototype,"_addSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=t.localId,i=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e[n].ssrc),o=this._reportsData.senders.filter((function(e){return e.trackId===i}))[0];o&&Oo(o)&&(o.jitter=Math.round(1e3*t.jitter),o.rtt=t.rtt,o.packetsLostRate=this.updateSenderPacketsLost(i,t.packetsLost,this._latestPacketsSent[i].crtPacketsSent))}}),Object.defineProperty(t.prototype,"_pickReceiverData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,t)){var n=e.packetsLost,i=e.bytesReceived,o=e.packetsReceived,a=e.jitter,s=e.framerateMean,c=e.kind,u=e.bitrateMean,l=e.nackCount,_=e.pliCount,d=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=n;var f=this.updateReceiverPacketsLost(d,n,o),p=0;"video"===c?u&&(p=Math.floor(u/1e3)):p=this.updateBytesRecv(d,i,this._reportsData.timestamp),p<0&&(p=0),this._bitrateRecv+=p,this._reportsData.receivers.push({trackId:d,kind:c,packetsLostRate:f,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(s),bitrate:p,jitter:a?Math.round(1e3*a):null,codecImplementationName:null,nackCount:l,pliCount:_,rtt:null,samplingRate:uo,googFirsReceived:uo,googRenderDelayMs:uo,trackState:uo})}}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e[t.localCandidateId],n=r.address,i=r.port,o=e[t.remoteCandidateId],a=o.address,s=o.port,c=o.protocol;this._reportsData.iceCandidatePair={IP:n,port:i,networkType:null,remoteIP:a,remotePort:s,protocol:c,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:this._totalPacketsLost}}}),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=+new Date;for(var r in this._reportsData={senders:[],receivers:[],timestamp:t},this._totalPacketsLost=0,this._bitrateRecv=0,this._bitrateSend=0,e){var n=e[r],i=n.type;"outbound-rtp"===i&&this._pickSenderData(n,e,i),"remote-inbound-rtp"===i&&this._addSenderData(e,n),"inbound-rtp"===i&&this._pickReceiverData(n,i),"candidate-pair"===i&&"succeeded"===n.state&&this._pickIceCandidatePair(e,n)}return this._reportsData}}),t}(Io),yo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return E(t,e),Object.defineProperty(t.prototype,"_pickReceiverData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var t;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"inbound-rtp")){var n=e.packetsLost,i=e.packetsReceived,o=e.jitter,a=e.bytesReceived,s=e.kind,c=e.nackCount,u=e.pliCount,l=e.audioLevel,_=e.frameHeight,d=e.frameWidth,f=null===(t=r._store)||void 0===t?void 0:t.getTrackIdBySSRC(e.ssrc);if(f){r._totalPacketsLost+=n;var p=r.updateReceiverPacketsLost(f,n,i),h=r.updateBytesRecv(f,a,r._reportsData.timestamp);h<0&&(h=0),r._bitrateRecv+=h,r._reportsData.receivers.push({trackId:f,kind:s,packetsLostRate:p,remoteResource:!0,audioLevel:l||0===l?vo(l):null,frameWidth:d,frameHeight:_,frameRate:null,bitrate:h,jitter:o?Math.round(1e3*o):o,codecImplementationName:null,nackCount:c,pliCount:u,rtt:null,samplingRate:uo,googFirsReceived:uo,googRenderDelayMs:uo,trackState:uo})}}}))}}),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var n;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"outbound-rtp")){var i=null===(n=r._store)||void 0===n?void 0:n.getTrackIdBySSRC(e.ssrc),o=e.kind,a=e.bytesSent,s=e.pliCount,c=e.nackCount,u=e.audioLevel,l=e.frameHeight,_=e.frameWidth,d=e.codecId,f=e.remoteId,p=e.packetsSent;if(i){var h=t[f],b=null,g=null,m=0;h&&(b=h.jitter,g=h.roundTripTime,m=h.packetsLost),r._totalPacketsLost+=m;var v=0;!r._latestPacketsSent[i]&&(r._latestPacketsSent[i]={}),h?v=r.updateSenderPacketsLost(i,m,p):r._latestPacketsSent[i].crtPacketsSent=p;var R=r.updateBytesSent(i,a,r._reportsData.timestamp);R<0&&(R=0),r._bitrateSend+=R,r._reportsData.senders.push({trackId:i,kind:o,packetsLostRate:v,remoteResource:!1,audioLevel:u||0===u?vo(u):null,frameWidth:_,frameHeight:l,frameRate:null,bitrate:R,jitter:b?Math.round(1e3*b):b,rtt:g?Math.round(1e3*g):g,encoderImplementation:t[d].mimeType,pliCount:s,nackCount:c,googFirsSent:uo,samplingRate:uo,googRenderDelayMs:uo,trackState:uo})}}}))}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.selectedCandidatePairId;if(r){var n=t[r],i=n.availableOutgoingBitrate,o=n.availableIncomingBitrate,a=n.currentRoundTripTime,s=n.localCandidateId,c=n.remoteCandidateId,u=t[s],l=u.address,_=u.port,d=t[c],f=d.address,p=d.port,h=d.protocol;this._reportsData.iceCandidatePair={IP:l||null,port:_,networkType:null,remoteIP:f,remotePort:p,protocol:h,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:1e3*a,availableOutgoingBitrate:i,availableIncomingBitrate:o,totalPacketsLost:this._totalPacketsLost},this._reportsData.receivers.forEach((function(e){e.rtt=1e3*a}))}}}),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.formatStateData(e),r=t.outbound,n=t.inbound,i=t.transport,o=t.connection;this._reportsData={senders:[],receivers:[]};var a=Math.floor(o[0].timestamp);if(this._reportsData.timestamp=a,this._totalPacketsLost=0,this._bitrateSend=0,this._bitrateRecv=0,this._pickSenderData(r,e),this._pickReceiverData(n,e),i.length>0){var s=i[0];this._pickIceCandidatePair(s,e)}return this._reportsData}}),t}(Io),Co=function(){function e(e,t,r){Object.defineProperty(this,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"SDPHeader",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"videoStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"audioStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]});var n=this.getStreamIndex();this.spliteStreams(n)}return Object.defineProperty(e.prototype,"videoSdps",{get:function(){return this.videoStreams.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioSdps",{get:function(){return this.audioStreams.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"trimBlankLine",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.replace(/\n\r\s*\r\n/g,"\r\n").replace(/\s+\r\n/g,"\r\n")}}),Object.defineProperty(e.prototype,"getStreamIndex",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=/m=(?:video|audio)/gim,t=new Set([0]),r=e.exec(this.SDP);null!==r;)t.add(null==r?void 0:r.index),r=e.exec(this.SDP);return t.add(this.SDP.length),A([],N(t),!1)}}),Object.defineProperty(e.prototype,"spliteStreams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.SDPHeader=this.SDP.substring(e[0],e[1]).replace(/\r\ns=-/g,"\r\ns=".concat((new Date).valueOf()));for(var t=1;t<e.length;t++){var r=this.SDP.substring(e[t],e[t+1]);/^\bm=video\b/.test(r)?this.videoStreams.push(r):this.audioStreams.push(r)}}}),Object.defineProperty(e,"clearInactiveOrRecvonly",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return/\ba=(recvonly|inactive)\b/.test(e)?e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,""):e}}),Object.defineProperty(e.prototype,"setHeaderBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.SDPHeader=this.SDPHeader.replace(/(\r\ns=[^\r\n]+)/gi,"$1\r\nc=IN IP4 0.0.0.0\r\nb=AS:".concat(t*e.KBitrate,"\r\nb=TIAS:").concat(t*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"setAudiosBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.audioStreams=this.audioStreams.map((function(r){return t.setAudioItemBitrate(r,e)})),this}}),Object.defineProperty(e.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(n){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(n)?r.setAudioItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setAudioBitrateWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(n){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(n)?r.setAudioItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setAudioItemBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bmaxaveragebitrate\b/gi.test(t)){var n=["$1","maxaveragebitrate=".concat(r.max*e.KBitrate*1e3)];t=t.replace(/(\buseinbandfec=[^\r\n]+)/gi,n.join(";"))}return this.addAudioBlineAS(t,r)}}),Object.defineProperty(e.prototype,"addAudioBlineAS",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(r.max*e.KBitrate,"\r\nb=TIAS:").concat(r.max*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"setVideosBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.videoStreams=this.videoStreams.map((function(r){return t.setVideoItemBitrate(r,e)})),this}}),Object.defineProperty(e.prototype,"setVideoBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map((function(n){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(n)?r.setVideoItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setVideoBitrateWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map((function(n){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(n)?r.setVideoItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setVideoItemBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bx-google-max-bitrate\b/.test(t)){var n=["$1","x-google-max-bitrate=".concat(r.max*e.KBitrate),"x-google-min-bitrate=".concat(r.min*e.KBitrate),"x-google-start-bitrate=".concat(r.start||r.max*e.KBitrate*.7)];t=t.replace(/(\bprofile-level-id=42[e0]01f\b)/gi,n.join(";"))}return this.addVideoBlineAS(t,r)}}),Object.defineProperty(e.prototype,"addVideoBlineAS",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(r.max*e.KBitrate,"\r\nb=TIAS:").concat(r.max*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"clearnSsrcWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(n){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(n)?r.clearSSRC(n,t):n})),this.videoStreams=this.videoStreams.map((function(n){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(n)?r.clearSSRC(n,t):n})),this}}),Object.defineProperty(e.prototype,"clearSSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(t===No.SENDONLY&&/\ba=sendonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===No.RECVONLY&&/\ba=recvonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===No.INACTIVE&&/\ba=inactive\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");return e}}),Object.defineProperty(e,"KBitrate",{enumerable:!0,configurable:!0,writable:!0,value:1}),e}(),Lo=function(){function e(){}return Object.defineProperty(e,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._audioEncoder=e.encodeAudio,this._audioDecoder=e.decodeAudio,this._videoEncoder=e.encodeVideo,this._videoDecoder=e.decodeVideo,this._logger=t}}),Object.defineProperty(e,"isInit",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!(this._audioEncoder&&this._audioDecoder&&this._videoEncoder&&this._videoDecoder)}}),Object.defineProperty(e,"decodeAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._audioDecoder(e)}catch(t){return this._logger.error(S.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"encodeAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._audioEncoder(e)}catch(t){return this._logger.error(S.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"decodeVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._videoDecoder(e)}catch(t){return this._logger.error(S.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"encodeVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._videoEncoder(e)}catch(t){return this._logger.error(S.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}),e}();!function(e){e[e.NB=0]="NB",e[e.MB=1]="MB",e[e.WB=2]="WB",e[e.SWB=3]="SWB",e[e.FB=4]="FB"}(Eo||(Eo={})),Eo.NB,Eo.NB,Eo.NB,Eo.NB,Eo.MB,Eo.MB,Eo.MB,Eo.MB,Eo.WB,Eo.WB,Eo.WB,Eo.WB,Eo.SWB,Eo.SWB,Eo.FB,Eo.FB,Eo.NB,Eo.NB,Eo.NB,Eo.NB,Eo.WB,Eo.WB,Eo.WB,Eo.WB,Eo.SWB,Eo.SWB,Eo.SWB,Eo.SWB,Eo.FB,Eo.FB,Eo.FB,Eo.FB;var Po,No,Ao=function(){function e(){}return Object.defineProperty(e,"splitSections",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.split("\nm=").map((function(e,t){var r=t>0?"m=".concat(e):e;return"".concat(r.trim(),"\r\n")}))}}),Object.defineProperty(e,"getMediaSections",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.splitSections(t);return r.shift(),r}}),Object.defineProperty(e,"parseExtmap",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}}}),Object.defineProperty(e,"splitLines",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.trim().split("\n").map((function(e){return e.trim()}))}}),Object.defineProperty(e,"parseMLine",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.splitLines(t)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}}}),Object.defineProperty(e,"matchPrefix",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.splitLines(t).filter((function(e){return 0===e.indexOf(r)}))}}),Object.defineProperty(e,"parseMsid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,n=e.matchPrefix(t,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=e.matchPrefix(t,"a=ssrc:").map((function(t){return e.parseSsrcMedia(t)})).filter((function(e){return"msid"===e.attribute}));return i.length>0&&i[0].value?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:{stream:"",track:""}}}),Object.defineProperty(e,"parseSsrcMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r}}),Object.defineProperty(e,"getMid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.matchPrefix(t,"a=mid:")[0];if(r)return r.substr(6)}}),Object.defineProperty(e,"splitNaluData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Uint8Array(e),r=0;if(this.isIFrame(t)){var n=t.join(","),i=n.indexOf("0,0,0,1,101");-1===i&&(i=n.indexOf("0,0,0,1,37")),r=n.substring(0,i).split(",").length-1+4+8}else r=12;return{header:t.slice(0,r),payloadData:t.slice(r)}}}),Object.defineProperty(e,"deal0x03",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=[];return r="encode"===t?e.join(",").replaceAll(",0,0,1,",",0,0,3,1,").split(",").map((function(e){return Number(e)})):e.join(",").replaceAll(",0,0,3,1,",",0,0,1,").split(",").map((function(e){return Number(e)})),new Uint8Array(r)}}),Object.defineProperty(e,"isIFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.join("").startsWith("0001103");return t||(t=e.join("").startsWith("000139")),t}}),Object.defineProperty(e,"parsePayloadTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.getMediaSections(t).find((function(t){return"audio"===e.parseMLine(t).kind}));if(r){var n=r.match(/a=rtpmap:(\d+)\s+(\S+)/g);n&&(e.payloadTypeCodecMap=n.map((function(e){var t=e.match(/a=rtpmap:(\d+)\s+(\w+)/);return t?{payloadType:Number(t[1]),codec:t[2]}:null})).filter((function(e){return!!e})))}}}),Object.defineProperty(e,"payloadTypeCodecMap",{enumerable:!0,configurable:!0,writable:!0,value:[]}),e}();!function(e){e.PLANB="plan-b",e.UNIFIEDPLAN="unified-plan"}(Po||(Po={})),function(e){e.SENDONLY="sendonly",e.RECVONLY="recvonly",e.INACTIVE="inactive"}(No||(No={}));var wo,Do=function(){function e(e,t,r){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_useEncrypt",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_outboundStreams",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e,"setSdpSemantics",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Vt.browser,n=Vt.version,i=Vt.supportsUnifiedPlan;if(t.info(S.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O,JSON.stringify({sdpSemantics:e,supportsUnifiedPlan:i,browser:r,version:n})),i)return/chrome/i.test(r)?n?void(this._sdpSemantics=n>92?"unified-plan":n<72?"plan-b":e):void(this._sdpSemantics="unified-plan"):void(/firefox/i.test(r)?this._sdpSemantics="unified-plan":/safari/i.test(r)?this._sdpSemantics=n<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan");this._sdpSemantics="plan-b"}}),Object.defineProperty(e,"getSdpSemantics",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e._sdpSemantics}}),Object.defineProperty(e.prototype,"getOutboundVideoInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._outboundStreams){var r=this._outboundStreams[t].getVideoTracks()[0];if(r){var n=/_tiny$/.test(t),i=Lt(r),o=i.width,a=i.height;e.push({trackId:r.id,simulcast:n?co.TINY:co.NORMAL,resolution:"".concat(o,"x").concat(a)})}}return e}}),Object.defineProperty(e.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return L(this,(function(r){switch(r.label){case 0:e=Co.trimBlankLine(e),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._peer.setRemoteDescription({type:"answer",sdp:e})];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),this._logger.info(S.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:T.FAILED,msg:t})),[2,I.SET_REMOTE_DESCRIPTION_FAILED];case 4:return this._logger.info(S.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:T.SUCCESSED,sdp:e})),[2,I.SUCCESS]}}))}))}}),Object.defineProperty(e.prototype,"getStatParsr",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return/chrome/i.test(Vt.browser)?new So(this,e,this._logger,t,r,n):/Firefox/i.test(Vt.browser)?new To(this,e,this._logger,t,r,n):/Safari/i.test(Vt.browser)?new yo(this,e,this._logger,t,r,n):null}}),Object.defineProperty(e.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return null}}),Object.defineProperty(e.prototype,"resetSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Co.trimBlankLine(e)}}),Object.defineProperty(e.prototype,"_setupSenderTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),r=t.readable,n=t.writable,i=new TransformStream({transform:this._encodeRtpChunk.bind(this,e)});r.pipeThrough(i).pipeTo(n)}}}),Object.defineProperty(e.prototype,"_setupReceiverTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),r=t.readable,n=t.writable,i=new TransformStream({transform:this._decodeRtpChunk.bind(this,e)});r.pipeThrough(i).pipeTo(n)}}}),Object.defineProperty(e.prototype,"_encodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ao.splitNaluData(e),r=t.header,n=t.payloadData,i=Lo.encodeVideo(n),o=Ao.deal0x03(i,"encode");return new Uint8Array(A(A([],N(r),!1),N(o),!1)).buffer}}),Object.defineProperty(e.prototype,"_decodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ao.splitNaluData(e),r=t.header,n=t.payloadData,i=Ao.deal0x03(n,"decode"),o=Lo.decodeVideo(i);return new Uint8Array(A(A([],N(r),!1),N(o),!1)).buffer}}),Object.defineProperty(e.prototype,"_handleAudioREDFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=function(e){for(var t=[],r=0;;){var n,i=!(e[r]>>7),o=127&e[r],a=void 0,s=void 0,c=void 0;if(i?(a=0,s=e.byteLength-(t.length>0?t.map((function(e){return 4+e.block.byteLength})).reduce((function(e,t){return e+t})):0)-1,c=e.slice(r,r+1),r+=1):(a=(e[r+1]<<6)+(e[r+2]>>2),s=((3&e[r+2])<<8)+e[r+3],c=e.slice(r,r+4),r+=4),n=new Uint8Array(s),t.push({timestampOffset:a,header:c,block:n,isPrimary:i,blockPType:o}),i)break}return t.forEach((function(t){var n=t.block.byteLength,i=e.slice(r,r+n);t.block.set(i),r+=n})),t}(new Uint8Array(e)),n=[],i=[],o=0;r.forEach((function(e){var r="decode"===t?Lo.decodeAudio(e.block):Lo.encodeAudio(e.block);if(r.byteLength!==e.block.byteLength&&!e.isPrimary){var a=N(e.header,4),s=a[2],c=a[3];s=(s>>2<<2)+r.byteLength>>8,c=255&r.byteLength,e.header=new Uint8Array([e.header[0],e.header[1],s,c])}e.block=r,o+=e.block.byteLength+e.header.byteLength,n.push(e.header),i.push(e.block)}));var a=new Uint8Array(o),s=0;return A(A([],N(n),!1),N(i),!1).forEach((function(e){a.set(e,s),s+=e.byteLength})),a.buffer}}),Object.defineProperty(e.prototype,"_handleOpusFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=new Uint8Array(e);return("encode"===t?Lo.encodeAudio(r):Lo.decodeAudio(r)).buffer}}),Object.defineProperty(e.prototype,"_encodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._encodeVideoFrame(n);else{var i=t.getMetadata().payloadType,o=Ao.payloadTypeCodecMap.filter((function(e){return e.payloadType===i}))[0].codec;"red"===o?t.data=this._handleAudioREDFrame(n,"encode"):"opus"===o?t.data=this._handleOpusFrame(n,"encode"):console.error("Unsupport audio payloadType: ".concat(i,", codec: ").concat(o))}r.enqueue(t)}}),Object.defineProperty(e.prototype,"_decodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._decodeVideoFrame(n);else{var i=t.getMetadata().payloadType,o=Ao.payloadTypeCodecMap.filter((function(e){return e.payloadType===i}))[0].codec;"red"===o?t.data=this._handleAudioREDFrame(n,"decode"):"opus"===o?t.data=this._handleOpusFrame(n,"decode"):console.error("Unsupport audio payloadType: ".concat(i,", codec: ").concat(o))}r.enqueue(t)}}),e}(),Uo=function(e){function t(t,r){var n=e.call(this,r,Po.PLANB,t)||this;return Object.defineProperty(n,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return E(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];A(A([],N(this.audioStreams),!1),N(this.videoStreams),!1).forEach((function(t){var r=t.match(/\ba=mid:(video|audio)\b/),n=Co.clearInactiveOrRecvonly(t);r&&r[1]===Qe.AUDIO&&(e[1]=n),r&&r[1]===Qe.VIDEO&&(e[2]=n)}));var t=e.join("");return Co.trimBlankLine(t)}}),Object.defineProperty(t.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(S.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Audio Bitrate With Stream Id"),this}}),Object.defineProperty(t.prototype,"setVideoBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(S.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Video Bitrate With Stream Id"),this}}),t}(Co),ko=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"senders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t}return E(t,e),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._localTracks.every((function(t){return t.getTrackId()!==e.getTrackId()}))&&this._localTracks.push(e);var t=e.getStreamId(),r=e.__innerGetMediaStreamTrack(),n=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);n.getTracks().forEach((function(e){e.kind===r.kind&&n.removeTrack(e)})),n.addTrack(r);var i=e.getTrackId(),o=this.senders[i];o?o.replaceTrack(r):(this.senders[i]=this._peer.addTrack(r,n),Object.defineProperty(r,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}))}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._localTracks.findIndex((function(t){return t===e}));t>=0&&this._localTracks.splice(t,1);var r=e.getTrackId(),n=this.senders[r];n&&(n.replaceTrack(null),this._peer.removeTrack(n),delete this.senders[r])}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n;return L(this,(function(i){switch(i.label){case 0:return[4,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0})];case 1:for(r in t=i.sent(),this._outboundStreams)n=this._outboundStreams[r].id,t.sdp=t.sdp.replace(new RegExp(n,"g"),r);return t.sdp&&(t.sdp=this.resetSdp(t.sdp)),[4,this._peer.setLocalDescription(t)];case 2:return i.sent(),[2,{type:"offer",semantics:"plan-b",sdp:t.sdp}]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return t=this.resetSdp(t),e.prototype.setRemoteAnswer.call(this,t)}}),Object.defineProperty(t.prototype,"_getMaxRangeBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._localTracks.filter((function(t){return e===ze.AUDIO_ONLY?t.isAudioTrack():t.isVideoTrack()})),r={max:0,min:0};return t.forEach((function(e){var t=e.getBitrate(),n=t.min,i=t.max,o=t.start;r.max=r.max<i?i:r.max,r.min=r.min>n?n:r.min,r.max===i?r.start=o:r.start=.7*r.max})),r}}),Object.defineProperty(t.prototype,"resetSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Uo(this._logger,e),r=this._getMaxRangeBitrate(ze.VIDEO_ONLY),n=this._getMaxRangeBitrate(ze.AUDIO_ONLY);return t.setAudiosBitrate(n),t.setVideosBitrate(r),t.stringify()}}),t}(Do),Mo=function(e){function t(t,r){return e.call(this,r,Po.UNIFIEDPLAN,t)||this}return E(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];A(A([],N(this.audioStreams),!1),N(this.videoStreams),!1).forEach((function(t){var r=t.match(/\ba=mid:(\d+)\b/);r&&r[1]&&(e[+r[1]+1]=t)})),this.SDPHeader="",this.videoStreams=[],this.audioStreams=[];var t=e.join("");return Co.trimBlankLine(t)}}),t}(Co),jo=function(){function e(){Object.defineProperty(this,"__streams",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}return Object.defineProperty(e,"getInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e.instance||(e.instance=new e),e.instance}}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.__streams.set(e,t),t}}),Object.defineProperty(e.prototype,"pickup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.__streams.get(e)}}),Object.defineProperty(e.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.__streams.delete(e)}}),Object.defineProperty(e.prototype,"streams",{get:function(){var e,t,r=new Map;try{for(var n=P(this.__streams.keys()),i=n.next();!i.done;i=n.next()){var o=i.value;r.set(o,this.pickup(o))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},enumerable:!1,configurable:!0}),e}(),Bo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_sendTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_recvAudio",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvVideo",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_subedTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"midMsid",{enumerable:!0,configurable:!0,writable:!0,value:{}}),t}return E(t,e),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(S.L_FUNCTION_IS_UNAVAILABLE,"the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}}),Object.defineProperty(t.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t in this._sendTransceiver){if(this._sendTransceiver[t].mid===e)return t}for(var t in this._recvTransceiver){if(this._recvTransceiver[t].mid===e)return t}return null}}),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=e.getTrackId(),n=e.getStreamId(),i=e.__innerGetMediaStreamTrack();this._localTracks[r]=e;var o=this._outboundStreams[n]||(this._outboundStreams[n]=new MediaStream);o.getTracks().forEach((function(e){e.kind===i.kind&&o.removeTrack(e)})),o.addTrack(i);var a=this._sendTransceiver[r];if(a)a.sender.replaceTrack(i),a.direction="sendonly";else{var s=this._sendTransceiver[r]=this._peer.addTransceiver(i,{direction:"sendonly",streams:[o]});this._setupSenderTransform(s.sender)}jo.getInstance().push(r,{msid:n,id:this._outboundStreams[n].id,kind:null===(t=e.streamTrack)||void 0===t?void 0:t.kind})}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.getTrackId(),r=e.getStreamId();delete this._localTracks[t];var n=this._sendTransceiver[t];if(n){"closed"!==this._peer.connectionState&&(n.direction="inactive",this._peer.removeTrack(n.sender),n.sender.replaceTrack(null));var i=this._outboundStreams[r];(e.isAudioTrack()?i.getAudioTracks():i.getVideoTracks()).forEach((function(e){return i.removeTrack(e)}));var o=this._sendTransceiver["".concat(t,"_tiny")];if(o&&"inactive"!==o.direction&&"closed"!==this._peer.connectionState){o.direction="inactive";var a=o.sender,s=a.track;this._peer.removeTrack(a),a.replaceTrack(null),this._outboundStreams["".concat(r,"_tiny")].removeTrack(s),s.stop()}}}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=At(e).mediaType;this._recvTransceiver[e]=t;var n=r===ze.AUDIO_ONLY?this._recvAudio:this._recvVideo,i=n.findIndex((function(e){return e===t}));i>=0&&n.splice(i,1)}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=e.slice(),n=this._subedTracks.slice();this._subedTracks=e.slice();for(var i=function(e){var t=r[e],i=n.findIndex((function(e){return e===t}));i>=0&&(r.splice(e,1),n.splice(i,1))},o=r.length-1;o>=0;o-=1)i(o);n.length&&n.forEach((function(e){var r=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var n=t._recvTransceiver[r];n&&(n.direction="inactive")}));var a={audio:0,video:0};r.length&&r.forEach((function(e){var r=e.isAudioTrack()?"audio":"video",n=t._recvTransceiver[e.getTrackId()];n?n.direction="recvonly":a[r]+=1}));for(o=this._recvAudio.length;o<a.audio;o+=1){var s=this._peer.addTransceiver("audio",{direction:"recvonly"});this._recvAudio.push(s),this._setupReceiverTransform(s.receiver)}for(o=this._recvVideo.length;o<a.video;o+=1){s=this._peer.addTransceiver("video",{direction:"recvonly"});this._recvVideo.push(s),this._setupReceiverTransform(s.receiver)}}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i;return L(this,(function(o){switch(o.label){case 0:return[4,this._peer.createOffer({iceRestart:e})];case 1:for(n in t=o.sent(),r=t.sdp,this._outboundStreams)i=this._outboundStreams[n].id,r=r.replace(new RegExp(i,"g"),n);return r=(r=this.resetOfferSdp(r)).replace(/(a=ice-options:trickle)/g,"$1\r\na=ice-options:renomination"),t.sdp=r,[4,this._peer.setLocalDescription(t)];case 2:return o.sent(),[2,{type:"offer",semantics:"unified-plan",sdp:r}]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){t=this.resetAnswerSdp(t);var r=/[\r\n]+\r\n[\r\n]+/g;return r.test(t)&&(t=t.replace(r,"\r\n")),e.prototype.setRemoteAnswer.call(this,t)}}),Object.defineProperty(t.prototype,"_genarateMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=null;return Ao.getMediaSections(e).forEach((function(e){Ao.parseExtmap(e);var i=Ao.parseMLine(e).kind,o=Ao.parseMsid(e).stream,a=Ao.getMid(e);"video"===r?/tiny$/.test(o)?o=o.replace(/tiny$/gi,"1_tiny"):o+="_1":o+="_0",o===t&&r===i&&a&&(n=a)})),n}}),Object.defineProperty(t.prototype,"_setSenderTransceiverBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._localTracks[t],o=null==i?void 0:i.getBitrate();n===Qe.AUDIO&&o&&e.setAudioBitrateWithMid(o,r),n===Qe.VIDEO&&o&&e.setVideoBitrateWithMid(o,r)}}),Object.defineProperty(t.prototype,"_resetSenderTransceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;for(var n in this._sendTransceiver){var i=this._sendTransceiver[n],o=null===(r=i.sender.track)||void 0===r?void 0:r.kind,a=i.direction,s=i.mid;s||(s=this._genarateMid(e,n,o)),s&&(a===No.SENDONLY&&this._setSenderTransceiverBitrate(t,n,s,o),a===No.INACTIVE&&t.clearnSsrcWithMid(s,No.INACTIVE))}}}),Object.defineProperty(t.prototype,"_resetRecvTransceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t in this._recvTransceiver){var r=this._recvTransceiver[t],n=r.direction,i=r.mid;i&&n===No.INACTIVE&&e.clearnSsrcWithMid(i,No.RECVONLY)}}}),Object.defineProperty(t.prototype,"resetOfferSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Mo(this._logger,e);return this._resetSenderTransceiver(e,t),this._resetRecvTransceiver(t),t.stringify()}}),Object.defineProperty(t.prototype,"resetAnswerSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=new Mo(this._logger,e);for(var n in this._sendTransceiver){var i=this._sendTransceiver[n],o=i.mid;if(o){var a=this._localTracks[n],s=null==a?void 0:a.getBitrate(),c=null===(t=i.sender.track)||void 0===t?void 0:t.kind;c===Qe.AUDIO&&s&&r.setAudioBitrateWithMid(s,o),c===Qe.VIDEO&&s&&r.setVideoBitrateWithMid(s,o)}}return r.stringify()}}),t}(Do);!function(e){e.VP8="VP8",e.VP9="VP9",e.H264="H264"}(wo||(wo={}));var xo,Vo,Fo,Jo,Go=function(e){function t(t,r,n,i,o,a,s){void 0===a&&(a=!1),void 0===s&&(s=!1);var c=e.call(this)||this;Object.defineProperty(c,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(c,"_reTryExchange",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(c,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(c,"_store",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(c,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(c,"_isRoomAudience",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(c,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"reportParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"pubLocalTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(c,"_reTryExchangeTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_reportStatsTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_reportR3R4ToPolarisTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_formatStatsData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_inRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_firstConnectFromPub",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null});var u=Do.getSdpSemantics(),l="unified-plan"===u&&s&&"function"==typeof RTCRtpSender.prototype.createEncodedStreams&&"function"==typeof RTCRtpReceiver.prototype.createEncodedStreams&&Lo.isInit(),_=c._rtcPeerConn=new RTCPeerConnection({sdpSemantics:u,encodedInsertableStreams:l});return c._sdpStrategy="plan-b"===u?new ko(c._logger,_,!1):new Bo(c._logger,_,l),c._rtcPeerConn.oniceconnectionstatechange=c._onICEConnectionStateChange.bind(c),c._rtcPeerConn.onconnectionstatechange=c._onConnectionStateChange.bind(c),c._rtcPeerConn.ontrack=c._onTrackReady.bind(c),c.reportParser=c._sdpStrategy.getStatParsr(c._rtcPeerConn,u,c._currentUserId,c._store),c}return E(t,e),Object.defineProperty(t.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.values(this.pubLocalTracks)}}),Object.defineProperty(t.prototype,"_onConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._logger.info(S.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S,"state: ".concat(this._rtcPeerConn.connectionState))}}),Object.defineProperty(t.prototype,"startAutoExecute",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.stopAutoExecute(),this._reportStatsTimer=setTimeout((function(){t._reportHandle(),t.startAutoExecute(e)}),e)}}),Object.defineProperty(t.prototype,"stopAutoExecute",{enumerable:!1,configurable:!0,writable:!0,value:function(){clearTimeout(this._reportStatsTimer)}}),Object.defineProperty(t.prototype,"_onICEConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r;return C(this,void 0,void 0,(function(){var n,i,o;return L(this,(function(a){switch(a.label){case 0:return n=this._rtcPeerConn.iceConnectionState,this._logger.info(S.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S,JSON.stringify({iceConnectionState:n})),[4,this._getStatsData()];case 1:i=a.sent(),o=i?this._createRCRTCStateReport(i).iceCandidatePair:null,this.emit(t.__INNER_ICE_STATE_CHANGE__,{status:n,time:Date.now(),iceCandidatePair:o}),"connected"===n?(this.emit(t.__INNER_ICE_CONNECTED__,this._firstConnectFromPub),this.startAutoExecute(1e3)):"failed"!==n&&"disconnected"!==n||this._handleRetry();try{null===(r=null===(e=this._reportListener)||void 0===e?void 0:e.onICEConnectionStateChange)||void 0===r||r.call(e,n)}catch(e){this._logger.error(S.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R,JSON.stringify({status:T.FAILED,mag:e}))}return[2]}}))}))}}),Object.defineProperty(t.prototype,"_handleRetry",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t=this;return L(this,(function(r){switch(r.label){case 0:return this._inRetry?[2]:(this.clearReTryExchangeTimer(),this._inRetry=!0,[4,this._reTryExchange()]);case 1:return e=r.sent().code,this._inRetry=!1,e===I.SUCCESS?[2]:(this._reTryExchangeTimer=setTimeout((function(){return t._handleRetry()}),15e3),[2])}}))}))}}),Object.defineProperty(t.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.streams.length){var r=e.streams[0].id,n=e.receiver.track,i=[r,"audio"===n.kind?ze.AUDIO_ONLY:ze.VIDEO_ONLY].join("_");Object.defineProperty(n,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}),this._updateRecvTransceiverMap(i,e.transceiver),this.emit(t.__INNER_EVENT_TRACK_READY__,e)}}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){return L(this,(function(n){return this._sdpStrategy.setBitrate(e,t,r),this._logger.info(S.L_RTC_PEER_CONNECTION_SET_BITRATE_O,JSON.stringify({status:T.SUCCESSED,max:e,min:t,start:r})),[2]}))}))}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return L(this,(function(r){switch(r.label){case 0:return[4,this._sdpStrategy.createOffer(e)];case 1:return t=r.sent(),this._logger.info(S.L_RTC_PEER_CONNECTION_CREATE_OFFER_O,JSON.stringify({offerSDP:t.sdp,sdpDemantics:t.semantics})),[2,t]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return void 0===t&&(t=!1),C(this,void 0,void 0,(function(){return L(this,(function(n){return Ao.parsePayloadTypes(null===(r=this._rtcPeerConn.localDescription)||void 0===r?void 0:r.sdp),this._firstConnectFromPub=t,[2,this._sdpStrategy.setRemoteAnswer(e)]}))}))}}),Object.defineProperty(t.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.pubLocalTracks[e]||null}}),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(_t.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(_t.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(_t.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(_t.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),this._logger.info(S.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O,"trackId: ".concat(e.getTrackId()))}}),Object.defineProperty(t.prototype,"removeLocalTrackById",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getLocalTrack(e);t?(this._logger.info(S.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:T.SUCCESSED,trackId:e})),this.removeLocalTrack(t)):this._logger.warn(S.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:T.FAILED,msg:"track not found",trackId:e}))}}),Object.defineProperty(t.prototype,"removeAllLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Object.keys(this.pubLocalTracks).forEach((function(t){/_tiny$/.test(t)||e.removeLocalTrackById(t)}))}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.getTrackId();delete this.pubLocalTracks[t],this._sdpStrategy.removeLocalTrack(e),e.__innerSetPublished(!1),e.off(_t.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(_t.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);var r="".concat(t,"_tiny"),n=this.getLocalTrack(r);n&&(this._sdpStrategy.removeLocalTrack(n),delete this.pubLocalTracks[r],n.destroy()),this._logger.info(S.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O,JSON.stringify({trackId:t}))}}),Object.defineProperty(t.prototype,"_updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._sdpStrategy.updateSubRemoteTracks(e)}}),Object.defineProperty(t.prototype,"getOutboundVideoInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sdpStrategy.getOutboundVideoInfo()}}),Object.defineProperty(t.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));r&&(r.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(_t.__INNER_EVENT_MUTED_CHANGE__,e,t)}}),Object.defineProperty(t.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.emit(_t.__INNER_EVENT_DESTROY__,e)}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(t.prototype,"_createSenderReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.filter((function(e){return e.trackId})).map((function(e){var t={trackId:e.trackId,kind:e.kind,packetsLostRate:e.packetsLostRate,remoteResource:e.remoteResource,bitrate:e.bitrate,jitter:e.jitter,rtt:e.rtt};return(e.audioLevel||0===e.audioLevel)&&(t.audioLevel=e.audioLevel),e.frameWidth&&(t.frameWidth=e.frameWidth),e.frameHeight&&(t.frameHeight=e.frameHeight),e.frameRate&&(t.frameRate=e.frameRate),y({},t)}))}}),Object.defineProperty(t.prototype,"_createReceiverReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.filter((function(e){return e.trackId})).map((function(e){var t={trackId:e.trackId,kind:e.kind,packetsLostRate:e.packetsLostRate,remoteResource:e.remoteResource,bitrate:e.bitrate,jitter:e.jitter,rtt:e.rtt};return(e.audioLevel||0===e.audioLevel)&&(t.audioLevel=e.audioLevel),e.frameWidth&&(t.frameWidth=e.frameWidth),e.frameHeight&&(t.frameHeight=e.frameHeight),e.frameRate&&(t.frameRate=e.frameRate),y({},t)}))}}),Object.defineProperty(t.prototype,"_createRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.timestamp,r=e.iceCandidatePair,n=e.senders,i=e.receivers;for(var o in(null==r?void 0:r.totalPacketsLost)&&(null==r||delete r.totalPacketsLost),r)Kt(r[o])&&delete r[o];return{timestamp:t,iceCandidatePair:r,senders:this._createSenderReport(n),receivers:this._createReceiverReport(i)}}}),Object.defineProperty(t.prototype,"_getStatsData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return C(this,void 0,void 0,(function(){var r,n,i;return L(this,(function(o){switch(o.label){case 0:return this._formatStatsData=null,r=null,[4,this._rtcPeerConn.getStats()];case 1:return n=o.sent(),r=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(n),i=null===(t=this.reportParser)||void 0===t?void 0:t.formatRCRTCStateReport(r),this._formatStatsData=i,[2,i]}}))}))}}),Object.defineProperty(t.prototype,"_reportHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r,n,i,o;return C(this,void 0,void 0,(function(){var a,s,c,u;return L(this,(function(l){switch(l.label){case 0:return[4,this._getStatsData()];case 1:if(!(a=l.sent()))return[2];s=this._createRCRTCStateReport(a);try{null===(r=null===(e=this._reportListener)||void 0===e?void 0:e.onStateReport)||void 0===r||r.call(e,JSON.parse(JSON.stringify(s)))}catch(e){this._logger.error(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}if(c=A(A([],N(a.receivers),!1),N(a.senders),!1).filter((function(e){return"audio"===e.kind})).map((function(e){return{trackId:e.trackId,audioLevel:e.audioLevel}})),this.emit(t.__INNER_AUDIOLEVEL_CHANGE__,c),this._isRoomAudience&&(null===(n=this._reportListener)||void 0===n?void 0:n.onReportLiveAudioStates)){u=this._getLiveAudioState();try{u.length&&(null===(o=null===(i=this._reportListener)||void 0===i?void 0:i.onReportLiveAudioStates)||void 0===o||o.call(i,u))}catch(e){this._logger.error(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}return[2]}}))}))}}),Object.defineProperty(t.prototype,"_getLiveAudioState",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this._rtcPeerConn.getReceivers().forEach((function(e){var r=e.getContributingSources();r.length&&t.push.apply(t,A([],N(r),!1))})),t.map((function(t){var r=t.source,n=t.audioLevel,i=e._store.getTrackIdBySSRC(r);if(!i)return{};var o=At(i).userId;return{audioLevel:vo(n),userId:o,trackId:i}})).filter((function(e){return!!e.userId}))}}),Object.defineProperty(t.prototype,"_sendR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return C(this,void 0,void 0,(function(){var r,n,i;return L(this,(function(o){switch(o.label){case 0:return(r=this._formatStatsData)?(n=r.senders,i=r.receivers,n.length?[4,null===(e=this._polarisReport)||void 0===e?void 0:e.sendR3Data(r)]:[3,2]):[2];case 1:o.sent(),o.label=2;case 2:return i.length?[4,null===(t=this._polarisReport)||void 0===t?void 0:t.sendR4Data(r)]:[3,4];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))}}),Object.defineProperty(t.prototype,"__reportR3R4ToPolaris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e=this;return L(this,(function(t){return clearTimeout(this._reportR3R4ToPolarisTimer),this._reportR3R4ToPolarisTimer=setTimeout((function(){return C(e,void 0,void 0,(function(){var e=this;return L(this,(function(t){return this._sendR3R4Data().then((function(){e.__reportR3R4ToPolaris()})),[2]}))}))}),2e3),[2]}))}))}}),Object.defineProperty(t.prototype,"getRTCPeerConn",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rtcPeerConn}}),Object.defineProperty(t.prototype,"getCapabilitiesCodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;void 0===e&&(e=wo.H264);var r=null===(t=RTCRtpSender.getCapabilities("video"))||void 0===t?void 0:t.codecs,n=null;switch(e){case wo.VP8:case wo.VP9:n=r.find((function(t){return t.mimeType.match(e)}));break;case wo.H264:n=r.find((function(t){var r;return t.mimeType.match(e)&&(null===(r=t.sdpFmtpLine)||void 0===r?void 0:r.match("42e01f"))}))}return r=r.filter((function(e){return e!==n})),r=A([n],N(r),!1)}}),Object.defineProperty(t.prototype,"setEncoderPreferences",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r;return L(this,(function(n){return t=this.getRTCPeerConn(),r=this.getCapabilitiesCodes(e),this._logger.info(S.L_SET_ENCODER_PREFERENCES_S,JSON.stringify({status:T.SUCCESSED,codecCap:r})),t.getTransceivers().forEach((function(e){var t;"video"===(null===(t=e.sender.track)||void 0===t?void 0:t.kind)&&e.setCodecPreferences(r)})),[2]}))}))}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.clear(),this.clearReTryExchangeTimer(),clearTimeout(this._reportR3R4ToPolarisTimer),this.stopAutoExecute(),this.registerReportListener(null),this._rtcPeerConn.close(),this._isDestroyed=!0,this.reportParser=null,this._logger.info(S.L_RTC_PEER_CONNECTION_DESTROY_O,JSON.stringify({status:T.SUCCESSED}))}}),Object.defineProperty(t.prototype,"clearReTryExchangeTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){clearTimeout(this._reTryExchangeTimer),this._reTryExchangeTimer=null}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(t,"__INNER_EVENT_TRACK_READY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-track-ready"}),Object.defineProperty(t,"__INNER_AUDIOLEVEL_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-audio-level-change"}),Object.defineProperty(t,"__INNER_ICE_STATE_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-state-change"}),Object.defineProperty(t,"__INNER_ICE_CONNECTED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-connected"}),t}(t),Ho=function(){function e(e,t){Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_audioLevelChangeHandler",{enumerable:!0,configurable:!0,writable:!0,value:null})}return Object.defineProperty(e.prototype,"audioLevelReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;if(this._audioLevelChangeHandler){var r=[];e.forEach((function(e){var n=At(e.trackId).userId,i=t._store.crtUserId===n?t._peer.getLocalTrack(e.trackId):t._store.getRemoteTrack(e.trackId);i&&r.push({track:i,audioLevel:e.audioLevel||0})})),this._audioLevelChangeHandler(r)}}}),Object.defineProperty(e.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._audioLevelChangeHandler=e}}),e}();!function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(xo||(xo={})),function(e){e.UNPUBLISH_PREV="UnpublishPrevCommand",e.PULL_RTCROOM_STATUS="PullRTCRoomStatusCommand",e.JOINROOM="JoinRoomCommand",e.PARSE_REMOTERES="ParseRemoteResCommand",e.PARSE_USERSTATE="ParseUserStateCommand",e.LOCAL_TRACK_MUTE="LocalTrackMuteCommand",e.PUBLISH="PublishCommand",e.RETRY_EXCHANGE="RetryExchangeCommand",e.UNPUBLISH="UnpublishCommand",e.SUBSCRIBE="SubscribeCommand",e.UNSUBSCRIBE="UnsubscribeCommand",e.UPDATE_SUBSCRIBE_LIST="UpdateSubscribeListCommand",e.ON_SIGNAL_RECONNECTED="OnSignalReconnectedCommand",e.LEAVE_OTHER_ROOM="LeaveOtherRoomCommand",e.RTC_IDENTITY_CHANGE="RTCIdentityChangeCommand",e.ENABLE_INNER_CDN="EnableInnerCDNCommand",e.EXCHANGE_WITH_PUSH_OTHER_ROOM="ExchangeWithPushOtherRoomCommand",e.MCUCONFIG_FLUSH="MCUConfigFlushCommand",e.UNKNOWN="Unknown"}(Vo||(Vo={})),function(e){e[e.LOW=0]="LOW",e[e.NORMAL=1]="NORMAL",e[e.HIGH=2]="HIGH"}(Fo||(Fo={})),function(e){e[e.Destroy=40400]="Destroy"}(Jo||(Jo={}));var Ko,Wo=function(){function e(){}return Object.defineProperty(e.prototype,"priority",{get:function(){return Fo.LOW},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kind",{get:function(){return Vo.UNKNOWN},enumerable:!1,configurable:!0}),e}(),Yo=function(){function e(e,t,r,n){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"abortCode",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_busy",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1})}return Object.defineProperty(e.prototype,"_next",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._busy=!1,this._execute()}}),Object.defineProperty(e.prototype,"_execute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t,r,n,o,a,s;return L(this,(function(c){switch(c.label){case 0:if(this._isDestroyed||this._busy||0===this._queue.length)return[2];this._busy=!0,e=this._queue.shift(),t=e.command,r=e.resolve,o=this._logger.createTraceId(),c.label=1;case 1:return c.trys.push([1,3,,4]),this._logger.info(S.L_INVOKER_EXECUTE_T,"kind: ".concat(t.kind,", length: ").concat(this._queue.length),o),[4,t.execute(this._context,this._store,this)];case 2:return n=c.sent(),[3,4];case 3:return a=c.sent(),console.error(a),this._logger.error(S.L_INVOKER_EXECUTE_R,t.kind,o),this._next(),[2];case 4:return(s=n.code)!==I.SUCCESS&&s!==i.SUCCESS?this._logger.warn(S.L_INVOKER_EXECUTE_R,"code: ".concat(s,", kind: ").concat(t.kind),o):this._logger.info(S.L_INVOKER_EXECUTE_R,"kind: ".concat(t.kind,", Done"),o),r(n),this._next(),[2]}}))}))}}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t=this;return L(this,(function(r){return[2,new Promise((function(r){if(t._logger.info(S.L_INVOKER_PUSH_O,JSON.stringify({isDestroyed:t._isDestroyed,kind:e.kind,length:t._queue.length})),t._isDestroyed)r({code:I.NOT_IN_ROOM});else{var n=e.priority;if(n===Fo.LOW)t._queue.push({command:e,resolve:r});else{var i=t._queue.findIndex((function(e){return e.command.priority<n})),o=-1===i?t._queue.length-1:i;t._queue.splice(o,0,{command:e,resolve:r})}setTimeout((function(){t._execute()}),0)}}))]}))}))}}),Object.defineProperty(e.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(e.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._isDestroyed||(this._logger.info(S.L_INVOKER_DESTROY_O),this._isDestroyed=!0,this._queue.forEach((function(t){t.resolve({code:e.abortCode})})),this._queue.length=0)}}),e}(),zo=function(e){function t(t,r){return e.call(this,t.logger,t,r,I.ROOM_HAS_BEEN_DESTROYED)||this}return E(t,e),Object.defineProperty(t.prototype,"store",{get:function(){return this._context.store},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype.destroy.call(this),this._store.removeRemoteTracks()}}),t}(Yo),qo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E(t,e),Object.defineProperty(t.prototype,"_updateTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Object.values(this._roomResources).forEach((function(t){t.forEach((function(t){var r=JSON.parse(t.uri),n=r.ssrc,i=r.resourceId;e._trackIdSSRCMap.set(n,i)}))}))}}),Object.defineProperty(t.prototype,"setTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._trackIdSSRCMap.set(e,t)}}),Object.defineProperty(t.prototype,"_initRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;for(var t in this._roomResources){var r=this._roomResources[t];t!==this.crtUserId&&0!==r.length&&r.forEach((function(t){var r=Nt(t),n=At(r),i=n.tag,o=n.userId,a=n.mediaType===ze.AUDIO_ONLY?new Et(e._logger,i,o):new It(e._logger,i,o);a.__innerSetRemoteMuted(0===t.state),e._remoteTracks[r]=a}))}}}),Object.defineProperty(t.prototype,"initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._sessionId=e.sessionId,this._token=e.token,this._roomStatusVersion=zt(e.version),this._roomResources=Wt(e,this.roomId,this._logger,t),this._updateTrackIdSSRCMap(),this._initRemoteTracks(),this.setResourcesByUserId(this.crtUserId,this.getResourcesByUserId(this.crtUserId)||[]),this._logger.info(S.L_PARSE_ROOMDATA_URIS_R,"room data -> ".concat(JSON.stringify(this._roomResources)),t)}}),Object.defineProperty(t.prototype,"assignRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){Object.assign(this._roomResources,e),this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"setResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._roomResources[e]=t,this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"removeRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){delete this._remoteTracks[e]}}),Object.defineProperty(t.prototype,"removeResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){delete this._roomResources[e],this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"addRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._remoteTracks[e.getTrackId()]=e}}),Object.defineProperty(t.prototype,"removeRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._remoteTracks);e.length&&(e.forEach((function(e){e.isAudioTrack()&&e.__releaseMediaElement()})),this._remoteTracks={})}}),Object.defineProperty(t.prototype,"setCDNEnabel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._CDNEnable=e}}),Object.defineProperty(t.prototype,"setCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._CDNUris=e}}),Object.defineProperty(t.prototype,"resetSubscribedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(t=this._subscribedList).splice.apply(t,A([0,this._subscribedList.length],N(e),!1)),this.resetCollectSubscribeList(e)}}),Object.defineProperty(t.prototype,"resetCollectSubscribeList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(t=this._collectSubscribeList).splice.apply(t,A([0,this._collectSubscribeList.length],N(e),!1))}}),Object.defineProperty(t.prototype,"setRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._roomStatusVersion=zt(e)}}),t}(function(){function e(e,t,r,n,i,o,a,s){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"roomMode",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"isUpgrade",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"isMainRoom",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_roomResources",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_collectSubscribeList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_token",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_CDNUris",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_CDNEnable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_trackIdSSRCMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_roomStatusVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_supportNtf",{enumerable:!0,configurable:!0,writable:!0,value:!0})}return Object.defineProperty(e.prototype,"getResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._roomResources[e]}}),Object.defineProperty(e.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._remoteTracks[e]}}),Object.defineProperty(e.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];for(var r in this._remoteTracks){var n=this._remoteTracks[r];n.getUserId()===e&&t.push(n)}return t}}),Object.defineProperty(e.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteTracks}}),Object.defineProperty(e.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(e.prototype,"getAllUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.keys(this._roomResources)}}),Object.defineProperty(e.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this.getAllUserIds().filter((function(t){return t!==e.crtUserId}))}}),Object.defineProperty(e.prototype,"getSubscribedList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subscribedList}}),Object.defineProperty(e.prototype,"getCollectSubscribeList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._collectSubscribeList}}),Object.defineProperty(e.prototype,"getPublishedResourceByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=At(e).userId;return this._roomResources[t].find((function(t){return Nt(t)===e}))}}),Object.defineProperty(e.prototype,"getToken",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._token}}),Object.defineProperty(e.prototype,"getCDNEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._CDNEnable}}),Object.defineProperty(e.prototype,"getCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._CDNUris}}),Object.defineProperty(e.prototype,"getRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomStatusVersion}}),Object.defineProperty(e.prototype,"getTrackIdBySSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._trackIdSSRCMap.get(e)}}),Object.defineProperty(e.prototype,"getRTCRequestHeader",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{"App-Key":this.appkey,RoomId:this.roomId,Token:this._token,RoomType:this.roomMode,UserId:this.crtUserId,"Client-Session-Id":this.clientSessionId}}}),Object.defineProperty(e.prototype,"getSupportNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._supportNtf}}),e}()),Qo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.UNPUBLISH_PREV},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,o,a,s,c;return L(this,(function(u){switch(u.label){case 0:return r=e.logger,n=e.context,o=t.getResourcesByUserId(t.crtUserId),a=o.slice(),o.length=0,s=r.createTraceId(),r.info(S.L_UNPUBLISH_PREV_COMMAND_T,JSON.stringify({resource:a}),s),[4,n.setRTCTotalRes(t.roomId,[St(Gt.UNPUBLISH,a)],Tt([]),Gt.TOTAL_CONTENT_RESOURCE,Tt([]))];case 1:return(c=u.sent())!==i.SUCCESS?r.error(S.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:T.FAILED,code:c}),s):r.info(S.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:T.SUCCESSED}),s),[2,{code:I.SUCCESS}]}}))}))}}),t}(Wo);!function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL"}(Ko||(Ko={}));var Zo,Xo=function(e){function t(t,r,n,i,o,a,s){var c=e.call(this)||this;return Object.defineProperty(c,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(c,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(c,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(c,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(c,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(c,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(c,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:s}),c}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.JOINROOM},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_getResultTag",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=S.L_RTC_CLIENT_JOIN_RTC_ROOM_R;return this.roomType===Ko.LIVE&&(e=S.L_RTC_CLIENT_JOIN_LIVING_ROOM_R),e}}),Object.defineProperty(t.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){var o=this;if(e.getConnectionStatus()!==u.CONNECTED)return t.error(i,JSON.stringify({status:T.FAILED,code:I.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:I.SIGNAL_DISCONNECTED};if(e.getNaviInfo(),!r("roomId",this.roomId,l,!0))return t.error(i,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:I.PARAMS_ERROR};if(!r("roomType",this.roomType,(function(e){return void 0!==Ko[e]})))return t.error(i,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:I.PARAMS_ERROR};if(!r("outerUserDatas",this.outerUserDatas,n,!1))return t.error(i,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:I.PARAMS_ERROR};if(this.outerUserDatas&&!Object.keys(this.outerUserDatas).every((function(e){return r("outerUserDatas.".concat(e),o.outerUserDatas[e],_,!0)})))return t.error(i,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:I.PARAMS_ERROR};return{code:I.SUCCESS}}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;return C(this,void 0,void 0,(function(){var o,a,s,c,u,l,_,d,f,p,h,b,g;return L(this,(function(m){switch(m.label){case 0:return o=Date.now(),a=e.context,s=e.service,c=e.logger,u=e.reportMediaActionLogger,l=this._getResultTag(),(_=this._validateParams(a,c,l).code)!==I.SUCCESS?[2,{code:_}]:(s.detectorMediaSever(),s.getNaviMS().length?(d=t.getSupportNtf(),[4,a.joinRTCRoom(this.roomId,this.roomType,this.livingType,this.joinType,this.innerUserDatas,this.outerUserDatas,d)]):(c.error(l,JSON.stringify({status:T.FAILED,code:I.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),[2,{code:I.NOT_OPEN_VIDEO_AUDIO_SERVER}]));case 1:return f=m.sent(),p=f.code,h=f.data,u.reportQualityJoinRoomData(o,p,this.roomType,null==h?void 0:h.sessionId),p===i.SUCCESS&&h?(t.initWithRoomData(h,this.traceId),t.getResourcesByUserId(t.crtUserId).length>0&&r.push(new Qo),(g=null===(n=h.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value)&&t.setCDNUris(JSON.parse(g)[0]),c.info(l,JSON.stringify({status:T.SUCCESSED,userId:t.crtUserId,roomId:this.roomId}),this.traceId),[2,{code:I.SUCCESS,data:h}]):(b=40032===p?I.SIGNAL_JOIN_RTC_ROOM_REFUSED:p,c.error(l,JSON.stringify({status:T.FAILED,code:b,msg:"joinRoom failed"}),this.traceId),[2,{code:b}])}}))}))}}),t}(Wo);!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(Zo||(Zo={}));var $o,ea,ta,ra="PEER_CONNECTION_CLOSED_BY_EXCEPTION",na="USER_JOIN",ia="USER_LEAVE",oa="TRACKS_PUBLISH",aa="TRACKS_UNPUBLISH",sa="AUDIO_MUTE_CHANGE",ca="VIDEO_MUTE_CHANGE",ua="CDN_ENABLE_CHANGE",la="USER_STATE_CHANGE",_a=function(e){function t(t,r,n,i,o,a,s,c){var u=e.call(this)||this;return Object.defineProperty(u,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"service",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(u,"context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"peer",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"store",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"getPushOtherRooms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),u}return E(t,e),t}(t);!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}($o||($o={})),function(e){e.BEGIN="begin",e.END="end"}(ea||(ea={})),function(e){e[e.SPREAD=0]="SPREAD",e[e.NO_SPREAD=-1]="NO_SPREAD"}(ta||(ta={}));var da,fa=function(e){function t(t,r,n){var i=e.call(this)||this;return Object.defineProperty(i,"reqBody",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"isNeedUpdateMsas",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return E(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;return C(this,void 0,void 0,(function(){var r,i,o,a,s,c,u,l,_,d;return L(this,(function(f){switch(f.label){case 0:return r=e.service,i=e.context,[4,r.exchange(t.getRTCRequestHeader(),this.reqBody,this.traceId,this.isNeedUpdateMsas)];case 1:return o=f.sent(),a=o.code,s=o.data,c=o.qualityMsList,u={code:a,data:{data:s,qualityMsList:c}},l=null===(n=null==s?void 0:s.urls)||void 0===n?void 0:n.pull_url,t.roomMode===Ko.LIVE&&l&&(_=JSON.parse(l),t.setCDNUris(_),(null==_?void 0:_.broadcast)===ta.SPREAD&&(t.setCDNEnabel(!0),d=y(y({},_),{enableInnerCDN:!0}),va(i,t.roomId,d))),[2,u]}}))}))}}),t}(Wo);!function(e){e.PUB="pub",e.UNPUB="unpub",e.SUB="sub",e.UNSUB="unsub"}(da||(da={}));var pa=function(e){function t(t,r,n,i,o){void 0===i&&(i=da.SUB);var a=e.call(this)||this;return Object.defineProperty(a,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"fromCommand",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"unsubTracks",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(a,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),a}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.UPDATE_SUBSCRIBE_LIST},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_dealSubscribeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=null==n?void 0:n.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),o=r.filter((function(e){return null==i?void 0:i.includes(e.track.getTrackId())})),a=r.filter((function(e){return!(null==i?void 0:i.includes(e.track.getTrackId()))}));t.info(S.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:T.SUCCESSED,subSuccessTrackIds:i,failedList:a}),this.traceId);var s=e.getRemoteTracks(),c=function(e){var t=o.some((function(t){return t.track.getTrackId()===e}));s[e].__innerSetSubscribed(t);var r=o.some((function(t){return t.track.getTrackId()===e&&t.subTiny}));s[e].isVideoTrack()&&s[e].__innerSetIsTinyTrack(r)};for(var u in s)c(u);return e.resetSubscribedList(o),a}}),Object.defineProperty(t.prototype,"_getParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this,i=r.map((function(e){return e instanceof Ot?{track:e}:y({},e)})),o={};return i=i.filter((function(r){var i=r.track.getTrackId();return e.getRemoteTrack(i)?!o[i]&&(o[i]=!0,!0):(t.warn(S.L_UPDATE_SUBSCRIBELIST_COMMAND_P,"track cannot found in room -> trackId: ".concat(i),n.traceId),!1)})).map((function(e){return y({},e)}))}}),Object.defineProperty(t.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return r("tracks",t,(function(){return o(t)&&t.every((function(e){return e instanceof Ot||e.track instanceof Ot}))}),!0)?{code:I.SUCCESS}:(e.warn(S.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"tracks is invalid"}),this.traceId),{code:I.PARAMS_ERROR})}}),Object.defineProperty(t.prototype,"_reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){(null==r?void 0:r.length)&&e.reportPubOrSubQualityData(this.fromCommand,this._actionStartTime,r,t,this._trackMediaMap)}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,l,_,d,f,p,h,b,g,m,v,R,O,E,C,P=this;return L(this,(function(L){switch(L.label){case 0:if(n=e.logger,i=e.peer,o=e.reportMediaActionLogger,this._actionStartTime=Date.now(),s=(a=this).tracks,c=a.forceReq,u=t.roomId,n.info(S.L_UPDATE_SUBSCRIBELIST_COMMAND_T,"roomId: ".concat(u,", forceReq: ").concat(c,", trackIds: ").concat(s.map(Yt)),this.traceId),(l=this._validateParams(n,s).code)!==I.SUCCESS)return[2,{code:l}];if(_=this._getParams(t,n,s),d=t.getSubscribedList().map((function(e){return y({},e)})),!c){if(!ya(_,d))return n.warn(S.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:T.SUCCESSED,msg:"subscribe list unchanged"}),this.traceId),[2,{code:I.SUCCESS}];d.length&&(f=d.map((function(e){return e.track})),n.warn(S.L_CLEAR_UNSUBSCRIBE_LIST_O,JSON.stringify({list:f.map((function(e){return e.getTrackId()}))}),this.traceId),p=t.getSubscribedList().filter((function(e){return f.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),t.resetSubscribedList(p))}return i.__reportR3R4ToPolaris(),i.clearReTryExchangeTimer(),i.updateSubRemoteTracks(_.map((function(e){return e.track}))),[4,ga(_,!1,e)];case 1:return(h=L.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new fa(h,this.traceId,!0).execute(e,t,r)];case 2:return b=L.sent(),s.forEach((function(e){var t=e instanceof Ot?e.getTrackId():e.track.getTrackId();P._trackMediaMap[t]=b.data.qualityMsList||[]})),g=this.fromCommand===da.SUB?s:this.unsubTracks,b.code!==I.SUCCESS?(this._reportPubOrSubQualityData(o,b.code,g),n.error(S.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:T.FAILED,code:b.code}),this.traceId),[2,{code:b.code}]):(m=b.data.data,v=m.sdp,R=m.resultCode,O=m.subscribedList,R!==I.SUCCESS?(this._reportPubOrSubQualityData(o,R,g),n.error(S.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:T.FAILED,code:R}),this.traceId),[2,{code:R}]):(o.setPubOrSubSuccessTime(Date.now()),[4,i.setRemoteAnswer(v.sdp)]));case 3:return E=L.sent(),this._reportPubOrSubQualityData(o,E,g),E!==I.SUCCESS?[2,{code:E}]:[2,(C=this._dealSubscribeResult(t,n,_,O)).length?{code:I.SUCCESS,data:C}:{code:I.SUCCESS}]}}))}))}}),t}(Wo),ha=function(e){function t(t,r){var n=e.call(this)||this;return Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.UNSUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return C(this,void 0,void 0,(function(){var i,a,s,c;return L(this,(function(u){return i=e.logger,a=e.polarisReport,s=this.tracks,r("tracks",s,(function(){return o(s)&&s.length>0&&s.every((function(e){return e instanceof Ot}))}),!0)?(i.info(S.L_ABSTRACT_ROOM_UNSUBSCRIBE_T,JSON.stringify({unSubscribeTrackIds:s.map(Yt)}),this.traceId),c=t.getSubscribedList().map((function(e){return y({},e)})).filter((function(e){return s.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),a.sendR2($o.SUBSCRIBE,ea.END,s.map((function(e){return e.getTrackId()}))),[2,new pa(c,!1,this.traceId,da.UNSUB,this.tracks).execute(e,t,n)]):(i.warn(S.L_ABSTRACT_ROOM_UNSUBSCRIBE_E,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:I.PARAMS_ERROR}])}))}))}}),t}(Wo),ba=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return E(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o;return L(this,(function(a){switch(a.label){case 0:return n=e.logger,i=this.tracks,o=n.createTraceId(),n.info(S.L_USER_LEFT_UNSUBSCRIBE_O,void 0,o),[4,new ha(i,o).execute(e,t,r)];case 1:return a.sent(),i.forEach((function(e){e.__innerDestroy(),t.removeRemoteTrack(e.getTrackId())})),e.emit(aa,i),[2,{code:I.SUCCESS}]}}))}))}}),t}(Wo);function ga(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a;return L(this,(function(s){switch(s.label){case 0:return n=r.peer,i=r.store,o=r.service,[4,n.createOffer(t)];case 1:return a=s.sent(),[2,{sdp:a,extend:JSON.stringify({customParams:o.getCustomExtendInfo(),resolutionInfo:n.getOutboundVideoInfo()}),subscribeList:e.filter((function(e){var t=e.track.getTrackId(),r=At(t).userId,n=i.getResourcesByUserId(r);if(!n)return!1;var o=n.filter((function(e){return t==="".concat(e.msid,"_").concat(e.mediaType)})).length;return o})).map((function(e){return{simulcast:e.subTiny?co.TINY:co.NORMAL,resolution:"",uri:i.getPublishedResourceByTrackId(e.track.getTrackId()).uri}})),switchstream:!1}]}}))}))}function ma(e,t,r){return C(this,void 0,void 0,(function(){var n,o;return L(this,(function(a){switch(a.label){case 0:return n=e.logger.createTraceId(),e.logger.info(S.L_LIVING_ROOM_SPREAD_CDN_INFO_T,JSON.stringify({CDNUris:r}),n),[4,e.setRTCCDNUris(t,Gt.TOTAL_CONTENT_RESOURCE,JSON.stringify([r]))];case 1:return(o=a.sent())!==i.SUCCESS?(e.logger.error(S.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(T.FAILED,", code: ").concat(o),n),[2,{code:I.SIGNAL_ERROR}]):(e.logger.info(S.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(T.SUCCESSED),n),[2,{code:I.SUCCESS}])}}))}))}function va(e,t,r){return C(this,void 0,void 0,(function(){var n,o;return L(this,(function(a){switch(a.label){case 0:return n=e.logger.createTraceId(),e.logger.info(S.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T,"CDNUris: ".concat(r),n),[4,e.setRTCData(t,"cdn_uris",JSON.stringify([r]),!0,Zo.ROOM)];case 1:return(o=a.sent())!==i.SUCCESS?(e.logger.error(S.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(T.FAILED,", code: ").concat(o),n),[2,{code:I.SIGNAL_ERROR}]):(e.logger.info(S.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(T.SUCCESSED),n),[2,{code:I.SUCCESS}])}}))}))}function Ra(e,t){return C(this,void 0,void 0,(function(){var r,n,i;return L(this,(function(o){switch(o.label){case 0:return r=t.roomId,n=Object.assign({},t.getCDNUris(),{enableInnerCDN:t.getCDNEnable()}),[4,Promise.all([ma(e,r,n),va(e,r,n)])];case 1:return i=o.sent(),[2,i.every((function(e){return e.code===I.SUCCESS}))?{code:I.SUCCESS}:{code:I.SIGNAL_ERROR}]}}))}))}var Oa=function(e,t,r,n){return C(void 0,void 0,void 0,(function(){var i,o,a,s,c,u,l;return L(this,(function(_){switch(_.label){case 0:for(a in i=e.crtUserId,o=[],n)o.push(a);s=0,_.label=1;case 1:return s<o.length?(c=o[s])===i?[3,3]:(u=n[c]).length?(l=u.map((function(t){return e.getRemoteTrack(Nt(t))})),[4,new ba(l).execute(t,e,r)]):[3,3]:[3,4];case 2:_.sent(),_.label=3;case 3:return s++,[3,1];case 4:return[2]}}))}))};function Ea(e,t,r,n,i,o){return C(this,void 0,void 0,(function(){var a,s,c,u,l,_,f,p,h,b,g,m,v,R,O,E,I,y,C;return L(this,(function(L){switch(L.label){case 0:for(a=r.logger,s=t.roomId,c=t.roomMode,u=[],l={},_={},f={},p=Wt(e,s,a,o),h=Object.keys(p),b=t.getAllUserIds(),g=h.length-1;g>=0;g-=1)m=h[g],-1!==(v=b.indexOf(m))?(R=t.getResourcesByUserId(m),O=p[m],E=Ut(R,O,!0),I=E.publishedList,y=E.modifiedList,C=E.unpublishedList,l[m]=Dt(I),_[m]=Dt(C),f[m]=Dt(y),b.splice(v,1)):(u.push(m),l[m]=Dt(p[m]));return b.length&&b.forEach((function(e){t.removeResourcesByUserId(e)})),t.assignRoomData(p),b.length?[4,Ia(b,r,t,n,o)]:[3,2];case 1:L.sent(),r.emit(ia,b),L.label=2;case 2:return u.length&&r.emit(na,u),[4,Oa(t,r,n,_)];case 3:return L.sent(),function(e,t,r){var n=t.logger;Object.keys(r).forEach((function(i){var o=r[i];if(0!==o.length){var a=o.map((function(t){var r=Nt(t),i=At(r),o=i.userId,a=i.tag,s=i.mediaType===ze.AUDIO_ONLY?new Et(n,a,o):new It(n,a,o);return e.addRemoteTrack(s),s.__innerSetRemoteMuted(0===t.state),s}));t.emit(oa,a)}}))}(t,r,l),function(e,t,r){Object.keys(r).forEach((function(n){r[n].forEach((function(r){var n=Nt(r),i=e.getRemoteTrack(n);i.__innerSetRemoteMuted(0===r.state),i.isAudioTrack()?t.emit(sa,i):t.emit(ca,i)}))}))}(t,r,f),c===d.LIVE&&function(e,t,r,n){var i;if(!n)return void r.warn(S.L_LIVING_ROOM_RECONNECTED_R,JSON.stringify({status:T.FAILED,code:"",msg:"cdn_uris not found"}));var o=JSON.parse(n),a=(null===(i=t.getCDNUris())||void 0===i?void 0:i.enableInnerCDN)!==o.enableInnerCDN;t.setCDNUris(o),a&&e.emit(ua,o.enableInnerCDN)}(r,t,a,i),[2]}}))}))}function Ia(e,t,r,n,i){return C(this,void 0,void 0,(function(){var o,a;return L(this,(function(s){switch(s.label){case 0:return o=[],a=[],e.forEach((function(e){o.push.apply(o,A([],N(r.getRemoteTracksByUserId(e)),!1)),a.push(e)})),o.length?[4,new ha(o,i).execute(t,r,n)]:[3,2];case 1:s.sent(),o.forEach((function(e){return r.removeRemoteTrack(e.getTrackId())})),s.label=2;case 2:return a.length&&a.forEach((function(e){return r.removeResourcesByUserId(e)})),[2]}}))}))}var Sa,Ta=function(e,t,r){var n=e.split("\r\nm"),i=r===ze.AUDIO_ONLY?"audio":"video",o=n.filter((function(e){return e.includes("=".concat(i))&&e.includes(t)}))[0],a=new RegExp("a=ssrc:(.*?) msid:".concat(t)),s=o.match(a);return s?s[1]:""},ya=function(e,t){var r=!1;return e.forEach((function(e){var n=t.findIndex((function(t){return t.track.getTrackId()===e.track.getTrackId()}));-1!==n?t.splice(n,1)[0].subTiny!==e.subTiny&&(r=!0):r=!0})),t.length&&(r=!0),r},Ca=function(e){function t(t,r){var n=e.call(this)||this;return Object.defineProperty(n,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.PARSE_USERSTATE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Fo.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isPKRoomUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n;try{for(var i=P(t),o=i.next();!o.done;o=i.next()){var a=o.value;if(a.extra&&a.extra.roomId!==e.roomId)return!0;if(1===Number(a.state)&&!e.getRemoteUserIds().includes(a.userId))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1}}),Object.defineProperty(t.prototype,"_dealAddUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=e.getResourcesByUserId(i);o||(n?r.upgrade.push(i):r.joined.push(i),t.info(S.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:i,msg:"user ".concat(n?"upgrade":"joined")}),this.traceId)),e.setResourcesByUserId(i,o||[])}}),Object.defineProperty(t.prototype,"_dealReduceUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){t.info(S.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:i,msg:"user ".concat(n?"downgrade":"left")}),this.traceId),n?r.downgrade.push(i):r.left.push(i)}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s=this;return L(this,(function(c){switch(c.label){case 0:return n=e.logger,i={joined:[],left:[],upgrade:[],downgrade:[]},0===(o=this.msgContent.users).length?[2,{code:I.SUCCESS,data:i}]:this._isPKRoomUser(t,o)?[2,{code:I.SUCCESS,data:i}]:(o.forEach((function(e){var r=e.userId;0===Number(e.state)?s._dealAddUser(t,n,i,e.switchRoleType,r):s._dealReduceUser(t,n,i,e.switchRoleType,r)})),(a=A(A([],N(i.left),!1),N(i.downgrade),!1)).length?[4,Ia(a,e,t,r,this.traceId)]:[3,2]);case 1:c.sent(),c.label=2;case 2:return[2,{code:I.SUCCESS,data:i}]}}))}))}}),t}(Wo),La=function(e){function t(t,r,n,i,o){var a=e.call(this)||this;return Object.defineProperty(a,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"senderId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"sentTime",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_publishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_unpublishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_modifiedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_nowResources",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.PARSE_REMOTERES},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Fo.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_dealPublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,l=this;return L(this,(function(_){switch(_.label){case 0:return n=e.logger,i=e.reportMediaActionLogger,o=this._nowResources.map(Nt),a=[],s=[],this._publishedList.forEach((function(e){var r=Nt(e),i=o.indexOf(r),c=At(r),u=c.userId,_=c.tag,d=c.mediaType;i>-1?l._nowResources[i]=e:l._nowResources.push(e);var f=t.getRemoteTrack(r);f?f.isSubscribed()&&a.push(f):(f=d===ze.AUDIO_ONLY?new Et(n,_,u):new It(n,_,u),t.addRemoteTrack(f),s.push(f)),f.__innerSetRemoteMuted(0===e.state)})),a.length?(c=a.map((function(e){return e.getTrackId()})),[4,new pa(a,!0,this.traceId).execute(e,t,r)]):[3,2];case 1:(u=_.sent().code)!==I.SUCCESS&&n.error(S.L_RESUB_REPUB_RES_R,JSON.stringify({status:T.FAILED,trackIds:c,code:u}),this.traceId),_.label=2;case 2:return e.emit(oa,s),i.reportQualityRecvPubMsgData(this.sentTime,this.senderId),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a;return L(this,(function(s){switch(s.label){case 0:for(n=this._unpublishedList.map(Nt),i=this._nowResources.length-1;i>=0;i-=1)o=this._nowResources[i],n.includes(Nt(o))&&this._nowResources.splice(i,1);return a=this._unpublishedList.map((function(e){var r=Nt(e);return t.getRemoteTrack(r)})),[4,new ba(a).execute(e,t,r)];case 1:return s.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealModifiedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l;return L(this,(function(_){r=this._nowResources.map(Nt);try{for(n=P(this._modifiedList),i=n.next();!i.done;i=n.next())o=i.value,a=Nt(o),s=r.indexOf(a),this._nowResources[s].state=o.state,(c=t.getRemoteTrack(a)).__innerSetRemoteMuted(0===o.state),c.isAudioTrack()?e.emit(sa,c):e.emit(ca,c)}catch(e){u={error:e}}finally{try{i&&!i.done&&(l=n.return)&&l.call(n)}finally{if(u)throw u.error}}return[2]}))}))}}),Object.defineProperty(t.prototype,"_updateCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i=this.msgContent.cdn_uris[0],o=(null===(r=t.getCDNUris())||void 0===r?void 0:r.enableInnerCDN)!==i.enableInnerCDN;t.setCDNUris(i),o&&e.emit(ua,!!(null===(n=t.getCDNUris())||void 0===n?void 0:n.enableInnerCDN))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,l,_,d;return L(this,(function(f){switch(f.label){case 0:if(n=this.msgContent.uris,this._publishedList=[],this._unpublishedList=[],this._modifiedList=[],o=this.senderId,a=this.messageType,!t.getRemoteUserIds().includes(o))return[2,{code:I.SUCCESS}];switch(this._nowResources=t.getResourcesByUserId(o)||[],a){case Gt.MODIFY:(s=this._modifiedList).push.apply(s,A([],N(n),!1));break;case Gt.PUBLISH:(c=this._publishedList).push.apply(c,A([],N(n),!1));break;case Gt.UNPUBLISH:(u=this._unpublishedList).push.apply(u,A([],N(n),!1));break;case Gt.TOTAL_CONTENT_RESOURCE:i=Ut(this._nowResources,n),(l=this._publishedList).push.apply(l,A([],N(i.publishedList),!1)),(_=this._unpublishedList).push.apply(_,A([],N(i.unpublishedList),!1)),(d=this._modifiedList).push.apply(d,A([],N(i.modifiedList),!1))}return this._publishedList.length?[4,this._dealPublishList(e,t,r)]:[3,2];case 1:f.sent(),f.label=2;case 2:return this._unpublishedList.length?[4,this._dealUnpublishList(e,t,r)]:[3,4];case 3:f.sent(),f.label=4;case 4:return this._modifiedList.length?[4,this._dealModifiedList(e,t)]:[3,6];case 5:f.sent(),f.label=6;case 6:return t.setResourcesByUserId(o,this._nowResources),t.roomMode!==Ko.LIVE?[2,{code:I.SUCCESS}]:this.msgContent.cdn_uris?(this._updateCDNUris(e,t),[2,{code:I.SUCCESS}]):[2,{code:I.SUCCESS}]}}))}))}}),t}(Wo),Pa=function(e){function t(t,r,n){var i=e.call(this)||this;return Object.defineProperty(i,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.SUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return C(this,void 0,void 0,(function(){var i,a,s,c,u,l,_,d,f;return L(this,(function(p){return i=e.logger,a=e.polarisReport,c=(s=this).tracks,u=s.forceReq,r("tracks",c,(function(){return o(c)&&c.length>0&&c.every((function(e){return e instanceof Ot||e.track instanceof Ot}))}),!0)?(i.info(S.L_ABSTRACT_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:c.map(Yt),forceReq:u}),this.traceId),l=t.getSubscribedList().map((function(e){return y({},e)})),_=c.map((function(e){return e instanceof Ot?{track:e}:e})),d=!1,f=[],_.forEach((function(e){var t=e.track.getTrackId();f.push(t);var r=l.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:l.push(e),d=!0)})),d||u?(a.sendR2($o.SUBSCRIBE,ea.BEGIN,f),[2,new pa(l,!0,this.traceId).execute(e,t,n)]):(i.warn(S.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:T.SUCCESSED,msg:"repeat subscribe"}),this.traceId),[2,{code:I.SUCCESS}])):(i.error(S.L_ABSTRACT_ROOM_SUBSCRIBE_E,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:I.PARAMS_ERROR}])}))}))}}),t}(Wo),Na=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(r,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),r}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.PUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_removePubFailedTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.forEach((function(e){var r=e instanceof _t?e:e.track;t.removeLocalTrackById(r.getTrackId())}))}}),Object.defineProperty(t.prototype,"_addLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l,_,d,f,p,h,b,g,m,v,R;return L(this,(function(O){switch(O.label){case 0:r=[],O.label=1;case 1:O.trys.push([1,10,11,12]),n=P(e),i=n.next(),O.label=2;case 2:if(i.done)return[3,9];if(o=i.value,s=(a=o instanceof _t?{pubTiny:!1,track:o}:o).track,c=a.pubTiny,!s.isVideoTrack())return[3,7];if(!c)return[3,7];u=void 0,O.label=3;case 3:return O.trys.push([3,5,,6]),u=s.__innerGetMediaStreamTrack().clone(),l=c.frameRate||We.FPS_15,_=c.resolution||Ye.W176_H144,d=Mt(_),f=d.width,p=d.height,h=xt(l),[4,u.applyConstraints({width:f,height:p,frameRate:h})];case 4:return O.sent(),[3,6];case 5:return b=O.sent(),null==u||u.stop(),this._logger.warn(S.L_ABSTRACT_ROOM_PUBLISH_E,"pubTiny failed -> id: ".concat(s.getTrackId(),", msg: ").concat(b.message),this._traceId),[3,9];case 6:return g=new ft(this._logger,s.getTag(),s.getUserId(),u,!0),r.push(g),t.addLocalTrack(g),[3,7];case 7:t.addLocalTrack(s),O.label=8;case 8:return i=n.next(),[3,2];case 9:return[3,12];case 10:return m=O.sent(),v={error:m},[3,12];case 11:try{i&&!i.done&&(R=n.return)&&R.call(n)}finally{if(v)throw v.error}return[7];case 12:return[2,r]}}))}))}}),Object.defineProperty(t.prototype,"__publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,_,d,f,p,h=this;return L(this,(function(b){switch(b.label){case 0:return i=e.peer,o=e.reportMediaActionLogger,t.roomId,a=[],r.forEach((function(e){var t=(e instanceof _t?{track:e}:e).track;a.push(t)})),r.sort((function(e,t){return(e instanceof _t?{track:e}:e).track.getBitrate().max-(t instanceof _t?{track:t}:t).track.getBitrate().max})),i.getLocalTracks().length+function(e,t){var r=0;return e.forEach((function(e){var n=e instanceof _t?e.getTrackId():e.track.getTrackId();t.getLocalTrack(n)||(e instanceof _t?r++:e.pubTiny&&e.track.isVideoTrack()&&(r+=2))})),r}(r,i)>10?(this._logger.error(S.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:T.FAILED,code:I.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:r.map(Yt),msg:"publish track limit exceeded"}),this._traceId),[2,{code:I.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:a}]):[4,this._addLocalTracks(r,i)];case 1:return s=b.sent(),i.clearReTryExchangeTimer(),[4,ga(t.getSubscribedList(),!1,e)];case 2:return(c=b.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new fa(c,this._traceId,!0).execute(e,t,n)];case 3:return u=b.sent(),a.forEach((function(e){var t=e.getTrackId();h._trackMediaMap[t]=u.data.qualityMsList||[]})),u.code!==I.SUCCESS?(o.reportPubOrSubQualityData(da.PUB,this._actionStartTime,a,u.code,this._trackMediaMap),this._logger.error(S.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:T.FAILED,tracks:r.map(Yt),code:u.code,msg:"exchange failed"}),this._traceId),this._removePubFailedTracks(r,i),[2,{code:u.code,tracks:a}]):(l=u.data.data,_=l.sdp,d=l.resultCode,f=l.message,d!==I.SUCCESS?(o.reportPubOrSubQualityData(da.PUB,this._actionStartTime,a,d,this._trackMediaMap),this._logger.error(S.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:T.FAILED,trackIds:r.map(Yt),code:d,msg:"exchange inner failed: ".concat(f)}),this._traceId),this._removePubFailedTracks(r,i),[2,{code:d,tracks:a}]):(o.setPubOrSubSuccessTime(Date.now()),[4,i.setRemoteAnswer(_.sdp,!0)]));case 4:return(p=b.sent())!==I.SUCCESS?(o.reportPubOrSubQualityData(da.PUB,this._actionStartTime,a,p,this._trackMediaMap),this._logger.error(S.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:T.FAILED,trackIds:r.map(Yt),code:p,msg:"set remote answer error"}),this._traceId),[2,{code:p,tracks:a}]):(s.length&&this._updateTinyTrackIdSSRCMap(t,c.sdp.sdp,s),[2,y(y({code:d},u.data),{tracks:a})])}}))}))}}),Object.defineProperty(t.prototype,"_updateTinyTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){r.forEach((function(r){var n=Ta(t,r.getStreamId(),ze.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(n),r.getTrackId())}))}}),Object.defineProperty(t.prototype,"_dealPublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,o,a,s,c,u,l,_,d,f,p,h,b,g,m,v,R,O,E,C,P,w,D;return L(this,(function(L){switch(L.label){case 0:return n=r.polarisReport,o=r.context,a=r.peer,s=r.reportMediaActionLogger,c=t.crtUserId,u=t.roomId,l="",_=t.getResourcesByUserId(c),d=A([],N(_),!1),[],p=e.tracks,e.code!==I.SUCCESS?[2,{code:e.code}]:(h=e.data,b=h.publishList,g=h.urls,m=h.mcuPublishList,l=null==g?void 0:g.liveUrl,b.map((function(e){return y({tag:e.msid.split("_").pop(),state:a.getLocalTrack(Nt(e)).isLocalMuted()?0:1},e)})).forEach((function(e){var t=function(e,t){for(var r=!1,n=0,i=0;i<t.length;i++){var o=t[i];if("".concat(e.msid,"_").concat(e.mediaType)==="".concat(o.msid,"_").concat(o.mediaType)){r=!0,n=i;break}}return{isInclude:r,index:n}}(e,d),r=t.isInclude,n=t.index;r?d.splice(n,1,e):d.push(e)})),v=(null==m?void 0:m.map((function(e){return y({tag:e.msid.split("_").pop(),state:1},e)})))||[],f=v,R=Ut(_,d).publishedList,O=y(y({},t.getCDNUris()),{enableInnerCDN:t.getCDNEnable()}),E=O&&O.broadcast===ta.SPREAD?JSON.stringify([O]):"",C=Date.now(),[4,o.setRTCTotalRes(u,[St(Gt.PUBLISH,R)],Tt(d),Gt.TOTAL_CONTENT_RESOURCE,Tt(f),E)]);case 1:return P=L.sent(),s.reportPubOrSubQualityData(da.PUB,this._actionStartTime,p,P,this._trackMediaMap,[{dur:Date.now()-C,cod:P}]),P!==i.SUCCESS?(this._logger.error(S.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:T.FAILED,code:P,msg:"send publish streams notification failed"}),this._traceId),[2,{code:I.SIGNAL_ERROR}]):(t.setResourcesByUserId(c,d),w=R.map((function(e){return Nt(e)})),n.sendR2($o.PUBLISH,ea.BEGIN,w),R.forEach((function(e){a.getLocalTrack("".concat(e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)})),D={code:I.SUCCESS},l&&(D.liveUrl=l),[2,D])}}))}))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return C(this,void 0,void 0,(function(){var i,a,s,c,u=this;return L(this,(function(l){switch(l.label){case 0:return i=e.logger,a=e.peer,this._traceId=i.createTraceId(),this._logger=i,this._actionStartTime=Date.now(),s=this.tracks,r("tracks",s,(function(){return o(s)&&s.length>0&&s.every((function(e){return e instanceof _t||e.track instanceof _t}))}),!0)?(this._logger.info(S.L_ABSTRACT_ROOM_PUBLISH_T,JSON.stringify({trackIds:s.map(Yt)})),(s=s.filter((function(e){var t=(e instanceof _t?{track:e}:e).track,r=t.isDestroyed();return r&&u._logger.warn(S.L_ABSTRACT_ROOM_PUBLISH_E,"track '".concat(t.getTrackId(),"' has beem destroyed"),u._traceId),!r}))).length?(a.__reportR3R4ToPolaris(),a.clearReTryExchangeTimer(),[4,this.__publish(e,t,s,n)]):(this._logger.error(S.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:T.FAILED,code:I.PUBLISH_TRACKS_IS_INVALID,msg:"params tracks is empty"}),this._traceId),[2,{code:I.PUBLISH_TRACKS_IS_INVALID}])):(this._logger.error(S.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> tracks"}),this._traceId),[2,{code:I.PARAMS_ERROR}]);case 1:return c=l.sent(),[4,this._dealPublishRes(c,t,e)];case 2:return[2,l.sent()]}}))}))}}),t}(Wo),Aa=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(r,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),r}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.UNPUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"__unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,_,d,f,p,h=this;return L(this,(function(b){switch(b.label){case 0:return i=e.peer,o=e.polarisReport,a=e.logger,s=e.reportMediaActionLogger,c=n.map((function(e){return e.getTrackId()})),0===c.map(t.getPublishedResourceByTrackId.bind(t)).filter((function(e){return!!e})).length?[2,{code:I.SUCCESS,tracks:n}]:(c.forEach((function(e){return i.removeLocalTrackById(e)})),o.sendR2($o.PUBLISH,ea.END,c),i.clearReTryExchangeTimer(),[4,ga(t.getSubscribedList(),!1,e)]);case 1:return u=b.sent(),(l=e.getPushOtherRooms()).length&&(u.pushOtherRooms=l),[4,new fa(u,this._traceId,!0).execute(e,t,r)];case 2:return _=b.sent(),n.forEach((function(e){var t=e.getTrackId();h._trackMediaMap[t]=_.data.qualityMsList||[]})),_.code!==I.SUCCESS?(s.reportPubOrSubQualityData(da.UNPUB,this._actionStartTime,n,_.code,this._trackMediaMap),a.error(S.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:T.FAILED,code:_.code,trackIds:n.map(Yt),msg:"exchange failed"}),this._traceId),[2,{code:_.code,tracks:n}]):(d=_.data.data,f=d.resultCode,p=d.message,f!==I.SUCCESS?(s.reportPubOrSubQualityData(da.UNPUB,this._actionStartTime,n,_.data.data.resultCode,this._trackMediaMap),a.error(S.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:T.FAILED,code:f,trackIds:n.map(Yt),msg:"exchange inner failed: ".concat(p)}),this._traceId),[2,{code:f,tracks:n}]):[2,y(y({code:_.code},_.data),{tracks:n})])}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,o,a,s,c,u,l,_,d,f,p,h,b,g,m,v,R,O,E,C;return L(this,(function(L){switch(L.label){case 0:return n=e.context,o=e.logger,a=e.peer,s=e.reportMediaActionLogger,c=n.getCurrentId(),u=t.roomId,l=[],[],d=r.tracks,f=r.code,p=r.data,f!==I.SUCCESS?(o.error(S.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({code:f,msg:"unpublish failed"}),this._traceId),[2,{code:f}]):p?(h=p.mcuPublishList,b=d.map((function(e){return e.getTrackId()})),g=b.map(t.getPublishedResourceByTrackId.bind(t)).filter((function(e){return!!e})),l.push.apply(l,A([],N(g),!1)),m=h?h.map((function(e){return y({tag:e.msid.split("_").pop(),state:1},e)})):[],_=m,v=t.getResourcesByUserId(c),R=v.filter((function(e){return!l.includes(e)})),O=Date.now(),[4,n.setRTCTotalRes(u,[St(Gt.UNPUBLISH,l)],Tt(R),Gt.TOTAL_CONTENT_RESOURCE,Tt(_))]):(o.info(S.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:T.SUCCESSED,msg:"unpublish list is empty "})),[2,{code:I.SUCCESS}]);case 1:return E=L.sent(),s.reportPubOrSubQualityData(da.UNPUB,this._actionStartTime,d,E,this._trackMediaMap,[{dur:Date.now()-O,cod:E}]),E!==i.SUCCESS?(o.error(S.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:T.FAILED,code:E,msg:"send unpublish notification failed"}),this._traceId),[2,{code:I.SIGNAL_ERROR}]):(o.info(S.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:T.SUCCESSED,code:I.SUCCESS,msg:"unpublish success",unPubResourceIds:b}),this._traceId),C=r.data.sdp,[4,a.setRemoteAnswer(C.sdp)]);case 2:return L.sent(),t.setResourcesByUserId(c,R),[2,{code:I.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return C(this,void 0,void 0,(function(){var i,o,a,s;return L(this,(function(c){switch(c.label){case 0:return i=e.logger,this._actionStartTime=Date.now(),o=t.crtUserId,a=this.tracks,this._traceId=i.createTraceId(),r("tracks",a,(function(){return a.every((function(e){return e.getUserId()===o&&e instanceof _t}))}),!0)?(i.info(S.L_ABSTRACT_ROOM_UNPUBLISH_T,JSON.stringify({trackIds:a.map(Yt)})),[4,this.__unpublish(e,t,n,a)]):(i.error(S.L_ABSTRACT_ROOM_UNPUBLISH_E,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> tracks"})),[2,{code:I.PARAMS_ERROR}]);case 1:return s=c.sent(),[4,this._dealUnpublishRes(e,t,s)];case 2:return[2,c.sent()]}}))}))}}),t}(Wo),wa=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.LOCAL_TRACK_MUTE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,l,_,d,f,p,h,b,g,m,v,R;return L(this,(function(O){switch(O.label){case 0:r=e.logger,n=e.context,o=this.localTrack,a=o.getTrackId(),s=t.crtUserId,c=t.roomId,u=!o.isLocalMuted(),l=r.createTraceId(),r.info(S.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T,JSON.stringify({enabled:u,trackId:this.localTrack.getTrackId()}),l),_=[{resourceId:a,enabled:u}],d=t.getResourcesByUserId(s),f=[],p=function(e){var t=Nt(e),r=_.findIndex((function(e){return e.resourceId===t}));if(r>=0){var n=_[r].enabled;return e.state=n?1:0,f.push(e),"break"}};try{for(h=P(d),b=h.next();!b.done&&(g=b.value,"break"!==p(g));b=h.next());}catch(e){v={error:e}}finally{try{b&&!b.done&&(R=h.return)&&R.call(h)}finally{if(v)throw v.error}}return[4,n.setRTCTotalRes(c,[St(Gt.MODIFY,f)],Tt(d),Gt.TOTAL_CONTENT_RESOURCE)];case 1:return(m=O.sent())!==i.SUCCESS?(r.error(S.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:T.FAILED,code:m,msg:"signal error"}),l),[2,{code:m}]):(r.info(S.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:T.SUCCESSED}),l),[2,{code:I.SUCCESS}])}}))}))}}),t}(Wo),Da=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.RETRY_EXCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Fo.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,l,_,d,f,p,h,b,g;return L(this,(function(m){switch(m.label){case 0:return n=e.logger,i=e.peer,o=e.context,a=n.createTraceId(),n.info(S.L_RETRY_EXCHANGE_COMMAND_T),s=o.getCurrentId(),[4,ga(t.getSubscribedList(),!0,e)];case 1:return(c=m.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new fa(c,a).execute(e,t,r)];case 2:return(u=m.sent()).code!==I.SUCCESS?[2,{code:u.code}]:(l=u.data.data,_=l.sdp,(d=l.resultCode)!==I.SUCCESS?[2,{code:d}]:(i.clearReTryExchangeTimer(),[4,i.setRemoteAnswer(_.sdp)]));case 3:return(f=m.sent())!==I.SUCCESS?[2,{code:f}]:(p=u.data.data.publishList||[],h=this._diffPublishListChange(p,t,i,s),b=h.plus,g=h.minus,b.length||g.length?[4,this._spreadPublishListUri(e,s,b,g,a)]:[3,5]);case 4:m.sent(),m.label=5;case 5:return[2,{code:I.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"_diffPublishListChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.getResourcesByUserId(n),o=JSON.parse(JSON.stringify(i));e.forEach((function(e){var t,n=e.mediaType,i=e.msid,a=o.findIndex((function(e){var t=e.mediaType,r=e.msid;return n===t&&i===r}));if(-1===a){var s=y({tag:i.split("_").pop(),state:(null===(t=r.getLocalTrack(Nt(e)))||void 0===t?void 0:t.isLocalMuted)?0:1},e);o.push(s)}else o[a].uri=e.uri}));var a=Ut(i,o,!0),s=a.publishedList,c=a.unpublishedList;return t.setResourcesByUserId(n,o),{plus:s,minus:c}}}),Object.defineProperty(t.prototype,"_spreadPublishListUri",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,o){return C(this,void 0,void 0,(function(){var a,s,c,u;return L(this,(function(l){switch(l.label){case 0:return a=e.store,s=e.logger,c=a.getResourcesByUserId(t),s.info(S.L_RETRY_EXCHANGE_SPREAD_T,JSON.stringify({plus:r,minus:n,allPublishList:c}),o),u=[],n.length&&u.push(St(Gt.UNPUBLISH,n)),r.length&&u.push(St(Gt.PUBLISH,r)),[4,e.context.setRTCTotalRes(a.roomId,u,Tt(c),Gt.TOTAL_CONTENT_RESOURCE)];case 1:return l.sent()===i.SUCCESS?s.info(S.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(T.SUCCESSED),o):s.error(S.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(T.FAILED),o),[2]}}))}))}}),t}(Wo);!function(e){e[e.JOIN=0]="JOIN",e[e.LEAVE=1]="LEAVE",e[e.OFFLINE=2]="OFFLINE",e[e.RESOURCECHANGE=3]="RESOURCECHANGE"}(Sa||(Sa={}));var Ua,ka,Ma=function(e){function t(t,r,n,i){var o=e.call(this)||this;return Object.defineProperty(o,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"_context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"_targetPullVersion",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.PULL_RTCROOM_STATUS},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,o,a,s,c,u,l,_,d,f,p,h,b,g,m,v,R,O,E,I,y,C,N;return L(this,(function(L){switch(L.label){case 0:return n=e.logger,o=t.getRoomStatusVersion(),n.info(S.L_PULL_ROOM_STATUS_T,JSON.stringify({roomId:this._roomId,localVersion:o}),this._traceId),this._targetPullVersion&&this._targetPullVersion<=o?(n.info(S.L_PULL_ROOM_STATUS_R,JSON.stringify({status:T.SUCCESSED,msg:"the roomData has been pulled",localVersion:o,targetPullVersion:this._targetPullVersion}),this._traceId),[2,{code:i.SUCCESS}]):[4,this._context.pullRTCRoomStatus(this._roomId,o)];case 1:return a=L.sent(),s=a.code,c=a.data,s!==i.SUCCESS?(n.info(S.L_PULL_ROOM_STATUS_R,JSON.stringify({status:T.FAILED,code:s}),this._traceId),[2,{code:s}]):(l=(u=c).bFullStatus,_=u.version,d=u.usersData,f=u.roomStatus,n.info(S.L_PULL_ROOM_STATUS_R,JSON.stringify({bFullStatus:l,version:zt(_),usersData:d,roomStatus:f}),this._traceId),t.setRoomStatusVersion(_),l?(p=function(e){var t={users:{}},r="";return e.forEach((function(e){var n,i,o=e.userId,a=e.userData;t.users[o]={};var s=null===(n=a.filter((function(e){return"uris"===e.key}))[0])||void 0===n?void 0:n.value,c=null===(i=a.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===i?void 0:i.value;r=c||r,t.users[o]={uris:s}})),{urisData:t,CDNUris:r&&JSON.stringify(JSON.parse(r)[0])}}(d),h=p.urisData,b=p.CDNUris,[4,Ea(h,t,e,r,b,this._traceId)]):[3,3]);case 2:return L.sent(),[2,{code:s}];case 3:L.trys.push([3,10,11,12]),g=P(f),m=g.next(),L.label=4;case 4:return m.done?[3,9]:(v=m.value).event!==Sa.RESOURCECHANGE?[3,6]:(R=function(e){var t,r,n=e.userId,i=e.userData,o=function(e){return e.some((function(e){return"uris"===e.key||"cdn_uris"===e.key}))}(i);if(o){var a=null===(t=i.filter((function(e){return"uris"===e.key}))[0])||void 0===t?void 0:t.value,s=null===(r=i.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===r?void 0:r.value;return{userId:n,content:{uris:a?JSON.parse(a):[],cdn_uris:s&&JSON.parse(s)}}}}(v),R?(E=R.content,(O=R.userId)===t.crtUserId?[3,8]:[4,new La(E,Gt.TOTAL_CONTENT_RESOURCE,O,this._traceId).execute(e,t,r)]):[3,8]);case 5:return L.sent(),[3,8];case 6:return E=function(e){var t,r=e.userId,n=e.userData,i=e.event,o=e.switchRoleType;return{users:[{userId:r,extra:null===(t=n.filter((function(e){return"extra"===e.key}))[0])||void 0===t?void 0:t.value,state:i,switchRoleType:o}]}}(v),[4,new Ca(E,this._traceId).execute(e,t,r)];case 7:I=L.sent().data,e.emit(la,I),L.label=8;case 8:return m=g.next(),[3,4];case 9:return[3,12];case 10:return y=L.sent(),C={error:y},[3,12];case 11:try{m&&!m.done&&(N=g.return)&&N.call(g)}finally{if(C)throw C.error}return[7];case 12:return[2,{code:s}]}}))}))}}),t}(Wo),ja=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.ON_SIGNAL_RECONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Fo.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,o,a,s,c,u;return L(this,(function(l){switch(l.label){case 0:return n=e.logger,o=e.peer,a=e.context,s=t.roomId,c=t.roomMode,u=n.createTraceId(),n.info(S.L_ABSTRACT_ROOM_IM_RECONNECTED_T,void 0,u),"closed"===o.getRTCPeerConn().connectionState?(n.error(S.L_ABSTRACT_ROOM_IM_RECONNECTED_R,"RTCPeerConnection closed. Please rejoin room to restore services",u),e.emit(ra),[2,{code:I.SUCCESS}]):[4,a.rtcPing(s,c)];case 1:return l.sent().code,[4,this._joinRoom(e,t,r,u)];case 2:return l.sent()!==i.SUCCESS?[3,4]:[4,this._restoreMediaServer(e,t,r)];case 3:l.sent(),l.label=4;case 4:return[3,7];case 5:return[4,new Ma(s,u,a).execute(e,t,r)];case 6:l.sent(),l.label=7;case 7:return[2,{code:I.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"_joinRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var o;return C(this,void 0,void 0,(function(){var a,s,c,u,l,_;return L(this,(function(d){switch(d.label){case 0:return a=e.context,s=e.logger,[4,a.joinRTCRoom(t.roomId,t.roomMode,this.livingType)];case 1:return c=d.sent(),u=c.code,l=c.data,u!==i.SUCCESS?(s.error(S.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:T.FAILED,code:u,msg:"im reconnect joinRTCRoom failed"}),n),[2]):l?(_=null===(o=l.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===o?void 0:o.value,[4,Ea(l,t,e,r,_,n)]):(s.info(S.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:T.FAILED,msg:"im reconnect joinRTCRoom, roomData is empty"}),n),[2]);case 2:return d.sent(),s.info(S.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:T.SUCCESSED,roomData:l}),n),[2,u]}}))}))}}),Object.defineProperty(t.prototype,"_restoreMediaServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i;return L(this,(function(o){switch(o.label){case 0:return n=e.peer.getLocalTracks(),i=Object.values(t.getRemoteTracks()).filter((function(e){return!!e.isSubscribed()})),n.length?[4,new Na(n).execute(e,t,r)]:[3,2];case 1:o.sent(),o.label=2;case 2:return n.length||!i.length?[3,4]:[4,new Pa(i,!0).execute(e,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))}}),t}(Wo),Ba=1,xa=5;!function(e){e[e.new=0]="new",e[e.checking=1]="checking",e[e.connected=2]="connected",e[e.completed=3]="completed",e[e.failed=4]="failed",e[e.disconnected=5]="disconnected",e[e.closed=6]="closed"}(Ua||(Ua={})),function(e){e[e.SERVER_KICK=1]="SERVER_KICK",e[e.OTHER_KICK=2]="OTHER_KICK",e[e.IM_DISCONNECTED=3]="IM_DISCONNECTED",e[e.IM_LOGOUT=4]="IM_LOGOUT",e[e.OTHER_CLIENT_IM_CONNECTED=5]="OTHER_CLIENT_IM_CONNECTED"}(ka||(ka={}));var Va,Fa,Ja,Ga,Ha=function(){function e(e,t,r,n){var i=this;Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_baseReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_networkReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pubOrSubSuccessTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_peerCStatus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reportQualityJoinRoomData",{enumerable:!0,configurable:!0,writable:!0,value:function(e,t,r,n){i._baseReportData=Object.assign(i._baseReportData,{snid:n});var o=y(y(y({},i._baseReportData),i._networkReportData),{cod:t,time:e,dur:Date.now()-e,rtp:r});i._logger.__statistics(S.L_QS_JOIN_ROOM_S,JSON.stringify(o))}}),this._baseReportData={rid:this._roomId,csnid:this._clientSessionId,snid:"",time:Date.now(),uid:this._userId},this._networkReportData={cr:"unknown",net:"unknown"}}return Object.defineProperty(e.prototype,"reportQualityKickedData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=y(y(y({},this._baseReportData),this._networkReportData),{time:Date.now(),cod:e===ka.OTHER_KICK?xa:Ba});this._logger.__statistics(S.L_QS_KICKED_S,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=this;r.forEach((function(r){var s,c,u=r instanceof _t||r instanceof Ot?r:r.track,l=u.getTrackId(),_=At(l).mediaType,d=!1;d=u instanceof _t?!!u.isVideoTrack()&&(null===(c=(s=u).__isTiny)||void 0===c?void 0:c.call(s)):r.subTiny||!1;var f=y(y(y({},a._baseReportData),a._networkReportData),{resid:l,mtp:_,smct:d?co.TINY:co.NORMAL,stp:"Rongcloud"!==u.getTag()?1:0,cod:n,msas:i?i[l]:[],sigs:o,time:Date.now(),dur:Date.now()-t});switch(e){case"pub":a._logger.__statistics(S.L_QS_PUBLISH_S,JSON.stringify(f));break;case"unpub":a._logger.__statistics(S.L_QS_UNPUBLISH_S,JSON.stringify(f));break;case"sub":a._logger.__statistics(S.L_QS_SUBSCRIBE_S,JSON.stringify(f));break;case"unsub":a._logger.__statistics(S.L_QS_UNSUBSCRIBE_S,JSON.stringify(f))}}))}}),Object.defineProperty(e.prototype,"reportQualityRecvPubMsgData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=y(y(y({},this._baseReportData),this._networkReportData),{puid:t,time:Date.now(),dur:Date.now()-e});this._logger.__statistics(S.L_QS_RECV_PUB_MSG_S,JSON.stringify(r))}}),Object.defineProperty(e.prototype,"setPubOrSubSuccessTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pubOrSubSuccessTime=e}}),Object.defineProperty(e.prototype,"reportIceFirstConnectData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=y(y(y({},this._baseReportData),this._networkReportData),{time:this._pubOrSubSuccessTime,dur:Date.now()-this._pubOrSubSuccessTime}),r="pub"===e?S.L_QS_PUB_ICE_STATUS_S:S.L_QS_SUB_ICE_STATUS_S;this._logger.__statistics(r,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"recordQualityIceStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this._peerCStatus||{},i=n.status,o=n.time;if(o){var a=e.IP,s=e.port,c=e.networkType,u=e.remoteIP,l=e.remotePort,_=y(y(y({},this._baseReportData),this._networkReportData),{dur:r-o,time:r,pices:Ua[i],ices:Ua[t],rcdts:[{ip:"".concat(u,":").concat(l)}],lcdts:[{ip:"".concat(a,":").concat(s),nttp:c}],cncdts:[]});this._logger.__statistics(S.L_QS_ICE_STATUS_S,JSON.stringify(_)),this._peerCStatus={status:t,time:r}}else this._peerCStatus={status:t,time:r}}}),e}();!function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE"}(Va||(Va={})),function(e){e[e.MeetingOrAnchor=1]="MeetingOrAnchor",e[e.Audience=2]="Audience"}(Fa||(Fa={})),function(e){e[e.NOT_REPORT=-1]="NOT_REPORT",e[e.REPORT_SUCCESS=1e4]="REPORT_SUCCESS",e[e.REPORT_FAIL=0]="REPORT_FAIL",e[e.PB_ERROR=40001]="PB_ERROR"}(Ja||(Ja={})),function(e){e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4"}(Ga||(Ga={}));var Ka,Wa,Ya,za,qa=function(){function e(e,t,r,n,i){void 0===i&&(i=Fa.MeetingOrAnchor),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_crtRTCRoom",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:i})}return Object.defineProperty(e.prototype,"_send",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return L(this,(function(t){switch(t.label){case 0:return this._context.getConnectionStatus()!==u.CONNECTED?[2,Ja.NOT_REPORT]:[4,this._context.setRTCState(this._roomId,e)];case 1:return t.sent()===i.SUCCESS?[2,Ja.REPORT_SUCCESS]:[2,Ja.REPORT_FAIL]}}))}))}}),Object.defineProperty(e.prototype,"_getClientID",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=kt(),this._runtime.localStorage.setItem(e,t)),t}}),Object.defineProperty(e.prototype,"_getRealResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,r=e.indexOf("_tiny");return r>-1&&(t=e.slice(0,r)),t}}),Object.defineProperty(e.prototype,"_getPolarisTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="",r=e.split("_");if(e.includes("_tiny")){var n=r.pop(),i=parseInt(r.pop())===ze.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,n,i].join("_")}else{i=parseInt(r.pop())===ze.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,i].join("_")}return t}}),Object.defineProperty(e.prototype,"_getBaseData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return{bitrateSend:(null==e?void 0:e.bitrateSend)||uo,bitrateRecv:(null==e?void 0:e.bitrateRecv)||uo,networkType:(null==e?void 0:e.networkType)||"unknown",rtt:(null==e?void 0:e.rtt)||uo,localAddress:"".concat((null==e?void 0:e.IP)||uo,":").concat(null==e?void 0:e.port),remoteAddress:"".concat(null==e?void 0:e.remoteIP,":").concat(null==e?void 0:e.remotePort),receiveBand:(null==e?void 0:e.availableIncomingBitrate)||uo,sendBand:(null==e?void 0:e.availableOutgoingBitrate)||uo,packetsLost:(null==e?void 0:e.totalPacketsLost)||uo,deviceId:this._context.getCurrentId()}}}),Object.defineProperty(e.prototype,"_getAudioLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:uo}}),Object.defineProperty(e.prototype,"_getBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:uo}}),Object.defineProperty(e.prototype,"_getPacketsLostRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:uo}}),Object.defineProperty(e.prototype,"_getFrameRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||uo}}),Object.defineProperty(e.prototype,"_getResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return e&&t?"".concat(e," * ").concat(t):"".concat(uo)}}),Object.defineProperty(e.prototype,"_getJitter",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||uo}}),Object.defineProperty(e.prototype,"_getNackCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:uo}}),Object.defineProperty(e.prototype,"_getPliCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:uo}}),Object.defineProperty(e.prototype,"_getRTT",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||uo}}),Object.defineProperty(e.prototype,"_getTrackState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e?this._crtRTCRoom.getLocalTrack(t):this._crtRTCRoom.getRemoteTrack(t);return(null==r?void 0:r.isLocalMuted())?Va.DISABLE:Va.ENABLE}}),Object.defineProperty(e.prototype,"sendR3Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a=this;return L(this,(function(s){switch(s.label){case 0:return t=e.iceCandidatePair,r=e.senders,n=this._getBaseData(t),i="R3\t".concat(n.bitrateSend,"\t-1\t-1\t-1\t").concat(n.networkType,"\t").concat(n.rtt,"\t").concat(n.localAddress,"\t").concat(n.receiveBand,"\t").concat(n.sendBand,"\t").concat(n.packetsLost,"\t").concat(n.deviceId,"\r"),o=r.map((function(e){var t=e.trackId,r=e.audioLevel,n=e.samplingRate,i=e.bitrate,o=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,_=e.jitter,d=e.nackCount,f=e.pliCount,p=e.rtt,h=e.googFirsSent,b=e.encoderImplementation,g=a._getPolarisTrackId(t),m=a._getRealResourceId(t);return{trackId:g,googCodecName:b||String(uo),audioLevel:a._getAudioLevel(r),bitrate:a._getBitrate(i),packetsLostRate:a._getPacketsLostRate(o),frameRate:a._getFrameRate(s),resolution:a._getResolution(c,u),jitter:a._getJitter(_),nackCount:a._getNackCount(d),pliCount:a._getPliCount(f),rtt:a._getRTT(p),googFirsSent:h,samplingRate:n,googRenderDelayMs:l,encoderImplementation:b||String(uo),trackState:a._getTrackState(!0,m)}})),i+=o.map((function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsSent,"\t").concat(e.encoderImplementation,"\t").concat(e.trackState)})).join("\n"),[4,this._send("".concat(i,"\r").concat(this._userRole))];case 1:return s.sent()!==Ja.REPORT_SUCCESS?[2,Ja.REPORT_FAIL]:[2,Ja.REPORT_SUCCESS]}}))}))}}),Object.defineProperty(e.prototype,"sendR4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a=this;return L(this,(function(s){switch(s.label){case 0:return t=e.iceCandidatePair,r=e.receivers,n=this._getBaseData(t),i="R4\t".concat(n.bitrateRecv,"\t-1\t-1\t-1\t").concat(n.networkType,"\t").concat(n.rtt,"\t").concat(n.localAddress,"\t").concat(n.receiveBand,"\t").concat(n.sendBand,"\t").concat(n.packetsLost,"\t").concat(n.deviceId,"\r"),o=r.filter((function(e){return!!e.trackId})).map((function(e){var t=e.trackId,r=e.audioLevel,n=e.samplingRate,i=e.bitrate,o=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,_=e.jitter,d=e.nackCount,f=e.pliCount,p=e.rtt,h=e.googFirsReceived,b=e.codecImplementationName,g=a._getPolarisTrackId(t),m=a._getRealResourceId(t);return{trackId:g,googCodecName:b||String(uo),audioLevel:a._getAudioLevel(r),bitrate:a._getBitrate(i),packetsLostRate:a._getPacketsLostRate(o),frameRate:a._getFrameRate(s),resolution:a._getResolution(c,u),jitter:a._getJitter(_),nackCount:a._getNackCount(d),pliCount:a._getPliCount(f),rtt:a._getRTT(p),googFirsReceived:h,samplingRate:n,googRenderDelayMs:l,codecImplementationName:b||String(uo),trackState:a._getTrackState(!1,m)}})),i+=o.map((function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsReceived,"\t").concat(e.codecImplementationName,"\t").concat(e.trackState)})).join("\n"),[4,this._send("".concat(i,"\r").concat(this._userRole))];case 1:return s.sent()!==Ja.REPORT_SUCCESS?[2,Ja.REPORT_FAIL]:[2,Ja.REPORT_SUCCESS]}}))}))}}),Object.defineProperty(e.prototype,"sendR1",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t=this._context.getCoreVersion(),r=(null===(e=navigator.userAgentData)||void 0===e?void 0:e.platformn)||navigator.platform,n=Vt.browser,i=Vt.version,o=this._getClientID(),a="R1\t".concat("5.7.3-enterprise-lz-alpha.1","\t").concat(t,"\t").concat("web","\t").concat(r,"\t").concat(-1,"\t").concat(n,"\t").concat(i,"\t").concat(o,"\t").concat(this._userRole);this._send(a)}}),Object.defineProperty(e.prototype,"sendR2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this._getClientID(),i="R2\t".concat(e,"\t").concat(t,"\t").concat(n,"\r").concat(r.join("\t"),"\r").concat(this._userRole);this._send(i)}}),e}(),Qa="evt-leave",Za=function(t){function r(e,r,n,i,o,a,s,c,u,l){void 0===u&&(u=lo()),void 0===l&&(l=!1);var _=t.call(this)||this;Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(_,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_service",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(_,"_pinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_peerConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(_,"_onRecvPKMsg",{enumerable:!0,configurable:!0,writable:!0,value:null});var d=_._logger=_._context.logger;_._reportMediaActionLogger=new Ha(d,_._roomId,_._clientSessionId,_._context.getCurrentId()),_._polarisReport=new qa(_._context,_._runtime,_._roomId,_);var f=_._context.getCurrentId(),p=new qo(d,u,_._context.getAppkey(),n,f,i,s,c),h=_._peerConnection=new Go(d,_._reTryExchange.bind(_),f,p,_._polarisReport,!1,l);_._setPeerConnectionListener();var b=_._executeCtx=new _a(d,_._service,e,r,h,p,_._polarisReport,_._reportMediaActionLogger);return b.getPushOtherRooms=function(){return _._getPushOtherRoomsParams()},_.setCommandEventListener(),_._invoker=new zo(b,p),_._store=_._invoker.store,_._audioLevelReport=new Ho(_._store,h),h.on(Go.__INNER_AUDIOLEVEL_CHANGE__,_._audioLevelReport.audioLevelReport,_._audioLevelReport),_._pinger=new qt(_._context,_._roomId,i,_._initOptions.pingGap),_._pinger.onFailed=_.__kickoff.bind(_),_._pinger.onPingResult=_._handlePingResult.bind(_),_._context.registerRTCSignalListener((function(e){return C(_,void 0,void 0,(function(){var t,r,n,i,o;return L(this,(function(a){return t=this._context.decodeRtcNotify(e),r=t.time,n=t.type,i=t.roomId,this._invoker.isDestroyed()?(this._logger.info(S.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:n,time:r,roomId:i})),[2]):(2===n&&i===this._roomId&&(o=this._logger.createTraceId(),this._logger.info(S.L_RTCNTF_PULL_ROOM_STATUS_O,null,o),this._startPullRTCRoomStatus(i,o,r)),[2])}))}))})),_}return E(r,t),Object.defineProperty(r.prototype,"_setPeerConnectionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._peerConnection;t.on(Go.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(_t.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(_t.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(Go.__INNER_ICE_CONNECTED__,(function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")}),this),t.on(Go.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,n=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,r,n)}))}}),Object.defineProperty(r.prototype,"setCommandEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._executeCtx;e.on(ra,this._rtcpeerClosed,this),e.on(na,this._callAppListener.bind(this,"onUserJoin"),this),e.on(ia,this._callAppListener.bind(this,"onUserLeave"),this),e.on(oa,this._onTrackPublish,this),e.on(aa,this._onTrackUnpublish,this),e.on(sa,this._onAudioMuteChange,this),e.on(ca,this._onVideoMuteChange,this),e.on(ua,this._callAppListener.bind(this,"onCDNEnableChange"),this),e.on(la,this._dealUserAppListener,this)}}),Object.defineProperty(r.prototype,"_startPullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){return L(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new Ma(e,t,this._context,r))];case 1:return n.sent(),[2]}}))}))}}),Object.defineProperty(r.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return C(this,void 0,void 0,(function(){var a,s,c;return L(this,(function(u){switch(u.label){case 0:return[4,this._invoker.push(new Xo(this._roomId,e,t,r,n,i,o))];case 1:return a=u.sent(),s=a.code,c=a.data,s!==I.SUCCESS?[2,{code:s}]:(this._initWithRoomData(c.offlineKickTime),[2,{code:s,data:c}])}}))}))}}),Object.defineProperty(r.prototype,"_initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pinger.start(1e3*e),this._polarisReport.sendR1()}}),Object.defineProperty(r.prototype,"_handlePingResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(e===Ht.SUCCESS&&(t>this._store.getRoomStatusVersion()&&this._store.getSupportNtf())){var r=this._logger.createTraceId();this._logger.info(S.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),r),this._startPullRTCRoomStatus(this._roomId,r,t)}this._callAppListener("onPing",e)}}),Object.defineProperty(r.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){this._logger.warn(S.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),f("max",t,(function(t){return e(t)&&t>Math.max(r||1,200)}),!0),f("min",r,(function(r){return e(r)&&r>=1&&(!e(t)||r<t)}),!0),f("start",n,(function(n){return e(n)&&n>r&&n<=t})),this._peerConnection.setBitrate(t,r,n)}}),Object.defineProperty(r.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.streams[0].id,r=e.receiver.track,n=[t,"audio"===r.kind?ze.AUDIO_ONLY:ze.VIDEO_ONLY].join("_"),i=this._store.getRemoteTrack(n);i?(i.__innerSetMediaStreamTrack(r),this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onTrackReady",trackId:i.getTrackId()})),this._callAppListener("onTrackReady",i)):this._logger.warn(S.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(r.id))}}),Object.defineProperty(r.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=null===(t=this._appListener)||void 0===t?void 0:t[e];if(i)try{i.apply(void 0,A([],N(r),!1))}catch(e){this._logger.error(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}}),Object.defineProperty(r.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackUnpublish",e)}}),Object.defineProperty(r.prototype,"__parseInnerMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.targetId;if(r===this._roomId){this._logger.info(S.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var n=e.content;switch(e.messageType){case Gt.KICK:this.__kickoff(!0,n);break;case Gt.STATE:this._stateHandle(n,t);break;case Gt.MODIFY:case Gt.PUBLISH:case Gt.UNPUBLISH:case Gt.TOTAL_CONTENT_RESOURCE:this._resourceHandle(n,e.messageType,e.senderUserId,e.sentTime,t);break;case Gt.ROOM_NOTIFY:this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case Gt.USER_NOTIFY:this._logger.warn(S.L_OLD_DAILY_RECORD_O,"TODO: ".concat(Gt.USER_NOTIFY));break;case Gt.PK_INVITE:case Gt.PK_CANCEL_INVITE:case Gt.PK_INVITE_TIMEOUT:case Gt.PK_INVITE_ANSWER:case Gt.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case Gt.OTHER_ROOM_OFFLINE:break;default:this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,n,e.senderUserId,e.messageUId)}}else this._logger.warn(S.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:T.FAILED,message:"roomId is different, msg roomId-> ".concat(r,", this._roomId-> ").concat(this._roomId," ")}),t)}}),Object.defineProperty(r.prototype,"__kickoff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i=this;return L(this,(function(o){return this._invoker.isDestroyed()||(this._logger.warn(S.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(Qa),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach((function(e){e.userId===i._context.getCurrentId()&&(n=e.type,r=e.kickExtra,i._reportMediaActionLogger.reportQualityKickedData(n))})),this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onKickOff",byServer:e,kickType:n,kickExtra:r})),this._callAppListener("onKickOff",e,n,r)),[2]}))}))}}),Object.defineProperty(r.prototype,"_rtcpeerClosed",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(Qa),this._leaveHandle(!0),this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}}),Object.defineProperty(r.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return C(this,void 0,void 0,(function(){var o;return L(this,(function(a){return o=e.uris,e.ignore||!o||this._invoker.push(new La(e,t,r,i,n)),[2]}))}))}}),Object.defineProperty(r.prototype,"_onTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackPublish",e)}}),Object.defineProperty(r.prototype,"_stateHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n;return L(this,(function(i){switch(i.label){case 0:return[4,this._invoker.push(new Ca(e,t))];case 1:return r=i.sent(),n=r.data,this._dealUserAppListener(n),[2]}}))}))}}),Object.defineProperty(r.prototype,"_dealUserAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=this,n=e.left,i=e.joined,o=e.upgrade,a=e.downgrade;if(null===(t=this._appListener)||void 0===t?void 0:t.onSwitchRole)return null==o||o.forEach((function(e){r._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onSwitchRole",userId:e,role:xo.ANCHOR})),r._callAppListener("onSwitchRole",e,xo.ANCHOR)})),null==a||a.forEach((function(e){r._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onSwitchRole",userId:e,role:xo.AUDIENCE})),r._callAppListener("onSwitchRole",e,xo.AUDIENCE)})),i.length>0&&(this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onUserJoin",joined:i})),this._callAppListener("onUserJoin",i)),void(n.length>0&&(this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onUserLeave",left:n})),this._callAppListener("onUserLeave",n)));var s=A(A([],N(i),!1),N(o),!1),c=A(A([],N(n),!1),N(a),!1);s.length>0&&(this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onUserJoin",allJoined:s})),this._callAppListener("onUserJoin",s)),c.length>0&&(c.length&&this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onUserLeave",allLeft:c})),this._callAppListener("onUserLeave",c))}}),Object.defineProperty(r.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(r.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(r.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getRemoteUserIds()}}),Object.defineProperty(r.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach((function(r){t.push.apply(t,A([],N(e.getRemoteTracksByUserId(r)),!1))})),t}}),Object.defineProperty(r.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTracksByUserId(e)}}),Object.defineProperty(r.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getSessionId()}}),Object.defineProperty(r.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n;return L(this,(function(o){switch(o.label){case 0:return r=this._logger.createTraceId(),this._logger.info(S.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:e,content:t}),r),[4,this._context.sendMessage(p.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0})];case 1:return(n=o.sent().code)!==i.SUCCESS?(this._logger.error(S.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:T.FAILED,code:n}),r),[2,{code:I.SIGNAL_ERROR}]):(this._logger.info(S.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:T.SUCCESSED,name:e,content:t}),r),[2,{code:I.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"setRoomAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),C(this,void 0,void 0,(function(){var o,a;return L(this,(function(s){switch(s.label){case 0:return o=this._logger.createTraceId(),this._logger.info(S.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,key:e,value:t,message:r,isInner:n}),o),[4,this._context.setRTCData(this._roomId,e,t,n,Zo.ROOM,r)];case 1:return(a=s.sent())!==i.SUCCESS?(this._logger.error(S.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:T.FAILED,code:a}),o),[2,{code:I.SIGNAL_ERROR}]):(this._logger.info(S.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:T.SUCCESSED,roomId:this._roomId,key:e,value:t,message:r,isInner:n}),o),[2,{code:I.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"deleteRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),C(this,void 0,void 0,(function(){var n,o;return L(this,(function(a){switch(a.label){case 0:return n=this._logger.createTraceId(),this._logger.info(S.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:e,message:t,isInner:r}),n),[4,this._context.removeRTCData(this._roomId,e,r,Zo.ROOM,t)];case 1:return(o=a.sent())!==i.SUCCESS?(this._logger.error(S.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:T.FAILED,code:o}),n),[2,{code:I.SIGNAL_ERROR}]):(this._logger.info(S.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:T.SUCCESSED,roomId:this._roomId,keys:e,message:t,isInner:r}),n),[2,{code:I.SUCCESS}])}}))}))}}),Object.defineProperty(r.prototype,"getRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=!1),C(this,void 0,void 0,(function(){var r,n,o,a;return L(this,(function(s){switch(s.label){case 0:return r=this._logger.createTraceId(),this._logger.info(S.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:e,isInner:t}),r),[4,this._context.getRTCData(this._roomId,e,t,Zo.ROOM)];case 1:return n=s.sent(),o=n.code,a=n.data,o!==i.SUCCESS?(this._logger.error(S.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(o),r),[2,{code:I.SIGNAL_ERROR}]):(this._logger.info(S.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:T.SUCCESSED,data:a}),r),[2,{code:I.SUCCESS,data:a}])}}))}))}}),Object.defineProperty(r.prototype,"_setUserAttributeValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,Zo.PERSON,r)}}),Object.defineProperty(r.prototype,"_deleteUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,Zo.PERSON,t)}}),Object.defineProperty(r.prototype,"_getUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._context.getRTCData(this._roomId,e,!1,Zo.PERSON)}}),Object.defineProperty(r.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.isDestroyed()}}),Object.defineProperty(r.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._leaveHandle(e)}}),Object.defineProperty(r.prototype,"_muteRemoteTracksBeforeQuit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._store.getRemoteTracks());e.length&&e.forEach((function(e){return e.mute()}))}}),Object.defineProperty(r.prototype,"_leaveHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return L(this,(function(t){switch(t.label){case 0:return this._invoker.isDestroyed()?[2]:(this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),e?[4,this._context.quitRTCRoom(this._roomId)]:[3,2]);case 1:t.sent(),t.label=2;case 2:return this._store.isMainRoom?[4,this._quitAllPKRoom()]:[3,4];case 3:t.sent(),t.label=4;case 4:return this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())];case 5:return t.sent(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(r.prototype,"_releasePCManager",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._peerConnection;e.removeAllLocalTrack(),e.destroy()}}),Object.defineProperty(r.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e instanceof ft&&e.__isTiny()||this.unpublish([e])}}),Object.defineProperty(r.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r;return L(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new wa(e))];case 1:return r=n.sent().code,t(r),[2]}}))}))}}),Object.defineProperty(r.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return L(this,(function(t){return[2,this._invoker.push(new Na(e))]}))}))}}),Object.defineProperty(r.prototype,"_getPushOtherRoomsParams",{enumerable:!1,configurable:!0,writable:!0,value:function(){return[]}}),Object.defineProperty(r.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Da)}}),Object.defineProperty(r.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return L(this,(function(t){return[2,this._invoker.push(new Aa(e))]}))}))}}),Object.defineProperty(r.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=At(e).userId;return!!(null===(t=this._store.getResourcesByUserId(r))||void 0===t?void 0:t.find((function(t){return Nt(t)===e})))}}),Object.defineProperty(r.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return L(this,(function(t){return[2,this._invoker.push(new Pa(e,void 0,void 0))]}))}))}}),Object.defineProperty(r.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return L(this,(function(r){return t=this._logger.createTraceId(),this._logger.info(S.L_APP_CALL_UNSUBSCRIBE_O,void 0,t),[2,this._invoker.push(new ha(e,t))]}))}))}}),Object.defineProperty(r.prototype,"updateSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return L(this,(function(t){return[2,this._invoker.push(new pa(e,!0,this._logger.createTraceId()))]}))}))}}),Object.defineProperty(r.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._peerConnection.getLocalTrack(e)}}),Object.defineProperty(r.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._peerConnection.getLocalTracks()}}),Object.defineProperty(r.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTrack(e)||null}}),Object.defineProperty(r.prototype,"subscribedTracks",{get:function(){return this._store.getSubscribedList().slice()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(S.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,e?Object.keys(e).join(","):null),this._appListener=e}}),Object.defineProperty(r.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(S.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,e?Object.keys(e).join(","):null),this._peerConnection.registerReportListener(e)}}),Object.defineProperty(r.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(S.L_ABSTRACT_ROOM_AUDIO_LEVEL_O),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(r.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._invoker.push(new ja(e))}}),Object.defineProperty(r.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}}),Object.defineProperty(r.prototype,"_onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(S.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:T.SUCCESSED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}}),Object.defineProperty(r.prototype,"_registerPKMsgListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._onRecvPKMsg=e}}),Object.defineProperty(r.prototype,"_quitAllPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){return L(this,(function(e){return[2]}))}))}}),Object.defineProperty(r.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.clientSessionId}}),r}(t),Xa=function(e){function t(t,r){var n=e.call(this)||this;return Object.defineProperty(n,"data",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.MCUCONFIG_FLUSH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i,o,a;return C(this,void 0,void 0,(function(){var r,s,c,u,l,_,d;return L(this,(function(f){switch(f.label){case 0:return r=e.context,s=e.service,c={"App-Key":r.getAppkey(),Token:t.getToken(),RoomId:t.roomId,UserId:r.getCurrentId(),SessionId:t.getSessionId()},[4,s.setMcuConfig(c,this.data)];case 1:return u=f.sent(),l=u.code,_=u.res,l!==I.SUCCESS?[2,{code:l}]:(_.pull_url&&t.setCDNUris(JSON.parse(_.pull_url)),d=this.cdnValues,l===I.SUCCESS&&((null===(i=null===(n=d.output)||void 0===n?void 0:n.video.normal)||void 0===i?void 0:i.width)||(null===(a=null===(o=d.output)||void 0===o?void 0:o.video.normal)||void 0===a?void 0:a.fps))&&Ra(r,t),[2,{code:l,data:_}])}}))}))}}),t}(Wo);!function(e){e[e.CROP=1]="CROP",e[e.WHOLE=2]="WHOLE"}(Ka||(Ka={})),function(e){e[e.CUSTOMIZE=1]="CUSTOMIZE",e[e.SUSPENSION=2]="SUSPENSION",e[e.ADAPTATION=3]="ADAPTATION"}(Wa||(Wa={})),function(e){e[e.CROP=1]="CROP",e[e.WHOLE=2]="WHOLE"}(Ya||(Ya={})),function(e){e[e.AUDIO_VIDEO_ALL=0]="AUDIO_VIDEO_ALL",e[e.AUDIO_VIDEO_NO=1]="AUDIO_VIDEO_NO",e[e.AUDIO_ALL_VIDEO_NO=2]="AUDIO_ALL_VIDEO_NO",e[e.AUDIO_NO_VIDEO_ALL=3]="AUDIO_NO_VIDEO_ALL",e[e.AUDIO_VIDEO_INPUT=4]="AUDIO_VIDEO_INPUT",e[e.AUDIO_ALL_VIDEO_INPUT=5]="AUDIO_ALL_VIDEO_INPUT",e[e.AUDIO_NO_VIDEO_INPUT=6]="AUDIO_NO_VIDEO_INPUT",e[e.AUDIO_INPUT_VIDEO_ALL=7]="AUDIO_INPUT_VIDEO_ALL",e[e.AUDIO_INPUT_VIDEO_NO=8]="AUDIO_INPUT_VIDEO_NO",e[e.ROOM_AUDIO_VIDEO_APPEND=9]="ROOM_AUDIO_VIDEO_APPEND",e[e.ROOM_AUDIO_VIDEO_NOT_APPEND=10]="ROOM_AUDIO_VIDEO_NOT_APPEND",e[e.ROOM_AUDIO_APPEND=11]="ROOM_AUDIO_APPEND",e[e.ROOM_AUDIO_NOT_APPEND=12]="ROOM_AUDIO_NOT_APPEND",e[e.ROOM_VIDEO_APPEND=13]="ROOM_VIDEO_APPEND",e[e.ROOM_VIDEO_NOT_APPEND=14]="ROOM_VIDEO_NOT_APPEND"}(za||(za={}));var $a,es=function(){return{version:2,mode:Wa.SUSPENSION}},ts=function(){function t(e,t,r){Object.defineProperty(this,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_isValidTrackId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_values",{enumerable:!0,configurable:!0,writable:!0,value:es()}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._executeCtx.logger}return Object.defineProperty(t.prototype,"setHostVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:T.FAILED,msg:"videoTrackId: ".concat(e," is invalid")})),this;var t=At(e),r=t.mediaType,n=t.tag,i=t.userId;return r!==ze.VIDEO_ONLY?(this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:T.FAILED,msg:"kind of ".concat(e," is not video")})),this):(this._values.host_stream_id=wt(i,n),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:T.SUCCESSED,videoTrackId:e})),this)}}),Object.defineProperty(t.prototype,"setMixLayoutMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[Wa.CUSTOMIZE,Wa.SUSPENSION,Wa.ADAPTATION].includes(e)?(this._values.mode=e,this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:T.SUCCESSED,mode:e})),this):(this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:T.SUCCESSED,msg:"mode: ".concat(e," is invalid")})),this)}}),Object.defineProperty(t.prototype,"_addOutputValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){void 0===r&&(r="normal");var n=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if("cdn"!==e)if("audio"!==e){var i=n.video;if("normal"!==r&&"tiny"!==r)if("backgroundColor"!==r)if("exparams"!==r){if("backgroundPicture"===r){var o=i.backgroundPicture||(i.backgroundPicture={fillMode:Ka.CROP,picture:[]});Object.assign(o,t)}}else i.exparams={renderMode:t};else i.backgroundColor=t;else{var a=i[r]||(i[r]={});Object.assign(a,t)}}else n.audio={bitrate:t};else n.cdn=t}}),Object.defineProperty(t.prototype,"setOutputVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!jt(e))return this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:T.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=Mt(e),r=t.width,n=t.height;return this._addOutputValue("video",{width:r,height:n},"normal"),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:T.SUCCESSED,resolution:e})),this}}),Object.defineProperty(t.prototype,"setOutputVideoFPS",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!Bt(e))return this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:T.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=xt(e);return this._addOutputValue("video",{fps:t},"normal"),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:T.SUCCESSED,fps:e})),this}}),Object.defineProperty(t.prototype,"setOutputVideoBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return!e(t)||t<=0?(this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:T.FAILED,msg:"params error -> bitrate: ".concat(t)})),this):(this._addOutputValue("video",{bitrate:t},"normal"),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:T.SUCCESSED,bitrate:t})),this)}}),Object.defineProperty(t.prototype,"setOutputTinyVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!jt(e))return this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:T.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=Mt(e),r=t.width,n=t.height;return this._addOutputValue("video",{width:r,height:n},"tiny"),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:T.SUCCESSED,resolution:e})),this}}),Object.defineProperty(t.prototype,"setOutputTinyVideoFPS",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!Bt(e))return this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:T.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=xt(e);return this._addOutputValue("video",{fps:t},"tiny"),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:T.SUCCESSED,fps:e})),this}}),Object.defineProperty(t.prototype,"setOutputTinyVideoBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return!e(t)||t<=0?(this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:T.FAILED,msg:"params error -> bitrate: ".concat(t)})),this):(this._addOutputValue("video",{bitrate:t},"tiny"),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:T.SUCCESSED,bitrate:t})),this)}}),Object.defineProperty(t.prototype,"setOutputVideoRenderMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[Ya.CROP,Ya.WHOLE].includes(e)?(this._addOutputValue("video",e,"exparams"),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:T.SUCCESSED,renderMode:e})),this):(this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:T.FAILED,msg:"params error -> renderMode: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"setOutputAudioBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e(t)&&t>0?(this._addOutputValue("audio",t),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:T.SUCCESSED,bitrate:t})),this):(this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:T.FAILED,msg:"params error -> bitrate: ".concat(t)})),this)}}),Object.defineProperty(t.prototype,"setOutputBackgroundColor",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return/^0x[a-fA-F0-9]{6}$/.test(e)?(this._addOutputValue("video",e,"backgroundColor"),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:T.SUCCESSED,color:e})),this):(this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:T.FAILED,msg:"params error -> color: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"addOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i,o){var a,s,c;if(!h(t))return this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:T.FAILED,msg:"params error -> uri: ".concat(t)})),this;if([r,n,i,o].some((function(t){return!e(t)||t<0||t>1})))return this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:T.FAILED,msg:"params of (x, y, w, h) error -> x: ".concat(r,", y: ").concat(n,", w: ").concat(i,", h: ").concat(o)})),this;var u=(null===(c=null===(s=null===(a=this._values.output)||void 0===a?void 0:a.video)||void 0===s?void 0:s.backgroundPicture)||void 0===c?void 0:c.picture)||[];return u.push({uri:t,w:i,h:o,x:r,y:n}),this._addOutputValue("video",{picture:u},"backgroundPicture"),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:T.SUCCESSED,uri:t,x:r,y:n,w:i,h:o})),this}}),Object.defineProperty(t.prototype,"removeOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n;if(!h(e))return this._logger.error(S.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:T.FAILED,msg:"params error -> uri: ".concat(e)})),this;var i=null===(n=null===(r=null===(t=this._values.output)||void 0===t?void 0:t.video)||void 0===r?void 0:r.backgroundPicture)||void 0===n?void 0:n.picture;return i&&(i=i.filter((function(t){return t.uri!==e})),this._addOutputValue("video",{pictures:i},"backgroundPicture")),this._logger.info(S.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:T.SUCCESSED,uri:e})),this}}),Object.defineProperty(t.prototype,"clearOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this._logger.info(S.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}}),Object.defineProperty(t.prototype,"setOutputBackgroundPictureFillMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[Ka.CROP,Ka.WHOLE].includes(e)?(this._addOutputValue("video",{fillMode:e},"backgroundPicture"),this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:T.SUCCESSED,fillMode:e})),this):(this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:T.FAILED,msg:"params error -> fillMode: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"addPublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=/^rtmp:\/\/.+/;if(!o(e)||0===e.length||e.some((function(e){return!n.test(e)})))return this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:T.FAILED,msg:"params error -> urls: ".concat(e.join(","))})),this;var i=(null===(r=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===r?void 0:r.concat())||[],a=!1;return e.forEach((function(e){i.some((function(t){return t.pushurl===e}))||(a=!0,i.push({pushurl:e}))})),i.length>5?(this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:T.FAILED,msg:"params error -> publish stream urls no more than 5, length: ".concat(e.length)})),this):(a&&this._addOutputValue("cdn",i),this._logger.info(S.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O,JSON.stringify({status:T.SUCCESSED,urls:e})),this)}}),Object.defineProperty(t.prototype,"removePublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=/^rtmp:\/\/.+/;if(!o(e)||0===e.length||e.some((function(e){return!n.test(e)})))return this._logger.error(S.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:T.FAILED,msg:"params error -> urls: ".concat(e.join(","))})),this;for(var i=(null===(r=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===r?void 0:r.concat())||[],a=i.length-1;a>=0;a-=1){var s=i[a].pushurl,c=e.indexOf(s);c>=0&&(e.splice(c,1),i.splice(a,1))}return this._addOutputValue("cdn",i),this._logger.info(S.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:T.SUCCESSED,urls:e})),this}}),Object.defineProperty(t.prototype,"clearPublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._addOutputValue("cdn",[]),this._logger.info(S.L_MCU_CONFIG_BUILDER_CLEAR_PUBLISH_STREAM_URLS_O),this}}),Object.defineProperty(t.prototype,"addCustomizeLayoutVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i,o){if(!l(t)||!this._isValidTrackId(t))return this._logger.error(S.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:T.FAILED,msg:"params error -> trackId: ".concat(t)})),this;if(!e(r)||!e(n))return this._logger.error(S.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:T.FAILED,msg:"params x or y is error -> x: ".concat(r,", y: ").concat(n)})),this;if([i,o].some((function(t){return!e(t)||t<0})))return this._logger.error(S.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:T.FAILED,msg:"params width or height error -> width: ".concat(i,", height: ").concat(o)})),this;var a=At(t),s=a.userId,c=a.tag;if(a.mediaType!==ze.VIDEO_ONLY)return this._logger.error(S.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:T.FAILED,msg:"type of trackId: ".concat(t," is not video")})),this;var u=wt(s,c),_=this._values.input||(this._values.input={}),d=_.video||(_.video=[]);return d.some((function(e){return e.height===o&&e.width===i&&e.stream_id===u&&e.user_id===s&&e.x===r&&e.y===n}))?(this._logger.warn(S.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:T.FAILED,msg:"Duplicate configuration item place ignored"})),this):(d.push({user_id:s,stream_id:u,x:r,y:n,width:i,height:o}),this._logger.info(S.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:T.SUCCESSED,trackId:t,x:r,y:n,width:i,height:o})),this)}}),Object.defineProperty(t.prototype,"removeCustomizeLayoutVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(S.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:T.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=At(e),r=t.userId,n=t.tag;if(t.mediaType!==ze.VIDEO_ONLY)return this._logger.error(S.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:T.FAILED,msg:"type of trackId: ".concat(e," is not video")})),this;var i=wt(r,n),o=this._values.input;return(null==o?void 0:o.video)&&o.video.length>0&&(o.video=o.video.filter((function(e){return e.stream_id===i}))),this._logger.info(S.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:T.SUCCESSED,trackId:e})),this}}),Object.defineProperty(t.prototype,"clearCustomizeLayoutVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._values.input;return null==e||delete e.video,this._logger.info(S.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_LAYOUT_VIDEO_O),this}}),Object.defineProperty(t.prototype,"setCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return e.some((function(e){return t._isValidTrackId(e)}))?(this._logger.error(S.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:T.FAILED,msg:"trackIds contain invalid item -> trackIds: ".concat(e.join(","))})),this):((this._values.input||(this._values.input={})).audio=e.map((function(e){var t=At(e),r=t.userId,n=t.tag;return{stream_id:wt(r,n),user_id:r}})),this._values.inputFilterMode=za.AUDIO_INPUT_VIDEO_ALL,this._logger.info(S.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:T.SUCCESSED,trackIds:e})),this)}}),Object.defineProperty(t.prototype,"addCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(S.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:T.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input||(this._values.input={}),r=t.audio||(t.audio=[]),n=At(e),i=n.userId,o=n.tag,a=wt(i,o);return r.some((function(e){return e.stream_id===a&&e.user_id===i}))?(this._logger.warn(S.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:T.FAILED,msg:"trackId: ".concat(e," is exist")})),this):(r.push({user_id:i,stream_id:a}),this._values.inputFilterMode=za.AUDIO_INPUT_VIDEO_ALL,this._logger.info(S.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:T.SUCCESSED,trackId:e})),this)}}),Object.defineProperty(t.prototype,"removeCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(S.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:T.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input;if(!(null==t?void 0:t.audio)||0===t.audio.length)return this._logger.error(S.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:T.FAILED,msg:"type of trackId: ".concat(e," is not audio")})),this;var r=At(e),n=r.userId,i=r.tag,o=wt(n,i);return t.audio=t.audio.filter((function(e){return n!==e.user_id||o!==e.stream_id})),this._logger.info(S.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:T.SUCCESSED,trackId:e})),this}}),Object.defineProperty(t.prototype,"clearCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._values.input;return(null==e?void 0:e.audio)&&delete e.audio,this._values.inputFilterMode=za.AUDIO_VIDEO_ALL,this._logger.info(S.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_INPUT_AUDIO_O),this}}),Object.defineProperty(t.prototype,"addPictureWaterMark",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i,o,a){if(!this._isValidTrackId(t))return this._logger.error(S.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:T.FAILED,msg:"params error -> trackId: ".concat(t)})),this;if(!h(r))return this._logger.error(S.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:T.FAILED,msg:"params error -> uri: ".concat(r)})),this;if([n,i,o,a].some((function(t){return!e(t)||t<0||t>1}))||n+o>1||i+a>1)return this._logger.error(S.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:T.FAILED,msg:"some attrs of (x, y, w, h) is invalid -> x: ".concat(n,", y: ").concat(i,", w: ").concat(o,", h: ").concat(a)})),this;var s=At(t),c=s.userId,u=s.tag,l=wt(c,u),_=(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen,d=_.filter((function(e){return e.streamId===l}))[0];return d?d.picture.push({uri:r,w:o,h:a,x:n,y:i}):_.push({streamId:l,picture:[{uri:r,w:o,h:a,x:n,y:i}]}),this._values.waterMark.singleScreen=_,this._logger.info(S.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:T.SUCCESSED,trackId:t,uri:r,x:n,y:i,w:o,h:a,singleScreen:_})),this}}),Object.defineProperty(t.prototype,"clearPictureWaterMark",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen=[],this._logger.info(S.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}}),Object.defineProperty(t.prototype,"removePictureWaterMark",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!l(e)||!this._isValidTrackId(e))return this._logger.error(S.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:T.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var r=At(e),n=r.userId,i=r.tag,o=wt(n,i);return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen.forEach((function(e){e.streamId===o&&(e.picture=e.picture.filter((function(e){return e.uri!==t})))})),this._logger.info(S.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:T.SUCCESSED,trackId:e,uri:t})),this}}),Object.defineProperty(t.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._values=es(),this._logger.info(S.L_MCU_CONFIG_BUILDER_RESET_O),this}}),Object.defineProperty(t.prototype,"flush",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return void 0===e&&(e=!0),C(this,void 0,void 0,(function(){var t,r;return L(this,(function(n){switch(n.label){case 0:return t=JSON.parse(JSON.stringify(this._values)),[4,this._invoker.push(new Xa(t,this._values))];case 1:return r=n.sent().code,e&&(this._values=es()),[2,{code:r}]}}))}))}}),Object.defineProperty(t.prototype,"__innerGetValues",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.parse(JSON.stringify(this._values))}}),t}();!function(e){e[e.VIDEO=0]="VIDEO",e[e.AUDIO=1]="AUDIO"}($a||($a={}));var rs,ns=function(e){function t(t,r,n){var i=e.call(this)||this;return Object.defineProperty(i,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return E(t,e),Object.defineProperty(t.prototype,"_exchangeWithPushOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,l,_;return L(this,(function(d){switch(d.label){case 0:return n=e.logger,i=e.peer,i.getLocalTracks().length?(o=i,[4,ga(t.getSubscribedList(),!1,e)]):(n.info(S.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:T.SUCCESSED,msg:"have not published resource"}),this.traceId),[2]);case 1:return a=d.sent(),s=e.getPushOtherRooms(),a.pushOtherRooms=s,[4,new fa(a,this.traceId,!0).execute(e,t,r)];case 2:return(c=d.sent()).code!==I.SUCCESS?(n.error(S.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:T.FAILED,code:c.code,pushOtherRooms:s}),this.traceId),[2]):(u=c.data.data,l=u.sdp,(_=u.resultCode)!==I.SUCCESS?(n.error(S.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:T.FAILED,code:_,pushOtherRooms:s}),this.traceId),[2]):(n.info(S.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:T.SUCCESSED,pushOtherRooms:s}),this.traceId),o.setRemoteAnswer(l.sdp),[2]))}}))}))}}),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.EXCHANGE_WITH_PUSH_OTHER_ROOM},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i;return L(this,(function(o){switch(o.label){case 0:return n=e.logger,i=this.roomId,n.info(S.L_EXCHANGE_WITH_PUSHOTHERROOM_T,i),this.roomPKHandler?this.roomPKHandler.getPKInfo(i)?[4,this._exchangeWithPushOtherRoom(e,t,r)]:(n.warn(S.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:T.FAILED,msg:"PKInfo not exist"}),this.traceId),[2,{code:I.SUCCESS}]):(n.error(S.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:T.FAILED,msg:"_roomPKHandler not exist"}),this.traceId),[2,{code:I.SUCCESS}]);case 1:return o.sent(),[2,{code:I.SUCCESS}]}}))}))}}),t}(Wo),is=function(e){function t(t,r,n,i,o,a){var s=e.call(this)||this;return Object.defineProperty(s,"pkHandler",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"room",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"isQuitPK",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.LEAVE_OTHER_ROOM},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"quitRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var o,a,s,c,u,l,_,d,f,p;return L(this,(function(h){switch(h.label){case 0:return o=e.logger,a=e.context,o.info(S.L_QUIT_PK_T,"roomId: ".concat(t),n),this._PKInfo[t]?(s=this._PKInfo[t],c=s.inviterRoomId,u=s.inviteeRoomId,l=s.inviterUserId,_=s.inviteSessionId,d={inviteeRoomId:u,inviterRoomId:c,userId:r.crtUserId},f={roomId:r.roomId,endRoomId:t,sessionId:_,content:JSON.stringify(d),keys:["".concat(c,"|").concat(l)]},[4,a.endRoomPK(f)]):(o.warn(S.L_QUIT_PK_R,"status: ".concat(T.FAILED,", msg: pkinfo is empty"),n),[2]);case 1:return(p=h.sent())!==i.SUCCESS?(o.error(S.L_QUIT_PK_R,"status: ".concat(T.FAILED,", code: ").concat(p),n),[2,{code:I.SIGNAL_ERROR}]):(o.info(S.L_QUIT_PK_R,"status: ".concat(T.SUCCESSED),n),delete this._PKInfo[t],[2])}}))}))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s;return L(this,(function(c){switch(c.label){case 0:return n=e.logger,o=(i=this).room,a=i.isQuitPK,s=o.getRoomId(),n.info(S.L_LIVING_ROOM_LEAVE_PK_ROOM_T,JSON.stringify({roomId:s,isQuitPK:a}),this.traceId),[4,o.__destroy(!0)];case 1:return c.sent(),delete this._joinedPKRooms[s],[4,new ns(s,this.pkHandler,this.traceId).execute(e,t,r)];case 2:return c.sent(),a&&this.quitRoomPK(e,s,t,this.traceId),n.info(S.L_LIVING_ROOM_LEAVE_PK_ROOM_R,JSON.stringify({status:T.SUCCESSED}),this.traceId),[2,{code:I.SUCCESS}]}}))}))}}),t}(Wo),os=function(){function e(e,t,r,n,i,o,a,s,c,u){Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_mainLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_registerPKMsgListener",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_onJoinedPKRoom",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_inviteTimeout",{enumerable:!0,configurable:!0,writable:!0,value:30}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mainRoomId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._context.logger,this._registerPKMsgListener(this._onRecvPKMsg.bind(this)),this._mainRoomId=this._mainLivingRoom.getRoomId()}return Object.defineProperty(e.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=null===(t=this._appListener)||void 0===t?void 0:t[e];if(i)try{i.apply(void 0,A([],N(r),!1))}catch(e){this._logger.error(S.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify(e))}}}),Object.defineProperty(e.prototype,"_onInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.inviteInfo||{},r=t.inviterRoomId,n={inviterRoomId:r,inviterUserId:t.inviterUserId,extra:t.extra};this._PKInfo[r]=t,this._logger.info(S.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onRequestJoinOtherRoom",info:n})),this._callAppListener("onRequestJoinOtherRoom",n)}}),Object.defineProperty(e.prototype,"_onCancelInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.inviteInfo||{},r=t.inviterRoomId,n={inviterRoomId:r,inviterUserId:t.inviterUserId,extra:t.extra};delete this._PKInfo[r],this._logger.info(S.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCancelRequestOtherRoom",cancelInfo:n})),this._callAppListener("onCancelRequestOtherRoom",n)}}),Object.defineProperty(e.prototype,"_onInviteTimeout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(e.prototype,"_onInviteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.answerCode,r=e.inviteContent,n=r.inviteSessionId,i=r.inviterUserId,o=r.inviterRoomId,a=r.inviteeUserId,s=r.inviterUserAutoMix,c=r.inviteeUserAutoMix,u=r.inviteeRoomId,l={agree:1===t,inviterRoomId:o,inviterUserId:i,inviteeRoomId:u,inviteeUserId:a,extra:r.extra};this._PKInfo[u]=this._PKInfo[u]||{inviteSessionId:n,inviterRoomId:o,inviterUserId:i,inviterUserAutoMix:s,inviteeRoomId:u},this._PKInfo[u].inviteeUserAutoMix=c,this._logger.info(S.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onResponseJoinOtherRoom",answerInfo:l})),this._callAppListener("onResponseJoinOtherRoom",l)}}),Object.defineProperty(e.prototype,"createLeaveOtherRoomCommand",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return new is(this,e,this._PKInfo,this._joinedPKRooms,t,r)}}),Object.defineProperty(e.prototype,"_onPKEnd",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a,s,c;return L(this,(function(u){switch(u.label){case 0:return t=e.inviteInfo,r=t.inviteeRoomId,n=t.inviterRoomId,i=t.userId,o=n===this._mainRoomId?r:n,a={endRoomId:o,endUserId:i},s=this._joinedPKRooms[o],c=this._logger.createTraceId(),this._logger.info(S.L_QUIT_PK_LEAVE_PK_ROOM_O,void 0,c),s?[4,this._invoker.push(this.createLeaveOtherRoomCommand(s,!0,c))]:[3,2];case 1:u.sent(),u.label=2;case 2:return delete this._PKInfo[o],this._logger.info(S.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onFinishOtherRoom",endInfo:a})),this._callAppListener("onFinishOtherRoom",a),[2]}}))}))}}),Object.defineProperty(e.prototype,"_onRecvPKMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.content;switch(e.messageType){case Gt.PK_INVITE:this._onInvite(t);break;case Gt.PK_CANCEL_INVITE:this._onCancelInvite(t);break;case Gt.PK_INVITE_TIMEOUT:this._onInviteTimeout(t);break;case Gt.PK_INVITE_ANSWER:this._onInviteAnswer(t);break;case Gt.PK_END:this._onPKEnd(t)}}}),Object.defineProperty(e.prototype,"registerRoomPKEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(S.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O,JSON.stringify({listener:e&&Object.keys(e)})),this._appListener=e}}),Object.defineProperty(e.prototype,"requestJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return C(this,void 0,void 0,(function(){var o,a,s,c,u,_;return L(this,(function(d){switch(d.label){case 0:return o=this._logger.createTraceId(),this._logger.info(S.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:e,inviteeUserId:t,options:n}),o),r("inviteeRoomId",e,l,!0)&&r("inviteeUserId",t,l,!0)?(a=lo(),s=!b(null==n?void 0:n.autoMix)||(null==n?void 0:n.autoMix),c={inviteSessionId:a,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:s,inviteeRoomId:e,inviteeUserId:t,inviteeTimeoutTime:this._inviteTimeout,extra:(null==n?void 0:n.extra)||""},u={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(c),inviteSessionId:a},[4,this._context.requestRoomPK(u)]):(this._logger.error(S.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),o),[2,{code:I.PARAMS_ERROR}]);case 1:return(_=d.sent())!==i.SUCCESS?(this._logger.error(S.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:_}),o),[2,{code:_}]):(this._PKInfo[e]={inviteSessionId:a,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:s,inviteeRoomId:e},this._logger.info(S.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.SUCCESSED}),o),[2,{code:I.SUCCESS}])}}))}))}}),Object.defineProperty(e.prototype,"cancelRequestJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return C(this,void 0,void 0,(function(){var o,a,s,c;return L(this,(function(u){switch(u.label){case 0:return o=this._logger.createTraceId(),this._logger.info(S.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:e,inviteeUserId:t,extra:n}),o),r("inviteeRoomId",e,l,!0)&&r("inviteeUserId",t,l,!0)?this._PKInfo[e]?(a={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:e,inviteeUserId:t,extra:n||""},s={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteSessionId:this._PKInfo[e].inviteSessionId,inviteInfo:JSON.stringify(a)},[4,this._context.cancelRoomPK(s)]):(this._logger.error(S.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"The request to connect with ".concat(t," user in room ").concat(e," is not initiated")}),o),[2,{code:I.PARAMS_ERROR}]):(this._logger.error(S.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),o),[2,{code:I.PARAMS_ERROR}]);case 1:return(c=u.sent())!==i.SUCCESS?(this._logger.error(S.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:c}),o),[2,{code:c}]):(this._logger.info(S.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.SUCCESSED}),o),delete this._PKInfo[e],[2,{code:I.SUCCESS}])}}))}))}}),Object.defineProperty(e.prototype,"responseJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,o){return C(this,void 0,void 0,(function(){var a,s,c,u,_,d,f,p,h,m;return L(this,(function(v){switch(v.label){case 0:return a=this._logger.createTraceId(),this._logger.info(S.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T,JSON.stringify({inviterRoomId:e,inviterUserId:t,agree:n,options:o}),a),r("inviterRoomId",e,l,!0)&&r("inviterUserId",t,l,!0)?this._PKInfo[e]?(s=this._PKInfo[e],c=s.inviteSessionId,u=s.inviterUserAutoMix,_=!b(null==o?void 0:o.autoMix)||(null==o?void 0:o.autoMix),d={inviteSessionId:c,inviterRoomId:e,inviterUserId:t,inviterUserAutoMix:u,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:_},f=Object.assign(d,{inviterUserAutoMix:u}),p=n?Object.assign(d,{MultiRoomKey:"".concat(e,"|").concat(this._mainRoomId),MultiRoomValue:JSON.stringify(f)}):d,!g(null==o?void 0:o.extra)&&Object.assign(p,{extra:o.extra}),h={agree:n,roomId:this._mainRoomId,inviteSessionId:c,inviteRoomId:e,inviteUserId:t,content:JSON.stringify(p),key:"".concat(e,"|").concat(this._mainRoomId),value:JSON.stringify(d)},[4,this._context.responseRoomPK(h)]):(this._logger.error(S.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"User ".concat(t," in room ").concat(e," did not send a request for connection")}),a),[2,{code:I.PARAMS_ERROR}]):(this._logger.error(S.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> inviterRoomId or inviterUserId"}),a),[2,{code:I.PARAMS_ERROR}]);case 1:return(m=v.sent())!==i.SUCCESS?(this._logger.error(S.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:m}),a),[2,{code:m}]):(this._logger.info(S.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.SUCCESSED}),a),this._PKInfo[e].inviteeUserAutoMix=_,[2,{code:I.SUCCESS}])}}))}))}}),Object.defineProperty(e.prototype,"joinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,n,i,o,a;return L(this,(function(s){switch(s.label){case 0:return t=this._logger.createTraceId(),this._logger.info(S.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T,JSON.stringify({roomId:e}),t),r("roomId",e,l,!0)?this._context.getConnectionStatus()!==u.CONNECTED?(this._logger.error(S.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:I.SIGNAL_DISCONNECTED,msg:"IM disconnected"}),t),[2,{code:I.SIGNAL_DISCONNECTED}]):this._joinedPKRooms[e]?(this._logger.warn(S.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:I.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),t),[2,{code:I.REPERT_JOIN_ROOM}]):(n=$a.VIDEO,i={extra:'{"roomId": "'.concat(this._mainRoomId,'"}')},[4,(o=new _s(this._context,this._runtime,e,this._service,this._initOptions,n,!1,!1,this._clientSessionId)).__innerInit(Ko.LIVE,void 0,n,i)]):(this._logger.error(S.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> roomId"}),t),[2,{code:I.PARAMS_ERROR}]);case 1:return(a=s.sent().code)!==I.SUCCESS?(this._logger.error(S.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.FAILED,code:a}),t),[2,{code:a}]):(this._joinedPKRooms[e]=o,[4,this._onJoinedPKRoom(e,t)]);case 2:return s.sent(),this._logger.info(S.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:T.SUCCESSED}),t),[2,{room:o,code:I.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()}]}}))}))}}),Object.defineProperty(e.prototype,"leaveOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r;return L(this,(function(n){return r=this._logger.createTraceId(),this._logger.info(S.L_APP_CALL_LEAVE_PK_ROOM_O,void 0,r),[2,this._invoker.push(this.createLeaveOtherRoomCommand(e,t,r))]}))}))}}),Object.defineProperty(e.prototype,"getPKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._PKInfo[e]}}),Object.defineProperty(e.prototype,"getAllPKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._PKInfo}}),Object.defineProperty(e.prototype,"getJoinedPKRooms",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._joinedPKRooms}}),e}();!function(e){e[e.OPEN=1]="OPEN",e[e.STOP=2]="STOP"}(rs||(rs={}));var as,ss=function(e){function t(t,r){var n=e.call(this)||this;return Object.defineProperty(n,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"enable",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.ENABLE_INNER_CDN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c,u;return L(this,(function(l){switch(l.label){case 0:return n=e.logger,i=e.context,o=this.enable,n.info(S.L_LIVING_ROOM_ENABLE_INNER_CDN_T,JSON.stringify({roomId:t.roomId,enable:o})),t.isMainRoom?b(o)?(t.setCDNEnabel(o),a={version:2,output:{inCDNModel:o?rs.OPEN:rs.STOP}},[4,new Xa(a,this.cdnValues).execute(e,t,r)]):(n.error(S.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> enable"})),[2,{code:I.PARAMS_ERROR}]):(n.error(S.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:T.FAILED,code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM}]);case 1:return(s=l.sent().code)!==I.SUCCESS?(n.error(S.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:T.FAILED,code:s,msg:"signal error"})),[2,{code:I.SIGNAL_ERROR}]):(c=t.getCDNUris())&&c.broadcast!==ta.SPREAD?(n.info(S.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:T.SUCCESSED,enable:o})),[2,{code:I.SUCCESS}]):[4,Ra(i,t)];case 2:return(u=l.sent().code)===I.SUCCESS?(n.info(S.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:T.SUCCESSED,enable:o})),[2,{code:I.SUCCESS}]):(n.error(S.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:T.FAILED,code:u})),[2,{code:u}])}}))}))}}),t}(Wo);!function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(as||(as={}));var cs,us,ls=function(e){function t(t,r){var n=e.call(this)||this;return Object.defineProperty(n,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return E(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return Vo.RTC_IDENTITY_CHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;return C(this,void 0,void 0,(function(){var o,a,s,c;return L(this,(function(u){switch(u.label){case 0:return[4,e.context.rtcIdentityChange(t.roomId,as.ViewerToAnchor,this.livingType)];case 1:return o=u.sent(),a=o.code,s=o.data,a===i.SUCCESS&&s?(t.initWithRoomData(s,this.traceId),t.getResourcesByUserId(t.crtUserId).length>0&&r.push(new Qo),(c=null===(n=s.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value)&&t.setCDNUris(JSON.parse(c)[0]),[2,{code:a,data:s}]):[2,{code:a}]}}))}))}}),t}(Wo),_s=function(e){function t(t,r,n,i,o,a,s,c,u){var l=e.call(this,t,r,n,Ko.LIVE,i,o,s,c,u)||this;return Object.defineProperty(l,"_livingType",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(l,"_mcuConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(l,"_roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),l._mcuConfigBuilder=new ts(l._executeCtx,l._invoker,l._isValidResourceId.bind(l)),l}return E(t,e),Object.defineProperty(t.prototype,"_initRoomPKHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(this._store.isMainRoom){var r=(n=this._roomId,i=t.roomInfo,o={},i.forEach((function(e){var t=JSON.parse(e.value),r=t.inviterRoomId,i=t.inviteeRoomId;o[n===r?i:r]=JSON.parse(e.value)})),o);this._roomPKHandler=new os(this._invoker,r,this._context,this._runtime,this._service,this._initOptions,this,e.prototype._registerPKMsgListener.bind(this),this._onJoinedPKRoom.bind(this),this._clientSessionId)}var n,i,o}}),Object.defineProperty(t.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,i,o,a,s){return C(this,void 0,void 0,(function(){var c,u,l;return L(this,(function(_){switch(_.label){case 0:return r("livingType",i,(function(e){return e===$a.AUDIO||e===$a.VIDEO}))?[4,e.prototype.__innerInit.call(this,t,n,i,o,a,s)]:(this._logger.error(S.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> livingType"}),s),[2,{code:I.PARAMS_ERROR}]);case 1:return c=_.sent(),u=c.code,l=c.data,u===I.SUCCESS&&l&&this._initRoomPKHandler(l),[2,{code:u,data:l}]}}))}))}}),Object.defineProperty(t.prototype,"__innerInitByIdentityChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n;return L(this,(function(o){switch(o.label){case 0:return[4,this._invoker.push(new ls(this._livingType,e))];case 1:return t=o.sent(),r=t.code,n=t.data,r===i.SUCCESS&&n?(this._initRoomPKHandler(n),this._initWithRoomData(n.offlineKickTime),this._logger.info(S.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:T.SUCCESSED,roomData:n}),e)):this._logger.error(S.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:T.FAILED,code:r}),e),[2,r]}}))}))}}),Object.defineProperty(t.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return C(this,void 0,void 0,(function(){return L(this,(function(r){return this._store.isMainRoom?[2,e.prototype.publish.call(this,t)]:(this._logger.error(S.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:T.FAILED,code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM}])}))}))}}),Object.defineProperty(t.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return C(this,void 0,void 0,(function(){return L(this,(function(r){return this._store.isMainRoom?[2,e.prototype.unpublish.call(this,t)]:(this._logger.error(S.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:T.FAILED,code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM}])}))}))}}),Object.defineProperty(t.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=At(e).userId,i=!!(null===(t=this._store.getResourcesByUserId(n))||void 0===t?void 0:t.find((function(t){return Nt(t)===e}))),o=this.getRoomPKHandler(),a=o.code,s=o.roomPKHandler;if(a!==I.SUCCESS||!s)return i;var c=s.getJoinedPKRooms(),u=[];return Object.values(c).forEach((function(e){u.push.apply(u,A([],N(e.getRemoteTracks()),!1))})),r=u.some((function(t){return e===t.getTrackId()})),i||r}}),Object.defineProperty(t.prototype,"getLivingType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._livingType}}),Object.defineProperty(t.prototype,"getMCUConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom?this._mcuConfigBuilder:(this._logger.error(S.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O,"the `getMCUConfigBuilder` is disabled in PK room"),{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}}),Object.defineProperty(t.prototype,"enableInnerCDN",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){return L(this,(function(t){return[2,this._invoker.push(new ss(this._mcuConfigBuilder.__innerGetValues(),e))]}))}))}}),Object.defineProperty(t.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i,o){return C(this,void 0,void 0,(function(){return L(this,(function(a){return e.prototype._resourceHandle.call(this,t,r,n,i,o),[2]}))}))}}),Object.defineProperty(t.prototype,"__getCDNEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return!!(null===(e=this._store.getCDNUris())||void 0===e?void 0:e.enableInnerCDN)}}),Object.defineProperty(t.prototype,"__getCDNPushMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return null===(e=this._store.getCDNUris())||void 0===e?void 0:e.push_mode}}),Object.defineProperty(t.prototype,"_onJoinedPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){return L(this,(function(r){return this._invoker.push(new ns(e,this._roomPKHandler,t)),[2]}))}))}}),Object.defineProperty(t.prototype,"_getPushOtherRoomsParams",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];if(!this.isMainRoom()||!this._roomPKHandler)return e;var t=this._roomPKHandler.getJoinedPKRooms();for(var r in t){var n=t[r].getSessionId(),i=this._roomPKHandler.getPKInfo(r);if(i){var o=i.inviterUserAutoMix,a=i.inviteeUserAutoMix,s=i.inviterUserId,c=this._context.getCurrentId()===s;e.push({roomId:r,sessionId:n,autoMix:c?!!o:!!a})}}return e}}),Object.defineProperty(t.prototype,"getRoomPKHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom?(this._logger.info(S.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:T.SUCCESSED})),{code:I.SUCCESS,roomPKHandler:this._roomPKHandler}):(this._logger.error(S.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:T.SUCCESSED,code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}}),Object.defineProperty(t.prototype,"_quitAllPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t;return L(this,(function(r){for(t in e=this._roomPKHandler.getJoinedPKRooms())this._roomPKHandler.leaveOtherRoom(e[t]);return this._logger.info(S.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O,JSON.stringify({status:T.SUCCESSED,roomIds:Object.keys(e)})),[2]}))}))}}),Object.defineProperty(t.prototype,"isMainRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom}}),t}(Za),ds=function(e){function t(t,r,n,i,o,a,s){return void 0===a&&(a=Ko.RTC),void 0===s&&(s=!1),e.call(this,t,r,n,a,i,o,!1,!1,lo(),s)||this}return E(t,e),t}(Za),fs=function(){function e(){Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"locked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"taskCount",{enumerable:!0,configurable:!0,writable:!0,value:0})}return Object.defineProperty(e.prototype,"checkToStart",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t,r,n,i,o;return L(this,(function(a){switch(a.label){case 0:if(0===this.queue.length||this.locked)return[2];this.locked=!0,e=this.queue.shift(),t=e.resolve,r=e.task,n=e.reject,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r()];case 2:return i=a.sent(),t(i),[3,4];case 3:return o=a.sent(),n(o),[3,4];case 4:return this.locked=!1,this.checkToStart(),[2]}}))}))}}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=new Promise((function(t,n){r.queue.push({resolve:t,task:e,reject:n})}));return this.checkToStart(),n}}),e}(),ps=new fs,hs=function(e,t){return void 0===t&&(t=""),ps.push(e,t)},bs=function(){function e(e,t,r){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_pc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rtcToken",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_liveUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_subTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:lo()}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_livingType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_subTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_fromRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._crtUserId=this._context.getCurrentId(),this._service=new ho(t,e,r.mediaServer),this._logger=this._context.logger,this._store=new qo(this._logger,this._clientSessionId,this._context.getAppkey(),this._crtUserId,this._crtUserId,Ko.LIVE)}return Object.defineProperty(e.prototype,"_getReqHeaders",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,o;return L(this,(function(a){switch(a.label){case 0:return t=this._crtUserId,this._rtcToken?[3,2]:[4,this._context.getRTCToken(t,Ko.LIVE,e)];case 1:if(r=a.sent(),n=r.code,o=r.data,n!==i.SUCCESS)return[2,{code:I.SIGNAL_ERROR}];this._rtcToken=o.rtcToken,a.label=2;case 2:return[2,{code:I.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:this._crtUserId,RoomId:t,RoomType:Ko.LIVE,Token:this._rtcToken,"Client-Session-Id":this._clientSessionId}}]}}))}))}}),Object.defineProperty(e.prototype,"_clearSubscribeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this._liveUrl="",this._livingType=null,this._mediaType=null,this._subTiny=!1,this._subTracks.length=0,null===(e=this._pc)||void 0===e||e.destroy(),this._pc=null}}),Object.defineProperty(e.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return C(this,void 0,void 0,(function(){var t;return L(this,(function(r){switch(r.label){case 0:return this._fromRetry=!0,[4,this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny)];case 1:return(t=r.sent().code)===I.SUCCESS&&(null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer()),[2,{code:t}]}}))}))}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),C(this,void 0,void 0,(function(){var i=this;return L(this,(function(o){return[2,hs((function(){return i.__subscribe(e,t,r,n)}),"audience-client-sub")]}))}))}}),Object.defineProperty(e.prototype,"__subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i;return void 0===n&&(n=!1),C(this,void 0,void 0,(function(){var o,a,s,c,u,l,d,f,p,h,b,g,m,v=this;return L(this,(function(R){switch(R.label){case 0:return this._logger.info(S.L_AUDIENCE_CLIENT_SUBSCRIBE_T,JSON.stringify({liveUrl:e,livingType:t,mediaType:r,subTiny:n})),o=[],this._context.getNaviInfo(),!this._fromRetry&&(null===(i=this._pc)||void 0===i||i.clearReTryExchangeTimer()),this._fromRetry=!1,_(e)?[$a.AUDIO,$a.VIDEO].includes(t)?[ze.AUDIO_ONLY,ze.VIDEO_ONLY,ze.AUDIO_VIDEO].includes(r)?this._liveUrl&&this._liveUrl!==e?(this._logger.error(S.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:I.BROADCAST_SUB_LIST_NOT_EMPTY,msg:"repeat subscribe"})),[2,{code:I.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:o}]):(this._pc||(this._pc=new Go(this._logger,this._reTryExchange.bind(this),this._crtUserId,this._store,void 0,!1),this._pc.on(Go.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this._pc.registerReportListener(this._reportListener),this._pc.__reportR3R4ToPolaris()),this._liveUrl=e,[4,this._getReqHeaders(t)]):(this._logger.error(S.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> -> mediaType: ".concat(r)})),[2,{code:I.PARAMS_ERROR,tracks:o}]):(this._logger.error("livingType is invalid: ".concat(t)),this._logger.error(S.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> livingType: ".concat(t)})),[2,{code:I.PARAMS_ERROR,tracks:o}]):(this._logger.error(S.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> liveUrl: ".concat(e)})),[2,{code:I.PARAMS_ERROR,tracks:o}]);case 1:return a=R.sent(),s=a.code,c=a.headers,s!==I.SUCCESS?(this._logger.error(S.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:s,msg:"getRTCToken failed"})),[2,{code:s,tracks:o}]):(u="rc_mcu_".concat(Date.now()),l="RongCloudRTC",0===this._subTracks.length&&(this._subTracks.push(new Et(this._logger,l,u),new It(this._logger,l,u)),this._pc.updateSubRemoteTracks(this._subTracks.slice())),[4,this._pc.createOffer(!0)]);case 2:return d=R.sent(),f={sdp:d,liveUrl:e,mediaType:r,simulcast:n?co.TINY:co.NORMAL,switchstream:!1},[4,this._service.broadcastSubscribe(c,f)];case 3:return(p=R.sent()).code!==I.SUCCESS?(this._logger.error(S.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:p.code})),[2,{code:p.code,tracks:o}]):(h=p.data).resultCode!==I.SUCCESS?(this._logger.error(S.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:h.resultCode,msg:h.message})),[2,{code:h.resultCode,tracks:o}]):(this._livingType=t,this._mediaType=r,this._subTiny=n,b=h.sdp,g=h.subscribedList,this._subscribedList=g,m=[],g.forEach((function(e){var t=e.mediaType,r=v._subTracks[t];m.push(r),r.__innerSetRemoteMuted(!0)})),this._pc.setRemoteAnswer(b.sdp),m&&this._updateTrackIdSSRCMap(b.sdp,m),this._logger.info(S.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:T.SUCCESSED,liveUrl:e})),[2,{code:I.SUCCESS,tracks:m}])}}))}))}}),Object.defineProperty(e.prototype,"_updateTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;t.forEach((function(t){var n=t.getTrackId(),i=At(n).mediaType,o=r._subscribedList.filter((function(e){return e.mediaType===i}))[0].msid,a=Ta(e,o,i);r._store.setTrackIdSSRCMap(Number(a),n)}))}}),Object.defineProperty(e.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e=this;return L(this,(function(t){return[2,hs((function(){return e.__unsubscribe()}),"audience-client-unsub")]}))}))}}),Object.defineProperty(e.prototype,"__unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return C(this,void 0,void 0,(function(){var t,r;return L(this,(function(n){switch(n.label){case 0:return this._logger.info(S.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T,JSON.stringify({liveUrl:this._liveUrl})),null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer(),this._rtcToken&&this._liveUrl?[4,this._getReqHeaders()]:(this._logger.warn(S.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:"",msg:"Address does not exist, without unsubscribe"})),[2,{code:I.SUCCESS}]);case 1:return t=n.sent().headers,[4,this._service.broadcastExit(t)];case 2:return(r=n.sent().code)!==I.SUCCESS?this._logger.error(S.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:r})):(this._logger.info(S.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:T.SUCCESSED,liveUrl:this._liveUrl})),this._subscribedList=[]),this._clearSubscribeInfo(),[2,{code:r}]}}))}))}}),Object.defineProperty(e.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(e.prototype,"registerTrackEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._appListener=e}}),Object.defineProperty(e.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=e.receiver.track,i="audio"===n.kind?ze.AUDIO_ONLY:ze.VIDEO_ONLY,o=this._subTracks[i];o.__innerSetMediaStreamTrack(n);try{this._logger.info(S.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,"trackId: ".concat(o.getTrackId())),null===(r=null===(t=this._appListener)||void 0===t?void 0:t.onTrackReady)||void 0===r||r.call(t,o)}catch(e){this._logger.error(S.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,JSON.stringify(e))}}}),e}();!function(e){e.RTMP="rtmp",e.FLV="flv",e.HLS="hls"}(cs||(cs={})),function(e){e[e.NOT_HTTPS=0]="NOT_HTTPS",e[e.HTTPS=1]="HTTPS"}(us||(us={}));var gs,ms=y(y({},Mt(Ye.W176_H144)),{frameRate:xt(We.FPS_15)}),vs=function(){function e(e,t,r,n,i,o,a){void 0===a&&(a=lo());var s=this;Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_joinResData",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_roomAnchorList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_roomRes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_roomAnchorRes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_pc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_CDNUris",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isPulling",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._logger=this._context.logger,this._crtUserId=this._context.getCurrentId(),this._polarisReport=new qa(this._context,this._runtime,this._roomId,this,Fa.Audience),this._reportMediaActionLogger=new Ha(this._logger,this._roomId,this._clientSessionId,this._crtUserId),this._service=new ho(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout);var c=this._store=new qo(this._logger,a,e.getAppkey(),n,this._crtUserId,Ko.LIVE),u=this._pc=new Go(this._logger,this._reTryExchange.bind(this),this._crtUserId,c,this._polarisReport,!0);this._audioLevelReport=new Ho(this._store,u),u.on(Go.__INNER_AUDIOLEVEL_CHANGE__,this._audioLevelReport.audioLevelReport,this._audioLevelReport),this._polarisReport.sendR1(),this._context.registerRTCSignalListener((function(e){return C(s,void 0,void 0,(function(){var t,r,n,i;return L(this,(function(o){return t=this._context.decodeRtcNotify(e),r=t.time,n=t.type,i=t.roomId,1===n&&this._startPull(i,r),[2]}))}))})),this._setInitData()}return Object.defineProperty(e.prototype,"_startPull",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,o,a,s;return L(this,(function(c){switch(c.label){case 0:return this._isPulling?[2]:(this._isPulling=!0,this._pullTime>t?(this._isPulling=!1,[2]):(r=this._logger.createTraceId(),this._logger.info(S.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T,"pullTime: ".concat(this._pullTime),r),[4,this._context.pullRTCRoomEntry(e)]));case 1:return n=c.sent(),o=n.code,a=n.data,o===i.SUCCESS&&(this._isPulling=!1,this._pullTime=(null==a?void 0:a.syncTime)||0,s=(null==a?void 0:a.kvEntries)||[],this._logger.info(S.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(T.SUCCESSED,", kvEntries: ").concat(JSON.stringify(s)),r),this.singalDataChange(s,e,r)),this._logger.info(S.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(T.FAILED,", code: ").concat(o),r),[2]}}))}))}}),Object.defineProperty(e.prototype,"_setInitData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(e,t,r){var n=t.filter((function(e){return"RC_RTC_SESSIONID"===e.key}))[0],i=n?n.value:"",o=t.filter((function(e){return"RC_ANCHOR_LIST"===e.key})).map((function(e){return JSON.parse(e.value||"[]")}))[0],a=t.filter((function(e){return e.key.includes("RC_RES_")})).map((function(e){return JSON.parse(e.value||"{}")})),s=a.length?JSON.parse(a[0].mcu_uris||"[]"):[],c=[];s.forEach((function(t){var n=t.mediaType,i=t.tag,o=n===ze.AUDIO_ONLY?new Et(r,i,"",e):new It(r,i,"",e);c.push(o)}));var u=[],l=[];a.forEach((function(e){var t=JSON.parse(e.uris||"[]");u.push.apply(u,A([],N(t),!1)),t.forEach((function(e){var t=e.mediaType,n=e.tag,i=e.msid.split("_");i.pop();var o=i.join("_"),a=t===ze.AUDIO_ONLY?new Et(r,n,o):new It(r,n,o);l.push(a)}))}));var _=t.filter((function(e){return"RC_CDN"===e.key})).map((function(e){var t=JSON.parse(e.value||"[]");return JSON.parse(t.cdn_uris)[0]}))[0];return{sessionId:i,remoteUserIds:o||[],remoteRTCUris:u,remoteMUCUris:s,remoteRTCTracks:l,remoteMCUTracks:c,remoteTracks:A(A([],N(l),!1),N(c),!1),CDNUris:_||{}}}(this._roomId,this._joinResData.kvEntries,this._logger),r=t.sessionId,n=t.remoteUserIds,i=t.remoteRTCUris,o=t.remoteMUCUris,a=t.remoteTracks,s=t.CDNUris;this._sessionId=r,this._roomAnchorList=n,a.forEach((function(t){e._remoteTracks[t.getTrackId()]=t})),this._CDNUris=s,i.forEach((function(t){var r=t.msid.split("_")[0];e._roomAnchorRes[r]?e._roomAnchorRes[r].push(t):e._roomAnchorRes[r]=[t];var n=JSON.parse(t.uri),i=n.ssrc,o=n.resourceId;e._store.setTrackIdSSRCMap(i,o)})),o.forEach((function(t){var r=t.mediaType,n=t.tag,i=[e._roomId,n,r].join("_");e._roomRes[i]=t;var o=JSON.parse(t.uri).ssrc;e._store.setTrackIdSSRCMap(o,i)})),i.forEach((function(t){var r=Nt(t);e._roomRes[r]=t}))}}),Object.defineProperty(e.prototype,"_assertRoomDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this._destroyed)return I.ROOM_HAS_BEEN_DESTROYED}}),Object.defineProperty(e.prototype,"singalDataChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i=this;if(t===this._roomId){var o=[],a=null===(n=e.filter((function(e){return"RC_CDN"===e.key}))[0])||void 0===n?void 0:n.value;a&&this._diffCDNUris(JSON.parse(JSON.parse(a).cdn_uris)[0],r),e.forEach((function(e){var t=e.key,n=e.value,a=e.uid;if(-1!==t.indexOf("RC_RES_")){var s=JSON.parse(n||"{}"),c=JSON.parse(s.mcu_uris||"[]"),u=JSON.parse(s.uris||"[]");return o.push.apply(o,A([],N(c),!1)),void i._diffAnchorResource(u,a,r)}if("RC_ANCHOR_LIST"===t){var l=JSON.parse(n||"[]");i._diffAnchorList(l,r)}})),this._diffRoomResource(o,r)}else this._logger.error(S.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P,JSON.stringify({status:T.FAILED,msg:"roomId inconsistency -> params roomId:".concat(t,", current roomId:").concat(this._roomId)}),r)}}),Object.defineProperty(e.prototype,"_diffAnchorList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=e.filter((function(e){return r._roomAnchorList.indexOf(e)<0})),i=this._roomAnchorList.filter((function(t){return e.indexOf(t)<0}));n.length>0&&this._handleNewJoinedAnchor(n,t),i.length>0&&this._handleLeftedAnchor(i,t)}}),Object.defineProperty(e.prototype,"_handleNewJoinedAnchor",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;(r=this._roomAnchorList).push.apply(r,A([],N(e),!1)),this._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorJoin",list:e}),t),this._callAppListener("onAnchorJoin",e)}}),Object.defineProperty(e.prototype,"_handleLeftedAnchor",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n=this;return L(this,(function(i){switch(i.label){case 0:return this._roomAnchorList=this._roomAnchorList.filter((function(t){return!e.includes(t)})),r=[],e.forEach((function(e){r.push.apply(r,A([],N(n.getRemoteTracksByUserId(e)),!1)),delete n._roomAnchorRes[e]})),r.length?[4,this.unsubscribe(r)]:[3,2];case 1:i.sent(),r.forEach((function(e){return delete n._remoteTracks[e.getTrackId()]})),i.label=2;case 2:return this._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorLeave",list:e}),t),this._callAppListener("onAnchorLeave",e),[2]}}))}))}}),Object.defineProperty(e.prototype,"_diffRoomResource",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o=this;return L(this,(function(a){return r=[],n=[],i=[],e.forEach((function(e){var t=Nt(e),n=At(t),a=n.tag,s=n.mediaType,c=[o._roomId,a,s].join("_"),u=JSON.parse(e.uri).ssrc;if(o._store.setTrackIdSSRCMap(u,c),!o._remoteTracks[c]){var l=s===ze.AUDIO_ONLY?new Et(o._logger,a,"",o._roomId):new It(o._logger,a,"",o._roomId);r.push(l),o._remoteTracks[c]=l,o._roomRes[l.getTrackId()]=e}i.push(c)})),Object.keys(this._remoteTracks).forEach((function(e){i.indexOf(e)<0&&o._remoteTracks[e].isMCUTrack()&&n.push(o._remoteTracks[e])})),r.length>0&&(this._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackPublish",trackIds:r.map((function(e){return e.getTrackId()}))}),t),this._callAppListener("onTrackPublish",r)),n.length>0&&this._onUserUnpublish(n,"onTrackUnpublish",t),[2]}))}))}}),Object.defineProperty(e.prototype,"_dealPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s,c=this;return L(this,(function(u){switch(u.label){case 0:return n=e.map(Nt),i=[],o=[],t.forEach((function(t){var r=Nt(t),a=n.indexOf(r),s=At(r),u=s.userId,l=s.tag,_=s.mediaType,d=JSON.parse(t.uri).ssrc;c._store.setTrackIdSSRCMap(d,r),a>-1?e[a]=t:e.push(t);var f=c._remoteTracks[r];c._roomRes[r]=t,f?f.isSubscribed()&&i.push(f):(f=_===ze.AUDIO_ONLY?new Et(c._logger,l,u):new It(c._logger,l,u),c._remoteTracks[r]=f,o.push(f)),f.__innerSetRemoteMuted(0===t.state)})),i.length?(a=i.map((function(e){return e.getTrackId()})),[4,hs((function(){return c._subscribeHandle(i,!0)}))]):[3,2];case 1:(s=u.sent().code)!==I.SUCCESS&&this._logger.error(S.L_RESUB_REPUB_RES_R,JSON.stringify({status:T.FAILED,trackIds:a,code:s})),u.label=2;case 2:return this._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorTrackPublish",trackIds:o.map((function(e){return e.getTrackId()}))}),r),this._callAppListener("onAnchorTrackPublish",o),[2]}}))}))}}),Object.defineProperty(e.prototype,"_dealUnpublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s=this;return L(this,(function(c){switch(c.label){case 0:for(n=t.map(Nt),i=e.length-1;i>=0;i-=1)o=e[i],n.includes(Nt(o))&&e.splice(i,1);return a=t.map((function(e){var t=Nt(e);return s._remoteTracks[t]})),[4,this._onUserUnpublish(a,"onAnchorTrackUnpublish",r)];case 1:return c.sent(),[2]}}))}))}}),Object.defineProperty(e.prototype,"_dealModified",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i,o=e.map(Nt);try{for(var a=P(t),s=a.next();!s.done;s=a.next()){var c=s.value,u=Nt(c);e[o.indexOf(u)].state=c.state;var l=this._remoteTracks[u];l.__innerSetRemoteMuted(0===c.state);var _=l.isAudioTrack()?"onAudioMuteChange":"onVideoMuteChange";this._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:_,trackId:l.getTrackId()}),r),this._callAppListener(_,l)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}}}),Object.defineProperty(e.prototype,"_diffAnchorResource",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a,s;return L(this,(function(c){switch(c.label){case 0:return n=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),i=Ut(n,e),o=i.publishedList,a=i.unpublishedList,s=i.modifiedList,o.length?[4,this._dealPublished(n,o,r)]:[3,2];case 1:c.sent(),c.label=2;case 2:return a.length?[4,this._dealUnpublished(n,a,r)]:[3,4];case 3:c.sent(),c.label=4;case 4:return s.length&&this._dealModified(n,s,r),[2]}}))}))}}),Object.defineProperty(e.prototype,"_onUserUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n=this;return L(this,(function(i){switch(i.label){case 0:return[4,this.unsubscribe(e)];case 1:return i.sent(),e.forEach((function(e){n._subscribedList=n._subscribedList.filter((function(t){return t.track.getTrackId()!==e.getTrackId()})),delete n._roomRes[e.getTrackId()],e.__innerDestroy(),delete n._remoteTracks[e.getTrackId()]})),this._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:t,trackIds:e.map((function(e){return e.getTrackId()}))}),r),this._callAppListener(t,e),[2]}}))}))}}),Object.defineProperty(e.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=null===(t=this._appListener)||void 0===t?void 0:t[e];if(i)try{i.apply(void 0,A([],N(r),!1))}catch(e){this._logger.error(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify(e))}}}),Object.defineProperty(e.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e=this;return L(this,(function(t){return[2,hs((function(){return C(e,void 0,void 0,(function(){var e,t,r,n,i,o,a,s,c,u;return L(this,(function(l){switch(l.label){case 0:return[4,this._createSubscribeParams(this._subscribedList,{},!0)];case 1:return e=l.sent().reqBody,[4,this._exchangeHandle(e)];case 2:return(t=l.sent()).code!==I.SUCCESS?[2,{code:t.code}]:(r=t.data,n=r.sdp,(i=r.resultCode)!==I.SUCCESS?[2,{code:i}]:(this._pc.clearReTryExchangeTimer(),(o=this._subscribedList.filter((function(e){return e.track.isMCUTrack()}))).length>0&&(a=o[0].track.getTrackId(),s=null===(u=this._roomRes[a])||void 0===u?void 0:u.msid,c=[this._roomId,"RongCloudRTC"].join("_"),n.sdp=n.sdp.replace(new RegExp(s,"g"),c)),[4,this._pc.setRemoteAnswer(n.sdp)]));case 3:return[2,{code:l.sent()}]}}))}))}),"audience-retry-exchange")]}))}))}}),Object.defineProperty(e.prototype,"_createSubscribeParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a=this;return L(this,(function(s){switch(s.label){case 0:return[4,this._pc.createOffer(r)];case 1:return n=s.sent(),i={resolutionInfo:[]},o={min:0,max:0},Object.keys(t).forEach((function(e){var r=t[e];[r.mediaStream,r.tinyStream].forEach((function(t,r){var a,s=1===r?[e,"tiny"].join("_"):e;n.sdp=null===(a=n.sdp)||void 0===a?void 0:a.replace(new RegExp(t.id,"g"),s);var c=t.getVideoTracks()[0];if(c){var u=0===r,l=u?Lt(c):ms,_=l.width,d=l.height,f=l.frameRate;i.resolutionInfo.push({trackId:c.id,simulcast:u?co.NORMAL:co.TINY,resolution:"".concat(_,"x").concat(d)});var p=$e(_,d),h=tt(f);o.min+=p.minBitrate*h,o.max+=p.maxBitrate*h}}))})),[2,{reqBody:{sdp:n,switchstream:!1,newVersionFlag:!0,subscribeList:e.map((function(e){return{simulcast:e.subTiny?co.TINY:co.NORMAL,resolution:"",uri:a._roomRes[e.track.getTrackId()].uri}}))},dynamicBitrate:o,offer:n}]}}))}))}}),Object.defineProperty(e.prototype,"_subscribeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===t&&(t=!1),void 0===n&&(n=!1),C(this,void 0,void 0,(function(){var i,a,s,c,u,l;return L(this,(function(_){return i=Date.now(),a=n?da.SUB:void 0,s=this._logger.createTraceId(),this._logger.info(S.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:e.map(Yt),forceReq:t}),s),this._assertRoomDestroyed()?(this._logger.error(S.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:I.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),s),this._reportPubOrSubQualityData(i,e,I.ROOM_HAS_BEEN_DESTROYED,a),[2,{code:I.ROOM_HAS_BEEN_DESTROYED}]):r("tracks",e,(function(){return o(e)&&e.length>0&&e.every((function(e){return e instanceof Ot||e.track instanceof Ot}))}),!0)?(this._pc.__reportR3R4ToPolaris(),this._pc.registerReportListener(this._reportListener),this._addPeerCEvent(),c=this._subscribedList.map((function(e){return y({},e)})),u=e.map((function(e){return e instanceof Ot?{track:e}:e})),l=[],u.forEach((function(e){var t=e.track.getTrackId();l.push(t);var r=c.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:c.push(e))})),this._polarisReport.sendR2($o.SUBSCRIBE,ea.BEGIN,l),[2,this._updateSubListHandle(c,s,i,a,!0)]):(this._logger.error(S.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> tracks"}),s),this._reportPubOrSubQualityData(i,e,I.PARAMS_ERROR,a),[2,{code:I.PARAMS_ERROR}])}))}))}}),Object.defineProperty(e.prototype,"_addPeerCEvent",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._pc.on(Go.__INNER_EVENT_TRACK_READY__,(function(t){var r=t.streams[0].id,n=t.receiver.track,i=[r,"audio"===n.kind?ze.AUDIO_ONLY:ze.VIDEO_ONLY].join("_"),o=e._remoteTracks[i];o?(o.__innerSetMediaStreamTrack(n),e._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackReady",trackId:o.getTrackId()})),e._callAppListener("onTrackReady",o)):e._logger.warn(S.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O,"cannot found RCRemoteTrack: ".concat(n.id))})),this._pc.once(Go.__INNER_ICE_CONNECTED__,(function(){e._reportMediaActionLogger.reportIceFirstConnectData("sub")}),this),this._pc.on(Go.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,n=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,r,n)}))}}),Object.defineProperty(e.prototype,"_getReqHeaders",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._crtUserId;return{"App-Key":this._context.getAppkey(),RoomId:e,Token:this._joinResData.token,RoomType:Ko.LIVE,UserId:e,"Session-Id":this._sessionId,"Client-Session-Id":this._clientSessionId}}}),Object.defineProperty(e.prototype,"_exchangeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}}),Object.defineProperty(e.prototype,"_dealSubscribeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i=this,o=null==t?void 0:t.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),a=e.filter((function(e){if(e.track.isMCUTrack()){var t=i._roomRes[e.track.getTrackId()],r="".concat(t.msid,"_").concat(t.mediaType);return o.includes(r)}return null==o?void 0:o.includes(e.track.getTrackId())})),s=null==a?void 0:a.map((function(e){return"".concat(e.track.getTrackId())})),c=e.filter((function(e){return!(null==s?void 0:s.includes(e.track.getTrackId()))})),u=function(e){var t=a.some((function(t){return t.track.getTrackId()===e}));l._remoteTracks[e].__innerSetSubscribed(t)},l=this;for(var _ in this._remoteTracks)u(_);return(n=this._subscribedList).splice.apply(n,A([0,this._subscribedList.length],N(a),!1)),this._logger.info(S.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:T.SUCCESSED,subSuccessTrackIds:o,failedList:c}),r),c}}),Object.defineProperty(e.prototype,"_getParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.map((function(e){return e instanceof Ot?{track:e}:y({},e)})),r={};return t=t.filter((function(e){var t=e.track.getTrackId();return!r[t]&&(r[t]=!0,!0)})).map((function(e){return y({},e)}))}}),Object.defineProperty(e.prototype,"_reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){n&&this._reportMediaActionLogger.reportPubOrSubQualityData(n,e,t,r,this._trackMediaMap)}}),Object.defineProperty(e.prototype,"_updateSubListHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o;return void 0===i&&(i=!1),C(this,void 0,void 0,(function(){var a,s,c,u,l,_,d,f,p,h,b,g,m=this;return L(this,(function(v){switch(v.label){case 0:return this._logger.info(S.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T,JSON.stringify({trackIds:e.map(Yt),forceReq:i}),t),a=this._getParams(e),s=this._subscribedList.map((function(e){return y({},e)})),i||ya(a,s)?(this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(a.map((function(e){return e.track}))),[4,this._createSubscribeParams(a,{},!1)]):(this._logger.info(S.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:T.SUCCESSED,msg:"repeat subscribe"}),t),[2,{code:I.SUCCESS}]);case 1:return c=v.sent().reqBody,[4,this._exchangeHandle(c)];case 2:return u=v.sent(),s.length&&(l=[],s.forEach((function(e){l.push(e.track.getTrackId())})),null===(o=this._pc.reportParser)||void 0===o||o.clearLatestPacketsRecv(l)),e.forEach((function(e){var t=e instanceof Ot?e.getTrackId():e.track.getTrackId();m._trackMediaMap[t]=u.qualityMsList||[]})),u.code!==I.SUCCESS?(this._reportPubOrSubQualityData(r,e,u.code,n),this._logger.error(S.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:T.FAILED,code:u.code}),t),[2,{code:u.code}]):(_=u.data,d=_.sdp,f=_.resultCode,p=_.message,h=_.subscribedList,f!==I.SUCCESS?(this._reportPubOrSubQualityData(r,e,f,n),this._logger.error(S.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:T.FAILED,code:f,msg:p}),t),[2,{code:f}]):(a.forEach((function(e){var t=e.track;if(t.isMCUTrack()){var r=m._roomRes[t.getTrackId()].msid,n=At(t.getTrackId()),i=n.tag,o=[n.userId,i].join("_");d.sdp=d.sdp.replace(new RegExp(r,"g"),o)}})),[4,this._pc.setRemoteAnswer(d.sdp)]));case 3:return b=v.sent(),this._reportPubOrSubQualityData(r,e,b,n),b!==I.SUCCESS?(this._logger.error(S.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:T.FAILED,code:b,msg:"set remote answer error"}),t),[2,{code:b}]):[2,(g=this._dealSubscribeResult(a,h,t)).length?{code:I.SUCCESS,failedList:g}:{code:I.SUCCESS}]}}))}))}}),Object.defineProperty(e.prototype,"_diffCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i;return L(this,(function(o){return this._CDNUris.url&&!e.url?(this._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoDisable"}),t),this._callAppListener("onCDNInfoDisable"),this._CDNUris=e,[2]):((!this._CDNUris||!this._CDNUris.url&&e.url)&&(this._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoEnable",resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),t),this._callAppListener("onCDNInfoEnable",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)})),r=this._CDNUris.w&&e.w&&this._CDNUris.w!==e.w,n=this._CDNUris.h&&e.h&&this._CDNUris.h!==e.h,i=this._CDNUris.fps&&e.fps&&this._CDNUris.fps!==e.fps,(r||n||i)&&(this._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoChange",resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),t),this._callAppListener("onCDNInfoChange",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)})),this._CDNUris=e,[2])}))}))}}),Object.defineProperty(e.prototype,"_getCDNPlayUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l,_,d,f,p,h,b,g;return L(this,(function(m){switch(m.label){case 0:return r=e.w,n=e.h,i=e.fps,o=this._initOptions.pullInnerCDNProtocol||cs.FLV,a=this._initOptions.pullInnerCDNUseHttps===us.NOT_HTTPS?us.NOT_HTTPS:us.HTTPS,this._CDNUris.url?(s={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._crtUserId,SessionId:this.getSessionId()},c=[],u=this._CDNUris,l=u.w,_=void 0===l?0:l,d=u.h,_/(void 0===d?1:d)>1?(r&&c.push("w=".concat(r)),n&&c.push("h=".concat(n))):(r&&c.push("h=".concat(r)),n&&c.push("w=".concat(n))),i&&c.push("fps=".concat(i)),c.push("kind=".concat(o)),c.push("is_https=".concat(a)),f=c.join("&"),p="".concat(this._CDNUris.url,"?"),f&&(p+=f),[4,this._service.getCDNResourceInfo(s,p,t)]):(this._logger.error(S.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:T.FAILED,code:I.CDN_RESOURCE_IS_EMPTY,msg:"cdn_uris url is empty, the anchor need to open or push CDN"}),t),[2,{code:I.CDN_RESOURCE_IS_EMPTY}]);case 1:return h=m.sent(),b=h.code,g=h.res,b!==I.SUCCESS?[2,{code:b}]:[2,{code:b,CDNPlayUrl:null==g?void 0:g.data.pull_url}]}}))}))}}),Object.defineProperty(e.prototype,"getCDNPlayUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o,a,s;return L(this,(function(c){return r=this._logger.createTraceId(),this._logger.info(S.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T,JSON.stringify({resolution:e,fps:t}),r),e&&!jt(e)?(this._logger.error(S.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> resolution"}),r),[2,{code:I.PARAMS_ERROR}]):t&&!Bt(t)?(this._logger.error(S.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> fps"}),r),[2,{code:I.PARAMS_ERROR}]):(n=e?Mt(e):{width:null,height:null},i=n.width,o=n.height,a=t?xt(t):null,s={},i&&(s.w=i),o&&(s.h=o),a&&(s.fps=a),[2,this._getCDNPlayUrl(s,r)])}))}))}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t=this;return L(this,(function(r){return[2,hs((function(){return t._subscribeHandle(e,!1,!0)}),"audience-sub")]}))}))}}),Object.defineProperty(e.prototype,"__unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,n,i,a;return L(this,(function(s){return t=Date.now(),n=da.UNSUB,i=this._logger.createTraceId(),this._logger.info(S.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T,JSON.stringify({trackIds:e.map((function(e){return e.getTrackId()}))}),i),this._assertRoomDestroyed()?(this._logger.error(S.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:I.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),i),[2,{code:I.ROOM_HAS_BEEN_DESTROYED}]):r("tracks",e,(function(){return o(e)&&e.length>0&&e.every((function(e){return e instanceof Ot}))}),!0)?(a=this._subscribedList.map((function(e){return y({},e)})).filter((function(t){return e.every((function(e){return e.getTrackId()!==t.track.getTrackId()}))})),this._polarisReport.sendR2($o.SUBSCRIBE,ea.END,e.map((function(e){return e.getTrackId()}))),[2,this._updateSubListHandle(a,i,t,n,!1)]):(this._logger.error(S.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> tracks"}),i),[2,{code:I.PARAMS_ERROR}])}))}))}}),Object.defineProperty(e.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t=this;return L(this,(function(r){return[2,hs((function(){return t.__unsubscribe(e)}),"audience-unsub")]}))}))}}),Object.defineProperty(e.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return C(this,void 0,void 0,(function(){return L(this,(function(r){switch(r.label){case 0:return this._destroyed?[2]:(this._destroyed=!0,e?[4,this._context.quitLivingRoomAsAudience(this._roomId)]:[3,2]);case 1:r.sent(),r.label=2;case 2:return[4,this._service.broadcastExit(this._getReqHeaders())];case 3:return r.sent(),null===(t=this._pc)||void 0===t||t.destroy(),this._context.registerRTCSignalListener(),[2]}}))}))}}),Object.defineProperty(e.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._remoteTracks[e]}}),Object.defineProperty(e.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return{}}}),Object.defineProperty(e.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e;return L(this,(function(t){switch(t.label){case 0:return e=this._logger.createTraceId(),this._logger.info(S.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T,void 0,e),[4,this._context.joinLivingRoomAsAudience(this._roomId,Ko.LIVE)];case 1:return t.sent().code!==i.SUCCESS&&this._logger.error(S.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(T.FAILED),e),this._logger.info(S.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(T.SUCCESSED),e),[2]}}))}))}}),Object.defineProperty(e.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._appListener=e}}),Object.defineProperty(e.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(S.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(e.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(e.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(e.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._crtUserId}}),Object.defineProperty(e.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(e.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomAnchorList}}),Object.defineProperty(e.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];for(var r in this._remoteTracks){var n=this._remoteTracks[r];n.getUserId()===e&&t.push(n)}return t}}),Object.defineProperty(e.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[],r=[];for(var n in this._remoteTracks){if(2===r.length)break;var i=this._remoteTracks[n];i.isMCUTrack()&&r.push(i)}return this._roomAnchorList.forEach((function(r){t.push.apply(t,A([],N(e.getRemoteTracksByUserId(r)),!1))})),A(A([],N(r),!1),N(t),!1)}}),Object.defineProperty(e.prototype,"getRemoteRTCTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._remoteTracks){var r=this._remoteTracks[t];r.isMCUTrack()||e.push(r)}return e}}),Object.defineProperty(e.prototype,"getRemoteMCUTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._remoteTracks){var r=this._remoteTracks[t];r.isMCUTrack()&&e.push(r)}return e}}),Object.defineProperty(e.prototype,"getCDNInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._CDNUris.w?{resolution:"W".concat(this._CDNUris.w,"_H").concat(this._CDNUris.h),fps:"FPS_".concat(this._CDNUris.fps),CDNEnable:this._CDNUris.enableInnerCDN}:{CDNEnable:!1}}}),Object.defineProperty(e.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._clientSessionId}}),e}();!function(e){e[e.AUTOMATIC=0]="AUTOMATIC",e[e.MANUAL=1]="MANUAL"}(gs||(gs={}));var Rs,Os,Es=function(){function e(e){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isElectron",{enumerable:!0,configurable:!0,writable:!0,value:/Electron/.test(navigator.userAgent)}),this._logger=e.logger}return Object.defineProperty(e.prototype,"_getMediaStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t="getUserMedia"),C(this,void 0,void 0,(function(){var r,n,i;return L(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),r=this.setConstraintsConfig(e),[4,navigator.mediaDevices[t](r)];case 1:return n=o.sent(),[2,{code:I.SUCCESS,stream:n}];case 2:return i=o.sent(),this._logger.error(S.L_GET_MEDIA_STREAM_E,JSON.stringify({name:i.name,message:i.message})),"Permission denied"===i.message?[2,{code:I.BROWSER_PERMISSION_DENIED}]:"Permission denied by system"===i.message?[2,{code:I.SYSTEM_PERMISSION_DENIED}]:[3,3];case 3:return[2,{code:"getUserMedia"===t?I.GET_USER_MEDIA_FAILED:I.GET_DISPLAY_MEDIA_FAILED}]}}))}))}}),Object.defineProperty(e.prototype,"_getMediaStreamErrorReason",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="";return e===I.BROWSER_PERMISSION_DENIED&&(t="Permission denied"),e===I.SYSTEM_PERMISSION_DENIED&&(t="Permission denied by system"),t}}),Object.defineProperty(e.prototype,"setConstraintsConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;if((null==e?void 0:e.audio)&&!this._isElectron){"boolean"==typeof e.audio&&(e.audio={});var n=null===(r=(t=navigator.mediaDevices).getSupportedConstraints)||void 0===r?void 0:r.call(t);(null==n?void 0:n.noiseSuppression)&&(e.audio.noiseSuppression=!!n.noiseSuppression),(null==n?void 0:n.autoGainControl)&&(e.audio.autoGainControl=!!n.autoGainControl),(null==n?void 0:n.echoCancellation)&&(e.audio.echoCancellation=!!n.echoCancellation),this._logger.info(S.L_SET_AUDIO_CONSTRAINTS_O,"browser supported -> ".concat(JSON.stringify(n)))}return e}}),Object.defineProperty(e.prototype,"createMicrophoneAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="RongCloudRTC"),C(this,void 0,void 0,(function(){var r,n,i,o,a,s;return L(this,(function(c){switch(c.label){case 0:return yt(e)?(r=this._context.getCurrentId())?[4,this._getMediaStream({audio:{deviceId:null==t?void 0:t.micphoneId,sampleRate:null==t?void 0:t.sampleRate,noiseSuppression:null==t?void 0:t.noiseSuppression,echoCancellation:null==t?void 0:t.echoCancellation,autoGainControl:null==t?void 0:t.autoGainControl}})]:(this._logger.error(S.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:I.INVALID_USER_ID}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.INVALID_TAGS,msg:"invalid tag"})),[2,{code:I.INVALID_TAGS}]);case 1:return n=c.sent(),i=n.stream,(o=n.code)!==I.SUCCESS?(this._logger.error(S.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:T.FAILED,code:o,msg:this._getMediaStreamErrorReason(o)})),[2,{code:o}]):(a=i.getAudioTracks()[0],s=new gt(this._logger,e,r,a),this._logger.info(S.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:T.SUCCESSED,trackId:s.getTrackId()})),[2,{code:o,track:s}])}}))}))}}),Object.defineProperty(e.prototype,"createCameraVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="RongCloudRTC"),C(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,l,_;return L(this,(function(d){switch(d.label){case 0:return yt(e)?(r=this._context.getCurrentId())?(n=jt(null==t?void 0:t.resolution)?t.resolution:Ye.W640_H480,i=Mt(n),o=i.width,a=i.height,[4,this._getMediaStream({video:{deviceId:null==t?void 0:t.cameraId,frameRate:xt((null==t?void 0:t.frameRate)||We.FPS_15),width:o,height:a,facingMode:null==t?void 0:t.faceMode}})]):(this._logger.error(S.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:I.INVALID_USER_ID}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.INVALID_TAGS,msg:"invalid tag"})),[2,{code:I.INVALID_TAGS}]);case 1:return s=d.sent(),c=s.stream,(u=s.code)!==I.SUCCESS?(this._logger.error(S.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:T.FAILED,code:u,msg:this._getMediaStreamErrorReason(u)})),[2,{code:u}]):(l=c.getVideoTracks()[0],_=new mt(this._logger,e,r,l),this._logger.info(S.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:T.SUCCESSED,trackId:_.getTrackId()})),[2,{code:u,track:_}])}}))}))}}),Object.defineProperty(e.prototype,"createMicrophoneAndCameraTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i,o;return void 0===e&&(e="RongCloudRTC"),C(this,void 0,void 0,(function(){var a,s,c,u,l,_,d,f,p,h,b=this;return L(this,(function(g){switch(g.label){case 0:return a=[],yt(e)?(s=this._context.getCurrentId())?(c=jt(null===(r=null==t?void 0:t.video)||void 0===r?void 0:r.resolution)?t.video.resolution:Ye.W640_H480,u=Mt(c),l=u.width,_=u.height,d=null==t?void 0:t.audio,[4,this._getMediaStream({video:{deviceId:null===(n=null==t?void 0:t.video)||void 0===n?void 0:n.cameraId,frameRate:xt((null===(i=null==t?void 0:t.video)||void 0===i?void 0:i.frameRate)||We.FPS_15),width:l,height:_,facingMode:null===(o=null==t?void 0:t.video)||void 0===o?void 0:o.faceMode},audio:{deviceId:null==d?void 0:d.micphoneId,sampleRate:null==d?void 0:d.sampleRate,noiseSuppression:null==d?void 0:d.noiseSuppression,echoCancellation:null==d?void 0:d.echoCancellation,autoGainControl:null==d?void 0:d.autoGainControl}})]):(this._logger.error(S.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:I.INVALID_USER_ID,tracks:a}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.INVALID_TAGS,msg:"invalid tag"})),[2,{code:I.INVALID_TAGS,tracks:a}]);case 1:return f=g.sent(),p=f.stream,(h=f.code)!==I.SUCCESS?(this._logger.error(S.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:T.FAILED,code:h,msg:this._getMediaStreamErrorReason(h)})),[2,{code:h,tracks:a}]):(p.getTracks().forEach((function(t){"video"===t.kind?a.push(new mt(b._logger,e,s,t)):a.unshift(new gt(b._logger,e,s,t))})),this._logger.info(S.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:T.SUCCESSED,trackIds:a.map((function(e){return e.getTrackId()}))})),[2,{code:h,tracks:a}])}}))}))}}),Object.defineProperty(e.prototype,"createScreenVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),C(this,void 0,void 0,(function(){var r;return L(this,(function(n){switch(n.label){case 0:return[4,this._createScreenTracks(e,!1,S.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,t)];case 1:return(r=n.sent()).code===I.SUCCESS?[2,{code:r.code,track:r.tracks[0]}]:[2,r]}}))}))}}),Object.defineProperty(e.prototype,"createScreenWithAudioTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),C(this,void 0,void 0,(function(){return L(this,(function(r){return[2,this._createScreenTracks(e,!0,S.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O,t)]}))}))}}),Object.defineProperty(e.prototype,"_createScreenTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c,u,l,_,d,f,p,h;return L(this,(function(b){switch(b.label){case 0:return yt(e)?(i=this._context.getCurrentId())?Jt()?(o=/macintosh|mac os x/i.test(navigator.userAgent),a=(!this._isElectron||!o)&&t,s=jt(null==n?void 0:n.resolution)?n.resolution:Ye.W1280_H720,this._isElectron?[4,this._createElectronScreenStream(t,r,s,null==n?void 0:n.chromeMediaSourceId)]:[3,2]):(this._logger.error(S.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.BROWSER_NOT_SUPPORT,msg:"browser not support"})),[2,{code:I.BROWSER_NOT_SUPPORT}]):(this._logger.error(r,JSON.stringify({status:T.FAILED,code:I.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:I.INVALID_USER_ID}]):(this._logger.error(r,JSON.stringify({status:T.FAILED,code:I.INVALID_TAGS,msg:"invalid tag"})),[2,{code:I.INVALID_TAGS}]);case 1:return _=b.sent(),[3,4];case 2:return[4,this._createWebScreenStream(t,s,null==n?void 0:n.frameRate)];case 3:_=b.sent(),b.label=4;case 4:return u=(c=_).stream,(l=c.code)!==I.SUCCESS?(this._logger.error(r,JSON.stringify({status:T.FAILED,code:l,msg:this._getMediaStreamErrorReason(l)})),[2,{code:l}]):(d=u.getVideoTracks()[0],f=new vt(this._logger,e,i,d),p=[f],a&&(h=u.getAudioTracks()[0])&&p.push(new Rt(this._logger,e,i,h)),this._logger.info(r,JSON.stringify({status:T.SUCCESSED,trackIds:p.map((function(e){return e.getTrackId()}))})),[2,{code:l,tracks:p}])}}))}))}}),Object.defineProperty(e.prototype,"_createElectronScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,o;return C(this,void 0,void 0,(function(){var a,s,c,u,l,d,f;return L(this,(function(p){return a=/macintosh|mac os x/i.test(navigator.userAgent),this._isElectron&&a&&e&&this._logger.warn(t,JSON.stringify({status:T.INFO,code:I.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO,msg:"mac in electron not support screen share with audio"})),s=(!this._isElectron||!a)&&e,!this._isElectron||g(n)||_(n)?(c=Mt(r),u=c.width,l=c.height,d={mandatory:{chromeMediaSourceId:n,chromeMediaSource:"desktop",minWidth:u,maxWidth:u,minHeight:l,maxHeight:l}},!n&&this._isElectron&&(null===(i=d.mandatory)||void 0===i||delete i.chromeMediaSourceId),f=null,s&&this._isElectron&&(null===(o=d.mandatory)||void 0===o||delete o.chromeMediaSourceId,f={mandatory:{chromeMediaSource:"desktop"}}),[2,this._getMediaStream({video:d,audio:f||s},"getUserMedia")]):(this._logger.error(t,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> options.chromeMediaSourceId type is string"})),[2,{code:I.PARAMS_ERROR}])}))}))}}),Object.defineProperty(e.prototype,"_createWebScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,i,o,a;return L(this,(function(s){return n=Mt(t),i=n.width,o=n.height,a={frameRate:xt(r||We.FPS_15),width:i,height:o},[2,this._getMediaStream({video:a,audio:e},"getDisplayMedia")]}))}))}}),Object.defineProperty(e.prototype,"createLocalAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n;return L(this,(function(i){return yt(e)?t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind?(r=this._context.getCurrentId())?(n=new dt(this._logger,e,r,t),this._logger.info(S.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:T.SUCCESSED,trackId:n.getTrackId()})),[2,{code:I.SUCCESS,track:n}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:I.INVALID_USER_ID}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not audio"})),[2,{code:I.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.INVALID_TAGS,msg:"invalid tag"})),[2,{code:I.INVALID_TAGS}])}))}))}}),Object.defineProperty(e.prototype,"createLocalVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n;return L(this,(function(i){return yt(e)?t&&t instanceof MediaStreamTrack&&"video"===t.kind?(r=this._context.getCurrentId())?(n=new ft(this._logger,e,r,t),this._logger.info(S.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:T.SUCCESSED,trackId:n.getTrackId()})),[2,{code:I.SUCCESS,track:n}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:I.INVALID_USER_ID}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not video"})),[2,{code:I.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:T.FAILED,code:I.INVALID_TAGS,msg:"invalid tag"})),[2,{code:I.INVALID_TAGS}])}))}))}}),Object.defineProperty(e.prototype,"_validateCreateLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!yt(e))return this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.INVALID_TAGS,msg:"invalid tag"})),{code:I.INVALID_TAGS,tracks:[]};if(!Ft())return this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.BROWSER_NOT_SUPPORT,msg:"browser not support"})),{code:I.BROWSER_NOT_SUPPORT,tracks:[]};var r=t instanceof File?URL.createObjectURL(t):t;return h(r)||/^blob:/.test(r)?this._context.getCurrentId()?{code:I.SUCCESS,tracks:[],url:r}:(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),{code:I.INVALID_USER_ID,tracks:[]}):(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> file"})),{code:I.PARAMS_ERROR,tracks:[]})}}),Object.defineProperty(e.prototype,"createLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){return C(this,void 0,void 0,(function(){var i,o,a=this;return L(this,(function(s){return(i=this._validateCreateLocalFileTracks(t,r)).code!==I.SUCCESS?[2,i]:(o=this._context.getCurrentId(),[2,new Promise((function(r){var s=document.createElement("video");(null==n?void 0:n.withoutAudio)&&(s.muted=!0),s.onloadedmetadata=function(){var i,c=[];try{var u=s.mozCaptureStream?"mozCaptureStream":"captureStream";i=s[u]()}catch(e){a._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.CREATE_FILE_TRACK_FAILED,msg:"captureSteam error -> ".concat(JSON.stringify(e))})),r({code:I.CREATE_FILE_TRACK_FAILED,tracks:c})}var l=N(e.getTracksWithOptions(i,n),2),_=l[0],d=l[1];_&&c.push(new bt(a._logger,t,o,_,s)),d&&c.push(new ht(a._logger,t,o,d,s)),0===c.length&&(s.pause(),s.src=""),s.onerror=null,a._logger.info(S.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:T.SUCCESSED,trackIds:c.map((function(e){return e.getTrackId()}))})),r({code:I.SUCCESS,tracks:c})},s.onerror=function(){a._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.CREATE_FILE_TRACK_FAILED,msg:"Failed to create file stream, video onerror"})),r({code:I.CREATE_FILE_TRACK_FAILED,tracks:[]})},s.src=i.url,s.loop=!0,s.play()}))])}))}))}}),Object.defineProperty(e.prototype,"createLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){return C(this,void 0,void 0,(function(){var i,o,a,s,c;return L(this,(function(u){return i=[],yt(t)?r instanceof MediaStream?(o=this._context.getCurrentId())?(a=N(e.getTracksWithOptions(r,n),2),s=a[0],c=a[1],s&&i.push(new dt(this._logger,t,o,s)),c&&i.push(new ft(this._logger,t,o,c)),this._logger.info(S.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:T.SUCCESSED,trackIds:i.map((function(e){return e.getTrackId()}))})),[2,{code:I.SUCCESS,tracks:i}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:I.INVALID_USER_ID,tracks:i}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> stream"})),[2,{code:I.PARAMS_ERROR,tracks:i}]):(this._logger.error(S.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:T.FAILED,code:I.INVALID_TAGS,msg:"invalid tag"})),[2,{code:I.INVALID_TAGS,tracks:i}])}))}))}}),Object.defineProperty(e,"getTracksWithOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=[];return r[0]=(null==t?void 0:t.withoutAudio)?void 0:e.getAudioTracks()[0],r[1]=(null==t?void 0:t.withoutVideo)?void 0:e.getVideoTracks()[0],r}}),e}(),Is=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_crtRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"_audience",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"_crtAudienceLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Do.setSdpSemantics(n.sdpSemantics||"unified-plan",i._logger),i._service=new ho(i._runtime,i._context,i._options.mediaServer,i._options.timeout),i._context.registerConnectionStateChangeListener(i._onIMStatusChange.bind(i)),i._context.registerDestroyListener(i._onIMUninit.bind(i)),i._context.registerMessageListener(i._handleMessage.bind(i)),i._context.getPluginContext().onnavidatachange=i.naviDataChange.bind(i),i}return E(t,e),Object.defineProperty(t.prototype,"_handleMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.conversationType!==p.RTC_ROOM)return!1;var t=this._logger.createTraceId();this._crtRoom instanceof _s&&this._getJoinedPKRoomList().forEach((function(r){r.__parseInnerMessage(e,t)}));return this._logger.info(S.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:T.SUCCESSED,message:e}),t),this._crtRoom?(this._crtRoom.__parseInnerMessage(e,t),!0):(this._logger.warn(S.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:T.FAILED,message:"the crtRoom is empty"}),t),!0)}}),Object.defineProperty(t.prototype,"naviDataChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(S.L_RTC_CLIENT_NAVI_CHANGE_O,"on navi change data => ".concat(JSON.stringify(e))),this._service.detectorMediaSever()}}),Object.defineProperty(t.prototype,"_getJoinedPKRoomList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._crtRoom.getRoomPKHandler(),t=e.code,r=e.roomPKHandler;if(t===I.SUCCESS&&r){var n=r.getJoinedPKRooms()||{};return Object.values(n)}return[]}}),Object.defineProperty(t.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(t.prototype,"setCustomExtendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._logger.info(S.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_T,"info: ".concat(e)),_(e)?(this._service.setCustomExtendInfo(e),this._logger.info(S.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_R,"code: ".concat(I.SUCCESS)),{code:I.SUCCESS}):(this._logger.info(S.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_R,"code: ".concat(I.PARAMS_ERROR)),{code:I.PARAMS_ERROR})}}),Object.defineProperty(t.prototype,"joinCrossRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=Ko.CROSS_MUTI),C(this,void 0,void 0,(function(){return L(this,(function(n){return console.warn("joinCrossRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{joinType:t,userData:r,mode:Ko.CROSS_MUTI})]}))}))}}),Object.defineProperty(t.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=Ko.RTC),C(this,void 0,void 0,(function(){return L(this,(function(n){return console.warn("joinRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{mode:i,joinType:t,userData:r})]}))}))}}),Object.defineProperty(t.prototype,"joinRTCRoomWithOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,i,o=this;return L(this,(function(a){switch(a.label){case 0:return r=this._logger.createTraceId(),this._logger.info(S.L_RTC_CLIENT_JOIN_RTC_ROOM_T,JSON.stringify({roomId:e,options:t}),r),this._crtRoom?(this._logger.error(S.L_RTC_CLIENT_JOIN_RTC_ROOM_R,JSON.stringify({status:T.FAILED,code:I.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:I.REPERT_JOIN_ROOM}]):[4,(n=this._crtRoom=new ds(this._context,this._runtime,e,this._service,this._options,null==t?void 0:t.mode,null==t?void 0:t.encrypt)).__innerInit((null==t?void 0:t.mode)||Ko.RTC,null==t?void 0:t.joinType,void 0,void 0,null==t?void 0:t.userData,r)];case 1:return(i=a.sent().code)!==I.SUCCESS?(this._crtRoom=null,[2,{code:i}]):(n.once(Qa,(function(){o._crtRoom=null})),[2,{code:i,room:n,userIds:n.getRemoteUserIds(),tracks:n.getRemoteTracks()}])}}))}))}}),Object.defineProperty(t.prototype,"joinLivingRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return C(this,void 0,void 0,(function(){var i,o,a,s,c=this;return L(this,(function(u){switch(u.label){case 0:return i=this._logger.createTraceId(),this._logger.info(S.L_RTC_CLIENT_JOIN_LIVING_ROOM_T,JSON.stringify({roomId:e,livingType:t,joinType:r,outerUserDatas:n}),i),this._crtRoom?(this._logger.error(S.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:T.FAILED,code:I.REPERT_JOIN_ROOM,msg:"Join the room repeatedly -> roomId: ".concat(e)}),i),[2,{code:I.REPERT_JOIN_ROOM}]):[4,(o=this._crtRoom=new _s(this._context,this._runtime,e,this._service,this._options,t,!1,!0)).__innerInit(Ko.LIVE,r,t,void 0,n,i)];case 1:return(a=u.sent().code)!==I.SUCCESS?(this._crtRoom=null,[2,{code:a}]):(o.once(Qa,(function(){c._crtRoom=null})),s={code:a,room:o,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()},o.__getCDNPushMode()===gs.MANUAL&&Object.assign(s,{CDNEnable:o.__getCDNEnable()}),[2,s])}}))}))}}),Object.defineProperty(t.prototype,"getAudienceClient",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._audience||(this._audience=new bs(this._context,this._runtime,this._options)),this._logger.info(S.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O),this._audience}}),Object.defineProperty(t.prototype,"_onIMStatusChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._logger.info(S.L_RTC_CLIENT_IM_CONNECTION_STATE_S,JSON.stringify({status:e,code:t,desc:u[e]})),e===u.DISCONNECTED){if(this._crtRoom){var r=ka.IM_DISCONNECTED;t===i.RC_DISCONN_KICK?r=ka.OTHER_CLIENT_IM_CONNECTED:2===t&&(r=ka.IM_LOGOUT),this._crtRoom.__kickoff(!0,{users:[{userId:this._context.getCurrentId(),type:r}]})}}else if(e===u.CONNECTED){if(this._service.detectorMediaSever(),this._crtRoom instanceof _s)this._getJoinedPKRoomList().forEach((function(e){e.__onReconnected()}));this._crtRoom&&this._crtRoom.__onReconnected()}}}),Object.defineProperty(t.prototype,"_onIMUninit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this._logger.info(S.L_RTC_CLIENT_DESTROY_S,JSON.stringify({msg:"TODO -> on IM client ondestroy"})),null===(e=this._crtRoom)||void 0===e||e.__destroy(!0)}}),Object.defineProperty(t.prototype,"leaveRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return C(this,void 0,void 0,(function(){var r;return L(this,(function(n){switch(n.label){case 0:return r=this._logger.createTraceId(),this._logger.info(S.L_RTC_CLIENT_LEAVE_ROOM_T,JSON.stringify({roomId:e.getRoomId()}),r),this._crtRoom?[4,this._crtRoom.__destroy(!0)]:(this._logger.warn(S.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:T.FAILED,msg:"Room does not exist, without leave"}),r),[2,{code:I.SUCCESS}]);case 1:return n.sent(),this._service.detectorMediaSever(),this._logger.info(S.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:T.SUCCESSED,roomId:null===(t=this._crtRoom)||void 0===t?void 0:t.getRoomId()}),r),this._crtRoom=null,[2,{code:I.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"joinLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return C(this,void 0,void 0,(function(){var n,o,a,s,c,u;return L(this,(function(_){switch(_.label){case 0:return n=this._logger.createTraceId(),this._logger.info(S.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:e,livingType:t}),n),this._service.detectorMediaSever(),this._context.getNaviInfo(),r("roomId",e,l,!0)&&r("livingType",t,(function(e){return e===$a.AUDIO||e===$a.VIDEO}))?this._crtAudienceLivingRoom?(this._logger.error(S.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:T.FAILED,code:I.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),n),[2,{code:I.REPERT_JOIN_ROOM}]):this._service.getNaviMS().length?[4,this._context.joinLivingRoomAsAudience(e,Ko.LIVE,t)]:(this._logger.error(S.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:T.FAILED,code:I.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),n),[2,{code:I.NOT_OPEN_VIDEO_AUDIO_SERVER}]):(this._logger.error(S.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> roomId or livingType"}),n),[2,{code:I.PARAMS_ERROR}]);case 1:return o=_.sent(),a=o.code,s=o.data,a!==i.SUCCESS?(this._logger.error(S.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:T.FAILED,code:a,msg:"signal error -> audience join room"}),n),[2,{code:I.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED}]):(c=lo(),u=new vs(this._context,this._runtime,this._options,e,s,t,c),this._crtAudienceLivingRoom=u,this._logger.info(S.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:T.SUCCESSED,roomData:s}),n),[2,{room:u,code:I.SUCCESS,userIds:u.getRemoteUserIds(),RTCTracks:u.getRemoteRTCTracks(),MCUTracks:u.getRemoteMCUTracks(),CDNUris:u.getCDNInfo()}])}}))}))}}),Object.defineProperty(t.prototype,"leaveLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return L(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(S.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:e.getRoomId(),userId:this._context.getCurrentId()}),t),this._crtAudienceLivingRoom?this._crtAudienceLivingRoom!==e?(this._logger.error(S.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> room"}),t),[2,{code:I.PARAMS_ERROR}]):[4,this._crtAudienceLivingRoom.__destroy(!0)]:(this._logger.warn(S.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:T.FAILED,msg:"Room does not exist, without leave"}),t),[2,{code:I.SUCCESS}]);case 1:return r.sent(),this._crtAudienceLivingRoom=null,this._logger.info(S.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:T.SUCCESSED}),t),[2,{code:I.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"upgradeToAnchorRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,n,o,a,s,c=this;return L(this,(function(u){switch(u.label){case 0:return t=this._logger.createTraceId(),this._logger.info(S.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T,void 0,t),r("room",e,(function(){return e instanceof vs}),!0)?(n=e.getRoomId(),this._crtRoom?(this._logger.error(S.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:T.FAILED,code:I.REPERT_JOIN_ROOM,msg:"Join the room repeatedly",roomId:n}),t),[2,{code:I.REPERT_JOIN_ROOM}]):[4,(o=this._crtRoom=new _s(this._context,this._runtime,n,this._service,this._options,e.livingType,!0,!0,e.getClientSessionId())).__innerInitByIdentityChange(t)]):(this._logger.error(S.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> room"}),t),[2,{code:I.PARAMS_ERROR}]);case 1:return(a=u.sent())!==i.SUCCESS?(this._crtRoom=null,[2,{code:a}]):(o.once(Qa,(function(){c._crtRoom=null})),[4,this._crtAudienceLivingRoom.__destroy(!1)]);case 2:return u.sent(),this._crtAudienceLivingRoom=null,s={room:o,code:I.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()},o.__getCDNPushMode()===gs.MANUAL&&Object.assign(s,{CDNEnable:o.__getCDNEnable()}),[2,s]}}))}))}}),Object.defineProperty(t.prototype,"downgradeToAudienceRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,n,o,a,s,c;return L(this,(function(u){switch(u.label){case 0:return t=this._logger.createTraceId(),this._logger.info(S.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T,JSON.stringify({roomId:e._roomId,userId:this._context.getCurrentId()}),t),e.isMainRoom()?r("room",e,(function(){return e instanceof _s}),!0)?this._crtAudienceLivingRoom?(this._logger.error(S.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:T.FAILED,code:I.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),t),[2,{code:I.REPERT_JOIN_ROOM}]):[4,this._context.rtcIdentityChange(e._roomId,as.AnchorToViewer,e.getLivingType())]:(this._logger.error(S.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:T.FAILED,code:I.PARAMS_ERROR,msg:"params error -> room"}),t),[2,{code:I.PARAMS_ERROR}]):(this._logger.error(S.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:T.FAILED,code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"the `downgradeToAudienceRoom` is disabled in PK room"}),t),[2,{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM}]);case 1:return n=u.sent(),o=n.code,a=n.data,o!==i.SUCCESS?(this._logger.error(S.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:T.FAILED,code:I.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}),t),[2,{code:I.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}]):(this._logger.info(S.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:T.SUCCESSED,roomData:a}),t),s=e.getClientSessionId(),c=new vs(this._context,this._runtime,this._options,e._roomId,a,e.getLivingType(),s),this._crtAudienceLivingRoom=c,this._crtRoom.__destroy(!1),this._crtRoom=null,[2,{room:c,code:I.SUCCESS,userIds:c.getRemoteUserIds(),RTCTracks:c.getRemoteRTCTracks(),MCUTracks:c.getRemoteMCUTracks(),CDNUris:c.getCDNInfo()}])}}))}))}}),Object.defineProperty(t.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C(this,void 0,void 0,(function(){var e,t,r,n,o;return L(this,(function(a){switch(a.label){case 0:return e=this._logger.createTraceId(),t=this._context.getCurrentId(),this._logger.error(S.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T,JSON.stringify({userId:t}),e),[4,this._context.getRTCJoinedUserInfo(t)];case 1:return r=a.sent(),n=r.code,o=r.data,n!==i.SUCCESS?(this._logger.error(S.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:T.FAILED,code:n}),e),[2,{code:n}]):(this._logger.info(S.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:T.SUCCESSED,roomInfo:o}),e),[2,{code:I.SUCCESS,data:o}])}}))}))}}),t}(Es);!function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Rs||(Rs={}));var Ss,Ts="rtcRJoin_data",ys="rtcRExit",Cs="rtcRInfo",Ls="rtcUData",Ps="rtcUDel",Ns="rtcSetData",As="userSetData",ws="rtcQryData",Ds="rtcDelData",Us="rtcToken",ks="rtcUserState",Ms="rtcUList",js="viewerJoinR",Bs="viewerExitR",xs="rtcPullKv",Vs="rtcIdentityChange",Fs="rtcInvite",Js="rtcCancelInvite",Gs="rtcInviteAnswer",Hs="rtcEndInvite",Ks="rtcQueryJoined",Ws="rtcPullRoomStatus",Ys="reportsdk",zs="rtcPing";!function(e){e.RtcInput="RtcInput",e.RtcOutput="RtcOutput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcRoomStatusInput="RtcRoomStatusInput",e.RtcRoomStatusOutput="RtcRoomStatusOutput",e.RtcReportSDKInput="RtcReportSDKInput",e.RtcPBPolaris="RCRTCPBPolaris",e.RtcPBR1Info="RCRTCPBR1Info",e.RtcPBR2Info="RCRTCPBR2Info",e.RtcPBR3Info="RCRTCPBR3Info",e.RtcPBR4Info="RCRTCPBR4Info",e.RtcPBStatusInfo="RCRTCPBStatusInfo",e.RtcPBStreamInfo="RCRTCPBStreamInfo"}(Ss||(Ss={}));var qs,Qs=((Os={})[Ss.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas","supportNtf"],Os[Ss.RtcOutput]=["version"],Os[Ss.RtcUserListOutput]=["users","token","sessionId","roomInfo","version"],Os[Ss.SetUserStatusInput]=["status"],Os[Ss.RtcSetDataInput]=["interior","target","key","value","objectName","content"],Os[Ss.RtcUserSetDataInput]=["valueInfo","objectName","content"],Os[Ss.RtcDataInput]=["interior","target","key","objectName","content"],Os[Ss.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],Os[Ss.MCFollowInput]=["state"],Os[Ss.RtcTokenOutput]=["rtcToken"],Os[Ss.RtcQryOutput]=["outInfo"],Os[Ss.RtcQryUserOutDataInput]=["userId"],Os[Ss.RtcUserOutDataOutput]=["user"],Os[Ss.RtcQueryListInput]=["order"],Os[Ss.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],Os[Ss.RtcValueInfo]=["key","value"],Os[Ss.RtcKeyDeleteInput]=["key"],Os[Ss.RtcNotifyMsg]=["type","time","roomId"],Os[Ss.RtcPullKV]=["timestamp","roomId"],Os[Ss.RtcKVOutput]=["entries","bFullUpdate","syncTime"],Os[Ss.RtcQueryUserJoinedInput]=["userId"],Os[Ss.RtcQueryUserJoinedOutput]=["info"],Os[Ss.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],Os[Ss.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],Os[Ss.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],Os[Ss.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],Os[Ss.RtcRoomStatusInput]=["version"],Os[Ss.RtcRoomStatusOutput]=["bFullStatus","version","usersData","roomStatus"],Os[Ss.RtcReportSDKInput]=["sdkInfo"],Os[Ss.RtcPBPolaris]=["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info"],Os[Ss.RtcPBR1Info]=["joinTime","rtcVersion","imVersion","platform","device","os","browserName","browserVersion"],Os[Ss.RtcPBR2Info]=["joinTime","sendTime","rtcActionType","rtcActionStatus","trackId"],Os[Ss.RtcPBR3Info]=["info"],Os[Ss.RtcPBR4Info]=["info"],Os[Ss.RtcPBStatusInfo]=["joinTime","receiveTime","totalBitRate","appCPUUsage","systemCPUUsage","systemCPUFrequency","networkStatus","googleRTTNetwork","ipAddress","useReceiveBroadBand","useSendBroadBand","packetLossCount","streams"],Os[Ss.RtcPBStreamInfo]=["trackId","codeName","volume","samplingRate","bitRate","packetLossRate","frameRate","resolution","blockTime","jitterData","nAckCount","pliCount","googleRTTTotalTime","isReceiveFirstFrameRate","codeType","isEnabled"],Os),Zs="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ".concat(Ss.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(Ss.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(Ss.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(Ss.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(Ss.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(Ss.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(Ss.RtcRoomStatusInput,"{ // rtc 和 living room 拉房间资源状态使用的参数\n required int64 version =1; //当前客户端最大的房间状态的version\n }\n message ").concat(Ss.RtcRoomStatusOutput,"{ // rtc 和 living room 拉房间资源状态返回的数据\n required bool bFullStatus =1; //标识此次给的数据是否是全量数据\n required int64 version =2; //当前获取后房间的最大版本号\n repeated RtcUserInfo usersData=3;//如果是全量数据,这个不为空,给的是房间全部的人以及发布的资源\n repeated RtcRoomStatus roomStatus=4;//房间增量数据\n }\n message RtcRoomStatus{ //房间状态变动\n required string userId = 1;//用户ID\n required int32 event = 2;//房间状态变更的event(人员加入/退出/离线/发布资源) (0:加入;1:离开;2:离线;3:资源变动) \n required int64 time = 3;//本次变更的版本号\n repeated RtcValueInfo userData = 4;//用户变更的资源(event为0或者3时可能有值)\n optional int32 switchRoleType = 5;//如果是切换角色导致的加入房间或退出房间的类型\n optional string extra = 6;\n }\n message ").concat(Ss.RtcUserListOutput,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n repeated string codeFormat = 8; //当前房间用户支持的编码交集\n optional int64 roomCreateTime = 9;//房间创建时间\n optional int64 userJoinTime = 10;//用户加入房间\n optional int64 version = 11;//当前房间的版本号\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat(Ss.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Ss.RtcInput,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(Ss.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(Ss.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n optional bool supportNtf = 9; //是否支持房间状态的变更通过通知拉取的方式获取\n }\n message ").concat(Ss.RtcQryOutput,"{\n repeated ").concat(Ss.RtcValueInfo," outInfo=1;\n }\n message ").concat(Ss.RtcDataInput,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(Ss.RtcSetDataInput,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(Ss.RtcUserSetDataInput," {\n repeated ").concat(Ss.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(Ss.RtcValueInfo," content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message ").concat(Ss.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(Ss.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(Ss.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Ss.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(Ss.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Ss.RtcNotifyMsg," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(Ss.RtcPullKV,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat(Ss.RtcKVOutput,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(Ss.RtcQueryUserJoinedInput,"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat(Ss.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(Ss.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n optional string sessionId=4;\n optional int64 roomCreateTime = 5;//房间创建时间\n optional int64 userJoinTime = 6;//用户加入房间\n }\n message ").concat(Ss.RtcInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(Ss.RtcCancelInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(Ss.RtcInviteAnswerInput,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(Ss.RtcEndInviteInput,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(Ss.RtcReportSDKInput,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n // ---- 北极星数据上报 -------\n message ').concat(Ss.RtcPBPolaris," {\n required string type = 1;//上报数据类型 R1-R4\n required string appKey = 2;\n required string sessionId = 3;//房间通话id\n required string roomId = 4;\n required int64 roomCreateTime = 5;//房间创建时间\n required string userId = 6;\n required int32 userRole = 7;\n required int64 joinTime = 8;\n required string signalDataCenter = 9;//signal数据中心\n optional ").concat(Ss.RtcPBR1Info," r1Info = 10;\n optional ").concat(Ss.RtcPBR2Info," r2Info = 11;\n optional ").concat(Ss.RtcPBR3Info," r3Info = 12;\n optional ").concat(Ss.RtcPBR4Info," r4Info = 13;\n }\n message ").concat(Ss.RtcPBR1Info," {\n required int64 joinTime = 1;//用户加入房间的时间\n required string rtcVersion = 2;//Rtc版本号\n required string imVersion = 3;//IM SDK 版本\n required string platform = 4;//平台(如:Android、iOS、Web)\n required string device = 5; //设备信息(手机名称+型号)\n required string os = 6;//系统版本(手机系统版本)\n optional string browserName = 7; //浏览器名称, 没有用 -1 表示\n optional string browserVersion = 8;//浏览器版本, 没有用 -1 表示\n optional int64 receiveTime = 9; // 发送数据的时间\n }\n message ").concat(Ss.RtcPBR2Info," {\n required int64 joinTime = 1;\n required int64 sendTime = 2;\n required string rtcActionType = 3;//发布类型 subscribe : 订阅 publish : 发布\n required string rtcActionStatus = 4;//发布状态 begin : 开始 tend : 结束\n repeated string trackId = 5;\n optional int64 receiveTime = 6; // 发送数据的时间\n }\n message ").concat(Ss.RtcPBR3Info," {\n required ").concat(Ss.RtcPBStatusInfo," info = 1;\n }\n message ").concat(Ss.RtcPBR4Info," {\n required ").concat(Ss.RtcPBStatusInfo," info = 1;\n }\n message ").concat(Ss.RtcPBStatusInfo," {\n optional int64 joinTime = 1;//用户加入房间的时间\n optional int64 receiveTime = 2;//用户发布数据流的时间(毫秒),暂时由客户端生成,后期如果有问题服务端做兜底处理\n optional int64 totalBitRate = 3;//总码率\n optional float appCPUUsage = 4;//APP CPU占用率\n optional float systemCPUUsage = 5;////系统 CPU占用率\n optional float systemCPUFrequency = 6;//系统CPU频率 (安卓8.0以上)\n optional string networkStatus = 7;//实时网络状态(2g、3g、4g、wifi)\n optional int32 googleRTTNetwork = 8;//Goog rtt 网络延迟\n optional string ipAddress = 9;//ip地址\n optional string useReceiveBroadBand = 10; //可接收带宽(单位: bit)\n optional string useSendBroadBand = 11;//可用发送带宽(单位: bit)\n optional string packetLossCount = 12;//丢包数\n repeated ").concat(Ss.RtcPBStreamInfo," streams = 13;\n }\n message ").concat(Ss.RtcPBStreamInfo," {\n required string trackId = 1;\n optional string codeName = 2;//编解码名称\n optional string volume = 3;//音频播放音量\n optional int32 samplingRate = 4; //音频采样率\n optional float bitRate = 5;//下行码率\n optional float packetLossRate = 6;\n optional int32 frameRate = 7;//视频接收帧率(单位:fps)\n optional string resolution = 8;//视频分辨率(格式:640*480)\n optional int64 blockTime = 9;//接收卡顿(间隔时间, 单位: ms)\n optional int32 jitterData = 10;//jitter数据抖动\n optional string nAckCount = 11;//nack数量\n optional string pliCount = 12; //PLI请求数\n optional int64 googleRTTTotalTime = 13; //googRtt往返时长\n optional int32 isReceiveFirstFrameRate = 14;//第一个关键帧是否正常收到\n optional string codeType = 15;//编码方式\n optional int32 isEnabled = 16; //当前流的状态是否可用\n }\n // ---- 北极星数据上报 -------\n}\n"),Xs=function(e,t,r,n,i,o,a){var s=i?Object.keys(i).map((function(t){return e.encode(Ss.RtcValueInfo,{key:t,value:i[t]},!0)})):void 0,c=o?Object.keys(o).map((function(t){return e.encode(Ss.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(Ss.RtcInput,{roomType:t,broadcastType:r,joinType:n,innerDatas:s,outerDatas:c,supportNtf:a})},$s=function(e,t){var r=e.decode(Ss.RtcUserListOutput,t),n=r.users,i=r.token,o=r.sessionId,a=r.roomInfo,s=r.entries,c=r.offlineKickTime,u=void 0===c?60:c,l=r.codeFormat,_=r.roomCreateTime,d=r.userJoinTime,f=r.version,p={};return m(n,(function(e){var t=e.userId,r=e.userData,n={};m(r,(function(e){var t=e.key,r=e.value;n[t]=r})),p[t]=n})),{users:p,token:i,sessionId:o,roomInfo:a,kvEntries:s,offlineKickTime:u,codeFormat:l,roomCreateTime:zt(_),userJoinTime:zt(d),version:f}},ec=function(){function e(e,t,r){Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"codec",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomCreateTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userJoinTime",{enumerable:!0,configurable:!0,writable:!0,value:0})}return Object.defineProperty(e.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,o,a,s){return C(this,void 0,void 0,(function(){var c,u,l,_,d,f,p,h,b,g,m,v,R,O;return L(this,(function(E){switch(E.label){case 0:return c=Xs(this.codec,t,r,n,o,a,s),[4,this.context.rtcSignaling(e,Ts,!0,c)];case 1:return u=E.sent(),l=u.code,_=u.buffer,l===i.SUCCESS&&_?(d=$s(this.codec,_),f=d.users,p=d.token,h=d.sessionId,b=d.roomInfo,g=d.kvEntries,m=d.offlineKickTime,v=d.roomCreateTime,R=d.userJoinTime,O=d.version,this.roomCreateTime=v,this.userJoinTime=R,[2,{code:l,data:{users:f,token:p,sessionId:h,roomInfo:b,kvEntries:g,offlineKickTime:m,version:O}}]):[2,{code:l,data:d}]}}))}))}}),Object.defineProperty(e.prototype,"quitRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return L(this,(function(r){switch(r.label){case 0:return t=this.codec.encode(Ss.SetUserStatusInput,{status:0}),[4,this.context.rtcSignaling(e,ys,!0,t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"getRTCRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,o,a;return L(this,(function(s){switch(s.label){case 0:return t=this.codec.encode(Ss.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(e,Cs,!0,t)];case 1:return r=s.sent(),n=r.code,o=r.buffer,n===i.SUCCESS&&o&&(a=this.codec.decode(Ss.RtcRoomInfoOutput,o)),[2,{code:n,data:a}]}}))}))}}),Object.defineProperty(e.prototype,"getRTCUserInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,o,a,s;return L(this,(function(c){switch(c.label){case 0:return t=this.codec.encode(Ss.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(e,Ls,!0,t)];case 1:return r=c.sent(),n=r.code,o=r.buffer,n===i.SUCCESS&&o&&(s=$s(this.codec,o),a={users:s.users}),[2,{code:n,data:a}]}}))}))}}),Object.defineProperty(e.prototype,"getRTCUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"removeRTCUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r;return L(this,(function(n){switch(n.label){case 0:return r=this.codec.encode(Ss.RtcKeyDeleteInput,{key:t}),[4,this.context.rtcSignaling(e,Ps,!1,r)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"setRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return C(this,void 0,void 0,(function(){var a;return L(this,(function(s){switch(s.label){case 0:return a=this.codec.encode(Ss.RtcSetDataInput,{interior:n,target:i,key:t,value:r,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.context.rtcSignaling(e,Ns,!1,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"setRTCTotalRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return C(this,void 0,void 0,(function(){var a,s,c=this;return L(this,(function(u){switch(u.label){case 0:return a={objectName:n,content:[],valueInfo:[this.codec.encode(Ss.RtcValueInfo,{key:"uris",value:r},!0)]},t.forEach((function(e){var t=c.codec.encode(Ss.RtcValueInfo,{key:e.name,value:e.content},!0);a.content.push(t)})),i&&a.valueInfo.push(this.codec.encode(Ss.RtcValueInfo,{key:"mcu_uris",value:i},!0)),o&&a.valueInfo.push(this.codec.encode(Ss.RtcValueInfo,{key:"cdn_uris",value:o},!0)),s=this.codec.encode(Ss.RtcUserSetDataInput,a),[4,this.context.rtcSignaling(e,As,!0,s)];case 1:return[2,u.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"setRTCCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n;return L(this,(function(i){switch(i.label){case 0:return n=this.codec.encode(Ss.RtcUserSetDataInput,{objectName:t,valueInfo:this.codec.encode(Ss.RtcValueInfo,{key:"cdn_uris",value:r},!0)}),[4,this.context.rtcSignaling(e,As,!0,n)];case 1:return[2,i.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"getRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var o,a,s,c,u,l;return L(this,(function(_){switch(_.label){case 0:return o=this.codec.encode(Ss.RtcDataInput,{interior:r,target:n,key:t}),[4,this.context.rtcSignaling(e,ws,!0,o)];case 1:return a=_.sent(),s=a.code,c=a.buffer,s===i.SUCCESS&&c?(u=this.codec.decode(Ss.RtcQryOutput,c).outInfo,l={},u.forEach((function(e){l[e.key]=e.value})),[2,{code:s,data:l}]):[2,{code:s}]}}))}))}}),Object.defineProperty(e.prototype,"removeRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return C(this,void 0,void 0,(function(){var o;return L(this,(function(a){switch(a.label){case 0:return o=this.codec.encode(Ss.RtcDataInput,{interior:r,target:n,key:t,objectName:(null==i?void 0:i.name)||"",content:(null==i?void 0:i.content)||""}),[4,this.context.rtcSignaling(e,Ds,!1,o)];case 1:return[2,a.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"setRTCOutData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){return L(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(e.prototype,"getRTCOutData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){return L(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(e.prototype,"getRTCToken",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,o,a,s,c;return L(this,(function(u){switch(u.label){case 0:return n=Xs(this.codec,t,r),[4,this.context.rtcSignaling(e,Us,!0,n)];case 1:return o=u.sent(),a=o.code,s=o.buffer,a===i.SUCCESS&&s?(c=this.codec.decode(Ss.RtcTokenOutput,s).rtcToken,[2,{code:a,data:{rtcToken:c}}]):[2,{code:a}]}}))}))}}),Object.defineProperty(e.prototype,"setRTCState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r;return L(this,(function(n){switch(n.label){case 0:return r=this.codec.encode(Ss.MCFollowInput,{state:t}),[4,this.context.rtcSignaling(e,ks,!0,r)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"setRTCStateByHttp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return C(this,void 0,void 0,(function(){var i,o,s;return L(this,(function(c){switch(c.label){case 0:i=function(e,t,r){var n=t.type,i=t.appKey,o=t.sessionId,a=t.roomId,s=t.roomCreateTime,c=t.userId,u=t.userRole,l=t.joinTime,_=t.signalDataCenter,d=t.r1Info,f=t.r2Info,p=t.r3Info,h=t.r4Info,b={type:n,appKey:i,sessionId:o,roomId:a,roomCreateTime:s,userId:c,userRole:u,joinTime:l,signalDataCenter:_};if(r===Ga.R1&&d){var g=e.encode(Ss.RtcPBR1Info,d,!0);return e.encode(Ss.RtcPBPolaris,y(y({},b),{r1Info:g}))}if(r===Ga.R2&&f){var m=e.encode(Ss.RtcPBR2Info,f,!0);return e.encode(Ss.RtcPBPolaris,y(y({},b),{r2Info:m}))}if(r===Ga.R3&&p){var v=(I=p.info).streams,R=Array.isArray(v)&&v.map((function(t){return t&&e.encode(Ss.RtcPBStreamInfo,t,!0)})),O=e.encode(Ss.RtcPBStatusInfo,y(y({},I),{streams:R}),!0),E=e.encode(Ss.RtcPBR3Info,{info:O},!0);return e.encode(Ss.RtcPBPolaris,y(y({},b),{r3Info:E}))}if(r===Ga.R4&&h){v=(I=h.info).streams,R=Array.isArray(v)&&v.map((function(t){return t&&e.encode(Ss.RtcPBStreamInfo,t,!0)})),O=e.encode(Ss.RtcPBStatusInfo,y(y({},I),{streams:R}),!0);var I,S=e.encode(Ss.RtcPBR4Info,{info:O},!0);return e.encode(Ss.RtcPBPolaris,y(y({},b),{r4Info:S}))}return{}}(this.codec,r,n),o=e,/^https:\/\//.test(e)||(o="https://".concat(e)),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,t.httpReq({url:"".concat(o,"/rtc/logserver/polaris"),body:i,method:a.POST,headers:{jwt:ho.jwtToken},timeout:2e3})];case 2:if(!(s=c.sent()).data)throw new Error("http request fail");return[2,JSON.parse(s.data).resultCode];case 3:return c.sent(),[2,Ja.REPORT_FAIL];case 4:return[2]}}))}))}}),Object.defineProperty(e.prototype,"getRTCUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,o,a;return L(this,(function(s){switch(s.label){case 0:return t=this.codec.encode(Ss.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(e,Ms,!0,t)];case 1:return r=s.sent(),n=r.code,o=r.buffer,n===i.SUCCESS&&o?(a=$s(this.codec,o),[2,{code:n,data:a}]):[2,{code:n}]}}))}))}}),Object.defineProperty(e.prototype,"joinLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,o,a,s,c,u,l,_,d;return L(this,(function(f){switch(f.label){case 0:return n=Xs(this.codec,t,r),[4,this.context.rtcSignaling(e,js,!0,n)];case 1:return o=f.sent(),a=o.code,s=o.buffer,a===i.SUCCESS&&s?(c=this.codec.decode(Ss.RtcViewerJoinedOutput,s),u=c.rtcToken,l=c.entries,_=c.roomCreateTime,d=c.userJoinTime,this.roomCreateTime=zt(_),this.userJoinTime=zt(d),[2,{code:a,data:{token:u,kvEntries:l}}]):[2,{code:a}]}}))}))}}),Object.defineProperty(e.prototype,"quitLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t;return L(this,(function(r){switch(r.label){case 0:return t=this.codec.encode(Ss.SetUserStatusInput,{status:0}),[4,this.context.rtcSignaling(e,Bs,!0,t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"rtcIdentityChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,o,a,s,c;return L(this,(function(u){switch(u.label){case 0:return n=this.codec.encode(Ss.RtcInput,{roomType:Ko.LIVE,broadcastType:r,identityChangeType:t,needSysChatroom:!1}),[4,this.context.rtcSignaling(e,Vs,!0,n)];case 1:return o=u.sent(),a=o.code,s=o.buffer,a===i.SUCCESS&&s?(c=$s(this.codec,s),[2,{code:a,data:c}]):[2,{code:a}]}}))}))}}),Object.defineProperty(e.prototype,"requestRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a,s;return L(this,(function(c){switch(c.label){case 0:return t=e.invitedRoomId,r=e.invitedUserId,n=e.inviteSessionId,i=e.inviteTimeout,o=e.inviteInfo,a=e.roomId,s=this.codec.encode(Ss.RtcInviteInput,{invitedRoomId:t,invitedUserId:r,inviteSessionId:n,timeoutTime:i,inviteInfo:o}),[4,this.context.rtcSignaling(a,Fs,!0,s)];case 1:return[2,c.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"cancelRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a;return L(this,(function(s){switch(s.label){case 0:return t=e.invitedRoomId,r=e.invitedUserId,n=e.inviteSessionId,i=e.inviteInfo,o=e.roomId,a=this.codec.encode(Ss.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:r,inviteSessionId:n,inviteInfo:i}),[4,this.context.rtcSignaling(o,Js,!0,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"responseRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a,s,c,u;return L(this,(function(l){switch(l.label){case 0:return t=e.inviteUserId,r=e.inviteRoomId,n=e.inviteSessionId,i=e.content,o=e.key,a=e.value,s=e.agree,c=e.roomId,u=this.codec.encode(Ss.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:r,inviteSessionId:n,content:i,key:o,value:a,answerCode:s?1:0}),[4,this.context.rtcSignaling(c,Gs,!0,u)];case 1:return[2,l.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"endRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,i,o,a;return L(this,(function(s){switch(s.label){case 0:return t=e.endRoomId,r=e.sessionId,n=e.content,i=e.keys,o=e.roomId,a=this.codec.encode(Ss.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:r,inviteContent:n,inviteRoomKeys:i}),[4,this.context.rtcSignaling(o,Hs,!0,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"getRTCJoinedUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,o,a;return L(this,(function(s){switch(s.label){case 0:return t=this.codec.encode(Ss.RtcQueryUserJoinedInput,{userId:e}),[4,this.context.rtcSignaling("",Ks,!0,t)];case 1:return r=s.sent(),n=r.code,o=r.buffer,n===i.SUCCESS&&o?(a=this.codec.decode(Ss.RtcQueryUserJoinedOutput,o).info||[],[2,{code:n,data:a.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:zt(e.joinTime)}}))}]):[2,{code:n}]}}))}))}}),Object.defineProperty(e.prototype,"pullRTCRoomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return C(this,void 0,void 0,(function(){var t,r,n,o,a,s,c;return L(this,(function(u){switch(u.label){case 0:return t=this.codec.encode(Ss.RtcPullKV,{timestamp:0,roomId:e}),[4,this.context.rtcSignaling(e,xs,!0,t)];case 1:return r=u.sent(),n=r.code,o=r.buffer,n!==i.SUCCESS?[2,{code:n}]:(a=this.codec.decode(Ss.RtcKVOutput,o),s=a.entries,c=a.syncTime,s=(s||[]).map((function(e){return y(y({},e),{timestamp:zt(e.timestamp)})})),[2,{code:n,data:{kvEntries:s,syncTime:zt(c)}}])}}))}))}}),Object.defineProperty(e.prototype,"pullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return C(this,void 0,void 0,(function(){var r,n,o,a,s;return L(this,(function(c){switch(c.label){case 0:return r=this.codec.encode(Ss.RtcRoomStatusInput,{version:t}),[4,this.context.rtcSignaling(e,Ws,!0,r)];case 1:return n=c.sent(),o=n.code,a=n.buffer,o!==i.SUCCESS?[2,{code:o}]:(s=this.codec.decode(Ss.RtcRoomStatusOutput,a),[2,{code:o,data:s}])}}))}))}}),Object.defineProperty(e.prototype,"decodeRtcNotify",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.decode(Ss.RtcNotifyMsg,e),r=t.time,n=t.type,i=t.roomId;return{time:zt(r),type:n,roomId:i}}}),Object.defineProperty(e.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getCurrentId()}}),Object.defineProperty(e.prototype,"getNaviInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getNaviInfo()}}),Object.defineProperty(e.prototype,"getConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getConnectionStatus()}}),Object.defineProperty(e.prototype,"getAppkey",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getAppkey()}}),Object.defineProperty(e.prototype,"webRtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return C(this,void 0,void 0,(function(){var n,o,a,s,c;return L(this,(function(u){switch(u.label){case 0:return n=this.codec.encode(Ss.RtcInput,{roomType:t,broadcastType:r}),[4,this.context.rtcSignaling(e,zs,!0,n)];case 1:return o=u.sent(),a=o.code,s=o.buffer,a!==i.SUCCESS?[2,{code:a}]:((c=this.codec.decode(Ss.RtcOutput,s)).version=zt(c.version),[2,{code:a,data:c}])}}))}))}}),Object.defineProperty(e.prototype,"rtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return/Electron/.test(navigator.userAgent)?this.context.rtcPingResVersion(e,t,r):this.webRtcPing(e,t,r)}}),Object.defineProperty(e.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this.context.sendMessage(e,t,r)}}),Object.defineProperty(e.prototype,"registerRTCSignalListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.registerRTCSignalListener(e)}}),Object.defineProperty(e.prototype,"registerConnectionStateChangeListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.onconnectionstatechange=e}}),Object.defineProperty(e.prototype,"registerDisconnectListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.ondisconnect=e}}),Object.defineProperty(e.prototype,"registerDestroyListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.ondestroy=e}}),Object.defineProperty(e.prototype,"registerMessageListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.onmessage=e}}),Object.defineProperty(e.prototype,"getCoreVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getCoreVersion()}}),Object.defineProperty(e.prototype,"getPluginContext",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context}}),Object.defineProperty(e.prototype,"reportSDKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.encode(Ss.RtcReportSDKInput,{sdkInfo:JSON.stringify(e)});this.context.rtcSignaling("",Ys,!0,t)}}),e}();!function(e){e.RTC="RTC"}(qs||(qs={})),v.add("rtclib","5.7.3-enterprise-lz-alpha.1");var tc={tag:"RCRTC",verify:function(e){return"undefined"==typeof isSecureContext||isSecureContext?!!v.validEngine("5.8.2")||(console.error("The current engine version '".concat(v.getInfo().engine,"' error, plugin-rtc required engine version at least '").concat("5.8.2","'.")),!1):(console.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(t,r,n){void 0===n&&(n={});var i=t.createLogger("RCRTC",qs.RTC);if(n.logLevel&&i.setOutputLevel(n.logLevel),i.warn(S.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.7.3-enterprise-lz-alpha.1",Commit:"6565408436e4992485ffcec70522294ea53a86d6","browserInfo.browser":Vt.browser,"browserInfo.supportsUnifiedPlan":Vt.supportsUnifiedPlan,"browserInfo.version":Vt.version})),f("options",n,R.OBJECT,!0),f("options.mediaServer",n.mediaServer,(function(e){return!(!h(e)||"https:"===location.protocol&&!/^https/.test(e))})),f("options.timeout",n.timeout,(function(t){return e(t)&&t>=5e3&&t<=3e4})),f("options.pingGap",n.pingGap,(function(t){return e(t)&&t>=3e3&&t<=1e4})),n.AAAWorklet){f("options.AAAWorklet",n.AAAWorklet,R.OBJECT,!0);var o=n.AAAWorklet,a=o.scriptUrl,s=o.wasmUrl;f("AAAWorklet.scriptUrl",a,R.STRING,!0),f("AAAWorklet.wasmUrl",s,R.STRING,!0),lt.SCRIPT_URL=a,lt.WASM_URL=s}return n.encryptor&&(f("options.encrypt",n.encryptor,R.OBJECT,!0),f("options.encrypt.decodeAudio",n.encryptor.decodeAudio,(function(e){return"function"==typeof e}),!0),f("options.encrypt.decodeVideo",n.encryptor.decodeVideo,(function(e){return"function"==typeof e}),!0),f("options.encrypt.encodeAudio",n.encryptor.encodeAudio,(function(e){return"function"==typeof e}),!0),f("options.encrypt.encodeVideo",n.encryptor.encodeVideo,(function(e){return"function"==typeof e}),!0),Lo.init(n.encryptor,i)),new Is(new ec(t,i,t.createCodec(Qs,Zs)),r,n)}},rc={DEFAULT:"RongCloudRTC"},nc={transResolution:Mt,transFrameRate:xt,parseTrackId:At,ifSupportLocalFileTrack:Ft,ifSupportScreenShare:Jt};export{Ka as BackgroundPictureFillMode,Wa as MixLayoutMode,Ya as MixVideoRenderMode,Za as RCAbstractRoom,bs as RCAudienceClient,vs as RCAudienceLivingRoom,ot as RCAudioBitrate,mt as RCCameraVideoTrack,We as RCFrameRate,us as RCInnerCDNPullIsHttps,cs as RCInnerCDNPullKind,ka as RCKickReason,_s as RCLivingRoom,$a as RCLivingType,dt as RCLocalAudioTrack,bt as RCLocalFileAudioTrack,pt as RCLocalFileTrack,ht as RCLocalFileVideoTrack,_t as RCLocalTrack,ft as RCLocalVideoTrack,ts as RCMCUConfigBuilder,Es as RCMediaStreamCapture,ze as RCMediaType,gt as RCMicphoneAudioTrack,Is as RCRTCClient,I as RCRTCCode,xo as RCRTCLiveRole,Ht as RCRTCPingResult,ds as RCRTCRoom,Et as RCRemoteAudioTrack,Ot as RCRemoteTrack,It as RCRemoteVideoTrack,Ye as RCResolution,Rt as RCScreenAudioTrack,vt as RCScreenVideoTrack,rc as RCTag,at as RCTrack,st as RCVideoBitrate,Rs as RTCJoinType,Ko as RTCMode,rt as device,nc as helper,tc as installer};
|