@rongcloud/plugin-rtc 5.36.0-alpha.6 → 5.36.1-nctest-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 +3 -1
- package/dist/index.d.ts +53 -115
- package/dist/index.esm.js +2 -2
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@rongcloud/engine"),t=function(e,r){return t=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])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var i,n,o,a=function(){return a=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};function s(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function c(e,t){var r,i,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function d(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,exports.RCRTCCode=void 0,(i=exports.RCRTCCode||(exports.RCRTCCode={}))[i.SUCCESS=1e4]="SUCCESS",i[i.PB_ERROR=40001]="PB_ERROR",i[i.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",i[i.PARAMS_ERROR=50001]="PARAMS_ERROR",i[i.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",i[i.NOT_IN_ROOM=50003]="NOT_IN_ROOM",i[i.SERVICE_INVALID=50004]="SERVICE_INVALID",i[i.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",i[i.ASR_NOT_AVAILABLE=50034]="ASR_NOT_AVAILABLE",i[i.ASR_NOT_START=50035]="ASR_NOT_START",i[i.SIGNAL_ERROR=53001]="SIGNAL_ERROR",i[i.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",i[i.REQUEST_FAILED=53004]="REQUEST_FAILED",i[i.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",i[i.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",i[i.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",i[i.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",i[i.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",i[i.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",i[i.BROWSER_PERMISSION_DENIED=53012]="BROWSER_PERMISSION_DENIED",i[i.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",i[i.INVALID_TAGS=53014]="INVALID_TAGS",i[i.INVALID_USER_ID=53015]="INVALID_USER_ID",i[i.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",i[i.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",i[i.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",i[i.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",i[i.TRACK_NOT_READY=53020]="TRACK_NOT_READY",i[i.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",i[i.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",i[i.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",i[i.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",i[i.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",i[i.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",i[i.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",i[i.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",i[i.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",i[i.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM",i[i.SOME_TRACKS_PUBLISH_FAILED=53031]="SOME_TRACKS_PUBLISH_FAILED",i[i.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO=53032]="MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO",i[i.JWT_TIME_OUT=1004]="JWT_TIME_OUT",i[i.SYSTEM_PERMISSION_DENIED=53033]="SYSTEM_PERMISSION_DENIED",i[i.PUBLISH_TRACKS_IS_INVALID=53034]="PUBLISH_TRACKS_IS_INVALID",i[i.TRACK_READYSTATE_IS_ENDED=53035]="TRACK_READYSTATE_IS_ENDED",i[i.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH=53036]="APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH",i[i.LOAD_3A_MODULE_FAILED=53037]="LOAD_3A_MODULE_FAILED",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_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_APPLY_VIDEO_ASPECT_RATIO_O="L-rtc_client_apply_video_aspect_ratio-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_RTC_CLIENT_GENERATE_SUMMARIZATION_T="L-rtc_client_generate_summarization-T",e.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R="L-rtc_client_generate_summarization-R",e.L_RTC_CLIENT_GET_ASR_CONTENT_T="L-rtc_client_get_asr_content-T",e.L_RTC_CLIENT_GET_ASR_CONTENT_R="L-rtc_client_get_asr_content-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_ABSTRACT_ROOM_SET_SRC_LANGUAGE_T="L-abstract_room_set_src_language-T",e.L_ABSTRACT_ROOM_SET_SRC_LANGUAGE_R="L-abstract_room_set_src_language-R",e.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_T="L-abstract_room_operate_asr_status-T",e.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R="L-abstract_room_operate_asr_status-R",e.L_ABSTRACT_ROOM_SET_ENABLE_ASR_T="L-abstract_room_set_enable_asr-T",e.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R="L-abstract_room_set_enable_asr-R",e.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_T="L-abstract_room_operate_realtime_translation-T",e.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R="L-abstract_room_operate_realtime_translation-R",e.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_T="L-abstract_room_operate_summarization-T",e.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R="L-abstract_room_operate_summarization-R",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",e.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_T="L-rtc_client_change_media_device-T",e.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R="L-rtc_client_change_media_device-R"}(n||(n={})),function(e){e.FAILED="fail",e.SUCCESSED="success",e.TIMEOUT="timeout",e.INFO="info"}(o||(o={}));let _=!0,p=!0;function f(e,t,r){const i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function h(e,t,r){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);const o=e=>{const t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};const o=i.removeEventListener;i.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 i=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,i])},Object.defineProperty(i,"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 R(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(_=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function b(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(p=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function g(){if("object"==typeof window){if(_)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function m(e,t){p&&console.warn(e+" is deprecated, please use "+t+" instead.")}function C(e){return"[object Object]"===Object.prototype.toString.call(e)}function v(e){return C(e)?Object.keys(e).reduce((function(t,r){const i=C(e[r]),n=i?v(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,{[r]:n})}),{}):e}function T(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((i=>{i.endsWith("Id")?T(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((t=>{T(e,e.get(t),r)}))})))}function O(e,t,r){const i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===i&&r.trackId===t.id&&T(e,r,n)}))})),n}const S=g;function E(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const i=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 i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let e={};"number"==typeof i.ideal?(e[n("min",r)]=i.ideal,t.optional.push(e),e={},e[n("max",r)]=i.ideal,t.optional.push(e)):(e[n("",r)]=i.ideal,t.optional.push(e))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",r)]=i.exact):["min","max"].forEach((e=>{void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,r)]=i[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(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=i(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=i(e.video),S("chrome: "+JSON.stringify(e)),n(e)}))}e.video=i(e.video)}return S("chrome: "+JSON.stringify(e)),n(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,i){n(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{i&&i(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return n(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 I(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 i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const n=new Event("track");n.track=r.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})),t.stream.getTracks().forEach((r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const n=new Event("track");n.track=r,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else h(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function L(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,i){let n=r.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.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 i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.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 A(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,i]=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 n=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 i=function(e){r(o(n(e)))};return t.apply(this,[i,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(n(t)))},r])})).then(r,i)}}function P(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=>O(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}),h(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>O(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,i;return this.getSenders().forEach((r=>{r.track===e&&(t?i=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?i=!0:r=t),t.track===e))),i||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 N(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 i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};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 i=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(i)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};const n=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]})),n.apply(this,arguments)}}function w(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return N(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 i=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}i.apply(this,[t])};const n=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.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 i=[].slice.call(arguments,1);if(1!==i.length||!i[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 n=this._streams[r.id];if(n)n.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const i=new e.MediaStream([t]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[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]=i[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 i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.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 D(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],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}))}function k(e,t){h(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var U=Object.freeze({__proto__:null,shimMediaStream:I,shimOnTrack:y,shimGetSendersWithDtmf:L,shimGetStats:A,shimSenderReceiverGetStats:P,shimAddTrackRemoveTrackWithNative:N,shimAddTrackRemoveTrack:w,shimPeerConnection:D,fixNegotiationNeeded:k,shimGetUserMedia:E,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 i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var M,x,j=(M=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]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:r[t[i]]=t[i+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={},i=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<i.length;n++)r[(t=i[n].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 i=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.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)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+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 i=t.matchPrefix(e+r,"a=ice-ufrag:")[0],n=t.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substr(12),password:n.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:[]},i=t.splitLines(e)[0].split(" "),n=3;n<i.length;n++){var o=i[n],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 i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)}));var n=0;return r.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),i+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach((function(e){i+=t.writeExtmap(e)})),i},t.parseRtpEncodingParameters=function(e){var r,i=[],n=t.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.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]),n.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}),i.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},i.push(t))}})),0===i.length&&c&&i.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,i.forEach((function(e){e.maxBitrate=l}))),i},t.parseRtcpParameters=function(e){var r={},i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);var n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,i=t.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(r=n[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,i=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");n.length>0&&(r=parseInt(n[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:i.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,i){var n=void 0!==r?r:2;return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,i,n){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"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:"+n.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 i=t.splitLines(e),n=0;n<i.length;n++)switch(i[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[n].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),i=0;i<r.length;i++)if(r[i].length<2||"="!==r[i].charAt(1))return!1;return!0},e.exports=t},M(x={exports:{}},x.exports),x.exports);function B(e,t,r,i,n){var o=j.writeRtpDescription(e.kind,t);if(o+=j.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=j.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":n||"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:"+(i?i.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:"+j.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+j.localCName+"\r\n"),o}function V(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},i=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]},n=function(e,t,r,n){var o=i(e.parameters.apt,r),a=i(t.parameters.apt,n);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach((function(i){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(i.name.toLowerCase()===a.name.toLowerCase()&&i.clockRate===a.clockRate){if("rtx"===i.name.toLowerCase()&&i.parameters&&a.parameters.apt&&!n(i,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(i.numChannels,a.numChannels),r.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter((function(e){for(var t=0;t<i.rtcpFeedback.length;t++)if(i.rtcpFeedback[t].type===e.type&&i.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var i=0;i<t.headerExtensions.length;i++){var n=t.headerExtensions[i];if(e.uri===n.uri){r.headerExtensions.push(n);break}}})),r}function F(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 J(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 G(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 H=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function i(t,r,i,n){var o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=n,e.setTimeout((function(){t._dispatchEvent("track",o)}))}var n=function(r){var i=this,n=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){i[e]=n[e].bind(n)})),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 G("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 i=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var n="string"==typeof i;return n&&(i=[i]),i=i.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=n?i[0]:i,!!i.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=j.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(n.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(n.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),n.prototype.onicecandidate=null,n.prototype.onaddstream=null,n.prototype.ontrack=null,n.prototype.onremovestream=null,n.prototype.onsignalingstatechange=null,n.prototype.oniceconnectionstatechange=null,n.prototype.onconnectionstatechange=null,n.prototype.onicegatheringstatechange=null,n.prototype.onnegotiationneeded=null,n.prototype.ondatachannel=null,n.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},n.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},n.prototype.getConfiguration=function(){return this._config},n.prototype.getLocalStreams=function(){return this.localStreams},n.prototype.getRemoteStreams=function(){return this.remoteStreams},n.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0,i={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)i.iceTransport=this.transceivers[0].iceTransport,i.dtlsTransport=this.transceivers[0].dtlsTransport;else{var n=this._createIceAndDtlsTransports();i.iceTransport=n.iceTransport,i.dtlsTransport=n.dtlsTransport}return t||this.transceivers.push(i),i},n.prototype.addTrack=function(t,r){if(this._isClosed)throw G("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var i;if(this.transceivers.find((function(e){return e.track===t})))throw G("InvalidAccessError","Track already exists.");for(var n=0;n<this.transceivers.length;n++)this.transceivers[n].track||this.transceivers[n].kind!==t.kind||(i=this.transceivers[n]);return i||(i=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),i.track=t,i.stream=r,i.rtpSender=new e.RTCRtpSender(t,i.dtlsTransport),i.rtpSender},n.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach((function(t){r.addTrack(t,e)}));else{var i=e.clone();e.getTracks().forEach((function(e,t){var r=i.getTracks()[t];e.addEventListener("enabled",(function(e){r.enabled=e.enabled}))})),i.getTracks().forEach((function(e){r.addTrack(e,i)}))}},n.prototype.removeTrack=function(t){if(this._isClosed)throw G("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 G("InvalidAccessError","Sender was not created by this connection.");var i=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(i)&&this.localStreams.indexOf(i)>-1&&this.localStreams.splice(this.localStreams.indexOf(i),1),this._maybeFireNegotiationNeeded()},n.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)}))},n.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},n.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},n.prototype._createIceGatherer=function(t,r){var i=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var n=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(n,"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;n.state=r?"completed":"gathering",null!==i.transceivers[t].bufferedCandidateEvents&&i.transceivers[t].bufferedCandidateEvents.push(e)},n.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),n},n.prototype._gather=function(t,r){var i=this,n=this.transceivers[r].iceGatherer;if(!n.onlocalcandidate){var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,n.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),n.onlocalcandidate=function(e){if(!(i.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"!==n.state&&"gathering"!==n.state||(n.state="completed");else{"new"===n.state&&(n.state="gathering"),a.component=1,a.ufrag=n.getLocalParameters().usernameFragment;var c=j.writeCandidate(a);o.candidate=Object.assign(o.candidate,j.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=j.getMediaSections(i._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",i._localDescription.sdp=j.getDescription(i._localDescription.sdp)+u.join("");var l=i.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==i.iceGatheringState&&(i.iceGatheringState="gathering",i._emitGatheringStateChange()),s||i._dispatchEvent("icecandidate",o),l&&(i._dispatchEvent("icecandidate",new Event("icecandidate")),i.iceGatheringState="complete",i._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){n.onlocalcandidate(e)}))}),0)}},n.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var i=new e.RTCDtlsTransport(r);return i.ondtlsstatechange=function(){t._updateConnectionState()},i.onerror=function(){Object.defineProperty(i,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:i}},n.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 i=this.transceivers[e].dtlsTransport;i&&(delete i.ondtlsstatechange,delete i.onerror,delete this.transceivers[e].dtlsTransport)},n.prototype._transceive=function(e,r,i){var n=V(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(n.encodings=e.sendEncodingParameters,n.rtcp={cname:j.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(n.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(n)),i&&e.rtpReceiver&&n.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?n.encodings=e.recvEncodingParameters:n.encodings=[{}],n.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(n.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(n.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(n))},n.prototype.setLocalDescription=function(e){var t,r,i=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(G("TypeError",'Unsupported type "'+e.type+'"'));if(!F("setLocalDescription",e.type,i.signalingState)||i._isClosed)return Promise.reject(G("InvalidStateError","Can not set local "+e.type+" in state "+i.signalingState));if("offer"===e.type)t=j.splitSections(e.sdp),r=t.shift(),t.forEach((function(e,t){var r=j.parseRtpParameters(e);i.transceivers[t].localCapabilities=r})),i.transceivers.forEach((function(e,t){i._gather(e.mid,t)}));else if("answer"===e.type){t=j.splitSections(i._remoteDescription.sdp),r=t.shift();var n=j.matchPrefix(r,"a=ice-lite").length>0;t.forEach((function(e,t){var o=i.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,l=o.remoteCapabilities;if(!(j.isRejected(e)&&0===j.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var d=j.getIceParameters(e,r),_=j.getDtlsParameters(e,r);n&&(_.role="server"),i.usingBundle&&0!==t||(i._gather(o.mid,t),"new"===s.state&&s.start(a,d,n?"controlling":"controlled"),"new"===c.state&&c.start(_));var p=V(u,l);i._transceive(o,p.codecs.length>0,!1)}}))}return i._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?i._updateSignalingState("have-local-offer"):i._updateSignalingState("stable"),Promise.resolve()},n.prototype.setRemoteDescription=function(n){var o=this;if(-1===["offer","answer"].indexOf(n.type))return Promise.reject(G("TypeError",'Unsupported type "'+n.type+'"'));if(!F("setRemoteDescription",n.type,o.signalingState)||o._isClosed)return Promise.reject(G("InvalidStateError","Can not set remote "+n.type+" in state "+o.signalingState));var a={};o.remoteStreams.forEach((function(e){a[e.id]=e}));var s=[],c=j.splitSections(n.sdp),u=c.shift(),l=j.matchPrefix(u,"a=ice-lite").length>0,d=j.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=d;var _=j.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!_&&_.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(i,c){var _=j.splitLines(i),p=j.getKind(i),f=j.isRejected(i)&&0===j.matchPrefix(i,"a=bundle-only").length,h=_[0].substr(2).split(" ")[2],R=j.getDirection(i,u),b=j.parseMsid(i),g=j.getMid(i)||j.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===h||"UDP/DTLS/SCTP"===h))o.transceivers[c]={mid:g,kind:p,protocol:h,rejected:!0};else{var m,C,v,T,O,S,E,I,y;!f&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(p,!0));var L,A,P=j.parseRtpParameters(i);f||(L=j.getIceParameters(i,u),(A=j.getDtlsParameters(i,u)).role="client"),E=j.parseRtpEncodingParameters(i);var N=j.parseRtcpParameters(i),w=j.matchPrefix(i,"a=end-of-candidates",u).length>0,D=j.matchPrefix(i,"a=candidate:").map((function(e){return j.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===n.type||"answer"===n.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"!==n.type||f){if("answer"===n.type&&!f){C=(m=o.transceivers[c]).iceGatherer,v=m.iceTransport,T=m.dtlsTransport,O=m.rtpReceiver,S=m.sendEncodingParameters,I=m.localCapabilities,o.transceivers[c].recvEncodingParameters=E,o.transceivers[c].remoteCapabilities=P,o.transceivers[c].rtcpParameters=N,D.length&&"new"===v.state&&(!l&&!w||d&&0!==c?D.forEach((function(e){J(m.iceTransport,e)})):v.setRemoteCandidates(D)),d&&0!==c||("new"===v.state&&v.start(C,L,"controlling"),"new"===T.state&&T.start(A)),!V(m.localCapabilities,m.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&m.sendEncodingParameters[0].rtx&&delete m.sendEncodingParameters[0].rtx,o._transceive(m,"sendrecv"===R||"recvonly"===R,"sendrecv"===R||"sendonly"===R),!O||"sendrecv"!==R&&"sendonly"!==R?delete m.rtpReceiver:(y=O.track,b?(a[b.stream]||(a[b.stream]=new e.MediaStream),r(y,a[b.stream]),s.push([y,O,a[b.stream]])):(a.default||(a.default=new e.MediaStream),r(y,a.default),s.push([y,O,a.default])))}}else{(m=o.transceivers[c]||o._createTransceiver(p)).mid=g,m.iceGatherer||(m.iceGatherer=o._createIceGatherer(c,d)),D.length&&"new"===m.iceTransport.state&&(!w||d&&0!==c?D.forEach((function(e){J(m.iceTransport,e)})):m.iceTransport.setRemoteCandidates(D)),I=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(I.codecs=I.codecs.filter((function(e){return"rtx"!==e.name}))),S=m.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var k,U=!1;if("sendrecv"===R||"sendonly"===R){if(U=!m.rtpReceiver,O=m.rtpReceiver||new e.RTCRtpReceiver(m.dtlsTransport,p),U)y=O.track,b&&"-"===b.stream||(b?(a[b.stream]||(a[b.stream]=new e.MediaStream,Object.defineProperty(a[b.stream],"id",{get:function(){return b.stream}})),Object.defineProperty(y,"id",{get:function(){return b.track}}),k=a[b.stream]):(a.default||(a.default=new e.MediaStream),k=a.default)),k&&(r(y,k),m.associatedRemoteMediaStreams.push(k)),s.push([y,O,k])}else m.rtpReceiver&&m.rtpReceiver.track&&(m.associatedRemoteMediaStreams.forEach((function(t){var r=t.getTracks().find((function(e){return e.id===m.rtpReceiver.track.id}));r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)})),m.associatedRemoteMediaStreams=[]);m.localCapabilities=I,m.remoteCapabilities=P,m.rtpReceiver=O,m.rtcpParameters=N,m.sendEncodingParameters=S,m.recvEncodingParameters=E,o._transceive(o.transceivers[c],!1,U)}}})),void 0===o._dtlsRole&&(o._dtlsRole="offer"===n.type?"active":"passive"),o._remoteDescription={type:n.type,sdp:n.sdp},"offer"===n.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 n=new Event("addstream");n.stream=r,e.setTimeout((function(){o._dispatchEvent("addstream",n)}))}s.forEach((function(e){var t=e[0],n=e[1];r.id===e[2].id&&i(o,t,n,[r])}))}})),s.forEach((function(e){e[2]||i(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()},n.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")},n.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},n.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))},n.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)}},n.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)}},n.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(G("InvalidStateError","Can not call createOffer after close"));var i=r.transceivers.filter((function(e){return"audio"===e.kind})).length,n=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&&(i=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(n=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(r.transceivers.forEach((function(e){"audio"===e.kind?--i<0&&(e.wantReceive=!1):"video"===e.kind&&--n<0&&(e.wantReceive=!1)}));i>0||n>0;)i>0&&(r._createTransceiver("audio"),i--),n>0&&(r._createTransceiver("video"),n--);var a=j.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach((function(i,n){var o=i.track,a=i.kind,s=i.mid||j.generateIdentifier();i.mid=s,i.iceGatherer||(i.iceGatherer=r._createIceGatherer(n,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"),i.remoteCapabilities&&i.remoteCapabilities.codecs&&i.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(i.remoteCapabilities&&i.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=i.sendEncodingParameters||[{ssrc:1001*(2*n+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),i.wantReceive&&(i.rtpReceiver=new e.RTCRtpReceiver(i.dtlsTransport,a)),i.localCapabilities=c,i.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+=B(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="+j.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)},n.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(G("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(G("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var i=j.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(i+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),i+="a=ice-options:trickle\r\n";var n=j.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach((function(e,o){if(!(o+1>n)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?i+="m=application 0 DTLS/SCTP 5000\r\n":i+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?i+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(i+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(i+="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=V(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,i+=B(e,s,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(i+="a=rtcp-rsize\r\n")}}));var o=new e.RTCSessionDescription({type:"answer",sdp:i});return Promise.resolve(o)},n.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(i,n){if(!r._remoteDescription)return n(G("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 n(G("OperationError","Can not add ICE candidate"));if(s.rejected)return i();var c=Object.keys(e.candidate).length>0?j.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return i();if(c.component&&1!==c.component)return i();if((0===o||o>0&&s.iceTransport!==r.transceivers[0].iceTransport)&&!J(s.iceTransport,c))return n(G("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=j.getMediaSections(r._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=j.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=j.getMediaSections(r._remoteDescription.sdp))[l]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=j.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));l++);i()}))},n.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 G("InvalidAccessError","Invalid selector.");return r.getStats()}var i=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&i.push(e[t].getStats())}))})),Promise.all(i).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 i=r.prototype.getStats;r.prototype.getStats=function(){return i.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(r){var i;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(i=e[r]).type]||i.type,t.set(r,e[r])})),t}))}}}));var o=["createOffer","createAnswer"];return o.forEach((function(e){var t=n.prototype[e];n.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=n.prototype[e];n.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=n.prototype[e];n.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)}})),n};function K(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 W(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 z(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=H(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&&m("RTCIceServer.url","RTCIceServer.urls");const i="string"==typeof r;return i&&(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=i?r[0]:r,!!r.length}}))}(e.iceServers,t.version),g("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function Y(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var q=Object.freeze({__proto__:null,shimPeerConnection:z,shimReplaceTrack:Y,shimGetUserMedia:K,shimGetDisplayMedia:W});function Z(e,t){const r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){m("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(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)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.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 Q(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 X(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],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,o]=arguments;return i.apply(this,[e||null]).then((e=>{if(t.version<53&&!n)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,i)=>{e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(n,o)}}function $(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 ee(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}),h(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function te(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){m("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function re(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 i=t.apply(this,arguments);if(r){const{sender:t}=i,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 i})}function ne(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 oe(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 ae(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 se=Object.freeze({__proto__:null,shimOnTrack:Q,shimPeerConnection:X,shimSenderGetStats:$,shimReceiverGetStats:ee,shimRemoveStream:te,shimRTCDataChannel:re,shimAddTransceiver:ie,shimGetParameters:ne,shimCreateOffer:oe,shimCreateAnswer:ae,shimGetUserMedia:Z,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 ce(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 ue(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 le(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n};let s=function(e,t,r){const i=n.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};t.setLocalDescription=s,s=function(e,t,r){const i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.setRemoteDescription=s,s=function(e,t,r){const i=a.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.addIceCandidate=s}function de(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(_e(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function _e(e){return e&&void 0!==e.video?Object.assign({},e,{video:v(e.video)}):e}function pe(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 i=e.iceServers[r];!i.hasOwnProperty("urls")&&i.hasOwnProperty("url")?(m("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):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 fe(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){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 Re(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var be=Object.freeze({__proto__:null,shimLocalStreamsAPI:ce,shimRemoteStreamsAPI:ue,shimCallbacksAPI:le,shimGetUserMedia:de,shimConstraints:_e,shimRTCIceServerUrls:pe,shimTrackEventTransceiver:fe,shimCreateOfferLegacy:he,shimAudioContext:Re});function ge(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),i=j.parseCandidate(e.candidate),n=Object.assign(r,i);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,h(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function me(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=j.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=j.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),i=function(e,r){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const n=j.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i}(arguments[0],e);let n;n=0===r&&0===i?Number.POSITIVE_INFINITY:0===r||0===i?Math.max(r,i):Math.min(r,i);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>n}),this._sctp=o}return r.apply(this,arguments)}}function Ce(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&n>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},h(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function ve(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 Te(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 Oe(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 Se=Object.freeze({__proto__:null,shimRTCIceCandidate:ge,shimMaxMessageSize:me,shimSendThrowTypeError:Ce,shimConnectionState:ve,removeExtmapAllowMixed:Te,shimAddIceCandidateNullOrEmpty:Oe});const Ee=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const r=g,i=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=f(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=f(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.mediaDevices&&r.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=f(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=f(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),n={browserDetails:i,commonShim:Se,extractVersion:f,disableLog:R,disableWarnings:b};switch(i.browser){case"chrome":if(!U||!D||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),n;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),n;r("adapter.js shimming chrome."),n.browserShim=U,Oe(e,i),E(e,i),I(e),D(e,i),y(e),w(e,i),L(e),A(e),P(e),k(e,i),ge(e),ve(e),me(e,i),Ce(e),Te(e,i);break;case"firefox":if(!se||!X||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),n;r("adapter.js shimming firefox."),n.browserShim=se,Oe(e,i),Z(e,i),X(e,i),Q(e),te(e),$(e),ee(e),re(e),ie(e),ne(e),oe(e),ae(e),ge(e),ve(e),me(e,i),Ce(e);break;case"edge":if(!q||!z||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),n;r("adapter.js shimming edge."),n.browserShim=q,K(e),W(e),z(e,i),Y(e),me(e,i),Ce(e);break;case"safari":if(!be||!t.shimSafari)return r("Safari shim is not included in this adapter release."),n;r("adapter.js shimming safari."),n.browserShim=be,Oe(e,i),pe(e),he(e),le(e),ce(e),ue(e),fe(e),de(e),Re(e),ge(e),me(e,i),Ce(e),Te(e,i);break;default:r("Unsupported browser!")}return n}({window:"undefined"==typeof window?void 0:window});var Ie,ye,Le,Ae;exports.RCFrameRate=void 0,(Ie=exports.RCFrameRate||(exports.RCFrameRate={})).FPS_10="FPS_10",Ie.FPS_15="FPS_15",Ie.FPS_24="FPS_24",Ie.FPS_30="FPS_30",exports.RCResolution=void 0,(ye=exports.RCResolution||(exports.RCResolution={})).W176_H132="W176_H132",ye.W176_H144="W176_H144",ye.W180_H180="W180_H180",ye.W240_H180="W240_H180",ye.W240_H240="W240_H240",ye.W256_H144="W256_H144",ye.W320_H180="W320_H180",ye.W320_H240="W320_H240",ye.W360_H360="W360_H360",ye.W480_H360="W480_H360",ye.W480_H480="W480_H480",ye.W640_H360="W640_H360",ye.W640_H480="W640_H480",ye.W720_H480="W720_H480",ye.W848_H480="W848_H480",ye.W960_H720="W960_H720",ye.W1280_H720="W1280_H720",ye.W1920_H1080="W1920_H1080",ye.W144_H176="W144_H176",ye.W144_H256="W144_H256",ye.W180_H240="W180_H240",ye.W180_H320="W180_H320",ye.W240_H320="W240_H320",ye.W360_H480="W360_H480",ye.W360_H640="W360_H640",ye.W480_H640="W480_H640",ye.W480_H720="W480_H720",ye.W480_H848="W480_H848",ye.W720_H1280="W720_H1280",ye.W720_H960="W720_H960",ye.W1080_H1920="W1080_H1920",exports.RCMediaType=void 0,(Le=exports.RCMediaType||(exports.RCMediaType={}))[Le.AUDIO_ONLY=0]="AUDIO_ONLY",Le[Le.VIDEO_ONLY=1]="VIDEO_ONLY",Le[Le.AUDIO_VIDEO=2]="AUDIO_VIDEO";var Pe,Ne=((Ae={})[exports.RCResolution.W176_H132]={width:176,height:132,maxBitrate:150,minBitrate:80},Ae[exports.RCResolution.W176_H144]={width:176,height:144,maxBitrate:150,minBitrate:80},Ae[exports.RCResolution.W180_H180]={width:180,height:180,maxBitrate:200,minBitrate:100},Ae[exports.RCResolution.W240_H180]={width:240,height:180,maxBitrate:240,minBitrate:120},Ae[exports.RCResolution.W240_H240]={width:240,height:240,maxBitrate:280,minBitrate:120},Ae[exports.RCResolution.W256_H144]={width:256,height:144,maxBitrate:240,minBitrate:120},Ae[exports.RCResolution.W320_H180]={width:320,height:180,maxBitrate:280,minBitrate:120},Ae[exports.RCResolution.W320_H240]={width:320,height:240,maxBitrate:400,minBitrate:120},Ae[exports.RCResolution.W360_H360]={width:360,height:360,maxBitrate:520,minBitrate:140},Ae[exports.RCResolution.W480_H360]={width:480,height:360,maxBitrate:650,minBitrate:150},Ae[exports.RCResolution.W480_H480]={width:480,height:480,maxBitrate:800,minBitrate:180},Ae[exports.RCResolution.W640_H360]={width:640,height:360,maxBitrate:800,minBitrate:180},Ae[exports.RCResolution.W640_H480]={width:640,height:480,maxBitrate:900,minBitrate:200},Ae[exports.RCResolution.W720_H480]={width:720,height:480,maxBitrate:1e3,minBitrate:200},Ae[exports.RCResolution.W848_H480]={width:848,height:480,maxBitrate:1860,minBitrate:200},Ae[exports.RCResolution.W960_H720]={width:960,height:720,maxBitrate:2e3,minBitrate:250},Ae[exports.RCResolution.W1280_H720]={width:1280,height:720,maxBitrate:2200,minBitrate:250},Ae[exports.RCResolution.W1920_H1080]={width:1920,height:1080,maxBitrate:4e3,minBitrate:400},Ae[exports.RCResolution.W144_H176]={width:144,height:176,maxBitrate:150,minBitrate:80},Ae[exports.RCResolution.W144_H256]={width:144,height:256,maxBitrate:240,minBitrate:120},Ae[exports.RCResolution.W180_H240]={width:180,height:240,maxBitrate:240,minBitrate:120},Ae[exports.RCResolution.W180_H320]={width:180,height:320,maxBitrate:280,minBitrate:120},Ae[exports.RCResolution.W240_H320]={width:240,height:320,maxBitrate:400,minBitrate:120},Ae[exports.RCResolution.W360_H480]={width:360,height:480,maxBitrate:650,minBitrate:150},Ae[exports.RCResolution.W360_H640]={width:360,height:640,maxBitrate:800,minBitrate:180},Ae[exports.RCResolution.W480_H640]={width:480,height:640,maxBitrate:900,minBitrate:200},Ae[exports.RCResolution.W480_H720]={width:480,height:720,maxBitrate:1e3,minBitrate:200},Ae[exports.RCResolution.W480_H848]={width:480,height:848,maxBitrate:1860,minBitrate:930},Ae[exports.RCResolution.W720_H1280]={width:720,height:1280,maxBitrate:2200,minBitrate:250},Ae[exports.RCResolution.W720_H960]={width:720,height:960,maxBitrate:2760,minBitrate:910},Ae[exports.RCResolution.W1080_H1920]={width:1080,height:1920,maxBitrate:4e3,minBitrate:400},Ae),we=function(e){var t={192:180,368:360,1088:1080};return t[e]?t[e]:e},De=function(e,t){e=we(e),t=we(t);var r=Ne["W".concat(e,"_H").concat(t)];if(r)return r;var i=e*t;return Object.keys(Ne).map((function(e){return Ne[e]})).sort((function(e,t){return e.height*e.width-t.width*t.height})).filter((function(e){return e.height*e.width>=i}))[0]||Ne.W1920_H1080},ke={10:1,15:1,24:1.5,30:1.5},Ue=function(e){var t=Number.MAX_VALUE,r=1;for(var i in ke){var n=Math.abs(e-parseInt(i));n<t&&(t=n,r=ke[i])}return r},Me={getCameras:function(){return s(void 0,void 0,void 0,(function(){return c(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 s(void 0,void 0,void 0,(function(){return c(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 s(void 0,void 0,void 0,(function(){return c(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"}(Pe||(Pe={}));var xe,je,Be,Ve=function(t){function i(e,r,i,n,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:i}),Object.defineProperty(s,"_kind",{enumerable:!0,configurable:!0,writable:!0,value:n}),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 r(i,t),Object.defineProperty(i.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._streamId}}),Object.defineProperty(i.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._id}}),Object.defineProperty(i.prototype,"getUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._userId}}),Object.defineProperty(i.prototype,"__innerGetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msTrack}}),Object.defineProperty(i.prototype,"streamTrack",{get:function(){return this._msTrack},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"getTag",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._tag}}),Object.defineProperty(i.prototype,"isLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isLocalTrack}}),Object.defineProperty(i.prototype,"isVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"video"===this._kind}}),Object.defineProperty(i.prototype,"isAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"audio"===this._kind}}),Object.defineProperty(i.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(i.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(n.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(i.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e,[2,exports.RCRTCCode.SUCCESS]}))}))}}),Object.defineProperty(i.prototype,"mute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,this._setLocalMuted(!0)]}))}))}}),Object.defineProperty(i.prototype,"unmute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,this._setLocalMuted(!1)]}))}))}}),Object.defineProperty(i.prototype,"isLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._localMuted}}),Object.defineProperty(i.prototype,"isMCUTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Boolean(this._roomId)}}),Object.defineProperty(i.prototype,"isOwnerMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteMuted}}),Object.defineProperty(i.prototype,"_validateVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(null==t?void 0:t.volume){if(!e.isNumber(null==t?void 0:t.volume))return this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.volume not a number"})),{code:exports.RCRTCCode.PARAMS_ERROR};(null==t?void 0:t.volume)<0&&(t.volume=0,this._logger.warn(n.L_TRACK_PLAY_E,JSON.stringify({status:o.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(n.L_TRACK_PLAY_E,JSON.stringify({status:o.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(i.prototype,"_validatePlayOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(a){switch(a.label){case 0:return this._msTrack?("ended"===this._msTrack.readyState&&this._logger.warn(n.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,Me.getSpeakers()]:[3,2]):(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.TRACK_NOT_READY,kind:this._kind,msg:"the track is not ready to play -> id: ".concat(this._id)})),[2,{code:exports.RCRTCCode.TRACK_NOT_READY}]);case 1:if(i=a.sent().map((function(e){return e.deviceId})),!i.includes(t.audioDeviceId))return this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.audioDeviceId"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}];a.label=2;case 2:return!this.isVideoTrack()||e&&(e instanceof HTMLVideoElement||this._validateVideoNodeName(e))?[2]:(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT,kind:this._kind,msg:"params element is not a HTMLVideoElement"})),[2,{code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT}])}}))}))}}),Object.defineProperty(i.prototype,"_setPlayAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.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:i.sent(),i.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(i.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a=this;return c(this,(function(u){switch(u.label){case 0:return this._logger.info(n.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=u.sent())?[2,r]:(i=this.isVideoTrack(),this._element=i?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;a._logger.info(n.L_TRACK_LOAD_START_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onloadstart -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.ondurationchange=function(e){var t;a._logger.info(n.L_TRACK_DURATION_CHANGE_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement ondurationchange -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.onloadedmetadata=function(e){var t;a._logger.info(n.L_TRACK_LOADED_META_DATA_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onloadedmetadata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.onloadeddata=function(e){var t;a._logger.info(n.L_TRACK_LOADED_DATA_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onloadeddata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.onabort=function(e){var t;a._logger.info(n.L_TRACK_ABORT_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onabort -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.oncanplay=function(e){return s(a,void 0,void 0,(function(){var r,a,s;return c(this,(function(c){switch(c.label){case 0:this._logger.info(n.L_TRACK_CANPLAY_O,JSON.stringify({status:o.INFO,kind:this._kind,msg:"HTMLMediaElement oncanplay -> id: ".concat(null===(a=e.target)||void 0===a?void 0:a.id,", trackId: ").concat(this._id)})),c.label=1;case 1:return c.trys.push([1,5,,6]),!(null==t?void 0:t.audioDeviceId)||i?[3,3]:[4,this._element.setSinkId(t.audioDeviceId)];case 2:c.sent(),c.label=3;case 3:return[4,null===(s=this._element)||void 0===s?void 0:s.play()];case 4:return c.sent(),[3,6];case 5:return"No permission to use requested device"===(r=c.sent()).message?(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,kind:this._kind,code:exports.RCRTCCode.NO_PERMISSION_TO_USE_REQUESTED_DEVICE,msg:"setSinkId failed, error msg: ".concat(r.message)})),[2]):(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.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,i=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));a._logger.info(n.L_TRACK_VOLUME_CHANGE_O,JSON.stringify({status:o.INFO,msg:"HTMLMediaElement onvolumechange -> id: ".concat(null===(r=e.target)||void 0===r?void 0:r.id,", volume: ").concat(i,", trackId: ").concat(a._id)}))},this._element.srcObject=this._msStream,this._element.autoplay=!0,[4,this._setPlayAttrs(i,t)]);case 2:return u.sent(),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"__innerDestroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.__innerSetMediaStreamTrack(void 0)}}),Object.defineProperty(i.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(i.prototype,"_validateVideoNodeName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()}}),i}(e.EventEmitter);exports.RCAudioBitrate=void 0,(Be=exports.RCAudioBitrate||(exports.RCAudioBitrate={})).Speech="Speech",Be.Music="Music",Be.MusicHigh="MusicHigh";var Fe,Je=((xe={})[exports.RCAudioBitrate.Music]={max:64,min:64},xe[exports.RCAudioBitrate.MusicHigh]={max:128,min:128},xe[exports.RCAudioBitrate.Speech]={max:32,min:32},xe);exports.RCVideoBitrate=void 0,(Fe=exports.RCVideoBitrate||(exports.RCVideoBitrate={})).LEVEL0="LEVEL0",Fe.LEVEL1="LEVEL1",Fe.LEVEL2="LEVEL2",Fe.LEVEL3="LEVEL3",Fe.LEVEL4="LEVEL4",Fe.LEVEL5="LEVEL5";var Ge,He=((je={})[exports.RCVideoBitrate.LEVEL0]={max:150,min:80},je[exports.RCVideoBitrate.LEVEL1]={max:280,min:120},je[exports.RCVideoBitrate.LEVEL2]={max:650,min:150},je[exports.RCVideoBitrate.LEVEL3]={max:1e3,min:200},je[exports.RCVideoBitrate.LEVEL4]={max:2200,min:250},je[exports.RCVideoBitrate.LEVEL5]={max:4e3,min:400},je),Ke=function(){function e(){}return Object.defineProperty(e,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a,s;return c(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 i=c.sent(),[3,6];case 5:return c.sent(),[2,{code:exports.RCRTCCode.LOAD_3A_MODULE_FAILED}];case 6:return n=r.createMediaStreamSource(new MediaStream([t])),o=new AudioWorkletNode(r,"process-worklet",{numberOfInputs:1,numberOfOutputs:1,outputChannelCount:[1],processorOptions:{binary:i}}),a=r.createMediaStreamDestination(),n.connect(o).connect(a),s=a.stream.getAudioTracks()[0],e._maps.set(t.id,r),[2,{code:exports.RCRTCCode.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:""}),Object.defineProperty(e,"SCRIPT_URL",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(e,"_maps",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),e}(),We=function(t){function i(e,r,i,n,o){var a=t.call(this,e,r,i,n,!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 r(i,t),Object.defineProperty(i.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(i.EVENT_LOCAL_TRACK_END,this),this.removeAll(i.EVENT_LOCAL_TRACK_END)}}),Object.defineProperty(i.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this;return new Promise((function(o){var a=r._localMuted!==e;t.prototype._setLocalMuted.call(r,e),r._remoteMuted=r._localMuted,a&&r._isPublished?r.emit(i.__INNER_EVENT_MUTED_CHANGE__,r,o):o(exports.RCRTCCode.SUCCESS),r._logger.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({enable:e,trackId:r._id}))}))}}),Object.defineProperty(i.prototype,"__innerSetPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isPublished=e}}),Object.defineProperty(i.prototype,"isPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isPublished}}),Object.defineProperty(i.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r;void 0===e&&(e=!0),this._isDestroyed||(this._logger.info(n.L_LOCAL_TRACK_DESTROY_O,this._id),this._isDestroyed=!0,null===(r=this._msTrack)||void 0===r||r.stop(),t.prototype.__innerDestroy.call(this),this.isAudioTrack()&&t.prototype.__releaseMediaElement.call(this),this._isPublished&&e&&this.emit(i.__INNER_EVENT_DESTROY__,this))}}),Object.defineProperty(i.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){void 0===t&&(t=0),void 0===r&&(r=0),void 0===i&&(i=0),!e.isNumber(t)||!e.isNumber(r)||!e.isNumber(i)||t<=0||r<=0||t<r?this._logger.error(n.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> max: ".concat(t,",min: ").concat(r,", start: ").concat(i),trackId:this._id})):(this._logger.info(n.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:o.SUCCESSED,max:t,min:r,start:i,trackId:this._id})),this._bitrateInfo={max:t,min:r,start:i})}}),Object.defineProperty(i.prototype,"getBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r,i,n,o,a,s,c,u=0,l=0,d=0;return(null===(r=this._msTrack)||void 0===r?void 0:r.kind)===Pe.VIDEO?(u=(e=lt(this._msTrack)).min,l=e.max):(null===(i=this._msTrack)||void 0===i?void 0:i.kind)===Pe.AUDIO&&(u=(t={min:32,max:32}).min,l=t.max),(null===(n=this._bitrateInfo)||void 0===n?void 0:n.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(i.prototype,"getSettings",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return null===(e=this._msTrack)||void 0===e?void 0:e.getSettings()}}),Object.defineProperty(i,"EVENT_LOCAL_TRACK_END",{enumerable:!0,configurable:!0,writable:!0,value:"local-track-end"}),Object.defineProperty(i,"__INNER_EVENT_MUTED_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-muted-change"}),Object.defineProperty(i,"__INNER_EVENT_DESTROY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-destroy"}),i}(Ve),ze=function(t){function i(e,r,i,n){return t.call(this,e,r,i,"audio",n)||this}return r(i,t),Object.defineProperty(i.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(e.validate("audioBitrate",t,(function(e){return e in exports.RCAudioBitrate}))){var r=Je[t];this.setBitrate(r.max,r.min,r.start||.7*r.max)}else this._logger.warn(n.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> params type is RCAudioBitrate"}))}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=l(r,2),o=n[0],a=void 0===o?1:o,s=n[1],c=void 0===s?.7*e||1:s;t.prototype.setBitrate.call(this,e,a,c)}}),i}(We),Ye=function(t){function i(e,r,i,n,o){void 0===o&&(o=!1);var a=t.call(this,e,r,i,"video",n)||this;return Object.defineProperty(a,"_isTiny",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return r(i,t),Object.defineProperty(i.prototype,"__isTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isTiny}}),Object.defineProperty(i.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.prototype.getStreamId.call(this);return this._isTiny?"".concat(e,"_tiny"):e}}),Object.defineProperty(i.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.prototype.getTrackId.call(this);return this._isTiny?"".concat(e,"_tiny"):e}}),Object.defineProperty(i.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(e.validate("videoBitrate",t,(function(e){return e in exports.RCVideoBitrate}))){var r=He[t];this.setBitrate(r.max,r.min,r.start||.7*r.max)}else this._logger.warn(n.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> params type is RCVideoBitrate"}))}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=l(r,2),o=n[0],a=void 0===o?1:o,s=n[1],c=void 0===s?.7*e||1:s;t.prototype.setBitrate.call(this,e,a,c)}}),i}(We),qe=function(e){function t(r,i,n,o,a,s){var c=e.call(this,r,i,n,o,a)||this;return Object.defineProperty(c,"_resource",{enumerable:!0,configurable:!0,writable:!0,value:s}),t._innerSetMapping(c.getTrackId(),s),c}return r(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,i,n=null===(r=this._mapping.get(t))||void 0===r?void 0:r.filter((function(t){return t!==e}));n&&n.length>0?this._mapping.set(t,n):(this._mapping.delete(t),t.pause(),t.src="",null===(i=t.parentNode)||void 0===i||i.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}(We),Ze=function(e){function t(t,r,i,n,o){return e.call(this,t,r,i,"video",n,o)||this}return r(t,e),t}(qe),Qe=function(e){function t(t,r,i,n,o){return e.call(this,t,r,i,"audio",n,o)||this}return r(t,e),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){return c(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 s(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this._setLocalMuted(!1)];case 1:return[2,{code:e.sent()}]}}))}))}}),t}(qe),Xe=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 r(t,e),Object.defineProperty(t.prototype,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t,r;return c(this,(function(i){switch(i.label){case 0:return this._logger.info(n.A_APPLY_3A_NOISE_WORKLET_T),this._originTrack?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"3A noise module already applied"})),[2,{code:exports.RCRTCCode.SUCCESS}]):!this._msTrack||this.isDestroyed()?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"track not ready"})),[2,{code:exports.RCRTCCode.TRACK_NOT_READY}]):this.isPublished()?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"track already published"})),[2,{code:exports.RCRTCCode.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH}]):[4,Ke.apply3ANoiseWorklet(this._msTrack)];case 1:return e=i.sent(),t=e.code,r=e.track,t===exports.RCRTCCode.SUCCESS&&r?(this._originTrack=this._msTrack,this._msTrack=r,this._logger.info(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.SUCCESSED})),[2,{code:exports.RCRTCCode.SUCCESS}]):(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"apply 3A noise module failed: ".concat(t),SCRIPT_URL:Ke.SCRIPT_URL,WASM_URL:Ke.WASM_URL})),[2,{code:t}])}}))}))}}),Object.defineProperty(t.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(t){!t&&this._originTrack&&(Ke.release3ANoiseWorklet(this._originTrack),this._originTrack.stop(),this._originTrack=null),e.prototype.__innerSetMediaStreamTrack.call(this,t)}}),Object.defineProperty(t.prototype,"replaceInnerTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),t}(ze),$e=function(e){function t(t,r,i,n,o){return void 0===o&&(o=!1),e.call(this,t,r,i,n,o)||this}return r(t,e),Object.defineProperty(t.prototype,"replaceInnerTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),t}(Ye),et=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(We.__INNER_EVENT_DESTROY__,this)}}),t}(Ye),tt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(We.__INNER_EVENT_DESTROY__,this)}}),t}(ze),rt=function(e){function t(t,r,i,n,o){var a=e.call(this,t,r,i,n,!1,o)||this;return Object.defineProperty(a,"_isSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),a}return r(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}(Ve),it=function(e){function t(t,r,i,n){return e.call(this,t,r,i,"audio",n)||this}return r(t,e),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=vt.browser,i=vt.version;return this._element&&i&&/chrome/i.test(r)&&i>=130&&(this._element.muted=t),e.prototype._setLocalMuted.call(this,t)}}),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}(rt),nt=function(e){function t(t,r,i,n){var o=e.call(this,t,r,i,"video",n)||this;return Object.defineProperty(o,"_isSubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),o}return r(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}(rt);exports.RCRTCGenerateSummarizationFormat=void 0,(Ge=exports.RCRTCGenerateSummarizationFormat||(exports.RCRTCGenerateSummarizationFormat={}))[Ge.MARK_DOWN=0]="MARK_DOWN",Ge[Ge.JSON=1]="JSON";var ot=function(e,t){return{name:e,content:JSON.stringify({uris:t,ignore:!0})}},at=function(e){return JSON.stringify(e)},st=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},ct=function(t){if(void 0===t)return 0;if(e.isNumber(t))return t;var r=t;return r.exact||r.ideal||r.max||0},ut=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)}},lt=function(e){var t=ut(e),r=t.width,i=t.height,n=t.frameRate,o=De(r||1920,i||1080),a=Ue(n);return{min:o.minBitrate*a,max:o.maxBitrate*a}},dt=function(e){return[e.msid,e.mediaType].join("_")},_t=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},pt=function(e,t){return[e,t].join("_")},ft=function(e){return e.map((function(e){return a({},e)}))},ht=function(e,t,r){void 0===r&&(r=!1),e=e.slice();var i=[],n=[],o=[];return t.forEach((function(t){var n=dt(t),a=e.findIndex((function(e){return dt(e)===n}));if(r&&(a=e.findIndex((function(e){return e.uri===t.uri}))),-1!==a){var s=e[a];s.uri!==t.uri?i.push(t):s.state!==t.state&&o.push(t),e.splice(a,1)}else i.push(t)})),n.push.apply(n,d([],l(e),!1)),{publishedList:i,unpublishedList:n,modifiedList:o}},Rt=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return e="".concat(e.replace(/-/g,""),"0"),(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),r=t.length+1,i=+e,n=[];do{var o=i%r;i=(i-o)/r,n.unshift(t[o])}while(i);return n.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e},bt=function(e){if(Ne[e]){var t=Ne[e];return{width:t.width,height:t.height}}var r=l(e.split("_").map((function(e){return parseInt(e.replace(/[^\d]/g,""))})),2);return{width:r[0],height:r[1]}},gt=function(e){return!!exports.RCResolution[e]},mt=function(e){return!!exports.RCFrameRate[e]},Ct=function(e){return parseInt(e.replace("FPS_",""))},vt=function(){var e=Ee.browserDetails;return{browser:e.browser,version:e.version,supportsUnifiedPlan:!1!==e.supportsUnifiedPlan}}();function Tt(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function Ot(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var St,Et,It=function(e){return"[object Null]"===Object.prototype.toString.call(e)},yt=function(e){return 1===e.type},Lt=function(e,t,r,i){var o={},a=Object.keys(e.users);return a.length&&a.forEach((function(a){var s=[],c=e.users[a];if(c.extra){var u=JSON.parse(c.extra).roomId;if(t!==u)return}if(c.uris)try{s.push.apply(s,d([],l(JSON.parse(c.uris)),!1))}catch(e){r.warn(n.L_PARSE_ROOMDATA_URIS_R,"invalid user data -> userId: ".concat(a,", userData: ").concat(c),i)}o[a]=s})),o},At=function(e){return e instanceof Ve?e.getTrackId():e.track.getTrackId()},Pt=function(t){if(!e.isObject(t)||void 0===t.low||void 0===t.high)return t;var r=t.low;return r<0&&(r+=4294967296),r=r.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(r.length,"}$")),r),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",e.ASR_STATUS="RCRTC:AsrStatus",e.ASR_SEI="RCRTC:PublishSeiAi",e.SUMMARIZATION_STATUS="RCRTC:Summarization"}(St||(St={})),exports.RCRTCPingResult=void 0,(Et=exports.RCRTCPingResult||(exports.RCRTCPingResult={})).SUCCESS="Success",Et.FAIL="Fail";var Nt=function(){function t(e,t,r,i){void 0===i&&(i=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:i}),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(t.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._started||(e<15e3&&(e=15e3),this._logger.info(n.L_PINGER_START_O,JSON.stringify({interval:this._gap,offlineKickTime:e})),this._started=!0,this._checkAlive(e))}}),Object.defineProperty(t.prototype,"_sendPing",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t=this;return new Promise((function(r){t._context.rtcPing(t._roomId,t._roomMode).then(r),setTimeout(r,5e3,{code:e.ErrorCode.TIMEOUT})}))}}),Object.defineProperty(t.prototype,"_checkAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,o,a,s,u,l=this;return c(this,(function(c){switch(c.label){case 0:return r=this._context.logger,i=r.createTraceId(),[4,this._sendPing()];case 1:return o=c.sent(),a=o.code,s=o.data,this._started?(u=Date.now(),a===e.ErrorCode.SUCCESS?(this._latestTimestamp=u,this.onPingResult(exports.RCRTCPingResult.SUCCESS,s.version),this._timer=setTimeout((function(){return l._checkAlive(t)}),this._gap),[2]):(r.error(n.L_PINGER_SEND_RTCPING_E,JSON.stringify({roomId:this._roomId,code:a}),i),this.onPingResult(exports.RCRTCPingResult.FAIL),40003===a||u-this._latestTimestamp>t?(this.stop(),this.onFailed(40003===a),[2]):(this._timer=setTimeout((function(){return l._checkAlive(t)}),this._gap),[2]))):[2]}}))}))}}),Object.defineProperty(t.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._started&&(this._logger.info(n.L_PINGER_STOP_O),this._started=!1,this._timer&&(clearTimeout(this._timer),this._timer=null))}}),t}();function wt(e){let t=e.length;for(;--t>=0;)e[t]=0}const Dt=256,kt=286,Ut=30,Mt=15,xt=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]),jt=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]),Bt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Vt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ft=new Array(576);wt(Ft);const Jt=new Array(60);wt(Jt);const Gt=new Array(512);wt(Gt);const Ht=new Array(256);wt(Ht);const Kt=new Array(29);wt(Kt);const Wt=new Array(Ut);function zt(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}let Yt,qt,Zt;function Qt(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}wt(Wt);const Xt=e=>e<256?Gt[e]:Gt[256+(e>>>7)],$t=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},er=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,$t(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)},tr=(e,t,r)=>{er(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},ir=(e,t,r)=>{const i=new Array(16);let n,o,a=0;for(n=1;n<=Mt;n++)a=a+r[n-1]<<1,i[n]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=rr(i[t]++,t))}},nr=e=>{let t;for(t=0;t<kt;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Ut;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},or=e=>{e.bi_valid>8?$t(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},ar=(e,t,r,i)=>{const n=2*t,o=2*r;return e[n]<e[o]||e[n]===e[o]&&i[t]<=i[r]},sr=(e,t,r)=>{const i=e.heap[r];let n=r<<1;for(;n<=e.heap_len&&(n<e.heap_len&&ar(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!ar(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i},cr=(e,t,r)=>{let i,n,o,a,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,n=e.pending_buf[e.sym_buf+s++],0===i?tr(e,n,t):(o=Ht[n],tr(e,o+Dt+1,t),a=xt[o],0!==a&&(n-=Kt[o],er(e,n,a)),i--,o=Xt(i),tr(e,o,r),a=jt[o],0!==a&&(i-=Wt[o],er(e,i,a)))}while(s<e.sym_next);tr(e,256,t)},ur=(e,t)=>{const r=t.dyn_tree,i=t.stat_desc.static_tree,n=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--,n&&(e.static_len-=i[2*c+1]);for(t.max_code=u,a=e.heap_len>>1;a>=1;a--)sr(e,r,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],sr(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++,sr(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,i=t.max_code,n=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,h=0;for(_=0;_<=Mt;_++)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,h++),r[2*l+1]=_,l>i||(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*(n[2*l+1]+p)));if(0!==h){do{for(_=c-1;0===e.bl_count[_];)_--;e.bl_count[_]--,e.bl_count[_+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(_=c;0!==_;_--)for(l=e.bl_count[_];0!==l;)d=e.heap[--u],d>i||(r[2*d+1]!==_&&(e.opt_len+=(_-r[2*d+1])*r[2*d],r[2*d+1]=_),l--)}})(e,t),ir(r,u,e.bl_count)},lr=(e,t,r)=>{let i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))},dr=(e,t,r)=>{let i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++s<c&&n===a)){if(s<u)do{tr(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(tr(e,n,e.bl_tree),s--),tr(e,16,e.bl_tree),er(e,s-3,2)):s<=10?(tr(e,17,e.bl_tree),er(e,s-3,3)):(tr(e,18,e.bl_tree),er(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}};let _r=!1;const pr=(e,t,r,i)=>{er(e,0+(i?1:0),3),or(e),$t(e,r),$t(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var fr=(e,t,r,i)=>{let n,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<Dt;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),ur(e,e.l_desc),ur(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),ur(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Vt[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=n&&(n=o)):n=o=r+5,r+4<=n&&-1!==t?pr(e,t,r,i):4===e.strategy||o===n?(er(e,2+(i?1:0),3),cr(e,Ft,Jt)):(er(e,4+(i?1:0),3),((e,t,r,i)=>{let n;for(er(e,t-257,5),er(e,r-1,5),er(e,i-4,4),n=0;n<i;n++)er(e,e.bl_tree[2*Vt[n]+1],3);dr(e,e.dyn_ltree,t-1),dr(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),cr(e,e.dyn_ltree,e.dyn_dtree)),nr(e),i&&or(e)},hr={_tr_init:e=>{_r||((()=>{let e,t,r,i,n;const o=new Array(16);for(r=0,i=0;i<28;i++)for(Kt[i]=r,e=0;e<1<<xt[i];e++)Ht[r++]=i;for(Ht[r-1]=i,n=0,i=0;i<16;i++)for(Wt[i]=n,e=0;e<1<<jt[i];e++)Gt[n++]=i;for(n>>=7;i<Ut;i++)for(Wt[i]=n<<7,e=0;e<1<<jt[i]-7;e++)Gt[256+n++]=i;for(t=0;t<=Mt;t++)o[t]=0;for(e=0;e<=143;)Ft[2*e+1]=8,e++,o[8]++;for(;e<=255;)Ft[2*e+1]=9,e++,o[9]++;for(;e<=279;)Ft[2*e+1]=7,e++,o[7]++;for(;e<=287;)Ft[2*e+1]=8,e++,o[8]++;for(ir(Ft,287,o),e=0;e<Ut;e++)Jt[2*e+1]=5,Jt[2*e]=rr(e,5);Yt=new zt(Ft,xt,257,kt,Mt),qt=new zt(Jt,jt,0,Ut,Mt),Zt=new zt(new Array(0),Bt,0,19,7)})(),_r=!0),e.l_desc=new Qt(e.dyn_ltree,Yt),e.d_desc=new Qt(e.dyn_dtree,qt),e.bl_desc=new Qt(e.bl_tree,Zt),e.bi_buf=0,e.bi_valid=0,nr(e)},_tr_stored_block:pr,_tr_flush_block:fr,_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*(Ht[r]+Dt+1)]++,e.dyn_dtree[2*Xt(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{er(e,2,3),tr(e,256,Ft),(e=>{16===e.bi_valid?($t(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 Rr=(e,t,r,i)=>{let n=65535&e,o=e>>>16&65535,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{n=n+t[i++]|0,o=o+n|0}while(--a);n%=65521,o%=65521}return n|o<<16};const br=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var gr=(e,t,r,i)=>{const n=br,o=i+r;e^=-1;for(let r=i;r<o;r++)e=e>>>8^n[255&(e^t[r])];return~e},mr={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"},Cr={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:vr,_tr_stored_block:Tr,_tr_flush_block:Or,_tr_tally:Sr,_tr_align:Er}=hr,{Z_NO_FLUSH:Ir,Z_PARTIAL_FLUSH:yr,Z_FULL_FLUSH:Lr,Z_FINISH:Ar,Z_BLOCK:Pr,Z_OK:Nr,Z_STREAM_END:wr,Z_STREAM_ERROR:Dr,Z_DATA_ERROR:kr,Z_BUF_ERROR:Ur,Z_DEFAULT_COMPRESSION:Mr,Z_FILTERED:xr,Z_HUFFMAN_ONLY:jr,Z_RLE:Br,Z_FIXED:Vr,Z_DEFAULT_STRATEGY:Fr,Z_UNKNOWN:Jr,Z_DEFLATED:Gr}=Cr,Hr=258,Kr=262,Wr=42,zr=113,Yr=666,qr=(e,t)=>(e.msg=mr[t],t),Zr=e=>2*e-(e>4?9:0),Qr=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Xr=e=>{let t,r,i,n=e.w_size;t=e.hash_size,i=t;do{r=e.head[--i],e.head[i]=r>=n?r-n:0}while(--t);t=n,i=t;do{r=e.prev[--i],e.prev[i]=r>=n?r-n:0}while(--t)};let $r=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const ei=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))},ti=(e,t)=>{Or(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ei(e.strm)},ri=(e,t)=>{e.pending_buf[e.pending++]=t},ii=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},ni=(e,t,r,i)=>{let n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),r),1===e.state.wrap?e.adler=Rr(e.adler,t,n,r):2===e.state.wrap&&(e.adler=gr(e.adler,t,n,r)),e.next_in+=n,e.total_in+=n,n)},oi=(e,t)=>{let r,i,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-Kr?e.strstart-(e.w_size-Kr):0,u=e.window,l=e.w_mask,d=e.prev,_=e.strstart+Hr;let p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(n>>=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(i=Hr-(_-o),o=_-Hr,i>a){if(e.match_start=t,a=i,i>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=d[t&l])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead},ai=e=>{const t=e.w_size;let r,i,n;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Kr)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Xr(e),i+=t),0===e.strm.avail_in)break;if(r=ni(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=$r(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=$r(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Kr&&0!==e.strm.avail_in)},si=(e,t)=>{let r,i,n,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,n=e.bi_valid+42>>3,e.strm.avail_out<n)break;if(n=e.strm.avail_out-n,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>n&&(r=n),r<o&&(0===r&&t!==Ar||t===Ir||r!==i+e.strm.avail_in))break;a=t===Ar&&r===i+e.strm.avail_in?1:0,Tr(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,ei(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(ni(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!==Ir&&t!==Ar&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(n=e.window_size-e.strstart,e.strm.avail_in>n&&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++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(ni(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water<e.strstart&&(e.high_water=e.strstart),n=e.bi_valid+42>>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,o=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=o||(i||t===Ar)&&t!==Ir&&0===e.strm.avail_in&&i<=n)&&(r=i>n?n:i,a=t===Ar&&0===e.strm.avail_in&&r===i?1:0,Tr(e,e.block_start,r,a),e.block_start+=r,ei(e.strm)),a?3:1)},ci=(e,t)=>{let r,i;for(;;){if(e.lookahead<Kr){if(ai(e),e.lookahead<Kr&&t===Ir)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=$r(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-Kr&&(e.match_length=oi(e,r)),e.match_length>=3)if(i=Sr(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=$r(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=$r(e,e.ins_h,e.window[e.strstart+1]);else i=Sr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(ti(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Ar?(ti(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ti(e,!1),0===e.strm.avail_out)?1:2},ui=(e,t)=>{let r,i,n;for(;;){if(e.lookahead<Kr){if(ai(e),e.lookahead<Kr&&t===Ir)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=$r(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-Kr&&(e.match_length=oi(e,r),e.match_length<=5&&(e.strategy===xr||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=Sr(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=$r(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++,i&&(ti(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=Sr(e,0,e.window[e.strstart-1]),i&&ti(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&&(i=Sr(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Ar?(ti(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ti(e,!1),0===e.strm.avail_out)?1:2};function li(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}const di=[new li(0,0,0,0,si),new li(4,4,8,4,ci),new li(4,5,16,8,ci),new li(4,6,32,32,ci),new li(4,4,16,16,ui),new li(8,16,32,32,ui),new li(8,16,128,128,ui),new li(8,32,128,256,ui),new li(32,128,258,1024,ui),new li(32,258,258,4096,ui)];function _i(){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=Gr,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),Qr(this.dyn_ltree),Qr(this.dyn_dtree),Qr(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),Qr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Qr(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 pi=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Wr&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==zr&&t.status!==Yr?1:0},fi=e=>{if(pi(e))return qr(e,Dr);e.total_in=e.total_out=0,e.data_type=Jr;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?Wr:zr,e.adler=2===t.wrap?0:1,t.last_flush=-2,vr(t),Nr},hi=e=>{const t=fi(e);var r;return t===Nr&&((r=e.state).window_size=2*r.w_size,Qr(r.head),r.max_lazy_match=di[r.level].max_lazy,r.good_match=di[r.level].good_length,r.nice_match=di[r.level].nice_length,r.max_chain_length=di[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},Ri=(e,t,r,i,n,o)=>{if(!e)return Dr;let a=1;if(t===Mr&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||r!==Gr||i<8||i>15||t<0||t>9||o<0||o>Vr||8===i&&1!==a)return qr(e,Dr);8===i&&(i=9);const s=new _i;return e.state=s,s.strm=e,s.status=Wr,s.wrap=a,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+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<<n+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,hi(e)};var bi={deflateInit:(e,t)=>Ri(e,t,Gr,15,8,Fr),deflateInit2:Ri,deflateReset:hi,deflateResetKeep:fi,deflateSetHeader:(e,t)=>pi(e)||2!==e.state.wrap?Dr:(e.state.gzhead=t,Nr),deflate:(e,t)=>{if(pi(e)||t>Pr||t<0)return e?qr(e,Dr):Dr;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===Yr&&t!==Ar)return qr(e,0===e.avail_out?Ur:Dr);const i=r.last_flush;if(r.last_flush=t,0!==r.pending){if(ei(e),0===e.avail_out)return r.last_flush=-1,Nr}else if(0===e.avail_in&&Zr(t)<=Zr(i)&&t!==Ar)return qr(e,Ur);if(r.status===Yr&&0!==e.avail_in)return qr(e,Ur);if(r.status===Wr&&0===r.wrap&&(r.status=zr),r.status===Wr){let t=Gr+(r.w_bits-8<<4)<<8,i=-1;if(i=r.strategy>=jr||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=i<<6,0!==r.strstart&&(t|=32),t+=31-t%31,ii(r,t),0!==r.strstart&&(ii(r,e.adler>>>16),ii(r,65535&e.adler)),e.adler=1,r.status=zr,ei(e),0!==r.pending)return r.last_flush=-1,Nr}if(57===r.status)if(e.adler=0,ri(r,31),ri(r,139),ri(r,8),r.gzhead)ri(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)),ri(r,255&r.gzhead.time),ri(r,r.gzhead.time>>8&255),ri(r,r.gzhead.time>>16&255),ri(r,r.gzhead.time>>24&255),ri(r,9===r.level?2:r.strategy>=jr||r.level<2?4:0),ri(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(ri(r,255&r.gzhead.extra.length),ri(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=gr(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(ri(r,0),ri(r,0),ri(r,0),ri(r,0),ri(r,0),ri(r,9===r.level?2:r.strategy>=jr||r.level<2?4:0),ri(r,3),r.status=zr,ei(e),0!==r.pending)return r.last_flush=-1,Nr;if(69===r.status){if(r.gzhead.extra){let t=r.pending,i=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+i>r.pending_buf_size;){let n=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=gr(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=n,ei(e),0!==r.pending)return r.last_flush=-1,Nr;t=0,i-=n}let n=new Uint8Array(r.gzhead.extra);r.pending_buf.set(n.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending+=i,r.gzhead.hcrc&&r.pending>t&&(e.adler=gr(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,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=gr(e.adler,r.pending_buf,r.pending-i,i)),ei(e),0!==r.pending)return r.last_flush=-1,Nr;i=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,ri(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>i&&(e.adler=gr(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=gr(e.adler,r.pending_buf,r.pending-i,i)),ei(e),0!==r.pending)return r.last_flush=-1,Nr;i=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,ri(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>i&&(e.adler=gr(e.adler,r.pending_buf,r.pending-i,i))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(ei(e),0!==r.pending))return r.last_flush=-1,Nr;ri(r,255&e.adler),ri(r,e.adler>>8&255),e.adler=0}if(r.status=zr,ei(e),0!==r.pending)return r.last_flush=-1,Nr}if(0!==e.avail_in||0!==r.lookahead||t!==Ir&&r.status!==Yr){let i=0===r.level?si(r,t):r.strategy===jr?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(ai(e),0===e.lookahead)){if(t===Ir)return 1;break}if(e.match_length=0,r=Sr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(ti(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Ar?(ti(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ti(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===Br?((e,t)=>{let r,i,n,o;const a=e.window;for(;;){if(e.lookahead<=Hr){if(ai(e),e.lookahead<=Hr&&t===Ir)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){o=e.strstart+Hr;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=Hr-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=Sr(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Sr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(ti(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Ar?(ti(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ti(e,!1),0===e.strm.avail_out)?1:2})(r,t):di[r.level].func(r,t);if(3!==i&&4!==i||(r.status=Yr),1===i||3===i)return 0===e.avail_out&&(r.last_flush=-1),Nr;if(2===i&&(t===yr?Er(r):t!==Pr&&(Tr(r,0,0,!1),t===Lr&&(Qr(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),ei(e),0===e.avail_out))return r.last_flush=-1,Nr}return t!==Ar?Nr:r.wrap<=0?wr:(2===r.wrap?(ri(r,255&e.adler),ri(r,e.adler>>8&255),ri(r,e.adler>>16&255),ri(r,e.adler>>24&255),ri(r,255&e.total_in),ri(r,e.total_in>>8&255),ri(r,e.total_in>>16&255),ri(r,e.total_in>>24&255)):(ii(r,e.adler>>>16),ii(r,65535&e.adler)),ei(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Nr:wr)},deflateEnd:e=>{if(pi(e))return Dr;const t=e.state.status;return e.state=null,t===zr?qr(e,kr):Nr},deflateSetDictionary:(e,t)=>{let r=t.length;if(pi(e))return Dr;const i=e.state,n=i.wrap;if(2===n||1===n&&i.status!==Wr||i.lookahead)return Dr;if(1===n&&(e.adler=Rr(e.adler,t,r,0)),i.wrap=0,r>=i.w_size){0===n&&(Qr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(r-i.w_size,r),0),t=e,r=i.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,ai(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=$r(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,ai(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,i.wrap=n,Nr},deflateInfo:"pako deflate (from Nodeca project)"};const gi=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var mi=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)gi(r,t)&&(e[t]=r[t])}}return e},Ci=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,i=0,n=e.length;t<n;t++){let n=e[t];r.set(n,i),i+=n.length}return r};let vi=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){vi=!1}const Ti=new Uint8Array(256);for(let e=0;e<256;e++)Ti[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ti[254]=Ti[254]=1;var Oi=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,i,n,o,a=e.length,s=0;for(n=0;n<a;n++)r=e.charCodeAt(n),55296==(64512&r)&&n+1<a&&(i=e.charCodeAt(n+1),56320==(64512&i)&&(r=65536+(r-55296<<10)+(i-56320),n++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),o=0,n=0;o<s;n++)r=e.charCodeAt(n),55296==(64512&r)&&n+1<a&&(i=e.charCodeAt(n+1),56320==(64512&i)&&(r=65536+(r-55296<<10)+(i-56320),n++)),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},Si=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,n;const o=new Array(2*r);for(n=0,i=0;i<r;){let t=e[i++];if(t<128){o[n++]=t;continue}let a=Ti[t];if(a>4)o[n++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i<r;)t=t<<6|63&e[i++],a--;a>1?o[n++]=65533:t<65536?o[n++]=t:(t-=65536,o[n++]=55296|t>>10&1023,o[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&vi)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r})(o,n)},Ei=(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+Ti[e[r]]>t?r:t};var Ii=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 yi=Object.prototype.toString,{Z_NO_FLUSH:Li,Z_SYNC_FLUSH:Ai,Z_FULL_FLUSH:Pi,Z_FINISH:Ni,Z_OK:wi,Z_STREAM_END:Di,Z_DEFAULT_COMPRESSION:ki,Z_DEFAULT_STRATEGY:Ui,Z_DEFLATED:Mi}=Cr;function xi(e){this.options=mi({level:ki,method:Mi,chunkSize:16384,windowBits:15,memLevel:8,strategy:Ui},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 Ii,this.strm.avail_out=0;let r=bi.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==wi)throw new Error(mr[r]);if(t.header&&bi.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Oi(t.dictionary):"[object ArrayBuffer]"===yi.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=bi.deflateSetDictionary(this.strm,e),r!==wi)throw new Error(mr[r]);this._dict_set=!0}}function ji(e,t){const r=new xi(t);if(r.push(e,!0),r.err)throw r.msg||mr[r.err];return r.result}xi.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize;let n,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?Ni:Li,"string"==typeof e?r.input=Oi(e):"[object ArrayBuffer]"===yi.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(i),r.next_out=0,r.avail_out=i),(o===Ai||o===Pi)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(n=bi.deflate(r,o),n===Di)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=bi.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===wi;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},xi.prototype.onData=function(e){this.chunks.push(e)},xi.prototype.onEnd=function(e){e===wi&&(this.result=Ci(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Bi={Deflate:xi,deflate:ji,deflateRaw:function(e,t){return(t=t||{}).raw=!0,ji(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,ji(e,t)},constants:Cr};const Vi=16209;var Fi=function(e,t){let r,i,n,o,a,s,c,u,l,d,_,p,f,h,R,b,g,m,C,v,T,O,S,E;const I=e.state;r=e.next_in,S=e.input,i=r+(e.avail_in-5),n=e.next_out,E=e.output,o=n-(t-e.avail_out),a=n+(e.avail_out-257),s=I.dmax,c=I.wsize,u=I.whave,l=I.wnext,d=I.window,_=I.hold,p=I.bits,f=I.lencode,h=I.distcode,R=(1<<I.lenbits)-1,b=(1<<I.distbits)-1;e:do{p<15&&(_+=S[r++]<<p,p+=8,_+=S[r++]<<p,p+=8),g=f[_&R];t:for(;;){if(m=g>>>24,_>>>=m,p-=m,m=g>>>16&255,0===m)E[n++]=65535&g;else{if(!(16&m)){if(64&m){if(32&m){I.mode=16191;break e}e.msg="invalid literal/length code",I.mode=Vi;break e}g=f[(65535&g)+(_&(1<<m)-1)];continue t}for(C=65535&g,m&=15,m&&(p<m&&(_+=S[r++]<<p,p+=8),C+=_&(1<<m)-1,_>>>=m,p-=m),p<15&&(_+=S[r++]<<p,p+=8,_+=S[r++]<<p,p+=8),g=h[_&b];;){if(m=g>>>24,_>>>=m,p-=m,m=g>>>16&255,16&m){if(v=65535&g,m&=15,p<m&&(_+=S[r++]<<p,p+=8,p<m&&(_+=S[r++]<<p,p+=8)),v+=_&(1<<m)-1,v>s){e.msg="invalid distance too far back",I.mode=Vi;break e}if(_>>>=m,p-=m,m=n-o,v>m){if(m=v-m,m>u&&I.sane){e.msg="invalid distance too far back",I.mode=Vi;break e}if(T=0,O=d,0===l){if(T+=c-m,m<C){C-=m;do{E[n++]=d[T++]}while(--m);T=n-v,O=E}}else if(l<m){if(T+=c+l-m,m-=l,m<C){C-=m;do{E[n++]=d[T++]}while(--m);if(T=0,l<C){m=l,C-=m;do{E[n++]=d[T++]}while(--m);T=n-v,O=E}}}else if(T+=l-m,m<C){C-=m;do{E[n++]=d[T++]}while(--m);T=n-v,O=E}for(;C>2;)E[n++]=O[T++],E[n++]=O[T++],E[n++]=O[T++],C-=3;C&&(E[n++]=O[T++],C>1&&(E[n++]=O[T++]))}else{T=n-v;do{E[n++]=E[T++],E[n++]=E[T++],E[n++]=E[T++],C-=3}while(C>2);C&&(E[n++]=E[T++],C>1&&(E[n++]=E[T++]))}break}if(64&m){e.msg="invalid distance code",I.mode=Vi;break e}g=h[(65535&g)+(_&(1<<m)-1)]}}break}}while(r<i&&n<a);C=p>>3,r-=C,p-=C<<3,_&=(1<<p)-1,e.next_in=r,e.next_out=n,e.avail_in=r<i?i-r+5:5-(r-i),e.avail_out=n<a?a-n+257:257-(n-a),I.hold=_,I.bits=p};const Ji=15,Gi=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]),Hi=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]),Ki=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]),Wi=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 zi=(e,t,r,i,n,o,a,s)=>{const c=s.bits;let u,l,d,_,p,f,h=0,R=0,b=0,g=0,m=0,C=0,v=0,T=0,O=0,S=0,E=null;const I=new Uint16Array(16),y=new Uint16Array(16);let L,A,P,N=null;for(h=0;h<=Ji;h++)I[h]=0;for(R=0;R<i;R++)I[t[r+R]]++;for(m=c,g=Ji;g>=1&&0===I[g];g--);if(m>g&&(m=g),0===g)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(b=1;b<g&&0===I[b];b++);for(m<b&&(m=b),T=1,h=1;h<=Ji;h++)if(T<<=1,T-=I[h],T<0)return-1;if(T>0&&(0===e||1!==g))return-1;for(y[1]=0,h=1;h<Ji;h++)y[h+1]=y[h]+I[h];for(R=0;R<i;R++)0!==t[r+R]&&(a[y[t[r+R]]++]=R);if(0===e?(E=N=a,f=20):1===e?(E=Gi,N=Hi,f=257):(E=Ki,N=Wi,f=0),S=0,R=0,h=b,p=o,C=m,v=0,d=-1,O=1<<m,_=O-1,1===e&&O>852||2===e&&O>592)return 1;for(;;){L=h-v,a[R]+1<f?(A=0,P=a[R]):a[R]>=f?(A=N[a[R]-f],P=E[a[R]-f]):(A=96,P=0),u=1<<h-v,l=1<<C,b=l;do{l-=u,n[p+(S>>v)+l]=L<<24|A<<16|P}while(0!==l);for(u=1<<h-1;S&u;)u>>=1;if(0!==u?(S&=u-1,S+=u):S=0,R++,0==--I[h]){if(h===g)break;h=t[r+a[R]]}if(h>m&&(S&_)!==d){for(0===v&&(v=m),p+=b,C=h-v,T=1<<C;C+v<g&&(T-=I[C+v],!(T<=0));)C++,T<<=1;if(O+=1<<C,1===e&&O>852||2===e&&O>592)return 1;d=S&_,n[d]=m<<24|C<<16|p-o}}return 0!==S&&(n[p+S]=h-v<<24|64<<16),s.bits=m,0};const{Z_FINISH:Yi,Z_BLOCK:qi,Z_TREES:Zi,Z_OK:Qi,Z_STREAM_END:Xi,Z_NEED_DICT:$i,Z_STREAM_ERROR:en,Z_DATA_ERROR:tn,Z_MEM_ERROR:rn,Z_BUF_ERROR:nn,Z_DEFLATED:on}=Cr,an=16180,sn=16190,cn=16191,un=16192,ln=16194,dn=16199,_n=16200,pn=16206,fn=16209,hn=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Rn(){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 bn=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<an||t.mode>16211?1:0},gn=e=>{if(bn(e))return en;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=an,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,Qi},mn=e=>{if(bn(e))return en;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,gn(e)},Cn=(e,t)=>{let r;if(bn(e))return en;const i=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?en:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,mn(e))},vn=(e,t)=>{if(!e)return en;const r=new Rn;e.state=r,r.strm=e,r.window=null,r.mode=an;const i=Cn(e,t);return i!==Qi&&(e.state=null),i};let Tn,On,Sn=!0;const En=e=>{if(Sn){Tn=new Int32Array(512),On=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(zi(1,e.lens,0,288,Tn,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;zi(2,e.lens,0,32,On,0,e.work,{bits:5}),Sn=!1}e.lencode=Tn,e.lenbits=9,e.distcode=On,e.distbits=5},In=(e,t,r,i)=>{let n;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)),i>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(n=o.wsize-o.wnext,n>i&&(n=i),o.window.set(t.subarray(r-i,r-i+n),o.wnext),(i-=n)?(o.window.set(t.subarray(r-i,r),0),o.wnext=i,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0};var yn={inflateReset:mn,inflateReset2:Cn,inflateResetKeep:gn,inflateInit:e=>vn(e,15),inflateInit2:vn,inflate:(e,t)=>{let r,i,n,o,a,s,c,u,l,d,_,p,f,h,R,b,g,m,C,v,T,O,S=0;const E=new Uint8Array(4);let I,y;const L=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(bn(e)||!e.output||!e.input&&0!==e.avail_in)return en;r=e.state,r.mode===cn&&(r.mode=un),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,l=r.bits,d=s,_=c,O=Qi;e:for(;;)switch(r.mode){case an:if(0===r.wrap){r.mode=un;break}for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,E[0]=255&u,E[1]=u>>>8&255,r.check=gr(r.check,E,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=fn;break}if((15&u)!==on){e.msg="unknown compression method",r.mode=fn;break}if(u>>>=4,l-=4,T=8+(15&u),0===r.wbits&&(r.wbits=T),T>15||T>r.wbits){e.msg="invalid window size",r.mode=fn;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&u?16189:cn,u=0,l=0;break;case 16181:for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==on){e.msg="unknown compression method",r.mode=fn;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=fn;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=gr(r.check,E,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=gr(r.check,E,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=gr(r.check,E,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+=i[o++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=gr(r.check,E,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&&(T=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(o,o+p),T)),512&r.flags&&4&r.wrap&&(r.check=gr(r.check,i,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{T=i[o+p++],r.head&&T&&r.length<65536&&(r.head.name+=String.fromCharCode(T))}while(T&&p<s);if(512&r.flags&&4&r.wrap&&(r.check=gr(r.check,i,p,o)),s-=p,o+=p,T)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{T=i[o+p++],r.head&&T&&r.length<65536&&(r.head.comment+=String.fromCharCode(T))}while(T&&p<s);if(512&r.flags&&4&r.wrap&&(r.check=gr(r.check,i,p,o)),s-=p,o+=p,T)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+=i[o++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=fn;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=cn;break;case 16189:for(;l<32;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}e.adler=r.check=hn(u),u=0,l=0,r.mode=sn;case sn: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,$i;e.adler=r.check=1,r.mode=cn;case cn:if(t===qi||t===Zi)break e;case un:if(r.last){u>>>=7&l,l-=7&l,r.mode=pn;break}for(;l<3;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(En(r),r.mode=dn,t===Zi){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=fn}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=fn;break}if(r.length=65535&u,u=0,l=0,r.mode=ln,t===Zi)break e;case ln:r.mode=16195;case 16195:if(p=r.length,p){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;n.set(i.subarray(o,o+p),a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=cn;break;case 16196:for(;l<14;){if(0===s)break e;s--,u+=i[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=fn;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===s)break e;s--,u+=i[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,I={bits:r.lenbits},O=zi(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,O){e.msg="invalid code lengths set",r.mode=fn;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],R=S>>>24,b=S>>>16&255,g=65535&S,!(R<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(g<16)u>>>=R,l-=R,r.lens[r.have++]=g;else{if(16===g){for(y=R+2;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(u>>>=R,l-=R,0===r.have){e.msg="invalid bit length repeat",r.mode=fn;break}T=r.lens[r.have-1],p=3+(3&u),u>>>=2,l-=2}else if(17===g){for(y=R+3;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=R,l-=R,T=0,p=3+(7&u),u>>>=3,l-=3}else{for(y=R+7;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=R,l-=R,T=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=fn;break}for(;p--;)r.lens[r.have++]=T}}if(r.mode===fn)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=fn;break}if(r.lenbits=9,I={bits:r.lenbits},O=zi(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,O){e.msg="invalid literal/lengths set",r.mode=fn;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},O=zi(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,O){e.msg="invalid distances set",r.mode=fn;break}if(r.mode=dn,t===Zi)break e;case dn:r.mode=_n;case _n: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,Fi(e,_),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,l=r.bits,r.mode===cn&&(r.back=-1);break}for(r.back=0;S=r.lencode[u&(1<<r.lenbits)-1],R=S>>>24,b=S>>>16&255,g=65535&S,!(R<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(b&&!(240&b)){for(m=R,C=b,v=g;S=r.lencode[v+((u&(1<<m+C)-1)>>m)],R=S>>>24,b=S>>>16&255,g=65535&S,!(m+R<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=m,l-=m,r.back+=m}if(u>>>=R,l-=R,r.back+=R,r.length=g,0===b){r.mode=16205;break}if(32&b){r.back=-1,r.mode=cn;break}if(64&b){e.msg="invalid literal/length code",r.mode=fn;break}r.extra=15&b,r.mode=16201;case 16201:if(r.extra){for(y=r.extra;l<y;){if(0===s)break e;s--,u+=i[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],R=S>>>24,b=S>>>16&255,g=65535&S,!(R<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(!(240&b)){for(m=R,C=b,v=g;S=r.distcode[v+((u&(1<<m+C)-1)>>m)],R=S>>>24,b=S>>>16&255,g=65535&S,!(m+R<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=m,l-=m,r.back+=m}if(u>>>=R,l-=R,r.back+=R,64&b){e.msg="invalid distance code",r.mode=fn;break}r.offset=g,r.extra=15&b,r.mode=16203;case 16203:if(r.extra){for(y=r.extra;l<y;){if(0===s)break e;s--,u+=i[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=fn;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=fn;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),h=r.window}else h=n,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{n[a++]=h[f++]}while(--p);0===r.length&&(r.mode=_n);break;case 16205:if(0===c)break e;n[a++]=r.length,c--,r.mode=_n;break;case pn:if(r.wrap){for(;l<32;){if(0===s)break e;s--,u|=i[o++]<<l,l+=8}if(_-=c,e.total_out+=_,r.total+=_,4&r.wrap&&_&&(e.adler=r.check=r.flags?gr(r.check,n,_,a-_):Rr(r.check,n,_,a-_)),_=c,4&r.wrap&&(r.flags?u:hn(u))!==r.check){e.msg="incorrect data check",r.mode=fn;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+=i[o++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=fn;break}u=0,l=0}r.mode=16208;case 16208:O=Xi;break e;case fn:O=tn;break e;case 16210:return rn;default:return en}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<fn&&(r.mode<pn||t!==Yi))&&In(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?gr(r.check,n,_,e.next_out-_):Rr(r.check,n,_,e.next_out-_)),e.data_type=r.bits+(r.last?64:0)+(r.mode===cn?128:0)+(r.mode===dn||r.mode===ln?256:0),(0===d&&0===_||t===Yi)&&O===Qi&&(O=nn),O},inflateEnd:e=>{if(bn(e))return en;let t=e.state;return t.window&&(t.window=null),e.state=null,Qi},inflateGetHeader:(e,t)=>{if(bn(e))return en;const r=e.state;return 2&r.wrap?(r.head=t,t.done=!1,Qi):en},inflateSetDictionary:(e,t)=>{const r=t.length;let i,n,o;return bn(e)?en:(i=e.state,0!==i.wrap&&i.mode!==sn?en:i.mode===sn&&(n=1,n=Rr(n,t,r,0),n!==i.check)?tn:(o=In(e,t,r,r),o?(i.mode=16210,rn):(i.havedict=1,Qi)))},inflateInfo:"pako inflate (from Nodeca project)"};var Ln=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 An=Object.prototype.toString,{Z_NO_FLUSH:Pn,Z_FINISH:Nn,Z_OK:wn,Z_STREAM_END:Dn,Z_NEED_DICT:kn,Z_STREAM_ERROR:Un,Z_DATA_ERROR:Mn,Z_MEM_ERROR:xn}=Cr;function jn(e){this.options=mi({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 Ii,this.strm.avail_out=0;let r=yn.inflateInit2(this.strm,t.windowBits);if(r!==wn)throw new Error(mr[r]);if(this.header=new Ln,yn.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Oi(t.dictionary):"[object ArrayBuffer]"===An.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=yn.inflateSetDictionary(this.strm,t.dictionary),r!==wn)))throw new Error(mr[r])}jn.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Nn:Pn,"[object ArrayBuffer]"===An.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(i),r.next_out=0,r.avail_out=i),o=yn.inflate(r,a),o===kn&&n&&(o=yn.inflateSetDictionary(r,n),o===wn?o=yn.inflate(r,a):o===Mn&&(o=kn));r.avail_in>0&&o===Dn&&r.state.wrap>0&&0!==e[r.next_in];)yn.inflateReset(r),o=yn.inflate(r,a);switch(o){case Un:case Mn:case kn:case xn:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===Dn))if("string"===this.options.to){let e=Ei(r.output,r.next_out),t=r.next_out-e,n=Si(r.output,e);r.next_out=t,r.avail_out=i-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(n)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==wn||0!==s){if(o===Dn)return o=yn.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},jn.prototype.onData=function(e){this.chunks.push(e)},jn.prototype.onEnd=function(e){e===wn&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ci(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const{Deflate:Bn,deflate:Vn,deflateRaw:Fn,gzip:Jn}=Bi;var Gn=Jn;var Hn,Kn=-1,Wn="RongCloudSEIAI",zn=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)}))},Yn=function(t,r,i){return s(void 0,void 0,void 0,(function(){var n,o;return c(this,(function(a){return n=[],o=i.jwt||"",[2,new Promise((function(i,a){t.forEach((function(t){return s(void 0,void 0,void 0,(function(){var a,s,u;return c(this,(function(c){switch(c.label){case 0:return a=t.detectorAddr.replace(/^(https?:\/\/)?/,"https://"),s="".concat(a,"/rtc/detector/ping?t=").concat((d=9999,(l=1e3)+Math.floor(Math.random()*(d-l)))),u={jwt:o},[4,r.httpReq({url:s,body:JSON.stringify(u),timeout:5e3,method:e.HttpMethod.POST})];case 1:return 200===c.sent().status&&n.push(t.clusterId),i(n),[2]}var l,d}))}))}))}))]}))}))},qn=function(e,t){var r,i;if(!t)return"";try{i=JSON.parse(t.voipCallInfo||'{ "strategy": 0 }')}catch(r){return e.warn(n.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O,"parse `voipCallInfo` of navi failed: ".concat(t.voipCallInfo)),""}if(0===i.strategy)return"";var o=null===(r=i.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!o||0===o.length)return"";var a=o[0];return a.detectorManager?a.detectorManager:""},Zn=function(t,r,i){return s(void 0,void 0,void 0,(function(){var n,o,a,s,u,l,d,_;return c(this,(function(c){switch(c.label){case 0:return n=qn(r,i),o=i.jwt||"",a=120,s=0,u=i.ipType||0,l={jwt:o,ipType:u},[4,t.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.36.0-alpha.6","Client-Session-Id":zn(),"Request-Id":Date.now().toString()},method:e.HttpMethod.POST})];case 1:return d=c.sent(),_=d.data&&JSON.parse(d.data).detectorAddrs||[],a=d.data&&JSON.parse(d.data).clientDetectMinute,s=d.data&&JSON.parse(d.data).resultCode,[2,{detectoraddrs:_,clientDetectMinute:a,status:s}]}}))}))};exports.RCRTCOperateSummarizationType=void 0,(Hn=exports.RCRTCOperateSummarizationType||(exports.RCRTCOperateSummarizationType={})).OPEN="2",Hn.CLOSE="1";function Qn(t){var r=t.method||e.HttpMethod.GET,i=t.timeout||6e4,n=t.headers,o=t.query,a=t.body,s=t.onProgress,c=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var r=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return r.length?[e,r.join("&")].join("?"):e}(t.url,o),u=new XMLHttpRequest;if(u.open(r,c),n&&u.setRequestHeader)for(var l in n)u.setRequestHeader(l,n[l]);return function(e,t,r,i){return new Promise((function(n){e.onreadystatechange=function(){i?2===e.readyState?n({data:e.responseText,status:e.status,xhr:e}):4===e.readyState?i(e.responseText,!0):3===e.readyState&&i(e.responseText,!1):4===e.readyState&&n({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){n({status:e.status})},0!==t&&setTimeout((function(){e.abort(),n({status:e.status})}),t),e.send(r)}))}(u,i,a,s)}var Xn,$n=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(vt.browser,"|").concat(vt.version),ClientVersion:"5.36.0-alpha.6","Client-Session-Id":zn(),"Request-Id":Date.now().toString()}},eo=function(){function t(t,r,i,n){void 0===n&&(n=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:i}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:n}),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}),this._logger=this._context.logger,r.getConnectionStatus()===e.RCConnectionStatus.CONNECTED&&this.isNededDetector()&&this.detectorMediaSever()}return Object.defineProperty(t.prototype,"isNededDetector",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._context.getNaviInfo();if(!e)return!1;var r=qn(this._logger,e),i=e.jwt||"",n=Date.now(),o=!1;return 0===t.detectorTime?o=!1:t.detectValidMinute+t.detectorTime<n&&(o=!0),!(!r||!i||this._msUrl||o)}}),Object.defineProperty(t.prototype,"detectorMediaSever",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.clearMSList();var e=this._context.getNaviInfo();this._startDetector(e)}}),Object.defineProperty(t.prototype,"_startDetector",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var r,i,n,o;return c(this,(function(a){switch(a.label){case 0:return[4,Zn(this._runtime,this._logger,e)];case 1:return r=a.sent(),i=r.detectoraddrs,n=r.clientDetectMinute,r.status!==exports.RCRTCCode.JWT_TIME_OUT?[3,3]:[4,this._context.getPluginContext().refetchNaviInfo()];case 2:return a.sent(),this.detectorMediaSever(),[2];case 3:return i.length?(o=t,[4,Yn(i,this._runtime,e)]):[3,5];case 4:o.msInDetector=a.sent(),a.label=5;case 5:return t.detectorTime=Date.now(),t.detectValidMinute=60*n*1e3,[2]}}))}))}}),Object.defineProperty(t.prototype,"clearMSList",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._msList.length=0}}),Object.defineProperty(t.prototype,"getMsList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msUrl?[this._msUrl]:(this._sortMediaServiceList(),d([],l(this._msList),!1))}}),Object.defineProperty(t.prototype,"_sortMediaServiceList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.msInDetector[0],r=t.msInDetector.slice(1),i=function(e,t){var r,i;if(!e)return[];try{i=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(r){return t.warn(n.L_PARSE_VOIP_SERVER_CONF_E,e.voipCallInfo),[]}if(0===i.strategy)return[];var o=null===(r=i.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!o||0===o.length)return[];var a=o[0],s=[];return a.mediaServer&&s.push(a.mediaServer.replace(/^(https?:\/\/)?/,"https://")),a.backupMediaServer&&a.backupMediaServer.forEach((function(e){s.push(e.replace(/^(https?:\/\/)?/,"https://"))})),s}(this._context.getNaviInfo(),this._logger),o=i[0],a=i.slice(1),s=d(d([this._clusterId,e,o],l(r),!1),l(a),!1).filter((function(e){return!!e})).map((function(e){return e.replace(/^(https?:\/\/)?/,"https://")}));this._msList=d([],l(new Set(s)),!1),this._logger.info(n.L_MEDIA_SERVICE_MSLIST_CHANGE_O,"MediaServiceList msList -> ".concat(JSON.stringify(this._msList)))}}),Object.defineProperty(t.prototype,"_openGzip",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var r=JSON.stringify(t),i=r.length,n=new Uint8Array(i),o=0;o<i;o++)n[o]=r.charCodeAt(o);var s;return{headers:e=a(a({},e),{"Content-Encoding":"gzip","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}),body:t=Gn(n,s)}}}),Object.defineProperty(t.prototype,"_dealRequestSuccessResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.parse(e);return t.rtcFinger&&(this._rtcFinger=t.rtcFinger),t.clusterId&&(this._clusterId!==t.clusterId&&this.clearMSList(),this._clusterId=t.clusterId),{code:exports.RCRTCCode.SUCCESS,data:t,qualityMsList:this._qualityMsList}}}),Object.defineProperty(t.prototype,"_request",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,u,l,d){return s(this,void 0,void 0,(function(){var s,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I;return c(this,(function(c){switch(c.label){case 0:if(this._qualityMsList=[],_=(s={headers:r,body:i}).headers,p=s.body,0===(f=this.getMsList()).length)return this._logger.error(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),u),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}];this._rtcFinger&&(p.rtcFinger=this._rtcFinger),h=0,c.label=1;case 1:return h<f.length?(R=Date.now(),b="".concat(f[h]).concat(t),g=$n(),m=a(a({},g),_),C=/x-www-form-urlencoded/.test(m["Content-Type"])?p:JSON.stringify(p),v=g["Request-Id"],this._logger.info(n.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:b,"Request-Id":v}),u),T=void 0,O={url:b,body:C,headers:m,method:e.HttpMethod.POST,timeout:this._timeout},d?[4,Qn(a(a({},O),{onProgress:d}))]:[3,3]):[3,7];case 2:return T=c.sent(),[3,5];case 3:return[4,this._runtime.httpReq(a({},O))];case 4:T=c.sent(),c.label=5;case 5:if(S=T.status,E=T.data,I=T.xhr,l&&this._qualityMsList.push({rsdur:Date.now()-R,rsid:v,rscod:200===S?exports.RCRTCCode.SUCCESS:exports.RCRTCCode.REQUEST_FAILED,msa:b}),200===S)return this._logger.info(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:o.SUCCESSED,url:b}),u),d?[2,{code:exports.RCRTCCode.SUCCESS,data:I}]:[2,this._dealRequestSuccessResult(E)];this._logger.error(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:o.FAILED,msg:"request error -> Request-Id: ".concat(v,", status: ").concat(S,", url: ").concat(b),timeout:this._timeout}),u),c.label=6;case 6:return h+=1,[3,1];case 7:return[2,{code:exports.RCRTCCode.REQUEST_FAILED,qualityMsList:this._qualityMsList}]}}))}))}}),Object.defineProperty(t.prototype,"exchange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n;return s(this,void 0,void 0,(function(){var o,a;return c(this,(function(s){switch(s.label){case 0:return[4,this._request("/exchange",e,t,r,i)];case 1:return(o=s.sent()).code===exports.RCRTCCode.SUCCESS&&(null===(n=o.data)||void 0===n?void 0:n.resultCode)===exports.RCRTCCode.SUCCESS&&(a=o.data.urls)&&(this._configUrl=a.configUrl),[2,o]}}))}))}}),Object.defineProperty(t.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(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(t.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(t.prototype,"broadcastExit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(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(t.prototype,"setMcuConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,s,u,l,d,_,p,f,h,R,b;return c(this,(function(c){switch(c.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_T,JSON.stringify({body:r}),i),this._configUrl?(s="".concat(this._configUrl.replace(/^(https?:\/\/)?/,"https://"),"/server/mcu/config"),u=$n(),l=a(a({},u),t),d=JSON.stringify(r),_=u["Request-Id"],[4,this._runtime.httpReq({url:s,headers:l,body:d,method:e.HttpMethod.POST})]):(this._logger.error(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND,msg:"MCU server not found"}),i),[2,{code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND}]);case 1:return p=c.sent(),f=p.status,h=p.data,200===f?(R=JSON.parse(h),(b=R.resultCode)===exports.RCRTCCode.SUCCESS?this._logger.info(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:o.SUCCESSED,"Request-Id":_}),i):this._logger.warn(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({code:b,"Request-Id":_}),i),[2,{code:b,res:R}]):(this._logger.error(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REQUEST_FAILED,msg:"request error -> Request-Id: ".concat(_,", status: ").concat(f,", url: ").concat(s)}),i),[2,{code:exports.RCRTCCode.REQUEST_FAILED}])}}))}))}}),Object.defineProperty(t.prototype,"getCDNResourceInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return s=$n(),u=a(a({},s),t),l=s["Request-Id"],this._logger.info(n.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T,"Request-Id: ".concat(l,", url: ").concat(r),i),[4,this._runtime.httpReq({url:r,headers:u,method:e.HttpMethod.GET})];case 1:return d=c.sent(),_=d.status,p=d.data,200===_?(f=JSON.parse(p),this._logger.info(n.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:o.SUCCESSED,cdnPlayerUrl:null==f?void 0:f.data.pull_url}),i),[2,{code:f.resultCode,res:f}]):(this._logger.info(n.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REQUEST_FAILED}),i),[2,{code:exports.RCRTCCode.REQUEST_FAILED}])}}))}))}}),Object.defineProperty(t.prototype,"updateASRStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return[4,this._request("/rtc/media/v1/asr/update",e,t,r)];case 1:return[2,i.sent()]}}))}))}}),Object.defineProperty(t.prototype,"operateRealtimeTranslation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return[4,this._request("/rtc/media/v1/asr/translation",e,t,r)];case 1:return[2,i.sent()]}}))}))}}),Object.defineProperty(t.prototype,"operateSummarization",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i;return c(this,(function(n){switch(n.label){case 0:return i="/rtc/media/v1/ai/room/sum/".concat(t.status===exports.RCRTCOperateSummarizationType.OPEN?"start":"stop"),[4,this._request(i,e,t,r)];case 1:return[2,n.sent()]}}))}))}}),Object.defineProperty(t.prototype,"generateSummarization",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o,a){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return s={"App-Key":this._context.getAppkey(),UserId:this._context.getCurrentId(),RoomId:e,"X-Stream":!0},u={taskId:t,startTime:r,endTime:i,config:{summarization:n.enableSummarization,summarizationDetails:n.enableSummarizationDetails,chapterSummary:n.enableChapterSummary,todoList:n.enableTodoList,hashtag:n.enableHashtag,language:n.destLang,format:n.format,custom:n.customPrompt}},[4,this._request("/rtc/media/v1/ai/room/sum/gen",s,u,a,!1,(function(e,t){o(e,t)}))];case 1:return l=c.sent(),d=l.code,_=l.data,p=null==_?void 0:_.getResponseHeader("x-code"),f=null==_?void 0:_.getResponseHeader("x-msg"),d===exports.RCRTCCode.SUCCESS&&p&&Number(p)!==exports.RCRTCCode.SUCCESS?[2,{code:Number(p),msg:f}]:[2,{code:d}]}}))}))}}),Object.defineProperty(t.prototype,"getASRContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o,a){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return s={"App-Key":this._context.getAppkey(),UserId:this._context.getCurrentId(),RoomId:e,"X-Stream":!0},u={taskId:t,startTime:r,endTime:i,language:a},[4,this._request("/rtc/media/v1/ai/room/sum/asr",s,u,o,!1,(function(e,t){n(e,t)}))];case 1:return l=c.sent(),d=l.code,_=l.data,p=null==_?void 0:_.getResponseHeader("x-code"),f=null==_?void 0:_.getResponseHeader("x-msg"),d===exports.RCRTCCode.SUCCESS&&p&&Number(p)!==exports.RCRTCCode.SUCCESS?[2,{code:Number(p),msg:f}]:[2,{code:d}]}}))}))}}),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}),t}();!function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}(Xn||(Xn={}));var to,ro=function(e,t){return Math.round(8*t/e)},io=function(e,t){void 0===t&&(t=2);var r=Math.pow(10,t);return Math.round(e*r)/r},no=function(e,t){void 0===t&&(t=2),e>1&&(e=1);var r=Math.pow(10,t);return Math.round(e*r)},oo=function(e,t,r,i){if(0===t)return 0;if(!r||!i)return io(e/t,3);var n=t-i;if(0===n)return 0;var o=e-r;return o<0||n<0?0:io(o/n,3)},ao=function(e){var t=e.jitter,r=e.rtt,i=e.packetsLostRate;return!It(t)||!It(r)||0!==i};!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"}(to||(to={}));var so,co=function(){function e(e,t,r,i,n,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:i}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),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 i,n;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];i=t-o.bytesSent,n=r-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:r}}else i=t,n=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:r};return ro(n,i)}}),Object.defineProperty(e.prototype,"updateBytesRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,n;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];i=t-o.bytesRecv,n=r-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r}}else i=t,n=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r};return ro(n,i)}}),Object.defineProperty(e.prototype,"updateSenderPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var n=this._latestPacketsSent[e],o=n.packetsLost,a=n.packetsSent;i=oo(t,r,o,a),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?a:r}else i=oo(t,r),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=r;return i}}),Object.defineProperty(e.prototype,"updateReceiverPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;if(this._latestPacketsRecv[e]){var n=this._latestPacketsRecv[e],o=n.packetsLost,a=n.packetsRecv;i=oo(t,r+t,o,a+o)}else i=oo(t,r);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:r},i}}),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())===exports.RCMediaType.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,i={};try{for(var n=u(e.entries()),o=n.next();!o.done;o=n.next()){var a=l(o.value,2),s=a[0],c=a[1];/codec/gi.test(c)&&s.includes("RTCCodec_")||(i[s]=c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i}}),Object.defineProperty(e.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={senders:[],receivers:[]};return this._logger.info(n.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O,JSON.stringify({status:o.SUCCESSED,stats:e,reports:t})),t}}),Object.defineProperty(e.prototype,"isValidTranceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n="outbound-rtp"===t?null===(r=this._rtcPeerConn.currentLocalDescription)||void 0===r?void 0:r.sdp:null===(i=this._rtcPeerConn.currentRemoteDescription)||void 0===i?void 0:i.sdp,o=e.ssrc;return!(null==n?void 0:n.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===to.REMOTEINBOUNDRTP?(e.remoteInbound.push(t),e):t.type===to.INBOUNDRTP?(e.inbound.push(t),e):t.type===to.OUTBOUNDRTP?(e.outbound.push(t),e):t.type===to.TRANSPORT?(e.transport.push(t),e):t.type===to.PEERCONNECTION?(e.connection.push(t),e):e}),{outbound:[],remoteInbound:[],inbound:[],transport:[],connection:[]})}}),e}(),uo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=this.formatStateData(e),n=i.outbound,o=i.remoteInbound,a=i.inbound,s=i.transport,c=i.connection,u={senders:[],receivers:[]},l=Math.floor(c[0].timestamp);u.timestamp=l;var d=0,_=0;d=(t=this.pickOutbound(n,e,d,l,_)).totalPacketsLost,_=t.bitrateSend,u.senders=t.senders,o.length>0&&u.senders.length>0&&this.pickRemoteInbound(o,u.senders,e);var p=0;if(d=(r=this.pickInbound(a,e,d,l,p)).totalPacketsLost,p=r.bitrateRecv,u.receivers=r.receivers,s.length>0){var f=s[0];this.pickRtcTransport(f,e,u,p,_,d)}return u}}),Object.defineProperty(t.prototype,"pickRtcTransport",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,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,h=p.port,R=p.networkType,b=t[_],g=b.ip,m=b.port,C=b.protocol;r.iceCandidatePair={IP:f,port:h,networkType:R,remoteIP:g,remotePort:m,protocol:C,bitrateRecv:i,bitrateSend:n,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 i=this;e.forEach((function(e){var n,o=e.localId,a=e.jitter,s=e.roundTripTime,c=e.packetsLost,u=t.filter((function(e){return e.id===o}))[0];if(u&&!ao(u)){var l=null===(n=i._store)||void 0===n?void 0:n.getTrackIdBySSRC(r[u.id].ssrc);u.jitter=Math.round(1e3*a),u.rtt=s;var d=i._latestPacketsSent[l].crtPacketsSent;u.packetsLostRate=i.updateSenderPacketsLost(l,c,d)}}))}}),Object.defineProperty(t.prototype,"_getOutboundVideoAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){var o,a,s,c=e.framesPerSecond,u=e.frameWidth,l=e.frameHeight;return"video"!==r||u||l||c||(u=(null===(o=t[i])||void 0===o?void 0:o.frameWidth)||t[n].width,l=(null===(a=t[i])||void 0===a?void 0:a.frameHeight)||t[n].height,c=(null===(s=t[n])||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,i,n){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,h=e.pliCount,R=e.nackCount,b=e.mid,g=e.trackId;if(void 0!==b&&(g=o.getTrackIdByMid(b)),g){var m=o._getOutboundVideoAttrs(e,t,u,g,l),C=m.frameRate,v=m.frameWidth,T=m.frameHeight,O=t[d],S=null,E=null,I=0;O&&(S=O.jitter,E=O.roundTripTime,I=O.packetsLost),r+=I;var y=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc);if(y){var L=l?t[l].audioLevel:t[g].audioLevel,A=0;!o._latestPacketsSent[y]&&(o._latestPacketsSent[y]={}),O?A=o.updateSenderPacketsLost(y,I,_):o._latestPacketsSent[y].crtPacketsSent=_;var P=o.updateBytesSent(y,p,i);P<0&&(P=0),n+=P,a.push({id:c,trackId:y,kind:u,packetsLostRate:A,remoteResource:!1,audioLevel:L||0===L?no(L):null,frameWidth:v,frameHeight:T,frameRate:C,bitrate:P,jitter:S?Math.round(1e3*S):S,rtt:E?Math.round(1e3*E):E,encoderImplementation:f,pliCount:h,nackCount:R,googFirsSent:Kn,samplingRate:Kn,googRenderDelayMs:Kn,trackState:Kn})}}}})),{totalPacketsLost:r,bitrateSend:n,senders:a}}}),Object.defineProperty(t.prototype,"_getInboundMediaAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){var o,a,s,c=e.frameWidth,u=e.frameHeight,l=e.audioLevel;return"video"===n?c||u||(c=(null===(o=t[r])||void 0===o?void 0:o.frameWidth)||t[i].width,u=(null===(a=t[r])||void 0===a?void 0:a.frameHeight)||t[i].height):l||(l=(null===(s=t[r])||void 0===s?void 0:s.audioLevel)||t[i].audioLevel),{frameWidth:c,frameHeight:u,audioLevel:l}}}),Object.defineProperty(t.prototype,"pickInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){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,h=e.nackCount,R=e.pliCount,b=e.mid,g=e.id,m=e.trackId;if(void 0!==b&&(m=o.getTrackIdByMid(b)),m){var C=o._getInboundMediaAttrs(e,t,m,g,p),v=C.frameWidth,T=C.frameHeight,O=C.audioLevel;r+=c;var S=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc),E=o.updateReceiverPacketsLost(S,c,u),I=o.updateBytesRecv(S,d,i);I<0&&(I=0),n+=I,a.push({trackId:S,kind:p,packetsLostRate:E,remoteResource:!0,audioLevel:O||0===O?no(O):null,frameWidth:v,frameHeight:T,frameRate:_,bitrate:I,jitter:l?Math.round(1e3*l):0,codecImplementationName:f,nackCount:h,pliCount:R,rtt:null,samplingRate:Kn,googFirsReceived:Kn,googRenderDelayMs:Kn,trackState:Kn})}}})),{totalPacketsLost:r,bitrateRecv:n,receivers:a}}}),t}(co),lo=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 r(t,e),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,r)){var n=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,h=_.packetsLost,R=null===(i=this._store)||void 0===i?void 0:i.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=h;var b=0;!this._latestPacketsSent[R]&&(this._latestPacketsSent[R]={}),d?b=this.updateSenderPacketsLost(R,h,a):this._latestPacketsSent[R].crtPacketsSent=a;var g=0;"video"===n?s&&(g=Math.floor(s/1e3)):g=this.updateBytesSent(R,o,this._reportsData.timestamp),g<0&&(g=0),this._bitrateSend+=g,this._reportsData.senders.push({trackId:R,kind:n,packetsLostRate:b,remoteResource:!1,audioLevel:null,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:Kn,samplingRate:Kn,googRenderDelayMs:Kn,trackState:Kn})}}}),Object.defineProperty(t.prototype,"_addSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i=t.localId,n=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e[i].ssrc),o=this._reportsData.senders.filter((function(e){return e.trackId===n}))[0];o&&ao(o)&&(o.jitter=Math.round(1e3*t.jitter),o.rtt=t.rtt,o.packetsLostRate=this.updateSenderPacketsLost(n,t.packetsLost,this._latestPacketsSent[n].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 i=e.packetsLost,n=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+=i;var p=this.updateReceiverPacketsLost(_,i,o),f=0;"video"===c?u&&(f=Math.floor(u/1e3)):f=this.updateBytesRecv(_,n,this._reportsData.timestamp),f<0&&(f=0),this._bitrateRecv+=f,this._reportsData.receivers.push({trackId:_,kind:c,packetsLostRate:p,remoteResource:!0,audioLevel:null,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:Kn,googFirsReceived:Kn,googRenderDelayMs:Kn,trackState:Kn})}}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e[t.localCandidateId],i=r.address,n=r.port,o=e[t.remoteCandidateId],a=o.address,s=o.port,c=o.protocol;this._reportsData.iceCandidatePair={IP:i,port:n,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 i=e[r],n=i.type;"outbound-rtp"===n&&this._pickSenderData(i,e,n),"remote-inbound-rtp"===n&&this._addSenderData(e,i),"inbound-rtp"===n&&this._pickReceiverData(i,n),"candidate-pair"===n&&"succeeded"===i.state&&this._pickIceCandidatePair(e,i)}return this._reportsData}}),t}(co),_o=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 r(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 i=e.packetsLost,n=e.packetsReceived,o=e.jitter,a=e.bytesReceived,s=e.kind,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+=i;var f=r.updateReceiverPacketsLost(p,i,n),h=r.updateBytesRecv(p,a,r._reportsData.timestamp);h<0&&(h=0),r._bitrateRecv+=h,r._reportsData.receivers.push({trackId:p,kind:s,packetsLostRate:f,remoteResource:!0,audioLevel:l||0===l?no(l):null,frameWidth:_,frameHeight:d,frameRate:null,bitrate:h,jitter:o?Math.round(1e3*o):o,codecImplementationName:null,nackCount:c,pliCount:u,rtt:null,samplingRate:Kn,googFirsReceived:Kn,googRenderDelayMs:Kn,trackState:Kn})}}}))}}),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var i;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"outbound-rtp")){var n=null===(i=r._store)||void 0===i?void 0:i.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(n){var h=t[p],R=null,b=null,g=0;h&&(R=h.jitter,b=h.roundTripTime,g=h.packetsLost),r._totalPacketsLost+=g;var m=0;!r._latestPacketsSent[n]&&(r._latestPacketsSent[n]={}),h?m=r.updateSenderPacketsLost(n,g,f):r._latestPacketsSent[n].crtPacketsSent=f;var C=r.updateBytesSent(n,a,r._reportsData.timestamp);C<0&&(C=0),r._bitrateSend+=C,r._reportsData.senders.push({trackId:n,kind:o,packetsLostRate:m,remoteResource:!1,audioLevel:u||0===u?no(u):null,frameWidth:d,frameHeight:l,frameRate:null,bitrate:C,jitter:R?Math.round(1e3*R):R,rtt:b?Math.round(1e3*b):b,encoderImplementation:t[_].mimeType,pliCount:s,nackCount:c,googFirsSent:Kn,samplingRate:Kn,googRenderDelayMs:Kn,trackState:Kn})}}}))}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.selectedCandidatePairId;if(r){var i=t[r],n=i.availableOutgoingBitrate,o=i.availableIncomingBitrate,a=i.currentRoundTripTime,s=i.localCandidateId,c=i.remoteCandidateId,u=t[s],l=u.address,d=u.port,_=t[c],p=_.address,f=_.port,h=_.protocol;this._reportsData.iceCandidatePair={IP:l||null,port:d,networkType:null,remoteIP:p,remotePort:f,protocol:h,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:1e3*a,availableOutgoingBitrate:n,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,i=t.inbound,n=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(i,e),n.length>0){var s=n[0];this._pickIceCandidatePair(s,e)}return this._reportsData}}),t}(co),po=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 i=this.getStreamIndex();this.spliteStreams(i)}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),d([],l(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(i){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(i)?r.setAudioItemBitrate(i,e):i})),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(i){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(i)?r.setAudioItemBitrate(i,e):i})),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 i=["$1","maxaveragebitrate=".concat(r.max*e.KBitrate*1e3)];t=t.replace(/(\buseinbandfec=[^\r\n]+)/gi,i.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(i){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(i)?r.setVideoItemBitrate(i,e):i})),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(i){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(i)?r.setVideoItemBitrate(i,e):i})),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 i=["$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,i.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(i){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(i)?r.clearSSRC(i,t):i})),this.videoStreams=this.videoStreams.map((function(i){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(i)?r.clearSSRC(i,t):i})),this}}),Object.defineProperty(e.prototype,"clearSSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(t===Ro.SENDONLY&&/\ba=sendonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===Ro.RECVONLY&&/\ba=recvonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===Ro.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}(),fo=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(n.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(n.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(n.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(n.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"}(so||(so={})),so.NB,so.NB,so.NB,so.NB,so.MB,so.MB,so.MB,so.MB,so.WB,so.WB,so.WB,so.WB,so.SWB,so.SWB,so.FB,so.FB,so.NB,so.NB,so.NB,so.NB,so.WB,so.WB,so.WB,so.WB,so.SWB,so.SWB,so.SWB,so.SWB,so.FB,so.FB,so.FB,so.FB;var ho,Ro,bo=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,i=e.matchPrefix(t,"a=msid:");if(1===i.length)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var n=e.matchPrefix(t,"a=ssrc:").map((function(t){return e.parseSsrcMedia(t)})).filter((function(e){return"msid"===e.attribute}));return n.length>0&&n[0].value?{stream:(r=n[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)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+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 i=t.join(","),n=i.indexOf("0,0,0,1,101");-1===n&&(n=i.indexOf("0,0,0,1,37")),r=i.substring(0,n).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 i=r.match(/a=rtpmap:(\d+)\s+(\S+)/g);i&&(e.payloadTypeCodecMap=i.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 go(e,t){for(var r=0,i=t;i<e.length;){var n=e[i];if(r+=n,i++,255!==n)break}return{value:r,nextOffset:i}}function mo(e,t){if(t>=e.length)return null;var r=go(e,t),i=r.value,n=r.nextOffset,o=go(e,n),a=o.value;if(n=o.nextOffset,a<16)return null;if(n+a>e.length)return null;var s=e.slice(n,n+16),c=n+16,u=a-16,l=e.slice(c,c+u);return l.length>=2&&0===l[l.length-2]&&128===l[l.length-1]?l=l.slice(0,l.length-2):l.length>=1&&128===l[l.length-1]&&(l=l.slice(0,l.length-1)),5===i?{payloadSize:a,uuid:s,content:l}:null}!function(e){e.PLANB="plan-b",e.UNIFIEDPLAN="unified-plan"}(ho||(ho={})),function(e){e.SENDONLY="sendonly",e.RECVONLY="recvonly",e.INACTIVE="inactive"}(Ro||(Ro={}));var Co,vo,To,Oo,So=function(){function e(e,t,r,i){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,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_useEncrypt",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_onReceiveSeiListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),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,i=vt.version,o=vt.supportsUnifiedPlan;if(t.info(n.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O,JSON.stringify({sdpSemantics:e,supportsUnifiedPlan:o,browser:r,version:i})),o)return/chrome/i.test(r)?i?void(this._sdpSemantics=i>92?"unified-plan":i<72?"plan-b":e):void(this._sdpSemantics="unified-plan"):void(/firefox/i.test(r)?this._sdpSemantics="unified-plan":/safari/i.test(r)?this._sdpSemantics=i<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,"setReceiveSeiListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._onReceiveSeiListener=e}}),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 i=/_tiny$/.test(t),n=ut(r),o=n.width,a=n.height;e.push({trackId:r.id,simulcast:i?Xn.TINY:Xn.NORMAL,resolution:"".concat(o,"x").concat(a)})}}return e}}),Object.defineProperty(e.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:e=po.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(n.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:o.FAILED,msg:t})),[2,exports.RCRTCCode.SET_REMOTE_DESCRIPTION_FAILED];case 4:return this._logger.info(n.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:o.SUCCESSED,sdp:e})),[2,exports.RCRTCCode.SUCCESS]}}))}))}}),Object.defineProperty(e.prototype,"getStatParsr",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return/chrome/i.test(vt.browser)?new uo(this,e,this._logger,t,r,i):/Firefox/i.test(vt.browser)?new lo(this,e,this._logger,t,r,i):/Safari/i.test(vt.browser)?new _o(this,e,this._logger,t,r,i):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 po.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,i=t.writable,n=new TransformStream({transform:this._encodeRtpChunk.bind(this,e)});r.pipeThrough(n).pipeTo(i)}}}),Object.defineProperty(e.prototype,"_setupReceiverTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.createEncodedStreams(),r=t.readable,i=t.writable,n=new TransformStream({transform:this._decodeRtpChunk.bind(this,e)});r.pipeThrough(n).pipeTo(i)}}),Object.defineProperty(e.prototype,"_encodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=bo.splitNaluData(e),r=t.header,i=t.payloadData,n=fo.encodeVideo(i),o=bo.deal0x03(n,"encode");return new Uint8Array(d(d([],l(r),!1),l(o),!1)).buffer}}),Object.defineProperty(e.prototype,"_decodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=new Uint8Array(e),i=r.join(",").indexOf("0,0,0,1,6,5");if(-1!==i&&r.join(",").includes("84,128,131,151,240,35,71,75,183,247,79,50,181,78,6,172")){var n=r.join(",").slice(i);return null===(t=this._onReceiveSeiListener)||void 0===t||t.call(this,n),e}if(!this._useEncrypt)return e;var o=bo.splitNaluData(e),a=o.header,s=o.payloadData,c=bo.deal0x03(s,"decode"),u=fo.decodeVideo(c);return new Uint8Array(d(d([],l(a),!1),l(u),!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 i,n=!(e[r]>>7),o=127&e[r],a=void 0,s=void 0,c=void 0;if(n?(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),i=new Uint8Array(s),t.push({timestampOffset:a,header:c,block:i,isPrimary:n,blockPType:o}),n)break}return t.forEach((function(t){var i=t.block.byteLength,n=e.slice(r,r+i);t.block.set(n),r+=i})),t}(new Uint8Array(e)),i=[],n=[],o=0;r.forEach((function(e){var r="decode"===t?fo.decodeAudio(e.block):fo.encodeAudio(e.block);if(r.byteLength!==e.block.byteLength&&!e.isPrimary){var a=l(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,i.push(e.header),n.push(e.block)}));var a=new Uint8Array(o),s=0;return d(d([],l(i),!1),l(n),!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?fo.encodeAudio(r):fo.decodeAudio(r)).buffer}}),Object.defineProperty(e.prototype,"_encodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._encodeVideoFrame(i);else{var n=t.getMetadata().payloadType,o=bo.payloadTypeCodecMap.filter((function(e){return e.payloadType===n}))[0].codec;"red"===o?t.data=this._handleAudioREDFrame(i,"encode"):"opus"===o?t.data=this._handleOpusFrame(i,"encode"):console.error("Unsupport audio payloadType: ".concat(n,", codec: ").concat(o))}r.enqueue(t)}}),Object.defineProperty(e.prototype,"_decodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._decodeVideoFrame(i);else if(this._useEncrypt){var n=t.getMetadata().payloadType,o=bo.payloadTypeCodecMap.filter((function(e){return e.payloadType===n}))[0].codec;"red"===o?t.data=this._handleAudioREDFrame(i,"decode"):"opus"===o?t.data=this._handleOpusFrame(i,"decode"):console.error("Unsupport audio payloadType: ".concat(n,", codec: ").concat(o))}r.enqueue(t)}}),e}(),Eo=function(e){function t(t,r){var i=e.call(this,r,ho.PLANB,t)||this;return Object.defineProperty(i,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];d(d([],l(this.audioStreams),!1),l(this.videoStreams),!1).forEach((function(t){var r=t.match(/\ba=mid:(video|audio)\b/),i=po.clearInactiveOrRecvonly(t);r&&r[1]===Pe.AUDIO&&(e[1]=i),r&&r[1]===Pe.VIDEO&&(e[2]=i)}));var t=e.join("");return po.trimBlankLine(t)}}),Object.defineProperty(t.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(n.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(n.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Video Bitrate With Stream Id"),this}}),t}(po),Io=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 r(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(),i=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);i.getTracks().forEach((function(e){e.kind===r.kind&&i.removeTrack(e)})),i.addTrack(r);var n=e.getTrackId(),o=this.senders[n];o?o.replaceTrack(r):(this.senders[n]=this._peer.addTrack(r,i),Object.defineProperty(r,"trackId",{value:n,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(),i=this.senders[r];i&&(i.replaceTrack(null),this._peer.removeTrack(i),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 s(this,void 0,void 0,(function(){var t,r,i;return c(this,(function(n){switch(n.label){case 0:return[4,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0})];case 1:for(r in t=n.sent(),this._outboundStreams)i=this._outboundStreams[r].id,t.sdp=t.sdp.replace(new RegExp(i,"g"),r);return t.sdp&&(t.sdp=this.resetSdp(t.sdp)),[4,this._peer.setLocalDescription(t)];case 2:return n.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===exports.RCMediaType.AUDIO_ONLY?t.isAudioTrack():t.isVideoTrack()})),r={max:0,min:0};return t.forEach((function(e){var t=e.getBitrate(),i=t.min,n=t.max,o=t.start;r.max=r.max<n?n:r.max,r.min=r.min>i?i:r.min,r.max===n?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 Eo(this._logger,e),r=this._getMaxRangeBitrate(exports.RCMediaType.VIDEO_ONLY),i=this._getMaxRangeBitrate(exports.RCMediaType.AUDIO_ONLY);return t.setAudiosBitrate(i),t.setVideosBitrate(r),t.stringify()}}),t}(So),yo=function(e){function t(t,r){return e.call(this,r,ho.UNIFIEDPLAN,t)||this}return r(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];d(d([],l(this.audioStreams),!1),l(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 po.trimBlankLine(t)}}),t}(po),Lo=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 i=u(this.__streams.keys()),n=i.next();!n.done;n=i.next()){var o=n.value;r.set(o,this.pickup(o))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},enumerable:!1,configurable:!0}),e}(),Ao=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 r(t,e),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(n.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(),i=e.getStreamId(),n=e.__innerGetMediaStreamTrack();this._localTracks[r]=e;var o=this._outboundStreams[i]||(this._outboundStreams[i]=new MediaStream);o.getTracks().forEach((function(e){e.kind===n.kind&&o.removeTrack(e)})),o.addTrack(n);var a=this._sendTransceiver[r];if(a)a.sender.replaceTrack(n),a.direction="sendonly";else{var s=this._sendTransceiver[r]=this._peer.addTransceiver(n,{direction:"sendonly",streams:[o]});this._setupSenderTransform(s.sender)}Lo.getInstance().push(r,{msid:i,id:this._outboundStreams[i].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,t){void 0===t&&(t=!0);var r=e.getTrackId(),i=e.getStreamId();delete this._localTracks[r];var n=this._sendTransceiver[r];if(n){"closed"!==this._peer.connectionState&&(n.direction="inactive",this._peer.removeTrack(n.sender),n.sender.replaceTrack(null));var o=this._outboundStreams[i];(e.isAudioTrack()?o.getAudioTracks():o.getVideoTracks()).forEach((function(e){return o.removeTrack(e)}));var a=this._sendTransceiver["".concat(r,"_tiny")];if(a&&"inactive"!==a.direction&&t&&"closed"!==this._peer.connectionState){a.direction="inactive";var s=a.sender,c=s.track;this._peer.removeTrack(s),s.replaceTrack(null),this._outboundStreams["".concat(i,"_tiny")].removeTrack(c),c.stop()}}}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=_t(e).mediaType;this._recvTransceiver[e]=t;var i=r===exports.RCMediaType.AUDIO_ONLY?this._recvAudio:this._recvVideo,n=i.findIndex((function(e){return e===t}));n>=0&&i.splice(n,1)}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=e.slice(),i=this._subedTracks.slice();this._subedTracks=e.slice();for(var n=function(e){var t=r[e],n=i.findIndex((function(e){return e===t}));n>=0&&(r.splice(e,1),i.splice(n,1))},o=r.length-1;o>=0;o-=1)n(o);i.length&&i.forEach((function(e){var r=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var i=t._recvTransceiver[r];i&&(i.direction="inactive")}));var a={audio:0,video:0};r.length&&r.forEach((function(e){var r=e.isAudioTrack()?"audio":"video",i=t._recvTransceiver[e.getTrackId()];i?i.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 s(this,void 0,void 0,(function(){var t,r,i,n;return c(this,(function(o){switch(o.label){case 0:return[4,this._peer.createOffer({iceRestart:e})];case 1:for(i in t=o.sent(),r=t.sdp,this._outboundStreams)n=this._outboundStreams[i].id,r=r.replace(new RegExp(n,"g"),i);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 i=null;return bo.getMediaSections(e).forEach((function(e){bo.parseExtmap(e);var n=bo.parseMLine(e).kind,o=bo.parseMsid(e).stream,a=bo.getMid(e);"video"===r?/tiny$/.test(o)?o=o.replace(/tiny$/gi,"1_tiny"):o+="_1":o+="_0",o===t&&r===n&&a&&(i=a)})),i}}),Object.defineProperty(t.prototype,"_setSenderTransceiverBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n=this._localTracks[t],o=null==n?void 0:n.getBitrate();i===Pe.AUDIO&&o&&e.setAudioBitrateWithMid(o,r),i===Pe.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 i in this._sendTransceiver){var n=this._sendTransceiver[i],o=null===(r=n.sender.track)||void 0===r?void 0:r.kind,a=n.direction,s=n.mid;s||(s=this._genarateMid(e,i,o)),s&&(a===Ro.SENDONLY&&this._setSenderTransceiverBitrate(t,i,s,o),a===Ro.INACTIVE&&t.clearnSsrcWithMid(s,Ro.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],i=r.direction,n=r.mid;n&&i===Ro.INACTIVE&&e.clearnSsrcWithMid(n,Ro.RECVONLY)}}}),Object.defineProperty(t.prototype,"resetOfferSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new yo(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 yo(this._logger,e);for(var i in this._sendTransceiver){var n=this._sendTransceiver[i],o=n.mid;if(o){var a=this._localTracks[i],s=null==a?void 0:a.getBitrate(),c=null===(t=n.sender.track)||void 0===t?void 0:t.kind;c===Pe.AUDIO&&s&&r.setAudioBitrateWithMid(s,o),c===Pe.VIDEO&&s&&r.setVideoBitrateWithMid(s,o)}}return r.stringify()}}),t}(So),Po=function(e){function t(t,r,i,n,o,a,s,c){void 0===s&&(s=!1),void 0===c&&(c=!1);var u=e.call(this)||this;Object.defineProperty(u,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(u,"_reTryExchange",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_store",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"_isRoomAudience",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"reportParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"pubLocalTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(u,"_reTryExchangeTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_reportStatsTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_reportR3R4ToPolarisTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_formatStatsData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_inRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_firstConnectFromPub",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null});var l=So.getSdpSemantics(),d="unified-plan"===l&&c&&"function"==typeof RTCRtpSender.prototype.createEncodedStreams&&"function"==typeof RTCRtpReceiver.prototype.createEncodedStreams&&fo.isInit(),_=u._rtcPeerConn=new RTCPeerConnection({sdpSemantics:l,encodedInsertableStreams:d});return u._sdpStrategy="plan-b"===l?new Io(t,u._logger,_,!1):new Ao(t,u._logger,_,d),u._sdpStrategy.setReceiveSeiListener(u._decodeSeiData.bind(u)),u._rtcPeerConn.oniceconnectionstatechange=u._onICEConnectionStateChange.bind(u),u._rtcPeerConn.onconnectionstatechange=u._onConnectionStateChange.bind(u),u._rtcPeerConn.ontrack=u._onTrackReady.bind(u),u.reportParser=u._sdpStrategy.getStatParsr(u._rtcPeerConn,l,u._currentUserId,u._store),u}return r(t,e),Object.defineProperty(t.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.values(this.pubLocalTracks)}}),Object.defineProperty(t.prototype,"_decodeSeiData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.split(",").map((function(e){return Number(e)})),i=function(e){if(e.length>=4&&0===e[0]&&0===e[1]&&(1===e[2]||0===e[2]&&1===e[3]))for(var t=0;t+4<e.length;)if(0===e[t]&&0===e[t+1]&&(1===e[t+2]||0===e[t+2]&&1===e[t+3])){if((i=t+(1===e[t+2]?3:4))>=e.length)break;if(6==(31&e[i])&&(o=mo(e,a=i+1)))return{payloadSize:o.payloadSize,content:o.content};t=i+1}else t++;else for(var r=0;r+4<=e.length;){var i,n=e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3];if(n<=0||r+4+n>e.length)break;if(6==(31&e[i=r+4])){var o,a=i+1;if(o=mo(e.subarray(a,r+4+n),0))return{payloadSize:o.payloadSize,content:o.content}}r+=4+n}return null}(new Uint8Array(r));if(null==i?void 0:i.content.length){var n=this._context.decodeAsrText(i.content,r);n.length&&this.emit(t.__INNER_SEI_CONTENT__,n)}}}),Object.defineProperty(t.prototype,"_onConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._logger.info(n.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 s(this,void 0,void 0,(function(){var i,a,s;return c(this,(function(c){switch(c.label){case 0:return i=this._rtcPeerConn.iceConnectionState,this._logger.info(n.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S,JSON.stringify({iceConnectionState:i})),[4,this._getStatsData()];case 1:a=c.sent(),s=a?this._createRCRTCStateReport(a).iceCandidatePair:null,this.emit(t.__INNER_ICE_STATE_CHANGE__,{status:i,time:Date.now(),iceCandidatePair:s}),"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){this._logger.error(n.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R,JSON.stringify({status:o.FAILED,mag:e}))}return[2]}}))}))}}),Object.defineProperty(t.prototype,"_handleRetry",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t=this;return c(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===exports.RCRTCCode.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,i=e.receiver.track,n=[r,"audio"===i.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_");Object.defineProperty(i,"trackId",{value:n,writable:!1,enumerable:!1,configurable:!1}),this._updateRecvTransceiverMap(n,e.transceiver),_t(n).tag!==Wn&&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 s(this,void 0,void 0,(function(){return c(this,(function(i){return this._sdpStrategy.setBitrate(e,t,r),this._logger.info(n.L_RTC_PEER_CONNECTION_SET_BITRATE_O,JSON.stringify({status:o.SUCCESSED,max:e,min:t,start:r})),[2]}))}))}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return[4,this._sdpStrategy.createOffer(e)];case 1:return t=r.sent(),this._logger.info(n.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),s(this,void 0,void 0,(function(){return c(this,(function(i){return bo.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(We.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(We.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(We.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(We.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),this._logger.info(n.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(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:o.SUCCESSED,trackId:e})),this.removeLocalTrack(t)):this._logger.warn(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:o.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,t){void 0===t&&(t=!0);var r=e.getTrackId();delete this.pubLocalTracks[r],this._sdpStrategy.removeLocalTrack(e,t),e.__innerSetPublished(!1),e.off(We.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(We.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);var i="".concat(r,"_tiny"),o=this.getLocalTrack(i);o&&t&&(this._sdpStrategy.removeLocalTrack(o,t),delete this.pubLocalTracks[i],o.destroy()),this._logger.info(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O,JSON.stringify({trackId:r}))}}),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(We.__INNER_EVENT_MUTED_CHANGE__,e,t)}}),Object.defineProperty(t.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.emit(We.__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),a({},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),a({},t)}))}}),Object.defineProperty(t.prototype,"_createRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.timestamp,r=e.iceCandidatePair,i=e.senders,n=e.receivers;for(var o in(null==r?void 0:r.totalPacketsLost)&&(null==r||delete r.totalPacketsLost),r)It(r[o])&&delete r[o];return{timestamp:t,iceCandidatePair:r,senders:this._createSenderReport(i),receivers:this._createReceiverReport(n)}}}),Object.defineProperty(t.prototype,"_getStatsData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return s(this,void 0,void 0,(function(){var r,i,n;return c(this,(function(o){switch(o.label){case 0:return this._formatStatsData=null,r=null,[4,this._rtcPeerConn.getStats()];case 1:return i=o.sent(),r=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(i),n=null===(t=this.reportParser)||void 0===t?void 0:t.formatRCRTCStateReport(r),this._formatStatsData=n,[2,n]}}))}))}}),Object.defineProperty(t.prototype,"_reportHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r,i,o,a;return s(this,void 0,void 0,(function(){var s,u,_,p;return c(this,(function(c){switch(c.label){case 0:return[4,this._getStatsData()];case 1:if(!(s=c.sent()))return[2];u=this._createRCRTCStateReport(s);try{null===(r=null===(e=this._reportListener)||void 0===e?void 0:e.onStateReport)||void 0===r||r.call(e,JSON.parse(JSON.stringify(u)))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}if(_=d(d([],l(s.receivers),!1),l(s.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__,_),this._isRoomAudience&&(null===(i=this._reportListener)||void 0===i?void 0:i.onReportLiveAudioStates)){p=this._getLiveAudioState();try{p.length&&(null===(a=null===(o=this._reportListener)||void 0===o?void 0:o.onReportLiveAudioStates)||void 0===a||a.call(o,p))}catch(e){this._logger.error(n.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,d([],l(r),!1))})),t.map((function(t){var r=t.source,i=t.audioLevel,n=e._store.getTrackIdBySSRC(r);if(!n)return{};var o=_t(n).userId;return{audioLevel:no(i),userId:o,trackId:n}})).filter((function(e){return!!e.userId}))}}),Object.defineProperty(t.prototype,"_sendR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r,i;return s(this,void 0,void 0,(function(){var n,o,a;return c(this,(function(s){switch(s.label){case 0:return(n=this._formatStatsData)?(o=n.senders,a=n.receivers,console.log("sendR3R4: senderTrackId: ".concat(null===(e=o[0])||void 0===e?void 0:e.trackId,", receiverTrackId: ").concat(null===(t=a[0])||void 0===t?void 0:t.trackId)),o.length?[4,null===(r=this._polarisReport)||void 0===r?void 0:r.sendR3Data(n)]:[3,2]):[2];case 1:s.sent(),s.label=2;case 2:return a.length?[4,null===(i=this._polarisReport)||void 0===i?void 0:i.sendR4Data(n)]:[3,4];case 3:s.sent(),s.label=4;case 4:return o.length=0,a.length=0,n=null,[2]}}))}))}}),Object.defineProperty(t.prototype,"__reportR3R4ToPolaris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){return this._isDestroyed||(clearTimeout(this._reportR3R4ToPolarisTimer),this._reportR3R4ToPolarisTimer=setTimeout((function(){return s(e,void 0,void 0,(function(){var e=this;return c(this,(function(t){return this._isDestroyed||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,"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(n.L_RTC_PEER_CONNECTION_DESTROY_O,JSON.stringify({status:o.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"}),Object.defineProperty(t,"__INNER_SEI_CONTENT__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-sei-content"}),t}(e.EventEmitter),No=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 i=_t(e.trackId).userId,n=t._store.crtUserId===i?t._peer.getLocalTrack(e.trackId):t._store.getRemoteTrack(e.trackId);n&&r.push({track:n,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}();exports.RCRTCLiveRole=void 0,(Co=exports.RCRTCLiveRole||(exports.RCRTCLiveRole={}))[Co.ANCHOR=1]="ANCHOR",Co[Co.AUDIENCE=2]="AUDIENCE",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"}(To||(To={})),function(e){e[e.Destroy=40400]="Destroy"}(Oo||(Oo={}));var wo,Do=function(){function e(){}return Object.defineProperty(e.prototype,"priority",{get:function(){return To.LOW},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kind",{get:function(){return vo.UNKNOWN},enumerable:!1,configurable:!0}),e}(),ko=function(){function t(e,t,r,i){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:i}),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(t.prototype,"_next",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._busy=!1,this._execute()}}),Object.defineProperty(t.prototype,"_execute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var t,r,i,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:if(this._isDestroyed||this._busy||0===this._queue.length)return[2];this._busy=!0,t=this._queue.shift(),r=t.command,i=t.resolve,a=this._logger.createTraceId(),c.label=1;case 1:return c.trys.push([1,3,,4]),this._logger.info(n.L_INVOKER_EXECUTE_T,"kind: ".concat(r.kind,", length: ").concat(this._queue.length),a),[4,r.execute(this._context,this._store,this)];case 2:return o=c.sent(),[3,4];case 3:return s=c.sent(),console.error(s),this._logger.error(n.L_INVOKER_EXECUTE_R,r.kind,a),this._next(),[2];case 4:return(u=o.code)!==exports.RCRTCCode.SUCCESS&&u!==e.ErrorCode.SUCCESS?this._logger.warn(n.L_INVOKER_EXECUTE_R,"code: ".concat(u,", kind: ").concat(r.kind),a):this._logger.info(n.L_INVOKER_EXECUTE_R,"kind: ".concat(r.kind,", Done"),a),i(o),this._next(),[2]}}))}))}}),Object.defineProperty(t.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(r){return[2,new Promise((function(r){if(t._logger.info(n.L_INVOKER_PUSH_O,JSON.stringify({isDestroyed:t._isDestroyed,kind:e.kind,length:t._queue.length})),t._isDestroyed)r({code:exports.RCRTCCode.NOT_IN_ROOM});else{var i=e.priority;if(i===To.LOW)t._queue.push({command:e,resolve:r});else{var o=t._queue.findIndex((function(e){return e.command.priority<i})),a=-1===o?t._queue.length-1:o;t._queue.splice(a,0,{command:e,resolve:r})}setTimeout((function(){t._execute()}),0)}}))]}))}))}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._isDestroyed||(this._logger.info(n.L_INVOKER_DESTROY_O),this._isDestroyed=!0,this._queue.forEach((function(t){t.resolve({code:e.abortCode})})),this._queue.length=0)}}),t}(),Uo=function(e){function t(t,r){return e.call(this,t.logger,t,r,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED)||this}return r(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}(ko);!function(e){e.VOID="0",e.OPEN="2",e.CLOSE="1"}(wo||(wo={}));var Mo,xo=function(){function e(e,t,r,i,n,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:i}),Object.defineProperty(this,"crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),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}),Object.defineProperty(this,"_asrStatus",{enumerable:!0,configurable:!0,writable:!0,value:wo.VOID}),Object.defineProperty(this,"_asrEnable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_srcLanguage",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_asrSeiUris",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_isStartRealTranslate",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_translationLang",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_summarizationStatusData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_nickName",{enumerable:!0,configurable:!0,writable:!0,value:""})}return Object.defineProperty(e.prototype,"getResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._roomResources[e]||this._asrSeiUris[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 i=this._remoteTracks[r];i.getUserId()===e&&t.push(i)}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=_t(e),r=t.tag,i=t.userId;return r===Wn?this._asrSeiUris[i][0]:this._roomResources[i].find((function(t){return dt(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}}),Object.defineProperty(e.prototype,"getASRIsAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this.getASRSeiUris().length}}),Object.defineProperty(e.prototype,"getASRStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._asrStatus}}),Object.defineProperty(e.prototype,"getASREnable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._asrEnable}}),Object.defineProperty(e.prototype,"getSrcLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._srcLanguage}}),Object.defineProperty(e.prototype,"getASRSeiUris",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._asrSeiUris);return e.length?e[0]:[]}}),Object.defineProperty(e.prototype,"getIsStartRealTranslate",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isStartRealTranslate}}),Object.defineProperty(e.prototype,"getTranslationLang",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._translationLang}}),Object.defineProperty(e.prototype,"getSummarizationStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._summarizationStatusData||null}}),Object.defineProperty(e.prototype,"getNickName",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._nickName}}),e}(),jo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(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),i=r.ssrc,n=r.resourceId;e._trackIdSSRCMap.set(i,n)}))}))}}),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=dt(t),i=_t(r),n=i.tag,o=i.userId,a=i.mediaType===exports.RCMediaType.AUDIO_ONLY?new it(e._logger,n,o):new nt(e._logger,n,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=Pt(e.version),this._roomResources=Lt(e,this.roomId,this._logger,t),this._updateTrackIdSSRCMap(),this._initRemoteTracks(),this.setResourcesByUserId(this.crtUserId,this.getResourcesByUserId(this.crtUserId)||[]),this._logger.info(n.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,d([0,this._subscribedList.length],l(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,d([0,this._collectSubscribeList.length],l(e),!1))}}),Object.defineProperty(t.prototype,"setRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._roomStatusVersion=Pt(e)}}),Object.defineProperty(t.prototype,"setASRStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._asrStatus=e}}),Object.defineProperty(t.prototype,"setASREnable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._asrEnable=e}}),Object.defineProperty(t.prototype,"setSrcLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._srcLanguage=e}}),Object.defineProperty(t.prototype,"setASRSeiUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.length){var t=e[0].msid.split("_")[0];this._asrSeiUris[t]=e}else this._asrSeiUris={}}}),Object.defineProperty(t.prototype,"addSeiRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e[0].msid.split("_"),r=t.pop(),i=t[0],n=new nt(this._logger,r,i);this.addRemoteTrack(n)}}),Object.defineProperty(t.prototype,"removeSeiRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.getASRSeiUris().length){var e=this.getASRSeiUris()[0],t=e.msid,r=e.mediaType,i="".concat(t,"_").concat(r);this.removeRemoteTrack(i)}}}),Object.defineProperty(t.prototype,"setIsStartRealTranslate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isStartRealTranslate=e}}),Object.defineProperty(t.prototype,"setTranslationLang",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._translationLang=e}}),Object.defineProperty(t.prototype,"setSummarizationStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._summarizationStatusData=e}}),Object.defineProperty(t.prototype,"setNickName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._nickName=e}}),t}(xo),Bo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.UNPUBLISH_PREV},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return i=t.logger,a=t.context,s=r.getResourcesByUserId(r.crtUserId),u=s.slice(),s.length=0,l=i.createTraceId(),i.info(n.L_UNPUBLISH_PREV_COMMAND_T,JSON.stringify({resource:u}),l),[4,a.setRTCTotalRes(r.roomId,[ot(St.UNPUBLISH,u)],at([]),St.TOTAL_CONTENT_RESOURCE,at([]))];case 1:return(d=c.sent())!==e.ErrorCode.SUCCESS?i.error(n.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:o.FAILED,code:d}),l):i.info(n.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:o.SUCCESSED}),l),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),i}(Do);exports.RTCMode=void 0,(Mo=exports.RTCMode||(exports.RTCMode={}))[Mo.RTC=0]="RTC",Mo[Mo.LIVE=2]="LIVE",Mo[Mo.CROSS_MUTI=7]="CROSS_MUTI",Mo[Mo.SIP=4]="SIP",Mo[Mo.CALL=5]="CALL";var Vo,Fo=function(t){function i(e,r,i,n,o,a,s,c){var u=t.call(this)||this;return Object.defineProperty(u,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(u,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(u,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"nickName",{enumerable:!0,configurable:!0,writable:!0,value:c}),u}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.JOINROOM},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_getResultTag",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=n.L_RTC_CLIENT_JOIN_RTC_ROOM_R;return this.roomType===exports.RTCMode.LIVE&&(e=n.L_RTC_CLIENT_JOIN_LIVING_ROOM_R),e}}),Object.defineProperty(i.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n=this;if(t.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED)return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:exports.RCRTCCode.SIGNAL_DISCONNECTED};if(yt(t.getNaviInfo()))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),this.traceId),{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR};if(!e.validate("roomId",this.roomId,e.notEmptyString,!0))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!e.validate("roomType",this.roomType,(function(e){return void 0!==exports.RTCMode[e]})))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!e.validate("outerUserDatas",this.outerUserDatas,e.isObject,!1))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.outerUserDatas&&!Object.keys(this.outerUserDatas).every((function(t){return e.validate("outerUserDatas.".concat(t),n.outerUserDatas[t],e.isString,!0)})))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.nickName&&(!e.validate("nickName",this.nickName,e.isString,!0)||this.nickName.length>64))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> nickName"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};return{code:exports.RCRTCCode.SUCCESS}}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n,a,u,l;return s(this,void 0,void 0,(function(){var s,d,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I;return c(this,(function(c){switch(c.label){case 0:return s=Date.now(),d=t.context,_=t.service,p=t.logger,f=t.reportMediaActionLogger,h=this._getResultTag(),(R=this._validateParams(d,p,h).code)!==exports.RCRTCCode.SUCCESS?[2,{code:R}]:_.getMsList().length?(b=r.getSupportNtf(),[4,d.joinRTCRoom(this.roomId,this.roomType,this.livingType,this.joinType,this.innerUserDatas,this.outerUserDatas,b)]):(p.error(h,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}]);case 1:return g=c.sent(),m=g.code,C=g.data,f.reportQualityJoinRoomData(s,m,this.roomType,null==C?void 0:C.sessionId),m===e.ErrorCode.SUCCESS&&C?(r.initWithRoomData(C,this.traceId),this.nickName&&r.setNickName(this.nickName),r.getResourcesByUserId(r.crtUserId).length>0&&i.push(new Bo),(T=null===(n=C.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value)&&r.setCDNUris(JSON.parse(T)[0]),(O=null===(a=C.roomInfo.filter((function(e){return"asr_status"===e.key}))[0])||void 0===a?void 0:a.value)&&r.setASRStatus(O),(S=null===(u=C.roomInfo.filter((function(e){return"sei_ai_uris"===e.key}))[0])||void 0===u?void 0:u.value)&&(I=JSON.parse(S)).length&&(r.setASRSeiUris(I),r.addSeiRemoteTrack(I)),(E=null===(l=C.roomInfo.filter((function(e){return"summarization"===e.key}))[0])||void 0===l?void 0:l.value)&&(I=JSON.parse(E),r.setSummarizationStatusData(I)),p.info(h,JSON.stringify({status:o.SUCCESSED,userId:r.crtUserId,roomId:this.roomId,sessionId:C.sessionId}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS,data:C}]):(v=40032===m?exports.RCRTCCode.SIGNAL_JOIN_RTC_ROOM_REFUSED:m,p.error(h,JSON.stringify({status:o.FAILED,code:v,msg:"joinRoom failed"}),this.traceId),[2,{code:v}])}}))}))}}),i}(Do);!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(Vo||(Vo={}));var Jo,Go,Ho,Ko="PEER_CONNECTION_CLOSED_BY_EXCEPTION",Wo="USER_JOIN",zo="USER_LEAVE",Yo="TRACKS_PUBLISH",qo="TRACKS_UNPUBLISH",Zo="AUDIO_MUTE_CHANGE",Qo="VIDEO_MUTE_CHANGE",Xo="CDN_ENABLE_CHANGE",$o="USER_STATE_CHANGE",ea="ASR_SEI_PUBLISH",ta="ASR_SEI_UNPUBLISH",ra="SUMMARIZATION_START",ia="SUMMARIZATION_STOP",na=function(e){function t(t,r,i,n,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:i}),Object.defineProperty(u,"runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),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 r(t,e),t}(e.EventEmitter);!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}(Jo||(Jo={})),function(e){e.BEGIN="begin",e.END="end"}(Go||(Go={})),function(e){e[e.SPREAD=0]="SPREAD",e[e.NO_SPREAD=-1]="NO_SPREAD"}(Ho||(Ho={}));var oa,aa=function(e){function t(t,r,i){var n=e.call(this)||this;return Object.defineProperty(n,"reqBody",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"isNeedUpdateMsas",{enumerable:!0,configurable:!0,writable:!0,value:i}),n}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;return s(this,void 0,void 0,(function(){var r,n,o,s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return r=e.service,n=e.context,[4,r.exchange(t.getRTCRequestHeader(),this.reqBody,this.traceId,this.isNeedUpdateMsas)];case 1:return o=c.sent(),s=o.code,u=o.data,l=o.qualityMsList,d={code:s,data:{data:u,qualityMsList:l}},_=null===(i=null==u?void 0:u.urls)||void 0===i?void 0:i.pull_url,t.roomMode===exports.RTCMode.LIVE&&_&&(p=JSON.parse(_),t.setCDNUris(p),(null==p?void 0:p.broadcast)===Ho.SPREAD&&(t.setCDNEnabel(!0),f=a(a({},p),{enableInnerCDN:!0}),_a(n,t.roomId,f))),[2,d]}}))}))}}),t}(Do);!function(e){e.PUB="pub",e.UNPUB="unpub",e.SUB="sub",e.UNSUB="unsub"}(oa||(oa={}));var sa=function(t){function i(e,r,i,n,o){void 0===n&&(n=oa.SUB);var a=t.call(this)||this;return Object.defineProperty(a,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(a,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"fromCommand",{enumerable:!0,configurable:!0,writable:!0,value:n}),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 r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.UPDATE_SUBSCRIBE_LIST},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_dealSubscribeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var a=null==i?void 0:i.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),s=r.filter((function(e){return null==a?void 0:a.includes(e.track.getTrackId())})),c=r.filter((function(e){return!(null==a?void 0:a.includes(e.track.getTrackId()))}));t.info(n.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,subSuccessTrackIds:a,failedList:c}),this.traceId);var u=e.getRemoteTracks(),l=function(e){var t=s.some((function(t){return t.track.getTrackId()===e}));u[e].__innerSetSubscribed(t);var r=s.some((function(t){return t.track.getTrackId()===e&&t.subTiny}));u[e].isVideoTrack()&&u[e].__innerSetIsTinyTrack(r)};for(var d in u)l(d);return e.resetSubscribedList(s),c}}),Object.defineProperty(i.prototype,"_getParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this,o=r.map((function(e){return e instanceof rt?{track:e}:a({},e)})),s={};return o=o.filter((function(r){var o=r.track.getTrackId();return e.getRemoteTrack(o)?!s[o]&&(s[o]=!0,!0):(t.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_P,"track cannot found in room -> trackId: ".concat(o),i.traceId),!1)})).map((function(e){return a({},e)}))}}),Object.defineProperty(i.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.validate("tracks",r,(function(){return e.isArray(r)&&r.every((function(e){return e instanceof rt||e.track instanceof rt}))}),!0)?{code:exports.RCRTCCode.SUCCESS}:(t.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"tracks is invalid"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR})}}),Object.defineProperty(i.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(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,s,u,l,d,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y,L,A=this;return c(this,(function(c){switch(c.label){case 0:if(i=e.logger,s=e.peer,u=e.reportMediaActionLogger,l=e.context,this._actionStartTime=Date.now(),_=(d=this).tracks,p=d.forceReq,f=t.roomId,i.info(n.L_UPDATE_SUBSCRIBELIST_COMMAND_T,"roomId: ".concat(f,", forceReq: ").concat(p,", trackIds: ").concat(_.map(At)),this.traceId),(h=this._validateParams(i,_).code)!==exports.RCRTCCode.SUCCESS)return[2,{code:h}];if(R=this._getParams(t,i,_),b=t.getSubscribedList().map((function(e){return a({},e)})),!p){if(!ma(R,b))return i.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.SUCCESSED,msg:"subscribe list unchanged"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}];b.length&&(g=b.map((function(e){return e.track})),i.warn(n.L_CLEAR_UNSUBSCRIBE_LIST_O,JSON.stringify({list:g.map((function(e){return e.getTrackId()}))}),this.traceId),m=t.getSubscribedList().filter((function(e){return g.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),t.resetSubscribedList(m))}return s.__reportR3R4ToPolaris(),s.clearReTryExchangeTimer(),s.updateSubRemoteTracks(R.map((function(e){return e.track}))),[4,la(R,!1,s,t,l)];case 1:return(C=c.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new aa(C,this.traceId,!0).execute(e,t,r)];case 2:return v=c.sent(),_.forEach((function(e){var t=e instanceof rt?e.getTrackId():e.track.getTrackId();A._trackMediaMap[t]=v.data.qualityMsList||[]})),T=this.fromCommand===oa.SUB?_:this.unsubTracks,v.code!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(u,v.code,T),i.error(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.FAILED,code:v.code}),this.traceId),[2,{code:v.code}]):(O=v.data.data,S=O.sdp,E=O.resultCode,I=O.subscribedList,E!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(u,E,T),i.error(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.FAILED,code:E}),this.traceId),[2,{code:E}]):(u.setPubOrSubSuccessTime(Date.now()),[4,s.setRemoteAnswer(S.sdp)]));case 3:return y=c.sent(),this._reportPubOrSubQualityData(u,y,T),y!==exports.RCRTCCode.SUCCESS?[2,{code:y}]:[2,(L=this._dealSubscribeResult(t,i,R,I)).length?{code:exports.RCRTCCode.SUCCESS,data:L}:{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),i}(Do),ca=function(t){function i(e,r){var i=t.call(this)||this;return Object.defineProperty(i,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.UNSUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d;return c(this,(function(c){return s=t.logger,u=t.polarisReport,l=this.tracks,e.validate("tracks",l,(function(){return e.isArray(l)&&l.length>0&&l.every((function(e){return e instanceof rt}))}),!0)?(s.info(n.L_ABSTRACT_ROOM_UNSUBSCRIBE_T,JSON.stringify({unSubscribeTrackIds:l.map(At)}),this.traceId),d=r.getSubscribedList().map((function(e){return a({},e)})).filter((function(e){return l.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),u.sendR2(Jo.SUBSCRIBE,Go.END,l.map((function(e){return e.getTrackId()}))),[2,new sa(d,!1,this.traceId,oa.UNSUB,this.tracks).execute(t,r,i)]):(s.warn(n.L_ABSTRACT_ROOM_UNSUBSCRIBE_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),i}(Do),ua=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 r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,o,a;return c(this,(function(s){switch(s.label){case 0:return i=e.logger,o=this.tracks,a=i.createTraceId(),i.info(n.L_USER_LEFT_UNSUBSCRIBE_O,void 0,a),[4,new ca(o,a).execute(e,t,r)];case 1:return s.sent(),o.forEach((function(e){e.__innerDestroy(),t.removeRemoteTrack(e.getTrackId())})),e.emit(qo,o),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(Do);function la(e,t,r,i,n){var o;return s(this,void 0,void 0,(function(){var a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return a=(null===(o=n.getNaviInfo())||void 0===o?void 0:o.ipType)||0,[4,r.createOffer(t)];case 1:return s=c.sent(),u=i.getSrcLanguage(),l=i.getNickName(),d={resolutionInfo:r.getOutboundVideoInfo()},u&&Object.assign(d,{srcLanguage:u}),l&&Object.assign(d,{nickName:l}),[2,{asr_status:i.getASRStatus(),ipType:a,sdp:s,extend:JSON.stringify(d),subscribeList:e.filter((function(e){var t=e.track.getTrackId(),r=_t(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?Xn.TINY:Xn.NORMAL,resolution:"",uri:i.getPublishedResourceByTrackId(e.track.getTrackId()).uri}})),switchstream:!1}]}}))}))}function da(t,r,i){return s(this,void 0,void 0,(function(){var a,s;return c(this,(function(c){switch(c.label){case 0:return a=t.logger.createTraceId(),t.logger.info(n.L_LIVING_ROOM_SPREAD_CDN_INFO_T,JSON.stringify({CDNUris:i}),a),[4,t.setRTCCDNUris(r,St.TOTAL_CONTENT_RESOURCE,JSON.stringify([i]))];case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(t.logger.error(n.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(o.FAILED,", code: ").concat(s),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(t.logger.info(n.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(o.SUCCESSED),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}function _a(t,r,i){return s(this,void 0,void 0,(function(){var a,s;return c(this,(function(c){switch(c.label){case 0:return a=t.logger.createTraceId(),t.logger.info(n.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T,"CDNUris: ".concat(i),a),[4,t.setRTCData(r,"cdn_uris",JSON.stringify([i]),!0,Vo.ROOM)];case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(t.logger.error(n.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(o.FAILED,", code: ").concat(s),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(t.logger.info(n.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(o.SUCCESSED),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}function pa(e,t){return s(this,void 0,void 0,(function(){var r,i,n;return c(this,(function(o){switch(o.label){case 0:return r=t.roomId,i=Object.assign({},t.getCDNUris(),{enableInnerCDN:t.getCDNEnable()}),[4,Promise.all([da(e,r,i),_a(e,r,i)])];case 1:return n=o.sent(),[2,n.every((function(e){return e.code===exports.RCRTCCode.SUCCESS}))?{code:exports.RCRTCCode.SUCCESS}:{code:exports.RCRTCCode.SIGNAL_ERROR}]}}))}))}var fa=function(e,t,r,i){return s(void 0,void 0,void 0,(function(){var n,o,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:for(a in n=e.crtUserId,o=[],i)o.push(a);s=0,c.label=1;case 1:return s<o.length?(u=o[s])===n?[3,3]:(l=i[u]).length?(d=l.map((function(t){return e.getRemoteTrack(dt(t))})),[4,new ua(d).execute(t,e,r)]):[3,3]:[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}}))}))};function ha(t,r,i,a,u,l){return s(this,void 0,void 0,(function(){var s,d,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y,L;return c(this,(function(c){switch(c.label){case 0:for(s=i.logger,d=r.roomId,_=r.roomMode,p=[],f={},h={},R={},b=Lt(t,d,s,l),g=Object.keys(b),m=r.getAllUserIds(),C=g.length-1;C>=0;C-=1)v=g[C],-1!==(T=m.indexOf(v))?(O=r.getResourcesByUserId(v),S=b[v],E=ht(O,S,!0),I=E.publishedList,y=E.modifiedList,L=E.unpublishedList,f[v]=ft(I),h[v]=ft(L),R[v]=ft(y),m.splice(T,1)):(p.push(v),f[v]=ft(b[v]));return m.length&&m.forEach((function(e){r.removeResourcesByUserId(e)})),r.assignRoomData(b),m.length?[4,Ra(m,i,r,a,l)]:[3,2];case 1:c.sent(),i.emit(zo,m),c.label=2;case 2:return p.length&&i.emit(Wo,p),[4,fa(r,i,a,h)];case 3:return c.sent(),function(e,t,r){var i=t.logger;Object.keys(r).forEach((function(n){var o=r[n];if(0!==o.length){var a=o.map((function(t){var r=dt(t),n=_t(r),o=n.userId,a=n.tag,s=n.mediaType===exports.RCMediaType.AUDIO_ONLY?new it(i,a,o):new nt(i,a,o);return e.addRemoteTrack(s),s.__innerSetRemoteMuted(0===t.state),s}));a.length&&t.emit(Yo,a)}}))}(r,i,f),function(e,t,r){Object.keys(r).forEach((function(i){r[i].forEach((function(r){var i=dt(r),n=e.getRemoteTrack(i);n.__innerSetRemoteMuted(0===r.state),n.isAudioTrack()?t.emit(Zo,n):t.emit(Qo,n)}))}))}(r,i,R),_===e.RTCMode.LIVE&&function(e,t,r,i){var a;if(!i)return void r.warn(n.L_LIVING_ROOM_RECONNECTED_R,JSON.stringify({status:o.FAILED,code:"",msg:"cdn_uris not found"}));var s=JSON.parse(i),c=(null===(a=t.getCDNUris())||void 0===a?void 0:a.enableInnerCDN)!==s.enableInnerCDN;t.setCDNUris(s),c&&e.emit(Xo,s.enableInnerCDN)}(i,r,s,u),[2]}}))}))}function Ra(e,t,r,i,n){return s(this,void 0,void 0,(function(){var o,a;return c(this,(function(s){switch(s.label){case 0:return o=[],a=[],e.forEach((function(e){o.push.apply(o,d([],l(r.getRemoteTracksByUserId(e)),!1)),a.push(e)})),o.length?[4,new ca(o,n).execute(t,r,i)]:[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 ba,ga=function(e,t,r){var i=e.split("\r\nm"),n=r===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=i.filter((function(e){return e.includes("=".concat(n))&&e.includes(t)}))[0],a=new RegExp("a=ssrc:(.*?) msid:".concat(t)),s=o.match(a);return s?s[1]:""},ma=function(e,t){var r=!1;return e.forEach((function(e){var i=t.findIndex((function(t){return t.track.getTrackId()===e.track.getTrackId()}));-1!==i?t.splice(i,1)[0].subTiny!==e.subTiny&&(r=!0):r=!0})),t.length&&(r=!0),r},Ca=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(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 To.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isPKRoomUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i;try{for(var n=u(t),o=n.next();!o.done;o=n.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&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return!1}}),Object.defineProperty(t.prototype,"_dealAddUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,o){var a=e.getResourcesByUserId(o);a||(i?r.upgrade.push(o):r.joined.push(o),t.info(n.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:o,msg:"user ".concat(i?"upgrade":"joined")}),this.traceId)),e.setResourcesByUserId(o,a||[])}}),Object.defineProperty(t.prototype,"_dealReduceUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,o){e.info(n.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:o,msg:"user ".concat(i?"downgrade":"left")}),this.traceId),i?t.downgrade.push(o):1!==Number(r)?t.offline.push(o):t.left.push(o)}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s=this;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,n={joined:[],left:[],offline:[],upgrade:[],downgrade:[]},0===(o=this.msgContent.users).length?[2,{code:exports.RCRTCCode.SUCCESS,data:n}]:this._isPKRoomUser(t,o)?[2,{code:exports.RCRTCCode.SUCCESS,data:n}]:(o.forEach((function(e){var r=e.userId;0===Number(e.state)?s._dealAddUser(t,i,n,e.switchRoleType,r):s._dealReduceUser(i,n,e.state,e.switchRoleType,r)})),(a=d(d(d([],l(n.left),!1),l(n.downgrade),!1),l(n.offline),!1)).length?[4,Ra(a,e,t,r,this.traceId)]:[3,2]);case 1:c.sent(),c.label=2;case 2:return[2,{code:exports.RCRTCCode.SUCCESS,data:n}]}}))}))}}),t}(Do),va=function(e){function t(t,r,i,n,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:i}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),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 r(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 To.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_dealPublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d,_,p=this;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,a=e.reportMediaActionLogger,s=this._nowResources.map(dt),u=[],l=[],this._publishedList.forEach((function(e){var r=dt(e),n=s.indexOf(r),o=_t(r),a=o.userId,c=o.tag,d=o.mediaType;n>-1?p._nowResources[n]=e:p._nowResources.push(e);var _=t.getRemoteTrack(r);_?_.isSubscribed()&&u.push(_):(_=d===exports.RCMediaType.AUDIO_ONLY?new it(i,c,a):new nt(i,c,a),t.addRemoteTrack(_),l.push(_)),_.__innerSetRemoteMuted(0===e.state)})),u.length?(d=u.map((function(e){return e.getTrackId()})),[4,new sa(u,!0,this.traceId).execute(e,t,r)]):[3,2];case 1:(_=c.sent().code)!==exports.RCRTCCode.SUCCESS&&i.error(n.L_RESUB_REPUB_RES_R,JSON.stringify({status:o.FAILED,trackIds:d,code:_}),this.traceId),c.label=2;case 2:return l.length&&e.emit(Yo,l),a.reportQualityRecvPubMsgData(this.sentTime,this.senderId),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a;return c(this,(function(s){switch(s.label){case 0:for(i=this._unpublishedList.map(dt),n=this._nowResources.length-1;n>=0;n-=1)o=this._nowResources[n],i.includes(dt(o))&&this._nowResources.splice(n,1);return a=this._unpublishedList.map((function(e){var r=dt(e);return t.getRemoteTrack(r)})),[4,new ua(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 s(this,void 0,void 0,(function(){var r,i,n,o,a,s,l,d,_;return c(this,(function(c){r=this._nowResources.map(dt);try{for(i=u(this._modifiedList),n=i.next();!n.done;n=i.next())o=n.value,a=dt(o),s=r.indexOf(a),this._nowResources[s].state=o.state,(l=t.getRemoteTrack(a)).__innerSetRemoteMuted(0===o.state),l.isAudioTrack()?e.emit(Zo,l):e.emit(Qo,l)}catch(e){d={error:e}}finally{try{n&&!n.done&&(_=i.return)&&_.call(i)}finally{if(d)throw d.error}}return[2]}))}))}}),Object.defineProperty(t.prototype,"_updateCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n=this.msgContent.cdn_uris[0],o=(null===(r=t.getCDNUris())||void 0===r?void 0:r.enableInnerCDN)!==n.enableInnerCDN;t.setCDNUris(n),o&&e.emit(Xo,!!(null===(i=t.getCDNUris())||void 0===i?void 0:i.enableInnerCDN))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s,u,_,p,f,h;return c(this,(function(c){switch(c.label){case 0:if(i=this.msgContent.uris,this._publishedList=[],this._unpublishedList=[],this._modifiedList=[],o=this.senderId,a=this.messageType,!t.getRemoteUserIds().includes(o))return[2,{code:exports.RCRTCCode.SUCCESS}];switch(this._nowResources=t.getResourcesByUserId(o)||[],a){case St.MODIFY:(s=this._modifiedList).push.apply(s,d([],l(i),!1));break;case St.PUBLISH:(u=this._publishedList).push.apply(u,d([],l(i),!1));break;case St.UNPUBLISH:(_=this._unpublishedList).push.apply(_,d([],l(i),!1));break;case St.TOTAL_CONTENT_RESOURCE:n=ht(this._nowResources,i),(p=this._publishedList).push.apply(p,d([],l(n.publishedList),!1)),(f=this._unpublishedList).push.apply(f,d([],l(n.unpublishedList),!1)),(h=this._modifiedList).push.apply(h,d([],l(n.modifiedList),!1))}return this._publishedList.length?[4,this._dealPublishList(e,t,r)]:[3,2];case 1:c.sent(),c.label=2;case 2:return this._unpublishedList.length?[4,this._dealUnpublishList(e,t,r)]:[3,4];case 3:c.sent(),c.label=4;case 4:return this._modifiedList.length?[4,this._dealModifiedList(e,t)]:[3,6];case 5:c.sent(),c.label=6;case 6:return t.setResourcesByUserId(o,this._nowResources),t.roomMode!==exports.RTCMode.LIVE?[2,{code:exports.RCRTCCode.SUCCESS}]:this.msgContent.cdn_uris?(this._updateCDNUris(e,t),[2,{code:exports.RCRTCCode.SUCCESS}]):[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(Do),Ta=function(t){function i(e,r,i){var n=t.call(this)||this;return Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(n,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),n}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.SUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,R;return c(this,(function(c){return s=t.logger,u=t.polarisReport,d=(l=this).tracks,_=l.forceReq,e.validate("tracks",d,(function(){return e.isArray(d)&&d.length>0&&d.every((function(e){return e instanceof rt||e.track instanceof rt}))}),!0)?(s.info(n.L_ABSTRACT_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:d.map(At),forceReq:_}),this.traceId),p=r.getSubscribedList().map((function(e){return a({},e)})),f=d.map((function(e){return e instanceof rt?{track:e}:e})),h=!1,R=[],f.forEach((function(e){var t=e.track.getTrackId();R.push(t);var r=p.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:p.push(e),h=!0)})),h||_?(u.sendR2(Jo.SUBSCRIBE,Go.BEGIN,R),[2,new sa(p,!0,this.traceId).execute(t,r,i)]):(s.warn(n.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,msg:"repeat subscribe"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}])):(s.error(n.L_ABSTRACT_ROOM_SUBSCRIBE_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),i}(Do),Oa=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),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 r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.PUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_removePubFailedTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.forEach((function(e){var r=e instanceof We?e:e.track;t.removeLocalTrackById(r.getTrackId())}))}}),Object.defineProperty(i.prototype,"_addLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,o,a,s,l,d,_,p,f,h,R,b,g,m,C,v,T,O;return c(this,(function(c){switch(c.label){case 0:r=[],c.label=1;case 1:c.trys.push([1,10,11,12]),i=u(e),o=i.next(),c.label=2;case 2:if(o.done)return[3,9];if(a=o.value,l=(s=a instanceof We?{pubTiny:!1,track:a}:a).track,d=s.pubTiny,!l.isVideoTrack())return[3,7];if(!d)return[3,7];_=void 0,c.label=3;case 3:return c.trys.push([3,5,,6]),_=l.__innerGetMediaStreamTrack().clone(),p=d.frameRate||exports.RCFrameRate.FPS_15,f=d.resolution||exports.RCResolution.W176_H144,h=bt(f),R=h.width,b=h.height,g=Ct(p),[4,_.applyConstraints({width:R,height:b,frameRate:g})];case 4:return c.sent(),[3,6];case 5:return m=c.sent(),null==_||_.stop(),this._logger.warn(n.L_ABSTRACT_ROOM_PUBLISH_E,"pubTiny failed -> id: ".concat(l.getTrackId(),", msg: ").concat(m.message),this._traceId),[3,9];case 6:return C=new Ye(this._logger,l.getTag(),l.getUserId(),_,!0),r.push(C),t.addLocalTrack(C),[3,7];case 7:t.addLocalTrack(l),c.label=8;case 8:return o=i.next(),[3,2];case 9:return[3,12];case 10:return v=c.sent(),T={error:v},[3,12];case 11:try{o&&!o.done&&(O=i.return)&&O.call(i)}finally{if(T)throw T.error}return[7];case 12:return[2,r]}}))}))}}),Object.defineProperty(i.prototype,"__publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,R,b,g,m,C=this;return c(this,(function(c){switch(c.label){case 0:return s=e.peer,u=e.reportMediaActionLogger,l=e.context,t.roomId,d=[],r.forEach((function(e){var t=(e instanceof We?{track:e}:e).track;d.push(t)})),r.sort((function(e,t){return(e instanceof We?{track:e}:e).track.getBitrate().max-(t instanceof We?{track:t}:t).track.getBitrate().max})),s.getLocalTracks().length+function(e,t){var r=0;return e.forEach((function(e){var i=e instanceof We?e.getTrackId():e.track.getTrackId();t.getLocalTrack(i)||(e instanceof We?r++:e.pubTiny&&e.track.isVideoTrack()&&(r+=2))})),r}(r,s)>10?(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:r.map(At),msg:"publish track limit exceeded"}),this._traceId),[2,{code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:d}]):[4,this._addLocalTracks(r,s)];case 1:return _=c.sent(),s.clearReTryExchangeTimer(),[4,la(t.getSubscribedList(),!1,s,t,l)];case 2:return(p=c.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new aa(p,this._traceId,!0).execute(e,t,i)];case 3:return f=c.sent(),d.forEach((function(e){var t=e.getTrackId();C._trackMediaMap[t]=f.data.qualityMsList||[]})),f.code!==exports.RCRTCCode.SUCCESS?(u.reportPubOrSubQualityData(oa.PUB,this._actionStartTime,d,f.code,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,tracks:r.map(At),code:f.code,msg:"exchange failed"}),this._traceId),this._removePubFailedTracks(r,s),[2,{code:f.code,tracks:d}]):(h=f.data.data,R=h.sdp,b=h.resultCode,g=h.message,b!==exports.RCRTCCode.SUCCESS?(u.reportPubOrSubQualityData(oa.PUB,this._actionStartTime,d,b,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,trackIds:r.map(At),code:b,msg:"exchange inner failed: ".concat(g)}),this._traceId),this._removePubFailedTracks(r,s),[2,{code:b,tracks:d}]):(u.setPubOrSubSuccessTime(Date.now()),[4,s.setRemoteAnswer(R.sdp,!0)]));case 4:return(m=c.sent())!==exports.RCRTCCode.SUCCESS?(u.reportPubOrSubQualityData(oa.PUB,this._actionStartTime,d,m,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,trackIds:r.map(At),code:m,msg:"set remote answer error"}),this._traceId),[2,{code:m,tracks:d}]):(_.length&&this._updateTinyTrackIdSSRCMap(t,p.sdp.sdp,_),[2,a(a({code:b},f.data),{tracks:d})])}}))}))}}),Object.defineProperty(i.prototype,"_updateTinyTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){r.forEach((function(r){var i=ga(t,r.getStreamId(),exports.RCMediaType.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(i),r.getTrackId())}))}}),Object.defineProperty(i.prototype,"_dealPublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y,L,A,P,N,w;return c(this,(function(c){switch(c.label){case 0:return s=i.polarisReport,u=i.context,_=i.peer,p=i.reportMediaActionLogger,f=r.crtUserId,h=r.roomId,R="",b=r.getResourcesByUserId(f),g=d([],l(b),!1),[],C=t.tracks,t.code!==exports.RCRTCCode.SUCCESS?[2,{code:t.code}]:(v=t.data,T=v.publishList,O=v.urls,S=v.mcuPublishList,R=null==O?void 0:O.liveUrl,T.map((function(e){return a({tag:e.msid.split("_").pop(),state:_.getLocalTrack(dt(e)).isLocalMuted()?0:1},e)})).forEach((function(e){var t=function(e,t){for(var r=!1,i=0,n=0;n<t.length;n++){var o=t[n];if("".concat(e.msid,"_").concat(e.mediaType)==="".concat(o.msid,"_").concat(o.mediaType)){r=!0,i=n;break}}return{isInclude:r,index:i}}(e,g),r=t.isInclude,i=t.index;r?g.splice(i,1,e):g.push(e)})),E=(null==S?void 0:S.map((function(e){return a({tag:e.msid.split("_").pop(),state:1},e)})))||[],m=E,I=ht(b,g).publishedList,y=a(a({},r.getCDNUris()),{enableInnerCDN:r.getCDNEnable()}),L=y&&y.broadcast===Ho.SPREAD?JSON.stringify([y]):"",A=Date.now(),[4,u.setRTCTotalRes(h,[ot(St.PUBLISH,I)],at(g),St.TOTAL_CONTENT_RESOURCE,at(m),L)]);case 1:return P=c.sent(),p.reportPubOrSubQualityData(oa.PUB,this._actionStartTime,C,P,this._trackMediaMap,[{dur:Date.now()-A,cod:P}]),P!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:o.FAILED,code:P,msg:"send publish streams notification failed"}),this._traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(r.setResourcesByUserId(f,g),N=I.map((function(e){return dt(e)})),s.sendR2(Jo.PUBLISH,Go.BEGIN,N),I.forEach((function(e){_.getLocalTrack("".concat(e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)})),w={code:exports.RCRTCCode.SUCCESS},R&&(w.liveUrl=R),[2,w])}}))}))}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d=this;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,s=t.peer,this._traceId=a.createTraceId(),this._logger=a,this._actionStartTime=Date.now(),u=this.tracks,e.validate("tracks",u,(function(){return e.isArray(u)&&u.length>0&&u.every((function(e){return e instanceof We||e.track instanceof We}))}),!0)?(this._logger.info(n.L_ABSTRACT_ROOM_PUBLISH_T,JSON.stringify({trackIds:u.map(At)})),(u=u.filter((function(e){var t=(e instanceof We?{track:e}:e).track,r=t.isDestroyed();return r&&d._logger.warn(n.L_ABSTRACT_ROOM_PUBLISH_E,"track '".concat(t.getTrackId(),"' has beem destroyed"),d._traceId),!r}))).length?(s.__reportR3R4ToPolaris(),s.clearReTryExchangeTimer(),[4,this.__publish(t,r,u,i)]):(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID,msg:"params tracks is empty"}),this._traceId),[2,{code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID}])):(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this._traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return l=c.sent(),[4,this._dealPublishRes(l,r,t)];case 2:return[2,c.sent()]}}))}))}}),i}(Do),Sa=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),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 r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.UNPUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"__unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,R,b,g,m,C=this;return c(this,(function(c){switch(c.label){case 0:return s=e.peer,u=e.polarisReport,l=e.logger,d=e.reportMediaActionLogger,_=e.context,p=i.map((function(e){return e.getTrackId()})),0===p.map(t.getPublishedResourceByTrackId.bind(t)).filter((function(e){return!!e})).length?[2,{code:exports.RCRTCCode.SUCCESS,tracks:i}]:(p.forEach((function(e){return s.removeLocalTrackById(e)})),u.sendR2(Jo.PUBLISH,Go.END,p),s.clearReTryExchangeTimer(),[4,la(t.getSubscribedList(),!1,s,t,_)]);case 1:return f=c.sent(),(h=e.getPushOtherRooms()).length&&(f.pushOtherRooms=h),[4,new aa(f,this._traceId,!0).execute(e,t,r)];case 2:return R=c.sent(),i.forEach((function(e){var t=e.getTrackId();C._trackMediaMap[t]=R.data.qualityMsList||[]})),R.code!==exports.RCRTCCode.SUCCESS?(d.reportPubOrSubQualityData(oa.UNPUB,this._actionStartTime,i,R.code,this._trackMediaMap),l.error(n.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:o.FAILED,code:R.code,trackIds:i.map(At),msg:"exchange failed"}),this._traceId),[2,{code:R.code,tracks:i}]):(b=R.data.data,g=b.resultCode,m=b.message,g!==exports.RCRTCCode.SUCCESS?(d.reportPubOrSubQualityData(oa.UNPUB,this._actionStartTime,i,R.data.data.resultCode,this._trackMediaMap),l.error(n.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:o.FAILED,code:g,trackIds:i.map(At),msg:"exchange inner failed: ".concat(m)}),this._traceId),[2,{code:g,tracks:i}]):[2,a(a({code:R.code},R.data),{tracks:i})])}}))}))}}),Object.defineProperty(i.prototype,"_dealUnpublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y,L,A;return c(this,(function(c){switch(c.label){case 0:return s=t.context,u=t.logger,_=t.peer,p=t.reportMediaActionLogger,f=s.getCurrentId(),h=r.roomId,R=[],[],g=i.tracks,m=i.code,C=i.data,m!==exports.RCRTCCode.SUCCESS?(u.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({code:m,msg:"unpublish failed"}),this._traceId),[2,{code:m}]):C?(v=C.mcuPublishList,T=g.map((function(e){return e.getTrackId()})),O=T.map(r.getPublishedResourceByTrackId.bind(r)).filter((function(e){return!!e})),R.push.apply(R,d([],l(O),!1)),S=v?v.map((function(e){return a({tag:e.msid.split("_").pop(),state:1},e)})):[],b=S,E=r.getResourcesByUserId(f),I=E.filter((function(e){return!R.includes(e)})),y=Date.now(),[4,s.setRTCTotalRes(h,[ot(St.UNPUBLISH,R)],at(I),St.TOTAL_CONTENT_RESOURCE,at(b))]):(u.info(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.SUCCESSED,msg:"unpublish list is empty "})),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return L=c.sent(),p.reportPubOrSubQualityData(oa.UNPUB,this._actionStartTime,g,L,this._trackMediaMap,[{dur:Date.now()-y,cod:L}]),L!==e.ErrorCode.SUCCESS?(u.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.FAILED,code:L,msg:"send unpublish notification failed"}),this._traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(u.info(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.SUCCESSED,code:exports.RCRTCCode.SUCCESS,msg:"unpublish success",unPubResourceIds:T}),this._traceId),A=i.data.sdp,[4,_.setRemoteAnswer(A.sdp)]);case 2:return c.sent(),r.setResourcesByUserId(f,I),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,this._actionStartTime=Date.now(),s=r.crtUserId,u=this.tracks,this._traceId=a.createTraceId(),e.validate("tracks",u,(function(){return u.every((function(e){return e.getUserId()===s&&e instanceof We}))}),!0)?(a.info(n.L_ABSTRACT_ROOM_UNPUBLISH_T,JSON.stringify({trackIds:u.map(At)})),[4,this.__unpublish(t,r,i,u)]):(a.error(n.L_ABSTRACT_ROOM_UNPUBLISH_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return l=c.sent(),[4,this._dealUnpublishRes(t,r,l)];case 2:return[2,c.sent()]}}))}))}}),i}(Do),Ea=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:e}),r}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.LOCAL_TRACK_MUTE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var i,a,s,l,d,_,p,f,h,R,b,g,m,C,v,T,O,S;return c(this,(function(c){switch(c.label){case 0:i=t.logger,a=t.context,s=this.localTrack,l=s.getTrackId(),d=r.crtUserId,_=r.roomId,p=!s.isLocalMuted(),f=i.createTraceId(),i.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T,JSON.stringify({enabled:p,trackId:this.localTrack.getTrackId()}),f),h=[{resourceId:l,enabled:p}],R=r.getResourcesByUserId(d),b=[],g=function(e){var t=dt(e),r=h.findIndex((function(e){return e.resourceId===t}));if(r>=0){var i=h[r].enabled;return e.state=i?1:0,b.push(e),"break"}};try{for(m=u(R),C=m.next();!C.done&&(v=C.value,"break"!==g(v));C=m.next());}catch(e){O={error:e}}finally{try{C&&!C.done&&(S=m.return)&&S.call(m)}finally{if(O)throw O.error}}return[4,a.setRTCTotalRes(_,[ot(St.MODIFY,b)],at(R),St.TOTAL_CONTENT_RESOURCE)];case 1:return(T=c.sent())!==e.ErrorCode.SUCCESS?(i.error(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:o.FAILED,code:T,msg:"signal error"}),f),[2,{code:T}]):(i.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:o.SUCCESSED}),f),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),i}(Do),Ia=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.RETRY_EXCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"priority",{get:function(){return To.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,o,a,s,u,l,d,_,p,f,h,R,b,g,m;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,o=e.peer,a=e.context,s=i.createTraceId(),i.info(n.L_RETRY_EXCHANGE_COMMAND_T),u=a.getCurrentId(),[4,la(t.getSubscribedList(),!0,o,t,a)];case 1:return(l=c.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new aa(l,s).execute(e,t,r)];case 2:return(d=c.sent()).code!==exports.RCRTCCode.SUCCESS?[2,{code:d.code}]:(_=d.data.data,p=_.sdp,(f=_.resultCode)!==exports.RCRTCCode.SUCCESS?[2,{code:f}]:(o.clearReTryExchangeTimer(),[4,o.setRemoteAnswer(p.sdp)]));case 3:return(h=c.sent())!==exports.RCRTCCode.SUCCESS?[2,{code:h}]:(R=d.data.data.publishList||[],b=this._diffPublishListChange(R,t,o,u),g=b.plus,m=b.minus,g.length||m.length?[4,this._spreadPublishListUri(e,u,g,m,s)]:[3,5]);case 4:c.sent(),c.label=5;case 5:return[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"_diffPublishListChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n=t.getResourcesByUserId(i),o=JSON.parse(JSON.stringify(n));e.forEach((function(e){var t,i=e.mediaType,n=e.msid,s=o.findIndex((function(e){var t=e.mediaType,r=e.msid;return i===t&&n===r}));if(-1===s){var c=a({tag:n.split("_").pop(),state:(null===(t=r.getLocalTrack(dt(e)))||void 0===t?void 0:t.isLocalMuted)?0:1},e);o.push(c)}else o[s].uri=e.uri}));var s=ht(n,o,!0),c=s.publishedList,u=s.unpublishedList;return t.setResourcesByUserId(i,o),{plus:c,minus:u}}}),Object.defineProperty(i.prototype,"_spreadPublishListUri",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,u){return s(this,void 0,void 0,(function(){var s,l,d,_;return c(this,(function(c){switch(c.label){case 0:return s=t.store,l=t.logger,d=s.getResourcesByUserId(r),l.info(n.L_RETRY_EXCHANGE_SPREAD_T,JSON.stringify({plus:i,minus:a,allPublishList:d}),u),_=[],a.length&&_.push(ot(St.UNPUBLISH,a)),i.length&&_.push(ot(St.PUBLISH,i)),[4,t.context.setRTCTotalRes(s.roomId,_,at(d),St.TOTAL_CONTENT_RESOURCE)];case 1:return c.sent()===e.ErrorCode.SUCCESS?l.info(n.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(o.SUCCESSED),u):l.error(n.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(o.FAILED),u),[2]}}))}))}}),i}(Do);!function(e){e[e.JOIN=0]="JOIN",e[e.LEAVE=1]="LEAVE",e[e.OFFLINE=2]="OFFLINE",e[e.RESOURCECHANGE=3]="RESOURCECHANGE"}(ba||(ba={}));var ya,La,Aa=function(t){function i(e,r,i,n){var o=t.call(this)||this;return Object.defineProperty(o,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(o,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"_context",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(o,"_targetPullVersion",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.PULL_RTCROOM_STATUS},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,l,d,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y,L,A,P;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,s=r.getRoomStatusVersion(),a.info(n.L_PULL_ROOM_STATUS_T,JSON.stringify({roomId:this._roomId,localVersion:s}),this._traceId),this._targetPullVersion&&this._targetPullVersion<=s?(a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({status:o.SUCCESSED,msg:"the roomData has been pulled",localVersion:s,targetPullVersion:this._targetPullVersion}),this._traceId),[2,{code:e.ErrorCode.SUCCESS}]):[4,this._context.pullRTCRoomStatus(this._roomId,s)];case 1:return l=c.sent(),d=l.code,_=l.data,d!==e.ErrorCode.SUCCESS?(a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({status:o.FAILED,code:d}),this._traceId),[2,{code:d}]):(f=(p=_).bFullStatus,h=p.version,R=p.usersData,b=p.roomStatus,a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({bFullStatus:f,version:Pt(h),usersData:R,roomStatus:b}),this._traceId),r.setRoomStatusVersion(h),f?(g=function(e){var t={users:{}},r="";return e.forEach((function(e){var i,n,o=e.userId,a=e.userData;t.users[o]={};var s=null===(i=a.filter((function(e){return"uris"===e.key}))[0])||void 0===i?void 0:i.value,c=null===(n=a.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value;r=c||r,t.users[o]={uris:s}})),{urisData:t,CDNUris:r&&JSON.stringify(JSON.parse(r)[0])}}(R),m=g.urisData,C=g.CDNUris,[4,ha(m,r,t,i,C,this._traceId)]):[3,3]);case 2:return c.sent(),[2,{code:d}];case 3:c.trys.push([3,10,11,12]),v=u(b),T=v.next(),c.label=4;case 4:return T.done?[3,9]:(O=T.value).event!==ba.RESOURCECHANGE?[3,6]:(S=function(e){var t,r,i=e.userId,n=e.userData,o=function(e){return e.some((function(e){return"uris"===e.key||"cdn_uris"===e.key}))}(n);if(o){var a=null===(t=n.filter((function(e){return"uris"===e.key}))[0])||void 0===t?void 0:t.value,s=null===(r=n.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===r?void 0:r.value;return{userId:i,content:{uris:a?JSON.parse(a):[],cdn_uris:s&&JSON.parse(s)}}}}(O),S?(I=S.content,(E=S.userId)===r.crtUserId?[3,8]:[4,new va(I,St.TOTAL_CONTENT_RESOURCE,E,this._traceId).execute(t,r,i)]):[3,8]);case 5:return c.sent(),[3,8];case 6:return I=function(e){var t,r=e.userId,i=e.userData,n=e.event,o=e.switchRoleType;return{users:[{userId:r,extra:null===(t=i.filter((function(e){return"extra"===e.key}))[0])||void 0===t?void 0:t.value,state:n,switchRoleType:o}]}}(O),[4,new Ca(I,this._traceId).execute(t,r,i)];case 7:y=c.sent().data,t.emit($o,y),c.label=8;case 8:return T=v.next(),[3,4];case 9:return[3,12];case 10:return L=c.sent(),A={error:L},[3,12];case 11:try{T&&!T.done&&(P=v.return)&&P.call(v)}finally{if(A)throw A.error}return[7];case 12:return[2,{code:d}]}}))}))}}),i}(Do),Pa=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:e}),r}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.ON_SIGNAL_RECONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"priority",{get:function(){return To.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var o,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return o=t.logger,a=t.peer,s=t.context,u=r.roomId,l=r.roomMode,d=o.createTraceId(),o.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_T,void 0,d),"closed"===a.getRTCPeerConn().connectionState?(o.error(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,"RTCPeerConnection closed. Please rejoin room to restore services",d),t.emit(Ko),[2,{code:exports.RCRTCCode.SUCCESS}]):[4,s.rtcPing(u,l)];case 1:return 40001!==c.sent().code?[3,5]:[4,this._joinRoom(t,r,i,d)];case 2:return c.sent()!==e.ErrorCode.SUCCESS?[3,4]:[4,this._restoreMediaServer(t,r,i)];case 3:c.sent(),c.label=4;case 4:return[3,7];case 5:return[4,new Aa(u,d,s).execute(t,r,i)];case 6:c.sent(),c.label=7;case 7:return[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"_joinRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){var u,l,d,_;return s(this,void 0,void 0,(function(){var s,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y;return c(this,(function(c){switch(c.label){case 0:return s=t.context,p=t.logger,[4,s.joinRTCRoom(r.roomId,r.roomMode,this.livingType)];case 1:return f=c.sent(),h=f.code,R=f.data,h!==e.ErrorCode.SUCCESS?(p.error(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:o.FAILED,code:h,msg:"im reconnect joinRTCRoom failed"}),a),[2]):R?(b=null===(u=R.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===u?void 0:u.value,[4,ha(R,r,t,i,b,a)]):(p.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:o.FAILED,msg:"im reconnect joinRTCRoom, roomData is empty"}),a),[2]);case 2:return c.sent(),(g=null===(l=R.roomInfo.filter((function(e){return"asr_status"===e.key}))[0])||void 0===l?void 0:l.value)&&r.setASRStatus(g),m=null===(d=R.roomInfo.filter((function(e){return"sei_ai_uris"===e.key}))[0])||void 0===d?void 0:d.value,C=r.getASRIsAvailable(),m&&((I=JSON.parse(m)).length?(C||t.emit(ea),r.setASRSeiUris(I),v=I[0],T=v.msid,O=v.mediaType,S="".concat(T,"_").concat(O),!r.getRemoteTrack(S)&&r.addSeiRemoteTrack(I)):(C&&t.emit(ta),r.removeSeiRemoteTrack(),r.setASRSeiUris(I))),(E=null===(_=R.roomInfo.filter((function(e){return"summarization"===e.key}))[0])||void 0===_?void 0:_.value)&&(I=JSON.parse(E),(y=r.getSummarizationStatusData())&&y.status!==I.status&&t.emit(I.status===exports.RCRTCOperateSummarizationType.OPEN?ra:ia,I.taskId),r.setSummarizationStatusData(I)),p.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:o.SUCCESSED,roomData:R}),a),[2,h]}}))}))}}),Object.defineProperty(i.prototype,"_restoreMediaServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n;return c(this,(function(o){switch(o.label){case 0:return i=e.peer.getLocalTracks(),n=Object.values(t.getRemoteTracks()).filter((function(e){return!!e.isSubscribed()})),i.length?[4,new Oa(i).execute(e,t,r)]:[3,2];case 1:o.sent(),o.label=2;case 2:return i.length||!n.length?[3,4]:[4,new Ta(n,!0).execute(e,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))}}),i}(Do),Na=1,wa=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"}(ya||(ya={})),exports.RCKickReason=void 0,(La=exports.RCKickReason||(exports.RCKickReason={}))[La.SERVER_KICK=1]="SERVER_KICK",La[La.OTHER_KICK=2]="OTHER_KICK",La[La.IM_DISCONNECTED=3]="IM_DISCONNECTED",La[La.IM_LOGOUT=4]="IM_LOGOUT",La[La.OTHER_CLIENT_IM_CONNECTED=5]="OTHER_CLIENT_IM_CONNECTED";var Da,ka,Ua,Ma,xa=function(){function e(e,t,r,i){var o=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:i}),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,i){o._baseReportData=Object.assign(o._baseReportData,{snid:i});var s=a(a(a({},o._baseReportData),o._networkReportData),{cod:t,time:e,dur:Date.now()-e,rtp:r});o._logger.__statistics(n.L_QS_JOIN_ROOM_S,JSON.stringify(s))}}),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=a(a(a({},this._baseReportData),this._networkReportData),{time:Date.now(),cod:e===exports.RCKickReason.OTHER_KICK?wa:Na});this._logger.__statistics(n.L_QS_KICKED_S,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,o,s){var c=this;r.forEach((function(r){var u,l,d=r instanceof We||r instanceof rt?r:r.track,_=d.getTrackId(),p=_t(_).mediaType,f=!1;f=d instanceof We?!!d.isVideoTrack()&&(null===(l=(u=d).__isTiny)||void 0===l?void 0:l.call(u)):r.subTiny||!1;var h=a(a(a({},c._baseReportData),c._networkReportData),{resid:_,mtp:p,smct:f?Xn.TINY:Xn.NORMAL,stp:"Rongcloud"!==d.getTag()?1:0,cod:i,msas:o?o[_]:[],sigs:s,time:Date.now(),dur:Date.now()-t});switch(e){case"pub":c._logger.__statistics(n.L_QS_PUBLISH_S,JSON.stringify(h));break;case"unpub":c._logger.__statistics(n.L_QS_UNPUBLISH_S,JSON.stringify(h));break;case"sub":c._logger.__statistics(n.L_QS_SUBSCRIBE_S,JSON.stringify(h));break;case"unsub":c._logger.__statistics(n.L_QS_UNSUBSCRIBE_S,JSON.stringify(h))}}))}}),Object.defineProperty(e.prototype,"reportQualityRecvPubMsgData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=a(a(a({},this._baseReportData),this._networkReportData),{puid:t,time:Date.now(),dur:Date.now()-e});this._logger.__statistics(n.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=a(a(a({},this._baseReportData),this._networkReportData),{time:this._pubOrSubSuccessTime,dur:Date.now()-this._pubOrSubSuccessTime}),r="pub"===e?n.L_QS_PUB_ICE_STATUS_S:n.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 i=this._peerCStatus||{},o=i.status,s=i.time;if(s){var c=e.IP,u=e.port,l=e.networkType,d=e.remoteIP,_=e.remotePort,p=a(a(a({},this._baseReportData),this._networkReportData),{dur:r-s,time:r,pices:ya[o],ices:ya[t],rcdts:[{ip:"".concat(d,":").concat(_)}],lcdts:[{ip:"".concat(c,":").concat(u),nttp:l}],cncdts:[]});console.log(n.L_QS_ICE_STATUS_S,p),this._logger.__statistics(n.L_QS_ICE_STATUS_S,JSON.stringify(p)),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"}(Da||(Da={})),function(e){e[e.MeetingOrAnchor=1]="MeetingOrAnchor",e[e.Audience=2]="Audience"}(ka||(ka={})),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"}(Ua||(Ua={})),function(e){e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4"}(Ma||(Ma={}));var ja,Ba=function(){function t(e,t,r,i,n){void 0===n&&(n=ka.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:i}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:n})}return Object.defineProperty(t.prototype,"_send",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?[2,Ua.NOT_REPORT]:[4,this._context.setRTCState(this._roomId,t)];case 1:return r.sent()===e.ErrorCode.SUCCESS?[2,Ua.REPORT_SUCCESS]:[2,Ua.REPORT_FAIL]}}))}))}}),Object.defineProperty(t.prototype,"_getClientID",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=Rt(),this._runtime.localStorage.setItem(e,t)),t}}),Object.defineProperty(t.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(t.prototype,"_getPolarisTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="",r=e.split("_");if(e.includes("_tiny")){var i=r.pop(),n=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,i,n].join("_")}else{n=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,n].join("_")}return t}}),Object.defineProperty(t.prototype,"_getBaseData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return{bitrateSend:(null==e?void 0:e.bitrateSend)||Kn,bitrateRecv:(null==e?void 0:e.bitrateRecv)||Kn,networkType:(null==e?void 0:e.networkType)||"unknown",rtt:(null==e?void 0:e.rtt)||Kn,localAddress:"".concat((null==e?void 0:e.IP)||Kn,":").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)||Kn,sendBand:(null==e?void 0:e.availableOutgoingBitrate)||Kn,packetsLost:(null==e?void 0:e.totalPacketsLost)||Kn,deviceId:this._context.getCurrentId()}}}),Object.defineProperty(t.prototype,"_getAudioLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Kn}}),Object.defineProperty(t.prototype,"_getBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Kn}}),Object.defineProperty(t.prototype,"_getPacketsLostRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Kn}}),Object.defineProperty(t.prototype,"_getFrameRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||Kn}}),Object.defineProperty(t.prototype,"_getResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return e&&t?"".concat(e," * ").concat(t):"".concat(Kn)}}),Object.defineProperty(t.prototype,"_getJitter",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||Kn}}),Object.defineProperty(t.prototype,"_getNackCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Kn}}),Object.defineProperty(t.prototype,"_getPliCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Kn}}),Object.defineProperty(t.prototype,"_getRTT",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||Kn}}),Object.defineProperty(t.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())?Da.DISABLE:Da.ENABLE}}),Object.defineProperty(t.prototype,"sendR3Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a=this;return c(this,(function(s){switch(s.label){case 0:return t=e.iceCandidatePair,r=e.senders,i=this._getBaseData(t),n="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"),o=r.map((function(e){var t=e.trackId,r=e.audioLevel,i=e.samplingRate,n=e.bitrate,o=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,d=e.jitter,_=e.nackCount,p=e.pliCount,f=e.rtt,h=e.googFirsSent,R=e.encoderImplementation,b=a._getPolarisTrackId(t),g=a._getRealResourceId(t);return{trackId:b,googCodecName:R||String(Kn),audioLevel:a._getAudioLevel(r),bitrate:a._getBitrate(n),packetsLostRate:a._getPacketsLostRate(o),frameRate:a._getFrameRate(s),resolution:a._getResolution(c,u),jitter:a._getJitter(d),nackCount:a._getNackCount(_),pliCount:a._getPliCount(p),rtt:a._getRTT(f),googFirsSent:h,samplingRate:i,googRenderDelayMs:l,encoderImplementation:R||String(Kn),trackState:a._getTrackState(!0,g)}})),n+=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(n,"\r").concat(this._userRole))];case 1:return s.sent()!==Ua.REPORT_SUCCESS?[2,Ua.REPORT_FAIL]:[2,Ua.REPORT_SUCCESS]}}))}))}}),Object.defineProperty(t.prototype,"sendR4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a=this;return c(this,(function(s){switch(s.label){case 0:return t=e.iceCandidatePair,r=e.receivers,i=this._getBaseData(t),n="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"),o=r.filter((function(e){return!!e.trackId})).map((function(e){var t=e.trackId,r=e.audioLevel,i=e.samplingRate,n=e.bitrate,o=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,d=e.jitter,_=e.nackCount,p=e.pliCount,f=e.rtt,h=e.googFirsReceived,R=e.codecImplementationName,b=a._getPolarisTrackId(t),g=a._getRealResourceId(t);return{trackId:b,googCodecName:R||String(Kn),audioLevel:a._getAudioLevel(r),bitrate:a._getBitrate(n),packetsLostRate:a._getPacketsLostRate(o),frameRate:a._getFrameRate(s),resolution:a._getResolution(c,u),jitter:a._getJitter(d),nackCount:a._getNackCount(_),pliCount:a._getPliCount(p),rtt:a._getRTT(f),googFirsReceived:h,samplingRate:i,googRenderDelayMs:l,codecImplementationName:R||String(Kn),trackState:a._getTrackState(!1,g)}})),n+=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(n,"\r").concat(this._userRole))];case 1:return s.sent()!==Ua.REPORT_SUCCESS?[2,Ua.REPORT_FAIL]:[2,Ua.REPORT_SUCCESS]}}))}))}}),Object.defineProperty(t.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,i=vt.browser,n=vt.version,o=this._getClientID(),a="R1\t".concat("5.36.0-alpha.6","\t").concat(t,"\t").concat("web","\t").concat(r,"\t").concat(-1,"\t").concat(i,"\t").concat(n,"\t").concat(o,"\t").concat(this._userRole);this._send(a)}}),Object.defineProperty(t.prototype,"sendR2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this._getClientID(),n="R2\t".concat(e,"\t").concat(t,"\t").concat(i,"\r").concat(r.join("\t"),"\r").concat(this._userRole);this._send(n)}}),t}(),Va=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"oldTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"newTrack",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,o,a,s,u,l,d,_,p,f,h,R=this;return c(this,(function(c){switch(c.label){case 0:return i=e.peer,o=e.logger,this.oldTrack&&this.newTrack?[$e,Xe].every((function(e){return!(R.oldTrack instanceof e)}))?(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack is not RCCameraVideoTrack or RCMicphoneAudioTrack"),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):[$e,Xe].every((function(e){return!(R.newTrack instanceof e)}))?(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"newTrack is not RCCameraVideoTrack or RCMicphoneAudioTrack"),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(a=this.oldTrack.getSettings(),s=this.newTrack.getSettings(),u=this.oldTrack.getTrackId(),l=this.newTrack.getTrackId(),d=this.oldTrack.isAudioTrack()?"audio":"video",_=this.newTrack.isAudioTrack()?"audio":"video",o.info(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_T,JSON.stringify({oldTrackId:u,newTrackId:l,oldSettings:a,newSettings:s})),this.oldTrack.isPublished()?u!==l?(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack trackId are different, oldTrackId: ".concat(u,", newTrackId: ").concat(l)),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):d!==_?(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack are not the same kind, oldTrackKind: ".concat(d,", newTrackKind: ").concat(_)),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(null==a?void 0:a.deviceId)===(null==s?void 0:s.deviceId)?(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack deviceId are the same, oldDeviceId: ".concat(null==a?void 0:a.deviceId,", newDeviceId: ").concat(null==s?void 0:s.deviceId)),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(i.addLocalTrack(this.newTrack),p=(null==a?void 0:a.width)!==(null==s?void 0:s.width)||(null==a?void 0:a.height)!==(null==s?void 0:s.height)||(null==a?void 0:a.frameRate)!==(null==s?void 0:s.frameRate),f=i.getLocalTrack("".concat(this.oldTrack.getTrackId(),"_tiny")),p?[4,(new Ia).execute(e,t,r)]:(f&&f.destroy(),this.oldTrack.destroy(!1),this.newTrack.__innerSetPublished(!0),o.info(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"changeMediaDevice success"),[2,{code:exports.RCRTCCode.SUCCESS}])):(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack is not published"),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])):(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack or newTrack is empty"),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(h=c.sent()).code!==exports.RCRTCCode.SUCCESS?(i.removeLocalTrack(this.newTrack,!1),i.addLocalTrack(this.oldTrack),this.newTrack.destroy(),o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"negotiation failed, code: ".concat(h.code)),[2,{code:h.code}]):(f&&f.destroy(),this.oldTrack.destroy(!1),this.newTrack.__innerSetPublished(!0),o.info(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"changeMediaDevice success"),[2,{code:h.code}])}}))}))}}),t}(Do);!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=0]="CLOSE"}(ja||(ja={}));var Fa,Ja=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"_type",{enumerable:!0,configurable:!0,writable:!0,value:e}),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}),r}return r(i,t),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var i,o,a,s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return i=t.logger,o=t.context,a=t.service,this._traceId=i.createTraceId(),this._logger=i,this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_T,"type: ".concat(this._type),this._traceId),(null==(s=o.getNaviInfo())?void 0:s.rtcAISwitch)===ja.CLOSE?(this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE}]):this._type===r.getASRStatus()?(this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS}]):(u=r.roomId,[4,o.setRTCData(u,"asr_status",this._type.toString(),!0,e.RTCApiType.ROOM,{name:St.ASR_STATUS,content:JSON.stringify({asr_status:this._type.toString()})})]);case 1:return(l=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:l}),this._traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(r.setASRStatus(this._type),[4,a.updateASRStatus(r.getRTCRequestHeader(),{asr_status:this._type},this._traceId)]);case 2:return d=c.sent(),_=d.code,p=d.data,_!==exports.RCRTCCode.SUCCESS||(null==p?void 0:p.resultCode)!==exports.RCRTCCode.SUCCESS&&42200!==(null==p?void 0:p.resultCode)?(f=_!==exports.RCRTCCode.SUCCESS?_:null==p?void 0:p.resultCode,this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:f}),this._traceId),[2,{code:f}]):(this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),i}(Do),Ga=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"_enable",{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}),r}return r(t,e),Object.defineProperty(t.prototype,"_updateSubSei",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n="".concat(e[0].msid,"_").concat(e[0].mediaType),o=r.getRemoteTrack(n);return this._enable?new Ta([o]).execute(t,r,i):new ca([o],this._traceId).execute(t,r,i)}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,o=e.context,this._traceId=i.createTraceId(),this._logger=i,this._logger.info(n.L_ABSTRACT_ROOM_SET_ENABLE_ASR_T,"enable: ".concat(this._enable),this._traceId),t.setASREnable(this._enable),(null==(a=o.getNaviInfo())?void 0:a.rtcAISwitch)===ja.CLOSE?(this._logger.error(n.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE}]):(s=t.getASRSeiUris()).length?[4,this._updateSubSei(s,e,t,r)]:(this._logger.info(n.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS,asrSeiUrisLength:0}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return(u=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:u}),this._traceId),[2,{code:u}]):(this._logger.info(n.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),t}(Do);!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=0]="CLOSE"}(Fa||(Fa={}));var Ha,Ka,Wa,za,Ya=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"_status",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_destLanguage",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i}return r(t,e),Object.defineProperty(t.prototype,"_operateWithRetry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return void 0===r&&(r=3),void 0===i&&(i=3e3),s(this,void 0,void 0,(function(){var n,o,a,s;return c(this,(function(c){switch(c.label){case 0:n=1,c.label=1;case 1:if(!(n<=r))return[3,8];c.label=2;case 2:return c.trys.push([2,4,,5]),[4,t.operateRealtimeTranslation(e.getRTCRequestHeader(),{status:this._status},this._traceId)];case 3:return o=c.sent(),a=o.code,o.data,a===exports.RCRTCCode.SUCCESS?[2]:(console.warn("第 ".concat(n," 次调用失败,code=").concat(a)),[3,5]);case 4:return s=c.sent(),console.error("第 ".concat(n," 次调用异常:"),s),[3,5];case 5:return n<r?[4,new Promise((function(e){setTimeout(e,i)}))]:[3,7];case 6:c.sent(),c.label=7;case 7:return n++,[3,1];case 8:return[2]}}))}))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var r,i,o,a,s,u,l,d,_;return c(this,(function(c){switch(c.label){case 0:if(r=e.logger,i=e.service,o=e.context,this._traceId=r.createTraceId(),this._logger=r,this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_T,JSON.stringify({status:this._status,destLanguage:this._destLanguage}),this._traceId),(null==(a=o.getNaviInfo())?void 0:a.rtcAISwitch)===ja.CLOSE)return this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE}];if(this._status===Fa.OPEN){if(!this._destLanguage)return this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.PARAMS_ERROR}),this._traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}];if(!t.getASRSeiUris().length)return this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_START}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_START}]}return s={status:this._status},this._destLanguage&&(s.destLanguage=this._destLanguage),[4,i.operateRealtimeTranslation(t.getRTCRequestHeader(),s,this._traceId)];case 1:return u=c.sent(),l=u.code,d=u.data,this._status===Fa.CLOSE?(t.setIsStartRealTranslate(!1),this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),l!==exports.RCRTCCode.SUCCESS&&this._operateWithRetry(t,i),[2,{code:exports.RCRTCCode.SUCCESS}]):l!==exports.RCRTCCode.SUCCESS||(null==d?void 0:d.resultCode)!==exports.RCRTCCode.SUCCESS?(_=l!==exports.RCRTCCode.SUCCESS?l:null==d?void 0:d.resultCode,this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:_}),this._traceId),[2,{code:_}]):(t.setIsStartRealTranslate(!0),this._destLanguage&&t.setTranslationLang(this._destLanguage),this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),t}(Do),qa=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"_type",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(e){return t.setASRStatus(this._type),[2,{code:exports.RCRTCCode.SUCCESS}]}))}))}}),t}(Do),Za=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"_asrSeiUris",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"_setEnableAsr",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i;return c(this,(function(n){switch(n.label){case 0:return(i=t.getASREnable())?[4,new Ga(this._asrSeiUris.length>0).execute(e,t,r)]:[3,2];case 1:n.sent(),t.setASREnable(i),n.label=2;case 2:return[2]}}))}))}}),Object.defineProperty(t.prototype,"_onPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){e.emit(ea),t.setASRSeiUris(this._asrSeiUris),t.addSeiRemoteTrack(this._asrSeiUris),this._setEnableAsr(e,t,r)}}),Object.defineProperty(t.prototype,"_onUnPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return e.emit(ta),[4,this._setEnableAsr(e,t,r)];case 1:return i.sent(),t.removeSeiRemoteTrack(),t.setASRSeiUris(this._asrSeiUris),[2]}}))}))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){return this._asrSeiUris.length?this._onPublish(e,t,r):this._onUnPublish(e,t,r),[2,{code:exports.RCRTCCode.SUCCESS}]}))}))}}),t}(Do),Qa=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"_srcLanguage",{enumerable:!0,configurable:!0,writable:!0,value:e}),r}return r(i,t),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var i;return c(this,(function(o){return(i=t.logger).info(n.L_ABSTRACT_ROOM_SET_SRC_LANGUAGE_T,"srcLanguage: ".concat(this._srcLanguage)),!e.isString(this._srcLanguage)||this._srcLanguage&&this._srcLanguage.length>50?(i.error(n.L_ABSTRACT_ROOM_SET_SRC_LANGUAGE_R,"code: ".concat(exports.RCRTCCode.PARAMS_ERROR)),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(r.setSrcLanguage(this._srcLanguage),i.info(n.L_ABSTRACT_ROOM_SET_SRC_LANGUAGE_R,"success"),[2,{code:exports.RCRTCCode.SUCCESS}])}))}))}}),i}(Do),Xa=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"_isStart",{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}),r}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,o;return s(this,void 0,void 0,(function(){var r,a,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return r=e.logger,a=e.context,s=e.service,this._traceId=r.createTraceId(),this._logger=r,this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_T,"isStart: ".concat(this._isStart),this._traceId),(null==(u=a.getNaviInfo())?void 0:u.rtcAISwitch)===ja.CLOSE?(this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE}]):t.getASRSeiUris().length?(null===(i=t.getSummarizationStatusData())||void 0===i?void 0:i.status)===exports.RCRTCOperateSummarizationType.OPEN&&this._isStart||(null===(o=t.getSummarizationStatusData())||void 0===o?void 0:o.status)===exports.RCRTCOperateSummarizationType.CLOSE&&!this._isStart?(this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:exports.RCRTCCode.SUCCESS,taskId:t.getSummarizationStatusData().taskId}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS,taskId:t.getSummarizationStatusData().taskId}]):(l={status:this._isStart?exports.RCRTCOperateSummarizationType.OPEN:exports.RCRTCOperateSummarizationType.CLOSE},[4,s.operateSummarization(t.getRTCRequestHeader(),l,this._traceId)]):(this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_START}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_START}]);case 1:return d=c.sent(),_=d.code,p=d.data,_!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:_}),this._traceId),[2,{code:_}]):(t.setSummarizationStatusData({taskId:p.taskId,status:this._isStart?exports.RCRTCOperateSummarizationType.OPEN:exports.RCRTCOperateSummarizationType.CLOSE}),this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:exports.RCRTCCode.SUCCESS,taskId:null==p?void 0:p.taskId}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS,taskId:null==p?void 0:p.taskId}])}}))}))}}),t}(Do),$a=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"_status",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_taskId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return t.setSummarizationStatusData({status:this._status,taskId:this._taskId}),e.emit(this._status===exports.RCRTCOperateSummarizationType.OPEN?ra:ia,this._taskId),[2,{code:exports.RCRTCCode.SUCCESS}]}))}))}}),t}(Do),es="evt-leave",ts=function(t){function i(e,r,i,o,a,u,l,d,_,p){void 0===_&&(_=zn()),void 0===p&&(p=!1);var f=t.call(this)||this;Object.defineProperty(f,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(f,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(f,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(f,"_service",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(f,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(f,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(f,"_pinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_peerConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(f,"_onRecvPKMsg",{enumerable:!0,configurable:!0,writable:!0,value:null});var h=f._logger=f._context.logger;f._reportMediaActionLogger=new xa(h,f._roomId,f._clientSessionId,f._context.getCurrentId()),f._polarisReport=new Ba(f._context,f._runtime,f._roomId,f);var R=f._context.getCurrentId(),b=new jo(h,_,f._context.getAppkey(),i,R,o,l,d),g=f._peerConnection=new Po(e,h,f._reTryExchange.bind(f),R,b,f._polarisReport,!1,p);f._setPeerConnectionListener();var m=f._executeCtx=new na(h,f._service,e,r,g,b,f._polarisReport,f._reportMediaActionLogger);return m.getPushOtherRooms=function(){return f._getPushOtherRoomsParams()},f.setCommandEventListener(),f._invoker=new Uo(m,b),f._store=f._invoker.store,f._audioLevelReport=new No(f._store,g),g.on(Po.__INNER_AUDIOLEVEL_CHANGE__,f._audioLevelReport.audioLevelReport,f._audioLevelReport),f._pinger=new Nt(f._context,f._roomId,o,f._initOptions.pingGap),f._pinger.onFailed=f.__kickoff.bind(f),f._pinger.onPingResult=f._handlePingResult.bind(f),f._context.registerRTCSignalListener((function(e){return s(f,void 0,void 0,(function(){var t,r,i,o,a;return c(this,(function(s){return t=this._context.decodeRtcNotify(e),r=t.time,i=t.type,o=t.roomId,this._invoker.isDestroyed()?(this._logger.info(n.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:i,time:r,roomId:o})),[2]):(2===i&&o===this._roomId&&(a=this._logger.createTraceId(),this._logger.info(n.L_RTCNTF_PULL_ROOM_STATUS_O,null,a),this._startPullRTCRoomStatus(o,a,r)),[2])}))}))})),f}return r(i,t),Object.defineProperty(i.prototype,"_setPeerConnectionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._peerConnection;t.on(Po.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(We.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(We.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(Po.__INNER_ICE_CONNECTED__,(function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")}),this),t.on(Po.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,i=t.time,n=t.iceCandidatePair;e._reportMediaActionLogger.recordQualityIceStatusData(n,r,i)})),t.on(Po.__INNER_SEI_CONTENT__,this._onReceiveAsrSeiContent,this)}}),Object.defineProperty(i.prototype,"setCommandEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._executeCtx;e.on(Ko,this._rtcpeerClosed,this),e.on(Wo,this._callAppListener.bind(this,"onUserJoin"),this),e.on(zo,this._callAppListener.bind(this,"onUserLeave"),this),e.on(Yo,this._onTrackPublish,this),e.on(qo,this._onTrackUnpublish,this),e.on(Zo,this._onAudioMuteChange,this),e.on(Qo,this._onVideoMuteChange,this),e.on(Xo,this._callAppListener.bind(this,"onCDNEnableChange"),this),e.on($o,this._dealUserAppListener,this),e.on(ea,this._callAppListener.bind(this,"onReceiveStartASR"),this),e.on(ta,this._callAppListener.bind(this,"onReceiveStopASR"),this),e.on(ra,this._callAppListener.bind(this,"onReceiveStartSummarization"),this),e.on(ia,this._callAppListener.bind(this,"onReceiveStopSummarization"),this)}}),Object.defineProperty(i.prototype,"_startPullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return[4,this._invoker.push(new Aa(e,t,this._context,r))];case 1:return i.sent(),[2]}}))}))}}),Object.defineProperty(i.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o,a){return s(this,void 0,void 0,(function(){var s,u,l;return c(this,(function(c){switch(c.label){case 0:return[4,this._invoker.push(new Fo(this._roomId,e,t,r,i,n,o,a))];case 1:return s=c.sent(),u=s.code,l=s.data,u!==exports.RCRTCCode.SUCCESS?[2,{code:u}]:(this._initWithRoomData(l.offlineKickTime),[2,{code:u,data:l}])}}))}))}}),Object.defineProperty(i.prototype,"_initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pinger.start(1e3*e),this._polarisReport.sendR1()}}),Object.defineProperty(i.prototype,"_handlePingResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(e===exports.RCRTCPingResult.SUCCESS&&(t>this._store.getRoomStatusVersion()&&this._store.getSupportNtf())){var r=this._logger.createTraceId();this._logger.info(n.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),r),this._startPullRTCRoomStatus(this._roomId,r,t)}this._callAppListener("onPing",e)}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){this._logger.warn(n.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),e.assert("max",t,(function(t){return e.isNumber(t)&&t>Math.max(r||1,200)}),!0),e.assert("min",r,(function(r){return e.isNumber(r)&&r>=1&&(!e.isNumber(t)||r<t)}),!0),e.assert("start",i,(function(i){return e.isNumber(i)&&i>r&&i<=t})),this._peerConnection.setBitrate(t,r,i)}}),Object.defineProperty(i.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.streams[0].id,r=e.receiver.track,i=[t,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),a=this._store.getRemoteTrack(i);a?(a.__innerSetMediaStreamTrack(r),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onTrackReady",trackId:a.getTrackId()})),this._callAppListener("onTrackReady",a)):this._logger.warn(n.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(r.id))}}),Object.defineProperty(i.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,d([],l(r),!1))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}}),Object.defineProperty(i.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackUnpublish",e)}}),Object.defineProperty(i.prototype,"__parseInnerMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.targetId;if(r===this._roomId){this._logger.info(n.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var i=e.content;switch(e.messageType){case St.KICK:this.__kickoff(!0,i);break;case St.STATE:this._stateHandle(i,t);break;case St.MODIFY:case St.PUBLISH:case St.UNPUBLISH:case St.TOTAL_CONTENT_RESOURCE:this._resourceHandle(i,e.messageType,e.senderUserId,e.sentTime,t);break;case St.ASR_STATUS:this._invoker.push(new qa(i.asr_status));break;case St.ASR_SEI:this._invoker.push(new Za(JSON.parse(i.sei_ai_uris||[])));break;case St.SUMMARIZATION_STATUS:this._invoker.push(new $a(i.status,i.taskId));break;case St.ROOM_NOTIFY:this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case St.USER_NOTIFY:this._logger.warn(n.L_OLD_DAILY_RECORD_O,"TODO: ".concat(St.USER_NOTIFY));break;case St.PK_INVITE:case St.PK_CANCEL_INVITE:case St.PK_INVITE_TIMEOUT:case St.PK_INVITE_ANSWER:case St.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case St.OTHER_ROOM_OFFLINE:break;default:this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,i,e.senderUserId,e.messageUId)}}else this._logger.warn(n.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:o.FAILED,message:"roomId is different, msg roomId-> ".concat(r,", this._roomId-> ").concat(this._roomId," ")}),t)}}),Object.defineProperty(i.prototype,"__kickoff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a=this;return c(this,(function(s){return this._invoker.isDestroyed()||(this._logger.warn(n.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(es),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach((function(e){e.userId===a._context.getCurrentId()&&(i=e.type,r=e.kickExtra,a._reportMediaActionLogger.reportQualityKickedData(i))})),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onKickOff",byServer:e,kickType:i,kickExtra:r})),this._callAppListener("onKickOff",e,i,r)),[2]}))}))}}),Object.defineProperty(i.prototype,"_rtcpeerClosed",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(es),this._leaveHandle(!0),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}}),Object.defineProperty(i.prototype,"_onReceiveAsrSeiContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){"destLangCode"in e?t._store.getIsStartRealTranslate()&&t._store.getTranslationLang()===e.destLangCode&&t._callAppListener("onReceiveRealtimeTranslationContent",e):t._callAppListener("onReceiveASRContent",e)}))}}),Object.defineProperty(i.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return s(this,void 0,void 0,(function(){var o;return c(this,(function(a){return o=e.uris,e.ignore||!o||this._invoker.push(new va(e,t,r,n,i)),[2]}))}))}}),Object.defineProperty(i.prototype,"_onTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackPublish",e)}}),Object.defineProperty(i.prototype,"_stateHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new Ca(e,t))];case 1:return r=n.sent(),i=r.data,this._dealUserAppListener(i),[2]}}))}))}}),Object.defineProperty(i.prototype,"_dealUserAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=this,a=e.left,s=e.joined,c=e.upgrade,u=e.downgrade,_=e.offline,p=d([],l(s),!1),f=d([],l(a),!1);(null===(t=this._appListener)||void 0===t?void 0:t.onSwitchRole)?(null==c||c.forEach((function(e){i._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.ANCHOR})),i._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.ANCHOR)})),null==u||u.forEach((function(e){i._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.AUDIENCE})),i._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.AUDIENCE)}))):(p.push.apply(p,d([],l(c),!1)),f.push.apply(f,d([],l(u),!1))),_.length&&((null===(r=this._appListener)||void 0===r?void 0:r.onUserOffline)?(this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onUserOffline",offline:_})),this._callAppListener("onUserOffline",_)):f.push.apply(f,d([],l(_),!1))),p.length>0&&(this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onUserJoin",allJoined:p})),this._callAppListener("onUserJoin",p)),f.length>0&&(this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onUserLeave",allLeft:f})),this._callAppListener("onUserLeave",f))}}),Object.defineProperty(i.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(i.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(i.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getRemoteUserIds()}}),Object.defineProperty(i.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach((function(r){t.push.apply(t,d([],l(e.getRemoteTracksByUserId(r)),!1))})),t}}),Object.defineProperty(i.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTracksByUserId(e)}}),Object.defineProperty(i.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getSessionId()}}),Object.defineProperty(i.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,a;return c(this,(function(s){switch(s.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:t,content:r}),i),[4,this._context.sendMessage(e.ConversationType.RTC_ROOM,this._roomId,{messageType:t,content:r,isStatusMessage:!0})];case 1:return(a=s.sent().code)!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:o.FAILED,code:a}),i),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:o.SUCCESSED,name:t,content:r}),i),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(i.prototype,"setRoomAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){return void 0===a&&(a=!1),s(this,void 0,void 0,(function(){var s,u;return c(this,(function(c){switch(c.label){case 0:return s=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,key:t,value:r,message:i,isInner:a}),s),[4,this._context.setRTCData(this._roomId,t,r,a,Vo.ROOM,i)];case 1:return(u=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.FAILED,code:u}),s),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.SUCCESSED,roomId:this._roomId,key:t,value:r,message:i,isInner:a}),s),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(i.prototype,"deleteRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return void 0===i&&(i=!1),s(this,void 0,void 0,(function(){var a,s;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:t,message:r,isInner:i}),a),[4,this._context.removeRTCData(this._roomId,t,i,Vo.ROOM,r)];case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.FAILED,code:s}),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.SUCCESSED,roomId:this._roomId,keys:t,message:r,isInner:i}),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(i.prototype,"getRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return void 0===t&&(t=[]),void 0===r&&(r=!1),s(this,void 0,void 0,(function(){var i,a,s,u;return c(this,(function(c){switch(c.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:t,isInner:r}),i),[4,this._context.getRTCData(this._roomId,t,r,Vo.ROOM)];case 1:return a=c.sent(),s=a.code,u=a.data,s!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(s),i),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.SUCCESSED,data:u}),i),[2,{code:exports.RCRTCCode.SUCCESS,data:u}])}}))}))}}),Object.defineProperty(i.prototype,"_setUserAttributeValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,Vo.PERSON,r)}}),Object.defineProperty(i.prototype,"_deleteUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,Vo.PERSON,t)}}),Object.defineProperty(i.prototype,"_getUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._context.getRTCData(this._roomId,e,!1,Vo.PERSON)}}),Object.defineProperty(i.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.isDestroyed()}}),Object.defineProperty(i.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._leaveHandle(e)}}),Object.defineProperty(i.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(i.prototype,"_leaveHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(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(i.prototype,"_releasePCManager",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._peerConnection;e.removeAllLocalTrack(),e.destroy()}}),Object.defineProperty(i.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e instanceof Ye&&e.__isTiny()||this.unpublish([e])}}),Object.defineProperty(i.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return[4,this._invoker.push(new Ea(e))];case 1:return r=i.sent().code,t(r),[2]}}))}))}}),Object.defineProperty(i.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new Oa(e))]}))}))}}),Object.defineProperty(i.prototype,"_getPushOtherRoomsParams",{enumerable:!1,configurable:!0,writable:!0,value:function(){return[]}}),Object.defineProperty(i.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Ia)}}),Object.defineProperty(i.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new Sa(e))]}))}))}}),Object.defineProperty(i.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=_t(e).userId;return!!(null===(t=this._store.getResourcesByUserId(r))||void 0===t?void 0:t.find((function(t){return dt(t)===e})))}}),Object.defineProperty(i.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new Ta(e,void 0,void 0))]}))}))}}),Object.defineProperty(i.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){return t=this._logger.createTraceId(),this._logger.info(n.L_APP_CALL_UNSUBSCRIBE_O,void 0,t),[2,this._invoker.push(new ca(e,t))]}))}))}}),Object.defineProperty(i.prototype,"updateSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new sa(e,!0,this._logger.createTraceId()))]}))}))}}),Object.defineProperty(i.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._peerConnection.getLocalTrack(e)}}),Object.defineProperty(i.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._peerConnection.getLocalTracks()}}),Object.defineProperty(i.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTrack(e)||null}}),Object.defineProperty(i.prototype,"subscribedTracks",{get:function(){return this._store.getSubscribedList().slice()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,e?Object.keys(e).join(","):null),this._appListener=e,this.asrIsAvailable()&&this._executeCtx.emit(ea);var t=this.getSummarizationStatusData();t&&(null==t?void 0:t.status)===exports.RCRTCOperateSummarizationType.OPEN&&this._executeCtx.emit(ra,t.taskId)}}),Object.defineProperty(i.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,e?Object.keys(e).join(","):null),this._peerConnection.registerReportListener(e)}}),Object.defineProperty(i.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(n.L_ABSTRACT_ROOM_AUDIO_LEVEL_O),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(i.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._invoker.push(new Pa(e))}}),Object.defineProperty(i.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}}),Object.defineProperty(i.prototype,"_onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}}),Object.defineProperty(i.prototype,"_registerPKMsgListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._onRecvPKMsg=e}}),Object.defineProperty(i.prototype,"_quitAllPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2]}))}))}}),Object.defineProperty(i.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.clientSessionId}}),Object.defineProperty(i.prototype,"changeMediaDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return[2,this._invoker.push(new Va(e,t))]}))}))}}),Object.defineProperty(i.prototype,"setSrcLanguageCode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._invoker.push(new Qa(e))}}),Object.defineProperty(i.prototype,"startASR",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Ja(wo.OPEN))}}),Object.defineProperty(i.prototype,"stopASR",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Ja(wo.CLOSE))}}),Object.defineProperty(i.prototype,"asrIsAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getASRIsAvailable()}}),Object.defineProperty(i.prototype,"setEnableASR",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._invoker.push(new Ga(e))}}),Object.defineProperty(i.prototype,"startRealtimeTranslation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._invoker.push(new Ya(Fa.OPEN,e))}}),Object.defineProperty(i.prototype,"stopRealtimeTranslation",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Ya(Fa.CLOSE))}}),Object.defineProperty(i.prototype,"startSummarization",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Xa(!0))}}),Object.defineProperty(i.prototype,"stopSummarization",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Xa(!1))}}),Object.defineProperty(i.prototype,"getSummarizationStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getSummarizationStatusData()}}),i}(e.EventEmitter),rs=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"data",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(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 i,n,o,a;return s(this,void 0,void 0,(function(){var r,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return r=e.context,s=e.service,u={"App-Key":r.getAppkey(),Token:t.getToken(),RoomId:t.roomId,UserId:r.getCurrentId(),SessionId:t.getSessionId()},[4,s.setMcuConfig(u,this.data)];case 1:return l=c.sent(),d=l.code,_=l.res,d!==exports.RCRTCCode.SUCCESS?[2,{code:d}]:(_.pull_url&&t.setCDNUris(JSON.parse(_.pull_url)),p=this.cdnValues,d===exports.RCRTCCode.SUCCESS&&((null===(n=null===(i=p.output)||void 0===i?void 0:i.video.normal)||void 0===n?void 0:n.width)||(null===(a=null===(o=p.output)||void 0===o?void 0:o.video.normal)||void 0===a?void 0:a.fps))&&pa(r,t),[2,{code:d,data:_}])}}))}))}}),t}(Do);exports.BackgroundPictureFillMode=void 0,(Ha=exports.BackgroundPictureFillMode||(exports.BackgroundPictureFillMode={}))[Ha.CROP=1]="CROP",Ha[Ha.WHOLE=2]="WHOLE",exports.MixLayoutMode=void 0,(Ka=exports.MixLayoutMode||(exports.MixLayoutMode={}))[Ka.CUSTOMIZE=1]="CUSTOMIZE",Ka[Ka.SUSPENSION=2]="SUSPENSION",Ka[Ka.ADAPTATION=3]="ADAPTATION",exports.MixVideoRenderMode=void 0,(Wa=exports.MixVideoRenderMode||(exports.MixVideoRenderMode={}))[Wa.CROP=1]="CROP",Wa[Wa.WHOLE=2]="WHOLE",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 is,ns=function(){return{version:2,mode:exports.MixLayoutMode.SUSPENSION}},os=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:ns()}),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(n.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,msg:"videoTrackId: ".concat(e," is invalid")})),this;var t=_t(e),r=t.mediaType,i=t.tag,a=t.userId;return r!==exports.RCMediaType.VIDEO_ONLY?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,msg:"kind of ".concat(e," is not video")})),this):(this._values.host_stream_id=pt(a,i),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:o.SUCCESSED,videoTrackId:e})),this)}}),Object.defineProperty(t.prototype,"setMixLayoutMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[exports.MixLayoutMode.CUSTOMIZE,exports.MixLayoutMode.SUSPENSION,exports.MixLayoutMode.ADAPTATION].includes(e)?(this._values.mode=e,this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:o.SUCCESSED,mode:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:o.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 i=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if("cdn"!==e)if("audio"!==e){var n=i.video;if("normal"!==r&&"tiny"!==r)if("backgroundColor"!==r)if("exparams"!==r){if("backgroundPicture"===r){var o=n.backgroundPicture||(n.backgroundPicture={fillMode:exports.BackgroundPictureFillMode.CROP,picture:[]});Object.assign(o,t)}}else n.exparams={renderMode:t};else n.backgroundColor=t;else{var a=n[r]||(n[r]={});Object.assign(a,t)}}else i.audio={bitrate:t};else i.cdn=t}}),Object.defineProperty(t.prototype,"setOutputVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!gt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:o.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=bt(e),r=t.width,i=t.height;return this._addOutputValue("video",{width:r,height:i},"normal"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:o.SUCCESSED,resolution:e})),this}}),Object.defineProperty(t.prototype,"setOutputVideoFPS",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!mt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:o.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=Ct(e);return this._addOutputValue("video",{fps:t},"normal"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:o.SUCCESSED,fps:e})),this}}),Object.defineProperty(t.prototype,"setOutputVideoBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return!e.isNumber(t)||t<=0?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> bitrate: ".concat(t)})),this):(this._addOutputValue("video",{bitrate:t},"normal"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:o.SUCCESSED,bitrate:t})),this)}}),Object.defineProperty(t.prototype,"setOutputTinyVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!gt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:o.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=bt(e),r=t.width,i=t.height;return this._addOutputValue("video",{width:r,height:i},"tiny"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:o.SUCCESSED,resolution:e})),this}}),Object.defineProperty(t.prototype,"setOutputTinyVideoFPS",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!mt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:o.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=Ct(e);return this._addOutputValue("video",{fps:t},"tiny"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:o.SUCCESSED,fps:e})),this}}),Object.defineProperty(t.prototype,"setOutputTinyVideoBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return!e.isNumber(t)||t<=0?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> bitrate: ".concat(t)})),this):(this._addOutputValue("video",{bitrate:t},"tiny"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:o.SUCCESSED,bitrate:t})),this)}}),Object.defineProperty(t.prototype,"setOutputVideoRenderMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[exports.MixVideoRenderMode.CROP,exports.MixVideoRenderMode.WHOLE].includes(e)?(this._addOutputValue("video",e,"exparams"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:o.SUCCESSED,renderMode:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> renderMode: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"setOutputAudioBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isNumber(t)&&t>0?(this._addOutputValue("audio",t),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:o.SUCCESSED,bitrate:t})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:o.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(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:o.SUCCESSED,color:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:o.FAILED,msg:"params error -> color: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"addOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,s){var c,u,l;if(!e.isHttpUrl(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.FAILED,msg:"params error -> uri: ".concat(t)})),this;if([r,i,a,s].some((function(t){return!e.isNumber(t)||t<0||t>1})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.FAILED,msg:"params of (x, y, w, h) error -> x: ".concat(r,", y: ").concat(i,", w: ").concat(a,", h: ").concat(s)})),this;var d=(null===(l=null===(u=null===(c=this._values.output)||void 0===c?void 0:c.video)||void 0===u?void 0:u.backgroundPicture)||void 0===l?void 0:l.picture)||[];return d.push({uri:t,w:a,h:s,x:r,y:i}),this._addOutputValue("video",{picture:d},"backgroundPicture"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.SUCCESSED,uri:t,x:r,y:i,w:a,h:s})),this}}),Object.defineProperty(t.prototype,"removeOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,a;if(!e.isHttpUrl(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.FAILED,msg:"params error -> uri: ".concat(t)})),this;var s=null===(a=null===(i=null===(r=this._values.output)||void 0===r?void 0:r.video)||void 0===i?void 0:i.backgroundPicture)||void 0===a?void 0:a.picture;return s&&(s=s.filter((function(e){return e.uri!==t})),this._addOutputValue("video",{pictures:s},"backgroundPicture")),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.SUCCESSED,uri:t})),this}}),Object.defineProperty(t.prototype,"clearOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this._logger.info(n.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[exports.BackgroundPictureFillMode.CROP,exports.BackgroundPictureFillMode.WHOLE].includes(e)?(this._addOutputValue("video",{fillMode:e},"backgroundPicture"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.SUCCESSED,fillMode:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> fillMode: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"addPublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,a=/^rtmp:\/\/.+/;if(!e.isArray(t)||0===t.length||t.some((function(e){return!a.test(e)})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> urls: ".concat(t.join(","))})),this;var s=(null===(i=null===(r=this._values.output)||void 0===r?void 0:r.cdn)||void 0===i?void 0:i.concat())||[],c=!1;return t.forEach((function(e){s.some((function(t){return t.pushurl===e}))||(c=!0,s.push({pushurl:e}))})),s.length>5?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> publish stream urls no more than 5, length: ".concat(t.length)})),this):(c&&this._addOutputValue("cdn",s),this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O,JSON.stringify({status:o.SUCCESSED,urls:t})),this)}}),Object.defineProperty(t.prototype,"removePublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,a=/^rtmp:\/\/.+/;if(!e.isArray(t)||0===t.length||t.some((function(e){return!a.test(e)})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:o.FAILED,msg:"params error -> urls: ".concat(t.join(","))})),this;for(var s=(null===(i=null===(r=this._values.output)||void 0===r?void 0:r.cdn)||void 0===i?void 0:i.concat())||[],c=s.length-1;c>=0;c-=1){var u=s[c].pushurl,l=t.indexOf(u);l>=0&&(t.splice(l,1),s.splice(c,1))}return this._addOutputValue("cdn",s),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:o.SUCCESSED,urls:t})),this}}),Object.defineProperty(t.prototype,"clearPublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._addOutputValue("cdn",[]),this._logger.info(n.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,i,a,s){if(!e.notEmptyString(t)||!this._isValidTrackId(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(t)})),this;if(!e.isNumber(r)||!e.isNumber(i))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params x or y is error -> x: ".concat(r,", y: ").concat(i)})),this;if([a,s].some((function(t){return!e.isNumber(t)||t<0})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params width or height error -> width: ".concat(a,", height: ").concat(s)})),this;var c=_t(t),u=c.userId,l=c.tag;if(c.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"type of trackId: ".concat(t," is not video")})),this;var d=pt(u,l),_=this._values.input||(this._values.input={}),p=_.video||(_.video=[]);return p.some((function(e){return e.height===s&&e.width===a&&e.stream_id===d&&e.user_id===u&&e.x===r&&e.y===i}))?(this._logger.warn(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"Duplicate configuration item place ignored"})),this):(p.push({user_id:u,stream_id:d,x:r,y:i,width:a,height:s}),this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.SUCCESSED,trackId:t,x:r,y:i,width:a,height:s})),this)}}),Object.defineProperty(t.prototype,"removeCustomizeLayoutVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=_t(e),r=t.userId,i=t.tag;if(t.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"type of trackId: ".concat(e," is not video")})),this;var a=pt(r,i),s=this._values.input;return(null==s?void 0:s.video)&&s.video.length>0&&(s.video=s.video.filter((function(e){return e.stream_id===a}))),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.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(n.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(n.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"trackIds contain invalid item -> trackIds: ".concat(e.join(","))})),this):((this._values.input||(this._values.input={})).audio=e.map((function(e){var t=_t(e),r=t.userId,i=t.tag;return{stream_id:pt(r,i),user_id:r}})),this._values.inputFilterMode=za.AUDIO_INPUT_VIDEO_ALL,this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.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(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input||(this._values.input={}),r=t.audio||(t.audio=[]),i=_t(e),a=i.userId,s=i.tag,c=pt(a,s);return r.some((function(e){return e.stream_id===c&&e.user_id===a}))?(this._logger.warn(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"trackId: ".concat(e," is exist")})),this):(r.push({user_id:a,stream_id:c}),this._values.inputFilterMode=za.AUDIO_INPUT_VIDEO_ALL,this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.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(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.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(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"type of trackId: ".concat(e," is not audio")})),this;var r=_t(e),i=r.userId,a=r.tag,s=pt(i,a);return t.audio=t.audio.filter((function(e){return i!==e.user_id||s!==e.stream_id})),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.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(n.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,i,a,s,c){if(!this._isValidTrackId(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(t)})),this;if(!e.isHttpUrl(r))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"params error -> uri: ".concat(r)})),this;if([i,a,s,c].some((function(t){return!e.isNumber(t)||t<0||t>1}))||i+s>1||a+c>1)return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"some attrs of (x, y, w, h) is invalid -> x: ".concat(i,", y: ").concat(a,", w: ").concat(s,", h: ").concat(c)})),this;var u=_t(t),l=u.userId,d=u.tag,_=pt(l,d),p=(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen,f=p.filter((function(e){return e.streamId===_}))[0];return f?f.picture.push({uri:r,w:s,h:c,x:i,y:a}):p.push({streamId:_,picture:[{uri:r,w:s,h:c,x:i,y:a}]}),this._values.waterMark.singleScreen=p,this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.SUCCESSED,trackId:t,uri:r,x:i,y:a,w:s,h:c,singleScreen:p})),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(n.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}}),Object.defineProperty(t.prototype,"removePictureWaterMark",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(!e.notEmptyString(t)||!this._isValidTrackId(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(t)})),this;var i=_t(t),a=i.userId,s=i.tag,c=pt(a,s);return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen.forEach((function(e){e.streamId===c&&(e.picture=e.picture.filter((function(e){return e.uri!==r})))})),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:o.SUCCESSED,trackId:t,uri:r})),this}}),Object.defineProperty(t.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._values=ns(),this._logger.info(n.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),s(this,void 0,void 0,(function(){var t,r;return c(this,(function(i){switch(i.label){case 0:return t=JSON.parse(JSON.stringify(this._values)),[4,this._invoker.push(new rs(t,this._values))];case 1:return r=i.sent().code,e&&(this._values=ns()),[2,{code:r}]}}))}))}}),Object.defineProperty(t.prototype,"__innerGetValues",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.parse(JSON.stringify(this._values))}}),t}();exports.RCLivingType=void 0,(is=exports.RCLivingType||(exports.RCLivingType={}))[is.VIDEO=0]="VIDEO",is[is.AUDIO=1]="AUDIO";var as,ss=function(e){function t(t,r,i){var n=e.call(this)||this;return Object.defineProperty(n,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),n}return r(t,e),Object.defineProperty(t.prototype,"_exchangeWithPushOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d,_,p,f,h;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,a=e.peer,s=e.context,a.getLocalTracks().length?(u=a,[4,la(t.getSubscribedList(),!1,u,t,s)]):(i.info(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.SUCCESSED,msg:"have not published resource"}),this.traceId),[2]);case 1:return l=c.sent(),d=e.getPushOtherRooms(),l.pushOtherRooms=d,[4,new aa(l,this.traceId,!0).execute(e,t,r)];case 2:return(_=c.sent()).code!==exports.RCRTCCode.SUCCESS?(i.error(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,code:_.code,pushOtherRooms:d}),this.traceId),[2]):(p=_.data.data,f=p.sdp,(h=p.resultCode)!==exports.RCRTCCode.SUCCESS?(i.error(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,code:h,pushOtherRooms:d}),this.traceId),[2]):(i.info(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.SUCCESSED,pushOtherRooms:d}),this.traceId),u.setRemoteAnswer(f.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 s(this,void 0,void 0,(function(){var i,a;return c(this,(function(s){switch(s.label){case 0:return i=e.logger,a=this.roomId,i.info(n.L_EXCHANGE_WITH_PUSHOTHERROOM_T,a),this.roomPKHandler?this.roomPKHandler.getPKInfo(a)?[4,this._exchangeWithPushOtherRoom(e,t,r)]:(i.warn(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,msg:"PKInfo not exist"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}]):(i.error(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,msg:"_roomPKHandler not exist"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return s.sent(),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(Do),cs=function(t){function i(e,r,i,n,o,a){var s=t.call(this)||this;return Object.defineProperty(s,"pkHandler",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(s,"room",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:n}),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 r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.LEAVE_OTHER_ROOM},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"quitRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,R,b;return c(this,(function(c){switch(c.label){case 0:return s=t.logger,u=t.context,s.info(n.L_QUIT_PK_T,"roomId: ".concat(r),a),this._PKInfo[r]?(l=this._PKInfo[r],d=l.inviterRoomId,_=l.inviteeRoomId,p=l.inviterUserId,f=l.inviteSessionId,h={inviteeRoomId:_,inviterRoomId:d,userId:i.crtUserId},R={roomId:i.roomId,endRoomId:r,sessionId:f,content:JSON.stringify(h),keys:["".concat(d,"|").concat(p)]},[4,u.endRoomPK(R)]):(s.warn(n.L_QUIT_PK_R,"status: ".concat(o.FAILED,", msg: pkinfo is empty"),a),[2]);case 1:return(b=c.sent())!==e.ErrorCode.SUCCESS?(s.error(n.L_QUIT_PK_R,"status: ".concat(o.FAILED,", code: ").concat(b),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(s.info(n.L_QUIT_PK_R,"status: ".concat(o.SUCCESSED),a),delete this._PKInfo[r],[2])}}))}))}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,s=(a=this).room,u=a.isQuitPK,l=s.getRoomId(),i.info(n.L_LIVING_ROOM_LEAVE_PK_ROOM_T,JSON.stringify({roomId:l,isQuitPK:u}),this.traceId),[4,s.__destroy(!0)];case 1:return c.sent(),delete this._joinedPKRooms[l],[4,new ss(l,this.pkHandler,this.traceId).execute(e,t,r)];case 2:return c.sent(),u&&this.quitRoomPK(e,l,t,this.traceId),i.info(n.L_LIVING_ROOM_LEAVE_PK_ROOM_R,JSON.stringify({status:o.SUCCESSED}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),i}(Do),us=function(){function t(e,t,r,i,n,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:i}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:n}),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(t.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,d([],l(r),!1))}catch(e){this._logger.error(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify(e))}}}),Object.defineProperty(t.prototype,"_onInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.inviteInfo||{},r=t.inviterRoomId,i={inviterRoomId:r,inviterUserId:t.inviterUserId,extra:t.extra};this._PKInfo[r]=t,this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onRequestJoinOtherRoom",info:i})),this._callAppListener("onRequestJoinOtherRoom",i)}}),Object.defineProperty(t.prototype,"_onCancelInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.inviteInfo||{},r=t.inviterRoomId,i={inviterRoomId:r,inviterUserId:t.inviterUserId,extra:t.extra};delete this._PKInfo[r],this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCancelRequestOtherRoom",cancelInfo:i})),this._callAppListener("onCancelRequestOtherRoom",i)}}),Object.defineProperty(t.prototype,"_onInviteTimeout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"_onInviteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.answerCode,r=e.inviteContent,i=r.inviteSessionId,o=r.inviterUserId,a=r.inviterRoomId,s=r.inviteeUserId,c=r.inviterUserAutoMix,u=r.inviteeUserAutoMix,l=r.inviteeRoomId,d={agree:1===t,inviterRoomId:a,inviterUserId:o,inviteeRoomId:l,inviteeUserId:s,extra:r.extra};this._PKInfo[l]=this._PKInfo[l]||{inviteSessionId:i,inviterRoomId:a,inviterUserId:o,inviterUserAutoMix:c,inviteeRoomId:l},this._PKInfo[l].inviteeUserAutoMix=u,this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onResponseJoinOtherRoom",answerInfo:d})),this._callAppListener("onResponseJoinOtherRoom",d)}}),Object.defineProperty(t.prototype,"createLeaveOtherRoomCommand",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return new cs(this,e,this._PKInfo,this._joinedPKRooms,t,r)}}),Object.defineProperty(t.prototype,"_onPKEnd",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,o,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return t=e.inviteInfo,r=t.inviteeRoomId,i=t.inviterRoomId,o=t.userId,a=i===this._mainRoomId?r:i,s={endRoomId:a,endUserId:o},u=this._joinedPKRooms[a],l=this._logger.createTraceId(),this._logger.info(n.L_QUIT_PK_LEAVE_PK_ROOM_O,void 0,l),u?[4,this._invoker.push(this.createLeaveOtherRoomCommand(u,!0,l))]:[3,2];case 1:c.sent(),c.label=2;case 2:return delete this._PKInfo[a],this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onFinishOtherRoom",endInfo:s})),this._callAppListener("onFinishOtherRoom",s),[2]}}))}))}}),Object.defineProperty(t.prototype,"_onRecvPKMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.content;switch(e.messageType){case St.PK_INVITE:this._onInvite(t);break;case St.PK_CANCEL_INVITE:this._onCancelInvite(t);break;case St.PK_INVITE_TIMEOUT:this._onInviteTimeout(t);break;case St.PK_INVITE_ANSWER:this._onInviteAnswer(t);break;case St.PK_END:this._onPKEnd(t)}}}),Object.defineProperty(t.prototype,"registerRoomPKEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O,JSON.stringify({listener:e&&Object.keys(e)})),this._appListener=e}}),Object.defineProperty(t.prototype,"requestJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d,_;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:t,inviteeUserId:r,options:i}),a),e.validate("inviteeRoomId",t,e.notEmptyString,!0)&&e.validate("inviteeUserId",r,e.notEmptyString,!0)?(s=zn(),u=!e.isBoolean(null==i?void 0:i.autoMix)||(null==i?void 0:i.autoMix),l={inviteSessionId:s,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:u,inviteeRoomId:t,inviteeUserId:r,inviteeTimeoutTime:this._inviteTimeout,extra:(null==i?void 0:i.extra)||""},d={roomId:this._mainRoomId,invitedRoomId:t,invitedUserId:r,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(l),inviteSessionId:s},[4,this._context.requestRoomPK(d)]):(this._logger.error(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),a),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(_=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:_}),a),[2,{code:_}]):(this._PKInfo[t]={inviteSessionId:s,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:u,inviteeRoomId:t},this._logger.info(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"cancelRequestJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:t,inviteeUserId:r,extra:i}),a),e.validate("inviteeRoomId",t,e.notEmptyString,!0)&&e.validate("inviteeUserId",r,e.notEmptyString,!0)?this._PKInfo[t]?(s={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:t,inviteeUserId:r,extra:i||""},u={roomId:this._mainRoomId,invitedRoomId:t,invitedUserId:r,inviteSessionId:this._PKInfo[t].inviteSessionId,inviteInfo:JSON.stringify(s)},[4,this._context.cancelRoomPK(u)]):(this._logger.error(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"The request to connect with ".concat(r," user in room ").concat(t," is not initiated")}),a),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),a),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(l=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:l}),a),[2,{code:l}]):(this._logger.info(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),a),delete this._PKInfo[t],[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"responseJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,R,b;return c(this,(function(c){switch(c.label){case 0:return s=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T,JSON.stringify({inviterRoomId:t,inviterUserId:r,agree:i,options:a}),s),e.validate("inviterRoomId",t,e.notEmptyString,!0)&&e.validate("inviterUserId",r,e.notEmptyString,!0)?this._PKInfo[t]?(u=this._PKInfo[t],l=u.inviteSessionId,d=u.inviterUserAutoMix,_=!e.isBoolean(null==a?void 0:a.autoMix)||(null==a?void 0:a.autoMix),p={inviteSessionId:l,inviterRoomId:t,inviterUserId:r,inviterUserAutoMix:d,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:_},f=Object.assign(p,{inviterUserAutoMix:d}),h=i?Object.assign(p,{MultiRoomKey:"".concat(t,"|").concat(this._mainRoomId),MultiRoomValue:JSON.stringify(f)}):p,!e.isUndefined(null==a?void 0:a.extra)&&Object.assign(h,{extra:a.extra}),R={agree:i,roomId:this._mainRoomId,inviteSessionId:l,inviteRoomId:t,inviteUserId:r,content:JSON.stringify(h),key:"".concat(t,"|").concat(this._mainRoomId),value:JSON.stringify(p)},[4,this._context.responseRoomPK(R)]):(this._logger.error(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"User ".concat(r," in room ").concat(t," did not send a request for connection")}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviterRoomId or inviterUserId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(b=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:b}),s),[2,{code:b}]):(this._logger.info(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),s),this._PKInfo[t].inviteeUserAutoMix=_,[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"joinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a,s,u;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T,JSON.stringify({roomId:t}),r),e.validate("roomId",t,e.notEmptyString,!0)?this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?(this._logger.error(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"IM disconnected"}),r),[2,{code:exports.RCRTCCode.SIGNAL_DISCONNECTED}]):this._joinedPKRooms[t]?(this._logger.warn(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):(i=exports.RCLivingType.VIDEO,a={extra:'{"roomId": "'.concat(this._mainRoomId,'"}')},[4,(s=new hs(this._context,this._runtime,t,this._service,this._initOptions,i,!1,!1,this._clientSessionId)).__innerInit(exports.RTCMode.LIVE,void 0,i,a)]):(this._logger.error(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(u=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:u}),r),[2,{code:u}]):(this._joinedPKRooms[t]=s,[4,this._onJoinedPKRoom(t,r)]);case 2:return c.sent(),this._logger.info(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),r),[2,{room:s,code:exports.RCRTCCode.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()}]}}))}))}}),Object.defineProperty(t.prototype,"leaveOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){return r=this._logger.createTraceId(),this._logger.info(n.L_APP_CALL_LEAVE_PK_ROOM_O,void 0,r),[2,this._invoker.push(this.createLeaveOtherRoomCommand(e,t,r))]}))}))}}),Object.defineProperty(t.prototype,"getPKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._PKInfo[e]}}),Object.defineProperty(t.prototype,"getAllPKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._PKInfo}}),Object.defineProperty(t.prototype,"getJoinedPKRooms",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._joinedPKRooms}}),t}();!function(e){e[e.OPEN=1]="OPEN",e[e.STOP=2]="STOP"}(as||(as={}));var ls,ds=function(t){function i(e,r){var i=t.call(this)||this;return Object.defineProperty(i,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"enable",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.ENABLE_INNER_CDN},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,s=t.context,u=this.enable,a.info(n.L_LIVING_ROOM_ENABLE_INNER_CDN_T,JSON.stringify({roomId:r.roomId,enable:u})),r.isMainRoom?e.isBoolean(u)?(r.setCDNEnabel(u),l={version:2,output:{inCDNModel:u?as.OPEN:as.STOP}},[4,new rs(l,this.cdnValues).execute(t,r,i)]):(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> enable"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}]);case 1:return(d=c.sent().code)!==exports.RCRTCCode.SUCCESS?(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:d,msg:"signal error"})),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(_=r.getCDNUris())&&_.broadcast!==Ho.SPREAD?(a.info(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.SUCCESSED,enable:u})),[2,{code:exports.RCRTCCode.SUCCESS}]):[4,pa(s,r)];case 2:return(p=c.sent().code)===exports.RCRTCCode.SUCCESS?(a.info(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.SUCCESSED,enable:u})),[2,{code:exports.RCRTCCode.SUCCESS}]):(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:p})),[2,{code:p}])}}))}))}}),i}(Do);!function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(ls||(ls={}));var _s,ps,fs=function(t){function i(e,r){var i=t.call(this)||this;return Object.defineProperty(i,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return vo.RTC_IDENTITY_CHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n;return s(this,void 0,void 0,(function(){var o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return[4,t.context.rtcIdentityChange(r.roomId,ls.ViewerToAnchor,this.livingType)];case 1:return o=c.sent(),a=o.code,s=o.data,a===e.ErrorCode.SUCCESS&&s?(r.initWithRoomData(s,this.traceId),r.getResourcesByUserId(r.crtUserId).length>0&&i.push(new Bo),(u=null===(n=s.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value)&&r.setCDNUris(JSON.parse(u)[0]),[2,{code:a,data:s}]):[2,{code:a}]}}))}))}}),i}(Do),hs=function(t){function i(e,r,i,n,o,a,s,c,u){var l=t.call(this,e,r,i,exports.RTCMode.LIVE,n,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 os(l._executeCtx,l._invoker,l._isValidResourceId.bind(l)),l}return r(i,t),Object.defineProperty(i.prototype,"_initRoomPKHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._store.isMainRoom){var r=(i=this._roomId,n=e.roomInfo,o={},n.forEach((function(e){var t=JSON.parse(e.value),r=t.inviterRoomId,n=t.inviteeRoomId;o[i===r?n:r]=JSON.parse(e.value)})),o);this._roomPKHandler=new us(this._invoker,r,this._context,this._runtime,this._service,this._initOptions,this,t.prototype._registerPKMsgListener.bind(this),this._onJoinedPKRoom.bind(this),this._clientSessionId)}var i,n,o}}),Object.defineProperty(i.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(r,i,a,u,l,d){return s(this,void 0,void 0,(function(){var s,_,p;return c(this,(function(c){switch(c.label){case 0:return e.validate("livingType",a,(function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO}))?[4,t.prototype.__innerInit.call(this,r,i,a,u,l,d)]:(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType"}),d),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return s=c.sent(),_=s.code,p=s.data,_===exports.RCRTCCode.SUCCESS&&p&&this._initRoomPKHandler(p),[2,{code:_,data:p}]}}))}))}}),Object.defineProperty(i.prototype,"__innerInitByIdentityChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a;return c(this,(function(s){switch(s.label){case 0:return[4,this._invoker.push(new fs(this._livingType,t))];case 1:return r=s.sent(),i=r.code,a=r.data,i===e.ErrorCode.SUCCESS&&a?(this._initRoomPKHandler(a),this._initWithRoomData(a.offlineKickTime),this._logger.info(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.SUCCESSED,roomData:a}),t)):this._logger.error(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.FAILED,code:i}),t),[2,i]}}))}))}}),Object.defineProperty(i.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._store.isMainRoom?[2,t.prototype.publish.call(this,e)]:(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}])}))}))}}),Object.defineProperty(i.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._store.isMainRoom?[2,t.prototype.unpublish.call(this,e)]:(this._logger.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}])}))}))}}),Object.defineProperty(i.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=_t(e).userId,n=!!(null===(t=this._store.getResourcesByUserId(i))||void 0===t?void 0:t.find((function(t){return dt(t)===e}))),o=this.getRoomPKHandler(),a=o.code,s=o.roomPKHandler;if(a!==exports.RCRTCCode.SUCCESS||!s)return n;var c=s.getJoinedPKRooms(),u=[];return Object.values(c).forEach((function(e){u.push.apply(u,d([],l(e.getRemoteTracks()),!1))})),r=u.some((function(t){return e===t.getTrackId()})),n||r}}),Object.defineProperty(i.prototype,"getLivingType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._livingType}}),Object.defineProperty(i.prototype,"getMCUConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom?this._mcuConfigBuilder:(this._logger.error(n.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O,"the `getMCUConfigBuilder` is disabled in PK room"),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}}),Object.defineProperty(i.prototype,"enableInnerCDN",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new ds(this._mcuConfigBuilder.__innerGetValues(),e))]}))}))}}),Object.defineProperty(i.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i,n,o){return s(this,void 0,void 0,(function(){return c(this,(function(a){return t.prototype._resourceHandle.call(this,e,r,i,n,o),[2]}))}))}}),Object.defineProperty(i.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(i.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(i.prototype,"_onJoinedPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._invoker.push(new ss(e,this._roomPKHandler,t)),[2]}))}))}}),Object.defineProperty(i.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 i=t[r].getSessionId(),n=this._roomPKHandler.getPKInfo(r);if(n){var o=n.inviterUserAutoMix,a=n.inviteeUserAutoMix,s=n.inviterUserId,c=this._context.getCurrentId()===s;e.push({roomId:r,sessionId:i,autoMix:c?!!o:!!a})}}return e}}),Object.defineProperty(i.prototype,"getRoomPKHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom?(this._logger.info(n.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:o.SUCCESSED})),{code:exports.RCRTCCode.SUCCESS,roomPKHandler:this._roomPKHandler}):(this._logger.error(n.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:o.SUCCESSED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}}),Object.defineProperty(i.prototype,"_quitAllPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t;return c(this,(function(r){for(t in e=this._roomPKHandler.getJoinedPKRooms())this._roomPKHandler.leaveOtherRoom(e[t]);return this._logger.info(n.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O,JSON.stringify({status:o.SUCCESSED,roomIds:Object.keys(e)})),[2]}))}))}}),Object.defineProperty(i.prototype,"isMainRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom}}),i}(ts),Rs=function(e){function t(t,r,i,n,o,a,s){return void 0===a&&(a=exports.RTCMode.RTC),void 0===s&&(s=!1),e.call(this,t,r,i,a,n,o,!1,!1,zn(),s)||this}return r(t,e),t}(ts),bs=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 s(this,void 0,void 0,(function(){var e,t,r,i,n,o;return c(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,i=e.reject,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r()];case 2:return n=a.sent(),t(n),[3,4];case 3:return o=a.sent(),i(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,i=new Promise((function(t,i){r.queue.push({resolve:t,task:e,reject:i})}));return this.checkToStart(),i}}),e}(),gs=new bs,ms=function(e,t){return void 0===t&&(t=""),gs.push(e,t)},Cs=function(){function t(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:zn()}),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 eo(t,e,r.mediaServer),this._logger=this._context.logger,this._store=new jo(this._logger,this._clientSessionId,this._context.getAppkey(),this._crtUserId,this._crtUserId,exports.RTCMode.LIVE)}return Object.defineProperty(t.prototype,"_getReqHeaders",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o;return c(this,(function(a){switch(a.label){case 0:return r=this._crtUserId,this._rtcToken?[3,2]:[4,this._context.getRTCToken(r,exports.RTCMode.LIVE,t)];case 1:if(i=a.sent(),n=i.code,o=i.data,n!==e.ErrorCode.SUCCESS)return[2,{code:exports.RCRTCCode.SIGNAL_ERROR}];this._rtcToken=o.rtcToken,a.label=2;case 2:return[2,{code:exports.RCRTCCode.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:this._crtUserId,RoomId:r,RoomType:exports.RTCMode.LIVE,Token:this._rtcToken,"Client-Session-Id":this._clientSessionId}}]}}))}))}}),Object.defineProperty(t.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(t.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return s(this,void 0,void 0,(function(){var t;return c(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)===exports.RCRTCCode.SUCCESS&&(null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer()),[2,{code:t}]}}))}))}}),Object.defineProperty(t.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return void 0===i&&(i=!1),s(this,void 0,void 0,(function(){var n=this;return c(this,(function(o){return[2,ms((function(){return n.__subscribe(e,t,r,i)}),"audience-client-sub")]}))}))}}),Object.defineProperty(t.prototype,"__subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){var u;return void 0===a&&(a=!1),s(this,void 0,void 0,(function(){var s,l,d,_,p,f,h,R,b,g,m,C,v,T=this;return c(this,(function(c){switch(c.label){case 0:return this._logger.info(n.L_AUDIENCE_CLIENT_SUBSCRIBE_T,JSON.stringify({liveUrl:t,livingType:r,mediaType:i,subTiny:a})),s=[],yt(this._context.getNaviInfo())?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"})),[2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,tracks:s}]):(!this._fromRetry&&(null===(u=this._pc)||void 0===u||u.clearReTryExchangeTimer()),this._fromRetry=!1,e.isString(t)?[exports.RCLivingType.AUDIO,exports.RCLivingType.VIDEO].includes(r)?[exports.RCMediaType.AUDIO_ONLY,exports.RCMediaType.VIDEO_ONLY,exports.RCMediaType.AUDIO_VIDEO].includes(i)?this._liveUrl&&this._liveUrl!==t?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,msg:"repeat subscribe"})),[2,{code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s}]):(this._pc||(this._pc=new Po(this._context,this._logger,this._reTryExchange.bind(this),this._crtUserId,this._store,void 0,!1),this._pc.on(Po.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this._pc.registerReportListener(this._reportListener),this._pc.__reportR3R4ToPolaris()),this._liveUrl=t,[4,this._getReqHeaders(r)]):(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> -> mediaType: ".concat(i)})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s}]):(this._logger.error("livingType is invalid: ".concat(r)),this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType: ".concat(r)})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s}]):(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> liveUrl: ".concat(t)})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s}]));case 1:return l=c.sent(),d=l.code,_=l.headers,d!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:d,msg:"getRTCToken failed"})),[2,{code:d,tracks:s}]):(p="rc_mcu_".concat(Date.now()),f="RongCloudRTC",0===this._subTracks.length&&(this._subTracks.push(new it(this._logger,f,p),new nt(this._logger,f,p)),this._pc.updateSubRemoteTracks(this._subTracks.slice())),[4,this._pc.createOffer(!0)]);case 2:return h=c.sent(),R={sdp:h,liveUrl:t,mediaType:i,simulcast:a?Xn.TINY:Xn.NORMAL,switchstream:!1},[4,this._service.broadcastSubscribe(_,R)];case 3:return(b=c.sent()).code!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:b.code})),[2,{code:b.code,tracks:s}]):(g=b.data).resultCode!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:g.resultCode,msg:g.message})),[2,{code:g.resultCode,tracks:s}]):(this._livingType=r,this._mediaType=i,this._subTiny=a,m=g.sdp,C=g.subscribedList,this._subscribedList=C,v=[],C.forEach((function(e){var t=e.mediaType,r=T._subTracks[t];v.push(r),r.__innerSetRemoteMuted(!0)})),this._pc.setRemoteAnswer(m.sdp),v&&this._updateTrackIdSSRCMap(m.sdp,v),this._logger.info(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,liveUrl:t})),[2,{code:exports.RCRTCCode.SUCCESS,tracks:v}])}}))}))}}),Object.defineProperty(t.prototype,"_updateTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;t.forEach((function(t){var i=t.getTrackId(),n=_t(i).mediaType,o=r._subscribedList.filter((function(e){return e.mediaType===n}))[0].msid,a=ga(e,o,n);r._store.setTrackIdSSRCMap(Number(a),i)}))}}),Object.defineProperty(t.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){return[2,ms((function(){return e.__unsubscribe()}),"audience-client-unsub")]}))}))}}),Object.defineProperty(t.prototype,"__unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return s(this,void 0,void 0,(function(){var t,r;return c(this,(function(i){switch(i.label){case 0:return this._logger.info(n.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(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:"",msg:"Address does not exist, without unsubscribe"})),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return t=i.sent().headers,[4,this._service.broadcastExit(t)];case 2:return(r=i.sent().code)!==exports.RCRTCCode.SUCCESS?this._logger.error(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:r})):(this._logger.info(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,liveUrl:this._liveUrl})),this._subscribedList=[]),this._clearSubscribeInfo(),[2,{code:r}]}}))}))}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(t.prototype,"registerTrackEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._appListener=e}}),Object.defineProperty(t.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=e.receiver.track,o="audio"===i.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY,a=this._subTracks[o];a.__innerSetMediaStreamTrack(i);try{this._logger.info(n.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,"trackId: ".concat(a.getTrackId())),null===(r=null===(t=this._appListener)||void 0===t?void 0:t.onTrackReady)||void 0===r||r.call(t,a)}catch(e){this._logger.error(n.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,JSON.stringify(e))}}}),t}();exports.RCInnerCDNPullKind=void 0,(_s=exports.RCInnerCDNPullKind||(exports.RCInnerCDNPullKind={})).RTMP="rtmp",_s.FLV="flv",_s.HLS="hls",exports.RCInnerCDNPullIsHttps=void 0,(ps=exports.RCInnerCDNPullIsHttps||(exports.RCInnerCDNPullIsHttps={}))[ps.NOT_HTTPS=0]="NOT_HTTPS",ps[ps.HTTPS=1]="HTTPS";var vs,Ts=a(a({},bt(exports.RCResolution.W176_H144)),{frameRate:Ct(exports.RCFrameRate.FPS_15)}),Os=function(){function t(e,t,r,i,n,o,a){void 0===a&&(a=zn());var u=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:i}),Object.defineProperty(this,"_joinResData",{enumerable:!0,configurable:!0,writable:!0,value:n}),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 Ba(this._context,this._runtime,this._roomId,this,ka.Audience),this._reportMediaActionLogger=new xa(this._logger,this._roomId,this._clientSessionId,this._crtUserId),this._service=new eo(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout);var l=this._store=new jo(this._logger,a,e.getAppkey(),i,this._crtUserId,exports.RTCMode.LIVE),d=this._pc=new Po(this._context,this._logger,this._reTryExchange.bind(this),this._crtUserId,l,this._polarisReport,!0);this._audioLevelReport=new No(this._store,d),d.on(Po.__INNER_AUDIOLEVEL_CHANGE__,this._audioLevelReport.audioLevelReport,this._audioLevelReport),this._polarisReport.sendR1(),this._context.registerRTCSignalListener((function(e){return s(u,void 0,void 0,(function(){var t,r,i,n;return c(this,(function(o){return t=this._context.decodeRtcNotify(e),r=t.time,i=t.type,n=t.roomId,1===i&&this._startPull(n,r),[2]}))}))})),this._setInitData()}return Object.defineProperty(t.prototype,"_startPull",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return this._isPulling?[2]:(this._isPulling=!0,this._pullTime>r?(this._isPulling=!1,[2]):(i=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T,"pullTime: ".concat(this._pullTime),i),[4,this._context.pullRTCRoomEntry(t)]));case 1:return a=c.sent(),s=a.code,u=a.data,s===e.ErrorCode.SUCCESS&&(this._isPulling=!1,this._pullTime=(null==u?void 0:u.syncTime)||0,l=(null==u?void 0:u.kvEntries)||[],this._logger.info(n.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(o.SUCCESSED,", kvEntries: ").concat(JSON.stringify(l)),i),this.singalDataChange(l,t,i)),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(o.FAILED,", code: ").concat(s),i),[2]}}))}))}}),Object.defineProperty(t.prototype,"_setInitData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(e,t,r){var i=t.filter((function(e){return"RC_RTC_SESSIONID"===e.key}))[0],n=i?i.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 i=t.mediaType,n=t.tag,o=i===exports.RCMediaType.AUDIO_ONLY?new it(r,n,"",e):new nt(r,n,"",e);c.push(o)}));var u=[],_=[];a.forEach((function(e){var t=JSON.parse(e.uris||"[]");u.push.apply(u,d([],l(t),!1)),t.forEach((function(e){var t=e.mediaType,i=e.tag,n=e.msid.split("_");n.pop();var o=n.join("_"),a=t===exports.RCMediaType.AUDIO_ONLY?new it(r,i,o):new nt(r,i,o);_.push(a)}))}));var p=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:n,remoteUserIds:o||[],remoteRTCUris:u,remoteMUCUris:s,remoteRTCTracks:_,remoteMCUTracks:c,remoteTracks:d(d([],l(_),!1),l(c),!1),CDNUris:p||{}}}(this._roomId,this._joinResData.kvEntries,this._logger),r=t.sessionId,i=t.remoteUserIds,n=t.remoteRTCUris,o=t.remoteMUCUris,a=t.remoteTracks,s=t.CDNUris;this._sessionId=r,this._roomAnchorList=i,a.forEach((function(t){e._remoteTracks[t.getTrackId()]=t})),this._CDNUris=s,n.forEach((function(t){var r=t.msid.split("_")[0];e._roomAnchorRes[r]?e._roomAnchorRes[r].push(t):e._roomAnchorRes[r]=[t];var i=JSON.parse(t.uri),n=i.ssrc,o=i.resourceId;e._store.setTrackIdSSRCMap(n,o)})),o.forEach((function(t){var r=t.mediaType,i=t.tag,n=[e._roomId,i,r].join("_");e._roomRes[n]=t;var o=JSON.parse(t.uri).ssrc;e._store.setTrackIdSSRCMap(o,n)})),n.forEach((function(t){var r=dt(t);e._roomRes[r]=t}))}}),Object.defineProperty(t.prototype,"_assertRoomDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this._destroyed)return exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}}),Object.defineProperty(t.prototype,"singalDataChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,a=this;if(t===this._roomId){var s=[],c=null===(i=e.filter((function(e){return"RC_CDN"===e.key}))[0])||void 0===i?void 0:i.value;c&&this._diffCDNUris(JSON.parse(JSON.parse(c).cdn_uris)[0],r),e.forEach((function(e){var t=e.key,i=e.value,n=e.uid;if(-1!==t.indexOf("RC_RES_")){var o=JSON.parse(i||"{}"),c=JSON.parse(o.mcu_uris||"[]"),u=JSON.parse(o.uris||"[]");return s.push.apply(s,d([],l(c),!1)),void a._diffAnchorResource(u,n,r)}if("RC_ANCHOR_LIST"===t){var _=JSON.parse(i||"[]");a._diffAnchorList(_,r)}})),this._diffRoomResource(s,r)}else this._logger.error(n.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P,JSON.stringify({status:o.FAILED,msg:"roomId inconsistency -> params roomId:".concat(t,", current roomId:").concat(this._roomId)}),r)}}),Object.defineProperty(t.prototype,"_diffAnchorList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=e.filter((function(e){return r._roomAnchorList.indexOf(e)<0})),n=this._roomAnchorList.filter((function(t){return e.indexOf(t)<0}));i.length>0&&this._handleNewJoinedAnchor(i,t),n.length>0&&this._handleLeftedAnchor(n,t)}}),Object.defineProperty(t.prototype,"_handleNewJoinedAnchor",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;(r=this._roomAnchorList).push.apply(r,d([],l(e),!1)),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorJoin",list:e}),t),this._callAppListener("onAnchorJoin",e)}}),Object.defineProperty(t.prototype,"_handleLeftedAnchor",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i=this;return c(this,(function(o){switch(o.label){case 0:return this._roomAnchorList=this._roomAnchorList.filter((function(t){return!e.includes(t)})),r=[],e.forEach((function(e){r.push.apply(r,d([],l(i.getRemoteTracksByUserId(e)),!1)),delete i._roomAnchorRes[e]})),r.length?[4,this.unsubscribe(r)]:[3,2];case 1:o.sent(),r.forEach((function(e){return delete i._remoteTracks[e.getTrackId()]})),o.label=2;case 2:return this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorLeave",list:e}),t),this._callAppListener("onAnchorLeave",e),[2]}}))}))}}),Object.defineProperty(t.prototype,"_diffRoomResource",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,o,a=this;return c(this,(function(s){return r=[],i=[],o=[],e.forEach((function(e){var t=dt(e),i=_t(t),n=i.tag,s=i.mediaType,c=[a._roomId,n,s].join("_"),u=JSON.parse(e.uri).ssrc;if(a._store.setTrackIdSSRCMap(u,c),!a._remoteTracks[c]){var l=s===exports.RCMediaType.AUDIO_ONLY?new it(a._logger,n,"",a._roomId):new nt(a._logger,n,"",a._roomId);r.push(l),a._remoteTracks[c]=l,a._roomRes[l.getTrackId()]=e}o.push(c)})),Object.keys(this._remoteTracks).forEach((function(e){o.indexOf(e)<0&&a._remoteTracks[e].isMCUTrack()&&i.push(a._remoteTracks[e])})),r.length>0&&(this._logger.info(n.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)),i.length>0&&this._onUserUnpublish(i,"onTrackUnpublish",t),[2]}))}))}}),Object.defineProperty(t.prototype,"_dealPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d=this;return c(this,(function(c){switch(c.label){case 0:return i=e.map(dt),a=[],s=[],t.forEach((function(t){var r=dt(t),n=i.indexOf(r),o=_t(r),c=o.userId,u=o.tag,l=o.mediaType,_=JSON.parse(t.uri).ssrc;d._store.setTrackIdSSRCMap(_,r),n>-1?e[n]=t:e.push(t);var p=d._remoteTracks[r];d._roomRes[r]=t,p?p.isSubscribed()&&a.push(p):(p=l===exports.RCMediaType.AUDIO_ONLY?new it(d._logger,u,c):new nt(d._logger,u,c),d._remoteTracks[r]=p,s.push(p)),p.__innerSetRemoteMuted(0===t.state)})),a.length?(u=a.map((function(e){return e.getTrackId()})),[4,ms((function(){return d._subscribeHandle(a,!0)}))]):[3,2];case 1:(l=c.sent().code)!==exports.RCRTCCode.SUCCESS&&this._logger.error(n.L_RESUB_REPUB_RES_R,JSON.stringify({status:o.FAILED,trackIds:u,code:l})),c.label=2;case 2:return this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorTrackPublish",trackIds:s.map((function(e){return e.getTrackId()}))}),r),this._callAppListener("onAnchorTrackPublish",s),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s=this;return c(this,(function(c){switch(c.label){case 0:for(i=t.map(dt),n=e.length-1;n>=0;n-=1)o=e[n],i.includes(dt(o))&&e.splice(n,1);return a=t.map((function(e){var t=dt(e);return s._remoteTracks[t]})),[4,this._onUserUnpublish(a,"onAnchorTrackUnpublish",r)];case 1:return c.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealModified",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,o,a=e.map(dt);try{for(var s=u(t),c=s.next();!c.done;c=s.next()){var l=c.value,d=dt(l);e[a.indexOf(d)].state=l.state;var _=this._remoteTracks[d];_.__innerSetRemoteMuted(0===l.state);var p=_.isAudioTrack()?"onAudioMuteChange":"onVideoMuteChange";this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:p,trackId:_.getTrackId()}),r),this._callAppListener(p,_)}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}}),Object.defineProperty(t.prototype,"_diffAnchorResource",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return i=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),n=ht(i,e),o=n.publishedList,a=n.unpublishedList,s=n.modifiedList,o.length?[4,this._dealPublished(i,o,r)]:[3,2];case 1:c.sent(),c.label=2;case 2:return a.length?[4,this._dealUnpublished(i,a,r)]:[3,4];case 3:c.sent(),c.label=4;case 4:return s.length&&this._dealModified(i,s,r),[2]}}))}))}}),Object.defineProperty(t.prototype,"_onUserUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i=this;return c(this,(function(o){switch(o.label){case 0:return[4,this.unsubscribe(e)];case 1:return o.sent(),e.forEach((function(e){i._subscribedList=i._subscribedList.filter((function(t){return t.track.getTrackId()!==e.getTrackId()})),delete i._roomRes[e.getTrackId()],e.__innerDestroy(),delete i._remoteTracks[e.getTrackId()]})),this._logger.info(n.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(t.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,d([],l(r),!1))}catch(e){this._logger.error(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify(e))}}}),Object.defineProperty(t.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){return[2,ms((function(){return s(e,void 0,void 0,(function(){var e,t,r,i,n,o,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return[4,this._createSubscribeParams(this._subscribedList,{},!0)];case 1:return e=c.sent().reqBody,[4,this._exchangeHandle(e)];case 2:return(t=c.sent()).code!==exports.RCRTCCode.SUCCESS?[2,{code:t.code}]:(r=t.data,i=r.sdp,(n=r.resultCode)!==exports.RCRTCCode.SUCCESS?[2,{code:n}]:(this._pc.clearReTryExchangeTimer(),(o=this._subscribedList.filter((function(e){return e.track.isMCUTrack()}))).length>0&&(a=o[0].track.getTrackId(),s=null===(l=this._roomRes[a])||void 0===l?void 0:l.msid,u=[this._roomId,"RongCloudRTC"].join("_"),i.sdp=i.sdp.replace(new RegExp(s,"g"),u)),[4,this._pc.setRemoteAnswer(i.sdp)]));case 3:return[2,{code:c.sent()}]}}))}))}),"audience-retry-exchange")]}))}))}}),Object.defineProperty(t.prototype,"_createSubscribeParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a=this;return c(this,(function(s){switch(s.label){case 0:return[4,this._pc.createOffer(r)];case 1:return i=s.sent(),n={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;i.sdp=null===(a=i.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?ut(c):Ts,d=l.width,_=l.height,p=l.frameRate;n.resolutionInfo.push({trackId:c.id,simulcast:u?Xn.NORMAL:Xn.TINY,resolution:"".concat(d,"x").concat(_)});var f=De(d,_),h=Ue(p);o.min+=f.minBitrate*h,o.max+=f.maxBitrate*h}}))})),[2,{reqBody:{sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map((function(e){return{simulcast:e.subTiny?Xn.TINY:Xn.NORMAL,resolution:"",uri:a._roomRes[e.track.getTrackId()].uri}}))},dynamicBitrate:o,offer:i}]}}))}))}}),Object.defineProperty(t.prototype,"_subscribeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return void 0===r&&(r=!1),void 0===i&&(i=!1),s(this,void 0,void 0,(function(){var s,u,l,d,_,p;return c(this,(function(c){return s=Date.now(),u=i?oa.SUB:void 0,l=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:t.map(At),forceReq:r}),l),this._assertRoomDestroyed()?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),l),this._reportPubOrSubQualityData(s,t,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,u),[2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}]):e.validate("tracks",t,(function(){return e.isArray(t)&&t.length>0&&t.every((function(e){return e instanceof rt||e.track instanceof rt}))}),!0)?(this._pc.__reportR3R4ToPolaris(),this._pc.registerReportListener(this._reportListener),this._addPeerCEvent(),d=this._subscribedList.map((function(e){return a({},e)})),_=t.map((function(e){return e instanceof rt?{track:e}:e})),p=[],_.forEach((function(e){var t=e.track.getTrackId();p.push(t);var r=d.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:d.push(e))})),this._polarisReport.sendR2(Jo.SUBSCRIBE,Go.BEGIN,p),[2,this._updateSubListHandle(d,l,s,u,!0)]):(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),l),this._reportPubOrSubQualityData(s,t,exports.RCRTCCode.PARAMS_ERROR,u),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),Object.defineProperty(t.prototype,"_addPeerCEvent",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._pc.on(Po.__INNER_EVENT_TRACK_READY__,(function(t){var r=t.streams[0].id,i=t.receiver.track,o=[r,"audio"===i.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),a=e._remoteTracks[o];a?(a.__innerSetMediaStreamTrack(i),e._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackReady",trackId:a.getTrackId()})),e._callAppListener("onTrackReady",a)):e._logger.warn(n.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O,"cannot found RCRemoteTrack: ".concat(i.id))})),this._pc.once(Po.__INNER_ICE_CONNECTED__,(function(){e._reportMediaActionLogger.reportIceFirstConnectData("sub")}),this),this._pc.on(Po.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,i=t.time,n=t.iceCandidatePair;n&&e._reportMediaActionLogger.recordQualityIceStatusData(n,r,i)}))}}),Object.defineProperty(t.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:exports.RTCMode.LIVE,UserId:e,"Session-Id":this._sessionId,"Client-Session-Id":this._clientSessionId}}}),Object.defineProperty(t.prototype,"_exchangeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}}),Object.defineProperty(t.prototype,"_dealSubscribeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,a=this,s=null==t?void 0:t.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),c=e.filter((function(e){if(e.track.isMCUTrack()){var t=a._roomRes[e.track.getTrackId()],r="".concat(t.msid,"_").concat(t.mediaType);return s.includes(r)}return null==s?void 0:s.includes(e.track.getTrackId())})),u=null==c?void 0:c.map((function(e){return"".concat(e.track.getTrackId())})),_=e.filter((function(e){return!(null==u?void 0:u.includes(e.track.getTrackId()))})),p=function(e){var t=c.some((function(t){return t.track.getTrackId()===e}));f._remoteTracks[e].__innerSetSubscribed(t)},f=this;for(var h in this._remoteTracks)p(h);return(i=this._subscribedList).splice.apply(i,d([0,this._subscribedList.length],l(c),!1)),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.SUCCESSED,subSuccessTrackIds:s,failedList:_}),r),_}}),Object.defineProperty(t.prototype,"_getParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.map((function(e){return e instanceof rt?{track:e}:a({},e)})),r={};return t=t.filter((function(e){var t=e.track.getTrackId();return!r[t]&&(r[t]=!0,!0)})).map((function(e){return a({},e)}))}}),Object.defineProperty(t.prototype,"_reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){i&&this._reportMediaActionLogger.reportPubOrSubQualityData(i,e,t,r,this._trackMediaMap)}}),Object.defineProperty(t.prototype,"_updateSubListHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,u){var l;return void 0===u&&(u=!1),s(this,void 0,void 0,(function(){var s,d,_,p,f,h,R,b,g,m,C,v,T=this;return c(this,(function(c){switch(c.label){case 0:return this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T,JSON.stringify({trackIds:e.map(At),forceReq:u}),t),s=this._getParams(e),d=this._subscribedList.map((function(e){return a({},e)})),u||ma(s,d)?(this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(s.map((function(e){return e.track}))),[4,this._createSubscribeParams(s,{},!1)]):(this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.SUCCESSED,msg:"repeat subscribe"}),t),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return _=c.sent().reqBody,[4,this._exchangeHandle(_)];case 2:return p=c.sent(),d.length&&(f=[],d.forEach((function(e){f.push(e.track.getTrackId())})),null===(l=this._pc.reportParser)||void 0===l||l.clearLatestPacketsRecv(f)),e.forEach((function(e){var t=e instanceof rt?e.getTrackId():e.track.getTrackId();T._trackMediaMap[t]=p.qualityMsList||[]})),p.code!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(r,e,p.code,i),this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.FAILED,code:p.code}),t),[2,{code:p.code}]):(h=p.data,R=h.sdp,b=h.resultCode,g=h.message,m=h.subscribedList,b!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(r,e,b,i),this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.FAILED,code:b,msg:g}),t),[2,{code:b}]):(s.forEach((function(e){var t=e.track;if(t.isMCUTrack()){var r=T._roomRes[t.getTrackId()].msid,i=_t(t.getTrackId()),n=i.tag,o=[i.userId,n].join("_");R.sdp=R.sdp.replace(new RegExp(r,"g"),o)}})),[4,this._pc.setRemoteAnswer(R.sdp)]));case 3:return C=c.sent(),this._reportPubOrSubQualityData(r,e,C,i),C!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.FAILED,code:C,msg:"set remote answer error"}),t),[2,{code:C}]):[2,(v=this._dealSubscribeResult(s,m,t)).length?{code:exports.RCRTCCode.SUCCESS,failedList:v}:{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"_diffCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,o;return c(this,(function(a){return this._CDNUris.url&&!e.url?(this._logger.info(n.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(n.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,i=this._CDNUris.h&&e.h&&this._CDNUris.h!==e.h,o=this._CDNUris.fps&&e.fps&&this._CDNUris.fps!==e.fps,(r||i||o)&&(this._logger.info(n.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(t.prototype,"_getCDNPlayUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l,d,_,p,f,h,R,b,g,m,C;return c(this,(function(c){switch(c.label){case 0:return r=e.w,i=e.h,a=e.fps,s=this._initOptions.pullInnerCDNProtocol||exports.RCInnerCDNPullKind.FLV,u=this._initOptions.pullInnerCDNUseHttps===exports.RCInnerCDNPullIsHttps.NOT_HTTPS?exports.RCInnerCDNPullIsHttps.NOT_HTTPS:exports.RCInnerCDNPullIsHttps.HTTPS,this._CDNUris.url?(l={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._crtUserId,SessionId:this.getSessionId()},d=[],_=this._CDNUris,p=_.w,f=void 0===p?0:p,h=_.h,f/(void 0===h?1:h)>1?(r&&d.push("w=".concat(r)),i&&d.push("h=".concat(i))):(r&&d.push("h=".concat(r)),i&&d.push("w=".concat(i))),a&&d.push("fps=".concat(a)),d.push("kind=".concat(s)),d.push("is_https=".concat(u)),R=d.join("&"),b="".concat(this._CDNUris.url,"?"),R&&(b+=R),[4,this._service.getCDNResourceInfo(l,b,t)]):(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY,msg:"cdn_uris url is empty, the anchor need to open or push CDN"}),t),[2,{code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY}]);case 1:return g=c.sent(),m=g.code,C=g.res,m!==exports.RCRTCCode.SUCCESS?[2,{code:m}]:[2,{code:m,CDNPlayUrl:null==C?void 0:C.data.pull_url}]}}))}))}}),Object.defineProperty(t.prototype,"getCDNPlayUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l;return c(this,(function(c){return r=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T,JSON.stringify({resolution:e,fps:t}),r),e&&!gt(e)?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> resolution"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):t&&!mt(t)?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> fps"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(i=e?bt(e):{width:null,height:null},a=i.width,s=i.height,u=t?Ct(t):null,l={},a&&(l.w=a),s&&(l.h=s),u&&(l.fps=u),[2,this._getCDNPlayUrl(l,r)])}))}))}}),Object.defineProperty(t.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(r){return[2,ms((function(){return t._subscribeHandle(e,!1,!0)}),"audience-sub")]}))}))}}),Object.defineProperty(t.prototype,"__unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,s,u;return c(this,(function(c){return r=Date.now(),i=oa.UNSUB,s=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T,JSON.stringify({trackIds:t.map((function(e){return e.getTrackId()}))}),s),this._assertRoomDestroyed()?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),s),[2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}]):e.validate("tracks",t,(function(){return e.isArray(t)&&t.length>0&&t.every((function(e){return e instanceof rt}))}),!0)?(u=this._subscribedList.map((function(e){return a({},e)})).filter((function(e){return t.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),this._polarisReport.sendR2(Jo.SUBSCRIBE,Go.END,t.map((function(e){return e.getTrackId()}))),[2,this._updateSubListHandle(u,s,r,i,!1)]):(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),Object.defineProperty(t.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(r){return[2,ms((function(){return t.__unsubscribe(e)}),"audience-unsub")]}))}))}}),Object.defineProperty(t.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return s(this,void 0,void 0,(function(){return c(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(t.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._remoteTracks[e]}}),Object.defineProperty(t.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return{}}}),Object.defineProperty(t.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T,void 0,t),[4,this._context.joinLivingRoomAsAudience(this._roomId,exports.RTCMode.LIVE)];case 1:return r.sent().code!==e.ErrorCode.SUCCESS&&this._logger.error(n.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(o.FAILED),t),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(o.SUCCESSED),t),[2]}}))}))}}),Object.defineProperty(t.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._appListener=e}}),Object.defineProperty(t.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),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._crtUserId}}),Object.defineProperty(t.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(t.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomAnchorList}}),Object.defineProperty(t.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];for(var r in this._remoteTracks){var i=this._remoteTracks[r];i.getUserId()===e&&t.push(i)}return t}}),Object.defineProperty(t.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[],r=[];for(var i in this._remoteTracks){if(2===r.length)break;var n=this._remoteTracks[i];n.isMCUTrack()&&r.push(n)}return this._roomAnchorList.forEach((function(r){t.push.apply(t,d([],l(e.getRemoteTracksByUserId(r)),!1))})),d(d([],l(r),!1),l(t),!1)}}),Object.defineProperty(t.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(t.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(t.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(t.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._clientSessionId}}),t}();!function(e){e[e.AUTOMATIC=0]="AUTOMATIC",e[e.MANUAL=1]="MANUAL"}(vs||(vs={}));var Ss,Es,Is=function(){function t(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(t.prototype,"_getMediaStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t="getUserMedia"),s(this,void 0,void 0,(function(){var r,i,o;return c(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),r=this.setConstraintsConfig(e),[4,navigator.mediaDevices[t](r)];case 1:return i=a.sent(),[2,{code:exports.RCRTCCode.SUCCESS,stream:i}];case 2:return o=a.sent(),this._logger.error(n.L_GET_MEDIA_STREAM_E,JSON.stringify({name:o.name,message:o.message})),"Permission denied"===o.message?[2,{code:exports.RCRTCCode.BROWSER_PERMISSION_DENIED}]:"Permission denied by system"===o.message?[2,{code:exports.RCRTCCode.SYSTEM_PERMISSION_DENIED}]:[3,3];case 3:return[2,{code:"getUserMedia"===t?exports.RCRTCCode.GET_USER_MEDIA_FAILED:exports.RCRTCCode.GET_DISPLAY_MEDIA_FAILED}]}}))}))}}),Object.defineProperty(t.prototype,"_getMediaStreamErrorReason",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="";return e===exports.RCRTCCode.BROWSER_PERMISSION_DENIED&&(t="Permission denied"),e===exports.RCRTCCode.SYSTEM_PERMISSION_DENIED&&(t="Permission denied by system"),t}}),Object.defineProperty(t.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 i=null===(r=(t=navigator.mediaDevices).getSupportedConstraints)||void 0===r?void 0:r.call(t);(null==i?void 0:i.noiseSuppression)&&(e.audio.noiseSuppression=!!i.noiseSuppression),(null==i?void 0:i.autoGainControl)&&(e.audio.autoGainControl=!!i.autoGainControl),(null==i?void 0:i.echoCancellation)&&(e.audio.echoCancellation=!!i.echoCancellation),this._logger.info(n.L_SET_AUDIO_CONSTRAINTS_O,"browser supported -> ".concat(JSON.stringify(i)))}return e}}),Object.defineProperty(t.prototype,"createMicrophoneAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="RongCloudRTC"),s(this,void 0,void 0,(function(){var r,i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return st(e)?(r=this._context.getCurrentId())?[4,this._getMediaStream({audio:{deviceId:(null==t?void 0:t.micphoneId)?{exact:null==t?void 0:t.micphoneId}:void 0,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(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return i=c.sent(),a=i.stream,(s=i.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:s,msg:this._getMediaStreamErrorReason(s)})),[2,{code:s}]):(u=a.getAudioTracks()[0],l=new Xe(this._logger,e,r,u),this._logger.info(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:l.getTrackId()})),[2,{code:s,track:l}])}}))}))}}),Object.defineProperty(t.prototype,"createCameraVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="RongCloudRTC"),s(this,void 0,void 0,(function(){var r,i,a,s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return st(e)?(r=this._context.getCurrentId())?(i=gt(null==t?void 0:t.resolution)?t.resolution:exports.RCResolution.W640_H480,a=bt(i),s=a.width,u=a.height,[4,this._getMediaStream({video:{deviceId:(null==t?void 0:t.cameraId)?{exact:null==t?void 0:t.cameraId}:void 0,frameRate:Ct((null==t?void 0:t.frameRate)||exports.RCFrameRate.FPS_15),width:{ideal:s,max:s},height:{ideal:u,max:u},facingMode:null==t?void 0:t.faceMode}})]):(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return l=c.sent(),d=l.stream,(_=l.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:_,msg:this._getMediaStreamErrorReason(_)})),[2,{code:_}]):(p=d.getVideoTracks()[0],[4,this._applyVideoAspectRatio(p,s,u)]);case 2:return c.sent(),f=new $e(this._logger,e,r,p),this._logger.info(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:f.getTrackId()})),[2,{code:_,track:f}]}}))}))}}),Object.defineProperty(t.prototype,"createMicrophoneAndCameraTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return void 0===e&&(e="RongCloudRTC"),s(this,void 0,void 0,(function(){var i,a,s,u,l,d,_,p,f,h,R,b,g,m;return c(this,(function(c){switch(c.label){case 0:return i=[],st(e)?(a=this._context.getCurrentId())?(s=gt(null===(r=null==t?void 0:t.video)||void 0===r?void 0:r.resolution)?t.video.resolution:exports.RCResolution.W640_H480,u=bt(s),l=u.width,d=u.height,_=null==t?void 0:t.audio,p=null==t?void 0:t.video,[4,this._getMediaStream({video:{deviceId:(null==p?void 0:p.cameraId)?{exact:null==p?void 0:p.cameraId}:void 0,frameRate:Ct((null==p?void 0:p.frameRate)||exports.RCFrameRate.FPS_15),width:{ideal:l,max:l},height:{ideal:d,max:d},facingMode:null==p?void 0:p.faceMode},audio:{deviceId:(null==_?void 0:_.micphoneId)?{exact:null==_?void 0:_.micphoneId}:void 0,sampleRate:null==_?void 0:_.sampleRate,noiseSuppression:null==_?void 0:_.noiseSuppression,echoCancellation:null==_?void 0:_.echoCancellation,autoGainControl:null==_?void 0:_.autoGainControl}})]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:i}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:i}]);case 1:if(f=c.sent(),h=f.stream,(R=f.code)!==exports.RCRTCCode.SUCCESS)return this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.FAILED,code:R,msg:this._getMediaStreamErrorReason(R)})),[2,{code:R,tracks:i}];b=h.getTracks(),g=0,c.label=2;case 2:return g<b.length?"video"!==(m=b[g]).kind?[3,4]:[4,this._applyVideoAspectRatio(m,l,d)]:[3,6];case 3:return c.sent(),i.push(new $e(this._logger,e,a,m)),[3,5];case 4:i.unshift(new Xe(this._logger,e,a,m)),c.label=5;case 5:return g++,[3,2];case 6:return this._logger.info(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.SUCCESSED,trackIds:i.map((function(e){return e.getTrackId()}))})),[2,{code:R,tracks:i}]}}))}))}}),Object.defineProperty(t.prototype,"createScreenVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return[4,this._createScreenTracks(e,!1,n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,t)];case 1:return(r=i.sent()).code===exports.RCRTCCode.SUCCESS?[2,{code:r.code,track:r.tracks[0]}]:[2,r]}}))}))}}),Object.defineProperty(t.prototype,"createScreenWithAudioTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),s(this,void 0,void 0,(function(){return c(this,(function(r){return[2,this._createScreenTracks(e,!0,n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O,t)]}))}))}}),Object.defineProperty(t.prototype,"_createScreenTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d,_,p,f,h,R,b,g;return c(this,(function(c){switch(c.label){case 0:return st(e)?(a=this._context.getCurrentId())?Ot()?(s=/macintosh|mac os x/i.test(navigator.userAgent),u=(!this._isElectron||!s)&&t,l=gt(null==i?void 0:i.resolution)?i.resolution:exports.RCResolution.W1280_H720,this._isElectron?[4,this._createElectronScreenStream(t,r,l,null==i?void 0:i.chromeMediaSourceId)]:[3,2]):(this._logger.error(n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),[2,{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT}]):(this._logger.error(r,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(r,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return f=c.sent(),[3,4];case 2:return[4,this._createWebScreenStream(t,l,null==i?void 0:i.frameRate)];case 3:f=c.sent(),c.label=4;case 4:return _=(d=f).stream,(p=d.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(r,JSON.stringify({status:o.FAILED,code:p,msg:this._getMediaStreamErrorReason(p)})),[2,{code:p}]):(h=_.getVideoTracks()[0],R=new et(this._logger,e,a,h),b=[R],u&&(g=_.getAudioTracks()[0])&&b.push(new tt(this._logger,e,a,g)),this._logger.info(r,JSON.stringify({status:o.SUCCESSED,trackIds:b.map((function(e){return e.getTrackId()}))})),[2,{code:p,tracks:b}])}}))}))}}),Object.defineProperty(t.prototype,"_createElectronScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n){var a,u;return s(this,void 0,void 0,(function(){var s,l,d,_,p,f,h;return c(this,(function(c){return s=/macintosh|mac os x/i.test(navigator.userAgent),this._isElectron&&s&&t&&this._logger.warn(r,JSON.stringify({status:o.INFO,code:exports.RCRTCCode.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO,msg:"mac in electron not support screen share with audio"})),l=(!this._isElectron||!s)&&t,!this._isElectron||e.isUndefined(n)||e.isString(n)?(d=bt(i),_=d.width,p=d.height,f={mandatory:{chromeMediaSourceId:n,chromeMediaSource:"desktop",minWidth:_,maxWidth:_,minHeight:p,maxHeight:p}},!n&&this._isElectron&&(null===(a=f.mandatory)||void 0===a||delete a.chromeMediaSourceId),h=null,l&&this._isElectron&&(null===(u=f.mandatory)||void 0===u||delete u.chromeMediaSourceId,h={mandatory:{chromeMediaSource:"desktop"}}),[2,this._getMediaStream({video:f,audio:h||l},"getUserMedia")]):(this._logger.error(r,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.chromeMediaSourceId type is string"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),Object.defineProperty(t.prototype,"_createWebScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a;return c(this,(function(s){return i=bt(t),n=i.width,o=i.height,a={frameRate:Ct(r||exports.RCFrameRate.FPS_15),width:n,height:o},[2,this._getMediaStream({video:a,audio:e},"getDisplayMedia")]}))}))}}),Object.defineProperty(t.prototype,"createLocalAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(a){return st(e)?t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind?(r=this._context.getCurrentId())?(i=new ze(this._logger,e,r,t),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:i.getTrackId()})),[2,{code:exports.RCRTCCode.SUCCESS,track:i}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not audio"})),[2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}])}))}))}}),Object.defineProperty(t.prototype,"createLocalVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(a){return st(e)?t&&t instanceof MediaStreamTrack&&"video"===t.kind?(r=this._context.getCurrentId())?(i=new Ye(this._logger,e,r,t),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:i.getTrackId()})),[2,{code:exports.RCRTCCode.SUCCESS,track:i}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not video"})),[2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}])}))}))}}),Object.defineProperty(t.prototype,"_validateCreateLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(!st(t))return this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),{code:exports.RCRTCCode.INVALID_TAGS,tracks:[]};if(!Tt())return this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,tracks:[]};var i=r instanceof File?URL.createObjectURL(r):r;return e.isHttpUrl(i)||/^blob:/.test(i)?this._context.getCurrentId()?{code:exports.RCRTCCode.SUCCESS,tracks:[],url:i}:(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),{code:exports.RCRTCCode.INVALID_USER_ID,tracks:[]}):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> file"})),{code:exports.RCRTCCode.PARAMS_ERROR,tracks:[]})}}),Object.defineProperty(t.prototype,"createLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i){return s(this,void 0,void 0,(function(){var a,s,u=this;return c(this,(function(c){return(a=this._validateCreateLocalFileTracks(e,r)).code!==exports.RCRTCCode.SUCCESS?[2,a]:(s=this._context.getCurrentId(),[2,new Promise((function(r){var c=document.createElement("video");(null==i?void 0:i.withoutAudio)&&(c.muted=!0),c.onloadedmetadata=function(){var a,d=[];try{var _=c.mozCaptureStream?"mozCaptureStream":"captureStream";a=c[_]()}catch(e){u._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"captureSteam error -> ".concat(JSON.stringify(e))})),r({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:d})}var p=l(t.getTracksWithOptions(a,i),2),f=p[0],h=p[1];f&&d.push(new Qe(u._logger,e,s,f,c)),h&&d.push(new Ze(u._logger,e,s,h,c)),0===d.length&&(c.pause(),c.src=""),c.onerror=null,u._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.SUCCESSED,trackIds:d.map((function(e){return e.getTrackId()}))})),r({code:exports.RCRTCCode.SUCCESS,tracks:d})},c.onerror=function(){u._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"Failed to create file stream, video onerror"})),r({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:[]})},c.src=a.url,c.loop=!0,c.play()}))])}))}))}}),Object.defineProperty(t.prototype,"createLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i){return s(this,void 0,void 0,(function(){var a,s,u,d,_;return c(this,(function(c){return a=[],st(e)?r instanceof MediaStream?(s=this._context.getCurrentId())?(u=l(t.getTracksWithOptions(r,i),2),d=u[0],_=u[1],d&&a.push(new ze(this._logger,e,s,d)),_&&a.push(new Ye(this._logger,e,s,_)),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.SUCCESSED,trackIds:a.map((function(e){return e.getTrackId()}))})),[2,{code:exports.RCRTCCode.SUCCESS,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> stream"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:a}])}))}))}}),Object.defineProperty(t,"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}}),Object.defineProperty(t.prototype,"_applyVideoAspectRatio",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:if(i=e.getSettings(),s=i.width,u=i.height,s===t&&u===r)return[2];l=t/r>=1?{width:{ideal:s,max:s}}:{height:{ideal:u,max:u}},c.label=1;case 1:return c.trys.push([1,3,,4]),[4,e.applyConstraints(a(a({},l),{aspectRatio:{ideal:t/r}}))];case 2:return c.sent(),this._logger.info(n.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O,JSON.stringify({status:o.SUCCESSED,msg:"apply aspectRatio success -> ".concat(t," / ").concat(r)})),[3,4];case 3:return d=c.sent(),this._logger.warn(n.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O,JSON.stringify({status:o.FAILED,msg:"apply aspectRatio error -> ".concat(JSON.stringify(d))})),[3,4];case 4:return[2]}}))}))}}),t}(),ys=function(t){function i(e,r,i){var n=t.call(this,e)||this;return Object.defineProperty(n,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(n,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(n,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_crtRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"_audience",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"_crtAudienceLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),So.setSdpSemantics(i.sdpSemantics||"unified-plan",n._logger),n._service=new eo(n._runtime,n._context,n._options.mediaServer,n._options.timeout),n._context.registerConnectionStateChangeListener(n._onIMStatusChange.bind(n)),n._context.registerDestroyListener(n._onIMUninit.bind(n)),n._context.registerMessageListener(n._handleMessage.bind(n)),n._context.getPluginContext().onnavidatachange=n.naviDataChange.bind(n),n}return r(i,t),Object.defineProperty(i.prototype,"_handleMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(t.conversationType!==e.ConversationType.RTC_ROOM)return!1;var r=this._logger.createTraceId();this._crtRoom instanceof hs&&this._getJoinedPKRoomList().forEach((function(e){e.__parseInnerMessage(t,r)}));return this._logger.info(n.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:o.SUCCESSED,message:t}),r),this._crtRoom?(this._crtRoom.__parseInnerMessage(t,r),!0):(this._logger.warn(n.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:o.FAILED,message:"the crtRoom is empty"}),r),!0)}}),Object.defineProperty(i.prototype,"naviDataChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_RTC_CLIENT_NAVI_CHANGE_O,"on navi change data => ".concat(JSON.stringify(e))),this._service.clearMSList(),this._service.isNededDetector()&&this._service.detectorMediaSever()}}),Object.defineProperty(i.prototype,"_getJoinedPKRoomList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._crtRoom.getRoomPKHandler(),t=e.code,r=e.roomPKHandler;if(t===exports.RCRTCCode.SUCCESS&&r){var i=r.getJoinedPKRooms()||{};return Object.values(i)}return[]}}),Object.defineProperty(i.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(i.prototype,"joinCrossRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return void 0===n&&(n=exports.RTCMode.CROSS_MUTI),s(this,void 0,void 0,(function(){return c(this,(function(i){return console.warn("joinCrossRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{joinType:t,userData:r,mode:exports.RTCMode.CROSS_MUTI})]}))}))}}),Object.defineProperty(i.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return void 0===n&&(n=exports.RTCMode.RTC),s(this,void 0,void 0,(function(){return c(this,(function(i){return console.warn("joinRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{mode:n,joinType:t,userData:r})]}))}))}}),Object.defineProperty(i.prototype,"joinRTCRoomWithOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a,s=this;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_JOIN_RTC_ROOM_T,JSON.stringify({roomId:e,options:t}),r),this._crtRoom?(this._logger.error(n.L_RTC_CLIENT_JOIN_RTC_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(i=this._crtRoom=new Rs(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)||exports.RTCMode.RTC,null==t?void 0:t.joinType,void 0,void 0,null==t?void 0:t.userData,r,null==t?void 0:t.nickName)];case 1:return(a=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._crtRoom=null,[2,{code:a}]):(i.once(es,(function(){s._crtRoom=null})),[2,{code:a,room:i,userIds:i.getRemoteUserIds(),tracks:i.getRemoteTracks()}])}}))}))}}),Object.defineProperty(i.prototype,"joinLivingRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,a){return s(this,void 0,void 0,(function(){var a,s,u,l,d=this;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_T,JSON.stringify({roomId:e,livingType:t,joinType:r,outerUserDatas:i}),a),this._crtRoom?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly -> roomId: ".concat(e)}),a),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(s=this._crtRoom=new hs(this._context,this._runtime,e,this._service,this._options,t,!1,!0)).__innerInit(exports.RTCMode.LIVE,r,t,void 0,i,a)];case 1:return(u=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._crtRoom=null,[2,{code:u}]):(s.once(es,(function(){d._crtRoom=null})),l={code:u,room:s,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()},s.__getCDNPushMode()===vs.MANUAL&&Object.assign(l,{CDNEnable:s.__getCDNEnable()}),[2,l])}}))}))}}),Object.defineProperty(i.prototype,"getAudienceClient",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._audience||(this._audience=new Cs(this._context,this._runtime,this._options)),this._logger.info(n.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O),this._audience}}),Object.defineProperty(i.prototype,"_onIMStatusChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(this._logger.info(n.L_RTC_CLIENT_IM_CONNECTION_STATE_S,JSON.stringify({status:t,code:r,desc:e.RCConnectionStatus[t]})),t===e.RCConnectionStatus.SUSPENDED&&r===e.ErrorCode.RC_CONN_REDIRECTED&&this._service.clearMSList(),t===e.RCConnectionStatus.DISCONNECTED){if(this._crtRoom){var i=exports.RCKickReason.IM_DISCONNECTED;r===e.ErrorCode.RC_DISCONN_KICK?i=exports.RCKickReason.OTHER_CLIENT_IM_CONNECTED:2===r&&(i=exports.RCKickReason.IM_LOGOUT),this._crtRoom.__kickoff(!0,{users:[{userId:this._context.getCurrentId(),type:i}]})}}else if(t===e.RCConnectionStatus.CONNECTED){if(this._service.isNededDetector()&&this._service.detectorMediaSever(),this._crtRoom instanceof hs)this._getJoinedPKRoomList().forEach((function(e){e.__onReconnected()}));this._crtRoom&&this._crtRoom.__onReconnected()}}}),Object.defineProperty(i.prototype,"_onIMUninit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this._logger.info(n.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(i.prototype,"leaveRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_LEAVE_ROOM_T,JSON.stringify({roomId:e.getRoomId()}),r),this._crtRoom?[4,this._crtRoom.__destroy(!0)]:(this._logger.warn(n.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:o.FAILED,msg:"Room does not exist, without leave"}),r),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return i.sent(),this._service.isNededDetector()&&this._service.detectorMediaSever(),this._logger.info(n.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:o.SUCCESSED,roomId:null===(t=this._crtRoom)||void 0===t?void 0:t.getRoomId()}),r),this._crtRoom=null,[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"joinLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:t,livingType:r}),i),this._service.isNededDetector()&&this._service.detectorMediaSever(),yt(this._context.getNaviInfo())?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),i),[2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR}]):e.validate("roomId",t,e.notEmptyString,!0)&&e.validate("livingType",r,(function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO}))?this._crtAudienceLivingRoom?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),i),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):this._service.getMsList().length?[4,this._context.joinLivingRoomAsAudience(t,exports.RTCMode.LIVE,r)]:(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),i),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}]):(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId or livingType"}),i),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return a=c.sent(),s=a.code,u=a.data,s!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:s,msg:"signal error -> audience join room"}),i),[2,{code:exports.RCRTCCode.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED}]):(l=zn(),d=new Os(this._context,this._runtime,this._options,t,u,r,l),this._crtAudienceLivingRoom=d,this._logger.info(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.SUCCESSED,roomData:u}),i),[2,{room:d,code:exports.RCRTCCode.SUCCESS,userIds:d.getRemoteUserIds(),RTCTracks:d.getRemoteRTCTracks(),MCUTracks:d.getRemoteMCUTracks(),CDNUris:d.getCDNInfo()}])}}))}))}}),Object.defineProperty(i.prototype,"leaveLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(n.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(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),t),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):[4,this._crtAudienceLivingRoom.__destroy(!0)]:(this._logger.warn(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,msg:"Room does not exist, without leave"}),t),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return r.sent(),this._crtAudienceLivingRoom=null,this._logger.info(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.SUCCESSED}),t),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"upgradeToAnchorRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l=this;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T,void 0,r),e.validate("room",t,(function(){return t instanceof Os}),!0)?(i=t.getRoomId(),this._crtRoom?(this._logger.error(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly",roomId:i}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(a=this._crtRoom=new hs(this._context,this._runtime,i,this._service,this._options,t.livingType,!0,!0,t.getClientSessionId())).__innerInitByIdentityChange(r)]):(this._logger.error(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(this._crtRoom=null,[2,{code:s}]):(a.once(es,(function(){l._crtRoom=null})),[4,this._crtAudienceLivingRoom.__destroy(!1)]);case 2:return c.sent(),this._crtAudienceLivingRoom=null,u={room:a,code:exports.RCRTCCode.SUCCESS,userIds:a.getRemoteUserIds(),tracks:a.getRemoteTracks()},a.__getCDNPushMode()===vs.MANUAL&&Object.assign(u,{CDNEnable:a.__getCDNEnable()}),[2,u]}}))}))}}),Object.defineProperty(i.prototype,"downgradeToAudienceRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T,JSON.stringify({roomId:t._roomId,userId:this._context.getCurrentId()}),r),t.isMainRoom()?e.validate("room",t,(function(){return t instanceof hs}),!0)?this._crtAudienceLivingRoom?(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,this._context.rtcIdentityChange(t._roomId,ls.AnchorToViewer,t.getLivingType())]:(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"the `downgradeToAudienceRoom` is disabled in PK room"}),r),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}]);case 1:return i=c.sent(),a=i.code,s=i.data,a!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}),r),[2,{code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}]):(this._logger.info(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.SUCCESSED,roomData:s}),r),u=t.getClientSessionId(),l=new Os(this._context,this._runtime,this._options,t._roomId,s,t.getLivingType(),u),this._crtAudienceLivingRoom=l,this._crtRoom.__destroy(!1),this._crtRoom=null,[2,{room:l,code:exports.RCRTCCode.SUCCESS,userIds:l.getRemoteUserIds(),RTCTracks:l.getRemoteRTCTracks(),MCUTracks:l.getRemoteMCUTracks(),CDNUris:l.getCDNInfo()}])}}))}))}}),Object.defineProperty(i.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var t,r,i,a,s;return c(this,(function(c){switch(c.label){case 0:return t=this._logger.createTraceId(),r=this._context.getCurrentId(),this._logger.error(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T,JSON.stringify({userId:r}),t),[4,this._context.getRTCJoinedUserInfo(r)];case 1:return i=c.sent(),a=i.code,s=i.data,a!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:o.FAILED,code:a}),t),[2,{code:a}]):(this._logger.info(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:o.SUCCESSED,roomInfo:s}),t),[2,{code:exports.RCRTCCode.SUCCESS,data:s}])}}))}))}}),Object.defineProperty(i.prototype,"generateSummarization",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,u,l){return void 0===i&&(i=0),void 0===a&&(a=0),s(this,void 0,void 0,(function(){var s,d,_,p,f,h,R;return c(this,(function(c){switch(c.label){case 0:return s=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_T,JSON.stringify({roomId:t,taskId:r,startTime:i,endTime:a,config:u,contentBlock:l}),s),e.validate("roomId",t,e.notEmptyString,!0)?e.validate("taskId",r,e.notEmptyString,!0)?!e.isNumber(i)||i<0?(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> startTime"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):!e.isNumber(a)||a<0?(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> endTime"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):e.validate("config",u,e.isObject,!0)?(d=function(t){if("destLang"in t&&!e.isString(t.destLang))return{isValid:!1,key:"destLang"};if("customPrompt"in t&&!e.isString(t.customPrompt))return{isValid:!1,key:"customPrompt"};if("enableSummarization"in t&&!e.isBoolean(t.enableSummarization))return{isValid:!1,key:"enableSummarization"};if("enableSummarizationDetails"in t&&!e.isBoolean(t.enableSummarizationDetails))return{isValid:!1,key:"enableSummarizationDetails"};if("enableChapterSummary"in t&&!e.isBoolean(t.enableChapterSummary))return{isValid:!1,key:"enableChapterSummary"};if("enableTodoList"in t&&!e.isBoolean(t.enableTodoList))return{isValid:!1,key:"enableTodoList"};if("enableHashtag"in t&&!e.isBoolean(t.enableHashtag))return{isValid:!1,key:"enableHashtag"};if("format"in t&&void 0===exports.RCRTCGenerateSummarizationFormat[t.format])return{isValid:!1,key:"format"};var r=t.enableSummarization||t.enableSummarizationDetails||t.enableChapterSummary||t.enableTodoList||t.enableHashtag;return t.customPrompt||r?{isValid:!0,key:""}:{isValid:!1,key:"at least one of the summary features must be enabled"}}(u),_=d.isValid,p=d.key,_||this._logger.warn(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> config.".concat(p)}),s),[4,this._service.generateSummarization(t,r,i,a,u,l,s)]):(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> config"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> taskId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return f=c.sent(),h=f.code,R=f.msg,h!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:h,msg:R}),s),[2,{code:h}]):(this._logger.info(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.SUCCESSED}),s),[2,{code:h}])}}))}))}}),Object.defineProperty(i.prototype,"getASRContent",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,u,l){return void 0===i&&(i=0),void 0===a&&(a=0),s(this,void 0,void 0,(function(){var s,d,_,p;return c(this,(function(c){switch(c.label){case 0:return s=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_GET_ASR_CONTENT_T,JSON.stringify({roomId:t,taskId:r,startTime:i,endTime:a,destLang:l,contentBlock:u}),s),e.validate("roomId",t,e.notEmptyString,!0)?e.validate("taskId",r,e.notEmptyString,!0)?!e.isNumber(i)||i<0?(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> startTime"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):!e.isNumber(a)||a<0?(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> endTime"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):e.validate("destLang",l,e.isString,!1)?[4,this._service.getASRContent(t,r,i,a,u,s,l)]:(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> destLang"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> taskId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return d=c.sent(),_=d.code,p=d.msg,_!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:_,msg:p}),s),[2,{code:_}]):(this._logger.info(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.SUCCESSED}),s),[2,{code:_}])}}))}))}}),i}(Is);exports.RTCJoinType=void 0,(Ss=exports.RTCJoinType||(exports.RTCJoinType={}))[Ss.KICK=0]="KICK",Ss[Ss.REFUSE=1]="REFUSE";var Ls,As="rtcRJoin_data",Ps="rtcRExit",Ns="rtcRInfo",ws="rtcUData",Ds="rtcUDel",ks="rtcSetData",Us="userSetData",Ms="rtcQryData",xs="rtcDelData",js="rtcToken",Bs="rtcUserState",Vs="rtcUList",Fs="viewerJoinR",Js="viewerExitR",Gs="rtcPullKv",Hs="rtcIdentityChange",Ks="rtcInvite",Ws="rtcCancelInvite",zs="rtcInviteAnswer",Ys="rtcEndInvite",qs="rtcQueryJoined",Zs="rtcPullRoomStatus",Qs="reportsdk",Xs="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.AsrTextMsg="AsrTextMsg",e.AsrResTextMsg="AsrResTextMsg"}(Ls||(Ls={}));var $s,ec=((Es={})[Ls.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas","supportNtf"],Es[Ls.RtcOutput]=["version"],Es[Ls.RtcUserListOutput]=["users","token","sessionId","roomInfo","version"],Es[Ls.SetUserStatusInput]=["status"],Es[Ls.RtcSetDataInput]=["interior","target","key","value","objectName","content"],Es[Ls.RtcUserSetDataInput]=["valueInfo","objectName","content"],Es[Ls.RtcDataInput]=["interior","target","key","objectName","content"],Es[Ls.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],Es[Ls.MCFollowInput]=["state"],Es[Ls.RtcTokenOutput]=["rtcToken"],Es[Ls.RtcQryOutput]=["outInfo"],Es[Ls.RtcQryUserOutDataInput]=["userId"],Es[Ls.RtcUserOutDataOutput]=["user"],Es[Ls.RtcQueryListInput]=["order"],Es[Ls.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],Es[Ls.RtcValueInfo]=["key","value"],Es[Ls.RtcKeyDeleteInput]=["key"],Es[Ls.RtcNotifyMsg]=["type","time","roomId"],Es[Ls.RtcPullKV]=["timestamp","roomId"],Es[Ls.RtcKVOutput]=["entries","bFullUpdate","syncTime"],Es[Ls.RtcQueryUserJoinedInput]=["userId"],Es[Ls.RtcQueryUserJoinedOutput]=["info"],Es[Ls.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],Es[Ls.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],Es[Ls.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],Es[Ls.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],Es[Ls.RtcRoomStatusInput]=["version"],Es[Ls.RtcRoomStatusOutput]=["bFullStatus","version","usersData","roomStatus"],Es[Ls.RtcReportSDKInput]=["sdkInfo"],Es[Ls.RtcPBPolaris]=["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info"],Es[Ls.RtcPBR1Info]=["joinTime","rtcVersion","imVersion","platform","device","os","browserName","browserVersion"],Es[Ls.RtcPBR2Info]=["joinTime","sendTime","rtcActionType","rtcActionStatus","trackId"],Es[Ls.RtcPBR3Info]=["info"],Es[Ls.RtcPBR4Info]=["info"],Es[Ls.RtcPBStatusInfo]=["joinTime","receiveTime","totalBitRate","appCPUUsage","systemCPUUsage","systemCPUFrequency","networkStatus","googleRTTNetwork","ipAddress","useReceiveBroadBand","useSendBroadBand","packetLossCount","streams"],Es[Ls.RtcPBStreamInfo]=["trackId","codeName","volume","samplingRate","bitRate","packetLossRate","frameRate","resolution","blockTime","jitterData","nAckCount","pliCount","googleRTTTotalTime","isReceiveFirstFrameRate","codeType","isEnabled"],Es[Ls.AsrTextMsg]=["bms","t","isEnd","msgId","lang"],Es[Ls.AsrResTextMsg]=["type","uid","asr"],Es),tc="\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(Ls.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(Ls.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(Ls.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(Ls.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(Ls.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(Ls.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(Ls.RtcRoomStatusInput,"{ // rtc 和 living room 拉房间资源状态使用的参数\n required int64 version =1; //当前客户端最大的房间状态的version\n }\n message ").concat(Ls.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(Ls.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(Ls.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Ls.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(Ls.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(Ls.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n optional bool supportNtf = 9; //是否支持房间状态的变更通过通知拉取的方式获取\n }\n message ").concat(Ls.RtcQryOutput,"{\n repeated ").concat(Ls.RtcValueInfo," outInfo=1;\n }\n message ").concat(Ls.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(Ls.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(Ls.RtcUserSetDataInput," {\n repeated ").concat(Ls.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(Ls.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(Ls.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(Ls.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(Ls.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Ls.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(Ls.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Ls.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(Ls.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(Ls.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(Ls.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(Ls.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(Ls.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(Ls.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(Ls.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(Ls.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(Ls.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(Ls.RtcReportSDKInput,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n // ---- 北极星数据上报 -------\n message ').concat(Ls.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(Ls.RtcPBR1Info," r1Info = 10;\n optional ").concat(Ls.RtcPBR2Info," r2Info = 11;\n optional ").concat(Ls.RtcPBR3Info," r3Info = 12;\n optional ").concat(Ls.RtcPBR4Info," r4Info = 13;\n }\n message ").concat(Ls.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(Ls.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(Ls.RtcPBR3Info," {\n required ").concat(Ls.RtcPBStatusInfo," info = 1;\n }\n message ").concat(Ls.RtcPBR4Info," {\n required ").concat(Ls.RtcPBStatusInfo," info = 1;\n }\n message ").concat(Ls.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(Ls.RtcPBStreamInfo," streams = 13;\n }\n message ").concat(Ls.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 message ").concat(Ls.AsrTextMsg," {\n optional int32 bms = 1; //开始转写的时间(毫秒)\n optional string t = 2; //翻译的内容\n optional bool isEnd = 3; //是否监测到完整语句\n optional string msgId = 4; //该消息的ID, 跟转写的msgId 需要一样;\n optional string lang = 5; //翻译的目标语言码\n }\n message ").concat(Ls.AsrResTextMsg," {\n optional int32 type = 1; //1 为语音识别,后续会扩展其它类型\n required string uid = 2; //对应转写的用户Id\n repeated ").concat(Ls.AsrTextMsg," asr = 3; //识别出的结果列表\n }\n}\n"),rc=function(e,t,r,i,n,o,a){var s=n?Object.keys(n).map((function(t){return e.encode(Ls.RtcValueInfo,{key:t,value:n[t]},!0)})):void 0,c=o?Object.keys(o).map((function(t){return e.encode(Ls.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(Ls.RtcInput,{roomType:t,broadcastType:r,joinType:i,innerDatas:s,outerDatas:c,supportNtf:a})},ic=function(t,r){var i=t.decode(Ls.RtcUserListOutput,r),n=i.users,o=i.token,a=i.sessionId,s=i.roomInfo,c=i.entries,u=i.offlineKickTime,l=void 0===u?60:u,d=i.codeFormat,_=i.roomCreateTime,p=i.userJoinTime,f=i.version,h={};return e.forEach(n,(function(t){var r=t.userId,i=t.userData,n={};e.forEach(i,(function(e){var t=e.key,r=e.value;n[t]=r})),h[r]=n})),{users:h,token:o,sessionId:a,roomInfo:s,kvEntries:c,offlineKickTime:l,codeFormat:d,roomCreateTime:Pt(_),userJoinTime:Pt(p),version:f}};!function(e){e[e.SUBTITLE=1]="SUBTITLE",e[e.TRANSLATION=2]="TRANSLATION"}($s||($s={}));var nc,oc=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})}return Object.defineProperty(t.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n,o,a,u){return s(this,void 0,void 0,(function(){var s,l,d,_,p,f,h,R,b,g,m,C,v,T;return c(this,(function(c){switch(c.label){case 0:return s=rc(this.codec,r,i,n,o,a,u),[4,this.context.rtcSignaling(t,As,!0,s)];case 1:return l=c.sent(),d=l.code,_=l.buffer,d===e.ErrorCode.SUCCESS&&_?(p=ic(this.codec,_),f=p.users,h=p.token,R=p.sessionId,b=p.roomInfo,g=p.kvEntries,m=p.offlineKickTime,C=p.roomCreateTime,v=p.userJoinTime,T=p.version,this.roomCreateTime=C,this.userJoinTime=v,[2,{code:d,data:{users:f,token:h,sessionId:R,roomInfo:b,kvEntries:g,offlineKickTime:m,version:T}}]):[2,{code:d,data:p}]}}))}))}}),Object.defineProperty(t.prototype,"quitRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this.codec.encode(Ls.SetUserStatusInput,{status:0}),[4,this.context.rtcSignaling(e,Ps,!0,t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(Ls.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,Ns,!0,r)];case 1:return i=s.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o&&(a=this.codec.decode(Ls.RtcRoomInfoOutput,o)),[2,{code:n,data:a}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return r=this.codec.encode(Ls.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,ws,!0,r)];case 1:return i=c.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o&&(s=ic(this.codec,o),a={users:s.users}),[2,{code:n,data:a}]}}))}))}}),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 s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return r=this.codec.encode(Ls.RtcKeyDeleteInput,{key:t}),[4,this.context.rtcSignaling(e,Ds,!1,r)];case 1:return[2,i.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o){return s(this,void 0,void 0,(function(){var a;return c(this,(function(s){switch(s.label){case 0:return a=this.codec.encode(Ls.RtcSetDataInput,{interior:i,target:n,key:t,value:r,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.context.rtcSignaling(e,ks,!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,i,n,o){return s(this,void 0,void 0,(function(){var a,s,u=this;return c(this,(function(c){switch(c.label){case 0:return a={objectName:i,content:[],valueInfo:[this.codec.encode(Ls.RtcValueInfo,{key:"uris",value:r},!0)]},t.forEach((function(e){var t=u.codec.encode(Ls.RtcValueInfo,{key:e.name,value:e.content},!0);a.content.push(t)})),n&&a.valueInfo.push(this.codec.encode(Ls.RtcValueInfo,{key:"mcu_uris",value:n},!0)),o&&a.valueInfo.push(this.codec.encode(Ls.RtcValueInfo,{key:"cdn_uris",value:o},!0)),s=this.codec.encode(Ls.RtcUserSetDataInput,a),[4,this.context.rtcSignaling(e,Us,!0,s)];case 1:return[2,c.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i;return c(this,(function(n){switch(n.label){case 0:return i=this.codec.encode(Ls.RtcUserSetDataInput,{objectName:t,valueInfo:this.codec.encode(Ls.RtcValueInfo,{key:"cdn_uris",value:r},!0)}),[4,this.context.rtcSignaling(e,Us,!0,i)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n){return s(this,void 0,void 0,(function(){var o,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return o=this.codec.encode(Ls.RtcDataInput,{interior:i,target:n,key:r}),[4,this.context.rtcSignaling(t,Ms,!0,o)];case 1:return a=c.sent(),s=a.code,u=a.buffer,s===e.ErrorCode.SUCCESS&&u?(l=this.codec.decode(Ls.RtcQryOutput,u).outInfo,d={},l.forEach((function(e){d[e.key]=e.value})),[2,{code:s,data:d}]):[2,{code:s}]}}))}))}}),Object.defineProperty(t.prototype,"removeRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return s(this,void 0,void 0,(function(){var o;return c(this,(function(a){switch(a.label){case 0:return o=this.codec.encode(Ls.RtcDataInput,{interior:r,target:i,key:t,objectName:(null==n?void 0:n.name)||"",content:(null==n?void 0:n.content)||""}),[4,this.context.rtcSignaling(e,xs,!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,i){return s(this,void 0,void 0,(function(){return c(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 s(this,void 0,void 0,(function(){return c(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(t.prototype,"getRTCToken",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return n=rc(this.codec,r,i),[4,this.context.rtcSignaling(t,js,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a===e.ErrorCode.SUCCESS&&s?(u=this.codec.decode(Ls.RtcTokenOutput,s).rtcToken,[2,{code:a,data:{rtcToken:u}}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"setRTCState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return r=this.codec.encode(Ls.MCFollowInput,{state:t}),[4,this.context.rtcSignaling(e,Bs,!0,r)];case 1:return[2,i.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCStateByHttp",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n){var o;return s(this,void 0,void 0,(function(){var s,u,l;return c(this,(function(c){switch(c.label){case 0:s=function(e,t,r){var i=t.type,n=t.appKey,o=t.sessionId,s=t.roomId,c=t.roomCreateTime,u=t.userId,l=t.userRole,d=t.joinTime,_=t.signalDataCenter,p=t.r1Info,f=t.r2Info,h=t.r3Info,R=t.r4Info,b={type:i,appKey:n,sessionId:o,roomId:s,roomCreateTime:c,userId:u,userRole:l,joinTime:d,signalDataCenter:_};if(r===Ma.R1&&p){var g=e.encode(Ls.RtcPBR1Info,p,!0);return e.encode(Ls.RtcPBPolaris,a(a({},b),{r1Info:g}))}if(r===Ma.R2&&f){var m=e.encode(Ls.RtcPBR2Info,f,!0);return e.encode(Ls.RtcPBPolaris,a(a({},b),{r2Info:m}))}if(r===Ma.R3&&h){var C=(S=h.info).streams,v=Array.isArray(C)&&C.map((function(t){return t&&e.encode(Ls.RtcPBStreamInfo,t,!0)})),T=e.encode(Ls.RtcPBStatusInfo,a(a({},S),{streams:v}),!0),O=e.encode(Ls.RtcPBR3Info,{info:T},!0);return e.encode(Ls.RtcPBPolaris,a(a({},b),{r3Info:O}))}if(r===Ma.R4&&R){C=(S=R.info).streams,v=Array.isArray(C)&&C.map((function(t){return t&&e.encode(Ls.RtcPBStreamInfo,t,!0)})),T=e.encode(Ls.RtcPBStatusInfo,a(a({},S),{streams:v}),!0);var S,E=e.encode(Ls.RtcPBR4Info,{info:T},!0);return e.encode(Ls.RtcPBPolaris,a(a({},b),{r4Info:E}))}return{}}(this.codec,i,n),u=t,/^https:\/\//.test(t)||(u="https://".concat(t)),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,r.httpReq({url:"".concat(u,"/rtc/logserver/polaris"),body:s,method:e.HttpMethod.POST,headers:{jwt:(null===(o=this.context.getNaviInfo())||void 0===o?void 0:o.jwt)||""},timeout:2e3})];case 2:if(!(l=c.sent()).data)throw new Error("http request fail");return[2,JSON.parse(l.data).resultCode];case 3:return c.sent(),[2,Ua.REPORT_FAIL];case 4:return[2]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(Ls.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,Vs,!0,r)];case 1:return i=s.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o?(a=ic(this.codec,o),[2,{code:n,data:a}]):[2,{code:n}]}}))}))}}),Object.defineProperty(t.prototype,"joinLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return n=rc(this.codec,r,i),[4,this.context.rtcSignaling(t,Fs,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a===e.ErrorCode.SUCCESS&&s?(u=this.codec.decode(Ls.RtcViewerJoinedOutput,s),l=u.rtcToken,d=u.entries,_=u.roomCreateTime,p=u.userJoinTime,this.roomCreateTime=Pt(_),this.userJoinTime=Pt(p),[2,{code:a,data:{token:l,kvEntries:d}}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"quitLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this.codec.encode(Ls.SetUserStatusInput,{status:0}),[4,this.context.rtcSignaling(e,Js,!0,t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"rtcIdentityChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return n=this.codec.encode(Ls.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:i,identityChangeType:r,needSysChatroom:!1}),[4,this.context.rtcSignaling(t,Hs,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a===e.ErrorCode.SUCCESS&&s?(u=ic(this.codec,s),[2,{code:a,data:u}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"requestRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return t=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,n=e.inviteTimeout,o=e.inviteInfo,a=e.roomId,s=this.codec.encode(Ls.RtcInviteInput,{invitedRoomId:t,invitedUserId:r,inviteSessionId:i,timeoutTime:n,inviteInfo:o}),[4,this.context.rtcSignaling(a,Ks,!0,s)];case 1:return[2,c.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"cancelRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return t=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,n=e.inviteInfo,o=e.roomId,a=this.codec.encode(Ls.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:r,inviteSessionId:i,inviteInfo:n}),[4,this.context.rtcSignaling(o,Ws,!0,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"responseRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return t=e.inviteUserId,r=e.inviteRoomId,i=e.inviteSessionId,n=e.content,o=e.key,a=e.value,s=e.agree,u=e.roomId,l=this.codec.encode(Ls.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:r,inviteSessionId:i,content:n,key:o,value:a,answerCode:s?1:0}),[4,this.context.rtcSignaling(u,zs,!0,l)];case 1:return[2,c.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"endRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return t=e.endRoomId,r=e.sessionId,i=e.content,n=e.keys,o=e.roomId,a=this.codec.encode(Ls.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:r,inviteContent:i,inviteRoomKeys:n}),[4,this.context.rtcSignaling(o,Ys,!0,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCJoinedUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(Ls.RtcQueryUserJoinedInput,{userId:t}),[4,this.context.rtcSignaling("",qs,!0,r)];case 1:return i=s.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o?(a=this.codec.decode(Ls.RtcQueryUserJoinedOutput,o).info||[],[2,{code:n,data:a.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:Pt(e.joinTime)}}))}]):[2,{code:n}]}}))}))}}),Object.defineProperty(t.prototype,"pullRTCRoomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,s,u,l;return c(this,(function(c){switch(c.label){case 0:return r=this.codec.encode(Ls.RtcPullKV,{timestamp:0,roomId:t}),[4,this.context.rtcSignaling(t,Gs,!0,r)];case 1:return i=c.sent(),n=i.code,o=i.buffer,n!==e.ErrorCode.SUCCESS?[2,{code:n}]:(s=this.codec.decode(Ls.RtcKVOutput,o),u=s.entries,l=s.syncTime,u=(u||[]).map((function(e){return a(a({},e),{timestamp:Pt(e.timestamp)})})),[2,{code:n,data:{kvEntries:u,syncTime:Pt(l)}}])}}))}))}}),Object.defineProperty(t.prototype,"pullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return i=this.codec.encode(Ls.RtcRoomStatusInput,{version:r}),[4,this.context.rtcSignaling(t,Zs,!0,i)];case 1:return n=c.sent(),o=n.code,a=n.buffer,o!==e.ErrorCode.SUCCESS?[2,{code:o}]:(s=this.codec.decode(Ls.RtcRoomStatusOutput,a),[2,{code:o,data:s}])}}))}))}}),Object.defineProperty(t.prototype,"decodeRtcNotify",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.decode(Ls.RtcNotifyMsg,e),r=t.time,i=t.type,n=t.roomId;return{time:Pt(r),type:i,roomId:n}}}),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(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return n=this.codec.encode(Ls.RtcInput,{roomType:r,broadcastType:i}),[4,this.context.rtcSignaling(t,Xs,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a!==e.ErrorCode.SUCCESS?[2,{code:a}]:((u=this.codec.decode(Ls.RtcOutput,s)).version=Pt(u.version),[2,{code:a,data:u}])}}))}))}}),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(Ls.RtcReportSDKInput,{sdkInfo:JSON.stringify(e)});this.context.rtcSignaling("",Qs,!0,t)}}),Object.defineProperty(t.prototype,"decodeAsrText",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;try{r=this.codec.decode(Ls.AsrResTextMsg,e)}catch(r){console.error("decodeAsrText error",{error:r,seiFrameData:e.join(","),seiOriginData:t.join(",")})}var i=r||{asr:[]},n=i.type,o=i.uid;return i.asr.map((function(e){var t=e.bms,r=e.t,i=e.isEnd,s=e.msgId,c=e.lang,u={userID:o,timeUTC:t,msg:r,msgId:s,isEnd:i};return n===$s.SUBTITLE?u:a(a({},u),{destLangCode:c})}))}}),t}();!function(e){e.RTC="RTC"}(nc||(nc={})),e.VersionManage.add("rtclib","5.36.0-alpha.6");var ac={tag:"RCRTC",verify:function(t){return"undefined"==typeof isSecureContext||isSecureContext?!!e.VersionManage.validEngine("5.34.0")||(console.error("The current engine version '".concat(e.VersionManage.getInfo().engine,"' error, plugin-rtc required engine version at least '").concat("5.34.0","'.")),!1):(console.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(t,r,i){void 0===i&&(i={});var o=t.createLogger("RCRTC",nc.RTC);if(i.logLevel&&o.setOutputLevel(i.logLevel),o.warn(n.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.36.0-alpha.6",Commit:"324878972716bb12032df6f7662467a6cd70735e","browserInfo.browser":vt.browser,"browserInfo.supportsUnifiedPlan":vt.supportsUnifiedPlan,"browserInfo.version":vt.version})),e.assert("options",i,e.AssertRules.OBJECT,!0),e.assert("options.mediaServer",i.mediaServer,(function(t){return!(!e.isHttpUrl(t)||"https:"===location.protocol&&!/^https/.test(t))})),e.assert("options.timeout",i.timeout,(function(t){return e.isNumber(t)&&t>=5e3&&t<=3e4})),e.assert("options.pingGap",i.pingGap,(function(t){return e.isNumber(t)&&t>=3e3&&t<=1e4})),i.AAAWorklet){e.assert("options.AAAWorklet",i.AAAWorklet,e.AssertRules.OBJECT,!0);var a=i.AAAWorklet,s=a.scriptUrl,c=a.wasmUrl;e.assert("AAAWorklet.scriptUrl",s,e.AssertRules.STRING,!0),e.assert("AAAWorklet.wasmUrl",c,e.AssertRules.STRING,!0),Ke.SCRIPT_URL=s,Ke.WASM_URL=c}return i.encryptor&&(e.assert("options.encrypt",i.encryptor,e.AssertRules.OBJECT,!0),e.assert("options.encrypt.decodeAudio",i.encryptor.decodeAudio,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.decodeVideo",i.encryptor.decodeVideo,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.encodeAudio",i.encryptor.encodeAudio,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.encodeVideo",i.encryptor.encodeVideo,(function(e){return"function"==typeof e}),!0),fo.init(i.encryptor,o)),new ys(new oc(t,o,t.createCodec(ec,tc)),r,i)}},sc={transResolution:bt,transFrameRate:Ct,parseTrackId:_t,ifSupportLocalFileTrack:Tt,ifSupportScreenShare:Ot};exports.RCAbstractRoom=ts,exports.RCAudienceClient=Cs,exports.RCAudienceLivingRoom=Os,exports.RCCameraVideoTrack=$e,exports.RCLivingRoom=hs,exports.RCLocalAudioTrack=ze,exports.RCLocalFileAudioTrack=Qe,exports.RCLocalFileTrack=qe,exports.RCLocalFileVideoTrack=Ze,exports.RCLocalTrack=We,exports.RCLocalVideoTrack=Ye,exports.RCMCUConfigBuilder=os,exports.RCMediaStreamCapture=Is,exports.RCMicphoneAudioTrack=Xe,exports.RCRTCClient=ys,exports.RCRTCRoom=Rs,exports.RCRemoteAudioTrack=it,exports.RCRemoteTrack=rt,exports.RCRemoteVideoTrack=nt,exports.RCScreenAudioTrack=tt,exports.RCScreenVideoTrack=et,exports.RCTag={DEFAULT:"RongCloudRTC"},exports.RCTrack=Ve,exports.device=Me,exports.helper=sc,exports.installer=ac;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@nexconn/engine"),t=require("@base/protobuf");function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t,n){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,T(r.key),r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=I(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function c(e,t,n){return(t=T(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(){return u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},u.apply(null,arguments)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function _(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function p(){
|
|
2
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
+
var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof s?r:s,u=Object.create(c.prototype);return f(u,"_invoke",function(n,r,i){var o,s,c,u=0,d=i||[],_=!1,l={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return o=t,s=0,c=e,l.n=n,a}};function p(n,r){for(s=n,c=r,t=0;!_&&u&&!i&&t<d.length;t++){var i,o=d[t],p=l.p,f=o[2];n>3?(i=f===r)&&(c=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((i=n<2&&p<o[1])?(s=0,l.v=r,l.n=o[1]):p<f&&(i=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,l.n=f,s=0))}if(i||n>1)return a;throw _=!0,r}return function(i,d,f){if(u>1)throw TypeError("Generator is already running");for(_&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!_;){o||(s?s<3?(s>1&&(l.n=-1),p(s,c)):l.n=c:l.v=c);try{if(u=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(_=l.n<0)?c:n.call(r,l))!==a)break}catch(t){o=e,s=1,c=t}finally{u=1}}return{value:t,done:_}}}(n,i,o),!0),u}var a={};function s(){}function c(){}function u(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(f(t={},r,function(){return this}),t),_=u.prototype=s.prototype=Object.create(d);function l(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,f(e,i,"GeneratorFunction")),e.prototype=Object.create(_),e}return c.prototype=u,f(_,"constructor",u),f(u,"constructor",c),c.displayName="GeneratorFunction",f(u,i,"GeneratorFunction"),f(_),f(_,i,"Generator"),f(_,r,function(){return this}),f(_,"toString",function(){return"[object Generator]"}),(p=function(){return{w:o,m:l}})()}function f(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}f=function(e,t,n,r){function o(t,n){f(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},f(e,t,n,r)}function h(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}}function R(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(typeof e+" is not iterable")}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(e,t)||I(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t,n,r){var i=u(d(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function v(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||I(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function I(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function S(e){var t="function"==typeof Map?new Map:void 0;return S=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(l())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&g(i,n.prototype),i}(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),g(n,e)},S(e)}var E,O=function(e){return"string"==typeof e},b=function(e){return"boolean"==typeof e},y=function(e){return"number"==typeof e&&!Number.isNaN(e)},L=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},k=function(e){return O(e)&&e.length>0},A=function(e){return"[object Object]"===Object.prototype.toString.call(e)},N=function(e){return"function"==typeof e},P=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},D=function(e){return O(e)&&/https?:\/\//.test(e)};!function(e){e[e.STRING=0]="STRING",e[e.ONLY_STRING=1]="ONLY_STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.OBJECT=4]="OBJECT",e[e.ARRAY=5]="ARRAY",e[e.CALLBACK=6]="CALLBACK"}(E||(E={}));var U,w,M,x=c(c(c(c(c(c(c({},E.STRING,k),E.ONLY_STRING,O),E.NUMBER,y),E.BOOLEAN,function(e){return"boolean"==typeof e}),E.OBJECT,A),E.ARRAY,L),E.CALLBACK,function(e){var t=!0;return A(e)||(t=!1),(e=e||{}).onSuccess&&!N(e.onSuccess)&&(t=!1),e.onError&&!N(e.onError)&&(t=!1),t}),B=function(){function e(t){var n;return i(this,e),(n=r(this,e,[t])).name="RCAssertError",n}return _(e,S(Error)),a(e)}(),V=function(e,t,n){if(!j(e,t,n,arguments.length>3&&void 0!==arguments[3]&&arguments[3]))throw new B("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},j=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n=x[n]||n;var i=r?n(t):P(t)||null==t||n(t);return i||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),i},F=function(){return a(function e(){i(this,e),Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:{}})},[{key:"on",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some(function(e){return e.listener===t&&e.target===n})||r.push({listener:t,target:n})}},{key:"once",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some(function(e){return e.listener===t&&e.target===n})||r.push({listener:t,target:n,once:!0})}},{key:"off",value:function(e,t,n){var r=this._map[e];r&&((r=r.filter(function(e){return e.listener!==t||e.target!==n})).length?this._map[e]=r:delete this._map[e])}},{key:"emit",value:function(e){var t=this._map[e];if(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var o=0;o<t.length;o+=1){var a=t[o],s=a.target,c=a.once,u=a.listener;c&&(t.splice(o,1),o-=1);try{u.call.apply(u,[s].concat(r))}catch(e){null===console||void 0===console||console.error(e)}}}}},{key:"removeAll",value:function(e){delete this._map[e]}},{key:"clear",value:function(){Object.keys(this._map).forEach(this.removeAll,this)}}])}();function G(e,t){var n;if(!e)return"";var r="undefined"!=typeof window&&"https:"===(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.protocol);return/^https?:\/\//.test(e)?r?e.replace(/^https?:\/\//i,"https://"):e:t!==M.HTTP||r?"https://".concat(e):"http://".concat(e)}!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(U||(U={})),function(e){e.WIFI="wifi",e.FOUR_G="4g",e.THREE_G="3g",e.TWO_G="2g",e.FIVE_G="2g",e.THREE_GENT="3gnet",e.UNKONWN="unknown"}(w||(w={})),function(e){e[e.RMTP=1]="RMTP",e[e.TLS=2]="TLS",e[e.RPP=3]="RPP",e[e.QUIC=4]="QUIC",e[e.WS=5]="WS",e[e.WSS=6]="WSS",e[e.HTTP=11]="HTTP",e[e.HTTPS=12]="HTTPS"}(M||(M={}));var J,H=function(e,t,n){var r=null==n?void 0:n.isReverse;A(e)&&function(){for(var n in e)t(e[n],n,e)}(),(L(e)||O(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,o=e.length;i<o;i++)t(e[i],i)}()};function K(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})}function q(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}!function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL",e[e.MEETING=6]="MEETING",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.CROSS_LIVE=8]="CROSS_LIVE"}(J||(J={})),"function"==typeof SuppressedError&&SuppressedError;var W=function(){return a(function e(t,n){var r=this;i(this,e),Object.defineProperty(this,"_promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolve",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_onCancel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._promise=new Promise(function(e){r._resolve=e,t(r._onResolve.bind(r))}),this._onCancel=n},[{key:"_onResolve",value:function(e){this._resolve(e)}},{key:"result",value:function(){return this._promise}},{key:"abort",value:function(){this._onCancel(this._onResolve.bind(this))}}])}();function z(e){var t=e.method||U.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,a=e.onProgress,s=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map(function(e){return"".concat(e,"=").concat(t[e])}).filter(function(e){return!!e});return n.length?[e,n.join("&")].join("?"):e}(e.url,i),c=new XMLHttpRequest;if(c.open(t,s),r&&c.setRequestHeader)for(var u in r)c.setRequestHeader(u,r[u]);return function(e,t,n,r){return new W(function(i){e.onreadystatechange=function(){4===e.readyState&&i({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){i({status:e.status})},r&&(e.upload.onprogress=function(e){return r(e)}),0!==t&&setTimeout(function(){e.abort(),i({status:e.status})},t),e.send(n)},function(t){e.abort(),t({status:-1})})}(c,n,o,a)}var Y,Q,Z,X=function(){return a(function e(t,n,r){i(this,e),Object.defineProperty(this,"isOk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"msg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isOk=0===t,this.code=t,this.msg=n,this.data=r},[{key:"next",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)switch(t.n){case 0:if(!this.isOk){t.n=1;break}return t.a(2,e(this.data));case 1:return t.a(2,this.wipe())}},t,this)}))}},{key:"or",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)switch(t.n){case 0:if(!this.isOk){t.n=1;break}return t.a(2,this);case 1:return t.a(2,e(this.code))}},t,this)}))}},{key:"orSync",value:function(e){return this.isOk?this:e(this.code)}},{key:"trans",value:function(e){return this.isOk?$(e(this.data)):this.wipe()}},{key:"tryTrans",value:function(e){return this.isOk?e(this.data):this.wipe()}},{key:"errmsg",value:function(){return JSON.stringify({code:this.code,msg:this.msg})}},{key:"wipe",value:function(){return this.isOk?$(void 0,this.msg):ee(this.code,this.msg)}}])}(),$=function(e,t){return new X(0,t||"success",e)},ee=function(e,t,n){return new X(e,t||"fail: ".concat(e),n)},te=function(){var e,t=new Promise(function(t){e=t});return{resolve:e,promise:t}},ne=function(){return a(function e(t){i(this,e),Y.add(this),Q.set(this,void 0),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?i.call(e,n):i?i.value=n:t.set(e,n)}(this,Q,t,"f"),this._logger=t.logger},[{key:"open",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return e=e.sort(function(e,t){return t.weight-e.weight}),t.a(2,q(this,Y,"m",Z).call(this,e,q(this,Q,"f")))},t,this)}))}}])}();Q=new WeakMap,Y=new WeakSet,Z=function e(t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(0!==t.length){r.n=1;break}return r.a(2,ee(39005,"All addrs failed"));case 1:return i=t.shift(),o=G(i.addr,i.protocol),o="".concat(o,"/v3/message/get_stream.json?sdkVersion=","5.36.1-nctest-alpha.1","&platform=Websocket&messageUID=").concat(n.msgUId),this._logger.info("L-req_stream_msg_content-O","try open -> ".concat(o)),r.n=2,this._openHandler(o,n);case 2:return a=r.v,r.a(2,a.or(function(r){return K(s,void 0,void 0,p().m(function i(){return p().w(function(i){for(;;)switch(i.n){case 0:if(-1!==r){i.n=1;break}return i.a(2,q(this,Y,"m",e).call(this,t,n));case 1:return i.a(2,a)}},i,this)}))}))}},r,this)}))};var re=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,ne),a(e,[{key:"_openHandler",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s=this;return p().w(function(n){for(;;)if(0===n.n)return r=te(),i=r.resolve,o=r.promise,(a=new XMLHttpRequest).open("GET",e,!0),a.timeout=t.timeout,a.ontimeout=function(){s._logger.warn("L-req_stream_msg_content-E","timeout -> ".concat(e)),i(ee(-1,"timeout"))},a.onreadystatechange=function(n){if(a.readyState===XMLHttpRequest.HEADERS_RECEIVED){var r=a.getResponseHeader("Content-Type"),o=null==r?void 0:r.startsWith("text/event-stream");if(200===a.status&&o){i($());var c=0;a.onprogress=function(e){var n=a.response.slice(c);c=a.response.length,t.onRawContent(n)},a.onerror=function(n){s._logger.warn("L-req_stream_msg_content-E","network error in transit -> ".concat(e)),a.onprogress=null,a.abort(),t.onNetworkError(39005)}}else a.onloadend=function(){var e=JSON.parse(a.response);i(ee(e.code,e.message))}}},a.onerror=function(t){s._logger.warn("L-req_stream_msg_content-E","req fail -> ".concat(e)),i(ee(-1))},a.setRequestHeader("Content-Type","application/json;charset=UTF-8"),a.setRequestHeader("App-Key",t.appkey),a.setRequestHeader("Authorization","Bearer ".concat(t.token)),a.send(),n.a(2,o)},n)}))}}])}(),ie=!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],n=0,r=t.length;n<r;n++)if(!e[t[n]])return!1;return!0}(uni));var oe=null,ae=function(e){return K(void 0,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,_e.getNetworkType();case 1:n=t.v,oe({status:"online"===e.type,type:n});case 2:return t.a(2)}},t)}))};var se,ce,ue,de,_e={tag:"browser",httpReq:function(e){return z(e).result()},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:ie,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",Promise.resolve($({id:Date.now(),onClose:function(e){n.onclose=function(t){var n=t.code,r=t.reason;e(n,r)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}))},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:w.UNKONWN},t=e.type,n=e.effectiveType,r=t||n||w.UNKONWN;return Promise.resolve(r)},setNetworkStatusListener:function(e){oe=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",ae),window.addEventListener("online",ae))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",ae),window.removeEventListener("online",ae)),oe=null},createSSEClient:function(e){return $(new re(e))},getApiVer:function(){var e=_e.runtimeInfo,t=e.type,n=e.version;return"|".concat(t,"|").concat(n)},get runtimeInfo(){var e,t,n=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var i in r)if(r.hasOwnProperty(i)){var o=n.match(r[i]);if(o){t=i,e=o[1]||o[2];break}}return{type:t||"Unknown",version:e||"Unknown"}}},le=_e;!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.GROUP=2]="GROUP",e[e.SYSTEM=3]="SYSTEM",e[e.CUSTOM=4]="CUSTOM",e[e.RTC_ROOM=7]="RTC_ROOM"}(se||(se={})),function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(ce||(ce={})),function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error"}(ue||(ue={})),function(e){e.RTC="RTC",e.CallPlus="CallPlus"}(de||(de={}));class pe{constructor(e){Object.defineProperty(this,"_writer",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:0})}debug(e,t,n){this._writer.writeLog(ue.Debug,e,null!=t?t:"",n)}info(e,t,n){this._writer.writeLog(ue.Info,e,null!=t?t:"",n)}warn(e,t,n){this._writer.writeLog(ue.Warn,e,null!=t?t:"",n)}error(e,t,n){this._writer.writeLog(ue.Error,e,null!=t?t:"",n)}createTraceId(){return""+ ++this._traceId}__statistics(e,t,n){}}const fe={toCommon:e=>e,toNative:e=>e},he={[e.ConversationType.PRIVATE]:se.PRIVATE,[e.ConversationType.GROUP]:se.GROUP,[e.ConversationType.SYSTEM]:se.SYSTEM,[e.ConversationType.CHATROOM]:se.CUSTOM,[e.ConversationType.APP_PUBLIC_SERVICE]:se.RTC_ROOM,[e.ConversationType.RTC_ROOM]:se.RTC_ROOM},Re={[se.PRIVATE]:e.ConversationType.PRIVATE,[se.GROUP]:e.ConversationType.GROUP,[se.SYSTEM]:e.ConversationType.SYSTEM,[se.CUSTOM]:e.ConversationType.CHATROOM,[se.RTC_ROOM]:e.ConversationType.APP_PUBLIC_SERVICE},ge={toCommon(e){var t;return null!==(t=he[e])&&void 0!==t?t:e},toNative(e){var t;return null!==(t=Re[e])&&void 0!==t?t:e}},me={[e.RCConnectionStatus.CONNECTED]:ce.CONNECTED,[e.RCConnectionStatus.CONNECTING]:ce.CONNECTING,[e.RCConnectionStatus.DISCONNECTED]:ce.DISCONNECTED,[e.RCConnectionStatus.SUSPENDED]:ce.SUSPENDED},Ce={[ce.DISCONNECTED]:e.RCConnectionStatus.DISCONNECTED,[ce.CONNECTING]:e.RCConnectionStatus.CONNECTING,[ce.CONNECTED]:e.RCConnectionStatus.CONNECTED,[ce.SUSPENDED]:e.RCConnectionStatus.SUSPENDED},ve={toNative:e=>Object.assign({},e)},Te={errorCode:fe,conversationType:ge,connectionStatus:{toCommon(e){var t;return null!==(t=me[e])&&void 0!==t?t:e},toNative(e){var t;return null!==(t=Ce[e])&&void 0!==t?t:e}},sendMsgOptions:ve,receivedMessage:{toCommon:e=>e},naviInfo:{toCommon(e){var t,n,r;return{voipCallInfo:null!==(t=e.voipCallInfo)&&void 0!==t?t:void 0,rtcAISwitch:e.rtcAISwitch,jwtToken:null!==(n=e.jwtToken)&&void 0!==n?n:e.jwt,logServer:e.logServer,dataCenter:null!==(r=e.dataCenter)&&void 0!==r?r:e.dc,openGzip:e.openGzip,ipType:e.ipType}}}};var Ie,Se,Ee,Oe;!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.GROUP=2]="GROUP",e[e.SYSTEM=3]="SYSTEM",e[e.CUSTOM=4]="CUSTOM",e[e.RTC_ROOM=7]="RTC_ROOM"}(Ie||(Ie={})),function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(Se||(Se={})),function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error"}(Ee||(Ee={})),function(e){e.RTC="RTC",e.CallPlus="CallPlus"}(Oe||(Oe={}));var be,ye,Le,ke=0,Ae=40001,Ne=40002,Pe=40003;exports.RCRTCCode=void 0,(be=exports.RCRTCCode||(exports.RCRTCCode={}))[be.SUCCESS=1e4]="SUCCESS",be[be.PB_ERROR=40001]="PB_ERROR",be[be.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",be[be.PARAMS_ERROR=50001]="PARAMS_ERROR",be[be.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",be[be.NOT_IN_ROOM=50003]="NOT_IN_ROOM",be[be.SERVICE_INVALID=50004]="SERVICE_INVALID",be[be.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",be[be.ASR_NOT_AVAILABLE=50034]="ASR_NOT_AVAILABLE",be[be.ASR_NOT_START=50035]="ASR_NOT_START",be[be.SIGNAL_ERROR=53001]="SIGNAL_ERROR",be[be.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",be[be.REQUEST_FAILED=53004]="REQUEST_FAILED",be[be.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",be[be.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",be[be.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",be[be.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",be[be.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",be[be.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",be[be.BROWSER_PERMISSION_DENIED=53012]="BROWSER_PERMISSION_DENIED",be[be.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",be[be.INVALID_TAGS=53014]="INVALID_TAGS",be[be.INVALID_USER_ID=53015]="INVALID_USER_ID",be[be.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",be[be.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",be[be.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",be[be.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",be[be.TRACK_NOT_READY=53020]="TRACK_NOT_READY",be[be.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",be[be.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",be[be.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",be[be.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",be[be.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",be[be.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",be[be.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",be[be.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",be[be.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",be[be.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM",be[be.SOME_TRACKS_PUBLISH_FAILED=53031]="SOME_TRACKS_PUBLISH_FAILED",be[be.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO=53032]="MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO",be[be.JWT_TIME_OUT=1004]="JWT_TIME_OUT",be[be.SYSTEM_PERMISSION_DENIED=53033]="SYSTEM_PERMISSION_DENIED",be[be.PUBLISH_TRACKS_IS_INVALID=53034]="PUBLISH_TRACKS_IS_INVALID",be[be.TRACK_READYSTATE_IS_ENDED=53035]="TRACK_READYSTATE_IS_ENDED",be[be.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH=53036]="APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH",be[be.LOAD_3A_MODULE_FAILED=53037]="LOAD_3A_MODULE_FAILED",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_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_APPLY_VIDEO_ASPECT_RATIO_O="L-rtc_client_apply_video_aspect_ratio-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_RTC_CLIENT_GENERATE_SUMMARIZATION_T="L-rtc_client_generate_summarization-T",e.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R="L-rtc_client_generate_summarization-R",e.L_RTC_CLIENT_GET_ASR_CONTENT_T="L-rtc_client_get_asr_content-T",e.L_RTC_CLIENT_GET_ASR_CONTENT_R="L-rtc_client_get_asr_content-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_ABSTRACT_ROOM_SET_SRC_LANGUAGE_T="L-abstract_room_set_src_language-T",e.L_ABSTRACT_ROOM_SET_SRC_LANGUAGE_R="L-abstract_room_set_src_language-R",e.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_T="L-abstract_room_operate_asr_status-T",e.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R="L-abstract_room_operate_asr_status-R",e.L_ABSTRACT_ROOM_SET_ENABLE_ASR_T="L-abstract_room_set_enable_asr-T",e.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R="L-abstract_room_set_enable_asr-R",e.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_T="L-abstract_room_operate_realtime_translation-T",e.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R="L-abstract_room_operate_realtime_translation-R",e.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_T="L-abstract_room_operate_summarization-T",e.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R="L-abstract_room_operate_summarization-R",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",e.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_T="L-rtc_client_change_media_device-T",e.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R="L-rtc_client_change_media_device-R"}(ye||(ye={})),function(e){e.FAILED="fail",e.SUCCESSED="success",e.TIMEOUT="timeout",e.INFO="info"}(Le||(Le={}));let De=!0,Ue=!0;function we(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function Me(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),i.apply(this,[e,o])};const o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(n))return o.apply(this,arguments);const r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"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 xe(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(De=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Be(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Ue=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Ve(){if("object"==typeof window){if(De)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function je(e,t){Ue&&console.warn(e+" is deprecated, please use "+t+" instead.")}function Fe(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ge(e){return Fe(e)?Object.keys(e).reduce(function(t,n){const r=Fe(e[n]),i=r?Ge(e[n]):e[n],o=r&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[n]:i})},{}):e}function Je(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith("Id")?Je(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach(t=>{Je(e,e.get(t),n)})}))}function He(e,t,n){const r=n?"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(n=>{n.type===r&&n.trackId===t.id&&Je(e,n,i)})}),i}const Ke=Ve;function qe(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),e={},e[i("max",n)]=r.ideal,t.optional.push(e)):(e[i("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[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,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(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)&&(!n.mediaDevices.getSupportedConstraints||!n.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 n.mediaDevices.enumerateDevices().then(n=>{let a=(n=n.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!a&&n.length&&t.includes("back")&&(a=n[n.length-1]),a&&(e.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=r(e.video),Ke("chrome: "+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return Ke("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(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(o(e))})})}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.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 We(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function ze(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",n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Me(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function Ye(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 n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.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 Qe(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=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 n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{n[t]=e.stat(t)}),t[n.id]=n}),t},o=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const r=function(e){n(o(i(e)))};return t.apply(this,[r,e])}return new Promise((e,n)=>{t.apply(this,[function(t){e(o(i(t)))},n])}).then(n,r)}}function Ze(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 n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>He(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}),Me(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>He(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,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function Xe(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,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=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();n.apply(this,arguments);const r=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.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 n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function $e(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Xe(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const r=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 n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}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,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[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[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=o(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>o(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}(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(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function et(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function tt(e,t){Me(e,"negotiationneeded",e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e})}var nt=Object.freeze({__proto__:null,shimMediaStream:We,shimOnTrack:ze,shimGetSendersWithDtmf:Ye,shimGetStats:Qe,shimSenderReceiverGetStats:Ze,shimAddTrackRemoveTrackWithNative:Xe,shimAddTrackRemoveTrack:$e,shimPeerConnection:et,fixNegotiationNeeded:tt,shimGetUserMedia:qe,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then(t=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var rt,it,ot=(rt=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 n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){var n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter(function(e){return 0===e.indexOf(n)})},t.parseCandidate=function(e){for(var t,n={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]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;case"ufrag":n.ufrag=t[r+1],n.usernameFragment=t[r+1];break;default:n[t[r]]=t[r+1]}return n},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 n=e.type;return t.push("typ"),t.push(n),"host"!==n&&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(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\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,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},t.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach(function(t){e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)}),t+="a=fmtp:"+n+" "+r.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="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},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 n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},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,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){var r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.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 n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),i=3;i<r.length;i++){var o=r[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),n.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach(function(e){n.headerExtensions.push(t.parseExtmap(e))}),n},t.writeRtpDescription=function(e,n){var r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach(function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)});var i=0;return n.codecs.forEach(function(e){e.maxptime>i&&(i=e.maxptime)}),i>0&&(r+="a=maxptime:"+i+"\r\n"),r+="a=rtcp-mux\r\n",n.headerExtensions&&n.headerExtensions.forEach(function(e){r+=t.writeExtmap(e)}),r},t.parseRtpEncodingParameters=function(e){var n,r=[],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&&(n=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&&n&&(t.rtx={ssrc:n}),r.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},r.push(t))}}),0===r.length&&c&&r.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach(function(e){e.maxBitrate=d})),r},t.parseRtcpParameters=function(e){var n={},r=t.matchPrefix(e,"a=ssrc:").map(function(e){return t.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return n.mux=o.length>0,n},t.parseMsid=function(e){var n,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[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:(n=i[0].value.split(" "))[0],track:n[1]}:void 0},t.parseSctpDescription=function(e){var n,r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(n=parseInt(i[0].substr(19),10)),isNaN(n)&&(n=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:n};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:n}}},t.writeSctpDescription=function(e,t){var n=[];return n="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&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,n,r){var i=void 0!==n?n:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,n,r,i){var o=t.writeRtpDescription(e.kind,n);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"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,n){for(var r=t.splitLines(e),i=0;i<r.length;i++)switch(r[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[i].substr(2)}return n?t.getDirection(n):"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 n=t.splitLines(e)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){var n=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var n=t.splitLines(e),r=0;r<n.length;r++)if(n[r].length<2||"="!==n[r].charAt(1))return!1;return!0},e.exports=t},rt(it={exports:{}},it.exports),it.exports);function at(e,t,n,r,i){var o=ot.writeRtpDescription(e.kind,t);if(o+=ot.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=ot.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"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:"+(r?r.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:"+ot.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+ot.localCName+"\r\n"),o}function st(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]},i=function(e,t,n,i){var o=r(e.parameters.apt,n),a=r(t.parameters.apt,i);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach(function(r){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(r.name.toLowerCase()===a.name.toLowerCase()&&r.clockRate===a.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&a.parameters.apt&&!i(r,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(r.numChannels,a.numChannels),n.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter(function(e){for(var t=0;t<r.rtcpFeedback.length;t++)if(r.rtcpFeedback[t].type===e.type&&r.rtcpFeedback[t].parameter===e.parameter)return!0;return!1});break}}}),e.headerExtensions.forEach(function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}}),n}function ct(e,t,n){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(n)}function ut(e,t){var n=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 n||e.addRemoteCandidate(t),!n}function dt(e,t){var n=new Error(t);return n.name=e,n.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],n}var _t=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function r(t,n,r,i){var o=new Event("track");o.track=n,o.receiver=r,o.transceiver={receiver:r},o.streams=i,e.setTimeout(function(){t._dispatchEvent("track",o)})}var i=function(n){var r=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){r[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",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw dt("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter(function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||n?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(n=!0,!0)}),delete e.url,e.urls=i?r[0]:r,!!r.length}})}(n.iceServers||[],t),this._iceGatherers=[],n.iceCandidatePoolSize)for(var o=n.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=ot.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 n=this.transceivers.length>0,r={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&&n)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();r.iceTransport=i.iceTransport,r.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(r),r},i.prototype.addTrack=function(t,n){if(this._isClosed)throw dt("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find(function(e){return e.track===t}))throw dt("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(r=this.transceivers[i]);return r||(r=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(n)&&this.localStreams.push(n),r.track=t,r.stream=n,r.rtpSender=new e.RTCRtpSender(t,r.dtlsTransport),r.rtpSender},i.prototype.addStream=function(e){var n=this;if(t>=15025)e.getTracks().forEach(function(t){n.addTrack(t,e)});else{var r=e.clone();e.getTracks().forEach(function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",function(e){n.enabled=e.enabled})}),r.getTracks().forEach(function(e){n.addTrack(e,r)})}},i.prototype.removeTrack=function(t){if(this._isClosed)throw dt("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 n=this.transceivers.find(function(e){return e.rtpSender===t});if(!n)throw dt("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map(function(e){return e.stream}).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(e){var n=t.getSenders().find(function(t){return t.track===e});n&&t.removeTrack(n)})},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,n){var r=this;if(n&&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 n=!e.candidate||0===Object.keys(e.candidate).length;i.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,n){var r=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:n};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=ot.writeCandidate(a);o.candidate=Object.assign(o.candidate,ot.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=ot.getMediaSections(r._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",r._localDescription.sdp=ot.getDescription(r._localDescription.sdp)+u.join("");var d=r.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),s||r._dispatchEvent("icecandidate",o),d&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout(function(){o.forEach(function(e){i.onlocalcandidate(e)})},0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var r=new e.RTCDtlsTransport(n);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:r}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,n,r){var i=st(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:ot.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),r&&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,n,r=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(dt("TypeError",'Unsupported type "'+e.type+'"'));if(!ct("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(dt("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=ot.splitSections(e.sdp),n=t.shift(),t.forEach(function(e,t){var n=ot.parseRtpParameters(e);r.transceivers[t].localCapabilities=n}),r.transceivers.forEach(function(e,t){r._gather(e.mid,t)});else if("answer"===e.type){t=ot.splitSections(r._remoteDescription.sdp),n=t.shift();var i=ot.matchPrefix(n,"a=ice-lite").length>0;t.forEach(function(e,t){var o=r.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,d=o.remoteCapabilities;if(!(ot.isRejected(e)&&0===ot.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var _=ot.getIceParameters(e,n),l=ot.getDtlsParameters(e,n);i&&(l.role="server"),r.usingBundle&&0!==t||(r._gather(o.mid,t),"new"===s.state&&s.start(a,_,i?"controlling":"controlled"),"new"===c.state&&c.start(l));var p=st(u,d);r._transceive(o,p.codecs.length>0,!1)}})}return r._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?r._updateSignalingState("have-local-offer"):r._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var o=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(dt("TypeError",'Unsupported type "'+i.type+'"'));if(!ct("setRemoteDescription",i.type,o.signalingState)||o._isClosed)return Promise.reject(dt("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=ot.splitSections(i.sdp),u=c.shift(),d=ot.matchPrefix(u,"a=ice-lite").length>0,_=ot.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=_;var l=ot.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!l&&l.substr(14).split(" ").indexOf("trickle")>=0,c.forEach(function(r,c){var l=ot.splitLines(r),p=ot.getKind(r),f=ot.isRejected(r)&&0===ot.matchPrefix(r,"a=bundle-only").length,h=l[0].substr(2).split(" ")[2],R=ot.getDirection(r,u),g=ot.parseMsid(r),m=ot.getMid(r)||ot.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===h||"UDP/DTLS/SCTP"===h))o.transceivers[c]={mid:m,kind:p,protocol:h,rejected:!0};else{var C,v,T,I,S,E,O,b,y;!f&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(p,!0));var L,k,A=ot.parseRtpParameters(r);f||(L=ot.getIceParameters(r,u),(k=ot.getDtlsParameters(r,u)).role="client"),O=ot.parseRtpEncodingParameters(r);var N=ot.parseRtcpParameters(r),P=ot.matchPrefix(r,"a=end-of-candidates",u).length>0,D=ot.matchPrefix(r,"a=candidate:").map(function(e){return ot.parseCandidate(e)}).filter(function(e){return 1===e.component});if(("offer"===i.type||"answer"===i.type)&&!f&&_&&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){v=(C=o.transceivers[c]).iceGatherer,T=C.iceTransport,I=C.dtlsTransport,S=C.rtpReceiver,E=C.sendEncodingParameters,b=C.localCapabilities,o.transceivers[c].recvEncodingParameters=O,o.transceivers[c].remoteCapabilities=A,o.transceivers[c].rtcpParameters=N,D.length&&"new"===T.state&&(!d&&!P||_&&0!==c?D.forEach(function(e){ut(C.iceTransport,e)}):T.setRemoteCandidates(D)),_&&0!==c||("new"===T.state&&T.start(v,L,"controlling"),"new"===I.state&&I.start(k)),!st(C.localCapabilities,C.remoteCapabilities).codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&C.sendEncodingParameters[0].rtx&&delete C.sendEncodingParameters[0].rtx,o._transceive(C,"sendrecv"===R||"recvonly"===R,"sendrecv"===R||"sendonly"===R),!S||"sendrecv"!==R&&"sendonly"!==R?delete C.rtpReceiver:(y=S.track,g?(a[g.stream]||(a[g.stream]=new e.MediaStream),n(y,a[g.stream]),s.push([y,S,a[g.stream]])):(a.default||(a.default=new e.MediaStream),n(y,a.default),s.push([y,S,a.default])))}}else{(C=o.transceivers[c]||o._createTransceiver(p)).mid=m,C.iceGatherer||(C.iceGatherer=o._createIceGatherer(c,_)),D.length&&"new"===C.iceTransport.state&&(!P||_&&0!==c?D.forEach(function(e){ut(C.iceTransport,e)}):C.iceTransport.setRemoteCandidates(D)),b=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(b.codecs=b.codecs.filter(function(e){return"rtx"!==e.name})),E=C.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var U,w=!1;if("sendrecv"===R||"sendonly"===R){if(w=!C.rtpReceiver,S=C.rtpReceiver||new e.RTCRtpReceiver(C.dtlsTransport,p),w)y=S.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(y,"id",{get:function(){return g.track}}),U=a[g.stream]):(a.default||(a.default=new e.MediaStream),U=a.default)),U&&(n(y,U),C.associatedRemoteMediaStreams.push(U)),s.push([y,S,U])}else C.rtpReceiver&&C.rtpReceiver.track&&(C.associatedRemoteMediaStreams.forEach(function(t){var n=t.getTracks().find(function(e){return e.id===C.rtpReceiver.track.id});n&&function(t,n){n.removeTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(n,t)}),C.associatedRemoteMediaStreams=[]);C.localCapabilities=b,C.remoteCapabilities=A,C.rtpReceiver=S,C.rtcpParameters=N,C.sendEncodingParameters=E,C.recvEncodingParameters=O,o._transceive(o.transceivers[c],!1,w)}}}),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 n=a[t];if(n.getTracks().length){if(-1===o.remoteStreams.indexOf(n)){o.remoteStreams.push(n);var i=new Event("addstream");i.stream=n,e.setTimeout(function(){o._dispatchEvent("addstream",i)})}s.forEach(function(e){var t=e[0],i=e[1];n.id===e[2].id&&r(o,t,i,[n])})}}),s.forEach(function(e){e[2]||r(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 n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},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 n=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",n)}},i.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(dt("InvalidStateError","Can not call createOffer after close"));var r=n.transceivers.filter(function(e){return"audio"===e.kind}).length,i=n.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&&(r=!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(n.transceivers.forEach(function(e){"audio"===e.kind?--r<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)});r>0||i>0;)r>0&&(n._createTransceiver("audio"),r--),i>0&&(n._createTransceiver("video"),i--);var a=ot.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach(function(r,i){var o=r.track,a=r.kind,s=r.mid||ot.generateIdentifier();r.mid=s,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.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"),r.remoteCapabilities&&r.remoteCapabilities.codecs&&r.remoteCapabilities.codecs.forEach(function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)})}),c.headerExtensions.forEach(function(e){(r.remoteCapabilities&&r.remoteCapabilities.headerExtensions||[]).forEach(function(t){e.uri===t.uri&&(e.id=t.id)})});var u=r.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,a)),r.localCapabilities=c,r.sendEncodingParameters=u}),"max-compat"!==n._config.bundlePolicy&&(a+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n",n.transceivers.forEach(function(e,t){a+=at(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),a+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,a+="a="+ot.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 n=this;if(n._isClosed)return Promise.reject(dt("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(dt("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var r=ot.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(r+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),r+="a=ice-options:trickle\r\n";var i=ot.getMediaSections(n._remoteDescription.sdp).length;n.transceivers.forEach(function(e,o){if(!(o+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?r+="m=application 0 DTLS/SCTP 5000\r\n":r+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?r+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(r+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(r+="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=st(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,r+=at(e,s,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(r+="a=rtcp-rsize\r\n")}});var o=new e.RTCSessionDescription({type:"answer",sdp:r});return Promise.resolve(o)},i.prototype.addIceCandidate=function(e){var t,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(r,i){if(!n._remoteDescription)return i(dt("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<n.transceivers.length;a++)if(n.transceivers[a].mid===e.sdpMid){o=a;break}var s=n.transceivers[o];if(!s)return i(dt("OperationError","Can not add ICE candidate"));if(s.rejected)return r();var c=Object.keys(e.candidate).length>0?ot.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return r();if(c.component&&1!==c.component)return r();if((0===o||o>0&&s.iceTransport!==n.transceivers[0].iceTransport)&&!ut(s.iceTransport,c))return i(dt("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=ot.getMediaSections(n._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=ot.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var d=0;d<n.transceivers.length&&(n.transceivers[d].rejected||(n.transceivers[d].iceTransport.addRemoteCandidate({}),(t=ot.getMediaSections(n._remoteDescription.sdp))[d]+="a=end-of-candidates\r\n",n._remoteDescription.sdp=ot.getDescription(n._remoteDescription.sdp)+t.join(""),!n.usingBundle));d++);r()})},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var n=null;if(this.transceivers.forEach(function(e){e.rtpSender&&e.rtpSender.track===t?n=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(n=e.rtpReceiver)}),!n)throw dt("InvalidAccessError","Invalid selector.");return n.getStats()}var r=[];return this.transceivers.forEach(function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(t){e[t]&&r.push(e[t].getStats())})}),Promise.all(r).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 n=e[t];if(n&&n.prototype&&n.prototype.getStats){var r=n.prototype.getStats;n.prototype.getStats=function(){return r.apply(this).then(function(e){var t=new Map;return Object.keys(e).forEach(function(n){var r;e[n].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(r=e[n]).type]||r.type,t.set(n,e[n])}),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 lt(e){const t=e&&e.navigator,n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(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 pt(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 ft(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 n=new Event("enabled");n.enabled=e,this.dispatchEvent(n)}})}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 n=_t(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 n=e.urls||e.url;e.url&&!e.urls&&je("RTCIceServer.url","RTCIceServer.urls");const r="string"==typeof n;return r&&(n=[n]),n=n.filter(e=>{if(0===e.indexOf("stun:"))return!1;const n=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return n&&!t?(t=!0,!0):n&&!t}),delete e.url,e.urls=r?n[0]:n,!!n.length}})}(e.iceServers,t.version),Ve("ICE servers after filtering:",e.iceServers)),new n(e)},e.RTCPeerConnection.prototype=n.prototype}function ht(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var Rt=Object.freeze({__proto__:null,shimPeerConnection:ft,shimReplaceTrack:ht,shimGetUserMedia:lt,shimGetDisplayMedia:pt});function gt(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){je("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function mt(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 Ct(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 n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]});const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,o)}}function vt(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 n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.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 Tt(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}),Me(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function It(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){je("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function St(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Et(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],n=e&&"sendEncodings"in e;n&&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 r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function Ot(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 bt(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 yt(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 Lt=Object.freeze({__proto__:null,shimOnTrack:mt,shimPeerConnection:Ct,shimSenderGetStats:vt,shimReceiverGetStats:Tt,shimRemoveStream:It,shimRTCDataChannel:St,shimAddTransceiver:Et,shimGetParameters:Ot,shimCreateOffer:bt,shimCreateAnswer:yt,shimGetUserMedia:gt,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}});function kt(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(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.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 n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function At(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 n=new Event("addstream");n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function Nt(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=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},t.createAnswer=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};let s=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){const r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Pt(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Dt(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function Dt(e){return e&&void 0!==e.video?Object.assign({},e,{video:Ge(e.video)}):e}function Ut(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(je("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function wt(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 Mt(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 n=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video")}return t.apply(this,arguments)}}function xt(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Bt=Object.freeze({__proto__:null,shimLocalStreamsAPI:kt,shimRemoteStreamsAPI:At,shimCallbacksAPI:Nt,shimGetUserMedia:Pt,shimConstraints:Dt,shimRTCIceServerUrls:Ut,shimTrackEventTransceiver:wt,shimCreateOfferLegacy:Mt,shimAudioContext:xt});function Vt(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 n=new t(e),r=ot.parseCandidate(e.candidate),i=Object.assign(n,r);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,Me(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function jt(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 n=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=ot.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=ot.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 n=parseInt(t[1],10);return n!=n?-1:n}(arguments[0]),n=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n}(e),r=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const i=ot.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r}(arguments[0],e);let i;i=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return n.apply(this,arguments)}}function Ft(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],i=r.length||r.size||r.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 n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},Me(e,"datachannel",e=>(t(e.channel,e.target),e))}function Gt(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 n=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 n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function Jt(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=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:n}):t.sdp=n}return n.apply(this,arguments)}}function Ht(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.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():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var Kt=Object.freeze({__proto__:null,shimRTCIceCandidate:Vt,shimMaxMessageSize:jt,shimSendThrowTypeError:Ft,shimConnectionState:Gt,removeExtmapAllowMixed:Jt,shimAddIceCandidateNullOrEmpty:Ht});const qt=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const n=Ve,r=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=we(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=we(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=we(n.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=we(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:r,commonShim:Kt,extractVersion:we,disableLog:xe,disableWarnings:Be};switch(r.browser){case"chrome":if(!nt||!et||!t.shimChrome)return n("Chrome shim is not included in this adapter release."),i;if(null===r.version)return n("Chrome shim can not determine version, not shimming."),i;n("adapter.js shimming chrome."),i.browserShim=nt,Ht(e,r),qe(e,r),We(e),et(e,r),ze(e),$e(e,r),Ye(e),Qe(e),Ze(e),tt(e,r),Vt(e),Gt(e),jt(e,r),Ft(e),Jt(e,r);break;case"firefox":if(!Lt||!Ct||!t.shimFirefox)return n("Firefox shim is not included in this adapter release."),i;n("adapter.js shimming firefox."),i.browserShim=Lt,Ht(e,r),gt(e,r),Ct(e,r),mt(e),It(e),vt(e),Tt(e),St(e),Et(e),Ot(e),bt(e),yt(e),Vt(e),Gt(e),jt(e,r),Ft(e);break;case"edge":if(!Rt||!ft||!t.shimEdge)return n("MS edge shim is not included in this adapter release."),i;n("adapter.js shimming edge."),i.browserShim=Rt,lt(e),pt(e),ft(e,r),ht(e),jt(e,r),Ft(e);break;case"safari":if(!Bt||!t.shimSafari)return n("Safari shim is not included in this adapter release."),i;n("adapter.js shimming safari."),i.browserShim=Bt,Ht(e,r),Ut(e),Mt(e),Nt(e),kt(e),At(e),wt(e),Pt(e),xt(e),Vt(e),jt(e,r),Ft(e),Jt(e,r);break;default:n("Unsupported browser!")}return i}({window:"undefined"==typeof window?void 0:window});var Wt,zt,Yt,Qt;exports.RCFrameRate=void 0,(Wt=exports.RCFrameRate||(exports.RCFrameRate={})).FPS_10="FPS_10",Wt.FPS_15="FPS_15",Wt.FPS_24="FPS_24",Wt.FPS_30="FPS_30",exports.RCResolution=void 0,(zt=exports.RCResolution||(exports.RCResolution={})).W176_H132="W176_H132",zt.W176_H144="W176_H144",zt.W180_H180="W180_H180",zt.W240_H180="W240_H180",zt.W240_H240="W240_H240",zt.W256_H144="W256_H144",zt.W320_H180="W320_H180",zt.W320_H240="W320_H240",zt.W360_H360="W360_H360",zt.W480_H360="W480_H360",zt.W480_H480="W480_H480",zt.W640_H360="W640_H360",zt.W640_H480="W640_H480",zt.W720_H480="W720_H480",zt.W848_H480="W848_H480",zt.W960_H720="W960_H720",zt.W1280_H720="W1280_H720",zt.W1920_H1080="W1920_H1080",zt.W144_H176="W144_H176",zt.W144_H256="W144_H256",zt.W180_H240="W180_H240",zt.W180_H320="W180_H320",zt.W240_H320="W240_H320",zt.W360_H480="W360_H480",zt.W360_H640="W360_H640",zt.W480_H640="W480_H640",zt.W480_H720="W480_H720",zt.W480_H848="W480_H848",zt.W720_H1280="W720_H1280",zt.W720_H960="W720_H960",zt.W1080_H1920="W1080_H1920",exports.RCMediaType=void 0,(Yt=exports.RCMediaType||(exports.RCMediaType={}))[Yt.AUDIO_ONLY=0]="AUDIO_ONLY",Yt[Yt.VIDEO_ONLY=1]="VIDEO_ONLY",Yt[Yt.AUDIO_VIDEO=2]="AUDIO_VIDEO";var Zt,Xt=(c(c(c(c(c(c(c(c(c(c(Qt={},exports.RCResolution.W176_H132,{width:176,height:132,maxBitrate:150,minBitrate:80}),exports.RCResolution.W176_H144,{width:176,height:144,maxBitrate:150,minBitrate:80}),exports.RCResolution.W180_H180,{width:180,height:180,maxBitrate:200,minBitrate:100}),exports.RCResolution.W240_H180,{width:240,height:180,maxBitrate:240,minBitrate:120}),exports.RCResolution.W240_H240,{width:240,height:240,maxBitrate:280,minBitrate:120}),exports.RCResolution.W256_H144,{width:256,height:144,maxBitrate:240,minBitrate:120}),exports.RCResolution.W320_H180,{width:320,height:180,maxBitrate:280,minBitrate:120}),exports.RCResolution.W320_H240,{width:320,height:240,maxBitrate:400,minBitrate:120}),exports.RCResolution.W360_H360,{width:360,height:360,maxBitrate:520,minBitrate:140}),exports.RCResolution.W480_H360,{width:480,height:360,maxBitrate:650,minBitrate:150}),c(c(c(c(c(c(c(c(c(c(Qt,exports.RCResolution.W480_H480,{width:480,height:480,maxBitrate:800,minBitrate:180}),exports.RCResolution.W640_H360,{width:640,height:360,maxBitrate:800,minBitrate:180}),exports.RCResolution.W640_H480,{width:640,height:480,maxBitrate:900,minBitrate:200}),exports.RCResolution.W720_H480,{width:720,height:480,maxBitrate:1e3,minBitrate:200}),exports.RCResolution.W848_H480,{width:848,height:480,maxBitrate:1860,minBitrate:200}),exports.RCResolution.W960_H720,{width:960,height:720,maxBitrate:2e3,minBitrate:250}),exports.RCResolution.W1280_H720,{width:1280,height:720,maxBitrate:2200,minBitrate:250}),exports.RCResolution.W1920_H1080,{width:1920,height:1080,maxBitrate:4e3,minBitrate:400}),exports.RCResolution.W144_H176,{width:144,height:176,maxBitrate:150,minBitrate:80}),exports.RCResolution.W144_H256,{width:144,height:256,maxBitrate:240,minBitrate:120}),c(c(c(c(c(c(c(c(c(c(Qt,exports.RCResolution.W180_H240,{width:180,height:240,maxBitrate:240,minBitrate:120}),exports.RCResolution.W180_H320,{width:180,height:320,maxBitrate:280,minBitrate:120}),exports.RCResolution.W240_H320,{width:240,height:320,maxBitrate:400,minBitrate:120}),exports.RCResolution.W360_H480,{width:360,height:480,maxBitrate:650,minBitrate:150}),exports.RCResolution.W360_H640,{width:360,height:640,maxBitrate:800,minBitrate:180}),exports.RCResolution.W480_H640,{width:480,height:640,maxBitrate:900,minBitrate:200}),exports.RCResolution.W480_H720,{width:480,height:720,maxBitrate:1e3,minBitrate:200}),exports.RCResolution.W480_H848,{width:480,height:848,maxBitrate:1860,minBitrate:930}),exports.RCResolution.W720_H1280,{width:720,height:1280,maxBitrate:2200,minBitrate:250}),exports.RCResolution.W720_H960,{width:720,height:960,maxBitrate:2760,minBitrate:910}),c(Qt,exports.RCResolution.W1080_H1920,{width:1080,height:1920,maxBitrate:4e3,minBitrate:400})),$t=function(e){var t={192:180,368:360,1088:1080};return t[e]?t[e]:e},en=function(e,t){e=$t(e),t=$t(t);var n=Xt["W".concat(e,"_H").concat(t)];if(n)return n;var r=e*t;return Object.keys(Xt).map(function(e){return Xt[e]}).sort(function(e,t){return e.height*e.width-t.width*t.height}).filter(function(e){return e.height*e.width>=r})[0]||Xt.W1920_H1080},tn={10:1,15:1,24:1.5,30:1.5},nn=function(e){var t=Number.MAX_VALUE,n=1;for(var r in tn){var i=Math.abs(e-parseInt(r));i<t&&(t=i,n=tn[r])}return n},rn={getCameras:function(){return K(void 0,void 0,void 0,p().m(function e(){var t;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,navigator.mediaDevices.enumerateDevices();case 1:return t=e.v,e.a(2,t.filter(function(e){return"videoinput"===e.kind}))}},e)}))},getMicrophones:function(){return K(void 0,void 0,void 0,p().m(function e(){var t;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,navigator.mediaDevices.enumerateDevices();case 1:return t=e.v,e.a(2,t.filter(function(e){return"audioinput"===e.kind}))}},e)}))},getSpeakers:function(){return K(void 0,void 0,void 0,p().m(function e(){var t;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,navigator.mediaDevices.enumerateDevices();case 1:return t=e.v,e.a(2,t.filter(function(e){return"audiooutput"===e.kind}))}},e)}))}};!function(e){e.AUDIO="audio",e.VIDEO="video"}(Zt||(Zt={}));var on,an=function(){function e(t,n,o,a,s,c){var u;return i(this,e),u=r(this,e),Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"_tag",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_kind",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"_isLocalTrack",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"_roomId",{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,"_element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),u._streamId=[u._userId||u._roomId,u._tag].join("_"),u._id=[u._streamId,u.isAudioTrack()?0:1].join("_"),u}return _(e,F),a(e,[{key:"getStreamId",value:function(){return this._streamId}},{key:"getTrackId",value:function(){return this._id}},{key:"getUserId",value:function(){return this._userId}},{key:"__innerGetMediaStreamTrack",value:function(){return this._msTrack}},{key:"streamTrack",get:function(){return this._msTrack}},{key:"getTag",value:function(){return this._tag}},{key:"isLocalTrack",value:function(){return this._isLocalTrack}},{key:"isVideoTrack",value:function(){return"video"===this._kind}},{key:"isAudioTrack",value:function(){return"audio"===this._kind}},{key:"isReady",value:function(){var e;return"live"===(null===(e=this._msTrack)||void 0===e?void 0:e.readyState)}},{key:"__innerSetMediaStreamTrack",value:function(e){this._msTrack=e,this._setLocalMuted(this._localMuted);var t=this._msStream=this._msStream||new MediaStream,n=t.getTracks()[0];n&&t.removeTrack(n),this._isLocalTrack||this._logger.warn(ye.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)}},{key:"_setLocalMuted",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e,t.a(2,exports.RCRTCCode.SUCCESS)},t,this)}))}},{key:"mute",value:function(){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)if(0===e.n)return e.a(2,this._setLocalMuted(!0))},e,this)}))}},{key:"unmute",value:function(){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)if(0===e.n)return e.a(2,this._setLocalMuted(!1))},e,this)}))}},{key:"isLocalMuted",value:function(){return this._localMuted}},{key:"isMCUTrack",value:function(){return Boolean(this._roomId)}},{key:"isOwnerMuted",value:function(){return this._remoteMuted}},{key:"_validateVolume",value:function(e){if(null==e?void 0:e.volume){if(!y(null==e?void 0:e.volume))return this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.volume not a number"})),{code:exports.RCRTCCode.PARAMS_ERROR};(null==e?void 0:e.volume)<0&&(e.volume=0,this._logger.warn(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.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(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.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"})))}}},{key:"_validatePlayOptions",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i;return p().w(function(n){for(;;)switch(n.n){case 0:if(this._msTrack){n.n=1;break}return this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.TRACK_NOT_READY,kind:this._kind,msg:"the track is not ready to play -> id: ".concat(this._id)})),n.a(2,{code:exports.RCRTCCode.TRACK_NOT_READY});case 1:if("ended"===this._msTrack.readyState&&this._logger.warn(ye.L_TRACK_PLAY_E,"track readyState is ended -> id: ".concat(this._id)),!(r=this._validateVolume(t))){n.n=2;break}return n.a(2,r);case 2:if(!(null==t?void 0:t.audioDeviceId)){n.n=4;break}return n.n=3,rn.getSpeakers();case 3:if(i=n.v.map(function(e){return e.deviceId}),i.includes(t.audioDeviceId)){n.n=4;break}return this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.audioDeviceId"})),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(!this.isVideoTrack()||e&&(e instanceof HTMLVideoElement||this._validateVideoNodeName(e))){n.n=5;break}return this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT,kind:this._kind,msg:"params element is not a HTMLVideoElement"})),n.a(2,{code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT});case 5:return n.a(2)}},n,this)}))}},{key:"_setPlayAttrs",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r;return p().w(function(n){for(;;)switch(n.n){case 0:if(e&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),!(null==t?void 0:t.audioDeviceId)||e){n.n=1;break}return n.n=1,this._element.setSinkId(t.audioDeviceId);case 1: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());case 2:return n.a(2)}},n,this)}))}},{key:"play",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o=this;return p().w(function(n){for(;;)switch(n.n){case 0:return this._logger.info(ye.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})),n.n=1,this._validatePlayOptions(e,t);case 1:if(!(r=n.v)){n.n=2;break}return n.a(2,r);case 2:return i=this.isVideoTrack(),this._element=i?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;o._logger.info(ye.L_TRACK_LOAD_START_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onloadstart -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.ondurationchange=function(e){var t;o._logger.info(ye.L_TRACK_DURATION_CHANGE_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement ondurationchange -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.onloadedmetadata=function(e){var t;o._logger.info(ye.L_TRACK_LOADED_META_DATA_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onloadedmetadata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.onloadeddata=function(e){var t;o._logger.info(ye.L_TRACK_LOADED_DATA_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onloadeddata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.onabort=function(e){var t;o._logger.info(ye.L_TRACK_ABORT_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onabort -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.oncanplay=function(e){return K(o,void 0,void 0,p().m(function n(){var r,o,a;return p().w(function(n){for(;;)switch(n.p=n.n){case 0:if(this._logger.info(ye.L_TRACK_CANPLAY_O,JSON.stringify({status:Le.INFO,kind:this._kind,msg:"HTMLMediaElement oncanplay -> id: ".concat(null===(r=e.target)||void 0===r?void 0:r.id,", trackId: ").concat(this._id)})),n.p=1,!(null==t?void 0:t.audioDeviceId)||i){n.n=2;break}return n.n=2,this._element.setSinkId(t.audioDeviceId);case 2:return n.n=3,null===(o=this._element)||void 0===o?void 0:o.play();case 3:n.n=6;break;case 4:if(n.p=4,"No permission to use requested device"!==(a=n.v).message){n.n=5;break}return this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,kind:this._kind,code:exports.RCRTCCode.NO_PERMISSION_TO_USE_REQUESTED_DEVICE,msg:"setSinkId failed, error msg: ".concat(a.message)})),n.a(2);case 5:this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.TRACK_PLAY_ERROR,kind:this._kind,msg:"play error, error msg: ".concat(a.message)}));case 6:return n.a(2)}},n,this,[[1,4]])}))},this._element.onvolumechange=function(e){var t,n,r=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));o._logger.info(ye.L_TRACK_VOLUME_CHANGE_O,JSON.stringify({status:Le.INFO,msg:"HTMLMediaElement onvolumechange -> id: ".concat(null===(n=e.target)||void 0===n?void 0:n.id,", volume: ").concat(r,", trackId: ").concat(o._id)}))},this._element.srcObject=this._msStream,this._element.autoplay=!0,n.n=3,this._setPlayAttrs(i,t);case 3:return n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}},{key:"__innerDestroy",value:function(){this.__innerSetMediaStreamTrack(void 0)}},{key:"__releaseMediaElement",value:function(){this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(this._element.remove(),this._element.srcObject=null)}},{key:"_validateVideoNodeName",value:function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()}}])}();exports.RCAudioBitrate=void 0,(on=exports.RCAudioBitrate||(exports.RCAudioBitrate={})).Speech="Speech",on.Music="Music",on.MusicHigh="MusicHigh";var sn,cn=c(c(c({},exports.RCAudioBitrate.Music,{max:64,min:64}),exports.RCAudioBitrate.MusicHigh,{max:128,min:128}),exports.RCAudioBitrate.Speech,{max:32,min:32});exports.RCVideoBitrate=void 0,(sn=exports.RCVideoBitrate||(exports.RCVideoBitrate={})).LEVEL0="LEVEL0",sn.LEVEL1="LEVEL1",sn.LEVEL2="LEVEL2",sn.LEVEL3="LEVEL3",sn.LEVEL4="LEVEL4",sn.LEVEL5="LEVEL5";var un=c(c(c(c(c(c({},exports.RCVideoBitrate.LEVEL0,{max:150,min:80}),exports.RCVideoBitrate.LEVEL1,{max:280,min:120}),exports.RCVideoBitrate.LEVEL2,{max:650,min:150}),exports.RCVideoBitrate.LEVEL3,{max:1e3,min:200}),exports.RCVideoBitrate.LEVEL4,{max:2200,min:250}),exports.RCVideoBitrate.LEVEL5,{max:4e3,min:400}),dn=function(){function e(){i(this,e)}return a(e,null,[{key:"apply3ANoiseWorklet",value:function(t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u;return p().w(function(n){for(;;)switch(n.p=n.n){case 0:return r=new AudioContext({sampleRate:44100}),n.p=1,n.n=2,r.audioWorklet.addModule(e.SCRIPT_URL);case 2:return n.n=3,fetch(e.WASM_URL,{cache:"force-cache",credentials:"same-origin"});case 3:return o=n.v,n.n=4,o.arrayBuffer();case 4:i=n.v,n.n=6;break;case 5:return n.p=5,n.v,n.a(2,{code:exports.RCRTCCode.LOAD_3A_MODULE_FAILED});case 6:return a=r.createMediaStreamSource(new MediaStream([t])),s=new AudioWorkletNode(r,"process-worklet",{numberOfInputs:1,numberOfOutputs:1,outputChannelCount:[1],processorOptions:{binary:i}}),c=r.createMediaStreamDestination(),a.connect(s).connect(c),u=c.stream.getAudioTracks()[0],e._maps.set(t.id,r),n.a(2,{code:exports.RCRTCCode.SUCCESS,track:u})}},n,null,[[1,5]])}))}},{key:"release3ANoiseWorklet",value:function(t){var n=e._maps.get(t.id);n&&(n.close(),e._maps.delete(t.id))}}])}();Object.defineProperty(dn,"WASM_URL",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(dn,"SCRIPT_URL",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(dn,"_maps",{enumerable:!0,configurable:!0,writable:!0,value:new Map});var _n=function(){function e(t,n,o,a,s){var c;return i(this,e),c=r(this,e,[t,n,o,a,!0]),Object.defineProperty(c,"_isDestroyed",{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(s),s.onended=function(){s.onended=null,c._onTrackEnded()},c}return _(e,an),a(e,[{key:"_onTrackEnded",value:function(){this.emit(e.EVENT_LOCAL_TRACK_END,this),this.removeAll(e.EVENT_LOCAL_TRACK_END)}},{key:"_setLocalMuted",value:function(t){var n=this;return new Promise(function(r){var i=n._localMuted!==t;C(e,"_setLocalMuted",n,3)([t]),n._remoteMuted=n._localMuted,i&&n._isPublished?n.emit(e.__INNER_EVENT_MUTED_CHANGE__,n,r):r(exports.RCRTCCode.SUCCESS),n._logger.info(ye.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({enable:t,trackId:n._id}))})}},{key:"__innerSetPublished",value:function(e){this._isPublished=e}},{key:"isPublished",value:function(){return this._isPublished}},{key:"destroy",value:function(){var t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._isDestroyed||(this._logger.info(ye.L_LOCAL_TRACK_DESTROY_O,this._id),this._isDestroyed=!0,null===(t=this._msTrack)||void 0===t||t.stop(),C(e,"__innerDestroy",this,3)([]),this.isAudioTrack()&&C(e,"__releaseMediaElement",this,3)([]),this._isPublished&&n&&this.emit(e.__INNER_EVENT_DESTROY__,this))}},{key:"isDestroyed",value:function(){return this._isDestroyed}},{key:"setBitrate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;!y(e)||!y(t)||!y(n)||e<=0||t<=0||e<t?this._logger.error(ye.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> max: ".concat(e,",min: ").concat(t,", start: ").concat(n),trackId:this._id})):(this._logger.info(ye.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,max:e,min:t,start:n,trackId:this._id})),this._bitrateInfo={max:e,min:t,start:n})}},{key:"getBitrate",value:function(){var e,t,n,r,i,o,a,s=0,c=0,u=0;if((null===(e=this._msTrack)||void 0===e?void 0:e.kind)===Zt.VIDEO){var d=Nn(this._msTrack);s=d.min,c=d.max}else if((null===(t=this._msTrack)||void 0===t?void 0:t.kind)===Zt.AUDIO){var _={min:32,max:32};s=_.min,c=_.max}return(null===(n=this._bitrateInfo)||void 0===n?void 0:n.max)&&(u=.7*(null===(r=this._bitrateInfo)||void 0===r?void 0:r.max)),{min:(null===(i=this._bitrateInfo)||void 0===i?void 0:i.min)||s,max:(null===(o=this._bitrateInfo)||void 0===o?void 0:o.max)||c,start:(null===(a=this._bitrateInfo)||void 0===a?void 0:a.start)||u}}},{key:"getSettings",value:function(){var e;return null===(e=this._msTrack)||void 0===e?void 0:e.getSettings()}}])}();Object.defineProperty(_n,"EVENT_LOCAL_TRACK_END",{enumerable:!0,configurable:!0,writable:!0,value:"local-track-end"}),Object.defineProperty(_n,"__INNER_EVENT_MUTED_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-muted-change"}),Object.defineProperty(_n,"__INNER_EVENT_DESTROY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-destroy"});var ln=function(){function e(t,n,o,a){return i(this,e),r(this,e,[t,n,o,"audio",a])}return _(e,_n),a(e,[{key:"setRecommendBitrate",value:function(e){if(j("audioBitrate",e,function(e){return e in exports.RCAudioBitrate})){var t=cn[e];this.setBitrate(t.max,t.min,t.start||.7*t.max)}else this._logger.warn(ye.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> params type is RCAudioBitrate"}))}},{key:"setBitrate",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=r[0],a=void 0===o?1:o,s=r[1],c=void 0===s?.7*t||1:s;C(e,"setBitrate",this,3)([t,a,c])}}])}(),pn=function(){function e(t,n,o,a){var s,c=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return i(this,e),s=r(this,e,[t,n,o,"video",a]),Object.defineProperty(s,"_isTiny",{enumerable:!0,configurable:!0,writable:!0,value:c}),s}return _(e,_n),a(e,[{key:"__isTiny",value:function(){return this._isTiny}},{key:"getStreamId",value:function(){var t=C(e,"getStreamId",this,3)([]);return this._isTiny?"".concat(t,"_tiny"):t}},{key:"getTrackId",value:function(){var t=C(e,"getTrackId",this,3)([]);return this._isTiny?"".concat(t,"_tiny"):t}},{key:"setRecommendBitrate",value:function(e){if(j("videoBitrate",e,function(e){return e in exports.RCVideoBitrate})){var t=un[e];this.setBitrate(t.max,t.min,t.start||.7*t.max)}else this._logger.warn(ye.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> params type is RCVideoBitrate"}))}},{key:"setBitrate",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=r[0],a=void 0===o?1:o,s=r[1],c=void 0===s?.7*t||1:s;C(e,"setBitrate",this,3)([t,a,c])}}])}(),fn=function(){function e(t,n,o,a,s,c){var u;return i(this,e),u=r(this,e,[t,n,o,a,s]),Object.defineProperty(u,"_resource",{enumerable:!0,configurable:!0,writable:!0,value:c}),e._innerSetMapping(u.getTrackId(),c),u}return _(e,_n),a(e,[{key:"destroy",value:function(){this.isAudioTrack()&&this.mute(),e._innerRemoveMapping(this.getTrackId(),this._resource),C(e,"destroy",this,3)([])}}],[{key:"_innerSetMapping",value:function(e,t){var n=this._mapping.get(t)||[];n.push(e),this._mapping.set(t,n)}},{key:"_innerRemoveMapping",value:function(e,t){var n,r,i=null===(n=this._mapping.get(t))||void 0===n?void 0:n.filter(function(t){return t!==e});i&&i.length>0?this._mapping.set(t,i):(this._mapping.delete(t),t.pause(),t.src="",null===(r=t.parentNode)||void 0===r||r.removeChild(t))}}])}();Object.defineProperty(fn,"_mapping",{enumerable:!0,configurable:!0,writable:!0,value:new Map});var hn,Rn=function(){function e(t,n,o,a,s){return i(this,e),r(this,e,[t,n,o,"video",a,s])}return _(e,fn),a(e)}(),gn=function(){function e(t,n,o,a,s){return i(this,e),r(this,e,[t,n,o,"audio",a,s])}return _(e,fn),a(e,[{key:"_setLocalMuted",value:function(t){var n=this,r=Object.create(null,{_setLocalMuted:{get:function(){return C(e,"_setLocalMuted",n,1)}}});return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)if(0===e.n)return this._resource&&(this._resource.muted=t),e.a(2,r._setLocalMuted.call(this,t))},e,this)}))}},{key:"play",value:function(){return K(this,void 0,void 0,p().m(function e(){var t;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._setLocalMuted(!1);case 1:return t=e.v,e.a(2,{code:t})}},e,this)}))}}])}(),mn=function(){function e(){var t;return i(this,e),t=r(this,e,arguments),Object.defineProperty(t,"_originTrack",{enumerable:!0,configurable:!0,writable:!0,value:null}),t}return _(e,ln),a(e,[{key:"apply3ANoiseWorklet",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r;return p().w(function(e){for(;;)switch(e.n){case 0:if(this._logger.info(ye.A_APPLY_3A_NOISE_WORKLET_T),!this._originTrack){e.n=1;break}return this._logger.warn(ye.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"3A noise module already applied"})),e.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:if(this._msTrack&&!this.isDestroyed()){e.n=2;break}return this._logger.warn(ye.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"track not ready"})),e.a(2,{code:exports.RCRTCCode.TRACK_NOT_READY});case 2:if(!this.isPublished()){e.n=3;break}return this._logger.warn(ye.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"track already published"})),e.a(2,{code:exports.RCRTCCode.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH});case 3:return e.n=4,dn.apply3ANoiseWorklet(this._msTrack);case 4:if(t=e.v,n=t.code,r=t.track,n===exports.RCRTCCode.SUCCESS&&r){e.n=5;break}return this._logger.warn(ye.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"apply 3A noise module failed: ".concat(n),SCRIPT_URL:dn.SCRIPT_URL,WASM_URL:dn.WASM_URL})),e.a(2,{code:n});case 5:return this._originTrack=this._msTrack,this._msTrack=r,this._logger.info(ye.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.SUCCESSED})),e.a(2,{code:exports.RCRTCCode.SUCCESS})}},e,this)}))}},{key:"__innerSetMediaStreamTrack",value:function(t){!t&&this._originTrack&&(dn.release3ANoiseWorklet(this._originTrack),this._originTrack.stop(),this._originTrack=null),C(e,"__innerSetMediaStreamTrack",this,3)([t])}},{key:"replaceInnerTrack",value:function(e){}}])}(),Cn=function(){function e(t,n,o,a){var s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return i(this,e),r(this,e,[t,n,o,a,s])}return _(e,pn),a(e,[{key:"replaceInnerTrack",value:function(e){}}])}(),vn=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,pn),a(e,[{key:"_onTrackEnded",value:function(){C(e,"_onTrackEnded",this,3)([]),this.isPublished()&&this.emit(_n.__INNER_EVENT_DESTROY__,this)}}])}(),Tn=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,ln),a(e,[{key:"_onTrackEnded",value:function(){C(e,"_onTrackEnded",this,3)([]),this.isPublished()&&this.emit(_n.__INNER_EVENT_DESTROY__,this)}}])}(),In=function(){function e(t,n,o,a,s){var c;return i(this,e),c=r(this,e,[t,n,o,a,!1,s]),Object.defineProperty(c,"_isSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),c}return _(e,an),a(e,[{key:"__innerSetRemoteMuted",value:function(e){this._remoteMuted=e}},{key:"__innerSetSubscribed",value:function(e){this._isSubscribed=e}},{key:"isSubscribed",value:function(){return this._isSubscribed}}])}(),Sn=function(){function e(t,n,o,a){return i(this,e),r(this,e,[t,n,o,"audio",a])}return _(e,In),a(e,[{key:"_setLocalMuted",value:function(t){var n=Gn.browser,r=Gn.version;return this._element&&r&&/chrome/i.test(n)&&r>=130&&(this._element.muted=t),C(e,"_setLocalMuted",this,3)([t])}},{key:"getVolume",value:function(){var e;return 100*((null===(e=this._element)||void 0===e?void 0:e.volume)||0)}}])}(),En=function(){function e(t,n,o,a){var s;return i(this,e),s=r(this,e,[t,n,o,"video",a]),Object.defineProperty(s,"_isSubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),s}return _(e,In),a(e,[{key:"__innerSetIsTinyTrack",value:function(e){this._isSubTiny=e}},{key:"isSubTiny",value:function(){return this._isSubTiny}}])}();exports.RCRTCGenerateSummarizationFormat=void 0,(hn=exports.RCRTCGenerateSummarizationFormat||(exports.RCRTCGenerateSummarizationFormat={}))[hn.MARK_DOWN=0]="MARK_DOWN",hn[hn.JSON=1]="JSON";var On,bn=function(e,t){return{name:e,content:JSON.stringify({uris:t,ignore:!0})}},yn=function(e){return JSON.stringify(e)},Ln=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},kn=function(e){if(void 0===e)return 0;if(y(e))return e;var t=e;return t.exact||t.ideal||t.max||0},An=function(e){var t=e.getSettings(),n=e.getConstraints();return{width:kn(n.width)||t.width||0,height:kn(n.height)||t.height||0,frameRate:t.frameRate||kn(n.frameRate)}},Nn=function(e){var t=An(e),n=t.width,r=t.height,i=t.frameRate,o=en(n||1920,r||1080),a=nn(i);return{min:o.minBitrate*a,max:o.maxBitrate*a}},Pn=function(e){return[e.msid,e.mediaType].join("_")},Dn=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},Un=function(e,t){return[e,t].join("_")},wn=function(e){return e.map(function(e){return Object.assign({},e)})},Mn=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e=e.slice();var r=[],i=[],o=[];return t.forEach(function(t){var i=Pn(t),a=e.findIndex(function(e){return Pn(e)===i});if(n&&(a=e.findIndex(function(e){return e.uri===t.uri})),-1!==a){var s=e[a];s.uri!==t.uri?r.push(t):s.state!==t.state&&o.push(t),e.splice(a,1)}else r.push(t)}),i.push.apply(i,v(e)),{publishedList:r,unpublishedList:i,modifiedList:o}},xn=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(""),n=t.length+1,r=+e,i=[];do{var o=r%n;r=(r-o)/n,i.unshift(t[o])}while(r);return i.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e},Bn=function(e){if(Xt[e]){var t=Xt[e];return{width:t.width,height:t.height}}var n=m(e.split("_").map(function(e){return parseInt(e.replace(/[^\d]/g,""))}),2);return{width:n[0],height:n[1]}},Vn=function(e){return!!exports.RCResolution[e]},jn=function(e){return!!exports.RCFrameRate[e]},Fn=function(e){return parseInt(e.replace("FPS_",""))},Gn={browser:(On=qt.browserDetails).browser,version:On.version,supportsUnifiedPlan:!1!==On.supportsUnifiedPlan};function Jn(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function Hn(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var Kn,qn,Wn=function(e){return"[object Null]"===Object.prototype.toString.call(e)},zn=function(e){return 1===e.type},Yn=function(e,t){var n=0;return e.forEach(function(e){var r=e instanceof _n?e.getTrackId():e.track.getTrackId();t.getLocalTrack(r)||(e instanceof _n?n++:e.pubTiny&&e.track.isVideoTrack()&&(n+=2))}),n},Qn=function(e,t,n,r){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,v(JSON.parse(s.uris)))}catch(e){n.warn(ye.L_PARSE_ROOMDATA_URIS_R,"invalid user data -> userId: ".concat(o,", userData: ").concat(s),r)}i[o]=a}),i},Zn=function(e,t){for(var n=!1,r=0,i=0;i<t.length;i++){var o=t[i];if("".concat(e.msid,"_").concat(e.mediaType)==="".concat(o.msid,"_").concat(o.mediaType)){n=!0,r=i;break}}return{isInclude:n,index:r}},Xn=function(e){return e instanceof an?e.getTrackId():e.track.getTrackId()},$n=function(e){if(!A(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)},er=function(e){if("destLang"in e&&!O(e.destLang))return{isValid:!1,key:"destLang"};if("customPrompt"in e&&!O(e.customPrompt))return{isValid:!1,key:"customPrompt"};if("enableSummarization"in e&&!b(e.enableSummarization))return{isValid:!1,key:"enableSummarization"};if("enableSummarizationDetails"in e&&!b(e.enableSummarizationDetails))return{isValid:!1,key:"enableSummarizationDetails"};if("enableChapterSummary"in e&&!b(e.enableChapterSummary))return{isValid:!1,key:"enableChapterSummary"};if("enableTodoList"in e&&!b(e.enableTodoList))return{isValid:!1,key:"enableTodoList"};if("enableHashtag"in e&&!b(e.enableHashtag))return{isValid:!1,key:"enableHashtag"};if("format"in e&&void 0===exports.RCRTCGenerateSummarizationFormat[e.format])return{isValid:!1,key:"format"};var t=e.enableSummarization||e.enableSummarizationDetails||e.enableChapterSummary||e.enableTodoList||e.enableHashtag;return e.customPrompt||t?{isValid:!0,key:""}:{isValid:!1,key:"at least one of the summary features must be enabled"}};!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",e.ASR_STATUS="RCRTC:AsrStatus",e.ASR_SEI="RCRTC:PublishSeiAi",e.SUMMARIZATION_STATUS="RCRTC:Summarization"}(Kn||(Kn={})),exports.RCRTCPingResult=void 0,(qn=exports.RCRTCPingResult||(exports.RCRTCPingResult={})).SUCCESS="Success",qn.FAIL="Fail";var tr=function(){return a(function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_roomMode",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_gap",{enumerable:!0,configurable:!0,writable:!0,value:o}),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},[{key:"start",value:function(e){this._started||(e<15e3&&(e=15e3),this._logger.info(ye.L_PINGER_START_O,JSON.stringify({interval:this._gap,offlineKickTime:e})),this._started=!0,this._checkAlive(e))}},{key:"_sendPing",value:function(){var e=this;return new Promise(function(t){e._context.rtcPing(e._roomId,e._roomMode).then(t),setTimeout(t,5e3,{code:Pe})})}},{key:"_checkAlive",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c=this;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this._context.logger,r=n.createTraceId(),t.n=1,this._sendPing();case 1:if(i=t.v,o=i.code,a=i.data,this._started){t.n=2;break}return t.a(2);case 2:if(s=Date.now(),o!==ke){t.n=3;break}return this._latestTimestamp=s,this.onPingResult(exports.RCRTCPingResult.SUCCESS,a.version),this._timer=setTimeout(function(){return c._checkAlive(e)},this._gap),t.a(2);case 3:if(n.error(ye.L_PINGER_SEND_RTCPING_E,JSON.stringify({roomId:this._roomId,code:o}),r),this.onPingResult(exports.RCRTCPingResult.FAIL),!(40003===o||s-this._latestTimestamp>e)){t.n=4;break}return this.stop(),this.onFailed(40003===o),t.a(2);case 4:this._timer=setTimeout(function(){return c._checkAlive(e)},this._gap);case 5:return t.a(2)}},t,this)}))}},{key:"stop",value:function(){this._started&&(this._logger.info(ye.L_PINGER_STOP_O),this._started=!1,this._timer&&(clearTimeout(this._timer),this._timer=null))}}])}();function nr(e){let t=e.length;for(;--t>=0;)e[t]=0}const rr=256,ir=286,or=30,ar=15,sr=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]),cr=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]),ur=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),dr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_r=new Array(576);nr(_r);const lr=new Array(60);nr(lr);const pr=new Array(512);nr(pr);const fr=new Array(256);nr(fr);const hr=new Array(29);nr(hr);const Rr=new Array(or);function gr(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let mr,Cr,vr;function Tr(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}nr(Rr);const Ir=e=>e<256?pr[e]:pr[256+(e>>>7)],Sr=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Er=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,Sr(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Or=(e,t,n)=>{Er(e,n[2*t],n[2*t+1])},br=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},yr=(e,t,n)=>{const r=new Array(16);let i,o,a=0;for(i=1;i<=ar;i++)a=a+n[i-1]<<1,r[i]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=br(r[t]++,t))}},Lr=e=>{let t;for(t=0;t<ir;t++)e.dyn_ltree[2*t]=0;for(t=0;t<or;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},kr=e=>{e.bi_valid>8?Sr(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Ar=(e,t,n,r)=>{const i=2*t,o=2*n;return e[i]<e[o]||e[i]===e[o]&&r[t]<=r[n]},Nr=(e,t,n)=>{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Ar(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Ar(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},Pr=(e,t,n)=>{let r,i,o,a,s=0;if(0!==e.sym_next)do{r=255&e.pending_buf[e.sym_buf+s++],r+=(255&e.pending_buf[e.sym_buf+s++])<<8,i=e.pending_buf[e.sym_buf+s++],0===r?Or(e,i,t):(o=fr[i],Or(e,o+rr+1,t),a=sr[o],0!==a&&(i-=hr[o],Er(e,i,a)),r--,o=Ir(r),Or(e,o,n),a=cr[o],0!==a&&(r-=Rr[o],Er(e,r,a)))}while(s<e.sym_next);Or(e,256,t)},Dr=(e,t)=>{const n=t.dyn_tree,r=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!==n[2*a]?(e.heap[++e.heap_len]=u=a,e.depth[a]=0):n[2*a+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=u<2?++u:0,n[2*c]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=r[2*c+1]);for(t.max_code=u,a=e.heap_len>>1;a>=1;a--)Nr(e,n,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Nr(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[2*c]=n[2*a]+n[2*s],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[2*a+1]=n[2*s+1]=c,e.heap[1]=c++,Nr(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,r=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,d,_,l,p,f,h=0;for(l=0;l<=ar;l++)e.bl_count[l]=0;for(n[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)d=e.heap[u],l=n[2*n[2*d+1]+1]+1,l>c&&(l=c,h++),n[2*d+1]=l,d>r||(e.bl_count[l]++,p=0,d>=s&&(p=a[d-s]),f=n[2*d],e.opt_len+=f*(l+p),o&&(e.static_len+=f*(i[2*d+1]+p)));if(0!==h){do{for(l=c-1;0===e.bl_count[l];)l--;e.bl_count[l]--,e.bl_count[l+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(l=c;0!==l;l--)for(d=e.bl_count[l];0!==d;)_=e.heap[--u],_>r||(n[2*_+1]!==l&&(e.opt_len+=(l-n[2*_+1])*n[2*_],n[2*_+1]=l),d--)}})(e,t),yr(n,u,e.bl_count)},Ur=(e,t,n)=>{let r,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=a,a=t[2*(r+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))},wr=(e,t,n)=>{let r,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),r=0;r<=n;r++)if(i=a,a=t[2*(r+1)+1],!(++s<c&&i===a)){if(s<u)do{Or(e,i,e.bl_tree)}while(0!==--s);else 0!==i?(i!==o&&(Or(e,i,e.bl_tree),s--),Or(e,16,e.bl_tree),Er(e,s-3,2)):s<=10?(Or(e,17,e.bl_tree),Er(e,s-3,3)):(Or(e,18,e.bl_tree),Er(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 Mr=!1;const xr=(e,t,n,r)=>{Er(e,0+(r?1:0),3),kr(e),Sr(e,n),Sr(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var Br=(e,t,n,r)=>{let i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&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<rr;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Dr(e,e.l_desc),Dr(e,e.d_desc),a=(e=>{let t;for(Ur(e,e.dyn_ltree,e.l_desc.max_code),Ur(e,e.dyn_dtree,e.d_desc.max_code),Dr(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*dr[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=n+5,n+4<=i&&-1!==t?xr(e,t,n,r):4===e.strategy||o===i?(Er(e,2+(r?1:0),3),Pr(e,_r,lr)):(Er(e,4+(r?1:0),3),((e,t,n,r)=>{let i;for(Er(e,t-257,5),Er(e,n-1,5),Er(e,r-4,4),i=0;i<r;i++)Er(e,e.bl_tree[2*dr[i]+1],3);wr(e,e.dyn_ltree,t-1),wr(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Pr(e,e.dyn_ltree,e.dyn_dtree)),Lr(e),r&&kr(e)},Vr={_tr_init:e=>{Mr||((()=>{let e,t,n,r,i;const o=new Array(16);for(n=0,r=0;r<28;r++)for(hr[r]=n,e=0;e<1<<sr[r];e++)fr[n++]=r;for(fr[n-1]=r,i=0,r=0;r<16;r++)for(Rr[r]=i,e=0;e<1<<cr[r];e++)pr[i++]=r;for(i>>=7;r<or;r++)for(Rr[r]=i<<7,e=0;e<1<<cr[r]-7;e++)pr[256+i++]=r;for(t=0;t<=ar;t++)o[t]=0;for(e=0;e<=143;)_r[2*e+1]=8,e++,o[8]++;for(;e<=255;)_r[2*e+1]=9,e++,o[9]++;for(;e<=279;)_r[2*e+1]=7,e++,o[7]++;for(;e<=287;)_r[2*e+1]=8,e++,o[8]++;for(yr(_r,287,o),e=0;e<or;e++)lr[2*e+1]=5,lr[2*e]=br(e,5);mr=new gr(_r,sr,257,ir,ar),Cr=new gr(lr,cr,0,or,ar),vr=new gr(new Array(0),ur,0,19,7)})(),Mr=!0),e.l_desc=new Tr(e.dyn_ltree,mr),e.d_desc=new Tr(e.dyn_dtree,Cr),e.bl_desc=new Tr(e.bl_tree,vr),e.bi_buf=0,e.bi_valid=0,Lr(e)},_tr_stored_block:xr,_tr_flush_block:Br,_tr_tally:(e,t,n)=>(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++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(fr[n]+rr+1)]++,e.dyn_dtree[2*Ir(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Er(e,2,3),Or(e,256,_r),(e=>{16===e.bi_valid?(Sr(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 jr=(e,t,n,r)=>{let i=65535&e,o=e>>>16&65535,a=0;for(;0!==n;){a=n>2e3?2e3:n,n-=a;do{i=i+t[r++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16};const Fr=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var Gr=(e,t,n,r)=>{const i=Fr,o=r+n;e^=-1;for(let n=r;n<o;n++)e=e>>>8^i[255&(e^t[n])];return-1^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"},Hr={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:Kr,_tr_stored_block:qr,_tr_flush_block:Wr,_tr_tally:zr,_tr_align:Yr}=Vr,{Z_NO_FLUSH:Qr,Z_PARTIAL_FLUSH:Zr,Z_FULL_FLUSH:Xr,Z_FINISH:$r,Z_BLOCK:ei,Z_OK:ti,Z_STREAM_END:ni,Z_STREAM_ERROR:ri,Z_DATA_ERROR:ii,Z_BUF_ERROR:oi,Z_DEFAULT_COMPRESSION:ai,Z_FILTERED:si,Z_HUFFMAN_ONLY:ci,Z_RLE:ui,Z_FIXED:di,Z_DEFAULT_STRATEGY:_i,Z_UNKNOWN:li,Z_DEFLATED:pi}=Hr,fi=258,hi=262,Ri=42,gi=113,mi=666,Ci=(e,t)=>(e.msg=Jr[t],t),vi=e=>2*e-(e>4?9:0),Ti=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ii=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do{n=e.head[--r],e.head[r]=n>=i?n-i:0}while(--t);t=i,r=t;do{n=e.prev[--r],e.prev[r]=n>=i?n-i:0}while(--t)};let Si=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const Ei=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},Oi=(e,t)=>{Wr(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Ei(e.strm)},bi=(e,t)=>{e.pending_buf[e.pending++]=t},yi=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Li=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),1===e.state.wrap?e.adler=jr(e.adler,t,i,n):2===e.state.wrap&&(e.adler=Gr(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},ki=(e,t)=>{let n,r,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-hi?e.strstart-(e.w_size-hi):0,u=e.window,d=e.w_mask,_=e.prev,l=e.strstart+fi;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(n=t,u[n+a]===f&&u[n+a-1]===p&&u[n]===u[o]&&u[++n]===u[o+1]){o+=2,n++;do{}while(u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&o<l);if(r=fi-(l-o),o=l-fi,r>a){if(e.match_start=t,a=r,r>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=_[t&d])>c&&0!==--i);return a<=e.lookahead?a:e.lookahead},Ai=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-hi)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Ii(e),r+=t),0===e.strm.avail_in)break;if(n=Li(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Si(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Si(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<hi&&0!==e.strm.avail_in)},Ni=(e,t)=>{let n,r,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(n=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,r=e.strstart-e.block_start,n>r+e.strm.avail_in&&(n=r+e.strm.avail_in),n>i&&(n=i),n<o&&(0===n&&t!==$r||t===Qr||n!==r+e.strm.avail_in))break;a=t===$r&&n===r+e.strm.avail_in?1:0,qr(e,0,0,a),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Ei(e.strm),r&&(r>n&&(r=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,n-=r),n&&(Li(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}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!==Qr&&t!==$r&&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&&(Li(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,r=e.strstart-e.block_start,(r>=o||(r||t===$r)&&t!==Qr&&0===e.strm.avail_in&&r<=i)&&(n=r>i?i:r,a=t===$r&&0===e.strm.avail_in&&n===r?1:0,qr(e,e.block_start,n,a),e.block_start+=n,Ei(e.strm)),a?3:1)},Pi=(e,t)=>{let n,r;for(;;){if(e.lookahead<hi){if(Ai(e),e.lookahead<hi&&t===Qr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Si(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-hi&&(e.match_length=ki(e,n)),e.match_length>=3)if(r=zr(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=Si(e,e.ins_h,e.window[e.strstart+3-1]),n=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=Si(e,e.ins_h,e.window[e.strstart+1]);else r=zr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Oi(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===$r?(Oi(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Oi(e,!1),0===e.strm.avail_out)?1:2},Di=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<hi){if(Ai(e),e.lookahead<hi&&t===Qr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Si(e,e.ins_h,e.window[e.strstart+3-1]),n=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!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-hi&&(e.match_length=ki(e,n),e.match_length<=5&&(e.strategy===si||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,r=zr(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=Si(e,e.ins_h,e.window[e.strstart+3-1]),n=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++,r&&(Oi(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(r=zr(e,0,e.window[e.strstart-1]),r&&Oi(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&&(r=zr(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===$r?(Oi(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Oi(e,!1),0===e.strm.avail_out)?1:2};function Ui(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const wi=[new Ui(0,0,0,0,Ni),new Ui(4,4,8,4,Pi),new Ui(4,5,16,8,Pi),new Ui(4,6,32,32,Pi),new Ui(4,4,16,16,Di),new Ui(8,16,32,32,Di),new Ui(8,16,128,128,Di),new Ui(8,32,128,256,Di),new Ui(32,128,258,1024,Di),new Ui(32,258,258,4096,Di)];function Mi(){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=pi,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),Ti(this.dyn_ltree),Ti(this.dyn_dtree),Ti(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),Ti(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ti(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 xi=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Ri&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==gi&&t.status!==mi?1:0},Bi=e=>{if(xi(e))return Ci(e,ri);e.total_in=e.total_out=0,e.data_type=li;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?Ri:gi,e.adler=2===t.wrap?0:1,t.last_flush=-2,Kr(t),ti},Vi=e=>{const t=Bi(e);var n;return t===ti&&((n=e.state).window_size=2*n.w_size,Ti(n.head),n.max_lazy_match=wi[n.level].max_lazy,n.good_match=wi[n.level].good_length,n.nice_match=wi[n.level].nice_length,n.max_chain_length=wi[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),t},ji=(e,t,n,r,i,o)=>{if(!e)return ri;let a=1;if(t===ai&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>9||n!==pi||r<8||r>15||t<0||t>9||o<0||o>di||8===r&&1!==a)return Ci(e,ri);8===r&&(r=9);const s=new Mi;return e.state=s,s.strm=e,s.status=Ri,s.wrap=a,s.gzhead=null,s.w_bits=r,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=n,Vi(e)};var Fi={deflateInit:(e,t)=>ji(e,t,pi,15,8,_i),deflateInit2:ji,deflateReset:Vi,deflateResetKeep:Bi,deflateSetHeader:(e,t)=>xi(e)||2!==e.state.wrap?ri:(e.state.gzhead=t,ti),deflate:(e,t)=>{if(xi(e)||t>ei||t<0)return e?Ci(e,ri):ri;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===mi&&t!==$r)return Ci(e,0===e.avail_out?oi:ri);const r=n.last_flush;if(n.last_flush=t,0!==n.pending){if(Ei(e),0===e.avail_out)return n.last_flush=-1,ti}else if(0===e.avail_in&&vi(t)<=vi(r)&&t!==$r)return Ci(e,oi);if(n.status===mi&&0!==e.avail_in)return Ci(e,oi);if(n.status===Ri&&0===n.wrap&&(n.status=gi),n.status===Ri){let t=pi+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=ci||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=r<<6,0!==n.strstart&&(t|=32),t+=31-t%31,yi(n,t),0!==n.strstart&&(yi(n,e.adler>>>16),yi(n,65535&e.adler)),e.adler=1,n.status=gi,Ei(e),0!==n.pending)return n.last_flush=-1,ti}if(57===n.status)if(e.adler=0,bi(n,31),bi(n,139),bi(n,8),n.gzhead)bi(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),bi(n,255&n.gzhead.time),bi(n,n.gzhead.time>>8&255),bi(n,n.gzhead.time>>16&255),bi(n,n.gzhead.time>>24&255),bi(n,9===n.level?2:n.strategy>=ci||n.level<2?4:0),bi(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(bi(n,255&n.gzhead.extra.length),bi(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Gr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(bi(n,0),bi(n,0),bi(n,0),bi(n,0),bi(n,0),bi(n,9===n.level?2:n.strategy>=ci||n.level<2?4:0),bi(n,3),n.status=gi,Ei(e),0!==n.pending)return n.last_flush=-1,ti;if(69===n.status){if(n.gzhead.extra){let t=n.pending,r=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=Gr(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,Ei(e),0!==n.pending)return n.last_flush=-1,ti;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=Gr(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=Gr(e.adler,n.pending_buf,n.pending-r,r)),Ei(e),0!==n.pending)return n.last_flush=-1,ti;r=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,bi(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=Gr(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=Gr(e.adler,n.pending_buf,n.pending-r,r)),Ei(e),0!==n.pending)return n.last_flush=-1,ti;r=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,bi(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=Gr(e.adler,n.pending_buf,n.pending-r,r))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ei(e),0!==n.pending))return n.last_flush=-1,ti;bi(n,255&e.adler),bi(n,e.adler>>8&255),e.adler=0}if(n.status=gi,Ei(e),0!==n.pending)return n.last_flush=-1,ti}if(0!==e.avail_in||0!==n.lookahead||t!==Qr&&n.status!==mi){let r=0===n.level?Ni(n,t):n.strategy===ci?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(Ai(e),0===e.lookahead)){if(t===Qr)return 1;break}if(e.match_length=0,n=zr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Oi(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===$r?(Oi(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Oi(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===ui?((e,t)=>{let n,r,i,o;const a=e.window;for(;;){if(e.lookahead<=fi){if(Ai(e),e.lookahead<=fi&&t===Qr)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+fi;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<o);e.match_length=fi-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=zr(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=zr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Oi(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===$r?(Oi(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Oi(e,!1),0===e.strm.avail_out)?1:2})(n,t):wi[n.level].func(n,t);if(3!==r&&4!==r||(n.status=mi),1===r||3===r)return 0===e.avail_out&&(n.last_flush=-1),ti;if(2===r&&(t===Zr?Yr(n):t!==ei&&(qr(n,0,0,!1),t===Xr&&(Ti(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Ei(e),0===e.avail_out))return n.last_flush=-1,ti}return t!==$r?ti:n.wrap<=0?ni:(2===n.wrap?(bi(n,255&e.adler),bi(n,e.adler>>8&255),bi(n,e.adler>>16&255),bi(n,e.adler>>24&255),bi(n,255&e.total_in),bi(n,e.total_in>>8&255),bi(n,e.total_in>>16&255),bi(n,e.total_in>>24&255)):(yi(n,e.adler>>>16),yi(n,65535&e.adler)),Ei(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?ti:ni)},deflateEnd:e=>{if(xi(e))return ri;const t=e.state.status;return e.state=null,t===gi?Ci(e,ii):ti},deflateSetDictionary:(e,t)=>{let n=t.length;if(xi(e))return ri;const r=e.state,i=r.wrap;if(2===i||1===i&&r.status!==Ri||r.lookahead)return ri;if(1===i&&(e.adler=jr(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){0===i&&(Ti(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Ai(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do{r.ins_h=Si(r,r.ins_h,r.window[e+3-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++}while(--t);r.strstart=e,r.lookahead=2,Ai(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,r.wrap=i,ti},deflateInfo:"pako deflate (from Nodeca project)"};const Gi=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ji=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)Gi(n,t)&&(e[t]=n[t])}}return e},Hi=e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,r=0,i=e.length;t<i;t++){let i=e[t];n.set(i,r),r+=i.length}return n};let Ki=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Ki=!1}const qi=new Uint8Array(256);for(let e=0;e<256;e++)qi[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;qi[254]=qi[254]=1;var Wi=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,r,i,o,a=e.length,s=0;for(i=0;i<a;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<a&&(r=e.charCodeAt(i+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),o=0,i=0;o<s;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<a&&(r=e.charCodeAt(i+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},zi=(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,i;const o=new Array(2*n);for(i=0,r=0;r<n;){let t=e[r++];if(t<128){o[i++]=t;continue}let a=qi[t];if(a>4)o[i++]=65533,r+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&r<n;)t=t<<6|63&e[r++],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&&Ki)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n})(o,i)},Yi=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+qi[e[n]]>t?n:t};var Qi=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 Zi=Object.prototype.toString,{Z_NO_FLUSH:Xi,Z_SYNC_FLUSH:$i,Z_FULL_FLUSH:eo,Z_FINISH:to,Z_OK:no,Z_STREAM_END:ro,Z_DEFAULT_COMPRESSION:io,Z_DEFAULT_STRATEGY:oo,Z_DEFLATED:ao}=Hr;function so(e){this.options=Ji({level:io,method:ao,chunkSize:16384,windowBits:15,memLevel:8,strategy:oo},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 Qi,this.strm.avail_out=0;let n=Fi.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==no)throw new Error(Jr[n]);if(t.header&&Fi.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Wi(t.dictionary):"[object ArrayBuffer]"===Zi.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=Fi.deflateSetDictionary(this.strm,e),n!==no)throw new Error(Jr[n]);this._dict_set=!0}}function co(e,t){const n=new so(t);if(n.push(e,!0),n.err)throw n.msg||Jr[n.err];return n.result}so.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?to:Xi,"string"==typeof e?n.input=Wi(e):"[object ArrayBuffer]"===Zi.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===$i||o===eo)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(i=Fi.deflate(n,o),i===ro)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=Fi.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===no;if(0!==n.avail_out){if(o>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},so.prototype.onData=function(e){this.chunks.push(e)},so.prototype.onEnd=function(e){e===no&&(this.result=Hi(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var uo={Deflate:so,deflate:co,deflateRaw:function(e,t){return(t=t||{}).raw=!0,co(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,co(e,t)},constants:Hr};const _o=16209;var lo=function(e,t){let n,r,i,o,a,s,c,u,d,_,l,p,f,h,R,g,m,C,v,T,I,S,E,O;const b=e.state;n=e.next_in,E=e.input,r=n+(e.avail_in-5),i=e.next_out,O=e.output,o=i-(t-e.avail_out),a=i+(e.avail_out-257),s=b.dmax,c=b.wsize,u=b.whave,d=b.wnext,_=b.window,l=b.hold,p=b.bits,f=b.lencode,h=b.distcode,R=(1<<b.lenbits)-1,g=(1<<b.distbits)-1;e:do{p<15&&(l+=E[n++]<<p,p+=8,l+=E[n++]<<p,p+=8),m=f[l&R];t:for(;;){if(C=m>>>24,l>>>=C,p-=C,C=m>>>16&255,0===C)O[i++]=65535&m;else{if(!(16&C)){if(64&C){if(32&C){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=_o;break e}m=f[(65535&m)+(l&(1<<C)-1)];continue t}for(v=65535&m,C&=15,C&&(p<C&&(l+=E[n++]<<p,p+=8),v+=l&(1<<C)-1,l>>>=C,p-=C),p<15&&(l+=E[n++]<<p,p+=8,l+=E[n++]<<p,p+=8),m=h[l&g];;){if(C=m>>>24,l>>>=C,p-=C,C=m>>>16&255,16&C){if(T=65535&m,C&=15,p<C&&(l+=E[n++]<<p,p+=8,p<C&&(l+=E[n++]<<p,p+=8)),T+=l&(1<<C)-1,T>s){e.msg="invalid distance too far back",b.mode=_o;break e}if(l>>>=C,p-=C,C=i-o,T>C){if(C=T-C,C>u&&b.sane){e.msg="invalid distance too far back",b.mode=_o;break e}if(I=0,S=_,0===d){if(I+=c-C,C<v){v-=C;do{O[i++]=_[I++]}while(--C);I=i-T,S=O}}else if(d<C){if(I+=c+d-C,C-=d,C<v){v-=C;do{O[i++]=_[I++]}while(--C);if(I=0,d<v){C=d,v-=C;do{O[i++]=_[I++]}while(--C);I=i-T,S=O}}}else if(I+=d-C,C<v){v-=C;do{O[i++]=_[I++]}while(--C);I=i-T,S=O}for(;v>2;)O[i++]=S[I++],O[i++]=S[I++],O[i++]=S[I++],v-=3;v&&(O[i++]=S[I++],v>1&&(O[i++]=S[I++]))}else{I=i-T;do{O[i++]=O[I++],O[i++]=O[I++],O[i++]=O[I++],v-=3}while(v>2);v&&(O[i++]=O[I++],v>1&&(O[i++]=O[I++]))}break}if(64&C){e.msg="invalid distance code",b.mode=_o;break e}m=h[(65535&m)+(l&(1<<C)-1)]}}break}}while(n<r&&i<a);v=p>>3,n-=v,p-=v<<3,l&=(1<<p)-1,e.next_in=n,e.next_out=i,e.avail_in=n<r?r-n+5:5-(n-r),e.avail_out=i<a?a-i+257:257-(i-a),b.hold=l,b.bits=p};const po=15,fo=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]),ho=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]),Ro=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]),go=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 mo=(e,t,n,r,i,o,a,s)=>{const c=s.bits;let u,d,_,l,p,f,h=0,R=0,g=0,m=0,C=0,v=0,T=0,I=0,S=0,E=0,O=null;const b=new Uint16Array(16),y=new Uint16Array(16);let L,k,A,N=null;for(h=0;h<=po;h++)b[h]=0;for(R=0;R<r;R++)b[t[n+R]]++;for(C=c,m=po;m>=1&&0===b[m];m--);if(C>m&&(C=m),0===m)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(g=1;g<m&&0===b[g];g++);for(C<g&&(C=g),I=1,h=1;h<=po;h++)if(I<<=1,I-=b[h],I<0)return-1;if(I>0&&(0===e||1!==m))return-1;for(y[1]=0,h=1;h<po;h++)y[h+1]=y[h]+b[h];for(R=0;R<r;R++)0!==t[n+R]&&(a[y[t[n+R]]++]=R);if(0===e?(O=N=a,f=20):1===e?(O=fo,N=ho,f=257):(O=Ro,N=go,f=0),E=0,R=0,h=g,p=o,v=C,T=0,_=-1,S=1<<C,l=S-1,1===e&&S>852||2===e&&S>592)return 1;for(;;){L=h-T,a[R]+1<f?(k=0,A=a[R]):a[R]>=f?(k=N[a[R]-f],A=O[a[R]-f]):(k=96,A=0),u=1<<h-T,d=1<<v,g=d;do{d-=u,i[p+(E>>T)+d]=L<<24|k<<16|A}while(0!==d);for(u=1<<h-1;E&u;)u>>=1;if(0!==u?(E&=u-1,E+=u):E=0,R++,0===--b[h]){if(h===m)break;h=t[n+a[R]]}if(h>C&&(E&l)!==_){for(0===T&&(T=C),p+=g,v=h-T,I=1<<v;v+T<m&&(I-=b[v+T],!(I<=0));)v++,I<<=1;if(S+=1<<v,1===e&&S>852||2===e&&S>592)return 1;_=E&l,i[_]=C<<24|v<<16|p-o}}return 0!==E&&(i[p+E]=h-T<<24|64<<16),s.bits=C,0};const{Z_FINISH:Co,Z_BLOCK:vo,Z_TREES:To,Z_OK:Io,Z_STREAM_END:So,Z_NEED_DICT:Eo,Z_STREAM_ERROR:Oo,Z_DATA_ERROR:bo,Z_MEM_ERROR:yo,Z_BUF_ERROR:Lo,Z_DEFLATED:ko}=Hr,Ao=16180,No=16190,Po=16191,Do=16192,Uo=16194,wo=16199,Mo=16200,xo=16206,Bo=16209,Vo=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function jo(){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 Fo=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Ao||t.mode>16211?1:0},Go=e=>{if(Fo(e))return Oo;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=Ao,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,Io},Jo=e=>{if(Fo(e))return Oo;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Go(e)},Ho=(e,t)=>{let n;if(Fo(e))return Oo;const r=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Oo:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Jo(e))},Ko=(e,t)=>{if(!e)return Oo;const n=new jo;e.state=n,n.strm=e,n.window=null,n.mode=Ao;const r=Ho(e,t);return r!==Io&&(e.state=null),r};let qo,Wo,zo=!0;const Yo=e=>{if(zo){qo=new Int32Array(512),Wo=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(mo(1,e.lens,0,288,qo,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;mo(2,e.lens,0,32,Wo,0,e.work,{bits:5}),zo=!1}e.lencode=qo,e.lenbits=9,e.distcode=Wo,e.distbits=5},Qo=(e,t,n,r)=>{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)),r>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),(r-=i)?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var Zo={inflateReset:Jo,inflateReset2:Ho,inflateResetKeep:Go,inflateInit:e=>Ko(e,15),inflateInit2:Ko,inflate:(e,t)=>{let n,r,i,o,a,s,c,u,d,_,l,p,f,h,R,g,m,C,v,T,I,S,E=0;const O=new Uint8Array(4);let b,y;const L=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Fo(e)||!e.output||!e.input&&0!==e.avail_in)return Oo;n=e.state,n.mode===Po&&(n.mode=Do),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,d=n.bits,_=s,l=c,S=Io;e:for(;;)switch(n.mode){case Ao:if(0===n.wrap){n.mode=Do;break}for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(2&n.wrap&&35615===u){0===n.wbits&&(n.wbits=15),n.check=0,O[0]=255&u,O[1]=u>>>8&255,n.check=Gr(n.check,O,2,0),u=0,d=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Bo;break}if((15&u)!==ko){e.msg="unknown compression method",n.mode=Bo;break}if(u>>>=4,d-=4,I=8+(15&u),0===n.wbits&&(n.wbits=I),I>15||I>n.wbits){e.msg="invalid window size",n.mode=Bo;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&u?16189:Po,u=0,d=0;break;case 16181:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(n.flags=u,(255&n.flags)!==ko){e.msg="unknown compression method",n.mode=Bo;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=Bo;break}n.head&&(n.head.text=u>>8&1),512&n.flags&&4&n.wrap&&(O[0]=255&u,O[1]=u>>>8&255,n.check=Gr(n.check,O,2,0)),u=0,d=0,n.mode=16182;case 16182:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.head&&(n.head.time=u),512&n.flags&&4&n.wrap&&(O[0]=255&u,O[1]=u>>>8&255,O[2]=u>>>16&255,O[3]=u>>>24&255,n.check=Gr(n.check,O,4,0)),u=0,d=0,n.mode=16183;case 16183:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.head&&(n.head.xflags=255&u,n.head.os=u>>8),512&n.flags&&4&n.wrap&&(O[0]=255&u,O[1]=u>>>8&255,n.check=Gr(n.check,O,2,0)),u=0,d=0,n.mode=16184;case 16184:if(1024&n.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.length=u,n.head&&(n.head.extra_len=u),512&n.flags&&4&n.wrap&&(O[0]=255&u,O[1]=u>>>8&255,n.check=Gr(n.check,O,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(p=n.length,p>s&&(p=s),p&&(n.head&&(I=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+p),I)),512&n.flags&&4&n.wrap&&(n.check=Gr(n.check,r,p,o)),s-=p,o+=p,n.length-=p),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===s)break e;p=0;do{I=r[o+p++],n.head&&I&&n.length<65536&&(n.head.name+=String.fromCharCode(I))}while(I&&p<s);if(512&n.flags&&4&n.wrap&&(n.check=Gr(n.check,r,p,o)),s-=p,o+=p,I)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===s)break e;p=0;do{I=r[o+p++],n.head&&I&&n.length<65536&&(n.head.comment+=String.fromCharCode(I))}while(I&&p<s);if(512&n.flags&&4&n.wrap&&(n.check=Gr(n.check,r,p,o)),s-=p,o+=p,I)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(4&n.wrap&&u!==(65535&n.check)){e.msg="header crc mismatch",n.mode=Bo;break}u=0,d=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Po;break;case 16189:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}e.adler=n.check=Vo(u),u=0,d=0,n.mode=No;case No:if(0===n.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=d,Eo;e.adler=n.check=1,n.mode=Po;case Po:if(t===vo||t===To)break e;case Do:if(n.last){u>>>=7&d,d-=7&d,n.mode=xo;break}for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}switch(n.last=1&u,u>>>=1,d-=1,3&u){case 0:n.mode=16193;break;case 1:if(Yo(n),n.mode=wo,t===To){u>>>=2,d-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=Bo}u>>>=2,d-=2;break;case 16193:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",n.mode=Bo;break}if(n.length=65535&u,u=0,d=0,n.mode=Uo,t===To)break e;case Uo:n.mode=16195;case 16195:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;i.set(r.subarray(o,o+p),a),s-=p,o+=p,c-=p,a+=p,n.length-=p;break}n.mode=Po;break;case 16196:for(;d<14;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(n.nlen=257+(31&u),u>>>=5,d-=5,n.ndist=1+(31&u),u>>>=5,d-=5,n.ncode=4+(15&u),u>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Bo;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.lens[L[n.have++]]=7&u,u>>>=3,d-=3}for(;n.have<19;)n.lens[L[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,b={bits:n.lenbits},S=mo(0,n.lens,0,19,n.lencode,0,n.work,b),n.lenbits=b.bits,S){e.msg="invalid code lengths set",n.mode=Bo;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;E=n.lencode[u&(1<<n.lenbits)-1],R=E>>>24,g=E>>>16&255,m=65535&E,!(R<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(m<16)u>>>=R,d-=R,n.lens[n.have++]=m;else{if(16===m){for(y=R+2;d<y;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u>>>=R,d-=R,0===n.have){e.msg="invalid bit length repeat",n.mode=Bo;break}I=n.lens[n.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===m){for(y=R+3;d<y;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=R,d-=R,I=0,p=3+(7&u),u>>>=3,d-=3}else{for(y=R+7;d<y;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=R,d-=R,I=0,p=11+(127&u),u>>>=7,d-=7}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Bo;break}for(;p--;)n.lens[n.have++]=I}}if(n.mode===Bo)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=Bo;break}if(n.lenbits=9,b={bits:n.lenbits},S=mo(1,n.lens,0,n.nlen,n.lencode,0,n.work,b),n.lenbits=b.bits,S){e.msg="invalid literal/lengths set",n.mode=Bo;break}if(n.distbits=6,n.distcode=n.distdyn,b={bits:n.distbits},S=mo(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,b),n.distbits=b.bits,S){e.msg="invalid distances set",n.mode=Bo;break}if(n.mode=wo,t===To)break e;case wo:n.mode=Mo;case Mo:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=d,lo(e,l),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,d=n.bits,n.mode===Po&&(n.back=-1);break}for(n.back=0;E=n.lencode[u&(1<<n.lenbits)-1],R=E>>>24,g=E>>>16&255,m=65535&E,!(R<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(g&&!(240&g)){for(C=R,v=g,T=m;E=n.lencode[T+((u&(1<<C+v)-1)>>C)],R=E>>>24,g=E>>>16&255,m=65535&E,!(C+R<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=C,d-=C,n.back+=C}if(u>>>=R,d-=R,n.back+=R,n.length=m,0===g){n.mode=16205;break}if(32&g){n.back=-1,n.mode=Po;break}if(64&g){e.msg="invalid literal/length code",n.mode=Bo;break}n.extra=15&g,n.mode=16201;case 16201:if(n.extra){for(y=n.extra;d<y;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.length+=u&(1<<n.extra)-1,u>>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;E=n.distcode[u&(1<<n.distbits)-1],R=E>>>24,g=E>>>16&255,m=65535&E,!(R<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(!(240&g)){for(C=R,v=g,T=m;E=n.distcode[T+((u&(1<<C+v)-1)>>C)],R=E>>>24,g=E>>>16&255,m=65535&E,!(C+R<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=C,d-=C,n.back+=C}if(u>>>=R,d-=R,n.back+=R,64&g){e.msg="invalid distance code",n.mode=Bo;break}n.offset=m,n.extra=15&g,n.mode=16203;case 16203:if(n.extra){for(y=n.extra;d<y;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.offset+=u&(1<<n.extra)-1,u>>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Bo;break}n.mode=16204;case 16204:if(0===c)break e;if(p=l-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Bo;break}p>n.wnext?(p-=n.wnext,f=n.wsize-p):f=n.wnext-p,p>n.length&&(p=n.length),h=n.window}else h=i,f=a-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do{i[a++]=h[f++]}while(--p);0===n.length&&(n.mode=Mo);break;case 16205:if(0===c)break e;i[a++]=n.length,c--,n.mode=Mo;break;case xo:if(n.wrap){for(;d<32;){if(0===s)break e;s--,u|=r[o++]<<d,d+=8}if(l-=c,e.total_out+=l,n.total+=l,4&n.wrap&&l&&(e.adler=n.check=n.flags?Gr(n.check,i,l,a-l):jr(n.check,i,l,a-l)),l=c,4&n.wrap&&(n.flags?u:Vo(u))!==n.check){e.msg="incorrect data check",n.mode=Bo;break}u=0,d=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(4&n.wrap&&u!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=Bo;break}u=0,d=0}n.mode=16208;case 16208:S=So;break e;case Bo:S=bo;break e;case 16210:return yo;default:return Oo}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=d,(n.wsize||l!==e.avail_out&&n.mode<Bo&&(n.mode<xo||t!==Co))&&Qo(e,e.output,e.next_out,l-e.avail_out),_-=e.avail_in,l-=e.avail_out,e.total_in+=_,e.total_out+=l,n.total+=l,4&n.wrap&&l&&(e.adler=n.check=n.flags?Gr(n.check,i,l,e.next_out-l):jr(n.check,i,l,e.next_out-l)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Po?128:0)+(n.mode===wo||n.mode===Uo?256:0),(0===_&&0===l||t===Co)&&S===Io&&(S=Lo),S},inflateEnd:e=>{if(Fo(e))return Oo;let t=e.state;return t.window&&(t.window=null),e.state=null,Io},inflateGetHeader:(e,t)=>{if(Fo(e))return Oo;const n=e.state;return 2&n.wrap?(n.head=t,t.done=!1,Io):Oo},inflateSetDictionary:(e,t)=>{const n=t.length;let r,i,o;return Fo(e)?Oo:(r=e.state,0!==r.wrap&&r.mode!==No?Oo:r.mode===No&&(i=1,i=jr(i,t,n,0),i!==r.check)?bo:(o=Qo(e,t,n,n),o?(r.mode=16210,yo):(r.havedict=1,Io)))},inflateInfo:"pako inflate (from Nodeca project)"};var Xo=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 $o=Object.prototype.toString,{Z_NO_FLUSH:ea,Z_FINISH:ta,Z_OK:na,Z_STREAM_END:ra,Z_NEED_DICT:ia,Z_STREAM_ERROR:oa,Z_DATA_ERROR:aa,Z_MEM_ERROR:sa}=Hr;function ca(e){this.options=Ji({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 Qi,this.strm.avail_out=0;let n=Zo.inflateInit2(this.strm,t.windowBits);if(n!==na)throw new Error(Jr[n]);if(this.header=new Xo,Zo.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Wi(t.dictionary):"[object ArrayBuffer]"===$o.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Zo.inflateSetDictionary(this.strm,t.dictionary),n!==na)))throw new Error(Jr[n])}ca.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?ta:ea,"[object ArrayBuffer]"===$o.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=Zo.inflate(n,a),o===ia&&i&&(o=Zo.inflateSetDictionary(n,i),o===na?o=Zo.inflate(n,a):o===aa&&(o=ia));n.avail_in>0&&o===ra&&n.state.wrap>0&&0!==e[n.next_in];)Zo.inflateReset(n),o=Zo.inflate(n,a);switch(o){case oa:case aa:case ia:case sa:return this.onEnd(o),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(0===n.avail_out||o===ra))if("string"===this.options.to){let e=Yi(n.output,n.next_out),t=n.next_out-e,i=zi(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(o!==na||0!==s){if(o===ra)return o=Zo.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},ca.prototype.onData=function(e){this.chunks.push(e)},ca.prototype.onEnd=function(e){e===na&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Hi(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const{Deflate:ua,deflate:da,deflateRaw:_a,gzip:la}=uo;var pa=la;var fa,ha=-1,Ra="RongCloudSEIAI",ga=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)})},ma=function(e,t){return e+Math.floor(Math.random()*(t-e))},Ca=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(Gn.browser,"|").concat(Gn.version),ClientVersion:"5.36.1-nctest-alpha.1","Client-Session-Id":ga(),"Request-Id":Date.now().toString()}},va=function(e,t,n){return K(void 0,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)if(0===r.n)return i=[],o=n.jwtToken||"",r.a(2,new Promise(function(n,r){e.forEach(function(e){return K(void 0,void 0,void 0,p().m(function r(){var a,s,c;return p().w(function(r){for(;;)switch(r.n){case 0:return a=e.detectorAddr.replace(/^(https?:\/\/)?/,"https://"),s="".concat(a,"/rtc/detector/ping?t=").concat(ma(1e3,9999)),c={jwt:o},r.n=1,t.httpReq({url:s,body:JSON.stringify(c),timeout:5e3,method:U.POST});case 1:200===r.v.status&&i.push(e.clusterId),n(i);case 2:return r.a(2)}},r)}))})}))},r)}))},Ta=function(e,t){var n,r;if(!t)return"";try{r=JSON.parse(t.voipCallInfo||'{ "strategy": 0 }')}catch(n){return e.warn(ye.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O,"parse `voipCallInfo` of navi failed: ".concat(t.voipCallInfo)),""}if(0===r.strategy)return"";var i=null===(n=r.callEngine)||void 0===n?void 0:n.filter(function(e){return 4===e.engineType});if(!i||0===i.length)return"";var o=i[0];return o.detectorManager?o.detectorManager:""},Ia=function(e,t,n){return K(void 0,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_;return p().w(function(r){for(;;)switch(r.n){case 0:return i=Ta(t,n),o=n.jwtToken||"",a=120,s=0,c=n.ipType||0,u={jwt:o,ipType:c},r.n=1,e.httpReq({url:"".concat(i,"/rtc/detector/servers"),body:JSON.stringify(u),headers:Ca(),method:U.POST});case 1:return d=r.v,_=d.data&&JSON.parse(d.data).detectorAddrs||[],a=d.data&&JSON.parse(d.data).clientDetectMinute,s=d.data&&JSON.parse(d.data).resultCode,r.a(2,{detectoraddrs:_,clientDetectMinute:a,status:s})}},r)}))};exports.RCRTCOperateSummarizationType=void 0,(fa=exports.RCRTCOperateSummarizationType||(exports.RCRTCOperateSummarizationType={})).OPEN="2",fa.CLOSE="1";function Sa(e){var t=e.method||U.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,a=e.onProgress,s=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map(function(e){return"".concat(e,"=").concat(t[e])}).filter(function(e){return!!e});return n.length?[e,n.join("&")].join("?"):e}(e.url,i),c=new XMLHttpRequest;if(c.open(t,s),r&&c.setRequestHeader)for(var u in r)c.setRequestHeader(u,r[u]);return function(e,t,n,r){return new Promise(function(i){e.onreadystatechange=function(){r?2===e.readyState?i({data:e.responseText,status:e.status,xhr:e}):4===e.readyState?r(e.responseText,!0):3===e.readyState&&r(e.responseText,!1):4===e.readyState&&i({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){i({status:e.status})},0!==t&&setTimeout(function(){e.abort(),i({status:e.status})},t),e.send(n)})}(c,n,o,a)}var Ea,Oa=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(Gn.browser,"|").concat(Gn.version),ClientVersion:"5.36.1-nctest-alpha.1","Client-Session-Id":ga(),"Request-Id":Date.now().toString()}},ba=function(){function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;i(this,e),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_msUrl",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:o}),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}),this._logger=this._context.logger,n.getConnectionStatus()===Se.CONNECTED&&this.isNededDetector()&&this.detectorMediaSever()}return a(e,[{key:"isNededDetector",value:function(){var t=this._context.getNaviInfo();if(!t)return!1;var n=Ta(this._logger,t),r=t.jwtToken||"",i=Date.now(),o=!1;return 0===e.detectorTime?o=!1:e.detectValidMinute+e.detectorTime<i&&(o=!0),!(!n||!r||this._msUrl||o)}},{key:"detectorMediaSever",value:function(){this.clearMSList();var e=this._context.getNaviInfo();this._startDetector(e)}},{key:"_startDetector",value:function(t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s;return p().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,Ia(this._runtime,this._logger,t);case 1:if(i=n.v,o=i.detectoraddrs,a=i.clientDetectMinute,i.status!==exports.RCRTCCode.JWT_TIME_OUT){n.n=3;break}return s=this._context.getPluginContext(),n.n=2,null===(r=s.refetchNaviInfo)||void 0===r?void 0:r.call(s);case 2:return this.detectorMediaSever(),n.a(2);case 3:if(!o.length){n.n=5;break}return n.n=4,va(o,this._runtime,t);case 4:e.msInDetector=n.v;case 5:e.detectorTime=Date.now(),e.detectValidMinute=60*a*1e3;case 6:return n.a(2)}},n,this)}))}},{key:"clearMSList",value:function(){this._msList.length=0}},{key:"getMsList",value:function(){return this._msUrl?[this._msUrl]:(this._sortMediaServiceList(),v(this._msList))}},{key:"_sortMediaServiceList",value:function(){var t=e.msInDetector[0],n=e.msInDetector.slice(1),r=function(e,t){var n,r;if(!e)return[];try{r=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(n){return t.warn(ye.L_PARSE_VOIP_SERVER_CONF_E,e.voipCallInfo),[]}if(0===r.strategy)return[];var i=null===(n=r.callEngine)||void 0===n?void 0:n.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),i=r[0],o=r.slice(1),a=[this._clusterId,t,i].concat(v(n),v(o)).filter(function(e){return!!e}).map(function(e){return e.replace(/^(https?:\/\/)?/,"https://")});this._msList=v(new Set(a)),this._logger.info(ye.L_MEDIA_SERVICE_MSLIST_CHANGE_O,"MediaServiceList msList -> ".concat(JSON.stringify(this._msList)))}},{key:"_openGzip",value:function(e,t){for(var n=JSON.stringify(t),r=n.length,i=new Uint8Array(r),o=0;o<r;o++)i[o]=n.charCodeAt(o);var a;return{headers:e=Object.assign(Object.assign({},e),{"Content-Encoding":"gzip","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}),body:t=pa(i,a)}}},{key:"_dealRequestSuccessResult",value:function(e){var t=JSON.parse(e);return t.rtcFinger&&(this._rtcFinger=t.rtcFinger),t.clusterId&&(this._clusterId!==t.clusterId&&this.clearMSList(),this._clusterId=t.clusterId),{code:exports.RCRTCCode.SUCCESS,data:t,qualityMsList:this._qualityMsList}}},{key:"_request",value:function(e,t,n,r,i,o){return K(this,void 0,void 0,p().m(function a(){var s,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E;return p().w(function(a){for(;;)switch(a.n){case 0:if(this._qualityMsList=[],c=(s={headers:t,body:n}).headers,u=s.body,0!==(d=this.getMsList()).length){a.n=1;break}return this._logger.error(ye.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),r),a.a(2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER});case 1:this._rtcFinger&&(u.rtcFinger=this._rtcFinger),_=0;case 2:if(!(_<d.length)){a.n=10;break}if(l=Date.now(),f="".concat(d[_]).concat(e),h=Oa(),R=Object.assign(Object.assign({},h),c),g=/x-www-form-urlencoded/.test(R["Content-Type"])?u:JSON.stringify(u),m=h["Request-Id"],this._logger.info(ye.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:f,"Request-Id":m}),r),C=void 0,v={url:f,body:g,headers:R,method:U.POST,timeout:this._timeout},!o){a.n=4;break}return a.n=3,Sa(Object.assign(Object.assign({},v),{onProgress:o}));case 3:C=a.v,a.n=6;break;case 4:return a.n=5,this._runtime.httpReq(Object.assign({},v));case 5:C=a.v;case 6:if(I=(T=C).status,S=T.data,E=T.xhr,i&&this._qualityMsList.push({rsdur:Date.now()-l,rsid:m,rscod:200===I?exports.RCRTCCode.SUCCESS:exports.RCRTCCode.REQUEST_FAILED,msa:f}),200!==I){a.n=8;break}if(this._logger.info(ye.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:Le.SUCCESSED,url:f}),r),!o){a.n=7;break}return a.a(2,{code:exports.RCRTCCode.SUCCESS,data:E});case 7:return a.a(2,this._dealRequestSuccessResult(S));case 8:this._logger.error(ye.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:Le.FAILED,msg:"request error -> Request-Id: ".concat(m,", status: ").concat(I,", url: ").concat(f),timeout:this._timeout}),r);case 9:_+=1,a.n=2;break;case 10:return a.a(2,{code:exports.RCRTCCode.REQUEST_FAILED,qualityMsList:this._qualityMsList})}},a,this)}))}},{key:"exchange",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s;return p().w(function(i){for(;;)switch(i.n){case 0:return i.n=1,this._request("/exchange",e,t,n,r);case 1:return(a=i.v).code===exports.RCRTCCode.SUCCESS&&(null===(o=a.data)||void 0===o?void 0:o.resultCode)===exports.RCRTCCode.SUCCESS&&(s=a.data.urls)&&(this._configUrl=s.configUrl),i.a(2,a)}},i,this)}))}},{key:"exit",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this._logger.createTraceId(),t.n=1,this._request("/exit",e,{},n);case 1:return r=t.v,i=r.code,t.a(2,i)}},t,this)}))}},{key:"broadcastSubscribe",value:function(e,t){var n=this._logger.createTraceId();return this._request("/broadcast/subscribe",e,t,n,!0)}},{key:"broadcastExit",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this._logger.createTraceId(),t.n=1,this._request("/broadcast/exit",e,{},n,!0);case 1:return r=t.v,i=r.code,t.a(2,{code:i})}},t,this)}))}},{key:"setMcuConfig",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l,f;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(ye.L_MEDIA_SERVICE_SET_MCU_CONFIG_T,JSON.stringify({body:t}),r),this._configUrl){n.n=1;break}return this._logger.error(ye.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND,msg:"MCU server not found"}),r),n.a(2,{code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND});case 1:return i="".concat(this._configUrl.replace(/^(https?:\/\/)?/,"https://"),"/server/mcu/config"),o=Oa(),a=Object.assign(Object.assign({},o),e),s=JSON.stringify(t),c=o["Request-Id"],n.n=2,this._runtime.httpReq({url:i,headers:a,body:s,method:U.POST});case 2:if(u=n.v,d=u.status,_=u.data,200!==d){n.n=3;break}return l=JSON.parse(_),(f=l.resultCode)===exports.RCRTCCode.SUCCESS?this._logger.info(ye.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:Le.SUCCESSED,"Request-Id":c}),r):this._logger.warn(ye.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({code:f,"Request-Id":c}),r),n.a(2,{code:f,res:l});case 3:return this._logger.error(ye.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REQUEST_FAILED,msg:"request error -> Request-Id: ".concat(c,", status: ").concat(d,", url: ").concat(i)}),r),n.a(2,{code:exports.RCRTCCode.REQUEST_FAILED})}},n,this)}))}},{key:"getCDNResourceInfo",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d;return p().w(function(r){for(;;)switch(r.n){case 0:return i=Oa(),o=Object.assign(Object.assign({},i),e),a=i["Request-Id"],this._logger.info(ye.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T,"Request-Id: ".concat(a,", url: ").concat(t),n),r.n=1,this._runtime.httpReq({url:t,headers:o,method:U.GET});case 1:if(s=r.v,c=s.status,u=s.data,200!==c){r.n=2;break}return d=JSON.parse(u),this._logger.info(ye.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:Le.SUCCESSED,cdnPlayerUrl:null==d?void 0:d.data.pull_url}),n),r.a(2,{code:d.resultCode,res:d});case 2:return this._logger.info(ye.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REQUEST_FAILED}),n),r.a(2,{code:exports.RCRTCCode.REQUEST_FAILED})}},r,this)}))}},{key:"updateASRStatus",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i;return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this._request("/rtc/media/v1/asr/update",e,t,n);case 1:return i=r.v,r.a(2,i)}},r,this)}))}},{key:"operateRealtimeTranslation",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i;return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this._request("/rtc/media/v1/asr/translation",e,t,n);case 1:return i=r.v,r.a(2,i)}},r,this)}))}},{key:"operateSummarization",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)switch(r.n){case 0:return i="/rtc/media/v1/ai/room/sum/".concat(t.status===exports.RCRTCOperateSummarizationType.OPEN?"start":"stop"),r.n=1,this._request(i,e,t,n);case 1:return o=r.v,r.a(2,o)}},r,this)}))}},{key:"generateSummarization",value:function(e,t,n,r,i,o,a){return K(this,void 0,void 0,p().m(function s(){var c,u,d,_,l,f,h;return p().w(function(s){for(;;)switch(s.n){case 0:return c={"App-Key":this._context.getAppkey(),UserId:this._context.getCurrentId(),RoomId:e,"X-Stream":!0},u={taskId:t,startTime:n,endTime:r,config:{summarization:i.enableSummarization,summarizationDetails:i.enableSummarizationDetails,chapterSummary:i.enableChapterSummary,todoList:i.enableTodoList,hashtag:i.enableHashtag,language:i.destLang,format:i.format,custom:i.customPrompt}},s.n=1,this._request("/rtc/media/v1/ai/room/sum/gen",c,u,a,!1,function(e,t){o(e,t)});case 1:if(d=s.v,_=d.code,l=d.data,f=null==l?void 0:l.getResponseHeader("x-code"),h=null==l?void 0:l.getResponseHeader("x-msg"),_!==exports.RCRTCCode.SUCCESS||!f||Number(f)===exports.RCRTCCode.SUCCESS){s.n=2;break}return s.a(2,{code:Number(f),msg:h});case 2:return s.a(2,{code:_})}},s,this)}))}},{key:"getASRContent",value:function(e,t,n,r,i,o,a){return K(this,void 0,void 0,p().m(function s(){var c,u,d,_,l,f,h;return p().w(function(s){for(;;)switch(s.n){case 0:return c={"App-Key":this._context.getAppkey(),UserId:this._context.getCurrentId(),RoomId:e,"X-Stream":!0},u={taskId:t,startTime:n,endTime:r,language:a},s.n=1,this._request("/rtc/media/v1/ai/room/sum/asr",c,u,o,!1,function(e,t){i(e,t)});case 1:if(d=s.v,_=d.code,l=d.data,f=null==l?void 0:l.getResponseHeader("x-code"),h=null==l?void 0:l.getResponseHeader("x-msg"),_!==exports.RCRTCCode.SUCCESS||!f||Number(f)===exports.RCRTCCode.SUCCESS){s.n=2;break}return s.a(2,{code:Number(f),msg:h});case 2:return s.a(2,{code:_})}},s,this)}))}}])}();Object.defineProperty(ba,"msInDetector",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(ba,"detectorTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(ba,"detectValidMinute",{enumerable:!0,configurable:!0,writable:!0,value:72e5}),function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}(Ea||(Ea={}));var ya,La=function(e,t){return Math.round(8*t/e)},ka=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=Math.pow(10,t);return Math.round(e*n)/n},Aa=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;e>1&&(e=1);var n=Math.pow(10,t);return Math.round(e*n)},Na=function(e,t,n,r){if(0===t)return 0;if(!n||!r)return ka(e/t,3);var i=t-r;if(0===i)return 0;var o=e-n;return o<0||i<0?0:ka(o/i,3)},Pa=function(e){var t=e.jitter,n=e.rtt,r=e.packetsLostRate;return!Wn(t)||!Wn(n)||0!==r};!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"}(ya||(ya={}));var Da=function(){return a(function e(t,n,r,o,a,s){i(this,e),Object.defineProperty(this,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_sdpSemantics",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:s}),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:{}})},[{key:"getTrackIdByMid",value:function(e){return this._sdpStrategy.getTrackIdByMid(e)}},{key:"updateBytesSent",value:function(e,t,n){var r,i;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];r=t-o.bytesSent,i=n-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:n}}else r=t,i=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:n};return La(i,r)}},{key:"updateBytesRecv",value:function(e,t,n){var r,i;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];r=t-o.bytesRecv,i=n-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:n}}else r=t,i=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:n};return La(i,r)}},{key:"updateSenderPacketsLost",value:function(e,t,n){var r;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var i=this._latestPacketsSent[e],o=i.packetsLost,a=i.packetsSent;r=Na(t,n,o,a),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?a:n}else r=Na(t,n),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=n;return r}},{key:"updateReceiverPacketsLost",value:function(e,t,n){var r;if(this._latestPacketsRecv[e]){var i=this._latestPacketsRecv[e],o=i.packetsLost,a=i.packetsRecv;r=Na(t,n+t,o,a+o)}else r=Na(t,n);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:n},r}},{key:"clearLatestpacketsSent",value:function(e){var t=this;e.forEach(function(e){if(parseInt(e.split("_").pop())===exports.RCMediaType.VIDEO_ONLY){var n="".concat(e,"_tiny");delete t._latestPacketsSent[n],delete t._latestBytesSent[n]}delete t._latestPacketsSent[e],delete t._latestBytesSent[e]})}},{key:"clearLatestPacketsRecv",value:function(e){var t=this;e.forEach(function(e){delete t._latestPacketsRecv[e],delete t._latestBytesRecv[e]})}},{key:"parseRTCStatsReport",value:function(e){var t,n={},r=s(e.entries());try{for(r.s();!(t=r.n()).done;){var i=m(t.value,2),o=i[0],a=i[1];/codec/gi.test(a)&&o.includes("RTCCodec_")||(n[o]=a)}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"formatRCRTCStateReport",value:function(e){var t={senders:[],receivers:[]};return this._logger.info(ye.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O,JSON.stringify({status:Le.SUCCESSED,stats:e,reports:t})),t}},{key:"isValidTranceiver",value:function(e,t){var n,r,i="outbound-rtp"===t?null===(n=this._rtcPeerConn.currentLocalDescription)||void 0===n?void 0:n.sdp:null===(r=this._rtcPeerConn.currentRemoteDescription)||void 0===r?void 0:r.sdp,o=e.ssrc;return!(null==i?void 0:i.split("\r\nm=").some(function(e){return e.includes(o)&&e.includes("a=inactive")}))}},{key:"formatStateData",value:function(e){return Object.values(e).reduce(function(e,t){return t.type===ya.REMOTEINBOUNDRTP?(e.remoteInbound.push(t),e):t.type===ya.INBOUNDRTP?(e.inbound.push(t),e):t.type===ya.OUTBOUNDRTP?(e.outbound.push(t),e):t.type===ya.TRANSPORT?(e.transport.push(t),e):t.type===ya.PEERCONNECTION?(e.connection.push(t),e):e},{outbound:[],remoteInbound:[],inbound:[],transport:[],connection:[]})}}])}(),Ua=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,Da),a(e,[{key:"formatRCRTCStateReport",value:function(e){var t=this.formatStateData(e),n=t.outbound,r=t.remoteInbound,i=t.inbound,o=t.transport,a=t.connection,s={senders:[],receivers:[]},c=Math.floor(a[0].timestamp);s.timestamp=c;var u=0,d=0,_=this.pickOutbound(n,e,u,c,d);u=_.totalPacketsLost,d=_.bitrateSend,s.senders=_.senders,r.length>0&&s.senders.length>0&&this.pickRemoteInbound(r,s.senders,e);var l=0,p=this.pickInbound(i,e,u,c,l);if(u=p.totalPacketsLost,l=p.bitrateRecv,s.receivers=p.receivers,o.length>0){var f=o[0];this.pickRtcTransport(f,e,s,l,d,u)}return s}},{key:"pickRtcTransport",value:function(e,t,n,r,i,o){var a=e.selectedCandidatePairId;if(a){var s=t[a],c=s.availableOutgoingBitrate,u=s.availableIncomingBitrate,d=s.currentRoundTripTime,_=s.localCandidateId,l=s.remoteCandidateId,p=t[_],f=p.ip,h=p.port,R=p.networkType,g=t[l],m=g.ip,C=g.port,v=g.protocol;n.iceCandidatePair={IP:f,port:h,networkType:R,remoteIP:m,remotePort:C,protocol:v,bitrateRecv:r,bitrateSend:i,rtt:1e3*d,availableOutgoingBitrate:c,availableIncomingBitrate:u,totalPacketsLost:o},n.receivers.forEach(function(e){e.rtt=1e3*d})}}},{key:"pickRemoteInbound",value:function(e,t,n){var r=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&&!Pa(u)){var d=null===(i=r._store)||void 0===i?void 0:i.getTrackIdBySSRC(n[u.id].ssrc);u.jitter=Math.round(1e3*a),u.rtt=s;var _=r._latestPacketsSent[d].crtPacketsSent;u.packetsLostRate=r.updateSenderPacketsLost(d,c,_)}})}},{key:"_getOutboundVideoAttrs",value:function(e,t,n,r,i){var o,a,s,c=e.framesPerSecond,u=e.frameWidth,d=e.frameHeight;return"video"!==n||u||d||c||(u=(null===(o=t[r])||void 0===o?void 0:o.frameWidth)||t[i].width,d=(null===(a=t[r])||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:d}}},{key:"pickOutbound",value:function(e,t,n,r,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,d=e.mediaSourceId,_=e.remoteId,l=e.packetsSent,p=e.bytesSent,f=e.encoderImplementation,h=e.pliCount,R=e.nackCount,g=e.mid,m=e.trackId;if(void 0!==g&&(m=o.getTrackIdByMid(g)),m){var C=o._getOutboundVideoAttrs(e,t,u,m,d),v=C.frameRate,T=C.frameWidth,I=C.frameHeight,S=t[_],E=null,O=null,b=0;S&&(E=S.jitter,O=S.roundTripTime,b=S.packetsLost),n+=b;var y=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc);if(y){var L=d?t[d].audioLevel:t[m].audioLevel,k=0;!o._latestPacketsSent[y]&&(o._latestPacketsSent[y]={}),S?k=o.updateSenderPacketsLost(y,b,l):o._latestPacketsSent[y].crtPacketsSent=l;var A=o.updateBytesSent(y,p,r);A<0&&(A=0),i+=A,a.push({id:c,trackId:y,kind:u,packetsLostRate:k,remoteResource:!1,audioLevel:L||0===L?Aa(L):null,frameWidth:T,frameHeight:I,frameRate:v,bitrate:A,jitter:E?Math.round(1e3*E):E,rtt:O?Math.round(1e3*O):O,encoderImplementation:f,pliCount:h,nackCount:R,googFirsSent:ha,samplingRate:ha,googRenderDelayMs:ha,trackState:ha})}}}}),{totalPacketsLost:n,bitrateSend:i,senders:a}}},{key:"_getInboundMediaAttrs",value:function(e,t,n,r,i){var o,a,s,c=e.frameWidth,u=e.frameHeight,d=e.audioLevel;return"video"===i?c||u||(c=(null===(o=t[n])||void 0===o?void 0:o.frameWidth)||t[r].width,u=(null===(a=t[n])||void 0===a?void 0:a.frameHeight)||t[r].height):d||(d=(null===(s=t[n])||void 0===s?void 0:s.audioLevel)||t[r].audioLevel),{frameWidth:c,frameHeight:u,audioLevel:d}}},{key:"pickInbound",value:function(e,t,n,r,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,d=e.jitter,_=e.bytesReceived,l=e.framesPerSecond,p=e.kind,f=e.codecImplementationName,h=e.nackCount,R=e.pliCount,g=e.mid,m=e.id,C=e.trackId;if(void 0!==g&&(C=o.getTrackIdByMid(g)),C){var v=o._getInboundMediaAttrs(e,t,C,m,p),T=v.frameWidth,I=v.frameHeight,S=v.audioLevel;n+=c;var E=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc),O=o.updateReceiverPacketsLost(E,c,u),b=o.updateBytesRecv(E,_,r);b<0&&(b=0),i+=b,a.push({trackId:E,kind:p,packetsLostRate:O,remoteResource:!0,audioLevel:S||0===S?Aa(S):null,frameWidth:T,frameHeight:I,frameRate:l,bitrate:b,jitter:d?Math.round(1e3*d):0,codecImplementationName:f,nackCount:h,pliCount:R,rtt:null,samplingRate:ha,googFirsReceived:ha,googRenderDelayMs:ha,trackState:ha})}}}),{totalPacketsLost:n,bitrateRecv:i,receivers:a}}}])}(),wa=function(){function e(){var t;return i(this,e),t=r(this,e,arguments),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,Da),a(e,[{key:"_pickSenderData",value:function(e,t,n){var r;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,n)){var i=e.kind,o=e.bytesSent,a=e.packetsSent,s=e.bitrateMean,c=e.framerateMean,u=e.nackCount,d=e.pliCount,_=e.remoteId,l=_?t[_]:{jitter:null,roundTripTime:null,packetsLost:0},p=l.jitter,f=l.roundTripTime,h=l.packetsLost,R=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=h;var g=0;!this._latestPacketsSent[R]&&(this._latestPacketsSent[R]={}),_?g=this.updateSenderPacketsLost(R,h,a):this._latestPacketsSent[R].crtPacketsSent=a;var m=0;"video"===i?s&&(m=Math.floor(s/1e3)):m=this.updateBytesSent(R,o,this._reportsData.timestamp),m<0&&(m=0),this._bitrateSend+=m,this._reportsData.senders.push({trackId:R,kind:i,packetsLostRate:g,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(c),bitrate:m,jitter:p?Math.round(1e3*p):null,rtt:f,encoderImplementation:null,pliCount:d,nackCount:u,googFirsSent:ha,samplingRate:ha,googRenderDelayMs:ha,trackState:ha})}}},{key:"_addSenderData",value:function(e,t){var n,r=t.localId,i=null===(n=this._store)||void 0===n?void 0:n.getTrackIdBySSRC(e[r].ssrc),o=this._reportsData.senders.filter(function(e){return e.trackId===i})[0];o&&Pa(o)&&(o.jitter=Math.round(1e3*t.jitter),o.rtt=t.rtt,o.packetsLostRate=this.updateSenderPacketsLost(i,t.packetsLost,this._latestPacketsSent[i].crtPacketsSent))}},{key:"_pickReceiverData",value:function(e,t){var n;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,t)){var r=e.packetsLost,i=e.bytesReceived,o=e.packetsReceived,a=e.jitter,s=e.framerateMean,c=e.kind,u=e.bitrateMean,d=e.nackCount,_=e.pliCount,l=null===(n=this._store)||void 0===n?void 0:n.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=r;var p=this.updateReceiverPacketsLost(l,r,o),f=0;"video"===c?u&&(f=Math.floor(u/1e3)):f=this.updateBytesRecv(l,i,this._reportsData.timestamp),f<0&&(f=0),this._bitrateRecv+=f,this._reportsData.receivers.push({trackId:l,kind:c,packetsLostRate:p,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(s),bitrate:f,jitter:a?Math.round(1e3*a):null,codecImplementationName:null,nackCount:d,pliCount:_,rtt:null,samplingRate:ha,googFirsReceived:ha,googRenderDelayMs:ha,trackState:ha})}}},{key:"_pickIceCandidatePair",value:function(e,t){var n=e[t.localCandidateId],r=n.address,i=n.port,o=e[t.remoteCandidateId],a=o.address,s=o.port,c=o.protocol;this._reportsData.iceCandidatePair={IP:r,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}}},{key:"formatRCRTCStateReport",value:function(e){var t=+new Date;for(var n in this._reportsData={senders:[],receivers:[],timestamp:t},this._totalPacketsLost=0,this._bitrateRecv=0,this._bitrateSend=0,e){var r=e[n],i=r.type;"outbound-rtp"===i&&this._pickSenderData(r,e,i),"remote-inbound-rtp"===i&&this._addSenderData(e,r),"inbound-rtp"===i&&this._pickReceiverData(r,i),"candidate-pair"===i&&"succeeded"===r.state&&this._pickIceCandidatePair(e,r)}return this._reportsData}}])}(),Ma=function(){function e(){var t;return i(this,e),t=r(this,e,arguments),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,Da),a(e,[{key:"_pickReceiverData",value:function(e,t){var n=this;e.forEach(function(e){var t;if("unified-plan"!==n._sdpSemantics||n.isValidTranceiver(e,"inbound-rtp")){var r=e.packetsLost,i=e.packetsReceived,o=e.jitter,a=e.bytesReceived,s=e.kind,c=e.nackCount,u=e.pliCount,d=e.audioLevel,_=e.frameHeight,l=e.frameWidth,p=null===(t=n._store)||void 0===t?void 0:t.getTrackIdBySSRC(e.ssrc);if(p){n._totalPacketsLost+=r;var f=n.updateReceiverPacketsLost(p,r,i),h=n.updateBytesRecv(p,a,n._reportsData.timestamp);h<0&&(h=0),n._bitrateRecv+=h,n._reportsData.receivers.push({trackId:p,kind:s,packetsLostRate:f,remoteResource:!0,audioLevel:d||0===d?Aa(d):null,frameWidth:l,frameHeight:_,frameRate:null,bitrate:h,jitter:o?Math.round(1e3*o):o,codecImplementationName:null,nackCount:c,pliCount:u,rtt:null,samplingRate:ha,googFirsReceived:ha,googRenderDelayMs:ha,trackState:ha})}}})}},{key:"_pickSenderData",value:function(e,t){var n=this;e.forEach(function(e){var r;if("unified-plan"!==n._sdpSemantics||n.isValidTranceiver(e,"outbound-rtp")){var i=null===(r=n._store)||void 0===r?void 0:r.getTrackIdBySSRC(e.ssrc),o=e.kind,a=e.bytesSent,s=e.pliCount,c=e.nackCount,u=e.audioLevel,d=e.frameHeight,_=e.frameWidth,l=e.codecId,p=e.remoteId,f=e.packetsSent;if(i){var h=t[p],R=null,g=null,m=0;h&&(R=h.jitter,g=h.roundTripTime,m=h.packetsLost),n._totalPacketsLost+=m;var C=0;!n._latestPacketsSent[i]&&(n._latestPacketsSent[i]={}),h?C=n.updateSenderPacketsLost(i,m,f):n._latestPacketsSent[i].crtPacketsSent=f;var v=n.updateBytesSent(i,a,n._reportsData.timestamp);v<0&&(v=0),n._bitrateSend+=v,n._reportsData.senders.push({trackId:i,kind:o,packetsLostRate:C,remoteResource:!1,audioLevel:u||0===u?Aa(u):null,frameWidth:_,frameHeight:d,frameRate:null,bitrate:v,jitter:R?Math.round(1e3*R):R,rtt:g?Math.round(1e3*g):g,encoderImplementation:t[l].mimeType,pliCount:s,nackCount:c,googFirsSent:ha,samplingRate:ha,googRenderDelayMs:ha,trackState:ha})}}})}},{key:"_pickIceCandidatePair",value:function(e,t){var n=e.selectedCandidatePairId;if(n){var r=t[n],i=r.availableOutgoingBitrate,o=r.availableIncomingBitrate,a=r.currentRoundTripTime,s=r.localCandidateId,c=r.remoteCandidateId,u=t[s],d=u.address,_=u.port,l=t[c],p=l.address,f=l.port,h=l.protocol;this._reportsData.iceCandidatePair={IP:d||null,port:_,networkType:null,remoteIP:p,remotePort:f,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})}}},{key:"formatRCRTCStateReport",value:function(e){var t=this.formatStateData(e),n=t.outbound,r=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(n,e),this._pickReceiverData(r,e),i.length>0){var s=i[0];this._pickIceCandidatePair(s,e)}return this._reportsData}}])}(),xa=function(){function e(t,n,r){i(this,e),Object.defineProperty(this,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:n}),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 o=this.getStreamIndex();this.spliteStreams(o)}return a(e,[{key:"videoSdps",get:function(){return this.videoStreams.slice()}},{key:"audioSdps",get:function(){return this.audioStreams.slice()}},{key:"getStreamIndex",value:function(){for(var e=/m=(?:video|audio)/gim,t=new Set([0]),n=e.exec(this.SDP);null!==n;)t.add(null==n?void 0:n.index),n=e.exec(this.SDP);return t.add(this.SDP.length),v(t)}},{key:"spliteStreams",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 n=this.SDP.substring(e[t],e[t+1]);/^\bm=video\b/.test(n)?this.videoStreams.push(n):this.audioStreams.push(n)}}},{key:"setHeaderBitrate",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))}},{key:"setAudiosBitrate",value:function(e){var t=this;return this.audioStreams=this.audioStreams.map(function(n){return t.setAudioItemBitrate(n,e)}),this}},{key:"setAudioBitrateWithStreamId",value:function(e,t){var n=this;return this.audioStreams=this.audioStreams.map(function(r){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(r)?n.setAudioItemBitrate(r,e):r}),this}},{key:"setAudioBitrateWithMid",value:function(e,t){var n=this;return this.audioStreams=this.audioStreams.map(function(r){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(r)?n.setAudioItemBitrate(r,e):r}),this}},{key:"setAudioItemBitrate",value:function(t,n){if(0===n.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bmaxaveragebitrate\b/gi.test(t)){var r=["$1","maxaveragebitrate=".concat(n.max*e.KBitrate*1e3)];t=t.replace(/(\buseinbandfec=[^\r\n]+)/gi,r.join(";"))}return this.addAudioBlineAS(t,n)}},{key:"addAudioBlineAS",value:function(t,n){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(n.max*e.KBitrate,"\r\nb=TIAS:").concat(n.max*e.KBitrate*850))}},{key:"setVideosBitrate",value:function(e){var t=this;return this.videoStreams=this.videoStreams.map(function(n){return t.setVideoItemBitrate(n,e)}),this}},{key:"setVideoBitrateWithStreamId",value:function(e,t){var n=this;return this.videoStreams=this.videoStreams.map(function(r){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(r)?n.setVideoItemBitrate(r,e):r}),this}},{key:"setVideoBitrateWithMid",value:function(e,t){var n=this;return this.videoStreams=this.videoStreams.map(function(r){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(r)?n.setVideoItemBitrate(r,e):r}),this}},{key:"setVideoItemBitrate",value:function(t,n){if(0===n.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bx-google-max-bitrate\b/.test(t)){var r=["$1","x-google-max-bitrate=".concat(n.max*e.KBitrate),"x-google-min-bitrate=".concat(n.min*e.KBitrate),"x-google-start-bitrate=".concat(n.start||n.max*e.KBitrate*.7)];t=t.replace(/(\bprofile-level-id=42[e0]01f\b)/gi,r.join(";"))}return this.addVideoBlineAS(t,n)}},{key:"addVideoBlineAS",value:function(t,n){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(n.max*e.KBitrate,"\r\nb=TIAS:").concat(n.max*e.KBitrate*850))}},{key:"clearnSsrcWithMid",value:function(e,t){var n=this;return this.audioStreams=this.audioStreams.map(function(r){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(r)?n.clearSSRC(r,t):r}),this.videoStreams=this.videoStreams.map(function(r){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(r)?n.clearSSRC(r,t):r}),this}},{key:"clearSSRC",value:function(e,t){if(t===Ga.SENDONLY&&/\ba=sendonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===Ga.RECVONLY&&/\ba=recvonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===Ga.INACTIVE&&/\ba=inactive\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");return e}}],[{key:"trimBlankLine",value:function(e){return e.replace(/\n\r\s*\r\n/g,"\r\n").replace(/\s+\r\n/g,"\r\n")}},{key:"clearInactiveOrRecvonly",value:function(e){return/\ba=(recvonly|inactive)\b/.test(e)?e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,""):e}}])}();Object.defineProperty(xa,"KBitrate",{enumerable:!0,configurable:!0,writable:!0,value:1});var Ba,Va=function(){return a(function e(){i(this,e)},null,[{key:"init",value:function(e,t){this._audioEncoder=e.encodeAudio,this._audioDecoder=e.decodeAudio,this._videoEncoder=e.encodeVideo,this._videoDecoder=e.decodeVideo,this._logger=t}},{key:"isInit",value:function(){return!!(this._audioEncoder&&this._audioDecoder&&this._videoEncoder&&this._videoDecoder)}},{key:"decodeAudio",value:function(e){try{return this._audioDecoder(e)}catch(t){return this._logger.error(ye.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}},{key:"encodeAudio",value:function(e){try{return this._audioEncoder(e)}catch(t){return this._logger.error(ye.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}},{key:"decodeVideo",value:function(e){try{return this._videoDecoder(e)}catch(t){return this._logger.error(ye.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}},{key:"encodeVideo",value:function(e){try{return this._videoEncoder(e)}catch(t){return this._logger.error(ye.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),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"}(Ba||(Ba={})),Ba.NB,Ba.NB,Ba.NB,Ba.NB,Ba.MB,Ba.MB,Ba.MB,Ba.MB,Ba.WB,Ba.WB,Ba.WB,Ba.WB,Ba.SWB,Ba.SWB,Ba.FB,Ba.FB,Ba.NB,Ba.NB,Ba.NB,Ba.NB,Ba.WB,Ba.WB,Ba.WB,Ba.WB,Ba.SWB,Ba.SWB,Ba.SWB,Ba.SWB,Ba.FB,Ba.FB,Ba.FB,Ba.FB;var ja=function(){function e(){i(this,e)}return a(e,null,[{key:"splitSections",value:function(e){return e.split("\nm=").map(function(e,t){var n=t>0?"m=".concat(e):e;return"".concat(n.trim(),"\r\n")})}},{key:"getMediaSections",value:function(t){var n=e.splitSections(t);return n.shift(),n}},{key:"parseExtmap",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]}}},{key:"splitLines",value:function(e){return e.trim().split("\n").map(function(e){return e.trim()})}},{key:"parseMLine",value:function(t){var n=e.splitLines(t)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}}},{key:"matchPrefix",value:function(t,n){return e.splitLines(t).filter(function(e){return 0===e.indexOf(n)})}},{key:"parseMsid",value:function(t){var n,r=e.matchPrefix(t,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[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:(n=i[0].value.split(" "))[0],track:n[1]}:{stream:"",track:""}}},{key:"parseSsrcMedia",value:function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n}},{key:"getMid",value:function(t){var n=e.matchPrefix(t,"a=mid:")[0];if(n)return n.substr(6)}},{key:"splitNaluData",value:function(e){var t=new Uint8Array(e),n=0;if(this.isIFrame(t)){var r=t.join(","),i=r.indexOf("0,0,0,1,101");-1===i&&(i=r.indexOf("0,0,0,1,37")),n=r.substring(0,i).split(",").length-1+4+8}else n=12;return{header:t.slice(0,n),payloadData:t.slice(n)}}},{key:"deal0x03",value:function(e,t){var n=[];return n="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(n)}},{key:"isIFrame",value:function(e){var t=e.join("").startsWith("0001103");return t||(t=e.join("").startsWith("000139")),t}},{key:"parsePayloadTypes",value:function(t){var n=e.getMediaSections(t).find(function(t){return"audio"===e.parseMLine(t).kind});if(n){var r=n.match(/a=rtpmap:(\d+)\s+(\S+)/g);r&&(e.payloadTypeCodecMap=r.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(ja,"payloadTypeCodecMap",{enumerable:!0,configurable:!0,writable:!0,value:[]});var Fa,Ga;function Ja(e,t){for(var n=0,r=t;r<e.length;){var i=e[r];if(n+=i,r++,255!==i)break}return{value:n,nextOffset:r}}function Ha(e,t){if(t>=e.length)return null;var n=Ja(e,t),r=n.value,i=n.nextOffset,o=Ja(e,i),a=o.value;if(i=o.nextOffset,a<16)return null;if(i+a>e.length)return null;var s=e.slice(i,i+16),c=i+16,u=a-16,d=e.slice(c,c+u);return d.length>=2&&0===d[d.length-2]&&128===d[d.length-1]?d=d.slice(0,d.length-2):d.length>=1&&128===d[d.length-1]&&(d=d.slice(0,d.length-1)),5===r?{payloadSize:a,uuid:s,content:d}:null}!function(e){e.PLANB="plan-b",e.UNIFIEDPLAN="unified-plan"}(Fa||(Fa={})),function(e){e.SENDONLY="sendonly",e.RECVONLY="recvonly",e.INACTIVE="inactive"}(Ga||(Ga={}));var Ka=function(){function e(t,n,r,o){i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_useEncrypt",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_onReceiveSeiListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_outboundStreams",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return a(e,[{key:"setReceiveSeiListener",value:function(e){this._onReceiveSeiListener=e}},{key:"getOutboundVideoInfo",value:function(){var e=[];for(var t in this._outboundStreams){var n=this._outboundStreams[t].getVideoTracks()[0];if(n){var r=/_tiny$/.test(t),i=An(n),o=i.width,a=i.height;e.push({trackId:n.id,simulcast:r?Ea.TINY:Ea.NORMAL,resolution:"".concat(o,"x").concat(a)})}}return e}},{key:"setRemoteAnswer",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)switch(t.p=t.n){case 0:return e=xa.trimBlankLine(e),t.p=1,t.n=2,this._peer.setRemoteDescription({type:"answer",sdp:e});case 2:t.n=4;break;case 3:return t.p=3,n=t.v,this._logger.info(ye.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:Le.FAILED,msg:n})),t.a(2,exports.RCRTCCode.SET_REMOTE_DESCRIPTION_FAILED);case 4:return this._logger.info(ye.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:Le.SUCCESSED,sdp:e})),t.a(2,exports.RCRTCCode.SUCCESS)}},t,this,[[1,3]])}))}},{key:"getStatParsr",value:function(e,t,n,r){return/chrome/i.test(Gn.browser)?new Ua(this,e,this._logger,t,n,r):/Firefox/i.test(Gn.browser)?new wa(this,e,this._logger,t,n,r):/Safari/i.test(Gn.browser)?new Ma(this,e,this._logger,t,n,r):null}},{key:"getTrackIdByMid",value:function(e){return null}},{key:"resetSdp",value:function(e){return xa.trimBlankLine(e)}},{key:"_setupSenderTransform",value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),n=t.readable,r=t.writable,i=new TransformStream({transform:this._encodeRtpChunk.bind(this,e)});n.pipeThrough(i).pipeTo(r)}}},{key:"_setupReceiverTransform",value:function(e){var t=e.createEncodedStreams(),n=t.readable,r=t.writable,i=new TransformStream({transform:this._decodeRtpChunk.bind(this,e)});n.pipeThrough(i).pipeTo(r)}},{key:"_encodeVideoFrame",value:function(e){var t=ja.splitNaluData(e),n=t.header,r=t.payloadData,i=Va.encodeVideo(r),o=ja.deal0x03(i,"encode");return new Uint8Array([].concat(v(n),v(o))).buffer}},{key:"_decodeVideoFrame",value:function(e){var t,n=new Uint8Array(e),r=n.join(",").indexOf("0,0,0,1,6,5");if(-1!==r&&n.join(",").includes("84,128,131,151,240,35,71,75,183,247,79,50,181,78,6,172")){var i=n.join(",").slice(r);return null===(t=this._onReceiveSeiListener)||void 0===t||t.call(this,i),e}if(!this._useEncrypt)return e;var o=ja.splitNaluData(e),a=o.header,s=o.payloadData,c=ja.deal0x03(s,"decode"),u=Va.decodeVideo(c);return new Uint8Array([].concat(v(a),v(u))).buffer}},{key:"_handleAudioREDFrame",value:function(e,t){var n=function(e){for(var t=[],n=0;;){var r,i=!(e[n]>>7),o=127&e[n],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(n,n+1),n+=1):(a=(e[n+1]<<6)+(e[n+2]>>2),s=((3&e[n+2])<<8)+e[n+3],c=e.slice(n,n+4),n+=4),r=new Uint8Array(s),t.push({timestampOffset:a,header:c,block:r,isPrimary:i,blockPType:o}),i)break}return t.forEach(function(t){var r=t.block.byteLength,i=e.slice(n,n+r);t.block.set(i),n+=r}),t}(new Uint8Array(e)),r=[],i=[],o=0;n.forEach(function(e){var n="decode"===t?Va.decodeAudio(e.block):Va.encodeAudio(e.block);if(n.byteLength!==e.block.byteLength&&!e.isPrimary){var a=m(e.header,4),s=a[2],c=a[3];s=(s>>2<<2)+n.byteLength>>8,c=255&n.byteLength,e.header=new Uint8Array([e.header[0],e.header[1],s,c])}e.block=n,o+=e.block.byteLength+e.header.byteLength,r.push(e.header),i.push(e.block)});var a=new Uint8Array(o),s=0;return[].concat(r,i).forEach(function(e){a.set(e,s),s+=e.byteLength}),a.buffer}},{key:"_handleOpusFrame",value:function(e,t){var n=new Uint8Array(e);return("encode"===t?Va.encodeAudio(n):Va.decodeAudio(n)).buffer}},{key:"_encodeRtpChunk",value:function(e,t,n){var r=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._encodeVideoFrame(r);else{var i=t.getMetadata().payloadType,o=ja.payloadTypeCodecMap.filter(function(e){return e.payloadType===i})[0].codec;"red"===o?t.data=this._handleAudioREDFrame(r,"encode"):"opus"===o?t.data=this._handleOpusFrame(r,"encode"):console.error("Unsupport audio payloadType: ".concat(i,", codec: ").concat(o))}n.enqueue(t)}},{key:"_decodeRtpChunk",value:function(e,t,n){var r=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._decodeVideoFrame(r);else if(this._useEncrypt){var i=t.getMetadata().payloadType,o=ja.payloadTypeCodecMap.filter(function(e){return e.payloadType===i})[0].codec;"red"===o?t.data=this._handleAudioREDFrame(r,"decode"):"opus"===o?t.data=this._handleOpusFrame(r,"decode"):console.error("Unsupport audio payloadType: ".concat(i,", codec: ").concat(o))}n.enqueue(t)}}],[{key:"setSdpSemantics",value:function(e,t){var n=Gn.browser,r=Gn.version,i=Gn.supportsUnifiedPlan;if(t.info(ye.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O,JSON.stringify({sdpSemantics:e,supportsUnifiedPlan:i,browser:n,version:r})),i)return/chrome/i.test(n)?r?void(this._sdpSemantics=r>92?"unified-plan":r<72?"plan-b":e):void(this._sdpSemantics="unified-plan"):void(/firefox/i.test(n)?this._sdpSemantics="unified-plan":/safari/i.test(n)?this._sdpSemantics=r<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan");this._sdpSemantics="plan-b"}},{key:"getSdpSemantics",value:function(){return e._sdpSemantics}}])}(),qa=function(){function e(t,n){var o;return i(this,e),o=r(this,e,[n,Fa.PLANB,t]),Object.defineProperty(o,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,xa),a(e,[{key:"stringify",value:function(){var e=[this.SDPHeader];[].concat(v(this.audioStreams),v(this.videoStreams)).forEach(function(t){var n=t.match(/\ba=mid:(video|audio)\b/),r=xa.clearInactiveOrRecvonly(t);n&&n[1]===Zt.AUDIO&&(e[1]=r),n&&n[1]===Zt.VIDEO&&(e[2]=r)});var t=e.join("");return xa.trimBlankLine(t)}},{key:"setAudioBitrateWithStreamId",value:function(e,t){return this._logger.warn(ye.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Audio Bitrate With Stream Id"),this}},{key:"setVideoBitrateWithStreamId",value:function(e,t){return this._logger.warn(ye.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Video Bitrate With Stream Id"),this}}])}(),Wa=function(){function e(){var t;return i(this,e),t=r(this,e,arguments),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,Ka),a(e,[{key:"addLocalTrack",value:function(e){this._localTracks.every(function(t){return t.getTrackId()!==e.getTrackId()})&&this._localTracks.push(e);var t=e.getStreamId(),n=e.__innerGetMediaStreamTrack(),r=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);r.getTracks().forEach(function(e){e.kind===n.kind&&r.removeTrack(e)}),r.addTrack(n);var i=e.getTrackId(),o=this.senders[i];o?o.replaceTrack(n):(this.senders[i]=this._peer.addTrack(n,r),Object.defineProperty(n,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}))}},{key:"removeLocalTrack",value:function(e){var t=this._localTracks.findIndex(function(t){return t===e});t>=0&&this._localTracks.splice(t,1);var n=e.getTrackId(),r=this.senders[n];r&&(r.replaceTrack(null),this._peer.removeTrack(r),delete this.senders[n])}},{key:"updateSubRemoteTracks",value:function(e){}},{key:"updateRecvTransceiverMap",value:function(e,t){}},{key:"setBitrate",value:function(e,t,n){}},{key:"createOffer",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 1:for(r in n=t.v,this._outboundStreams)i=this._outboundStreams[r].id,n.sdp=n.sdp.replace(new RegExp(i,"g"),r);return n.sdp&&(n.sdp=this.resetSdp(n.sdp)),t.n=2,this._peer.setLocalDescription(n);case 2:return t.a(2,{type:"offer",semantics:"plan-b",sdp:n.sdp})}},t,this)}))}},{key:"setRemoteAnswer",value:function(t){return t=this.resetSdp(t),C(e,"setRemoteAnswer",this,3)([t])}},{key:"_getMaxRangeBitrate",value:function(e){var t=this._localTracks.filter(function(t){return e===exports.RCMediaType.AUDIO_ONLY?t.isAudioTrack():t.isVideoTrack()}),n={max:0,min:0};return t.forEach(function(e){var t=e.getBitrate(),r=t.min,i=t.max,o=t.start;n.max=n.max<i?i:n.max,n.min=n.min>r?r:n.min,n.max===i?n.start=o:n.start=.7*n.max}),n}},{key:"resetSdp",value:function(e){var t=new qa(this._logger,e),n=this._getMaxRangeBitrate(exports.RCMediaType.VIDEO_ONLY),r=this._getMaxRangeBitrate(exports.RCMediaType.AUDIO_ONLY);return t.setAudiosBitrate(r),t.setVideosBitrate(n),t.stringify()}}])}(),za=function(){function e(t,n){return i(this,e),r(this,e,[n,Fa.UNIFIEDPLAN,t])}return _(e,xa),a(e,[{key:"stringify",value:function(){var e=[this.SDPHeader];[].concat(v(this.audioStreams),v(this.videoStreams)).forEach(function(t){var n=t.match(/\ba=mid:(\d+)\b/);n&&n[1]&&(e[+n[1]+1]=t)}),this.SDPHeader="",this.videoStreams=[],this.audioStreams=[];var t=e.join("");return xa.trimBlankLine(t)}}])}(),Ya=function(){function e(){i(this,e),Object.defineProperty(this,"__streams",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}return a(e,[{key:"push",value:function(e,t){return this.__streams.set(e,t),t}},{key:"pickup",value:function(e){return this.__streams.get(e)}},{key:"delete",value:function(e){return this.__streams.delete(e)}},{key:"streams",get:function(){var e,t=new Map,n=s(this.__streams.keys());try{for(n.s();!(e=n.n()).done;){var r=e.value;t.set(r,this.pickup(r))}}catch(e){n.e(e)}finally{n.f()}return t}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}])}(),Qa=function(){function e(){var t;return i(this,e),t=r(this,e,arguments),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,Ka),a(e,[{key:"setBitrate",value:function(e,t,n){this._logger.warn(ye.L_FUNCTION_IS_UNAVAILABLE,"the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}},{key:"getTrackIdByMid",value:function(e){for(var t in this._sendTransceiver){if(this._sendTransceiver[t].mid===e)return t}for(var n in this._recvTransceiver){if(this._recvTransceiver[n].mid===e)return n}return null}},{key:"addLocalTrack",value:function(e){var t,n=e.getTrackId(),r=e.getStreamId(),i=e.__innerGetMediaStreamTrack();this._localTracks[n]=e;var o=this._outboundStreams[r]||(this._outboundStreams[r]=new MediaStream);o.getTracks().forEach(function(e){e.kind===i.kind&&o.removeTrack(e)}),o.addTrack(i);var a=this._sendTransceiver[n];if(a)a.sender.replaceTrack(i),a.direction="sendonly";else{var s=this._sendTransceiver[n]=this._peer.addTransceiver(i,{direction:"sendonly",streams:[o]});this._setupSenderTransform(s.sender)}Ya.getInstance().push(n,{msid:r,id:this._outboundStreams[r].id,kind:null===(t=e.streamTrack)||void 0===t?void 0:t.kind})}},{key:"removeLocalTrack",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e.getTrackId(),r=e.getStreamId();delete this._localTracks[n];var i=this._sendTransceiver[n];if(i){"closed"!==this._peer.connectionState&&(i.direction="inactive",this._peer.removeTrack(i.sender),i.sender.replaceTrack(null));var o=this._outboundStreams[r];(e.isAudioTrack()?o.getAudioTracks():o.getVideoTracks()).forEach(function(e){return o.removeTrack(e)});var a=this._sendTransceiver["".concat(n,"_tiny")];if(a&&"inactive"!==a.direction&&t&&"closed"!==this._peer.connectionState){a.direction="inactive";var s=a.sender,c=s.track;this._peer.removeTrack(s),s.replaceTrack(null),this._outboundStreams["".concat(r,"_tiny")].removeTrack(c),c.stop()}}}},{key:"updateRecvTransceiverMap",value:function(e,t){var n=Dn(e).mediaType;this._recvTransceiver[e]=t;var r=n===exports.RCMediaType.AUDIO_ONLY?this._recvAudio:this._recvVideo,i=r.findIndex(function(e){return e===t});i>=0&&r.splice(i,1)}},{key:"updateSubRemoteTracks",value:function(e){var t=this,n=e.slice(),r=this._subedTracks.slice();this._subedTracks=e.slice();for(var i=function(){var e=n[o],t=r.findIndex(function(t){return t===e});t>=0&&(n.splice(o,1),r.splice(t,1))},o=n.length-1;o>=0;o-=1)i();r.length&&r.forEach(function(e){var n=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var r=t._recvTransceiver[n];r&&(r.direction="inactive")});var a={audio:0,video:0};n.length&&n.forEach(function(e){var n=e.isAudioTrack()?"audio":"video",r=t._recvTransceiver[e.getTrackId()];r?r.direction="recvonly":a[n]+=1});for(var s=this._recvAudio.length;s<a.audio;s+=1){var c=this._peer.addTransceiver("audio",{direction:"recvonly"});this._recvAudio.push(c),this._setupReceiverTransform(c.receiver)}for(var u=this._recvVideo.length;u<a.video;u+=1){var d=this._peer.addTransceiver("video",{direction:"recvonly"});this._recvVideo.push(d),this._setupReceiverTransform(d.receiver)}}},{key:"createOffer",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._peer.createOffer({iceRestart:e});case 1:for(i in n=t.v,r=n.sdp,this._outboundStreams)o=this._outboundStreams[i].id,r=r.replace(new RegExp(o,"g"),i);return r=(r=this.resetOfferSdp(r)).replace(/(a=ice-options:trickle)/g,"$1\r\na=ice-options:renomination"),n.sdp=r,t.n=2,this._peer.setLocalDescription(n);case 2:return t.a(2,{type:"offer",semantics:"unified-plan",sdp:r})}},t,this)}))}},{key:"setRemoteAnswer",value:function(t){t=this.resetAnswerSdp(t);var n=/[\r\n]+\r\n[\r\n]+/g;return n.test(t)&&(t=t.replace(n,"\r\n")),C(e,"setRemoteAnswer",this,3)([t])}},{key:"_genarateMid",value:function(e,t,n){var r=null;return ja.getMediaSections(e).forEach(function(e){ja.parseExtmap(e);var i=ja.parseMLine(e).kind,o=ja.parseMsid(e).stream,a=ja.getMid(e);"video"===n?/tiny$/.test(o)?o=o.replace(/tiny$/gi,"1_tiny"):o+="_1":o+="_0",o===t&&n===i&&a&&(r=a)}),r}},{key:"_setSenderTransceiverBitrate",value:function(e,t,n,r){var i=this._localTracks[t],o=null==i?void 0:i.getBitrate();r===Zt.AUDIO&&o&&e.setAudioBitrateWithMid(o,n),r===Zt.VIDEO&&o&&e.setVideoBitrateWithMid(o,n)}},{key:"_resetSenderTransceiver",value:function(e,t){var n;for(var r in this._sendTransceiver){var i=this._sendTransceiver[r],o=null===(n=i.sender.track)||void 0===n?void 0:n.kind,a=i.direction,s=i.mid;s||(s=this._genarateMid(e,r,o)),s&&(a===Ga.SENDONLY&&this._setSenderTransceiverBitrate(t,r,s,o),a===Ga.INACTIVE&&t.clearnSsrcWithMid(s,Ga.INACTIVE))}}},{key:"_resetRecvTransceiver",value:function(e){for(var t in this._recvTransceiver){var n=this._recvTransceiver[t],r=n.direction,i=n.mid;i&&r===Ga.INACTIVE&&e.clearnSsrcWithMid(i,Ga.RECVONLY)}}},{key:"resetOfferSdp",value:function(e){var t=new za(this._logger,e);return this._resetSenderTransceiver(e,t),this._resetRecvTransceiver(t),t.stringify()}},{key:"resetAnswerSdp",value:function(e){var t,n=new za(this._logger,e);for(var r in this._sendTransceiver){var i=this._sendTransceiver[r],o=i.mid;if(o){var a=this._localTracks[r],s=null==a?void 0:a.getBitrate(),c=null===(t=i.sender.track)||void 0===t?void 0:t.kind;c===Zt.AUDIO&&s&&n.setAudioBitrateWithMid(s,o),c===Zt.VIDEO&&s&&n.setVideoBitrateWithMid(s,o)}}return n.stringify()}}])}(),Za=function(){function e(t,n,o,a,s,c){var u,d=arguments.length>6&&void 0!==arguments[6]&&arguments[6],_=arguments.length>7&&void 0!==arguments[7]&&arguments[7];i(this,e),u=r(this,e),Object.defineProperty(u,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_reTryExchange",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"_store",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"_isRoomAudience",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(u,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"reportParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"pubLocalTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(u,"_reTryExchangeTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_reportStatsTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_reportR3R4ToPolarisTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_formatStatsData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_inRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_firstConnectFromPub",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null});var l=Ka.getSdpSemantics(),p="unified-plan"===l&&_&&"function"==typeof RTCRtpSender.prototype.createEncodedStreams&&"function"==typeof RTCRtpReceiver.prototype.createEncodedStreams&&Va.isInit(),f=u._rtcPeerConn=new RTCPeerConnection({sdpSemantics:l,encodedInsertableStreams:p});return u._sdpStrategy="plan-b"===l?new Wa(t,u._logger,f,!1):new Qa(t,u._logger,f,p),u._sdpStrategy.setReceiveSeiListener(u._decodeSeiData.bind(u)),u._rtcPeerConn.oniceconnectionstatechange=u._onICEConnectionStateChange.bind(u),u._rtcPeerConn.onconnectionstatechange=u._onConnectionStateChange.bind(u),u._rtcPeerConn.ontrack=u._onTrackReady.bind(u),u.reportParser=u._sdpStrategy.getStatParsr(u._rtcPeerConn,l,u._currentUserId,u._store),u}return _(e,F),a(e,[{key:"getLocalTracks",value:function(){return Object.values(this.pubLocalTracks)}},{key:"_decodeSeiData",value:function(t){var n=t.split(",").map(function(e){return Number(e)}),r=function(e){if(e.length>=4&&0===e[0]&&0===e[1]&&(1===e[2]||0===e[2]&&1===e[3]))for(var t=0;t+4<e.length;)if(0===e[t]&&0===e[t+1]&&(1===e[t+2]||0===e[t+2]&&1===e[t+3])){var n=t+(1===e[t+2]?3:4);if(n>=e.length)break;if(6==(31&e[n])){var r=Ha(e,n+1);if(r)return{payloadSize:r.payloadSize,content:r.content}}t=n+1}else t++;else for(var i=0;i+4<=e.length;){var o=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3];if(o<=0||i+4+o>e.length)break;var a=i+4;if(6==(31&e[a])){var s=a+1,c=Ha(e.subarray(s,i+4+o),0);if(c)return{payloadSize:c.payloadSize,content:c.content}}i+=4+o}return null}(new Uint8Array(n));if(null==r?void 0:r.content.length){var i=this._context.decodeAsrText(r.content,n);i.length&&this.emit(e.__INNER_SEI_CONTENT__,i)}}},{key:"_onConnectionStateChange",value:function(){this._logger.info(ye.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S,"state: ".concat(this._rtcPeerConn.connectionState))}},{key:"startAutoExecute",value:function(e){var t=this;this.stopAutoExecute(),this._reportStatsTimer=setTimeout(function(){t._reportHandle(),t.startAutoExecute(e)},e)}},{key:"stopAutoExecute",value:function(){clearTimeout(this._reportStatsTimer)}},{key:"_onICEConnectionStateChange",value:function(){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a;return p().w(function(t){for(;;)switch(t.n){case 0:return i=this._rtcPeerConn.iceConnectionState,this._logger.info(ye.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S,JSON.stringify({iceConnectionState:i})),t.n=1,this._getStatsData();case 1:o=t.v,a=o?this._createRCRTCStateReport(o).iceCandidatePair:null,this.emit(e.__INNER_ICE_STATE_CHANGE__,{status:i,time:Date.now(),iceCandidatePair:a}),"connected"===i?(this.emit(e.__INNER_ICE_CONNECTED__,this._firstConnectFromPub),this.startAutoExecute(1e3)):"failed"!==i&&"disconnected"!==i||this._handleRetry();try{null===(r=null===(n=this._reportListener)||void 0===n?void 0:n.onICEConnectionStateChange)||void 0===r||r.call(n,i)}catch(e){this._logger.error(ye.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R,JSON.stringify({status:Le.FAILED,mag:e}))}case 2:return t.a(2)}},t,this)}))}},{key:"_handleRetry",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r=this;return p().w(function(e){for(;;)switch(e.n){case 0:if(!this._inRetry){e.n=1;break}return e.a(2);case 1:return this.clearReTryExchangeTimer(),this._inRetry=!0,e.n=2,this._reTryExchange();case 2:if(t=e.v,n=t.code,this._inRetry=!1,n!==exports.RCRTCCode.SUCCESS){e.n=3;break}return e.a(2);case 3:this._reTryExchangeTimer=setTimeout(function(){return r._handleRetry()},15e3);case 4:return e.a(2)}},e,this)}))}},{key:"_onTrackReady",value:function(t){if(t.streams.length){var n=t.streams[0].id,r=t.receiver.track,i=[n,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_");Object.defineProperty(r,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}),this._updateRecvTransceiverMap(i,t.transceiver),Dn(i).tag!==Ra&&this.emit(e.__INNER_EVENT_TRACK_READY__,t)}}},{key:"setBitrate",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){return p().w(function(r){for(;;)switch(r.n){case 0:this._sdpStrategy.setBitrate(e,t,n),this._logger.info(ye.L_RTC_PEER_CONNECTION_SET_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,max:e,min:t,start:n}));case 1:return r.a(2)}},r,this)}))}},{key:"createOffer",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._sdpStrategy.createOffer(e);case 1:return n=t.v,this._logger.info(ye.L_RTC_PEER_CONNECTION_CREATE_OFFER_O,JSON.stringify({offerSDP:n.sdp,sdpDemantics:n.semantics})),t.a(2,n)}},t,this)}))}},{key:"setRemoteAnswer",value:function(e){return K(this,arguments,void 0,function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return p().m(function r(){var i;return p().w(function(r){for(;;)if(0===r.n)return ja.parsePayloadTypes(null===(i=t._rtcPeerConn.localDescription)||void 0===i?void 0:i.sdp),t._firstConnectFromPub=n,r.a(2,t._sdpStrategy.setRemoteAnswer(e))},r)})()})}},{key:"getLocalTrack",value:function(e){return this.pubLocalTracks[e]||null}},{key:"addLocalTrack",value:function(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(_n.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(_n.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(_n.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(_n.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),this._logger.info(ye.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O,"trackId: ".concat(e.getTrackId()))}},{key:"removeLocalTrackById",value:function(e){var t=this.getLocalTrack(e);t?(this._logger.info(ye.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this.removeLocalTrack(t)):this._logger.warn(ye.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:Le.FAILED,msg:"track not found",trackId:e}))}},{key:"removeAllLocalTrack",value:function(){var e=this;Object.keys(this.pubLocalTracks).forEach(function(t){/_tiny$/.test(t)||e.removeLocalTrackById(t)})}},{key:"removeLocalTrack",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e.getTrackId();delete this.pubLocalTracks[n],this._sdpStrategy.removeLocalTrack(e,t),e.__innerSetPublished(!1),e.off(_n.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(_n.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);var r="".concat(n,"_tiny"),i=this.getLocalTrack(r);i&&t&&(this._sdpStrategy.removeLocalTrack(i,t),delete this.pubLocalTracks[r],i.destroy()),this._logger.info(ye.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O,JSON.stringify({trackId:n}))}},{key:"_updateRecvTransceiverMap",value:function(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}},{key:"updateSubRemoteTracks",value:function(e){this._sdpStrategy.updateSubRemoteTracks(e)}},{key:"getOutboundVideoInfo",value:function(){return this._sdpStrategy.getOutboundVideoInfo()}},{key:"_onLocalTrackMuted",value:function(e,t){var n=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));n&&(n.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(_n.__INNER_EVENT_MUTED_CHANGE__,e,t)}},{key:"_onLocalTrackDestroied",value:function(e){this.emit(_n.__INNER_EVENT_DESTROY__,e)}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"_createSenderReport",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),Object.assign({},t)})}},{key:"_createReceiverReport",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),Object.assign({},t)})}},{key:"_createRCRTCStateReport",value:function(e){var t=e.timestamp,n=e.iceCandidatePair,r=e.senders,i=e.receivers;for(var o in(null==n?void 0:n.totalPacketsLost)&&(null==n||delete n.totalPacketsLost),n)Wn(n[o])&&delete n[o];return{timestamp:t,iceCandidatePair:n,senders:this._createSenderReport(r),receivers:this._createReceiverReport(i)}}},{key:"_getStatsData",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o;return p().w(function(e){for(;;)switch(e.n){case 0:return this._formatStatsData=null,r=null,e.n=1,this._rtcPeerConn.getStats();case 1:return i=e.v,r=null===(t=this.reportParser)||void 0===t?void 0:t.parseRTCStatsReport(i),o=null===(n=this.reportParser)||void 0===n?void 0:n.formatRCRTCStateReport(r),this._formatStatsData=o,e.a(2,o)}},e,this)}))}},{key:"_reportHandle",value:function(){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u,d;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._getStatsData();case 1:if(s=t.v){t.n=2;break}return t.a(2);case 2:c=this._createRCRTCStateReport(s);try{null===(r=null===(n=this._reportListener)||void 0===n?void 0:n.onStateReport)||void 0===r||r.call(n,JSON.parse(JSON.stringify(c)))}catch(e){this._logger.error(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}if(u=[].concat(v(s.receivers),v(s.senders)).filter(function(e){return"audio"===e.kind}).map(function(e){return{trackId:e.trackId,audioLevel:e.audioLevel}}),this.emit(e.__INNER_AUDIOLEVEL_CHANGE__,u),this._isRoomAudience&&(null===(i=this._reportListener)||void 0===i?void 0:i.onReportLiveAudioStates)){d=this._getLiveAudioState();try{d.length&&(null===(a=null===(o=this._reportListener)||void 0===o?void 0:o.onReportLiveAudioStates)||void 0===a||a.call(o,d))}catch(e){this._logger.error(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}case 3:return t.a(2)}},t,this)}))}},{key:"_getLiveAudioState",value:function(){var e=this,t=[];return this._rtcPeerConn.getReceivers().forEach(function(e){var n=e.getContributingSources();n.length&&t.push.apply(t,v(n))}),t.map(function(t){var n=t.source,r=t.audioLevel,i=e._store.getTrackIdBySSRC(n);if(!i)return{};var o=Dn(i).userId;return{audioLevel:Aa(r),userId:o,trackId:i}}).filter(function(e){return!!e.userId})}},{key:"_sendR3R4Data",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o,a,s,c;return p().w(function(e){for(;;)switch(e.n){case 0:if(o=this._formatStatsData){e.n=1;break}return e.a(2);case 1:if(s=(a=o).senders,c=a.receivers,console.log("sendR3R4: senderTrackId: ".concat(null===(t=s[0])||void 0===t?void 0:t.trackId,", receiverTrackId: ").concat(null===(n=c[0])||void 0===n?void 0:n.trackId)),!s.length){e.n=2;break}return e.n=2,null===(r=this._polarisReport)||void 0===r?void 0:r.sendR3Data(o);case 2:if(!c.length){e.n=3;break}return e.n=3,null===(i=this._polarisReport)||void 0===i?void 0:i.sendR4Data(o);case 3:s.length=0,c.length=0,o=null;case 4:return e.a(2)}},e,this)}))}},{key:"__reportR3R4ToPolaris",value:function(){return K(this,void 0,void 0,p().m(function e(){var t=this;return p().w(function(e){for(;;)switch(e.n){case 0:if(!this._isDestroyed){e.n=1;break}return e.a(2);case 1:clearTimeout(this._reportR3R4ToPolarisTimer),this._reportR3R4ToPolarisTimer=setTimeout(function(){return K(t,void 0,void 0,p().m(function e(){var t=this;return p().w(function(e){for(;;)switch(e.n){case 0:if(!this._isDestroyed){e.n=1;break}return e.a(2);case 1:this._sendR3R4Data().then(function(){t.__reportR3R4ToPolaris()});case 2:return e.a(2)}},e,this)}))},2e3);case 2:return e.a(2)}},e,this)}))}},{key:"getRTCPeerConn",value:function(){return this._rtcPeerConn}},{key:"destroy",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(ye.L_RTC_PEER_CONNECTION_DESTROY_O,JSON.stringify({status:Le.SUCCESSED}))}},{key:"clearReTryExchangeTimer",value:function(){clearTimeout(this._reTryExchangeTimer),this._reTryExchangeTimer=null}},{key:"isDestroyed",value:function(){return this._isDestroyed}}])}();Object.defineProperty(Za,"__INNER_EVENT_TRACK_READY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-track-ready"}),Object.defineProperty(Za,"__INNER_AUDIOLEVEL_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-audio-level-change"}),Object.defineProperty(Za,"__INNER_ICE_STATE_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-state-change"}),Object.defineProperty(Za,"__INNER_ICE_CONNECTED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-connected"}),Object.defineProperty(Za,"__INNER_SEI_CONTENT__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-sei-content"});var Xa,$a,es,ts,ns=function(){return a(function e(t,n){i(this,e),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_audioLevelChangeHandler",{enumerable:!0,configurable:!0,writable:!0,value:null})},[{key:"audioLevelReport",value:function(e){var t=this;if(this._audioLevelChangeHandler){var n=[];e.forEach(function(e){var r=Dn(e.trackId).userId,i=t._store.crtUserId===r?t._peer.getLocalTrack(e.trackId):t._store.getRemoteTrack(e.trackId);i&&n.push({track:i,audioLevel:e.audioLevel||0})}),this._audioLevelChangeHandler(n)}}},{key:"onAudioLevelChange",value:function(e){this._audioLevelChangeHandler=e}}])}();exports.RCRTCLiveRole=void 0,(Xa=exports.RCRTCLiveRole||(exports.RCRTCLiveRole={}))[Xa.ANCHOR=1]="ANCHOR",Xa[Xa.AUDIENCE=2]="AUDIENCE",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"}($a||($a={})),function(e){e[e.LOW=0]="LOW",e[e.NORMAL=1]="NORMAL",e[e.HIGH=2]="HIGH"}(es||(es={})),function(e){e[e.Destroy=40400]="Destroy"}(ts||(ts={}));var rs,is=function(){return a(function e(){i(this,e)},[{key:"priority",get:function(){return es.LOW}},{key:"kind",get:function(){return $a.UNKNOWN}}])}(),os=function(){return a(function e(t,n,r,o){i(this,e),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"abortCode",{enumerable:!0,configurable:!0,writable:!0,value:o}),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})},[{key:"_next",value:function(){this._busy=!1,this._execute()}},{key:"_execute",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o,a,s;return p().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!this._isDestroyed&&!this._busy&&0!==this._queue.length){e.n=1;break}return e.a(2);case 1:return this._busy=!0,t=this._queue.shift(),n=t.command,r=t.resolve,o=this._logger.createTraceId(),e.p=2,this._logger.info(ye.L_INVOKER_EXECUTE_T,"kind: ".concat(n.kind,", length: ").concat(this._queue.length),o),e.n=3,n.execute(this._context,this._store,this);case 3:i=e.v,e.n=5;break;case 4:return e.p=4,s=e.v,console.error(s),this._logger.error(ye.L_INVOKER_EXECUTE_R,n.kind,o),this._next(),e.a(2);case 5:(a=i.code)!==exports.RCRTCCode.SUCCESS&&a!==ke?this._logger.warn(ye.L_INVOKER_EXECUTE_R,"code: ".concat(a,", kind: ").concat(n.kind),o):this._logger.info(ye.L_INVOKER_EXECUTE_R,"kind: ".concat(n.kind,", Done"),o),r(i),this._next();case 6:return e.a(2)}},e,this,[[2,4]])}))}},{key:"push",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n=this;return p().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t){if(n._logger.info(ye.L_INVOKER_PUSH_O,JSON.stringify({isDestroyed:n._isDestroyed,kind:e.kind,length:n._queue.length})),n._isDestroyed)t({code:exports.RCRTCCode.NOT_IN_ROOM});else{var r=e.priority;if(r===es.LOW)n._queue.push({command:e,resolve:t});else{var i=n._queue.findIndex(function(e){return e.command.priority<r}),o=-1===i?n._queue.length-1:i;n._queue.splice(o,0,{command:e,resolve:t})}setTimeout(function(){n._execute()},0)}}))},t)}))}},{key:"isDestroyed",value:function(){return this._isDestroyed}},{key:"destroy",value:function(){var e=this;this._isDestroyed||(this._logger.info(ye.L_INVOKER_DESTROY_O),this._isDestroyed=!0,this._queue.forEach(function(t){t.resolve({code:e.abortCode})}),this._queue.length=0)}}])}(),as=function(){function e(t,n){return i(this,e),r(this,e,[t.logger,t,n,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED])}return _(e,os),a(e,[{key:"store",get:function(){return this._context.store}},{key:"destroy",value:function(){C(e,"destroy",this,3)([]),this._store.removeRemoteTracks()}}])}();!function(e){e.VOID="0",e.OPEN="2",e.CLOSE="1"}(rs||(rs={}));var ss=function(){return a(function e(t,n,r,o,a,s,c,u){i(this,e),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"roomMode",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"isUpgrade",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"isMainRoom",{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,"_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}),Object.defineProperty(this,"_asrStatus",{enumerable:!0,configurable:!0,writable:!0,value:rs.VOID}),Object.defineProperty(this,"_asrEnable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_srcLanguage",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_asrSeiUris",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_isStartRealTranslate",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_translationLang",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_summarizationStatusData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_nickName",{enumerable:!0,configurable:!0,writable:!0,value:""})},[{key:"getResourcesByUserId",value:function(e){return this._roomResources[e]||this._asrSeiUris[e]}},{key:"getRemoteTrack",value:function(e){return this._remoteTracks[e]}},{key:"getRemoteTracksByUserId",value:function(e){var t=[];for(var n in this._remoteTracks){var r=this._remoteTracks[n];r.getUserId()===e&&t.push(r)}return t}},{key:"getRemoteTracks",value:function(){return this._remoteTracks}},{key:"getSessionId",value:function(){return this._sessionId}},{key:"getAllUserIds",value:function(){return Object.keys(this._roomResources)}},{key:"getRemoteUserIds",value:function(){var e=this;return this.getAllUserIds().filter(function(t){return t!==e.crtUserId})}},{key:"getSubscribedList",value:function(){return this._subscribedList}},{key:"getCollectSubscribeList",value:function(){return this._collectSubscribeList}},{key:"getPublishedResourceByTrackId",value:function(e){var t=Dn(e),n=t.tag,r=t.userId;return n===Ra?this._asrSeiUris[r][0]:this._roomResources[r].find(function(t){return Pn(t)===e})}},{key:"getToken",value:function(){return this._token}},{key:"getCDNEnable",value:function(){return this._CDNEnable}},{key:"getCDNUris",value:function(){return this._CDNUris}},{key:"getRoomStatusVersion",value:function(){return this._roomStatusVersion}},{key:"getTrackIdBySSRC",value:function(e){return this._trackIdSSRCMap.get(e)}},{key:"getRTCRequestHeader",value:function(){return{"App-Key":this.appkey,RoomId:this.roomId,Token:this._token,RoomType:this.roomMode,UserId:this.crtUserId,"Client-Session-Id":this.clientSessionId}}},{key:"getSupportNtf",value:function(){return this._supportNtf}},{key:"getASRIsAvailable",value:function(){return!!this.getASRSeiUris().length}},{key:"getASRStatus",value:function(){return this._asrStatus}},{key:"getASREnable",value:function(){return this._asrEnable}},{key:"getSrcLanguage",value:function(){return this._srcLanguage}},{key:"getASRSeiUris",value:function(){var e=Object.values(this._asrSeiUris);return e.length?e[0]:[]}},{key:"getIsStartRealTranslate",value:function(){return this._isStartRealTranslate}},{key:"getTranslationLang",value:function(){return this._translationLang}},{key:"getSummarizationStatusData",value:function(){return this._summarizationStatusData||null}},{key:"getNickName",value:function(){return this._nickName}}])}(),cs=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,ss),a(e,[{key:"_updateTrackIdSSRCMap",value:function(){var e=this;Object.values(this._roomResources).forEach(function(t){t.forEach(function(t){var n=JSON.parse(t.uri),r=n.ssrc,i=n.resourceId;e._trackIdSSRCMap.set(r,i)})})}},{key:"setTrackIdSSRCMap",value:function(e,t){this._trackIdSSRCMap.set(e,t)}},{key:"_initRemoteTracks",value:function(){var e=this;for(var t in this._roomResources){var n=this._roomResources[t];t!==this.crtUserId&&0!==n.length&&n.forEach(function(t){var n=Pn(t),r=Dn(n),i=r.tag,o=r.userId,a=r.mediaType===exports.RCMediaType.AUDIO_ONLY?new Sn(e._logger,i,o):new En(e._logger,i,o);a.__innerSetRemoteMuted(0===t.state),e._remoteTracks[n]=a})}}},{key:"initWithRoomData",value:function(e,t){this._sessionId=e.sessionId,this._token=e.token,this._roomStatusVersion=$n(e.version),this._roomResources=Qn(e,this.roomId,this._logger,t),this._updateTrackIdSSRCMap(),this._initRemoteTracks(),this.setResourcesByUserId(this.crtUserId,this.getResourcesByUserId(this.crtUserId)||[]),this._logger.info(ye.L_PARSE_ROOMDATA_URIS_R,"room data -> ".concat(JSON.stringify(this._roomResources)),t)}},{key:"assignRoomData",value:function(e){Object.assign(this._roomResources,e),this._updateTrackIdSSRCMap()}},{key:"setResourcesByUserId",value:function(e,t){this._roomResources[e]=t,this._updateTrackIdSSRCMap()}},{key:"removeRemoteTrack",value:function(e){delete this._remoteTracks[e]}},{key:"removeResourcesByUserId",value:function(e){delete this._roomResources[e],this._updateTrackIdSSRCMap()}},{key:"addRemoteTrack",value:function(e){this._remoteTracks[e.getTrackId()]=e}},{key:"removeRemoteTracks",value:function(){var e=Object.values(this._remoteTracks);e.length&&(e.forEach(function(e){e.isAudioTrack()&&e.__releaseMediaElement()}),this._remoteTracks={})}},{key:"setCDNEnabel",value:function(e){this._CDNEnable=e}},{key:"setCDNUris",value:function(e){this._CDNUris=e}},{key:"resetSubscribedList",value:function(e){var t;(t=this._subscribedList).splice.apply(t,[0,this._subscribedList.length].concat(v(e))),this.resetCollectSubscribeList(e)}},{key:"resetCollectSubscribeList",value:function(e){var t;(t=this._collectSubscribeList).splice.apply(t,[0,this._collectSubscribeList.length].concat(v(e)))}},{key:"setRoomStatusVersion",value:function(e){this._roomStatusVersion=$n(e)}},{key:"setASRStatus",value:function(e){this._asrStatus=e}},{key:"setASREnable",value:function(e){this._asrEnable=e}},{key:"setSrcLanguage",value:function(e){this._srcLanguage=e}},{key:"setASRSeiUris",value:function(e){if(e.length){var t=e[0].msid.split("_")[0];this._asrSeiUris[t]=e}else this._asrSeiUris={}}},{key:"addSeiRemoteTrack",value:function(e){var t=e[0].msid.split("_"),n=t.pop(),r=t[0],i=new En(this._logger,n,r);this.addRemoteTrack(i)}},{key:"removeSeiRemoteTrack",value:function(){if(this.getASRSeiUris().length){var e=this.getASRSeiUris()[0],t=e.msid,n=e.mediaType,r="".concat(t,"_").concat(n);this.removeRemoteTrack(r)}}},{key:"setIsStartRealTranslate",value:function(e){this._isStartRealTranslate=e}},{key:"setTranslationLang",value:function(e){this._translationLang=e}},{key:"setSummarizationStatusData",value:function(e){this._summarizationStatusData=e}},{key:"setNickName",value:function(e){this._nickName=e}}])}(),us=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,is),a(e,[{key:"kind",get:function(){return $a.UNPUBLISH_PREV}},{key:"execute",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c;return p().w(function(n){for(;;)switch(n.n){case 0:return r=e.logger,i=e.context,o=t.getResourcesByUserId(t.crtUserId),a=o.slice(),o.length=0,s=r.createTraceId(),r.info(ye.L_UNPUBLISH_PREV_COMMAND_T,JSON.stringify({resource:a}),s),n.n=1,i.setRTCTotalRes(t.roomId,[bn(Kn.UNPUBLISH,a)],yn([]),Kn.TOTAL_CONTENT_RESOURCE,yn([]));case 1:return(c=n.v)!==ke?r.error(ye.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:Le.FAILED,code:c}),s):r.info(ye.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:Le.SUCCESSED}),s),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n)}))}}])}();exports.RTCMode=void 0,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"}(exports.RTCMode||(exports.RTCMode={}));var ds,_s=function(){function e(t,n,o,a,s,c,u,d,_){var l;return i(this,e),l=r(this,e),Object.defineProperty(l,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(l,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(l,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(l,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(l,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(l,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(l,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(l,"srcLanguage",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(l,"nickName",{enumerable:!0,configurable:!0,writable:!0,value:_}),l}return _(e,is),a(e,[{key:"kind",get:function(){return $a.JOINROOM}},{key:"_getResultTag",value:function(){var e=ye.L_RTC_CLIENT_JOIN_RTC_ROOM_R;return this.roomType===exports.RTCMode.LIVE&&(e=ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_R),e}},{key:"_validateParams",value:function(e,t,n){var r=this;if(e.getConnectionStatus()!==Se.CONNECTED)return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:exports.RCRTCCode.SIGNAL_DISCONNECTED};if(zn(e.getNaviInfo()))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),this.traceId),{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR};if(!j("roomId",this.roomId,k,!0))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!j("roomType",this.roomType,function(e){return void 0!==exports.RTCMode[e]}))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!j("outerUserDatas",this.outerUserDatas,A,!1))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.outerUserDatas&&!Object.keys(this.outerUserDatas).every(function(e){return j("outerUserDatas.".concat(e),r.outerUserDatas[e],O,!0)}))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.nickName&&(!j("nickName",this.nickName,O,!0)||this.nickName.length>64))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> nickName"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.srcLanguage&&(!j("srcLanguage",this.srcLanguage,O,!0)||this.srcLanguage.length>50))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> srcLanguage"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};return{code:exports.RCRTCCode.SUCCESS}}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E,O,b,y;return p().w(function(r){for(;;)switch(r.n){case 0:if(c=Date.now(),u=e.context,d=e.service,_=e.logger,l=e.reportMediaActionLogger,f=this._getResultTag(),h=this._validateParams(u,_,f),(R=h.code)===exports.RCRTCCode.SUCCESS){r.n=1;break}return r.a(2,{code:R});case 1:if(d.getMsList().length){r.n=2;break}return _.error(f,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),r.a(2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER});case 2:return g=t.getSupportNtf(),r.n=3,u.joinRTCRoom(this.roomId,this.roomType,this.livingType,this.joinType,this.innerUserDatas,this.outerUserDatas,g);case 3:if(m=r.v,C=m.code,v=m.data,l.reportQualityJoinRoomData(c,C,this.roomType,null==v?void 0:v.sessionId),C===ke&&v){r.n=4;break}return T=40032===C?exports.RCRTCCode.SIGNAL_JOIN_RTC_ROOM_REFUSED:C,_.error(f,JSON.stringify({status:Le.FAILED,code:T,msg:"joinRoom failed"}),this.traceId),r.a(2,{code:T});case 4:return t.initWithRoomData(v,this.traceId),this.nickName&&t.setNickName(this.nickName),this.srcLanguage&&t.setSrcLanguage(this.srcLanguage),t.getResourcesByUserId(t.crtUserId).length>0&&n.push(new us),(I=null===(i=v.roomInfo.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===i?void 0:i.value)&&t.setCDNUris(JSON.parse(I)[0]),(S=null===(o=v.roomInfo.filter(function(e){return"asr_status"===e.key})[0])||void 0===o?void 0:o.value)&&t.setASRStatus(S),(E=null===(a=v.roomInfo.filter(function(e){return"sei_ai_uris"===e.key})[0])||void 0===a?void 0:a.value)&&(O=JSON.parse(E)).length&&(t.setASRSeiUris(O),t.addSeiRemoteTrack(O)),(b=null===(s=v.roomInfo.filter(function(e){return"summarization"===e.key})[0])||void 0===s?void 0:s.value)&&(y=JSON.parse(b),t.setSummarizationStatusData(y)),_.info(f,JSON.stringify({status:Le.SUCCESSED,userId:t.crtUserId,roomId:this.roomId,sessionId:v.sessionId}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS,data:v})}},r,this)}))}}])}();!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(ds||(ds={}));var ls,ps,fs,hs="PEER_CONNECTION_CLOSED_BY_EXCEPTION",Rs="USER_JOIN",gs="USER_LEAVE",ms="TRACKS_PUBLISH",Cs="TRACKS_UNPUBLISH",vs="AUDIO_MUTE_CHANGE",Ts="VIDEO_MUTE_CHANGE",Is="CDN_ENABLE_CHANGE",Ss="USER_STATE_CHANGE",Es="ASR_SEI_PUBLISH",Os="ASR_SEI_UNPUBLISH",bs="SUMMARIZATION_START",ys="SUMMARIZATION_STOP",Ls=function(){function e(t,n,o,a,s,c,u,d){var _;return i(this,e),_=r(this,e),Object.defineProperty(_,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(_,"service",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"context",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"runtime",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"peer",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(_,"store",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(_,"polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(_,"reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(_,"getPushOtherRooms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),_}return _(e,F),a(e)}();!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}(ls||(ls={})),function(e){e.BEGIN="begin",e.END="end"}(ps||(ps={})),function(e){e[e.SPREAD=0]="SPREAD",e[e.NO_SPREAD=-1]="NO_SPREAD"}(fs||(fs={}));var ks,As=function(){function e(t,n,o){var a;return i(this,e),a=r(this,e),Object.defineProperty(a,"reqBody",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"isNeedUpdateMsas",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return _(e,is),a(e,[{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l,f;return p().w(function(n){for(;;)switch(n.n){case 0:return i=e.service,o=e.context,n.n=1,i.exchange(t.getRTCRequestHeader(),this.reqBody,this.traceId,this.isNeedUpdateMsas);case 1:return a=n.v,s=a.code,c=a.data,u=a.qualityMsList,d={code:s,data:{data:c,qualityMsList:u}},_=null===(r=null==c?void 0:c.urls)||void 0===r?void 0:r.pull_url,t.roomMode===exports.RTCMode.LIVE&&_&&(l=JSON.parse(_),t.setCDNUris(l),(null==l?void 0:l.broadcast)===fs.SPREAD&&(t.setCDNEnabel(!0),f=Object.assign(Object.assign({},l),{enableInnerCDN:!0}),Ms(o,t.roomId,f))),n.a(2,d)}},n,this)}))}}])}();!function(e){e.PUB="pub",e.UNPUB="unpub",e.SUB="sub",e.UNSUB="unsub"}(ks||(ks={}));var Ns=function(){function e(t,n,o){var a,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ks.SUB,c=arguments.length>4?arguments[4]:void 0;return i(this,e),a=r(this,e),Object.defineProperty(a,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"fromCommand",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(a,"unsubTracks",{enumerable:!0,configurable:!0,writable:!0,value:c}),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,is),a(e,[{key:"kind",get:function(){return $a.UPDATE_SUBSCRIBE_LIST}},{key:"_dealSubscribeResult",value:function(e,t,n,r){var i=null==r?void 0:r.map(function(e){return"".concat(e.msid,"_").concat(e.mediaType)}),o=n.filter(function(e){return null==i?void 0:i.includes(e.track.getTrackId())}),a=n.filter(function(e){return!(null==i?void 0:i.includes(e.track.getTrackId()))});t.info(ye.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.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 n=o.some(function(t){return t.track.getTrackId()===e&&t.subTiny});s[e].isVideoTrack()&&s[e].__innerSetIsTinyTrack(n)};for(var u in s)c(u);return e.resetSubscribedList(o),a}},{key:"_getParams",value:function(e,t,n){var r=this,i=n.map(function(e){return e instanceof In?{track:e}:Object.assign({},e)}),o={};return i=i.filter(function(n){var i=n.track.getTrackId();return e.getRemoteTrack(i)?!o[i]&&(o[i]=!0,!0):(t.warn(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_P,"track cannot found in room -> trackId: ".concat(i),r.traceId),!1)}).map(function(e){return Object.assign({},e)})}},{key:"_validateParams",value:function(e,t){return j("tracks",t,function(){return L(t)&&t.every(function(e){return e instanceof In||e.track instanceof In})},!0)?{code:exports.RCRTCCode.SUCCESS}:(e.warn(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"tracks is invalid"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR})}},{key:"_reportPubOrSubQualityData",value:function(e,t,n){(null==n?void 0:n.length)&&e.reportPubOrSubQualityData(this.fromCommand,this._actionStartTime,n,t,this._trackMediaMap)}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E,O,b,y=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.peer,a=e.reportMediaActionLogger,s=e.context,this._actionStartTime=Date.now(),c=this.tracks,u=this.forceReq,d=t.roomId,i.info(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_T,"roomId: ".concat(d,", forceReq: ").concat(u,", trackIds: ").concat(c.map(Xn)),this.traceId),_=this._validateParams(i,c),(l=_.code)===exports.RCRTCCode.SUCCESS){r.n=1;break}return r.a(2,{code:l});case 1:if(f=this._getParams(t,i,c),h=t.getSubscribedList().map(function(e){return Object.assign({},e)}),u){r.n=3;break}if(Ys(f,h)){r.n=2;break}return i.warn(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.SUCCESSED,msg:"subscribe list unchanged"}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:h.length&&(R=h.map(function(e){return e.track}),i.warn(ye.L_CLEAR_UNSUBSCRIBE_LIST_O,JSON.stringify({list:R.map(function(e){return e.getTrackId()})}),this.traceId),g=t.getSubscribedList().filter(function(e){return R.every(function(t){return t.getTrackId()!==e.track.getTrackId()})}),t.resetSubscribedList(g));case 3:return o.__reportR3R4ToPolaris(),o.clearReTryExchangeTimer(),o.updateSubRemoteTracks(f.map(function(e){return e.track})),r.n=4,Us(f,!1,o,t,s);case 4:return(m=r.v).pushOtherRooms=e.getPushOtherRooms(),r.n=5,new As(m,this.traceId,!0).execute(e,t,n);case 5:if(C=r.v,c.forEach(function(e){var t=e instanceof In?e.getTrackId():e.track.getTrackId();y._trackMediaMap[t]=C.data.qualityMsList||[]}),v=this.fromCommand===ks.SUB?c:this.unsubTracks,C.code===exports.RCRTCCode.SUCCESS){r.n=6;break}return this._reportPubOrSubQualityData(a,C.code,v),i.error(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.FAILED,code:C.code}),this.traceId),r.a(2,{code:C.code});case 6:if(T=C.data.data,I=T.sdp,S=T.resultCode,E=T.subscribedList,S===exports.RCRTCCode.SUCCESS){r.n=7;break}return this._reportPubOrSubQualityData(a,S,v),i.error(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.FAILED,code:S}),this.traceId),r.a(2,{code:S});case 7:return a.setPubOrSubSuccessTime(Date.now()),r.n=8,o.setRemoteAnswer(I.sdp);case 8:if(O=r.v,this._reportPubOrSubQualityData(a,O,v),O===exports.RCRTCCode.SUCCESS){r.n=9;break}return r.a(2,{code:O});case 9:return b=this._dealSubscribeResult(t,i,f,E),r.a(2,b.length?{code:exports.RCRTCCode.SUCCESS,data:b}:{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}(),Ps=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,is),a(e,[{key:"kind",get:function(){return $a.UNSUBSCRIBE}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.polarisReport,a=this.tracks,j("tracks",a,function(){return L(a)&&a.length>0&&a.every(function(e){return e instanceof In})},!0)){r.n=1;break}return i.warn(ye.L_ABSTRACT_ROOM_UNSUBSCRIBE_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return i.info(ye.L_ABSTRACT_ROOM_UNSUBSCRIBE_T,JSON.stringify({unSubscribeTrackIds:a.map(Xn)}),this.traceId),s=t.getSubscribedList().map(function(e){return Object.assign({},e)}).filter(function(e){return a.every(function(t){return t.getTrackId()!==e.track.getTrackId()})}),o.sendR2(ls.SUBSCRIBE,ps.END,a.map(function(e){return e.getTrackId()})),r.a(2,new Ns(s,!1,this.traceId,ks.UNSUB,this.tracks).execute(e,t,n))}},r,this)}))}}])}(),Ds=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),n}return _(e,is),a(e,[{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e.logger,o=this.tracks,a=i.createTraceId(),i.info(ye.L_USER_LEFT_UNSUBSCRIBE_O,void 0,a),r.n=1,new Ps(o,a).execute(e,t,n);case 1:return o.forEach(function(e){e.__innerDestroy(),t.removeRemoteTrack(e.getTrackId())}),e.emit(Cs,o),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}();function Us(e,t,n,r,i){return K(this,void 0,void 0,p().m(function o(){var a,s,c,u,d,_,l;return p().w(function(o){for(;;)switch(o.n){case 0:return s=(null===(a=i.getNaviInfo())||void 0===a?void 0:a.ipType)||0,o.n=1,n.createOffer(t);case 1:return c=o.v,u=r.getSrcLanguage(),d=r.getNickName(),_={resolutionInfo:n.getOutboundVideoInfo()},u&&Object.assign(_,{srcLanguage:u}),d&&Object.assign(_,{nickName:d}),l={asr_status:r.getASRStatus(),ipType:s,sdp:c,extend:JSON.stringify(_),subscribeList:e.filter(function(e){var t=e.track.getTrackId(),n=Dn(t).userId,i=r.getResourcesByUserId(n);if(!i)return!1;var o=i.filter(function(e){return t==="".concat(e.msid,"_").concat(e.mediaType)}).length;return o}).map(function(e){return{simulcast:e.subTiny?Ea.TINY:Ea.NORMAL,resolution:"",uri:r.getPublishedResourceByTrackId(e.track.getTrackId()).uri}}),switchstream:!1},o.a(2,l)}},o)}))}function ws(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e.logger.createTraceId(),e.logger.info(ye.L_LIVING_ROOM_SPREAD_CDN_INFO_T,JSON.stringify({CDNUris:n}),i),r.n=1,e.setRTCCDNUris(t,Kn.TOTAL_CONTENT_RESOURCE,JSON.stringify([n]));case 1:if((o=r.v)===ke){r.n=2;break}return e.logger.error(ye.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(Le.FAILED,", code: ").concat(o),i),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return e.logger.info(ye.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(Le.SUCCESSED),i),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r)}))}function Ms(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e.logger.createTraceId(),e.logger.info(ye.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T,"CDNUris: ".concat(n),i),r.n=1,e.setRTCData(t,"cdn_uris",JSON.stringify([n]),!0,ds.ROOM);case 1:if((o=r.v)===ke){r.n=2;break}return e.logger.error(ye.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(Le.FAILED,", code: ").concat(o),i),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return e.logger.info(ye.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(Le.SUCCESSED),i),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r)}))}function xs(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a;return p().w(function(n){for(;;)switch(n.n){case 0:return r=t.roomId,i=Object.assign({},t.getCDNUris(),{enableInnerCDN:t.getCDNEnable()}),n.n=1,Promise.all([ws(e,r,i),Ms(e,r,i)]);case 1:return o=n.v,a=o.every(function(e){return e.code===exports.RCRTCCode.SUCCESS}),n.a(2,a?{code:exports.RCRTCCode.SUCCESS}:{code:exports.RCRTCCode.SIGNAL_ERROR})}},n)}))}var Bs=function(e,t,n,r){return K(void 0,void 0,void 0,p().m(function i(){var o,a,s,c,u,d;return p().w(function(i){for(;;)switch(i.n){case 0:o=e.crtUserId,u=h(r);case 1:if((d=u()).done){i.n=4;break}if((a=d.value)!==o){i.n=2;break}return i.a(3,1);case 2:if(!(s=r[a]).length){i.n=3;break}return c=s.map(function(t){return e.getRemoteTrack(Pn(t))}),i.n=3,new Ds(c).execute(t,e,n);case 3:i.n=1;break;case 4:return i.a(2)}},i)}))},Vs=function(e,t,n){var r=t.logger;Object.keys(n).forEach(function(i){var o=n[i];if(0!==o.length){var a=o.map(function(t){var n=Pn(t),i=Dn(n),o=i.userId,a=i.tag,s=i.mediaType===exports.RCMediaType.AUDIO_ONLY?new Sn(r,a,o):new En(r,a,o);return e.addRemoteTrack(s),s.__innerSetRemoteMuted(0===t.state),s});a.length&&t.emit(ms,a)}})},js=function(e,t,n){Object.keys(n).forEach(function(r){n[r].forEach(function(n){var r=Pn(n),i=e.getRemoteTrack(r);i.__innerSetRemoteMuted(0===n.state),i.isAudioTrack()?t.emit(vs,i):t.emit(Ts,i)})})};function Fs(e,t,n,r,i,o){return K(this,void 0,void 0,p().m(function a(){var s,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E,O,b;return p().w(function(a){for(;;)switch(a.n){case 0:s=n.logger,c=t.roomId,u=t.roomMode,d=[],_={},l={},f={},h=Qn(e,c,s,o),R=Object.keys(h),g=t.getAllUserIds(),m=R.length-1;case 1:if(!(m>=0)){a.n=4;break}if(C=R[m],-1!==(v=g.indexOf(C))){a.n=2;break}return d.push(C),_[C]=wn(h[C]),a.a(3,3);case 2:T=t.getResourcesByUserId(C),I=h[C],S=Mn(T,I,!0),E=S.publishedList,O=S.modifiedList,b=S.unpublishedList,_[C]=wn(E),l[C]=wn(b),f[C]=wn(O),g.splice(v,1);case 3:m-=1,a.n=1;break;case 4:if(g.length&&g.forEach(function(e){t.removeResourcesByUserId(e)}),t.assignRoomData(h),!g.length){a.n=6;break}return a.n=5,Js(g,n,t,r,o);case 5:n.emit(gs,g);case 6:return d.length&&n.emit(Rs,d),a.n=7,Bs(t,n,r,l);case 7:Vs(t,n,_),js(t,n,f),u===J.LIVE&&Gs(n,t,s,i);case 8:return a.a(2)}},a)}))}function Gs(e,t,n,r){var i;if(r){var o=JSON.parse(r),a=(null===(i=t.getCDNUris())||void 0===i?void 0:i.enableInnerCDN)!==o.enableInnerCDN;t.setCDNUris(o),a&&e.emit(Is,o.enableInnerCDN)}else n.warn(ye.L_LIVING_ROOM_RECONNECTED_R,JSON.stringify({status:Le.FAILED,code:"",msg:"cdn_uris not found"}))}function Js(e,t,n,r,i){return K(this,void 0,void 0,p().m(function o(){var a,s;return p().w(function(o){for(;;)switch(o.n){case 0:if(a=[],s=[],e.forEach(function(e){a.push.apply(a,v(n.getRemoteTracksByUserId(e))),s.push(e)}),!a.length){o.n=2;break}return o.n=1,new Ps(a,i).execute(t,n,r);case 1:a.forEach(function(e){return n.removeRemoteTrack(e.getTrackId())});case 2:s.length&&s.forEach(function(e){return n.removeResourcesByUserId(e)});case 3:return o.a(2)}},o)}))}function Hs(e){var t,n=e.userId,r=e.userData,i=e.event,o=e.switchRoleType;return{users:[{userId:n,extra:null===(t=r.filter(function(e){return"extra"===e.key})[0])||void 0===t?void 0:t.value,state:i,switchRoleType:o}]}}function Ks(e){var t,n,r=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===(n=i.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===n?void 0:n.value;return{userId:r,content:{uris:a?JSON.parse(a):[],cdn_uris:s&&JSON.parse(s)}}}}function qs(e){var t={users:{}},n="";return e.forEach(function(e){var r,i,o=e.userId,a=e.userData;t.users[o]={};var s=null===(r=a.filter(function(e){return"uris"===e.key})[0])||void 0===r?void 0:r.value,c=null===(i=a.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===i?void 0:i.value;n=c||n,t.users[o]={uris:s}}),{urisData:t,CDNUris:n&&JSON.stringify(JSON.parse(n)[0])}}var Ws,zs=function(e,t,n){var r=e.split("\r\nm"),i=n===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.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]:""},Ys=function(e,t){var n=!1;return e.forEach(function(e){var r=t.findIndex(function(t){return t.track.getTrackId()===e.track.getTrackId()});-1!==r?t.splice(r,1)[0].subTiny!==e.subTiny&&(n=!0):n=!0}),t.length&&(n=!0),n},Qs=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,is),a(e,[{key:"kind",get:function(){return $a.PARSE_USERSTATE}},{key:"priority",get:function(){return es.NORMAL}},{key:"_isPKRoomUser",value:function(e,t){var n,r=s(t);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.extra&&i.extra.roomId!==e.roomId)return!0;if(1===Number(i.state)&&!e.getRemoteUserIds().includes(i.userId))return!0}}catch(e){r.e(e)}finally{r.f()}return!1}},{key:"_dealAddUser",value:function(e,t,n,r,i){var o=e.getResourcesByUserId(i);o||(r?n.upgrade.push(i):n.joined.push(i),t.info(ye.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:i,msg:"user ".concat(r?"upgrade":"joined")}),this.traceId)),e.setResourcesByUserId(i,o||[])}},{key:"_dealReduceUser",value:function(e,t,n,r,i){e.info(ye.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:i,msg:"user ".concat(r?"downgrade":"left")}),this.traceId),r?t.downgrade.push(i):1!==Number(n)?t.offline.push(i):t.left.push(i)}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o={joined:[],left:[],offline:[],upgrade:[],downgrade:[]},0!==(a=this.msgContent.users).length){r.n=1;break}return r.a(2,{code:exports.RCRTCCode.SUCCESS,data:o});case 1:if(!this._isPKRoomUser(t,a)){r.n=2;break}return r.a(2,{code:exports.RCRTCCode.SUCCESS,data:o});case 2:if(a.forEach(function(e){var n=e.userId;0===Number(e.state)?c._dealAddUser(t,i,o,e.switchRoleType,n):c._dealReduceUser(i,o,e.state,e.switchRoleType,n)}),!(s=[].concat(v(o.left),v(o.downgrade),v(o.offline))).length){r.n=3;break}return r.n=3,Js(s,e,t,n,this.traceId);case 3:return r.a(2,{code:exports.RCRTCCode.SUCCESS,data:o})}},r,this)}))}}])}(),Zs=function(){function e(t,n,o,a,s){var c;return i(this,e),c=r(this,e),Object.defineProperty(c,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(c,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(c,"senderId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(c,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(c,"sentTime",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(c,"_publishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(c,"_unpublishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(c,"_modifiedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(c,"_nowResources",{enumerable:!0,configurable:!0,writable:!0,value:[]}),c}return _(e,is),a(e,[{key:"kind",get:function(){return $a.PARSE_REMOTERES}},{key:"priority",get:function(){return es.NORMAL}},{key:"_dealPublishList",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.reportMediaActionLogger,a=this._nowResources.map(Pn),s=[],c=[],this._publishedList.forEach(function(e){var n=Pn(e),r=a.indexOf(n),o=Dn(n),u=o.userId,d=o.tag,_=o.mediaType;r>-1?l._nowResources[r]=e:l._nowResources.push(e);var p=t.getRemoteTrack(n);p?p.isSubscribed()&&s.push(p):(p=_===exports.RCMediaType.AUDIO_ONLY?new Sn(i,d,u):new En(i,d,u),t.addRemoteTrack(p),c.push(p)),p.__innerSetRemoteMuted(0===e.state)}),!s.length){r.n=2;break}return u=s.map(function(e){return e.getTrackId()}),r.n=1,new Ns(s,!0,this.traceId).execute(e,t,n);case 1:d=r.v,(_=d.code)!==exports.RCRTCCode.SUCCESS&&i.error(ye.L_RESUB_REPUB_RES_R,JSON.stringify({status:Le.FAILED,trackIds:u,code:_}),this.traceId);case 2:c.length&&e.emit(ms,c),o.reportQualityRecvPubMsgData(this.sentTime,this.senderId);case 3:return r.a(2)}},r,this)}))}},{key:"_dealUnpublishList",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)switch(r.n){case 0:for(i=this._unpublishedList.map(Pn),o=this._nowResources.length-1;o>=0;o-=1)a=this._nowResources[o],i.includes(Pn(a))&&this._nowResources.splice(o,1);return s=this._unpublishedList.map(function(e){var n=Pn(e);return t.getRemoteTrack(n)}),r.n=1,new Ds(s).execute(e,t,n);case 1:return r.a(2)}},r,this)}))}},{key:"_dealModifiedList",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,c,u,d;return p().w(function(n){for(;;)switch(n.n){case 0:r=this._nowResources.map(Pn),i=s(this._modifiedList);try{for(i.s();!(o=i.n()).done;)a=o.value,c=Pn(a),u=r.indexOf(c),this._nowResources[u].state=a.state,(d=t.getRemoteTrack(c)).__innerSetRemoteMuted(0===a.state),d.isAudioTrack()?e.emit(vs,d):e.emit(Ts,d)}catch(e){i.e(e)}finally{i.f()}case 1:return n.a(2)}},n,this)}))}},{key:"_updateCDNUris",value:function(e,t){var n,r,i=this.msgContent.cdn_uris[0],o=(null===(n=t.getCDNUris())||void 0===n?void 0:n.enableInnerCDN)!==i.enableInnerCDN;t.setCDNUris(i),o&&e.emit(Is,!!(null===(r=t.getCDNUris())||void 0===r?void 0:r.enableInnerCDN))}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h;return p().w(function(r){for(;;)switch(r.n){case 0:if(d=this.msgContent.uris,this._publishedList=[],this._unpublishedList=[],this._modifiedList=[],l=this.senderId,f=this.messageType,t.getRemoteUserIds().includes(l)){r.n=1;break}return r.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:this._nowResources=t.getResourcesByUserId(l)||[],h=f,r.n=h===Kn.MODIFY?2:h===Kn.PUBLISH?3:h===Kn.UNPUBLISH?4:h===Kn.TOTAL_CONTENT_RESOURCE?5:6;break;case 2:return(i=this._modifiedList).push.apply(i,v(d)),r.a(3,6);case 3:return(o=this._publishedList).push.apply(o,v(d)),r.a(3,6);case 4:return(a=this._unpublishedList).push.apply(a,v(d)),r.a(3,6);case 5:return _=Mn(this._nowResources,d),(s=this._publishedList).push.apply(s,v(_.publishedList)),(c=this._unpublishedList).push.apply(c,v(_.unpublishedList)),(u=this._modifiedList).push.apply(u,v(_.modifiedList)),r.a(3,6);case 6:if(!this._publishedList.length){r.n=7;break}return r.n=7,this._dealPublishList(e,t,n);case 7:if(!this._unpublishedList.length){r.n=8;break}return r.n=8,this._dealUnpublishList(e,t,n);case 8:if(!this._modifiedList.length){r.n=9;break}return r.n=9,this._dealModifiedList(e,t);case 9:if(t.setResourcesByUserId(l,this._nowResources),t.roomMode===exports.RTCMode.LIVE){r.n=10;break}return r.a(2,{code:exports.RCRTCCode.SUCCESS});case 10:if(this.msgContent.cdn_uris){r.n=11;break}return r.a(2,{code:exports.RCRTCCode.SUCCESS});case 11:return this._updateCDNUris(e,t),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}(),Xs=function(){function e(t,n,o){var a;return i(this,e),a=r(this,e),Object.defineProperty(a,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return _(e,is),a(e,[{key:"kind",get:function(){return $a.SUBSCRIBE}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.polarisReport,a=this.tracks,s=this.forceReq,j("tracks",a,function(){return L(a)&&a.length>0&&a.every(function(e){return e instanceof In||e.track instanceof In})},!0)){r.n=1;break}return i.error(ye.L_ABSTRACT_ROOM_SUBSCRIBE_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(i.info(ye.L_ABSTRACT_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:a.map(Xn),forceReq:s}),this.traceId),c=t.getSubscribedList().map(function(e){return Object.assign({},e)}),u=a.map(function(e){return e instanceof In?{track:e}:e}),d=!1,_=[],u.forEach(function(e){var t=e.track.getTrackId();_.push(t);var n=c.find(function(e){return e.track.getTrackId()===t});n&&n.subTiny===e.subTiny||(n?n.subTiny=e.subTiny:c.push(e),d=!0)}),d||s){r.n=2;break}return i.warn(ye.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,msg:"repeat subscribe"}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return o.sendR2(ls.SUBSCRIBE,ps.BEGIN,_),r.a(2,new Ns(c,!0,this.traceId).execute(e,t,n))}},r,this)}))}}])}(),$s=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(n,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),n}return _(e,is),a(e,[{key:"kind",get:function(){return $a.PUBLISH}},{key:"_removePubFailedTracks",value:function(e,t){e.forEach(function(e){var n=e instanceof _n?e:e.track;t.removeLocalTrackById(n.getTrackId())})}},{key:"_addLocalTracks",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,c,u,d,_,l,f,h,R,g,m,C,v,T;return p().w(function(n){for(;;)switch(n.p=n.n){case 0:r=[],i=s(e),n.p=1,i.s();case 2:if((o=i.n()).done){n.n=9;break}if(a=o.value,u=(c=a instanceof _n?{pubTiny:!1,track:a}:a).track,d=c.pubTiny,!u.isVideoTrack()){n.n=7;break}if(!d){n.n=7;break}return _=void 0,n.p=3,_=u.__innerGetMediaStreamTrack().clone(),l=d.frameRate||exports.RCFrameRate.FPS_15,f=d.resolution||exports.RCResolution.W176_H144,h=Bn(f),R=h.width,g=h.height,m=Fn(l),n.n=4,_.applyConstraints({width:R,height:g,frameRate:m});case 4:n.n=6;break;case 5:return n.p=5,v=n.v,null==_||_.stop(),this._logger.warn(ye.L_ABSTRACT_ROOM_PUBLISH_E,"pubTiny failed -> id: ".concat(u.getTrackId(),", msg: ").concat(v.message),this._traceId),n.a(3,9);case 6:C=new pn(this._logger,u.getTag(),u.getUserId(),_,!0),r.push(C),t.addLocalTrack(C),n.n=7;break;case 7:t.addLocalTrack(u);case 8:n.n=2;break;case 9:n.n=11;break;case 10:n.p=10,T=n.v,i.e(T);case 11:return n.p=11,i.f(),n.f(11);case 12:return n.a(2,r)}},n,this,[[3,5],[1,10,11,12]])}))}},{key:"__publish",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h,R,g,m,C=this;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=e.peer,a=e.reportMediaActionLogger,s=e.context,t.roomId,c=[],n.forEach(function(e){var t=(e instanceof _n?{track:e}:e).track;c.push(t)}),n.sort(function(e,t){return(e instanceof _n?{track:e}:e).track.getBitrate().max-(t instanceof _n?{track:t}:t).track.getBitrate().max}),!(o.getLocalTracks().length+Yn(n,o)>10)){i.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:n.map(Xn),msg:"publish track limit exceeded"}),this._traceId),i.a(2,{code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:c});case 1:return i.n=2,this._addLocalTracks(n,o);case 2:return u=i.v,o.clearReTryExchangeTimer(),d=t.getSubscribedList(),i.n=3,Us(d,!1,o,t,s);case 3:return(_=i.v).pushOtherRooms=e.getPushOtherRooms(),i.n=4,new As(_,this._traceId,!0).execute(e,t,r);case 4:if(l=i.v,c.forEach(function(e){var t=e.getTrackId();C._trackMediaMap[t]=l.data.qualityMsList||[]}),l.code===exports.RCRTCCode.SUCCESS){i.n=5;break}return a.reportPubOrSubQualityData(ks.PUB,this._actionStartTime,c,l.code,this._trackMediaMap),this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,tracks:n.map(Xn),code:l.code,msg:"exchange failed"}),this._traceId),this._removePubFailedTracks(n,o),i.a(2,{code:l.code,tracks:c});case 5:if(f=l.data.data,h=f.sdp,R=f.resultCode,g=f.message,R===exports.RCRTCCode.SUCCESS){i.n=6;break}return a.reportPubOrSubQualityData(ks.PUB,this._actionStartTime,c,R,this._trackMediaMap),this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,trackIds:n.map(Xn),code:R,msg:"exchange inner failed: ".concat(g)}),this._traceId),this._removePubFailedTracks(n,o),i.a(2,{code:R,tracks:c});case 6:return a.setPubOrSubSuccessTime(Date.now()),i.n=7,o.setRemoteAnswer(h.sdp,!0);case 7:if((m=i.v)===exports.RCRTCCode.SUCCESS){i.n=8;break}return a.reportPubOrSubQualityData(ks.PUB,this._actionStartTime,c,m,this._trackMediaMap),this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,trackIds:n.map(Xn),code:m,msg:"set remote answer error"}),this._traceId),i.a(2,{code:m,tracks:c});case 8:return u.length&&this._updateTinyTrackIdSSRCMap(t,_.sdp.sdp,u),i.a(2,Object.assign(Object.assign({code:R},l.data),{tracks:c}))}},i,this)}))}},{key:"_updateTinyTrackIdSSRCMap",value:function(e,t,n){n.forEach(function(n){var r=zs(t,n.getStreamId(),exports.RCMediaType.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(r),n.getTrackId())})}},{key:"_dealPublishRes",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C,T,I,S,E,O,b,y,L,k;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=n.polarisReport,o=n.context,a=n.peer,s=n.reportMediaActionLogger,c=t.crtUserId,u=t.roomId,d="",_=t.getResourcesByUserId(c),l=v(_),f=[],h=e.tracks,e.code===exports.RCRTCCode.SUCCESS){r.n=1;break}return r.a(2,{code:e.code});case 1:return R=e.data,g=R.publishList,m=R.urls,C=R.mcuPublishList,d=null==m?void 0:m.liveUrl,g.map(function(e){return Object.assign({tag:e.msid.split("_").pop(),state:a.getLocalTrack(Pn(e)).isLocalMuted()?0:1},e)}).forEach(function(e){var t=Zn(e,l),n=t.isInclude,r=t.index;n?l.splice(r,1,e):l.push(e)}),T=(null==C?void 0:C.map(function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)}))||[],f=T,I=Mn(_,l),S=I.publishedList,E=Object.assign(Object.assign({},t.getCDNUris()),{enableInnerCDN:t.getCDNEnable()}),O=E&&E.broadcast===fs.SPREAD?JSON.stringify([E]):"",b=Date.now(),r.n=2,o.setRTCTotalRes(u,[bn(Kn.PUBLISH,S)],yn(l),Kn.TOTAL_CONTENT_RESOURCE,yn(f),O);case 2:if(y=r.v,s.reportPubOrSubQualityData(ks.PUB,this._actionStartTime,h,y,this._trackMediaMap,[{dur:Date.now()-b,cod:y}]),y===ke){r.n=3;break}return this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:Le.FAILED,code:y,msg:"send publish streams notification failed"}),this._traceId),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 3:return t.setResourcesByUserId(c,l),L=S.map(function(e){return Pn(e)}),i.sendR2(ls.PUBLISH,ps.BEGIN,L),S.forEach(function(e){a.getLocalTrack("".concat(e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)}),k={code:exports.RCRTCCode.SUCCESS},d&&(k.liveUrl=d),r.a(2,k)}},r,this)}))}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.peer,this._traceId=i.createTraceId(),this._logger=i,this._actionStartTime=Date.now(),a=this.tracks,j("tracks",a,function(){return L(a)&&a.length>0&&a.every(function(e){return e instanceof _n||e.track instanceof _n})},!0)){r.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this._traceId),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._logger.info(ye.L_ABSTRACT_ROOM_PUBLISH_T,JSON.stringify({trackIds:a.map(Xn)})),(a=a.filter(function(e){var t=(e instanceof _n?{track:e}:e).track,n=t.isDestroyed();return n&&u._logger.warn(ye.L_ABSTRACT_ROOM_PUBLISH_E,"track '".concat(t.getTrackId(),"' has beem destroyed"),u._traceId),!n})).length){r.n=2;break}return this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID,msg:"params tracks is empty"}),this._traceId),r.a(2,{code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID});case 2:return o.__reportR3R4ToPolaris(),o.clearReTryExchangeTimer(),r.n=3,this.__publish(e,t,a,n);case 3:return s=r.v,r.n=4,this._dealPublishRes(s,t,e);case 4:return c=r.v,r.a(2,c)}},r,this)}))}}])}(),ec=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(n,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),n}return _(e,is),a(e,[{key:"kind",get:function(){return $a.UNPUBLISH}},{key:"__unpublish",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h,R,g,m,C=this;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=e.peer,a=e.polarisReport,s=e.logger,c=e.reportMediaActionLogger,u=e.context,d=r.map(function(e){return e.getTrackId()}),0!==d.map(t.getPublishedResourceByTrackId.bind(t)).filter(function(e){return!!e}).length){i.n=1;break}return i.a(2,{code:exports.RCRTCCode.SUCCESS,tracks:r});case 1:return d.forEach(function(e){return o.removeLocalTrackById(e)}),a.sendR2(ls.PUBLISH,ps.END,d),o.clearReTryExchangeTimer(),_=t.getSubscribedList(),i.n=2,Us(_,!1,o,t,u);case 2:return l=i.v,(f=e.getPushOtherRooms()).length&&(l.pushOtherRooms=f),i.n=3,new As(l,this._traceId,!0).execute(e,t,n);case 3:if(h=i.v,r.forEach(function(e){var t=e.getTrackId();C._trackMediaMap[t]=h.data.qualityMsList||[]}),h.code===exports.RCRTCCode.SUCCESS){i.n=4;break}return c.reportPubOrSubQualityData(ks.UNPUB,this._actionStartTime,r,h.code,this._trackMediaMap),s.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:Le.FAILED,code:h.code,trackIds:r.map(Xn),msg:"exchange failed"}),this._traceId),i.a(2,{code:h.code,tracks:r});case 4:if(R=h.data.data,g=R.resultCode,m=R.message,g===exports.RCRTCCode.SUCCESS){i.n=5;break}return c.reportPubOrSubQualityData(ks.UNPUB,this._actionStartTime,r,h.data.data.resultCode,this._trackMediaMap),s.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:Le.FAILED,code:g,trackIds:r.map(Xn),msg:"exchange inner failed: ".concat(m)}),this._traceId),i.a(2,{code:g,tracks:r});case 5:return i.a(2,Object.assign(Object.assign({code:h.code},h.data),{tracks:r}))}},i,this)}))}},{key:"_dealUnpublishRes",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C,T,I,S,E,O;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.context,o=e.logger,a=e.peer,s=e.reportMediaActionLogger,c=i.getCurrentId(),u=t.roomId,d=[],_=[],l=n.tracks,f=n.code,h=n.data,f===exports.RCRTCCode.SUCCESS){r.n=1;break}return o.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({code:f,msg:"unpublish failed"}),this._traceId),r.a(2,{code:f});case 1:if(h){r.n=2;break}return o.info(ye.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.SUCCESSED,msg:"unpublish list is empty "})),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return R=h.mcuPublishList,g=l.map(function(e){return e.getTrackId()}),m=g.map(t.getPublishedResourceByTrackId.bind(t)).filter(function(e){return!!e}),d.push.apply(d,v(m)),C=R?R.map(function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)}):[],_=C,T=t.getResourcesByUserId(c),I=T.filter(function(e){return!d.includes(e)}),S=Date.now(),r.n=3,i.setRTCTotalRes(u,[bn(Kn.UNPUBLISH,d)],yn(I),Kn.TOTAL_CONTENT_RESOURCE,yn(_));case 3:if(E=r.v,s.reportPubOrSubQualityData(ks.UNPUB,this._actionStartTime,l,E,this._trackMediaMap,[{dur:Date.now()-S,cod:E}]),E===ke){r.n=4;break}return o.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.FAILED,code:E,msg:"send unpublish notification failed"}),this._traceId),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 4:return o.info(ye.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.SUCCESSED,code:exports.RCRTCCode.SUCCESS,msg:"unpublish success",unPubResourceIds:g}),this._traceId),O=n.data.sdp,r.n=5,a.setRemoteAnswer(O.sdp);case 5:return t.setResourcesByUserId(c,I),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,this._actionStartTime=Date.now(),o=t.crtUserId,a=this.tracks,this._traceId=i.createTraceId(),j("tracks",a,function(){return a.every(function(e){return e.getUserId()===o&&e instanceof _n})},!0)){r.n=1;break}return i.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"})),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return i.info(ye.L_ABSTRACT_ROOM_UNPUBLISH_T,JSON.stringify({trackIds:a.map(Xn)})),r.n=2,this.__unpublish(e,t,n,a);case 2:return s=r.v,r.n=3,this._dealUnpublishRes(e,t,s);case 3:return c=r.v,r.a(2,c)}},r,this)}))}}])}(),tc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),n}return _(e,is),a(e,[{key:"kind",get:function(){return $a.LOCAL_TRACK_MUTE}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,c,u,d,_,l,f,h,g,m,C,v,T;return p().w(function(n){for(;;)switch(n.p=n.n){case 0:r=e.logger,i=e.context,o=this.localTrack,a=o.getTrackId(),c=t.crtUserId,u=t.roomId,d=!o.isLocalMuted(),_=r.createTraceId(),r.info(ye.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T,JSON.stringify({enabled:d,trackId:this.localTrack.getTrackId()}),_),l=[{resourceId:a,enabled:d}],f=t.getResourcesByUserId(c),h=[],g=s(f),n.p=1,C=p().m(function e(){var t,n,r,i;return p().w(function(e){for(;;)switch(e.n){case 0:if(t=m.value,n=Pn(t),r=l.findIndex(function(e){return e.resourceId===n}),!(r>=0)){e.n=1;break}return i=l[r].enabled,t.state=i?1:0,h.push(t),e.a(2,1);case 1:return e.a(2)}},e)}),g.s();case 2:if((m=g.n()).done){n.n=5;break}return n.d(R(C()),3);case 3:if(!n.v){n.n=4;break}return n.a(3,5);case 4:n.n=2;break;case 5:n.n=7;break;case 6:n.p=6,T=n.v,g.e(T);case 7:return n.p=7,g.f(),n.f(7);case 8:return n.n=9,i.setRTCTotalRes(u,[bn(Kn.MODIFY,h)],yn(f),Kn.TOTAL_CONTENT_RESOURCE);case 9:if((v=n.v)===ke){n.n=10;break}return r.error(ye.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:Le.FAILED,code:v,msg:"signal error"}),_),n.a(2,{code:v});case 10:return r.info(ye.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:Le.SUCCESSED}),_),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this,[[1,6,7,8]])}))}}])}(),nc=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,is),a(e,[{key:"kind",get:function(){return $a.RETRY_EXCHANGE}},{key:"priority",get:function(){return es.HIGH}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C,v;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e.logger,o=e.peer,a=e.context,s=i.createTraceId(),i.info(ye.L_RETRY_EXCHANGE_COMMAND_T),c=a.getCurrentId(),u=t.getSubscribedList(),r.n=1,Us(u,!0,o,t,a);case 1:return(d=r.v).pushOtherRooms=e.getPushOtherRooms(),r.n=2,new As(d,s).execute(e,t,n);case 2:if((_=r.v).code===exports.RCRTCCode.SUCCESS){r.n=3;break}return r.a(2,{code:_.code});case 3:if(l=_.data.data,f=l.sdp,(h=l.resultCode)===exports.RCRTCCode.SUCCESS){r.n=4;break}return r.a(2,{code:h});case 4:return o.clearReTryExchangeTimer(),r.n=5,o.setRemoteAnswer(f.sdp);case 5:if((R=r.v)===exports.RCRTCCode.SUCCESS){r.n=6;break}return r.a(2,{code:R});case 6:if(g=_.data.data.publishList||[],m=this._diffPublishListChange(g,t,o,c),C=m.plus,v=m.minus,!C.length&&!v.length){r.n=7;break}return r.n=7,this._spreadPublishListUri(e,c,C,v,s);case 7:return r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"_diffPublishListChange",value:function(e,t,n,r){var i=t.getResourcesByUserId(r),o=JSON.parse(JSON.stringify(i));e.forEach(function(e){var t,r=e.mediaType,i=e.msid,a=o.findIndex(function(e){var t=e.mediaType,n=e.msid;return r===t&&i===n});if(-1===a){var s=Object.assign({tag:i.split("_").pop(),state:(null===(t=n.getLocalTrack(Pn(e)))||void 0===t?void 0:t.isLocalMuted)?0:1},e);o.push(s)}else o[a].uri=e.uri});var a=Mn(i,o,!0),s=a.publishedList,c=a.unpublishedList;return t.setResourcesByUserId(r,o),{plus:s,minus:c}}},{key:"_spreadPublishListUri",value:function(e,t,n,r,i){return K(this,void 0,void 0,p().m(function o(){var a,s,c,u;return p().w(function(o){for(;;)switch(o.n){case 0:return a=e.store,s=e.logger,c=a.getResourcesByUserId(t),s.info(ye.L_RETRY_EXCHANGE_SPREAD_T,JSON.stringify({plus:n,minus:r,allPublishList:c}),i),u=[],r.length&&u.push(bn(Kn.UNPUBLISH,r)),n.length&&u.push(bn(Kn.PUBLISH,n)),o.n=1,e.context.setRTCTotalRes(a.roomId,u,yn(c),Kn.TOTAL_CONTENT_RESOURCE);case 1:o.v===ke?s.info(ye.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(Le.SUCCESSED),i):s.error(ye.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(Le.FAILED),i);case 2:return o.a(2)}},o)}))}}])}();!function(e){e[e.JOIN=0]="JOIN",e[e.LEAVE=1]="LEAVE",e[e.OFFLINE=2]="OFFLINE",e[e.RESOURCECHANGE=3]="RESOURCECHANGE"}(Ws||(Ws={}));var rc,ic,oc=function(){function e(t,n,o,a){var s;return i(this,e),s=r(this,e),Object.defineProperty(s,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_context",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"_targetPullVersion",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return _(e,is),a(e,[{key:"kind",get:function(){return $a.PULL_RTCROOM_STATUS}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E,O,b,y;return p().w(function(r){for(;;)switch(r.p=r.n){case 0:if(i=e.logger,o=t.getRoomStatusVersion(),i.info(ye.L_PULL_ROOM_STATUS_T,JSON.stringify({roomId:this._roomId,localVersion:o}),this._traceId),!(this._targetPullVersion&&this._targetPullVersion<=o)){r.n=1;break}return i.info(ye.L_PULL_ROOM_STATUS_R,JSON.stringify({status:Le.SUCCESSED,msg:"the roomData has been pulled",localVersion:o,targetPullVersion:this._targetPullVersion}),this._traceId),r.a(2,{code:ke});case 1:return r.n=2,this._context.pullRTCRoomStatus(this._roomId,o);case 2:if(a=r.v,c=a.code,u=a.data,c===ke){r.n=3;break}return i.info(ye.L_PULL_ROOM_STATUS_R,JSON.stringify({status:Le.FAILED,code:c}),this._traceId),r.a(2,{code:c});case 3:if(d=u.bFullStatus,_=u.version,l=u.usersData,f=u.roomStatus,i.info(ye.L_PULL_ROOM_STATUS_R,JSON.stringify({bFullStatus:d,version:$n(_),usersData:l,roomStatus:f}),this._traceId),t.setRoomStatusVersion(_),!d){r.n=5;break}return h=qs(l),R=h.urisData,g=h.CDNUris,r.n=4,Fs(R,t,e,n,g,this._traceId);case 4:return r.a(2,{code:c});case 5:m=s(f),r.p=6,m.s();case 7:if((C=m.n()).done){r.n=14;break}if((v=C.value).event!==Ws.RESOURCECHANGE){r.n=11;break}if(T=Ks(v)){r.n=8;break}return r.a(3,13);case 8:if(I=T.content,(S=T.userId)!==t.crtUserId){r.n=9;break}return r.a(3,13);case 9:return r.n=10,new Zs(I,Kn.TOTAL_CONTENT_RESOURCE,S,this._traceId).execute(e,t,n);case 10:r.n=13;break;case 11:return E=Hs(v),r.n=12,new Qs(E,this._traceId).execute(e,t,n);case 12:O=r.v,b=O.data,e.emit(Ss,b);case 13:r.n=7;break;case 14:r.n=16;break;case 15:r.p=15,y=r.v,m.e(y);case 16:return r.p=16,m.f(),r.f(16);case 17:return r.a(2,{code:c})}},r,this,[[6,15,16,17]])}))}}])}(),ac=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:t}),n}return _(e,is),a(e,[{key:"kind",get:function(){return $a.ON_SIGNAL_RECONNECTED}},{key:"priority",get:function(){return es.HIGH}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.peer,a=e.context,s=t.roomId,c=t.roomMode,u=i.createTraceId(),i.info(ye.L_ABSTRACT_ROOM_IM_RECONNECTED_T,void 0,u),"closed"!==o.getRTCPeerConn().connectionState){r.n=1;break}return i.error(ye.L_ABSTRACT_ROOM_IM_RECONNECTED_R,"RTCPeerConnection closed. Please rejoin room to restore services",u),e.emit(hs),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return r.n=2,a.rtcPing(s,c);case 2:if(d=r.v,40001!==d.code){r.n=5;break}return r.n=3,this._joinRoom(e,t,n,u);case 3:if(r.v!==ke){r.n=4;break}return r.n=4,this._restoreMediaServer(e,t,n);case 4:r.n=6;break;case 5:return r.n=6,new oc(s,u,a).execute(e,t,n);case 6:return r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"_joinRoom",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E,O,b;return p().w(function(i){for(;;)switch(i.n){case 0:return u=e.context,d=e.logger,i.n=1,u.joinRTCRoom(t.roomId,t.roomMode,this.livingType);case 1:if(_=i.v,l=_.code,f=_.data,l===ke){i.n=2;break}return d.error(ye.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:Le.FAILED,code:l,msg:"im reconnect joinRTCRoom failed"}),r),i.a(2);case 2:if(f){i.n=3;break}return d.info(ye.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:Le.FAILED,msg:"im reconnect joinRTCRoom, roomData is empty"}),r),i.a(2);case 3:return h=null===(o=f.roomInfo.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===o?void 0:o.value,i.n=4,Fs(f,t,e,n,h,r);case 4:return(R=null===(a=f.roomInfo.filter(function(e){return"asr_status"===e.key})[0])||void 0===a?void 0:a.value)&&t.setASRStatus(R),g=null===(s=f.roomInfo.filter(function(e){return"sei_ai_uris"===e.key})[0])||void 0===s?void 0:s.value,m=t.getASRIsAvailable(),g&&((C=JSON.parse(g)).length?(m||e.emit(Es),t.setASRSeiUris(C),v=C[0],T=v.msid,I=v.mediaType,S="".concat(T,"_").concat(I),!t.getRemoteTrack(S)&&t.addSeiRemoteTrack(C)):(m&&e.emit(Os),t.removeSeiRemoteTrack(),t.setASRSeiUris(C))),(E=null===(c=f.roomInfo.filter(function(e){return"summarization"===e.key})[0])||void 0===c?void 0:c.value)&&(O=JSON.parse(E),(b=t.getSummarizationStatusData())&&b.status!==O.status&&e.emit(O.status===exports.RCRTCOperateSummarizationType.OPEN?bs:ys,O.taskId),t.setSummarizationStatusData(O)),d.info(ye.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:Le.SUCCESSED,roomData:f}),r),i.a(2,l)}},i,this)}))}},{key:"_restoreMediaServer",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.peer.getLocalTracks(),o=Object.values(t.getRemoteTracks()).filter(function(e){return!!e.isSubscribed()}),!i.length){r.n=1;break}return r.n=1,new $s(i).execute(e,t,n);case 1:if(i.length||!o.length){r.n=2;break}return r.n=2,new Xs(o,!0).execute(e,t,n);case 2:return r.a(2)}},r)}))}}])}(),sc=1,cc=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"}(rc||(rc={})),exports.RCKickReason=void 0,(ic=exports.RCKickReason||(exports.RCKickReason={}))[ic.SERVER_KICK=1]="SERVER_KICK",ic[ic.OTHER_KICK=2]="OTHER_KICK",ic[ic.IM_DISCONNECTED=3]="IM_DISCONNECTED",ic[ic.IM_LOGOUT=4]="IM_LOGOUT",ic[ic.OTHER_CLIENT_IM_CONNECTED=5]="OTHER_CLIENT_IM_CONNECTED";var uc,dc,_c,lc,pc=function(){return a(function e(t,n,r,o){var a=this;i(this,e),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:o}),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,n,r){a._baseReportData=Object.assign(a._baseReportData,{snid:r});var i=Object.assign(Object.assign(Object.assign({},a._baseReportData),a._networkReportData),{cod:t,time:e,dur:Date.now()-e,rtp:n});a._logger.__statistics(ye.L_QS_JOIN_ROOM_S,JSON.stringify(i))}}),this._baseReportData={rid:this._roomId,csnid:this._clientSessionId,snid:"",time:Date.now(),uid:this._userId},this._networkReportData={cr:"unknown",net:"unknown"}},[{key:"reportQualityKickedData",value:function(e){var t=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{time:Date.now(),cod:e===exports.RCKickReason.OTHER_KICK?cc:sc});this._logger.__statistics(ye.L_QS_KICKED_S,JSON.stringify(t))}},{key:"reportPubOrSubQualityData",value:function(e,t,n,r,i,o){var a=this;n.forEach(function(n){var s,c,u=n instanceof _n||n instanceof In?n:n.track,d=u.getTrackId(),_=Dn(d).mediaType,l=!1;l=u instanceof _n?!!u.isVideoTrack()&&(null===(c=(s=u).__isTiny)||void 0===c?void 0:c.call(s)):n.subTiny||!1;var p=Object.assign(Object.assign(Object.assign({},a._baseReportData),a._networkReportData),{resid:d,mtp:_,smct:l?Ea.TINY:Ea.NORMAL,stp:"Rongcloud"!==u.getTag()?1:0,cod:r,msas:i?i[d]:[],sigs:o,time:Date.now(),dur:Date.now()-t});switch(e){case"pub":a._logger.__statistics(ye.L_QS_PUBLISH_S,JSON.stringify(p));break;case"unpub":a._logger.__statistics(ye.L_QS_UNPUBLISH_S,JSON.stringify(p));break;case"sub":a._logger.__statistics(ye.L_QS_SUBSCRIBE_S,JSON.stringify(p));break;case"unsub":a._logger.__statistics(ye.L_QS_UNSUBSCRIBE_S,JSON.stringify(p))}})}},{key:"reportQualityRecvPubMsgData",value:function(e,t){var n=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{puid:t,time:Date.now(),dur:Date.now()-e});this._logger.__statistics(ye.L_QS_RECV_PUB_MSG_S,JSON.stringify(n))}},{key:"setPubOrSubSuccessTime",value:function(e){this._pubOrSubSuccessTime=e}},{key:"reportIceFirstConnectData",value:function(e){var t=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{time:this._pubOrSubSuccessTime,dur:Date.now()-this._pubOrSubSuccessTime}),n="pub"===e?ye.L_QS_PUB_ICE_STATUS_S:ye.L_QS_SUB_ICE_STATUS_S;this._logger.__statistics(n,JSON.stringify(t))}},{key:"recordQualityIceStatusData",value:function(e,t,n){var r=this._peerCStatus||{},i=r.status,o=r.time;if(o){var a=e.IP,s=e.port,c=e.networkType,u=e.remoteIP,d=e.remotePort,_=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{dur:n-o,time:n,pices:rc[i],ices:rc[t],rcdts:[{ip:"".concat(u,":").concat(d)}],lcdts:[{ip:"".concat(a,":").concat(s),nttp:c}],cncdts:[]});console.log(ye.L_QS_ICE_STATUS_S,_),this._logger.__statistics(ye.L_QS_ICE_STATUS_S,JSON.stringify(_)),this._peerCStatus={status:t,time:n}}else this._peerCStatus={status:t,time:n}}}])}();!function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE"}(uc||(uc={})),function(e){e[e.MeetingOrAnchor=1]="MeetingOrAnchor",e[e.Audience=2]="Audience"}(dc||(dc={})),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"}(_c||(_c={})),function(e){e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4"}(lc||(lc={}));var fc,hc=function(){return a(function e(t,n,r,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:dc.MeetingOrAnchor;i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_crtRTCRoom",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:a})},[{key:"_send",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)switch(t.n){case 0:if(this._context.getConnectionStatus()===Se.CONNECTED){t.n=1;break}return t.a(2,_c.NOT_REPORT);case 1:return t.n=2,this._context.setRTCState(this._roomId,e);case 2:if(t.v!==ke){t.n=3;break}return t.a(2,_c.REPORT_SUCCESS);case 3:return t.a(2,_c.REPORT_FAIL)}},t,this)}))}},{key:"_getClientID",value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=xn(),this._runtime.localStorage.setItem(e,t)),t}},{key:"_getRealResourceId",value:function(e){var t=e,n=e.indexOf("_tiny");return n>-1&&(t=e.slice(0,n)),t}},{key:"_getPolarisTrackId",value:function(e){var t="",n=e.split("_");if(e.includes("_tiny")){var r=n.pop(),i=parseInt(n.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=n.pop();t=[n.join("_"),o,r,i].join("_")}else{var a=parseInt(n.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",s=n.pop();t=[n.join("_"),s,a].join("_")}return t}},{key:"_getBaseData",value:function(e){return{bitrateSend:(null==e?void 0:e.bitrateSend)||ha,bitrateRecv:(null==e?void 0:e.bitrateRecv)||ha,networkType:(null==e?void 0:e.networkType)||"unknown",rtt:(null==e?void 0:e.rtt)||ha,localAddress:"".concat((null==e?void 0:e.IP)||ha,":").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)||ha,sendBand:(null==e?void 0:e.availableOutgoingBitrate)||ha,packetsLost:(null==e?void 0:e.totalPacketsLost)||ha,deviceId:this._context.getCurrentId()}}},{key:"_getAudioLevel",value:function(e){return e||0===e?e:ha}},{key:"_getBitrate",value:function(e){return e||0===e?e:ha}},{key:"_getPacketsLostRate",value:function(e){return e||0===e?e:ha}},{key:"_getFrameRate",value:function(e){return e||ha}},{key:"_getResolution",value:function(e,t){return e&&t?"".concat(e," * ").concat(t):"".concat(ha)}},{key:"_getJitter",value:function(e){return e||ha}},{key:"_getNackCount",value:function(e){return e||0===e?e:ha}},{key:"_getPliCount",value:function(e){return e||0===e?e:ha}},{key:"_getRTT",value:function(e){return e||ha}},{key:"_getTrackState",value:function(e,t){var n=e?this._crtRTCRoom.getLocalTrack(t):this._crtRTCRoom.getRemoteTrack(t);return(null==n?void 0:n.isLocalMuted())?uc.DISABLE:uc.ENABLE}},{key:"sendR3Data",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s=this;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.iceCandidatePair,r=e.senders,i=this._getBaseData(n),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=r.map(function(e){var t=e.trackId,n=e.audioLevel,r=e.samplingRate,i=e.bitrate,o=e.packetsLostRate,a=e.frameRate,c=e.frameWidth,u=e.frameHeight,d=e.googRenderDelayMs,_=e.jitter,l=e.nackCount,p=e.pliCount,f=e.rtt,h=e.googFirsSent,R=e.encoderImplementation,g=s._getPolarisTrackId(t),m=s._getRealResourceId(t);return{trackId:g,googCodecName:R||String(ha),audioLevel:s._getAudioLevel(n),bitrate:s._getBitrate(i),packetsLostRate:s._getPacketsLostRate(o),frameRate:s._getFrameRate(a),resolution:s._getResolution(c,u),jitter:s._getJitter(_),nackCount:s._getNackCount(l),pliCount:s._getPliCount(p),rtt:s._getRTT(f),googFirsSent:h,samplingRate:r,googRenderDelayMs:d,encoderImplementation:R||String(ha),trackState:s._getTrackState(!0,m)}}),o+=a.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"),t.n=1,this._send("".concat(o,"\r").concat(this._userRole));case 1:if(t.v===_c.REPORT_SUCCESS){t.n=2;break}return t.a(2,_c.REPORT_FAIL);case 2:return t.a(2,_c.REPORT_SUCCESS)}},t,this)}))}},{key:"sendR4Data",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s=this;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.iceCandidatePair,r=e.receivers,i=this._getBaseData(n),o="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"),a=r.filter(function(e){return!!e.trackId}).map(function(e){var t=e.trackId,n=e.audioLevel,r=e.samplingRate,i=e.bitrate,o=e.packetsLostRate,a=e.frameRate,c=e.frameWidth,u=e.frameHeight,d=e.googRenderDelayMs,_=e.jitter,l=e.nackCount,p=e.pliCount,f=e.rtt,h=e.googFirsReceived,R=e.codecImplementationName,g=s._getPolarisTrackId(t),m=s._getRealResourceId(t);return{trackId:g,googCodecName:R||String(ha),audioLevel:s._getAudioLevel(n),bitrate:s._getBitrate(i),packetsLostRate:s._getPacketsLostRate(o),frameRate:s._getFrameRate(a),resolution:s._getResolution(c,u),jitter:s._getJitter(_),nackCount:s._getNackCount(l),pliCount:s._getPliCount(p),rtt:s._getRTT(f),googFirsReceived:h,samplingRate:r,googRenderDelayMs:d,codecImplementationName:R||String(ha),trackState:s._getTrackState(!1,m)}}),o+=a.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"),t.n=1,this._send("".concat(o,"\r").concat(this._userRole));case 1:if(t.v===_c.REPORT_SUCCESS){t.n=2;break}return t.a(2,_c.REPORT_FAIL);case 2:return t.a(2,_c.REPORT_SUCCESS)}},t,this)}))}},{key:"sendR1",value:function(){var e,t=this._context.getCoreVersion(),n=(null===(e=navigator.userAgentData)||void 0===e?void 0:e.platformn)||navigator.platform,r=Gn.browser,i=Gn.version,o=this._getClientID(),a="R1\t".concat("5.36.1-nctest-alpha.1","\t").concat(t,"\t").concat("web","\t").concat(n,"\t").concat(-1,"\t").concat(r,"\t").concat(i,"\t").concat(o,"\t").concat(this._userRole);this._send(a)}},{key:"sendR2",value:function(e,t,n){var r=this._getClientID(),i="R2\t".concat(e,"\t").concat(t,"\t").concat(r,"\r").concat(n.join("\t"),"\r").concat(this._userRole);this._send(i)}}])}(),Rc=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"oldTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"newTrack",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,is),a(e,[{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.peer,o=e.logger,this.oldTrack&&this.newTrack){r.n=1;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack or newTrack is empty"),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(![Cn,mn].every(function(e){return!(R.oldTrack instanceof e)})){r.n=2;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack is not RCCameraVideoTrack or RCMicphoneAudioTrack"),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(![Cn,mn].every(function(e){return!(R.newTrack instanceof e)})){r.n=3;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"newTrack is not RCCameraVideoTrack or RCMicphoneAudioTrack"),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 3:if(a=this.oldTrack.getSettings(),s=this.newTrack.getSettings(),c=this.oldTrack.getTrackId(),u=this.newTrack.getTrackId(),d=this.oldTrack.isAudioTrack()?"audio":"video",_=this.newTrack.isAudioTrack()?"audio":"video",o.info(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_T,JSON.stringify({oldTrackId:c,newTrackId:u,oldSettings:a,newSettings:s})),this.oldTrack.isPublished()){r.n=4;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack is not published"),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(c===u){r.n=5;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack trackId are different, oldTrackId: ".concat(c,", newTrackId: ").concat(u)),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 5:if(d===_){r.n=6;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack are not the same kind, oldTrackKind: ".concat(d,", newTrackKind: ").concat(_)),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 6:if((null==a?void 0:a.deviceId)!==(null==s?void 0:s.deviceId)){r.n=7;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack deviceId are the same, oldDeviceId: ".concat(null==a?void 0:a.deviceId,", newDeviceId: ").concat(null==s?void 0:s.deviceId)),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 7:if(i.addLocalTrack(this.newTrack),l=(null==a?void 0:a.width)!==(null==s?void 0:s.width)||(null==a?void 0:a.height)!==(null==s?void 0:s.height)||(null==a?void 0:a.frameRate)!==(null==s?void 0:s.frameRate),f=i.getLocalTrack("".concat(this.oldTrack.getTrackId(),"_tiny")),l){r.n=8;break}return f&&f.destroy(),this.oldTrack.destroy(!1),this.newTrack.__innerSetPublished(!0),o.info(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"changeMediaDevice success"),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 8:return r.n=9,(new nc).execute(e,t,n);case 9:if((h=r.v).code===exports.RCRTCCode.SUCCESS){r.n=10;break}return i.removeLocalTrack(this.newTrack,!1),i.addLocalTrack(this.oldTrack),this.newTrack.destroy(),o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"negotiation failed, code: ".concat(h.code)),r.a(2,{code:h.code});case 10:return f&&f.destroy(),this.oldTrack.destroy(!1),this.newTrack.__innerSetPublished(!0),o.info(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"changeMediaDevice success"),r.a(2,{code:h.code})}},r,this)}))}}])}();!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=0]="CLOSE"}(fc||(fc={}));var gc,mc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"_type",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return _(e,is),a(e,[{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=e.logger,i=e.context,o=e.service,this._traceId=r.createTraceId(),this._logger=r,this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_T,"type: ".concat(this._type),this._traceId),(null==(a=i.getNaviInfo())?void 0:a.rtcAISwitch)!==fc.CLOSE){n.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if(this._type!==t.getASRStatus()){n.n=2;break}return this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return s=t.roomId,n.n=3,i.setRTCData(s,"asr_status",this._type.toString(),!0,ds.ROOM,{name:Kn.ASR_STATUS,content:JSON.stringify({asr_status:this._type.toString()})});case 3:if((c=n.v)===ke){n.n=4;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:c}),this._traceId),n.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 4:return t.setASRStatus(this._type),n.n=5,o.updateASRStatus(t.getRTCRequestHeader(),{asr_status:this._type},this._traceId);case 5:if(u=n.v,d=u.code,_=u.data,d===exports.RCRTCCode.SUCCESS&&((null==_?void 0:_.resultCode)===exports.RCRTCCode.SUCCESS||42200===(null==_?void 0:_.resultCode))){n.n=6;break}return l=d!==exports.RCRTCCode.SUCCESS?d:null==_?void 0:_.resultCode,this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:l}),this._traceId),n.a(2,{code:l});case 6:return this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}}])}(),Cc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"_enable",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return _(e,is),a(e,[{key:"_updateSubSei",value:function(e,t,n,r){var i="".concat(e[0].msid,"_").concat(e[0].mediaType),o=n.getRemoteTrack(i);return this._enable?new Xs([o]).execute(t,n,r):new Ps([o],this._traceId).execute(t,n,r)}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.context,this._traceId=i.createTraceId(),this._logger=i,this._logger.info(ye.L_ABSTRACT_ROOM_SET_ENABLE_ASR_T,"enable: ".concat(this._enable),this._traceId),t.setASREnable(this._enable),(null==(a=o.getNaviInfo())?void 0:a.rtcAISwitch)!==fc.CLOSE){r.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),r.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if((s=t.getASRSeiUris()).length){r.n=2;break}return this._logger.info(ye.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS,asrSeiUrisLength:0}),this._traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return r.n=3,this._updateSubSei(s,e,t,n);case 3:if(c=r.v,(u=c.code)===exports.RCRTCCode.SUCCESS){r.n=4;break}return this._logger.error(ye.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:u}),this._traceId),r.a(2,{code:u});case 4:return this._logger.info(ye.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}();!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=0]="CLOSE"}(gc||(gc={}));var vc,Tc,Ic,Sc,Ec=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"_status",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"_destLanguage",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o}return _(e,is),a(e,[{key:"_operateWithRetry",value:function(e,t){return K(this,arguments,void 0,function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3e3;return p().m(function o(){var a,s,c,u;return p().w(function(o){for(;;)switch(o.p=o.n){case 0:a=1;case 1:if(!(a<=r)){o.n=8;break}return o.p=2,o.n=3,t.operateRealtimeTranslation(e.getRTCRequestHeader(),{status:n._status},n._traceId);case 3:if(s=o.v,c=s.code,s.data,c!==exports.RCRTCCode.SUCCESS){o.n=4;break}return o.a(2);case 4:console.warn("第 ".concat(a," 次调用失败,code=").concat(c)),o.n=6;break;case 5:o.p=5,u=o.v,console.error("第 ".concat(a," 次调用异常:"),u);case 6:if(!(a<r)){o.n=7;break}return o.n=7,new Promise(function(e){setTimeout(e,i)});case 7:a++,o.n=1;break;case 8:return o.a(2)}},o,null,[[2,5]])})()})}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=e.logger,i=e.service,o=e.context,this._traceId=r.createTraceId(),this._logger=r,this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_T,JSON.stringify({status:this._status,destLanguage:this._destLanguage}),this._traceId),(null==(a=o.getNaviInfo())?void 0:a.rtcAISwitch)!==fc.CLOSE){n.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if(this._status!==gc.OPEN){n.n=3;break}if(this._destLanguage){n.n=2;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.PARAMS_ERROR}),this._traceId),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(t.getASRSeiUris().length){n.n=3;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_START}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_START});case 3:return s={status:this._status},this._destLanguage&&(s.destLanguage=this._destLanguage),n.n=4,i.operateRealtimeTranslation(t.getRTCRequestHeader(),s,this._traceId);case 4:if(c=n.v,u=c.code,d=c.data,this._status!==gc.CLOSE){n.n=5;break}return t.setIsStartRealTranslate(!1),this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),u!==exports.RCRTCCode.SUCCESS&&this._operateWithRetry(t,i),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 5:if(u===exports.RCRTCCode.SUCCESS&&(null==d?void 0:d.resultCode)===exports.RCRTCCode.SUCCESS){n.n=6;break}return _=u!==exports.RCRTCCode.SUCCESS?u:null==d?void 0:d.resultCode,this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:_}),this._traceId),n.a(2,{code:_});case 6:return t.setIsStartRealTranslate(!0),this._destLanguage&&t.setTranslationLang(this._destLanguage),this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}}])}(),Oc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"_type",{enumerable:!0,configurable:!0,writable:!0,value:t}),n}return _(e,is),a(e,[{key:"execute",value:function(e,t){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)if(0===e.n)return t.setASRStatus(this._type),e.a(2,{code:exports.RCRTCCode.SUCCESS})},e,this)}))}}])}(),bc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"_asrSeiUris",{enumerable:!0,configurable:!0,writable:!0,value:t}),n}return _(e,is),a(e,[{key:"_setEnableAsr",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i;return p().w(function(r){for(;;)switch(r.n){case 0:if(!(i=t.getASREnable())){r.n=2;break}return r.n=1,new Cc(this._asrSeiUris.length>0).execute(e,t,n);case 1:t.setASREnable(i);case 2:return r.a(2)}},r,this)}))}},{key:"_onPublish",value:function(e,t,n){e.emit(Es),t.setASRSeiUris(this._asrSeiUris),t.addSeiRemoteTrack(this._asrSeiUris),this._setEnableAsr(e,t,n)}},{key:"_onUnPublish",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){return p().w(function(r){for(;;)switch(r.n){case 0:return e.emit(Os),r.n=1,this._setEnableAsr(e,t,n);case 1:t.removeSeiRemoteTrack(),t.setASRSeiUris(this._asrSeiUris);case 2:return r.a(2)}},r,this)}))}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){return p().w(function(r){for(;;)if(0===r.n)return this._asrSeiUris.length?this._onPublish(e,t,n):this._onUnPublish(e,t,n),r.a(2,{code:exports.RCRTCCode.SUCCESS})},r,this)}))}}])}(),yc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"_isStart",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return _(e,is),a(e,[{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l;return p().w(function(n){for(;;)switch(n.n){case 0:if(o=e.logger,a=e.context,s=e.service,this._traceId=o.createTraceId(),this._logger=o,this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_T,"isStart: ".concat(this._isStart),this._traceId),(null==(c=a.getNaviInfo())?void 0:c.rtcAISwitch)!==fc.CLOSE){n.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if(t.getASRSeiUris().length){n.n=2;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_START}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_START});case 2:if(!((null===(r=t.getSummarizationStatusData())||void 0===r?void 0:r.status)===exports.RCRTCOperateSummarizationType.OPEN&&this._isStart||(null===(i=t.getSummarizationStatusData())||void 0===i?void 0:i.status)===exports.RCRTCOperateSummarizationType.CLOSE&&!this._isStart)){n.n=3;break}return this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:exports.RCRTCCode.SUCCESS,taskId:t.getSummarizationStatusData().taskId}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS,taskId:t.getSummarizationStatusData().taskId});case 3:return u={status:this._isStart?exports.RCRTCOperateSummarizationType.OPEN:exports.RCRTCOperateSummarizationType.CLOSE},n.n=4,s.operateSummarization(t.getRTCRequestHeader(),u,this._traceId);case 4:if(d=n.v,_=d.code,l=d.data,_===exports.RCRTCCode.SUCCESS){n.n=5;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:_}),this._traceId),n.a(2,{code:_});case 5:return t.setSummarizationStatusData({taskId:l.taskId,status:this._isStart?exports.RCRTCOperateSummarizationType.OPEN:exports.RCRTCOperateSummarizationType.CLOSE}),this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:exports.RCRTCCode.SUCCESS,taskId:null==l?void 0:l.taskId}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS,taskId:null==l?void 0:l.taskId})}},n,this)}))}}])}(),Lc=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"_status",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"_taskId",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,is),a(e,[{key:"execute",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){return p().w(function(n){for(;;)if(0===n.n)return t.setSummarizationStatusData({status:this._status,taskId:this._taskId}),e.emit(this._status===exports.RCRTCOperateSummarizationType.OPEN?bs:ys,this._taskId),n.a(2,{code:exports.RCRTCCode.SUCCESS})},n,this)}))}}])}(),kc="evt-leave",Ac=function(){function e(t,n,o,a,s,c,u,d){var _,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:ga(),f=arguments.length>9&&void 0!==arguments[9]&&arguments[9];i(this,e),_=r(this,e),Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_service",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(_,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(_,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:l}),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 h=_._logger=_._context.logger;_._reportMediaActionLogger=new pc(h,_._roomId,_._clientSessionId,_._context.getCurrentId()),_._polarisReport=new hc(_._context,_._runtime,_._roomId,_);var R=_._context.getCurrentId(),g=new cs(h,l,_._context.getAppkey(),o,R,a,u,d),m=_._peerConnection=new Za(t,h,_._reTryExchange.bind(_),R,g,_._polarisReport,!1,f);_._setPeerConnectionListener();var C=_._executeCtx=new Ls(h,_._service,t,n,m,g,_._polarisReport,_._reportMediaActionLogger);return C.getPushOtherRooms=function(){return _._getPushOtherRoomsParams()},_.setCommandEventListener(),_._invoker=new as(C,g),_._store=_._invoker.store,_._audioLevelReport=new ns(_._store,m),m.on(Za.__INNER_AUDIOLEVEL_CHANGE__,_._audioLevelReport.audioLevelReport,_._audioLevelReport),_._pinger=new tr(_._context,_._roomId,a,_._initOptions.pingGap),_._pinger.onFailed=_.__kickoff.bind(_),_._pinger.onPingResult=_._handlePingResult.bind(_),_._context.registerRTCSignalListener(function(e){return K(_,void 0,void 0,p().m(function t(){var n,r,i,o,a;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._context.decodeRtcNotify(e),r=n.time,i=n.type,o=n.roomId,!this._invoker.isDestroyed()){t.n=1;break}return this._logger.info(ye.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:i,time:r,roomId:o})),t.a(2);case 1:2===i&&o===this._roomId&&(a=this._logger.createTraceId(),this._logger.info(ye.L_RTCNTF_PULL_ROOM_STATUS_O,null,a),this._startPullRTCRoomStatus(o,a,r));case 2:return t.a(2)}},t,this)}))}),_}return _(e,F),a(e,[{key:"_setPeerConnectionListener",value:function(){var e=this,t=this._peerConnection;t.on(Za.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(_n.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(_n.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(Za.__INNER_ICE_CONNECTED__,function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")},this),t.on(Za.__INNER_ICE_STATE_CHANGE__,function(t){var n=t.status,r=t.time,i=t.iceCandidatePair;e._reportMediaActionLogger.recordQualityIceStatusData(i,n,r)}),t.on(Za.__INNER_SEI_CONTENT__,this._onReceiveAsrSeiContent,this)}},{key:"setCommandEventListener",value:function(){var e=this._executeCtx;e.on(hs,this._rtcpeerClosed,this),e.on(Rs,this._callAppListener.bind(this,"onUserJoin"),this),e.on(gs,this._callAppListener.bind(this,"onUserLeave"),this),e.on(ms,this._onTrackPublish,this),e.on(Cs,this._onTrackUnpublish,this),e.on(vs,this._onAudioMuteChange,this),e.on(Ts,this._onVideoMuteChange,this),e.on(Is,this._callAppListener.bind(this,"onCDNEnableChange"),this),e.on(Ss,this._dealUserAppListener,this),e.on(Es,this._callAppListener.bind(this,"onReceiveStartASR"),this),e.on(Os,this._callAppListener.bind(this,"onReceiveStopASR"),this),e.on(bs,this._callAppListener.bind(this,"onReceiveStartSummarization"),this),e.on(ys,this._callAppListener.bind(this,"onReceiveStopSummarization"),this)}},{key:"_startPullRTCRoomStatus",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this._invoker.push(new oc(e,t,this._context,n));case 1:return r.a(2)}},r,this)}))}},{key:"__innerInit",value:function(e,t,n,r,i,o,a,s){return K(this,void 0,void 0,p().m(function c(){var u,d,_;return p().w(function(c){for(;;)switch(c.n){case 0:return c.n=1,this._invoker.push(new _s(this._roomId,e,t,n,r,i,o,a,s));case 1:if(u=c.v,d=u.code,_=u.data,d===exports.RCRTCCode.SUCCESS){c.n=2;break}return c.a(2,{code:d});case 2:return this._initWithRoomData(_.offlineKickTime),c.a(2,{code:d,data:_})}},c,this)}))}},{key:"_initWithRoomData",value:function(e){this._pinger.start(1e3*e),this._polarisReport.sendR1()}},{key:"_handlePingResult",value:function(e,t){if(e===exports.RCRTCPingResult.SUCCESS&&(t>this._store.getRoomStatusVersion()&&this._store.getSupportNtf())){var n=this._logger.createTraceId();this._logger.info(ye.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),n),this._startPullRTCRoomStatus(this._roomId,n,t)}this._callAppListener("onPing",e)}},{key:"setBitrate",value:function(e,t,n){this._logger.warn(ye.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),V("max",e,function(e){return y(e)&&e>Math.max(t||1,200)},!0),V("min",t,function(t){return y(t)&&t>=1&&(!y(e)||t<e)},!0),V("start",n,function(n){return y(n)&&n>t&&n<=e}),this._peerConnection.setBitrate(e,t,n)}},{key:"_onTrackReady",value:function(e){var t=e.streams[0].id,n=e.receiver.track,r=[t,"audio"===n.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),i=this._store.getRemoteTrack(r);i?(i.__innerSetMediaStreamTrack(n),this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onTrackReady",trackId:i.getTrackId()})),this._callAppListener("onTrackReady",i)):this._logger.warn(ye.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(n.id))}},{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){this._logger.error(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}},{key:"_onTrackUnpublish",value:function(e){this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map(function(e){return e.getTrackId()})})),this._callAppListener("onTrackUnpublish",e)}},{key:"__parseInnerMessage",value:function(e,t){var n=e.targetId;if(n===this._roomId){this._logger.info(ye.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var r=e.content;switch(e.messageType){case Kn.KICK:this.__kickoff(!0,r);break;case Kn.STATE:this._stateHandle(r,t);break;case Kn.MODIFY:case Kn.PUBLISH:case Kn.UNPUBLISH:case Kn.TOTAL_CONTENT_RESOURCE:this._resourceHandle(r,e.messageType,e.senderUserId,e.sentTime,t);break;case Kn.ASR_STATUS:this._invoker.push(new Oc(r.asr_status));break;case Kn.ASR_SEI:this._invoker.push(new bc(JSON.parse(r.sei_ai_uris||[])));break;case Kn.SUMMARIZATION_STATUS:this._invoker.push(new Lc(r.status,r.taskId));break;case Kn.ROOM_NOTIFY:this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case Kn.USER_NOTIFY:this._logger.warn(ye.L_OLD_DAILY_RECORD_O,"TODO: ".concat(Kn.USER_NOTIFY));break;case Kn.PK_INVITE:case Kn.PK_CANCEL_INVITE:case Kn.PK_INVITE_TIMEOUT:case Kn.PK_INVITE_ANSWER:case Kn.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case Kn.OTHER_ROOM_OFFLINE:break;default:this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,r,e.senderUserId,e.messageUId)}}else this._logger.warn(ye.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:Le.FAILED,message:"roomId is different, msg roomId-> ".concat(n,", this._roomId-> ").concat(this._roomId," ")}),t)}},{key:"__kickoff",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o=this;return p().w(function(n){for(;;)switch(n.n){case 0:if(!this._invoker.isDestroyed()){n.n=1;break}return n.a(2);case 1:this._logger.warn(ye.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(kc),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach(function(e){e.userId===o._context.getCurrentId()&&(i=e.type,r=e.kickExtra,o._reportMediaActionLogger.reportQualityKickedData(i))}),this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onKickOff",byServer:e,kickType:i,kickExtra:r})),this._callAppListener("onKickOff",e,i,r);case 2:return n.a(2)}},n,this)}))}},{key:"_rtcpeerClosed",value:function(){this.emit(kc),this._leaveHandle(!0),this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}},{key:"_onReceiveAsrSeiContent",value:function(e){var t=this;e.forEach(function(e){"destLangCode"in e?t._store.getIsStartRealTranslate()&&t._store.getTranslationLang()===e.destLangCode&&t._callAppListener("onReceiveRealtimeTranslationContent",e):t._callAppListener("onReceiveASRContent",e)})}},{key:"_resourceHandle",value:function(e,t,n,r,i){return K(this,void 0,void 0,p().m(function o(){var a;return p().w(function(o){for(;;)switch(o.n){case 0:if(a=e.uris,!e.ignore&&a){o.n=1;break}return o.a(2);case 1:this._invoker.push(new Zs(e,t,n,i,r));case 2:return o.a(2)}},o,this)}))}},{key:"_onTrackPublish",value:function(e,t,n){this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map(function(e){return e.getTrackId()})})),this._callAppListener("onTrackPublish",e)}},{key:"_stateHandle",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i;return p().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,this._invoker.push(new Qs(e,t));case 1:r=n.v,i=r.data,this._dealUserAppListener(i);case 2:return n.a(2)}},n,this)}))}},{key:"_dealUserAppListener",value:function(e){var t,n,r=this,i=e.left,o=e.joined,a=e.upgrade,s=e.downgrade,c=e.offline,u=v(o),d=v(i);(null===(t=this._appListener)||void 0===t?void 0:t.onSwitchRole)?(null==a||a.forEach(function(e){r._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.ANCHOR})),r._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.ANCHOR)}),null==s||s.forEach(function(e){r._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.AUDIENCE})),r._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.AUDIENCE)})):(u.push.apply(u,v(a)),d.push.apply(d,v(s))),c.length&&((null===(n=this._appListener)||void 0===n?void 0:n.onUserOffline)?(this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onUserOffline",offline:c})),this._callAppListener("onUserOffline",c)):d.push.apply(d,v(c))),u.length>0&&(this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onUserJoin",allJoined:u})),this._callAppListener("onUserJoin",u)),d.length>0&&(this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onUserLeave",allLeft:d})),this._callAppListener("onUserLeave",d))}},{key:"getRoomId",value:function(){return this._roomId}},{key:"getCrtUserId",value:function(){return this._context.getCurrentId()}},{key:"getRemoteUserIds",value:function(){return this._store.getRemoteUserIds()}},{key:"getRemoteTracks",value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach(function(n){t.push.apply(t,v(e.getRemoteTracksByUserId(n)))}),t}},{key:"getRemoteTracksByUserId",value:function(e){return this._store.getRemoteTracksByUserId(e)}},{key:"getSessionId",value:function(){return this._store.getSessionId()}},{key:"sendMessage",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o;return p().w(function(n){for(;;)switch(n.n){case 0:return r=this._logger.createTraceId(),this._logger.info(ye.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:e,content:t}),r),n.n=1,this._context.sendMessage(Ie.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0});case 1:if(i=n.v,(o=i.code)===ke){n.n=2;break}return this._logger.error(ye.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:Le.FAILED,code:o}),r),n.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return this._logger.info(ye.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:Le.SUCCESSED,name:e,content:t}),r),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}},{key:"setRoomAttribute",value:function(e,t,n){return K(this,arguments,void 0,function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return p().m(function o(){var a,s;return p().w(function(o){for(;;)switch(o.n){case 0:return a=r._logger.createTraceId(),r._logger.info(ye.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:r._roomId,key:e,value:t,message:n,isInner:i}),a),o.n=1,r._context.setRTCData(r._roomId,e,t,i,ds.ROOM,n);case 1:if((s=o.v)===ke){o.n=2;break}return r._logger.error(ye.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.FAILED,code:s}),a),o.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return r._logger.info(ye.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.SUCCESSED,roomId:r._roomId,key:e,value:t,message:n,isInner:i}),a),o.a(2,{code:exports.RCRTCCode.SUCCESS})}},o)})()})}},{key:"deleteRoomAttributes",value:function(e,t){return K(this,arguments,void 0,function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return p().m(function i(){var o,a;return p().w(function(i){for(;;)switch(i.n){case 0:return o=n._logger.createTraceId(),n._logger.info(ye.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:n._roomId,keys:e,message:t,isInner:r}),o),i.n=1,n._context.removeRTCData(n._roomId,e,r,ds.ROOM,t);case 1:if((a=i.v)===ke){i.n=2;break}return n._logger.error(ye.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.FAILED,code:a}),o),i.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return n._logger.info(ye.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.SUCCESSED,roomId:n._roomId,keys:e,message:t,isInner:r}),o),i.a(2,{code:exports.RCRTCCode.SUCCESS})}},i)})()})}},{key:"getRoomAttributes",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e._logger.createTraceId(),e._logger.info(ye.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:e._roomId,keys:t,isInner:n}),i),r.n=1,e._context.getRTCData(e._roomId,t,n,ds.ROOM);case 1:if(o=r.v,a=o.code,s=o.data,a===ke){r.n=2;break}return e._logger.error(ye.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(a),i),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return e._logger.info(ye.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.SUCCESSED,data:s}),i),r.a(2,{code:exports.RCRTCCode.SUCCESS,data:s})}},r)})()})}},{key:"_setUserAttributeValue",value:function(e,t,n){return this._context.setRTCData(this._roomId,e,t,!1,ds.PERSON,n)}},{key:"_deleteUserAttributes",value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,ds.PERSON,t)}},{key:"_getUserAttributes",value:function(e){return this._context.getRTCData(this._roomId,e,!1,ds.PERSON)}},{key:"isDestroyed",value:function(){return this._invoker.isDestroyed()}},{key:"__destroy",value:function(e){return this._leaveHandle(e)}},{key:"_muteRemoteTracksBeforeQuit",value:function(){var e=Object.values(this._store.getRemoteTracks());e.length&&e.forEach(function(e){return e.mute()})}},{key:"_leaveHandle",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)switch(t.n){case 0:if(!this._invoker.isDestroyed()){t.n=1;break}return t.a(2);case 1:if(this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),!e){t.n=2;break}return t.n=2,this._context.quitRTCRoom(this._roomId);case 2:if(!this._store.isMainRoom){t.n=3;break}return t.n=3,this._quitAllPKRoom();case 3:return this._pinger.stop(),t.n=4,this._service.exit(this._store.getRTCRequestHeader());case 4:this._releasePCManager();case 5:return t.a(2)}},t,this)}))}},{key:"_releasePCManager",value:function(){var e=this._peerConnection;e.removeAllLocalTrack(),e.destroy()}},{key:"_onLocalTrackDestroied",value:function(e){e instanceof pn&&e.__isTiny()||this.unpublish([e])}},{key:"_onLocalTrackMuted",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i;return p().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,this._invoker.push(new tc(e));case 1:r=n.v,i=r.code,t(i);case 2:return n.a(2)}},n,this)}))}},{key:"publish",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new $s(e)))},t,this)}))}},{key:"_getPushOtherRoomsParams",value:function(){return[]}},{key:"_reTryExchange",value:function(){return this._invoker.push(new nc)}},{key:"unpublish",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new ec(e)))},t,this)}))}},{key:"_isValidResourceId",value:function(e){var t,n=Dn(e).userId;return!!(null===(t=this._store.getResourcesByUserId(n))||void 0===t?void 0:t.find(function(t){return Pn(t)===e}))}},{key:"subscribe",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new Xs(e,void 0,void 0)))},t,this)}))}},{key:"unsubscribe",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)if(0===t.n)return n=this._logger.createTraceId(),this._logger.info(ye.L_APP_CALL_UNSUBSCRIBE_O,void 0,n),t.a(2,this._invoker.push(new Ps(e,n)))},t,this)}))}},{key:"updateSubList",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new Ns(e,!0,this._logger.createTraceId())))},t,this)}))}},{key:"getLocalTrack",value:function(e){return this._peerConnection.getLocalTrack(e)}},{key:"getLocalTracks",value:function(){return this._peerConnection.getLocalTracks()}},{key:"getRemoteTrack",value:function(e){return this._store.getRemoteTrack(e)||null}},{key:"subscribedTracks",get:function(){return this._store.getSubscribedList().slice()}},{key:"registerRoomEventListener",value:function(e){this._logger.info(ye.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,e?Object.keys(e).join(","):null),this._appListener=e,this.asrIsAvailable()&&this._executeCtx.emit(Es);var t=this.getSummarizationStatusData();t&&(null==t?void 0:t.status)===exports.RCRTCOperateSummarizationType.OPEN&&this._executeCtx.emit(bs,t.taskId)}},{key:"registerReportListener",value:function(e){this._logger.info(ye.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,e?Object.keys(e).join(","):null),this._peerConnection.registerReportListener(e)}},{key:"onAudioLevelChange",value:function(e,t){this._logger.info(ye.L_ABSTRACT_ROOM_AUDIO_LEVEL_O),this._audioLevelReport.onAudioLevelChange(e)}},{key:"__onReconnected",value:function(e){this._invoker.push(new ac(e))}},{key:"_onAudioMuteChange",value:function(e){this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}},{key:"_onVideoMuteChange",value:function(e){this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}},{key:"_registerPKMsgListener",value:function(e){this._onRecvPKMsg=e}},{key:"_quitAllPKRoom",value:function(){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)if(0===e.n)return e.a(2)},e)}))}},{key:"getClientSessionId",value:function(){return this._store.clientSessionId}},{key:"changeMediaDevice",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){return p().w(function(n){for(;;)if(0===n.n)return n.a(2,this._invoker.push(new Rc(e,t)))},n,this)}))}},{key:"startASR",value:function(){return this._invoker.push(new mc(rs.OPEN))}},{key:"stopASR",value:function(){return this._invoker.push(new mc(rs.CLOSE))}},{key:"asrIsAvailable",value:function(){return this._store.getASRIsAvailable()}},{key:"setEnableASR",value:function(e){return this._invoker.push(new Cc(e))}},{key:"startRealtimeTranslation",value:function(e){return this._invoker.push(new Ec(gc.OPEN,e))}},{key:"stopRealtimeTranslation",value:function(){return this._invoker.push(new Ec(gc.CLOSE))}},{key:"startSummarization",value:function(){return this._invoker.push(new yc(!0))}},{key:"stopSummarization",value:function(){return this._invoker.push(new yc(!1))}},{key:"getSummarizationStatusData",value:function(){return this._store.getSummarizationStatusData()}}])}(),Nc=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"data",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,is),a(e,[{key:"kind",get:function(){return $a.MCUCONFIG_FLUSH}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l,f;return p().w(function(n){for(;;)switch(n.n){case 0:return s=e.context,c=e.service,u={"App-Key":s.getAppkey(),Token:t.getToken(),RoomId:t.roomId,UserId:s.getCurrentId(),SessionId:t.getSessionId()},n.n=1,c.setMcuConfig(u,this.data);case 1:if(d=n.v,_=d.code,l=d.res,_===exports.RCRTCCode.SUCCESS){n.n=2;break}return n.a(2,{code:_});case 2:return l.pull_url&&t.setCDNUris(JSON.parse(l.pull_url)),f=this.cdnValues,_===exports.RCRTCCode.SUCCESS&&((null===(i=null===(r=f.output)||void 0===r?void 0:r.video.normal)||void 0===i?void 0:i.width)||(null===(a=null===(o=f.output)||void 0===o?void 0:o.video.normal)||void 0===a?void 0:a.fps))&&xs(s,t),n.a(2,{code:_,data:l})}},n,this)}))}}])}();exports.BackgroundPictureFillMode=void 0,(vc=exports.BackgroundPictureFillMode||(exports.BackgroundPictureFillMode={}))[vc.CROP=1]="CROP",vc[vc.WHOLE=2]="WHOLE",exports.MixLayoutMode=void 0,(Tc=exports.MixLayoutMode||(exports.MixLayoutMode={}))[Tc.CUSTOMIZE=1]="CUSTOMIZE",Tc[Tc.SUSPENSION=2]="SUSPENSION",Tc[Tc.ADAPTATION=3]="ADAPTATION",exports.MixVideoRenderMode=void 0,(Ic=exports.MixVideoRenderMode||(exports.MixVideoRenderMode={}))[Ic.CROP=1]="CROP",Ic[Ic.WHOLE=2]="WHOLE",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"}(Sc||(Sc={}));var Pc,Dc=function(){return{version:2,mode:exports.MixLayoutMode.SUSPENSION}},Uc=function(){return a(function e(t,n,r){i(this,e),Object.defineProperty(this,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_isValidTrackId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_values",{enumerable:!0,configurable:!0,writable:!0,value:Dc()}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._executeCtx.logger},[{key:"setHostVideoTrack",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,msg:"videoTrackId: ".concat(e," is invalid")})),this;var t=Dn(e),n=t.mediaType,r=t.tag,i=t.userId;return n!==exports.RCMediaType.VIDEO_ONLY?(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,msg:"kind of ".concat(e," is not video")})),this):(this._values.host_stream_id=Un(i,r),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,videoTrackId:e})),this)}},{key:"setMixLayoutMode",value:function(e){return[exports.MixLayoutMode.CUSTOMIZE,exports.MixLayoutMode.SUSPENSION,exports.MixLayoutMode.ADAPTATION].includes(e)?(this._values.mode=e,this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:Le.SUCCESSED,mode:e})),this):(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:Le.SUCCESSED,msg:"mode: ".concat(e," is invalid")})),this)}},{key:"_addOutputValue",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal",r=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if("cdn"!==e)if("audio"!==e){var i=r.video;if("normal"!==n&&"tiny"!==n)if("backgroundColor"!==n)if("exparams"!==n){if("backgroundPicture"===n){var o=i.backgroundPicture||(i.backgroundPicture={fillMode:exports.BackgroundPictureFillMode.CROP,picture:[]});Object.assign(o,t)}}else i.exparams={renderMode:t};else i.backgroundColor=t;else{var a=i[n]||(i[n]={});Object.assign(a,t)}}else r.audio={bitrate:t};else r.cdn=t}},{key:"setOutputVideoResolution",value:function(e){if(!Vn(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=Bn(e),n=t.width,r=t.height;return this._addOutputValue("video",{width:n,height:r},"normal"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.SUCCESSED,resolution:e})),this}},{key:"setOutputVideoFPS",value:function(e){if(!jn(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:Le.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=Fn(e);return this._addOutputValue("video",{fps:t},"normal"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:Le.SUCCESSED,fps:e})),this}},{key:"setOutputVideoBitrate",value:function(e){return!y(e)||e<=0?(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> bitrate: ".concat(e)})),this):(this._addOutputValue("video",{bitrate:e},"normal"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,bitrate:e})),this)}},{key:"setOutputTinyVideoResolution",value:function(e){if(!Vn(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=Bn(e),n=t.width,r=t.height;return this._addOutputValue("video",{width:n,height:r},"tiny"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.SUCCESSED,resolution:e})),this}},{key:"setOutputTinyVideoFPS",value:function(e){if(!jn(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:Le.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=Fn(e);return this._addOutputValue("video",{fps:t},"tiny"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:Le.SUCCESSED,fps:e})),this}},{key:"setOutputTinyVideoBitrate",value:function(e){return!y(e)||e<=0?(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> bitrate: ".concat(e)})),this):(this._addOutputValue("video",{bitrate:e},"tiny"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,bitrate:e})),this)}},{key:"setOutputVideoRenderMode",value:function(e){return[exports.MixVideoRenderMode.CROP,exports.MixVideoRenderMode.WHOLE].includes(e)?(this._addOutputValue("video",e,"exparams"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:Le.SUCCESSED,renderMode:e})),this):(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> renderMode: ".concat(e)})),this)}},{key:"setOutputAudioBitrate",value:function(e){return y(e)&&e>0?(this._addOutputValue("audio",e),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,bitrate:e})),this):(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> bitrate: ".concat(e)})),this)}},{key:"setOutputBackgroundColor",value:function(e){return/^0x[a-fA-F0-9]{6}$/.test(e)?(this._addOutputValue("video",e,"backgroundColor"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:Le.SUCCESSED,color:e})),this):(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:Le.FAILED,msg:"params error -> color: ".concat(e)})),this)}},{key:"addOutputBackgroundPicture",value:function(e,t,n,r,i){var o,a,s;if(!D(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> uri: ".concat(e)})),this;if([t,n,r,i].some(function(e){return!y(e)||e<0||e>1}))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.FAILED,msg:"params of (x, y, w, h) error -> x: ".concat(t,", y: ").concat(n,", w: ").concat(r,", h: ").concat(i)})),this;var c=(null===(s=null===(a=null===(o=this._values.output)||void 0===o?void 0:o.video)||void 0===a?void 0:a.backgroundPicture)||void 0===s?void 0:s.picture)||[];return c.push({uri:e,w:r,h:i,x:t,y:n}),this._addOutputValue("video",{picture:c},"backgroundPicture"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.SUCCESSED,uri:e,x:t,y:n,w:r,h:i})),this}},{key:"removeOutputBackgroundPicture",value:function(e){var t,n,r;if(!D(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> uri: ".concat(e)})),this;var i=null===(r=null===(n=null===(t=this._values.output)||void 0===t?void 0:t.video)||void 0===n?void 0:n.backgroundPicture)||void 0===r?void 0:r.picture;return i&&(i=i.filter(function(t){return t.uri!==e}),this._addOutputValue("video",{pictures:i},"backgroundPicture")),this._logger.info(ye.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.SUCCESSED,uri:e})),this}},{key:"clearOutputBackgroundPicture",value:function(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}},{key:"setOutputBackgroundPictureFillMode",value:function(e){return[exports.BackgroundPictureFillMode.CROP,exports.BackgroundPictureFillMode.WHOLE].includes(e)?(this._addOutputValue("video",{fillMode:e},"backgroundPicture"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.SUCCESSED,fillMode:e})),this):(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> fillMode: ".concat(e)})),this)}},{key:"addPublishStreamUrls",value:function(e){var t,n,r=/^rtmp:\/\/.+/;if(!L(e)||0===e.length||e.some(function(e){return!r.test(e)}))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> urls: ".concat(e.join(","))})),this;var i=(null===(n=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===n?void 0:n.concat())||[],o=!1;return e.forEach(function(e){i.some(function(t){return t.pushurl===e})||(o=!0,i.push({pushurl:e}))}),i.length>5?(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> publish stream urls no more than 5, length: ".concat(e.length)})),this):(o&&this._addOutputValue("cdn",i),this._logger.info(ye.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O,JSON.stringify({status:Le.SUCCESSED,urls:e})),this)}},{key:"removePublishStreamUrls",value:function(e){var t,n,r=/^rtmp:\/\/.+/;if(!L(e)||0===e.length||e.some(function(e){return!r.test(e)}))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:Le.FAILED,msg:"params error -> urls: ".concat(e.join(","))})),this;for(var i=(null===(n=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===n?void 0:n.concat())||[],o=i.length-1;o>=0;o-=1){var a=i[o].pushurl,s=e.indexOf(a);s>=0&&(e.splice(s,1),i.splice(o,1))}return this._addOutputValue("cdn",i),this._logger.info(ye.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:Le.SUCCESSED,urls:e})),this}},{key:"clearPublishStreamUrls",value:function(){return this._addOutputValue("cdn",[]),this._logger.info(ye.L_MCU_CONFIG_BUILDER_CLEAR_PUBLISH_STREAM_URLS_O),this}},{key:"addCustomizeLayoutVideo",value:function(e,t,n,r,i){if(!k(e)||!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;if(!y(t)||!y(n))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params x or y is error -> x: ".concat(t,", y: ").concat(n)})),this;if([r,i].some(function(e){return!y(e)||e<0}))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params width or height error -> width: ".concat(r,", height: ").concat(i)})),this;var o=Dn(e),a=o.userId,s=o.tag;if(o.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"type of trackId: ".concat(e," is not video")})),this;var c=Un(a,s),u=this._values.input||(this._values.input={}),d=u.video||(u.video=[]);return d.some(function(e){return e.height===i&&e.width===r&&e.stream_id===c&&e.user_id===a&&e.x===t&&e.y===n})?(this._logger.warn(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"Duplicate configuration item place ignored"})),this):(d.push({user_id:a,stream_id:c,x:t,y:n,width:r,height:i}),this._logger.info(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e,x:t,y:n,width:r,height:i})),this)}},{key:"removeCustomizeLayoutVideo",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=Dn(e),n=t.userId,r=t.tag;if(t.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"type of trackId: ".concat(e," is not video")})),this;var i=Un(n,r),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(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this}},{key:"clearCustomizeLayoutVideo",value:function(){var e=this._values.input;return null==e||delete e.video,this._logger.info(ye.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_LAYOUT_VIDEO_O),this}},{key:"setCustomizeInputAudio",value:function(e){var t=this;return e.some(function(e){return t._isValidTrackId(e)})?(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"trackIds contain invalid item -> trackIds: ".concat(e.join(","))})),this):((this._values.input||(this._values.input={})).audio=e.map(function(e){var t=Dn(e),n=t.userId,r=t.tag;return{stream_id:Un(n,r),user_id:n}}),this._values.inputFilterMode=Sc.AUDIO_INPUT_VIDEO_ALL,this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.SUCCESSED,trackIds:e})),this)}},{key:"addCustomizeInputAudio",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input||(this._values.input={}),n=t.audio||(t.audio=[]),r=Dn(e),i=r.userId,o=r.tag,a=Un(i,o);return n.some(function(e){return e.stream_id===a&&e.user_id===i})?(this._logger.warn(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"trackId: ".concat(e," is exist")})),this):(n.push({user_id:i,stream_id:a}),this._values.inputFilterMode=Sc.AUDIO_INPUT_VIDEO_ALL,this._logger.info(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this)}},{key:"removeCustomizeInputAudio",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.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(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"type of trackId: ".concat(e," is not audio")})),this;var n=Dn(e),r=n.userId,i=n.tag,o=Un(r,i);return t.audio=t.audio.filter(function(e){return r!==e.user_id||o!==e.stream_id}),this._logger.info(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this}},{key:"clearCustomizeInputAudio",value:function(){var e=this._values.input;return(null==e?void 0:e.audio)&&delete e.audio,this._values.inputFilterMode=Sc.AUDIO_VIDEO_ALL,this._logger.info(ye.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_INPUT_AUDIO_O),this}},{key:"addPictureWaterMark",value:function(e,t,n,r,i,o){if(!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;if(!D(t))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"params error -> uri: ".concat(t)})),this;if([n,r,i,o].some(function(e){return!y(e)||e<0||e>1})||n+i>1||r+o>1)return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"some attrs of (x, y, w, h) is invalid -> x: ".concat(n,", y: ").concat(r,", w: ").concat(i,", h: ").concat(o)})),this;var a=Dn(e),s=a.userId,c=a.tag,u=Un(s,c),d=(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen,_=d.filter(function(e){return e.streamId===u})[0];return _?_.picture.push({uri:t,w:i,h:o,x:n,y:r}):d.push({streamId:u,picture:[{uri:t,w:i,h:o,x:n,y:r}]}),this._values.waterMark.singleScreen=d,this._logger.info(ye.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.SUCCESSED,trackId:e,uri:t,x:n,y:r,w:i,h:o,singleScreen:d})),this}},{key:"clearPictureWaterMark",value:function(){return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen=[],this._logger.info(ye.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}},{key:"removePictureWaterMark",value:function(e,t){if(!k(e)||!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var n=Dn(e),r=n.userId,i=n.tag,o=Un(r,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(ye.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.SUCCESSED,trackId:e,uri:t})),this}},{key:"reset",value:function(){return this._values=Dc(),this._logger.info(ye.L_MCU_CONFIG_BUILDER_RESET_O),this}},{key:"flush",value:function(){return K(this,arguments,void 0,function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return p().m(function n(){var r,i,o;return p().w(function(n){for(;;)switch(n.n){case 0:return r=JSON.parse(JSON.stringify(e._values)),n.n=1,e._invoker.push(new Nc(r,e._values));case 1:return i=n.v,o=i.code,t&&(e._values=Dc()),n.a(2,{code:o})}},n)})()})}},{key:"__innerGetValues",value:function(){return JSON.parse(JSON.stringify(this._values))}}])}();exports.RCLivingType=void 0,(Pc=exports.RCLivingType||(exports.RCLivingType={}))[Pc.VIDEO=0]="VIDEO",Pc[Pc.AUDIO=1]="AUDIO";var wc,Mc=function(){function e(t,n,o){var a;return i(this,e),a=r(this,e),Object.defineProperty(a,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return _(e,is),a(e,[{key:"_exchangeWithPushOtherRoom",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.peer,a=e.context,o.getLocalTracks().length){r.n=1;break}return i.info(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.SUCCESSED,msg:"have not published resource"}),this.traceId),r.a(2);case 1:return s=o,c=t.getSubscribedList(),r.n=2,Us(c,!1,s,t,a);case 2:return u=r.v,d=e.getPushOtherRooms(),u.pushOtherRooms=d,r.n=3,new As(u,this.traceId,!0).execute(e,t,n);case 3:if((_=r.v).code===exports.RCRTCCode.SUCCESS){r.n=4;break}return i.error(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,code:_.code,pushOtherRooms:d}),this.traceId),r.a(2);case 4:if(l=_.data.data,f=l.sdp,(h=l.resultCode)===exports.RCRTCCode.SUCCESS){r.n=5;break}return i.error(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,code:h,pushOtherRooms:d}),this.traceId),r.a(2);case 5:i.info(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.SUCCESSED,pushOtherRooms:d}),this.traceId),s.setRemoteAnswer(f.sdp);case 6:return r.a(2)}},r,this)}))}},{key:"kind",get:function(){return $a.EXCHANGE_WITH_PUSH_OTHER_ROOM}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=this.roomId,i.info(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_T,o),this.roomPKHandler){r.n=1;break}return i.error(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,msg:"_roomPKHandler not exist"}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:if(this.roomPKHandler.getPKInfo(o)){r.n=2;break}return i.warn(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,msg:"PKInfo not exist"}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return r.n=3,this._exchangeWithPushOtherRoom(e,t,n);case 3:return r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}(),xc=function(){function e(t,n,o,a,s,c){var u;return i(this,e),u=r(this,e),Object.defineProperty(u,"pkHandler",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"room",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"isQuitPK",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:c}),u}return _(e,is),a(e,[{key:"kind",get:function(){return $a.LEAVE_OTHER_ROOM}},{key:"quitRoomPK",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=e.logger,a=e.context,o.info(ye.L_QUIT_PK_T,"roomId: ".concat(t),r),this._PKInfo[t]){i.n=1;break}return o.warn(ye.L_QUIT_PK_R,"status: ".concat(Le.FAILED,", msg: pkinfo is empty"),r),i.a(2);case 1:return s=this._PKInfo[t],c=s.inviterRoomId,u=s.inviteeRoomId,d=s.inviterUserId,_=s.inviteSessionId,l={inviteeRoomId:u,inviterRoomId:c,userId:n.crtUserId},f={roomId:n.roomId,endRoomId:t,sessionId:_,content:JSON.stringify(l),keys:["".concat(c,"|").concat(d)]},i.n=2,a.endRoomPK(f);case 2:if((h=i.v)===ke){i.n=3;break}return o.error(ye.L_QUIT_PK_R,"status: ".concat(Le.FAILED,", code: ").concat(h),r),i.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 3:o.info(ye.L_QUIT_PK_R,"status: ".concat(Le.SUCCESSED),r),delete this._PKInfo[t];case 4:return i.a(2)}},i,this)}))}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e.logger,o=this.room,a=this.isQuitPK,s=o.getRoomId(),i.info(ye.L_LIVING_ROOM_LEAVE_PK_ROOM_T,JSON.stringify({roomId:s,isQuitPK:a}),this.traceId),r.n=1,o.__destroy(!0);case 1:return delete this._joinedPKRooms[s],r.n=2,new Mc(s,this.pkHandler,this.traceId).execute(e,t,n);case 2:return a&&this.quitRoomPK(e,s,t,this.traceId),i.info(ye.L_LIVING_ROOM_LEAVE_PK_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}(),Bc=function(){return a(function e(t,n,r,o,a,s,c,u,d,_){i(this,e),Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_mainLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"_registerPKMsgListener",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_onJoinedPKRoom",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:_}),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()},[{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){this._logger.error(ye.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify(e))}}},{key:"_onInvite",value:function(e){var t=e.inviteInfo||{},n=t.inviterRoomId,r={inviterRoomId:n,inviterUserId:t.inviterUserId,extra:t.extra};this._PKInfo[n]=t,this._logger.info(ye.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onRequestJoinOtherRoom",info:r})),this._callAppListener("onRequestJoinOtherRoom",r)}},{key:"_onCancelInvite",value:function(e){var t=e.inviteInfo||{},n=t.inviterRoomId,r={inviterRoomId:n,inviterUserId:t.inviterUserId,extra:t.extra};delete this._PKInfo[n],this._logger.info(ye.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCancelRequestOtherRoom",cancelInfo:r})),this._callAppListener("onCancelRequestOtherRoom",r)}},{key:"_onInviteTimeout",value:function(e){}},{key:"_onInviteAnswer",value:function(e){var t=e.answerCode,n=e.inviteContent,r=n.inviteSessionId,i=n.inviterUserId,o=n.inviterRoomId,a=n.inviteeUserId,s=n.inviterUserAutoMix,c=n.inviteeUserAutoMix,u=n.inviteeRoomId,d={agree:1===t,inviterRoomId:o,inviterUserId:i,inviteeRoomId:u,inviteeUserId:a,extra:n.extra};this._PKInfo[u]=this._PKInfo[u]||{inviteSessionId:r,inviterRoomId:o,inviterUserId:i,inviterUserAutoMix:s,inviteeRoomId:u},this._PKInfo[u].inviteeUserAutoMix=c,this._logger.info(ye.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onResponseJoinOtherRoom",answerInfo:d})),this._callAppListener("onResponseJoinOtherRoom",d)}},{key:"createLeaveOtherRoomCommand",value:function(e,t,n){return new xc(this,e,this._PKInfo,this._joinedPKRooms,t,n)}},{key:"_onPKEnd",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=e.inviteInfo,r=n.inviteeRoomId,i=n.inviterRoomId,o=n.userId,a=i===this._mainRoomId?r:i,s={endRoomId:a,endUserId:o},c=this._joinedPKRooms[a],u=this._logger.createTraceId(),this._logger.info(ye.L_QUIT_PK_LEAVE_PK_ROOM_O,void 0,u),!c){t.n=1;break}return t.n=1,this._invoker.push(this.createLeaveOtherRoomCommand(c,!0,u));case 1:delete this._PKInfo[a],this._logger.info(ye.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onFinishOtherRoom",endInfo:s})),this._callAppListener("onFinishOtherRoom",s);case 2:return t.a(2)}},t,this)}))}},{key:"_onRecvPKMsg",value:function(e){var t=e.content;switch(e.messageType){case Kn.PK_INVITE:this._onInvite(t);break;case Kn.PK_CANCEL_INVITE:this._onCancelInvite(t);break;case Kn.PK_INVITE_TIMEOUT:this._onInviteTimeout(t);break;case Kn.PK_INVITE_ANSWER:this._onInviteAnswer(t);break;case Kn.PK_END:this._onPKEnd(t)}}},{key:"registerRoomPKEventListener",value:function(e){this._logger.info(ye.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O,JSON.stringify({listener:e&&Object.keys(e)})),this._appListener=e}},{key:"requestJoinOtherRoom",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=this._logger.createTraceId(),this._logger.info(ye.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:e,inviteeUserId:t,options:n}),i),j("inviteeRoomId",e,k,!0)&&j("inviteeUserId",t,k,!0)){r.n=1;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),i),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return o=ga(),a=!b(null==n?void 0:n.autoMix)||(null==n?void 0:n.autoMix),s={inviteSessionId:o,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:a,inviteeRoomId:e,inviteeUserId:t,inviteeTimeoutTime:this._inviteTimeout,extra:(null==n?void 0:n.extra)||""},c={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(s),inviteSessionId:o},r.n=2,this._context.requestRoomPK(c);case 2:if((u=r.v)===ke){r.n=3;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:u}),i),r.a(2,{code:u});case 3:return this._PKInfo[e]={inviteSessionId:o,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:a,inviteeRoomId:e},this._logger.info(ye.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),i),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"cancelRequestJoinOtherRoom",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=this._logger.createTraceId(),this._logger.info(ye.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:e,inviteeUserId:t,extra:n}),i),j("inviteeRoomId",e,k,!0)&&j("inviteeUserId",t,k,!0)){r.n=1;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),i),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._PKInfo[e]){r.n=2;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"The request to connect with ".concat(t," user in room ").concat(e," is not initiated")}),i),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return o={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:e,inviteeUserId:t,extra:n||""},a={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteSessionId:this._PKInfo[e].inviteSessionId,inviteInfo:JSON.stringify(o)},r.n=3,this._context.cancelRoomPK(a);case 3:if((s=r.v)===ke){r.n=4;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:s}),i),r.a(2,{code:s});case 4:return this._logger.info(ye.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),i),delete this._PKInfo[e],r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"responseJoinOtherRoom",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=this._logger.createTraceId(),this._logger.info(ye.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T,JSON.stringify({inviterRoomId:e,inviterUserId:t,agree:n,options:r}),o),j("inviterRoomId",e,k,!0)&&j("inviterUserId",t,k,!0)){i.n=1;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviterRoomId or inviterUserId"}),o),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._PKInfo[e]){i.n=2;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"User ".concat(t," in room ").concat(e," did not send a request for connection")}),o),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return a=this._PKInfo[e],s=a.inviteSessionId,c=a.inviterUserAutoMix,u=!b(null==r?void 0:r.autoMix)||(null==r?void 0:r.autoMix),d={inviteSessionId:s,inviterRoomId:e,inviterUserId:t,inviterUserAutoMix:c,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:u},_=Object.assign(d,{inviterUserAutoMix:c}),l=n?Object.assign(d,{MultiRoomKey:"".concat(e,"|").concat(this._mainRoomId),MultiRoomValue:JSON.stringify(_)}):d,!P(null==r?void 0:r.extra)&&Object.assign(l,{extra:r.extra}),f={agree:n,roomId:this._mainRoomId,inviteSessionId:s,inviteRoomId:e,inviteUserId:t,content:JSON.stringify(l),key:"".concat(e,"|").concat(this._mainRoomId),value:JSON.stringify(d)},i.n=3,this._context.responseRoomPK(f);case 3:if((h=i.v)===ke){i.n=4;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:h}),o),i.a(2,{code:h});case 4:return this._logger.info(ye.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),o),this._PKInfo[e].inviteeUserAutoMix=u,i.a(2,{code:exports.RCRTCCode.SUCCESS})}},i,this)}))}},{key:"joinOtherRoom",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T,JSON.stringify({roomId:e}),n),j("roomId",e,k,!0)){t.n=1;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),n),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._context.getConnectionStatus()===Se.CONNECTED){t.n=2;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"IM disconnected"}),n),t.a(2,{code:exports.RCRTCCode.SIGNAL_DISCONNECTED});case 2:if(!this._joinedPKRooms[e]){t.n=3;break}return this._logger.warn(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),n),t.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 3:return r=exports.RCLivingType.VIDEO,i={extra:'{"roomId": "'.concat(this._mainRoomId,'"}')},o=new Hc(this._context,this._runtime,e,this._service,this._initOptions,r,!1,!1,this._clientSessionId),t.n=4,o.__innerInit(exports.RTCMode.LIVE,void 0,r,i);case 4:if(a=t.v,(s=a.code)===exports.RCRTCCode.SUCCESS){t.n=5;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:s}),n),t.a(2,{code:s});case 5:return this._joinedPKRooms[e]=o,t.n=6,this._onJoinedPKRoom(e,n);case 6:return this._logger.info(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),n),t.a(2,{room:o,code:exports.RCRTCCode.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()})}},t,this)}))}},{key:"leaveOtherRoom",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r;return p().w(function(n){for(;;)if(0===n.n)return r=this._logger.createTraceId(),this._logger.info(ye.L_APP_CALL_LEAVE_PK_ROOM_O,void 0,r),n.a(2,this._invoker.push(this.createLeaveOtherRoomCommand(e,t,r)))},n,this)}))}},{key:"getPKInfo",value:function(e){return this._PKInfo[e]}},{key:"getAllPKInfo",value:function(){return this._PKInfo}},{key:"getJoinedPKRooms",value:function(){return this._joinedPKRooms}}])}();!function(e){e[e.OPEN=1]="OPEN",e[e.STOP=2]="STOP"}(wc||(wc={}));var Vc,jc=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"enable",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,is),a(e,[{key:"kind",get:function(){return $a.ENABLE_INNER_CDN}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.context,a=this.enable,i.info(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_T,JSON.stringify({roomId:t.roomId,enable:a})),t.isMainRoom){r.n=1;break}return i.error(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),r.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:if(b(a)){r.n=2;break}return i.error(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> enable"})),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return t.setCDNEnabel(a),s={version:2,output:{inCDNModel:a?wc.OPEN:wc.STOP}},r.n=3,new Nc(s,this.cdnValues).execute(e,t,n);case 3:if(c=r.v,(u=c.code)===exports.RCRTCCode.SUCCESS){r.n=4;break}return i.error(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:u,msg:"signal error"})),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 4:if(!(d=t.getCDNUris())||d.broadcast===fs.SPREAD){r.n=5;break}return i.info(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.SUCCESSED,enable:a})),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 5:return r.n=6,xs(o,t);case 6:if(_=r.v,(l=_.code)!==exports.RCRTCCode.SUCCESS){r.n=7;break}return i.info(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.SUCCESSED,enable:a})),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 7:return i.error(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:l})),r.a(2,{code:l})}},r,this)}))}}])}();!function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Vc||(Vc={}));var Fc,Gc,Jc=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,is),a(e,[{key:"kind",get:function(){return $a.RTC_IDENTITY_CHANGE}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u;return p().w(function(r){for(;;)switch(r.n){case 0:return o=e.context,r.n=1,o.rtcIdentityChange(t.roomId,Vc.ViewerToAnchor,this.livingType);case 1:if(a=r.v,s=a.code,c=a.data,s===ke&&c){r.n=2;break}return r.a(2,{code:s});case 2:return t.initWithRoomData(c,this.traceId),t.getResourcesByUserId(t.crtUserId).length>0&&n.push(new us),(u=null===(i=c.roomInfo.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===i?void 0:i.value)&&t.setCDNUris(JSON.parse(u)[0]),r.a(2,{code:s,data:c})}},r,this)}))}}])}(),Hc=function(){function e(t,n,o,a,s,c,u,d,_){var l;return i(this,e),l=r(this,e,[t,n,o,exports.RTCMode.LIVE,a,s,u,d,_]),Object.defineProperty(l,"_livingType",{enumerable:!0,configurable:!0,writable:!0,value:c}),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 Uc(l._executeCtx,l._invoker,l._isValidResourceId.bind(l)),l}return _(e,Ac),a(e,[{key:"_initRoomPKHandler",value:function(t){if(this._store.isMainRoom){var n=(r=this._roomId,i=t.roomInfo,o={},i.forEach(function(e){var t=JSON.parse(e.value),n=t.inviterRoomId,i=t.inviteeRoomId;o[r===n?i:n]=JSON.parse(e.value)}),o);this._roomPKHandler=new Bc(this._invoker,n,this._context,this._runtime,this._service,this._initOptions,this,C(e,"_registerPKMsgListener",this,1).bind(this),this._onJoinedPKRoom.bind(this),this._clientSessionId)}var r,i,o}},{key:"__innerInit",value:function(t,n,r,i,o,a){var s=this,c=Object.create(null,{__innerInit:{get:function(){return C(e,"__innerInit",s,1)}}});return K(this,void 0,void 0,p().m(function e(){var s,u,d;return p().w(function(e){for(;;)switch(e.n){case 0:if(j("livingType",r,function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO})){e.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType"}),a),e.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return e.n=2,c.__innerInit.call(this,t,n,r,i,o,a);case 2:return s=e.v,u=s.code,d=s.data,u===exports.RCRTCCode.SUCCESS&&d&&this._initRoomPKHandler(d),e.a(2,{code:u,data:d})}},e,this)}))}},{key:"__innerInitByIdentityChange",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._invoker.push(new Jc(this._livingType,e));case 1:return n=t.v,r=n.code,i=n.data,r===ke&&i?(this._initRoomPKHandler(i),this._initWithRoomData(i.offlineKickTime),this._logger.info(ye.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.SUCCESSED,roomData:i}),e)):this._logger.error(ye.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.FAILED,code:r}),e),t.a(2,r)}},t,this)}))}},{key:"publish",value:function(t){var n=this,r=Object.create(null,{publish:{get:function(){return C(e,"publish",n,1)}}});return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:if(this._store.isMainRoom){e.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),e.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:return e.a(2,r.publish.call(this,t))}},e,this)}))}},{key:"unpublish",value:function(t){var n=this,r=Object.create(null,{unpublish:{get:function(){return C(e,"unpublish",n,1)}}});return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:if(this._store.isMainRoom){e.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),e.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:return e.a(2,r.unpublish.call(this,t))}},e,this)}))}},{key:"_isValidResourceId",value:function(e){var t,n,r=Dn(e).userId,i=!!(null===(t=this._store.getResourcesByUserId(r))||void 0===t?void 0:t.find(function(t){return Pn(t)===e})),o=this.getRoomPKHandler(),a=o.code,s=o.roomPKHandler;if(a!==exports.RCRTCCode.SUCCESS||!s)return i;var c=s.getJoinedPKRooms(),u=[];return Object.values(c).forEach(function(e){u.push.apply(u,v(e.getRemoteTracks()))}),n=u.some(function(t){return e===t.getTrackId()}),i||n}},{key:"getLivingType",value:function(){return this._livingType}},{key:"getMCUConfigBuilder",value:function(){return this._store.isMainRoom?this._mcuConfigBuilder:(this._logger.error(ye.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O,"the `getMCUConfigBuilder` is disabled in PK room"),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"enableInnerCDN",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new jc(this._mcuConfigBuilder.__innerGetValues(),e)))},t,this)}))}},{key:"_resourceHandle",value:function(t,n,r,i,o){var a=this,s=Object.create(null,{_resourceHandle:{get:function(){return C(e,"_resourceHandle",a,1)}}});return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:s._resourceHandle.call(this,t,n,r,i,o);case 1:return e.a(2)}},e,this)}))}},{key:"__getCDNEnable",value:function(){var e;return!!(null===(e=this._store.getCDNUris())||void 0===e?void 0:e.enableInnerCDN)}},{key:"__getCDNPushMode",value:function(){var e;return null===(e=this._store.getCDNUris())||void 0===e?void 0:e.push_mode}},{key:"_onJoinedPKRoom",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){return p().w(function(n){for(;;)switch(n.n){case 0:this._invoker.push(new Mc(e,this._roomPKHandler,t));case 1:return n.a(2)}},n,this)}))}},{key:"_getPushOtherRoomsParams",value:function(){var e=[];if(!this.isMainRoom()||!this._roomPKHandler)return e;var t=this._roomPKHandler.getJoinedPKRooms();for(var n in t){var r=t[n].getSessionId(),i=this._roomPKHandler.getPKInfo(n);if(i){var o=i.inviterUserAutoMix,a=i.inviteeUserAutoMix,s=i.inviterUserId,c=this._context.getCurrentId()===s;e.push({roomId:n,sessionId:r,autoMix:c?!!o:!!a})}}return e}},{key:"getRoomPKHandler",value:function(){return this._store.isMainRoom?(this._logger.info(ye.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:Le.SUCCESSED})),{code:exports.RCRTCCode.SUCCESS,roomPKHandler:this._roomPKHandler}):(this._logger.error(ye.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:Le.SUCCESSED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"_quitAllPKRoom",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n;return p().w(function(e){for(;;)switch(e.n){case 0:for(n in t=this._roomPKHandler.getJoinedPKRooms())this._roomPKHandler.leaveOtherRoom(t[n]);this._logger.info(ye.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O,JSON.stringify({status:Le.SUCCESSED,roomIds:Object.keys(t)}));case 1:return e.a(2)}},e,this)}))}},{key:"isMainRoom",value:function(){return this._store.isMainRoom}}])}(),Kc=function(){function e(t,n,o,a,s){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:exports.RTCMode.RTC,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return i(this,e),r(this,e,[t,n,o,c,a,s,!1,!1,ga(),u])}return _(e,Ac),a(e)}(),qc=new(function(){return a(function e(){i(this,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})},[{key:"checkToStart",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o,a;return p().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==this.queue.length&&!this.locked){e.n=1;break}return e.a(2);case 1:return this.locked=!0,t=this.queue.shift(),n=t.resolve,r=t.task,i=t.reject,e.p=2,e.n=3,r();case 3:o=e.v,n(o),e.n=5;break;case 4:e.p=4,a=e.v,i(a);case 5:this.locked=!1,this.checkToStart();case 6:return e.a(2)}},e,this,[[2,4]])}))}},{key:"push",value:function(e){var t=this,n=new Promise(function(n,r){t.queue.push({resolve:n,task:e,reject:r})});return this.checkToStart(),n}}])}()),Wc=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return qc.push(e,t)},zc=function(){return a(function e(t,n,r){i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),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:ga()}),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 ba(n,t,r.mediaServer),this._logger=this._context.logger,this._store=new cs(this._logger,this._clientSessionId,this._context.getAppkey(),this._crtUserId,this._crtUserId,exports.RTCMode.LIVE)},[{key:"_getReqHeaders",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._crtUserId,this._rtcToken){t.n=3;break}return t.n=1,this._context.getRTCToken(n,exports.RTCMode.LIVE,e);case 1:if(r=t.v,i=r.code,o=r.data,i===ke){t.n=2;break}return t.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:this._rtcToken=o.rtcToken;case 3:return t.a(2,{code:exports.RCRTCCode.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:this._crtUserId,RoomId:n,RoomType:exports.RTCMode.LIVE,Token:this._rtcToken,"Client-Session-Id":this._clientSessionId}})}},t,this)}))}},{key:"_clearSubscribeInfo",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}},{key:"_reTryExchange",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r;return p().w(function(e){for(;;)switch(e.n){case 0:return this._fromRetry=!0,e.n=1,this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny);case 1:return n=e.v,(r=n.code)===exports.RCRTCCode.SUCCESS&&(null===(t=this._pc)||void 0===t||t.clearReTryExchangeTimer()),e.a(2,{code:r})}},e,this)}))}},{key:"subscribe",value:function(e,t,n){return K(this,arguments,void 0,function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return p().m(function o(){return p().w(function(o){for(;;)if(0===o.n)return o.a(2,Wc(function(){return r.__subscribe(e,t,n,i)},"audience-client-sub"))},o)})()})}},{key:"__subscribe",value:function(e,t,n){return K(this,arguments,void 0,function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return p().m(function o(){var a,s,c,u,d,_,l,f,h,R,g,m,C,v;return p().w(function(o){for(;;)switch(o.n){case 0:if(r._logger.info(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_T,JSON.stringify({liveUrl:e,livingType:t,mediaType:n,subTiny:i})),s=[],!zn(r._context.getNaviInfo())){o.n=1;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"})),o.a(2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,tracks:s});case 1:if(!r._fromRetry&&(null===(a=r._pc)||void 0===a||a.clearReTryExchangeTimer()),r._fromRetry=!1,O(e)){o.n=2;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> liveUrl: ".concat(e)})),o.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s});case 2:if([exports.RCLivingType.AUDIO,exports.RCLivingType.VIDEO].includes(t)){o.n=3;break}return r._logger.error("livingType is invalid: ".concat(t)),r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType: ".concat(t)})),o.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s});case 3:if([exports.RCMediaType.AUDIO_ONLY,exports.RCMediaType.VIDEO_ONLY,exports.RCMediaType.AUDIO_VIDEO].includes(n)){o.n=4;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> -> mediaType: ".concat(n)})),o.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s});case 4:if(!r._liveUrl||r._liveUrl===e){o.n=5;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,msg:"repeat subscribe"})),o.a(2,{code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s});case 5:return r._pc||(r._pc=new Za(r._context,r._logger,r._reTryExchange.bind(r),r._crtUserId,r._store,void 0,!1),r._pc.on(Za.__INNER_EVENT_TRACK_READY__,r._onTrackReady,r),r._pc.registerReportListener(r._reportListener),r._pc.__reportR3R4ToPolaris()),r._liveUrl=e,o.n=6,r._getReqHeaders(t);case 6:if(c=o.v,u=c.code,d=c.headers,u===exports.RCRTCCode.SUCCESS){o.n=7;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:u,msg:"getRTCToken failed"})),o.a(2,{code:u,tracks:s});case 7:return _="rc_mcu_".concat(Date.now()),l="RongCloudRTC",0===r._subTracks.length&&(r._subTracks.push(new Sn(r._logger,l,_),new En(r._logger,l,_)),r._pc.updateSubRemoteTracks(r._subTracks.slice())),o.n=8,r._pc.createOffer(!0);case 8:return f=o.v,h={sdp:f,liveUrl:e,mediaType:n,simulcast:i?Ea.TINY:Ea.NORMAL,switchstream:!1},o.n=9,r._service.broadcastSubscribe(d,h);case 9:if((R=o.v).code===exports.RCRTCCode.SUCCESS){o.n=10;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:R.code})),o.a(2,{code:R.code,tracks:s});case 10:if((g=R.data).resultCode===exports.RCRTCCode.SUCCESS){o.n=11;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:g.resultCode,msg:g.message})),o.a(2,{code:g.resultCode,tracks:s});case 11:return r._livingType=t,r._mediaType=n,r._subTiny=i,m=g.sdp,C=g.subscribedList,r._subscribedList=C,v=[],C.forEach(function(e){var t=e.mediaType,n=r._subTracks[t];v.push(n),n.__innerSetRemoteMuted(!0)}),r._pc.setRemoteAnswer(m.sdp),v&&r._updateTrackIdSSRCMap(m.sdp,v),r._logger.info(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,liveUrl:e})),o.a(2,{code:exports.RCRTCCode.SUCCESS,tracks:v})}},o)})()})}},{key:"_updateTrackIdSSRCMap",value:function(e,t){var n=this;t.forEach(function(t){var r=t.getTrackId(),i=Dn(r).mediaType,o=n._subscribedList.filter(function(e){return e.mediaType===i})[0].msid,a=zs(e,o,i);n._store.setTrackIdSSRCMap(Number(a),r)})}},{key:"unsubscribe",value:function(){return K(this,void 0,void 0,p().m(function e(){var t=this;return p().w(function(e){for(;;)if(0===e.n)return e.a(2,Wc(function(){return t.__unsubscribe()},"audience-client-unsub"))},e)}))}},{key:"__unsubscribe",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o;return p().w(function(e){for(;;)switch(e.n){case 0:if(this._logger.info(ye.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T,JSON.stringify({liveUrl:this._liveUrl})),null===(t=this._pc)||void 0===t||t.clearReTryExchangeTimer(),this._rtcToken&&this._liveUrl){e.n=1;break}return this._logger.warn(ye.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:"",msg:"Address does not exist, without unsubscribe"})),e.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return e.n=2,this._getReqHeaders();case 2:return n=e.v,r=n.headers,e.n=3,this._service.broadcastExit(r);case 3:return i=e.v,(o=i.code)!==exports.RCRTCCode.SUCCESS?this._logger.error(ye.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:o})):(this._logger.info(ye.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,liveUrl:this._liveUrl})),this._subscribedList=[]),this._clearSubscribeInfo(),e.a(2,{code:o})}},e,this)}))}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"registerTrackEventListener",value:function(e){this._appListener=e}},{key:"_onTrackReady",value:function(e){var t,n,r=e.receiver.track,i="audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY,o=this._subTracks[i];o.__innerSetMediaStreamTrack(r);try{this._logger.info(ye.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,"trackId: ".concat(o.getTrackId())),null===(n=null===(t=this._appListener)||void 0===t?void 0:t.onTrackReady)||void 0===n||n.call(t,o)}catch(e){this._logger.error(ye.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,JSON.stringify(e))}}}])}();exports.RCInnerCDNPullKind=void 0,(Fc=exports.RCInnerCDNPullKind||(exports.RCInnerCDNPullKind={})).RTMP="rtmp",Fc.FLV="flv",Fc.HLS="hls",exports.RCInnerCDNPullIsHttps=void 0,(Gc=exports.RCInnerCDNPullIsHttps||(exports.RCInnerCDNPullIsHttps={}))[Gc.NOT_HTTPS=0]="NOT_HTTPS",Gc[Gc.HTTPS=1]="HTTPS";var Yc,Qc=Object.assign(Object.assign({},Bn(exports.RCResolution.W176_H144)),{frameRate:Fn(exports.RCFrameRate.FPS_15)}),Zc=function(){return a(function e(t,n,r,o,a,s){var c=this,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:ga();i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_joinResData",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:u}),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 hc(this._context,this._runtime,this._roomId,this,dc.Audience),this._reportMediaActionLogger=new pc(this._logger,this._roomId,this._clientSessionId,this._crtUserId),this._service=new ba(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout);var d=this._store=new cs(this._logger,u,t.getAppkey(),o,this._crtUserId,exports.RTCMode.LIVE),_=this._pc=new Za(this._context,this._logger,this._reTryExchange.bind(this),this._crtUserId,d,this._polarisReport,!0);this._audioLevelReport=new ns(this._store,_),_.on(Za.__INNER_AUDIOLEVEL_CHANGE__,this._audioLevelReport.audioLevelReport,this._audioLevelReport),this._polarisReport.sendR1(),this._context.registerRTCSignalListener(function(e){return K(c,void 0,void 0,p().m(function t(){var n,r,i,o;return p().w(function(t){for(;;)switch(t.n){case 0:n=this._context.decodeRtcNotify(e),r=n.time,i=n.type,o=n.roomId,1===i&&this._startPull(o,r);case 1:return t.a(2)}},t,this)}))}),this._setInitData()},[{key:"_startPull",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s;return p().w(function(n){for(;;)switch(n.n){case 0:if(!this._isPulling){n.n=1;break}return n.a(2);case 1:if(this._isPulling=!0,!(this._pullTime>t)){n.n=2;break}return this._isPulling=!1,n.a(2);case 2:return r=this._logger.createTraceId(),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T,"pullTime: ".concat(this._pullTime),r),n.n=3,this._context.pullRTCRoomEntry(e);case 3:i=n.v,o=i.code,a=i.data,o===ke&&(this._isPulling=!1,this._pullTime=(null==a?void 0:a.syncTime)||0,s=(null==a?void 0:a.kvEntries)||[],this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(Le.SUCCESSED,", kvEntries: ").concat(JSON.stringify(s)),r),this.singalDataChange(s,e,r)),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(Le.FAILED,", code: ").concat(o),r);case 4:return n.a(2)}},n,this)}))}},{key:"_setInitData",value:function(){var e=this,t=function(e,t,n){var r=t.filter(function(e){return"RC_RTC_SESSIONID"===e.key})[0],i=r?r.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 r=t.mediaType,i=t.tag,o=r===exports.RCMediaType.AUDIO_ONLY?new Sn(n,i,"",e):new En(n,i,"",e);c.push(o)});var u=[],d=[];a.forEach(function(e){var t=JSON.parse(e.uris||"[]");u.push.apply(u,v(t)),t.forEach(function(e){var t=e.mediaType,r=e.tag,i=e.msid.split("_");i.pop();var o=i.join("_"),a=t===exports.RCMediaType.AUDIO_ONLY?new Sn(n,r,o):new En(n,r,o);d.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:d,remoteMCUTracks:c,remoteTracks:[].concat(d,c),CDNUris:_||{}}}(this._roomId,this._joinResData.kvEntries,this._logger),n=t.sessionId,r=t.remoteUserIds,i=t.remoteRTCUris,o=t.remoteMUCUris,a=t.remoteTracks,s=t.CDNUris;this._sessionId=n,this._roomAnchorList=r,a.forEach(function(t){e._remoteTracks[t.getTrackId()]=t}),this._CDNUris=s,i.forEach(function(t){var n=t.msid.split("_")[0];e._roomAnchorRes[n]?e._roomAnchorRes[n].push(t):e._roomAnchorRes[n]=[t];var r=JSON.parse(t.uri),i=r.ssrc,o=r.resourceId;e._store.setTrackIdSSRCMap(i,o)}),o.forEach(function(t){var n=t.mediaType,r=t.tag,i=[e._roomId,r,n].join("_");e._roomRes[i]=t;var o=JSON.parse(t.uri).ssrc;e._store.setTrackIdSSRCMap(o,i)}),i.forEach(function(t){var n=Pn(t);e._roomRes[n]=t})}},{key:"_assertRoomDestroyed",value:function(){if(this._destroyed)return exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}},{key:"singalDataChange",value:function(e,t,n){var r,i=this;if(t===this._roomId){var o=[],a=null===(r=e.filter(function(e){return"RC_CDN"===e.key})[0])||void 0===r?void 0:r.value;a&&this._diffCDNUris(JSON.parse(JSON.parse(a).cdn_uris)[0],n),e.forEach(function(e){var t=e.key,r=e.value,a=e.uid;if(-1!==t.indexOf("RC_RES_")){var s=JSON.parse(r||"{}"),c=JSON.parse(s.mcu_uris||"[]"),u=JSON.parse(s.uris||"[]");return o.push.apply(o,v(c)),void i._diffAnchorResource(u,a,n)}if("RC_ANCHOR_LIST"===t){var d=JSON.parse(r||"[]");i._diffAnchorList(d,n)}}),this._diffRoomResource(o,n)}else this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P,JSON.stringify({status:Le.FAILED,msg:"roomId inconsistency -> params roomId:".concat(t,", current roomId:").concat(this._roomId)}),n)}},{key:"_diffAnchorList",value:function(e,t){var n=this,r=e.filter(function(e){return n._roomAnchorList.indexOf(e)<0}),i=this._roomAnchorList.filter(function(t){return e.indexOf(t)<0});r.length>0&&this._handleNewJoinedAnchor(r,t),i.length>0&&this._handleLeftedAnchor(i,t)}},{key:"_handleNewJoinedAnchor",value:function(e,t){var n;(n=this._roomAnchorList).push.apply(n,v(e)),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorJoin",list:e}),t),this._callAppListener("onAnchorJoin",e)}},{key:"_handleLeftedAnchor",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i=this;return p().w(function(n){for(;;)switch(n.n){case 0:if(this._roomAnchorList=this._roomAnchorList.filter(function(t){return!e.includes(t)}),r=[],e.forEach(function(e){r.push.apply(r,v(i.getRemoteTracksByUserId(e))),delete i._roomAnchorRes[e]}),!r.length){n.n=2;break}return n.n=1,this.unsubscribe(r);case 1:r.forEach(function(e){return delete i._remoteTracks[e.getTrackId()]});case 2:this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorLeave",list:e}),t),this._callAppListener("onAnchorLeave",e);case 3:return n.a(2)}},n,this)}))}},{key:"_diffRoomResource",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a=this;return p().w(function(n){for(;;)switch(n.n){case 0:r=[],i=[],o=[],e.forEach(function(e){var t=Pn(e),n=Dn(t),i=n.tag,s=n.mediaType,c=[a._roomId,i,s].join("_"),u=JSON.parse(e.uri).ssrc;if(a._store.setTrackIdSSRCMap(u,c),!a._remoteTracks[c]){var d=s===exports.RCMediaType.AUDIO_ONLY?new Sn(a._logger,i,"",a._roomId):new En(a._logger,i,"",a._roomId);r.push(d),a._remoteTracks[c]=d,a._roomRes[d.getTrackId()]=e}o.push(c)}),Object.keys(this._remoteTracks).forEach(function(e){o.indexOf(e)<0&&a._remoteTracks[e].isMCUTrack()&&i.push(a._remoteTracks[e])}),r.length>0&&(this._logger.info(ye.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)),i.length>0&&this._onUserUnpublish(i,"onTrackUnpublish",t);case 1:return n.a(2)}},n,this)}))}},{key:"_dealPublished",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.map(Pn),o=[],a=[],t.forEach(function(t){var n=Pn(t),r=i.indexOf(n),s=Dn(n),c=s.userId,u=s.tag,_=s.mediaType,l=JSON.parse(t.uri).ssrc;d._store.setTrackIdSSRCMap(l,n),r>-1?e[r]=t:e.push(t);var p=d._remoteTracks[n];d._roomRes[n]=t,p?p.isSubscribed()&&o.push(p):(p=_===exports.RCMediaType.AUDIO_ONLY?new Sn(d._logger,u,c):new En(d._logger,u,c),d._remoteTracks[n]=p,a.push(p)),p.__innerSetRemoteMuted(0===t.state)}),!o.length){r.n=2;break}return s=o.map(function(e){return e.getTrackId()}),r.n=1,Wc(function(){return d._subscribeHandle(o,!0)});case 1:c=r.v,(u=c.code)!==exports.RCRTCCode.SUCCESS&&this._logger.error(ye.L_RESUB_REPUB_RES_R,JSON.stringify({status:Le.FAILED,trackIds:s,code:u}));case 2:this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorTrackPublish",trackIds:a.map(function(e){return e.getTrackId()})}),n),this._callAppListener("onAnchorTrackPublish",a);case 3:return r.a(2)}},r,this)}))}},{key:"_dealUnpublished",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c=this;return p().w(function(r){for(;;)switch(r.n){case 0:for(i=t.map(Pn),o=e.length-1;o>=0;o-=1)a=e[o],i.includes(Pn(a))&&e.splice(o,1);return s=t.map(function(e){var t=Pn(e);return c._remoteTracks[t]}),r.n=1,this._onUserUnpublish(s,"onAnchorTrackUnpublish",n);case 1:return r.a(2)}},r,this)}))}},{key:"_dealModified",value:function(e,t,n){var r,i=e.map(Pn),o=s(t);try{for(o.s();!(r=o.n()).done;){var a=r.value,c=Pn(a);e[i.indexOf(c)].state=a.state;var u=this._remoteTracks[c];u.__innerSetRemoteMuted(0===a.state);var d=u.isAudioTrack()?"onAudioMuteChange":"onVideoMuteChange";this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:d,trackId:u.getTrackId()}),n),this._callAppListener(d,u)}}catch(e){o.e(e)}finally{o.f()}}},{key:"_diffAnchorResource",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),o=Mn(i,e),a=o.publishedList,s=o.unpublishedList,c=o.modifiedList,!a.length){r.n=1;break}return r.n=1,this._dealPublished(i,a,n);case 1:if(!s.length){r.n=2;break}return r.n=2,this._dealUnpublished(i,s,n);case 2:c.length&&this._dealModified(i,c,n);case 3:return r.a(2)}},r,this)}))}},{key:"_onUserUnpublish",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i=this;return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this.unsubscribe(e);case 1:e.forEach(function(e){i._subscribedList=i._subscribedList.filter(function(t){return t.track.getTrackId()!==e.getTrackId()}),delete i._roomRes[e.getTrackId()],e.__innerDestroy(),delete i._remoteTracks[e.getTrackId()]}),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:t,trackIds:e.map(function(e){return e.getTrackId()})}),n),this._callAppListener(t,e);case 2:return r.a(2)}},r,this)}))}},{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify(e))}}},{key:"_reTryExchange",value:function(){return K(this,void 0,void 0,p().m(function e(){var t=this;return p().w(function(e){for(;;)if(0===e.n)return e.a(2,Wc(function(){return K(t,void 0,void 0,p().m(function e(){var t,n,r,i,o,a,s,c,u,d,_,l;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._createSubscribeParams(this._subscribedList,{},!0);case 1:return n=e.v,r=n.reqBody,e.n=2,this._exchangeHandle(r);case 2:if((i=e.v).code===exports.RCRTCCode.SUCCESS){e.n=3;break}return e.a(2,{code:i.code});case 3:if(o=i.data,a=o.sdp,(s=o.resultCode)===exports.RCRTCCode.SUCCESS){e.n=4;break}return e.a(2,{code:s});case 4:return this._pc.clearReTryExchangeTimer(),(c=this._subscribedList.filter(function(e){return e.track.isMCUTrack()})).length>0&&(u=c[0].track.getTrackId(),d=null===(t=this._roomRes[u])||void 0===t?void 0:t.msid,_=[this._roomId,"RongCloudRTC"].join("_"),a.sdp=a.sdp.replace(new RegExp(d,"g"),_)),e.n=5,this._pc.setRemoteAnswer(a.sdp);case 5:return l=e.v,e.a(2,{code:l})}},e,this)}))},"audience-retry-exchange"))},e)}))}},{key:"_createSubscribeParams",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c=this;return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this._pc.createOffer(n);case 1:return i=r.v,o={resolutionInfo:[]},a={min:0,max:0},Object.keys(t).forEach(function(e){var n=t[e];[n.mediaStream,n.tinyStream].forEach(function(t,n){var r,s=1===n?[e,"tiny"].join("_"):e;i.sdp=null===(r=i.sdp)||void 0===r?void 0:r.replace(new RegExp(t.id,"g"),s);var c=t.getVideoTracks()[0];if(c){var u=0===n,d=u?An(c):Qc,_=d.width,l=d.height,p=d.frameRate;o.resolutionInfo.push({trackId:c.id,simulcast:u?Ea.NORMAL:Ea.TINY,resolution:"".concat(_,"x").concat(l)});var f=en(_,l),h=nn(p);a.min+=f.minBitrate*h,a.max+=f.maxBitrate*h}})}),s={sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map(function(e){return{simulcast:e.subTiny?Ea.TINY:Ea.NORMAL,resolution:"",uri:c._roomRes[e.track.getTrackId()].uri}})},r.a(2,{reqBody:s,dynamicBitrate:a,offer:i})}},r,this)}))}},{key:"_subscribeHandle",value:function(e){return K(this,arguments,void 0,function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return p().m(function i(){var o,a,s,c,u,d;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=Date.now(),a=r?ks.SUB:void 0,s=t._logger.createTraceId(),t._logger.info(ye.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:e.map(Xn),forceReq:n}),s),!t._assertRoomDestroyed()){i.n=1;break}return t._logger.error(ye.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),s),t._reportPubOrSubQualityData(o,e,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,a),i.a(2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED});case 1:if(j("tracks",e,function(){return L(e)&&e.length>0&&e.every(function(e){return e instanceof In||e.track instanceof In})},!0)){i.n=2;break}return t._logger.error(ye.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),s),t._reportPubOrSubQualityData(o,e,exports.RCRTCCode.PARAMS_ERROR,a),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return t._pc.__reportR3R4ToPolaris(),t._pc.registerReportListener(t._reportListener),t._addPeerCEvent(),c=t._subscribedList.map(function(e){return Object.assign({},e)}),u=e.map(function(e){return e instanceof In?{track:e}:e}),d=[],u.forEach(function(e){var t=e.track.getTrackId();d.push(t);var n=c.find(function(e){return e.track.getTrackId()===t});n&&n.subTiny===e.subTiny||(n?n.subTiny=e.subTiny:c.push(e))}),t._polarisReport.sendR2(ls.SUBSCRIBE,ps.BEGIN,d),i.a(2,t._updateSubListHandle(c,s,o,a,!0))}},i)})()})}},{key:"_addPeerCEvent",value:function(){var e=this;this._pc.on(Za.__INNER_EVENT_TRACK_READY__,function(t){var n=t.streams[0].id,r=t.receiver.track,i=[n,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),o=e._remoteTracks[i];o?(o.__innerSetMediaStreamTrack(r),e._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackReady",trackId:o.getTrackId()})),e._callAppListener("onTrackReady",o)):e._logger.warn(ye.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O,"cannot found RCRemoteTrack: ".concat(r.id))}),this._pc.once(Za.__INNER_ICE_CONNECTED__,function(){e._reportMediaActionLogger.reportIceFirstConnectData("sub")},this),this._pc.on(Za.__INNER_ICE_STATE_CHANGE__,function(t){var n=t.status,r=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,n,r)})}},{key:"_getReqHeaders",value:function(){var e=this._crtUserId;return{"App-Key":this._context.getAppkey(),RoomId:e,Token:this._joinResData.token,RoomType:exports.RTCMode.LIVE,UserId:e,"Session-Id":this._sessionId,"Client-Session-Id":this._clientSessionId}}},{key:"_exchangeHandle",value:function(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}},{key:"_dealSubscribeResult",value:function(e,t,n){var r,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()],n="".concat(t.msid,"_").concat(t.mediaType);return o.includes(n)}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});i._remoteTracks[e].__innerSetSubscribed(t)};for(var d in this._remoteTracks)u(d);return(r=this._subscribedList).splice.apply(r,[0,this._subscribedList.length].concat(v(a))),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.SUCCESSED,subSuccessTrackIds:o,failedList:c}),n),c}},{key:"_getParams",value:function(e){var t=e.map(function(e){return e instanceof In?{track:e}:Object.assign({},e)}),n={};return t=t.filter(function(e){var t=e.track.getTrackId();return!n[t]&&(n[t]=!0,!0)}).map(function(e){return Object.assign({},e)})}},{key:"_reportPubOrSubQualityData",value:function(e,t,n,r){r&&this._reportMediaActionLogger.reportPubOrSubQualityData(r,e,t,n,this._trackMediaMap)}},{key:"_updateSubListHandle",value:function(e,t,n,r){return K(this,arguments,void 0,function(e,t,n,r){var i=this,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return p().m(function a(){var s,c,u,d,_,l,f,h,R,g,m,C,v,T;return p().w(function(a){for(;;)switch(a.n){case 0:if(i._logger.info(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T,JSON.stringify({trackIds:e.map(Xn),forceReq:o}),t),c=i._getParams(e),u=i._subscribedList.map(function(e){return Object.assign({},e)}),o||Ys(c,u)){a.n=1;break}return i._logger.info(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.SUCCESSED,msg:"repeat subscribe"}),t),a.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return i._pc.clearReTryExchangeTimer(),i._pc.updateSubRemoteTracks(c.map(function(e){return e.track})),a.n=2,i._createSubscribeParams(c,{},!1);case 2:return d=a.v,_=d.reqBody,a.n=3,i._exchangeHandle(_);case 3:if(l=a.v,u.length&&(f=[],u.forEach(function(e){f.push(e.track.getTrackId())}),null===(s=i._pc.reportParser)||void 0===s||s.clearLatestPacketsRecv(f)),e.forEach(function(e){var t=e instanceof In?e.getTrackId():e.track.getTrackId();i._trackMediaMap[t]=l.qualityMsList||[]}),l.code===exports.RCRTCCode.SUCCESS){a.n=4;break}return i._reportPubOrSubQualityData(n,e,l.code,r),i._logger.error(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.FAILED,code:l.code}),t),a.a(2,{code:l.code});case 4:if(h=l.data,R=h.sdp,g=h.resultCode,m=h.message,C=h.subscribedList,g===exports.RCRTCCode.SUCCESS){a.n=5;break}return i._reportPubOrSubQualityData(n,e,g,r),i._logger.error(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.FAILED,code:g,msg:m}),t),a.a(2,{code:g});case 5:return c.forEach(function(e){var t=e.track;if(t.isMCUTrack()){var n=i._roomRes[t.getTrackId()].msid,r=Dn(t.getTrackId()),o=r.tag,a=[r.userId,o].join("_");R.sdp=R.sdp.replace(new RegExp(n,"g"),a)}}),a.n=6,i._pc.setRemoteAnswer(R.sdp);case 6:if(v=a.v,i._reportPubOrSubQualityData(n,e,v,r),v===exports.RCRTCCode.SUCCESS){a.n=7;break}return i._logger.error(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.FAILED,code:v,msg:"set remote answer error"}),t),a.a(2,{code:v});case 7:return T=i._dealSubscribeResult(c,C,t),a.a(2,T.length?{code:exports.RCRTCCode.SUCCESS,failedList:T}:{code:exports.RCRTCCode.SUCCESS})}},a)})()})}},{key:"_diffCDNUris",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o;return p().w(function(n){for(;;)switch(n.n){case 0:if(!this._CDNUris.url||e.url){n.n=1;break}return this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoDisable"}),t),this._callAppListener("onCDNInfoDisable"),this._CDNUris=e,n.a(2);case 1:(!this._CDNUris||!this._CDNUris.url&&e.url)&&(this._logger.info(ye.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,i=this._CDNUris.h&&e.h&&this._CDNUris.h!==e.h,o=this._CDNUris.fps&&e.fps&&this._CDNUris.fps!==e.fps,(r||i||o)&&(this._logger.info(ye.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;case 2:return n.a(2)}},n,this)}))}},{key:"_getCDNPlayUrl",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l,f,h,R,g,m,C;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=e.w,i=e.h,o=e.fps,a=this._initOptions.pullInnerCDNProtocol||exports.RCInnerCDNPullKind.FLV,s=this._initOptions.pullInnerCDNUseHttps===exports.RCInnerCDNPullIsHttps.NOT_HTTPS?exports.RCInnerCDNPullIsHttps.NOT_HTTPS:exports.RCInnerCDNPullIsHttps.HTTPS,this._CDNUris.url){n.n=1;break}return this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY,msg:"cdn_uris url is empty, the anchor need to open or push CDN"}),t),n.a(2,{code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY});case 1:return c={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._crtUserId,SessionId:this.getSessionId()},u=[],d=this._CDNUris,_=d.w,l=void 0===_?0:_,f=d.h,l/(void 0===f?1:f)>1?(r&&u.push("w=".concat(r)),i&&u.push("h=".concat(i))):(r&&u.push("h=".concat(r)),i&&u.push("w=".concat(i))),o&&u.push("fps=".concat(o)),u.push("kind=".concat(a)),u.push("is_https=".concat(s)),h=u.join("&"),R="".concat(this._CDNUris.url,"?"),h&&(R+=h),n.n=2,this._service.getCDNResourceInfo(c,R,t);case 2:if(g=n.v,m=g.code,C=g.res,m===exports.RCRTCCode.SUCCESS){n.n=3;break}return n.a(2,{code:m});case 3:return n.a(2,{code:m,CDNPlayUrl:null==C?void 0:C.data.pull_url})}},n,this)}))}},{key:"getCDNPlayUrl",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T,JSON.stringify({resolution:e,fps:t}),r),!e||Vn(e)){n.n=1;break}return this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> resolution"}),r),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(!t||jn(t)){n.n=2;break}return this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> fps"}),r),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return i=e?Bn(e):{width:null,height:null},o=i.width,a=i.height,s=t?Fn(t):null,c={},o&&(c.w=o),a&&(c.h=a),s&&(c.fps=s),n.a(2,this._getCDNPlayUrl(c,r))}},n,this)}))}},{key:"subscribe",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n=this;return p().w(function(t){for(;;)if(0===t.n)return t.a(2,Wc(function(){return n._subscribeHandle(e,!1,!0)},"audience-sub"))},t)}))}},{key:"__unsubscribe",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=Date.now(),r=ks.UNSUB,i=this._logger.createTraceId(),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T,JSON.stringify({trackIds:e.map(function(e){return e.getTrackId()})}),i),!this._assertRoomDestroyed()){t.n=1;break}return this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),i),t.a(2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED});case 1:if(j("tracks",e,function(){return L(e)&&e.length>0&&e.every(function(e){return e instanceof In})},!0)){t.n=2;break}return this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),i),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return o=this._subscribedList.map(function(e){return Object.assign({},e)}).filter(function(t){return e.every(function(e){return e.getTrackId()!==t.track.getTrackId()})}),this._polarisReport.sendR2(ls.SUBSCRIBE,ps.END,e.map(function(e){return e.getTrackId()})),t.a(2,this._updateSubListHandle(o,i,n,r,!1))}},t,this)}))}},{key:"unsubscribe",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n=this;return p().w(function(t){for(;;)if(0===t.n)return t.a(2,Wc(function(){return n.__unsubscribe(e)},"audience-unsub"))},t)}))}},{key:"__destroy",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)switch(t.n){case 0:if(!this._destroyed){t.n=1;break}return t.a(2);case 1:if(this._destroyed=!0,!e){t.n=2;break}return t.n=2,this._context.quitLivingRoomAsAudience(this._roomId);case 2:return t.n=3,this._service.broadcastExit(this._getReqHeaders());case 3:null===(n=this._pc)||void 0===n||n.destroy(),this._context.registerRTCSignalListener();case 4:return t.a(2)}},t,this)}))}},{key:"getRemoteTrack",value:function(e){return this._remoteTracks[e]}},{key:"getLocalTrack",value:function(e){return{}}},{key:"__onReconnected",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n;return p().w(function(e){for(;;)switch(e.n){case 0:return t=this._logger.createTraceId(),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T,void 0,t),e.n=1,this._context.joinLivingRoomAsAudience(this._roomId,exports.RTCMode.LIVE);case 1:n=e.v,n.code!==ke&&this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(Le.FAILED),t),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(Le.SUCCESSED),t);case 2:return e.a(2)}},e,this)}))}},{key:"registerRoomEventListener",value:function(e){this._appListener=e}},{key:"onAudioLevelChange",value:function(e,t){this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O),this._audioLevelReport.onAudioLevelChange(e)}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"getRoomId",value:function(){return this._roomId}},{key:"getCrtUserId",value:function(){return this._crtUserId}},{key:"getSessionId",value:function(){return this._sessionId}},{key:"getRemoteUserIds",value:function(){return this._roomAnchorList}},{key:"getRemoteTracksByUserId",value:function(e){var t=[];for(var n in this._remoteTracks){var r=this._remoteTracks[n];r.getUserId()===e&&t.push(r)}return t}},{key:"getRemoteTracks",value:function(){var e=this,t=[],n=[];for(var r in this._remoteTracks){if(2===n.length)break;var i=this._remoteTracks[r];i.isMCUTrack()&&n.push(i)}return this._roomAnchorList.forEach(function(n){t.push.apply(t,v(e.getRemoteTracksByUserId(n)))}),[].concat(n,t)}},{key:"getRemoteRTCTracks",value:function(){var e=[];for(var t in this._remoteTracks){var n=this._remoteTracks[t];n.isMCUTrack()||e.push(n)}return e}},{key:"getRemoteMCUTracks",value:function(){var e=[];for(var t in this._remoteTracks){var n=this._remoteTracks[t];n.isMCUTrack()&&e.push(n)}return e}},{key:"getCDNInfo",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}}},{key:"getClientSessionId",value:function(){return this._clientSessionId}}])}();!function(e){e[e.AUTOMATIC=0]="AUTOMATIC",e[e.MANUAL=1]="MANUAL"}(Yc||(Yc={}));var Xc,$c,eu=function(){function e(t){i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),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=t.logger}return a(e,[{key:"_getMediaStream",value:function(e){return K(this,arguments,void 0,function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"getUserMedia";return p().m(function r(){var i,o,a;return p().w(function(r){for(;;)switch(r.p=r.n){case 0:return r.p=0,i=t.setConstraintsConfig(e),r.n=1,navigator.mediaDevices[n](i);case 1:return o=r.v,r.a(2,{code:exports.RCRTCCode.SUCCESS,stream:o});case 2:if(r.p=2,a=r.v,t._logger.error(ye.L_GET_MEDIA_STREAM_E,JSON.stringify({name:a.name,message:a.message})),"Permission denied"!==a.message){r.n=3;break}return r.a(2,{code:exports.RCRTCCode.BROWSER_PERMISSION_DENIED});case 3:if("Permission denied by system"!==a.message){r.n=4;break}return r.a(2,{code:exports.RCRTCCode.SYSTEM_PERMISSION_DENIED});case 4:return r.a(2,{code:"getUserMedia"===n?exports.RCRTCCode.GET_USER_MEDIA_FAILED:exports.RCRTCCode.GET_DISPLAY_MEDIA_FAILED})}},r,null,[[0,2]])})()})}},{key:"_getMediaStreamErrorReason",value:function(e){var t="";return e===exports.RCRTCCode.BROWSER_PERMISSION_DENIED&&(t="Permission denied"),e===exports.RCRTCCode.SYSTEM_PERMISSION_DENIED&&(t="Permission denied by system"),t}},{key:"setConstraintsConfig",value:function(e){var t,n;if((null==e?void 0:e.audio)&&!this._isElectron){"boolean"==typeof e.audio&&(e.audio={});var r=null===(n=(t=navigator.mediaDevices).getSupportedConstraints)||void 0===n?void 0:n.call(t);(null==r?void 0:r.noiseSuppression)&&(e.audio.noiseSuppression=!!r.noiseSuppression),(null==r?void 0:r.autoGainControl)&&(e.audio.autoGainControl=!!r.autoGainControl),(null==r?void 0:r.echoCancellation)&&(e.audio.echoCancellation=!!r.echoCancellation),this._logger.info(ye.L_SET_AUDIO_CONSTRAINTS_O,"browser supported -> ".concat(JSON.stringify(r)))}return e}},{key:"createMicrophoneAudioTrack",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",n=arguments.length>1?arguments[1]:void 0;return p().m(function r(){var i,o,a,s,c,u;return p().w(function(r){for(;;)switch(r.n){case 0:if(Ln(t)){r.n=1;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),r.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(i=e._context.getCurrentId()){r.n=2;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),r.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 2:return r.n=3,e._getMediaStream({audio:{deviceId:(null==n?void 0:n.micphoneId)?{exact:null==n?void 0:n.micphoneId}:void 0,sampleRate:null==n?void 0:n.sampleRate,noiseSuppression:null==n?void 0:n.noiseSuppression,echoCancellation:null==n?void 0:n.echoCancellation,autoGainControl:null==n?void 0:n.autoGainControl}});case 3:if(o=r.v,a=o.stream,(s=o.code)===exports.RCRTCCode.SUCCESS){r.n=4;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:s,msg:e._getMediaStreamErrorReason(s)})),r.a(2,{code:s});case 4:return c=a.getAudioTracks()[0],u=new mn(e._logger,t,i,c),e._logger.info(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:u.getTrackId()})),r.a(2,{code:s,track:u})}},r)})()})}},{key:"createCameraVideoTrack",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",n=arguments.length>1?arguments[1]:void 0;return p().m(function r(){var i,o,a,s,c,u,d,_,l,f;return p().w(function(r){for(;;)switch(r.n){case 0:if(Ln(t)){r.n=1;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),r.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(i=e._context.getCurrentId()){r.n=2;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),r.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 2:return o=Vn(null==n?void 0:n.resolution)?n.resolution:exports.RCResolution.W640_H480,a=Bn(o),s=a.width,c=a.height,r.n=3,e._getMediaStream({video:{deviceId:(null==n?void 0:n.cameraId)?{exact:null==n?void 0:n.cameraId}:void 0,frameRate:Fn((null==n?void 0:n.frameRate)||exports.RCFrameRate.FPS_15),width:{ideal:s,max:s},height:{ideal:c,max:c},facingMode:null==n?void 0:n.faceMode}});case 3:if(u=r.v,d=u.stream,(_=u.code)===exports.RCRTCCode.SUCCESS){r.n=4;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:_,msg:e._getMediaStreamErrorReason(_)})),r.a(2,{code:_});case 4:return l=d.getVideoTracks()[0],r.n=5,e._applyVideoAspectRatio(l,s,c);case 5:return f=new Cn(e._logger,t,i,l),e._logger.info(ye.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:f.getTrackId()})),r.a(2,{code:_,track:f})}},r)})()})}},{key:"createMicrophoneAndCameraTracks",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",n=arguments.length>1?arguments[1]:void 0;return p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C;return p().w(function(r){for(;;)switch(r.n){case 0:if(o=[],Ln(t)){r.n=1;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),r.a(2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:o});case 1:if(a=e._context.getCurrentId()){r.n=2;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),r.a(2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:o});case 2:return s=Vn(null===(i=null==n?void 0:n.video)||void 0===i?void 0:i.resolution)?n.video.resolution:exports.RCResolution.W640_H480,c=Bn(s),u=c.width,d=c.height,_=null==n?void 0:n.audio,l=null==n?void 0:n.video,r.n=3,e._getMediaStream({video:{deviceId:(null==l?void 0:l.cameraId)?{exact:null==l?void 0:l.cameraId}:void 0,frameRate:Fn((null==l?void 0:l.frameRate)||exports.RCFrameRate.FPS_15),width:{ideal:u,max:u},height:{ideal:d,max:d},facingMode:null==l?void 0:l.faceMode},audio:{deviceId:(null==_?void 0:_.micphoneId)?{exact:null==_?void 0:_.micphoneId}:void 0,sampleRate:null==_?void 0:_.sampleRate,noiseSuppression:null==_?void 0:_.noiseSuppression,echoCancellation:null==_?void 0:_.echoCancellation,autoGainControl:null==_?void 0:_.autoGainControl}});case 3:if(f=r.v,h=f.stream,(R=f.code)===exports.RCRTCCode.SUCCESS){r.n=4;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.FAILED,code:R,msg:e._getMediaStreamErrorReason(R)})),r.a(2,{code:R,tracks:o});case 4:g=h.getTracks(),m=0;case 5:if(!(m<g.length)){r.n=9;break}if("video"!==(C=g[m]).kind){r.n=7;break}return r.n=6,e._applyVideoAspectRatio(C,u,d);case 6:o.push(new Cn(e._logger,t,a,C)),r.n=8;break;case 7:o.unshift(new mn(e._logger,t,a,C));case 8:m++,r.n=5;break;case 9:return e._logger.info(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.SUCCESSED,trackIds:o.map(function(e){return e.getTrackId()})})),r.a(2,{code:R,tracks:o})}},r)})()})}},{key:"createScreenVideoTrack",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"screenshare",n=arguments.length>1?arguments[1]:void 0;return p().m(function r(){var i;return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,e._createScreenTracks(t,!1,ye.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,n);case 1:if((i=r.v).code!==exports.RCRTCCode.SUCCESS){r.n=2;break}return r.a(2,{code:i.code,track:i.tracks[0]});case 2:return r.a(2,i)}},r)})()})}},{key:"createScreenWithAudioTracks",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"screenshare",n=arguments.length>1?arguments[1]:void 0;return p().m(function r(){return p().w(function(r){for(;;)if(0===r.n)return r.a(2,e._createScreenTracks(t,!0,ye.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O,n))},r)})()})}},{key:"_createScreenTracks",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h,R,g;return p().w(function(i){for(;;)switch(i.n){case 0:if(Ln(e)){i.n=1;break}return this._logger.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),i.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(o=this._context.getCurrentId()){i.n=2;break}return this._logger.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),i.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 2:if(Hn()){i.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),i.a(2,{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT});case 3:if(a=/macintosh|mac os x/i.test(navigator.userAgent),s=(!this._isElectron||!a)&&t,c=Vn(null==r?void 0:r.resolution)?r.resolution:exports.RCResolution.W1280_H720,!this._isElectron){i.n=5;break}return i.n=4,this._createElectronScreenStream(t,n,c,null==r?void 0:r.chromeMediaSourceId);case 4:g=i.v,i.n=7;break;case 5:return i.n=6,this._createWebScreenStream(t,c,null==r?void 0:r.frameRate);case 6:g=i.v;case 7:if(d=(u=g).stream,(_=u.code)===exports.RCRTCCode.SUCCESS){i.n=8;break}return this._logger.error(n,JSON.stringify({status:Le.FAILED,code:_,msg:this._getMediaStreamErrorReason(_)})),i.a(2,{code:_});case 8:return l=d.getVideoTracks()[0],f=new vn(this._logger,e,o,l),h=[f],s&&(R=d.getAudioTracks()[0])&&h.push(new Tn(this._logger,e,o,R)),this._logger.info(n,JSON.stringify({status:Le.SUCCESSED,trackIds:h.map(function(e){return e.getTrackId()})})),i.a(2,{code:_,tracks:h})}},i,this)}))}},{key:"_createElectronScreenStream",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f;return p().w(function(i){for(;;)switch(i.n){case 0:if(s=/macintosh|mac os x/i.test(navigator.userAgent),this._isElectron&&s&&e&&this._logger.warn(t,JSON.stringify({status:Le.INFO,code:exports.RCRTCCode.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO,msg:"mac in electron not support screen share with audio"})),c=(!this._isElectron||!s)&&e,!this._isElectron||P(r)||O(r)){i.n=1;break}return this._logger.error(t,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.chromeMediaSourceId type is string"})),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return u=Bn(n),d=u.width,_=u.height,l={mandatory:{chromeMediaSourceId:r,chromeMediaSource:"desktop",minWidth:d,maxWidth:d,minHeight:_,maxHeight:_}},!r&&this._isElectron&&(null===(o=l.mandatory)||void 0===o||delete o.chromeMediaSourceId),f=null,c&&this._isElectron&&(null===(a=l.mandatory)||void 0===a||delete a.chromeMediaSourceId,f={mandatory:{chromeMediaSource:"desktop"}}),i.a(2,this._getMediaStream({video:l,audio:f||c},"getUserMedia"))}},i,this)}))}},{key:"_createWebScreenStream",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)if(0===r.n)return i=Bn(t),o=i.width,a=i.height,s={frameRate:Fn(n||exports.RCFrameRate.FPS_15),width:o,height:a},r.a(2,this._getMediaStream({video:s,audio:e},"getDisplayMedia"))},r,this)}))}},{key:"createLocalAudioTrack",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i;return p().w(function(n){for(;;)switch(n.n){case 0:if(Ln(e)){n.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),n.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind){n.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not audio"})),n.a(2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED});case 2:if(r=this._context.getCurrentId()){n.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),n.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 3:return i=new ln(this._logger,e,r,t),this._logger.info(ye.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:i.getTrackId()})),n.a(2,{code:exports.RCRTCCode.SUCCESS,track:i})}},n,this)}))}},{key:"createLocalVideoTrack",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i;return p().w(function(n){for(;;)switch(n.n){case 0:if(Ln(e)){n.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),n.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(t&&t instanceof MediaStreamTrack&&"video"===t.kind){n.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not video"})),n.a(2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED});case 2:if(r=this._context.getCurrentId()){n.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),n.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 3:return i=new pn(this._logger,e,r,t),this._logger.info(ye.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:i.getTrackId()})),n.a(2,{code:exports.RCRTCCode.SUCCESS,track:i})}},n,this)}))}},{key:"_validateCreateLocalFileTracks",value:function(e,t){if(!Ln(e))return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),{code:exports.RCRTCCode.INVALID_TAGS,tracks:[]};if(!Jn())return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,tracks:[]};var n=t instanceof File?URL.createObjectURL(t):t;return D(n)||/^blob:/.test(n)?this._context.getCurrentId()?{code:exports.RCRTCCode.SUCCESS,tracks:[],url:n}:(this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),{code:exports.RCRTCCode.INVALID_USER_ID,tracks:[]}):(this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> file"})),{code:exports.RCRTCCode.PARAMS_ERROR,tracks:[]})}},{key:"createLocalFileTracks",value:function(t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s=this;return p().w(function(i){for(;;)switch(i.n){case 0:if((o=this._validateCreateLocalFileTracks(t,n)).code===exports.RCRTCCode.SUCCESS){i.n=1;break}return i.a(2,o);case 1:return a=this._context.getCurrentId(),i.a(2,new Promise(function(n){var i=document.createElement("video");(null==r?void 0:r.withoutAudio)&&(i.muted=!0),i.onloadedmetadata=function(){var o,c=[];try{var u=i.mozCaptureStream?"mozCaptureStream":"captureStream";o=i[u]()}catch(e){s._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"captureSteam error -> ".concat(JSON.stringify(e))})),n({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:c})}var d=m(e.getTracksWithOptions(o,r),2),_=d[0],l=d[1];_&&c.push(new gn(s._logger,t,a,_,i)),l&&c.push(new Rn(s._logger,t,a,l,i)),0===c.length&&(i.pause(),i.src=""),i.onerror=null,s._logger.info(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.SUCCESSED,trackIds:c.map(function(e){return e.getTrackId()})})),n({code:exports.RCRTCCode.SUCCESS,tracks:c})},i.onerror=function(){s._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"Failed to create file stream, video onerror"})),n({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:[]})},i.src=o.url,i.loop=!0,i.play()}))}},i,this)}))}},{key:"createLocalTracks",value:function(t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=[],Ln(t)){i.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),i.a(2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:o});case 1:if(n instanceof MediaStream){i.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> stream"})),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:o});case 2:if(a=this._context.getCurrentId()){i.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),i.a(2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:o});case 3:return s=e.getTracksWithOptions(n,r),c=m(s,2),u=c[0],d=c[1],u&&o.push(new ln(this._logger,t,a,u)),d&&o.push(new pn(this._logger,t,a,d)),this._logger.info(ye.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.SUCCESSED,trackIds:o.map(function(e){return e.getTrackId()})})),i.a(2,{code:exports.RCRTCCode.SUCCESS,tracks:o})}},i,this)}))}},{key:"_applyVideoAspectRatio",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c;return p().w(function(r){for(;;)switch(r.p=r.n){case 0:if(i=e.getSettings(),o=i.width,a=i.height,o!==t||a!==n){r.n=1;break}return r.a(2);case 1:return s=t/n>=1?{width:{ideal:o,max:o}}:{height:{ideal:a,max:a}},r.p=2,r.n=3,e.applyConstraints(Object.assign(Object.assign({},s),{aspectRatio:{ideal:t/n}}));case 3:this._logger.info(ye.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O,JSON.stringify({status:Le.SUCCESSED,msg:"apply aspectRatio success -> ".concat(t," / ").concat(n)})),r.n=5;break;case 4:r.p=4,c=r.v,this._logger.warn(ye.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O,JSON.stringify({status:Le.FAILED,msg:"apply aspectRatio error -> ".concat(JSON.stringify(c))}));case 5:return r.a(2)}},r,this,[[2,4]])}))}}],[{key:"getTracksWithOptions",value:function(e,t){var n=[];return n[0]=(null==t?void 0:t.withoutAudio)?void 0:e.getAudioTracks()[0],n[1]=(null==t?void 0:t.withoutVideo)?void 0:e.getVideoTracks()[0],n}}])}(),tu=function(){return a(function e(n){i(this,e),Xc.add(this),Object.defineProperty(this,"pbModules",{enumerable:!0,configurable:!0,writable:!0,value:void 0});var r=t.ProtoBuf.loadProto(n);this.pbModules=r.build("Modules").probuf},[{key:"encode",value:function(e,t){return this.pbModules[e].encode(t).toArrayBuffer()}},{key:"decode",value:function(e,t){try{var n=this.pbModules[e].decode(t);return q(this,Xc,"m",$c).call(this,n)}catch(t){var r="name: ".concat(e,", stack: ").concat(t.stack);throw null===console||void 0===console||console.error("pb decode error!",r),t}}}])}();Xc=new WeakSet,$c=function e(n){var r,i=this;if(n instanceof Array)return n.map(function(t){return q(i,Xc,"m",e).call(i,t)});if(r=n,"[object Object]"!==Object.prototype.toString.call(r))return n;if(n instanceof t.ProtoBuf.ByteBuffer)return n.toArrayBuffer();if(n instanceof t.ProtoBuf.Long)return n.toNumber();var o={};return Object.keys(n).forEach(function(t){o[t]=q(i,Xc,"m",e).call(i,n[t])}),o};var nu,ru,iu,ou,au,su,cu;!function(e){e[e.PERSON=1]="PERSON",e[e.PERSONS=2]="PERSONS",e[e.GROUP=3]="GROUP",e[e.TEMPGROUP=4]="TEMPGROUP",e[e.CUSTOMERSERVICE=5]="CUSTOMERSERVICE",e[e.NOTIFY=6]="NOTIFY",e[e.MC=7]="MC",e[e.MP=8]="MP",e[e.ULTRAGROUP=10]="ULTRAGROUP"}(nu||(nu={})),function(e){e[e.IMAGE=1]="IMAGE",e[e.AUDIO=2]="AUDIO",e[e.VIDEO=3]="VIDEO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT",e[e.COMBINE_HTML=6]="COMBINE_HTML"}(ru||(ru={})),function(e){e[e.GROUP_SUCCESS=0]="GROUP_SUCCESS",e[e.GROUP_FAILURE=1]="GROUP_FAILURE"}(iu||(iu={})),function(e){e[e.IsSilent=1]="IsSilent",e[e.IsTop=2]="IsTop",e[e.Tags=3]="Tags",e[e.AutoTrans=4]="AutoTrans"}(ou||(ou={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(au||(au={})),function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(su||(su={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(cu||(cu={})),new tu("package Modules;\nmessage probuf {\n message SetUserStatusOutput {\n optional int32 nothing=1;\n }\n message GetUserStatusInput {\n optional int32 nothing=1;\n }\n message GetUserStatusOutput {\n optional string status=1;\n optional string subUserId=2;\n }\n message SubUserStatusInput {\n repeated string userid =1;\n }\n message SubUserStatusOutput {\n optional int32 nothing=1;\n }\n message VoipDynamicInput {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n message VoipDynamicOutput {\n required string dynamicKey=1;\n }\n message NotifyMsg {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message SyncRequestMsg {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n optional int64 endTime = 8;\n optional bool compressioEnabled = 9;\n }\n message UpStreamMessage {\n required int32 sessionId = 1;\n required string classname = 2;\n required string content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string toUserIds = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n optional string busChannel = 13;\n optional string systemId = 16;\n optional string senderPortrait = 21;\n optional int64 optionBits = 22;\n }\n message PushExtra {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message DownStreamMessages {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n optional int64 systemTime = 5;\n optional int64 credibleStartTime = 6;\n optional int64 credibleEndTime = 7;\n optional bool compressioEnabled = 8;\n optional bytes compressedData = 9;\n }\n message ChrmDownStreamMessages {\n repeated bytes list = 1;\n required int64 syncTime = 2;\n optional bool compressioEnabled = 3;\n optional bytes compressedData = 4;\n }\n message DownStreamMessage {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required string content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19;\n optional int64 extStatus = 20;\n repeated string toUserIds = 21;\n optional int32 groupUnpush = 22;\n optional int64 optionBits = 23;\n optional string convertExt = 24;\n optional ExtMsgData extMsgData = 25;\n }\n message ExtMsgData {\n optional int64 seqId = 1;\n optional int64 sendTime = 2;\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n IMAGE = 1;\n AUDIO = 2;\n VIDEO = 3;\n FILE = 4;\n SIGHT = 5;\n COMBINE_HTML = 6;\n }\n message GetQNupTokenInput {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n optional string url = 5;\n optional string ext = 6;\n optional int64 size = 7;\n optional int32 ipType = 8;\n }\n message GetQNdownloadUrlInput {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message GetDownloadUrlInput {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n optional string ext = 4;\n optional int64 size = 5;\n optional int32 ipType = 6;\n }\n message GetQNupTokenOutput {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n\n optional string minioAuthorization = 20;\n optional string minioContentSha256 = 21;\n optional string minioDate = 22;\n optional string minioBucketName = 23;\n\n optional string downloadAuthInfo = 24;\n optional string ossConfig = 25;\n }\n message GetQNdownloadUrlOutput {\n required string downloadUrl = 1;\n }\n message GetDownloadUrlOutput {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n GROUP_SUCCESS = 0x00;\n GROUP_FAILURE = 0x01;\n }\n message ChrmInput {\n required int32 nothing = 1;\n optional string extra = 2;\n }\n message ChrmOutput {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n optional int64 createTime = 4;\n optional int32 memberCount = 5;\n optional int32 chatroomBanState = 6;\n optional int32 whiteListState = 7;\n }\n message ChrmPullMsg {\n required int64 syncTime = 1;\n required int32 count = 2;\n optional int32 pullMsgType = 3;\n optional bool compressioEnabled = 4;\n }\n message ChrmPullMsgNew {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message RelationQryInput {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n optional bool isEraseMsgContent = 5;\n optional int64 endTime = 6;\n optional bool compressioEnabled = 7;\n optional int32 qryType = 8;\n }\n message RelationsOutput {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;\n optional int64 pullTime = 3;\n optional bool compressioEnabled = 4; \n optional bytes compressedData = 5;\n }\n message RelationInfo {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;\n optional int64 versionTime = 7;\n optional int64 remindCount = 8;\n optional int32 busChannelType = 9;\n optional UnreadMsgInfo msgInfo = 10;\n optional int32 remindMeCount = 11;\n }\n message UnreadMsgInfo {\n required string msgId = 1;\n required int64 msgTime= 2;\n optional int32 remindType= 3;\n optional string className = 4;\n }\n message QryRemindListReq {\n required string groupId = 1;\n optional string busChannel = 2;\n optional int64 msgTime = 3;\n optional int32 size = 4;\n }\n message QryRemindListResp {\n repeated UnreadMsgInfo msgInfo = 1;\n }\n message RelationInfoReadTime {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message CleanHisMsgInput {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4;\n }\n message CleanMsgBatchReq {\n repeated CleanHisMsgInput input = 1;\n }\n message HistoryMessageInput {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n optional int64 credibleStartTime = 4;\n optional int64 credibleEndTime = 5;\n optional bool compressioEnabled = 6; \n optional bytes compressedData = 7;\n }\n message QueryChatRoomInfoInput {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message QueryChatRoomInfoOutput {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput {\n required string id = 1;\n }\n\n message MPFollowOutput {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MCFollowOutput {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message HistoryMsgInput {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5;\n optional bool compressioEnabled = 6;\n optional bool ignoreCmd = 10;\n }\n\n message HistoryMsgOuput {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n optional int64 credibleStartTime = 4;\n optional int64 credibleEndTime = 5;\n optional bool compressioEnabled = 6;\n optional bytes compressedData = 7;\n }\n message SessionsAttQryInput {\n required int32 nothing = 1;\n }\n message SessionsAttOutput {\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message SessionMsgReadInput {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;\n }\n message SessionMsgReadOutput {\n optional int32 nothing=1;\n }\n message DeleteSessionsInput {\n repeated SessionInfo sessions = 1;\n }\n message SessionInfo {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 unreadCount = 3;\n optional string busChannel = 4;\n }\n message QuerySessionsInput {\n repeated SessionInfo sessions = 1;\n }\n message QuerySessionsOutPut {\n repeated SessionInfo sessions = 1;\n }\n message DeleteSessionsOutput {\n optional int32 nothing=1;\n }\n message RelationDelBatchReq {\n repeated RelationOpInput relation = 1;\n optional bool cleanMsg = 2;\n }\n message RelationOpInput {\n required string conversationId = 1;\n required ChannelType conversationType = 2;\n optional string busChannel = 3;\n }\n message DeleteMsgInput {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4;\n }\n message DeleteMsg {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\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 optional int64 version = 6;\n }\n message SetChrmKV {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message SetChrmKVS {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message DeleteChrmKVS {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ChrmKVOutput {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n optional bool compressioEnabled = 4; \n optional bytes compressedData = 5;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message ChrmKVSOutput {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ChrmKVSOutputEntity {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message QueryChrmKV {\n required int64 timestamp = 1;\n optional bool compressioEnabled = 2;\n }\n message SetUserSettingInput {\n required int64 version=1;\n required string value=2;\n optional bool ignoreVersion = 3;\n }\n message SetUserSettingOutput {\n required int64 version=1;\n required bool reserve=2;\n optional bool updateVersion = 3;\n }\n message PullUserSettingInput {\n required int64 version=1;\n optional bool reserve=2;\n optional int32 ipType = 3;\n }\n message PullUserSettingOutput {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message SessionReq {\n required int64 time = 1;\n }\n message SessionStates {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message SessionState {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;\n }\n message SessionStateItem {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n optional int64 time = 4;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n AutoTrans = 4;\n }\n message SessionStateModifyReq {\n required int64 version=1;\n repeated SessionState state= 2;\n optional bool ignoreVersion = 3;\n }\n message GroupUnpushQuery {\n optional string busChannel = 1;\n }\n message GroupUnpushSet{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message GroupUnpushResult {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message SessionStateModifyResp {\n required int64 version=1;\n optional bool updateVersion = 2;\n }\n message TypeUnpushInput {\n required ChannelType type = 1;\n required int64 version = 2;\n required int32 unpushLevel = 3;\n optional bool ignoreVersion = 4;\n }\n message TypeUnpushOutput {\n required int64 version = 1;\n optional bool updateVersion = 2;\n }\n message GrpReadReceiptMsg {\n repeated string msgId=1;\n optional string channelId = 2;\n }\n message GrpReadReceiptQryReq {\n repeated string msgId=1;\n optional string channelId = 2;\n }\n message ReadReceipt {\n optional string targetId = 1;\n optional int32 type = 2;\n optional string channelId = 3;\n optional int32 readType =4 ;\n repeated string msgIds= 5 ;\n optional string fromId = 6;\n }\n message QueryReceiptReq {\n optional string targetId = 1;\n optional string busChannel =2;\n optional int32 type = 3;\n repeated string msgIds = 4;\n optional int32 qryType = 5;\n optional int32 order =6;\n optional bool compress = 7;\n optional int32 readType = 8;\n optional int32 pageType = 9; \n optional int32 pageSize = 10;\n optional string pageToken = 11;\n repeated string users = 12;\n }\n message QueryReceiptBatchReq {\n repeated QueryReceipt items = 1;\n optional bool compress = 2;\n }\n message QueryReceipt {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 type = 3;\n repeated string msgIds = 4;\n }\n message ReceiptResp {\n repeated QueryReceiptRespItem resp = 1;\n optional bool compress = 2;\n optional bytes compressData = 3;\n optional string pageToken = 4;\n }\n message QueryReceiptBatchResp {\n repeated QueryReceiptBatchRespItem item = 1;\n optional bool compress = 2;\n optional bytes compressData = 3;\n }\n\n message QueryReceiptBatchRespItem {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 type = 3;\n repeated QueryReceiptRespItem msg = 4;\n }\n message QueryReceiptRespItem {\n optional string msgId = 1;\n optional int64 msgTime = 2;\n optional int32 totalCnt = 3;\n optional int64 readCnt = 4;\n repeated ReceiptUser readUser = 5;\n repeated string unreadList = 6;\n optional int64 unreadCnt = 7;\n repeated ReceiptUser unreadUser = 8;\n }\n message GrpReadReceiptQryResp {\n required int32 totalMemberNum = 1;\n repeated GrpMsgReadUser list = 2;\n }\n message GrpMsgReadUser {\n required int64 readTime = 1;\n required string userId = 2;\n }\n message SessionTagAddInput {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n optional bool ignoreVersion = 3;\n }\n message SessionTagItem {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message SessionTagDelInput {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n optional bool ignoreVersion = 3;\n }\n message SessionDisTagReq {\n repeated string tagId=1;\n }\n message UserSettingNotification {\n required int64 version=1;\n required bool reserve=2;\n }\n message ReportSDKInput {\n required string sdkInfo=1;\n }\n message ReportSDKOutput {\n optional int32 nothing=1;\n }\n message UltraGrpPullSes {\n required int64 syncTime = 1;\n optional bool isEraseMsgContent = 2;\n }\n message UltraGrpPullMsg {\n required int64 syncTime = 1;\n optional bool compressioEnabled = 2;\n }\n message MsgChangeReq {\n required string fromUserId = 1;\n required string targetId = 2;\n required ChannelType type = 3;\n required string msgUID = 4;\n required int64 msgTime = 5;\n optional string busChannel = 6;\n optional string content = 7;\n }\n message ModifyMsgResp {\n optional int64 modifyTime = 1;\n optional DownStreamMessage msg = 2;\n }\n message QueryMsgChange {\n required int64 syncTime = 1;\n optional int32 needCompress = 2;\n optional int64 onlineTime = 3;\n optional string targetId = 4;\n }\n message EventChangeList {\n repeated EventChange list = 1;\n required int64 syncTime = 2;\n optional bool hasNext = 3 ;\n optional string targetId = 4;\n optional bool isCompress = 5 ;\n }\n message EventChange {\n optional string businessId = 1;\n optional ChannelType channelType = 2;\n optional int64 time = 3;\n optional int32 changeType = 4;\n optional string originalId = 5;\n optional int64 originalTime = 6;\n optional string secondaryId = 7;\n optional bool isAdmin = 8;\n optional bool additionalMark = 9; \n optional string operatorId = 10;\n optional int32 subChangeType = 11;\n optional int32 secondaryType = 12;\n optional bool isRemindMe = 13;\n repeated string extIds = 14;\n optional int32 remindType = 15;\n optional bytes eventData = 16;\n }\n message MsgChangeList {\n repeated MsgChange list = 1;\n required int64 syncTime = 2;\n optional bool hasNext = 3 ;\n }\n message MsgChange {\n required string targetId = 1;\n required ChannelType type = 2;\n required int64 time = 3;\n required int32 changeType = 4;\n required string msgUID = 5;\n required int64 msgTime = 6;\n optional string busChannel = 7;\n optional bool isAdmin = 8;\n optional bool isDel = 9;\n optional string operatorId = 10;\n optional int32 subChangeType = 11;\n optional int32 busChannelType = 12;\n optional bool isRemindMe = 13;\n repeated string userGroupIds = 14;\n optional int32 remindType = 15;\n }\n message MsgQuery {\n required string targetId = 1;\n required ChannelType type = 2;\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo {\n required int64 msgTime = 1;\n required string msgUID = 2;\n optional string busChannel = 3;\n }\n message MsgQueryAck {\n repeated DownStreamMessage list = 1;\n repeated string notExistMsgId = 2;\n }\n message OperateStatus {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional int32 opType = 3;\n optional string busChannel = 4;\n }\n message OperateStatusNotify {\n optional ChannelType type = 1;\n optional int64 notifyType = 2;\n repeated OperateInfo info = 3 ;\n repeated OperateSummary summary = 4 ;\n }\n message OperateInfo {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional string userId = 3;\n optional int32 opType = 4;\n optional int64 optime = 5;\n }\n \n message OperateSummary {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 count = 3;\n optional int32 opType = 4;\n }\n\n message SetRtcRoomIdInput {\n required string rtcRoomId= 1;\n }\n message SetRtcRoomIdOutput {\n required int32 nothing = 1;\n }\n message CallInfoUpStream {\n required string key= 1;\n required string dataContent=2;\n }\n message CallInfoDownStream {\n required string key= 1;\n required string dataContent=2;\n required int64 maxTime=3;\n }\n message KvInput {\n required int64 syncTime = 1;\n }\n message KvOutput {\n required int64 maxTime = 1;\n repeated KvInfo info = 2;\n }\n message KvInfo {\n required string key =1;\n required string value =2;\n }\n message ReadReceiptMsg {\n required string targetId = 1;\n required ChannelType type = 2;\n optional string busChannel = 3;\n optional string startMsgId = 4;\n optional string endMsgId = 5;\n }\n message ReceiptQryReq {\n required string msgId = 1;\n optional string busChannel = 2;\n required string targetId = 3;\n }\n message QueryReceiptResp {\n optional int32 num = 1;\n repeated ReceiptUser list = 2;\n optional int32 readCnt = 3;\n }\n message ReceiptUser {\n optional int64 receiptTime = 1;\n optional string userId = 2;\n optional string name = 3;\n optional string portrait = 4;\n optional bool mentioned= 5;\n }\n message ReceiptCntQryReq {\n optional ChannelType type = 1;\n optional string channelId = 2;\n optional string busChannel = 3;\n repeated string msgId = 4;\n }\n message ReceiptCntQryResp {\n repeated MsgReadCnt result= 1;\n }\n\n message MsgReadCnt {\n optional string msgId = 1;\n optional int32 cnt = 2;\n optional int32 tmn = 3;\n }\n message UpdateUserSubReq {\n optional int32 subType = 1;\n repeated UserSubDetail subUsers = 2;\n optional int32 opType = 3;\n optional int32 expiry = 4;\n }\n message UserSubDetail {\n optional string subUserId = 1;\n }\n message UpdateUserSubResp {\n repeated UserSubDetail subUsers = 1;\n optional int64 subTime = 2;\n }\n message PullUserSubReq {\n optional int64 version = 1;\n optional string pageToken = 2;\n }\n message PUllUserSubResp {\n repeated UserSubList list = 1;\n optional int64 version = 2;\n optional bool hasNext = 3;\n optional string pageToken = 4;\n optional bool isFull = 5;\n }\n message UserSubList {\n repeated UserSubDetail subUsers = 1;\n optional int32 subType = 2;\n optional int64 subTime = 3;\n optional int32 expiry = 4;\n optional int32 opType = 5;\n }\n message PullSubDataReq {\n optional int64 versionTime = 1;\n optional bool needAllData = 2;\n optional string pageToken = 3;\n }\n message PullSubDataResp {\n repeated SubDataDetail list = 1;\n optional int64 versionTime = 2;\n optional bool hasNext = 3;\n optional string pageToken = 4;\n optional bool isFull = 5;\n }\n message SubDataDetail {\n optional string statusStr = 1;\n optional string subUserId = 2;\n repeated SubData data = 3;\n optional int32 subType = 4;\n }\n\n message SubData {\n optional int32 platformInfo = 1;\n optional int32 value = 2;\n optional int64 versionTime = 3;\n }\n message QrySubDataReq {\n optional int32 subType = 1;\n repeated UserSubDetail subUsers = 2;\n }\n message UserProfile {\n optional int64 version = 1;\n optional string userId = 2;\n repeated ProfileInfo userProfile = 3;\n repeated ProfileInfo userExtProfile = 4;\n }\n message ProfileInfo {\n optional string key = 1;\n optional string value = 2;\n }\n message SetUserProfileResp {\n optional int64 version = 1;\n optional string key = 2;\n repeated string censorFailedFields = 3;\n }\n message PullUserProfileReq {\n repeated string userId = 1;\n }\n message UserProfiles {\n repeated UserProfile UserProfile = 1;\n }\n message UserProfileInput {\n required int32 nothing = 1;\n }\n message UserProfilePermission {\n optional int32 permission = 1;\n }\n message UserProfileOutput {\n required int32 nothing = 1;\n }\n message SearchUserProfile {\n optional string uniqueId = 1;\n }\n message ChannelsInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated ProfileInfo settingProfile = 3;\n repeated ProfileInfo extProfile = 4;\n optional ChannelBaseInfo baseInfo = 5;\n repeated string users = 6;\n }\n\n message ChannelBaseInfo {\n optional string creatorId = 1;\n optional string ownerId = 2;\n optional int64 createTime = 3;\n optional int32 memberCount = 4;\n }\n\n message ChannelsOutput {\n optional int64 operateTime = 1;\n optional int32 flag = 2;\n optional string msg = 3;\n optional int32 processCode = 4;\n optional ChannelsJoinedInfo channelInfo = 5;\n repeated ChannelsUserInfo userInfos = 6;\n optional FriendInviteInfo friendInviteInfo = 7;\n optional FriendUserInfo friendUserInfo = 8;\n repeated string censorFailedFields = 9;\n }\n\n message MultiChannels {\n optional ChannelType type = 1;\n repeated ChannelsInput list = 2;\n }\n\n message ModifyChannelsInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional QuitChannelsSetting settingInfo = 3;\n repeated string users = 4;\n optional int32 operateType = 5;\n }\n\n message QuitChannelsSetting {\n optional bool isQuit = 1;\n optional bool isDelBan = 2;\n optional bool isDelWhite = 3;\n optional bool isDelAttention = 4;\n }\n\n message ChannelsQueryInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional ChannelsPageParam page = 3;\n repeated string ids = 4;\n optional int32 roleType = 5;\n }\n\n message ChannelsPageParam {\n optional int32 size = 1;\n optional string pageToken = 2;\n optional bool hasNext = 3 ;\n optional int32 total = 4 ;\n optional int32 order = 5 ;\n }\n\n message ChannelsListResult {\n optional int32 listType = 1;\n optional bytes result = 2;\n optional ChannelsPageParam page = 3;\n }\n \n message ChannelsInviteStatusInfos {\n repeated ChannelsInviteStatusInfo list = 1;\n }\n \n message ChannelsUserInfos {\n repeated ChannelsUserInfo list = 1;\n }\n \n message ChannelsJoinedInfos {\n repeated ChannelsJoinedInfo list = 1;\n }\n\n message ChannelsUserInfo {\n optional string userId = 1;\n optional ChannelsUserExtInfo ext = 2;\n optional int64 opTime = 3;\n optional string name = 4;\n optional string portraitUrl = 5;\n }\n\n message ChannelsUserExtInfo {\n optional int32 role = 1;\n optional int64 joinTime = 2;\n optional string channelNickName = 3;\n optional string additional = 4;\n optional string remarkName = 5;\n optional bool isBan = 6;\n optional int64 banEndTime = 7;\n }\n\n message ChannelsMemberUpdateInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional string userId = 3;\n optional string channelNickName = 4;\n optional string additional = 5;\n optional int32 operateType = 6;\n }\n message ChannelsJoinedInfo {\n optional string targetId = 1;\n repeated ProfileInfo settingProfile = 2;\n repeated ProfileInfo extProfile = 3;\n optional ChannelBaseInfo baseInfo = 4;\n optional ChannelsUserExtInfo userInfo = 5;\n }\n message ChannelsInviteStatusInfo {\n optional string targetId = 1;\n optional ChannelsUserInfo joinUserInfo = 2;\n optional ChannelsUserInfo inviterInfo = 3;\n optional int32 status = 4;\n optional int32 directionType = 5;\n optional int32 joinType = 6;\n optional string detail = 7;\n optional int64 applyTime = 8;\n optional ChannelsUserInfo processInfo = 9;\n optional int64 processTime = 10;\n }\n message ChannelsMemberResponseInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional int32 optType = 3;\n optional int32 optResult = 4;\n optional string joinUserId = 5;\n optional string inviterId = 6;\n optional string detail = 7;\n }\n message ChannelsMembersInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated string userIds = 3;\n }\n message FriendInput {\n optional string targetId = 1;\n optional int32 type = 2;\n optional string info = 3;\n }\n message FriendsOutput {\n repeated FriendOutput list = 1;\n }\n message FriendOutput {\n optional string userId = 1;\n optional int64 operateTime = 2;\n optional string flag = 3;\n }\n message FriendsInput {\n repeated string targetId = 1;\n optional int32 type = 2;\n }\n message FriendsCheckOutput {\n repeated FriendCheckOutput list = 1;\n }\n\n message FriendCheckOutput {\n optional string targetId = 1;\n optional int32 status = 2;\n }\n message FriendProfileInput {\n optional string targetId = 1;\n optional string remarkName = 2;\n repeated ProfileInfo extProfile = 3;\n }\n message FriendProfileOutput {\n repeated string censorFailedFields = 1;\n }\n message FriendQueryInput {\n optional int32 queryType = 1;\n optional ChannelsPageParam page = 2;\n optional int32 friendType= 3;\n }\n message FriendUserInfo {\n optional string userId = 1;\n optional int64 relationTime = 2;\n optional int32 friendType = 3;\n optional int32 flag = 4;\n optional string remarkName = 5;\n optional string name = 6;\n optional string portraitUrl = 7;\n repeated ProfileInfo extProfile = 8;\n \n }\n message FriendInviteInfo {\n optional string userId = 1;\n optional string name = 2;\n optional string portraitUrl = 3;\n optional int32 type = 4;\n optional int32 status = 5;\n optional int64 operateTime = 6;\n optional string info = 7;\n optional int32 friendType = 8;\n }\n message FriendsListInput {\n repeated string targetId = 1;\n optional int32 type = 2;\n }\n message FriendLevelSet {\n optional int32 level = 1;\n }\n\n message FriendPageParam {\n optional int32 size = 1;\n optional string pageToken = 2;\n }\n message FriendUserInfos {\n repeated FriendUserInfo list = 1;\n }\n\n message FriendInviteInfos {\n repeated FriendInviteInfo list = 1;\n }\n \n message FriendApplyEvent {\n optional int32 applyType = 1;\n optional int32 friendType = 2;\n optional string info = 3;\n optional string name = 4;\n optional string portraitUrl = 5;\n }\n message UpdateChannnelInfo {\n optional ChannelsJoinedInfo channelInfo = 1;\n optional ChannelsUserInfo userInfo = 2;\n }\n message UpdateUserInfo {\n optional ChannelsUserInfo updatedUserInfo = 1;\n optional ChannelsUserInfo optUserInfo = 2;\n }\n message ChannelApplyInfo {\n repeated ChannelsInviteStatusInfo statusInfo = 1;\n }\n message ChannelEventData {\n optional ChannelsUserInfo optUserInfo = 1;\n optional ChannelsJoinedInfo channelInfo = 2;\n repeated ChannelsUserInfo userInfos = 3;\n optional ChannelsJoinedInfo channelFullInfo = 4;\n }\n message FriendTypeChangeEvent {\n optional string friendId = 1;\n optional int32 friendType = 2;\n }\n message FriendUpdateEvent {\n optional string remarkname = 1;\n repeated ProfileInfo extProfile = 2;\n }\n message AddUnpushPeriodInput {\n required string startTime = 1;\n required int32 spanMinutes = 2;\n optional int32 level = 3;\n optional string timezone = 4;\n }\n message DeleteUnpushPeriodInput {\n required int32 nothing = 1;\n }\n message QueryUnpushPeriodInput {\n required int32 nothing = 1;\n }\n message QueryUnpushPeriodOutput {\n required int32 isUnpush = 1;\n optional string startTime = 2;\n optional int32 spanMinutes = 3;\n optional int32 level = 4;\n optional string timezone = 5;\n }\n message RelationDel {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated string busChannel = 3;\n optional bool cleanMsg = 4;\n }\n message MsgReadEvent {\n optional string msgId = 1;\n optional int64 msgTime = 2;\n optional int32 totalCnt = 3;\n optional int32 readCnt = 4;\n optional int32 unreadCnt = 5;\n repeated ReceiptUser readList =6;\n }\n message ConvertMsgInput {\n optional int32 businessType = 1;\n optional bytes businessInfo = 2;\n }\n message SpeechToTextInfo {\n optional string msgId = 1;\n optional string objectName = 2;\n optional string content = 3;\n optional int32 sampleRate = 4;\n optional int32 channelNumber = 5;\n optional string format = 6;\n optional string extra = 7;\n }\n message ConvertMsgOutput {\n optional int32 businessType = 1;\n optional bytes businessResult = 2;\n }\n message SpeechToTextResult {\n optional string result = 1;\n optional string message = 2;\n }\n message TransReq {\n repeated TransInfo transInfos = 1;\n optional int32 model = 2;\n optional bool forceTrans = 3;\n }\n message TransResp {\n repeated TransResult results = 1;\n optional int32 model = 2;\n }\n message TransInfo {\n optional string messageUID = 1;\n optional int32 transType = 2;\n optional string text = 3;\n optional string transFileUrl = 4;\n optional string sourceLan = 5;\n optional string targetLan = 6;\n optional int32 inputSource = 7;\n }\n message TransResult {\n optional string messageUID = 1;\n optional string transResult = 2;\n optional string sourceLan = 3;\n optional string targetLan = 4;\n optional int32 code = 5;\n optional int32 inputSource = 6;\n }\n message PullModifyMsgReq { \n optional int64 pullVersion = 1;\n optional bool compress = 2;\n repeated int32 modifyType = 3;\n }\n message PullModifyMsgResp {\n repeated ModifyMsg msg = 1;\n optional int64 nextVersion = 2;\n optional bool finished = 3;\n optional bool compress = 4;\n optional bytes compressedData = 5;\n }\n message ModifyMsg {\n optional int32 modifyType = 1;\n optional DownStreamMessage msg = 2;\n }\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 SetUserStatusInput {\n optional int32 status=1;\n }\n message MCFollowInput {\n required string state = 1;\n }\n message RtcQueryListInput {\n optional int32 order=1;\n }\n message RtcKeyDeleteInput {\n repeated string key=1;\n }\n message RtcValueInfo {\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo {\n required string userId=1;\n repeated RtcValueInfo userData=2;\n }\n message RtcUserListOutput {\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4;\n repeated RtcKVEntity entries = 5;\n optional int64 syncTime = 6;\n optional int32 offlineKickTime = 7;\n }\n message RtcRoomInfoOutput {\n optional string roomId = 1;\n repeated RtcValueInfo roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message 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 RtcValueInfo innerDatas = 7;\n repeated RtcValueInfo outerDatas = 8;\n }\n message RtcQryOutput {\n repeated RtcValueInfo outInfo=1;\n }\n message 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 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 RtcUserSetDataInput {\n repeated RtcValueInfo valueInfo = 1;\n required string objectName = 2;\n repeated 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 optional int32 nothing=1;\n optional int64 version=2;\n }\n message RtcTokenOutput {\n required string rtcToken=1;\n }\n message RtcSetOutDataInput {\n required TargetType target=1;\n repeated RtcValueInfo valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message RtcQryUserOutDataInput {\n repeated string userId = 1;\n }\n message RtcUserOutDataOutput {\n repeated RtcUserInfo user = 1;\n }\n message RtcNotifyMsg {\n required int32 type= 1;\n optional int64 time= 2;\n optional string roomId=3;\n }\n message RtcPullKV {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity {\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 RtcKVOutput {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType {\n AnchorToViewer = 1;\n ViewerToAnchor = 2;\n }\n message RtcQueryUserJoinedInput {\n required string userId = 1;\n }\n message RtcJoinedInfo {\n required string deviceId = 1;\n required string roomId = 2;\n optional int64 joinTime = 3;\n }\n message RtcQueryUserJoinedOutput {\n repeated RtcJoinedInfo info = 1;\n }\n message RtcViewerJoinedOutput {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;\n optional int64 syncTime = 3;\n }\n message RtcInviteInput {\n required string invitedUserId=1;\n optional int32 timeoutTime=2;\n required string invitedRoomId=3;\n required string inviteInfo=4;\n required string inviteSessionId= 5;\n }\n message RtcCancelInviteInput {\n required string invitedUserId=1;\n required string invitedRoomId=2;\n required string inviteInfo=3;\n required string inviteSessionId=4;\n }\n message RtcInviteAnswerInput {\n required string inviteUserId=1;\n required int32 answerCode=2;\n required string inviteRoomId=3;\n required string inviteSessionId=4;\n required string content=5;\n optional string key=6;\n optional string value=7;\n }\n message RtcEndInviteInput {\n required string inviteRoomId=1;\n required string inviteSessionId=2;\n required string inviteContent=3;\n repeated string inviteRoomKeys=4;\n }\n}\n");var uu,du,_u=function(){return a(function e(t){i(this,e),Object.defineProperty(this,"pbCodec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.pbCodec=new tu(t)},[{key:"encode",value:function(e,t,n){return n?t:this.pbCodec.encode(e,t)}},{key:"decode",value:function(e,t){return this.pbCodec.decode(e,t)}}])}(),lu="rtcRJoin_data",pu="rtcRExit",fu="rtcRInfo",hu="rtcUData",Ru="rtcUDel",gu="rtcSetData",mu="userSetData",Cu="rtcQryData",vu="rtcDelData",Tu="rtcToken",Iu="rtcUserState",Su="rtcUList",Eu="viewerJoinR",Ou="viewerExitR",bu="rtcPullKv",yu="rtcIdentityChange",Lu="rtcInvite",ku="rtcCancelInvite",Au="rtcInviteAnswer",Nu="rtcEndInvite",Pu="rtcQueryJoined",Du="rtcPullRoomStatus",Uu="reportsdk",wu="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.AsrTextMsg="AsrTextMsg",e.AsrResTextMsg="AsrResTextMsg"}(du||(du={})),c(c(c(c(c(c(c(c(c(c(uu={},du.RtcInput,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas","supportNtf"]),du.RtcOutput,["version"]),du.RtcUserListOutput,["users","token","sessionId","roomInfo","version"]),du.SetUserStatusInput,["status"]),du.RtcSetDataInput,["interior","target","key","value","objectName","content"]),du.RtcUserSetDataInput,["valueInfo","objectName","content"]),du.RtcDataInput,["interior","target","key","objectName","content"]),du.RtcSetOutDataInput,["target","valueInfo","objectName","content"]),du.MCFollowInput,["state"]),du.RtcTokenOutput,["rtcToken"]),c(c(c(c(c(c(c(c(c(c(uu,du.RtcQryOutput,["outInfo"]),du.RtcQryUserOutDataInput,["userId"]),du.RtcUserOutDataOutput,["user"]),du.RtcQueryListInput,["order"]),du.RtcRoomInfoOutput,["roomId","roomData","userCount","list"]),du.RtcValueInfo,["key","value"]),du.RtcKeyDeleteInput,["key"]),du.RtcNotifyMsg,["type","time","roomId"]),du.RtcPullKV,["timestamp","roomId"]),du.RtcKVOutput,["entries","bFullUpdate","syncTime"]),c(c(c(c(c(c(c(c(c(c(uu,du.RtcQueryUserJoinedInput,["userId"]),du.RtcQueryUserJoinedOutput,["info"]),du.RtcInviteInput,["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"]),du.RtcCancelInviteInput,["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"]),du.RtcInviteAnswerInput,["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"]),du.RtcEndInviteInput,["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]),du.RtcRoomStatusInput,["version"]),du.RtcRoomStatusOutput,["bFullStatus","version","usersData","roomStatus"]),du.RtcReportSDKInput,["sdkInfo"]),du.RtcPBPolaris,["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info"]),c(c(c(c(c(c(c(c(uu,du.RtcPBR1Info,["joinTime","rtcVersion","imVersion","platform","device","os","browserName","browserVersion"]),du.RtcPBR2Info,["joinTime","sendTime","rtcActionType","rtcActionStatus","trackId"]),du.RtcPBR3Info,["info"]),du.RtcPBR4Info,["info"]),du.RtcPBStatusInfo,["joinTime","receiveTime","totalBitRate","appCPUUsage","systemCPUUsage","systemCPUFrequency","networkStatus","googleRTTNetwork","ipAddress","useReceiveBroadBand","useSendBroadBand","packetLossCount","streams"]),du.RtcPBStreamInfo,["trackId","codeName","volume","samplingRate","bitRate","packetLossRate","frameRate","resolution","blockTime","jitterData","nAckCount","pliCount","googleRTTTotalTime","isReceiveFirstFrameRate","codeType","isEnabled"]),du.AsrTextMsg,["bms","t","isEnd","msgId","lang"]),du.AsrResTextMsg,["type","uid","asr"]);var Mu,xu="\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(du.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(du.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(du.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(du.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(du.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(du.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(du.RtcRoomStatusInput,"{ // rtc 和 living room 拉房间资源状态使用的参数\n required int64 version =1; //当前客户端最大的房间状态的version\n }\n message ").concat(du.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(du.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(du.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(du.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(du.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(du.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n optional bool supportNtf = 9; //是否支持房间状态的变更通过通知拉取的方式获取\n }\n message ").concat(du.RtcQryOutput,"{\n repeated ").concat(du.RtcValueInfo," outInfo=1;\n }\n message ").concat(du.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(du.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(du.RtcUserSetDataInput," {\n repeated ").concat(du.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(du.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(du.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(du.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(du.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(du.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(du.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(du.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(du.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(du.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(du.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(du.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(du.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(du.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(du.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(du.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(du.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(du.RtcReportSDKInput,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n // ---- 北极星数据上报 -------\n message ').concat(du.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(du.RtcPBR1Info," r1Info = 10;\n optional ").concat(du.RtcPBR2Info," r2Info = 11;\n optional ").concat(du.RtcPBR3Info," r3Info = 12;\n optional ").concat(du.RtcPBR4Info," r4Info = 13;\n }\n message ").concat(du.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(du.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(du.RtcPBR3Info," {\n required ").concat(du.RtcPBStatusInfo," info = 1;\n }\n message ").concat(du.RtcPBR4Info," {\n required ").concat(du.RtcPBStatusInfo," info = 1;\n }\n message ").concat(du.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(du.RtcPBStreamInfo," streams = 13;\n }\n message ").concat(du.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 message ").concat(du.AsrTextMsg," {\n optional int32 bms = 1; //开始转写的时间(毫秒)\n optional string t = 2; //翻译的内容\n optional bool isEnd = 3; //是否监测到完整语句\n optional string msgId = 4; //该消息的ID, 跟转写的msgId 需要一样;\n optional string lang = 5; //翻译的目标语言码\n }\n message ").concat(du.AsrResTextMsg," {\n optional int32 type = 1; //1 为语音识别,后续会扩展其它类型\n required string uid = 2; //对应转写的用户Id\n repeated ").concat(du.AsrTextMsg," asr = 3; //识别出的结果列表\n }\n}\n"),Bu=function(e,t,n,r,i,o,a){var s=i?Object.keys(i).map(function(t){return e.encode(du.RtcValueInfo,{key:t,value:i[t]},!0)}):void 0,c=o?Object.keys(o).map(function(t){return e.encode(du.RtcValueInfo,{key:t,value:o[t]},!0)}):void 0;return e.encode(du.RtcInput,{roomType:t,broadcastType:n,joinType:r,innerDatas:s,outerDatas:c,supportNtf:a})},Vu=function(e,t){var n=e.decode(du.RtcUserListOutput,t),r=n.users,i=n.token,o=n.sessionId,a=n.roomInfo,s=n.entries,c=n.offlineKickTime,u=void 0===c?60:c,d=n.codeFormat,_=n.roomCreateTime,l=n.userJoinTime,p=n.version,f={};return H(r,function(e){var t=e.userId,n=e.userData,r={};H(n,function(e){var t=e.key,n=e.value;r[t]=n}),f[t]=r}),{users:f,token:i,sessionId:o,roomInfo:a,kvEntries:s,offlineKickTime:u,codeFormat:d,roomCreateTime:$n(_),userJoinTime:$n(l),version:p}},ju=function(e,t,n){var r=t.type,i=t.appKey,o=t.sessionId,a=t.roomId,s=t.roomCreateTime,c=t.userId,u=t.userRole,d=t.joinTime,_=t.signalDataCenter,l=t.r1Info,p=t.r2Info,f=t.r3Info,h=t.r4Info,R={type:r,appKey:i,sessionId:o,roomId:a,roomCreateTime:s,userId:c,userRole:u,joinTime:d,signalDataCenter:_};if(n===lc.R1&&l){var g=e.encode(du.RtcPBR1Info,l,!0);return e.encode(du.RtcPBPolaris,Object.assign(Object.assign({},R),{r1Info:g}))}if(n===lc.R2&&p){var m=e.encode(du.RtcPBR2Info,p,!0);return e.encode(du.RtcPBPolaris,Object.assign(Object.assign({},R),{r2Info:m}))}if(n===lc.R3&&f){var C=f.info,v=C.streams,T=Array.isArray(v)&&v.map(function(t){return t&&e.encode(du.RtcPBStreamInfo,t,!0)}),I=e.encode(du.RtcPBStatusInfo,Object.assign(Object.assign({},C),{streams:T}),!0),S=e.encode(du.RtcPBR3Info,{info:I},!0);return e.encode(du.RtcPBPolaris,Object.assign(Object.assign({},R),{r3Info:S}))}if(n===lc.R4&&h){var E=h.info,O=E.streams,b=Array.isArray(O)&&O.map(function(t){return t&&e.encode(du.RtcPBStreamInfo,t,!0)}),y=e.encode(du.RtcPBStatusInfo,Object.assign(Object.assign({},E),{streams:b}),!0),L=e.encode(du.RtcPBR4Info,{info:y},!0);return e.encode(du.RtcPBPolaris,Object.assign(Object.assign({},R),{r4Info:L}))}return{}};!function(e){e[e.SUBTITLE=1]="SUBTITLE",e[e.TRANSLATION=2]="TRANSLATION"}(Mu||(Mu={}));var Fu,Gu=function(){return a(function e(t){i(this,e),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:t}),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,"codec",{enumerable:!0,configurable:!0,writable:!0,value:new _u(xu)})},[{key:"logger",get:function(){return this.context.logger}},{key:"joinRTCRoom",value:function(e,t,n,r,i,o,a){return K(this,void 0,void 0,p().m(function s(){var c,u,d,_,l,f,h,R,g,m,C,v,T,I,S;return p().w(function(s){for(;;)switch(s.n){case 0:return c=Bu(this.codec,t,n,r,i,o,a),s.n=1,this.context.rtcSignaling(e,lu,!0,c);case 1:if(u=s.v,d=u.code,_=u.buffer,d!==ke||!_){s.n=2;break}return l=Vu(this.codec,_),h=(f=l).users,R=f.token,g=f.sessionId,m=f.roomInfo,C=f.kvEntries,v=f.offlineKickTime,T=f.roomCreateTime,I=f.userJoinTime,S=f.version,this.roomCreateTime=T,this.userJoinTime=I,s.a(2,{code:d,data:{users:h,token:R,sessionId:g,roomInfo:m,kvEntries:C,offlineKickTime:v,version:S}});case 2:return s.a(2,{code:d,data:l})}},s,this)}))}},{key:"quitRTCRoom",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(du.SetUserStatusInput,{status:0}),t.n=1,this.context.rtcSignaling(e,pu,!0,n);case 1:return r=t.v,i=r.code,t.a(2,i)}},t,this)}))}},{key:"getRTCRoomInfo",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(du.RtcQueryListInput,{order:2}),t.n=1,this.context.rtcSignaling(e,fu,!0,n);case 1:return r=t.v,i=r.code,o=r.buffer,i===ke&&o&&(a=this.codec.decode(du.RtcRoomInfoOutput,o)),t.a(2,{code:i,data:a})}},t,this)}))}},{key:"getRTCUserInfoList",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(du.RtcQueryListInput,{order:2}),t.n=1,this.context.rtcSignaling(e,hu,!0,n);case 1:return r=t.v,i=r.code,o=r.buffer,i===ke&&o&&(s=Vu(this.codec,o),a={users:s.users}),t.a(2,{code:i,data:a})}},t,this)}))}},{key:"getRTCUserInfo",value:function(e){throw new Error("Method not implemented.")}},{key:"removeRTCUserInfo",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o;return p().w(function(n){for(;;)switch(n.n){case 0:return r=this.codec.encode(du.RtcKeyDeleteInput,{key:t}),n.n=1,this.context.rtcSignaling(e,Ru,!1,r);case 1:return i=n.v,o=i.code,n.a(2,o)}},n,this)}))}},{key:"setRTCData",value:function(e,t,n,r,i,o){return K(this,void 0,void 0,p().m(function a(){var s,c,u;return p().w(function(a){for(;;)switch(a.n){case 0:return s=this.codec.encode(du.RtcSetDataInput,{interior:r,target:i,key:t,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),a.n=1,this.context.rtcSignaling(e,gu,!1,s);case 1:return c=a.v,u=c.code,a.a(2,u)}},a,this)}))}},{key:"setRTCTotalRes",value:function(e,t,n,r,i,o){return K(this,void 0,void 0,p().m(function a(){var s,c,u,d,_=this;return p().w(function(a){for(;;)switch(a.n){case 0:return s={objectName:r,content:[],valueInfo:[this.codec.encode(du.RtcValueInfo,{key:"uris",value:n},!0)]},t.forEach(function(e){var t=_.codec.encode(du.RtcValueInfo,{key:e.name,value:e.content},!0);s.content.push(t)}),i&&s.valueInfo.push(this.codec.encode(du.RtcValueInfo,{key:"mcu_uris",value:i},!0)),o&&s.valueInfo.push(this.codec.encode(du.RtcValueInfo,{key:"cdn_uris",value:o},!0)),c=this.codec.encode(du.RtcUserSetDataInput,s),a.n=1,this.context.rtcSignaling(e,mu,!0,c);case 1:return u=a.v,d=u.code,a.a(2,d)}},a,this)}))}},{key:"setRTCCDNUris",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a;return p().w(function(r){for(;;)switch(r.n){case 0:return i=this.codec.encode(du.RtcUserSetDataInput,{objectName:t,valueInfo:this.codec.encode(du.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),r.n=1,this.context.rtcSignaling(e,mu,!0,i);case 1:return o=r.v,a=o.code,r.a(2,a)}},r,this)}))}},{key:"getRTCData",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_;return p().w(function(i){for(;;)switch(i.n){case 0:return o=this.codec.encode(du.RtcDataInput,{interior:n,target:r,key:t}),i.n=1,this.context.rtcSignaling(e,Cu,!0,o);case 1:if(a=i.v,s=a.code,c=a.buffer,s===ke&&c){i.n=2;break}return i.a(2,{code:s});case 2:return u=this.codec.decode(du.RtcQryOutput,c),d=u.outInfo,_={},d.forEach(function(e){_[e.key]=e.value}),i.a(2,{code:s,data:_})}},i,this)}))}},{key:"removeRTCData",value:function(e,t,n,r,i){return K(this,void 0,void 0,p().m(function o(){var a,s,c;return p().w(function(o){for(;;)switch(o.n){case 0:return a=this.codec.encode(du.RtcDataInput,{interior:n,target:r,key:t,objectName:(null==i?void 0:i.name)||"",content:(null==i?void 0:i.content)||""}),o.n=1,this.context.rtcSignaling(e,vu,!1,a);case 1:return s=o.v,c=s.code,o.a(2,c)}},o,this)}))}},{key:"setRTCOutData",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:throw new Error("JSEngine's method not implemented.");case 1:return e.a(2)}},e)}))}},{key:"getRTCOutData",value:function(e,t){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:throw new Error("JSEngine's method not implemented.");case 1:return e.a(2)}},e)}))}},{key:"getRTCToken",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u;return p().w(function(r){for(;;)switch(r.n){case 0:return i=Bu(this.codec,t,n),r.n=1,this.context.rtcSignaling(e,Tu,!0,i);case 1:if(o=r.v,a=o.code,s=o.buffer,a===ke&&s){r.n=2;break}return r.a(2,{code:a});case 2:return c=this.codec.decode(du.RtcTokenOutput,s),u=c.rtcToken,r.a(2,{code:a,data:{rtcToken:u}})}},r,this)}))}},{key:"setRTCState",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o;return p().w(function(n){for(;;)switch(n.n){case 0:return r=this.codec.encode(du.MCFollowInput,{state:t}),n.n=1,this.context.rtcSignaling(e,Iu,!0,r);case 1:return i=n.v,o=i.code,n.a(2,o)}},n,this)}))}},{key:"setRTCStateByHttp",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u;return p().w(function(i){for(;;)switch(i.p=i.n){case 0:return a=ju(this.codec,n,r),s=e,/^https:\/\//.test(e)||(s="https://".concat(e)),i.p=1,i.n=2,t.httpReq({url:"".concat(s,"/rtc/logserver/polaris"),body:a,method:U.POST,headers:{jwt:(null===(o=this.context.getNaviInfo())||void 0===o?void 0:o.jwtToken)||""},timeout:2e3});case 2:if((c=i.v).data){i.n=3;break}throw new Error("http request fail");case 3:return u=JSON.parse(c.data).resultCode,i.a(2,u);case 4:return i.p=4,i.v,i.a(2,_c.REPORT_FAIL)}},i,this,[[1,4]])}))}},{key:"getRTCUserList",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(du.RtcQueryListInput,{order:2}),t.n=1,this.context.rtcSignaling(e,Su,!0,n);case 1:if(r=t.v,i=r.code,o=r.buffer,i===ke&&o){t.n=2;break}return t.a(2,{code:i});case 2:return a=Vu(this.codec,o),t.a(2,{code:i,data:a})}},t,this)}))}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l;return p().w(function(r){for(;;)switch(r.n){case 0:return i=Bu(this.codec,t,n),r.n=1,this.context.rtcSignaling(e,Eu,!0,i);case 1:if(o=r.v,a=o.code,s=o.buffer,a===ke&&s){r.n=2;break}return r.a(2,{code:a});case 2:return c=this.codec.decode(du.RtcViewerJoinedOutput,s),u=c.rtcToken,d=c.entries,_=c.roomCreateTime,l=c.userJoinTime,this.roomCreateTime=$n(_),this.userJoinTime=$n(l),r.a(2,{code:a,data:{token:u,kvEntries:d}})}},r,this)}))}},{key:"quitLivingRoomAsAudience",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(du.SetUserStatusInput,{status:0}),t.n=1,this.context.rtcSignaling(e,Ou,!0,n);case 1:return r=t.v,i=r.code,t.a(2,i)}},t,this)}))}},{key:"rtcIdentityChange",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c;return p().w(function(r){for(;;)switch(r.n){case 0:return i=this.codec.encode(du.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),r.n=1,this.context.rtcSignaling(e,yu,!0,i);case 1:if(o=r.v,a=o.code,s=o.buffer,a===ke&&s){r.n=2;break}return r.a(2,{code:a});case 2:return c=Vu(this.codec,s),r.a(2,{code:a,data:c})}},r,this)}))}},{key:"requestRoomPK",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u,d;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,o=e.inviteTimeout,a=e.inviteInfo,s=e.roomId,c=this.codec.encode(du.RtcInviteInput,{invitedRoomId:n,invitedUserId:r,inviteSessionId:i,timeoutTime:o,inviteInfo:a}),t.n=1,this.context.rtcSignaling(s,Lu,!0,c);case 1:return u=t.v,d=u.code,t.a(2,d)}},t,this)}))}},{key:"cancelRoomPK",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,o=e.inviteInfo,a=e.roomId,s=this.codec.encode(du.RtcCancelInviteInput,{invitedRoomId:n,invitedUserId:r,inviteSessionId:i,inviteInfo:o}),t.n=1,this.context.rtcSignaling(a,ku,!0,s);case 1:return c=t.v,u=c.code,t.a(2,u)}},t,this)}))}},{key:"responseRoomPK",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u,d,_,l;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.inviteUserId,r=e.inviteRoomId,i=e.inviteSessionId,o=e.content,a=e.key,s=e.value,c=e.agree,u=e.roomId,d=this.codec.encode(du.RtcInviteAnswerInput,{inviteUserId:n,inviteRoomId:r,inviteSessionId:i,content:o,key:a,value:s,answerCode:c?1:0}),t.n=1,this.context.rtcSignaling(u,Au,!0,d);case 1:return _=t.v,l=_.code,t.a(2,l)}},t,this)}))}},{key:"endRoomPK",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.endRoomId,r=e.sessionId,i=e.content,o=e.keys,a=e.roomId,s=this.codec.encode(du.RtcEndInviteInput,{inviteRoomId:n,inviteSessionId:r,inviteContent:i,inviteRoomKeys:o}),t.n=1,this.context.rtcSignaling(a,Nu,!0,s);case 1:return c=t.v,u=c.code,t.a(2,u)}},t,this)}))}},{key:"getRTCJoinedUserInfo",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(du.RtcQueryUserJoinedInput,{userId:e}),t.n=1,this.context.rtcSignaling("",Pu,!0,n);case 1:if(r=t.v,i=r.code,o=r.buffer,i===ke&&o){t.n=2;break}return t.a(2,{code:i});case 2:return a=this.codec.decode(du.RtcQueryUserJoinedOutput,o).info||[],t.a(2,{code:i,data:a.map(function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:$n(e.joinTime)}})})}},t,this)}))}},{key:"pullRTCRoomEntry",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(du.RtcPullKV,{timestamp:0,roomId:e}),t.n=1,this.context.rtcSignaling(e,bu,!0,n);case 1:if(r=t.v,i=r.code,o=r.buffer,i===ke){t.n=2;break}return t.a(2,{code:i});case 2:return a=this.codec.decode(du.RtcKVOutput,o),s=a.entries,c=a.syncTime,s=(s||[]).map(function(e){return Object.assign(Object.assign({},e),{timestamp:$n(e.timestamp)})}),t.a(2,{code:i,data:{kvEntries:s,syncTime:$n(c)}})}},t,this)}))}},{key:"pullRTCRoomStatus",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s;return p().w(function(n){for(;;)switch(n.n){case 0:return r=this.codec.encode(du.RtcRoomStatusInput,{version:t}),n.n=1,this.context.rtcSignaling(e,Du,!0,r);case 1:if(i=n.v,o=i.code,a=i.buffer,o===ke){n.n=2;break}return n.a(2,{code:o});case 2:return s=this.codec.decode(du.RtcRoomStatusOutput,a),n.a(2,{code:o,data:s})}},n,this)}))}},{key:"decodeRtcNotify",value:function(e){var t=this.codec.decode(du.RtcNotifyMsg,e),n=t.time,r=t.type,i=t.roomId;return{time:$n(n),type:r,roomId:i}}},{key:"getCurrentId",value:function(){return this.context.getCurrentId()}},{key:"getNaviInfo",value:function(){return this.context.getNaviInfo()}},{key:"getConnectionStatus",value:function(){return this.context.getConnectionStatus()}},{key:"getAppkey",value:function(){return this.context.getAppkey()}},{key:"webRtcPing",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c;return p().w(function(r){for(;;)switch(r.n){case 0:return i=this.codec.encode(du.RtcInput,{roomType:t,broadcastType:n}),r.n=1,this.context.rtcSignaling(e,wu,!0,i);case 1:if(o=r.v,a=o.code,s=o.buffer,a===ke){r.n=2;break}return r.a(2,{code:a});case 2:return(c=this.codec.decode(du.RtcOutput,s)).version=$n(c.version),r.a(2,{code:a,data:c})}},r,this)}))}},{key:"rtcPing",value:function(e,t,n){var r,i;return/Electron/.test(navigator.userAgent)?null===(i=(r=this.context).rtcPingResVersion)||void 0===i?void 0:i.call(r,e,t,n):this.webRtcPing(e,t,n)}},{key:"sendMessage",value:function(e,t,n){return this.context.sendMessage(e,t,n)}},{key:"registerRTCSignalListener",value:function(e){this.context.registerRTCSignalListener(e)}},{key:"registerConnectionStateChangeListener",value:function(e){var t,n;null===(n=(t=this.context).registerConnectionStateChangeListener)||void 0===n||n.call(t,e)}},{key:"registerDisconnectListener",value:function(e){var t,n;null===(n=(t=this.context).registerDisconnectListener)||void 0===n||n.call(t,e)}},{key:"registerDestroyListener",value:function(e){var t,n;null===(n=(t=this.context).registerDestroyListener)||void 0===n||n.call(t,e)}},{key:"registerMessageListener",value:function(e){var t,n;null===(n=(t=this.context).registerMessageListener)||void 0===n||n.call(t,e)}},{key:"getCoreVersion",value:function(){return this.context.getCoreVersion()}},{key:"getPluginContext",value:function(){return this.context}},{key:"reportSDKInfo",value:function(e){var t=this.codec.encode(du.RtcReportSDKInput,{sdkInfo:JSON.stringify(e)});this.context.rtcSignaling("",Uu,!0,t)}},{key:"decodeAsrText",value:function(e,t){var n;try{n=this.codec.decode(du.AsrResTextMsg,e)}catch(n){console.error("decodeAsrText error",{error:n,seiFrameData:e.join(","),seiOriginData:t.join(",")})}var r=n||{asr:[]},i=r.type,o=r.uid;return r.asr.map(function(e){var t=e.bms,n=e.t,r=e.isEnd,a=e.msgId,s=e.lang,c={userID:o,timeUTC:t,msg:n,msgId:a,isEnd:r};return i===Mu.SUBTITLE?c:Object.assign(Object.assign({},c),{destLangCode:s})})}}])}(),Ju=function(){function e(t,n,o){var a,s,c;return i(this,e),a=r(this,e,[t]),Object.defineProperty(a,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_options",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_crtRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(a,"_audience",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(a,"_crtAudienceLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Ka.setSdpSemantics(o.sdpSemantics||"unified-plan",a._logger),a._service=new ba(a._runtime,a._context,a._options.mediaServer,a._options.timeout),a._context.registerConnectionStateChangeListener(a._onIMStatusChange.bind(a)),a._context.registerDestroyListener(a._onIMUninit.bind(a)),a._context.registerMessageListener(a._handleMessage.bind(a)),null===(c=(s=a._context.getPluginContext()).setOnnavidatachange)||void 0===c||c.call(s,a.naviDataChange.bind(a)),a}return _(e,eu),a(e,[{key:"_handleMessage",value:function(e){if(e.conversationType!==Ie.RTC_ROOM)return!1;var t=this._logger.createTraceId();this._crtRoom instanceof Hc&&this._getJoinedPKRoomList().forEach(function(n){n.__parseInnerMessage(e,t)});return this._logger.info(ye.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:Le.SUCCESSED,message:e}),t),this._crtRoom?(this._crtRoom.__parseInnerMessage(e,t),!0):(this._logger.warn(ye.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:Le.FAILED,message:"the crtRoom is empty"}),t),!0)}},{key:"naviDataChange",value:function(e){this._logger.info(ye.L_RTC_CLIENT_NAVI_CHANGE_O,"on navi change data => ".concat(JSON.stringify(e))),this._service.clearMSList(),this._service.isNededDetector()&&this._service.detectorMediaSever()}},{key:"_getJoinedPKRoomList",value:function(){var e=this._crtRoom.getRoomPKHandler(),t=e.code,n=e.roomPKHandler;if(t===exports.RCRTCCode.SUCCESS&&n){var r=n.getJoinedPKRooms()||{};return Object.values(r)}return[]}},{key:"getPluginContext",value:function(){return this._context.getPluginContext()}},{key:"getCurrentId",value:function(){return this._context.getCurrentId()}},{key:"joinCrossRTCRoom",value:function(e,t,n){return K(this,arguments,void 0,function(e,t,n){var r=this;return arguments.length>4&&void 0!==arguments[4]||exports.RTCMode.CROSS_MUTI,p().m(function i(){return p().w(function(i){for(;;)if(0===i.n)return console.warn("joinCrossRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),i.a(2,r.joinRTCRoomWithOptions(e,{joinType:t,userData:n,mode:exports.RTCMode.CROSS_MUTI}))},i)})()})}},{key:"joinRTCRoom",value:function(e,t,n){return K(this,arguments,void 0,function(e,t,n){var r=this,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:exports.RTCMode.RTC;return p().m(function o(){return p().w(function(o){for(;;)if(0===o.n)return console.warn("joinRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),o.a(2,r.joinRTCRoomWithOptions(e,{mode:i,joinType:t,userData:n}))},o)})()})}},{key:"joinRTCRoomWithOptions",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s=this;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_JOIN_RTC_ROOM_T,JSON.stringify({roomId:e,options:t}),r),!this._crtRoom){n.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_RTC_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),n.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 1:return i=this._crtRoom=new Kc(this._context,this._runtime,e,this._service,this._options,null==t?void 0:t.mode,null==t?void 0:t.encrypt),n.n=2,i.__innerInit((null==t?void 0:t.mode)||exports.RTCMode.RTC,null==t?void 0:t.joinType,void 0,void 0,null==t?void 0:t.userData,r,null==t?void 0:t.srcLanguage,null==t?void 0:t.nickName);case 2:if(o=n.v,(a=o.code)===exports.RCRTCCode.SUCCESS){n.n=3;break}return this._crtRoom=null,n.a(2,{code:a});case 3:return i.once(kc,function(){s._crtRoom=null}),n.a(2,{code:a,room:i,userIds:i.getRemoteUserIds(),tracks:i.getRemoteTracks()})}},n,this)}))}},{key:"joinLivingRoom",value:function(e,t,n,r){return K(this,arguments,void 0,function(e,t,n,r){var i=this;return p().m(function o(){var a,s,c,u,d;return p().w(function(o){for(;;)switch(o.n){case 0:if(a=i._logger.createTraceId(),i._logger.info(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_T,JSON.stringify({roomId:e,livingType:t,joinType:n,outerUserDatas:r}),a),!i._crtRoom){o.n=1;break}return i._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly -> roomId: ".concat(e)}),a),o.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 1:return s=i._crtRoom=new Hc(i._context,i._runtime,e,i._service,i._options,t,!1,!0),o.n=2,s.__innerInit(exports.RTCMode.LIVE,n,t,void 0,r,a);case 2:if(c=o.v,(u=c.code)===exports.RCRTCCode.SUCCESS){o.n=3;break}return i._crtRoom=null,o.a(2,{code:u});case 3:return s.once(kc,function(){i._crtRoom=null}),d={code:u,room:s,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()},s.__getCDNPushMode()===Yc.MANUAL&&Object.assign(d,{CDNEnable:s.__getCDNEnable()}),o.a(2,d)}},o)})()})}},{key:"getAudienceClient",value:function(e){return this._audience||(this._audience=new zc(this._context,this._runtime,this._options)),this._logger.info(ye.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O),this._audience}},{key:"_onIMStatusChange",value:function(e,t){if(this._logger.info(ye.L_RTC_CLIENT_IM_CONNECTION_STATE_S,JSON.stringify({status:e,code:t,desc:Se[e]})),e===Se.SUSPENDED&&t===Ae&&this._service.clearMSList(),e===Se.DISCONNECTED){if(this._crtRoom){var n=exports.RCKickReason.IM_DISCONNECTED;t===Ne?n=exports.RCKickReason.OTHER_CLIENT_IM_CONNECTED:2===t&&(n=exports.RCKickReason.IM_LOGOUT),this._crtRoom.__kickoff(!0,{users:[{userId:this._context.getCurrentId(),type:n}]})}}else if(e===Se.CONNECTED){if(this._service.isNededDetector()&&this._service.detectorMediaSever(),this._crtRoom instanceof Hc)this._getJoinedPKRoomList().forEach(function(e){e.__onReconnected()});this._crtRoom&&this._crtRoom.__onReconnected()}}},{key:"_onIMUninit",value:function(){var e;this._logger.info(ye.L_RTC_CLIENT_DESTROY_S,JSON.stringify({msg:"TODO -> on IM client ondestroy"})),null===(e=this._crtRoom)||void 0===e||e.__destroy(!0)}},{key:"leaveRoom",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r;return p().w(function(t){for(;;)switch(t.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_LEAVE_ROOM_T,JSON.stringify({roomId:e.getRoomId()}),r),this._crtRoom){t.n=1;break}return this._logger.warn(ye.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:Le.FAILED,msg:"Room does not exist, without leave"}),r),t.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return t.n=2,this._crtRoom.__destroy(!0);case 2:return this._service.isNededDetector()&&this._service.detectorMediaSever(),this._logger.info(ye.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:Le.SUCCESSED,roomId:null===(n=this._crtRoom)||void 0===n?void 0:n.getRoomId()}),r),this._crtRoom=null,t.a(2,{code:exports.RCRTCCode.SUCCESS})}},t,this)}))}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:e,livingType:t}),r),this._service.isNededDetector()&&this._service.detectorMediaSever(),!zn(this._context.getNaviInfo())){n.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),r),n.a(2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR});case 1:if(j("roomId",e,k,!0)&&j("livingType",t,function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO})){n.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId or livingType"}),r),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(!this._crtAudienceLivingRoom){n.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),n.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 3:if(this._service.getMsList().length){n.n=4;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),r),n.a(2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER});case 4:return n.n=5,this._context.joinLivingRoomAsAudience(e,exports.RTCMode.LIVE,t);case 5:if(i=n.v,o=i.code,a=i.data,o===ke){n.n=6;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:o,msg:"signal error -> audience join room"}),r),n.a(2,{code:exports.RCRTCCode.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED});case 6:return s=ga(),c=new Zc(this._context,this._runtime,this._options,e,a,t,s),this._crtAudienceLivingRoom=c,this._logger.info(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.SUCCESSED,roomData:a}),r),n.a(2,{room:c,code:exports.RCRTCCode.SUCCESS,userIds:c.getRemoteUserIds(),RTCTracks:c.getRemoteRTCTracks(),MCUTracks:c.getRemoteMCUTracks(),CDNUris:c.getCDNInfo()})}},n,this)}))}},{key:"leaveLivingRoomAsAudience",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:e.getRoomId(),userId:this._context.getCurrentId()}),n),this._crtAudienceLivingRoom){t.n=1;break}return this._logger.warn(ye.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,msg:"Room does not exist, without leave"}),n),t.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:if(this._crtAudienceLivingRoom===e){t.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),n),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return t.n=3,this._crtAudienceLivingRoom.__destroy(!0);case 3:return this._crtAudienceLivingRoom=null,this._logger.info(ye.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.SUCCESSED}),n),t.a(2,{code:exports.RCRTCCode.SUCCESS})}},t,this)}))}},{key:"upgradeToAnchorRoom",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s=this;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T,void 0,n),j("room",e,function(){return e instanceof Zc},!0)){t.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),n),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(r=e.getRoomId(),!this._crtRoom){t.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly",roomId:r}),n),t.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 2:return i=this._crtRoom=new Hc(this._context,this._runtime,r,this._service,this._options,e.livingType,!0,!0,e.getClientSessionId()),t.n=3,i.__innerInitByIdentityChange(n);case 3:if((o=t.v)===ke){t.n=4;break}return this._crtRoom=null,t.a(2,{code:o});case 4:return i.once(kc,function(){s._crtRoom=null}),t.n=5,this._crtAudienceLivingRoom.__destroy(!1);case 5:return this._crtAudienceLivingRoom=null,a={room:i,code:exports.RCRTCCode.SUCCESS,userIds:i.getRemoteUserIds(),tracks:i.getRemoteTracks()},i.__getCDNPushMode()===Yc.MANUAL&&Object.assign(a,{CDNEnable:i.__getCDNEnable()}),t.a(2,a)}},t,this)}))}},{key:"downgradeToAudienceRoom",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T,JSON.stringify({roomId:e._roomId,userId:this._context.getCurrentId()}),n),e.isMainRoom()){t.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"the `downgradeToAudienceRoom` is disabled in PK room"}),n),t.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:if(j("room",e,function(){return e instanceof Hc},!0)){t.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),n),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(!this._crtAudienceLivingRoom){t.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),n),t.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 3:return t.n=4,this._context.rtcIdentityChange(e._roomId,Vc.AnchorToViewer,e.getLivingType());case 4:if(r=t.v,i=r.code,o=r.data,i===ke){t.n=5;break}return this._logger.error(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}),n),t.a(2,{code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED});case 5:return this._logger.info(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.SUCCESSED,roomData:o}),n),a=e.getClientSessionId(),s=new Zc(this._context,this._runtime,this._options,e._roomId,o,e.getLivingType(),a),this._crtAudienceLivingRoom=s,this._crtRoom.__destroy(!1),this._crtRoom=null,t.a(2,{room:s,code:exports.RCRTCCode.SUCCESS,userIds:s.getRemoteUserIds(),RTCTracks:s.getRemoteRTCTracks(),MCUTracks:s.getRemoteMCUTracks(),CDNUris:s.getCDNInfo()})}},t,this)}))}},{key:"getJoinedRoomInfo",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o;return p().w(function(e){for(;;)switch(e.n){case 0:return t=this._logger.createTraceId(),n=this._context.getCurrentId(),this._logger.error(ye.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T,JSON.stringify({userId:n}),t),e.n=1,this._context.getRTCJoinedUserInfo(n);case 1:if(r=e.v,i=r.code,o=r.data,i===ke){e.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:Le.FAILED,code:i}),t),e.a(2,{code:i});case 2:return this._logger.info(ye.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:Le.SUCCESSED,roomInfo:o}),t),e.a(2,{code:exports.RCRTCCode.SUCCESS,data:o})}},e,this)}))}},{key:"generateSummarization",value:function(e,t){return K(this,arguments,void 0,function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;return p().m(function s(){var c,u,d,_,l,f,h;return p().w(function(s){for(;;)switch(s.n){case 0:if(c=n._logger.createTraceId(),n._logger.info(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_T,JSON.stringify({roomId:e,taskId:t,startTime:r,endTime:i,config:o,contentBlock:a}),c),j("roomId",e,k,!0)){s.n=1;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(j("taskId",t,k,!0)){s.n=2;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> taskId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(y(r)&&!(r<0)){s.n=3;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> startTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 3:if(y(i)&&!(i<0)){s.n=4;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> endTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(j("config",o,A,!0)){s.n=5;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> config"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 5:return u=er(o),d=u.isValid,_=u.key,d||n._logger.warn(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> config.".concat(_)}),c),s.n=6,n._service.generateSummarization(e,t,r,i,o,a,c);case 6:if(l=s.v,f=l.code,h=l.msg,f===exports.RCRTCCode.SUCCESS){s.n=7;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:f,msg:h}),c),s.a(2,{code:f});case 7:return n._logger.info(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.SUCCESSED}),c),s.a(2,{code:f})}},s)})()})}},{key:"getASRContent",value:function(e,t){return K(this,arguments,void 0,function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;return p().m(function s(){var c,u,d,_;return p().w(function(s){for(;;)switch(s.n){case 0:if(c=n._logger.createTraceId(),n._logger.info(ye.L_RTC_CLIENT_GET_ASR_CONTENT_T,JSON.stringify({roomId:e,taskId:t,startTime:r,endTime:i,destLang:a,contentBlock:o}),c),j("roomId",e,k,!0)){s.n=1;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(j("taskId",t,k,!0)){s.n=2;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> taskId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(y(r)&&!(r<0)){s.n=3;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> startTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 3:if(y(i)&&!(i<0)){s.n=4;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> endTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(j("destLang",a,O,!1)){s.n=5;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> destLang"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 5:return s.n=6,n._service.getASRContent(e,t,r,i,o,c,a);case 6:if(u=s.v,d=u.code,_=u.msg,d===exports.RCRTCCode.SUCCESS){s.n=7;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:d,msg:_}),c),s.a(2,{code:d});case 7:return n._logger.info(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.SUCCESSED}),c),s.a(2,{code:d})}},s)})()})}}],[{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=n.logger;if(i.warn(ye.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.36.1-nctest-alpha.1",Commit:"ea43ad6567a1db1d58a4ea47be96d1791498f690","browserInfo.browser":Gn.browser,"browserInfo.supportsUnifiedPlan":Gn.supportsUnifiedPlan,"browserInfo.version":Gn.version})),V("options",t,E.OBJECT,!0),V("options.mediaServer",t.mediaServer,function(e){return!(!D(e)||"https:"===location.protocol&&!/^https/.test(e))}),V("options.timeout",t.timeout,function(e){return y(e)&&e>=5e3&&e<=3e4}),V("options.pingGap",t.pingGap,function(e){return y(e)&&e>=3e3&&e<=1e4}),t.AAAWorklet){V("options.AAAWorklet",t.AAAWorklet,E.OBJECT,!0);var o=t.AAAWorklet,a=o.scriptUrl,s=o.wasmUrl;V("AAAWorklet.scriptUrl",a,E.STRING,!0),V("AAAWorklet.wasmUrl",s,E.STRING,!0),dn.SCRIPT_URL=a,dn.WASM_URL=s}return t.encryptor&&(V("options.encrypt",t.encryptor,E.OBJECT,!0),V("options.encrypt.decodeAudio",t.encryptor.decodeAudio,function(e){return"function"==typeof e},!0),V("options.encrypt.decodeVideo",t.encryptor.decodeVideo,function(e){return"function"==typeof e},!0),V("options.encrypt.encodeAudio",t.encryptor.encodeAudio,function(e){return"function"==typeof e},!0),V("options.encrypt.encodeVideo",t.encryptor.encodeVideo,function(e){return"function"==typeof e},!0),Va.init(t.encryptor,i)),e._instance||(e._instance=new e(new Gu(n),r,t)),e._instance}}])}();Object.defineProperty(Ju,"_instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.RTCJoinType=void 0,(Fu=exports.RTCJoinType||(exports.RTCJoinType={}))[Fu.KICK=0]="KICK",Fu[Fu.REFUSE=1]="REFUSE",e.VersionManage.add("rtclib","5.36.1-nctest-alpha.1");var Hu={tag:"RCRTC",verify:function(){return"undefined"==typeof isSecureContext||isSecureContext?!!e.VersionManage.validEngine("26.1.0")||(console.error("The current engine version '".concat(e.VersionManage.getInfo().engine,"' error, plugin-rtc required engine version at least '","26.1.0","'.")),!1):(console.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(e){var t=function(e){const t={logger:(de.RTC,n=e.createLogger("RCRTC","RTC"),new pe({writeLog(e,t,r,i){switch(e){case ue.Debug:n.debug(t,r,i);break;case ue.Info:n.info(t,r,i);break;case ue.Warn:n.warn(t,r,i);break;case ue.Error:n.error(t,r,i);break;default:n.info(t,r,i)}}})),rtcSignaling(t,n,r,i){return K(this,void 0,void 0,function*(){const o=yield e.rtcSignaling(t,n,r,i);return{code:Te.errorCode.toCommon(null==o?void 0:o.code),buffer:null==o?void 0:o.buffer}})},registerRTCSignalListener(t){e.registerRTCSignalListener(t)},sendGroupCallSignalInfo(t,n,r){return K(this,void 0,void 0,function*(){const i=yield e.setCallInfo(t,n,r);return{code:Te.errorCode.toCommon(i.code),data:i.data}})},registerGroupCallSignalInfoListener(t){e.onCallInfo=e=>{t(e)}},setOnnavidatachange(t){const n=t?e=>{const n=Te.naviInfo.toCommon(e);t(n)}:void 0;e.onnavidatachange=n},refetchNaviInfo:e.refetchNaviInfo?()=>K(this,void 0,void 0,function*(){yield e.refetchNaviInfo()}):void 0,registerConnectionStateChangeListener(t){e.onconnectionstatechange=(e,n)=>{t(Te.connectionStatus.toCommon(e),Te.errorCode.toCommon(null!=n?n:0))}},registerDisconnectListener(t){e.ondisconnect=t},registerDestroyListener(t){e.ondestroy=t},registerMessageListener(t){const n=t?e=>t(Te.receivedMessage.toCommon(e)):void 0;e.onmessage=n},sendMessage(t,n,r){return K(this,void 0,void 0,function*(){const i=Te.conversationType.toNative(t),o=Te.sendMsgOptions.toNative(r),a=yield e.sendMessage(i,n,o);return{code:Te.errorCode.toCommon(a.code),data:void 0!==a.data?Te.receivedMessage.toCommon(a.data):void 0}})},getCurrentId:()=>e.getCurrentId(),getNaviInfo(){const t=e.getNaviInfo();return null!=t?Te.naviInfo.toCommon(t):null},getConnectionStatus:()=>Te.connectionStatus.toCommon(e.getConnectionStatus()),getAppkey:()=>e.getAppkey(),getCoreVersion:()=>e.getCoreVersion(),registerMessageType(t,n,r,i){e.registerMessageType(t,n,r,i)}};var n;return e.rtcPingResVersion&&(t.rtcPingResVersion=(t,n,r)=>K(this,void 0,void 0,function*(){const i=yield e.rtcPingResVersion(t,n,r);return{code:Te.errorCode.toCommon(i.code),data:i.data}})),t}(e);return t.logger.warn(ye.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.36.1-nctest-alpha.1",Commit:"ea43ad6567a1db1d58a4ea47be96d1791498f690","browserInfo.browser":Gn.browser,"browserInfo.supportsUnifiedPlan":Gn.supportsUnifiedPlan,"browserInfo.version":Gn.version})),new Ju(new Gu(t),le,{})}},Ku={transResolution:Bn,transFrameRate:Fn,parseTrackId:Dn,ifSupportLocalFileTrack:Jn,ifSupportScreenShare:Hn};exports.RCAbstractRoom=Ac,exports.RCAudienceClient=zc,exports.RCAudienceLivingRoom=Zc,exports.RCCameraVideoTrack=Cn,exports.RCLivingRoom=Hc,exports.RCLocalAudioTrack=ln,exports.RCLocalFileAudioTrack=gn,exports.RCLocalFileTrack=fn,exports.RCLocalFileVideoTrack=Rn,exports.RCLocalTrack=_n,exports.RCLocalVideoTrack=pn,exports.RCMCUConfigBuilder=Uc,exports.RCMediaStreamCapture=eu,exports.RCMicphoneAudioTrack=mn,exports.RCRTCClient=Ju,exports.RCRTCRoom=Kc,exports.RCRemoteAudioTrack=Sn,exports.RCRemoteTrack=In,exports.RCRemoteVideoTrack=En,exports.RCScreenAudioTrack=Tn,exports.RCScreenVideoTrack=vn,exports.RCTag={DEFAULT:"RongCloudRTC"},exports.RCTrack=an,exports.device=rn,exports.helper=Ku,exports.installer=Hu;
|