@rongcloud/engine 5.44.0 → 5.46.0-c-tmp-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/index.mjs +1 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
|
-
function e(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(e);n<s.length;n++)t.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(i[s[n]]=e[s[n]])}return i}function t(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{l(s.next(e))}catch(e){r(e)}}function a(e){try{l(s.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))}function i(e,t,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(e):s?s.value:t.get(e)}function s(e,t,i,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,i):n?n.value=i:t.set(e,i),i}var n;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC",e[e.MINIO=5]="MINIO"}(n||(n={}));const r={L_IMSDK_VER_O:"L-imsdk_ver-O",A_INIT_REPEAT_O:"A_INIT_REPEAT_O",L_INIT_O:"L-init-O",A_DESTROY_O:"A_DESTROY_O",A_CONNECT_T:"A-connect-T",A_CONNECT_R:"A-connect-R",A_CONNECT_S:"A-connect-S",L_QUERY_CMP_T:"L-query_cmp-T",L_QUERY_CMP_R:"L-query_cmp-R",A_DISCONNECT_O:"A-disconnect-O",A_RECONNECT_T:"A-reconnect-T",A_RECONNECT_R:"A_RECONNECT_R",L_CONNECT_T:"L-connect-T",L_CONNECT_O:"L-connect-O",L_CONNECT_R:"L-connect-R",L_CONNECT_S:"L-connect-S",L_DB_UPGRATE_START_S:"L-db_upgrate_start-S",L_DB_UPGRATING_S:"L-db_upgrating-S",L_DB_UPGRATE_COMPLETE_S:"L-db_upgrate_complete-S",L_NOTIFY_ULTRA_ONLINE_S:"L-notify-ultra-online-S",L_ULTRA_SYNC_DONE_S:"L-ultra-sync-done-S",L_BATCH_MESSAGE_O:"L-BATCH_MESSAGE-O",A_MSG_LISTENER_E:"A-MSG_LISTENER-E",O:"L-original-O",T:"L-TEST-O",L_INSTALL_PLUGIN_T:"L-INSTALL_PLUGIN-T",L_INSTALL_PLUGIN_R:"L-INSTALL_PLUGIN-R",L_NAVI_CONF_E:"L-NAVI_CONF_ERROR-E",L_NAVI_CMP_R:"L-NAVI_CPM-R",A_SEND_MSG_T:"A-send_msg-T",A_SEND_MSG_R:"A-send_msg-R",L_SEND_MSG_T:"L-send_msg-T",L_SEND_MSG_R:"L-send_msg-R",A_SEND_TYPING_STATUS_T:"A-send_typing_status-T",A_SEND_TYPING_STATUS_R:"A-send_typing_status-R",A_SEND_READ_RECEIPT_REQ_T:"A-send_read_receipt_req-T",A_SEND_READ_RECEIPT_REQ_R:"A-send_read_receipt_req-R",L_PULL_MSG_T:"L-pull_msg-T",L_PULL_MSG_R:"L-pull_msg-R",L_PULL_MSG_E:"L-pull_msg-E",L_PULL_MSG_O:"L-pull_msg-O",L_PULL_ULTRA_MSG_T:"L-pull_ultra_msg-T",L_PULL_ULTRA_MSG_R:"L-pull_ultra_msg-R",L_PULL_UG_RELATIONS_T:"L-pull_ug_relations-T",L_PULL_UG_RELATIONS_R:"L-pull_ug_relations-R",L_PULL_CHATROOM_KV_T:"L-pull_chatroom_kv-T",L_PULL_CHATROOM_KV_R:"L-pull_chatroom_kv-R",L_PULL_CHATROOM_MSG_T:"L-pull_chatroom_msg-T",L_PULL_CHATROOM_MSG_R:"L-pull_chatroom_msg-R",L_RECV_MULTI_SYNC_MSG_O:"L-recv_multi_sync_msg-O",L_RECV_S_MSG_O:"L-recv_s_msg-O",A_DELETE_LOCAL_MSGS_T:"A-delete_local_msgs-T",A_DELETE_LOCAL_MSGS_R:"A-delete_local_msgs-R",A_RECALL_MESSAGE_T:"A-recall_msg-T",A_RECALL_MESSAGE_R:"A-recall_msg-R",A_RECALL_MESSAGE_E:"A-recall_msg-E",A_REGTYP_O:"A-regtyp-O",P_REGTYP_E:"P-regtype-E",L_GET_NAVI_T:"L-get_navi-T",L_GET_NAVI_R:"L-get_navi-R",L_REQUEST_T:"L-request-T",L_REQUEST_R:"L-request-R",L_PARSE_NAVI_E:"L-parse_navi-E",L_ENV_S:"L-Env-S",L_GET_INDEX_NAVI_S:"L-get_index_navi-S",A_JOIN_CHATROOM_T:"A-join_chatroom-T",A_JOIN_CHATROOM_R:"A-join_chatroom-R",L_REJOIN_CHATROOM_T:"L-rejoin_chatroom-T",L_REJOIN_CHATROOM_R:"L-rejoin_chatroom-R",A_QUIT_CHATROOM_T:"A-quit_chatroom-T",A_QUIT_CHATROOM_R:"A-quit_chatroom-R",A_GET_CHATROOM_INFO_T:"A-get_chatroom_info-T",A_GET_CHATROOM_INFO_R:"A-get_chatroom_info-R",A_SET_CHATROOM_ENTRY_T:"A-set_chatroom_entry-T",A_SET_CHATROOM_ENTRY_R:"A-set_chatroom_entry-R",A_SET_CHATROOM_ENTRIES_T:"A-set_chatroom_entries-T",A_SET_CHATROOM_ENTRIES_R:"A-set_chatroom_entries-R",A_REMOVE_CHATROOM_ENTRY_T:"A-remove_chatroom_entry-T",A_REMOVE_CHATROOM_ENTRY_R:"A-remove_chatroom_entry-R",A_REMOVE_CHATROOM_ENTRIES_T:"A-remove_chatroom_entries-T",A_REMOVE_CHATROOM_ENTRIES_R:"A-remove_chatroom_entries-R",A_GET_CHATROOM_ENTRY_T:"A-get_chatroom_entry-T",A_GET_CHATROOM_ENTRY_R:"A-get_chatroom_entry-R",A_GET_CHATROOM_ENTRIES_T:"A-get_chatroom_entries-T",A_GET_CHATROOM_ENTRIES_R:"A-get_chatroom_entries-R",A_BIND_RTC_FOR_CHATROOM_T:"A-bind_rtc_for_chatroom-T",A_BIND_RTC_FOR_CHATROOM_R:"A-bind_rtc_for_chatroom-R",L_MEDIA_S:"L-media-S",L_MEDIA_UPLOAD_T:"L-media_upload-T",L_MEDIA_UPLOAD_R:"L-media_upload-R",G_UPLOAD_LOG_S:"G-upload_log-S",G_REPORT_LOG_S:"G-report_log-S",G_UPLOAD_LOG_E:"G-upload_log-E",G_GET_REAL_TIMELOG_COMMAND_S:"G-get_real_timelog_command-S",L_CHECK_ALIVE_IM_T:"L-check_alive_im-T",L_CHECK_ALIVE_IM_R:"L-check_alive_im-R",L_CHECK_ALIVE_IM_S:"L-check_alive_im-S",A_GET_LOCAL_MESSAGE_T:"A-get_local_message-T",A_GET_LOCAL_MESSAGE_R:"A-get_local_message-R",A_GET_HISTORY_MSG_T:"A-get_history_msg-T",A_GET_HISTORY_MSG_R:"A-get_history_msg-R",A_GET_REMOTE_HISTORY_MSG_T:"A-get_remote_history_msg-T",A_GET_REMOTE_HISTORY_MSG_R:"A-get_remote_history_msg-R",L_CALLBACK_E:"L-callback-E",A_SEND_READ_RECEIPT_T:"A-send_read_receipt-T",A_SEND_READ_RECEIPT_R:"A-send_read_receipt-R",A_SEND_READ_RECEIPT_V2_T:"A-send_read_receipt_v2-T",A_SEND_READ_RECEIPT_V2_R:"A-send_read_receipt_v2-R",A_SYNC_READ_STATUS_T:"A-sync_read_status-T",A_SYNC_READ_STATUS_R:"A-sync_read_status-R",L_PB_ENCODE_E:"L-pb-encode-E",L_PB_DECODE_E:"L-pb-decode-E",L_NOTIFY_NAVI_CHANGE_E:"L-notify_navi_change-E",L_REPORT_FULL_LOG_O:"L-report_full_log-O",L_REPORT_FULL_LOG_T:"L-report_full_log-T",L_REPORT_FULL_LOG_R:"L-report_full_log-R",L_REPORT_LOG_POLICY_E:"L-parse_navi_logpolicy-E",L_UNSUPPORT_INDEXDB_O:"L-unsupport_IndexDB-O",L_LOGDB_OPEN_FAILED_E:"L-logDB_open_failed-E",L_LOGDB_CLOSED_S:"L-logDB_closed-S",L_LOGDB_ERROR_E:"L-logDB_error-S",L_LOGDB_ABORT_S:"L-logDB_abort-S",L_REALTIME_LOG_T:"L_REALTIME_LOG_T",L_REALTIME_LOG_R:"L_REALTIME_LOG_R",L_REALTIME_LOG_O:"L_REALTIME_LOG_O",L_SEND_RMTP_E:"L-send-rmtp-E",L_RECV_RMTP_O:"L-recv-rmtp-O",L_RECV_RMTP_E:"L-recv-rmtp-E",L_RECV_S_NTF_O:"L-recv_s_ntf_O",L_RECV_S_CMD_O:"L-recv_s_cmd_O",L_VER_REPORT_T:"L-VER_REPORT-T",L_VER_REPORT_R:"L-VER_REPORT-R",L_UNSUPPORT_NTF_FROM_MAIN_E:"L_UNSUPPORT_NTF_FROM_MAIN_E",A_REMOVE_PROXY_O:"A-remove_proxy-O",L_SET_PROXY_O:"L-set_proxy-O",L_TEST_PROXY_T:"L-test_proxy-T",L_TEST_PROXY_R:"L-test_proxy-R",L_WS_DISACCORD_E:"L-ws_disaccord-E",L_GET_STATIC_CONF_T:"L-get_static_conf-T",L_GET_STATIC_CONF_R:"L-get_static_conf-R",L_GET_STATIC_CONF_E:"L-get_static_conf-E",L_CLOUD_DISABLED:"L-cloud_disabled",L_CLOUD_OVERCLOCK:"L-cloud_overclock",L_CLOUD_APPKEY_REGION_E:"L-cloud_appkey_region_error",L_CLOUD_CONFIG_DATA_E:"L-cloud_config_data_error",L_CLOUD_SET_AREA_CODE_O:"L-cloud_set_area_code-O",L_CLOUD_SET_MRTR_O:"L-cloud_set_mrtr-O",L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S:"L-sync_subscribed_user_status_finished-S",L_PULL_SUBSCRIBED_USER_RELATION_T:"L-pull_subscribed_user_relation-T",L_PULL_SUBSCRIBED_USER_RELATION_R:"L-pull_subscribed_user_relation-R",L_PULL_SUBSCRIBED_USER_STATUS_T:"L-pull_subscribed_user_status-T",L_PULL_SUBSCRIBED_USER_STATUS_R:"L-pull_subscribed_user_status-R",L_OWN_USER_PROFILE_CHANGED_S:"L-own_user_profile_changed-S",L_QUERY_SUBSCRIBE_DATA_T:"L-query_subscribe_data-T",L_QUERY_SUBSCRIBE_DATA_R:"L-query_subscribe_data-R",L_PULL_USER_PROFILE_T:"L-pull_user_profile-T",L_PULL_USER_PROFILE_R:"L-pull_user_profile-R",L_PULL_OWN_PROFILE_T:"L-pull_own_profile-T",L_PULL_OWN_PROFILE_R:"L-pull_own_profile-R",L_QUERY_FRIEND_LIST_T:"L-query_friend_list-T",L_QUERY_FRIEND_LIST_R:"L-query_friend_list-R",L_PULL_USER_PROFILE_REQ_T:"L-pull_user_profile_req-T",L_PULL_USER_PROFILE_REQ_R:"L-pull_user_profile_req-R",L_SERVER_EVENT_NOTIFY_ONLINE_T:"L-server_event_notify_online-T",L_SERVER_EVENT_NOTIFY_ONLINE_R:"L-server_event_notify_online-R",L_PULL_EVENT_CHANGE_T:"L-pull_event_change-T",L_PULL_EVENT_CHANGE_R:"L-pull_event_change-R",L_PARSE_JSON_E:"L-parse_json-E",L_REQ_STREAM_MSG_CONTENT_T:"L-req_stream_msg_content-T",L_REQ_STREAM_MSG_CONTENT_R:"L-req_stream_msg_content-R",L_REQ_STREAM_MSG_CONTENT_O:"L-req_stream_msg_content-O",L_REQ_STREAM_MSG_CONTENT_E:"L-req_stream_msg_content-E",L_PULL_CONVERSATION_SETTINGS_T:"L-pull_conversation_settings-T",L_PULL_CONVERSATION_SETTINGS_R:"L-pull_conversation_settings-R",L_PULL_SG_RELATIONS_T:"L-pull_sg_relations-T",L_PULL_SG_RELATIONS_R:"L-pull_sg_relations-R",A_REMOVE_CONVERSATION_T:"A-remove_conversation-T",A_REMOVE_CONVERSATION_R:"A-remove_conversation-R",A_GET_CONVERSATION_T:"A-get_conversation-T",A_GET_CONVERSATION_R:"A-get_conversation-R",A_BATCH_SET_CONVERSATION_TO_TOP_T:"A-batch_set_conversation_to_top-T",A_BATCH_SET_CONVERSATION_TO_TOP_R:"A-batch_set_conversation_to_top-R",A_BATCH_SET_CONVERSATION_NOTIFICATION_LEVEL_T:"A-batch_set_convers_notification_level-T",A_BATCH_SET_CONVERSATION_NOTIFICATION_LEVEL_R:"A-batch_set_convers_notification_level-R",A_BATCH_SET_CONVERSATION_TRANSLATE_STRATEGY_T:"A-batch_set_convers_translate_strategy-T",A_BATCH_SET_CONVERSATION_TRANSLATE_STRATEGY_R:"A-batch_set_convers_translate_strategy-R",A_DELETE_REMOTE_MESSAGE_BY_TIMESTAMP_T:"A-delete_remote_message_by_timestamp-T",A_DELETE_REMOTE_MESSAGE_BY_TIMESTAMP_R:"A-delete_remote_message_by_timestamp-R",A_DEL_REMOTE_MSGS_T:"A-del_remote_msgs-T",A_DEL_REMOTE_MSGS_R:"A-del_remote_msgs-R",A_BATCH_CLEAR_REMOTE_MSG_T:"A-batch_clear_remote_msg-T",A_BATCH_CLEAR_REMOTE_MSG_R:"A-batch_clear_remote_msg-R",L_EVENT_LOOP_BLOCKING_S:"L-event_loop_blocking-S",A_E_SEARCH_CONVERSATION_BY_CONTENT_T:"A-e_search_conversation_by_content-T",A_E_SEARCH_CONVERSATION_BY_CONTENT_R:"A-e_search_conversation_by_content-R",A_LOAD_CONVERSATION_LIST_T:"A-load_conversation_list-T",A_LOAD_CONVERSATION_LIST_R:"A-load_conversation_list-R",P_GET_SYS_VERSION_E:"P-get_sys_version-E",A_CLEAR_LOCAL_CACHE_O:"A-clear_local_cache-O",A_E_SET_MESSAGE_STATUS_TO_READ_T:"A-e_set_message_status_to_read-T",A_E_SET_MESSAGE_STATUS_TO_READ_R:"A-e_set_message_status_to_read-R",A_SEARCH_MSGS_BY_PARAMS_T:"A-search_msgs_by_params-T",A_SEARCH_MSGS_BY_PARAMS_R:"A-search_msgs_by_params-R",A_GET_CHATROOM_HISTORY_MESSAGES_T:"A-get_chatroom_history_messages-T",A_GET_CHATROOM_HISTORY_MESSAGES_R:"A-get_chatroom_history_messages-R",A_REQUEST_SPEECH_TO_TEXT_FOR_MESSAGE_T:"A-request_speech_to_text_for_message-T",A_REQUEST_SPEECH_TO_TEXT_FOR_MESSAGE_R:"A-request_speech_to_text_for_message-R",L_SYNC_USER_SETTINGS_T:"L-sync_user_settings-T",L_SYNC_USER_SETTINGS_R:"L-sync_user_settings-R",A_ADD_TAG_T:"A-add_tag-T",A_ADD_TAG_R:"A-add_tag-R",A_REMOVE_TAG_T:"A-remove_tag-T",A_REMOVE_TAG_R:"A-remove_tag-R",A_UPDATE_TAG_T:"A-update_tag-T",A_UPDATE_TAG_R:"A-update_tag-R",A_GET_TAGS_T:"A-get_tags-T",A_GET_TAGS_R:"A-get_tags-R",A_ADD_TAG_FOR_CONVERSATIONS_T:"A-add_tag_for_conversations-T",A_ADD_TAG_FOR_CONVERSATIONS_R:"A-add_tag_for_conversations-R",A_GET_TAGS_OF_CONVERSATION_T:"A-get_tags_of_conversation-T",A_GET_TAGS_OF_CONVERSATION_R:"A-get_tags_of_conversation-R",A_SET_CONVER_TO_TOP_IN_TAG_T:"A-set_conver_to_top_in_tag-T",A_SET_CONVER_TO_TOP_IN_TAG_R:"A-set_conver_to_top_in_tag-R",A_REMOVE_TAG_FOR_CONVERS_T:"A-remove_tag_for_conversations-T",A_REMOVE_TAG_FOR_CONVERS_R:"A-remove_tag_for_conversations-R",A_REMOVE_TAGS_FOR_CONVER_T:"A-remove_tags_for_conversation-T",A_REMOVE_TAGS_FOR_CONVER_R:"A-remove_tags_for_conversation-R",A_GET_UNREAD_COUNT_BY_TAG_T:"A-get_unread_count_by_tag-T",A_GET_UNREAD_COUNT_BY_TAG_R:"A-get_unread_count_by_tag-R",A_GET_UNREAD_COUNT_T:"A-get_unread_count-T",A_GET_UNREAD_COUNT_R:"A-get_unread_count-R",A_GET_UNTAGGED_CONVERSATION_LIST_BY_PAGE_T:"A-get_untagged_conversation_list_by_page-T",A_GET_UNTAGGED_CONVERSATION_LIST_BY_PAGE_R:"A-get_untagged_conversation_list_by_page-R",A_SET_TRANSLATION_LANGUAGE_T:"A-set_translation_language-T",A_SET_TRANSLATION_LANGUAGE_R:"A-set_translation_language-R",A_GET_TRANSLATION_LANGUAGE_T:"A-get_translation_language-T",A_GET_TRANSLATION_LANGUAGE_R:"A-get_translation_language-R",A_SET_AUTO_TRANSLATE_ENABLED_T:"A-set_auto_translate_enabled-T",A_SET_AUTO_TRANSLATE_ENABLED_R:"A-set_auto_translate_enabled-R",A_GET_AUTO_TRANSLATE_ENABLED_T:"A-get_auto_translate_enabled-T",A_GET_AUTO_TRANSLATE_ENABLED_R:"A-get_auto_translate_enabled-R",L_PULL_OFFLINE_MESSAGE_FINISHED_S:"L-pull_offline_message_finished-S",A_MODIFY_MESSAGE_WITH_PARAMS_T:"A-modify_msg_with_params-T",A_MODIFY_MESSAGE_WITH_PARAMS_R:"A-modify_msg_with_params-R",A_REFRESH_REFERENCE_MESSAGE_WITH_PARAMS_T:"A-refresh_refer_msg_with_params-T",A_REFRESH_REFERENCE_MESSAGE_WITH_PARAMS_R:"A-refresh_refer_msg_with_params-R",L_PULL_MODIFY_MSG_T:"L-pull_modify_msg-T",L_PULL_MODIFY_MSG_R:"L-pull_modify_msg-R",A_BATCH_DEL_CONVERS_T:"A-batch_del_conversation-T",A_BATCH_DEL_CONVERS_R:"A-batch_del_conversation-R",A_SYNC_REMOTE_CONVERSATIONS_T:"A-e_sync_remote_conversations-T",A_SYNC_REMOTE_CONVERSATIONS_R:"A-e_sync_remote_conversations-R",L_UPDATE_MSG_BOX_TIME_O:"L-update_msg_box_time-O",A_SEND_UG_TYPING_T:"A-send_ug_typing-T",A_SEND_UG_TYPING_R:"A-send_ug_typing-R",A_GET_UG_LIST_T:"A-get_ug_list-T",A_GET_UG_LIST_R:"A-get_ug_list-R",A_GET_UG_MSGS_BY_UID_T:"A-get_ug_msgs_by_uid-T",A_GET_UG_MSGS_BY_UID_R:"A-get_ug_msgs_by_uid-R",A_GET_UG_UNREAD_MENTIONED_DIGEST_T:"A-get_ug_unread_mentioned_digest-T",A_GET_UG_UNREAD_MENTIONED_DIGEST_R:"A-get_ug_unread_mentioned_digest-R",A_GET_HIS_MSGS_BY_OBJ_NAMES_T:"A-get_his_msgs_by_obj_names-T",A_GET_HIS_MSGS_BY_OBJ_NAMES_R:"A-get_his_msgs_by_obj_names-R",A_GET_CONTINUOUS_MSGS_T:"A-get_continuous_msgs-T",A_GET_CONTINUOUS_MSGS_R:"A-get_continuous_msgs-R",A_GET_MSGS_AROUND_TIMESTAMP_T:"A-get_msgs_around_timestamp-T",A_GET_MSGS_AROUND_TIMESTAMP_R:"A-get_msgs_around_timestamp-R",A_CLEAR_LOCAL_MSG_T:"A-clear_local_msg-T",A_CLEAR_LOCAL_MSG_R:"A-clear_local_msg-R",A_DEL_LOCAL_MSGS_BY_TIME_T:"A-del_local_msgs_by_time-T",A_DEL_LOCAL_MSGS_BY_TIME_R:"A-del_local_msgs_by_time-R",A_BATCH_CLEAR_LOCAL_MSGS_BY_TIME_T:"A-batch_clear_local_msgs_by_time-T",A_BATCH_CLEAR_LOCAL_MSGS_BY_TIME_R:"A-batch_clear_local_msgs_by_time-R",A_DEL_LOCAL_UG_MSGS_FOR_ALL_CHANNEL_T:"A-del_local_ug_msgs_for_all_channel-T",A_DEL_LOCAL_UG_MSGS_FOR_ALL_CHANNEL_R:"A-del_local_ug_msgs_for_all_channel-R",A_UPDATE_MSG_EXPANSION_T:"A-update_msg_expansion-T",A_UPDATE_MSG_EXPANSION_R:"A-update_msg_expansion-R",A_REMOVE_MSG_EXPANSION_T:"A-remove_msg_expansion-T",A_REMOVE_MSG_EXPANSION_R:"A-remove_msg_expansion-R",A_REMOVE_ALL_MSG_EXPANSION_T:"A-remove_all_msg_expansion-T",A_REMOVE_ALL_MSG_EXPANSION_R:"A-remove_all_msg_expansion-R",A_INSERT_MSG_T:"A-insert_msg-T",A_INSERT_MSG_R:"A-insert_msg-R",A_BATCH_INSERT_MSGS_T:"A-batch_insert_msgs-T",A_BATCH_INSERT_MSGS_R:"A-batch_insert_msgs-R",A_SET_MSG_CONTENT_T:"A-set_msg_content-T",A_SET_MSG_CONTENT_R:"A-set_msg_content-R",A_SET_UG_DEFAULT_NTF_LEVEL_T:"A-set_ug_default_ntf_level-T",A_SET_UG_DEFAULT_NTF_LEVEL_R:"A-set_ug_default_ntf_level-R",A_GET_UG_DEFAULT_NTF_LEVEL_T:"A-get_ug_default_ntf_level-T",A_GET_UG_DEFAULT_NTF_LEVEL_R:"A-get_ug_default_ntf_level-R",A_GET_UG_UNREAD_COUNT_FOR_ALL_CHANNELS_T:"A-get_ug_unread_count_for_all_channels-T",A_GET_UG_UNREAD_COUNT_FOR_ALL_CHANNELS_R:"A-get_ug_unread_count_for_all_channels-R",A_GET_TOTAL_UNREAD_COUNT_BY_LEVELS_T:"A-get_total_unread_count_by_levels-T",A_GET_TOTAL_UNREAD_COUNT_BY_LEVELS_R:"A-get_total_unread_count_by_levels-R",A_GET_TOTAL_UNREAD_COUNT_T:"A-get_total_unread_count-T",A_GET_TOTAL_UNREAD_COUNT_R:"A-get_total_unread_count-R",A_GET_FIRST_UNREAD_MEG_T:"A-get_first_unread_msg-T",A_GET_FIRST_UNREAD_MSG_R:"A-get_first_unread_msg-R",A_GET_FIRST_UNREAD_MSG_DIGEST_T:"A-get_first_unread_msg_digest-T",A_GET_FIRST_UNREAD_MSG_DIGEST_R:"A-get_first_unread_msg_digest-R",A_GET_UNREAD_MENTIONED_MSGS_T:"A-get_unread_mentioned_msgs-T",A_GET_UNREAD_MENTIONED_MSGS_R:"A-get_unread_mentioned_msgs-R",A_GET_UG_UNREAD_INFO_LIST_T:"A-get_ug_unread_info_list-T",A_GET_UG_UNREAD_INFO_LIST_R:"A-get_ug_unread_info_list-R",A_GET_UG_FIRST_UNREAD_MSG_DIGEST_T:"A-get_ug_first_unread_msg_digest-T",A_GET_UG_FIRST_UNREAD_MSG_DIGEST_R:"A-get_ug_first_unread_msg_digest-R",A_GET_LOCAL_MSG_COUNT_T:"A-get_local_msg_count-T",A_GET_LOCAL_MSG_COUNT_R:"A-get_local_msg_count-R",A_GET_CONVERSATIONS_T:"A-get_conversations-T",A_GET_CONVERSATIONS_R:"A-get_conversations-R",A_GET_BLOCKED_UG_LIST_T:"A-get_blocked_ug_list-T",A_GET_BLOCKED_UG_LIST_R:"A-get_blocked_ug_list-R",A_CLEAR_UNREAD_COUNT_T:"A-clear_unread_count-T",A_CLEAR_UNREAD_COUNT_R:"A-clear_unread_count-R",A_CLEAR_ALL_UNREAD_COUNT_T:"A-clear_all_unread_count-T",A_CLEAR_ALL_UNREAD_COUNT_R:"A-clear_all_unread_count-R",A_GET_TOP_CONVERSATION_LIST_T:"A-get_top_conversation_list-T",A_GET_TOP_CONVERSATION_LIST_R:"A-get_top_conversation_list-R",A_GET_UNREAD_CONVERSATION_LIST_T:"A-get_unread_conversation_list-T",A_GET_UNREAD_CONVERSATION_LIST_R:"A-get_unread_conversation_list-R",A_GET_BLOCKED_CONVERSATION_LIST_T:"A-get_blocked_conversation_list-T",A_GET_BLOCKED_CONVERSATION_LIST_R:"A-get_blocked_conversation_list-R",A_GET_ALL_CONVERSATION_LIST_T:"A-get_all_conversation_list-T",A_GET_ALL_CONVERSATION_LIST_R:"A-get_all_conversation_list-R",A_GET_CONVERSATION_LIST_BY_TIME_T:"A-get_conversation_list_by_time-T",A_GET_CONVERSATION_LIST_BY_TIME_R:"A-get_conversation_list_by_time-R",A_GET_CONVERSATION_LIST_OLD_T:"A-get_conversation_list_old-T",A_GET_CONVERSATION_LIST_OLD_R:"A-get_conversation_list_old-R",A_GET_UNREAD_MENTIONED_COUNT_T:"A-get_unread_mentioned_count-T",A_GET_UNREAD_MENTIONED_COUNT_R:"A-get_unread_mentioned_count-R",A_GET_ALL_UNREAD_MENTIONED_COUNT_T:"A-get_all_unread_mentioned_count-T",A_GET_ALL_UNREAD_MENTIONED_COUNT_R:"A-get_all_unread_mentioned_count-R",A_GET_REALTIME_CONVERSATIONS_T:"A-get_realtime_conversations-T",A_GET_REALTIME_CONVERSATIONS_R:"A-get_realtime_conversations-R",A_GET_REALTIM_CON_TOTAL_UNREAD_COUNT_T:"A-get_realtime_con_total_unread_count-T",A_GET_REALTIM_CON_TOTAL_UNREAD_COUNT_R:"A-get_realtime_con_total_unread_count-R",A_CLEAR_REALTIME_CON_UNREAD_COUNT_T:"A-clear_realtime_con_unread_count-T",A_CLEAR_REALTIME_CON_UNREAD_COUNT_R:"A-clear_realtime_con_unread_count-R",A_REMOVE_REALTIME_CONVERSATIONS_T:"A-remove_realtime_conversations-T",A_REMOVE_REALTIME_CONVERSATIONS_R:"A-remove_realtime_conversations-R",A_BATCH_GET_REALTIME_CON_UNREAD_COUNT_T:"A-batch_get_realtime_con_unread_count-T",A_BATCH_GET_REALTIME_CON_UNREAD_COUNT_R:"A-batch_get_realtime_con_unread_count-R",A_GET_SUB_USERS_STATUS_T:"A-get_sub_users_status-T",A_GET_SUB_USERS_STATUS_R:"A-get_sub_users_status-R",A_GET_SUB_USERS_ONLINE_STATUS_T:"A-get_sub_users_online_status-T",A_GET_SUB_USERS_ONLINE_STATUS_R:"A-get_sub_users_online_status-R",A_SAVE_EDITED_MSG_DRAFT_T:"A-save_edited_msg_draft-T",A_SAVE_EDITED_MSG_DRAFT_R:"A-save_edited_msg_draft-R",A_GET_EDITED_MSG_DRAFT_T:"A-get_edited_msg_draft-T",A_GET_EDITED_MSG_DRAFT_R:"A-get_edited_msg_draft-R",A_CLEAR_EDITED_MSG_DRAFT_T:"A-clear_edited_msg_draft-T",A_CLEAR_EDITED_MSG_DRAFT_R:"A-clear_edited_msg_draft-R",A_GET_UNREAD_MENTION_ME_CONVERSATION_LIST_T:"A-get_unread_mention_me_conversation_list-T",A_GET_UNREAD_MENTION_ME_CONVERSATION_LIST_R:"A-get_unread_mention_me_conversation_list-R",A_GET_USER_PROFILES_T:"A-get_user_profiles-T",A_GET_USER_PROFILES_R:"A-get_user_profiles-R",A_ADD_TO_BLACKLIST_T:"A-add_to_blacklist-T",A_ADD_TO_BLACKLIST_R:"A-add_to_blacklist-R",A_REMOVE_FROM_BLACKLIST_T:"A-remove_from_blacklist-T",A_REMOVE_FROM_BLACKLIST_R:"A-remove_from_blacklist-R",A_GET_BLACKLIST_T:"A-get_blacklist-T",A_GET_BLACKLIST_R:"A-get_blacklist-R",A_GET_BLACKLIST_STATUS_T:"A-get_blacklist_status-T",A_GET_BLACKLIST_STATUS_R:"A-get_blacklist_status-R",A_E_SET_MSG_RECEIVED_STATUS_T:"A-e_set_msg_received_status-T",A_E_SET_MSG_RECEIVED_STATUS_R:"A-e_set_msg_received_status-R",A_E_SET_MSG_SENT_STATUS_T:"A-e_set_msg_sent_status-T",A_E_SET_MSG_SENT_STATUS_R:"A-e_set_msg_sent_status-R",A_E_SET_CHECK_DUPLICATE_MSG_T:"A-e_set_check_duplicate_msg-T",A_E_SET_CHECK_DUPLICATE_MSG_R:"A-e_set_check_duplicate_msg-R",A_SET_PROXY_T:"A-set_proxy-T",A_SET_PROXY_R:"A-set_proxy-R",A_GET_PROXY_T:"A-get_proxy-T",A_GET_PROXY_R:"A-get_proxy-R",A_TEST_PROXY_T:"A-test_proxy-T",A_TEST_PROXY_R:"A-test_proxy-R",A_CLEAR_UNREAD_COUNT_BY_TIME_T:"A-clear_unread_count_by_time-T",A_CLEAR_UNREAD_COUNT_BY_TIME_R:"A-clear_unread_count_by_time-R",A_GET_MSG_READER_T:"A-get_msg_reader-T",A_GET_MSG_READER_R:"A-get_msg_reader-R",A_SEND_READ_RECEIPT_V4_T:"A-send_read_receipt_v4-T",A_SEND_READ_RECEIPT_V4_R:"A-send_read_receipt_v4-R",A_GET_READ_RECEIPT_V4_T:"A-get_read_receipt_V4-T",A_GET_READ_RECEIPT_V4_R:"A-get_read_receipt_V4-R",A_BATCH_GET_READ_RECEIPT_INFO_V4_T:"A-batch_get_read_receipt_info_V4-T",A_BATCH_GET_READ_RECEIPT_INFO_V4_R:"A-batch_get_read_receipt_info_V4-R",A_GET_ALL_ROBOTS_T:"A-get_all_robots-T",A_GET_ALL_ROBOTS_R:"A-get_all_robots-R",A_GET_ROBOT_BY_ID_T:"A-get_robot_by_id-T",A_GET_ROBOT_BY_ID_R:"A-get_robot_by_id-R",A_ADD_FRIEND_T:"A-add_friend-T",A_ADD_FRIEND_R:"A-add_friend-R",A_DELETE_FRIENDS_T:"A-delete_friends-T",A_DELETE_FRIENDS_R:"A-delete_friends-R",A_ACCEPT_FRIEND_REQUEST_T:"A-accept_friend_request-T",A_ACCEPT_FRIEND_REQUEST_R:"A-accept_friend_request-R",A_REFUSE_FRIEND_REQUEST_T:"A-refuse_friend_request-T",A_REFUSE_FRIEND_REQUEST_R:"A-refuse_friend_request-R",A_SET_FRIEND_INFO_T:"A-set_friend_info-T",A_SET_FRIEND_INFO_R:"A-set_friend_info-R",A_CHECK_FRIENDS_T:"A-check_friends-T",A_CHECK_FRIENDS_R:"A-check_friends-R",A_GET_FRIENDS_T:"A-get_friends-T",A_GET_FRIENDS_R:"A-get_friends-R",A_GET_FRIEND_APPLICATIONS_T:"A-get_friend_applications-T",A_GET_FRIEND_APPLICATIONS_R:"A-get_friend_applications-R",A_GET_FRIENDS_INFO_T:"A-get_friends_info-T",A_GET_FRIENDS_INFO_R:"A-get_friends_info-R",A_SEARCH_FRIENDS_INFO_T:"A-search_friends_info-T",A_SEARCH_FRIENDS_INFO_R:"A-search_friends_info-R",A_SET_FRIEND_ADD_PERMISSION_T:"A-set_friend_add_permission-T",A_SET_FRIEND_ADD_PERMISSION_R:"A-set_friend_add_permission-R",A_GET_FRIEND_ADD_PERMISSION_T:"A-get_friend_add_permission-T",A_GET_FRIEND_ADD_PERMISSION_R:"A-get_friend_add_permission-R",A_CREATE_GROUP_T:"A-create_group-T",A_CREATE_GROUP_R:"A-create_group-R",A_UPDATE_GROUP_INFO_T:"A-update_group_info-T",A_UPDATE_GROUP_INFO_R:"A-update_group_info-R",A_GET_GROUPS_INFO_T:"A-get_groups_info-T",A_GET_GROUPS_INFO_R:"A-get_groups_info-R",A_KICK_GROUP_MEMBERS_T:"A-kick_group_members-T",A_KICK_GROUP_MEMBERS_R:"A-kick_group_members-R",A_QUIT_GROUP_T:"A-quit_group-T",A_QUIT_GROUP_R:"A-quit_group-R",A_DISMISS_GROUP_T:"A-dismiss_group-T",A_DISMISS_GROUP_R:"A-dismiss_group-R",A_TRANSFER_GROUP_OWNER_T:"A-transfer_group_owner-T",A_TRANSFER_GROUP_OWNER_R:"A-transfer_group_owner-R",A_ADD_GROUP_MANAGERS_T:"A-add_group_managers-T",A_ADD_GROUP_MANAGERS_R:"A-add_group_managers-R",A_REMOVE_GROUP_MANAGERS_T:"A-remove_group_managers-T",A_REMOVE_GROUP_MANAGERS_R:"A-remove_group_managers-R",A_GET_GROUP_MEMBERS_T:"A-get_group_members-T",A_GET_GROUP_MEMBERS_R:"A-get_group_members-R",A_SET_GROUP_MEMBER_INFO_T:"A-set_group_member_info-T",A_SET_GROUP_MEMBER_INFO_R:"A-set_group_member_info-R",A_SEARCH_GROUP_MEMBERS_T:"A-search_group_members-T",A_SEARCH_GROUP_MEMBERS_R:"A-search_group_members-R",A_JOIN_GROUP_T:"A-join_group-T",A_JOIN_GROUP_R:"A-join_group-R",A_INVITE_USERS_TO_GROUP_T:"A-invite_users_to_group-T",A_INVITE_USERS_TO_GROUP_R:"A-invite_users_to_group-R",A_ADD_GROUP_FOLLOWS_T:"A-add_group_follows-T",A_ADD_GROUP_FOLLOWS_R:"A-add_group_follows-R",A_REMOVE_GROUP_FOLLOWS_T:"A-remove_group_follows-T",A_REMOVE_GROUP_FOLLOWS_R:"A-remove_group_follows-R",A_GET_GROUP_FOLLOWS_T:"A-get_group_follows-T",A_GET_GROUP_FOLLOWS_R:"A-get_group_follows-R",A_SET_GROUP_REMARK_T:"A-set_group_remark-T",A_SET_GROUP_REMARK_R:"A-set_group_remark-R",A_GET_GROUP_MEMBERS_BY_ROLE_T:"A-get_group_members_by_role-T",A_GET_GROUP_MEMBERS_BY_ROLE_R:"A-get_group_members_by_role-R",A_ACCEPT_GROUP_INVITE_T:"A-accept_group_invite-T",A_ACCEPT_GROUP_INVITE_R:"A-accept_group_invite-R",A_REFUSE_GROUP_INVITE_T:"A-refuse_group_invite-T",A_REFUSE_GROUP_INVITE_R:"A-refuse_group_invite-R",A_ACCEPT_GROUP_APPLICATION_T:"A-accept_group_application-T",A_ACCEPT_GROUP_APPLICATION_R:"A-accept_group_application-R",A_REFUSE_GROUP_APPLICATION_T:"A-refuse_group_application-T",A_REFUSE_GROUP_APPLICATION_R:"A-refuse_group_application-R",A_GET_GROUP_APPLICATIONS_T:"A-get_group_applications-T",A_GET_GROUP_APPLICATIONS_R:"A-get_group_applications-R",A_GET_JOINED_GROUPS_BY_ROLES_T:"A-get_joined_groups_by_roles-T",A_GET_JOINED_GROUPS_BY_ROLES_R:"A-get_joined_groups_by_roles-R",A_SEARCH_JOINED_GROUPS_T:"A-search_joined_groups-T",A_SEARCH_JOINED_GROUPS_R:"A-search_joined_groups-R",A_GET_JOINED_GROUPS_T:"A-get_joined_groups-T",A_GET_JOINED_GROUPS_R:"A-get_joined_groups-R",A_SEARCH_USER_PROFILE_BY_UNIQUE_ID_T:"A-search_user_profile_by_unique_id-T",A_SEARCH_USER_PROFILE_BY_UNIQUE_ID_R:"A-search_user_profile_by_unique_id-R",A_UPDATE_MY_USER_PROFILE_VISIBILITY_T:"A-update_my_user_profile_visibility-T",A_UPDATE_MY_USER_PROFILE_VISIBILITY_R:"A-update_my_user_profile_visibility-R",A_GET_MY_USER_PROFILE_VISIBILITY_T:"A-get_my_user_profile_visibility-T",A_GET_MY_USER_PROFILE_VISIBILITY_R:"A-get_my_user_profile_visibility-R",A_SUBSCRIBE_USER_STATUS_T:"A-subscribe_user_status-T",A_SUBSCRIBE_USER_STATUS_R:"A-subscribe_user_status-R",A_UNSUBSCRIBE_USER_STATUS_T:"A-unsubscribe_user_status-T",A_UNSUBSCRIBE_USER_STATUS_R:"A-unsubscribe_user_status-R",A_GET_SUBSCRIBE_USER_STATUS_LIST_T:"A-get_subscribe_user_status_list-T",A_GET_SUBSCRIBE_USER_STATUS_LIST_R:"A-get_subscribe_user_status_list-R",A_GET_MY_USER_PROFILE_T:"A-get_my_user_profile-T",A_GET_MY_USER_PROFILE_R:"A-get_my_user_profile-R",A_UPDATE_MY_USER_PROFILE_T:"A-update_my_user_profile-T",A_UPDATE_MY_USER_PROFILE_R:"A-update_my_user_profile-R",A_GET_CONVERSATIONS_INCLUDING_ROBOTS_T:"A-get_conversations_including_robots-T",A_GET_CONVERSATIONS_INCLUDING_ROBOTS_R:"A-get_conversations_including_robots-R",L_PULL_SG_UNREAD_COUNT_T:"L-pull_sg_unread_count-T",L_PULL_SG_UNREAD_COUNT_R:"L-pull_sg_unread_count-R",A_MARK_REMOTE_CONVERSATION_AS_READ_T:"A-mark_remote_conversation_as_read-T",A_MARK_REMOTE_CONVERSATION_AS_READ_R:"A-mark_remote_conversation_as_read-R",A_ADD_MSG_REACTION_T:"A-add_msg_reaction-T",A_ADD_MSG_REACTION_R:"A-add_msg_reaction-R",A_REMOVE_MSG_REACTION_T:"A-remove_msg_reaction-T",A_REMOVE_MSG_REACTION_R:"A-remove_msg_reaction-R",A_BATCH_GET_MSG_REACTION_SUMMARIES_T:"A-batch_get_msg_reaction_summaries-T",A_BATCH_GET_MSG_REACTION_SUMMARIES_R:"A-batch_get_msg_reaction_summaries-R",A_GET_MSG_REACTIONS_T:"A-get_msg_reactions-T",A_GET_MSG_REACTIONS_R:"A-get_msg_reactions-R",A_GET_MSG_REACTION_USERS_T:"A-get_msg_reaction_users-T",A_GET_MSG_REACTION_USERS_R:"A-get_msg_reaction_users-R",L_EXEC_CUSTOM_CONVERSATION_STORAGE_EVICTION_E:"L-exec_custom_conversation_storage_eviction-E",A_GET_MESSAGES_T:"A-get_msgs-T",A_GET_MESSAGES_R:"A-get_msgs-R"};var o,a,l,c,_,d,u,h,g,E,I,T,f,R,A,p,m,S,v,N,O,y,C,M,b,L,U,P,D,w;!function(e){e[e.BOTH=2]="BOTH"}(o||(o={})),function(e){e[e.BOTH=2]="BOTH"}(a||(a={})),function(e){e[e.FREE=1]="FREE",e[e.NEED_VERIFY=2]="NEED_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(l||(l={})),function(e){e[e.NONE=0]="NONE",e[e.IN_MY_FRIEND_LIST=1]="IN_MY_FRIEND_LIST",e[e.IN_OTHER_FRIEND_LIST=2]="IN_OTHER_FRIEND_LIST",e[e.BOTH_WAY=3]="BOTH_WAY"}(c||(c={})),function(e){e[e.SENT=1]="SENT",e[e.RECEIVED=2]="RECEIVED"}(_||(_={})),function(e){e[e.UNHANDLED=0]="UNHANDLED",e[e.ACCEPTED=1]="ACCEPTED",e[e.REFUSED=2]="REFUSED",e[e.EXPIRED=3]="EXPIRED"}(d||(d={})),function(e){e[e.FRIEND_APPLICATION=31]="FRIEND_APPLICATION"}(u||(u={})),function(e){e[e.FRIEND_APPLY=0]="FRIEND_APPLY",e[e.FRIEND_REFUSE=1]="FRIEND_REFUSE",e[e.FRIEND_USER_INFO=2]="FRIEND_USER_INFO",e[e.FRIENDS_INPUT=3]="FRIENDS_INPUT",e[e.FRIEND_CLEAR=4]="FRIEND_CLEAR",e[e.FRIEND_INFO_CHANGE=5]="FRIEND_INFO_CHANGE",e[e.FRIEND_INFO_CHANGE_SYNC=6]="FRIEND_INFO_CHANGE_SYNC"}(h||(h={})),function(e){e[e.OWNER_VERIFY=0]="OWNER_VERIFY",e[e.FREE=1]="FREE",e[e.OWNER_OR_MANAGER_VERIFY=2]="OWNER_OR_MANAGER_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(g||(g={})),function(e){e[e.OWNER=0]="OWNER",e[e.OWNER_OR_MANAGER=1]="OWNER_OR_MANAGER",e[e.EVERYONE=2]="EVERYONE"}(E||(E={})),function(e){e[e.OWNER_OR_MANAGER_OR_SELF=0]="OWNER_OR_MANAGER_OR_SELF",e[e.OWNER_OR_SELF=1]="OWNER_OR_SELF",e[e.SELF=2]="SELF"}(I||(I={})),function(e){e[e.FREE=0]="FREE",e[e.INVITEE_VERIFY=1]="INVITEE_VERIFY"}(T||(T={})),function(e){e[e.UNDEF=0]="UNDEF",e[e.NORMAL=1]="NORMAL",e[e.MANAGER=2]="MANAGER",e[e.OWNER=3]="OWNER"}(f||(f={})),function(e){e[e.CREATE=0]="CREATE",e[e.JOIN=1]="JOIN",e[e.KICK=2]="KICK",e[e.QUIT=3]="QUIT",e[e.DISMISS=4]="DISMISS",e[e.ADD_MANAGER=5]="ADD_MANAGER",e[e.REMOVE_MANAGER=6]="REMOVE_MANAGER",e[e.TRANSFER_GROUP_OWNER=7]="TRANSFER_GROUP_OWNER"}(R||(R={})),function(e){e[e.GROUP_INFO_CHANGE=0]="GROUP_INFO_CHANGE",e[e.MEMBER_PROFILE_CHANGE=1]="MEMBER_PROFILE_CHANGE",e[e.GROUP_REMARK_SET=2]="GROUP_REMARK_SET",e[e.GROUP_REMARK_DELETE=3]="GROUP_REMARK_DELETE"}(A||(A={})),function(e){e[e.ADD=1]="ADD",e[e.REMOVE=2]="REMOVE"}(p||(p={})),function(e){e[e.MANAGER_UNHANDLED=0]="MANAGER_UNHANDLED",e[e.MANAGER_REFUSED=1]="MANAGER_REFUSED",e[e.INVITEE_UNHANDLED=2]="INVITEE_UNHANDLED",e[e.INVITEE_REFUSED=3]="INVITEE_REFUSED",e[e.JOINED=4]="JOINED",e[e.EXPIRED=5]="EXPIRED"}(m||(m={})),function(e){e[e.REFUSE=0]="REFUSE",e[e.ACCEPT=1]="ACCEPT"}(S||(S={})),function(e){e[e.APPLICANT=0]="APPLICANT",e[e.MANAGER=1]="MANAGER"}(v||(v={})),function(e){e[e.GROUP_OPERATION=11]="GROUP_OPERATION",e[e.GROUP_PROFILE_CHANGE=12]="GROUP_PROFILE_CHANGE",e[e.GROUP_APPLICATION_INVITATION=13]="GROUP_APPLICATION_INVITATION",e[e.GROUP_FOLLOW_USER_CHANGE=14]="GROUP_FOLLOW_USER_CHANGE"}(N||(N={})),function(e){e[e.APPLICATION=0]="APPLICATION",e[e.INVITATION=1]="INVITATION"}(O||(O={})),function(e){e[e.APPLICATION_SENT=0]="APPLICATION_SENT",e[e.INVITATION_SENT=1]="INVITATION_SENT",e[e.INVITATION_RECEIVED=2]="INVITATION_RECEIVED",e[e.APPLICATION_RECEIVED=3]="APPLICATION_RECEIVED"}(y||(y={})),function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(C||(C={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(M||(M={})),function(e){e[e.LeaveOnMyOwn=1]="LeaveOnMyOwn",e[e.OtherDeviceLogin=2]="OtherDeviceLogin"}(b||(b={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(L||(L={})),function(e){e[e.UnmuteUsers=0]="UnmuteUsers",e[e.MuteUsers=1]="MuteUsers",e[e.UnmuteAll=2]="UnmuteAll",e[e.MuteAll=3]="MuteAll",e[e.RemoveWhitelist=4]="RemoveWhitelist",e[e.AddWhitelist=5]="AddWhitelist",e[e.UnmuteGloble=6]="UnmuteGloble",e[e.MuteGloble=7]="MuteGloble"}(U||(U={})),function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(P||(P={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.NOT_IN_WHITELIST=407]="NOT_IN_WHITELIST",e[e.FORBIDDEN_IN_PRIVATE=20106]="FORBIDDEN_IN_PRIVATE",e[e.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",e[e.DANGEROUS_CONTENT=20112]="DANGEROUS_CONTENT",e[e.CONTENT_REVIEW_REJECTED=20113]="CONTENT_REVIEW_REJECTED",e[e.MESSAGE_OVER_MODIFY_TIME_FAIL=20114]="MESSAGE_OVER_MODIFY_TIME_FAIL",e[e.MESSAGE_SIZE_EXCEEDED=20115]="MESSAGE_SIZE_EXCEEDED",e[e.MESSAGE_UNSUPPORTED_MODIFY=20116]="MESSAGE_UNSUPPORTED_MODIFY",e[e.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",e[e.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",e[e.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",e[e.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",e[e.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",e[e.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET=24360]="RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET",e[e.RC_USER_PROFILE_KEY_NOT_EXIST=24361]="RC_USER_PROFILE_KEY_NOT_EXIST",e[e.RC_USER_PROFILE_EXT_KEY_NOT_EXIST=24362]="RC_USER_PROFILE_EXT_KEY_NOT_EXIST",e[e.RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT=24363]="RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT",e[e.RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT=24364]="RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT",e[e.RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT=24365]="RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT",e[e.RC_USER_PROFILE_USER_NOT_EXIST=24366]="RC_USER_PROFILE_USER_NOT_EXIST",e[e.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS=24367]="RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS",e[e.RC_USER_PROFILE_VALUE_EXCEED_RANGE=24368]="RC_USER_PROFILE_VALUE_EXCEED_RANGE",e[e.RC_USER_PROFILE_SERVICE_UNAVAILABLE=24369]="RC_USER_PROFILE_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",e[e.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",e[e.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",e[e.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",e[e.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",e[e.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",e[e.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",e[e.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",e[e.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",e[e.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",e[e.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",e[e.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",e[e.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",e[e.RC_ENTRUST_SERVER_ERROR=25402]="RC_ENTRUST_SERVER_ERROR",e[e.RC_ENTRUST_SERVER_PARAMETER_ERROR=25403]="RC_ENTRUST_SERVER_PARAMETER_ERROR",e[e.RC_GROUP_ILLEGAL_ERROR=25404]="RC_GROUP_ILLEGAL_ERROR",e[e.RC_GROUP_AUTHORITY_ERROR=25405]="RC_GROUP_AUTHORITY_ERROR",e[e.RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT=25406]="RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT",e[e.RC_GROUP_PARAMETER_FORMAT_ERROR=25407]="RC_GROUP_PARAMETER_FORMAT_ERROR",e[e.RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS=25408]="RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS",e[e.RC_GROUP_ID_ALREADY_EXIST=25409]="RC_GROUP_ID_ALREADY_EXIST",e[e.RC_GROUP_ID_NOT_EXIST=25410]="RC_GROUP_ID_NOT_EXIST",e[e.RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT=25411]="RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_MEMBERS_ALREADY_IN_GROUP=25412]="RC_GROUP_MEMBERS_ALREADY_IN_GROUP",e[e.RC_GROUP_NOT_ALLOW_SDK_OPERATION=25413]="RC_GROUP_NOT_ALLOW_SDK_OPERATION",e[e.RC_GROUP_NOT_ALLOW_JOIN=25414]="RC_GROUP_NOT_ALLOW_JOIN",e[e.RC_GROUP_EXT_KEY_NOT_EXIST=25415]="RC_GROUP_EXT_KEY_NOT_EXIST",e[e.RC_GROUP_REQUEST_OVERFREQUENCY=25416]="RC_GROUP_REQUEST_OVERFREQUENCY",e[e.RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK=25417]="RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK",e[e.RC_GROUP_USER_NOT_IN_GROUP=25418]="RC_GROUP_USER_NOT_IN_GROUP",e[e.RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT=25419]="RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP=25420]="RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP",e[e.RC_GROUP_APPLICATION_NOT_EXIST=25421]="RC_GROUP_APPLICATION_NOT_EXIST",e[e.RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT=25422]="RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_NAME_INVALID=25423]="RC_GROUP_NAME_INVALID",e[e.RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT=25424]="RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT",e[e.RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER=25425]="RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER",e[e.RC_GROUP_NO_INVITE_PERMISSION=25426]="RC_GROUP_NO_INVITE_PERMISSION",e[e.RC_GROUP_NEED_INVITEE_ACCEPT=25427]="RC_GROUP_NEED_INVITEE_ACCEPT",e[e.RC_GROUP_APPLICATION_ALREADY_HANDLE=25428]="RC_GROUP_APPLICATION_ALREADY_HANDLE",e[e.RC_GROUP_OLD_GROUP_NOT_ENTRUST=25429]="RC_GROUP_OLD_GROUP_NOT_ENTRUST",e[e.RC_GROUP_ID_INVALID=25430]="RC_GROUP_ID_INVALID",e[e.RC_PAGE_TOKEN_PARSING_FAILED=25432]="RC_PAGE_TOKEN_PARSING_FAILED",e[e.RC_FRIEND_ALREADY_FRIEND=25460]="RC_FRIEND_ALREADY_FRIEND",e[e.RC_FRIEND_NEED_ACCEPT=25461]="RC_FRIEND_NEED_ACCEPT",e[e.RC_FRIEND_IN_OTHER_BLACK_LIST=25462]="RC_FRIEND_IN_OTHER_BLACK_LIST",e[e.RC_FRIEND_NOT_IN_OTHER_WHITE_LIST=25463]="RC_FRIEND_NOT_IN_OTHER_WHITE_LIST",e[e.RC_FRIEND_IN_MY_BLACK_LIST=25464]="RC_FRIEND_IN_MY_BLACK_LIST",e[e.RC_FRIEND_NOT_IN_MY_WHITE_LIST=25465]="RC_FRIEND_NOT_IN_MY_WHITE_LIST",e[e.RC_FRIEND_APPLICATION_NOT_EXIST=25466]="RC_FRIEND_APPLICATION_NOT_EXIST",e[e.RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT=25467]="RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT",e[e.RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT=25468]="RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT",e[e.RC_FRIEND_NOT_FRIEND=25469]="RC_FRIEND_NOT_FRIEND",e[e.RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT=25470]="RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT",e[e.RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND=25471]="RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND",e[e.RC_FRIEND_NOT_EXIST=25472]="RC_FRIEND_NOT_EXIST",e[e.RC_FRIEND_NOT_ALLOW_ADD_SELF=25473]="RC_FRIEND_NOT_ALLOW_ADD_SELF",e[e.RC_FRIEND_NOT_SUPPORT_ROBOT=25474]="RC_FRIEND_NOT_SUPPORT_ROBOT",e[e.SERVICE_INFORMATION_AUDIT_FAILED=25480]="SERVICE_INFORMATION_AUDIT_FAILED",e[e.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",e[e.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",e[e.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",e[e.RC_READ_RECEIPT_V4_INVALID=26005]="RC_READ_RECEIPT_V4_INVALID",e[e.RC_SERVER_DRIVE_UNREAD_COUNT_INVALID=26006]="RC_SERVER_DRIVE_UNREAD_COUNT_INVALID",e[e.RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED=26007]="RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED",e[e.RC_SERVER_PARAMETER_MESSAGEUID_INVALID=26009]="RC_SERVER_PARAMETER_MESSAGEUID_INVALID",e[e.RC_SERVER_PARAMETER_INVALID=26010]="RC_SERVER_PARAMETER_INVALID",e[e.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE=26020]="RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE",e[e.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT=26021]="RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT",e[e.RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT=26022]="RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT",e[e.RC_FILE_SIZE_EXCEED_LIMIT=26106]="RC_FILE_SIZE_EXCEED_LIMIT",e[e.INVALID_PARAMETER_SIZE_NOT_FOUND=26107]="INVALID_PARAMETER_SIZE_NOT_FOUND",e[e.SERVICE_RRSV5_UNAVAILABLE=26314]="SERVICE_RRSV5_UNAVAILABLE",e[e.SERVICE_RRSV5_READ_RECEIPT_NOT_SUPPORT=26315]="SERVICE_RRSV5_READ_RECEIPT_NOT_SUPPORT",e[e.SERVICE_RRSV5_PARAM_LENGTH_EXCEED=26316]="SERVICE_RRSV5_PARAM_LENGTH_EXCEED",e[e.SERVICE_RRSV5_CONVERSATION_NOT_SUPPORT=26317]="SERVICE_RRSV5_CONVERSATION_NOT_SUPPORT",e[e.SERVICE_RRSV5_QUERY_NOT_SUPPORT=26318]="SERVICE_RRSV5_QUERY_NOT_SUPPORT",e[e.SERVICE_RRSV5_MESSAGE_SENDER_MISMATCH=26320]="SERVICE_RRSV5_MESSAGE_SENDER_MISMATCH",e[e.SERVICE_RRSV5_MESSAGE_RECEIPT_NEEDLESS=26321]="SERVICE_RRSV5_MESSAGE_RECEIPT_NEEDLESS",e[e.SERVICE_RRSV5_MESSAGE_NOT_EXIST=26322]="SERVICE_RRSV5_MESSAGE_NOT_EXIST",e[e.MSG_REACTION_LIMIT_REACHED=26323]="MSG_REACTION_LIMIT_REACHED",e[e.MSG_REACTION_USER_LIMIT_REACHED=26324]="MSG_REACTION_USER_LIMIT_REACHED",e[e.SERVICE_STT_UNAVAILABLE=28300]="SERVICE_STT_UNAVAILABLE",e[e.SERVICE_STT_CONVERTED_FAILED=28304]="SERVICE_STT_CONVERTED_FAILED",e[e.SERVICE_STT_INTERNAL_ERROR=28305]="SERVICE_STT_INTERNAL_ERROR",e[e.SERVICE_STT_PARAM_MISS=28306]="SERVICE_STT_PARAM_MISS",e[e.SERVICE_STT_USAGE_EXCEED=28307]="SERVICE_STT_USAGE_EXCEED",e[e.TRANS_SERVICE_NOT_OPEN=28400]="TRANS_SERVICE_NOT_OPEN",e[e.TRANS_FAILED=28401]="TRANS_FAILED",e[e.TRANS_INTERNAL_ERROR=28402]="TRANS_INTERNAL_ERROR",e[e.TRANS_PARAM_MISSING=28403]="TRANS_PARAM_MISSING",e[e.TRANS_PARAM_ERROR=28404]="TRANS_PARAM_ERROR",e[e.TRANS_QUOTA_LIMIT=28405]="TRANS_QUOTA_LIMIT",e[e.TRANS_TEXT_LENGTH_EXCEEDS_LIMIT=28406]="TRANS_TEXT_LENGTH_EXCEEDS_LIMIT",e[e.TRANS_LANGUAGE_NOT_SUPPORT=28407]="TRANS_LANGUAGE_NOT_SUPPORT",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",e[e.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.MESSAGE_NOT_SUPPORT_SENDING=30017]="MESSAGE_NOT_SUPPORT_SENDING",e[e.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",e[e.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",e[e.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",e[e.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",e[e.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",e[e.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",e[e.RC_TCP_RESET=32054]="RC_TCP_RESET",e[e.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",e[e.PROTOCOL_DECODE_ERROR=32546]="PROTOCOL_DECODE_ERROR",e[e.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.METHOD_BUSY=33103]="METHOD_BUSY",e[e.NOT_ALLOW_PULL_CONVERSATION=33301]="NOT_ALLOW_PULL_CONVERSATION",e[e.SDK_PULL_CONVERSATION=33302]="SDK_PULL_CONVERSATION",e[e.MODIFIED_MESSAGE_IS_NOT_SENT=33401]="MODIFIED_MESSAGE_IS_NOT_SENT",e[e.MODIFIED_MESSAGE_TIMEOUT=33402]="MODIFIED_MESSAGE_TIMEOUT",e[e.QUOTE_MSG_NOT_FOUND=33403]="QUOTE_MSG_NOT_FOUND",e[e.INVALID_PARAMETER_QUOTE_INFO=33404]="INVALID_PARAMETER_QUOTE_INFO",e[e.REACTION_ID_INVALID=33405]="REACTION_ID_INVALID",e[e.INVALID_PARAMETER_UNREAD_COUNT_FILTER=33406]="INVALID_PARAMETER_UNREAD_COUNT_FILTER",e[e.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",e[e.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",e[e.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.UPLOAD_FAIL=34011]="UPLOAD_FAIL",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",e[e.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",e[e.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",e[e.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",e[e.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",e[e.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",e[e.INVALID_PARAMETER_LAUGUAGE=34200]="INVALID_PARAMETER_LAUGUAGE",e[e.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",e[e.INVALID_PARAMETER_TIMESTAMP=34202]="INVALID_PARAMETER_TIMESTAMP",e[e.INVALID_PARAMETER_MESSAGE_UID=34203]="INVALID_PARAMETER_MESSAGE_UID",e[e.INVALID_PARAMETER_MESSAGE_ID=34204]="INVALID_PARAMETER_MESSAGE_ID",e[e.INVALID_PARAMETER_MESSAGE_CONTENT=34205]="INVALID_PARAMETER_MESSAGE_CONTENT",e[e.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",e[e.INVALID_PARAMETER_MEDIA_TYPE=34207]="INVALID_PARAMETER_MEDIA_TYPE",e[e.INVALID_PARAMETER_REQUEST_URL=34208]="INVALID_PARAMETER_REQUEST_URL",e[e.INVALID_PARAMETER_CONVERSATION_TYPE=34209]="INVALID_PARAMETER_CONVERSATION_TYPE",e[e.INVALID_PARAMETER_TARGET_ID=34210]="INVALID_PARAMETER_TARGET_ID",e[e.INVALID_PARAMETER_CHANNEL_ID=34211]="INVALID_PARAMETER_CHANNEL_ID",e[e.INVALID_PARAMETER_TAG_ID=34212]="INVALID_PARAMETER_TAG_ID",e[e.INVALID_PARAMETER_TAG_NAME=34213]="INVALID_PARAMETER_TAG_NAME",e[e.INVALID_PARAMETER_USER_ID=34214]="INVALID_PARAMETER_USER_ID",e[e.INVALID_PARAMETER_USERIDLIST=34215]="INVALID_PARAMETER_USERIDLIST",e[e.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME=34217]="INVALID_PARAMETER_DOWNLOADMEDIAFILENAME",e[e.INVALID_PARAMETER_MESSAGE_EXPANSION=34220]="INVALID_PARAMETER_MESSAGE_EXPANSION",e[e.INVALID_PARAMETER_NOTMEDIAMESSAGE=34223]="INVALID_PARAMETER_NOTMEDIAMESSAGE",e[e.INVALID_PARAMETER_TIMESTRING=34224]="INVALID_PARAMETER_TIMESTRING",e[e.INVALID_PARAMETER_CONVERSATION=34225]="INVALID_PARAMETER_CONVERSATION",e[e.INVALID_PARAMETER_NOTIFICATION_LEVEL=34228]="INVALID_PARAMETER_NOTIFICATION_LEVEL",e[e.INVALID_PARAMETER_MESSAGE_ARRAY=34229]="INVALID_PARAMETER_MESSAGE_ARRAY",e[e.INVALID_PARAMETER_RECEIVED_STATUS=34230]="INVALID_PARAMETER_RECEIVED_STATUS",e[e.INVALID_PARAMETER_CHANNEL_TYPE=34231]="INVALID_PARAMETER_CHANNEL_TYPE",e[e.INVALID_PARAMETER_COUNT=34232]="INVALID_PARAMETER_COUNT",e[e.INVALID_PARAMETER_MEDIA_URL=34235]="INVALID_PARAMETER_MEDIA_URL",e[e.INVALID_PARAMETER_UNIQUE_ID=34236]="INVALID_PARAMETER_UNIQUE_ID",e[e.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",e[e.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",e[e.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",e[e.INVALID_PARAMETER_CONVERSATIONS=34242]="INVALID_PARAMETER_CONVERSATIONS",e[e.INVALID_PARAMETER_SENT_STATUS=34244]="INVALID_PARAMETER_SENT_STATUS",e[e.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",e[e.INVALID_PARAMETER_RTCROOMID=34259]="INVALID_PARAMETER_RTCROOMID",e[e.INVALID_PARAMETER_KEY=34260]="INVALID_PARAMETER_KEY",e[e.INVALID_PARAMETER_KEYS=34261]="INVALID_PARAMETER_KEYS",e[e.INVALID_PARAMETER_VALUE=34262]="INVALID_PARAMETER_VALUE",e[e.INVALID_PARAMETER_ENTRIES=34263]="INVALID_PARAMETER_ENTRIES",e[e.INVALID_PARAMETER_NOTIFICATION_EXTRA=34264]="INVALID_PARAMETER_NOTIFICATION_EXTRA",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME=34271]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME",e[e.INVALID_PARAMETER_BEFORE=34272]="INVALID_PARAMETER_BEFORE",e[e.INVALID_PARAMETER_AFTER=34273]="INVALID_PARAMETER_AFTER",e[e.INVALID_PARAMETER_KEYWORD=34274]="INVALID_PARAMETER_KEYWORD",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST=34275]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST",e[e.INVALID_PARAMETER_OFFSET=34276]="INVALID_PARAMETER_OFFSET",e[e.INVALID_PARAMETER_START_TIME=34277]="INVALID_PARAMETER_START_TIME",e[e.INVALID_PARAMETER_END_TIME=34278]="INVALID_PARAMETER_END_TIME",e[e.INVALID_PARAMETER_LIMIT=34279]="INVALID_PARAMETER_LIMIT",e[e.INVALID_MESSAGE_DIRECTION=34280]="INVALID_MESSAGE_DIRECTION",e[e.INVALID_MESSAGE_SENT_STATUS=34281]="INVALID_MESSAGE_SENT_STATUS",e[e.INVALID_PARAMETER_TARGETID_LIST=34282]="INVALID_PARAMETER_TARGETID_LIST",e[e.INVALID_PARAMETER_SPAN_MINUTES=34283]="INVALID_PARAMETER_SPAN_MINUTES",e[e.INVALID_PARAMETER_CONVERSATION_TYPE_LIST=34284]="INVALID_PARAMETER_CONVERSATION_TYPE_LIST",e[e.INVALID_PARAMETER_CONVERSATION_LIST=34287]="INVALID_PARAMETER_CONVERSATION_LIST",e[e.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST=34288]="INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST",e[e.INVALID_PARAMETER_START_MESSAGE_UID=34289]="INVALID_PARAMETER_START_MESSAGE_UID",e[e.INVALID_PARAMETER_END_MESSAGE_UID=34290]="INVALID_PARAMETER_END_MESSAGE_UID",e[e.READ_RECEIPT_V4_NOT_SUPPORT=34291]="READ_RECEIPT_V4_NOT_SUPPORT",e[e.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34292]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",e[e.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE=34296]="RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE",e[e.RC_DB_NOT_INIT=34301]="RC_DB_NOT_INIT",e[e.RC_DB_CORRUPT=34302]="RC_DB_CORRUPT",e[e.RC_DB_SQL_ERROR=34303]="RC_DB_SQL_ERROR",e[e.RC_DB_DATA_NOT_FOUND=34304]="RC_DB_DATA_NOT_FOUND",e[e.RC_NET_DATA_ERROR=34305]="RC_NET_DATA_ERROR",e[e.INVALID_PARAMETER_SUBSCRIBE_TYPE=34306]="INVALID_PARAMETER_SUBSCRIBE_TYPE",e[e.INVALID_PARAMETER_SUBSCRIBE_EXPIRY=34307]="INVALID_PARAMETER_SUBSCRIBE_EXPIRY",e[e.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS=34308]="INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS",e[e.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE=34309]="INVALID_PARAMETER_SUBSCRIBE_PAGESIZE",e[e.SUB_PROCESS_EXIT=34310]="SUB_PROCESS_EXIT",e[e.ADDON_NOT_EXIST=34311]="ADDON_NOT_EXIST",e[e.INVALID_PARAMETER_USER_PROFILE=34312]="INVALID_PARAMETER_USER_PROFILE",e[e.INVALID_PARAMETER_USER_PROFILE_VISIBILITY=34313]="INVALID_PARAMETER_USER_PROFILE_VISIBILITY",e[e.INVALID_PARAMETER_EXTRA=34314]="INVALID_PARAMETER_EXTRA",e[e.DB_UPGRADE_FAILED=34315]="DB_UPGRADE_FAILED",e[e.INVALID_PARAMETER_GROUP_INFO=34318]="INVALID_PARAMETER_GROUP_INFO",e[e.INVALID_PARAMETER_GROUP_ID=34319]="INVALID_PARAMETER_GROUP_ID",e[e.INVALID_PARAMETER_GROUP_NAME=34320]="INVALID_PARAMETER_GROUP_NAME",e[e.INVALID_PARAMETER_GROUP_IDS=34321]="INVALID_PARAMETER_GROUP_IDS",e[e.INVALID_PARAMETER_GROUP_MEMBER_ROLE=34322]="INVALID_PARAMETER_GROUP_MEMBER_ROLE",e[e.INVALID_PARAMETER_GROUP_APPLICATION_STATUS=34323]="INVALID_PARAMETER_GROUP_APPLICATION_STATUS",e[e.INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION=34324]="INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION",e[e.INVALID_PARAMETER_NICK_NAME=34325]="INVALID_PARAMETER_NICK_NAME",e[e.INVALID_PARAMETER_REASON=34326]="INVALID_PARAMETER_REASON",e[e.INVALID_PARAMETER_REMARK=34327]="INVALID_PARAMETER_REMARK",e[e.INVALID_PARAMETER_PAGING_QUERY_OPTION=34328]="INVALID_PARAMETER_PAGING_QUERY_OPTION",e[e.NET_DATA_IS_SYNCHRONIZING=34329]="NET_DATA_IS_SYNCHRONIZING",e[e.INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE=34330]="INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE",e[e.INVALID_PARAMETER_DIRECTION_TYPE=34331]="INVALID_PARAMETER_DIRECTION_TYPE",e[e.INVALID_PARAMETER_FRIEND_APPLICATION_TYPE=34332]="INVALID_PARAMETER_FRIEND_APPLICATION_TYPE",e[e.INVALID_PARAMETER_FRIEND_APPLICATION_STATUS=34333]="INVALID_PARAMETER_FRIEND_APPLICATION_STATUS",e[e.INVALID_PARAMETER_FRIEND_ADD_PERMISSION=34334]="INVALID_PARAMETER_FRIEND_ADD_PERMISSION",e[e.INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS=34335]="INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS",e[e.RC_REAL_TIME_CONVERSATION_UNAVAILABLE=34336]="RC_REAL_TIME_CONVERSATION_UNAVAILABLE",e[e.SERVER_DATA_ERROR=34344]="SERVER_DATA_ERROR",e[e.INVALID_PARAMETER_MESSAGE_INFO_MAP=34345]="INVALID_PARAMETER_MESSAGE_INFO_MAP",e[e.INVALID_PARAMETER_PAGE_TOKEN=34346]="INVALID_PARAMETER_PAGE_TOKEN",e[e.SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN=34435]="SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN",e[e.SERVER_RECORD_UNREAD_COUNT_DISABLED=34436]="SERVER_RECORD_UNREAD_COUNT_DISABLED",e[e.DATABASEDISKFULL=34439]="DATABASEDISKFULL",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.NOT_SUPPORT=35004]="NOT_SUPPORT",e[e.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",e[e.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",e[e.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",e[e.INVALID_PARAMETER_MESSAGE_TYPE=35024]="INVALID_PARAMETER_MESSAGE_TYPE",e[e.INVALID_PARAMETER_ORDER=35025]="INVALID_PARAMETER_ORDER",e[e.INVALID_PARAMETER_DRAFT=35028]="INVALID_PARAMETER_DRAFT",e[e.INVALID_PARAMETER_MESSAGE=35029]="INVALID_PARAMETER_MESSAGE",e[e.INVALID_PARAMETER_PUSH_CONTENT=35030]="INVALID_PARAMETER_PUSH_CONTENT",e[e.INVALID_PARAMETER_SENDOPTIONS=35031]="INVALID_PARAMETER_SENDOPTIONS",e[e.INVALID_PARAMETER_CONTENT_DISPOSITION=35032]="INVALID_PARAMETER_CONTENT_DISPOSITION",e[e.INVALID_PARAMETER_SAVE_NAME=35033]="INVALID_PARAMETER_SAVE_NAME",e[e.INVALID_PARAMETER_SERVER_TYPE=35034]="INVALID_PARAMETER_SERVER_TYPE",e[e.INVALID_PARAMETER_CLEAN_SPACE=35035]="INVALID_PARAMETER_CLEAN_SPACE",e[e.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION=35036]="INVALID_PARAMETER_CAN_INCLUDE_EXPANSION",e[e.INVALID_PARAMETER_DISABLE_NOTIFICATION=35037]="INVALID_PARAMETER_DISABLE_NOTIFICATION",e[e.INVALID_PARAMETER_CHECK_DUPLICATE=35038]="INVALID_PARAMETER_CHECK_DUPLICATE",e[e.INVALID_PARAMETER_IS_AUTO_DELETE=35039]="INVALID_PARAMETER_IS_AUTO_DELETE",e[e.INVALID_PARAMETER_IS_SEND_NOTIFICATION=35040]="INVALID_PARAMETER_IS_SEND_NOTIFICATION",e[e.INVALID_PARAMETER_IS_FORCE=35041]="INVALID_PARAMETER_IS_FORCE",e[e.INVALID_PARAMETER_IS_TOP=35042]="INVALID_PARAMETER_IS_TOP",e[e.INVALID_PARAMETER_IS_UPDATE_TIME=35043]="INVALID_PARAMETER_IS_UPDATE_TIME",e[e.INVALID_PARAMETER_CONTAIN_MUTED=35044]="INVALID_PARAMETER_CONTAIN_MUTED",e[e.INVALID_PARAMETER_IS_STATUS_MESSAGE=35045]="INVALID_PARAMETER_IS_STATUS_MESSAGE",e[e.INVALID_PARAMETER_IS_MENTIONED=35046]="INVALID_PARAMETER_IS_MENTIONED",e[e.INVALID_PARAMETER_IS_VOIP_PUSH=35047]="INVALID_PARAMETER_IS_VOIP_PUSH",e[e.INVALID_PARAMETER_MENTIONED_TYPE=35048]="INVALID_PARAMETER_MENTIONED_TYPE",e[e.INVALID_PARAMETER_PUSH_CONFIG=35049]="INVALID_PARAMETER_PUSH_CONFIG",e[e.INVALID_PARAMETER_PUSH_DATA=35050]="INVALID_PARAMETER_PUSH_DATA",e[e.DNS_PROXY_TIMEOUT=35051]="DNS_PROXY_TIMEOUT",e[e.DNS_PROXY_ERROR=35052]="DNS_PROXY_ERROR",e[e.DNS_PROXY_DATA_ERROR=35053]="DNS_PROXY_DATA_ERROR",e[e.INVALID_DISABLE_UPDATE_LAST_MESSAGE=35054]="INVALID_DISABLE_UPDATE_LAST_MESSAGE",e[e.ONLY_DEFAULT_CHANNEL_SUPPORTS_PINNING=35055]="ONLY_DEFAULT_CHANNEL_SUPPORTS_PINNING",e[e.SEND_READ_RECEIPT_CONF_ERROR=35056]="SEND_READ_RECEIPT_CONF_ERROR",e[e.SPEECH_TO_TEXT_DISABLE=35057]="SPEECH_TO_TEXT_DISABLE",e[e.SPEECH_TO_TEXT_REQUEST_IN_PROCESS=35058]="SPEECH_TO_TEXT_REQUEST_IN_PROCESS",e[e.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED=35059]="SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED",e[e.TRANSLATION_PARAMS_TYPE_INVALID=35060]="TRANSLATION_PARAMS_TYPE_INVALID",e[e.TRANSLATION_PARAMS_LIST_INVALID=35061]="TRANSLATION_PARAMS_LIST_INVALID",e[e.INVALID_PARAMETER_TRANSLATE_STRATEGY=35062]="INVALID_PARAMETER_TRANSLATE_STRATEGY",e[e.TRANSLATION_LANGUAGE_SAME=35063]="TRANSLATION_LANGUAGE_SAME",e[e.INVALID_PARAMETER_TRANSLATE_MODE=35064]="INVALID_PARAMETER_TRANSLATE_MODE",e[e.TRANSLATION_TEXT_INVALID=35065]="TRANSLATION_TEXT_INVALID",e[e.MSG_BLOCK_SEND=35066]="MSG_BLOCK_SEND",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.STREAM_MESSAGE_DISABLE=39001]="STREAM_MESSAGE_DISABLE",e[e.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED=39002]="STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED",e[e.STREAM_MESSAGE_EXPANSION_KEY_ERROR=39003]="STREAM_MESSAGE_EXPANSION_KEY_ERROR",e[e.STREAM_MESSAGE_REQUEST_FAIL=39005]="STREAM_MESSAGE_REQUEST_FAIL",e[e.STREAM_MESSAGE_REQUEST_IN_PROCESS=39006]="STREAM_MESSAGE_REQUEST_IN_PROCESS",e[e.STREAM_MESSAGE_SYNCED=39007]="STREAM_MESSAGE_SYNCED",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.TIMEOUT=-1]="TIMEOUT"}(D||(D={})),function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(w||(w={}));const G=0,V=1,k=2,x=3,F=4,B=5,H=6,j=7,Y=e=>{const t=[w.PRIVATE,w.GROUP,w.SYSTEM,w.PUBLIC_SERVICE,w.APP_PUBLIC_SERVICE];switch(e){case G:return t;case V:return[w.PRIVATE,w.GROUP];case k:return[...t,w.ULTRA_GROUP];case x:return[...t,w.ULTRA_GROUP,w.CHATROOM];case F:return[...t,w.ULTRA_GROUP,w.CHATROOM,w.RTC_ROOM,w.CUSTOMER_SERVICE,w.DISCUSSION];case B:return[w.PRIVATE,w.GROUP,w.ULTRA_GROUP];case H:return[w.GROUP];case j:return[w.PRIVATE]}},W=(e,t)=>Y(t).includes(e);var q,J,K;!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"}(q||(q={})),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"}(J||(J={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(K||(K={}));const Q={TextMessage:"RC:TxtMsg",TEXT:"RC:TxtMsg",VOICE:"RC:VcMsg",HQ_VOICE:"RC:HQVCMsg",IMAGE:"RC:ImgMsg",GIF:"RC:GIFMsg",RICH_CONTENT:"RC:ImgTextMsg",LOCATION:"RC:LBSMsg",FILE:"RC:FileMsg",SIGHT:"RC:SightMsg",COMBINE:"RC:CombineMsg",COMBINE_V2:"RC:CombineV2Msg",CHRM_KV_NOTIFY:"RC:chrmKVNotiMsg",LOG_COMMAND:"RC:LogCmdMsg",EXPANSION_NOTIFY:"RC:MsgExMsg",REFERENCE:"RC:ReferenceMsg",RECALL:"RC:RcCmd",RECALL_MESSAGE_TYPE:"RC:RcCmd",RECALL_NOTIFICATION_MESSAGE:"RC:RcNtf",READ_RECEIPT:"RC:ReadNtf",READ_RECEIPT_REQUEST:"RC:RRReqMsg",READ_RECEIPT_RESPONSE:"RC:RRRspMsg",SYNC_READ_STATUS:"RC:SRSMsg",GROUP_READ_RECEIPT_REQUEST:"RC:RRMsg",READ_STATE:"RC:RSMsg",DELIVERED:"RC:Delivered",DELIVERED_MSG:"RC:DRMsg",CHATROOM_MERGE_CHANGE:"RC:ChrmMemChange",CHATROOM_SYNC_MSG:"RC:ChrmSyncMsg",CHATROOM_MERGE_BLOCK:"RC:ChrmBlockMsg",CHATROOM_MERGE_BAN:"RC:ChrmBanMsg",TYPING_STATUS:"RC:TypSts",INTERCEPT:"RC:InterceptMsg",CLOUD_CONTROL:"RC:CCConfigChangeRequestMsg",STREAM_MESSAGE:"RC:StreamMsg",COMMAND:"RC:CmdMsg",COMMAND_NOTIFICATION:"RC:CmdNtf",INFORMATION_NOTIFICATION:"RC:InfoNtf",GROUP_NOTIFICATION:"RC:GrpNtf"};var X,z,Z,$,ee,te,ie,se,ne,re,oe,ae,le,ce,_e,de,ue,he,ge,Ee,Ie;!function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(X||(X={})),function(e){e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(z||(z={})),function(e){e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY",e[e.MSG_RECALL=3]="MSG_RECALL",e[e.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",e[e.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE",e[e.UG_DEL=6]="UG_DEL"}(Z||(Z={})),function(e){e[e.CHANNEL_DELETE=1]="CHANNEL_DELETE",e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",e[e.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}($||($={})),function(e){e[e.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",e[e.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",e[e.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",e[e.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",e[e.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP"}(ee||(ee={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(te||(te={})),function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(ie||(ie={})),function(e){e[e.typing=0]="typing"}(se||(se={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}(ne||(ne={})),function(e){e[e.Other=0]="Other",e[e.iOS=1]="iOS",e[e.Android=2]="Android",e[e.Web=3]="Web",e[e.PC=4]="PC",e[e.Mini=5]="Mini",e[e.HarmonyOS=6]="HarmonyOS"}(re||(re={})),function(e){e[e.ONLINE_STATUS=1]="ONLINE_STATUS",e[e.USER_PROFILE=2]="USER_PROFILE",e[e.FRIEND_ONLINE_STATUS=3]="FRIEND_ONLINE_STATUS",e[e.FRIEND_USER_PROFILE=4]="FRIEND_USER_PROFILE"}(oe||(oe={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}(ae||(ae={})),function(e){e[e.NOT_SET=0]="NOT_SET",e[e.INVISIBLE=1]="INVISIBLE",e[e.EVERYONE=2]="EVERYONE",e[e.FriendVisible=3]="FriendVisible"}(le||(le={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(ce||(ce={})),function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(_e||(_e={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(de||(de={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(ue||(ue={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(he||(he={})),function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S",e.IM_CMP="IM-stats_cmp-S",e.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",e.IM_STATS_CS="IM-stats_cs-S",e.IM_NETWORK_CHANGE="IM-stats_network_change-S",e.L_CLOUD_INFO_FETCH_T="L-cloud_info_fetch-T",e.L_CLOUD_INFO_FETCH_R="L-cloud_info_fetch-R",e.IM_MSG_SEND="IM-msg_send-S",e.IM_MSG_RECEIVE="IM-msg_receive-S"}(ge||(ge={})),function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(Ee||(Ee={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(Ie||(Ie={}));const Te=e=>e===Ie.OPEN?Ee.AT_MESSAGE_NOTIFICATION:Ee.NOT_SET,fe=e=>e<=Ee.NOT_SET?Ie.CLOSE:Ie.OPEN;var Re,Ae,pe,me,Se,ve,Ne,Oe,ye;!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(Re||(Re={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(Ae||(Ae={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(pe||(pe={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(me||(me={})),function(e){e[e.CURRENT=2]="CURRENT"}(Se||(Se={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(ve||(ve={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Ne||(Ne={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(Oe||(Oe={})),function(e){e[e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT=0]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT",e[e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_MENTION_MESSAGE=1]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_MENTION_MESSAGE",e[e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_BLOCKED=5]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_BLOCKED"}(ye||(ye={}));const Ce={ALL:0,EXCLUDE_ROBOT:1,ROBOT_ONLY:2},Me={DISALLOW:0,ALLOW:1},be={NOT_CONVERTED:0,CONVERTING:1,SUCCESS:2,FAILED:3},Le={NORMAL:0,ROBOT:1},Ue={UNKNOWN:-1,V1:0,V2:1,V4:3,V5:4},Pe={DEFAULT:0,DELETED:1,RECALLED:2},De={ADDED:1,REMOVED:2,CLEARED:3},we={ALL:0,UNREAD_ONLY:1,MENTION_ONLY:2,NO_UNREAD:3};var Ge,Ve;!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"}(Ge||(Ge={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(Ve||(Ve={}));const ke=72e5,xe=6e4,Fe=131072,Be="5.44.0".replace(/-.+$/,""),He=5368709120,je=10485760,Ye="rongcloudsystem",We=864e5,qe="RCDeviceId",Je=e=>`navi_${e}`,Ke=(e,t)=>`RC-con-stat-ver-${e}-${t}`,Qe=(e,t)=>`RCV4-CONVER-${e}-${t}`,Xe=(e,t)=>`RCV4-ultragroupconversation-${e}-${t}`,ze=(e,t)=>`RC-con-type-settings-${e}-${t}`,Ze=(e,t)=>`outbox_${e}_${t}`,$e=(e,t)=>`inbox_${e}_${t}`,et=(e,t)=>`broadcastbox_${e}_${t}`,it=(e,t)=>`send_msg_${e}_${t}`,st=(e,t)=>`RC-us-${e}-${t}`,nt=e=>`rc-static-config-${e}`,rt=e=>`RC-cc-${e}`,ot=(e,t)=>`RC-RR-${e}-${t}`,at=e=>`RC-LI-${e}`,lt=Math.pow(2,31)-1,ct="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{},_t="engine";ct[_t]="5.44.0";class dt{static add(e,t){["imlib-next","engine","electron-main","electron-renderer","imlib-v2-adapter","Global_IM_UIKit","IMKit","imkit-store","rtclib","calllib","callplus","plugin-wechat-rtc"].includes(e)&&(ct[e]=t)}static validEngine(e){const t=e.match(/\d+\.\d+\.\d+/);if(!t)return!1;const i=t[0].split(".").map((e=>e.padStart(3,"0"))).join("");return ct[_t].match(/\d+\.\d+\.\d+/)[0].split(".").map((e=>e.padStart(3,"0"))).join("")>=i}static getInfo(){return ct}}const ut={gen:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=Math.floor(36*Math.random());return("x"===e?t:3&t|8).toString(36)})),genWithLen(e=22){const t=Date.now(),i=t.toString(36),s=Math.floor(Math.random()*t).toString(36),n=e-i.length-s.length;var r;return[s,i,n>0?(r=n,Array.from({length:r}).map((()=>Math.floor(36*Math.random()).toString(36))).join("")):""].join("").slice(0,e)}},ht=ut.genWithLen(22),gt=Date.now(),Et=e=>"string"==typeof e,It=e=>"boolean"==typeof e,Tt=e=>"number"==typeof e&&!Number.isNaN(e),ft=e=>t=>Number.isInteger(t)&&(void 0===e.min||t>=e.min)&&(void 0===e.max||t<=e.max),Rt=e=>-1!==Object.prototype.toString.call(e).indexOf("Array"),At=e=>t=>Et(t)&&(void 0===e.isTrim||0===t.length||t.trim().length>0)&&(void 0===e.minLength||t.length>=e.minLength)&&(void 0===e.maxLength||t.length<=e.maxLength)&&(void 0===e.validator||e.validator(t)),pt=e=>Et(e)&&e.length>0,mt=e=>Rt(e)&&e.length>0,St=e=>"[object Object]"===Object.prototype.toString.call(e),vt=e=>"function"==typeof e,Nt=e=>void 0===e||"[object Undefined]"===Object.prototype.toString.call(e),Ot=e=>Et(e)&&/https?:\/\//.test(e),yt=e=>{for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},Ct=e=>Tt(e)&&Object.prototype.hasOwnProperty.call(w,e),Mt=e=>Tt(e)&&Object.prototype.hasOwnProperty.call(Ee,e),bt=e=>{let t=!1;return Et(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Lt=e=>Object.values(e.type).includes(e.value),Ut=e=>At({minLength:1,maxLength:64})(e),Pt=e=>At({minLength:1,maxLength:64})(e)&&/^[a-zA-Z0-9+=\-_|:]*$/.test(e),Dt=e=>Tt(e)&&Object.prototype.hasOwnProperty.call(J,e),wt=()=>void 0!==(null===window||void 0===window?void 0:window.__RCCppContextBridge__),Gt=e=>({isRead:(e&Re.READ)===Re.READ,isListened:(e&Re.LISTENED)===Re.LISTENED,isDownload:(e&Re.DOWNLOADED)===Re.DOWNLOADED,isRetrieved:(e&Re.RETRIEVED)===Re.RETRIEVED}),Vt=e=>{let t=Re.UNREAD;return(null==e?void 0:e.isRead)&&(t|=Re.READ),(null==e?void 0:e.isListened)&&(t|=Re.LISTENED),(null==e?void 0:e.isDownload)&&(t|=Re.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=Re.RETRIEVED),t},kt=e=>[re.iOS,re.Android,re.Web,re.PC,re.Mini,re.HarmonyOS].map((t=>{const i=e.findIndex((e=>e.platform===t));return-1===i?{platform:t,changeTime:0,eventValue:0}:e[i]})),xt=(e,t,i)=>{const s=t.reduce(((e,t)=>(["gender","role","level"].includes(t.key)?e[t.key]=Number(t.value):e[t.key]=t.value,e)),{});return s.userId=e,i.forEach((e=>{s.extraProfile=s.extraProfile||{},s.extraProfile[e.key]=e.value})),s},Ft=(e,t,i)=>t?1===i?q.TLS:q.RMTP:"http"===e?q.WS:q.WSS,Bt=(e,t)=>{const{server:i,backupServer:s,bs:n,serverAddr:r,protocol:o,openTLS:a}=e;if(r){return[...r.filter((e=>e.addr))]}const l=[],c=[];return i&&c.push(i),(s||n||"").split(",").forEach((e=>{c.indexOf(e)<0&&c.push(e)})),c.forEach(((e,s)=>{e&&l.push({addr:e,protocol:Ft(o,t,a),weight:i.length-s,race:!1})})),[...l]},Ht=(e=[])=>e.map((e=>{const t=Wt(e.settingProfile),i=e.extProfile||[],{targetId:s,baseInfo:n,userInfo:r}=e;return JSON.parse(JSON.stringify(Object.assign(Object.assign({groupId:s},Yt(t)),{extProfile:i.length>0?Wt(i):void 0,creatorId:null==n?void 0:n.creatorId,ownerId:null==n?void 0:n.ownerId,createTime:null==n?void 0:n.createTime,membersCount:null==n?void 0:n.memberCount,remark:null==r?void 0:r.remarkName})))})),jt=e=>{if(void 0===e)return;const t=Number(e);return Number.isNaN(t)?void 0:t},Yt=e=>JSON.parse(JSON.stringify({groupName:e.name,portraitUri:e.portraitUrl,introduction:e.introduction,notice:e.announcement,joinPermission:jt(e.joinPerm),removeMemberPermission:jt(e.removePerm),invitePermission:jt(e.memInvitePerm),inviteHandlePermission:jt(e.invitePerm),groupInfoEditPermission:jt(e.profilePerm),memberInfoEditPermission:jt(e.memProfilePerm)})),Wt=e=>{let t={};return e&&0!==e.length?(e.forEach((e=>{t[e.key]=e.value})),t):t},qt=e=>{const{userId:t,name:i,portraitUrl:s,ext:n}=e,{role:r,joinTime:o,channelNickName:a,additional:l,isBot:c}=n||{};return{userId:t,name:i||"",portraitUri:s||"",nickname:a||"",extra:l||"",role:r||f.UNDEF,joinedTime:o||0,isRobot:!!c}},Jt=e=>{const{joinUserInfo:t,inviterInfo:i,processInfo:s}=e;return{groupId:e.targetId,joinMemberInfo:qt(t),inviterInfo:i&&i.userId?qt(i):void 0,operatorInfo:s&&s.userId?qt(s):void 0,status:e.status,direction:e.directionType,type:e.joinType,operationTime:e.applyTime||0,reason:e.detail||""}},Kt=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{}),Qt=(e,t)=>{if(e=e.replace(/\?$/,""),!t)return e;const i=Object.keys(t).map((e=>`${e}=${t[e]}`)).filter((e=>!!e));return i.length?[e,i.join("&")].join("?"):e};const Xt=(e,t)=>{const i=Math.floor(1e3*Math.random()%1e4),s=ut.gen(),n=(e=>{e=e||"-";const t=new Date;return`${t.getFullYear()}${e}${t.getMonth()+1}${e}${t.getDate()}`})(),r=(new Date).getTime();let o="";if(t){const e=t.split(".");o=`.${e[e.length-1]}`}return`${e}__RC-${n}_${i}_${r}${s}${o}`},zt=(e={},t={},i={})=>{const{channelIdMi:s,channelIdHW:n,channelIdOPPO:r,typeVivo:o,importanceHW:a,categoryHW:l,imageUrlHW:c,categoryVivo:_,importanceHonor:d,imageUrlHonor:u}=t,{APNS:h,FCM:g}=((e={},t={})=>{const{threadId:i,apnsCollapseId:s,category:n,richMediaUri:r,interruptionLevel:o}=e,{googleConfig:a}=t,l={};l["thread-id"]=i||"",l["apns-collapse-id"]=s||"",l.category=n||"",l.richMediaUri=r||"",l["interruption-level"]=o||"active";const c={};c.collapse_key=null==a?void 0:a.collapseKey,c.imageUrl=null==a?void 0:a.imageUrl;let _=null==a?void 0:a.priority;return _&&!["high","normal"].includes(_)&&(_="normal"),c.priority=_,{APNS:l,FCM:c}})(e,t),E=[{HW:{channelId:n||"",importance:a||"NORMAL",image:c||"",category:l||""}},{MI:{channelId:s||""}},{OPPO:{channelId:r||""}},{VIVO:{classification:o||"",category:_||""}},{APNS:h},{FCM:g},{HONOR:{importance:d||he.NORMAL,image:u||""}},{OHOS:{category:i.category||null,image:i.image||""}}];return JSON.stringify(E)},Zt=(e,t)=>{const i={},s={notificationId:t||""},n={};if(!e)return{iOSConfig:i,androidConfig:s,harmonyOSConfig:n};try{const t=JSON.parse(e);null==t||t.forEach((e=>{var t,r,o,a,l,c,_,d,u,h,g,E;const I=Object.keys(e);if(0===I.length)return;const T=I[0];switch(T){case"HW":return s.channelIdHW=null===(t=e[T])||void 0===t?void 0:t.channelId,s.importanceHW=null===(r=e[T])||void 0===r?void 0:r.importance,s.imageUrlHW=null===(o=e[T])||void 0===o?void 0:o.image,void(s.categoryHW=null===(a=e[T])||void 0===a?void 0:a.category);case"MI":return void(s.channelIdMi=null===(l=e[T])||void 0===l?void 0:l.channelId);case"OPPO":return void(s.channelIdOPPO=null===(c=e[T])||void 0===c?void 0:c.channelId);case"VIVO":return s.typeVivo=null===(_=e[T])||void 0===_?void 0:_.classification,void(s.categoryVivo=null===(d=e[T])||void 0===d?void 0:d.category);case"APNS":return i.threadId=e[T]["thread-id"],i.apnsCollapseId=e[T]["apns-collapse-id"],i.category=e[T].category,i.richMediaUri=e[T].richMediaUri,void(i.interruptionLevel=e[T]["interruption-level"]);case"FCM":return void(s.googleConfig={collapseKey:e[T].collapse_key||"",imageUrl:e[T].imageUrl||"",priority:e[T].priority||""});case"HONOR":return s.importanceHonor=null===(u=e[T])||void 0===u?void 0:u.importance,void(s.imageUrlHonor=null===(h=e[T])||void 0===h?void 0:h.image);case"OHOS":n.category=null===(g=e[T])||void 0===g?void 0:g.category,n.image=null===(E=e[T])||void 0===E?void 0:E.image}}))}catch(e){}return{iOSConfig:i,androidConfig:s,harmonyOSConfig:n}},$t=e=>{const t=/^[A-Za-z0-9_=+-]+$/.test(e),i=e.length;return t&&(i<=128&&i>=1)},ei=e=>{const{length:t}=e;return t<=4096&&t>=1},ti=(()=>{let e=0;return()=>{const t=((4294967295&Date.now())>>>0).toString(2),i=Math.floor(Math.random()*(Math.pow(2,8)-1)),s=t+e.toString(2).padStart(11,"0")+i.toString(2).padStart(8,"0");return e=2047&++e,parseInt(s,2)}})(),ii=()=>{const e=dt.getInfo();let t="electron";for(let i in e)"engine"!==i&&(t=["imlib-v2-adapter","imlib-next"].includes(i)?i:"electron");return t},si=(e,i,s)=>t(void 0,void 0,void 0,(function*(){const t=yield window.crypto.subtle.importKey("raw",(new TextEncoder).encode(i),"AES-CBC",!0,["decrypt"]),n=yield window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(s)},t,function(e){const t=null===window||void 0===window?void 0:window.atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return i.buffer}(e));return(new TextDecoder).decode(n)}));function ni(e,t){var i;if(!e)return"";const s="undefined"!=typeof window&&"https:"===(null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.protocol);return/^https?:\/\//.test(e)?s?e.replace(/^https?:\/\//i,"https://"):e:t!==q.HTTP||s?`https://${e}`:`http://${e}`}const ri=(e,t)=>{if(!e)return"";const{ossConfig:i=""}=e;let s="";try{const e=JSON.parse(i);if(e.length>0){const t=e.find((e=>e.minio));t&&(s=t.minio)}}catch(e){t.warn(r.L_PARSE_JSON_E,JSON.stringify({ossConfig:i,error:e}))}return s};const oi=(e,t)=>t&&0!==t.length?[w.GROUP,w.ULTRA_GROUP,w.APP_PUBLIC_SERVICE,w.PUBLIC_SERVICE].includes(e)?t:[]:t||[];class ai extends Error{constructor(e){super(e),this.name="RCError"}static InvalidParameters(e){return(null==e?void 0:e.length)?new ai(`Invalid parameter -> ${e}`):new ai("Invalid parameters.")}static ParameterTypeError(){return new ai("Wrong parameter type")}}var li;class ci{constructor(){li.set(this,!1)}stopPropagation(){s(this,li,!0,"f")}get isStopPropagation(){return i(this,li,"f")}}li=new WeakMap;class _i{constructor(){Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_piped",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}_addItem(e,t,i,s,n=0){const r=Symbol(),o=this._map.get(e)||this._map.set(e,[]).get(e),a={symbol:r,priority:Math.min(n,100),listener:t.bind(s),once:i},l=o.findIndex((e=>e.priority>n));return-1===l?o.push(a):o.splice(l,0,a),r}on(e,t,i,s=0){return this._addItem(e,t,!1,i,s)}once(e,t,i,s=0){return this._addItem(e,t,!0,i,s)}off(e){for(let[t,i]of this._map){const t=i.findIndex((t=>t.symbol===e));if(-1!==t)return void i.splice(t,1)}}emit(e,...t){const i=this._map.get(e);if(i&&i.length>0){const e=new ci;for(let s=0;s<i.length;s+=1){const{once:n,listener:r}=i[s];n&&i.splice(s,1);try{r(e,...t)}catch(e){null===console||void 0===console||console.error(e)}if(e.isStopPropagation)return}}[...this._piped.entries()].forEach((([i,s])=>{(0===s.length||s.includes(e))&&i.emit(e,...t)}))}removeAll(e){this._map.delete(e)}clear(){this._piped.clear(),this._map.clear()}pipe(e,t){this._piped.set(e,t||[])}}class di extends _i{constructor(e){super(),Object.defineProperty(this,"_name",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_versionQueue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_pullingPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_dataVersion",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"_invervalTimer",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"_started",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get length(){return this._versionQueue.length}get _isPulling(){return null!==this._pullingPromise}setInitVersion(e,t=!1){-1===this._dataVersion&&(this._dataVersion=e,t&&this._execPulling())}push(e){this._versionQueue.push(e),-1!==this._dataVersion&&this._execPulling()}_execPulling(){return t(this,void 0,void 0,(function*(){if(this._pullingPromise)return;this._pullingPromise=this._handleSyncData(this._dataVersion);const{isOk:e,data:t}=yield this._pullingPromise;if(this._pullingPromise=null,!e)return;if(void 0===(null==t?void 0:t.version)||t.version<this._dataVersion)throw new Error(`${this._name}: version error, please check: lastVersion: ${this._dataVersion}, newVersion: ${null==t?void 0:t.version}`);const{version:i,hasNext:s}=t,n=this._versionQueue.filter((e=>e>i));return this._versionQueue=[...n],this._dataVersion=i,s?this._execPulling():this._versionQueue.length>0?(this._versionQueue.length=0,this._execPulling()):void 0}))}startInterval(e,t){this._started||(this._started=!0,t&&this._execPulling(),this._invervalTimer=setInterval((()=>this._execPulling()),e))}stopInterval(){this._started&&(this._started=!1,clearInterval(this._invervalTimer),this._invervalTimer=-1)}reset(){this.stopInterval(),this._versionQueue.length=0,this._dataVersion=-1}}class ui{constructor(e,t){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((t=>{this._resolve=t,e(this._onResolve.bind(this))})),this._onCancel=t}_onResolve(e){this._resolve(e)}result(){return this._promise}abort(){this._onCancel(this._onResolve.bind(this))}}class hi{constructor(e,t,i){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===e,this.code=e,this.msg=t,this.data=i}static from(e,t,i){return new hi(e,t||`fail: ${e}`,i)}static ok(e,t){return new hi(0,t||"success",e)}static fail(e,t,i){return new hi(e,t||`fail: ${e}`,i)}next(e){return t(this,void 0,void 0,(function*(){return this.isOk?e(this.data):this.wipe()}))}or(e){return t(this,void 0,void 0,(function*(){return this.isOk?this:e(this.code)}))}orSync(e){return this.isOk?this:e(this.code)}trans(e){return this.isOk?gi(e(this.data)):this.wipe()}tryTrans(e){return this.isOk?e(this.data):this.wipe()}errmsg(){return JSON.stringify({code:this.code,msg:this.msg})}wipe(){return this.isOk?gi(void 0,this.msg):Ei(this.code,this.msg)}}const{ok:gi}=hi,{fail:Ei}=hi;class Ii{constructor(e){Object.defineProperty(this,"_apiName",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_isValid",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_code",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_errmsg",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}static create(e){return new Ii(e)}get isFailed(){return!this._isValid}fail(e,t,i=!1){return this.isFailed&&(0===this._code||i)&&(this._code=e,this._errmsg=t||this._errmsg),this}setFailed(e,t){return this._isValid=!1,this.fail(e,t)}result(){if(this.isFailed&&0===this._code)throw new Error("Validator: result() should not be called without fail()");return this.isFailed?Ei(this._code,this._errmsg):gi()}check(e){return this.isFailed||e(this),this}validate(e,t,i,s=!1){if(this.isFailed)return this;const n=s?i(t):null==t||i(t);return this._isValid=n,this.isFailed&&(this._errmsg=`param '${e}' is invalid`),this}assert(e,t,i,s=!1){if(this.isFailed)return this;if(this.validate(e,t,i,s),this.isFailed)throw ai.InvalidParameters(`'${e}' at '${this._apiName}'`);return this}isString(e,t,i=!1){return this.validate(e,t,(()=>"string"==typeof t),i)}assertString(e,t,i=!1){return this.assert(e,t,(()=>"string"==typeof t),i)}isHttpUrl(e,t,i=!1){return this.isNotEmptyString(e,t,i).validate(e,t,(e=>/^https?:\/\//.test(e)))}isNotEmptyString(e,t,i=!1){return this.isString(e,t,i).validate(e,t,(e=>e.trim().length>0),i)}assertNotEmptyString(e,t,i=!1){return this.assertString(e,t,i),this.assert(e,t,(e=>e.trim().length>0),i)}isLimitedString(e,t,i,s,n=!1){return this.isString(e,t,n).validate(e,t,(e=>e.length>=i&&e.length<=s),n)}assertLimitedString(e,t,i,s,n=!1){return this.assertString(e,t,n),this.assert(e,t,(e=>e.length>=i&&e.length<=s),n)}isBoolean(e,t,i=!1){return this.validate(e,t,(e=>"boolean"==typeof e),i)}assertBoolean(e,t,i=!1){return this.assert(e,t,(e=>"boolean"==typeof e),i)}isNumber(e,t,i=!1){return this.validate(e,t,(e=>"number"==typeof e&&!Number.isNaN(e)),i)}assertNumber(e,t,i=!1){return this.assert(e,t,(e=>"number"==typeof e&&!Number.isNaN(e)),i)}isLimitedNumber(e,t,i,s,n=!1){return this.isNumber(e,t,n).validate(e,t,(e=>e>=i&&e<=s),n)}assertLimitedNumber(e,t,i,s,n=!1){return this.assertNumber(e,t,n),this.assert(e,t,(e=>e>=i&&e<=s),n)}isInteger(e,t,i=!1){return this.validate(e,t,(e=>Number.isInteger(e)),i)}assertInteger(e,t,i=!1){return this.assert(e,t,(e=>Number.isInteger(e)),i)}isLimitedInteger(e,t,i,s,n=!1){return this.isInteger(e,t,n).validate(e,t,(e=>e>=i&&e<=s),n)}isTimestamp(e,t,i=!1){return this.isLimitedInteger(e,t,0,Number.MAX_SAFE_INTEGER,i)}assertLimitedInteger(e,t,i,s,n=!1){return this.assertInteger(e,t,n),this.assert(e,t,(e=>e>=i&&e<=s),n)}isArray(e,t,i=!1){return this.validate(e,t,(e=>-1!==Object.prototype.toString.call(e).indexOf("Array")),i)}assertArray(e,t,i=!1){return this.assert(e,t,(e=>-1!==Object.prototype.toString.call(e).indexOf("Array")),i)}isLimitedArray(e,t,i,s=!1,n=1){return this.isArray(e,t,s).validate(e,t,(e=>e.length>=n&&e.length<=i),s)}assertLimitedArray(e,t,i,s=!1,n=1){return this.assertArray(e,t,s),this.assert(e,t,(e=>e.length>=n&&e.length<=i),s)}isTypedArray(e,t,i,s=!1){return this.isArray(e,t,s).validate(e,t,(e=>e.every(i)),s)}assertTypedArray(e,t,i,s=!1){return this.assertArray(e,t,s),this.assert(e,t,(e=>e.every(i)),s)}isLimitedTypedArray(e,t,i,s,n=!1,r=1){return this.isLimitedArray(e,t,i,n,r).validate(e,t,(e=>e.every(s)),n)}assertLimitedTypedArray(e,t,i,s,n=!1,r=1){return this.assertLimitedArray(e,t,i,n,r),this.assert(e,t,(e=>e.every(s)),n)}isObject(e,t,i=!1){return this.validate(e,t,(e=>"[object Object]"===Object.prototype.toString.call(e)),i)}assertObject(e,t,i=!1){return this.assert(e,t,(e=>"[object Object]"===Object.prototype.toString.call(e)),i)}isStringEnum(e,t,i,s=!1){return this.isString(e,t,s).validate(e,t,(e=>Object.values(i).includes(e)),s)}isNumberEnum(e,t,i,s=!1){return this.isNumber(e,t,s).validate(e,t,(e=>Object.values(i).includes(e)),s)}assertValueOf(e,t,i,s=!1){return this.assert(e,t,(()=>Object.values(i).includes(t)),s)}isFunction(e,t,i=!1){return this.validate(e,t,(e=>"function"==typeof e),i)}assertFunction(e,t,i=!1){return this.assert(e,t,(e=>"function"==typeof e),i)}}const Ti="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function fi(e){let t,i,s,n,r,o,a,l="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c<e.length;)n=Ti.indexOf(e.charAt(c++)),r=Ti.indexOf(e.charAt(c++)),o=Ti.indexOf(e.charAt(c++)),a=Ti.indexOf(e.charAt(c++)),t=n<<2|r>>4,i=(15&r)<<4|o>>2,s=(3&o)<<6|a,l+=String.fromCharCode(t),64!==o&&(l+=String.fromCharCode(i)),64!==a&&(l+=String.fromCharCode(s));return l}const Ri=()=>{let e,t=new Promise((t=>{e=t}));return{resolve:e,promise:t}},Ai=1732584193,pi=4023233417,mi=2562383102,Si=271733878,vi=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Ni=[3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745];function Oi(e,t){return e<<t|e>>>32-t}function yi(e,t,i){return e&i|t&~i}function Ci(e,t,i){return e^t^i}function Mi(e,t,i){return t^(e|~i)}function bi(e){const t=[];for(let i=0;i<e.length;i+=4)t.push((e[i]||0)|(e[i+1]||0)<<8|(e[i+2]||0)<<16|(e[i+3]||0)<<24);return t}function Li(e){const t=new Uint8Array(4);return t[0]=255&e,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}function Ui(e){const t=8*e.length,i=e.length%64<56?56-e.length%64:120-e.length%64,s=new Uint8Array(e.length+i+8);s.set(e),s[e.length]=128;for(let t=1;t<i;t++)s[e.length+t]=0;const n=new Uint8Array(8),r=4294967295&t,o=4294967295&Math.floor(t/4294967296);n.set(Li(r),0),n.set(Li(o),4),s.set(n,e.length+i);let a=Ai,l=pi,c=mi,_=Si;for(let e=0;e<s.length;e+=64){const t=bi(s.slice(e,e+64)),i=a,n=l,r=c,o=_;for(let e=0;e<64;e++){let i,s;e<16?(i=(d=l)&c|~d&_,s=e):e<32?(i=yi(l,c,_),s=(5*e+1)%16):e<48?(i=Ci(l,c,_),s=(3*e+5)%16):(i=Mi(l,c,_),s=7*e%16);const n=_;_=c,c=l,l+=Oi(a+i+Ni[e]+t[s]&4294967295,vi[e]),a=n}a=a+i&4294967295,l=l+n&4294967295,c=c+r&4294967295,_=_+o&4294967295}var d;const u=new Uint8Array(16);return u.set(Li(a),0),u.set(Li(l),4),u.set(Li(c),8),u.set(Li(_),12),function(e){return Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join("")}(u)}function Pi(e){const t=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);const t=unescape(encodeURIComponent(e)).split("").map((e=>e.charCodeAt(0)));return new Uint8Array(t)}(e);return Ui(t)}function Di(e){const t=e.method||Ve.GET,i=e.timeout||xe,{headers:s,query:n,body:r,onProgress:o}=e,a=Qt(e.url,n),l=new XMLHttpRequest;if(l.open(t,a),s&&l.setRequestHeader)for(const e in s)l.setRequestHeader(e,s[e]);return function(e,t,i,s){return new ui((n=>{e.onreadystatechange=()=>{4===e.readyState&&n({data:e.responseText,status:e.status,xhr:e})},e.onerror=()=>{n({status:e.status})},s&&(e.upload.onprogress=e=>s(e)),0!==t&&setTimeout((()=>{e.abort(),n({status:e.status})}),t),e.send(i)}),(t=>{e.abort(),t({status:-1})}))}(l,i,r,o)}var wi;!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(wi||(wi={}));const Gi={SUCCESS:0,UPDATING:1,FAILED:2},Vi={DEFAULT:0,MODIFIED:1,RECALLED:2,DELETE:3},ki={TranslationLanguage:0,AutoTranslateEnable:1};var xi;!function(e){e[e.BJ=1]="BJ",e[e.SG=2]="SG",e[e.NA=3]="NA",e[e.SG_A=4]="SG_A",e[e.SG_B=4]="SG_B",e[e.SA=5]="SA",e[e.OM=6]="OM"}(xi||(xi={}));const Fi={[xi.BJ]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5yb25nLWVkZ2UuY29t","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ucm9uZy1lZGdlLmNvbQ==",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnJvbmctZWRnZS5jb20=","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5yb25nLWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5yb25nLWVkZ2UuY29t"]},[xi.SG]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zZy1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2ctbGlnaHQtZWRnZS5jb20=",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWxpZ2h0LWVkZ2UuY29t","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1saWdodC1lZGdlLmNvbQ=="]},[xi.NA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi51cy1saWdodC1lZGdlLmNvbQ==","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24udXMtbGlnaHQtZWRnZS5jb20=",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnVzLWxpZ2h0LWVkZ2UuY29t","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC51cy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy51cy1saWdodC1lZGdlLmNvbQ=="]},[xi.SG_B]:{naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWItbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1iLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1iLWxpZ2h0LWVkZ2UuY29t"]},[xi.SA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zYXUtbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2F1LWxpZ2h0LWVkZ2UuY29t",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNhdS1saWdodC1lZGdlLmNvbQ==","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zYXUtbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zYXUtbGlnaHQtZWRnZS5jb20="]},[xi.OM]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5vbS1saWdodC1lZGdlLmNvbQ==","bmF2LWIub20tbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ub20tbGlnaHQtZWRnZS5jb20=",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLm9tLWxpZ2h0LWVkZ2UuY29t","d3MtYi5vbS1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5vbS1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIub20tbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9kdWFsc3RhY2stc3RhdHMub20tbGlnaHQtZWRnZS5jb20="]}};function Bi(e){return xi[e]?e:xi.BJ}const Hi=new class{constructor(){Object.defineProperty(this,"initOption",{enumerable:!0,configurable:!0,writable:!0,value:{}})}init(e){this.initOption=e}getNaviUrlList(e,t){const{areaCode:i,navigators:s}=this.initOption||{},n=function(e=xi.BJ){return Fi[Bi(e)].naviUrlBase64}(i).map((e=>fi(e)));let r=[];const[,o]=e.split("@");t&&(r=o?o.split(";"):[]);const a=s&&s.length>0?[...r,...s]:[...r,...n];return a.filter(((e,t)=>a.indexOf(e)===t)).map((e=>ni(e)))}getLogUrlPolicyList(e,t){const{log:i,logPolicy:s}=e||{},{areaCode:n,logServerUrl:o}=this.initOption||{},a=function(e=xi.BJ){return Fi[Bi(e)].logUrlBase64}(n).map((e=>Object.assign(Object.assign({},e),{addr:fi(e.addr)}))),l=[],c={level:1,itv:6,times:5};if(i)l.push(...i.addrs),Object.assign(c,i.policy);else if(s)try{const e=JSON.parse(s);l.push({addr:e.url,protocol:q.HTTPS,weight:1}),c.level=e.level,c.itv=e.itv,c.times=e.times}catch(i){t.warn(r.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}const _=o?[{addr:o,protocol:q.HTTPS,weight:101},...l]:[...l,...a];return{policy:c,addrs:_.filter(((e,t)=>_.findIndex((t=>t.addr===e.addr&&t.protocol===e.protocol))===t)).map((e=>Object.assign(Object.assign({},e),{addr:ni(e.addr,e.protocol)}))).sort(((e,t)=>t.weight-e.weight))}}getMiniCmpUrlList(){var e;const t=function(e=xi.BJ){return Fi[Bi(e)].miniCmpBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>fi(e))),{miniCMPProxy:i}=this.initOption||{};return i&&i.length>0?i:t}getStaticConfigUrl(){var e;return function(e=xi.BJ){return Fi[Bi(e)].staticConfigUrlBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>fi(e)))}getCloudControllerUrl(e){var t;return function(e=xi.BJ){return Fi[Bi(e)].cloudControllerUrlBase64}(null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode).map((e=>fi(e)))}getAreaCode(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:xi.BJ}setAreaCode(e){return!(!e||!xi[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)}getStatsUrlList(e){var t;const{active:i,activeServer:s}=e||{};let n=(null==i?void 0:i.addrs)||[];const r=function(e=xi.BJ){return Fi[Bi(e)].statsUrlBase64}(null===(t=this.initOption)||void 0===t?void 0:t.areaCode).map((e=>fi(e))),o=[];return 0!==n.length?o.push(...n.sort(((e,t)=>t.weight-e.weight)).map((e=>ni(e.addr,e.protocol)))):s&&o.push(ni(s,q.HTTPS)),r.forEach((e=>{o.includes(e)||o.push(e)})),o}};class ji{constructor(e,t){Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"staticUrls",{enumerable:!0,configurable:!0,writable:!0,value:[]})}getStaticConfig(){var e;return t(this,void 0,void 0,(function*(){const t=this.getCache();if(t){try{const e=JSON.parse(t);if(Date.now()-(null==e?void 0:e.time)<18e5){const t=(yield this.decryptData(e.val)).resources.navi.slice();return t.sort(((e,t)=>t.weight-e.weight)),{navi:t.map((e=>ni(e.addr,e.protocol)))||[]}}}catch(e){this.logger.error(r.L_GET_STATIC_CONF_E,JSON.stringify({error:null==e?void 0:e.stack}))}this.clearCache()}const i=yield this._requestHandle();if(!i)return;const s=yield this.decryptData(i);if((null==s?void 0:s.areaCode)!==Hi.getAreaCode())return;this.setCache(JSON.stringify({time:Date.now(),val:i})),this.staticUrls=(null==s?void 0:s.bootstrap)||[];const n=null===(e=null==s?void 0:s.resources)||void 0===e?void 0:e.navi.slice();return n.sort(((e,t)=>t.weight-e.weight)),{navi:n.map((e=>ni(e.addr,e.protocol)))||[]}}))}_requestHandle(){return t(this,void 0,void 0,(function*(){let e=[...this.staticUrls,...Hi.getStaticConfigUrl()].map((e=>ni(e)));e=e.filter(((t,i)=>e.indexOf(t)===i));for(let t of e){this.logger.info(r.L_GET_STATIC_CONF_T,JSON.stringify({url:t}));const e=Date.now(),{code:i,data:s}=yield this.sendRequest(`${t}/${this.appkey}`);if(200===i)return this.logger.info(r.L_GET_STATIC_CONF_R,JSON.stringify({url:t,code:i,duration:Date.now()-e})),s;this.logger.warn(r.L_GET_STATIC_CONF_R,JSON.stringify({url:t,code:i,duration:Date.now()-e}))}}))}}var Yi;!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD",e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG"}(Yi||(Yi={}));class Wi{constructor(e,t,i,s){Object.defineProperty(this,"_appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_type",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"proxy",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"outputLevel",{enumerable:!0,configurable:!0,writable:!0,value:Yi.WARN}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Yi.DEBUG)}),Object.defineProperty(this,"info",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Yi.INFO)}),Object.defineProperty(this,"warn",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Yi.WARN)}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Yi.ERROR)}),Object.defineProperty(this,"__statistics",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Yi.STATISTICS)}),Object.defineProperty(this,"record",{enumerable:!0,configurable:!0,writable:!0,value:this.__statistics})}_write(e){const{tag:t,level:i,content:s,traceId:n}=e;/^[\w-]+$/.test(t)?i!==Yi.DEBUG&&this.proxy.write(e):console.error(`${(new Date).toISOString()}[${this._id}]['ERROR']: ${t} | ${s} | ${n}`)}createTraceId(){return""+ ++Wi._traceIdCount}getSessionId(){return ht}_stdout(e){const{time:t,tag:i,content:s,traceId:n,level:r,loggerId:o}=e;if(!console)return;if(r<=Yi.FATAL)return;if(r>this.outputLevel)return;const a=["error","warn","info","debug"][r-1],l=`${new Date(t).toISOString()}[${null!=o?o:this._id}][${(a||"stat").toUpperCase()}]: ${i} | ${s} | ${n}`;console[a||"warn"](l)}setOutputLevel(e){(e=>[Yi.DEBUG,Yi.INFO,Yi.WARN,Yi.ERROR].some((t=>t===e)))(e)&&(this.outputLevel=e)}_log(e,t,i,s){const n={time:Date.now(),level:e,tag:t,content:i,traceId:s,loggerId:this._id,sessionId:this.getSessionId(),type:this._type};this._stdout(n),this._write(n)}summary(e,t,i,s={},n,r){if(t.isOk){const r=null==n?void 0:n(t.data);this.info(e,JSON.stringify(Object.assign(Object.assign({isOk:!0},s),r)),i)}else{const n=null==r?void 0:r(t.data);this.warn(e,JSON.stringify(Object.assign(Object.assign({code:t.code,msg:t.msg},s),n)),i)}}}Object.defineProperty(Wi,"_traceIdCount",{enumerable:!0,configurable:!0,writable:!0,value:0});class qi{constructor(e,t,i,s,n=!1){Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"deviceInfo",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"logDB",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"disableLogReport",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"userId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"reportFailedNumber",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"itvByNavi",{enumerable:!0,configurable:!0,writable:!0,value:6}),Object.defineProperty(this,"timesByNavi",{enumerable:!0,configurable:!0,writable:!0,value:5})}_getLogs(e,i,s,n,r,o){return t(this,void 0,void 0,(function*(){let t=[];try{const r=yield this.logDB.read(e,i,s,n,o);Rt(r.logs)&&(t=r.logs.filter((e=>!(!e||"object"!=typeof e))))}catch(e){}return{logs:t}}))}checkStart(e,i){return t(this,void 0,void 0,(function*(){if(this.started)return;if(this.userId=e.userId,!e.logSwitch||this.disableLogReport)return;const{policy:t,addrs:s}=Hi.getLogUrlPolicyList(e,this.logger);this.started=!0,this.itvByNavi=t.itv,this.timesByNavi=t.times,s.length>0&&this.realtimeReport(s[0].addr,t.level,t.itv,i)}))}_sendLogs2Realtime(e,i,s,n){return t(this,void 0,void 0,(function*(){const{success:t,data:o}=yield this.compressLogs(e);if(!t)return{isOk:!1,itv:n};let a=Ot(s)?s:`https://${s}`;a+=`?version=5.44.0&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.getDeviceId()}&deviceInfo=${this.deviceInfo}&platform=Web`;const{status:l,data:c}=yield this.send({url:a,body:o,method:"POST"});if(200!==l)return this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(n+=n),this.reportFailedNumber++,{isOk:!1,itv:n};let _,d;if(this.reportFailedNumber=0,c)try{const e=JSON.parse(c);e.nextTime&&(n=e.nextTime),_=e.level,d=e.logSwitch}catch(e){this.logger.warn(r.L_PARSE_JSON_E,JSON.stringify({error:null==e?void 0:e.stack}),i)}return{isOk:!0,itv:n,level:_,logSwitch:d}}))}realtimeReport(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=Date.now(),r=this.logger.getTimestamp4RealtimeLog()||gt,o=Math.max(t-3e4,r+1),a=this.logger.createTraceId(),{logs:l}=yield this._getLogs(r,o,i,!0,a,n);if(0===l.length);else if(l.length>0){const{itv:t,level:n,logSwitch:r,isOk:o}=yield this._sendLogs2Realtime(l,a,e,s);if(o){const e=Math.max(...l.map((e=>e.time)));this.logger.setTimestamp4RealtimeLog(e+1),0===r&&(this.started=!1),void 0!==n&&(i=n)}s=t}this.started&&(s>=60&&this.itvByNavi<60&&(s=60),this.timer=setTimeout((()=>this.realtimeReport(e,i,s,n)),1e3*s))}))}report(e,i,s,n,o,a,l=!1){return t(this,void 0,void 0,(function*(){if("web"!==s.toLowerCase()||this.disableLogReport)return;const t=this.logger.createTraceId();this.logger.info(r.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:i,logId:o,messageUId:a,isCloudControl:l}),t);const{logs:c}=yield this._getLogs(e,i,Yi.DEBUG,!1,t);this.logger.info(r.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),t);let _,d=Ot(n)?n:`https://${n}`;if(d+=`?version=5.44.0&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.getDeviceId()}&deviceInfo=${this.deviceInfo}&platform=Web&logId=${o}`,c.length>0){const{success:e,data:t}=yield this.compressLogs(c);_=e?t:"compress failed"}else _="no data or no database";this.logger.debug(r.L_REPORT_FULL_LOG_O,"compress done",t),l&&(d+="&source=cloud");const{status:u}=yield this.send({url:d,body:_,method:"POST"});this.logger.info(r.L_REPORT_FULL_LOG_R,JSON.stringify({status:u}),t)}))}stop(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1}}const Ji=e=>{const{sessionId:t,level:i,loggerId:s,traceId:n,time:r,tag:o,type:a}=e;let{content:l}=e;Et(l)||(l=JSON.stringify(l));let c=i<0?l||"":JSON.stringify({content:l,traceId:n,from:s});return c=`"${c.replace(/"/g,'""')}"`,`${t},${r},${a},${i},${o},${c}\n`};function Ki(e){try{return!(!e||"object"!=typeof e)&&("number"==typeof e.time&&("string"==typeof e.tag&&("string"==typeof e.sessionId&&("string"==typeof e.type&&"number"==typeof e.level))))}catch(e){return!1}}var Qi,Xi,zi,Zi,$i,es,ts,is;function ss(){return t(this,void 0,void 0,(function*(){return{logs:[]}}))}function ns(){}class rs{constructor(e,t){Qi.set(this,void 0),Xi.set(this,void 0),s(this,Qi,e,"f"),s(this,Xi,t,"f")}read(e,s,n,r,o){return t(this,void 0,void 0,(function*(){try{const t=yield i(this,Qi,"f").call(this,e,s,n,r,o);if(!t||!Array.isArray(t.logs))return{logs:[]};return{logs:t.logs.filter(Ki)}}catch(e){return console.error("[LogDBProxy] read error",e),{logs:[]}}}))}write(e){try{i(this,Xi,"f").call(this,e)}catch(e){console.error("[LogDBProxy] write error",e)}}setLogReader(e){return"function"==typeof e&&s(this,Qi,e,"f"),this}setLogWriter(e){return"function"==typeof e&&s(this,Xi,e,"f"),this}}function os(){return new rs(ss,ns)}Qi=new WeakMap,Xi=new WeakMap;class as{static start(e){i(this,zi,"f",Zi)||(s(this,zi,e,"f",Zi),e.info(r.L_EVENT_LOOP_BLOCKING_S,"start"),i(this,zi,"m",is).call(this))}static stop(){i(this,zi,"f",Zi)&&(i(this,zi,"f",Zi).info(r.L_EVENT_LOOP_BLOCKING_S,"stop"),s(this,zi,null,"f",Zi),i(this,zi,"f",$i)&&(clearTimeout(i(this,zi,"f",$i)),s(this,zi,null,"f",$i)))}}zi=as,is=function e(){const t=Date.now();s(this,zi,setTimeout((()=>{const s=Date.now()-t;s>=i(this,zi,"f",ts)&&i(this,zi,"f",Zi).warn(r.L_EVENT_LOOP_BLOCKING_S,`delta time: ${s}ms`),i(this,zi,"m",e).call(this)}),i(this,zi,"f",es)),"f",$i)},Zi={value:null},$i={value:null},es={value:30},ts={value:1500};const ls=1,cs=2,_s=3;class ds{constructor(e){Object.defineProperty(this,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"uploadTask",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"taskLock",{enumerable:!0,configurable:!0,writable:!0,value:!0})}uploadLogCmdTask(e){this.uploadTask.push(e),this.enqueueTask()}reportLogCmdTask(e){var t,i,s,n;this.taskLock=!1;const r=null!==(t=e.startTime)&&void 0!==t?t:0,o=null!==(i=e.endTime)&&void 0!==i?i:0,a=null!==(s=e.platform)&&void 0!==s?s:"",l=null!==(n=e.uri)&&void 0!==n?n:"";e.logId!==this.logId&&""!==l&&(this.logId=e.logId,this.reporter.report(r,o,a,l,e.logId,"",!0).finally((()=>{this.taskLock=!0,this.uploadTask.length>0&&this.enqueueTask()})))}enqueueTask(){if(!this.taskLock)return;const e=this.uploadTask.shift();e&&this.reportLogCmdTask(e)}}class us{constructor(e,t,i){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"isEable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"expire",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"interval",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastRequestTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"uploadTaskManage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"changeAreaCode",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_cache",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.uploadTaskManage=new ds(i)}init(){try{const e=this.getLocalCloudControllerCache();this._cache=e?JSON.parse(e):{timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}}}catch(e){this._cache={timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}}}this._cache&&(this.interval=this._cache.cc.interval,this.expire=this._cache.cc.expire,this.timestamp=this._cache.timestamp||0,this.isEable=this._cache.cc.enable,this.lastRequestTime=this._cache.lastRequestTime,this.logCmdMsgTasks(this._cache),this.setMRTRConfig(this._handleMrtrData(this._cache.mrtr)))}isExire(){return(new Date).getTime()-this.timestamp<this.expire}isOverclock(){return(new Date).getTime()-this.lastRequestTime<this.interval}logCmdMsgTasks(e){if(e.uploadLog){const{tasks:t}=e.uploadLog;t.forEach((e=>{e.objectName===Q.LOG_COMMAND&&this.uploadTaskManage.uploadLogCmdTask(e)}))}}dataHandle(e){const t=this._cache;t.lastRequestTime=this.lastRequestTime,yt(e)&&(t.timestamp=e.timestamp,e.uploadLog&&!e.uploadLog.temporary&&(t.uploadLog=e.uploadLog),e.cc&&!e.cc.temporary&&(t.cc=e.cc),e.mrtr&&!e.mrtr.temporary&&(t.mrtr=this._handleMrtrData(e.mrtr)),e.mrtr&&this.setMRTRConfig(this._handleMrtrData(e.mrtr))),this.setCloudControllerCache(t),this.expire=t.cc.expire,this.interval=t.cc.interval,this.timestamp=t.timestamp,this.logCmdMsgTasks(e)}request(e,i,s){return t(this,void 0,void 0,(function*(){if(!this.isEable&&i===ls&&this.isExire())return this.logger.info(r.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),this.timestamp;if(!this.isEable&&i===cs&&this.isOverclock())return this.logger.info(r.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),this.timestamp;const t=ni(e);this.lastRequestTime=(new Date).getTime();const n=`${t}/v1/config`,o={"Content-Type":"application/json","RC-App-Key":this.appkey};s&&(o["RC-Token"]=s);const a={platform:"web",version:"5.44.0",timestamp:this.timestamp};this.logger.record(ge.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!s,uri:n}));const{code:l,data:c}=yield this.httpRequest(n,Ve.POST,o,a);if(this.logger.record(ge.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:c})),l===D.CLOUD_DATA_CENTER_INVALID&&c&&c.targetRegion){const e=c.targetRegion;if(this.changeAreaCode===e)return this.timestamp;const t=Hi.setAreaCode(e);this.logger.info(r.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:t,originAreaCode:Hi.getAreaCode(),newAreaCode:e})),this.changeAreaCode=e;const i=Hi.getCloudControllerUrl(e);return i[0]?this.request(i[0],_s):(this.logger.info(r.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:n,msg:"appkey region error"})),this.timestamp)}return c&&this.dataHandle(c),this.timestamp||this.lastRequestTime}))}_handleMrtrData(e){return{chatroom:(null==e?void 0:e.chatroom)||0,group:(null==e?void 0:e.group)||0,private:(null==e?void 0:e.private)||0,ultraGroup:(null==e?void 0:e.ultraGroup)||0,temporary:!!(null==e?void 0:e.temporary)}}}var hs,gs,Es,Is;const Ts=e=>e===D.RC_CONN_REDIRECTED;class fs extends _i{constructor(e,t,i){super(),hs.add(this),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"navi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_fromSuspend",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"token",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"curCmpUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"uuid",{enumerable:!0,configurable:!0,writable:!0,value:""}),Is.set(this,0),Object.defineProperty(this,"_doConnectReason",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_network",{enumerable:!0,configurable:!0,writable:!0,value:{status:!0,type:Ge.UNKONWN}}),Object.defineProperty(this,"_checkAliveTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_crtConnectionStatus",{enumerable:!0,configurable:!0,writable:!0,value:ce.DISCONNECTED}),Object.defineProperty(this,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_openCallPlus",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"cmpWeightCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_crtConnectionTask",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"reconnectTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_failedCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ALLOW_FAILED_TIMES",{enumerable:!0,configurable:!0,writable:!0,value:2})}getToken(){return this.token}get cid(){return`${this.uuid}_${this.retryCount}`}getCurrentUserId(){return this._crtUserId}setConnectionStatus(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus===ce.DISCONNECTED&&e===ce.CONNECTING&&(this._doConnectReason=Ne.CONNECT,i(this,hs,"m",Es).call(this)),this._crtConnectionStatus===ce.CONNECTED&&e===ce.SUSPENDED&&(t===D.RC_PING_EXCEED_LIMIT?this._doConnectReason=Ne.TIMEOUT:t===D.RC_CONN_REDIRECTED?this._doConnectReason=Ne.REDIRECTED:this._doConnectReason=Ne.RECONNECT),this._crtConnectionStatus===ce.CONNECTED){const s={bid:ii(),cod:t,net:this.getNetwork().type,dur:Date.now()-i(this,Is,"f"),cid:this.cid};this.logger.record(ge.IM_CONNECTION_DURATION,JSON.stringify(s)),e===ce.SUSPENDED&&i(this,hs,"m",Es).call(this)}switch(this._crtConnectionStatus=e,e){case ce.CONNECTED:this.logger.info(r.L_CONNECT_S,`status: ${e}`),this.checkAlive(),i(this,hs,"m",gs).call(this).emit("onConnected",this._fromSuspend);break;case ce.CONNECTING:this.logger.warn(r.L_CONNECT_S,`status: ${e}`),i(this,hs,"m",gs).call(this).emit("onConnecting");break;case ce.SUSPENDED:this._fromSuspend=!0,this.logger.warn(r.L_CONNECT_S,`status: ${e}, code: ${t}`),Ts(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),i(this,hs,"m",gs).call(this).emit("onSuspend",t);break;default:this._fromSuspend=!1,this._crtUserId="",this.logger.warn(r.L_CONNECT_S,`status: ${e}, code: ${t}`),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),i(this,hs,"m",gs).call(this).emit("onDisconnected",t)}}}getConnectionStatus(){return this._crtConnectionStatus}get isConnected(){return this._crtConnectionStatus===ce.CONNECTED}setNetwork(e,t){if(!t){const t={cid:this.cid,cn:e.type,on:this._network.type};this.logger.record(ge.IM_NETWORK_CHANGE,JSON.stringify(t))}this._network=e}getNetwork(){return this._network}connect(e,i,s,n){return t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus===ce.CONNECTED)return gi(this._crtUserId);if(this._crtConnectionTask)return this._crtConnectionTask;this._openCallPlus=s,this.token=e,this.setConnectionStatus(ce.CONNECTING);const{code:t,data:r}=yield this.try2Connect(e,i,!1,n,!0);return t!==D.SUCCESS?(this.setConnectionStatus(ce.DISCONNECTED,t),Ei(t)):(this.setConnectionStatus(ce.CONNECTED),gi(r))}))}try2Connect(e,i,s,n,r){return t(this,void 0,void 0,(function*(){if(this._crtConnectionTask)return this._crtConnectionTask;this._crtConnectionTask=this.createConnectionTask(e,i,s,n,r);const t=yield this._crtConnectionTask;return this._crtConnectionTask=null,t}))}createConnectionTask(e,i,n,o,a){return t(this,void 0,void 0,(function*(){const t={cid:this.cid,reason:this._doConnectReason,net:this.getNetwork().type,spr:0,sts:Date.now(),timelimit:0};this.logger.record(ge.IM_STATS_CS,JSON.stringify(t));const l={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this._doConnectReason},{code:c,data:_}=yield this.navi.request(e,n,!1,o,l);if(c!==D.SUCCESS)return Ei(c);const d=_;if(1===d.type)return Ei(D.PACKAGE_ENVIRONMENT_ERROR);this.logger.info(r.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:i}),o);const{code:u,data:h}=yield this._connectWithToken(e.replace(/@.+$/,"@"),d,i,o);if(a||u===D.SUCCESS||(this.retryCount+=1),Ts(u))return this.logger.warn(r.L_CONNECT_R,`redirect code: ${u}`,o),this.clearCmpWeightCache(),this.createConnectionTask(e,i,!0,o,a);if([D.RC_TCP_RESET,D.RC_CONN_ACK_TIMEOUT,D.RC_TCP_DISCONNECTED_NO_RMTP,D.CONNECTION_REFUSED].includes(u)&&this.cmpWeightCache&&this.cmpWeightCache.length>1){this.updateCmpWeight(this.curCmpUrl,!1);const t=this.cmpWeightCache.every((e=>e.failed));return a&&t?(this.logger.warn(r.L_CONNECT_R,`cpp code:${u},reture code:${D.SERVER_UNAVAILABLE}`,o),Ei(D.SERVER_UNAVAILABLE)):(this.logger.warn(r.L_CONNECT_R,`cmp ack timeout, code: ${u}`,o),this.setConnectionStatus(ce.SUSPENDED,u),this.setConnectionStatus(ce.CONNECTING),this.createConnectionTask(e,i,!1,o,a))}return u!==D.SUCCESS?(this.logger.warn(r.L_CONNECT_R,`code: ${u}`,o),Ei(u)):(this.logger.info(r.L_CONNECT_R,`userId: ${h}`,o),s(this,Is,Date.now(),"f"),this._crtUserId=h,gi(h))}))}try2Reconnect(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.debug(r.T,`try2Reconnect -> ignoreNaviCache: ${e}, reason: ${i}`,s),this.stopReconnectTimer();const n=()=>t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus!==ce.SUSPENDED)return;this.setConnectionStatus(ce.CONNECTING,i);const{code:t,isOk:r}=yield this.try2Connect(this.token,!0,e,s,!1);this.reconnectTimer=null,r?this.setConnectionStatus(ce.CONNECTED):[D.SERVER_UNAVAILABLE,D.TIMEOUT,D.RC_SOCKET_DISCONNECTED,D.RC_SOCKET_NOT_CREATED,D.RC_CONN_ACK_TIMEOUT,D.RC_TCP_RESET,D.RC_NAVI_REQ_FAILED,D.RC_NETWORK_DOWN,D.RC_TCP_DISCONNECTED_NO_RMTP].includes(t)?this._crtConnectionStatus===ce.CONNECTING&&(this.setConnectionStatus(ce.SUSPENDED,t),this.reconnectTimer=setTimeout(n,5e3)):this.setConnectionStatus(ce.DISCONNECTED,t)}));n()}))}onDisconnectByServer(e,t){return Ts(e)?(this.setConnectionStatus(ce.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===D.RC_UDP_DISCONNECTED?(this.setConnectionStatus(ce.SUSPENDED,e),void setTimeout((()=>{this.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(ce.DISCONNECTED,e)}onDisconenctUnusual(e){this.setConnectionStatus(ce.SUSPENDED,e),this.try2Reconnect(!1,e)}checkAlive(){return t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus!==ce.CONNECTED)return this._failedCount=0,void this.logger.debug(r.L_CHECK_ALIVE_IM_S,"stop ping because of no connection");const e=this.logger.createTraceId();this.logger.debug(r.L_CHECK_ALIVE_IM_T,null,e);const t=yield this.sendPing(15e3);if(t===D.SUCCESS)return this.logger.debug(r.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,void(this._checkAliveTimer=setTimeout((()=>this.checkAlive()),15e3));if(this._crtConnectionStatus===ce.CONNECTED){if(this._failedCount+=1,this.logger.debug(r.L_CHECK_ALIVE_IM_R,`code: ${t}, count: ${this._failedCount}`,e),this._failedCount<this.ALLOW_FAILED_TIMES)return this.checkAlive();this._failedCount=0,this.logger.warn(r.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),yield this.close(!0),this.setConnectionStatus(ce.SUSPENDED,D.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,D.RC_PING_EXCEED_LIMIT)}}))}disconnect(e,i){return t(this,void 0,void 0,(function*(){return this.stopReconnectTimer(),this._crtConnectionTask&&(yield this._crtConnectionTask),this.setConnectionStatus(ce.DISCONNECTED,D.ACTIVE_DISCONNECT),this.close(!1,e,i)}))}stopReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}getCmpList(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return[...this.cmpWeightCache];const i=Bt(e,t);return this.cmpWeightCache=[...i],[...i]}updateCmpWeight(e,t,i){if(!this.cmpWeightCache)return;const s=this.cmpWeightCache.find((t=>i?t.addr===e&&t.protocol===q.QUIC:t.addr===e));if(s)if(t){const e=Math.max(...this.cmpWeightCache.map((e=>e.weight)));s.weight!==e&&(s.weight=e+1)}else{const e=Math.min(...this.cmpWeightCache.map((e=>e.weight)));s.weight!==e&&(s.weight=e-1),s.failed=!0}}clearCmpWeightCache(){this.cmpWeightCache=void 0}reconnect(e,t,i,s){this.token=e,this._openCallPlus=i,this.onDisconenctUnusual(s)}}Is=new WeakMap,hs=new WeakSet,gs=function(){return this},Es=function(){this.uuid=ut.gen(),this.retryCount=0};const Rs=e=>e.replace(/@.+$/,"@");class As{constructor(e,t,i,s=!0,n=!0,r=!1){Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"staticConfigManager",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"isRequestProfile",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"isUseDynamicNaviUrl",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"useNaviV2",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"crtRequest",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_environment",{enumerable:!0,configurable:!0,writable:!0,value:"default"})}getCatchKey(e){return e+(this._environment?`-${this._environment}`:"")}request(e,i,s,n,r){return t(this,void 0,void 0,(function*(){if(this.crtRequest)return this.crtRequest;this.crtRequest=this.sendRequest(e,i,s,n,r);const t=yield this.crtRequest;return this.crtRequest=null,t}))}sendRequest(e,i,s,n,o){var a;return t(this,void 0,void 0,(function*(){const t=Rs(e),l=this.getNaviCache(t);if(!i&&l){const{timestamp:e,naviInfo:t}=l;if(s||Date.now()-e<ke){if(this.logger.info(r.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:t}),n),o){const{uuid:e,retryCount:i,reason:s}=o,r={bid:ii(),ptc:pe.NAVI,cod:D.SUCCESS,net:o.type,dur:0,spr:0,pr:null!==(a=t.type)&&void 0!==a?a:0,hos:"",cache:me.LOCAL,v:Se.CURRENT,rsn:s,cid:`${e}_${i}`,count:i};this.logger.record(ge.IM_NAVI,JSON.stringify(r),n)}return gi(t)}}const c=Hi.getNaviUrlList(e,this.isUseDynamicNaviUrl);this.logger.info(r.L_GET_NAVI_T,JSON.stringify({token:e,uris:c}),n);let{code:_,data:d}=yield this.requestHandler(c,e,n,o);if(_===D.RC_NAVI_REQ_FAILED&&this.isRequestProfile){const t=yield this.staticConfigManager.getStaticConfig();if((null==t?void 0:t.navi)&&(null==t?void 0:t.navi.length)>0){const{navi:i}=t,s=yield this.requestHandler(i,e,n,o);_=s.code,d=s.data}}if(_!==D.SUCCESS)return this.logger.warn(r.L_GET_NAVI_R,_,n),Ei(_);const u=d;if(u.code&&200!==u.code)return this.logger.warn(r.L_GET_NAVI_R,u.code,n),Ei(this.transHttpCode(u.code));if(!(Bt(u).length>0)){const e={server:u.server,backupServer:u.backupServer,serverAddr:u.serverAddr,bs:u.bs};return this.logger.warn(r.L_GET_NAVI_R,`navi server address invalid: ${JSON.stringify(e)}`,n),Ei(D.SERVER_UNAVAILABLE)}return this.logger.info(r.L_GET_NAVI_R,JSON.stringify({naviInfo:u}),n),this.setNaviCache(t,u),gi(u)}))}requestHandler(e,i,s,n){return t(this,void 0,void 0,(function*(){for(let t=0,r=e.length;t<r;t+=1){const r=t===e.length-1,o=this.useV2Navi()?this.httpRequestV2:this.httpRequest,a=Date.now(),{code:l,data:c}=yield o.call(this,e[t],this.appkey,i,s,r),_={bid:ii(),ptc:pe.NAVI,cod:l,net:null==n?void 0:n.type,dur:Date.now()-a,spr:0,pr:(null==c?void 0:c.type)||0,hos:e[t],cache:me.REQUEST,v:Se.CURRENT,rsn:null==n?void 0:n.reason,cid:`${null==n?void 0:n.uuid}_${null==n?void 0:n.retryCount}`,count:null==n?void 0:n.retryCount};if(this.logger.record(ge.IM_NAVI,JSON.stringify(_),s),[D.SUCCESS,D.RC_CONN_TOKEN_INCORRECT,D.RC_LICENSE_EXPIRED].includes(l))return l===D.SUCCESS?gi(c):Ei(l)}return Ei(D.RC_NAVI_REQ_FAILED)}))}transHttpCode(e){switch(e){case 401:case 403:return D.RC_CONN_TOKEN_INCORRECT;case 416:return D.RC_LICENSE_EXPIRED;default:return D.RC_NAVI_REQ_FAILED}}getNaviInfoFromCache(e){const t=this.getNaviCache(Rs(e));return t?t.naviInfo:null}updateVoipCallInfo(e,t){const i=this.getNaviInfoFromCache(e);i&&this.setNaviCache(Rs(e),Object.assign(Object.assign({},i),{voipCallInfo:t}))}getNaviV2RequestOption(e){const{uri:t,token:i,platform:s,protocol:n,mac:r}=e;let o="";o=`${t}/v2/navi.json?cloud=0`;let a=`token=${encodeURIComponent(i)}&v=${Be}&platfrom=${s}`;return r&&(a+=`&m=${r}`),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":`conn=${n};rtc=4;log=2;iptype=v4,v6`},body:a,url:o,timeout:1e4}}useV2Navi(){return!0}}const ps=new Map([["RC:TxtMsg",{isCounted:!0,isPersited:!0}],["RC:ImgMsg",{isCounted:!0,isPersited:!0}],["RC:VcMsg",{isCounted:!0,isPersited:!0}],["RC:ImgTextMsg",{isCounted:!0,isPersited:!0,searchProps:["content","title"]}],["RC:FileMsg",{isCounted:!0,isPersited:!0,searchProps:["name"]}],["RC:HQVCMsg",{isCounted:!0,isPersited:!0}],["RC:LBSMsg",{isCounted:!0,isPersited:!0}],["RC:PSImgTxtMsg",{isCounted:!0,isPersited:!0}],["RC:PSMultiImgTxtMsg",{isCounted:!0,isPersited:!0}],["RCJrmf:RpMsg",{isCounted:!0,isPersited:!0}],["RCJrmf:RpOpendMsg",{isCounted:!0,isPersited:!0}],["RC:CombineMsg",{isCounted:!0,isPersited:!0}],["RC:CombineV2Msg",{isCounted:!0,isPersited:!0}],["RC:ReferenceMsg",{isCounted:!0,isPersited:!0,searchProps:["content"]}],["RC:SightMsg",{isCounted:!0,isPersited:!0}],["RC:GIFMsg",{isCounted:!0,isPersited:!0}],["RC:RLStart",{isCounted:!0,isPersited:!0}],["RC:RLEnd",{isCounted:!0,isPersited:!0}],["RC:StreamMsg",{isCounted:!0,isPersited:!0}],[Q.INFORMATION_NOTIFICATION,{isCounted:!1,isPersited:!0}],["RC:ContactNtf",{isCounted:!1,isPersited:!0}],["RC:ProfileNtf",{isCounted:!1,isPersited:!0}],[Q.COMMAND_NOTIFICATION,{isCounted:!1,isPersited:!0}],[Q.GROUP_NOTIFICATION,{isCounted:!1,isPersited:!0}],["RC:RcNtf",{isCounted:!1,isPersited:!0}],[Q.COMMAND,{isCounted:!1,isPersited:!1}],["RC:TypSts",{isCounted:!1,isPersited:!1,isStatusMessage:!0}],["RC:PSCmd",{isCounted:!1,isPersited:!1}],["RC:SRSMsg",{isCounted:!1,isPersited:!1}],["RC:RcCmd",{isCounted:!1,isPersited:!0}],["RC:RRReqMsg",{isCounted:!1,isPersited:!1}],["RC:RRRspMsg",{isCounted:!1,isPersited:!1}],["RC:CsChaR",{isCounted:!1,isPersited:!1}],["RC:CSCha",{isCounted:!1,isPersited:!1}],["RC:CsEva",{isCounted:!1,isPersited:!1}],["RC:CsContact",{isCounted:!1,isPersited:!1}],["RC:CsHs",{isCounted:!1,isPersited:!1}],["RC:CsHsR",{isCounted:!1,isPersited:!1}],["RC:CsSp",{isCounted:!1,isPersited:!1}],["RC:CsEnd",{isCounted:!1,isPersited:!1}],["RC:CsUpdate",{isCounted:!1,isPersited:!1}],["RC:ReadNtf",{isCounted:!1,isPersited:!1}],["RC:chrmKVNotiMsg",{isCounted:!1,isPersited:!1}],["RC:VCAccept",{isCounted:!1,isPersited:!1}],["RC:VCRinging",{isCounted:!1,isPersited:!1}],["RC:VCSummary",{isCounted:!1,isPersited:!1}],["RC:VCHangup",{isCounted:!1,isPersited:!1}],["RC:VCInvite",{isCounted:!1,isPersited:!1}],["RC:VCModifyMedia",{isCounted:!1,isPersited:!1}],["RC:VCModifyMem",{isCounted:!1,isPersited:!1}],["RC:MsgExMsg",{isCounted:!1,isPersited:!1}],["RC:Delivered",{isCounted:!1,isPersited:!1}],["RC:RRMsg",{isCounted:!1,isPersited:!1}],["RC:LogCmdMsg",{isCounted:!1,isPersited:!1}],["RC:InterceptMsg",{isCounted:!1,isPersited:!1,isStatusMessage:!0}],["RC:RLJoin",{isCounted:!1,isPersited:!1}],["RC:RLQuit",{isCounted:!1,isPersited:!1}],["RC:RL",{isCounted:!1,isPersited:!1,isStatusMessage:!0}],["RC:CCConfigChangeRequestMsg",{isCounted:!1,isPersited:!1}]]);function ms(e){return ps.get(e)}function Ss(e){return ps.has(e)}const vs={MECHANICAL:0,INTELLIGENT:1};class Ns{constructor(e,t,i,s){Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sourceLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"targetLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.identifier=e,this.sourceLanguage=t||"auto",this.targetLanguage=i,this.text=s}isValid(e){return"string"==typeof this.identifier&&this.identifier.length>0&&"string"==typeof this.sourceLanguage&&(void 0===this.targetLanguage||"string"==typeof this.targetLanguage)&&(e?"string"==typeof this.text:void 0===this.text||"string"==typeof this.text)}toInnerParam(){return{identifier:this.identifier,sourceLanguage:this.sourceLanguage,targetLanguage:this.targetLanguage,content:this.text}}}class Os extends Ns{constructor(e,t,i,s){super(e,t,i,s)}}class ys extends Ns{constructor(e,t,i){super(Pi(e),t,i,e)}}const Cs={NONE:0,TRANSLATING:1,SUCCESS:2,FAILED:3},Ms={DEFAULT:0,AUTO_ON:1,AUTO_OFF:2};class bs{static enable(){return!0}}const Ls=48,Us=64,Ps=80,Ds=96,ws=112,Gs="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Vs=e=>{const t={};for(let i=0;i<e.length-1;i++){const s=e.charAt(i)+e.charAt(i+1);t.hasOwnProperty(s)?t[s].push(i):t[s]=[i]}const i=[];let s=[];const n=function(){if(s.length>0){const e=s.join("");if(s=[],e.length>26){const t=Fs(e.length),s=String.fromCharCode(Ps|t.length);i.push(s+t)}else{const t=String.fromCharCode(Ds|e.length);i.push(t)}i.push(e)}};let r=0;for(;r<e.length;){const o=xs(t,e,r);if(o.length<2){s.push(e.charAt(r++));continue}if(o.length<4){s.push(e.substr(r,o.length)),r+=o.length;continue}const a=Fs(r-o.offset),l=Fs(o.length);if(a.length+l.length>=o.length){s.push(e.substr(r,o.length)),r+=o.length;continue}n();const c=String.fromCharCode(Us|a.length<<2|l.length);i.push(c+a+l),r+=o.length}n();const o=Fs(e.length),a=String.fromCharCode(Ls|o.length);return i.push(a+o),i.join("")},xs=(e,t,i)=>{const s={length:0,offset:-1};if(t.length,i>=t.length-1)return s;const n=e[t.charAt(i)+t.charAt(i+1)];if(n[0]===i)return s;const r=t.length-i;for(let e=0,o=n.length;e<o;e++){const o=n[e],a=i-o;if(a>238327)continue;const l=Math.min(r,a);if(l<=s.length)break;if(s.length>2&&t.charAt(o+s.length-1)!==t.charAt(i+s.length-1))continue;let c=2;for(let e=c;e<l&&t.charAt(o+e)===t.charAt(i+e);e++)c++;c>=s.length&&(s.length=c,s.offset=o)}return s},Fs=e=>{const t=[];let i=0;do{i=e%62,t.push(Gs.charAt(i)),e=(e-i)/62}while(e>0);return t.join("")},Bs=e=>{let t=0,i=0;for(let s=e.length-1;s>=0;s--){if(i=Gs.indexOf(e.charAt(s)),-1===i)throw new Error('decode number error, data is "'+e+'"');t=62*t+i}return t},Hs=()=>!("undefined"==typeof uni||!(e=>{const t=["request","getSystemInfo"];for(let i=0,s=t.length;i<s;i++)if(!e[t[i]])return!1;return!0})(uni)),js=e=>(["setItem","getItem","removeItem"].forEach((t=>{const i=e[t];e[t]=(...t)=>{try{return i.apply(e,t)}catch(e){null===console||void 0===console||console.error(e)}}})),e);var Ys,Ws,qs;class Js{constructor(e){Ys.add(this),Ws.set(this,void 0),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),s(this,Ws,e,"f"),this._logger=e.logger}open(e){return t(this,void 0,void 0,(function*(){return e=e.sort(((e,t)=>t.weight-e.weight)),i(this,Ys,"m",qs).call(this,e,i(this,Ws,"f"))}))}}Ws=new WeakMap,Ys=new WeakSet,qs=function e(s,n){return t(this,void 0,void 0,(function*(){if(0===s.length)return Ei(D.STREAM_MESSAGE_REQUEST_FAIL,"All addrs failed");const o=s.shift();let a=ni(o.addr,o.protocol);a=`${a}/v3/message/get_stream.json?sdkVersion=5.44.0&platform=Websocket&messageUID=${n.msgUId}`,this._logger.info(r.L_REQ_STREAM_MSG_CONTENT_O,`try open -> ${a}`);const l=yield this._openHandler(a,n);return l.or((r=>t(this,void 0,void 0,(function*(){return-1===r?i(this,Ys,"m",e).call(this,s,n):l}))))}))};class Ks extends Js{_openHandler(e,i){return t(this,void 0,void 0,(function*(){const{resolve:t,promise:s}=Ri(),n=new XMLHttpRequest;let o=!1,a=null;const l=e=>{o||(o=!0,a&&(clearTimeout(a),a=null),e.isOk||(this._logger.warn(r.L_REQ_STREAM_MSG_CONTENT_E,`req fail -> code: ${e.code}`),n.abort()),t(e))};return a=setTimeout((()=>l(Ei(-1,"timeout"))),i.timeout),n.onerror=e=>l(Ei(-1,"network error")),n.onreadystatechange=t=>{if(n.readyState!==XMLHttpRequest.HEADERS_RECEIVED)return;const s=n.getResponseHeader("Content-Type"),o=null==s?void 0:s.startsWith("text/event-stream");if(200!==n.status||!o)return void(n.onloadend=()=>{const e=JSON.parse(n.response);l(Ei(e.code,e.message))});l(gi());let a=0;n.onprogress=e=>{const t=n.response.slice(a);a=n.response.length,i.onRawContent(t)},n.onerror=t=>{this._logger.warn(r.L_REQ_STREAM_MSG_CONTENT_E,`network error in transit -> ${e}`),n.onprogress=null,n.abort(),i.onNetworkError(D.STREAM_MESSAGE_REQUEST_FAIL)}},n.open("GET",e,!0),n.setRequestHeader("Content-Type","application/json;charset=UTF-8"),n.setRequestHeader("App-Key",i.appkey),n.setRequestHeader("Authorization",`Bearer ${i.token}`),n.send(),s}))}}const Qs=Hs();let Xs=null;const zs=e=>t(void 0,void 0,void 0,(function*(){const t=yield Zs.getNetworkType();Xs({status:"online"===e.type,type:t})}));const Zs={tag:"browser",httpReq:e=>Di(e).result(),get localStorage(){return localStorage},get sessionStorage(){return sessionStorage},useNavi:!0,connectPlatform:"",isFromUniapp:Qs,createWebSocket:function(e,t){const i=new WebSocket(e,t);return i.binaryType="arraybuffer",Promise.resolve(gi({id:Date.now(),onClose(e){i.onclose=t=>{const{code:i,reason:s}=t;e(i,s)}},onError(e){i.onerror=e},onMessage(e){i.onmessage=t=>{e(t.data)}},onOpen(e){i.onopen=e},send(e){i.send(e)},close(e,t){i.close()}}))},getNetworkType(){const{type:e,effectiveType:t}=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:Ge.UNKONWN},i=e||t||Ge.UNKONWN;return Promise.resolve(i)},setNetworkStatusListener:function(e){Xs=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",zs),window.addEventListener("online",zs))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",zs),window.removeEventListener("online",zs)),Xs=null},createSSEClient:e=>gi(new Ks(e)),getApiVer:()=>{const{type:e,version:t}=Zs.runtimeInfo;return`browser|${e}|${t}`},get runtimeInfo(){const{userAgent:e}=navigator;let t,i;const s={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(const n in s){if(!s.hasOwnProperty(n))continue;let r=e.match(s[n]);if(r){i=n,t=r[1]||r[2];break}}return{type:i||"Unknown",version:t||"Unknown"}}};var $s;!function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgS=2]="ppMsgS",e[e.pgMsgS=3]="pgMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.prMsgS=7]="prMsgS",e[e.pbMsgP=8]="pbMsgP",e[e.qryPMsg=9]="qryPMsg",e[e.qryGMsg=10]="qryGMsg",e[e.qryCHMsg=11]="qryCHMsg",e[e.qryCMsg=12]="qryCMsg",e[e.qrySMsg=13]="qrySMsg",e[e.qryMCMsg=14]="qryMCMsg",e[e.qryMPMsg=15]="qryMPMsg",e[e.recallMsg=16]="recallMsg",e[e.rrMsg=17]="rrMsg",e[e.rrList=18]="rrList",e[e.s_ntf=19]="s_ntf",e[e.s_msg=20]="s_msg",e[e.s_stat=21]="s_stat",e[e.s_cmd=22]="s_cmd",e[e.s_us=23]="s_us",e[e.transLan=24]="transLan",e[e.autoTrans=25]="autoTrans",e[e.pullUS=26]="pullUS",e[e.sendMsgRead=27]="sendMsgRead",e[e.qryMsgRead=28]="qryMsgRead",e[e.qryMsgReadCntBatch=29]="qryMsgReadCntBatch",e[e.updRTime=30]="updRTime",e[e.qryRLBatch=31]="qryRLBatch",e[e.chatMsgS=32]="chatMsgS",e[e.qrySessionsAtt=33]="qrySessionsAtt",e[e.pullMsg=34]="pullMsg",e[e.qrySessions=35]="qrySessions",e[e.delSessions=36]="delSessions",e[e.delMsg=37]="delMsg",e[e.delUgMsg=38]="delUgMsg",e[e.delUgSe=39]="delUgSe",e[e.updRRTime=40]="updRRTime",e[e.qrySessionsUnread=41]="qrySessionsUnread",e[e.setTypeUnpush=42]="setTypeUnpush",e[e.chrmPull=43]="chrmPull",e[e.joinChrm=44]="joinChrm",e[e.joinChrmR=45]="joinChrmR",e[e.exitChrm=46]="exitChrm",e[e.queryChrmI=47]="queryChrmI",e[e.setKV=48]="setKV",e[e.delKV=49]="delKV",e[e.setKVS=50]="setKVS",e[e.delKVS=51]="delKVS",e[e.pullKV=52]="pullKV",e[e.qryRelation=53]="qryRelation",e[e.qryRelationR=54]="qryRelationR",e[e.qryRelationFilter=55]="qryRelationFilter",e[e.delRelation=56]="delRelation",e[e.delRelationBatch=57]="delRelationBatch",e[e.pullSe=58]="pullSe",e[e.pullSeAtts=59]="pullSeAtts",e[e.setSeAtt=60]="setSeAtt",e[e.qnTkn=61]="qnTkn",e[e.qnUrl=62]="qnUrl",e[e.aliUrl=63]="aliUrl",e[e.s3Url=64]="s3Url",e[e.stcUrl=65]="stcUrl",e[e.minioUrl=66]="minioUrl",e[e.cleanPMsg=67]="cleanPMsg",e[e.cleanGMsg=68]="cleanGMsg",e[e.cleanCMsg=69]="cleanCMsg",e[e.cleanSMsg=70]="cleanSMsg",e[e.cleanMCMsg=71]="cleanMCMsg",e[e.cleanMPMsg=72]="cleanMPMsg",e[e.cleanMsgBatch=73]="cleanMsgBatch",e[e.rtcPing=74]="rtcPing",e[e.rtc_ntf=75]="rtc_ntf",e[e.rtcSetOutData=76]="rtcSetOutData",e[e.rtcQryUserOutData=77]="rtcQryUserOutData",e[e.addSeTag=78]="addSeTag",e[e.delSeTag=79]="delSeTag",e[e.addTag=80]="addTag",e[e.delTag=81]="delTag",e[e.reportsdk=82]="reportsdk",e[e.pullUgSes=83]="pullUgSes",e[e.pullUgMsg=84]="pullUgMsg",e[e.ugMsg=85]="ugMsg",e[e.qryUgMsg=86]="qryUgMsg",e[e.updUgRTime=87]="updUgRTime",e[e.upMsgEx=88]="upMsgEx",e[e.modifyMsg=89]="modifyMsg",e[e.qryMsgChange=90]="qryMsgChange",e[e.qryMsg=91]="qryMsg",e[e.operate=92]="operate",e[e.s_opNtf=93]="s_opNtf",e[e.ugUnpushQuery=94]="ugUnpushQuery",e[e.ugUnpushSet=95]="ugUnpushSet",e[e.setRtcRoomId=96]="setRtcRoomId",e[e.qryUgUal=97]="qryUgUal",e[e.updUserSub=98]="updUserSub",e[e.pullUserSub=99]="pullUserSub",e[e.pullSubData=100]="pullSubData",e[e.qrySubData=101]="qrySubData",e[e.pullUserProfile=102]="pullUserProfile",e[e.pullOwnProfile=103]="pullOwnProfile",e[e.updProfilePermiss=104]="updProfilePermiss",e[e.qProfilePermiss=105]="qProfilePermiss",e[e.searchUserProfile=106]="searchUserProfile",e[e.updUserProfile=107]="updUserProfile",e[e.pullEventChange=108]="pullEventChange",e[e.channelCreate=109]="channelCreate",e[e.upChannelInfo=110]="upChannelInfo",e[e.qChannelInfo=111]="qChannelInfo",e[e.channelMemKick=112]="channelMemKick",e[e.channelMemQuit=113]="channelMemQuit",e[e.channelDismiss=114]="channelDismiss",e[e.channelTransfer=115]="channelTransfer",e[e.upChannelManager=116]="upChannelManager",e[e.qChannelMem=117]="qChannelMem",e[e.qChannelSpeMem=118]="qChannelSpeMem",e[e.upChannelMem=119]="upChannelMem",e[e.channelMemJoin=120]="channelMemJoin",e[e.channelMemInvite=121]="channelMemInvite",e[e.channelApplyResp=122]="channelApplyResp",e[e.qChannelApplyList=123]="qChannelApplyList",e[e.qChannelMemJoin=124]="qChannelMemJoin",e[e.qChannelMemSpeJoin=125]="qChannelMemSpeJoin",e[e.upChannelRemark=126]="upChannelRemark",e[e.qChannelRemark=127]="qChannelRemark",e[e.upChannelFollow=128]="upChannelFollow",e[e.qChannelFollow=129]="qChannelFollow",e[e.qSimpleUserProfile=130]="qSimpleUserProfile",e[e.friendAdd=131]="friendAdd",e[e.friendDel=132]="friendDel",e[e.friendHandle=133]="friendHandle",e[e.friendSetPf=134]="friendSetPf",e[e.friendCheck=135]="friendCheck",e[e.friendsQuery=136]="friendsQuery",e[e.friendApplyDel=137]="friendApplyDel",e[e.friendsInfoQry=138]="friendsInfoQry",e[e.friendAuthSet=139]="friendAuthSet",e[e.friendAuthGet=140]="friendAuthGet",e[e.addUnpush=141]="addUnpush",e[e.qryUnpush=142]="qryUnpush",e[e.delUnpush=143]="delUnpush",e[e.s_pubCall=144]="s_pubCall",e[e.reqCall=145]="reqCall",e[e.pullKvMsg=146]="pullKvMsg",e[e.readReceipt=147]="readReceipt",e[e.qryReceipt=148]="qryReceipt",e[e.qryReceiptBatch=149]="qryReceiptBatch",e[e.upConvertMsg=150]="upConvertMsg",e[e.pullModifyMsg=151]="pullModifyMsg",e[e.qAppBot=152]="qAppBot",e[e.qBot=153]="qBot",e[e.addPReaction=154]="addPReaction",e[e.rmPReaction=155]="rmPReaction",e[e.addGReaction=156]="addGReaction",e[e.rmGReaction=157]="rmGReaction",e[e.addUgReaction=158]="addUgReaction",e[e.rmUgReaction=159]="rmUgReaction",e[e.mReactBQ=160]="mReactBQ",e[e.ugMReactBQ=161]="ugMReactBQ",e[e.mReactQ=162]="mReactQ",e[e.ugMReactQ=163]="ugMReactQ",e[e.mReactUQ=164]="mReactUQ",e[e.ugMReactUQ=165]="ugMReactUQ"}($s||($s={}));const en=e=>{const t=$s[e];return t},tn=e=>$s[e],sn=0,nn=1,rn=2,on=3,an=4,ln=5,cn=6,_n=7,dn=12,un=13,hn=14,gn=4,En=3,In="rtcRJoin_data",Tn="rtcRExit",fn="rtcUPut",Rn="rtcUDel",An="rtcSetData",pn="userSetData",mn="rtcQryData",Sn="rtcDelData",vn="rtcToken",Nn="rtcUserState",On="rtcUList",yn="viewerJoinR",Cn="viewerExitR",Mn="rtcIdentityChange",bn="rtcInvite",Ln="rtcCancelInvite",Un="rtcInviteAnswer",Pn="rtcEndInvite",Dn="rtcQueryJoined",wn=0,Gn=1,Vn=2,kn=3,xn=4,Fn=5,Bn=6,Hn=7,jn=8,Yn=9,Wn=10,qn=11,Jn=12,Kn=13,Qn=14,Xn=15,zn=16,Zn=17,$n=18,er=19,tr=20,ir=1,sr=2,nr=4,rr=5,or=6,ar=7,lr=8,cr=9;class _r{static writeUTF(e){let{back:t,byteSize:i}=this._getBackAndByteSize(e);for(let e=0,i=t.length;e<i;e++)t[e]>255&&(t[e]&=255);return i<=255?[0,i].concat(t):[i>>8,255&i].concat(t)}static _getBackAndByteSize(e){const t=[];let i=0;if("string"==typeof e)for(let s=0,n=e.length;s<n;s++){const n=e.charCodeAt(s);n>=0&&n<=127?(i+=1,t.push(n)):n>=128&&n<=2047?(i+=2,t.push(192|31&n>>6),t.push(128|63&n)):n>=2048&&n<=65535&&(i+=3,t.push(224|15&n>>12),t.push(128|63&n>>6),t.push(128|63&n))}return{byteSize:i,back:t}}static readUTF(e){const t=[];let i,s,n=-1;const r=e;let o="";for(;++n<r.length;){let e=Number(r[n]);if(e===(127&e)||(240&~e?224&~e?192&~e||(e^=192,e=e<<6|128^r[++n]):(e^=224,e=e<<6|128^r[++n],e=e<<6|128^r[++n]):(e^=240,e=e<<6|128^r[++n],e=e<<6|128^r[++n],e=e<<6|128^r[++n])),!Number.isFinite(e)||e<0||e>1114111||Math.floor(e)!==e)throw RangeError(`Invalid code point: ${e}`);e<=65535?t.push(e):(e-=65536,i=e>>10|55296,s=e%1024|56320,t.push(i,s)),(n+1===r.length||t.length>16384)&&(o+=String.fromCharCode.apply(null,t),t.length=0)}return o}}class dr{constructor(e){Object.defineProperty(this,"_pool",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_position",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_poolLen",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._pool=e,this._poolLen=e.length}check(){return this._position>=this._pool.length}read2Byte(){const e=this;if(e.check())return-1;let t="";for(let i=0;i<2;i++){let i=e._pool[e._position++].toString(16);1===i.length&&(i=`0${i}`),t+=i.toString()}return parseInt(t,16)}readInt32(){return(this.readByte()<<24)+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()}readLong(){const e=this;if(e.check())return-1;let t="";for(let i=0;i<8;i++){let i=e._pool[e._position++].toString(16);1===i.length&&(i=`0${i}`),t+=i}return parseInt(t,16)}readByte(){if(this.check())return-1;let e=this._pool[this._position++];return e>255&&(e&=255),e}readUTF(){if(this.check())return"";const e=this.readByte()<<8|this.readByte(),t=this._position;this._position+=e;const i=this._pool.subarray(t,this._position);return _r.readUTF(i)}readAll(){return this._pool.subarray(this._position,this._poolLen)}}class ur{constructor(){Object.defineProperty(this,"_pool",{enumerable:!0,configurable:!0,writable:!0,value:[]})}writeByte(e){e>=0&&(e>255&&(e&=255),this._pool.push(e))}writeBuffer(e){this._pool=this._pool.concat([...new Int8Array(e)])}writeArr(e){this._pool=this._pool.concat(e)}writeUTF(e){const t=_r.writeUTF(e);this._pool=this._pool.concat(t)}getBytesArray(){return this._pool}}class hr{constructor(e,t=nn,i=!1,s=!1){Object.defineProperty(this,"command",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"qos",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_retain",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"dup",{enumerable:!0,configurable:!0,writable:!0,value:s})}static parse(e){return new hr(e>>4,(6&e)>>1,!(1&~e),(8&e)>0)}encode(){let e=this.command<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this.dup?8:0,e}}class gr{constructor(e){Object.defineProperty(this,"header",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:0})}read(e,t,i){this.readMessage(e,t,i)}readMessage(e,t,i){return{stream:e,length:t}}}class Er{constructor(e){Object.defineProperty(this,"_header",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"messageId",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._header=new hr(e,sn)}write(e){const t=this.getHeaderFlag();e.writeByte(t),this.writeMessage(e)}setHeaderQos(e){this._header.qos=e}getHeaderFlag(){return this._header.encode()}getArrayBuffer(){const e=new ur;this.write(e);const t=e.getBytesArray();return new Int8Array(t).buffer}}class Ir extends gr{constructor(){super(...arguments),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"userId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"messageId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"sessionId",{enumerable:!0,configurable:!0,writable:!0,value:""})}readMessage(e,t,i){if(e.readByte(),this.status=e.readByte(),t<=Ir.MESSAGE_LENGTH)return{stream:e,length:t};if(i===gn){const t=e.readByte();1&t&&(this.userId=e.readUTF()),2&t&&(this.sessionId=e.readUTF()),4&t&&(this.timestamp=e.readLong()),8&t&&(this.messageId=e.read2Byte())}else this.userId=e.readUTF(),this.sessionId=e.readUTF(),this.timestamp=e.readLong();return{stream:e,length:t}}}Object.defineProperty(Ir,"MESSAGE_LENGTH",{enumerable:!0,configurable:!0,writable:!0,value:2});class Tr extends Er{constructor(e){super(hn),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:e})}writeMessage(e){e.writeArr([0,this.status])}}class fr extends gr{constructor(){super(...arguments),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}readMessage(e,t){return e.readByte(),this.status=e.readByte(),this.data=e.readAll(),{stream:e,length:t}}}Object.defineProperty(fr,"MESSAGE_LENGTH",{enumerable:!0,configurable:!0,writable:!0,value:2});class Rr extends Er{constructor(){super(dn)}writeMessage(e){}}class Ar extends gr{constructor(e){super(e)}}class pr extends gr{constructor(){super(...arguments),Object.defineProperty(this,"messageId",{enumerable:!0,configurable:!0,writable:!0,value:0})}readMessage(e,t){const i=256*e.readByte()+e.readByte();return this.messageId=parseInt(i.toString(),10),{stream:e,length:t}}}class mr extends Er{writeMessage(e){const t=this.messageId,i=255&t,s=(65280&t)>>8;e.writeByte(s),e.writeByte(i)}}class Sr extends pr{constructor(e){super(e),Object.defineProperty(this,"topic",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"pbData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"targetId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"syncMsg",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.syncMsg=e.dup}readMessage(e,t){return this.date=e.readInt32(),this.topic=e.readUTF(),this.targetId=e.readUTF(),super.readMessage(e,t),this.pbData=e.readAll(),{stream:e,length:t}}}class vr extends mr{constructor(e,t,i,s){super(e),Object.defineProperty(this,"targetId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"pbData",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"topic",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.topic="string"==typeof t?t:tn(t)}writeMessage(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),super.writeMessage(e),e.writeBuffer(this.pbData)}}class Nr extends vr{constructor(e,t,i){super(ln,e,i,t)}}class Or extends vr{constructor(e,t,i){super(on,e,i,t)}}class yr extends pr{constructor(){super(...arguments),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"millisecond",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"messageUId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:0})}readMessage(e,t){return super.readMessage(e,t),this.date=e.readInt32(),this.status=256*e.readByte()+e.readByte(),this.millisecond=256*e.readByte()+e.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=e.readUTF(),{stream:e,length:t}}}class Cr extends mr{constructor(e){super(an),this.messageId=e}}class Mr extends mr{constructor(e){super(_n),this.messageId=e}}class br extends pr{constructor(){super(...arguments),Object.defineProperty(this,"pbData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:0})}readMessage(e,t){return super.readMessage(e,t),this.date=e.readInt32(),this.status=256*e.readByte()+e.readByte(),this.pbData=e.readAll(),{stream:e,length:t}}}const Lr=(e,t)=>{const i=new Uint8Array(e),s=new dr(i),n=s.readByte(),r=(e=>{const{command:t}=e;let i;switch(t){case rn:i=new Ir(e);break;case on:i=new Sr(e);break;case an:i=new yr(e);break;case cn:i=new br(e);break;case un:i=new Ar(e);break;case hn:i=new fr(e);break;default:console.error(`No support for deserializing ${t} messages`)}return i})(hr.parse(n));return r&&r.read(s,i.length-1,t),r};class Ur extends Js{_openHandler(e,t){const{resolve:i,promise:s}=Ri(),n=this._logger,o=wx.request({url:e,enableChunked:!0,method:"GET",timeout:t.timeout,header:{"Content-Type":"application/json;charset=UTF-8","App-Key":t.appkey,Authorization:`Bearer ${t.token}`},success(e){var t;if(200===e.statusCode&&(null===(t=e.header["Content-Type"])||void 0===t?void 0:t.startsWith("text/event-stream")))i(gi());else{const{code:t,message:s}=JSON.parse(e.data);i(Ei(t,s))}},fail(t){const{errMsg:s,errno:o}=t;n.warn(r.L_REQ_STREAM_MSG_CONTENT_E,JSON.stringify({url:e,errMsg:s,errno:o})),i(Ei(-1,t.errMsg))},complete(){n.debug(r.L_REQ_STREAM_MSG_CONTENT_O,`req complete -> ${e}`)}});return o.onChunkReceived((e=>{const i=_r.readUTF(new Uint8Array(e.data));n.debug(r.L_REQ_STREAM_MSG_CONTENT_O,`chunk received -> ${i}`),t.onRawContent(i)})),s}}const Pr=Hs(),Dr=js({setItem(e,t){wx.setStorage({key:e,data:t})},getItem:e=>wx.getStorageSync(e),removeItem(e){wx.removeStorage({key:e})}});let wr=null;const Gr=e=>{const{isConnected:t,networkType:i}=e;wr({status:t,type:i})};const Vr={tag:"wechat",httpReq(e){const t=e.method||Ve.GET,i=e.timeout||xe,{headers:s,query:n,body:r}=e,o=Qt(e.url,n);return new Promise((e=>{wx.request({url:o,method:t,header:s,timeout:i,data:r,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:D.RC_HTTP_REQ_FAIL})}})}))},localStorage:Dr,sessionStorage:Dr,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Pr,createWebSocket(e,t){const i=wx.connectSocket({url:e,protocols:t});return Promise.resolve(gi({id:Date.now(),onClose(e){i.onClose((t=>{e(t.code,t.reason)}))},onError(e){i.onError((t=>{e(t.errMsg),i.close()}))},onMessage(e){i.onMessage((t=>{e(t.data)}))},onOpen(e){i.onOpen(e)},send(e){i.send({data:e})},close(e,t){i.close({code:e,reason:t})}}))},getNetworkType:()=>new Promise((e=>{wx.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){wr=e,wx.onNetworkStatusChange(Gr)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(Gr),wr=null},createSSEClient:e=>gi(new Ur(e)),get runtimeInfo(){return{type:Vr.tag,version:"Unknown"}}},kr=Hs(),xr=js({setItem(e,t){my.setStorage({key:e,data:t})},getItem(e){const{data:t}=my.getStorageSync({key:e});return t},removeItem(e){my.removeStorage({key:e})}});let Fr=null;const Br=e=>{const{isConnected:t,networkType:i}=e;Fr({status:t,type:i})};const Hr={tag:"alipay",httpReq(e){const t=e.method||Ve.GET,i=e.timeout||xe,{headers:s,query:n,body:r}=e,o=Qt(e.url,n),a=e.dataType||"json";return new Promise((e=>{my.request({url:o,method:t,headers:s,timeout:i,data:r,dataType:a,success:t=>{e({data:t.data,status:t.status})},fail:()=>{e({status:D.RC_HTTP_REQ_FAIL})}})}))},localStorage:xr,sessionStorage:xr,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:kr,createWebSocket(e){const t=my.connectSocket({url:e,multiple:!0});return Promise.resolve(gi({id:Date.now(),onClose(e){t.onClose(e)},onError(e){t.onError((t=>{e(t.errMsg)}))},onMessage(e){t.onMessage((t=>{t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen(e){t.onOpen(e)},send(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close(){t.close()}}))},getNetworkType:()=>new Promise((e=>{my.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){Fr=e,my.onNetworkStatusChange(Br)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(Br),Fr=null},createSSEClient:e=>Ei(D.NOT_SUPPORT,"Not supported yet"),get runtimeInfo(){return{type:Hr.tag,version:"Unknown"}}},jr=Hs(),Yr=js({setItem(e,t){tt.setStorage({key:e,data:t})},getItem:e=>tt.getStorageSync(e),removeItem(e){tt.removeStorage({key:e})}});let Wr=null;const qr=e=>{const{isConnected:t,networkType:i}=e;Wr({status:t,type:i})};const Jr={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:jr,localStorage:Yr,sessionStorage:Yr,httpReq:e=>new Promise((t=>{tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success(e){const i=(null==e?void 0:e.data)||{},s={data:JSON.stringify(i),status:e.statusCode};t(s)},fail(e){t({status:D.RC_HTTP_REQ_FAIL})}})})),createWebSocket:(e,t)=>new Promise((i=>{const s=tt.connectSocket({url:e,protocols:t,fail:e=>i(Ei(D.RC_SOCKET_DISCONNECTED,e.errMsg))});i(gi({id:Date.now(),onOpen(e){s.onOpen(e)},onClose(e){s.onClose((t=>e(t.code,t.reason)))},onError(e){s.onError((t=>{s.close(),e(t.errMsg)}))},onMessage(e){s.onMessage((t=>e(t.data)))},send(e){s.send({data:e})},close(e,t){s.close({code:e,reason:t})}}))})),getNetworkType:()=>new Promise((e=>{tt.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){Wr=e,tt.onNetworkStatusChange(qr)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(qr),Wr=null},createSSEClient:e=>Ei(D.NOT_SUPPORT),get runtimeInfo(){return{type:Jr.tag,version:"Unknown"}}},Kr=Hs(),Qr=js({setItem(e,t){swan.setStorage({key:e,data:t})},getItem:e=>swan.getStorageSync(e),removeItem(e){swan.removeStorage({key:e})}});let Xr=null;const zr=e=>{const{isConnected:t,networkType:i}=e;Xr({status:t,type:i})};const Zr={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Kr,localStorage:Qr,sessionStorage:Qr,httpReq:e=>new Promise((t=>{swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success(e){const i=(null==e?void 0:e.data)||{},s={data:JSON.stringify(i),status:e.statusCode};t(s)},fail(e){t({status:D.RC_HTTP_REQ_FAIL})}})})),createWebSocket(e,t){const i=swan.connectSocket({url:e,protocols:t});return Promise.resolve(gi({id:Date.now(),onOpen(e){i.onOpen(e)},onClose(e){i.onClose((t=>e(t.code,t.reason)))},onError(e){i.onError((t=>e(t.errMsg)))},onMessage(e){i.onMessage((t=>e(t.data)))},send(e){i.send({data:e})},close(e,t){i.close({code:e,reason:t})}}))},getNetworkType(){return t(this,void 0,void 0,(function*(){return new Promise((e=>{swan.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})}))}))},setNetworkStatusListener:function(e){Xr=e,swan.onNetworkStatusChange(zr)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(zr),Xr=null},createSSEClient:e=>Ei(D.NOT_SUPPORT),get runtimeInfo(){return{type:Zr.tag,version:"Unknown"}}},$r=Hs(),eo=js({setItem(e,t){jd.setStorage({key:e,data:t})},getItem:e=>jd.getStorageSync(e),removeItem(e){jd.removeStorage({key:e})}});let to=null;const io=e=>{const{isConnected:t,networkType:i}=e;to({status:t,type:i})};const so={tag:"jingdong",httpReq(e){const t=e.method||Ve.GET,i=e.timeout||xe,{headers:s,query:n,body:r}=e,o=Qt(e.url,n);return new Promise((e=>{jd.request({url:o,method:t,header:s,timeout:i,data:r,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:D.RC_HTTP_REQ_FAIL})}})}))},localStorage:eo,sessionStorage:eo,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:$r,createWebSocket:(e,t)=>(jd.connectSocket({url:e,protocols:t}),Promise.resolve(gi({id:Date.now(),onClose(e){jd.onSocketClose((t=>{e(t.code,t.reason)}))},onError(e){jd.onSocketError((t=>{e(t.errMsg)}))},onMessage(e){jd.onSocketMessage((t=>{e(t.data)}))},onOpen(e){jd.onSocketOpen(e)},send(e){jd.sendSocketMessage({data:e})},close(e,t){jd.closeSocket({code:e,reason:t})}}))),getNetworkType:()=>new Promise((e=>{jd.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){to=e,jd.onNetworkStatusChange(io)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(io),to=null},createSSEClient:e=>Ei(D.NOT_SUPPORT),get runtimeInfo(){return{type:so.tag,version:"Unknown"}}},no=Hs(),ro=js({setItem(e,t){ks.setStorage({key:e,data:t})},getItem:e=>ks.getStorageSync(e),removeItem(e){ks.removeStorage({key:e})}});let oo=null;const ao=e=>{const{isConnected:t,networkType:i}=e;oo({status:t,type:i})};const lo={tag:"kuaishou",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:no,localStorage:ro,sessionStorage:ro,httpReq:e=>new Promise((t=>{ks.request({url:e.url,data:e.body,header:e.headers,method:e.method,success(e){const i=(null==e?void 0:e.data)||{},s={data:JSON.stringify(i),status:e.statusCode};t(s)},fail(e){t({status:D.RC_HTTP_REQ_FAIL})}})})),createWebSocket(e,t){const i=ks.connectSocket({url:e,protocols:t});return Promise.resolve(gi({id:Date.now(),onOpen(e){i.onOpen(e)},onClose(e){i.onClose((t=>e(t.code,t.reason)))},onError(e){i.onError((t=>e(t.errMsg)))},onMessage(e){i.onMessage((t=>e(t.data)))},send(e){i.send({data:e})},close(e,t){i.close({code:e,reason:t})}}))},getNetworkType:()=>new Promise((e=>{ks.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){oo=e,ks.onNetworkStatusChange(ao)},removeNetworkStatusListener:function(){ks.offNetworkStatusChange(ao),oo=null},createSSEClient:e=>Ei(D.NOT_SUPPORT),get runtimeInfo(){return{type:lo.tag,version:"Unknown"}}},co=js({setItem(e,t){uni.setStorage({key:e,data:t})},getItem:e=>uni.getStorageSync(e),removeItem(e){uni.removeStorage({key:e,success:()=>{}})}});let _o=null;const uo=e=>{const{isConnected:t,networkType:i}=e;_o({status:t,type:i})};const ho={tag:"uniapp",httpReq(e){const t=e.method||Ve.GET,i=e.timeout||xe,{headers:s,query:n,body:r}=e,o=Qt(e.url,n);return new Promise((e=>{uni.request({url:o,method:t,header:s,timeout:i,data:r,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:D.RC_HTTP_REQ_FAIL})}})}))},localStorage:co,sessionStorage:co,useNavi:!0,get connectPlatform(){const{uniPlatform:e,osName:t}=uni.getSystemInfoSync();return["app","app-plus"].includes(e)&&t||""},isFromUniapp:!0,createWebSocket(e,t){const i={complete(){},url:e,protocols:t},s=uni.connectSocket(i);return Promise.resolve(gi({id:Date.now(),onClose(e){s.onClose((t=>{e(t.code,t.reason)}))},onError(e){s.onError((t=>{e(t.errMsg)}))},onMessage(e){s.onMessage((t=>{e(t.data)}))},onOpen(e){s.onOpen(e)},send(e){s.send({data:e})},close(e,t){s.close({code:e,reason:t})}}))},getNetworkType:()=>new Promise((e=>{uni.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){_o=e,uni.onNetworkStatusChange(uo)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(uo),_o=null},createSSEClient:e=>Ei(D.NOT_SUPPORT),getApiVer:()=>{const e=uni.getSystemInfoSync(),{osAndroidAPILevel:t,deviceModel:i,deviceBrand:s,osVersion:n,osName:r}=e;return`${s||""}|${i||""}|${("android"===r?t:n)||""}|||uniapp`.replace(/-/g,"_")},get runtimeInfo(){return{type:ho.tag,version:"Unknown"}}},go=e=>e&&e.request&&e.getSystemInfo,Eo="undefined"!=typeof uni&&go(uni)?(()=>{switch(process.env.VUE_APP_PLATFORM){case"app-plus":case"app":case"app-harmony":return ho;case"mp-jd":return so;case"mp-baidu":return Zr;case"mp-toutiao":return Jr;case"mp-alipay":return Hr;case"mp-weixin":return Vr;case"mp-kuaishou":return lo;default:return Zs}})():"undefined"!=typeof jd&&go(jd)?so:"undefined"!=typeof my&&go(my)?Hr:"undefined"!=typeof tt&&go(tt)?Jr:"undefined"!=typeof ks&&go(ks)?lo:"undefined"!=typeof swan&&go(swan)?Zr:"undefined"!=typeof wx&&go(wx)?Vr:Zs,Io=function(){var e,t={},i=function(e){var t=function(e,i,n){if(void 0===e&&(e=t.DEFAULT_CAPACITY),void 0===i&&(i=t.DEFAULT_ENDIAN),void 0===n&&(n=t.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");i=!!i,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=i,this.noAssert=n};t.VERSION="5.0.1",t.LITTLE_ENDIAN=!0,t.BIG_ENDIAN=!1,t.DEFAULT_CAPACITY=16,t.DEFAULT_ENDIAN=t.BIG_ENDIAN,t.DEFAULT_NOASSERT=!1,t.Long=e||null;var i=t.prototype;i.__isByteBuffer__,Object.defineProperty(i,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var s=new ArrayBuffer(0),n=String.fromCharCode;function r(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function o(){var e=[],t=[];return function(){if(0===arguments.length)return t.join("")+n.apply(String,e);e.length+arguments.length>1024&&(t.push(n.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function a(e,t,i,s,n){var r,o,a=8*n-s-1,l=(1<<a)-1,c=l>>1,_=-7,d=i?n-1:0,u=i?-1:1,h=e[t+d];for(d+=u,r=h&(1<<-_)-1,h>>=-_,_+=a;_>0;r=256*r+e[t+d],d+=u,_-=8);for(o=r&(1<<-_)-1,r>>=-_,_+=s;_>0;o=256*o+e[t+d],d+=u,_-=8);if(0===r)r=1-c;else{if(r===l)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,s),r-=c}return(h?-1:1)*o*Math.pow(2,r-s)}function l(e,t,i,s,n,r){var o,a,l,c=8*r-n-1,_=(1<<c)-1,d=_>>1,u=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=s?0:r-1,g=s?1:-1,E=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=_):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+d>=1?u/l:u*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=_?(a=0,o=_):o+d>=1?(a=(t*l-1)*Math.pow(2,n),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,n),o=0));n>=8;e[i+h]=255&a,h+=g,a/=256,n-=8);for(o=o<<n|a,c+=n;c>0;e[i+h]=255&o,h+=g,o/=256,c-=8);e[i+h-g]|=128*E}t.accessor=function(){return Uint8Array},t.allocate=function(e,i,s){return new t(e,i,s)},t.concat=function(e,i,s,n){"boolean"!=typeof i&&"string"==typeof i||(n=s,s=i,i=void 0);for(var r,o=0,a=0,l=e.length;a<l;++a)t.isByteBuffer(e[a])||(e[a]=t.wrap(e[a],i)),(r=e[a].limit-e[a].offset)>0&&(o+=r);if(0===o)return new t(0,s,n);var c,_=new t(o,s,n);for(a=0;a<l;)(r=(c=e[a++]).limit-c.offset)<=0||(_.view.set(c.view.subarray(c.offset,c.limit),_.offset),_.offset+=r);return _.limit=_.offset,_.offset=0,_},t.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},t.type=function(){return ArrayBuffer},t.wrap=function(e,s,n,r){if("string"!=typeof s&&(r=n,n=s,s=void 0),"string"==typeof e)switch(void 0===s&&(s="utf8"),s){case"base64":return t.fromBase64(e,n);case"hex":return t.fromHex(e,n);case"binary":return t.fromBinary(e,n);case"utf8":return t.fromUTF8(e,n);case"debug":return t.fromDebug(e,n);default:throw Error("Unsupported encoding: "+s)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");var o;if(t.isByteBuffer(e))return(o=i.clone.call(e)).markedOffset=-1,o;if(e instanceof Uint8Array)o=new t(0,n,r),e.length>0&&(o.buffer=e.buffer,o.offset=e.byteOffset,o.limit=e.byteOffset+e.byteLength,o.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)o=new t(0,n,r),e.byteLength>0&&(o.buffer=e,o.offset=0,o.limit=e.byteLength,o.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");(o=new t(e.length,n,r)).limit=e.length;for(var a=0;a<e.length;++a)o.view[a]=e[a]}return o},i.writeBitSet=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var s,n=t,r=e.length,o=r>>3,a=0;for(t+=this.writeVarint32(r,t);o--;)s=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(s,t++);if(a<r){var l=0;for(s=0;a<r;)s|=(1&!!e[a++])<<l++;this.writeByte(s,t++)}return i?(this.offset=t,this):t-n},i.readBitSet=function(e){var t=void 0===e;t&&(e=this.offset);var i,s=this.readVarint32(e),n=s.value,r=n>>3,o=0,a=[];for(e+=s.length;r--;)i=this.readByte(e++),a[o++]=!!(1&i),a[o++]=!!(2&i),a[o++]=!!(4&i),a[o++]=!!(8&i),a[o++]=!!(16&i),a[o++]=!!(32&i),a[o++]=!!(64&i),a[o++]=!!(128&i);if(o<n){var l=0;for(i=this.readByte(e++);o<n;)a[o++]=!!(i>>l++&1)}return t&&(this.offset=e),a},i.readBytes=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}var s=this.slice(t,t+e);return i&&(this.offset+=e),s},i.writeBytes=i.append,i.writeInt8=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=1,this.view[t]=e,i&&(this.offset+=1),this},i.writeByte=i.writeInt8,i.readInt8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i=this.view[e];return 128&~i||(i=-(255-i+1)),t&&(this.offset+=1),i},i.readByte=i.readInt8,i.writeUint8=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=1,this.view[t]=e,i&&(this.offset+=1),this},i.writeUInt8=i.writeUint8,i.readUint8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i=this.view[e];return t&&(this.offset+=1),i},i.readUInt8=i.readUint8,i.writeInt16=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),i&&(this.offset+=2),this},i.writeShort=i.writeInt16,i.readInt16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var i=0;return this.littleEndian?(i=this.view[e],i|=this.view[e+1]<<8):(i=this.view[e]<<8,i|=this.view[e+1]),32768&~i||(i=-(65535-i+1)),t&&(this.offset+=2),i},i.readShort=i.readInt16,i.writeUint16=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),i&&(this.offset+=2),this},i.writeUInt16=i.writeUint16,i.readUint16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var i=0;return this.littleEndian?(i=this.view[e],i|=this.view[e+1]<<8):(i=this.view[e]<<8,i|=this.view[e+1]),t&&(this.offset+=2),i},i.readUInt16=i.readUint16,i.writeInt32=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),i&&(this.offset+=4),this},i.writeInt=i.writeInt32,i.readInt32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var i=0;return this.littleEndian?(i=this.view[e+2]<<16,i|=this.view[e+1]<<8,i|=this.view[e],i+=this.view[e+3]<<24>>>0):(i=this.view[e+1]<<16,i|=this.view[e+2]<<8,i|=this.view[e+3],i+=this.view[e]<<24>>>0),i|=0,t&&(this.offset+=4),i},i.readInt=i.readInt32,i.writeUint32=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),i&&(this.offset+=4),this},i.writeUInt32=i.writeUint32,i.readUint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var i=0;return this.littleEndian?(i=this.view[e+2]<<16,i|=this.view[e+1]<<8,i|=this.view[e],i+=this.view[e+3]<<24>>>0):(i=this.view[e+1]<<16,i|=this.view[e+2]<<8,i|=this.view[e+3],i+=this.view[e]<<24>>>0),t&&(this.offset+=4),i},i.readUInt32=i.readUint32,e&&(i.writeInt64=function(t,i){var s=void 0===i;if(s&&(i=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),i+=8;var n=this.buffer.byteLength;i>n&&this.resize((n*=2)>i?n:i),i-=8;var r=t.low,o=t.high;return this.littleEndian?(this.view[i+3]=r>>>24&255,this.view[i+2]=r>>>16&255,this.view[i+1]=r>>>8&255,this.view[i]=255&r,i+=4,this.view[i+3]=o>>>24&255,this.view[i+2]=o>>>16&255,this.view[i+1]=o>>>8&255,this.view[i]=255&o):(this.view[i]=o>>>24&255,this.view[i+1]=o>>>16&255,this.view[i+2]=o>>>8&255,this.view[i+3]=255&o,i+=4,this.view[i]=r>>>24&255,this.view[i+1]=r>>>16&255,this.view[i+2]=r>>>8&255,this.view[i+3]=255&r),s&&(this.offset+=8),this},i.writeLong=i.writeInt64,i.readInt64=function(t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var s=0,n=0;this.littleEndian?(s=this.view[t+2]<<16,s|=this.view[t+1]<<8,s|=this.view[t],s+=this.view[t+3]<<24>>>0,t+=4,n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0):(n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0,t+=4,s=this.view[t+1]<<16,s|=this.view[t+2]<<8,s|=this.view[t+3],s+=this.view[t]<<24>>>0);var r=new e(s,n,!1);return i&&(this.offset+=8),r},i.readLong=i.readInt64,i.writeUint64=function(t,i){var s=void 0===i;if(s&&(i=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),i+=8;var n=this.buffer.byteLength;i>n&&this.resize((n*=2)>i?n:i),i-=8;var r=t.low,o=t.high;return this.littleEndian?(this.view[i+3]=r>>>24&255,this.view[i+2]=r>>>16&255,this.view[i+1]=r>>>8&255,this.view[i]=255&r,i+=4,this.view[i+3]=o>>>24&255,this.view[i+2]=o>>>16&255,this.view[i+1]=o>>>8&255,this.view[i]=255&o):(this.view[i]=o>>>24&255,this.view[i+1]=o>>>16&255,this.view[i+2]=o>>>8&255,this.view[i+3]=255&o,i+=4,this.view[i]=r>>>24&255,this.view[i+1]=r>>>16&255,this.view[i+2]=r>>>8&255,this.view[i+3]=255&r),s&&(this.offset+=8),this},i.writeUInt64=i.writeUint64,i.readUint64=function(t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var s=0,n=0;this.littleEndian?(s=this.view[t+2]<<16,s|=this.view[t+1]<<8,s|=this.view[t],s+=this.view[t+3]<<24>>>0,t+=4,n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0):(n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0,t+=4,s=this.view[t+1]<<16,s|=this.view[t+2]<<8,s|=this.view[t+3],s+=this.view[t]<<24>>>0);var r=new e(s,n,!0);return i&&(this.offset+=8),r},i.readUInt64=i.readUint64),i.writeFloat32=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=4,l(this.view,e,t,this.littleEndian,23,4),i&&(this.offset+=4),this},i.writeFloat=i.writeFloat32,i.readFloat32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var i=a(this.view,e,this.littleEndian,23,4);return t&&(this.offset+=4),i},i.readFloat=i.readFloat32,i.writeFloat64=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=8;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=8,l(this.view,e,t,this.littleEndian,52,8),i&&(this.offset+=8),this},i.writeDouble=i.writeFloat64,i.readFloat64=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}var i=a(this.view,e,this.littleEndian,52,8);return t&&(this.offset+=8),i},i.readDouble=i.readFloat64,t.MAX_VARINT32_BYTES=5,t.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5},t.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},t.zigZagDecode32=function(e){return e>>>1^-(1&e)},i.writeVarint32=function(e,i){var s=void 0===i;if(s&&(i=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}var n,r=t.calculateVarint32(e);i+=r;var o=this.buffer.byteLength;for(i>o&&this.resize((o*=2)>i?o:i),i-=r,e>>>=0;e>=128;)n=127&e|128,this.view[i++]=n,e>>>=7;return this.view[i++]=e,s?(this.offset=i,this):r},i.writeVarint32ZigZag=function(e,i){return this.writeVarint32(t.zigZagEncode32(e),i)},i.readVarint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i,s=0,n=0;do{if(!this.noAssert&&e>this.limit){var r=Error("Truncated");throw r.truncated=!0,r}i=this.view[e++],s<5&&(n|=(127&i)<<7*s),++s}while(128&i);return n|=0,t?(this.offset=e,n):{value:n,length:s}},i.readVarint32ZigZag=function(e){var i=this.readVarint32(e);return"object"==typeof i?i.value=t.zigZagDecode32(i.value):i=t.zigZagDecode32(i),i},e&&(t.MAX_VARINT64_BYTES=10,t.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var i=t.toInt()>>>0,s=t.shiftRightUnsigned(28).toInt()>>>0,n=t.shiftRightUnsigned(56).toInt()>>>0;return 0==n?0==s?i<16384?i<128?1:2:i<1<<21?3:4:s<16384?s<128?5:6:s<1<<21?7:8:n<128?9:10},t.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},t.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},i.writeVarint64=function(i,s){var n=void 0===s;if(n&&(s=this.offset),!this.noAssert){if("number"==typeof i)i=e.fromNumber(i);else if("string"==typeof i)i=e.fromString(i);else if(!(i&&i instanceof e))throw TypeError("Illegal value: "+i+" (not an integer or Long)");if("number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+0) <= "+this.buffer.byteLength)}"number"==typeof i?i=e.fromNumber(i,!1):"string"==typeof i?i=e.fromString(i,!1):!1!==i.unsigned&&(i=i.toSigned());var r=t.calculateVarint64(i),o=i.toInt()>>>0,a=i.shiftRightUnsigned(28).toInt()>>>0,l=i.shiftRightUnsigned(56).toInt()>>>0;s+=r;var c=this.buffer.byteLength;switch(s>c&&this.resize((c*=2)>s?c:s),s-=r,r){case 10:this.view[s+9]=l>>>7&1;case 9:this.view[s+8]=9!==r?128|l:127&l;case 8:this.view[s+7]=8!==r?a>>>21|128:a>>>21&127;case 7:this.view[s+6]=7!==r?a>>>14|128:a>>>14&127;case 6:this.view[s+5]=6!==r?a>>>7|128:a>>>7&127;case 5:this.view[s+4]=5!==r?128|a:127&a;case 4:this.view[s+3]=4!==r?o>>>21|128:o>>>21&127;case 3:this.view[s+2]=3!==r?o>>>14|128:o>>>14&127;case 2:this.view[s+1]=2!==r?o>>>7|128:o>>>7&127;case 1:this.view[s]=1!==r?128|o:127&o}return n?(this.offset+=r,this):r},i.writeVarint64ZigZag=function(e,i){return this.writeVarint64(t.zigZagEncode64(e),i)},i.readVarint64=function(t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var s=t,n=0,r=0,o=0,a=0;if(n=127&(a=this.view[t++]),128&a&&(n|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(n|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(n|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(r=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(o=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(o|=(127&(a=this.view[t++]))<<7,128&a||this.noAssert&&void 0===a))))))))))throw Error("Buffer overrun");var l=e.fromBits(n|r<<28,r>>>4|o<<24,!1);return i?(this.offset=t,l):{value:l,length:t-s}},i.readVarint64ZigZag=function(i){var s=this.readVarint64(i);return s&&s.value instanceof e?s.value=t.zigZagDecode64(s.value):s=t.zigZagDecode64(s),s}),i.writeCString=function(e,t){var i=void 0===t;i&&(t=this.offset);var s,n=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(s=0;s<n;++s)if(0===e.charCodeAt(s))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}n=_.calculateUTF16asUTF8(r(e))[1],t+=n+1;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=n+1,_.encodeUTF16toUTF8(r(e),function(e){this.view[t++]=e}.bind(this)),this.view[t++]=0,i?(this.offset=t,this):n},i.readCString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i,s=e,n=-1;return _.decodeUTF8toUTF16(function(){if(0===n)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(n=this.view[e++])?null:n}.bind(this),i=o(),!0),t?(this.offset=e,i()):{string:i(),length:e-s}},i.writeIString=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var s,n=t;s=_.calculateUTF16asUTF8(r(e),this.noAssert)[1],t+=4+s;var o=this.buffer.byteLength;if(t>o&&this.resize((o*=2)>t?o:t),t-=4+s,this.littleEndian?(this.view[t+3]=s>>>24&255,this.view[t+2]=s>>>16&255,this.view[t+1]=s>>>8&255,this.view[t]=255&s):(this.view[t]=s>>>24&255,this.view[t+1]=s>>>16&255,this.view[t+2]=s>>>8&255,this.view[t+3]=255&s),t+=4,_.encodeUTF16toUTF8(r(e),function(e){this.view[t++]=e}.bind(this)),t!==n+4+s)throw RangeError("Illegal range: Truncated data, "+t+" == "+(t+4+s));return i?(this.offset=t,this):t-n},i.readIString=function(e){var i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var s=e,n=this.readUint32(e),r=this.readUTF8String(n,t.METRICS_BYTES,e+=4);return e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-s}},t.METRICS_CHARS="c",t.METRICS_BYTES="b",i.writeUTF8String=function(e,t){var i,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var n=t;i=_.calculateUTF16asUTF8(r(e))[1],t+=i;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=i,_.encodeUTF16toUTF8(r(e),function(e){this.view[t++]=e}.bind(this)),s?(this.offset=t,this):t-n},i.writeString=i.writeUTF8String,t.calculateUTF8Chars=function(e){return _.calculateUTF16asUTF8(r(e))[0]},t.calculateUTF8Bytes=function(e){return _.calculateUTF16asUTF8(r(e))[1]},t.calculateString=t.calculateUTF8Bytes,i.readUTF8String=function(e,i,s){"number"==typeof i&&(s=i,i=void 0);var n=void 0===s;if(n&&(s=this.offset),void 0===i&&(i=t.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+0) <= "+this.buffer.byteLength)}var r,a=0,l=s;if(i===t.METRICS_CHARS){if(r=o(),_.decodeUTF8(function(){return a<e&&s<this.limit?this.view[s++]:null}.bind(this),(function(e){++a,_.UTF8toUTF16(e,r)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return n?(this.offset=s,r()):{string:r(),length:s-l}}if(i===t.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+"+e+") <= "+this.buffer.byteLength)}var c=s+e;if(_.decodeUTF8toUTF16(function(){return s<c?this.view[s++]:null}.bind(this),r=o(),this.noAssert),s!==c)throw RangeError("Illegal range: Truncated data, "+s+" == "+c);return n?(this.offset=s,r()):{string:r(),length:s-l}}throw TypeError("Unsupported metrics: "+i)},i.readString=i.readUTF8String,i.writeVString=function(e,i){var s=void 0===i;if(s&&(i=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}var n,o,a=i;n=_.calculateUTF16asUTF8(r(e),this.noAssert)[1],o=t.calculateVarint32(n),i+=o+n;var l=this.buffer.byteLength;if(i>l&&this.resize((l*=2)>i?l:i),i-=o+n,i+=this.writeVarint32(n,i),_.encodeUTF16toUTF8(r(e),function(e){this.view[i++]=e}.bind(this)),i!==a+n+o)throw RangeError("Illegal range: Truncated data, "+i+" == "+(i+n+o));return s?(this.offset=i,this):i-a},i.readVString=function(e){var i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var s=e,n=this.readVarint32(e),r=this.readUTF8String(n.value,t.METRICS_BYTES,e+=n.length);return e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-s}},i.append=function(e,i,s){"number"!=typeof i&&"string"==typeof i||(s=i,i=void 0);var n=void 0===s;if(n&&(s=this.offset),!this.noAssert){if("number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,i));var r=e.limit-e.offset;if(r<=0)return this;s+=r;var o=this.buffer.byteLength;return s>o&&this.resize((o*=2)>s?o:s),s-=r,this.view.set(e.view.subarray(e.offset,e.limit),s),e.offset+=r,n&&(this.offset+=r),this},i.appendTo=function(e,t){return e.append(this,t),this},i.assert=function(e){return this.noAssert=!e,this},i.capacity=function(){return this.buffer.byteLength},i.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},i.clone=function(e){var i=new t(0,this.littleEndian,this.noAssert);return e?(i.buffer=new ArrayBuffer(this.buffer.byteLength),i.view=new Uint8Array(i.buffer)):(i.buffer=this.buffer,i.view=this.view),i.offset=this.offset,i.markedOffset=this.markedOffset,i.limit=this.limit,i},i.compact=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(0===e&&t===this.buffer.byteLength)return this;var i=t-e;if(0===i)return this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var n=new ArrayBuffer(i),r=new Uint8Array(n);return r.set(this.view.subarray(e,t)),this.buffer=n,this.view=r,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=i,this},i.copy=function(e,i){if(void 0===e&&(e=this.offset),void 0===i&&(i=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal end: Not an integer");if(i>>>=0,e<0||e>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+i+" <= "+this.buffer.byteLength)}if(e===i)return new t(0,this.littleEndian,this.noAssert);var s=i-e,n=new t(s,this.littleEndian,this.noAssert);return n.offset=0,n.limit=s,n.markedOffset>=0&&(n.markedOffset-=e),this.copyTo(n,0,e,i),n},i.copyTo=function(e,i,s,n){var r,o;if(!this.noAssert&&!t.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(i=(o=void 0===i)?e.offset:0|i,s=(r=void 0===s)?this.offset:0|s,n=void 0===n?this.limit:0|n,i<0||i>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+i+" <= "+e.buffer.byteLength);if(s<0||n>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+s+" <= "+this.buffer.byteLength);var a=n-s;return 0===a?e:(e.ensureCapacity(i+a),e.view.set(this.view.subarray(s,n),i),r&&(this.offset+=a),o&&(e.offset+=a),this)},i.ensureCapacity=function(e){var t=this.buffer.byteLength;return t<e?this.resize((t*=2)>e?t:e):this},i.fill=function(e,t,i){var s=void 0===t;if(s&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===i&&(i=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal end: Not an integer");if(i>>>=0,t<0||t>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+i+" <= "+this.buffer.byteLength)}if(t>=i)return this;for(;t<i;)this.view[t++]=e;return s&&(this.offset=t),this},i.flip=function(){return this.limit=this.offset,this.offset=0,this},i.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},i.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},i.LE=function(e){return this.littleEndian=void 0===e||!!e,this},i.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},i.prepend=function(e,i,s){"number"!=typeof i&&"string"==typeof i||(s=i,i=void 0);var n=void 0===s;if(n&&(s=this.offset),!this.noAssert){if("number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,i));var r=e.limit-e.offset;if(r<=0)return this;var o=r-s;if(o>0){var a=new ArrayBuffer(this.buffer.byteLength+o),l=new Uint8Array(a);l.set(this.view.subarray(s,this.buffer.byteLength),r),this.buffer=a,this.view=l,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,s+=o}else new Uint8Array(this.buffer);return this.view.set(e.view.subarray(e.offset,e.limit),s-r),e.offset=e.limit,n&&(this.offset-=r),this},i.prependTo=function(e,t){return e.prepend(this,t),this},i.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},i.remaining=function(){return this.limit-this.offset},i.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},i.resize=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}if(this.buffer.byteLength<e){var t=new ArrayBuffer(e),i=new Uint8Array(t);i.set(this.view),this.buffer=t,this.view=i}return this},i.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},i.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},i.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var i=this.clone();return i.offset=e,i.limit=t,i},i.toBuffer=function(e){var t=this.offset,i=this.limit;if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: Not an integer");if(t>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal limit: Not an integer");if(i>>>=0,t<0||t>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+i+" <= "+this.buffer.byteLength)}if(!e&&0===t&&i===this.buffer.byteLength)return this.buffer;if(t===i)return s;var n=new ArrayBuffer(i-t);return new Uint8Array(n).set(new Uint8Array(this.buffer).subarray(t,i),0),n},i.toArrayBuffer=i.toBuffer,i.toString=function(e,t,i){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(i=t=e="utf8"),e){case"utf8":return this.toUTF8(t,i);case"base64":return this.toBase64(t,i);case"hex":return this.toHex(t,i);case"binary":return this.toBinary(t,i);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}};var c=function(){for(var e={},t=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],i=[],s=0,n=t.length;s<n;++s)i[t[s]]=s;return e.encode=function(e,i){for(var s,n;null!==(s=e());)i(t[s>>2&63]),n=(3&s)<<4,null!==(s=e())?(i(t[63&((n|=s>>4&15)|s>>4&15)]),n=(15&s)<<2,null!==(s=e())?(i(t[63&(n|s>>6&3)]),i(t[63&s])):(i(t[63&n]),i(61))):(i(t[63&n]),i(61),i(61))},e.decode=function(e,t){var s,n,r;function o(e){throw Error("Illegal character code: "+e)}for(;null!==(s=e());)if(void 0===(n=i[s])&&o(s),null!==(s=e())&&(void 0===(r=i[s])&&o(s),t(n<<2>>>0|(48&r)>>4),null!==(s=e()))){if(void 0===(n=i[s])){if(61===s)break;o(s)}if(t((15&r)<<4>>>0|(60&n)>>2),null!==(s=e())){if(void 0===(r=i[s])){if(61===s)break;o(s)}t((3&n)<<6>>>0|r)}}},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)},e}();i.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var i;return c.encode(function(){return e<t?this.view[e++]:null}.bind(this),i=o()),i()},t.fromBase64=function(e,i){if("string"!=typeof e)throw TypeError("str");var s=new t(e.length/4*3,i),n=0;return c.decode(r(e),(function(e){s.view[n++]=e})),s.limit=n,s},t.btoa=function(e){return t.fromBinary(e).toBase64()},t.atob=function(e){return t.fromBase64(e).toBinary()},i.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var i=[],s=[];e<t;)i.push(this.view[e++]),i.length>=1024&&(s.push(String.fromCharCode.apply(String,i)),i=[]);return s.join("")+String.fromCharCode.apply(String,i)},t.fromBinary=function(e,i){if("string"!=typeof e)throw TypeError("str");for(var s,n=0,r=e.length,o=new t(r,i);n<r;){if((s=e.charCodeAt(n))>255)throw RangeError("illegal char code: "+s);o.view[n++]=s}return o.limit=r,o},i.toDebug=function(e){for(var t,i=-1,s=this.buffer.byteLength,n="",r="",o="";i<s;){if(-1!==i&&(n+=(t=this.view[i])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(r+=t>32&&t<127?String.fromCharCode(t):".")),++i,e&&i>0&&i%16==0&&i!==s){for(;n.length<51;)n+=" ";o+=n+r+"\n",n=r=""}i===this.offset&&i===this.limit?n+=i===this.markedOffset?"!":"|":i===this.offset?n+=i===this.markedOffset?"[":"<":i===this.limit?n+=i===this.markedOffset?"]":">":n+=i===this.markedOffset?"'":e||0!==i&&i!==s?" ":""}if(e&&" "!==n){for(;n.length<51;)n+=" ";o+=n+r+"\n"}return e?o:n},t.fromDebug=function(e,i,s){for(var n,r,o=e.length,a=new t((o+1)/3|0,i,s),l=0,c=0,_=!1,d=!1,u=!1,h=!1,g=!1;l<o;){switch(n=e.charAt(l++)){case"!":if(!s){if(d||u||h){g=!0;break}d=u=h=!0}a.offset=a.markedOffset=a.limit=c,_=!1;break;case"|":if(!s){if(d||h){g=!0;break}d=h=!0}a.offset=a.limit=c,_=!1;break;case"[":if(!s){if(d||u){g=!0;break}d=u=!0}a.offset=a.markedOffset=c,_=!1;break;case"<":if(!s){if(d){g=!0;break}d=!0}a.offset=c,_=!1;break;case"]":if(!s){if(h||u){g=!0;break}h=u=!0}a.limit=a.markedOffset=c,_=!1;break;case">":if(!s){if(h){g=!0;break}h=!0}a.limit=c,_=!1;break;case"'":if(!s){if(u){g=!0;break}u=!0}a.markedOffset=c,_=!1;break;case" ":_=!1;break;default:if(!s&&_){g=!0;break}if(r=parseInt(n+e.charAt(l++),16),!s&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[c++]=r,_=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+l)}if(!s){if(!d||!h)throw TypeError("Illegal str: Missing offset or limit");if(c<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+o)}return a},i.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var i,s=new Array(t-e);e<t;)(i=this.view[e++])<16?s.push("0",i.toString(16)):s.push(i.toString(16));return s.join("")},t.fromHex=function(e,i,s){if(!s){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(var n,r=e.length,o=new t(r/2|0,i),a=0,l=0;a<r;a+=2){if(n=parseInt(e.substring(a,a+2),16),!s&&(!isFinite(n)||n<0||n>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[l++]=n}return o.limit=l,o};var _=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var i=null;for("number"==typeof e&&(i=e,e=function(){return null});null!==i||null!==(i=e());)i<128?t(127&i):i<2048?(t(i>>6&31|192),t(63&i|128)):i<65536?(t(i>>12&15|224),t(i>>6&63|128),t(63&i|128)):(t(i>>18&7|240),t(i>>12&63|128),t(i>>6&63|128),t(63&i|128)),i=null},decodeUTF8:function(e,t){for(var i,s,n,r,o=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(i=e());)if(128&i)if(192==(224&i))null===(s=e())&&o([i,s]),t((31&i)<<6|63&s);else if(224==(240&i))(null===(s=e())||null===(n=e()))&&o([i,s,n]),t((15&i)<<12|(63&s)<<6|63&n);else{if(240!=(248&i))throw RangeError("Illegal starting byte: "+i);(null===(s=e())||null===(n=e())||null===(r=e()))&&o([i,s,n,r]),t((7&i)<<18|(63&s)<<12|(63&n)<<6|63&r)}else t(i)},UTF16toUTF8:function(e,t){for(var i,s=null;null!==(i=null!==s?s:e());)i>=55296&&i<=57343&&null!==(s=e())&&s>=56320&&s<=57343?(t(1024*(i-55296)+s-56320+65536),s=null):t(i);null!==s&&t(s)},UTF8toUTF16:function(e,t){var i=null;for("number"==typeof e&&(i=e,e=function(){return null});null!==i||null!==(i=e());)i<=65535?t(i):(t(55296+((i-=65536)>>10)),t(i%1024+56320)),i=null},encodeUTF16toUTF8:function(t,i){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,i)}))},decodeUTF8toUTF16:function(t,i){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,i)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,i=0;null!==(t=e());)i+=t<128?1:t<2048?2:t<65536?3:4;return i},calculateUTF16asUTF8:function(t){var i=0,s=0;return e.UTF16toUTF8(t,(function(e){++i,s+=e<128?1:e<2048?2:e<65536?3:4})),[i,s]}};return e}();return i.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var i;try{_.decodeUTF8toUTF16(function(){return e<t?this.view[e++]:null}.bind(this),i=o())}catch(i){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return i()},t.fromUTF8=function(e,i,s){if(!s&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var n=new t(_.calculateUTF16asUTF8(r(e),!0)[1],i,s),o=0;return _.encodeUTF16toUTF8(r(e),(function(e){n.view[o++]=e})),n.limit=o,n},t}(function(){function e(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function t(e){return!0===(e&&e.__isLong__)}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t;var i={},s={};function n(e,t){var n,r,a;return t?(a=0<=(e>>>=0)&&e<256)&&(r=s[e])?r:(n=o(e,(0|e)<0?-1:0,!0),a&&(s[e]=n),n):(a=-128<=(e|=0)&&e<128)&&(r=i[e])?r:(n=o(e,e<0?-1:0,!1),a&&(i[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?E:g;if(t){if(e<0)return E;if(e>=d)return A}else{if(e<=-u)return p;if(e+1>=u)return R}return e<0?r(-e,t).neg():o(e%_|0,e/_|0,t)}function o(t,i,s){return new e(t,i,s)}e.fromInt=n,e.fromNumber=r,e.fromBits=o;var a=Math.pow;function l(e,t,i){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(i=t,t=!1):t=!!t,(i=i||10)<2||36<i)throw RangeError("radix");var s;if((s=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===s)return l(e.substring(1),t,i).neg();for(var n=r(a(i,8)),o=g,c=0;c<e.length;c+=8){var _=Math.min(8,e.length-c),d=parseInt(e.substring(c,c+_),i);if(_<8){var u=r(a(i,_));o=o.mul(u).add(r(d))}else o=(o=o.mul(n)).add(r(d))}return o.unsigned=t,o}function c(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?l(t):o(t.low,t.high,t.unsigned)}e.fromString=l,e.fromValue=c;var _=4294967296,d=_*_,u=d/2,h=n(1<<24),g=n(0);e.ZERO=g;var E=n(0,!0);e.UZERO=E;var I=n(1);e.ONE=I;var T=n(1,!0);e.UONE=T;var f=n(-1);e.NEG_ONE=f;var R=o(-1,2147483647,!1);e.MAX_VALUE=R;var A=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=A;var p=o(0,-2147483648,!1);e.MIN_VALUE=p;var m=e.prototype;return m.toInt=function(){return this.unsigned?this.low>>>0:this.low},m.toNumber=function(){return this.unsigned?(this.high>>>0)*_+(this.low>>>0):this.high*_+(this.low>>>0)},m.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(p)){var t=r(e),i=this.div(t),s=i.mul(t).sub(this);return i.toString(e)+s.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=r(a(e,6),this.unsigned),o=this,l="";;){var c=o.div(n),_=(o.sub(c.mul(n)).toInt()>>>0).toString(e);if((o=c).isZero())return _+l;for(;_.length<6;)_="0"+_;l=""+_+l}},m.getHighBits=function(){return this.high},m.getHighBitsUnsigned=function(){return this.high>>>0},m.getLowBits=function(){return this.low},m.getLowBitsUnsigned=function(){return this.low>>>0},m.getNumBitsAbs=function(){if(this.isNegative())return this.eq(p)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},m.isZero=function(){return 0===this.high&&0===this.low},m.isNegative=function(){return!this.unsigned&&this.high<0},m.isPositive=function(){return this.unsigned||this.high>=0},m.isOdd=function(){return!(1&~this.low)},m.isEven=function(){return!(1&this.low)},m.equals=function(e){return t(e)||(e=c(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},m.eq=m.equals,m.notEquals=function(e){return!this.eq(e)},m.neq=m.notEquals,m.lessThan=function(e){return this.comp(e)<0},m.lt=m.lessThan,m.lessThanOrEqual=function(e){return this.comp(e)<=0},m.lte=m.lessThanOrEqual,m.greaterThan=function(e){return this.comp(e)>0},m.gt=m.greaterThan,m.greaterThanOrEqual=function(e){return this.comp(e)>=0},m.gte=m.greaterThanOrEqual,m.compare=function(e){if(t(e)||(e=c(e)),this.eq(e))return 0;var i=this.isNegative(),s=e.isNegative();return i&&!s?-1:!i&&s?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},m.comp=m.compare,m.negate=function(){return!this.unsigned&&this.eq(p)?p:this.not().add(I)},m.neg=m.negate,m.add=function(e){t(e)||(e=c(e));var i=this.high>>>16,s=65535&this.high,n=this.low>>>16,r=65535&this.low,a=e.high>>>16,l=65535&e.high,_=e.low>>>16,d=0,u=0,h=0,g=0;return h+=(g+=r+(65535&e.low))>>>16,u+=(h+=n+_)>>>16,d+=(u+=s+l)>>>16,d+=i+a,o((h&=65535)<<16|(g&=65535),(d&=65535)<<16|(u&=65535),this.unsigned)},m.subtract=function(e){return t(e)||(e=c(e)),this.add(e.neg())},m.sub=m.subtract,m.multiply=function(e){if(this.isZero())return g;if(t(e)||(e=c(e)),e.isZero())return g;if(this.eq(p))return e.isOdd()?p:g;if(e.eq(p))return this.isOdd()?p:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(h)&&e.lt(h))return r(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,s=65535&this.high,n=this.low>>>16,a=65535&this.low,l=e.high>>>16,_=65535&e.high,d=e.low>>>16,u=65535&e.low,E=0,I=0,T=0,f=0;return T+=(f+=a*u)>>>16,I+=(T+=n*u)>>>16,T&=65535,I+=(T+=a*d)>>>16,E+=(I+=s*u)>>>16,I&=65535,E+=(I+=n*d)>>>16,I&=65535,E+=(I+=a*_)>>>16,E+=i*u+s*d+n*_+a*l,o((T&=65535)<<16|(f&=65535),(E&=65535)<<16|(I&=65535),this.unsigned)},m.mul=m.multiply,m.divide=function(e){if(t(e)||(e=c(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?E:g;var i,s,n;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return E;if(e.gt(this.shru(1)))return T;n=E}else{if(this.eq(p))return e.eq(I)||e.eq(f)?p:e.eq(p)?I:(i=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?I:f:(s=this.sub(e.mul(i)),n=i.add(s.div(e)));if(e.eq(p))return this.unsigned?E:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=g}for(s=this;s.gte(e);){i=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(i)/Math.LN2),l=o<=48?1:a(2,o-48),_=r(i),d=_.mul(e);d.isNegative()||d.gt(s);)d=(_=r(i-=l,this.unsigned)).mul(e);_.isZero()&&(_=I),n=n.add(_),s=s.sub(d)}return n},m.div=m.divide,m.modulo=function(e){return t(e)||(e=c(e)),this.sub(this.div(e).mul(e))},m.mod=m.modulo,m.not=function(){return o(~this.low,~this.high,this.unsigned)},m.and=function(e){return t(e)||(e=c(e)),o(this.low&e.low,this.high&e.high,this.unsigned)},m.or=function(e){return t(e)||(e=c(e)),o(this.low|e.low,this.high|e.high,this.unsigned)},m.xor=function(e){return t(e)||(e=c(e)),o(this.low^e.low,this.high^e.high,this.unsigned)},m.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):o(0,this.low<<e-32,this.unsigned)},m.shl=m.shiftLeft,m.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):o(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},m.shr=m.shiftRight,m.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var i=this.high;return e<32?o(this.low>>>e|i<<32-e,i>>>e,this.unsigned):o(32===e?i:i>>>e-32,0,this.unsigned)},m.shru=m.shiftRightUnsigned,m.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},m.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},m.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},m.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},m.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e}());return t.ByteBuffer=i,t.Long=i.Long||null,t.VERSION="5.0.3",t.WIRE_TYPES={},t.WIRE_TYPES.VARINT=0,t.WIRE_TYPES.BITS64=1,t.WIRE_TYPES.LDELIM=2,t.WIRE_TYPES.STARTGROUP=3,t.WIRE_TYPES.ENDGROUP=4,t.WIRE_TYPES.BITS32=5,t.PACKABLE_WIRE_TYPES=[t.WIRE_TYPES.VARINT,t.WIRE_TYPES.BITS64,t.WIRE_TYPES.BITS32],t.TYPES={int32:{name:"int32",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:t.WIRE_TYPES.VARINT,defaultValue:t.Long?t.Long.ZERO:void 0},uint64:{name:"uint64",wireType:t.WIRE_TYPES.VARINT,defaultValue:t.Long?t.Long.UZERO:void 0},sint64:{name:"sint64",wireType:t.WIRE_TYPES.VARINT,defaultValue:t.Long?t.Long.ZERO:void 0},bool:{name:"bool",wireType:t.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:t.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:t.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:t.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:t.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:t.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:t.WIRE_TYPES.BITS64,defaultValue:t.Long?t.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:t.WIRE_TYPES.BITS64,defaultValue:t.Long?t.Long.ZERO:void 0},float:{name:"float",wireType:t.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:t.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:t.WIRE_TYPES.STARTGROUP,defaultValue:null}},t.MAP_KEY_TYPES=[t.TYPES.int32,t.TYPES.sint32,t.TYPES.sfixed32,t.TYPES.uint32,t.TYPES.fixed32,t.TYPES.int64,t.TYPES.sint64,t.TYPES.sfixed64,t.TYPES.uint64,t.TYPES.fixed64,t.TYPES.bool,t.TYPES.string,t.TYPES.bytes],t.ID_MIN=1,t.ID_MAX=536870911,t.convertFieldsToCamelCase=!1,t.populateAccessors=!0,t.populateDefaults=!0,t.Util=((e={}).IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e),t.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,FQTYPEREF:/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},t.DotProto=function(e,t){var i={},s=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},n=s.prototype;n._readString=function(){var e='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;e.lastIndex=this.index-1;var i=e.exec(this.source);if(!i)throw Error("unterminated string");return this.index=e.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,i[1]},n.next=function(){if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();var e,i,s;do{for(e=!1;t.WHITESPACE.test(s=this.source.charAt(this.index));)if("\n"===s&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(s=this.source.charAt(this.index)))return"/";do{if("\n"===s&&++this.line,++this.index===this.source.length)return null;i=s,s=this.source.charAt(this.index)}while("*"!==i||"/"!==s);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;var n=this.index;if(t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(n++)))for(;n<this.source.length&&!t.DELIM.test(this.source.charAt(n));)++n;var r=this.source.substring(this.index,this.index=n);return'"'!==r&&"'"!==r||(this._stringOpen=r),r},n.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},n.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},n.omit=function(e){return this.peek()===e&&(this.next(),!0)},n.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},i.Tokenizer=s;var r=function(e){this.tn=new s(e),this.proto3=!1},o=r.prototype;function a(e,i){var s=-1,n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))s=parseInt(e);else if(t.NUMBER_HEX.test(e))s=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(n<0?"-":"")+e);s=parseInt(e.substring(1),8)}if(s=n*s|0,!i&&s<0)throw Error("illegal id value: "+(n<0?"-":"")+e);return s}function l(e){var i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return i*parseInt(e,10);if(t.NUMBER_HEX.test(e))return i*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return i*parseInt(e.substring(1),8);if("inf"===e)return i*(1/0);if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return i*parseFloat(e);throw Error("illegal number value: "+(i<0?"-":"")+e)}function c(e,t,i){void 0===e[t]?e[t]=i:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(i))}return o.parse=function(){var e,i,s={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},n=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!n||null!==s.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),s.package=e;break;case"import":if(!n)throw Error("unexpected 'import'");("public"===(e=this.tn.peek())||(i="weak"===e))&&this.tn.next(),e=this._readString(),this.tn.skip(";"),i||s.imports.push(e);break;case"syntax":if(!n)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(s.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(s,null),n=!1;break;case"enum":this._parseEnum(s),n=!1;break;case"option":this._parseOption(s);break;case"service":this._parseService(s);break;case"extend":this._parseExtend(s);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete s.name,s},r.parse=function(e){return new r(e).parse()},o._readString=function(){var e,t,i="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);i+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return i},o._readValue=function(e){var i=this.tn.peek();if('"'===i||"'"===i)return this._readString();if(this.tn.next(),t.NUMBER.test(i))return l(i);if(t.BOOL.test(i))return"true"===i.toLowerCase();if(e&&t.TYPEREF.test(i))return i;throw Error("illegal value: "+i)},o._parseOption=function(e,i){var s=this.tn.next(),n=!1;if("("===s&&(n=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal option name: "+s);var r=s;n&&(this.tn.skip(")"),r="("+r+")",s=this.tn.peek(),t.FQTYPEREF.test(s)&&(r+=s,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),i||this.tn.skip(";")},o._parseOptionValue=function(e,i){var s=this.tn.peek();if("{"!==s)c(e.options,i,this._readValue(!0));else for(this.tn.skip("{");"}"!==(s=this.tn.next());){if(!t.NAME.test(s))throw Error("illegal option name: "+i+"."+s);this.tn.omit(":")?c(e.options,i+"."+s,this._readValue(!0)):this._parseOptionValue(e,i+"."+s)}},o._parseService=function(e){var i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal service name at line "+this.tn.line+": "+i);var s={name:i,rpc:{},options:{}};for(this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(s);else{if("rpc"!==i)throw Error("illegal service token: "+i);this._parseServiceRPC(s)}this.tn.omit(";"),e.services.push(s)},o._parseServiceRPC=function(e){var i="rpc",s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal rpc service method name: "+s);var n=s,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}};if(this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.request_stream=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal rpc service request type: "+s);if(r.request=s,this.tn.skip(")"),"returns"!==(s=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+s);if(this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.response_stream=!0,s=this.tn.next()),r.response=s,this.tn.skip(")"),"{"===(s=this.tn.peek())){for(this.tn.next();"}"!==(s=this.tn.next());){if("option"!==s)throw Error("illegal rpc service token: "+s);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},o._parseMessage=function(e,i){var s=!!i,n=this.tn.next(),r={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(n))throw Error("illegal "+(s?"group":"message")+" name: "+n);for(r.name=n,s&&(this.tn.skip("="),i.id=a(this.tn.next()),r.isGroup=!0),"["===(n=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(n=this.tn.next());)if(t.RULE.test(n))this._parseMessageField(r,n);else if("oneof"===n)this._parseMessageOneOf(r);else if("enum"===n)this._parseEnum(r);else if("message"===n)this._parseMessage(r);else if("option"===n)this._parseOption(r);else if("service"===n)this._parseService(r);else if("extensions"===n)r.hasOwnProperty("extensions")?r.extensions=r.extensions.concat(this._parseExtensionRanges()):r.extensions=this._parseExtensionRanges();else if("reserved"===n)this._parseIgnored();else if("extend"===n)this._parseExtend(r);else{if(!t.TYPEREF.test(n))throw Error("illegal message token: "+n);if(!this.proto3)throw Error("illegal field rule: "+n);this._parseMessageField(r,"optional",n)}return this.tn.omit(";"),e.messages.push(r),r},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,i,s){if(!t.RULE.test(i))throw Error("illegal message field rule: "+i);var n,r={rule:i,type:"",name:"",options:{},id:0};if("map"===i){if(s)throw Error("illegal type: "+s);if(this.tn.skip("<"),n=this.tn.next(),!t.TYPE.test(n)&&!t.TYPEREF.test(n))throw Error("illegal message field type: "+n);if(r.keytype=n,this.tn.skip(","),n=this.tn.next(),!t.TYPE.test(n)&&!t.TYPEREF.test(n))throw Error("illegal message field: "+n);if(r.type=n,this.tn.skip(">"),n=this.tn.next(),!t.NAME.test(n))throw Error("illegal message field name: "+n);r.name=n,this.tn.skip("="),r.id=a(this.tn.next()),"["===(n=this.tn.peek())&&this._parseFieldOptions(r),this.tn.skip(";")}else if("group"===(s=void 0!==s?s:this.tn.next())){var o=this._parseMessage(e,r);if(!/^[A-Z]/.test(o.name))throw Error("illegal group name: "+o.name);r.type=o.name,r.name=o.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(r.type=s,n=this.tn.next(),!t.NAME.test(n))throw Error("illegal message field name: "+n);r.name=n,this.tn.skip("="),r.id=a(this.tn.next()),"["===(n=this.tn.peek())&&this._parseFieldOptions(r),this.tn.skip(";")}return e.fields.push(r),r},o._parseMessageOneOf=function(e){var i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal oneof name: "+i);var s,n=i,r=[];for(this.tn.skip("{");"}"!==(i=this.tn.next());)(s=this._parseMessageField(e,"optional",i)).oneof=n,r.push(s.id);this.tn.omit(";"),e.oneofs[n]=r},o._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},o._parseEnum=function(e){var i={name:"",values:[],options:{}},s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal name: "+s);for(i.name=s,this.tn.skip("{");"}"!==(s=this.tn.next());)if("option"===s)this._parseOption(i);else{if(!t.NAME.test(s))throw Error("illegal name: "+s);this.tn.skip("=");var n={name:s,id:a(this.tn.next(),!0)};"["===(s=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(n)}this.tn.omit(";"),e.enums.push(i)},o._parseExtensionRanges=function(){var t,i,s,n=[];do{for(i=[];;){switch(t=this.tn.next()){case"min":s=e.ID_MIN;break;case"max":s=e.ID_MAX;break;default:s=l(t)}if(i.push(s),2===i.length)break;if("to"!==this.tn.peek()){i.push(s);break}this.tn.next()}n.push(i)}while(this.tn.omit(","));return this.tn.skip(";"),n},o._parseExtend=function(e){var i=this.tn.next();if(!t.TYPEREF.test(i))throw Error("illegal extend reference: "+i);var s={ref:i,fields:[]};for(this.tn.skip("{");"}"!==(i=this.tn.next());)if(t.RULE.test(i))this._parseMessageField(s,i);else{if(!t.TYPEREF.test(i))throw Error("illegal extend token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(s,"optional",i)}return this.tn.omit(";"),e.messages.push(s),s},o.toString=function(){return"Parser at line "+this.tn.line},i.Parser=r,i}(t,t.Lang),t.Reflect=function(e){var t={},s=function(e,t,i){this.builder=e,this.parent=t,this.name=i,this.className},n=s.prototype;n.fqn=function(){for(var e=this.name,t=this;;){if(null==(t=t.parent))break;e=t.name+"."+e}return e},n.toString=function(e){return(e?this.className+" ":"")+this.fqn()},n.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},t.T=s;var r=function(e,t,i,n,r){s.call(this,e,t,i),this.className="Namespace",this.children=[],this.options=n||{},this.syntax=r||"proto2"},o=r.prototype=Object.create(s.prototype);o.getChildren=function(e){if(null==(e=e||null))return this.children.slice();for(var t=[],i=0,s=this.children.length;i<s;++i)this.children[i]instanceof e&&t.push(this.children[i]);return t},o.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof _.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof _.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},o.getChild=function(e){for(var t="number"==typeof e?"id":"name",i=0,s=this.children.length;i<s;++i)if(this.children[i][t]===e)return this.children[i];return null},o.resolve=function(e,i){var s,n="string"==typeof e?e.split("."):e,r=this,o=0;if(""===n[o]){for(;null!==r.parent;)r=r.parent;o++}do{do{if(!(r instanceof t.Namespace)){r=null;break}if(!(s=r.getChild(n[o]))||!(s instanceof t.T)||i&&!(s instanceof t.Namespace)){r=null;break}r=s,o++}while(o<n.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(e,i)}while(null!=r);return r},o.qn=function(e){var i=[],s=e;do{i.unshift(s.name),s=s.parent}while(null!==s);for(var n=1;n<=i.length;n++){var r=i.slice(i.length-n);if(e===this.resolve(r,e instanceof t.Namespace))return r.join(".")}return e.fqn()},o.build=function(){for(var e,t={},i=this.children,s=0,n=i.length;s<n;++s)(e=i[s])instanceof r&&(t[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(t,"$options",{value:this.buildOpt()}),t},o.buildOpt=function(){for(var e={},t=Object.keys(this.options),i=0,s=t.length;i<s;++i){var n=t[i],r=this.options[t[i]];e[n]=r}return e},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},t.Namespace=r;var a=function(t,i,s,n,r){if(this.type=t,this.resolvedType=i,this.isMapKey=s,this.syntax=n,this.name=r,s&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},l=a.prototype;function c(t,i){if(t&&"number"==typeof t.low&&"number"==typeof t.high&&"boolean"==typeof t.unsigned&&t.low==t.low&&t.high==t.high)return new e.Long(t.low,t.high,void 0===i?t.unsigned:i);if("string"==typeof t)return e.Long.fromString(t,i||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,i||!1);throw Error("not convertible to Long")}a.defaultFieldValue=function(t){if("string"==typeof t&&(t=e.TYPES[t]),void 0===t.defaultValue)throw Error("default value for type "+t.name+" is not supported");return t==e.TYPES.bytes?new i(0):t.defaultValue},l.toString=function(){return(this.name||"")+(this.isMapKey?"map":"value")+" element"},l.verifyValue=function(t){var s=this;function n(e,t){throw Error("Illegal value for "+s.toString(!0)+" of type "+s.type.name+": "+e+" ("+t+")")}switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof t||t==t&&t%1!=0)&&n(typeof t,"not an integer"),t>4294967295?0|t:t;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof t||t==t&&t%1!=0)&&n(typeof t,"not an integer"),t<0?t>>>0:t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return c(t,!1)}catch(e){n(typeof t,e.message)}else n(typeof t,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return c(t,!0)}catch(e){n(typeof t,e.message)}else n(typeof t,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof t&&n(typeof t,"not a boolean"),t;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof t&&n(typeof t,"not a number"),t;case e.TYPES.string:return"string"==typeof t||t&&t instanceof String||n(typeof t,"not a string"),""+t;case e.TYPES.bytes:return i.isByteBuffer(t)?t:i.wrap(t,"base64");case e.TYPES.enum:var r=this.resolvedType.getChildren(e.Reflect.Enum.Value);for(a=0;a<r.length;a++){if(r[a].name==t)return r[a].id;if(r[a].id==t)return r[a].id}if("proto3"===this.syntax)return("number"!=typeof t||t==t&&t%1!=0)&&n(typeof t,"not an integer"),(t>4294967295||t<0)&&n(typeof t,"not in range for uint32"),t;n(t,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(t&&"object"==typeof t||n(typeof t,"object expected"),t instanceof this.resolvedType.clazz)return t;if(t instanceof e.Builder.Message){var o={};for(var a in t)t.hasOwnProperty(a)&&(o[a]=t[a]);t=o}return new this.resolvedType.clazz(t)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+t+" (undefined type "+this.type+")")},l.calculateLength=function(t,s){if(null===s)return 0;var n;switch(this.type){case e.TYPES.int32:return s<0?i.calculateVarint64(s):i.calculateVarint32(s);case e.TYPES.uint32:return i.calculateVarint32(s);case e.TYPES.sint32:return i.calculateVarint32(i.zigZagEncode32(s));case e.TYPES.fixed32:case e.TYPES.sfixed32:case e.TYPES.float:return 4;case e.TYPES.int64:case e.TYPES.uint64:return i.calculateVarint64(s);case e.TYPES.sint64:return i.calculateVarint64(i.zigZagEncode64(s));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return i.calculateVarint32(s);case e.TYPES.double:return 8;case e.TYPES.string:return n=i.calculateUTF8Bytes(s),i.calculateVarint32(n)+n;case e.TYPES.bytes:if(s.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+s.remaining()+" bytes remaining");return i.calculateVarint32(s.remaining())+s.remaining();case e.TYPES.message:return n=this.resolvedType.calculate(s),i.calculateVarint32(n)+n;case e.TYPES.group:return(n=this.resolvedType.calculate(s))+i.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+s+" (unknown type)")},l.encodeValue=function(t,s,n){if(null===s)return n;switch(this.type){case e.TYPES.int32:s<0?n.writeVarint64(s):n.writeVarint32(s);break;case e.TYPES.uint32:n.writeVarint32(s);break;case e.TYPES.sint32:n.writeVarint32ZigZag(s);break;case e.TYPES.fixed32:n.writeUint32(s);break;case e.TYPES.sfixed32:n.writeInt32(s);break;case e.TYPES.int64:case e.TYPES.uint64:n.writeVarint64(s);break;case e.TYPES.sint64:n.writeVarint64ZigZag(s);break;case e.TYPES.fixed64:n.writeUint64(s);break;case e.TYPES.sfixed64:n.writeInt64(s);break;case e.TYPES.bool:"string"==typeof s?n.writeVarint32("false"===s.toLowerCase()?0:!!s):n.writeVarint32(s?1:0);break;case e.TYPES.enum:n.writeVarint32(s);break;case e.TYPES.float:n.writeFloat32(s);break;case e.TYPES.double:n.writeFloat64(s);break;case e.TYPES.string:n.writeVString(s);break;case e.TYPES.bytes:if(s.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+s.remaining()+" bytes remaining");var r=s.offset;n.writeVarint32(s.remaining()),n.append(s),s.offset=r;break;case e.TYPES.message:var o=(new i).LE();this.resolvedType.encode(s,o),n.writeVarint32(o.offset),n.append(o.flip());break;case e.TYPES.group:this.resolvedType.encode(s,n),n.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+s+" (unknown type)")}return n},l.decode=function(t,i,s){if(i!=this.type.wireType)throw Error("Unexpected wire type for element");var n,r;switch(this.type){case e.TYPES.int32:return 0|t.readVarint32();case e.TYPES.uint32:return t.readVarint32()>>>0;case e.TYPES.sint32:return 0|t.readVarint32ZigZag();case e.TYPES.fixed32:return t.readUint32()>>>0;case e.TYPES.sfixed32:return 0|t.readInt32();case e.TYPES.int64:return t.readVarint64();case e.TYPES.uint64:return t.readVarint64().toUnsigned();case e.TYPES.sint64:return t.readVarint64ZigZag();case e.TYPES.fixed64:return t.readUint64();case e.TYPES.sfixed64:return t.readInt64();case e.TYPES.bool:return!!t.readVarint32();case e.TYPES.enum:return t.readVarint32();case e.TYPES.float:return t.readFloat();case e.TYPES.double:return t.readDouble();case e.TYPES.string:return t.readVString();case e.TYPES.bytes:if(r=t.readVarint32(),t.remaining()<r)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+r+" required but got only "+t.remaining());return(n=t.clone()).limit=n.offset+r,t.offset+=r,n;case e.TYPES.message:return r=t.readVarint32(),this.resolvedType.decode(t,r);case e.TYPES.group:return this.resolvedType.decode(t,-1,s)}throw Error("[INTERNAL] Illegal decode type")},l.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return i.fromBinary(t)}},l.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},t.Element=a;var _=function(e,t,i,s,n,o){r.call(this,e,t,i,s,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!n,this._fields=null,this._fieldsById=null,this._fieldsByName=null},d=_.prototype=Object.create(r.prototype);function u(t,i){var s=i.readVarint32(),n=7&s,r=s>>>3;switch(n){case e.WIRE_TYPES.VARINT:do{s=i.readUint8()}while(!(128&~s));break;case e.WIRE_TYPES.BITS64:i.offset+=8;break;case e.WIRE_TYPES.LDELIM:s=i.readVarint32(),i.offset+=s;break;case e.WIRE_TYPES.STARTGROUP:u(r,i);break;case e.WIRE_TYPES.ENDGROUP:if(r===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+r+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:i.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+n)}return!0}d.build=function(t){if(this.clazz&&!t)return this.clazz;var s=function(e,t){var s=t.getChildren(e.Reflect.Message.Field),n=t.getChildren(e.Reflect.Message.OneOf),r=function(o,a){e.Builder.Message.call(this);for(var l=0,c=n.length;l<c;++l)this[n[l].name]=null;for(l=0,c=s.length;l<c;++l){var _=s[l];this[_.name]=_.repeated?[]:_.map?new e.Map(_):null,!_.required&&"proto3"!==t.syntax||null===_.defaultValue||(this[_.name]=_.defaultValue)}var d;if(arguments.length>0)if(1!==arguments.length||null===o||"object"!=typeof o||!("function"!=typeof o.encode||o instanceof r)||Array.isArray(o)||o instanceof e.Map||i.isByteBuffer(o)||o instanceof ArrayBuffer||e.Long&&o instanceof e.Long)for(l=0,c=arguments.length;l<c;++l)void 0!==(d=arguments[l])&&this.$set(s[l].name,d);else this.$set(o)},o=r.prototype=Object.create(e.Builder.Message.prototype);o.add=function(i,s,n){var r=t._fieldsByName[i];if(!n){if(!r)throw Error(this+"#"+i+" is undefined");if(!(r instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: "+r.toString(!0));if(!r.repeated)throw Error(this+"#"+i+" is not a repeated field");s=r.verifyValue(s,!0)}return null===this[i]&&(this[i]=[]),this[i].push(s),this},o.$add=o.add,o.set=function(i,s,n){if(i&&"object"==typeof i){for(var r in n=s,i)i.hasOwnProperty(r)&&void 0!==(s=i[r])&&void 0===t._oneofsByName[r]&&this.$set(r,s,n);return this}var o=t._fieldsByName[i];if(n)this[i]=s;else{if(!o)throw Error(this+"#"+i+" is not a field: undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: "+o.toString(!0));this[o.name]=s=o.verifyValue(s)}if(o&&o.oneof){var a=this[o.oneof.name];null!==s?(null!==a&&a!==o.name&&(this[a]=null),this[o.oneof.name]=o.name):a===i&&(this[o.oneof.name]=null)}return this},o.$set=o.set,o.get=function(i,s){if(s)return this[i];var n=t._fieldsByName[i];if(!(n&&n instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: undefined");if(!(n instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: "+n.toString(!0));return this[n.name]},o.$get=o.get;for(var a=0;a<s.length;a++){var l=s[a];l instanceof e.Reflect.Message.ExtensionField||t.builder.options.populateAccessors&&function(e){var i=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));i=i.substring(0,1).toUpperCase()+i.substring(1);var s=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),n=function(t,i){return this[e.name]=i?t:e.verifyValue(t),this},r=function(){return this[e.name]};null===t.getChild("set"+i)&&(o["set"+i]=n),null===t.getChild("set_"+s)&&(o["set_"+s]=n),null===t.getChild("get"+i)&&(o["get"+i]=r),null===t.getChild("get_"+s)&&(o["get_"+s]=r)}(l)}function c(t,s,n,r){if(null===t||"object"!=typeof t){if(r&&r instanceof e.Reflect.Enum){var o=e.Reflect.Enum.getName(r.object,t);if(null!==o)return o}return t}if(i.isByteBuffer(t))return s?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return n?t.toString():e.Long.fromValue(t);var a;if(Array.isArray(t))return a=[],t.forEach((function(e,t){a[t]=c(e,s,n,r)})),a;if(a={},t instanceof e.Map){for(var l=t.entries(),_=l.next();!_.done;_=l.next())a[t.keyElem.valueToString(_.value[0])]=c(_.value[1],s,n,t.valueElem.resolvedType);return a}var d=t.$type,u=void 0;for(var h in t)t.hasOwnProperty(h)&&(d&&(u=d.getChild(h))?a[h]=c(t[h],s,n,u.resolvedType):a[h]=c(t[h],s,n));return a}return o.encode=function(e,s){"boolean"==typeof e&&(s=e,e=void 0);var n=!1;e||(e=new i,n=!0);var r=e.littleEndian;try{return t.encode(this,e.LE(),s),(n?e.flip():e).LE(r)}catch(t){throw e.LE(r),t}},r.encode=function(e,t,i){return new r(e).encode(t,i)},o.calculate=function(){return t.calculate(this)},o.encodeDelimited=function(e,s){var n=!1;e||(e=new i,n=!0);var r=(new i).LE();return t.encode(this,r,s).flip(),e.writeVarint32(r.remaining()),e.append(r),n?e.flip():e},o.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},o.toArrayBuffer=o.encodeAB,o.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},o.toBuffer=o.encodeNB,o.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},o.toBase64=o.encode64,o.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},o.toHex=o.encodeHex,o.toRaw=function(e,t){return c(this,!!e,!!t,this.$type)},o.encodeJSON=function(){return JSON.stringify(c(this,!0,!0,this.$type))},r.decode=function(e,s,n){"string"==typeof s&&(n=s,s=-1),"string"==typeof e?e=i.wrap(e,n||"base64"):i.isByteBuffer(e)||(e=i.wrap(e));var r=e.littleEndian;try{var o=t.decode(e.LE(),s);return e.LE(r),o}catch(t){throw e.LE(r),t}},r.decodeDelimited=function(e,s){if("string"==typeof e?e=i.wrap(e,s||"base64"):i.isByteBuffer(e)||(e=i.wrap(e)),e.remaining()<1)return null;var n=e.offset,r=e.readVarint32();if(e.remaining()<r)return e.offset=n,null;try{var o=t.decode(e.slice(e.offset,e.offset+r).LE());return e.offset+=r,o}catch(t){throw e.offset+=r,t}},r.decode64=function(e){return r.decode(e,"base64")},r.decodeHex=function(e){return r.decode(e,"hex")},r.decodeJSON=function(e){return new r(JSON.parse(e))},o.toString=function(){return t.toString()},Object.defineProperty&&(Object.defineProperty(r,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),r}(e,this);this._fields=[],this._fieldsById={},this._fieldsByName={},this._oneofsByName={};for(var n,r=0,o=this.children.length;r<o;r++)if((n=this.children[r])instanceof I||n instanceof _||n instanceof R){if(s.hasOwnProperty(n.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+n.toString(!0)+" cannot override static property '"+n.name+"'");s[n.name]=n.build()}else if(n instanceof _.Field)n.build(),this._fields.push(n),this._fieldsById[n.id]=n,this._fieldsByName[n.name]=n;else if(n instanceof _.OneOf)this._oneofsByName[n.name]=n;else if(!(n instanceof _.OneOf||n instanceof f))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[r].toString(!0));return this.clazz=s},d.encode=function(e,t,i){for(var s,n,r=null,o=0,a=this._fields.length;o<a;++o)n=e[(s=this._fields[o]).name],s.required&&null===n?null===r&&(r=s):s.encode(i?n:s.verifyValue(n),t,e);if(null!==r){var l=Error("Missing at least one required field for "+this.toString(!0)+": "+r);throw l.encoded=t,l}return t},d.calculate=function(e){for(var t,i,s=0,n=0,r=this._fields.length;n<r;++n){if(i=e[(t=this._fields[n]).name],t.required&&null===i)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);s+=t.calculate(i,e)}return s},d.decode=function(t,i,s){"number"!=typeof i&&(i=-1);for(var n,r,o,a,l=t.offset,c=new this.clazz;t.offset<l+i||-1===i&&t.remaining()>0;){if(o=(n=t.readVarint32())>>>3,(r=7&n)===e.WIRE_TYPES.ENDGROUP){if(o!==s)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+o+" ("+(s?s+" expected":"not a group")+")");break}if(a=this._fieldsById[o]){if(a.repeated&&!a.options.packed)c[a.name].push(a.decode(r,t));else if(a.map){var _=a.decode(r,t);c[a.name].set(_[0],_[1])}else if(c[a.name]=a.decode(r,t),a.oneof){var d=c[a.oneof.name];null!==d&&d!==a.name&&(c[d]=null),c[a.oneof.name]=a.name}}else switch(r){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM:var h=t.readVarint32();t.offset+=h;break;case e.WIRE_TYPES.STARTGROUP:for(;u(o,t););break;default:throw Error("Illegal wire type for unknown field "+o+" in "+this.toString(!0)+"#decode: "+r)}}for(var g=0,E=this._fields.length;g<E;++g)if(null===c[(a=this._fields[g]).name])if("proto3"===this.syntax)c[a.name]=a.defaultValue;else{if(a.required){var I=Error("Missing at least one required field for "+this.toString(!0)+": "+a.name);throw I.decoded=c,I}e.populateDefaults&&null!==a.defaultValue&&(c[a.name]=a.defaultValue)}return c},t.Message=_;var h=function(t,i,n,r,o,a,l,c,d,u){s.call(this,t,i,a),this.className="Message.Field",this.required="required"===n,this.repeated="repeated"===n,this.map="map"===n,this.keyType=r||null,this.type=o,this.resolvedType=null,this.id=l,this.options=c||{},this.defaultValue=null,this.oneof=d||null,this.syntax=u||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof _.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},g=h.prototype=Object.create(s.prototype);g.build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax,this.name),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax,this.name)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},g.verifyValue=function(t,i){i=i||!1;var s,n=this;function r(e,t){throw Error("Illegal value for "+n.toString(!0)+" of type "+n.type.name+": "+e+" ("+t+")")}if(null===t)return this.required&&r(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&r(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!i){Array.isArray(t)||(t=[t]);var o=[];for(s=0;s<t.length;s++)o.push(this.element.verifyValue(t[s]));return o}return this.map&&!i?t instanceof e.Map?t:(t instanceof Object||r(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&r(typeof t,"no array expected"),this.element.verifyValue(t))},g.hasWirePresence=function(t,i){if("proto3"!==this.syntax)return null!==t;if(this.oneof&&i[this.oneof.name]===this.name)return!0;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return 0!==t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return 0!==t.low||0!==t.high;case e.TYPES.bool:return t;case e.TYPES.float:case e.TYPES.double:return 0!==t;case e.TYPES.string:return t.length>0;case e.TYPES.bytes:return t.remaining()>0;case e.TYPES.enum:return 0!==t;case e.TYPES.message:return null!==t;default:return!0}},g.encode=function(t,s,n){if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return s;try{var r;if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){s.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s.ensureCapacity(s.offset+=1);var o=s.offset;for(r=0;r<t.length;r++)this.element.encodeValue(this.id,t[r],s);var a=s.offset-o,l=i.calculateVarint32(a);if(l>1){var c=s.slice(o,s.offset);o+=l-1,s.offset=o,s.append(c)}s.writeVarint32(a,o-l)}else for(r=0;r<t.length;r++)s.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[r],s);else this.map?t.forEach((function(t,n,r){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);s.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s.writeVarint32(o),s.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,n,s),s.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,s)}),this):this.hasWirePresence(t,n)&&(s.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,s))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return s},g.calculate=function(t,s){if(t=this.verifyValue(t),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;var n=0;try{var r,o;if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),o=0,r=0;r<t.length;r++)o+=this.element.calculateLength(this.id,t[r]);n+=i.calculateVarint32(o),n+=o}else for(r=0;r<t.length;r++)n+=i.calculateVarint32(this.id<<3|this.type.wireType),n+=this.element.calculateLength(this.id,t[r]);else this.map?t.forEach((function(t,s,r){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,s)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n+=i.calculateVarint32(o),n+=o}),this):this.hasWirePresence(t,s)&&(n+=i.calculateVarint32(this.id<<3|this.type.wireType),n+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},g.decode=function(t,i,s){var n,r;if(!(!this.map&&t==this.type.wireType||!s&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!s){r=i.readVarint32(),r=i.offset+r;for(var o=[];i.offset<r;)o.push(this.decode(this.type.wireType,i,!0));return o}if(this.map){var l=a.defaultFieldValue(this.keyType);if(n=a.defaultFieldValue(this.type),r=i.readVarint32(),i.remaining()<r)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+r+" required but got only "+i.remaining());var c=i.clone();for(c.limit=c.offset+r,i.offset+=r;c.remaining()>0;){var _=c.readVarint32();t=7&_;var d=_>>>3;if(1===d)l=this.keyElement.decode(c,t,d);else{if(2!==d)throw Error("Unexpected tag in map field key/value submessage");n=this.element.decode(c,t,d)}}return[l,n]}return this.element.decode(i,t,this.id)},t.Message.Field=h;var E=function(e,t,i,s,n,r,o){h.call(this,e,t,i,null,s,n,r,o),this.extension};E.prototype=Object.create(h.prototype),t.Message.ExtensionField=E;t.Message.OneOf=function(e,t,i){s.call(this,e,t,i),this.fields=[]};var I=function(e,t,i,s,n){r.call(this,e,t,i,s,n),this.className="Enum",this.object=null};I.getName=function(e,t){for(var i,s=Object.keys(e),n=0;n<s.length;++n)if(e[i=s[n]]===t)return i;return null},(I.prototype=Object.create(r.prototype)).build=function(t){if(this.object&&!t)return this.object;for(var i=new e.Builder.Enum,s=this.getChildren(I.Value),n=0,r=s.length;n<r;++n)i[s[n].name]=s[n].id;return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=i},t.Enum=I;var T=function(e,t,i,n){s.call(this,e,t,i),this.className="Enum.Value",this.id=n};T.prototype=Object.create(s.prototype),t.Enum.Value=T;var f=function(e,t,i,n){s.call(this,e,t,i),this.field=n};f.prototype=Object.create(s.prototype),t.Extension=f;var R=function(e,t,i,s){r.call(this,e,t,i,s),this.className="Service",this.clazz=null};(R.prototype=Object.create(r.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){for(var s=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,i){setTimeout(i.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},n=s.prototype=Object.create(e.Builder.Service.prototype),r=t.getChildren(e.Reflect.Service.RPCMethod),o=0;o<r.length;o++)!function(e){n[e.name]=function(s,n){try{try{s=e.resolvedRequestType.clazz.decode(i.wrap(s))}catch(e){if(!(e instanceof TypeError))throw e}if(null===s||"object"!=typeof s)throw Error("Illegal arguments");s instanceof e.resolvedRequestType.clazz||(s=new e.resolvedRequestType.clazz(s)),this.rpcImpl(e.fqn(),s,(function(i,s){if(i)n(i);else{null===s&&(s="");try{s=e.resolvedResponseType.clazz.decode(s)}catch(e){}s&&s instanceof e.resolvedResponseType.clazz?n(null,s):n(Error("Illegal response type received in service method "+t.name+"#"+e.name))}}))}catch(e){setTimeout(n.bind(this,e),0)}},s[e.name]=function(t,i,n){new s(t)[e.name](i,n)},Object.defineProperty&&(Object.defineProperty(s[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(n[e.name],"$options",{value:s[e.name].$options}))}(r[o]);return Object.defineProperty&&(Object.defineProperty(s,"$options",{value:t.buildOpt()}),Object.defineProperty(n,"$options",{value:s.$options}),Object.defineProperty(s,"$type",{value:t}),Object.defineProperty(n,"$type",{value:t})),s}(e,this)},t.Service=R;var A=function(e,t,i,n){s.call(this,e,t,i),this.className="Service.Method",this.options=n||{}};(A.prototype=Object.create(s.prototype)).buildOpt=o.buildOpt,t.Service.Method=A;var p=function(e,t,i,s,n,r,o,a){A.call(this,e,t,i,a),this.className="Service.RPCMethod",this.requestName=s,this.responseName=n,this.requestStream=r,this.responseStream=o,this.resolvedRequestType=null,this.resolvedResponseType=null};return p.prototype=Object.create(A.prototype),t.Service.RPCMethod=p,t}(t),t.Builder=function(e,t,i){var s=function(e){this.ns=new i.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},n=s.prototype;function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}return s.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},s.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},s.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},s.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},s.isExtend=function(e){return"string"==typeof e.ref},n.reset=function(){return this.ptr=this.ns,this},n.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new i.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},n.create=function(t){if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(var n=[t];n.length>0;){if(t=n.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){var r=t.shift();if(s.isMessage(r)){var o=new i.Message(this,this.ptr,r.name,r.options,r.isGroup,r.syntax),a={};r.oneofs&&Object.keys(r.oneofs).forEach((function(e){o.addChild(a[e]=new i.Message.OneOf(this,o,e))}),this),r.fields&&r.fields.forEach((function(e){if(null!==o.getChild(0|e.id))throw Error("duplicate or invalid field id in "+o.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+o.name+"#"+e.name+": "+e.oneof);e=new i.Message.Field(this,o,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,r.syntax),t&&t.fields.push(e),o.addChild(e)}),this);var l=[];if(r.enums&&r.enums.forEach((function(e){l.push(e)})),r.messages&&r.messages.forEach((function(e){l.push(e)})),r.services&&r.services.forEach((function(e){l.push(e)})),r.extensions&&("number"==typeof r.extensions[0]?o.extensions=[r.extensions]:o.extensions=r.extensions),this.ptr.addChild(o),l.length>0){n.push(t),t=l,l=null,this.ptr=o,o=null;continue}l=null}else if(s.isEnum(r))o=new i.Enum(this,this.ptr,r.name,r.options,r.syntax),r.values.forEach((function(e){o.addChild(new i.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(s.isService(r))o=new i.Service(this,this.ptr,r.name,r.options),Object.keys(r.rpc).forEach((function(e){var t=r.rpc[e];o.addChild(new i.Service.RPCMethod(this,o,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(o);else{if(!s.isExtend(r))throw Error("not a valid definition: "+JSON.stringify(r));if(o=this.ptr.resolve(r.ref,!0))r.fields.forEach((function(t){if(null!==o.getChild(0|t.id))throw Error("duplicate extended field id in "+o.name+": "+t.id);if(o.extensions){var s=!1;if(o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(s=!0)})),!s)throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)")}var n=t.name;this.options.convertFieldsToCamelCase&&(n=e.Util.toCamelCase(n));var r=new i.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+n,t.id,t.options),a=new i.Extension(this,this.ptr,t.name,r);r.extension=a,this.ptr.addChild(a),o.addChild(r)}),this);else if(!/\.?google\.protobuf\./.test(r.ref))throw Error("extended message "+r.ref+" is not defined")}r=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},n.import=function(t,i){var s="/";if("string"==typeof i){if(e.Util.IS_NODE&&(i=require("path").resolve(i)),!0===this.files[i])return this.reset();this.files[i]=!0}else if("object"==typeof i){var n,o=i.root;if(e.Util.IS_NODE&&(o=require("path").resolve(o)),(o.indexOf("\\")>=0||i.file.indexOf("\\")>=0)&&(s="\\"),n=e.Util.IS_NODE?require("path").join(o,i.file):o+s+i.file,!0===this.files[n])return this.reset();this.files[n]=!0}if(t.imports&&t.imports.length>0){var a,l=!1;"object"==typeof i?(this.importRoot=i.root,l=!0,a=this.importRoot,i=i.file,(a.indexOf("\\")>=0||i.indexOf("\\")>=0)&&(s="\\")):"string"==typeof i?this.importRoot?a=this.importRoot:i.indexOf("/")>=0?""===(a=i.replace(/\/[^\/]*$/,""))&&(a="/"):i.indexOf("\\")>=0?(a=i.replace(/\\[^\\]*$/,""),s="\\"):a=".":a=null;for(var c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!a)throw Error("cannot determine import root");var _=t.imports[c];if("google/protobuf/descriptor.proto"===_)continue;if(_=e.Util.IS_NODE?require("path").join(a,_):a+s+_,!0===this.files[_])continue;/\.proto$/i.test(_)&&!e.DotProto&&(_=_.replace(/\.proto$/,".json"));var d=e.Util.fetch(_);if(null===d)throw Error("failed to import '"+_+"' in '"+i+"': file not found");/\.json$/i.test(_)?this.import(JSON.parse(d+""),_):this.import(e.DotProto.Parser.parse(d),_)}else i?/\.(\w+)$/.test(i)?this.import(t.imports[c],i.replace(/^(.+)\.(\w+)$/,(function(e,t,i){return t+"_import"+c+"."+i}))):this.import(t.imports[c],i+"_import"+c):this.import(t.imports[c]);l&&(this.importRoot=null)}t.package&&this.define(t.package),t.syntax&&r(t);var u=this.ptr;return t.options&&Object.keys(t.options).forEach((function(e){u.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=u),t.enums&&(this.create(t.enums),this.ptr=u),t.services&&(this.create(t.services),this.ptr=u),t.extends&&this.create(t.extends),this.reset()},n.resolveAll=function(){var s;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof i.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof i.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(s=(this.ptr instanceof i.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=s,s instanceof i.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==s.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(s instanceof i.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=s.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}"proto3"===this.ptr.syntax&&this.ptr.repeated&&void 0===this.ptr.options.packed&&-1!==e.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType)&&(this.ptr.options.packed=!0)}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((s=this.ptr.parent.resolve(this.ptr.requestName,!0))&&s instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=s,!((s=this.ptr.parent.resolve(this.ptr.responseName,!0))&&s instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=s}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},n.build=function(e){if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(var t="string"==typeof e?e.split("."):e,i=this.result,s=0;s<t.length;s++){if(!i[t[s]]){i=null;break}i=i[t[s]]}return i},n.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},n.toString=function(){return"Builder"},s.Message=function(){},s.Enum=function(){},s.Service=function(){},s}(t,t.Lang,t.Reflect),t.Map=function(e,t){var i=function(e,i){if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),i)for(var s=Object.keys(i),n=0;n<s.length;n++){var r=this.keyElem.valueFromString(s[n]),o=this.valueElem.verifyValue(i[s[n]]);this.map[this.keyElem.valueToString(r)]={key:r,value:o}}},s=i.prototype;function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}return s.clear=function(){this.map={}},s.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),i=t in this.map;return delete this.map[t],i},s.entries=function(){for(var e,t=[],i=Object.keys(this.map),s=0;s<i.length;s++)t.push([(e=this.map[i[s]]).key,e.value]);return n(t)},s.keys=function(){for(var e=[],t=Object.keys(this.map),i=0;i<t.length;i++)e.push(this.map[t[i]].key);return n(e)},s.values=function(){for(var e=[],t=Object.keys(this.map),i=0;i<t.length;i++)e.push(this.map[t[i]].value);return n(e)},s.forEach=function(e,t){for(var i,s=Object.keys(this.map),n=0;n<s.length;n++)e.call(t,(i=this.map[s[n]]).value,i.key,this)},s.set=function(e,t){var i=this.keyElem.verifyValue(e),s=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(i)]={key:i,value:s},this},s.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));if(t in this.map)return this.map[t].value},s.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},i}(0,t.Reflect),t.loadProto=function(e,i,s){return("string"==typeof i||i&&"string"==typeof i.file&&"string"==typeof i.root)&&(s=i,i=void 0),t.loadJson(t.DotProto.Parser.parse(e),i,s)},t.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=t.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=t.populateAccessors),new t.Builder(e)},t.loadJson=function(e,i,s){return("string"==typeof i||i&&"string"==typeof i.file&&"string"==typeof i.root)&&(s=i,i=null),i&&"object"==typeof i||(i=t.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),i.import(e,s),i.resolveAll(),i},t}(),To="NotifyMsg",fo="SyncRequestMsg",Ro="UpStreamMessage",Ao="DownStreamMessages",po="ChrmDownStreamMessages",mo="DownStreamMessage",So="ExtMsgData",vo="GetQNupTokenInput",No="GetDownloadUrlInput",Oo="GetQNupTokenOutput",yo="GetDownloadUrlOutput",Co="ChrmInput",Mo="ChrmOutput",bo="ChrmPullMsg",Lo="RelationQryInput",Uo="RelationQryFilter",Po="RelationsOutput",Do="QryRemindListReq",wo="QryRemindListResp",Go="CleanHisMsgInput",Vo="CleanMsgBatchReq",ko="QueryChatRoomInfoInput",xo="QueryChatRoomInfoOutput",Fo="HistoryMsgInput",Bo="HistoryMsgOuput",Ho="SessionsAttQryInput",jo="SessionsAttOutput",Yo="SessionMsgReadInput",Wo="DeleteSessionsInput",qo="QuerySessionsInput",Jo="QuerySessionsOutPut",Ko="RelationDelBatchReq",Qo="DeleteMsgInput",Xo="SetChrmKV",zo="SetChrmKVS",Zo="ChrmKVOutput",$o="ChrmKVSOutput",ea="QueryChrmKV",ta="SetUserSettingInput",ia="SetUserSettingOutput",sa="PullUserSettingInput",na="PullUserSettingOutput",ra="SessionReq",oa="SessionStates",aa="SessionStateModifyReq",la="GroupUnpushQuery",ca="GroupUnpushSet",_a="GroupUnpushResult",da="SessionStateModifyResp",ua="TypeUnpushInput",ha="TypeUnpushOutput",ga="GrpReadReceiptMsg",Ea="ReadReceipt",Ia="QueryReceiptReq",Ta="QueryReceiptBatchReq",fa="ReceiptResp",Ra="QueryReceiptBatchResp",Aa="GrpReadReceiptQryResp",pa="SessionTagAddInput",ma="SessionTagDelInput",Sa="UserSettingNotification",va="ReportSDKInput",Na="UltraGrpPullSes",Oa="UltraGrpPullMsg",ya="MsgChangeReq",Ca="ModifyMsgResp",Ma="QueryMsgChange",ba="EventChangeList",La="MsgChangeList",Ua="MsgQuery",Pa="MsgQueryAck",Da="OperateStatus",wa="OperateStatusNotify",Ga="SetRtcRoomIdInput",Va="CallInfoUpStream",ka="CallInfoDownStream",xa="KvInput",Fa="KvOutput",Ba="ReadReceiptMsg",Ha="ReceiptQryReq",ja="QueryReceiptResp",Ya="ReceiptCntQryReq",Wa="ReceiptCntQryResp",qa="UpdateUserSubReq",Ja="UpdateUserSubResp",Ka="PullUserSubReq",Qa="PUllUserSubResp",Xa="PullSubDataReq",za="PullSubDataResp",Za="SubDataDetail",$a="QrySubDataReq",el="UserProfile",tl="SetUserProfileResp",il="PullUserProfileReq",sl="UserProfiles",nl="UserProfileInput",rl="UserProfilePermission",ol="SearchUserProfile",al="ChannelsInput",ll="ChannelsOutput",cl="MultiChannels",_l="ModifyChannelsInput",dl="ChannelsQueryInput",ul="ChannelsListResult",hl="ChannelsInviteStatusInfos",gl="ChannelsUserInfos",El="ChannelsJoinedInfos",Il="ChannelsMemberUpdateInput",Tl="ChannelsMemberResponseInput",fl="ChannelsMembersInput",Rl="FriendInput",Al="FriendsInput",pl="FriendsCheckOutput",ml="FriendProfileInput",Sl="FriendProfileOutput",vl="FriendQueryInput",Nl="FriendsListInput",Ol="FriendLevelSet",yl="FriendUserInfos",Cl="FriendInviteInfos",Ml="ChannelApplyInfo",bl="AddUnpushPeriodInput",Ll="DeleteUnpushPeriodInput",Ul="QueryUnpushPeriodInput",Pl="QueryUnpushPeriodOutput",Dl="MsgReadEvent",wl="ConvertMsgInput",Gl="SpeechToTextInfo",Vl="ConvertMsgOutput",kl="SpeechToTextResult",xl="TransReq",Fl="TransResp",Bl="PullModifyMsgReq",Hl="PullModifyMsgResp",jl="SessionQryInput",Yl="SessionsOutput",Wl="SetUserStatusInput",ql="MCFollowInput",Jl="RtcQueryListInput",Kl="RtcKeyDeleteInput",Ql="RtcValueInfo",Xl="RtcUserListOutput",zl="RtcInput",Zl="RtcQryOutput",$l="RtcDataInput",ec="RtcSetDataInput",tc="RtcUserSetDataInput",ic="RtcOutput",sc="RtcTokenOutput",nc="RtcQueryUserJoinedInput",rc="RtcQueryUserJoinedOutput",oc="RtcViewerJoinedOutput",ac="RtcInviteInput",lc="RtcCancelInviteInput",cc="RtcInviteAnswerInput",_c="RtcEndInviteInput",dc="BotInput",uc="BotOutput",hc="ReactionInput",gc="ReactionAck",Ec="ReactionBatchQry",Ic="ReactionsOutput",Tc="ReactionQry",fc="ReactionOutput",Rc="ReactionUserOutput",Ac="ReactionEvent",pc=(e=>{let t=0,i="";e:do{const s=e.charCodeAt(t++),n=s&ws,r=15&s;let o;switch(n){case Us:const s=r>>2,a=3&r;if(0===s||0===a)throw new Error("Data parsing error,at "+t);let l=Bs(e.substr(t,s));const c=Bs(e.substr(t+=s,a));if(l=i.length-l,l+c>i.length)throw new Error("Data parsing error,at "+t);t+=a,i+=i.substr(l,c);break;case Ls:if(o=Bs(e.substr(t,r)),o!==i.length)throw console.log(i.length),console.log(o),new Error("Data parsing error,at "+t);t+=r;break e;case Ps:o=Bs(e.substr(t,r)),i+=e.substr(t+=r,o),t+=o;break;case Ds:i+=e.substr(t,r),t+=r;break;case ws:if(r>10)throw new Error("Data parsing error,at "+t);i+=e.substr(t,16+r),t+=16+r;break;default:throw new Error("Data parsing error,at "+t+" header:"+n)}}while(t<e.length);return i})("upackage Modules;\nmessEH4kprobuf {\n EJ8sSetUserStatusOutputEW5QV optional int32 nothing=1;\n }I41BaGI41CbInJ3111I72Mistring stEZ4I416EUJbubIA14dId=2Ib1GaSER6Ie2IhrepeatedI618guserid If2II41DIm4rkVoipDynamicI62Egquired I116n engineType = Im37Ea9Ig27jchannelNamEb4Iq35IN4IEb7iExtra = 3IK2RIM3DIl1GadEa6cKeyIQ3IjNotifyMsg IJ3LatIC3DIn4Ce64 tiI43UermId=Iw25Ik5HgdestroyIj44b=4Is6HjyncRequestIT2Mh64 syncTI426Ij5Gkbool ispollIC24Ib2IEX7cwebIY2HER7iPullSend=IW25EWIdKeepIp84a5IW4LgsendBoxID34Id24b=6EcLibroadcastEe9a7EeLcendIl37a8IH2KucompressioEnabled = 9IS5GiUpStreamMEG7Iw7LbseI814cnIdIDBRglassnamI78BEZHfontentI6B8Ie8IkpushText = Ie5GEY7fappDatIBC4Ig57I4GGbtoI9H6ds = Id5MfdelMsgI257IY5GIlC8Ea5Ir35Ia5GIP46iconfigFlaIN94IU55Ig1HlclientUniqueI356a0Il1MfextraCIa49a1IiDGdPushI9G6Ie44cExtEb4IqDNdbusCIxG6Eb4In5NhsystemIdEZ4Ii4GEZ8lenderPortraiIp14a2I8GMEF6cBitIw54a2IP2GfExtMsgIz65cextEB8c= 2IT2NemetadEZ7IH8GiReferenceI615crefIE18IP85IeBCEgEIXQMamIi77IYQNdfromIQ96IhJRI9CBIiMHI27AI42MetitleIeLMIQP4otemplateIdNoUseI82PIX84Ie25IhDRfConfigIi64IkDNIl1AInD8IG3CdDownI4HDbs IQUFEYHe listICHJIDNHIgMLffinishIJJ5IJPJI8LKIX3JIj18I1C4EZ7IzMMmcredibleStartEg7IQHMEg8bEnIXM8IVHGIXMPICNHeytes Eg8bedIXB7IANHdChrmIC6YIG16I06zIv2KIuSHIv2MIXVHIV8II1ZMI0EDIx2GIhJ7Iqb5IjY7IRCNegroupISCCIFRSIt87IFRQIAQ9I95DIuI4Ii8EIg5GIEg5IZ8JIcV7Ird7IO8GInIFIwPJIQb4direcEI4IrPKEZ6lplantform =1IqHMgisRemovId75IkPOfsourceIgPKI9SOIpHNI9SGIMEGI3JEEc8IIEJIbUGa1If5GILTLIm5NILTEIoVMcextIdn6I4A4Is57IcYSIGTKc32 IeA5bUnIO24IHTKIrTKIlNNgconvertIW36IETHISUPIy5NISUCIv5GISUPI065I1GCIu1BIHsIIyi5aqIOULISjAIlICIS14eenum IJGCIQ16fPERSONIC1AEG6aSIiGAeGROUPIQGAdTEMPEJ8Ip47oCUSTOMERSERVICEI2GAfNOTIFYIlFAbMCI2l8cMP=IK97eULTRAIJ18INE6ICNDkreateDiscusIuj5MR01KI667IaI7IItHI61GITuTIqy4I51JI256gInvitatIC2FIzzKI4A4I81HeLeaveID19IwyPIxz7IC2RcEviIKJ5I71LIA2BI51KbReIm44IA2SIP5WEx8bfoIB3zI314IN6MIFRJMA31UINgCMj31UIsRNeadminIZT9IuR9Ic7EhfirstTenI1JAI2SJg32 openIAK9IJC5I64NMN91FI71Depage IKiOdnumbIi75MuA1HIW1CId5FIJ37IA6IIg47I9B9ME61Ieotal Im1JbMeIC24ID14IPARIBzSEW4MLA1EEYKIFsBIE7NeextenIwF4ItbKaGISP4Il26Jy5L1IW1CIy5MIk4BbmeEe5Iq5oM7K17IHEwI31BIeKTJ07O1IE2FbSeMr717II3vI419IJ3MMW91NI2T9dFileIzSBdIMAGIkR4Iw37eAUDIOId3AdVIDEEF4IGA7cFILEi4I7H7eSIGHTIhGAlCOMBINE_HTMLIUGKlGetQNupTokenI54LIU29MVK1NIl57ckeyIFmQjhttpMethodIkyQhqueryStrIj56IvgNburIXA4InaNMQD16IuuMcsizIjuKI4k7bpTIY36I5X5Ic4HkdownloadUrlIg4iIRAGIg4Te fileI5PCIA2FIEt4J82Y1I72GIi5OMr11NIi56Ml11JIi5CIKATILDPMZJ15eadlinIY3RetokenIa3QcbosId15Ia3QfbosDatMV51KIaq8batIxm4c5;\nEVLfosskeyIxF5M1I1NhossPolicIH64MjM1NfossSigIg24IwqNiossBucketIt67c9;\nIBvMi3CredentiIlN5MmM1Oms3Algorithm =MlM1IEc9IY47IxwPa3IV39MfM1Pa3IV34eatureIxwRbs3Ia3DIxw4MHk1NicAuthorizIQj5M3O1SbtcIex7fSha256IAxKEhAIl38IB6NcstcIb2EIC6OeminioId2GILx8EjLIf2GIUxHEjCIh27ITxHEaCIj2DIZx4MpW1MIzH7Im24IMX5IgxJIGAAM1M16MpQ1LINLGMUl1UEeAIEUNIRKBIC1ymAdd2BlackListI8qWIOVEIAqAhmoveFromJB111aQISS4I61UImYXI61EIneMID2DIivLI319Mnw1KIL3eiBlockPushI11SgblockeeI41MkModifyPermiMC11HIjqSI29IMrK15M001KEQ7cfo MRL16IuB6I31MICeSIHfSIR19M531WIFzPIcmMcHasIc5TIsjWIu35I714dCodeIe1TI24MEV9IyV5eresulMdU19IJi9EbEI416ME915n_SUCCESS = 0x0IYK7EQ6fFAILURIEi4c0x0MG21JcrmIIrCfMpM1NI5yMbrmIo7hM2o1KIXmAM5K1MdjoinM6G17M1Q1NMHC15MEe1Qc32 I5u6cCouMOV1CMHP1GjhatroomBanIkC4MEe1Nh32 whiteIAG8IUj9IU4GdPullMU52qMYR18Il26IR4JI2z4IU16IKf7Ma52LMLd1KMp01HIi2BcNewIG7MIE28MWf1nMnA2JIpOEilationQryMMK1LMsC1QMNW1HIp4PMRc16Mhl19MvC2MeorderIC9JMLA27hEraseMsgMZY1AMWn1MM2R1AI89GIS6PIesMcqryIfsCMgB1IEU5MaB17Eg7M1f1MdbotTI457McQ1HIB6BgFilter MRD1MIC6zIe5BMeB19MCb1FbagM5x1KI867fTagTopIOyQdpageIfp8I26TI3FKIA48MbB1NEV8IwQ5binISSAIh2IbFiMTx19IPAMIEF4IOANIBFRa MXs1bIZ4eI34KIUUKMCR1gIcT9Ix3GMdu1Iemsg =IiNMdreadMZH27M501ObunEb4IiN5Is3PMnl1DMw61McverIVQ4Mm12NII28cminIj16MJJ2PIj1AIQENbUnIR37MrK16E87MXt1PIs16bMeIu18IdwHIv97bBoMHJ2AMdQ2DIn1DIWaMMzE2FIqNFcmsgIC66IYFMIb26M6Y25Mi31OMM025I4s7IRQHiQryRemindIlT4cReqIe2NMz12AIlXOIp7DI7EMIH37IUOPMZ917Ie2WbspImGGIZ7PItDSdReadIJ25I1EoIsCJM0R1NgtargetIMkK19IYWDgleanHisIy25IEKAI71TIE27M572SIE27MX12KI2E4I845I29DIQ7VIWZIIy24hMsgBatchI59AIMRCIW3GbinE64IT6JgHistoryImI7IWnSID4IIB4PIO6GIm9BIK6AI92PcsOuIdQJNgO231II2FbhaIc44IKkSMQN2HIjMMMQN2IIoMGIzRPb6;IzRcITVHMM215hChatRoomMZf1VI9Z5IcZOI8Z5IZq9Ia1SMZy2SIbS4iTotalNumsIV6CIvb9brmMSj16IIT6dnfosITsOEe7IynLMSv27IlUNIoz5M8q1IgPFollowInBSMp32CExJIqusaMMa216Ieb6Ih5IbMCJV1U1Ma41SdmpidM7838Ma41SIZGJI2tDIf6JMXy2HIzc8Mkn17cUrlMby2HM411EITd7MlD3DdarchIO34Im4PIS24IO3Ocid=Ie4IIM18I96ZIQ1AMxu18I76CIKDJIew5Io2PIn48Io2NIe65IM1OMIr1TMiF3DIn2UIbMIIvSEMLm2HIgOHMIA3cIjrCIOxnI4TKI5MhItfKggnoreCmMS03AIvQLbsgIqQhIM7HIoQEI4TNImQ6IMnNJkQf1IjQsMo127dsAttMa61FMgN1gI61BMbp1SeinboxMSC1QMVW27EaAIr5JIlA4IDR4Irh6Ido8IQfHIL27cMsgIfh4IR3LIghfI1lAMqM2UM813SIGfUIo2EMuT3rgDeleteSIK67M4W1LMh928IRH4MlM17M8X1LEeCNrR2E1IWzQI25uIQa5Jw371IC1DeOutPuID1vIM6EIR7rI1t8cDelIpnFM1B1HaOIDR7breEG6M8B1ObclI7p6IbPKIE1GIeYMIMrCMp13XI5sGMO52RIm7CIcFHIN56I5SOMMJ1ZI33OIfF9IyO8Ih18IFG4Ic74IbArI81AMUL3kIDI9IJN4MOU1NMH33CIrzLlhrmKVEntity IH7MMJF26IGFNevalueIw1PMh639IQSMInX4estampMUM2RInl5M5U1MM5F17MUJ1KcSetIW36ImIIIs3BeentryIKCOabMbl36IY3JMAe3GgnotificIaD8Io3GI4AJIwNJIq27bS MQU1HJr2P2IAB6Ju2o2IR26Men2OIt2FbieIvyBIv2FiFullUpdatIICNMz51EN9W1O1IV3IbSVIeC6IhFDIDDPMKc2YIljDIb17I75SET7IE58grrorKeyMB41OIq2HdkeysEI7MN41OIc1GIPLMIMJDIrIFIQ25MI22OMr717IPHKIMJIIgTMIa7JM594IMgA47fettingIKwRIv67INwOIdM5Izo8ICrKIO5AI4jJI82CISlSI92OIg15greserveI92MbupIwC4I92RI7z4II4rIg1EI92OMDf2FI32WInBMIa2Chtem itemMdy2NIi2BM8d1II91FMAQ1UMbd3iIiVMMyc3GIiH6IhV8Mvc3MI338Msc3JMU51AMdj17IuiGcTagIU35dtagsMmq2JEc7MYe1JMoJ1IEuJMD925MTl3AIqAUIT2EMAA26I334MXb18IY1OJUqU1Ic37MLz1GI32CI955Ii25EA5MK81hIN3OIx9KEWCIW35Iwp7EHAIweeII8SI3fTIOVCMlN25IO2HMC637esSileMeD2CbIsMc326I627cTagIi1BgAutoTraICt5Md01OIb15MqW26IVAPIY9nIeMnMdR25Mxh36IcQ5IzRNMJk3EI71RcSetI41eIqFHbunI414dLeveM6I3MIe1AgResult M1u1WM0u1hIF2TMiA1OIH7DMgt1BIXPgIDRGIx3HIOA4Iw36NMC101IucAIt3fIU9WIlBHIm2AI4WZIyZOIQ4XmGrpReadReceipM6b4DM6J2EIXy5MXk4OIGLHIa1QMX125M771HJd131Ia1BMTW1rMEh4AMpj4UMrJ1LM9M47dreadIKM6b4 MLO2MIc35ds= 5EW7MHP4KMtB3AIOiHId37IA5AIg3hIBFJIXcMMMj1GI83KMpg2PMnV2AMlg2MMFb17MPR2bMQE2JIg58MqI2NMRO25MkI28b EZObSiMIC25MHF3OMZP2CMcI28Mbv3PIFpMIr67MDJ1OEaCIChGIS4PIi1TJW871MxB1NIX8iIlEEI4B7MbH2IIaBEbspIYY5cresIhtXMSQ4KM711DM5117MzZ4OIf7BMoT1MI87EI03UEb9IYo9J53F1Ml62IIw1LJA8q1IC7LMXa25IV5UIt2VMtO1XMpO1TMQj15aCM2c1LMpP2AEW6Mn34GIZ27Iuu4Ec5E95Mxv4PMmd16dListMic2PMLe17Il15I3tGIl1CEe6In17Mtj3IIoTIIVbLI548MdD26cNumMcA1JcGrpMak17Im15MuL27IfVKEdCIrYLIoM5MuE2TMfj2EIveJfTagAddMg81iIAyRMn81uIC1DMq21OILZRdnameIzTKMOA39Ik45M2C5OcTopMTE5JIP29cDelJd482fDisTagI0eQIf4BMU81NMuS15MFS18NTE111IHQEgportSDKMxl1SgsdkInfoMlo1KI017Mlp1rhUltraGrpMKJ56M6718MrF3ZMY93aMrD1IIm1BMbH3hMdN1pIC24ehangeM2q2QMAt4TIlQII9sGIEtJM5K4NfmsgUIDMAG1JI0PGM203qMEu4HMJC2HIyx6IqK5IWM9I7RGEZ5I16NMx33NILeNI569Ih7nI0B7eeedCoIdYPMvn47fnlineTM4e1MI97II3JHeEventIh26IrS5IoGFEVBNt4501ehasNeML845a3IIsNIg2GInDIIL4BIPt6IF3NMlA1QeinessILZLMaM3QM6L1aMhY3IcngeI217MAw3OjriginalId MVw1PEa8MfQ3NMhc39hcondaryIMbQ3KI657eAdminM0b5OdaddiEG6dMarkIMt6Iv2MgperatorMRV5MMlU17bubIJ66M7N18IqBMIw29Ed8Mig5NM0736bMeMm84BIcRGcextMXu37ItyMMoB3AMb55KIBm6eeventI8m7MV846IkLLIyCKI8GAIwCzIxCHI52LMS33oMJd1ZMlW1MMvx2EIfBJIEONMvd1PIFOAIWBNIFODIVBqeisDelMSN3JJLBK1MJP3HIMBxIsk4MA046JSBZ1MvV1CJM991Mzn49Id15IZ15MkT25Mbd45IY95c //MSt4HEjFISTLI29AMPt2OI5A9MXQ2rIO48cAckM5F3oIH7EhnotExistMjr58IKXHbOpIFA4heStatus MW31XIMRTMzN1NM6C48Mdw3NM9S2bIh2DM2G27IZj8M5V2ZIuRHMSG25IJO8M6Q39I859In17MRz2CIXX8EcIjSummary suE86c= 4IILHIJ1CNH91N1M901GME03NIH68Mev2MEF4I1jAI634Eb4IJ6JIm37NXC1T1MT33WIF3DMHA3FdtRtcM4M35Mt31MM9q48brtEc7Md02LI71AMkL4tcCalMNC55MhQ28MMb2QIgHPddataISu7ICyIIY18IpGAJa161ILKIaaM2035MJ94IbKvMu41RIfoGEvEMwk1SIo17IvJJIp14M9E3REV7M8h2RMB22UMvi1SM601JIJRyI1PYMKY6LbrtIrN8MEm5OcndMEY7MP96JMln1KMQu3TMjx1jMpn3ZMGR1GML81NMvL1LMpN1CMsL1CMBi1LMBR1BIB4JMLM1BMdR1HEX5IuzNM364WMaW3EMQb1OMPJ5AI4xLimentionedIH7QcCntIK7DMzx2qM4I2RIeARMWh1LMVh1RIk28Mbe1IMiS17Ir64MJd46Mpf3LEbAM8a1nIrP4M1L4RbtmMnM1LMXl26MtL15bubIi5JIfl9M1K2GMSW2ChubDetailM7n68Mn81NIUbSMlg27cxpiIKY6MVO1LIg19Mdp6NM9p68ImMKIl3FMv54JIG3OMzv5NcubTMyv5FMVb2HIS5OMfo2aMho1CIa1IbUlIa1AIH3PMV015IAkEIA2PM1D1WMMr1dMXR4JcullICNKIe2CIM6xInADMxw2NIs69I9AaI9BQI93HMQV15fubDataIs7WMoT1SgneedAllMx668Iq5YMal2LID29IV8IER7IQ57IX8aMcL1dJb8J1Ik2EMj57ScStrMLv4RIfGBMtc2HIb16IQf5MYN4QIb99IClJI317IJLLhplatformMPN4CEbHMKK3RIF6HINYIcrySI8ASISNxIxEGgProfileIdJtIuXGI929IP17Ih45Myq55If17InUIEgGcExtEjAILPHEkCMW73iMwl2KMg33JIX17Mxd1QMiC3iIUYIpcensorFailedFielMPE15Mk13PIH29MYs1OMMK5QI11BMWh6HI68CII8CI91UMcu3sI31BMZL5AImDNEWAIB1UInytMGB46IBCRMdA29M7c6AMrC6NMKQ7MMi41YMwJ1ZIsBCbseMqz15ILDccextIHDFIx1IdBaseEj5abE98MrE2QIMH7MuH4IIE1GIE4MM4725MlS18MLT1NbwnIPpNMXI5JInNMMXI5EIrNIIy68MU22PMoC15MHC15M4s1TafMoi66MOi5OMOb4OIiB4hrocessCoMuP35Ia6NgsJoinedIP55Iiq8Ig6MEn8McE68MOX4DMha1GkFriendInvitIt66bfrEHFMxa1IEq6IX19Eo6EF9MJD5II1KSMc077IbrCdultiIA38IQvgI74HISE6MbM2EMp12HJBFR1EZ9dQuitIe18M1F27IJF8It47MDd1RMQn2QIcA8IehDMt51DIv1IIb3FIHd7Eg4MtD5QM0445IwnPEW5eWhiteMp13PEY4cAttMU316ITETM5d17JL6Q1If18jPageParam MAV67IC6NbidIA6QbroMsE67Mbt2OMiO5AI7LPID2BIDeMMXs27IAwdMa72hM8X6EMt038MyX4NMT728I73JMu657MaF3AI51FIOE4IMhEMwn1FMVl59Iu6kIgU4IjULIQJ4Mov58INK4MGU5MEfHIqrDIV1NI7K8IN1PIeK9IF1ZIvNAIH1PIUOBIJ1EIW2RIpZOMnP2FIm5HI214cExtIbX8MtJ2QbpTMpJ2TMxI7EMEq4RIOJLII2KIf9LIPE4ImyPMNq5BMkD3UdNickMJT6UMNE2AIR3QfremarkIA17Mof4LcisBIgL5M8s7NbanM0V7VMjQ58MMq27Iv4JMjp26MnF16JfLS1M8p1WIe5PMcr7OIe5CMMF3NISSDMUz6OI5DCI14eIdkcIMlSIdkDMID4NIdkKIkeOIECCI0e8MgA4MIgJNI48uIWHAILD4IMeBI2NOEZ9binI724El8ME91NMYR48I4UMMGX79I9UTIoF5IL8BMSz7KMI715Mhg5OdapplMDg28M3J2GIT3HIil7IT37MMU7MEa7Ion8MtL7IItEDgResponsJvET1IAD8IhU8Mo02OIjV8IoEPIK89MZX4KIZb8I887Mkj6RIS6EIY4QNX01T1MfT6HMH91HIbr8MhA5uMEe3XMHD28Ix1MMpz5NET6ES7IGYGI41EMvU8TIsWPICzKMnw6OIDz6I73OMPV7SI55jIU1JeCheckIg4SEXCIibPEhIIt7tIkJ9Iq2NMTG1JMqG2oIHYDInQkIM2PMWg6TMI21LI1ANIEuQMZl37EW4IGnNIlmPIkJMMN516Mfq5BII2IIDjuMh328Ma156MSW3TIA2AIxLPIuC7IkfqIFkEInLNIFkEMLW3GIY8PIRS7INKNMhB19I55lMGe5LIs2UI05MMko4CI5EQMr13NITJDI15NIaM7M2v3MIb7DM9b3HIYI7Mwu6IJ6KF1MpA45cSetMp01NMJB47IrJOMy41GM051VMC12lIwDEIOyHIREFIcMVI2AAIB1NIZABMq01REi6aAIMe4MYD35I25MIse6MgX6SIC8DIpVZJTz71M6A2GIrK5MmR18MBO1MMWS1QIbmXIWoBMlq1IMAC29I02SID1AEl5MDS1CI22XcoptIcoGIFfJIN75MmZ2DMnA1WIsG6MNK6OMi289MW138IW3WIh2EIS3OIH6PIPVGMnY1TIGwNIW1JdFullIQwCIoEIIGB4ME836IVCLMvb39IqD5I3JQIVCIIXGJID85If1SINS6M678CIIRaIn1HcAddMeU46ePerioMNq2TMrs6CM8d4MispanMinutM0E55IOWMIBM8MKZ3OgimezoneM2J5QIp2XMJK7cJ9191I91CMav1SbisMrR89MzC2OIf5BMoU5NIf5DIUWMIf58M3q8OIf5AMje2JMyg59J7wU1MHp2TMqh5GIK8HMWd27IoCSNgD4U1M1n2DIFcMMTC4CM4s1GMEE4GMeD46MvH1IMhZ86M3j5OMOQ39M9i35Mda1TMki39I5PNmSpeechToTextIEa4MX39sfobjectMIQ9VM7F9PIqB7fampleRMMs7MMhY3AdnelNMyE88IsmNfformatIthQMsN78Mg81II469Me44SI56jM6C19I76TMRi1MIQO9MQT7CMRh8KIJ16Mfv4KdransMvI2JEO5I085ctraEA6MWe2QcmodM5H3LMZ596dorceMi658IYwHI427MDb2IEP8IV34Ic36I42dIW1HIusREe7MQ546IDoNI514IehUbteMfc2SI315dFileIBh6Mqx7OMyv85aLMKd15IBBNI8M6EZ6MkU7MM9r65aSMAx86IKBKIU5CIP4pIN3CICBEIM3UMT54TEZ6IiFNM5E26MiB8NIp3BM7d1JMrG45M2B4Acq {MWr4IMNI77MUO4AMvh4dIvA9IJA9MhZ3AM3X2LMFD4KMk53AET8MWI27ICRMdnextMr65FMfJ9hIF3GM8n2HMMp5dIm2AIXKLII4DMQG4jMJ09DbacEB4I2W6creaMRA98MAV4OMbb7OMre2WMMV7UIx4DMpZ4HMg21GMvZ4PMyT1NEU7ET7MAV57MO92xIg7BMiL9uIN2EN8g3N1MUS4QI37MMrs6HMBa66Iqu6EB5Mc22LEcBIxALMMI36I0QNMfK26Iid6IJfMEZ7cMeCM3t4RIvh4brTM1w6KEW7eutOffEX5I8KGMjL7EMUx85EJ9IJKCMGc55IVy4M8c5BhKICK = 0IL16eREFUSMZi8BgCOEXISTMTC9HbTaIb74I91BgROOM =1MMI27MgC99MCz5PMvAAWM8u6CIoHDM3477ICxVM7P86IrpHbtcIGt5MnK1GMlB7LI01KcKeyIcw6MnL1Sdkey=EzKeValueMZi3UM236ZIN1FMGC1FMqw4MM8r4HII2DEa4I3G4IY1PMWJ8QI52CMUa25MKv4OM0f85Mjs4HMp68GIVL8Ii2MdroomMs52EEeCMoI6JMb7ANMgq3AIVbMkofflineKickMTF2CIX4FM4K7UI6l8MUx35MGj3KIV3GM1L3NMEL7AMam6FIF6LMO175M4e3IbtcMM61RI124Mhh15MVM4NMjq98Ea5IsUHID3CIkr5eInnerMWL5NMtO39bSyIZO4MfC85IVYJbIdIPL4btyM4P4BbidEJHIj7II1K9Me92II46MbinIm27McX5BEgMeouterEg8Mhc1HIvH4bryIwCPI91DM315NMXi85caInIp6JMUP26fnterioIwI7EUBIrMBIdU6Mm34AIwIIIQZNMf11AMmM7OMd117IjQ6Iz2FcSetJ23K1I4LIMNz4NI4L6MHn4OIV3AIFsNIV38MC38IInD6IZ3LIf7KIC25MtU1EIl2GMS71KIF1MMY71FI0AIIt5RcsInJx8B1ItAGbelIL4PIwRRIS2GIp7GIS2II12KMrD5fIjfPINSKMJ79RInN8Eb7IJFLfSetOutINCPIW3IIuOTIM99IZTOIcBBMst9QIcB5IrOKcQryIfB4Ir2LMIU3eIlC7I617INXcIA1NMBiAZMsX7SMF51PImU6IM9LdPullM5i6hIR8HIEW8IS9KI6Z9NR47Z2Ix2HIJ7PNIv6R1MMB28Iko5IkWJIF26mAnchorToVieweMmr3BEG6bToEW6IQ6NMPg16cserMtp18MF59rbtcMep2HMeY4HdevicMsb3BI89WMep8XIF3UIv6PIj2BMKY8CIfpGI655ID1LIUKSIe8XMN37cIhhHMo826MQ18REY5Mi226MLk5IMEdA8fimeoutMFk7LIA1EMhj47IEYNEb6IhM5Mv95NEY6MJk99IhDMeCanceMm7A6IY3oIz2UIa3TIz25IX3TIz2AI7oMEa4hAnswerInIy2WIx2NIV67janswerCodeIu2UIT6aIw2FMJXAPIoeOIOZ4M9i1NIGg6IFvKcEndIG7eIA37IF7TIA3AIN4TMKq48MnV3OIo19dKeysIJ7IcBotILWSMoW36MwK9IbotIgG6EsFIG15ffo botEuOEW4IozMMnG87MCW5MMiY2yMZD8EMB41GcMetMkTA5Mi4A7MxTA9MpoAPMrY2QMAA67IES5MA41OIn1CMQA4UIH4MMRA4PMDW18NRp201N9Q121MYj4KMps1KIm27MU53KM6fAKMij2OMcDBAM4j9NMcDBAM3j9NM4x5DMHuAHIV58MXM5AMqJ6IMCF36MT35NI318MUP65cQryJb6o1M9q4TMZa1RMtV3LcallMFL67IS6OM9c1BMf79JIJ46MT54NI62GME32MMfc1HMQW5HMjE25IYC7M4s86EG8MMZ6tIK1FMdt4qIs88Mqa1DMYE2BIq2BMal1SEf8JQ9r1J1GE1IU9VMUq2DIrFNIz6CMPXBTIpFSJSAM1Msl4XI88ZM355JES6M4117Jv2s1Mew1HIv2fMfC2RIs8DMiA3OICMDMdW1RM6o1LMCA76cserII25M9h6KIa5AM0618MFZ2JEbBMuD3tIC3IIa1KMBY2SJvFf2MF05FMAY1HIv5GMh57QIY7AMvX17b}\n3Q4C");var mc,Sc;class vc{constructor(e){mc.add(this),Object.defineProperty(this,"pbModules",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=Io.loadProto(e);this.pbModules=t.build("Modules").probuf}encode(e,t){return this.pbModules[e].encode(t).toArrayBuffer()}decode(e,t){try{const s=this.pbModules[e].decode(t);return i(this,mc,"m",Sc).call(this,s)}catch(t){const i=`name: ${e}, stack: ${t.stack}`;throw null===console||void 0===console||console.error("pb decode error!",i),t}}}var Nc,Oc,yc,Cc,Mc,bc,Lc;mc=new WeakSet,Sc=function e(t,s){if(t instanceof Array)return t.map((t=>i(this,mc,"m",e).call(this,t)));if(n=t,"[object Object]"!==Object.prototype.toString.call(n))return t;var n;if(t instanceof Io.ByteBuffer)return t.toArrayBuffer();if(t instanceof Io.Long)return s?t.toString():t.toNumber();const r={};return Object.keys(t).forEach((s=>{const n=t[s],o=t.$type.name===So&&"seqId"===s;r[s]=i(this,mc,"m",e).call(this,n,o)})),r},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"}(Nc||(Nc={})),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"}(Oc||(Oc={})),function(e){e[e.GROUP_SUCCESS=0]="GROUP_SUCCESS",e[e.GROUP_FAILURE=1]="GROUP_FAILURE"}(yc||(yc={})),function(e){e[e.IsSilent=1]="IsSilent",e[e.IsTop=2]="IsTop",e[e.Tags=3]="Tags",e[e.AutoTrans=4]="AutoTrans"}(Cc||(Cc={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Mc||(Mc={})),function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(bc||(bc={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Lc||(Lc={}));const Uc=new vc(pc);var Pc,Dc,wc,Gc,Vc,kc,xc,Fc,Bc;!function(e){e[e.LOG=0]="LOG",e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.STATISTICS=6]="STATISTICS",e[e.NONE=1e3]="NONE"}(Pc||(Pc={})),function(e){e.IM="IM",e.RTC="RTC"}(Dc||(Dc={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.USER_LOGOUT=19]="USER_LOGOUT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR"}(wc||(wc={})),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"}(Gc||(Gc={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(Vc||(Vc={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(kc||(kc={})),function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(xc||(xc={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Fc||(Fc={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Bc||(Bc={}));class Hc{constructor(){Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:{}})}on(e,t,i){const s=this._map[e]||(this._map[e]=[]);s.some((e=>e.listener===t&&e.target===i))||s.push({listener:t,target:i})}once(e,t,i){const s=this._map[e]||(this._map[e]=[]);s.some((e=>e.listener===t&&e.target===i))||s.push({listener:t,target:i,once:!0})}off(e,t,i){let s=this._map[e];s&&(s=s.filter((e=>e.listener!==t||e.target!==i)),s.length?this._map[e]=s:delete this._map[e])}emit(e,...t){const i=this._map[e];if(i)for(let e=0;e<i.length;e+=1){const{target:s,once:n,listener:r}=i[e];n&&(i.splice(e,1),e-=1);try{r.call(s,...t)}catch(e){null===console||void 0===console||console.error(e)}}}removeAll(e){delete this._map[e]}clear(){Object.keys(this._map).forEach(this.removeAll,this)}}const jc=(e,t,i)=>{const s=null==i?void 0:i.isReverse;St(e)&&(()=>{for(const i in e)t(e[i],i,e)})(),(Rt(e)||Et(e))&&(()=>{if(s)for(let i=e.length-1;i>=0;i--)t(e[i],i);else for(let i=0,s=e.length;i<s;i++)t(e[i],i)})()},Yc=(e,t)=>(jc(e,((i,s)=>{e[s]=t(i,s)})),e),Wc=e=>"[object Null]"===Object.prototype.toString.call(e),qc=()=>ut.gen(),Jc=()=>ut.genWithLen(22);class Kc{constructor(e){Object.defineProperty(this,"pbCodec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.pbCodec=new vc(e)}encode(e,t,i){return i?t:this.pbCodec.encode(e,t)}decode(e,t){return this.pbCodec.decode(e,t)}}const Qc=(e,t,i,s,n)=>{const r=s?Object.keys(s).map((e=>({key:e,value:s[e]}))):void 0,o=n?Object.keys(n).map((e=>({key:e,value:n[e]}))):void 0;return Uc.encode(zl,{roomType:e,broadcastType:t,joinType:i,innerDatas:r,outerDatas:o})},Xc=e=>{const t=Uc.decode(Xl,e),{users:i,token:s,sessionId:n,roomInfo:r,entries:o,offlineKickTime:a}=t,l={};return jc(i,(e=>{const{userId:t,userData:i}=e,s={};jc(i,(e=>{const{key:t,value:i}=e;s[t]=i})),l[t]=s})),{users:l,token:s,sessionId:n,roomInfo:r,kvEntries:o,offlineKickTime:a}};var zc,Zc,$c,e_,t_,i_,s_,n_,r_,o_,a_,l_;!function(e){e.INIT="INIT",e.DATA="DATA",e.END="END"}(zc||(zc={}));class c_ extends _i{constructor(e,t){super(),Zc.add(this),$c.set(this,void 0),e_.set(this,new Map),t_.set(this,void 0),s(this,$c,e,"f"),s(this,t_,t,"f")}requestStreamMessageContent(e){return t(this,void 0,void 0,(function*(){const t=i(this,Zc,"a",i_).createTraceId();i(this,Zc,"a",i_).info(r.L_REQ_STREAM_MSG_CONTENT_T,`messageUId: ${e}`,t);const s=yield Ii.create("requestStreamMessageContent").isLimitedString("messageUId",e,1,64,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID,"messageUId is invalid.").result().tryTrans(i(this,$c,"f").validateConnected).tryTrans((e=>{var t,i;return(null===(i=null===(t=null==e?void 0:e.streamServer)||void 0===t?void 0:t.addrs)||void 0===i?void 0:i.length)?gi(e.streamServer.addrs):Ei(D.STREAM_MESSAGE_DISABLE)})).next((t=>i(this,Zc,"m",a_).call(this,e,t)));return i(this,Zc,"a",i_).summary(r.L_REQ_STREAM_MSG_CONTENT_R,s,t,{messageUId:e}),s.wipe()}))}}$c=new WeakMap,e_=new WeakMap,t_=new WeakMap,Zc=new WeakSet,i_=function(){return i(this,$c,"f").logger},s_=function(e,t,s){const n=i(this,e_,"f").get(e);n&&(i(this,e_,"f").delete(e),i(this,Zc,"m",n_).call(this,e,zc.END,t,n.msg))},n_=function(e,t,i,s,n){this.emit("message",{code:i,messageUId:e,type:t,chunk:n,message:s})},r_=function(e,t){e.content=Object.assign(Object.assign({},e.content),t),i(this,$c,"f")._innerSetMessageContent(e.messageId,JSON.stringify(e.content),e.messageType)},o_=function(e,t,s){const n=i(this,e_,"f").get(t);let r,o;switch(e){case"init":n.msg&&i(this,Zc,"m",r_).call(this,n.msg,{content:"",stopReason:0,completeReason:0,isSynced:!1}),i(this,Zc,"m",n_).call(this,t,zc.INIT,D.SUCCESS,n.msg);break;case"complete":r=s.length?JSON.parse(s):{},o=r.complete||!1,n.msg&&i(this,Zc,"m",r_).call(this,n.msg,{stopReason:r.stopReason||0,completeReason:r.completeReason||0,complete:o,isSynced:o}),i(this,Zc,"m",s_).call(this,t,r.stopReason||0,o);break;default:r=JSON.parse(s),n.cached+=r.content,n.msg&&i(this,Zc,"m",r_).call(this,n.msg,{content:n.cached}),i(this,Zc,"m",n_).call(this,t,zc.DATA,D.SUCCESS,n.msg,{content:r.content,fullContent:n.cached})}},a_=function(e,s){return t(this,void 0,void 0,(function*(){if(i(this,e_,"f").has(e))return Ei(D.STREAM_MESSAGE_REQUEST_IN_PROCESS,`Request in process, msgUId: ${e}`);if(i(this,e_,"f").size>=3)return Ei(D.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED,"The request queue is full");const t=Eo.createSSEClient({logger:i(this,Zc,"a",i_),msgUId:e,appkey:i(this,$c,"f").appkey,token:i(this,$c,"f").token,timeout:3e4,onRawContent:t=>{t.split("\n\n").forEach((t=>{if(0===t.length)return;t.startsWith("data:")&&(t=`event:delta\n${t}`);const s=t.indexOf("\n"),n=t.slice(0,s).replace("event:",""),r=t.slice(s+1+5);i(this,Zc,"m",o_).call(this,n,e,r.trim())}))},onNetworkError:t=>{i(this,Zc,"m",s_).call(this,e,t,!1)}});if(!t.isOk)return t.wipe();const n=t.data,r={client:n,cached:"",msg:void 0};if(i(this,e_,"f").set(e,r),i(this,t_,"f")){const{code:t,data:s}=yield i(this,$c,"f").getLocalMessage(e);if(!s)return i(this,e_,"f").delete(e),Ei(t,`message not found, msgUId: ${e}`);if(s.content.isSynced)return i(this,e_,"f").delete(e),Ei(D.STREAM_MESSAGE_SYNCED,"synced");r.msg=s}const o=yield n.open(s.slice());return o.isOk||i(this,e_,"f").delete(e),o.wipe()}))};class __{constructor(e){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e})}__getContext(){return this._context}createCodec(e,t){return new Kc(t)}createPBCodec(e,t){return new vc(e)}refetchNaviInfo(){return t(this,void 0,void 0,(function*(){return this._context.refetchNaviInfo()}))}getNaviInfo(){return this._context.getNaviInfoFromCache()}getCoreVersion(){return"5.44.0"}getAPIVersion(){return"5.44.0"}getAppkey(){return this._context.appkey}getCurrentId(){return this._context.getCurrentUserId()}getUserToken(){return this._context.token}getConnectionStatus(){return this._context.getConnectionStatus()}getDeviceId(){return this._context.getDeviceId()}setPushConfig(e){this._context.setPushConfig(e)}sendMessage(e,t,i){return console.warn('[PluginContext] sendMessage is deprecated, please use "sendMessageTo" instead'),this.sendMessageTo({conversationType:e,targetId:t,channelId:i.channelId},i)}sendMessageTo(e,t){return this._context.sendMessageByPlugin(e,t)}registerMessageType(e,t,i,s=[]){this._context.registerMessageType(e,t,i,s)}getServerTime(){return this._context.getServerTime()}getOSInfo(){return this._context.getOSInfo()}getProcessInfo(){return this._context.getProcessInfo()}getMainProcessInfo(){return this._context.getMainProcessInfo()}setCallInfo(e,t,i){return this._context.setCallInfo(e,t,i)}createLogger(e,t){return this._context.createLogger(e,t)}getStatsUrlList(){return this._context.getStatsUrlList()}registerCustomSignalHandler(e,t){this._context.registerCustomSignalHandler(e,t)}}class d_ extends __{joinRTCRoom(e,i,s,n,r,o){return t(this,void 0,void 0,(function*(){const t=Qc(i,s,n,r,o),{code:a,buffer:l}=yield this.rtcSignaling(e,In,!0,t);let c;return a===D.SUCCESS&&l&&(c=Xc(l)),{code:a,data:c}}))}quitRTCRoom(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Wl,{status:0}),{code:i}=yield this.rtcSignaling(e,Tn,!0,t);return i}))}rtcPing(e,i,s){return t(this,void 0,void 0,(function*(){const{code:t}=yield this._context.rtcPing(e,i,s);return t}))}rtcPingResVersion(e,t,i){return this._context.rtcPing(e,t,i)}getRTCUserInfo(e){throw new Error("Method not implemented.")}setRTCUserInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Ql,{key:i,value:s}),{code:n}=yield this.rtcSignaling(e,fn,!0,t);return n}))}removeRTCUserInfo(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Kl,{key:i}),{code:s}=yield this.rtcSignaling(e,Rn,!1,t);return s}))}setRTCData(e,i,s,n,r,o){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ec,{interior:n,target:r,key:i,value:s,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),{code:a}=yield this.rtcSignaling(e,An,!1,t);return a}))}setRTCTotalRes(e,i,s,n,r=""){return t(this,void 0,void 0,(function*(){const t={objectName:n,content:[{key:i.name,value:i.content}],valueInfo:[{key:"uris",value:s},{key:"mcu_uris",value:r}]},o=Uc.encode(tc,t),{code:a}=yield this.rtcSignaling(e,pn,!0,o);return a}))}setRTCCDNUris(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(tc,{objectName:i,valueInfo:[{key:"cdn_uris",value:s}]}),{code:n}=yield this.rtcSignaling(e,pn,!0,t);return n}))}getRTCData(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=Uc.encode($l,{interior:s,target:n,key:i}),{code:r,buffer:o}=yield this.rtcSignaling(e,mn,!0,t);if(r!==D.SUCCESS||!o)return{code:r};const{outInfo:a}=Uc.decode(Zl,o),l={};return a.forEach((e=>{l[e.key]=e.value})),{code:r,data:l}}))}removeRTCData(e,i,s,n,r){return t(this,void 0,void 0,(function*(){const t=Uc.encode($l,{interior:s,target:n,key:i,objectName:null==r?void 0:r.name,content:null==r?void 0:r.content}),{code:o}=yield this.rtcSignaling(e,Sn,!1,t);return o}))}setRTCOutData(e,i,s,n){return t(this,void 0,void 0,(function*(){throw new Error("JSEngine's method not implemented.")}))}getRTCOutData(e,i){return t(this,void 0,void 0,(function*(){throw new Error("JSEngine's method not implemented.")}))}getRTCToken(e,i,s){return t(this,void 0,void 0,(function*(){const t=Qc(i,s),{code:n,buffer:r}=yield this.rtcSignaling(e,vn,!0,t);if(n!==D.SUCCESS||!r)return{code:n};const{rtcToken:o}=Uc.decode(sc,r);return{code:n,data:{rtcToken:o}}}))}setRTCState(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ql,{state:i}),{code:s}=yield this.rtcSignaling(e,Nn,!0,t);return s}))}getRTCUserList(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Jl,{order:2}),{code:i,buffer:s}=yield this.rtcSignaling(e,On,!0,t);if(i!==D.SUCCESS||!s)return{code:i};return{code:i,data:Xc(s)}}))}joinLivingRoomAsAudience(e,i,s){return t(this,void 0,void 0,(function*(){const t=Qc(i,s),{code:n,buffer:r}=yield this.rtcSignaling(e,yn,!0,t);if(n!==D.SUCCESS||!r)return{code:n};const{rtcToken:o,entries:a}=Uc.decode(oc,r);return{code:n,data:{token:o,kvEntries:a}}}))}quitLivingRoomAsAudience(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Wl,{status:0}),{code:i}=yield this.rtcSignaling(e,Cn,!0,t);return i}))}rtcIdentityChange(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(zl,{roomType:Gc.LIVE,broadcastType:s,identityChangeType:i,needSysChatroom:!1}),{code:n,buffer:r}=yield this.rtcSignaling(e,Mn,!0,t);if(n!==D.SUCCESS||!r)return{code:n};return{code:n,data:Xc(r)}}))}requestRoomPK(e){return t(this,void 0,void 0,(function*(){const{invitedRoomId:t,invitedUserId:i,inviteSessionId:s,inviteTimeout:n,inviteInfo:r,roomId:o}=e,a=Uc.encode(ac,{invitedRoomId:t,invitedUserId:i,inviteSessionId:s,timeoutTime:n,inviteInfo:r}),{code:l}=yield this.rtcSignaling(o,bn,!0,a);return l}))}cancelRoomPK(e){return t(this,void 0,void 0,(function*(){const{invitedRoomId:t,invitedUserId:i,inviteSessionId:s,inviteInfo:n,roomId:r}=e,o=Uc.encode(lc,{invitedRoomId:t,invitedUserId:i,inviteSessionId:s,inviteInfo:n}),{code:a}=yield this.rtcSignaling(r,Ln,!0,o);return a}))}responseRoomPK(e){return t(this,void 0,void 0,(function*(){const{inviteUserId:t,inviteRoomId:i,inviteSessionId:s,content:n,key:r,value:o,agree:a,roomId:l}=e,c=Uc.encode(cc,{inviteUserId:t,inviteRoomId:i,inviteSessionId:s,content:n,key:r,value:o,answerCode:a?1:0}),{code:_}=yield this.rtcSignaling(l,Un,!0,c);return _}))}endRoomPK(e){return t(this,void 0,void 0,(function*(){const{endRoomId:t,sessionId:i,content:s,keys:n,roomId:r}=e,o=Uc.encode(_c,{inviteRoomId:t,inviteSessionId:i,inviteContent:s,inviteRoomKeys:n}),{code:a}=yield this.rtcSignaling(r,Pn,!0,o);return a}))}registerRTCSignalListener(e){this._context.registerRTCSignalingListener(e)}rtcSignaling(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=yield this._context.rtcSignaling(e,i,s,n);return{code:t.code,buffer:t.data}}))}getRTCJoinedUserInfo(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(nc,{userId:e}),{code:i,buffer:s}=yield this.rtcSignaling("",Dn,!0,t);if(i!==D.SUCCESS||!s)return{code:i};return{code:i,data:Uc.decode(rc,s).info.map((e=>({deviceId:e.deviceId,roomId:e.roomId,joinTime:e.joinTime})))}}))}}!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.CHANNEL_ID=7]="CHANNEL_ID"}(l_||(l_={}));const u_={[l_.STRING]:pt,[l_.ONLY_STRING]:Et,[l_.NUMBER]:Tt,[l_.BOOLEAN]:e=>"boolean"==typeof e,[l_.OBJECT]:St,[l_.ARRAY]:Rt,[l_.CALLBACK]:e=>{let t=!0;return St(e)||(t=!1),(e=e||{}).onSuccess&&!vt(e.onSuccess)&&(t=!1),e.onError&&!vt(e.onError)&&(t=!1),t},[l_.CHANNEL_ID]:bt};class h_ extends Error{constructor(e){super(e),this.name="RCAssertError"}}const g_=(e,t,i,s=!1)=>{if(!E_(e,t,i,s))throw new h_(`'${e}' is invalid: ${JSON.stringify(t)}`)},E_=(e,t,i,s=!1)=>{i=u_[i]||i;const n=s?i(t):Nt(t)||null==t||i(t);return n||null===console||void 0===console||console.error(`'${e}' is invalid: ${JSON.stringify(t)}`),n},I_=(e,t)=>{if(!pt(e))return Ei(D.INVALID_PARAMETER_MESSAGE_TYPE);if(!Ss(e))return Ei(D.MESSAGE_NOT_REGISTERED);const{searchProps:i}=ms(e);if(!i||0===i.length)return gi();return i.every((e=>void 0!==t[e]))?gi():Ei(D.SEARCH_PROPS_LIMIT_ERROR)},T_=(e,t,i)=>f_(Ii.create(e),t,i),f_=(e,t,i)=>(e.isFailed||e.isObject("conversation",t,!0).fail(D.INVALID_PARAMETER_CONVERSATION).validate("conversationType",null==t?void 0:t.conversationType,(()=>W(null==t?void 0:t.conversationType,i)),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE).validate("targetId",null==t?void 0:t.targetId,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("channelId",null==t?void 0:t.channelId,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID),e),R_=(e,t,i)=>(e.check((e=>f_(e,t,B))).check((e=>{const s=null==t?void 0:t.messageType;pt(s)?s===Q.STREAM_MESSAGE&&i.includes("RC_Ext_StreamMsgSummary")&&e.setFailed(D.STREAM_MESSAGE_EXPANSION_KEY_ERROR):e.setFailed(D.INVALID_PARAMETER_MESSAGE_TYPE)})).check((e=>{(null==t?void 0:t.canIncludeExpansion)||e.setFailed(D.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION)})).isNotEmptyString("messageUId",null==t?void 0:t.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isTimestamp("sentTime",null==t?void 0:t.sentTime,!0).fail(D.INVALID_PARAMETER_TIMESTAMP),e),A_=(e,t,i)=>(e.check((e=>{i||e.setFailed(D.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION)})).isObject("expansion",t,!0).fail(D.INVALID_PARAMETER_MESSAGE_EXPANSION).check((e=>{const i=Object.keys(t);if(i.length>20||0===i.length)return void e.setFailed(D.EXPANSION_LIMIT_EXCEET);if(i.some((e=>!/^[A-Za-z0-9_=+-]+$/.test(e)||"string"!=typeof t[e])))return void e.setFailed(D.INVALID_PARAMETER_MESSAGE_EXPANSION);i.some((e=>e.length>32||t[e].length>4096))&&e.setFailed(D.EXPANSION_LIMIT_EXCEET)})),e),p_=(e,t)=>t?(e.isObject("proxy",t,!0).isString("socketHost",t.socksHost,!0).isNumber("socketPort",t.socksPort,!0).isString("socketUsername",t.socksUsername).isString("socketPassword",t.socksPassword).fail(D.INVALID_PARAMETER_PROXY),e):e;const m_=e=>function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);const t=unescape(encodeURIComponent(e)).split("").map((e=>e.charCodeAt(0)));return new Uint8Array(t)}(e).byteLength,S_=e=>({isPersited:!!(16&e),isCounted:!!(32&e),disableNotification:!!(512&e),receivedStatus:!!(2&e)?Re.RETRIEVED:Re.UNREAD,canIncludeExpansion:!!(1024&e)}),v_=(e,t,i,s,n)=>{let r=0;return e&&(r|=16),t&&(r|=32),i&&(r|=64),s&&(r|=512),n&&(r|=1024),r},N_=e=>{const t={};try{const i=JSON.parse(e);Object.entries(i).forEach((([e,i])=>{t[e]=i.v}))}catch(t){console.error(`parseMessageExpansion error: ${e}`,t)}return t},O_=(e,t,i,s)=>{const n=Uc.decode(Ro,e.pbData),r=en(e.topic);let o,a;if(r===$s.recallMsg){const e=JSON.parse(n.content);o=e.conversationType,a=e.targetId}else l=r,o={[$s.ppMsgP]:w.PRIVATE,[$s.pgMsgP]:w.GROUP,[$s.chatMsg]:w.CHATROOM,[$s.ugMsg]:w.ULTRA_GROUP,[$s.pcMsgP]:w.CUSTOMER_SERVICE,[$s.pbMsgP]:w.SYSTEM}[l]||w.PRIVATE,a=e.targetId;var l;const c=![w.GROUP,w.CHATROOM,w.RTC_ROOM,w.ULTRA_GROUP].includes(o),_=c?a:t,d=c?"":a,{isPersited:u,isCounted:h,isMentioned:g,disableNotification:E,canIncludeExpansion:I}=b_(n.sessionId);return{fromUserId:_,type:o,groupId:d,classname:n.classname,content:n.content,dataTime:i,status:v_(u,h,g,E,I),msgId:s,direction:ue.SEND,clientUniqueId:n.clientUniqueId,extraContent:n.extraContent,pushContent:n.pushText,configFlag:n.configFlag,pushExt:n.pushExt,busChannel:n.busChannel,toUserIds:n.toUserIds,optionBits:n.optionBits,refData:n.refData}},y_=(e,t,i=!1,s)=>{const{type:n,classname:r}=e,o=![w.GROUP,w.CHATROOM,w.RTC_ROOM,w.ULTRA_GROUP].includes(n)?s||e.fromUserId:e.groupId||s,{disableNotification:a,receivedStatus:l,canIncludeExpansion:c}=S_(e.status),_=e.direction===ue.SEND?ue.SEND:ue.RECEIVE,d=((e=0,t,i)=>{const{isVoipPush:s,isFilerWhiteBlacklist:n,disablePushTitle:r,forceShowDetailContent:o}=(e=>({isVoipPush:!!(1&e),isFilerWhiteBlacklist:!!(2&e),disablePushTitle:!!(4&e),forceShowDetailContent:!!(8&e)}))(e),a=Zt(null==i?void 0:i.pushConfigs,null==i?void 0:i.pushId);return Object.assign({pushTitle:(null==i?void 0:i.title)||"",pushContent:t||"",pushData:"",disablePushTitle:r,forceShowDetailContent:o,templateId:null==i?void 0:i.templateId},a)})(e.configFlag||0,e.pushContent,e.pushExt),{isInterrupt:u,isModifyMessage:h,isPrivateChannel:g,isStatusMessage:E}=(e=>{const t=e||0;return{isInterrupt:!!(2&t),isModifyMessage:!!(4&t),isPrivateChannel:!!(8&t),isStatusMessage:!!(64&t)}})(e.extStatus);let I,T,f;if(Ss(e.classname)){const t=ms(e.classname);I=t.isCounted,T=t.isPersited,f=!!t.isStatusMessage}else{const t=S_(e.status);I=t.isCounted,T=t.isPersited,f=E||!1}const R=(e=>{let t;try{t=JSON.parse(e)}catch(i){t=e}if(null==t?void 0:t.user){const{portrait:e,portraitUri:i}=t.user,s=e||i;s&&(t.user.portrait=t.user.portraitUri=s)}return t})(e.content),A=e.optionBits||0,p={conversationType:n,targetId:o,senderUserId:_===ue.SEND?t:e.fromUserId,messageType:r,messageUId:e.msgId,isPersited:T,isCounted:I,isMentioned:!!R.mentionedInfo,sentTime:e.dataTime,messageDirection:_,receivedTime:Date.now(),disableNotification:a,receivedStatus:l,receivedStatusInfo:Gt(l),canIncludeExpansion:c,content:R,expansion:e.extraContent?N_(e.extraContent):null,pushConfig:d,channelId:e.busChannel||"",isInterrupt:u,isModifyMessage:h,messageId:e.clientUniqueId||0,sentStatus:ie.SENT,isOffLineMessage:i,channelType:g?X.PRIVATE:X.PUBLIC,isStatusMessage:f,readReceiptInfo:void 0,directedUserIds:e.toUserIds,disableUpdateLastMessage:(1&A)>0,needReceipt:(2&A)>0,sendReceipt:!!(4&A)||void 0,modifyInfo:L_(e.convertExt),extraData:e.extMsgData?{seqId:e.extMsgData.seqId,sentTime:e.extMsgData.sendTime}:void 0,hasReactions:(64&A)>0};return e.refData&&(p.quoteInfo={messageUId:e.refData.msgId,senderId:e.refData.fromUserId,objectName:e.refData.classname,quoteMessageStatus:Pe.DEFAULT}),p},C_=(e,t,i,s=!1,n)=>{const r=y_(t,i,s,n);return r.messageType===Q.RECALL&&e.serverSaveUnread?(r.__innerData__={keepUnreadCount:!(16&t.optionBits)},r):r},M_=(e,t,i,s,n)=>{let r=0;const{isPersited:o,isCounted:a,isStatusMessage:l}=ms(e),c=n||l;return o&&!c&&(r|=1),a&&!c&&(r|=2),t&&(r|=4),i&&(r|=32),s&&(r|=64),r},b_=e=>({isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e),isMentioned:!!(4&e)}),L_=e=>{if(e)try{const{modify:t}=JSON.parse(e);if(t.time)return{timestamp:t.time,content:{},status:Gi.SUCCESS}}catch(t){console.error(`parse message modify info error: ${e}`,t)}},U_=(e,t)=>{const{sentTime:i,messageUId:s,isDelete:n,isAdmin:r,directionalUserIdList:o,extra:a}=e.content,l={recallTime:i,recallActionTime:e.sentTime,admin:!!r,delete:!!n,isDelete:!!n,operatorId:e.senderUserId,extra:a},c=Object.assign(Object.assign({},e),{content:l,messageType:Q.RECALL_NOTIFICATION_MESSAGE});return t&&(c.messageUId=s,c.sentTime=i,c.directedUserIds=o),c};function P_(e){return 1&~((null==e?void 0:e.sessionMode)||0)?Ei(D.RC_REAL_TIME_CONVERSATION_UNAVAILABLE):gi()}function D_(e){return Math.min(e,999)}class w_{constructor(e){Object.defineProperty(this,"_delayTime",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"subscribeData",{enumerable:!0,configurable:!0,writable:!0,value:{[oe.ONLINE_STATUS]:{},[oe.USER_PROFILE]:{}}}),Object.defineProperty(this,"_ownProfile",{enumerable:!0,configurable:!0,writable:!0,value:null})}clearSubscribeRelation(){this.subscribeData={[oe.ONLINE_STATUS]:{},[oe.USER_PROFILE]:{}}}clearSubscribeStatusData(e){e===oe.ONLINE_STATUS?Object.keys(this.subscribeData[e]).forEach((t=>{this.subscribeData[e][t].statusMap={}})):e===oe.USER_PROFILE&&Object.keys(this.subscribeData[e]).forEach((t=>{this.subscribeData[e][t].profile=void 0}))}getSubscribeUserData(e,t){const i=this.subscribeData[e][t];return i?Object.assign({},i):void 0}removeSubscribeUserData(e,t){delete this.subscribeData[e][t]}updateSubscribeUserData(e,t,i){this.subscribeData[e][t]=i}clearExpiredData(e){for(const t in this.subscribeData[e]){const i=this.subscribeData[e][t];i.expiry<(Date.now()+this._delayTime-i.subscribeTime)/1e3&&delete this.subscribeData[e][t]}}getSubscribeUserList(e,t,i){return[...Object.values(this.subscribeData[e])].sort(((e,t)=>e.subscribeTime-t.subscribeTime)).slice(i,i+t)}updateOwnProfile(e){var t;const i=Object.assign(Object.assign({},null===(t=this._ownProfile)||void 0===t?void 0:t.extraProfile),e.extraProfile);this._ownProfile=Object.assign(Object.assign(Object.assign({},this._ownProfile),e),{extraProfile:i})}getOwnProfile(){return this._ownProfile?Object.assign(Object.assign({},this._ownProfile),{extraProfile:Object.assign({},this._ownProfile.extraProfile)}):null}}class G_{constructor(e){Object.defineProperty(this,"_delayTime",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_relationshipStatusVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_subUserStatusVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_ownProfileVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_subStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._subStore=new w_(e)}updateRelationshipStatusVersion(e){e>this._relationshipStatusVersion&&(this._relationshipStatusVersion=e)}getRelationshipStatusVersion(){return this._relationshipStatusVersion}updateSubscribeUserStatusVersion(e){e>this._subUserStatusVersion&&(this._subUserStatusVersion=e)}getSubscribeUserStatusVersion(){return this._subUserStatusVersion}_filterSubscribeRelationData(e){return e.reduce(((e,t)=>(t.subUsers.forEach((i=>{let s=e.find((e=>e.subscribeType===t.subType&&e.userId===i.subUserId));s?s.subscribeTime<t.subTime&&(s.expiry=t.expiry,s.operationType=t.opType,s.subscribeTime=t.subTime):e.push({userId:i.subUserId,subscribeTime:t.subTime,subscribeType:t.subType,expiry:t.expiry,operationType:t.opType})})),e)),[])}updateSubscribeRelation(e,t=!1){const i=[],s=[],n=[];t&&this._subStore.clearSubscribeRelation();return this._filterSubscribeRelationData(e).forEach((e=>{var t,r;const{userId:o,subscribeTime:a,subscribeType:l,expiry:c,operationType:_}=e;if(_===ae.UNSUBSCRIBE)return this._subStore.removeSubscribeUserData(l,o),void n.push(e);const d=this._subStore.getSubscribeUserData(l,o);if(!(d&&d.subscribeTime>=a)){if(l===oe.ONLINE_STATUS){i.push(o);const e=(null===(t=d)||void 0===t?void 0:t.statusMap)||{};this._subStore.updateSubscribeUserData(l,o,{subscribeTime:a,expiry:c,userId:o,subscribeType:l,statusMap:e})}else{s.push(o);const e=null===(r=d)||void 0===r?void 0:r.profile;this._subStore.updateSubscribeUserData(l,o,{subscribeTime:a,expiry:c,userId:o,subscribeType:l,profile:e,isSubscribed:!0})}n.push(e)}})),{newSubscribeOnlineStatusList:i,newSubscribeUserProfileList:s,subscribeUserChangeList:n}}clearSubscribeStatus(){this._subStore.clearSubscribeStatusData(oe.ONLINE_STATUS),this._subStore.clearSubscribeStatusData(oe.USER_PROFILE)}updateSubscribeUserOnlineStatus(e){const t=[];return e.forEach((e=>{const i=e.subUserId,s=e.data,n=this._subStore.getSubscribeUserData(oe.ONLINE_STATUS,i);if(!n)return;const r=[],o=Object.assign({},n.statusMap);s.forEach((e=>{const t=e.platformInfo,i=e.versionTime,s=o[t];if(s&&s.changeTime>i)return;const n={eventValue:e.value,changeTime:i};o[t]=n,r.push(Object.assign(Object.assign({},n),{platform:t}))})),this._subStore.updateSubscribeUserData(oe.ONLINE_STATUS,i,{subscribeTime:n.subscribeTime,expiry:n.expiry,userId:i,subscribeType:oe.ONLINE_STATUS,statusMap:o}),t.push({userId:i,subscribeType:oe.ONLINE_STATUS,subscribeTime:n.subscribeTime,expiry:n.expiry,details:r})})),t}updateSubscribeUserProfile(e){const t=[];return e.forEach((e=>{const{userId:i,version:s,userProfile:n,userExtProfile:r}=e,o=this._subStore.getSubscribeUserData(oe.USER_PROFILE,i),a=xt(i,n,r);o?o.profile&&o.profile.version>=s||(this._subStore.updateSubscribeUserData(oe.USER_PROFILE,i,{subscribeTime:o.subscribeTime,expiry:o.expiry,userId:i,subscribeType:oe.USER_PROFILE,profile:{info:a,version:s},isSubscribed:o.isSubscribed}),o.isSubscribed&&t.push({userId:i,subscribeType:oe.USER_PROFILE,subscribeTime:o.subscribeTime,expiry:o.expiry,userProfile:Object.assign({},a)})):this._subStore.updateSubscribeUserData(oe.USER_PROFILE,i,{subscribeTime:0,expiry:0,userId:i,subscribeType:oe.USER_PROFILE,profile:{info:a,version:s},isSubscribed:!1})})),t}getSubscribeUserStatus(e,t){const i=[];return t.forEach((t=>{const s=this._subStore.getSubscribeUserData(e,t);if(!s||s.expiry<(Date.now()+this._delayTime-s.subscribeTime)/1e3)this._subStore.removeSubscribeUserData(e,t);else{const t={subscribeTime:s.subscribeTime,expiry:s.expiry,userId:s.userId,subscribeType:s.subscribeType};if(e===oe.ONLINE_STATUS){const{statusMap:e}=s,i=Object.keys(e).map((t=>Object.assign({platform:~~t},e[~~t])));t.details=kt(i)}else if(e===oe.USER_PROFILE&&!s.isSubscribed)return;i.push(t)}})),i}getUserProfiles(e){const t=[],i=[];return e.forEach((e=>{const s=this._subStore.getSubscribeUserData(oe.USER_PROFILE,e);if(!s||!s.profile)return void i.push(e);const{version:n,info:r}=s.profile;if(s.isSubscribed)return this._delayTime+Date.now()-n>6048e5?void i.push(e):void t.push(Object.assign(Object.assign({},r),{extraProfile:Object.assign({},r.extraProfile)}));this._delayTime+Date.now()-n>6e5?i.push(e):t.push(Object.assign(Object.assign({},r),{extraProfile:Object.assign({},r.extraProfile)}))})),{list:t,needQueryUserIds:i}}getSubscribeUserList(e,t,i){this._subStore.clearExpiredData(e);return this._subStore.getSubscribeUserList(e,t,i).map((t=>{const i={subscribeTime:t.subscribeTime,expiry:t.expiry,userId:t.userId,subscribeType:t.subscribeType};if(e===oe.ONLINE_STATUS){const e=Object.keys(t.statusMap).map((e=>Object.assign({platform:~~e},t.statusMap[~~e])));i.details=kt(e)}return i}))}updateOwnProfile(e,t){this._ownProfileVersion>t||this._subStore.updateOwnProfile(e)}getOwnProfile(){return this._subStore.getOwnProfile()}}class V_{constructor(e,t,i,s,n,r,o){Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_event",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_delayTime",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_isOpenUserProfile",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_subDriven",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_isPullingRelationship",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullRelationshipQueue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_pullRelationshipFailTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_isPullingSubUserStatus",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullSubUserStatusQueue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_pullSubUserStatusFailTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_subscribeService",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._subscribeService=new G_(s)}syncData(){return t(this,void 0,void 0,(function*(){this._subDriven&&(yield this._syncSubscribeRelationship(!1),yield this._syncSubscribeUserStatus(!0)),this._isOpenUserProfile&&(yield this.syncOwnProfile()),1&this._subDriven&&this._event.syncSubscribeUserStatusFinished(oe.ONLINE_STATUS),2&this._subDriven&&this._event.syncSubscribeUserStatusFinished(oe.USER_PROFILE),3&this._subDriven&&this._event.syncSubscribeUserStatusFinished(oe.FRIEND_ONLINE_STATUS),4&this._subDriven&&this._event.syncSubscribeUserStatusFinished(oe.FRIEND_USER_PROFILE)}))}startSyncSubscribeRelationship(e){return t(this,void 0,void 0,(function*(){this._pullRelationshipQueue.push(e),this._syncSubscribeRelationship()}))}_syncSubscribeRelationship(e=!0){return t(this,void 0,void 0,(function*(){this._isPullingRelationship||(this._isPullingRelationship=!0,yield this._pullSubscribeRelationship(e),this._isPullingRelationship=!1,this._pullRelationshipQueue.length>0&&(this._pullRelationshipQueue.length=0,yield this._syncSubscribeRelationship(e)))}))}_pullSubscribeRelationship(e,i=""){return t(this,void 0,void 0,(function*(){const t=this._subscribeService.getRelationshipStatusVersion(),s=this._logger.createTraceId();this._logger.info(r.L_PULL_SUBSCRIBED_USER_RELATION_T,JSON.stringify({version:t,_pageToken:i}),s);const n=Uc.encode(Ka,{version:t,pageToken:i}),o=yield this._ctx.query($s.pullUserSub,this._currentUserId,n,Qa);if(this._logger.summary(r.L_PULL_SUBSCRIBED_USER_RELATION_R,o,s),!o.isOk)return this._pullRelationshipFailTime++,this._pullRelationshipFailTime>5?void(this._pullRelationshipFailTime=0):this._pullSubscribeRelationship(e,i);this._pullRelationshipFailTime=0;const{list:a,version:l,hasNext:c,pageToken:_}=o.data;if(e){const{newSubscribeOnlineStatusList:e,newSubscribeUserProfileList:t,subscribeUserChangeList:i}=this._subscribeService.updateSubscribeRelation(a);i.length>0&&this._event.subscribeRelationChanged(i),e.length>0&&this._queryAndUpdateUserOnlineStatus(e),t.length>0&&this._queryAndUpdateUserProfile(t)}else this._subscribeService.updateSubscribeRelation(a,!i);this._subscribeService.updateRelationshipStatusVersion(l),this._pullRelationshipQueue=this._pullRelationshipQueue.filter((e=>e>l)),c&&(yield this._pullSubscribeRelationship(e,_))}))}startsyncSubscribeUserStatus(e){return t(this,void 0,void 0,(function*(){this._pullSubUserStatusQueue.push(e),this._syncSubscribeUserStatus()}))}_syncSubscribeUserStatus(e=!1){return t(this,void 0,void 0,(function*(){this._isPullingSubUserStatus||(this._isPullingSubUserStatus=!0,yield this._pullSubscribeUserStatus(e),this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue.length>0&&(this._pullSubUserStatusQueue.length=0,yield this._syncSubscribeUserStatus(e)))}))}_pullSubscribeUserStatus(e=!1,i=""){return t(this,void 0,void 0,(function*(){const t=this._subscribeService.getSubscribeUserStatusVersion(),s=this._logger.createTraceId();this._logger.info(r.L_PULL_SUBSCRIBED_USER_STATUS_T,JSON.stringify({version:t,_pageToken:i,needAllData:e}),s);const n=Uc.encode(Xa,{versionTime:t,needAllData:e,pageToken:i}),o=yield this._ctx.query($s.pullSubData,this._currentUserId,n,za);if(!o.isOk)return this._logger.warn(r.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:o.code,failTime:this._pullSubUserStatusFailTime}),s),this._pullSubUserStatusFailTime++,this._pullSubUserStatusFailTime>5?void(this._pullSubUserStatusFailTime=0):this._pullSubscribeUserStatus(e,i);this._pullSubUserStatusFailTime=0;let{list:a,versionTime:l,hasNext:c,pageToken:_,isFull:d}=o.data;this._logger.info(r.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:o.code}),s),this._pullSubUserStatusQueue=this._pullSubUserStatusQueue.filter((e=>e>l)),this._subscribeService.updateSubscribeUserStatusVersion(l);const u=[],h=[];a.forEach((e=>{switch(e.subType){case oe.ONLINE_STATUS:u.push(e);break;case oe.USER_PROFILE:h.push(e.subUserId);case oe.FRIEND_ONLINE_STATUS:case oe.FRIEND_USER_PROFILE:}})),d&&""===i&&this._subscribeService.clearSubscribeStatus(),u.length>0&&this._updateUserOnlineStatus(u,!d),h.length>0&&(yield this._queryAndUpdateUserProfile(h,!d)),c&&(yield this._pullSubscribeUserStatus(e,_))}))}_queryAndUpdateUserOnlineStatus(e){return t(this,void 0,void 0,(function*(){const t=this._logger.createTraceId();this._logger.info(r.L_QUERY_SUBSCRIBE_DATA_T,JSON.stringify(e),t);const i=Uc.encode($a,{subType:oe.ONLINE_STATUS,subUsers:e.map((e=>({subUserId:e})))}),s=yield this._ctx.query($s.qrySubData,this._currentUserId,i,za);this._logger.summary(r.L_QUERY_SUBSCRIBE_DATA_R,s,t),s.isOk&&this._updateUserOnlineStatus(s.data.list)}))}_updateUserOnlineStatus(e,t=!0){let i=this._subscribeService.updateSubscribeUserOnlineStatus(e);i=i.filter((e=>e.details&&e.details.length>0)),t&&i.length>0&&this._event.subscribeUserStatusChanged(i)}_queryAndUpdateUserProfile(e,i=!0){return t(this,void 0,void 0,(function*(){const t=this._logger.createTraceId();this._logger.info(r.L_PULL_USER_PROFILE_T,JSON.stringify(e),t);const s=Uc.encode(il,{userId:e}),n=new Nr($s.pullUserProfile,s,this._currentUserId),{code:o,data:a}=yield this._ctx.send(n,sl);if(this._logger.info(r.L_PULL_USER_PROFILE_R,JSON.stringify({code:o,data:a}),t),o!==D.SUCCESS)return Ei(o);const l=this._subscribeService.updateSubscribeUserProfile(a.UserProfile);return i&&l.length>0&&this._event.subscribeUserStatusChanged(l),gi(a.UserProfile)}))}updateUserStatus(e){return t(this,void 0,void 0,(function*(){const t=Uc.decode(Za,e.pbData);if(t.subType===oe.ONLINE_STATUS)this._updateUserOnlineStatus([t]);else if(t.subType===oe.USER_PROFILE)this._queryAndUpdateUserProfile([t.subUserId]);else if(t.subType===oe.FRIEND_ONLINE_STATUS){const e=t.data.map((e=>({changeTime:e.versionTime,eventValue:e.value,platform:e.platformInfo})));this._event.subscribeUserStatusChanged([{userId:t.subUserId,subscribeType:t.subType,subscribeTime:0,expiry:0,details:e}])}else if(t.subType===oe.FRIEND_USER_PROFILE){const e=yield this._queryAndUpdateUserProfile([t.subUserId]),{data:i}=e;i&&this._event.subscribeUserStatusChanged([{userId:t.subUserId,subscribeType:t.subType,subscribeTime:0,expiry:0,userProfile:xt(t.subUserId,i[0].userProfile,i[0].userExtProfile)}])}}))}getSubscribeUserStatus(e,t){return this._subscribeService.getSubscribeUserStatus(e,t)}getSubscribeUserList(e,t,i){return this._subscribeService.getSubscribeUserList(e,t,i)}updateSubscribeRelation(e,i,s,n=0){return t(this,void 0,void 0,(function*(){const t=Uc.encode(qa,{subType:i,opType:s,expiry:n,subUsers:e.map((e=>({subUserId:e})))}),r=yield this._ctx.query($s.updUserSub,this._currentUserId,t,Ja),{code:o,data:a,isOk:l}=r;if(o===D.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT)return Ei(o,"",a.subUsers.map((e=>e.subUserId)));if(!l)return r.wipe();const{subTime:c}=a;return this._subscribeService.updateSubscribeRelation([{subType:i,subTime:c,expiry:n,opType:s,subUsers:e.map((e=>({subUserId:e})))}]),s===ae.SUBSCRIBE&&(i===oe.ONLINE_STATUS?this._queryAndUpdateUserOnlineStatus(e):i===oe.USER_PROFILE&&this._queryAndUpdateUserProfile(e,!1)),r.wipe()}))}getUserProfiles(e){return t(this,void 0,void 0,(function*(){const{needQueryUserIds:t,list:i}=this._subscribeService.getUserProfiles(e);if(0===t.length)return gi(i);const s=yield this._queryAndUpdateUserProfile(t,!1);if(!s.isOk)return s.wipe();const n=s.data.map((e=>xt(e.userId,e.userProfile,e.userExtProfile)));return gi([...i,...n])}))}syncOwnProfile(e=!1){return t(this,void 0,void 0,(function*(){if(!this._isOpenUserProfile)return Ei(D.RC_USER_PROFILE_SERVICE_UNAVAILABLE);const t=this._logger.createTraceId();this._logger.info(r.L_PULL_OWN_PROFILE_T,"",t);const i=Uc.encode(nl,{nothing:1}),s=yield this._ctx.query($s.pullOwnProfile,this._currentUserId,i,el);if(this._logger.summary(r.L_PULL_OWN_PROFILE_R,s,t),!s.isOk)return s.wipe();const{userExtProfile:n,userProfile:o,version:a,userId:l}=s.data,c=xt(l,o,n);return this._subscribeService.updateOwnProfile(c,a),e&&this._event.ownUserProfileChanged(c),gi(c)}))}getOwnProfile(){return t(this,void 0,void 0,(function*(){const e=this._subscribeService.getOwnProfile();return e?gi(e):this.syncOwnProfile()}))}updateOwnProfile(e,i){return t(this,void 0,void 0,(function*(){this._subscribeService.updateOwnProfile(e,i)}))}}var k_;class x_ extends Wi{constructor(e,t,i,s){super(e,t,i,s),k_.set(this,gt)}setTimestamp4RealtimeLog(e){s(this,k_,e,"f")}getTimestamp4RealtimeLog(){return i(this,k_,"f")}}k_=new WeakMap;let F_=null;const B_="RC_LOGS",H_="RC_STATISTICS",j_={[B_]:["level","time"],[H_]:["level","time"]},Y_=(e,t,i)=>new Promise((s=>{const n=e.transaction(t,"readwrite").objectStore(t).index("time"),r=IDBKeyRange.upperBound(Date.now()-i),o=n.openCursor(r);o.onsuccess=e=>{const t=e.target.result;t?(t.delete(),t.continue()):s()},o.onerror=()=>{s()}}));let W_=null;const q_=e=>t(void 0,void 0,void 0,(function*(){const t=yield F_;if(!t)return;const{db:i}=t;yield Y_(i,B_,e),yield Y_(i,H_,e),W_=setTimeout((()=>q_(e)),6e5)})),J_=(e,t,i=168)=>{F_||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==Eo.runtimeInfo.type?F_=new Promise((s=>{const n=window.indexedDB;(e=>{const t=window.indexedDB;t.databases&&t.databases().then((i=>{i.forEach((i=>{i.name&&e.includes(i.name)&&t.deleteDatabase(i.name)}))}))})(["RC_ENGINE_DB",`RC_STATISTIC_${e}`]);const o=`RC_LOGS_${e}`,a=n.open(o,2);a.onerror=e=>{t.error(r.L_LOGDB_OPEN_FAILED_E,e.target.error),s(null)},a.onsuccess=n=>{const o=n.target.result;o?(o.onclose=e=>{F_=null,t.warn(r.L_LOGDB_CLOSED_S)},o.onerror=e=>{F_=null,t.error(r.L_LOGDB_ERROR_E,e.target.error)},o.onabort=e=>{t.info(r.L_LOGDB_ABORT_S,e.target.error)},q_(3600*Math.max(24,Math.min(168,i))*1e3),s({appkey:e,db:o})):s(null)},a.onupgradeneeded=e=>{const t=e.target.result;Object.keys(j_).forEach((e=>{t.objectStoreNames.contains(e)&&t.deleteObjectStore(e);const i=t.createObjectStore(e,{autoIncrement:!0});j_[e].forEach((e=>i.createIndex(e,e,{unique:!1})))}))}})):t.warn(r.L_UNSUPPORT_INDEXDB_O))},K_=[],Q_=(e,t,i)=>new Promise((s=>{const n=e.transaction(t,"readwrite");n.oncomplete=s,n.onabort=s;const r=n.objectStore(t);i.forEach((e=>{try{r.add(e)}catch(t){null===console||void 0===console||console.error("write failed ->",e,t)}}))})),X_=[];let z_=!1;const Z_=e=>t(void 0,void 0,void 0,(function*(){if(z_||0===X_.length)return;z_=!0;const t=X_.filter((e=>e.level<Yi.FATAL)),i=X_.filter((e=>e.level>=Yi.FATAL));X_.length=0,yield Q_(e,B_,i),yield Q_(e,H_,t),z_=!1,0===X_.length&&K_.length>0&&(K_.forEach((e=>e.close())),K_.length=0),setTimeout((()=>Z_(e)))})),$_=()=>{const e=os();return e.setLogReader(((e,i,s,n,r=B_)=>t(void 0,void 0,void 0,(function*(){const t=yield F_;return t?new Promise((o=>{const{db:a}=t,l=a.transaction(r,"readonly").objectStore(r),c=[],_=IDBKeyRange.bound(e,i),d=l.index("time").openCursor(_);d.onsuccess=e=>{const t=e.target.result;if(t){const e=t.value;e.level<=s&&(n?e.sessionId===ht:e.level>=0)&&c.push(e),t.continue()}else o({logs:c})},d.onerror=()=>{o({logs:[]})}})):{logs:[]}})))),e.setLogWriter((e=>{(e=>{t(void 0,void 0,void 0,(function*(){const t=yield F_;if(t){if(e.content&&Et(e.content))try{e.content=JSON.parse(e.content)}catch(e){}X_.push(e),Z_(t.db)}}))})(e)})),e},ed=144e5;if("undefined"!=typeof window){const e=(e,t)=>{const i=t.map((({sessionId:e,time:t,type:i,level:s,tag:n,traceId:r,loggerId:o,content:a})=>`${e},${t},${i},${s},${n},${r},${o},"${a}"\n`)),s=new Blob(i,{type:"text/csv"}),n=URL.createObjectURL(s),r=document.createElement("a");r.href=n,r.download=`${e}.csv`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)};window.__rongcloud_devtools__={logger:{get(i,s=Date.now()-ed,n=Date.now()){return t(this,void 0,void 0,(function*(){s=s<0?Date.now()+s:s,(n=n<=0?Date.now():n)-s>ed&&(s=n-ed);const t=os(),o=new x_(i,"RC-IM","IM",t);o.debug(r.T,`get logs: startTime ${s} endTime ${n}`),J_(i,o);const{logs:a}=yield t.read(s,n,Yi.DEBUG,!1);o.debug(r.T,`get logs ${a.length}`),e(`${i}-${s}-${n}`,a)}))}}}}class td extends qi{constructor(e,t,i,s,n){const{type:r,version:o}=Eo.runtimeInfo;super(e,`${r}|${o}|${t.getSessionId()}|${Eo.connectPlatform}`,s,t),Object.defineProperty(this,"tableName",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"appStorage",{enumerable:!0,configurable:!0,writable:!0,value:n})}getDeviceId(){return this.appStorage.deviceId}send(e){return Eo.httpReq(e)}checkStart(e){const i=Object.create(null,{checkStart:{get:()=>super.checkStart}});return t(this,void 0,void 0,(function*(){return yield((e,i)=>t(void 0,void 0,void 0,(function*(){const t=i.get("logReporter");t[`REPORT_SESSION_${e}`]={sessionId:ht},i.set("logReporter",t)})))(e.userId,this.appStorage),i.checkStart.call(this,e,this.tableName)}))}compressLogs(e){return t(this,void 0,void 0,(function*(){return{success:!0,data:Vs(e.map(Ji).join(""))}}))}realtimeReport(e,i,s){const n=Object.create(null,{realtimeReport:{get:()=>super.realtimeReport}});return t(this,void 0,void 0,(function*(){return n.realtimeReport.call(this,e,i,s,this.tableName)}))}}class id extends td{constructor(e,t,i){super(e,t,B_,t.proxy,i)}isReporter(){return t(this,void 0,void 0,(function*(){const e=yield((e,i)=>t(void 0,void 0,void 0,(function*(){const t=i.get("logReporter")[`REPORT_SESSION_${e}`];return(null==t?void 0:t.sessionId)===ht})))(this.userId,this.appStorage);return e}))}report(e,i,s,n,r,o,a=!1){const l=Object.create(null,{report:{get:()=>super.report}});return t(this,void 0,void 0,(function*(){const t=yield this.isReporter();if(!this.userId||t)return l.report.call(this,e,i,s,n,r,o,a)}))}}class sd extends td{constructor(e,t,i){super(e,t,H_,t.proxy,i)}}var nd,rd,od,ad,ld;class cd extends di{constructor(e,t,s){super("WebConversationSettings"),nd.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_storage",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:s}),rd.set(this,!1),this._ctx.on("sCmd",i(this,nd,"m",ad),this),this._ctx.on("onConnected",i(this,nd,"m",od),this)}_handleSyncData(e){return t(this,void 0,void 0,(function*(){return(yield i(this,nd,"m",ld).call(this,e)).trans((()=>({version:this._storage.get("conversationStatusVersion")})))}))}syncDataFromServer(){return t(this,void 0,void 0,(function*(){const e=this._storage.get("conversationStatusVersion");return yield i(this,nd,"m",ld).call(this,e),this._storage.get("conversationStatusVersion")}))}}rd=new WeakMap,nd=new WeakSet,od=function(){s(this,rd,!0,"f")},ad=function(e,t){const{type:i,time:s}=t;if(3===i)this.push(s),e.stopPropagation()},ld=function(e){return t(this,void 0,void 0,(function*(){const{logger:t}=this._ctx,n=t.createTraceId();t.info(r.L_PULL_CONVERSATION_SETTINGS_T,JSON.stringify({version:e}),n);const o=Uc.encode(ra,{time:e}),a=yield this._ctx.query($s.pullSeAtts,this._ctx.currentUserId,o,oa);if(a.isOk){const e=this._storage.updateBySessionStates(a.data.state);e.length&&this._emitter.emit("conversationStatusChanged",e)}const l=this._storage.get("conversationStatusVersion");return t.summary(r.L_PULL_CONVERSATION_SETTINGS_R,a,n,{version:e,nextVersion:l},(e=>({respVer:e.version}))),i(this,rd,"f")&&(s(this,rd,!1,"f"),this._emitter.emit("conversationStatusSynced",a.code)),a.wipe()}))};class _d{constructor(){Object.defineProperty(this,"_memData",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}syncDataFromLocalStorage(e){this._memData=this._syncDataHandler(e)}get(e){return this._memData[e].value}set(e,t){const i=this._memData[e],{key:s,stringify:n}=i;i.value=t;const r=n?JSON.stringify(t):t;Eo.localStorage.setItem(s,r)}delete(e){const t=this._memData[e];delete this._memData[e];const{key:i}=t;Eo.localStorage.removeItem(i)}}const dd=e=>{var t;return`${null!==(t=e.channelId)&&void 0!==t?t:""}_${e.conversationType}_${e.targetId}`},ud=e=>{const[t,i,...s]=e.split("_");return{channelId:t,conversationType:parseInt(i,10),targetId:s.join("_")}};var hd,gd,Ed,Id,Td;function fd(e){if(!e)return;if(Array.isArray(e))return e;return Object.entries(e).map((([e,{isTop:t}])=>({tagId:e,isTop:t})))}const Rd=()=>({latestMessage:null,lastReadTime:0,firstUnreadMessageType:"",firstUnreadMessageUId:"",firstUnreadTime:0,unreadCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,hasMentioned:!1,mentionedInfo:void 0,isTop:!1,notificationLevel:Ee.NOT_SET,translateStrategy:Ms.DEFAULT,tags:[],channelType:X.PUBLIC,operationTime:0,draft:"",hidden:!1,includeRobot:!1,version:0});class Ad{constructor(e){hd.set(this,void 0),gd.set(this,void 0),Ed.set(this,void 0),Id.set(this,Rd()),Td.set(this,[]),s(this,hd,e.conversationType,"f"),s(this,gd,e.targetId,"f"),s(this,Ed,e.channelId||"","f")}get conversationType(){return i(this,hd,"f")}get targetId(){return i(this,gd,"f")}get channelId(){return i(this,Ed,"f")}get version(){return i(this,Id,"f").version||0}get channelType(){return i(this,Id,"f").channelType}get hidden(){return!!i(this,Id,"f").hidden}get isTop(){return!!i(this,Id,"f").isTop}get notificationLevel(){return i(this,Id,"f").notificationLevel||Ee.NOT_SET}get translateStrategy(){return i(this,Id,"f").translateStrategy||Ms.DEFAULT}get tags(){return(i(this,Id,"f").tags||[]).map((e=>({tagId:e.tagId,isTop:e.isTop})))}get unreadCount(){return i(this,Id,"f").unreadCount||0}get unreadMentionedCount(){return i(this,Id,"f").unreadMentionedCount||0}get unreadMentionedMeCount(){return i(this,Id,"f").unreadMentionedMeCount||0}get hasMentioned(){return!!i(this,Id,"f").hasMentioned}get mentionedInfo(){return i(this,Id,"f").mentionedInfo}get lastReadTime(){return i(this,Id,"f").lastReadTime||0}get firstUnreadTime(){return i(this,Id,"f").firstUnreadTime||0}get firstUnreadMessageUId(){return i(this,Id,"f").firstUnreadMessageUId||""}get firstUnreadMessageType(){return i(this,Id,"f").firstUnreadMessageType||""}get latestMessage(){return i(this,Id,"f").latestMessage||null}get operationTime(){return i(this,Id,"f").operationTime||0}get draft(){return i(this,Id,"f").draft||""}get firstUnreadMessage(){return this.firstUnreadTime?{sentTime:this.firstUnreadTime,messageType:this.firstUnreadMessageType,messageUId:this.firstUnreadMessageUId}:null}get identifier(){return{conversationType:i(this,hd,"f"),targetId:i(this,gd,"f"),channelId:i(this,Ed,"f")}}get key(){return dd(this.identifier)}get includeRobot(){return!!i(this,Id,"f").includeRobot}toIReceivedConversation(){return Object.assign(Object.assign({},this.identifier),{latestMessage:this.latestMessage,unreadMessageCount:this.unreadCount,unreadMentionedCount:this.unreadMentionedCount,unreadMentionedMeCount:this.unreadMentionedMeCount,hasMentioned:this.hasMentioned,mentionedInfo:this.mentionedInfo,lastUnreadTime:0,notificationLevel:this.notificationLevel,translateStrategy:this.translateStrategy,notificationStatus:fe(this.notificationLevel),isTop:this.isTop,operationTime:this.operationTime,firstUnreadMessage:this.firstUnreadMessage,versionTime:0,draft:this.draft,includeRobot:this.includeRobot})}toStoragItem(e){const t={};return this.hidden&&(t.h=1),e||(this.isTop&&(t.to=1),this.notificationLevel!==Ee.NOT_SET&&(t.nl=this.notificationLevel),this.tags.length>0&&(t.tg=this.tags),this.translateStrategy!==Ms.DEFAULT&&(t.ts=this.translateStrategy)),t}remove(){this.updateAttrs(Object.assign(Object.assign({},Rd()),{tags:this.tags,isTop:this.isTop,notificationLevel:this.notificationLevel,translateStrategy:this.translateStrategy,hidden:!0}))}clearUnreadCount(e){const t={unreadCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,hasMentioned:!1,mentionedInfo:void 0,lastReadTime:e,firstUnreadTime:0,firstUnreadMessageType:void 0,firstUnreadMessageUId:void 0};return t.version=Math.max(this.version,e),this.updateAttrs(t,e)}updateAttrs(e,t=0){const s={},n={latestMessage:"latestMessage",unreadCount:"unreadMessageCount",hasMentioned:"hasMentioned",mentionedInfo:"mentionedInfo",notificationLevel:"notificationLevel",tags:"tags",isTop:"isTop",translateStrategy:"translateStrategy",unreadMentionedCount:"unreadMentionedCount",unreadMentionedMeCount:"unreadMentionedMeCount",lastReadTime:void 0,firstUnreadMessageType:void 0,firstUnreadMessageUId:void 0,firstUnreadTime:void 0,channelType:void 0,operationTime:void 0,draft:void 0,includeRobot:void 0,hidden:void 0,version:void 0};return Object.entries(n).forEach((([n,r])=>{const o=n;if(!Object.prototype.hasOwnProperty.call(e,o))return;const a=e[o];i(this,Id,"f")[o]!==a&&(i(this,Id,"f")[o]=a,r&&(s[r]={time:t,val:a}))})),Object.keys(s).length>0?s:null}addRecvMessageRecord(e,t,s){i(this,Td,"f").push([e,t,s]),this.removeRecvMessageRecords(e-12e4)}removeRecvMessageRecords(e){s(this,Td,i(this,Td,"f").filter((([t])=>t<=e)),"f")}calibrateUnreadCount(e,t){const{mentionCnt:s,mentionMeCnt:n,clearTime:r,firstUnreadMsg:o,cnt:a}=e,l=e.cutOffTime,c=s>0,_=n>0,d=c?{type:_?K.SINGAL:K.ALL,userIdList:_?[t]:void 0}:void 0,u={unreadCount:a,unreadMentionedCount:s,unreadMentionedMeCount:n,lastReadTime:r,firstUnreadTime:null==o?void 0:o.msgTime,firstUnreadMessageType:null==o?void 0:o.className,firstUnreadMessageUId:null==o?void 0:o.msgId,hasMentioned:c,mentionedInfo:d,version:l};i(this,Td,"f").forEach((([e,t,i])=>{e<=l||(u.version=Math.max(u.version,e),u.unreadCount+=t,i===K.SINGAL?u.unreadMentionedMeCount+=t:i===K.ALL&&(u.unreadMentionedCount+=t))}));const h=this.updateAttrs(u,r);return this.removeRecvMessageRecords(l),h}}hd=new WeakMap,gd=new WeakMap,Ed=new WeakMap,Id=new WeakMap,Td=new WeakMap;class pd extends Ad{toStoragItem(e){const t=super.toStoragItem(e);return this.unreadCount>0&&(t.c=this.unreadCount),this.unreadMentionedCount>0&&(t.mc=this.unreadMentionedCount),this.unreadMentionedMeCount>0&&(t.mmc=this.unreadMentionedMeCount),this.hasMentioned&&(t.hm=1),this.mentionedInfo&&(t.m=this.mentionedInfo),this.firstUnreadMessageUId&&(t.fuid=this.firstUnreadMessageUId),this.firstUnreadMessageType&&(t.fumt=this.firstUnreadMessageType),this.firstUnreadTime&&(t.fut=this.firstUnreadTime),this.lastReadTime&&(t.rt=this.lastReadTime),this.version&&(t.v=this.version),t}}class md extends Ad{toIReceivedConversation(){const e=super.toIReceivedConversation();return e.channelType=this.channelType,e}isDefaultChannel(){return!this.channelId||"RCDefault"===this.channelId}}var Sd,vd,Nd;const Od=e=>`${e.targetId}_${e.channelId||""}`;class yd extends _d{constructor(e){super(),Sd.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_conversationCachePolicy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"models",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"ugSentRecord",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const t=this._ctx.initOptions.conversationCachePolicy;this._conversationCachePolicy=t?{limit:"number"==typeof t.limit?t.limit:1e3,ultraGroupLimit:"number"==typeof t.ultraGroupLimit?t.ultraGroupLimit:5e3,customEviction:"function"==typeof t.customEviction?t.customEviction:void 0}:void 0}get enableReadReceiptStorage(){return this._ctx.initOptions.enableReadReceiptStorage}_syncDataHandler(e){const{localStorage:t}=Eo,{appkey:s,currentUserId:n,isDisableEmptyUGChannelId:r,isMemSesAttrs:o}=e,a=$e(s,n),l=Ze(s,n),c=et(s,n),_=Qe(s,n),d=Ke(s,n),u=Xe(s,n),h=ze(s,n),g=it(s,n),E=ot(s,n);t.removeItem(`RC-con-s-ver-${s}-${n}`),o&&t.removeItem(d),this.ugSentRecord.clear();const I=t.getItem(a)||"0",T=t.getItem(l)||"0",f=t.getItem(c)||"1",R=t.getItem(d)||"0",A=JSON.parse(t.getItem(h)||"{}"),p=JSON.parse(t.getItem(_)||"{}"),m=JSON.parse(t.getItem(u)||"{}"),S=JSON.parse(t.getItem(g)||"{}"),v=JSON.parse(t.getItem(E)||"{}");i(this,Sd,"m",vd).call(this,p,m,A,r);const N=Object.entries(v);N.length>0&&N.forEach((([e,t])=>{Object.entries(t).forEach((([e,i])=>{delete i.d,i.t<this._ctx.serverTime-We&&delete t[e]})),0===Object.keys(t).length&&delete v[e]}));return{inboxTime:{value:parseInt(I,10)||0,key:a},outboxTime:{value:parseInt(T,10)||0,key:l},broadcastTime:{value:parseInt(f,10)||0,key:c},conversationStatus:{value:p,key:_,stringify:!0},ultraGroupStatus:{value:m,key:u,stringify:!0},conversationStatusVersion:{value:parseInt(R,10)||0,key:d},conversationTypeGlobalSettings:{value:A,key:h,stringify:!0},sentRecord:{value:S,key:g,stringify:!0},readReceiptRecord:{value:v,key:E,stringify:!0}}}addUGSentRecord(e,t){this.ugSentRecord.set(e,t)}removeUGSentRecordByTimestamp(e){Array.from(this.ugSentRecord.entries()).forEach((([t,i])=>{i<=e&&this.ugSentRecord.delete(t)}))}isLocalSentUGMessage(e){return this.ugSentRecord.has(e)}addSentRecord(e,t){const i=this.get("sentRecord");i[e]=t,this.set("sentRecord",i)}removeSentRecord(e){const t=this.get("sentRecord");delete t[e],this.set("sentRecord",t)}removeSentRecordByTimestamp(e){const t=this.get("sentRecord");Object.keys(t).forEach((i=>{t[i]<=e&&delete t[i]})),this.set("sentRecord",t)}hasSentRecord(e){return!!this.get("sentRecord")[e]}addReadReceiptRequest(e,t){const{conversationType:i,content:s,senderUserId:n,sentTime:r}=e,{messageUId:o}=s;if(i!==w.GROUP||!o)return!1;if(!this.enableReadReceiptStorage)return!0;if(r<this._ctx.serverTime-We)return!1;const a=this.get("readReceiptRecord"),l=Od(e),c=a[l]=a[l]||{};c[o]={t:e.sentTime,sId:n===t?void 0:n};const _=Object.entries(c);if(_.length>30){const[e,t]=_.sort(((e,t)=>e[1].t-t[1].t)).pop();delete c[e]}return this.set("readReceiptRecord",a),!0}handleReadReceiptResponse(e,t){const{conversationType:i,content:s,senderUserId:n,sentTime:r}=e;if(i!==w.GROUP||!s.receiptMessageDic)return!1;if(!this.enableReadReceiptStorage)return!0;const o=n===t,{receiptMessageDic:a}=s,l=Od(e),c=this.get("readReceiptRecord"),_=c[l]=c[l]||{};if(o)Object.entries(a).forEach((([e,t])=>{t.forEach((e=>{delete _[e]}))})),0===Object.keys(_).length&&delete c[l];else{(a[t]||[]).forEach((e=>{const t=_[e];t&&(t.us=(t.us||[]).concat(n))}))}return this.set("readReceiptRecord",c),!0}getReadReceiptResponseUsers(e,t){var i;return(null===(i=(this.get("readReceiptRecord")[Od(e)]||{})[t])||void 0===i?void 0:i.us)||[]}createReadReceiptResponseContent(e){const t=this.get("readReceiptRecord")[Od(e)]||{},i={receiptMessageDic:{}};return Object.entries(t).forEach((([e,t])=>{t.sId&&(i.receiptMessageDic[t.sId]=i.receiptMessageDic[t.sId]||[],i.receiptMessageDic[t.sId].push(e))})),i}syncDataFromLocalStorage(e){super.syncDataFromLocalStorage(e),this.models.clear(),i(this,Sd,"m",Nd).call(this)}setConversationTypeNotificationLevel(e,t){const i=this.get("conversationTypeGlobalSettings");t===Ee.NOT_SET?delete i[e]:i[e]={nl:t},this.set("conversationTypeGlobalSettings",i)}getConversationTypeNotificationLevel(e){var t;return(null===(t=this.get("conversationTypeGlobalSettings")[e])||void 0===t?void 0:t.nl)||Ee.NOT_SET}getOrCreateModel(e,t){const{conversationType:i,targetId:s,channelId:n}=e;let r=this.getModel(e);if(!r){r=e.conversationType===w.ULTRA_GROUP?new md(e):new pd(e);const n=(i===w.PRIVATE||i===w.SYSTEM)&&this._ctx.robots.some((e=>e.robotId===s));r.updateAttrs({includeRobot:n}),t&&this.models.set(r.key,r)}return r}updateConversationStorage(e){const t=this.get("ultraGroupStatus"),i=this.get("conversationStatus");let s=!1,n=!1;const{isMemSesAttrs:r}=this._ctx;e.forEach((e=>{const{conversationType:o,key:a}=e,l=e.toStoragItem(r),c=Object.keys(l),_=0===c.length||1===c.length&&"h"===c[0],d=o===w.ULTRA_GROUP;d?n=!0:s=!0;const u=d?t:i;_?delete u[a]:u[a]=l})),s&&this._updateConversationStorage("conversationStatus",i),n&&this._updateConversationStorage("ultraGroupStatus",t)}_updateConversationStorage(e,t){if(!this._conversationCachePolicy)return void this.set(e,t);const{limit:i,ultraGroupLimit:s,customEviction:n}=this._conversationCachePolicy;if("ultraGroupStatus"===e&&this._ctx.isMemSesAttrs)return;const o="conversationStatus"===e?i:s;let a=Object.entries(t);if(a.length<=o)return void this.set(e,t);let l=a.map((([e,t])=>this.getModel(ud(e)))).filter((e=>!!e));if(n){const e=l.map((e=>e.toIReceivedConversation()));try{a=n(e).map((e=>{const i=dd(e);return[i,t[i]]})).filter((e=>!!e[1]))}catch(e){this._ctx.logger.error(r.L_EXEC_CUSTOM_CONVERSATION_STORAGE_EVICTION_E,(null==e?void 0:e.message)||"unknown error")}}else l=this._defaultEviction(l,o),a=l.map((e=>{const{key:i}=e;return[i,t[i]]})).filter((e=>!!e[1]));this.set(e,Object.fromEntries(a))}_defaultEviction(e,t){return e.sort(((e,t)=>{const i=e.version,s=t.version,n=e.isTop?1:0;return(t.isTop?1:0)-n||s-i})).slice(0,t)}updateBySessionStates(e){if(!(null==e?void 0:e.length))return[];let t=this.get("conversationStatusVersion");const i=new Map,s=new Set;e.forEach((e=>{const{channelId:n,busChannel:r,type:o,stateItem:a}=e,l=e.time;t=Math.max(t,l);const c={};if(null==a||a.forEach((e=>{const{tags:t,sessionStateType:i,value:s}=e;switch(i){case Cc.IsSilent:c.notificationLevel=parseInt(s,10);break;case Cc.IsTop:c.isTop="1"===s;break;case Cc.Tags:c.tags=t;break;case Cc.AutoTrans:c.translateStrategy=parseInt(s,10)}})),!n)return void(void 0!==c.notificationLevel&&this.setConversationTypeNotificationLevel(o,c.notificationLevel));const _={conversationType:o,targetId:n,channelId:r},d=this.getOrCreateModel(_,!0);s.add(d);const u=d.updateAttrs(c,l);if(u)if(i.has(d)){const e=i.get(d);Object.assign(e,u)}else i.set(d,u)})),this.set("conversationStatusVersion",t),this.updateConversationStorage(Array.from(s));return Array.from(i.entries()).map((([e,t])=>({conversation:e.toIReceivedConversation(),updatedItems:t})))}addRelations(e,t){e.forEach((e=>{const{userId:i,type:s,busChannel:n}=e,r={conversationType:s,targetId:i,channelId:n},o=this.getOrCreateModel(r,!0),a=((e,t)=>{var i,s,n;const{msg:r,isBot:o}=e;return{latestMessage:r?y_(r,t,!1,e.userId):void 0,lastReadTime:e.readMsgTime,unreadCount:e.unreadCount,operationTime:e.versionTime,unreadMentionedCount:e.remindCount,unreadMentionedMeCount:e.remindMeCount,firstUnreadMessageType:null===(i=e.msgInfo)||void 0===i?void 0:i.className,firstUnreadMessageUId:null===(s=e.msgInfo)||void 0===s?void 0:s.msgId,firstUnreadTime:null===(n=e.msgInfo)||void 0===n?void 0:n.msgTime,includeRobot:!!o}})(e,t);s===w.ULTRA_GROUP?o.updateAttrs(a):o.updateAttrs({latestMessage:a.latestMessage,operationTime:a.operationTime,includeRobot:a.includeRobot,hidden:!1})}))}getDrafts(e){const t=this.getModel(e);return(null==t?void 0:t.draft)||""}setDrafts(e,t){this.getOrCreateModel(e,!0).updateAttrs({draft:t})}deleteDrafts(e){const t=this.getModel(e);t&&t.updateAttrs({draft:""})}getCachedUGConversation(e,t){const i={conversationType:w.ULTRA_GROUP,targetId:e,channelId:t},s=this.getModel(i);return(null==s?void 0:s.toIReceivedConversation())||null}getAllUGModels(){const e=this.models.values();return Array.from(e).filter((e=>e.conversationType===w.ULTRA_GROUP)).map((e=>e))}getAllSGModels(){const e=this.models.values();return Array.from(e).filter((e=>e.conversationType!==w.ULTRA_GROUP)).map((e=>e))}getAllModels(){return Array.from(this.models.values())}getModel(e){const{conversationType:t,targetId:i}=e,s=dd(e),n=this.models.get(s);if(!n)return null;const r=(t===w.PRIVATE||t===w.SYSTEM)&&this._ctx.robots.some((e=>e.robotId===i));return n.updateAttrs({includeRobot:r}),n}removeConversation(e){const t=this.getModel(e);t&&(t.remove(),this.updateConversationStorage([t]))}getAllUnreadCount(e,t){let i=0;return this.getAllSGModels().forEach((s=>{var n;const{conversationType:r}=s;e.includes(r)&&(s.notificationLevel>Ee.NOT_SET&&!t||(i+=null!==(n=s.unreadCount)&&void 0!==n?n:0))})),i}getTagConversationCountMap(){const e=new Map;return this.getAllModels().forEach((t=>{const{tags:i}=t;i.length>0&&i.forEach((i=>{e.set(i.tagId,(e.get(i.tagId)||[]).concat(t.identifier))}))})),e}clearConversationUnreadCount(e,t){const i=this.getModel(e);if(!i)return null;const s=i.clearUnreadCount(t);return this.updateConversationStorage([i]),s?{conversation:i.toIReceivedConversation(),updatedItems:s}:null}}Sd=new WeakSet,vd=function(e,t,i,s){Object.keys(e).forEach((t=>{const s=ud(t);W(s.conversationType,G)?s.targetId||(i[s.conversationType]={nl:e[t].nl||Ee.NOT_SET},delete e[t]):delete e[t]})),Object.keys(t).forEach((e=>{const n=ud(e);if(n.conversationType===w.ULTRA_GROUP)return n.targetId?void(s&&!n.channelId&&delete t[e]):(i[n.conversationType]={nl:t[e].nl||Ee.NOT_SET},void delete t[e]);delete t[e]}))},Nd=function(){[...Object.entries(this.get("conversationStatus")),...Object.entries(this.get("ultraGroupStatus"))].forEach((([e,t])=>{const i=ud(e);if(!W(i.conversationType,k))return;this.getOrCreateModel(i,!0).updateAttrs((e=>{const{c:t,mc:i,mmc:s,hm:n,m:r,fut:o,fuid:a,fumt:l,nl:c,to:_,tg:d,rt:u,h:h,ts:g,v:E}=e;return{isTop:!!_,notificationLevel:c,tags:fd(d),unreadCount:t,unreadMentionedCount:i,unreadMentionedMeCount:s,hasMentioned:!!n,mentionedInfo:r,firstUnreadTime:o,firstUnreadMessageUId:a,firstUnreadMessageType:l,lastReadTime:u,hidden:!!h,translateStrategy:g,version:E||u}})(t),0)}))};function Cd(e){let t=e.length;for(;--t>=0;)e[t]=0}const Md=256,bd=286,Ld=30,Ud=15,Pd=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]),Dd=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]),wd=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Gd=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vd=new Array(576);Cd(Vd);const kd=new Array(60);Cd(kd);const xd=new Array(512);Cd(xd);const Fd=new Array(256);Cd(Fd);const Bd=new Array(29);Cd(Bd);const Hd=new Array(Ld);function Yd(e,t,i,s,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=n,this.has_stree=e&&e.length}let Wd,qd,Jd;function Kd(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}Cd(Hd);const Qd=e=>e<256?xd[e]:xd[256+(e>>>7)],Xd=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},zd=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,Xd(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)},Zd=(e,t,i)=>{zd(e,i[2*t],i[2*t+1])},$d=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},eu=(e,t,i)=>{const s=new Array(16);let n,r,o=0;for(n=1;n<=Ud;n++)o=o+i[n-1]<<1,s[n]=o;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=$d(s[t]++,t))}},tu=e=>{let t;for(t=0;t<bd;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Ld;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},iu=e=>{e.bi_valid>8?Xd(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},su=(e,t,i,s)=>{const n=2*t,r=2*i;return e[n]<e[r]||e[n]===e[r]&&s[t]<=s[i]},nu=(e,t,i)=>{const s=e.heap[i];let n=i<<1;for(;n<=e.heap_len&&(n<e.heap_len&&su(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!su(t,s,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=s},ru=(e,t,i)=>{let s,n,r,o,a=0;if(0!==e.sym_next)do{s=255&e.pending_buf[e.sym_buf+a++],s+=(255&e.pending_buf[e.sym_buf+a++])<<8,n=e.pending_buf[e.sym_buf+a++],0===s?Zd(e,n,t):(r=Fd[n],Zd(e,r+Md+1,t),o=Pd[r],0!==o&&(n-=Bd[r],zd(e,n,o)),s--,r=Qd(s),Zd(e,r,i),o=Dd[r],0!==o&&(s-=Hd[r],zd(e,s,o)))}while(a<e.sym_next);Zd(e,256,t)},ou=(e,t)=>{const i=t.dyn_tree,s=t.stat_desc.static_tree,n=t.stat_desc.has_stree,r=t.stat_desc.elems;let o,a,l,c=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<r;o++)0!==i[2*o]?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):i[2*o+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,i[2*l]=1,e.depth[l]=0,e.opt_len--,n&&(e.static_len-=s[2*l+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)nu(e,i,o);l=r;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],nu(e,i,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,i[2*l]=i[2*o]+i[2*a],e.depth[l]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,i[2*o+1]=i[2*a+1]=l,e.heap[1]=l++,nu(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,s=t.max_code,n=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let c,_,d,u,h,g,E=0;for(u=0;u<=Ud;u++)e.bl_count[u]=0;for(i[2*e.heap[e.heap_max]+1]=0,c=e.heap_max+1;c<573;c++)_=e.heap[c],u=i[2*i[2*_+1]+1]+1,u>l&&(u=l,E++),i[2*_+1]=u,_>s||(e.bl_count[u]++,h=0,_>=a&&(h=o[_-a]),g=i[2*_],e.opt_len+=g*(u+h),r&&(e.static_len+=g*(n[2*_+1]+h)));if(0!==E){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,E-=2}while(E>0);for(u=l;0!==u;u--)for(_=e.bl_count[u];0!==_;)d=e.heap[--c],d>s||(i[2*d+1]!==u&&(e.opt_len+=(u-i[2*d+1])*i[2*d],i[2*d+1]=u),_--)}})(e,t),eu(i,c,e.bl_count)},au=(e,t,i)=>{let s,n,r=-1,o=t[1],a=0,l=7,c=4;for(0===o&&(l=138,c=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)n=o,o=t[2*(s+1)+1],++a<l&&n===o||(a<c?e.bl_tree[2*n]+=a:0!==n?(n!==r&&e.bl_tree[2*n]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,r=n,0===o?(l=138,c=3):n===o?(l=6,c=3):(l=7,c=4))},lu=(e,t,i)=>{let s,n,r=-1,o=t[1],a=0,l=7,c=4;for(0===o&&(l=138,c=3),s=0;s<=i;s++)if(n=o,o=t[2*(s+1)+1],!(++a<l&&n===o)){if(a<c)do{Zd(e,n,e.bl_tree)}while(0!=--a);else 0!==n?(n!==r&&(Zd(e,n,e.bl_tree),a--),Zd(e,16,e.bl_tree),zd(e,a-3,2)):a<=10?(Zd(e,17,e.bl_tree),zd(e,a-3,3)):(Zd(e,18,e.bl_tree),zd(e,a-11,7));a=0,r=n,0===o?(l=138,c=3):n===o?(l=6,c=3):(l=7,c=4)}};let cu=!1;const _u=(e,t,i,s)=>{zd(e,0+(s?1:0),3),iu(e),Xd(e,i),Xd(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var du=(e,t,i,s)=>{let n,r,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&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<Md;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),ou(e,e.l_desc),ou(e,e.d_desc),o=(e=>{let t;for(au(e,e.dyn_ltree,e.l_desc.max_code),au(e,e.dyn_dtree,e.d_desc.max_code),ou(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Gd[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=n&&(n=r)):n=r=i+5,i+4<=n&&-1!==t?_u(e,t,i,s):4===e.strategy||r===n?(zd(e,2+(s?1:0),3),ru(e,Vd,kd)):(zd(e,4+(s?1:0),3),((e,t,i,s)=>{let n;for(zd(e,t-257,5),zd(e,i-1,5),zd(e,s-4,4),n=0;n<s;n++)zd(e,e.bl_tree[2*Gd[n]+1],3);lu(e,e.dyn_ltree,t-1),lu(e,e.dyn_dtree,i-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),ru(e,e.dyn_ltree,e.dyn_dtree)),tu(e),s&&iu(e)},uu={_tr_init:e=>{cu||((()=>{let e,t,i,s,n;const r=new Array(16);for(i=0,s=0;s<28;s++)for(Bd[s]=i,e=0;e<1<<Pd[s];e++)Fd[i++]=s;for(Fd[i-1]=s,n=0,s=0;s<16;s++)for(Hd[s]=n,e=0;e<1<<Dd[s];e++)xd[n++]=s;for(n>>=7;s<Ld;s++)for(Hd[s]=n<<7,e=0;e<1<<Dd[s]-7;e++)xd[256+n++]=s;for(t=0;t<=Ud;t++)r[t]=0;for(e=0;e<=143;)Vd[2*e+1]=8,e++,r[8]++;for(;e<=255;)Vd[2*e+1]=9,e++,r[9]++;for(;e<=279;)Vd[2*e+1]=7,e++,r[7]++;for(;e<=287;)Vd[2*e+1]=8,e++,r[8]++;for(eu(Vd,287,r),e=0;e<Ld;e++)kd[2*e+1]=5,kd[2*e]=$d(e,5);Wd=new Yd(Vd,Pd,257,bd,Ud),qd=new Yd(kd,Dd,0,Ld,Ud),Jd=new Yd(new Array(0),wd,0,19,7)})(),cu=!0),e.l_desc=new Kd(e.dyn_ltree,Wd),e.d_desc=new Kd(e.dyn_dtree,qd),e.bl_desc=new Kd(e.bl_tree,Jd),e.bi_buf=0,e.bi_valid=0,tu(e)},_tr_stored_block:_u,_tr_flush_block:du,_tr_tally:(e,t,i)=>(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++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(Fd[i]+Md+1)]++,e.dyn_dtree[2*Qd(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{zd(e,2,3),Zd(e,256,Vd),(e=>{16===e.bi_valid?(Xd(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 hu=(e,t,i,s)=>{let n=65535&e,r=e>>>16&65535,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{n=n+t[s++]|0,r=r+n|0}while(--o);n%=65521,r%=65521}return n|r<<16};const gu=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var Eu=(e,t,i,s)=>{const n=gu,r=s+i;e^=-1;for(let i=s;i<r;i++)e=e>>>8^n[255&(e^t[i])];return~e},Iu={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"},Tu={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:fu,_tr_stored_block:Ru,_tr_flush_block:Au,_tr_tally:pu,_tr_align:mu}=uu,{Z_NO_FLUSH:Su,Z_PARTIAL_FLUSH:vu,Z_FULL_FLUSH:Nu,Z_FINISH:Ou,Z_BLOCK:yu,Z_OK:Cu,Z_STREAM_END:Mu,Z_STREAM_ERROR:bu,Z_DATA_ERROR:Lu,Z_BUF_ERROR:Uu,Z_DEFAULT_COMPRESSION:Pu,Z_FILTERED:Du,Z_HUFFMAN_ONLY:wu,Z_RLE:Gu,Z_FIXED:Vu,Z_DEFAULT_STRATEGY:ku,Z_UNKNOWN:xu,Z_DEFLATED:Fu}=Tu,Bu=258,Hu=262,ju=42,Yu=113,Wu=666,qu=(e,t)=>(e.msg=Iu[t],t),Ju=e=>2*e-(e>4?9:0),Ku=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Qu=e=>{let t,i,s,n=e.w_size;t=e.hash_size,s=t;do{i=e.head[--s],e.head[s]=i>=n?i-n:0}while(--t);t=n,s=t;do{i=e.prev[--s],e.prev[s]=i>=n?i-n:0}while(--t)};let Xu=(e,t,i)=>(t<<e.hash_shift^i)&e.hash_mask;const zu=e=>{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},Zu=(e,t)=>{Au(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,zu(e.strm)},$u=(e,t)=>{e.pending_buf[e.pending++]=t},eh=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},th=(e,t,i,s)=>{let n=e.avail_in;return n>s&&(n=s),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),i),1===e.state.wrap?e.adler=hu(e.adler,t,n,i):2===e.state.wrap&&(e.adler=Eu(e.adler,t,n,i)),e.next_in+=n,e.total_in+=n,n)},ih=(e,t)=>{let i,s,n=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-Hu?e.strstart-(e.w_size-Hu):0,c=e.window,_=e.w_mask,d=e.prev,u=e.strstart+Bu;let h=c[r+o-1],g=c[r+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(i=t,c[i+o]===g&&c[i+o-1]===h&&c[i]===c[r]&&c[++i]===c[r+1]){r+=2,i++;do{}while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&r<u);if(s=Bu-(u-r),r=u-Bu,s>o){if(e.match_start=t,o=s,s>=a)break;h=c[r+o-1],g=c[r+o]}}}while((t=d[t&_])>l&&0!=--n);return o<=e.lookahead?o:e.lookahead},sh=e=>{const t=e.w_size;let i,s,n;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Hu)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Qu(e),s+=t),0===e.strm.avail_in)break;if(i=th(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=Xu(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=Xu(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<Hu&&0!==e.strm.avail_in)},nh=(e,t)=>{let i,s,n,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,a=e.strm.avail_in;do{if(i=65535,n=e.bi_valid+42>>3,e.strm.avail_out<n)break;if(n=e.strm.avail_out-n,s=e.strstart-e.block_start,i>s+e.strm.avail_in&&(i=s+e.strm.avail_in),i>n&&(i=n),i<r&&(0===i&&t!==Ou||t===Su||i!==s+e.strm.avail_in))break;o=t===Ou&&i===s+e.strm.avail_in?1:0,Ru(e,0,0,o),e.pending_buf[e.pending-4]=i,e.pending_buf[e.pending-3]=i>>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,zu(e.strm),s&&(s>i&&(s=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+s),e.strm.next_out),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s,e.block_start+=s,i-=s),i&&(th(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===o);return a-=e.strm.avail_in,a&&(a>=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<=a&&(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-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?4:t!==Su&&t!==Ou&&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&&(th(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,r=n>e.w_size?e.w_size:n,s=e.strstart-e.block_start,(s>=r||(s||t===Ou)&&t!==Su&&0===e.strm.avail_in&&s<=n)&&(i=s>n?n:s,o=t===Ou&&0===e.strm.avail_in&&i===s?1:0,Ru(e,e.block_start,i,o),e.block_start+=i,zu(e.strm)),o?3:1)},rh=(e,t)=>{let i,s;for(;;){if(e.lookahead<Hu){if(sh(e),e.lookahead<Hu&&t===Su)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=Xu(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Hu&&(e.match_length=ih(e,i)),e.match_length>=3)if(s=pu(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=Xu(e,e.ins_h,e.window[e.strstart+3-1]),i=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=Xu(e,e.ins_h,e.window[e.strstart+1]);else s=pu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(Zu(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Ou?(Zu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Zu(e,!1),0===e.strm.avail_out)?1:2},oh=(e,t)=>{let i,s,n;for(;;){if(e.lookahead<Hu){if(sh(e),e.lookahead<Hu&&t===Su)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=Xu(e,e.ins_h,e.window[e.strstart+3-1]),i=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!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Hu&&(e.match_length=ih(e,i),e.match_length<=5&&(e.strategy===Du||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,s=pu(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=Xu(e,e.ins_h,e.window[e.strstart+3-1]),i=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++,s&&(Zu(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(s=pu(e,0,e.window[e.strstart-1]),s&&Zu(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&&(s=pu(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Ou?(Zu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Zu(e,!1),0===e.strm.avail_out)?1:2};function ah(e,t,i,s,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=n}const lh=[new ah(0,0,0,0,nh),new ah(4,4,8,4,rh),new ah(4,5,16,8,rh),new ah(4,6,32,32,rh),new ah(4,4,16,16,oh),new ah(8,16,32,32,oh),new ah(8,16,128,128,oh),new ah(8,32,128,256,oh),new ah(32,128,258,1024,oh),new ah(32,258,258,4096,oh)];function ch(){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=Fu,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),Ku(this.dyn_ltree),Ku(this.dyn_dtree),Ku(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),Ku(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ku(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 _h=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==ju&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Yu&&t.status!==Wu?1:0},dh=e=>{if(_h(e))return qu(e,bu);e.total_in=e.total_out=0,e.data_type=xu;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?ju:Yu,e.adler=2===t.wrap?0:1,t.last_flush=-2,fu(t),Cu},uh=e=>{const t=dh(e);var i;return t===Cu&&((i=e.state).window_size=2*i.w_size,Ku(i.head),i.max_lazy_match=lh[i.level].max_lazy,i.good_match=lh[i.level].good_length,i.nice_match=lh[i.level].nice_length,i.max_chain_length=lh[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},hh=(e,t,i,s,n,r)=>{if(!e)return bu;let o=1;if(t===Pu&&(t=6),s<0?(o=0,s=-s):s>15&&(o=2,s-=16),n<1||n>9||i!==Fu||s<8||s>15||t<0||t>9||r<0||r>Vu||8===s&&1!==o)return qu(e,bu);8===s&&(s=9);const a=new ch;return e.state=a,a.strm=e,a.status=ju,a.wrap=o,a.gzhead=null,a.w_bits=s,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=n+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<n+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=r,a.method=i,uh(e)};var gh={deflateInit:(e,t)=>hh(e,t,Fu,15,8,ku),deflateInit2:hh,deflateReset:uh,deflateResetKeep:dh,deflateSetHeader:(e,t)=>_h(e)||2!==e.state.wrap?bu:(e.state.gzhead=t,Cu),deflate:(e,t)=>{if(_h(e)||t>yu||t<0)return e?qu(e,bu):bu;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===Wu&&t!==Ou)return qu(e,0===e.avail_out?Uu:bu);const s=i.last_flush;if(i.last_flush=t,0!==i.pending){if(zu(e),0===e.avail_out)return i.last_flush=-1,Cu}else if(0===e.avail_in&&Ju(t)<=Ju(s)&&t!==Ou)return qu(e,Uu);if(i.status===Wu&&0!==e.avail_in)return qu(e,Uu);if(i.status===ju&&0===i.wrap&&(i.status=Yu),i.status===ju){let t=Fu+(i.w_bits-8<<4)<<8,s=-1;if(s=i.strategy>=wu||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=s<<6,0!==i.strstart&&(t|=32),t+=31-t%31,eh(i,t),0!==i.strstart&&(eh(i,e.adler>>>16),eh(i,65535&e.adler)),e.adler=1,i.status=Yu,zu(e),0!==i.pending)return i.last_flush=-1,Cu}if(57===i.status)if(e.adler=0,$u(i,31),$u(i,139),$u(i,8),i.gzhead)$u(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),$u(i,255&i.gzhead.time),$u(i,i.gzhead.time>>8&255),$u(i,i.gzhead.time>>16&255),$u(i,i.gzhead.time>>24&255),$u(i,9===i.level?2:i.strategy>=wu||i.level<2?4:0),$u(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&($u(i,255&i.gzhead.extra.length),$u(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=Eu(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if($u(i,0),$u(i,0),$u(i,0),$u(i,0),$u(i,0),$u(i,9===i.level?2:i.strategy>=wu||i.level<2?4:0),$u(i,3),i.status=Yu,zu(e),0!==i.pending)return i.last_flush=-1,Cu;if(69===i.status){if(i.gzhead.extra){let t=i.pending,s=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+s>i.pending_buf_size;){let n=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=n,zu(e),0!==i.pending)return i.last_flush=-1,Cu;t=0,s-=n}let n=new Uint8Array(i.gzhead.extra);i.pending_buf.set(n.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending+=s,i.gzhead.hcrc&&i.pending>t&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-s,s)),zu(e),0!==i.pending)return i.last_flush=-1,Cu;s=0}t=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,$u(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>s&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-s,s)),zu(e),0!==i.pending)return i.last_flush=-1,Cu;s=0}t=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,$u(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>s&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-s,s))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(zu(e),0!==i.pending))return i.last_flush=-1,Cu;$u(i,255&e.adler),$u(i,e.adler>>8&255),e.adler=0}if(i.status=Yu,zu(e),0!==i.pending)return i.last_flush=-1,Cu}if(0!==e.avail_in||0!==i.lookahead||t!==Su&&i.status!==Wu){let s=0===i.level?nh(i,t):i.strategy===wu?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(sh(e),0===e.lookahead)){if(t===Su)return 1;break}if(e.match_length=0,i=pu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Zu(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Ou?(Zu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Zu(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===Gu?((e,t)=>{let i,s,n,r;const o=e.window;for(;;){if(e.lookahead<=Bu){if(sh(e),e.lookahead<=Bu&&t===Su)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,s=o[n],s===o[++n]&&s===o[++n]&&s===o[++n])){r=e.strstart+Bu;do{}while(s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&n<r);e.match_length=Bu-(r-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=pu(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=pu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Zu(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Ou?(Zu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Zu(e,!1),0===e.strm.avail_out)?1:2})(i,t):lh[i.level].func(i,t);if(3!==s&&4!==s||(i.status=Wu),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),Cu;if(2===s&&(t===vu?mu(i):t!==yu&&(Ru(i,0,0,!1),t===Nu&&(Ku(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),zu(e),0===e.avail_out))return i.last_flush=-1,Cu}return t!==Ou?Cu:i.wrap<=0?Mu:(2===i.wrap?($u(i,255&e.adler),$u(i,e.adler>>8&255),$u(i,e.adler>>16&255),$u(i,e.adler>>24&255),$u(i,255&e.total_in),$u(i,e.total_in>>8&255),$u(i,e.total_in>>16&255),$u(i,e.total_in>>24&255)):(eh(i,e.adler>>>16),eh(i,65535&e.adler)),zu(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?Cu:Mu)},deflateEnd:e=>{if(_h(e))return bu;const t=e.state.status;return e.state=null,t===Yu?qu(e,Lu):Cu},deflateSetDictionary:(e,t)=>{let i=t.length;if(_h(e))return bu;const s=e.state,n=s.wrap;if(2===n||1===n&&s.status!==ju||s.lookahead)return bu;if(1===n&&(e.adler=hu(e.adler,t,i,0)),s.wrap=0,i>=s.w_size){0===n&&(Ku(s.head),s.strstart=0,s.block_start=0,s.insert=0);let e=new Uint8Array(s.w_size);e.set(t.subarray(i-s.w_size,i),0),t=e,i=s.w_size}const r=e.avail_in,o=e.next_in,a=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,sh(s);s.lookahead>=3;){let e=s.strstart,t=s.lookahead-2;do{s.ins_h=Xu(s,s.ins_h,s.window[e+3-1]),s.prev[e&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=e,e++}while(--t);s.strstart=e,s.lookahead=2,sh(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,e.next_in=o,e.input=a,e.avail_in=r,s.wrap=n,Cu},deflateInfo:"pako deflate (from Nodeca project)"};const Eh=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ih={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Eh(i,t)&&(e[t]=i[t])}}return e},flattenChunks:e=>{let t=0;for(let i=0,s=e.length;i<s;i++)t+=e[i].length;const i=new Uint8Array(t);for(let t=0,s=0,n=e.length;t<n;t++){let n=e[t];i.set(n,s),s+=n.length}return i}};let Th=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Th=!1}const fh=new Uint8Array(256);for(let e=0;e<256;e++)fh[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;fh[254]=fh[254]=1;var Rh={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,s,n,r,o=e.length,a=0;for(n=0;n<o;n++)i=e.charCodeAt(n),55296==(64512&i)&&n+1<o&&(s=e.charCodeAt(n+1),56320==(64512&s)&&(i=65536+(i-55296<<10)+(s-56320),n++)),a+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(a),r=0,n=0;r<a;n++)i=e.charCodeAt(n),55296==(64512&i)&&n+1<o&&(s=e.charCodeAt(n+1),56320==(64512&s)&&(i=65536+(i-55296<<10)+(s-56320),n++)),i<128?t[r++]=i:i<2048?(t[r++]=192|i>>>6,t[r++]=128|63&i):i<65536?(t[r++]=224|i>>>12,t[r++]=128|i>>>6&63,t[r++]=128|63&i):(t[r++]=240|i>>>18,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i);return t},buf2string:(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s,n;const r=new Array(2*i);for(n=0,s=0;s<i;){let t=e[s++];if(t<128){r[n++]=t;continue}let o=fh[t];if(o>4)r[n++]=65533,s+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&s<i;)t=t<<6|63&e[s++],o--;o>1?r[n++]=65533:t<65536?r[n++]=t:(t-=65536,r[n++]=55296|t>>10&1023,r[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Th)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let s=0;s<t;s++)i+=String.fromCharCode(e[s]);return i})(r,n)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+fh[e[i]]>t?i:t}};var Ah=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 ph=Object.prototype.toString,{Z_NO_FLUSH:mh,Z_SYNC_FLUSH:Sh,Z_FULL_FLUSH:vh,Z_FINISH:Nh,Z_OK:Oh,Z_STREAM_END:yh,Z_DEFAULT_COMPRESSION:Ch,Z_DEFAULT_STRATEGY:Mh,Z_DEFLATED:bh}=Tu;function Lh(e){this.options=Ih.assign({level:Ch,method:bh,chunkSize:16384,windowBits:15,memLevel:8,strategy:Mh},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 Ah,this.strm.avail_out=0;let i=gh.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==Oh)throw new Error(Iu[i]);if(t.header&&gh.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Rh.string2buf(t.dictionary):"[object ArrayBuffer]"===ph.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=gh.deflateSetDictionary(this.strm,e),i!==Oh)throw new Error(Iu[i]);this._dict_set=!0}}Lh.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize;let n,r;if(this.ended)return!1;for(r=t===~~t?t:!0===t?Nh:mh,"string"==typeof e?i.input=Rh.string2buf(e):"[object ArrayBuffer]"===ph.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),(r===Sh||r===vh)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(n=gh.deflate(i,r),n===yh)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),n=gh.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Oh;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Lh.prototype.onData=function(e){this.chunks.push(e)},Lh.prototype.onEnd=function(e){e===Oh&&(this.result=Ih.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const Uh=16209;var Ph=function(e,t){let i,s,n,r,o,a,l,c,_,d,u,h,g,E,I,T,f,R,A,p,m,S,v,N;const O=e.state;i=e.next_in,v=e.input,s=i+(e.avail_in-5),n=e.next_out,N=e.output,r=n-(t-e.avail_out),o=n+(e.avail_out-257),a=O.dmax,l=O.wsize,c=O.whave,_=O.wnext,d=O.window,u=O.hold,h=O.bits,g=O.lencode,E=O.distcode,I=(1<<O.lenbits)-1,T=(1<<O.distbits)-1;e:do{h<15&&(u+=v[i++]<<h,h+=8,u+=v[i++]<<h,h+=8),f=g[u&I];t:for(;;){if(R=f>>>24,u>>>=R,h-=R,R=f>>>16&255,0===R)N[n++]=65535&f;else{if(!(16&R)){if(64&R){if(32&R){O.mode=16191;break e}e.msg="invalid literal/length code",O.mode=Uh;break e}f=g[(65535&f)+(u&(1<<R)-1)];continue t}for(A=65535&f,R&=15,R&&(h<R&&(u+=v[i++]<<h,h+=8),A+=u&(1<<R)-1,u>>>=R,h-=R),h<15&&(u+=v[i++]<<h,h+=8,u+=v[i++]<<h,h+=8),f=E[u&T];;){if(R=f>>>24,u>>>=R,h-=R,R=f>>>16&255,16&R){if(p=65535&f,R&=15,h<R&&(u+=v[i++]<<h,h+=8,h<R&&(u+=v[i++]<<h,h+=8)),p+=u&(1<<R)-1,p>a){e.msg="invalid distance too far back",O.mode=Uh;break e}if(u>>>=R,h-=R,R=n-r,p>R){if(R=p-R,R>c&&O.sane){e.msg="invalid distance too far back",O.mode=Uh;break e}if(m=0,S=d,0===_){if(m+=l-R,R<A){A-=R;do{N[n++]=d[m++]}while(--R);m=n-p,S=N}}else if(_<R){if(m+=l+_-R,R-=_,R<A){A-=R;do{N[n++]=d[m++]}while(--R);if(m=0,_<A){R=_,A-=R;do{N[n++]=d[m++]}while(--R);m=n-p,S=N}}}else if(m+=_-R,R<A){A-=R;do{N[n++]=d[m++]}while(--R);m=n-p,S=N}for(;A>2;)N[n++]=S[m++],N[n++]=S[m++],N[n++]=S[m++],A-=3;A&&(N[n++]=S[m++],A>1&&(N[n++]=S[m++]))}else{m=n-p;do{N[n++]=N[m++],N[n++]=N[m++],N[n++]=N[m++],A-=3}while(A>2);A&&(N[n++]=N[m++],A>1&&(N[n++]=N[m++]))}break}if(64&R){e.msg="invalid distance code",O.mode=Uh;break e}f=E[(65535&f)+(u&(1<<R)-1)]}}break}}while(i<s&&n<o);A=h>>3,i-=A,h-=A<<3,u&=(1<<h)-1,e.next_in=i,e.next_out=n,e.avail_in=i<s?s-i+5:5-(i-s),e.avail_out=n<o?o-n+257:257-(n-o),O.hold=u,O.bits=h};const Dh=15,wh=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]),Gh=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]),Vh=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]),kh=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 xh=(e,t,i,s,n,r,o,a)=>{const l=a.bits;let c,_,d,u,h,g,E=0,I=0,T=0,f=0,R=0,A=0,p=0,m=0,S=0,v=0,N=null;const O=new Uint16Array(16),y=new Uint16Array(16);let C,M,b,L=null;for(E=0;E<=Dh;E++)O[E]=0;for(I=0;I<s;I++)O[t[i+I]]++;for(R=l,f=Dh;f>=1&&0===O[f];f--);if(R>f&&(R=f),0===f)return n[r++]=20971520,n[r++]=20971520,a.bits=1,0;for(T=1;T<f&&0===O[T];T++);for(R<T&&(R=T),m=1,E=1;E<=Dh;E++)if(m<<=1,m-=O[E],m<0)return-1;if(m>0&&(0===e||1!==f))return-1;for(y[1]=0,E=1;E<Dh;E++)y[E+1]=y[E]+O[E];for(I=0;I<s;I++)0!==t[i+I]&&(o[y[t[i+I]]++]=I);if(0===e?(N=L=o,g=20):1===e?(N=wh,L=Gh,g=257):(N=Vh,L=kh,g=0),v=0,I=0,E=T,h=r,A=R,p=0,d=-1,S=1<<R,u=S-1,1===e&&S>852||2===e&&S>592)return 1;for(;;){C=E-p,o[I]+1<g?(M=0,b=o[I]):o[I]>=g?(M=L[o[I]-g],b=N[o[I]-g]):(M=96,b=0),c=1<<E-p,_=1<<A,T=_;do{_-=c,n[h+(v>>p)+_]=C<<24|M<<16|b}while(0!==_);for(c=1<<E-1;v&c;)c>>=1;if(0!==c?(v&=c-1,v+=c):v=0,I++,0==--O[E]){if(E===f)break;E=t[i+o[I]]}if(E>R&&(v&u)!==d){for(0===p&&(p=R),h+=T,A=E-p,m=1<<A;A+p<f&&(m-=O[A+p],!(m<=0));)A++,m<<=1;if(S+=1<<A,1===e&&S>852||2===e&&S>592)return 1;d=v&u,n[d]=R<<24|A<<16|h-r}}return 0!==v&&(n[h+v]=E-p<<24|64<<16),a.bits=R,0};const{Z_FINISH:Fh,Z_BLOCK:Bh,Z_TREES:Hh,Z_OK:jh,Z_STREAM_END:Yh,Z_NEED_DICT:Wh,Z_STREAM_ERROR:qh,Z_DATA_ERROR:Jh,Z_MEM_ERROR:Kh,Z_BUF_ERROR:Qh,Z_DEFLATED:Xh}=Tu,zh=16180,Zh=16190,$h=16191,eg=16192,tg=16194,ig=16199,sg=16200,ng=16206,rg=16209,og=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function ag(){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 lg=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<zh||t.mode>16211?1:0},cg=e=>{if(lg(e))return qh;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=zh,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,jh},_g=e=>{if(lg(e))return qh;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,cg(e)},dg=(e,t)=>{let i;if(lg(e))return qh;const s=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?qh:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,_g(e))},ug=(e,t)=>{if(!e)return qh;const i=new ag;e.state=i,i.strm=e,i.window=null,i.mode=zh;const s=dg(e,t);return s!==jh&&(e.state=null),s};let hg,gg,Eg=!0;const Ig=e=>{if(Eg){hg=new Int32Array(512),gg=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(xh(1,e.lens,0,288,hg,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;xh(2,e.lens,0,32,gg,0,e.work,{bits:5}),Eg=!1}e.lencode=hg,e.lenbits=9,e.distcode=gg,e.distbits=5},Tg=(e,t,i,s)=>{let n;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),s>=r.wsize?(r.window.set(t.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(n=r.wsize-r.wnext,n>s&&(n=s),r.window.set(t.subarray(i-s,i-s+n),r.wnext),(s-=n)?(r.window.set(t.subarray(i-s,i),0),r.wnext=s,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=n))),0};var fg={inflateReset:_g,inflateReset2:dg,inflateResetKeep:cg,inflateInit:e=>ug(e,15),inflateInit2:ug,inflate:(e,t)=>{let i,s,n,r,o,a,l,c,_,d,u,h,g,E,I,T,f,R,A,p,m,S,v=0;const N=new Uint8Array(4);let O,y;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(lg(e)||!e.output||!e.input&&0!==e.avail_in)return qh;i=e.state,i.mode===$h&&(i.mode=eg),o=e.next_out,n=e.output,l=e.avail_out,r=e.next_in,s=e.input,a=e.avail_in,c=i.hold,_=i.bits,d=a,u=l,S=jh;e:for(;;)switch(i.mode){case zh:if(0===i.wrap){i.mode=eg;break}for(;_<16;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(2&i.wrap&&35615===c){0===i.wbits&&(i.wbits=15),i.check=0,N[0]=255&c,N[1]=c>>>8&255,i.check=Eu(i.check,N,2,0),c=0,_=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",i.mode=rg;break}if((15&c)!==Xh){e.msg="unknown compression method",i.mode=rg;break}if(c>>>=4,_-=4,m=8+(15&c),0===i.wbits&&(i.wbits=m),m>15||m>i.wbits){e.msg="invalid window size",i.mode=rg;break}i.dmax=1<<i.wbits,i.flags=0,e.adler=i.check=1,i.mode=512&c?16189:$h,c=0,_=0;break;case 16181:for(;_<16;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(i.flags=c,(255&i.flags)!==Xh){e.msg="unknown compression method",i.mode=rg;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=rg;break}i.head&&(i.head.text=c>>8&1),512&i.flags&&4&i.wrap&&(N[0]=255&c,N[1]=c>>>8&255,i.check=Eu(i.check,N,2,0)),c=0,_=0,i.mode=16182;case 16182:for(;_<32;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.head&&(i.head.time=c),512&i.flags&&4&i.wrap&&(N[0]=255&c,N[1]=c>>>8&255,N[2]=c>>>16&255,N[3]=c>>>24&255,i.check=Eu(i.check,N,4,0)),c=0,_=0,i.mode=16183;case 16183:for(;_<16;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.head&&(i.head.xflags=255&c,i.head.os=c>>8),512&i.flags&&4&i.wrap&&(N[0]=255&c,N[1]=c>>>8&255,i.check=Eu(i.check,N,2,0)),c=0,_=0,i.mode=16184;case 16184:if(1024&i.flags){for(;_<16;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.length=c,i.head&&(i.head.extra_len=c),512&i.flags&&4&i.wrap&&(N[0]=255&c,N[1]=c>>>8&255,i.check=Eu(i.check,N,2,0)),c=0,_=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(h=i.length,h>a&&(h=a),h&&(i.head&&(m=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(s.subarray(r,r+h),m)),512&i.flags&&4&i.wrap&&(i.check=Eu(i.check,s,h,r)),a-=h,r+=h,i.length-=h),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break e;h=0;do{m=s[r+h++],i.head&&m&&i.length<65536&&(i.head.name+=String.fromCharCode(m))}while(m&&h<a);if(512&i.flags&&4&i.wrap&&(i.check=Eu(i.check,s,h,r)),a-=h,r+=h,m)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===a)break e;h=0;do{m=s[r+h++],i.head&&m&&i.length<65536&&(i.head.comment+=String.fromCharCode(m))}while(m&&h<a);if(512&i.flags&&4&i.wrap&&(i.check=Eu(i.check,s,h,r)),a-=h,r+=h,m)break e}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;_<16;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(4&i.wrap&&c!==(65535&i.check)){e.msg="header crc mismatch",i.mode=rg;break}c=0,_=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=$h;break;case 16189:for(;_<32;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}e.adler=i.check=og(c),c=0,_=0,i.mode=Zh;case Zh:if(0===i.havedict)return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=a,i.hold=c,i.bits=_,Wh;e.adler=i.check=1,i.mode=$h;case $h:if(t===Bh||t===Hh)break e;case eg:if(i.last){c>>>=7&_,_-=7&_,i.mode=ng;break}for(;_<3;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}switch(i.last=1&c,c>>>=1,_-=1,3&c){case 0:i.mode=16193;break;case 1:if(Ig(i),i.mode=ig,t===Hh){c>>>=2,_-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=rg}c>>>=2,_-=2;break;case 16193:for(c>>>=7&_,_-=7&_;_<32;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",i.mode=rg;break}if(i.length=65535&c,c=0,_=0,i.mode=tg,t===Hh)break e;case tg:i.mode=16195;case 16195:if(h=i.length,h){if(h>a&&(h=a),h>l&&(h=l),0===h)break e;n.set(s.subarray(r,r+h),o),a-=h,r+=h,l-=h,o+=h,i.length-=h;break}i.mode=$h;break;case 16196:for(;_<14;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(i.nlen=257+(31&c),c>>>=5,_-=5,i.ndist=1+(31&c),c>>>=5,_-=5,i.ncode=4+(15&c),c>>>=4,_-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=rg;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;_<3;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.lens[C[i.have++]]=7&c,c>>>=3,_-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,O={bits:i.lenbits},S=xh(0,i.lens,0,19,i.lencode,0,i.work,O),i.lenbits=O.bits,S){e.msg="invalid code lengths set",i.mode=rg;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;v=i.lencode[c&(1<<i.lenbits)-1],I=v>>>24,T=v>>>16&255,f=65535&v,!(I<=_);){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(f<16)c>>>=I,_-=I,i.lens[i.have++]=f;else{if(16===f){for(y=I+2;_<y;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(c>>>=I,_-=I,0===i.have){e.msg="invalid bit length repeat",i.mode=rg;break}m=i.lens[i.have-1],h=3+(3&c),c>>>=2,_-=2}else if(17===f){for(y=I+3;_<y;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}c>>>=I,_-=I,m=0,h=3+(7&c),c>>>=3,_-=3}else{for(y=I+7;_<y;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}c>>>=I,_-=I,m=0,h=11+(127&c),c>>>=7,_-=7}if(i.have+h>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=rg;break}for(;h--;)i.lens[i.have++]=m}}if(i.mode===rg)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=rg;break}if(i.lenbits=9,O={bits:i.lenbits},S=xh(1,i.lens,0,i.nlen,i.lencode,0,i.work,O),i.lenbits=O.bits,S){e.msg="invalid literal/lengths set",i.mode=rg;break}if(i.distbits=6,i.distcode=i.distdyn,O={bits:i.distbits},S=xh(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,O),i.distbits=O.bits,S){e.msg="invalid distances set",i.mode=rg;break}if(i.mode=ig,t===Hh)break e;case ig:i.mode=sg;case sg:if(a>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=a,i.hold=c,i.bits=_,Ph(e,u),o=e.next_out,n=e.output,l=e.avail_out,r=e.next_in,s=e.input,a=e.avail_in,c=i.hold,_=i.bits,i.mode===$h&&(i.back=-1);break}for(i.back=0;v=i.lencode[c&(1<<i.lenbits)-1],I=v>>>24,T=v>>>16&255,f=65535&v,!(I<=_);){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(T&&!(240&T)){for(R=I,A=T,p=f;v=i.lencode[p+((c&(1<<R+A)-1)>>R)],I=v>>>24,T=v>>>16&255,f=65535&v,!(R+I<=_);){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}c>>>=R,_-=R,i.back+=R}if(c>>>=I,_-=I,i.back+=I,i.length=f,0===T){i.mode=16205;break}if(32&T){i.back=-1,i.mode=$h;break}if(64&T){e.msg="invalid literal/length code",i.mode=rg;break}i.extra=15&T,i.mode=16201;case 16201:if(i.extra){for(y=i.extra;_<y;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.length+=c&(1<<i.extra)-1,c>>>=i.extra,_-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;v=i.distcode[c&(1<<i.distbits)-1],I=v>>>24,T=v>>>16&255,f=65535&v,!(I<=_);){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(!(240&T)){for(R=I,A=T,p=f;v=i.distcode[p+((c&(1<<R+A)-1)>>R)],I=v>>>24,T=v>>>16&255,f=65535&v,!(R+I<=_);){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}c>>>=R,_-=R,i.back+=R}if(c>>>=I,_-=I,i.back+=I,64&T){e.msg="invalid distance code",i.mode=rg;break}i.offset=f,i.extra=15&T,i.mode=16203;case 16203:if(i.extra){for(y=i.extra;_<y;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.offset+=c&(1<<i.extra)-1,c>>>=i.extra,_-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=rg;break}i.mode=16204;case 16204:if(0===l)break e;if(h=u-l,i.offset>h){if(h=i.offset-h,h>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=rg;break}h>i.wnext?(h-=i.wnext,g=i.wsize-h):g=i.wnext-h,h>i.length&&(h=i.length),E=i.window}else E=n,g=o-i.offset,h=i.length;h>l&&(h=l),l-=h,i.length-=h;do{n[o++]=E[g++]}while(--h);0===i.length&&(i.mode=sg);break;case 16205:if(0===l)break e;n[o++]=i.length,l--,i.mode=sg;break;case ng:if(i.wrap){for(;_<32;){if(0===a)break e;a--,c|=s[r++]<<_,_+=8}if(u-=l,e.total_out+=u,i.total+=u,4&i.wrap&&u&&(e.adler=i.check=i.flags?Eu(i.check,n,u,o-u):hu(i.check,n,u,o-u)),u=l,4&i.wrap&&(i.flags?c:og(c))!==i.check){e.msg="incorrect data check",i.mode=rg;break}c=0,_=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;_<32;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(4&i.wrap&&c!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=rg;break}c=0,_=0}i.mode=16208;case 16208:S=Yh;break e;case rg:S=Jh;break e;case 16210:return Kh;default:return qh}return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=a,i.hold=c,i.bits=_,(i.wsize||u!==e.avail_out&&i.mode<rg&&(i.mode<ng||t!==Fh))&&Tg(e,e.output,e.next_out,u-e.avail_out),d-=e.avail_in,u-=e.avail_out,e.total_in+=d,e.total_out+=u,i.total+=u,4&i.wrap&&u&&(e.adler=i.check=i.flags?Eu(i.check,n,u,e.next_out-u):hu(i.check,n,u,e.next_out-u)),e.data_type=i.bits+(i.last?64:0)+(i.mode===$h?128:0)+(i.mode===ig||i.mode===tg?256:0),(0===d&&0===u||t===Fh)&&S===jh&&(S=Qh),S},inflateEnd:e=>{if(lg(e))return qh;let t=e.state;return t.window&&(t.window=null),e.state=null,jh},inflateGetHeader:(e,t)=>{if(lg(e))return qh;const i=e.state;return 2&i.wrap?(i.head=t,t.done=!1,jh):qh},inflateSetDictionary:(e,t)=>{const i=t.length;let s,n,r;return lg(e)?qh:(s=e.state,0!==s.wrap&&s.mode!==Zh?qh:s.mode===Zh&&(n=1,n=hu(n,t,i,0),n!==s.check)?Jh:(r=Tg(e,t,i,i),r?(s.mode=16210,Kh):(s.havedict=1,jh)))},inflateInfo:"pako inflate (from Nodeca project)"};var Rg=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 Ag=Object.prototype.toString,{Z_NO_FLUSH:pg,Z_FINISH:mg,Z_OK:Sg,Z_STREAM_END:vg,Z_NEED_DICT:Ng,Z_STREAM_ERROR:Og,Z_DATA_ERROR:yg,Z_MEM_ERROR:Cg}=Tu;function Mg(e){this.options=Ih.assign({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 Ah,this.strm.avail_out=0;let i=fg.inflateInit2(this.strm,t.windowBits);if(i!==Sg)throw new Error(Iu[i]);if(this.header=new Rg,fg.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Rh.string2buf(t.dictionary):"[object ArrayBuffer]"===Ag.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=fg.inflateSetDictionary(this.strm,t.dictionary),i!==Sg)))throw new Error(Iu[i])}function bg(e,t){const i=new Mg(t);if(i.push(e),i.err)throw i.msg||Iu[i.err];return i.result}Mg.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize,n=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=t===~~t?t:!0===t?mg:pg,"[object ArrayBuffer]"===Ag.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),r=fg.inflate(i,o),r===Ng&&n&&(r=fg.inflateSetDictionary(i,n),r===Sg?r=fg.inflate(i,o):r===yg&&(r=Ng));i.avail_in>0&&r===vg&&i.state.wrap>0&&0!==e[i.next_in];)fg.inflateReset(i),r=fg.inflate(i,o);switch(r){case Og:case yg:case Ng:case Cg:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===vg))if("string"===this.options.to){let e=Rh.utf8border(i.output,i.next_out),t=i.next_out-e,n=Rh.buf2string(i.output,e);i.next_out=t,i.avail_out=s-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(n)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==Sg||0!==a){if(r===vg)return r=fg.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Mg.prototype.onData=function(e){this.chunks.push(e)},Mg.prototype.onEnd=function(e){e===Sg&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ih.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Lg={Inflate:Mg,inflate:bg,inflateRaw:function(e,t){return(t=t||{}).raw=!0,bg(e,t)},ungzip:bg,constants:Tu};const{Inflate:Ug,inflate:Pg,inflateRaw:Dg,ungzip:wg}=Lg;var Gg=wg;function Vg(e){return Object.keys(e).map((t=>{let i=e[t];return"string"!=typeof i&&(i=`${i}`),{key:t,value:i}}))}function kg(e,t,i,s){return Uc.encode(al,{targetId:e,type:w.GROUP,users:s,extProfile:i?Vg(i):void 0,settingProfile:Vg(t)})}const xg=(e,t)=>Uc.encode(Yo,{type:e.conversationType,msgTime:t,channelId:e.targetId,busChannel:e.channelId||""}),Fg=e=>{const{compressioEnabled:t,compressedData:i,info:s,pullTime:n,isFinished:r,pageToken:o}=Uc.decode(Po,e);if(t){const e=Gg(i);return Fg(e)}return{info:s,pullTime:n,isFinished:r,pageToken:o}},Bg=e=>{const t=Uc.decode(Ao,e);if(t.compressioEnabled){const e=Gg(t.compressedData);return Bg(e)}return t},Hg=e=>{const t=Uc.decode(po,e);if(t.compressioEnabled){const e=Gg(t.compressedData);return Hg(e)}const{syncTime:i,list:s}=t;return{syncTime:i,list:s.map((e=>Uc.decode(mo,new Uint8Array(e))))}},jg=e=>Uc.encode(Ia,Object.assign(Object.assign({},e),{compress:bs.enable()})),Yg=e=>{const t=Uc.decode(fa,e);if(t.compress){const e=Gg(t.compressData);return Yg(e)}return t},Wg=e=>{const t=Uc.decode(Ra,e);if(t.compress){const e=Gg(t.compressData);return Wg(e)}return t},qg=e=>{const{listType:t,result:i,page:s}=e,n=new Uint8Array(i);let r=[];switch(t){case 1:r=Uc.decode(gl,n).list;break;case 2:r=Uc.decode(hl,n).list;break;case 3:r=Uc.decode(El,n).list;break;case 11:r=Uc.decode(yl,n).list;break;case 12:r=Uc.decode(Cl,n).list}return Object.assign(Object.assign({},s),{list:r})},Jg=e=>Uc.encode(Fo,Object.assign(Object.assign({},e),{compressioEnabled:bs.enable(),ignoreCmd:!0})),Kg=e=>{const t=Uc.decode(Bo,e);if(t.compressioEnabled){const e=Gg(t.compressedData);return Kg(e)}return t},Qg=(e,t)=>Uc.encode(aa,{ignoreVersion:!0,version:e,state:t}),Xg=e=>{const t=Uc.decode(Hl,e);if(t.compress){const e=Gg(t.compressedData);return Xg(e)}return t},zg=e=>Uc.encode(ea,{timestamp:e,compressioEnabled:bs.enable()}),Zg=e=>{const t=Uc.decode(Zo,e);if(t.compressioEnabled){const e=Gg(t.compressedData);return Zg(e)}return t},$g=e=>{if(!e)return;const{pushTitle:t,iOSConfig:i,androidConfig:s,templateId:n,harmonyOSConfig:r}=e;return{title:t,pushConfigs:zt(i,s,r),pushId:null==s?void 0:s.notificationId,templateId:n}},eE=(e,t)=>{const{targetId:i,conversationType:s,channelId:n}=e,{messageType:r,isMentioned:o,disableNotification:a,canIncludeExpansion:l,pushConfig:c,directionalUserIdList:_,isVoipPush:d,isFilerWhiteBlacklist:u,content:h,pushContent:g,pushData:E,expansion:I,messageId:T,needReceipt:f,disableUpdateLastMessage:R,isStatusMessage:A,quoteInfo:p}=t,m=M_(r,o,a,l,A),S=((e,t,i,s)=>{let n=0;return e&&(n|=1),t&&(n|=2),i&&(n|=4),s&&(n|=8),n})(!!d,!u,!!(null==c?void 0:c.disablePushTitle),!!(null==c?void 0:c.forceShowDetailContent));let v;if(h.user&&h.user.portraitUri&&(h.user.portrait=h.user.portraitUri),l&&I){v={};for(const[e,t]of Object.entries(I))v[e]={v:t}}const N=$g(c),O=s===w.SYSTEM?i:void 0,{isPersited:y}=ms(r);let C=0;y&&R&&(C|=1),f&&(C|=2);const M=p?{msgId:p.messageUId,fromUserId:p.senderId,classname:p.objectName}:void 0;return Uc.encode(Ro,{sessionId:m,pushText:(null==c?void 0:c.pushContent)||g,appData:(null==c?void 0:c.pushData)||E,toUserIds:_,configFlag:S,classname:r,content:JSON.stringify(h),extraContent:v?JSON.stringify(v):void 0,pushExt:N,clientUniqueId:T,busChannel:n,systemId:O,optionBits:C,refData:M})},tE=e=>Uc.encode(dl,Object.assign(Object.assign({},e),{type:w.GROUP})),iE=e=>Uc.encode(Il,Object.assign(Object.assign({},e),{type:w.GROUP})),sE=e=>Uc.encode(_l,Object.assign(Object.assign({},e),{type:w.GROUP})),nE=e=>{const t=Uc.decode(Yl,e);if(t.compress){const e=Gg(t.compressedData);return nE(e)}return t},rE=e=>{const t=Uc.decode(Ic,e);if(t.compress){const e=Gg(t.compressedData);return rE(e)}return t},oE=e=>{const t=Uc.decode(fc,e);if(t.compress){const e=Gg(t.compressedData);return oE(e)}return t},aE=e=>{const t=Uc.decode(Rc,e);if(t.compress){const e=Gg(t.compressedData);return aE(e)}return t},lE=(e,t)=>{const i=[];return e.forEach((e=>{const{reactionId:s,reactionTime:n,userReact:r,user:o,userCnt:a}=e,l={messageUId:t,reactionId:s,reactionTime:n,hasCurrentUserReacted:r,totalCount:a,users:o.map((e=>({userId:e.userId,reactionTime:e.reactionTime})))};i.push(l)})),i},cE=e=>{const{targetId:t,type:i,busChannel:s,opType:n,msgId:r,reactionId:o,userCnt:a,users:l}=e;return{conversationIdentifier:{targetId:t,conversationType:i,channelId:s||""},messageUId:r,reactionId:o,operationType:n,totalCount:a,users:l.map((({userId:e,reactionTime:t})=>({reactionTime:t,userId:e})))}},_E={[ir]:D.RC_DISCONN_KICK,[sr]:D.RC_DISCONN_EXCEPTION,[rr]:D.RC_DISCONN_EXCEPTION,[or]:D.RC_CONN_REDIRECTED,[ar]:D.RC_CONN_TOKEN_EXPIRED,[lr]:D.RC_CONN_PROTO_VERSION_ERROR,[cr]:D.RC_ACCOUNT_CANCELLATION},dE={[wn]:D.SUCCESS,[Gn]:D.RC_CONN_PROTO_VERSION_ERROR,[Vn]:D.RC_CONN_IDENTIFIER_REJECTED,[kn]:D.RC_CONN_SERVER_UNAVAILABLE,[xn]:D.RC_CONN_TOKEN_INCORRECT,[Fn]:D.RC_CONN_NOT_AUTHRORIZED,[Bn]:D.RC_CONN_REDIRECTED,[Hn]:D.RC_CONN_PACKAGE_NAME_INVALID,[jn]:D.RC_CONN_APP_BLOCKED_OR_DELETED,[Yn]:D.RC_CONN_USER_BLOCKED,[Wn]:D.RC_CONN_TOKEN_EXPIRED,[qn]:D.RC_CONN_DEVICE_ERROR,[Jn]:D.RC_CONN_HOSTNAME_ERROR,[Kn]:D.RC_DISCONN_SAME_CLIENT_ON_LINE,[Qn]:D.RC_LISCENSE_COUNT_OUT_OF_LIMIT,[Xn]:D.RC_CONN_WRONG_CLUSTER,[zn]:D.RC_APP_AUTH_NOT_PASS,[Zn]:D.RC_OTP_USED,[$n]:D.RC_PLATFORM_ERROR,[er]:D.RC_ACCOUNT_CANCELLATION,[tr]:D.RC_LICENSE_EXPIRED},uE=e=>[$s.ppMsgS,$s.pgMsgS,$s.chatMsgS,$s.prMsgS].includes(e);var hE,gE,EE,IE,TE,fE,RE,AE,pE,mE,SE,vE,NE,OE,yE,CE;class ME extends di{constructor(e,t,s){super("WebSGMsgReceiver"),hE.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_storage",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_recvRecord",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this._ctx.on("sMsg",i(this,hE,"m",IE),this),this._ctx.on("syncMsg",i(this,hE,"m",EE),this)}_handleSyncData(e){var s;return t(this,void 0,void 0,(function*(){const{logger:t,currentUserId:n,connectedTime:o}=this._ctx,a=this._ctx.getNaviInfoFromCache(),l=this._storage.get("inboxTime"),c=this._storage.get("outboxTime"),_=this._storage.get("broadcastTime"),d=t.createTraceId();t.info(r.L_PULL_MSG_T,JSON.stringify({inboxTime:l,outboxTime:c,broadcastTime:_}),d);const u=Uc.encode(fo,{ispolling:!1,isPullSend:!0,syncTime:l,sendBoxSyncTime:c,broadcastSyncTime:_,compressioEnabled:bs.enable()}),h=yield this._ctx.query($s.pullMsg,n,u);if(!h.isOk)return t.warn(r.L_PULL_MSG_R,JSON.stringify({code:h.code}),d),h.wipe();const g=Bg(h.data.pbData),{list:E,finished:I,syncTime:T,broadcastSyncTime:f}=g;let R=c;const A=E.map((e=>{const t=C_(a,e,n,e.dataTime<o);return t.messageDirection===ue.SEND&&(R=Math.max(R,t.sentTime)),t}));this._storage.removeSentRecordByTimestamp(R-ME.MESSAGE_RECORD_TTL);const p=i(this,hE,"a",gE);let m=A.filter((e=>{if(e.senderUserId===n){const t=i(this,hE,"m",RE).call(this,e);if(!t){const t=i(this,hE,"m",fE).call(this,e);this._storage.addSentRecord(t,e.sentTime)}return!t}if(p)return!0;const t=!this._recvRecord.has(e.messageUId);return t&&this._recvRecord.set(e.messageUId,e.sentTime),t}));this._storage.set("inboxTime",T),this._storage.set("broadcastTime",f||1),this._storage.set("outboxTime",R),t.info(r.L_PULL_MSG_R,JSON.stringify({code:0,inboxTime:T,broadcastTime:f,outboxTime:R,msgCount:A.length,afterFilteredCount:m.length,hasNext:!I}),d);const S=Math.max(T,f||1,R);return 0===e&&this._emitter.emit("__firstOfflineMessageTime__",(null===(s=A[0])||void 0===s?void 0:s.sentTime)||0),i(this,hE,"m",TE).call(this,"pullMsg",m,!!I),i(this,hE,"m",pE).call(this,T),gi({version:S,hasNext:!I})}))}}hE=new WeakSet,gE=function(){var e;return 0!==(null===(e=this._ctx.getNaviInfoFromCache())||void 0===e?void 0:e.openHistoryMsg)},EE=function(e,t,s){const{conversationType:n}=t;n!==w.ULTRA_GROUP&&n!==w.CHATROOM&&(e.stopPropagation(),n===w.RTC_ROOM||uE(s)?i(this,hE,"m",TE).call(this,"syncMsg",[t],!0):i(this,hE,"m",AE).call(this,"syncMsg",t))},IE=function(e,t){const{conversationType:s,sentTime:n,isStatusMessage:r,messageUId:o}=t;if(s===w.CHATROOM||s===w.ULTRA_GROUP)return;if(e.stopPropagation(),r||s===w.RTC_ROOM)return void i(this,hE,"m",TE).call(this,"smsg",[t],!0);if(t.senderUserId===this._ctx.currentUserId)return void i(this,hE,"m",AE).call(this,"smsg",t);if(i(this,hE,"a",gE))return void this.push(n);this._recvRecord.has(o)||(this._recvRecord.set(o,n),i(this,hE,"m",TE).call(this,"smsg",[t],!0)),i(this,hE,"m",pE).call(this,n)},TE=function(e,t,i){this._emitter.emit("messages",e,t,i)},fE=function(e){return e.messageType===Q.RECALL?`Cmd:${e.content.messageUId}`:e.messageUId},RE=function(e){const t=i(this,hE,"m",fE).call(this,e);return this._storage.hasSentRecord(t)},AE=function(e,t){if(i(this,hE,"m",RE).call(this,t))return;const s=i(this,hE,"m",fE).call(this,t);this._storage.addSentRecord(s,t.sentTime),i(this,hE,"m",TE).call(this,e,[t],!0)},pE=function(e){if(i(this,hE,"a",gE))return;const t=e-ME.MESSAGE_RECORD_TTL;Array.from(this._recvRecord.entries()).forEach((([e,i])=>{i<=t&&this._recvRecord.delete(e)}))},Object.defineProperty(ME,"MESSAGE_RECORD_TTL",{enumerable:!0,configurable:!0,writable:!0,value:18e4});class bE extends di{constructor(e,t){super("WebUGMsgReceiver"),mE.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_storage",{enumerable:!0,configurable:!0,writable:!0,value:t}),this._ctx.on("syncMsg",i(this,mE,"m",vE),this),this._ctx.on("sCmd",i(this,mE,"m",SE),this)}markOnline(){return t(this,void 0,void 0,(function*(){const e=yield i(this,mE,"m",OE).call(this,0);if(!e.isOk)return this._ctx.logger.warn(r.L_NOTIFY_ULTRA_ONLINE_S,`fail to pull ug msg, code: ${e.code}`),e.wipe();this._ctx.logger.info(r.L_NOTIFY_ULTRA_ONLINE_S,"success");const{syncTime:t}=e.data,s=yield i(this,mE,"m",NE).call(this,0,[]);if(!s.isOk)return s.wipe();const n=s.data,o=n.length>0?n[n.length-1].versionTime:0,a=Math.max(t,o);return gi({relations:n,msgVersion:a})}))}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const t=yield i(this,mE,"m",OE).call(this,e);if(!t.isOk)return t.wipe();const{syncTime:s,finished:n,list:r}=t.data;if(null==r?void 0:r.length){const{currentUserId:e}=this._ctx,t=r.filter((e=>!this._storage.isLocalSentUGMessage(e.msgId))).map((t=>y_(t,e,!1)));t.length>0&&this._ctx.emit("messagesFromUG",t,s)}return this._storage.removeUGSentRecordByTimestamp(s),gi({version:s,hasNext:!n})}))}}mE=new WeakSet,SE=function(e,t){if(6===t.type)this.push(t.time),e.stopPropagation()},vE=function(e,t){t.conversationType===w.ULTRA_GROUP&&(this.push(t.sentTime),e.stopPropagation())},NE=function e(s,n){return t(this,void 0,void 0,(function*(){const{currentUserId:t,logger:o}=this._ctx,a=o.createTraceId();o.info(r.L_PULL_UG_RELATIONS_T,JSON.stringify({ver:s}),a);const l=Uc.encode(Na,{syncTime:s,isEraseMsgContent:!1}),c=yield this._ctx.query($s.pullUgSes,t,l,void 0);if(o.summary(r.L_PULL_UG_RELATIONS_R,c,a,{ver:s}),!c.isOk)return c.wipe();const{info:_,isFinished:d}=Fg(c.data.pbData);if(n.push(..._),!d){const t=_[_.length-1].versionTime;return i(this,mE,"m",e).call(this,t,n)}return gi(n)}))},OE=function(e){return t(this,void 0,void 0,(function*(){const{currentUserId:t,logger:i}=this._ctx,s=i.createTraceId();i.info(r.L_PULL_ULTRA_MSG_T,JSON.stringify({version:e}),s);const n=(o=e,Uc.encode(Oa,{syncTime:o,compressioEnabled:bs.enable()}));var o;const a=yield this._ctx.query($s.pullUgMsg,t,n);if(i.summary(r.L_PULL_ULTRA_MSG_R,a,s,{version:e}),!a.isOk)return a.wipe();const l=a.data;return gi(Bg(l.pbData))}))};const LE=13,UE=36,PE=41;class DE extends di{constructor(e,t){super("WebServerEventHandler"),yE.add(this),Object.defineProperty(this,"_con",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t})}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const t=this._logger.createTraceId();this._logger.info(r.L_PULL_EVENT_CHANGE_T,JSON.stringify({version:e}),t);const s=yield i(this,yE,"m",CE).call(this,e);if(this._logger.summary(r.L_PULL_EVENT_CHANGE_R,s,t,{version:e}),!s.isOk)return s.wipe();const{list:n,syncTime:o,hasNext:a}=s.data;if(n.length){const e=new Map;n.forEach((t=>{const i=t.changeType;e.has(i)?e.get(i).push(t):e.set(i,[t])})),Array.from(e.entries()).forEach((([e,t])=>{this.emit("serverEvent",e,t)}))}return gi({version:o,hasNext:a})}))}noticeOnline(){return t(this,void 0,void 0,(function*(){const e=this._logger.createTraceId();this._logger.info(r.L_SERVER_EVENT_NOTIFY_ONLINE_T,JSON.stringify({version:0}),e);const t=yield i(this,yE,"m",CE).call(this,0);return this._logger.summary(r.L_SERVER_EVENT_NOTIFY_ONLINE_R,t,e,{version:0}),t}))}}var wE,GE,VE;yE=new WeakSet,CE=function(e){const t=Uc.encode(Ma,{syncTime:e});return this._con.query($s.pullEventChange,this._con.getCurrentUserId(),t,ba)};class kE extends di{constructor(e){super("WebUGServerEventHandler"),wE.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e})}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Ma,{syncTime:e}),s=yield this._ctx.query($s.qryMsgChange,this._ctx.currentUserId,t,La);if(!s.isOk)return s.wipe();const{list:n,syncTime:r,hasNext:o}=s.data;return n&&n.length&&i(this,wE,"m",GE).call(this,n),gi({version:r,hasNext:o})}))}_handleReactions(e){const t=Object.values(De),i=e.map((e=>{const t=Uc.decode(Ac,new Uint8Array(e));return cE(t)})).filter((({operationType:e})=>t.includes(e)));i.length&&this._ctx.emit("messageReaction",{reactions:i})}}wE=new WeakSet,GE=function(e){const t=[],s=[],n=[],r=[],o=[],a=[];e.forEach((e=>{const{changeType:i}=e;switch(i){case 1:s.push(e);break;case 2:t.push(e);break;case 3:n.push(e);break;case 4:r.push(e);break;case 5:o.push(e);break;case 6:break;case 7:a.push(e.eventData)}})),s.length&&i(this,wE,"m",VE).call(this,s,1),t.length&&i(this,wE,"m",VE).call(this,t,2),n.length&&this.emit("ugMsgRecalled",n),r.length&&this._ctx.emit("ugChannelChanged",r),o.length&&this._ctx.emit("ugUserGroupChanged",o),this._handleReactions(a)},VE=function(e,t){const i=new Map;e.forEach((e=>{const{targetId:t,busChannel:s,msgUID:n}=e,r=`${t}-${s}`,o=i.get(r);o?o.messageUIds.push(n):i.set(r,{conversationIdentifier:{conversationType:w.ULTRA_GROUP,targetId:t,channelId:s},messageUIds:[n]})})),Array.from(i.entries()).forEach((([e,i])=>{1===t?this.emit("ugMsgExpansion",i.conversationIdentifier,i.messageUIds):this.emit("ugMsgModify",i.conversationIdentifier,i.messageUIds)}))};const xE=()=>t(void 0,void 0,void 0,(function*(){return Ei(D.NOT_SUPPORT,"Not support")}));var FE,BE,HE,jE,YE,WE,qE,JE,KE,QE,XE,zE,ZE,$E,eI,tI,iI,sI,nI,rI,oI,aI,lI,cI,_I,dI,uI,hI,gI,EI,II,TI,fI,RI,AI,pI,mI,SI,vI,NI,OI,yI,CI,MI,bI,LI,UI;class PI extends di{constructor(e,t){super("WebSGMsgModifyReceiver"),FE.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:t}),BE.set(this,!0),this._ctx.on("onConnected",i(this,FE,"m",HE),this)}_handleModifyNotifies(e){if(0===e.length)return;const{currentUserId:t}=this._ctx,i=[];e.forEach((({modifyType:e,msg:s})=>{const n=y_(s,t,!1);i.push(n);const{conversationType:r,targetId:o,channelId:a}=n,l=this.storage.getModel({conversationType:r,targetId:o,channelId:a});if(!l||!l.latestMessage)return;const{messageUId:c,messageType:_,content:d}=l.latestMessage;if(c!==n.messageUId){if(_===Q.REFERENCE){const{referMsgUid:e}=d;if(e!==n.messageUId)return;d.referMsg=n.content}}else l.updateAttrs({latestMessage:n})})),this._ctx.emit("messageModified",i)}_handleReactionNotifies(e){if(0===e.length)return;const t=Object.values(De),i=e.filter((({reaction:e})=>t.includes(e.opType))).map((({reaction:e})=>cE(e)));i.length&&this._ctx.emit("messageReaction",{reactions:i})}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const t=this._ctx.logger.createTraceId();this._ctx.logger.info(r.L_PULL_MODIFY_MSG_T,JSON.stringify({time:e}),t);const n=Uc.encode(Bl,{pullVersion:e,modifyType:[1,3],compress:bs.enable()}),o=yield this._ctx.query($s.pullModifyMsg,this._ctx.currentUserId,n,void 0);if(this._ctx.logger.summary(r.L_PULL_MODIFY_MSG_R,o,t),!o.isOk)return o.wipe();const{msg:a,nextVersion:l,finished:c}=Xg(o.data.pbData);return a&&a.length&&i(this,FE,"m",jE).call(this,a),i(this,BE,"f")&&(this._ctx.emit("messageModifiedSyncCompleted",!c),s(this,BE,!1,"f")),gi({version:l,hasNext:!c})}))}}BE=new WeakMap,FE=new WeakSet,HE=function(e,t){s(this,BE,!0,"f"),t||this.reset()},jE=function(e){const t=[],i=[];e.forEach((e=>{const{modifyType:s}=e;1===s?t.push(e):3===s&&i.push(e)})),this._handleModifyNotifies(t),this._handleReactionNotifies(i)};const DI=18e4;class wI extends _i{constructor(e,t,n){super(),YE.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_userSettins",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),WE.set(this,void 0),qE.set(this,void 0),JE.set(this,void 0),KE.set(this,void 0),QE.set(this,void 0),XE.set(this,!1),zE.set(this,void 0),ZE.set(this,!1),uI.set(this,1),Object.defineProperty(this,"getUntaggedConversationListByPage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),yI.set(this,new Set),Object.defineProperty(this,"searchConversationByContent",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setMessageSpeechToTextVisible",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"syncRemoteConversations",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getHistoryMessagesByObjectNames",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getContinuousMessages",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getMessagesAroundTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"deleteLocalUGMessagesForAllChannel",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getUnreadMentionedMessages",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getFirstUnreadMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getConversations",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"clearConversations",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"saveEditedMessageDraft",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getEditedMessageDraft",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"clearEditedMessageDraft",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"clearUnreadCountByTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:xE}),s(this,zE,new _i,"f"),s(this,QE,n,"f"),this.storage=new yd(e),this.settings=new cd(this._ctx,this.storage,this),s(this,WE,new bE(this._ctx,this.storage),"f"),s(this,qE,new ME(this._ctx,this.storage,i(this,zE,"f")),"f"),s(this,JE,new kE(this._ctx),"f"),s(this,KE,new PI(this._ctx,this.storage),"f"),i(this,zE,"f").on("messages",i(this,YE,"m",oI),this),i(this,zE,"f").on("__firstOfflineMessageTime__",((e,t)=>{i(this,KE,"f").setInitVersion(t||this._ctx.connectedTime)}),this),i(this,JE,"f").on("ugMsgModify",i(this,YE,"m",EI),this),i(this,JE,"f").on("ugMsgExpansion",i(this,YE,"m",II),this),i(this,JE,"f").on("ugMsgRecalled",i(this,YE,"m",TI),this),this._ctx.on("onConnected",i(this,YE,"m",dI),this),this._ctx.on("onDisconnected",i(this,YE,"m",AI),this),this._ctx.on("onSuspend",i(this,YE,"m",AI),this),this._ctx.on("sCmd",i(this,YE,"m",pI),this),this._ctx.on("sNtf",i(this,YE,"m",mI),this),this._ctx.on("signal",i(this,YE,"m",SI),this),this._ctx.on("serverEvent",i(this,YE,"m",aI),this),this._ctx.on("robotsSynced",i(this,YE,"m",$E),this)}get ugSynced(){return i(this,XE,"f")}getConversationListByTimestamp(e,s){return t(this,void 0,void 0,(function*(){const{count:t,startTime:n,order:r,conversationTypes:o}=e;if(!s)return i(this,YE,"m",vI).call(this,n,t,r||0,o);const a=0!==n||r?n:Number.MAX_SAFE_INTEGER;let l=this.storage.getAllModels();o&&o.length>0&&(l=l.filter((e=>o.includes(e.conversationType)))),l=l.filter((e=>!e.hidden&&(e.conversationType!==w.ULTRA_GROUP||!e.channelId||"RCDefault"===e.channelId)&&(r?e.operationTime>a:e.operationTime<a))).sort(((e,t)=>e.operationTime-t.operationTime));const c=Math.min(l.length,t),_=r?l.slice(0,c):l.slice(l.length-c);return r||_.reverse(),gi(_.map((e=>e.toIReceivedConversation())))}))}getTopConversationList(e,s,n){return t(this,void 0,void 0,(function*(){const t=((null==s?void 0:s.length)||0)>0?s:Y(e?k:G),r="string"==typeof n&&""!==n,o=this.storage.getAllModels().filter((i=>i.isTop&&!i.hidden&&t.includes(i.conversationType)&&(i.conversationType!==w.ULTRA_GROUP&&(!r||i.channelId===n)||e&&(!i.channelId||"RCDefault"===i.channelId)))).sort(((e,t)=>e.operationTime-t.operationTime)).map((e=>e.toIReceivedConversation()));return i(this,YE,"m",NI).call(this,o)}))}getBlockedConversationList(){return t(this,void 0,void 0,(function*(){const{includeUg:e}=this._ctx,t=this.storage.getAllModels().filter((t=>!t.hidden&&t.notificationLevel>Ee.NOT_SET&&(t.conversationType!==w.ULTRA_GROUP||e&&(!t.channelId||"RCDefault"===t.channelId)))).sort(((e,t)=>e.operationTime-t.operationTime)).map((e=>e.toIReceivedConversation()));return i(this,YE,"m",NI).call(this,t)}))}getUnreadConversationList(e,s){return t(this,void 0,void 0,(function*(){const t=((null==s?void 0:s.length)||0)>0?s:Y(e?k:G),n=this.storage.getAllModels().filter((i=>i.unreadCount>0&&t.includes(i.conversationType)&&(i.conversationType!==w.ULTRA_GROUP||e&&(!i.channelId||"RCDefault"===i.channelId)))).sort(((e,t)=>e.operationTime-t.operationTime)).map((e=>e.toIReceivedConversation()));return i(this,YE,"m",NI).call(this,n)}))}getAllConversationList(e,s){return t(this,void 0,void 0,(function*(){const t="string"==typeof s;if(e){const e=this.storage.getAllModels().filter((e=>!(e.hidden||(e.conversationType===w.ULTRA_GROUP||t&&e.channelId!==s)&&e.channelId&&"RCDefault"!==e.channelId))).sort(((e,t)=>e.operationTime-t.operationTime)).map((e=>e.toIReceivedConversation()));return gi(e)}return(yield i(this,YE,"m",vI).call(this,0,1e3,0)).trans((e=>e.filter((e=>!t||e.channelId===s))))}))}getTotalUnreadCount(e,i,s){return t(this,void 0,void 0,(function*(){let t=0;return this.storage.getAllModels().forEach((n=>{n.unreadCount>0&&e.includes(n.conversationType)&&(n.conversationType!==w.ULTRA_GROUP&&(!s&&!n.channelId||n.channelId===s)||n.conversationType===w.ULTRA_GROUP&&(""===n.channelId||"RCDefault"===n.channelId))&&(i||n.notificationLevel<=Ee.NOT_SET)&&(t+=n.unreadCount)})),gi(t)}))}getConversation(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getOrCreateModel(e,!1).toIReceivedConversation(),s=yield i(this,YE,"m",NI).call(this,[t]);return s.isOk?s.trans((e=>e[0])):gi(t)}))}batchSetConversationToTop(e,s,n,r){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),n=yield i(this,YE,"m",OI).call(this,e,t,s);if(!n.isOk)return n.wipe();const{version:o,updateVersion:a}=n.data,l=e.map((e=>{const t=this.storage.getOrCreateModel(e,!0);return t.updateAttrs({isTop:s,hidden:!r&&t.hidden,operationTime:t.hidden&&r?Date.now():t.operationTime}),t}));return this.storage.updateConversationStorage(l),a&&this.storage.set("conversationStatusVersion",o),gi()}))}batchSetConversationNotificationLevel(e,s){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),n=yield i(this,YE,"m",OI).call(this,e,t,void 0,s);if(!n.isOk)return n.wipe();const{version:r,updateVersion:o}=n.data,a=e.map((e=>{const t=this.storage.getOrCreateModel(e,!0);return t.updateAttrs({notificationLevel:s}),t}));return this.storage.updateConversationStorage(a),o&&this.storage.set("conversationStatusVersion",r),gi()}))}batchSetConversationTranslateStrategy(e,s){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),n=yield i(this,YE,"m",OI).call(this,e,t,void 0,void 0,s);if(!n.isOk)return n.wipe();const{version:r,updateVersion:o}=n.data,a=e.map((e=>{const t=this.storage.getOrCreateModel(e,!0);return t.updateAttrs({translateStrategy:s}),t}));return this.storage.updateConversationStorage(a),o&&this.storage.set("conversationStatusVersion",r),gi()}))}getConversationNotificationLevel(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getOrCreateModel(e,!1);return gi(t.notificationLevel)}))}getConversationTypeNotificationLevel(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getConversationTypeNotificationLevel(e);return gi(t)}))}setConversationTypeNotificationLevel(e,i){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),{currentUserId:s}=this._ctx,n=Uc.encode(ua,{type:e,unpushLevel:i,version:t,ignoreVersion:!0}),r=yield this._ctx.query($s.setTypeUnpush,s,n,ha);if(!r.isOk)return r.wipe();const{version:o,updateVersion:a}=r.data;return this.storage.setConversationTypeNotificationLevel(e,i),a&&this.storage.set("conversationStatusVersion",o),gi()}))}clearAllSGUnreadCount(){return t(this,void 0,void 0,(function*(){const e=this.storage.getAllSGModels(),t=this._ctx.serverTime;return e.forEach((e=>e.clearUnreadCount(t))),this.storage.updateConversationStorage(e),gi()}))}deleteRemoteMessage(e,i){return t(this,void 0,void 0,(function*(){const t=i.map((e=>({msgDataTime:e.sentTime,msgId:e.messageUId,direct:e.messageDirection}))),s=Uc.encode(Qo,{type:e.conversationType,busChannel:e.channelId,conversationId:e.targetId,msgs:t}),n=e.conversationType===w.ULTRA_GROUP?$s.delUgMsg:$s.delMsg,r=yield this._ctx.query(n,this._ctx.currentUserId,s);if(!r.isOk)return r.wipe();if(!this._ctx.includeUg)return gi();const o=this.storage.getModel(e);if(o){const{latestMessage:e}=o;e&&i.some((t=>t.messageUId===e.messageUId))&&o.updateAttrs({latestMessage:null})}return gi()}))}deleteRemoteMessageByTimestamp(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Go,{conversationType:e.conversationType,targetId:e.targetId,busChannel:e.channelId,dataTime:i}),s=GI[e.conversationType],n=yield this._ctx.query(s,this._ctx.currentUserId,t);if(!n.isOk)return n.wipe();if(!this._ctx.includeUg)return gi();const r=this.storage.getModel(e);if(r){const{latestMessage:e}=r;e&&(0===i||e.sentTime<=i)&&r.updateAttrs({latestMessage:null})}return gi()}))}batchClearRemoteHistoryMessages(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Vo,{input:e.map((e=>({conversationType:e.conversationType,targetId:e.targetId,busChannel:e.channelId,dataTime:e.timestamp||0})))}),i=yield this._ctx.query($s.cleanMsgBatch,this._ctx.currentUserId,t);return i.isOk?(e.forEach((e=>{const t=this.storage.getModel(e);if(t){const{latestMessage:i}=t;i&&(!e.timestamp||i.sentTime<=e.timestamp)&&t.updateAttrs({latestMessage:null})}})),gi()):i.wipe()}))}sendReadReceiptResponseV5(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Ea,{targetId:e.targetId,type:e.conversationType,channelId:e.channelId,readType:0,msgIds:i}),s=i[0];return(yield this._ctx.query($s.readReceipt,s,t)).wipe()}))}getMessageReadReceiptInfoV5ByIdentifiers(e){return t(this,void 0,void 0,(function*(){const t=new Map;e.forEach((e=>{const i=dd(e.identifier),s=t.get(i)||new Set;s.add(e.messageUId),t.set(i,s)}));const i=(e=>Uc.encode(Ta,{items:e,compress:bs.enable()}))(Array.from(t.entries()).map((([e,t])=>{const i=ud(e);return{targetId:i.targetId,type:i.conversationType,busChannel:i.channelId,msgIds:Array.from(t)}}))),s=yield this._ctx.query($s.qryReceiptBatch,e[0].messageUId,i);if(!s.isOk)return s.wipe();const n=s.data,{item:r}=Wg(n.pbData),o=[];return r.forEach((e=>{var t;const i={conversationType:e.type,targetId:e.targetId,channelId:e.busChannel};null===(t=e.msg)||void 0===t||t.forEach((({msgId:e,unreadCnt:t,readCnt:s,totalCnt:n})=>{o.push({identifier:i,messageUId:e,unreadCount:t,readCount:s,totalCount:n})}))})),gi(o)}))}getMessagesReadReceiptUsersByPageV5(e,i,s){return t(this,void 0,void 0,(function*(){const t=0===s.readStatus?1:2,n=jg({targetId:e.targetId,type:e.conversationType,busChannel:e.channelId,msgIds:[i],qryType:1,pageType:1,pageToken:s.pageToken,pageSize:s.pageCount,readType:t,order:s.order?0:1}),r=yield this._ctx.query($s.qryReceipt,i,n);if(!r.isOk)return r.wipe();const o=r.data,{resp:a,pageToken:l}=Yg(o.pbData),c=a[0];return gi({pageToken:l||"",totalCount:1===t?c.readCnt:c.unreadCnt,users:(1===t?c.readUser:c.unreadUser).map((e=>{const{userId:t,mentioned:i,receiptTime:s}=e;return{userId:t,timestamp:s||0,isMentioned:!!i}}))})}))}getMessagesReadReceiptByUsersV5(e,i,s){return t(this,void 0,void 0,(function*(){const t=jg({targetId:e.targetId,type:e.conversationType,busChannel:e.channelId,msgIds:[i],qryType:2,users:s}),n=yield this._ctx.query($s.qryReceipt,i,t);if(!n.isOk)return n.wipe();const r=n.data,{resp:o}=Yg(r.pbData),a=o[0];return gi({pageToken:"",totalCount:0,users:[...a.readUser,...a.unreadUser].map((e=>{const{userId:t,mentioned:i,receiptTime:s}=e;return{userId:t,timestamp:s||0,isMentioned:!!i}}))})}))}requestSpeechToTextForMessage(e,s){return t(this,void 0,void 0,(function*(){const t=Ii.create("requestSpeechToTextForMessage").isObject("option",s,!0).fail(D.BIZ_ERROR_INVALID_PARAMETER,"option type error").validate("messageType",null==s?void 0:s.messageType,(e=>e===Q.HQ_VOICE||e===Q.VOICE),!0).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).check((e=>{if(s.messageType===Q.HQ_VOICE)e.validate("numberOfChannels",s.numberOfChannels,(e=>1===e),!0).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"numberOfChannels invalid").validate("sampleRate",s.sampleRate,(e=>16e3===e||8e3===e),!0).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"sampleRate invalid").isString("format",s.format).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"format invalid").isHttpUrl("remoteUrl",s.remoteUrl,!0).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"remoteUrl invalid");else{const{content:t}=s;e.isNotEmptyString("content",t,!0).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"content invalid")}})).isLimitedInteger("duration",s.duration,1,60,!0).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"duration invalid").result();return t.isOk?i(this,yI,"f").has(e)?Ei(D.SPEECH_TO_TEXT_REQUEST_IN_PROCESS,"speech to text request in process"):(i(this,YE,"m",CI).call(this,e,s),gi()):t.wipe()}))}modifyMessageWithParams(e){return t(this,void 0,void 0,(function*(){const{messageUId:t,messageContent:i,conversation:s}=e,n=Uc.encode(ya,{targetId:s.targetId,type:s.conversationType,busChannel:s.channelId,msgUID:t,msgTime:0,content:JSON.stringify(i),fromUserId:""}),r=yield this._ctx.query($s.modifyMsg,this._ctx.currentUserId,n,Ca);if(!r.isOk)return r.wipe();const o=this.storage.getModel(s);if(o){const{latestMessage:e,conversationType:s}=o;e&&e.messageUId===t&&(e.content=i,e.isModifyMessage=!0,e.modifyInfo=s===w.ULTRA_GROUP?void 0:{timestamp:r.data.modifyTime,status:Gi.SUCCESS,content:{}},o.updateAttrs({latestMessage:e}))}return gi()}))}refreshReferenceMessageWithParams(e,s,n,r,o){return t(this,void 0,void 0,(function*(){const t=Ii.create("refreshReferenceMessageWithParams").validate("messageInfoMap",o,(t=>t&&e.every((e=>t[e]&&pt(t[e])))),!0).fail(D.INVALID_PARAMETER_MESSAGE_INFO_MAP).result();return t.isOk?(setTimeout((()=>{r([]),i(this,YE,"m",bI).call(this,e,s,n,o)}),0),gi()):t.wipe()}))}addTagForConversations(e,i){return t(this,void 0,void 0,(function*(){if(!this._userSettins.hasTag(e))return Ei(D.TAG_NOT_EXIST);const t=this.storage.get("conversationStatusVersion"),s=Date.now(),{currentUserId:n}=this._ctx,r=i.map((t=>({type:t.conversationType,channelId:t.targetId,busChannel:t.channelId,time:s,stateItem:[{sessionStateType:Cc.Tags,value:"",tags:[{tagId:e}]}]}))),o=Qg(t,r),a=yield this._ctx.query($s.addTag,n,o,da);if(!a.isOk)return a.wipe();const{version:l,updateVersion:c}=a.data,_=new Map;i.forEach((t=>{const i=this.storage.getOrCreateModel(t,!0),s={},{tags:n}=i;n.some((t=>t.tagId===e))||(s.tags=n.concat({tagId:e}),_.set(i,s))}));const d=[],u=[];return Array.from(_.entries()).forEach((([e,t])=>{u.push(e);const i=e.updateAttrs(t,l);i&&d.push({conversation:e.toIReceivedConversation(),updatedItems:i})})),this.storage.updateConversationStorage(u),c&&this.storage.set("conversationStatusVersion",l),d.length>0&&this.emit("conversationStatusChanged",d),gi()}))}getTagsForConversation(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getOrCreateModel(e,!1),i=this._userSettins.getTags(),s=t.tags.map((e=>{var t;return{tagId:e.tagId,tagName:null===(t=i[e.tagId])||void 0===t?void 0:t.tagName}}));return gi(s)}))}setConversationStatusInTag(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),{isTop:n}=s,r=this.storage.getOrCreateModel(i,!1),{tags:o}=r,a=o.find((t=>t.tagId===e));if(!a)return Ei(D.NO_TAG_IN_CONVER);const l=Qg(t,[{type:i.conversationType,channelId:i.targetId,busChannel:i.channelId,time:Date.now(),stateItem:[{sessionStateType:Cc.Tags,value:"",tags:[{tagId:e,isTop:n}]}]}]),{currentUserId:c}=this._ctx,_=yield this._ctx.query($s.addTag,c,l,da);if(!_.isOk)return _.wipe();const{version:d,updateVersion:u}=_.data;return a.isTop=n,r.updateAttrs({tags:o},d),this.storage.updateConversationStorage([r]),u&&this.storage.set("conversationStatusVersion",d),gi()}))}removeTagForConversations(e,i){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),s=Qg(t,i.map((t=>({type:t.conversationType,channelId:t.targetId,busChannel:t.channelId,time:Date.now(),stateItem:[{sessionStateType:Cc.Tags,value:"",tags:[{tagId:e}]}]})))),{currentUserId:n}=this._ctx,r=yield this._ctx.query($s.delTag,n,s,da);if(!r.isOk)return r.wipe();const{version:o,updateVersion:a}=r.data,l=i.map((t=>{const i=this.storage.getOrCreateModel(t,!0),{tags:s}=i,n={tags:s.filter((t=>t.tagId!==e))};return i.updateAttrs(n,o),i}));return this.storage.updateConversationStorage(l),a&&this.storage.set("conversationStatusVersion",o),gi()}))}removeTagsForConversation(e,i){return t(this,void 0,void 0,(function*(){const{currentUserId:t}=this._ctx,s=this.storage.get("conversationStatusVersion"),n=Qg(s,[{type:e.conversationType,channelId:e.targetId,busChannel:e.channelId,time:Date.now(),stateItem:[{sessionStateType:Cc.Tags,value:"",tags:i.map((e=>({tagId:e})))}]}]),r=yield this._ctx.query($s.delTag,t,n,da);if(!r.isOk)return r.wipe();const{version:o,updateVersion:a}=r.data,l=this.storage.getOrCreateModel(e,!0),{tags:c}=l,_={tags:c.filter((e=>!i.includes(e.tagId)))};return l.updateAttrs(_,o),this.storage.updateConversationStorage([l]),a&&this.storage.set("conversationStatusVersion",o),gi()}))}getConversationListByTag(e,s,n){return t(this,void 0,void 0,(function*(){if(!this._userSettins.hasTag(e))return gi([]);const t=s||Number.MAX_SAFE_INTEGER,r=this.storage.getAllSGModels().filter((i=>i.operationTime<t&&i.tags.some((t=>t.tagId===e)))).sort(((e,t)=>t.operationTime-e.operationTime)).slice(0,n);if(0===r.length)return gi([]);const o=r.map((t=>Object.assign(Object.assign({},t.toIReceivedConversation()),{isTopInTag:t.tags.some((t=>t.tagId===e&&t.isTop))})));return i(this,YE,"m",NI).call(this,o)}))}getUnreadCountByTag(e,i){return t(this,void 0,void 0,(function*(){let t=0;return this.storage.getAllSGModels().forEach((s=>{var n;if(s.tags.some((t=>t.tagId===e))){if(s.notificationLevel>Ee.NOT_SET&&!i)return;t+=null!==(n=s.unreadCount)&&void 0!==n?n:0}})),gi(t)}))}batchDeleteConversations(e){return t(this,void 0,void 0,(function*(){const{identifiers:t,deleteMessages:i}=e,s=Uc.encode(Ko,{relation:t.map((({conversationType:e,targetId:t,channelId:i})=>({conversationType:e,conversationId:t,busChannel:i}))),cleanMsg:i}),n=yield this._ctx.query($s.delRelationBatch,this._ctx.currentUserId,s,void 0);return n.isOk&&t.forEach((e=>{const t=this.storage.getModel(e);t&&this.storage.removeConversation(t)})),n.wipe()}))}sendReadReceiptV2(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ga,{msgId:i,channelId:s});return(yield this._ctx.query($s.rrMsg,e,t)).wipe()}))}sendUltraGroupTypingStatus(e){return t(this,void 0,void 0,(function*(){const{conversationType:t,channelId:i,targetId:s}=e,n=Uc.encode(Da,{targetId:s,type:t,busChannel:i||"",opType:0}),r=new Or($s.operate,n,s);r.setHeaderQos(nn);return(yield this._ctx.send(r)).wipe()}))}getUltraGroupList(e){return t(this,void 0,void 0,(function*(){const{targetId:t,channelType:i}=e||{},s=this.storage.getAllUGModels().filter((e=>!(void 0!==t&&t!==e.targetId||void 0!==i&&i!==e.channelType))).sort(((e,t)=>{var i,s;const n=(null===(i=e.latestMessage)||void 0===i?void 0:i.sentTime)||0;return((null===(s=t.latestMessage)||void 0===s?void 0:s.sentTime)||0)-n})).map((e=>{const t=e.toIReceivedConversation();return t.unreadMentionedCount=D_(t.unreadMentionedCount||0),t.unreadMessageCount=D_(t.unreadMessageCount||0),t.unreadMentionedMeCount=D_(t.unreadMentionedMeCount||0),t}));return gi(s)}))}getRemoteMessagesByUIds(e,s){return t(this,void 0,void 0,(function*(){const{currentUserId:t}=this._ctx,n=yield i(this,YE,"m",MI).call(this,e,s);if(!n.isOk)return n.wipe();const{list:r,notExistMsgId:o}=n.data,a=r.map((i=>y_(i,t,!1,e.targetId)));return gi(a)}))}getUGUnreadMentionedDigest(e){return t(this,void 0,void 0,(function*(){const{targetId:t,channelId:i,sentTime:s,count:n}=e,r=Uc.encode(Do,{groupId:t,busChannel:i,msgTime:s,size:n}),o=yield this._ctx.query($s.qryUgUal,this._ctx.currentUserId,r,wo);if(!o.isOk)return o.wipe();const{msgInfo:a}=o.data;return gi(a.map((e=>({messageUId:e.msgId,sentTime:e.msgTime,messageType:e.className,mentionedType:e.remindType}))))}))}updateUGMessageExpansion(e,i,s){var n;return t(this,void 0,void 0,(function*(){const{currentUserId:t}=this._ctx,{mid:r,put:o,del:a,clear:l}=i,c=Uc.encode(ya,{fromUserId:t,targetId:e.targetId,type:e.conversationType,busChannel:e.channelId,msgUID:r,msgTime:s,content:JSON.stringify(i)}),_=yield this._ctx.query($s.upMsgEx,e.targetId,c);if(_.isOk){const t=null===(n=this.storage.getModel(e))||void 0===n?void 0:n.latestMessage;(null==t?void 0:t.messageUId)===r&&(l?t.expansion={}:o?t.expansion=Object.assign(Object.assign({},t.expansion),o):a&&t.expansion&&a.forEach((e=>{delete t.expansion[e]})))}return _.wipe()}))}setUGDefaultNotificationLevel(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ca,{unpushLevel:i,busChannel:s});return(yield this._ctx.query($s.ugUnpushSet,e,t)).wipe()}))}getUGDefaultNotificationLevel(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(la,{busChannel:i}),s=yield this._ctx.query($s.ugUnpushQuery,e,t,_a);if(!s.isOk)return s.wipe();const{unpushLevel:n}=s.data;return gi(n)}))}getUnreadMentionedCount(e){var i;return t(this,void 0,void 0,(function*(){const t=this.storage.getModel(e);return gi(null!==(i=null==t?void 0:t.unreadMentionedCount)&&void 0!==i?i:0)}))}getAllUnreadMentionedCount(){return t(this,void 0,void 0,(function*(){const e=this.storage.getAllSGModels().reduce(((e,t)=>e+t.unreadMentionedCount),0);return gi(e)}))}getTotalUnreadCountByLevels(e,i,s){return t(this,void 0,void 0,(function*(){let t=0;return this.storage.getAllModels().forEach((n=>{if(!e.includes(n.conversationType))return;const{notificationLevel:r,unreadCount:o,unreadMentionedCount:a}=n;(0===i.length||i.includes(r))&&(t+=s?a:o)})),gi(t)}))}getConversationUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getModel(e);return gi(t?t.unreadCount:0)}))}getFirstUnreadMessageDigest(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getModel(e);if(!t)return gi(null);const i=t.firstUnreadMessage;return gi(i?{messageUId:i.messageUId||"",sentTime:i.sentTime}:null)}))}getUGUnreadCountForAllChannels(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.storage.getAllUGModels().reduce(((t,n)=>{const r=s?n.unreadMentionedCount:n.unreadCount;if(!r||n.targetId!==e)return t;const o=n.notificationLevel||Ee.NOT_SET;return!i.length||i.includes(o)?t+r:t}),0);return gi(D_(t))}))}getUGUnreadInfoList(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getAllUGModels().filter((t=>e.includes(t.targetId))).map((e=>({conversationType:e.conversationType,type:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadMessageCount:D_(e.unreadCount||0),mentionedCount:D_(e.unreadMentionedCount||0),mentionedMeCount:D_(e.unreadMentionedMeCount||0),notificationLevel:e.notificationLevel||Ee.NOT_SET})));return gi(t)}))}getUGFirstUnreadMessageDigest(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getModel(e),i=null==t?void 0:t.firstUnreadMessage;return i?gi(i):Ei(D.RC_DB_DATA_NOT_FOUND)}))}getBlockedUGList(){return t(this,void 0,void 0,(function*(){const e=this.storage.getAllUGModels().filter((e=>e.notificationLevel>Ee.NOT_SET)).map((e=>e.toIReceivedConversation()));return gi(e)}))}clearConversationUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=this._ctx.serverTime;if(e.conversationType===w.ULTRA_GROUP){const i=xg(e,t),s=new Or($s.updUgRTime,i,this._ctx.currentUserId);s.setHeaderQos(nn);const n=yield this._ctx.send(s);if(!n.isOk)return n.wipe()}return this.storage.clearConversationUnreadCount(e,t),gi()}))}getRealtimeConversations(e,s,n){return t(this,void 0,void 0,(function*(){const t=yield i(this,YE,"m",UI).call(this,s,n,e,[],Ce.ALL,$s.qrySessions);if(!t.isOk)return t.wipe();const{currentUserId:r}=this._ctx,o=t.data.info.map((e=>{const{unreadCount:t,busChannel:i,type:s,userId:n,versionTime:o,msg:a}=e,l=this.storage.getOrCreateModel({conversationType:s,targetId:n,channelId:i||""},!1);return Object.assign(Object.assign({},l.toIReceivedConversation()),{unreadMessageCount:t,operationTime:o,latestMessage:a?y_(a,r,!1,n):null})})).sort(((e,t)=>{var i,s;const r=(null===(i=e.latestMessage)||void 0===i?void 0:i.sentTime)||0,o=(null===(s=t.latestMessage)||void 0===s?void 0:s.sentTime)||0;return 0===n?o-r:r-o}));return gi(o)}))}getRealtimeConTotalUnreadCount(){return t(this,void 0,void 0,(function*(){const e=Uc.encode(Ho,{nothing:1});return(yield this._ctx.query($s.qrySessionsAtt,this._ctx.currentUserId,e,jo)).trans((e=>e.totalUnreadCount))}))}clearRealtimeConUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=this._ctx.serverTime;this.storage.clearConversationUnreadCount(e,this._ctx.serverTime);const i=xg(e,t),s=new Or($s.updRRTime,i,this._ctx.currentUserId);return(yield this._ctx.send(s)).wipe()}))}removeRealtimeConversations(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Wo,{sessions:e.map((e=>({type:e.conversationType,channelId:e.targetId,busChannel:e.channelId})))});return(yield this._ctx.query($s.delSessions,this._ctx.currentUserId,t)).wipe()}))}batchGetRealtimeConUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(qo,{sessions:e.map((e=>({type:e.conversationType,channelId:e.targetId,busChannel:e.channelId})))});return(yield this._ctx.query($s.qrySessionsUnread,this._ctx.currentUserId,t,Jo)).trans((e=>e.sessions.map((e=>({conversationType:e.type,targetId:e.channelId,channelId:e.busChannel||"",unreadCount:e.unreadCount||0})))))}))}getUnreadMentionMeConversationList(e,s){return t(this,void 0,void 0,(function*(){const{count:t,conversationTypes:n}=e,r=e.timestamp||Number.MAX_SAFE_INTEGER;if(s){const e=this.storage.getAllModels().filter((e=>e.operationTime<r&&e.unreadMentionedCount>0&&n.includes(e.conversationType)&&(e.conversationType!==w.ULTRA_GROUP||!e.channelId||"RCDefault"===e.channelId))).sort(((e,t)=>t.operationTime-e.operationTime)).slice(0,t);return gi(e.map((e=>e.toIReceivedConversation())))}const o=this.storage.getAllSGModels().filter((e=>e.operationTime<r&&e.unreadMentionedCount>0&&n.includes(e.conversationType))).sort(((e,t)=>t.operationTime-e.operationTime)).slice(0,t).map((e=>e.toIReceivedConversation()));return i(this,YE,"m",NI).call(this,o)}))}loadConversationList(e,i,s){return t(this,void 0,void 0,(function*(){const t=((e,t,i)=>{const{conversationTypes:s,tagFilter:n={},order:r,channelId:o}=i,{tagIds:a,topPriority:l}=n;return Uc.encode(Uo,{type:s,count:t,order:r,tags:a,isTagTop:!!l,pageToken:e,compress:bs.enable()})})(e,i,s),n=yield this._ctx.query($s.qryRelationFilter,this._ctx.currentUserId,t,void 0);if(!n.isOk)return n.wipe();const{pageToken:r,isFinished:o,info:a}=Fg(n.data.pbData),l=a.map((e=>{const{busChannel:t,type:i,userId:s}=e,n={conversationType:i,targetId:s,channelId:t||""},r=this.storage.getOrCreateModel(n,!1);return Object.assign(Object.assign({},r.toIReceivedConversation()),{operationTime:e.versionTime,latestMessage:e.msg?y_(e.msg,this._ctx.currentUserId,!1,s):null})}));return gi({pageToken:r||"",finished:!!o,list:l})}))}updateConversationReadTime(e,i){return t(this,void 0,void 0,(function*(){const t=xg(e,i),s=new Or($s.updRTime,t,this._ctx.currentUserId);return(yield this._ctx.send(s)).wipe()}))}getMessageReader(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ga,{msgId:[i],channelId:s});return(yield this._ctx.query($s.rrList,e,t,Aa)).trans((e=>({totalMemberCount:e.totalMemberNum,list:e.list})))}))}sendReadReceiptMessageV4(e,i,s){return t(this,void 0,void 0,(function*(){const{conversationType:t,targetId:n,channelId:r}=e,o=Uc.encode(Ba,{targetId:n,type:t,busChannel:r,startMsgId:i,endMsgId:s}),a=new Or($s.sendMsgRead,o,n);return(yield this._ctx.send(a)).wipe()}))}getMessageReadReceiptV4(e,i){return t(this,void 0,void 0,(function*(){const{targetId:t,channelId:s=""}=e,n=Uc.encode(Ha,{targetId:t,busChannel:s,msgId:i});return(yield this._ctx.query($s.qryMsgRead,t,n,ja)).trans((({list:e,num:t,readCnt:i})=>({list:e.map((e=>({userId:e.userId,readTime:e.receiptTime}))),totalCount:t,readCount:i})))}))}batchGetMessageReadReceiptInfoV4(e,i){return t(this,void 0,void 0,(function*(){const{targetId:t,conversationType:s,channelId:n}=e,r=Uc.encode(Ya,{type:s,busChannel:n,msgId:i});return(yield this._ctx.query($s.qryMsgReadCntBatch,t,r,Wa)).trans((({result:t})=>t.map((t=>Object.assign({messageUId:t.msgId,readedCount:t.cnt,totalCount:t.tmn},e)))))}))}getConversationsIncludingRobots(e){return t(this,void 0,void 0,(function*(){const{count:t,conversationTypes:s}=e;if(!this._ctx.includeUg)return i(this,YE,"m",vI).call(this,e.timestamp,t,0,s,Ce.ROBOT_ONLY);let n=e.timestamp||Number.MAX_SAFE_INTEGER;const r=this.storage.getAllSGModels().filter((e=>e.includeRobot&&e.operationTime<n&&s.includes(e.conversationType))).sort(((e,t)=>t.operationTime-e.operationTime)).slice(0,t);return gi(r.map((e=>e.toIReceivedConversation())))}))}markRemoteConversationAsRead(e,s,n){return t(this,void 0,void 0,(function*(){const t=yield i(this,QE,"f").sendMessage(e,s,n);if(!t.isOk)return t.wipe();const{sentTime:r}=t.data,o=this.storage.getModel(e);return o&&(o.clearUnreadCount(r),this.storage.updateConversationStorage([o])),t.wipe()}))}_updateMessageReaction(e,i){return t(this,void 0,void 0,(function*(){const{conversationIdentifier:t,pushConfig:s,reactionId:n,messageUId:r}=i,{targetId:o,conversationType:a,channelId:l}=t,c=$g(s),_=Uc.encode(hc,{targetId:o,type:a,busChannel:l,msgId:r,reactionId:n,pushExt:c,appData:null==s?void 0:s.pushData,pushText:null==s?void 0:s.pushContent});return(yield this._ctx.query(e,o,_,gc)).wipe()}))}addMessageReaction(e){return t(this,void 0,void 0,(function*(){const t={[w.PRIVATE]:$s.addPReaction,[w.GROUP]:$s.addGReaction,[w.ULTRA_GROUP]:$s.addUgReaction}[e.conversationIdentifier.conversationType];return this._updateMessageReaction(t,e)}))}removeMessageReaction(e){const t={[w.PRIVATE]:$s.rmPReaction,[w.GROUP]:$s.rmGReaction,[w.ULTRA_GROUP]:$s.rmUgReaction}[e.conversationIdentifier.conversationType];return this._updateMessageReaction(t,e)}batchGetMessageReactionSummaries(e){var i;return t(this,void 0,void 0,(function*(){const{conversationIdentifier:t,messageUIds:s}=e,{targetId:n,conversationType:r,channelId:o}=t,a=r===w.ULTRA_GROUP?$s.ugMReactBQ:$s.mReactBQ,l=Uc.encode(Ec,{targetId:n,type:r,busChannel:o,msgId:s,compress:bs.enable(),allUser:!1}),c=yield this._ctx.query(a,s[0],l,void 0);if(!c.isOk)return c.wipe();const{msgReaction:_}=rE(c.data.pbData),d={};return s.forEach((e=>{d[e]=[]})),null===(i=_)||void 0===i||i.forEach((e=>{d[e.msgId]=lE(e.reaction,e.msgId)})),gi(d)}))}getMessageReactions(e){return t(this,void 0,void 0,(function*(){const{conversationIdentifier:t,pageToken:i,count:s,messageUId:n}=e,{targetId:r,conversationType:o,channelId:a}=t,l=o===w.ULTRA_GROUP?$s.ugMReactQ:$s.mReactQ,c=Uc.encode(Tc,{targetId:r,type:o,busChannel:a,msgId:n,size:s,pageToken:i,compress:bs.enable(),allUser:!1}),_=yield this._ctx.query(l,n,c,void 0);if(!_.isOk)return _.wipe();const{pageToken:d,reaction:u}=oE(_.data.pbData),h={pageToken:d||"",reactions:lE(u,n)};return gi(h)}))}getMessageReactionUsers(e){return t(this,void 0,void 0,(function*(){const{conversationIdentifier:t,pageToken:i,count:s,messageUId:n,reactionId:r}=e,{targetId:o,conversationType:a,channelId:l}=t,c=a===w.ULTRA_GROUP?$s.ugMReactUQ:$s.mReactUQ,_=Uc.encode(Tc,{targetId:o,type:a,busChannel:l,msgId:n,reactionId:r,size:s,pageToken:i,compress:bs.enable()}),d=yield this._ctx.query(c,n,_,void 0);if(!d.isOk)return d.wipe();const{pageToken:u,reaction:h}=aE(d.data.pbData),g=h.user,E={pageToken:u||"",totalCount:h.userCnt,users:g.map((({userId:e,reactionTime:t})=>({userId:e,reactionTime:t})))};return gi(E)}))}}WE=new WeakMap,qE=new WeakMap,JE=new WeakMap,KE=new WeakMap,QE=new WeakMap,XE=new WeakMap,zE=new WeakMap,ZE=new WeakMap,uI=new WeakMap,yI=new WeakMap,YE=new WeakSet,$E=function(e,t,i){if(t!==D.SUCCESS||!this._ctx.includeUg||0===i.length)return;const s=[w.PRIVATE,w.SYSTEM];this.storage.getAllSGModels().filter((e=>s.includes(e.conversationType)&&i.some((t=>t.robotId===e.targetId)))).forEach((e=>e.updateAttrs({includeRobot:!0})))},eI=function(e,t){const{conversationType:i,targetId:s,channelId:n,senderUserId:r}=e;if(i!==w.PRIVATE)return!1;if(r===this._ctx.currentUserId){const r={conversationType:i,targetId:s,channelId:n},o=this.storage.getOrCreateModel(r,!0);if(o.version<e.sentTime){const i=o.clearUnreadCount(e.sentTime);i&&t.set(o,Object.assign(Object.assign({},t.get(o)),i))}}return!0},tI=function(e,t,i,s){const{conversationType:n,targetId:r,channelId:o,senderUserId:a,content:l}=t;if(a!==this._ctx.currentUserId)return!1;const c={conversationType:n,targetId:r,channelId:o},_=this.storage.getOrCreateModel(c,!0);if(_.version>=t.sentTime)return!1;const d=_.clearUnreadCount(t.sentTime);return d&&i.set(_,Object.assign(Object.assign({},i.get(_)),d)),_.removeRecvMessageRecords(t.sentTime),1!==e.sesDriven||(t.isOffLineMessage&&s.push(Object.assign(Object.assign({},c),{timestamp:l.lastMessageSendTime})),!1)},iI=function(e,t){const{conversationType:i,targetId:s,channelId:n,content:r}=e,o={conversationType:i,targetId:s,channelId:n},a=i===w.PRIVATE?{privateReadReceipt:Object.assign(Object.assign({},o),{endMsgTime:r.endMsgTime})}:{groupReadReceipt:Object.assign(Object.assign({},o),{totalCount:r.tmn,readedCount:r.rrn,messageUId:r.msgId})};t.push(a)},sI=function(e,t,i,s){var n;const{content:r,conversationType:o,targetId:a,channelId:l,isPersited:c,isStatusMessage:_,isCounted:d,messageType:u,isMentioned:h,senderUserId:g,disableUpdateLastMessage:E}=e;if(!W(o,k))return;if(_||!c)return;if(P_(i).isOk)return;const I={conversationType:o,targetId:a,channelId:l},T=this.storage.getOrCreateModel(I,!0),f=g===s,R=u===Q.RECALL,A=e.sentTime>T.version,p=T.hidden&&!A,m={};A&&(m.hidden=!1);const S=()=>{const i=T.updateAttrs(m,e.sentTime);i&&t.set(T,Object.assign(Object.assign({},t.get(T)),i))};if(!p&&(!R||T.hidden)&&e.sentTime>=T.operationTime&&(m.operationTime=e.sentTime),p||E||T.latestMessage&&!(e.sentTime>=T.latestMessage.sentTime)||(m.latestMessage=i.supportRecallRefactor&&R?U_(e,!0):e),!A)return void S();if(m.version=e.sentTime,R){let{sentTime:t,originalFromUserId:i}=r;return i||(i=g),t&&t>T.lastReadTime&&!(null===(n=e.__innerData__)||void 0===n?void 0:n.keepUnreadCount)&&i!==s&&(m.unreadCount=Math.max(T.unreadCount-1,0),0===m.unreadCount&&(m.firstUnreadMessageUId="",m.firstUnreadTime=0,m.firstUnreadMessageType="",m.unreadMentionedCount=0,m.unreadMentionedMeCount=0,m.hasMentioned=!1,m.mentionedInfo=void 0),T.addRecvMessageRecord(t,-1)),void S()}if(f||!d)return void S();let v;if(m.unreadCount=T.unreadCount+1,0===T.unreadCount&&(m.firstUnreadMessageUId=e.messageUId,m.firstUnreadTime=e.sentTime,m.firstUnreadMessageType=e.messageType),r.mentionedInfo){const{type:e,userIdList:t}=r.mentionedInfo,i=e===K.ALL||e===K.SINGAL&&(null==t?void 0:t.includes(s));i&&(v=e,m.hasMentioned=i,m.mentionedInfo={type:e,userIdList:t},m.unreadMentionedCount=T.unreadMentionedCount+1,e===K.SINGAL&&(m.unreadMentionedMeCount=T.unreadMentionedMeCount+1))}T.addRecvMessageRecord(e.sentTime,1,v),S()},nI=function(e,t){const{conversationType:i,targetId:s,channelId:n,content:r}=e,o={conversationType:i,targetId:s,channelId:n||""},{put:a,del:l,mid:c,clear:_}=r;if(a?t.push({updatedExpansion:Object.assign(Object.assign({},o),{messageUId:c,expansion:a})}):l&&t.push({deletedExpansion:Object.assign(Object.assign({},o),{messageUId:c,deletedKeys:l})}),!this._ctx.includeUg)return;const d=this.storage.getModel(o);d&&d.latestMessage&&d.latestMessage.messageUId===c&&(_?d.latestMessage.expansion={}:a?d.latestMessage.expansion=Object.assign(Object.assign({},d.latestMessage.expansion),a):l&&d.latestMessage.expansion&&l.forEach((e=>{delete d.latestMessage.expansion[e]})))},rI=function(e){const{currentUserId:t}=this._ctx,s=this._ctx.getNaviInfoFromCache(),n={v4ReadReceipts:[],v4SyncNotify:[],expansions:[],logCmdMessages:[],cloudControllerMessages:[],messages:[],updateModels:new Map};return n.messages=e.filter((e=>{switch(e.messageType){case Q.DELIVERED:case Q.DELIVERED_MSG:return!1;case Q.LOG_COMMAND:return n.logCmdMessages.push(e),!1;case Q.CLOUD_CONTROL:return n.cloudControllerMessages.push(e),!1;case Q.READ_RECEIPT:return i(this,YE,"m",eI).call(this,e,n.updateModels);case Q.SYNC_READ_STATUS:return i(this,YE,"m",tI).call(this,s,e,n.updateModels,n.v4SyncNotify);case Q.READ_STATE:return i(this,YE,"m",iI).call(this,e,n.v4ReadReceipts),!1;case Q.READ_RECEIPT_REQUEST:return this.storage.addReadReceiptRequest(e,t);case Q.READ_RECEIPT_RESPONSE:return this.storage.handleReadReceiptResponse(e,t);case Q.EXPANSION_NOTIFY:return i(this,YE,"m",nI).call(this,e,n.expansions),!1;default:return i(this,YE,"m",sI).call(this,e,n.updateModels,s,t),!0}})),n},oI=function(e,t,n,r){e.stopPropagation(),this._ctx.recordReceivedMessagesForStatistics(n);const{messages:o,v4ReadReceipts:a,v4SyncNotify:l,expansions:c,logCmdMessages:_,cloudControllerMessages:d,updateModels:u}=i(this,YE,"m",rI).call(this,n);if(l.length&&this.emit("syncReadStatusV4",l),o.length&&this.emit("messages",t,o,r),!i(this,ZE,"f")&&"pullMsg"===t&&r&&(s(this,ZE,!0,"f"),this.emit("offlineFinished"),i(this,KE,"f").startInterval(DI,!0)),c.length&&this.emit("expansions",c),a.length&&this.emit("readReceiptV4",a),u.size){const e=[],t=[];Array.from(u.entries()).forEach((([i,s])=>{t.push(i),e.push({conversation:i.toIReceivedConversation(),updatedItems:s})})),this.storage.updateConversationStorage(t),this.emit("conversationStatusChanged",e)}this._ctx.handleLogCmdMessages(_),this._ctx.handleCloudControllerMessage(d)},aI=function(e,t,i){if(t!==UE)return;e.stopPropagation();const s=[];i.forEach((e=>{const{subChangeType:t}=e;if(0!==t)return;const i=Uc.decode(Dl,new Uint8Array(e.eventData)),{msgId:n,unreadCnt:r,readCnt:o,readList:a,totalCnt:l}=i;s.push({identifier:{conversationType:e.channelType,targetId:e.businessId,channelId:e.secondaryId},messageUId:n,users:a.map((e=>({userId:e.userId,timestamp:e.receiptTime,isMentioned:!!e.mentioned}))),readCount:o,unreadCount:r,totalCount:l})})),this._ctx.emit("readReceiptResponseV5",s)},lI=function(e){return t(this,void 0,void 0,(function*(){s(this,ZE,!1,"f"),e||(i(this,qE,"f").setInitVersion(0),this._ctx.includeUg&&i(this,YE,"m",hI).call(this)),this._ctx.svrUnread&&(e||this.storage.getAllSGModels().forEach((e=>e.clearUnreadCount(0))),yield i(this,YE,"m",cI).call(this,0),this.emit("syncServerSaveUnreadCompleted")),i(this,qE,"f").startInterval(DI,!0)}))},cI=function e(s,n=new Map,o){return t(this,void 0,void 0,(function*(){const{logger:t,currentUserId:a}=this._ctx,l=t.createTraceId();t.info(r.L_PULL_SG_UNREAD_COUNT_T,JSON.stringify({version:s,pageToken:o}),l);const c=((e,t)=>Uc.encode(jl,{version:e,compress:bs.enable(),pageToken:t}))(s,o),_=yield this._ctx.query($s.pullSe,a,c,void 0);if(!_.isOk)return void t.warn(r.L_PULL_SG_UNREAD_COUNT_R,_.errmsg(),l);const{session:d,pageToken:u}=nE(_.data.pbData);if(t.summary(r.L_PULL_SG_UNREAD_COUNT_R,_,l,{nextPageToken:u}),d.forEach((e=>{const{targetId:t,type:i,busChannel:s,unread:r}=e,o={conversationType:i,targetId:t,channelId:s},l=this.storage.getOrCreateModel(o,!0),c=l.calibrateUnreadCount(r,a);c&&n.set(l,Object.assign(Object.assign({},n.get(l)),c))})),u)return i(this,YE,"m",e).call(this,s,n,u);this.storage.updateConversationStorage(Array.from(n.keys()))}))},_I=function(e){return t(this,void 0,void 0,(function*(){if(!e){this.settings.reset();const e=yield this.settings.syncDataFromServer();this.settings.setInitVersion(e)}this._ctx.isConnected&&this.settings.startInterval(DI,!0)}))},dI=function(e,t){s(this,XE,!1,"f"),t||this.storage.syncDataFromLocalStorage(this._ctx),i(this,YE,"m",_I).call(this,t),i(this,YE,"m",lI).call(this,t),this._ctx.ugEnabel&&i(this,YE,"m",RI).call(this,t)},hI=function e(){return t(this,void 0,void 0,(function*(){if(!this._ctx.isConnected)return;const{logger:t}=this._ctx,n=t.createTraceId(),o=i(this,uI,"f");t.info(r.L_PULL_SG_RELATIONS_T,JSON.stringify({startTime:o}),n);const a=yield i(this,YE,"m",UI).call(this,o,1,1e3);if(!a.isOk)return t.warn(r.L_PULL_SG_RELATIONS_R,a.errmsg(),n),void setTimeout((()=>i(this,YE,"m",e).call(this)),1e3);const{info:l,isFinished:c,pullTime:_}=a.data;if(s(this,uI,_,"f"),t.info(r.L_PULL_SG_RELATIONS_R,JSON.stringify({startTime:o,isFinished:c,pullTime:_}),n),this.storage.addRelations(l,this._ctx.currentUserId),!c)return i(this,YE,"m",e).call(this);this.emit("sgRelationsSynced",D.SUCCESS)}))},gI=function(e,s,n){return t(this,void 0,void 0,(function*(){const t=yield i(this,YE,"m",MI).call(this,e,s);if(!t.isOk)return;const r=t.data.list.map((t=>y_(t,this._ctx.currentUserId,!1,e.targetId))),o=this.storage.getModel(e);if(o&&o.latestMessage){const e=r.find((e=>e.messageUId===o.latestMessage.messageUId));e&&o.updateAttrs({latestMessage:e})}2===n?this._ctx.emit("messageModified",r):1===n&&this._ctx.emit("ugMsgExpansionUpdated",r)}))},EI=function(e,t,s){i(this,YE,"m",gI).call(this,t,s,2)},II=function(e,t,s){i(this,YE,"m",gI).call(this,t,s,1)},TI=function(e,t){const s=t.map((e=>{const{targetId:t,busChannel:s,msgUID:n,msgTime:r,operatorId:o,remindType:a}=e,l={conversationType:w.ULTRA_GROUP,targetId:t,channelId:s||""},c=Object.assign(Object.assign({},l),{messageUId:n,sentTime:r}),_=Object.assign(Object.assign({},l),{sentTime:r,messageUId:n,senderUserId:o,content:c,messageDirection:1,messageType:Q.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:Re.UNREAD,receivedStatusInfo:Gt(Re.UNREAD)}),d=this.storage.getModel(l);return d&&i(this,YE,"m",fI).call(this,d,_,a),_}));this._ctx.emit("ugMsgRecalled",s)},fI=function(e,t,i){const s={},{messageUId:n,sentTime:r}=t.content,{latestMessage:o}=e;o&&o.messageUId===n&&(s.latestMessage=U_(t,!0)),r&&e.lastReadTime<r&&e.unreadCount&&(s.unreadCount=e.unreadCount-1,i!==K.ALL&&i!==K.SINGAL||!e.unreadMentionedCount||(s.unreadMentionedCount=e.unreadMentionedCount-1),i===K.SINGAL&&e.unreadMentionedCount&&(s.unreadMentionedMeCount=e.unreadMentionedMeCount-1));const a=e.updateAttrs(s,r);this.storage.updateConversationStorage([e]),a&&this.emit("conversationStatusChanged",[{conversation:e.toIReceivedConversation(),updatedItems:a}])},RI=function(e){return t(this,void 0,void 0,(function*(){const e=yield i(this,WE,"f").markOnline();if(!e.isOk)return;const{relations:t,msgVersion:n}=e.data;this.storage.addRelations(t,this._ctx.currentUserId),s(this,XE,!0,"f"),this.emit("ultraGroupEnable"),i(this,WE,"f").setInitVersion(n),i(this,WE,"f").startInterval(DI,!0),i(this,JE,"f").setInitVersion(n),i(this,JE,"f").startInterval(DI,!0)}))},AI=function(){s(this,XE,!1,"f"),this.settings.stopInterval(),i(this,WE,"f").reset(),i(this,qE,"f").reset(),i(this,JE,"f").reset()},pI=function(e,s){return t(this,void 0,void 0,(function*(){if(3===s.type)return e.stopPropagation(),void this.settings.push(s.time);if(7===s.type)return e.stopPropagation(),void i(this,JE,"f").push(s.time);if(12===s.type)return e.stopPropagation(),void i(this,KE,"f").push(s.time);if(13===s.type){e.stopPropagation();const t=new Map;if(yield i(this,YE,"m",cI).call(this,s.time,t),t.size>0){const e=Array.from(t.entries()).map((([e,t])=>({conversation:e.toIReceivedConversation(),updatedItems:t})));this.emit("conversationStatusChanged",e)}}}))},mI=function(e,t){1===t.type&&(e.stopPropagation(),i(this,qE,"f").push(t.time))},SI=function(e,t,i){const{syncMsg:s}=t,n=en(t.topic);if(s&&n===$s.updUgRTime){e.stopPropagation();const{channelId:i,busChannel:s,msgTime:n}=Uc.decode(Yo,t.pbData),r=this.storage.clearConversationUnreadCount({conversationType:w.ULTRA_GROUP,targetId:i,channelId:s||""},n);r&&this.emit("conversationStatusChanged",[r])}},vI=function(e,s,n,r,o){return t(this,void 0,void 0,(function*(){const{currentUserId:t}=this._ctx,a=yield i(this,YE,"m",UI).call(this,e,n||0,s,r,o);if(!a.isOk)return a.wipe();const{info:l,isFinished:c,pullTime:_}=a.data,d=l.map((e=>{const{userId:i,type:s,busChannel:n}=e,r=this.storage.getOrCreateModel({conversationType:s,targetId:i,channelId:n},!1);return Object.assign(Object.assign({},r.toIReceivedConversation()),{operationTime:e.versionTime,latestMessage:e.msg?y_(e.msg,t,!1,i):null})}));return gi(d)}))},NI=function(e){return t(this,void 0,void 0,(function*(){if(this._ctx.includeUg)return gi(e);const{currentUserId:t}=this._ctx,s=e.filter((({conversationType:e})=>e!==w.ULTRA_GROUP)).map((({conversationType:e,targetId:t,channelId:i})=>({conversationType:e,conversationId:t,busChannel:i})));if(0===s.length)return gi(e);const n=Uc.encode(Ko,{relation:s.slice(0,100)}),r=yield this._ctx.query($s.qryRLBatch,this._ctx.currentUserId,n,void 0);if(!r.isOk)return r.wipe();const{info:o}=i(this,YE,"m",LI).call(this,r.data.pbData);return o.forEach((i=>{if(!i.msg)return;const s=e.find((e=>(e.channelId||"")===(i.busChannel||"")&&e.targetId===i.userId&&e.conversationType===i.type));s.latestMessage=y_(i.msg,t,!1,i.userId),s.includeRobot=!!i.isBot})),gi(e)}))},OI=function(e,i,s,n,r){return t(this,void 0,void 0,(function*(){const t=[];void 0!==s&&t.push({sessionStateType:Cc.IsTop,value:s?"1":"0"}),void 0!==n&&t.push({sessionStateType:Cc.IsSilent,value:n.toString()}),void 0!==r&&t.push({sessionStateType:Cc.AutoTrans,value:r.toString()});const o=Qg(i,e.map((e=>({type:e.conversationType,channelId:e.targetId,busChannel:e.channelId,stateItem:t}))));return this._ctx.query($s.setSeAtt,this._ctx.currentUserId,o,da)}))},CI=function(e,s){return t(this,void 0,void 0,(function*(){i(this,yI,"f").add(e);const t=s.messageType===Q.HQ_VOICE?{msgId:e,objectName:s.messageType,content:s.remoteUrl,sampleRate:s.sampleRate,channelNumber:s.numberOfChannels,format:s.format}:{msgId:e,objectName:s.messageType,content:s.content},n=Uc.encode(wl,{businessType:1,businessInfo:Uc.encode(Gl,t)}),r=yield this._ctx.query($s.upConvertMsg,e,n,Vl);i(this,yI,"f").delete(e);const{code:o}=r;let a;if(r.isOk){const e=Uc.decode(kl,new Uint8Array(r.data.businessResult));a={status:be.SUCCESS,text:e.result}}else a={status:be.FAILED,text:""};this._ctx.emit("speechToTextResponse",{code:o,messageUId:e,sttInfo:a})}))},MI=function(e,t){const{targetId:i,conversationType:s,channelId:n}=e,r=Uc.encode(Ua,{targetId:i,type:s,query:t.map((e=>({msgTime:0,msgUID:e,busChannel:n})))});return this._ctx.query($s.qryMsg,this._ctx.currentUserId,r,Pa)},bI=function(e,s,n,r){return t(this,void 0,void 0,(function*(){const t=Object.values(r),o=[...new Set([...e,...t])],{isOk:a,code:l,data:c}=yield i(this,YE,"m",MI).call(this,s,o);if(!a)return void n(e.map((e=>({messageUId:e,code:l}))));const{list:_,notExistMsgId:d}=c,u=new Map(_.map((e=>{const t=y_(e,this._ctx.currentUserId,!1,s.targetId);return[t.messageUId,t]}))),h=e.map((e=>{const t=u.get(e);if(!t)return d.includes(e)?{messageUId:e,code:D.RC_DB_DATA_NOT_FOUND}:{messageUId:e,code:D.SERVER_DATA_ERROR};if(t.messageType!==Q.REFERENCE)return{messageUId:e,code:D.INVALID_PARAMETER_MESSAGE_TYPE};const i=r[e],s=u.get(i),n=t.content;return s?(n.referMsg=s.content,n.referMsgStatus=s.isModifyMessage?Vi.MODIFIED:Vi.DEFAULT,{messageUId:e,message:t,code:D.SUCCESS}):d.includes(i)?(n.referMsgStatus=Vi.DELETE,{messageUId:e,code:D.RC_DB_DATA_NOT_FOUND,message:t}):(n.referMsgStatus=Vi.DEFAULT,{messageUId:e,code:D.SERVER_DATA_ERROR,message:t})}));n(h)}))},LI=function(e){const t=Fg(e);return this._ctx.getNaviInfoFromCache().supportRecallRefactor&&t.info.forEach((e=>{const{msg:t}=e;if(t&&t.classname===Q.RECALL){const e=JSON.parse(t.content),{messageUId:i,sentTime:s,extra:n}=e,r={recallTime:s,recallActionTime:t.dataTime,admin:!!e.isAdmin,delete:!!e.isDelete,isDelete:!!e.isDelete,operatorId:t.fromUserId,extra:n};t.classname=Q.RECALL_NOTIFICATION_MESSAGE,t.content=JSON.stringify(r),t.msgId=i,t.dataTime=s||t.dataTime}})),t},UI=function(e,s,n,r,o,a=$s.qryRelationR){return t(this,void 0,void 0,(function*(){const{currentUserId:t}=this._ctx,l=((e,t,i,s,n)=>Uc.encode(Lo,{startTime:e,order:t,count:i,compressioEnabled:bs.enable(),channelType:s,botType:n}))(e,s,n,r,o);return(yield this._ctx.query(a,t,l)).trans((e=>i(this,YE,"m",LI).call(this,e.pbData)))}))};const GI={[w.PRIVATE]:$s.cleanPMsg,[w.GROUP]:$s.cleanGMsg,[w.CUSTOMER_SERVICE]:$s.cleanCMsg,[w.SYSTEM]:$s.cleanSMsg,[w.APP_PUBLIC_SERVICE]:$s.cleanMCMsg,[w.PUBLIC_SERVICE]:$s.cleanMPMsg,[w.ULTRA_GROUP]:$s.cleanGMsg},VI=(e,t,i,s,n,r,o,a,l,c)=>{var _;const d=l?`&protocolVer=${l}`:"";return`${i}://${s}/websocket?appId=${n}&token=${encodeURIComponent(r)}&sdkVer=${Be}&pid=${a}&deviceId=${encodeURIComponent(e)}${1===c?`&baggage=${encodeURIComponent(`cid=${o}`)}`:""}&apiVer=${encodeURIComponent((null===(_=Eo.getApiVer)||void 0===_?void 0:_.call(Eo))||`${Eo.tag}||`)}${Eo.connectPlatform?`&platform=${Eo.connectPlatform}`:""}${d}${Eo.isFromUniapp?`&appIdentifier=${encodeURIComponent(t)}`:""}`};class kI extends fs{constructor(e,t,i,s){super(e,t,i),Object.defineProperty(this,"appStorage",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_socket",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_connectedTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_socketIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_serverSessionId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_localConnectedTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_idCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_generateMessageId",{enumerable:!0,configurable:!0,writable:!0,value:()=>(this._idCount>=65535&&(this._idCount=0),++this._idCount)}),Object.defineProperty(this,"_pingResolve",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_messageIds",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_syncMessageIds",{enumerable:!0,configurable:!0,writable:!0,value:{}})}getConnectedTime(){return this._connectedTime}getLocalConnectedTime(){return this._localConnectedTime}getCrtServerTime(){return Date.now()-this._localConnectedTime+this._connectedTime}getDelayTime(){return this._localConnectedTime-this._connectedTime}_connectWithToken(e,i,s,n){return t(this,void 0,void 0,(function*(){const{openAnti:t,type:s,baggageEnabled:o}=i,a=this.getCmpList(i);this.logger.debug(r.L_NAVI_CMP_R,JSON.stringify(a),n);const l=a.filter(((e,t)=>a.findIndex((t=>t.addr===e.addr))===t)).sort(((e,t)=>e.weight>t.weight?-1:1));if(0===l.length)return this.logger.error(r.L_NAVI_CONF_E,"no service available",n),Ei(D.SERVER_UNAVAILABLE);const c=1===t?gn:En;for(let t=0;t<l.length;t+=1){const{protocol:i,addr:r,weight:a}=l[t],_=VI(this.appStorage.deviceId,this.appStorage.packageName,i===q.WS?"ws":"wss",r,this.appkey,e,this.cid,"",c,o),d=Date.now(),{code:u,data:h}=yield this.connectWebSocket(_,c,n),g=this.cmpWeightCache.findIndex((e=>e.addr===r)),E={bid:ii(),ptc:pe.WS,cod:u,net:this.getNetwork().type,dur:Date.now()-d,spr:0,pr:s||0,hos:r,idx:g,rct:this.retryCount?ve.RECONNECT:ve.CONNECT,cid:this.cid,v:Se.CURRENT,rsn:this._doConnectReason,count:this.retryCount,weight:a,ssid:this._serverSessionId};if(this.logger.record(ge.IM_WEBSOCKET,JSON.stringify(E),n),u!==D.RC_SOCKET_DISCONNECTED&&u!==D.TIMEOUT)return u!==D.SUCCESS?Ei(u):(this._localConnectedTime=Math.floor((Date.now()+d)/2),this._socket=h.socket,this.updateCmpWeight(l[t].addr,!0),this.curCmpUrl=l[t].addr,gi(h.userId))}return Ei(D.SERVER_UNAVAILABLE)}))}connectWebSocket(e,i,s){return t(this,void 0,void 0,(function*(){this.logger.info(r.L_CONNECT_O,`connect start: ${e}`,s);const{resolve:t,promise:n}=Ri(),{data:o,code:a,msg:l}=yield Eo.createWebSocket(e);if(a!==D.SUCCESS||!o)return Ei(a,l);this._socketIndex=o.id;let c=D.SUCCESS;const _=setTimeout((()=>{this.logger.warn(r.L_CONNECT_S,"timeout",s),c=D.TIMEOUT,"wechat"===Eo.tag?o.close():(t(Ei(D.TIMEOUT)),this.onSocketEnd(o,D.TIMEOUT,s))}),5e3);return o.onOpen((()=>{this.logger.info(r.L_CONNECT_S,"socket opened",s),clearTimeout(_)})),o.onError((e=>{this.logger.warn(r.L_CONNECT_S,"socket error",s),console.error(e),clearTimeout(_);const i=D.RC_SOCKET_DISCONNECTED;t(Ei(i)),this.onSocketEnd(o,i,s)})),o.onClose((()=>{this.logger.info(r.L_CONNECT_S,"socket close",s);const e=c===D.SUCCESS?D.RC_SOCKET_DISCONNECTED:c;t(Ei(e)),this.onSocketEnd(o,e,s)})),o.onMessage((e=>{if(this._socketIndex!==o.id)return void this.logger.warn(r.L_WS_DISACCORD_E,JSON.stringify({socketIndex:this._socketIndex,curSocketId:o.id}));if("[object ArrayBuffer]"!==Object.prototype.toString.call(e))return;const n=Lr(e,i);if(n){if(n instanceof Ir){const e=n.status;if(e!==wn)return this.logger.warn(r.L_CONNECT_O,`connect failed: ${e}`,s),c=(e=>dE[e])(e),o.close(),void t(Ei(c));this.logger.info(r.L_CONNECT_O,"connect success",s);const{timestamp:i,userId:a,messageId:l,sessionId:_}=n;return this._serverSessionId=_,this._connectedTime=i,this._idCount=l,void t(gi({userId:a,socket:o}))}if(n instanceof fr){const e=n.status;return this.logger.info(r.T,`recv disconnect signal -> status: ${e}`),void this.onRecvDisconnect(e,o)}this._onReceiveSignal(n)}})),n}))}_qosNeedAck(e){if(e.header.qos!==sn)return e instanceof Sr&&!e.syncMsg?(this.logger.debug(r.O,`send pubAck -> ${e.messageId} ${e.topic}`),void this.sendOnly(new Cr(e.messageId))):void(e instanceof br&&this._messageIds[e.messageId]&&(this.logger.debug(r.O,`send queryCon -> ${e.messageId}`),this.sendOnly(new Mr(e.messageId))))}_publishReader(e){return t(this,void 0,void 0,(function*(){const{syncMsg:t,topic:i,messageId:s}=e;if(this.logger.debug(r.O,`recv PublishReader -> messageId: ${s} ${i}`),i===pn)return;if(!t||uE(en(i)))return void this.emit("signal",e);const n=yield new Promise((e=>{this._syncMessageIds[s]=e}));delete this._syncMessageIds[s],this.emit("signal",e,n)}))}_onReceiveSignal(e){return t(this,void 0,void 0,(function*(){if(e instanceof Ar&&this._pingResolve)return this._pingResolve(D.SUCCESS),void(this._pingResolve=void 0);if(this._qosNeedAck(e),e instanceof yr||e instanceof br){const{messageId:t}=e;this.logger.debug(r.O,`recv ack -> messageId: ${t}`);const i=this._messageIds[t];i&&(i(e),delete this._messageIds[t]);const s=this._syncMessageIds[t];s&&(delete this._syncMessageIds[t],s(e))}e instanceof Sr&&(yield this._publishReader(e))}))}onRecvDisconnect(e,t){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer((e=>_E[e])(e)))}onSocketEnd(e,t,i){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(t),this._pingResolve&&(this._pingResolve(t),this._pingResolve=void 0))}clearResolves(){for(const e in this._messageIds){const t=this._messageIds[e];delete this._messageIds[e],t(D.RC_SOCKET_DISCONNECTED)}}sendPing(e){return new Promise((t=>{this._pingResolve=t,setTimeout((()=>t(D.TIMEOUT)),e),this.sendOnly(new Rr)}))}sendOnly(e){this._socket&&((e instanceof Or||e instanceof Nr)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getArrayBuffer()))}_sendHandler(e){return t(this,void 0,void 0,(function*(){if(!this._socket)return Ei(D.RC_NET_CHANNEL_INVALID);const t=this._generateMessageId();e.messageId=t,this._socket.send(e.getArrayBuffer());const i=yield new Promise((e=>{this._messageIds[t]=e,setTimeout((()=>{this._messageIds[t]&&delete this._messageIds[t],e(D.TIMEOUT)}),3e4)})),s="number"==typeof i?i:i.status;return D.SUCCESS,"number"==typeof i?Ei(i):s===D.SUCCESS?gi(i):Ei(s,"",i)}))}query(e,i,s,n,r){return t(this,void 0,void 0,(function*(){this.logger.createTraceId(),tn(e);const t=new Nr(e,s,i);r&&t.setHeaderQos(r);const o=yield this._sendHandler(t),{data:a,isOk:l}=o;return l&&void 0!==n?gi(Uc.decode(n,a.pbData)):o}))}send(e,i){return t(this,void 0,void 0,(function*(){const t=yield this._sendHandler(e);if(!t.data)return t.wipe();if(t.data instanceof yr)return t;const s=t.data,n=i&&s.pbData&&[D.SUCCESS,D.CHATROOM_KV_STORE_NOT_ALL_SUCCESS,D.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT,D.RC_USER_PROFILE_KEY_NOT_EXIST,D.RC_USER_PROFILE_EXT_KEY_NOT_EXIST,D.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS,D.RC_USER_PROFILE_VALUE_EXCEED_RANGE,D.RC_GROUP_PARAMETER_FORMAT_ERROR].indexOf(s.status)>=0?Uc.decode(i,s.pbData):s;return 0!==s.status?Ei(s.status,void 0,i&&s.pbData?n:null):gi(n)}))}close(e,i,s){return t(this,void 0,void 0,(function*(){s&&(yield this.sendOnly(new Tr(nr))),this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()}))}}const xI={};function FI(){return{code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,location:"",monitor:0,joinMChrm:!1,openMp:0,openUS:1,grpMsgLimit:0,isFormatted:0,gifSize:2048,logSwitch:0,logPolicy:"",compDays:0,msgAck:"",activeServer:"",qnAddr:"",extkitSwitch:0,alone:!1,voipServer:"",offlinelogserver:"",backupServer:Hi.getMiniCmpUrlList().join(",")}}class BI extends As{constructor(e,t,i,s,n="default",r){super(e,t,i,Eo.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol),Eo.useNavi,r),Object.defineProperty(this,"_appStorage",{enumerable:!0,configurable:!0,writable:!0,value:s}),this._environment=n}httpRequest(e,i,s,n,o){return t(this,void 0,void 0,(function*(){const t=`${e}/navi.js?appId=${i}&token=${encodeURIComponent(s)}&callBack=x&v=${Be}&r=${Date.now()}&env=${this._environment}&p=${Eo.tag}`;this.logger.debug(r.L_REQUEST_T,`req navi => ${t}`,n);const a=yield Eo.httpReq({url:t,timeout:1e4,dataType:"text"});if(200!==a.status)return this.logger.debug(r.L_REQUEST_R,`request navi failed: ${a.status}`,n),!Eo.useNavi&&o?gi(FI()):Ei(this.transHttpCode(a.status));try{let e=a.data.match(/{[\d\D]+}/)[0];0===e.indexOf('{\\"code\\":')&&(e=JSON.parse(`"${e}"`));const i=JSON.parse(e);return i.protocol=/^https/.test(t)?"https":"http",i.code&&200!==i.code?Ei(this.transHttpCode(i.code)):(Eo.useNavi||(i.server="",i.backupServer=Hi.getMiniCmpUrlList().join(","),i.logSwitch=0),gi(i))}catch(e){this.logger.error(r.L_PARSE_NAVI_E,a.data,n)}return Ei(D.RC_NAVI_REQ_FAILED)}))}httpRequestV2(e,i,s,n,o){return t(this,void 0,void 0,(function*(){const t=this.getNaviV2RequestOption({appkey:i,token:s,uri:e,platform:Eo.tag,protocol:(/^https/.test(e)?q.WSS:q.WS).toString()});this.logger.debug(r.L_REQUEST_T,`req navi => ${t.url}`,n);const a=yield Eo.httpReq(t);if(200!==a.status)return this.logger.debug(r.L_REQUEST_R,`request navi failed: ${a.status}`,n),!Eo.useNavi&&o?gi(FI()):Ei(this.transHttpCode(a.status));try{let e=a.data;const i="object"!=typeof e?JSON.parse(e):e;if(i.protocol=/^https/.test(t.url)?"https":"http",!Eo.useNavi){i.logSwitch=0;const e=Hi.getMiniCmpUrlList();i.serverAddr=e.map(((i,s)=>({addr:i,protocol:/^https/.test(t.url)?q.WSS:q.WS,weight:e.length-s})))}return gi(i)}catch(e){this.logger.error(r.L_PARSE_NAVI_E,a.data,n)}return Ei(D.RC_NAVI_REQ_FAILED)}))}getNaviCache(e){const t=this.getCatchKey(e);if(xI[t])return xI[t];const i=this._appStorage.get("naviInfo");if(!i)return null;let s;try{s=JSON.parse(i)}catch(e){s=[]}if(0===s.length)return null;const n=s.find((t=>t.token===e&&t.environment===this._environment))||null;return xI[t]=n,n}setNaviCache(e,t){let i=[];const s=Date.now(),n=this._appStorage.get("naviInfo");if(n){try{i=JSON.parse(n)}catch(e){i=[]}i.length>0&&(i=i.filter((t=>s-t.timestamp<ke&&(e!==t.token||this._environment!==t.environment))))}const r={timestamp:s,naviInfo:t,token:e,environment:this._environment};i.push(r),this._appStorage.set("naviInfo",JSON.stringify(i)),xI[this.getCatchKey(e)]=r}}class HI{constructor(){Object.defineProperty(this,"recallMsgMap",{enumerable:!0,configurable:!0,writable:!0,value:new Set})}}function jI(e){const t=!(1&~(e.ugMsg||0)),i=!(1&~(e.sessionCfg||0));return t&&i}class YI extends us{constructor(e,t,i,s){super(t,e,i),Object.defineProperty(this,"_appStorage",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_mrtr",{enumerable:!0,configurable:!0,writable:!0,value:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}});const{type:n,version:r}=Eo.runtimeInfo;this.model=`Web|${n}|${r}`,this.init()}httpRequest(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=n;t.deviceId=this._appStorage.deviceId,t.model=this.model;const o={url:e,method:i,headers:s,body:JSON.stringify(t)},a=this.logger.createTraceId();this.logger.info(r.L_REQUEST_T,JSON.stringify(o),a);const{status:l,data:c=""}=yield Eo.httpReq(o);this.logger.info(r.L_REQUEST_R,JSON.stringify({status:l,data:c}),a);try{const e=JSON.parse(c),t=e.data;return{code:parseInt(e.code,10),data:t}}catch(e){return this.logger.warn(r.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:l,data:c,error:e})),{code:l,msg:e}}}))}setCloudControllerCache(e){this._appStorage.set("cloudControllerData",JSON.stringify(e))}getLocalCloudControllerCache(){return this._appStorage.get("cloudControllerData")}setMRTRConfig(e){this.logger.info(r.L_CLOUD_SET_MRTR_O,JSON.stringify(e)),this._mrtr=e}getMRTRConfig(){return this._mrtr}}class WI extends ji{constructor(e,t,i){super(e,t),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_appStorage",{enumerable:!0,configurable:!0,writable:!0,value:i})}getCache(){return this._appStorage.get("staticConf")}setCache(e){this._appStorage.set("staticConf",e)}clearCache(){this._appStorage.delete("staticConf")}sendRequest(e){return t(this,void 0,void 0,(function*(){const{status:t,data:i}=yield Eo.httpReq({url:e});return{code:t,data:i}}))}decryptData(e){return t(this,void 0,void 0,(function*(){try{const t=yield si(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91");return JSON.parse(t)}catch(e){this.logger.error(r.L_GET_STATIC_CONF_E,JSON.stringify({error:null==e?void 0:e.stack}))}}))}}class qI extends _d{constructor(){super(),Object.defineProperty(this,"_deviceId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_customDeviceId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_packageName",{enumerable:!0,configurable:!0,writable:!0,value:""});let e="";const{localStorage:t,tag:i}=Eo;"browser"!==i?(e=t.getItem(qe)||"",e||(e=ut.genWithLen(22),t.setItem(qe,e))):e=ht,this._deviceId=e}setPackageName(e){this._packageName=e}get deviceId(){return this._customDeviceId||this._deviceId}get packageName(){return this._packageName}setCustomDeviceId(e){this._customDeviceId=e}_syncDataHandler(e){const{appkey:t}=e,{localStorage:i}=Eo,s=rt(t),n=i.getItem(s),r=nt(t),o=i.getItem(r),a=Je(t),l=i.getItem(a),c=at(t),_=i.getItem(c);return{cloudControllerData:{value:n,key:s},staticConf:{value:o,key:r},naviInfo:{value:l,key:a},logReporter:{value:_?JSON.parse(_):{},key:c,stringify:!0}}}}var JI,KI,QI,XI,zI,ZI,$I,eT,tT,iT;const sT=[$s.chatMsg,$s.ugMsg,$s.recallMsg,$s.ppMsgS,$s.pgMsgS,$s.ppMsgP,$s.pgMsgP,$s.pcMsgP,$s.prMsgS,$s.pbMsgP,$s.chatMsgS];class nT extends _i{constructor(e){var t;super(),JI.add(this),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"navi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_connection",{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,"send",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"query",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"connect",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disconnect",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"userStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),KI.set(this,void 0),QI.set(this,void 0),XI.set(this,void 0),zI.set(this,void 0),ZI.set(this,void 0),Object.defineProperty(this,"_robots",{enumerable:!0,configurable:!0,writable:!0,value:{robots:[],isSynced:!1}}),this.appStorage=new qI,this.appStorage.syncDataFromLocalStorage(this);const{appkey:n,loggerProxy:r,environment:o,useNaviV2:a,logOutputLevel:l,logExpireTime:c,areaCode:_,navigators:d,logServerUrl:u,miniCMPProxy:h}=e,g=r||$_(),E=this.logger=new x_(e.appkey,"IMLib","IM",g);E.setOutputLevel(l),r||J_(n,this.logger,c),Hi.init({areaCode:_,navigators:d,logServerUrl:u,miniCMPProxy:h}),this.navi=new BI(n,this.logger,new WI(n,this.logger,this.appStorage),this.appStorage,o||"default",!!a);const I=this._connection=new kI(n,this.navi,this.logger,this.appStorage);this.send=this._connection.send.bind(this._connection),this.query=this._connection.query.bind(this._connection),this.sendOnly=this._connection.sendOnly.bind(this._connection),this.connect=this._connection.connect.bind(this._connection),this.disconnect=this._connection.disconnect.bind(this._connection),I.on("onConnected",i(this,JI,"m",$I),this),I.on("onDisconnected",i(this,JI,"m",tT),this),I.on("onSuspend",i(this,JI,"m",eT),this),I.on("signal",i(this,JI,"m",iT),this),I.pipe(this),s(this,QI,new id(n,E,this.appStorage),"f"),s(this,XI,new sd(n,E,this.appStorage),"f"),s(this,zI,new YI(n,E,i(this,QI,"f"),this.appStorage),"f"),t=this,[{set value(e){s(t,ZI,e,"f")}}.value]=Hi.getCloudControllerUrl(),this.userStorage=new HI,s(this,KI,new DE(I,E),"f"),i(this,KI,"f").pipe(this),"browser"===Eo.tag&&i(this,zI,"f").request(i(this,ZI,"f"),ls)}get isConnected(){return this._connection.isConnected}get connectionStatus(){return this._connection.getConnectionStatus()}get currentUserId(){return this._connection.getCurrentUserId()}get currentToken(){return this._connection.getToken()}get serverTime(){return this._connection.getCrtServerTime()}get delayTime(){return this._connection.getDelayTime()}get connectedTime(){return this._connection.getConnectedTime()}get ugEnabel(){return!(1&~(this.getNaviInfoFromCache().ugMsg||0))}get isDisableEmptyUGChannelId(){return!(2&~(this.getNaviInfoFromCache().ugDriven||0))}get includeUg(){return jI(this.getNaviInfoFromCache())}get isMemSesAttrs(){var e;return(8&((null===(e=this.getNaviInfoFromCache())||void 0===e?void 0:e.sessionCfg)||0))>0}get svrUnread(){return 1===this.getNaviInfoFromCache().serverSaveUnread}get logReporter(){return i(this,QI,"f")}get statisticReporter(){return i(this,XI,"f")}get appkey(){return this.initOptions.appkey}get initOptions(){return this._initOptions}getNaviInfoFromCache(){return this.navi.getNaviInfoFromCache(this.currentToken)}get robots(){return this._robots.robots.slice()}getAllRobots(e){return t(this,void 0,void 0,(function*(){let t=this._robots.robots.slice();if(!e&&this._robots.isSynced)return gi(t);const i=Uc.encode(dc,{ids:[]}),s=yield this._connection.query($s.qAppBot,this.currentUserId,i,uc);if(!s.isOk)return e&&this.emit("robotsSynced",s.code,[],[],[]),Ei(s.code,s.msg,t);let n=Math.max(...t.map((e=>e.updateTime)));const r=[],o=s.data.bots.map((e=>{const t={robotId:e.id,name:e.name,portraitUri:e.portraitUrl,robotType:e.type||"",metadata:Object.fromEntries(e.metadata.map((e=>[e.key,e.value]))),createTime:e.createTime,updateTime:e.updateTime};return t.updateTime>n&&r.push(t),t})),a=t.filter((e=>!o.some((t=>t.robotId===e.robotId))));return this._robots.isSynced=!0,this._robots.robots=o,e&&this.emit("robotsSynced",s.code,o.slice(),r,a),gi(o.slice())}))}handleCloudControllerMessage(e){return t(this,void 0,void 0,(function*(){if(0===e.length)return;if(e.shift().senderUserId!==Ye)return this.handleCloudControllerMessage(e);const t=this._connection.getToken(),s=(yield i(this,zI,"f").request(i(this,ZI,"f"),_s,t))||0,n=e.filter((e=>e.sentTime>s));return this.handleCloudControllerMessage(n)}))}handleLogCmdMessages(e){e.forEach((e=>{if(e.senderUserId!==Ye)return;const{startTime:t,endTime:s,platform:n,logId:r,uri:o}=e.content;i(this,QI,"f").report(parseInt(t,10),parseInt(s,10),n,o,r,e.messageUId)}))}handleNetworkChange(e,t){if(this._connection.setNetwork(e,t),e.status&&i(this,ZI,"f")){const e=this._connection.getToken();i(this,zI,"f").request(i(this,ZI,"f"),cs,e)}}checkIfNeedRecordMessageUId(e,t){const s=i(this,zI,"f").getMRTRConfig();if(!s)return!1;const n=function(e){if(!e)return Math.floor(4294967296*Math.random());let t=0;if(0===e.length)return t;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return Math.abs(t)}(t);let r=0;switch(e){case w.PRIVATE:r=s.private;break;case w.GROUP:r=s.group;break;case w.CHATROOM:r=s.chatroom;break;case w.ULTRA_GROUP:r=s.ultraGroup}return!!r&&n%(1/r)==0}recordReceivedMessagesForStatistics(e){if(0===e.length)return;const{connectedTime:t}=this,i=e.filter((e=>e.sentTime>=t&&this.checkIfNeedRecordMessageUId(e.conversationType,e.messageUId))).map((e=>e.messageUId));if(0===i.length)return;const s=Date.now();this.logger.record(ge.IM_MSG_RECEIVE,JSON.stringify({client_ts:s,server_deltatime:s-this.serverTime,msg_ids:i.join(",")}))}}var rT,oT,aT;KI=new WeakMap,QI=new WeakMap,XI=new WeakMap,zI=new WeakMap,ZI=new WeakMap,JI=new WeakSet,$I=function(e,s){return t(this,void 0,void 0,(function*(){s||this.getAllRobots(!0);const e=yield i(this,KI,"f").noticeOnline();if(!e.isOk)return;if(s)i(this,KI,"f").startInterval(18e4,!0);else{const{syncTime:t,hasNext:s}=e.data;i(this,KI,"f").setInitVersion(t),i(this,KI,"f").startInterval(18e4,!!s)}const t=this.getNaviInfoFromCache();i(this,QI,"f").checkStart(t),i(this,XI,"f").checkStart(t)}))},eT=function(e,t){i(this,KI,"f").stopInterval()},tT=function(e){this._robots.isSynced=!1,this._robots.robots=[],i(this,KI,"f").reset(),i(this,QI,"f").stop(),i(this,XI,"f").stop()},iT=function(e,t,s){const{topic:n,syncMsg:o,targetId:a,date:l,pbData:c}=t,_=en(n),d=this.getNaviInfoFromCache();if(_)if(this.logger.debug(r.L_RECV_RMTP_O,n),o&&sT.includes(_)){e.stopPropagation();const{timestamp:i=this.serverTime,messageUId:n=""}=s||{},r=O_(t,this.currentUserId,i,n),o=C_(d,r,this.currentUserId,!1,t.targetId);this.emit("syncMsg",o,_)}else{if(_===$s.s_ntf){e.stopPropagation();const i=Uc.decode(To,t.pbData),{type:s,chrmId:n,time:o}=i;return this.logger.info(r.L_RECV_S_NTF_O,`type: ${s}, chrmId: ${n}, time: ${o}`),void this.emit("sNtf",i)}if(_===$s.s_cmd){e.stopPropagation();const s=Uc.decode(To,t.pbData),{type:n,chrmId:o,time:a}=s;if(this.logger.info(r.L_RECV_S_CMD_O,`type: ${n}, chrmId: ${o}, time: ${a}`),11===n)return void i(this,KI,"f").push(a);this.emit("sCmd",s)}if(_===$s.s_msg){e.stopPropagation();const i=Uc.decode(mo,t.pbData),s=C_(d,i,this.currentUserId,!1);this.emit("sMsg",s)}}else{this.logger.warn(r.L_RECV_RMTP_E,`unknown topic: ${n}`),e.stopPropagation();const t={name:n,targetId:a,data:c,timestamp:l};this.emit("unknownSignal",t)}};const lT=(e,t,i)=>{let s=0;return e&&(s|=1),t&&(s|=2),i&&(s|=4),s},cT=(e,t,i)=>({chatroomId:e,key:t.key,value:t.value,timestamp:t.version,type:i?C.DELETE:C.UPDATE});class _T extends di{constructor(e,t,i){super("WebChatroomKVStore"),rT.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_chatroomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:i}),oT.set(this,new Map),Object.defineProperty(this,"_emittedEntriesSynced",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const{logger:t}=this._ctx,s=t.createTraceId(),n=this._chatroomId,o={chatroomId:n,timestamp:e};t.info(r.L_PULL_CHATROOM_KV_T,JSON.stringify(o),s);const a=yield this._ctx.query($s.pullKV,n,zg(e),void 0);if(!a.isOk)return t.warn(r.L_PULL_CHATROOM_KV_R,JSON.stringify(Object.assign(Object.assign({},o),{code:a.code})),s),a.wipe();const{bFullUpdate:l,entries:c,syncTime:_}=Zg(a.data.pbData);t.info(r.L_PULL_CHATROOM_KV_R,JSON.stringify(Object.assign(Object.assign({},o),{newVersion:_})),s);const d=new Map;return l&&(Array.from(i(this,oT,"f").values()).forEach((e=>{d.set(e.key,cT(n,e,!0))})),i(this,oT,"f").clear()),Array.from(c.values()).forEach((e=>{const{isDelete:t}={isAutoDelete:!!(1&(s=e.status)),isOverwrite:!!(2&s),isDelete:!!(4&s)};var s;const r=(e=>{const{key:t,value:i,timestamp:s,uid:n,version:r}=e;return{key:t,value:i,userId:n,version:r}})(e);t?i(this,oT,"f").delete(r.key):i(this,oT,"f").set(r.key,r),d.set(r.key,cT(n,r,t))})),this._emittedEntriesSynced||(this._emittedEntriesSynced=!0,this._emitter.emit("chatroom",{entriesSynced:n})),d.size>0&&this._emitter.emit("chatroom",{updatedEntries:Array.from(d.values())}),gi({version:_})}))}setEntry(e,s){return t(this,void 0,void 0,(function*(){const t=yield i(this,rT,"m",aT).call(this,e,s,!1);return t.isOk&&i(this,oT,"f").set(e.key,{key:e.key,value:e.value,userId:this._ctx.currentUserId,version:this._ctx.serverTime}),t}))}removeEntry(e,s){return t(this,void 0,void 0,(function*(){const t=yield i(this,rT,"m",aT).call(this,{key:e.key,value:"",isAutoDelete:!1,isSendNotification:e.isSendNotification,notificationExtra:e.notificationExtra},s,!0);return t.isOk&&i(this,oT,"f").delete(e.key),t}))}setEntries(e){return t(this,void 0,void 0,(function*(){const{serverTime:t}=this._ctx,s=e.entries.map((s=>{var n;const r=i(this,oT,"f").get(s.key);return{key:s.key,value:s.value,uid:this._ctx.currentUserId,version:null!==(n=null==r?void 0:r.version)&&void 0!==n?n:t,status:lT(!!e.isAutoDelete,e.isForce||!1,!1)}})),n=Uc.encode(zo,{entry:s}),r=yield this._ctx.query($s.setKVS,this._chatroomId,n,$o);if(!r.isOk&&r.code!==D.CHATROOM_KV_STORE_NOT_ALL_SUCCESS)return r.wipe();const{errorKeys:o,keysVersion:a}=r.data,l=new Map;return null==a||a.forEach((e=>{l.set(e.key,e.version)})),e.entries.forEach((e=>{const{key:t}=e,s=l.get(t);s&&i(this,oT,"f").set(t,{key:t,value:e.value,userId:this._ctx.currentUserId,version:s})})),r.wipe()}))}removeEntries(e){return t(this,void 0,void 0,(function*(){const t=lT(!1,!1,!0),{serverTime:s}=this._ctx,n=Uc.encode(zo,{entry:e.keys.map((e=>{var n;const r=i(this,oT,"f").get(e);return{key:e,status:t,value:"",uid:this._ctx.currentUserId,version:null!==(n=null==r?void 0:r.version)&&void 0!==n?n:s}}))}),r=yield this._ctx.query($s.delKVS,this._chatroomId,n,$o);if(!r.isOk&&r.code!==D.CHATROOM_KV_STORE_NOT_ALL_SUCCESS)return r.wipe();const{errorKeys:o}=r.data,a=new Set;return null==o||o.forEach((e=>a.add(e.key))),e.keys.forEach((e=>{a.has(e)||i(this,oT,"f").delete(e)})),r.wipe()}))}getEntry(e){if(!i(this,oT,"f").has(e))return null;return i(this,oT,"f").get(e).value}getAllEntries(){const e=Array.from(i(this,oT,"f").entries()).map((([e,t])=>[e,t.value]));return Object.fromEntries(e)}}var dT,uT,hT,gT,ET,IT,TT,fT,RT,AT,pT,mT,ST,vT,NT,OT,yT,CT,MT,bT,LT,UT;oT=new WeakMap,rT=new WeakSet,aT=function(e,s,n){var r;return t(this,void 0,void 0,(function*(){const{serverTime:t}=this._ctx,o=i(this,oT,"f").get(e.key),a=lT(!!e.isAutoDelete,s,n),l={entry:{key:e.key,value:e.value,uid:this._ctx.currentUserId,version:null!==(r=null==o?void 0:o.version)&&void 0!==r?r:t,status:a}};e.isSendNotification&&(l.type=w.CHATROOM,l.bNotify=!0,l.notification={sessionId:M_(Q.CHRM_KV_NOTIFY,!1,!1,!1),classname:Q.CHRM_KV_NOTIFY,content:JSON.stringify({key:e.key,value:e.value,extra:e.notificationExtra,type:n?C.DELETE:C.UPDATE})});const c=Uc.encode(Xo,l);return(yield this._ctx.query(n?$s.delKV:$s.setKV,this._chatroomId,c)).wipe()}))};class PT extends di{constructor(e,t,i,n){super("WebChatroomMessageReceiver"),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_chatroomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:n}),dT.set(this,0),s(this,dT,i,"f")}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const{logger:t}=this._ctx,s=t.createTraceId(),n={chatroomId:this._chatroomId,version:e};t.info(r.L_PULL_CHATROOM_MSG_T,JSON.stringify(n),s);const o=((e,t)=>Uc.encode(bo,{syncTime:e,count:t,compressioEnabled:bs.enable()}))(e,i(this,dT,"f")),a=yield this._ctx.query($s.chrmPull,this._chatroomId,o,void 0);if(t.summary(r.L_PULL_CHATROOM_MSG_R,a,s,n),!a.isOk)return a.wipe();const{currentUserId:l}=this._ctx,{list:c,syncTime:_}=Hg(a.data.pbData);if(c.length>0){const e=c.map((e=>y_(e,l,!1,this._chatroomId)));this._emitter.emit("message",e,this._chatroomId)}return gi({version:_})}))}}dT=new WeakMap;class DT{constructor(e,t,i,n,r){uT.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"initCount",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:r}),hT.set(this,void 0),gT.set(this,void 0),s(this,hT,new PT(this._ctx,this.roomId,i,n),"f"),s(this,gT,new _T(this._ctx,this.roomId,n),"f")}startInterval(){const e=18e4;i(this,hT,"f").setInitVersion(0),i(this,hT,"f").startInterval(e,!0),i(this,uT,"a",ET)&&(i(this,gT,"f").setInitVersion(0),i(this,gT,"f").startInterval(e,!0))}restartInterval(){const e=18e4;this.stopInterval(),i(this,gT,"f").startInterval(e,!0),i(this,hT,"f").startInterval(e,!0)}stopInterval(){i(this,hT,"f").stopInterval(),i(this,gT,"f").stopInterval()}handleMessageNotify(e){i(this,hT,"f").push(e)}handleKVNotify(e){i(this,gT,"f").push(e)}setEntry(e,s){return t(this,void 0,void 0,(function*(){return i(this,gT,"f").setEntry(e,s)}))}setEntries(e){return t(this,void 0,void 0,(function*(){return i(this,gT,"f").setEntries(e)}))}removeEntry(e,s){return t(this,void 0,void 0,(function*(){return i(this,gT,"f").removeEntry(e,s)}))}removeEntries(e){return t(this,void 0,void 0,(function*(){return i(this,gT,"f").removeEntries(e)}))}getEntry(e){return i(this,gT,"f").getEntry(e)}getAllEntries(){return i(this,gT,"f").getAllEntries()}}hT=new WeakMap,gT=new WeakMap,uT=new WeakSet,ET=function(){var e;return!!(null===(e=this._ctx.getNaviInfoFromCache())||void 0===e?void 0:e.kvStorage)};const wT=e=>{const{joinTime:t,createTime:i,memberCount:s,chatroomBanState:n,whiteListState:r}=e;return{createTime:i,joinTime:t,memberCount:s,isAllChatroomBanned:!(1&~(n||0)),isCurrentUserBanned:!(2&~(n||0)),isCurrentChatroomBanned:!(4&~(n||0)),isCurrentChatroomInWhitelist:!(1&~(r||0))}};class GT extends _i{constructor(e){super(),IT.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),TT.set(this,new Map),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),fT.set(this,void 0),Object.defineProperty(this,"setCheckChatRoomDuplicateMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),this.logger=e.logger,s(this,fT,new _i,"f"),i(this,fT,"f").on("message",i(this,IT,"m",AT),this),i(this,fT,"f").on("chatroom",i(this,IT,"m",RT),this),this._ctx.on("onConnected",i(this,IT,"m",ST),this),this._ctx.on("onDisconnected",i(this,IT,"m",pT),this),this._ctx.on("onSuspend",i(this,IT,"m",mT),this),this._ctx.on("sNtf",i(this,IT,"m",NT),this),this._ctx.on("sCmd",i(this,IT,"m",OT),this),this._ctx.on("syncMsg",i(this,IT,"m",vT),this),this._ctx.on("sMsg",i(this,IT,"m",vT),this)}joinChatroom(e,s,n,r){return t(this,void 0,void 0,(function*(){const t=yield i(this,IT,"m",MT).call(this,e,n,r);if(!t.isOk)return t.wipe();let o=i(this,TT,"f").get(e);return o||(o=new DT(this._ctx,e,s,i(this,fT,"f"),r),i(this,TT,"f").set(e,o),o.startInterval()),t.trans(wT)}))}quitChatroom(e,s){return t(this,void 0,void 0,(function*(){if(!i(this,TT,"f").get(e))return gi();i(this,IT,"m",bT).call(this,e);const t=Uc.encode(Co,{nothing:1,extra:s});return(yield this._ctx.query($s.exitChrm,e,t)).wipe()}))}getChatroomInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ko,{count:i,order:s});return(yield this._ctx.query($s.queryChrmI,e,t,xo)).trans((e=>{const{userTotalNums:t,userInfos:i}=e;return{userCount:t,userInfos:i.map((({id:e,time:t})=>({id:e,time:t})))}}))}))}setChatroomEntry(e,s,n){return t(this,void 0,void 0,(function*(){return i(this,IT,"m",LT).call(this,e).next((e=>e.setEntry(s,n)))}))}setChatroomEntries(e,s){return t(this,void 0,void 0,(function*(){return i(this,IT,"m",LT).call(this,e).next((e=>e.setEntries(s)))}))}removeChatroomEntry(e,s,n){return t(this,void 0,void 0,(function*(){return i(this,IT,"m",LT).call(this,e).next((e=>e.removeEntry(s,n)))}))}removeChatroomEntries(e,s){return t(this,void 0,void 0,(function*(){return i(this,IT,"m",LT).call(this,e).next((e=>e.removeEntries(s)))}))}getChatroomEntry(e,s){return t(this,void 0,void 0,(function*(){const t=i(this,TT,"f").get(e);if(t){const e=t.getEntry(s);return null===e?Ei(D.CHATROOM_KEY_NOT_EXIST):gi(e)}return(yield i(this,IT,"m",UT).call(this,e)).tryTrans((e=>{const t=e[s];return void 0===t?Ei(D.CHATROOM_KEY_NOT_EXIST):gi(t)}))}))}getAllChatroomEntries(e){return t(this,void 0,void 0,(function*(){const t=i(this,TT,"f").get(e);return t?gi(t.getAllEntries()):i(this,IT,"m",UT).call(this,e)}))}getChatroomHistoryMessages(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=Jg({targetId:e,time:i,count:s,order:n}),{currentUserId:r}=this._ctx,o=yield this._ctx.query($s.qryCHMsg,e,t);if(!o.isOk)return o.wipe();const a=Kg(o.data.pbData);return gi({hasMore:!!a.hasMsg,list:a.list.map((t=>y_(t,r,!1,e)))})}))}bindRTCRoomForChatroom(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Ga,{rtcRoomId:e.rtcRoomId});return(yield this._ctx.query($s.setRtcRoomId,e.chatRoomId,t)).wipe()}))}}var VT,kT,xT,FT;TT=new WeakMap,fT=new WeakMap,IT=new WeakSet,RT=function(e,t){e.stopPropagation(),this.emit("chatroom",t)},AT=function(e,t,s){e.stopPropagation(),this._ctx.recordReceivedMessagesForStatistics(t),i(this,IT,"m",yT).call(this,t,s,!1)},pT=function(){for(const e of i(this,TT,"f").values())e.stopInterval();i(this,TT,"f").clear()},mT=function(){for(const e of i(this,TT,"f").values())e.stopInterval()},ST=function(e,t){if(t)for(const e of i(this,TT,"f").values())i(this,IT,"m",CT).call(this,e)},vT=function(e,t){t.conversationType===w.CHATROOM&&(e.stopPropagation(),i(this,IT,"m",yT).call(this,[t],t.targetId,!0))},NT=function(e,t){const{type:s,chrmId:n,time:r}=t;if(2!==s)return;e.stopPropagation();const o=i(this,TT,"f").get(n);o&&o.handleMessageNotify(r)},OT=function(e,t){const{type:s,chrmId:n,time:r,destroyType:o}=t;if(2!==s&&4!==s)return;e.stopPropagation();const a=i(this,TT,"f").get(n);return a?4===s?(i(this,TT,"f").delete(n),void this.emit("chatroom",{chatroomDestroyed:n,chatroomDestroyedType:o})):void a.handleKVNotify(r):void 0},yT=function(e,t,s){if(!(i(this,TT,"f").get(t)||s&&e[0].messageType===Q.CHATROOM_MERGE_BLOCK))return;const n=e.filter((e=>{var s;const{messageType:n}=e;if(n===Q.CHATROOM_MERGE_CHANGE){const t=function(e){const t={},i=[],s=e.content.memberCount||0;return Array.isArray(e.content.userList)&&e.content.userList.forEach((e=>{t[e.userId]=e.status,i.push({userId:e.userId,action:e.status,extra:e.extra})})),{users:t,chatroomId:e.targetId,memberCount:s,userList:i}}(e);return this.emit("chatroom",{userChange:t}),!1}if(n===Q.CHATROOM_MERGE_BAN){const t=function(e){const{chatroomId:t,operateType:i,durationTime:s,operateTime:n,userList:r,extra:o}=e.content;return{chatroomId:t,banType:i,durationTime:s,operateTime:n,userIdList:r,extra:o||""}}(e);return this.emit("chatroom",{chatroomNotifyBan:t}),!1}if(n===Q.CHATROOM_SYNC_MSG){const t=function(e){const{chatroomId:t,status:i,reason:s,time:n,extra:r}=e.content;return{chatroomId:t,status:i,reason:s,time:n,extra:r||""}}(e);return this.emit("chatroom",{chatroomNotifyMultiLoginSync:t}),!1}if(n===Q.CHATROOM_MERGE_BLOCK){const n=function(e){const{chatroomId:t,operateType:i,durationTime:s,operateTime:n,userList:r,extra:o}=e.content;return{chatroomId:t,operateType:i,durationTime:s,operateTime:n,userIdList:r,extra:o||""}}(e);return n.operateType===P.Blocked&&(null===(s=null==n?void 0:n.userIdList)||void 0===s?void 0:s.includes(this._ctx.currentUserId))&&i(this,IT,"m",bT).call(this,t),this.emit("chatroom",{chatroomNotifyBlock:n}),!1}return!0}));n.length>0&&this.emit("message",n,t)},CT=function(e){return t(this,void 0,void 0,(function*(){const{roomId:t,extra:s}=e,n=this.logger.createTraceId();this.logger.info(r.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:t}),n);const o=yield i(this,IT,"m",MT).call(this,t,!1,s);this.logger.summary(r.L_REJOIN_CHATROOM_R,o,n,{chatroomId:t});const{code:a,isOk:l,data:c}=o;if(!l)return a!==D.RC_CHATROOM_USER_KICKED&&a!==D.RC_CHATROOM_NOT_EXIST||i(this,TT,"f").delete(t),void this.emit("chatroom",{rejoinedRoom:{chatroomId:t,errorCode:a}});e.restartInterval();const _=wT(c);this.emit("chatroom",{rejoinedRoom:Object.assign(Object.assign({chatroomId:t},_),{count:e.initCount})})}))},MT=function(e,t,i){const s=Uc.encode(Co,{extra:i,nothing:1}),n=t?$s.joinChrm:$s.joinChrmR;return this._ctx.query(n,e,s,Mo)},bT=function(e){const t=i(this,TT,"f").get(e);t&&(t.stopInterval(),i(this,TT,"f").delete(e))},LT=function(e){const t=i(this,TT,"f").get(e);return t?gi(t):Ei(D.NOT_IN_CHATROOM)},UT=function(e){return t(this,void 0,void 0,(function*(){const t=yield this._ctx.query($s.pullKV,e,zg(0),void 0);if(!t.isOk)return t.wipe();const{entries:i}=Zg(t.data.pbData);return gi(i.reduce(((e,t)=>(e[t.key]=t.value,e)),{}))}))};class BT extends _d{_syncDataHandler(e){const{localStorage:t}=Eo,{appkey:i,currentUserId:s}=e,n=st(i,s),r=t.getItem(n)||"{}",{version:o,tags:a,transLan:l,autoTrans:c}=JSON.parse(r);return{value:{value:{version:o||0,tags:a||{},transLan:l||"zh",autoTrans:c||!1},key:n,stringify:!0}}}get version(){return this.get("value").version||0}get tags(){return this.get("value").tags||{}}forceUpdate(e){this.set("value",e)}addTag(e,t){const{tags:i,autoTrans:s,transLan:n}=this.get("value");i[e.tagId]={tagName:e.tagName,createdTime:t},this.set("value",{version:t,tags:i,autoTrans:s,transLan:n})}deleteTag(e,t){const{tags:i,autoTrans:s,transLan:n}=this.get("value");delete i[e],this.set("value",{version:t,tags:i,autoTrans:s,transLan:n})}}class HT extends di{constructor(e){super("UserSettings"),VT.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),kT.set(this,!1),this.storage=new BT,this._ctx.on("onConnected",this._handleConnected,this),this._ctx.on("onDisconnected",this._handleDisconnected,this),this._ctx.on("onSuspend",this._handleDisconnected,this),this._ctx.on("signal",this._handleSignal,this)}_handleConnected(){this.storage.syncDataFromLocalStorage(this._ctx),s(this,kT,!0,"f");const{version:e}=this.storage;this.setInitVersion(e),this.push(e)}_handleDisconnected(){this.reset()}_handleSignal(e,t){if(en(t.topic)===$s.s_us){const{version:i}=Uc.decode(Sa,t.pbData);this.push(i),e.stopPropagation()}}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const{currentUserId:t,logger:s}=this._ctx,n=this._ctx.getNaviInfoFromCache(),o=s.createTraceId();s.info(r.L_SYNC_USER_SETTINGS_T,`version: ${e}`,o);const a=Uc.encode(sa,{version:e,ipType:n.ipType||0}),l=yield this._ctx.query($s.pullUS,t,a,na);if(s.summary(r.L_SYNC_USER_SETTINGS_R,l,o),!l.isOk)return i(this,VT,"m",xT).call(this,l.code),l.wipe();const{version:c,items:_}=l.data;let d=!1,u=!1,h=!1,g="";const{transLan:E,autoTrans:I,tags:T}=this.storage.get("value"),f={version:c,transLan:E,autoTrans:I,tags:T};return null==_||_.forEach((e=>{const{key:t,value:i}=e;switch(t){case"Tag":f.tags={},e.tags.forEach((e=>{f.tags[e.tagId]={tagName:e.name,createdTime:e.createdTime}})),d=!0;break;case"transLan":h=!0,f.transLan=_r.readUTF(new Uint8Array(i));break;case"autoTrans":u=!0,f.autoTrans="1"===_r.readUTF(new Uint8Array(i));break;case"VoipInfo":g=_r.readUTF(new Uint8Array(i))}})),this.storage.set("value",f),d&&this.emit("tagsChanged"),h&&this.emit("userSettingsChanged",{key:ki.TranslationLanguage,value:f.transLan}),u&&this.emit("userSettingsChanged",{key:ki.AutoTranslateEnable,value:f.autoTrans}),g&&this.emit("voipInfoChanged",g),i(this,VT,"m",xT).call(this,l.code),gi({version:c})}))}hasTag(e){return!!this.storage.tags[e]}getTags(){return this.storage.tags}createTag(e){return t(this,void 0,void 0,(function*(){const{version:t}=this.storage,{currentUserId:i}=this._ctx,s=Uc.encode(pa,{version:t,tags:[{tagId:e.tagId,name:e.tagName}],ignoreVersion:!0}),n=yield this._ctx.query($s.addSeTag,i,s,ia);if(n.isOk){const{version:i,updateVersion:s}=n.data;this.storage.addTag(e,s?i:t)}return n.wipe()}))}removeTag(e){return t(this,void 0,void 0,(function*(){const{version:t}=this.storage,{currentUserId:i}=this._ctx,s=Uc.encode(ma,{version:t,tags:[{tagId:e}],ignoreVersion:!0}),n=yield this._ctx.query($s.delSeTag,i,s,ia);if(n.isOk){const{version:i,updateVersion:s}=n.data;this.storage.deleteTag(e,s?i:t)}return n.wipe()}))}setTranslationLanguage(e){return t(this,void 0,void 0,(function*(){return i(this,VT,"m",FT).call(this,$s.transLan,e)}))}getTranslationLanguage(){return t(this,void 0,void 0,(function*(){return gi(this.storage.get("value").transLan||"zh")}))}setAutoTranslateEnabled(e){return t(this,void 0,void 0,(function*(){return i(this,VT,"m",FT).call(this,$s.autoTrans,e?"1":"0")}))}getAutoTranslateEnabled(){return t(this,void 0,void 0,(function*(){return gi(this.storage.get("value").autoTrans)}))}}kT=new WeakMap,VT=new WeakSet,xT=function(e){i(this,kT,"f")&&(s(this,kT,!1,"f"),this.emit("userSettingsSynced",e))},FT=function(e,i){return t(this,void 0,void 0,(function*(){const{version:t}=this.storage,{currentUserId:s}=this._ctx,n=Uc.encode(ta,{version:t,value:i,ignoreVersion:!0}),r=yield this._ctx.query(e,s,n,ia);if(r.isOk){const{version:t,updateVersion:s}=r.data,{transLan:n,autoTrans:o,tags:a,version:l}=this.storage.get("value"),c={version:s?t:l,transLan:n,autoTrans:o,tags:a};switch(e){case $s.transLan:c.transLan=i;break;case $s.autoTrans:c.autoTrans="1"===i}this.storage.set("value",c)}return r.wipe()}))};const jT=e=>{var t;return{userId:e.userId,name:e.name,portraitUri:e.portraitUrl,remark:null!==(t=e.remarkName)&&void 0!==t?t:"",directionType:e.friendType,extProfile:Object.fromEntries(e.extProfile.map((e=>[e.key,e.value]))),addTime:e.relationTime,inBlackList:!!e.flag}},YT=e=>{var t,i;const{targetId:s,settingProfile:n,extProfile:r,baseInfo:o,userInfo:a}=e,l=Kt(n||[]),c=Kt(r||[]);return{groupId:s,groupName:l.name||"",portraitUri:l.portraitUrl||"",introduction:l.introduction||"",notice:l.announcement||"",extProfile:c,joinPermission:~~l.joinPerm,removeMemberPermission:~~l.removePerm,invitePermission:~~l.memInvitePerm,inviteHandlePermission:~~l.invitePerm,groupInfoEditPermission:~~l.profilePerm,memberInfoEditPermission:~~l.memProfilePerm,creatorId:(null==o?void 0:o.creatorId)||"",ownerId:(null==o?void 0:o.ownerId)||"",createTime:(null==o?void 0:o.createTime)||0,membersCount:(null==o?void 0:o.memberCount)||0,remark:null!==(t=null==a?void 0:a.remarkName)&&void 0!==t?t:"",joinedTime:(null==a?void 0:a.joinTime)||0,role:null!==(i=null==a?void 0:a.role)&&void 0!==i?i:f.UNDEF}};class WT{constructor(e){Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"searchFriendsInfo",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"searchGroupMembers",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"searchJoinedGroups",{enumerable:!0,configurable:!0,writable:!0,value:xE})}updateMyUserProfileVisibility(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(rl,{permission:e});return(yield this.ctx.query($s.updProfilePermiss,this.ctx.currentUserId,t)).wipe()}))}getMyUserProfileVisibility(){return t(this,void 0,void 0,(function*(){const e=Uc.encode(nl,{nothing:1});return(yield this.ctx.query($s.qProfilePermiss,this.ctx.currentUserId,e,rl)).trans((e=>e.permission))}))}searchUserProfileByUniqueId(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ol,{uniqueId:e}),i=yield this.ctx.query($s.searchUserProfile,this.ctx.currentUserId,t,el);if(!i.isOk)return i.wipe();const{userId:s,userProfile:n,userExtProfile:r}=i.data,o=xt(s,n,r);return gi(o)}))}createGroup(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=kg(e,i,s,n),r=yield this.ctx.query($s.channelCreate,e,t,void 0);if(r.isOk||!r.data)return r.wipe();const o=Uc.decode(ll,r.data.pbData),a={errorKeys:o.censorFailedFields,processCode:o.processCode||0};return Ei(r.code,r.msg,a)}))}updateGroupInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=kg(e,i,s),n=yield this.ctx.query($s.upChannelInfo,e,t,void 0);if(n.isOk||!n.data)return n.wipe();const r=Uc.decode(ll,n.data.pbData);return Ei(n.code,n.msg,{errorKeys:r.censorFailedFields})}))}getGroupsInfo(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(cl,{type:w.GROUP,list:e.map((e=>({targetId:e})))}),i=yield this.ctx.query($s.qChannelInfo,e[0],t,ul);if(!i.isOk)return i.wipe();const{list:s}=qg(i.data);return gi(s.map(YT))}))}kickGroupMembers(e,i,s){return t(this,void 0,void 0,(function*(){const t=sE({targetId:e,users:i,settingInfo:{isQuit:!0,isDelBan:s.removeMuteStatus,isDelAttention:s.removeFollow,isDelWhite:s.removeWhiteList}});return(yield this.ctx.query($s.channelMemKick,e,t)).wipe()}))}quitGroup(e,i){return t(this,void 0,void 0,(function*(){const t=sE({targetId:e,settingInfo:{isQuit:!0,isDelBan:i.removeMuteStatus,isDelAttention:i.removeFollow,isDelWhite:i.removeWhiteList}});return(yield this.ctx.query($s.channelMemQuit,e,t)).wipe()}))}dismissGroup(e){return t(this,void 0,void 0,(function*(){const t=sE({targetId:e});return(yield this.ctx.query($s.channelDismiss,e,t)).wipe()}))}transferGroupOwner(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=sE({targetId:e,settingInfo:{isQuit:s,isDelBan:n.removeMuteStatus,isDelAttention:n.removeFollow,isDelWhite:n.removeWhiteList},users:[i]});return(yield this.ctx.query($s.channelTransfer,e,t)).wipe()}))}setGroupManagers(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(_l,{targetId:i,type:w.GROUP,users:s,operateType:e});return(yield this.ctx.query($s.upChannelManager,i,t)).wipe()}))}setGroupFollows(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(_l,{targetId:i,type:w.GROUP,users:s,operateType:e});return(yield this.ctx.query($s.upChannelFollow,i,t)).wipe()}))}getGroupFollows(e){return t(this,void 0,void 0,(function*(){const t=tE({targetId:e}),i=yield this.ctx.query($s.qChannelFollow,this.ctx.currentUserId,t,ul);if(!i.isOk)return i.wipe();const{list:s}=qg(i.data),n=s.map((e=>({userId:e.userId,time:e.opTime})));return gi(n)}))}setGroupRemark(e,i){return t(this,void 0,void 0,(function*(){const t=iE({targetId:e,operateType:i?p.ADD:p.REMOVE,channelNickName:i});return(yield this.ctx.query($s.upChannelRemark,e,t)).wipe()}))}addFriend(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Rl,{targetId:e,type:i,info:s});return(yield this.ctx.query($s.friendAdd,this.ctx.currentUserId,t,ll)).trans((e=>({processCode:e.processCode||0})))}))}deleteFriends(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Al,{targetId:e,type:i});return(yield this.ctx.query($s.friendDel,this.ctx.currentUserId,t)).wipe()}))}acceptFriendRequest(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Rl,{targetId:e,type:1});return(yield this.ctx.query($s.friendHandle,this.ctx.currentUserId,t)).wipe()}))}refuseFriendRequest(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Rl,{targetId:e,type:2,info:i});return(yield this.ctx.query($s.friendHandle,this.ctx.currentUserId,t)).wipe()}))}setFriendInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ml,{targetId:e,remarkName:i,extProfile:Object.entries(s).map((([e,t])=>({key:e,value:t})))}),n=yield this.ctx.query($s.friendSetPf,this.ctx.currentUserId,t,void 0);if(n.isOk||!n.data)return n.wipe();const r=Uc.decode(Sl,n.data.pbData);return Ei(n.code,"",{errorKeys:r.censorFailedFields})}))}checkFriends(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Al,{targetId:e,type:i});return(yield this.ctx.query($s.friendCheck,this.ctx.currentUserId,t,pl)).trans((({list:e})=>e.map((e=>({userId:e.targetId,relationType:e.status})))))}))}getFriends(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(vl,{queryType:11,friendType:e,page:{size:i.count,order:i.order?0:1,pageToken:i.pageToken}}),s=yield this.ctx.query($s.friendsQuery,this.ctx.currentUserId,t,ul);if(!s.isOk)return s.wipe();const{pageToken:n,hasNext:r}=s.data.page,{list:o}=qg(s.data),a={pageToken:r&&n?n:"",data:o.map(jT)};return gi(a)}))}getFriendApplications(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(vl,{queryType:12,page:{size:e.count,pageToken:e.pageToken,order:e.order?0:1}}),i=yield this.ctx.query($s.friendsQuery,this.ctx.currentUserId,t,ul);if(!i.isOk)return i.wipe();const{pageToken:s,hasNext:n}=i.data.page,{list:r}=qg(i.data),o={pageToken:n&&s?s:"",data:r.map((e=>({userId:e.userId,name:e.name,portraitUri:e.portraitUrl,applicationType:e.type,applicationStatus:e.status,operationTime:e.operateTime,extra:e.info||""})))};return gi(o)}))}getFriendsInfo(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Nl,{targetId:e});return(yield this.ctx.query($s.friendsInfoQry,this.ctx.currentUserId,t,yl)).trans((e=>e.list.map(jT)))}))}setFriendAddPermission(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Ol,{level:e});return(yield this.ctx.query($s.friendAuthSet,this.ctx.currentUserId,t)).wipe()}))}getFriendAddPermission(){return t(this,void 0,void 0,(function*(){const{currentUserId:e}=this.ctx,t=Uc.encode(Rl,{targetId:e});return(yield this.ctx.query($s.friendAuthGet,e,t,Ol)).trans((e=>e.level))}))}getGroupMembers(e,i){return t(this,void 0,void 0,(function*(){const t=tE({targetId:e,ids:i}),s=yield this.ctx.query($s.qChannelSpeMem,e,t,ul);if(!s.isOk)return s.wipe();const{list:n}=qg(s.data),r=n.map(qt);return gi(r)}))}setGroupMemberInfo(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=iE({targetId:e,userId:i,channelNickName:s,additional:n}),r=yield this.ctx.query($s.upChannelMem,e,t,void 0);if(r.isOk||!r.data)return r.wipe();const o=Uc.decode(ll,r.data.pbData);return Ei(r.code,r.msg,{errorKeys:o.censorFailedFields})}))}getGroupMembersByRole(e,i,s){return t(this,void 0,void 0,(function*(){const t=tE({targetId:e,roleType:i,botType:s.filterRobotType,page:{size:s.count,order:s.order?0:1,pageToken:s.pageToken}}),n=yield this.ctx.query($s.qChannelMem,e,t,ul);if(!n.isOk)return n.wipe();const{pageToken:r,hasNext:o}=n.data.page,{list:a}=qg(n.data),l={pageToken:o&&r?r:"",data:a.map(qt)};return gi(l)}))}joinGroup(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(fl,{targetId:e,type:w.GROUP});return(yield this.ctx.query($s.channelMemJoin,e,t,ll)).trans((e=>({processCode:e.processCode||0})))}))}inviteUsersToGroup(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(fl,{targetId:e,type:w.GROUP,userIds:i});return(yield this.ctx.query($s.channelMemInvite,e,t,ll)).trans((e=>({processCode:e.processCode||0})))}))}memberInviteResponse(e){return t(this,void 0,void 0,(function*(){const{groupId:t,inviterId:i,optType:s,optResult:n,joinUserId:r,reason:o}=e,a=Uc.encode(Tl,{targetId:t,type:w.GROUP,optType:s,optResult:n,inviterId:i,joinUserId:r,detail:o});return(yield this.ctx.query($s.channelApplyResp,t,a,ll)).trans((e=>({processCode:e.processCode||0})))}))}getGroupApplications(e,i,s){return t(this,void 0,void 0,(function*(){const t=tE({page:{size:e.count,pageToken:e.pageToken,order:e.order?0:1}}),i=yield this.ctx.query($s.qChannelApplyList,this.ctx.currentUserId,t,ul);if(!i.isOk)return i.wipe();const{pageToken:s,hasNext:n,list:r}=qg(i.data),o=r.map(Jt);return gi({data:o,pageToken:n&&s?s:""})}))}getJoinedGroupsByRole(e,i){return t(this,void 0,void 0,(function*(){const t=tE({roleType:e,page:{size:i.count,pageToken:i.pageToken,order:i.order?1:0}}),s=yield this.ctx.query($s.qChannelMemJoin,this.ctx.currentUserId,t,ul);if(!s.isOk)return s.wipe();const{pageToken:n,hasNext:r}=s.data.page,{list:o}=qg(s.data),a=o.map(YT);return gi({data:a,pageToken:r&&n?n:""})}))}getJoinedGroups(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(dl,{type:w.GROUP,ids:e}),i=yield this.ctx.query($s.qChannelMemSpeJoin,this.ctx.currentUserId,t,ul);if(!i.isOk)return i.wipe();const{list:s}=qg(i.data),n=s.map(YT);return gi(n)}))}}const qT={[N.GROUP_OPERATION]:e=>"ChannelEventData",[N.GROUP_PROFILE_CHANGE]:e=>"ChannelEventData",[u.FRIEND_APPLICATION]:e=>({0:"FriendApplyEvent",1:"FriendApplyEvent",2:"FriendUserInfo",3:"FriendsInput",5:"FriendTypeChangeEvent",6:"FriendUpdateEvent"}[e])};class JT{constructor(e){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e})}decodeByPBName(e,t,i){let s=e;const n={}[t];try{s=e.length>0&&Uc.decode(t,e),vt(n)&&(s=n.call(this,s,i))}catch(e){this.logger.error(r.L_PB_DECODE_E,t)}return s}formatEventChangeList(e){return e.map((e=>{const{businessId:t,time:i,changeType:s,originalId:n,originalTime:r,secondaryId:o,isAdmin:a,additionalMark:l,operatorId:c,subChangeType:_,secondaryType:d,remindType:u,isRemindMe:h,extIds:g,eventData:E}=e;let I;return E&&(I=this._formatEventData(E,s,_)),{businessId:t,changeType:s,originalId:n,time:i,originalTime:r,secondaryId:o||"",isAdmin:a,additionalMark:l,operatorId:c,subChangeType:_,userGroupIds:g,secondaryType:d,remindType:u,isRemindMe:h,eventData:I}}))}_formatEventData(e,t,i){let s={};return e&&qT[t]&&qT[t](i)&&(s=Uc.decode(qT[t](i),e)||{}),s}}var KT,QT,XT,zT,ZT,$T,ef,tf,sf,nf,rf;const of={[w.PRIVATE]:$s.qryPMsg,[w.GROUP]:$s.qryGMsg,[w.CHATROOM]:$s.qryCHMsg,[w.CUSTOMER_SERVICE]:$s.qryCMsg,[w.SYSTEM]:$s.qrySMsg,[w.APP_PUBLIC_SERVICE]:$s.qryMCMsg,[w.PUBLIC_SERVICE]:$s.qryMPMsg,[w.ULTRA_GROUP]:$s.qryUgMsg},af=(e,t,i,s,n,r)=>{const{isCounted:o,isPersited:a,isStatusMessage:l}=ms(t.messageType),{conversationType:c,targetId:_,channelId:d}=e;return{conversationType:c,targetId:_,channelId:d||"",senderUserId:n,messageDirection:ue.SEND,isCounted:o,isMentioned:!!t.isMentioned,content:t.content,messageType:t.messageType,isOffLineMessage:!1,isPersited:a,messageUId:i,sentTime:s,receivedTime:0,disableNotification:!!t.disableNotification,isStatusMessage:!!l,canIncludeExpansion:!!t.canIncludeExpansion,expansion:t.canIncludeExpansion?t.expansion:null,receivedStatus:Re.UNREAD,receivedStatusInfo:Gt(Re.UNREAD),pushConfig:t.pushConfig,isInterrupt:t.isInterrupt,messageId:r||0,sentStatus:ie.SENT,directedUserIds:t.directionalUserIdList,disableUpdateLastMessage:t.disableUpdateLastMessage,needReceipt:t.needReceipt}},lf=[N.GROUP_OPERATION,N.GROUP_PROFILE_CHANGE,N.GROUP_APPLICATION_INVITATION,N.GROUP_FOLLOW_USER_CHANGE],cf=[u.FRIEND_APPLICATION];class _f{constructor(e,t){KT.add(this),Object.defineProperty(this,"_watcher",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userSettings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subscribeManager",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_openCallPlus",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_chat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_chatroom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dataHosting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_codec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_signalHandlerMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_latestPullKVMsgTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_handleInnerMsgOptions",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{const{messageType:i}=t;return i===Q.SYNC_READ_STATUS&&(t.directionalUserIdList=oi(e.conversationType,[this.currentUserId])),i===Q.READ_RECEIPT_RESPONSE&&(t.content.receiptMessageDic&&0!==Object.keys(t.content.receiptMessageDic).length||(t.content=this._chat.storage.createReadReceiptResponseContent(e)),t.directionalUserIdList=Object.keys(t.content.receiptMessageDic)),t}}),Object.defineProperty(this,"getOSInfo",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getProcessInfo",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getMainProcessInfo",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setProxy",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getProxy",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"testProxy",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setUserStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getUserStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"addToBlacklist",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"removeFromBlacklist",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getBlacklist",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getBlacklistStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"insertMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"batchInsertMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getLocalMessageCount",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"deleteLocalMessages",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"deleteLocalMessagesByTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"batchClearLocalMessagesByTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"clearLocalMessages",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setMessageContent",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setMessageSearchField",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"searchConversationByContentWithAllChannel",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"searchMessagesWithParams",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setMessageSentStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"updateMessageReceiptStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setMessageReceivedStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"clearLocalData",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setCheckDuplicateMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE});const s=this._ctx=new nT(t),{logger:n}=s;this._codec=new JT(n),this._userSettings=new HT(s),this._chat=new wI(s,this._userSettings,this),this._chatroom=new GT(s),this._dataHosting=new WT(s),this._chat.on("messages",this._handleChatMessages,this),this._chat.on("offlineFinished",(()=>this._watcher.pullFinished()),this),this._chat.on("syncReadStatusV4",this._handleSyncReadStatusV4,this),this._chat.on("expansions",this._handleExpansions,this),this._chat.on("readReceiptV4",this._handleReadReceiptV4,this),this._chat.on("conversationStatusChanged",this._conversationStatusChanged,this),this._chat.on("conversationStatusSynced",((e,t)=>this._watcher.conversationStatusSynced(t)),this),this._chat.on("sgRelationsSynced",((e,t)=>this._watcher.sgRelationsSynced(t)),this),this._chat.on("ultraGroupEnable",(()=>this._watcher.ultraGroupEnable()),this),this._chat.on("syncServerSaveUnreadCompleted",(()=>this._watcher.syncServerSaveUnreadCompleted()),this),this._chatroom.on("message",this._handleChatroomMessages,this),this._chatroom.on("chatroom",this._handlerChatroomEvent,this),s.on("sCmd",this._handleSCmdNotify,this),s.on("signal",this._handleSignal,this),s.on("onConnected",this.onConnected,this),s.on("onDisconnected",this.onDisconnected,this),s.on("onConnecting",this.onConnecting,this),s.on("onSuspend",this.onSuspend,this),s.on("messagesFromUG",this._handleMessagesFromUltraGroup,this),s.on("serverEvent",i(this,KT,"m",sf),this),s.on("readReceiptResponseV5",i(this,KT,"m",XT),this),s.on("speechToTextResponse",i(this,KT,"m",zT),this),s.on("ugUserGroupChanged",this._handleUserGroupStatus,this),s.on("ugChannelChanged",this._handleUltraChannelChange,this),s.on("messageModified",i(this,KT,"m",ZT),this),s.on("messageModifiedSyncCompleted",i(this,KT,"m",$T),this),s.on("ugMsgExpansionUpdated",i(this,KT,"m",ef),this),s.on("ugMsgRecalled",i(this,KT,"m",tf),this),s.on("robotsSynced",i(this,KT,"m",QT),this),s.on("messageReaction",((e,t)=>this._watcher.messageReaction(t))),s.on("unknownSignal",((e,t)=>this._handleUnknownSignal(t)),this),this._userSettings.on("voipInfoChanged",this._naviChangeHandler,this),this._userSettings.on("tagsChanged",(()=>this._watcher.tag()),this),this._userSettings.on("userSettingsSynced",((e,t)=>this._watcher.userSettingsSynced(t)),this),this._userSettings.on("userSettingsChanged",((e,t)=>this._watcher.userSettingsChanged(t)),this)}get appkey(){return this._initOptions.appkey}get chat(){return this._chat}get chatroom(){return this._chatroom}get userSettings(){return this._userSettings}get dataHosting(){return this._dataHosting}get usingCppEngine(){return!1}get logger(){return this._ctx.logger}registerCustomSignalHandler(e,t){"function"==typeof t&&e.forEach((e=>{const i=this._signalHandlerMap.get(e)||new Set;i.add(t),this._signalHandlerMap.set(e,i)}))}_handleUnknownSignal(e){const{name:t}=e,i=this._signalHandlerMap.get(t);i&&Array.from(i).forEach((i=>{try{i(e)}catch(e){console.error(`execute custom signal('${t}') handler err.`,e)}}))}onConnected(e,t){const i=this._ctx.getNaviInfoFromCache();this._initSubscribeManager(i),this._openCallPlus&&this._syncCallPullKVMsg(),this._watcher.onConnected(t)}onDisconnected(e,t){this._resetMemoryState(),this._watcher.onDisconnected(t)}onSuspend(e,t){this._watcher.onSuspend(t)}onConnecting(e){this._watcher.onConnecting()}_handleSyncReadStatusV4(e,t){t.forEach((e=>this._watcher.syncReadStatus(e)))}_handleReadReceiptV4(e,t){t.forEach((e=>this._watcher.messageReadReceipt(e)))}_handleExpansions(e,t){t.forEach((e=>this._watcher.expansion(e)))}_conversationStatusChanged(e,t){const i=t.some((e=>{var t;return void 0!==(null===(t=e.updatedItems)||void 0===t?void 0:t.tags)}));this._watcher.conversation(t),i&&this._watcher.conversationTag()}_initSubscribeManager(e){(e.subDriven||e.userProfile)&&(this._subscribeManager||(this._subscribeManager=new V_(this._ctx,{syncSubscribeUserStatusFinished:e=>{var t,i;null===(i=(t=this._watcher).syncSubscribedUserStatusFinished)||void 0===i||i.call(t,e)},subscribeUserStatusChanged:e=>{var t,i;null===(i=(t=this._watcher).subscribedUserStatusChange)||void 0===i||i.call(t,e)},subscribeRelationChanged:e=>{var t,i;null===(i=(t=this._watcher).subscribedRelationChange)||void 0===i||i.call(t,e)},ownUserProfileChanged:e=>{var t,i;null===(i=(t=this._watcher).ownUserProfileChanged)||void 0===i||i.call(t,e)}},this.currentUserId,this._ctx.delayTime,this.logger,!!e.userProfile,e.subDriven||0)),this._subscribeManager.syncData())}createLogger(e,t){return new x_(this.appkey,e,t,this.logger.proxy)}refetchNaviInfo(){return this._ctx.navi.request(this._ctx.currentToken,!0,!0,this.logger.createTraceId())}get naviInfo(){return this._ctx.getNaviInfoFromCache()}get connectedTime(){return this._ctx.connectedTime}get connectionStatus(){return this._ctx.connectionStatus}connect(e,i,s,n){return t(this,void 0,void 0,(function*(){return this._openCallPlus=s,this._ctx.connect(e,i,s,n)}))}_handleMessagesFromUltraGroup(e,t,i){const s=new Map,n=[];t.forEach((e=>{var t,i,r;const{targetId:o,content:a,messageUId:l,channelId:c,isMentioned:_,isCounted:d,senderUserId:u,messageType:h,sentTime:g,channelType:E,isPersited:I}=e,T={conversationType:w.ULTRA_GROUP,targetId:o,channelId:c||""},f=this._chat.storage.getOrCreateModel(T,!0),R=s.get(f)||{params:{channelType:E},time:g};s.set(f,R),R.time=g;const{params:A}=R;if(I&&(A.hidden=!1,A.latestMessage=e,A.operationTime=g),d&&u!==this.currentUserId&&h!==Q.RECALL_NOTIFICATION_MESSAGE){A.unreadCount=(A.unreadCount||f.unreadCount)+1;const e=(null===(t=null==a?void 0:a.mentionedInfo)||void 0===t?void 0:t.type)===K.ALL;_&&(e||(null===(r=null===(i=null==a?void 0:a.mentionedInfo)||void 0===i?void 0:i.userIdList)||void 0===r?void 0:r.includes(this.currentUserId)))&&(A.unreadMentionedCount=(A.unreadMentionedCount||f.unreadMentionedCount)+1,e||(A.unreadMentionedMeCount=(A.unreadMentionedMeCount||f.unreadMentionedMeCount)+1),A.hasMentioned=!0,A.mentionedInfo=null==a?void 0:a.mentionedInfo),f.firstUnreadMessage||A.firstUnreadMessageUId||(A.firstUnreadMessageType=h,A.firstUnreadMessageUId=l,A.firstUnreadTime=g)}n.push(e)}));const r=[],o=[];Array.from(s.entries()).forEach((([e,{params:t,time:i}])=>{r.push(e);const s=e.updateAttrs(t,i);s&&o.push({conversation:e.toIReceivedConversation(),updatedItems:s})})),this._chat.storage.updateConversationStorage(r),o.length>0&&this._watcher.conversation(o),this._batchMessage(n)}_handleChatroomMessages(e,t,i){this._watcher.batchMessage(t)}_handlerChatroomEvent(e,t){this._watcher.chatroom(t)}_handleChatMessages(e,t,i,s){this._watcher.batchMessage(i)}_handleSignal(e,t,i){var s;const{syncMsg:n,topic:r}=t;if(n)return void this._receiveSyncMsg(t,i);switch(en(r)){case $s.rtc_ntf:this._watcher.onRTCDataChange(t.pbData);break;case $s.s_opNtf:this._pullOperateStatusNotify(t);break;case $s.s_pubCall:this._pubCallInfo(t);break;case $s.s_stat:null===(s=this._subscribeManager)||void 0===s||s.updateUserStatus(t)}}_handleSCmdNotify(e,t){var i,s,n;const{time:r,type:o}=t;switch(o){case 8:null===(i=this._subscribeManager)||void 0===i||i.startsyncSubscribeUserStatus(r);break;case 9:null===(s=this._subscribeManager)||void 0===s||s.startSyncSubscribeRelationship(r);break;case 10:null===(n=this._subscribeManager)||void 0===n||n.syncOwnProfile(!0)}}_receiveMessageExpansion(e){const{content:t,channelId:i="",conversationType:s,targetId:n}=e,{put:r,del:o,mid:a}=t;r&&this._watcher.expansion({updatedExpansion:{messageUId:a,expansion:r,channelId:i,conversationType:s,targetId:n}}),o&&this._watcher.expansion({deletedExpansion:{messageUId:a,deletedKeys:o,channelId:i,conversationType:s,targetId:n}})}_clearConversationUnreadCount(e,t,i,s,n){const r=this._chat.storage.clearConversationUnreadCount({conversationType:e,targetId:t,channelId:i},n);s&&r&&this._watcher.conversation([r])}_updateSGModelCacheAfterSent(e){const{conversationType:t,isPersited:i,targetId:s,channelId:n,sentTime:r,disableUpdateLastMessage:o,messageType:a,messageUId:l,content:c}=e;if(!W(t,G))return;const _=this.naviInfo,d={conversationType:t,targetId:s,channelId:n},u=this._chat.storage.getOrCreateModel(d,!0),h={},g=a===Q.RECALL;if(i){g&&!u.hidden||(h.operationTime=r),h.hidden=!1;const t=g?c.sentTime:r;o||u.latestMessage&&!(u.latestMessage.sentTime<=t)||(h.latestMessage=_.supportRecallRefactor&&g?U_(e,!0):e)}if(this._ctx.includeUg&&a===Q.EXPANSION_NOTIFY&&u.latestMessage&&u.latestMessage.messageUId===l){const{put:e,del:t,clear:i}=c;i?u.latestMessage.expansion={}:e?u.latestMessage.expansion=Object.assign(Object.assign({},u.latestMessage.expansion),e):t&&u.latestMessage.expansion&&t.forEach((e=>{delete u.latestMessage.expansion[e]}))}const E=u.updateAttrs(h,e.sentTime);this._chat.storage.updateConversationStorage([u]),E&&this._watcher.conversation([{conversation:u.toIReceivedConversation(),updatedItems:E}])}_receiveSyncMsg(e,t){var i;switch(en(e.topic)){case $s.updRTime:this._receivesyncReadStatus(e);break;case $s.updUserSub:null===(i=this._subscribeManager)||void 0===i||i.startSyncSubscribeRelationship(t.timestamp)}}_batchMessage(e){this._watcher.batchMessage(e)}_pubCallInfo(e){const{key:t,dataContent:i,maxTime:s}=Uc.decode(ka,e.pbData);this._latestPullKVMsgTimestamp=s,this._watcher.callInfo(JSON.stringify({list:[{key:t,value:i}]}))}_receivesyncReadStatus(e){const t=Uc.decode(Yo,e.pbData),{type:i,channelId:s,msgTime:n,busChannel:r}=t;this._clearConversationUnreadCount(i,s,r||"",!0,n),this._watcher.syncReadStatus({conversationType:i,targetId:s,channelId:r,timestamp:n})}_syncCallPullKVMsg(){return t(this,void 0,void 0,(function*(){if(!this._ctx.isConnected)return;const e=Uc.encode(xa,{syncTime:this._latestPullKVMsgTimestamp}),{isOk:t,data:i}=yield this._ctx.query($s.pullKvMsg,this.currentUserId,e,Fa);t&&i&&(this._latestPullKVMsgTimestamp=i.maxTime,this._watcher.callInfo(JSON.stringify({list:i.info})))}))}getHistoryMessage(e,i,s){return t(this,void 0,void 0,(function*(){const{conversationType:t,targetId:s,channelId:n}=e,{timestamp:r,count:o,order:a}=i,l=of[t],{currentUserId:c}=this,_=Jg({targetId:s,busChannel:n,time:r||(1===a?1:this._ctx.serverTime+6e4),count:o,order:a}),d=t===w.CHATROOM?s:c,u=yield this._ctx.query(l,d,_,void 0);if(!u.isOk)return u.wipe();const h=Kg(u.data.pbData),g=h.list.map((e=>{const t=y_(e,c,!1,s);if(t.messageDirection===ue.SEND){const e=this._chat.storage.getReadReceiptResponseUsers(t,t.messageUId);t.readReceiptInfo={isReceiptRequestMessage:!0,readerList:e}}return t}));return gi({hasMore:!!h.hasMsg,list:0===a?g.reverse():g})}))}reportSDKInfo(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),i=JSON.stringify(e);this.logger.info(r.L_VER_REPORT_T,i,t);const s=Uc.encode(va,{sdkInfo:i}),n=yield this._ctx.query($s.reportsdk,this._ctx.currentUserId,s);this.logger.summary(r.L_VER_REPORT_R,n,t)}))}saveTextMessageDraft(e,i){return t(this,void 0,void 0,(function*(){return this._chat.storage.setDrafts(e,i),gi()}))}getTextMessageDraft(e){return t(this,void 0,void 0,(function*(){const t=this._chat.storage.getDrafts(e);return gi(t)}))}clearTextMessageDraft(e){return t(this,void 0,void 0,(function*(){return this._chat.storage.deleteDrafts(e),gi()}))}sendMessage(e,i,s,n){return t(this,void 0,void 0,(function*(){const{conversationType:t,targetId:s}=e;i=this._handleInnerMsgOptions(e,i);let r=!1;[w.PRIVATE,w.GROUP].includes(t)&&(i.isStatusMessage||ms(i.messageType).isStatusMessage)&&(r=!0);const o=r?(a=t,{[w.PRIVATE]:$s.ppMsgS,[w.GROUP]:$s.pgMsgS}[a]):(e=>({[w.PRIVATE]:$s.ppMsgP,[w.GROUP]:$s.pgMsgP,[w.CHATROOM]:$s.chatMsg,[w.CUSTOMER_SERVICE]:$s.pcMsgP,[w.RTC_ROOM]:$s.prMsgS,[w.SYSTEM]:$s.pbMsgP}[e]))(t)||$s.ppMsgP;var a;i.messageId||(i.messageId=ti());const{messageId:l}=i,c=eE(e,i),_=new Or($s[o],c,t===w.SYSTEM?this.currentUserId:s);if(_.setHeaderQos(nn),r)return this._ctx.sendOnly(_),gi(af(e,Object.assign(Object.assign({},i),{isStatusMessage:r}),"",0,this.currentUserId,l));const d=this._ctx.serverTime,u=af(e,Object.assign(Object.assign({},i),{isStatusMessage:r}),"",d,this.currentUserId,l);null==n||n(l);const h=Date.now(),{code:g,isOk:E,msg:I,data:T}=yield this._ctx.send(_);if(!E)return this._ctx.checkIfNeedRecordMessageUId(t)&&this.logger.record(ge.IM_MSG_SEND,JSON.stringify({channel:t,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._ctx.serverTime,cod:g})),u.sentStatus=ie.FAILED,Ei(g,I,u);const{timestamp:f,messageUId:R}=T;return u.sentTime=f,u.messageUId=R,this._sendMessageSuccessHandle(u),this._ctx.checkIfNeedRecordMessageUId(t,R)&&this.logger.record(ge.IM_MSG_SEND,JSON.stringify({msg_id:R,channel:t,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._ctx.serverTime,cod:g})),gi(u)}))}_sendMessageSuccessHandle(e){e.conversationType!==w.CHATROOM&&this._chat.storage.addSentRecord(e.messageUId,e.sentTime),this._updateSGModelCacheAfterSent(e);const{messageType:t}=e;t===Q.READ_RECEIPT_REQUEST&&this._chat.storage.addReadReceiptRequest(e,this.currentUserId),t===Q.READ_RECEIPT_RESPONSE&&this._chat.storage.handleReadReceiptResponse(e,this.currentUserId)}recallMsg(e,i){return t(this,void 0,void 0,(function*(){const{targetId:t,conversationType:s}=e,n=e.channelId||"",{user:r,extra:o,isDelete:a,directionalUserIdList:l,disableUpdateLastMessage:c,messageUId:_,sentTime:d,disableNotification:u,pushConfig:h,pushContent:g,isAdmin:E}=i,I={conversationType:s,targetId:t,messageUId:_,sentTime:d,channelId:n,isDelete:!!a,isAdmin:!!E};r&&(I.user=r),o&&(I.extra=o);const T={content:I,messageType:Q.RECALL,disableNotification:u,pushConfig:h,pushContent:(null==h?void 0:h.pushContent)||g,disableUpdateLastMessage:c,directionalUserIdList:oi(s,l)},f=eE(e,T),R=new Or($s.recallMsg,f,this.currentUserId);R.setHeaderQos(nn);const A=yield this._ctx.send(R);if(!A.isOk)return A.wipe();const p=A.data;s!==w.ULTRA_GROUP&&(p.messageUId=`Cmd:${_}`);const m=af(e,T,p.messageUId,p.timestamp,this.currentUserId);return s===w.ULTRA_GROUP?(this._chat.storage.addUGSentRecord(p.messageUId,p.timestamp),this._updateUltraGroupWhenRecallMsg(m)):(this._chat.storage.addSentRecord(p.messageUId,p.timestamp),this._updateSGModelCacheAfterSent(m)),gi(m)}))}_naviChangeHandler(e,t){this._ctx.navi.updateVoipCallInfo(this._ctx.currentToken,t);const i=this._ctx.getNaviInfoFromCache();this._watcher.onNaviDataChange(Object.assign({},i))}getFileToken(e,i,s,n,r,o){return t(this,void 0,void 0,(function*(){let t;t=n&&"uploads"!==n?i||"":Xt(e,i);const a=this.naviInfo,l=ri(a,this.logger);let c="";l||(c=JSON.stringify({uploadDomain:l}));const _=Uc.encode(vo,{type:e,key:t,httpMethod:s||"",queryString:n||"",url:r||"",ext:c,size:o?Math.ceil(o):0,ipType:a.ipType||0});return(yield this._ctx.query($s.qnTkn,this.currentUserId,_,Oo)).trans((e=>Object.assign(Object.assign({},e),{fileName:t,downloadAuthInfo:e.downloadAuthInfo?JSON.parse(e.downloadAuthInfo):null})))}))}getFileUrl(e,i,s,r){return t(this,void 0,void 0,(function*(){const t=this.naviInfo;let o,a="",l="";i===n.QINIU?o=$s.qnUrl:i===n.AWS?o=$s.s3Url:i===n.STC?o=$s.stcUrl:i===n.MINIO?(o=$s.minioUrl,a=ri(t,this.logger),l=JSON.stringify({url:a})):o=$s.aliUrl;const c=Uc.encode(No,{type:e,key:s,fileName:r,ext:l,size:-1,ipType:t.ipType||0});return(yield this._ctx.query(o,this.currentUserId,c,yo)).trans((({downloadUrl:e})=>({downloadUrl:e})))}))}disconnect(e,i){return t(this,void 0,void 0,(function*(){return yield this._ctx.disconnect(e,i),this._resetMemoryState(),gi()}))}_resetMemoryState(){this._subscribeManager&&delete this._subscribeManager}registerMessageType(e,t){}get serverTime(){return this._ctx.serverTime}get userId(){return this._ctx.currentUserId}get currentUserId(){return this._ctx.currentUserId}createTag(e){return t(this,void 0,void 0,(function*(){return this._userSettings.hasTag(e.tagId)?Ei(D.TAG_EXISTS):this._userSettings.createTag(e)}))}removeTag(e){return t(this,void 0,void 0,(function*(){return this._userSettings.hasTag(e)?this._userSettings.removeTag(e):Ei(D.TAG_NOT_EXIST)}))}updateTag(e){return t(this,void 0,void 0,(function*(){return this._userSettings.hasTag(e.tagId)?this._userSettings.createTag(e):Ei(D.TAG_NOT_EXIST)}))}getTagList(){var e;return t(this,void 0,void 0,(function*(){const t=this._userSettings.getTags(),i=this._chat.storage.getTagConversationCountMap(),s=[];for(const n in t)s.push({tagId:n,tagName:t[n].tagName,createdTime:t[n].createdTime,conversationCount:(null===(e=i.get(n))||void 0===e?void 0:e.length)||0});return gi(s)}))}sendUltraMessage(e,i,s,n){return t(this,void 0,void 0,(function*(){const{targetId:t}=e;i.messageId||(i.messageId=ti());const{messageId:s}=i,r=eE(e,i),o=new Or($s.ugMsg,r,t);o.setHeaderQos(nn);const a=this._ctx.serverTime,l=af(e,Object.assign({},i),"",a,this.currentUserId,s);n&&n(s);const c=Date.now(),{code:_,data:d}=yield this._ctx.send(o);if(_!==D.SUCCESS)return this._ctx.checkIfNeedRecordMessageUId(w.ULTRA_GROUP)&&this.logger.record(ge.IM_MSG_SEND,JSON.stringify({channel:w.ULTRA_GROUP,start_ts:c,client_ts:Date.now(),server_deltatime:Date.now()-this._ctx.serverTime,cod:_})),l.sentStatus=ie.FAILED,Ei(_,void 0,l);const{timestamp:u,messageUId:h}=d;l.sentTime=u,l.messageUId=h,this._ctx.checkIfNeedRecordMessageUId(w.ULTRA_GROUP,h)&&this.logger.record(ge.IM_MSG_SEND,JSON.stringify({msg_id:h,channel:w.ULTRA_GROUP,start_ts:c,client_ts:Date.now(),server_deltatime:Date.now()-this._ctx.serverTime,cod:_})),this._chat.storage.addUGSentRecord(h,u);const g=this._chat.storage.getOrCreateModel(e,!0),E=g.updateAttrs({operationTime:u,latestMessage:Object.assign({},l)},u);return E&&this._watcher.conversation([{conversation:g.toIReceivedConversation(),updatedItems:E}]),gi(l)}))}_pullOperateStatusNotify(e){if(!this._ctx.isConnected)return;const t=(e=>{const{type:t,notifyType:i,info:s,summary:n}=e,r=[],o=[],a=!(2&~i),l=!(1&~i);return l&&Array.isArray(s)&&s.forEach((e=>{const{targetId:t,busChannel:i,userId:s,opType:n,optime:o}=e;r.push({targetId:t,channelId:i,userId:s,operationType:n,operationTime:o})})),a&&Array.isArray(n)&&n.forEach((e=>{const{targetId:t,busChannel:i,count:s,opType:n}=e;o.push({targetId:t,channelId:i,count:s,operationType:n})})),{conversationType:t,info:r,summary:o,hasInfo:l,hasSummary:a}})(Uc.decode(wa,e.pbData));this._watcher.operateStatus(t)}_handleConvertEvent(e){var t,i;const s=[];e.filter((e=>0===e.subChangeType)).forEach((e=>{const{results:t}=Uc.decode(Fl,new Uint8Array(e.eventData));s.push(...t.map((e=>({identifier:e.messageUID,from:e.inputSource,code:e.code,translateInfo:{targetLanguage:e.targetLan,translatedText:e.transResult||"",status:e.code===D.SUCCESS?Cs.SUCCESS:Cs.FAILED}}))))})),s.length&&(null===(i=(t=this._watcher).translateResponse)||void 0===i||i.call(t,s))}_handleEventChangeList(e){const t={Group:{map:{},types:lf},Friend:{map:{},types:cf}},i=(e,t,i)=>{e[t]||(e[t]=[]),e[t].push(i)};e.forEach((e=>{const{changeType:s}=e;for(const n in t)if(t[n].types.includes(s)){i(t[n].map,s,e);break}}));const s={Group:this._processChangeMapGroup.bind(this),Friend:this._processChangeMapFriend.bind(this)};for(const e in t)Object.keys(t[e].map).length>0&&s[e](t[e].map)}_processChangeMapGroup(e){const{GROUP_OPERATION:t,GROUP_PROFILE_CHANGE:i,GROUP_FOLLOW_USER_CHANGE:s}=N;e[t]&&this._handleGroupOperation(e[t]),e[i]&&this._handleGroupProfileChange(e[i]),e[s]&&this._handleFollowUserChange(e[s])}_processChangeMapFriend(e){(e[u.FRIEND_APPLICATION]||[]).forEach((e=>{var t,i,s,n,r,o,a,l,c,_;const{subChangeType:u,businessId:g,time:E,eventData:I}=e,{FRIEND_APPLY:T,FRIEND_REFUSE:f,FRIEND_USER_INFO:R,FRIENDS_INPUT:A,FRIEND_CLEAR:p,FRIEND_INFO_CHANGE:m,FRIEND_INFO_CHANGE_SYNC:S}=h;switch(u){case T:case f:{const e=u===T?d.UNHANDLED:d.REFUSED;null===(i=(t=this._watcher).friendApplicationStatusChanged)||void 0===i||i.call(t,{userId:g,applicationType:I.applyType,applicationStatus:e,directionType:I.friendType,operationTime:E,extra:I.info||""});break}case R:null===(n=(s=this._watcher).friendAdd)||void 0===n||n.call(s,{userId:g,name:I.name,portraitUri:I.portraitUrl,directionType:I.friendType,operationTime:E});break;case A:null===(o=(r=this._watcher).friendDelete)||void 0===o||o.call(r,{userIds:I.targetId,directionType:I.type,operationTime:E});break;case p:null===(l=(a=this._watcher).friendCleared)||void 0===l||l.call(a,E);break;case m:break;case S:null===(_=(c=this._watcher).friendInfoChangedSync)||void 0===_||_.call(c,{userId:g,remark:I.remarkname,extProfile:I.extProfile,operationTime:E})}}))}_handleGroupOperation(e){e.forEach((e=>{var t,i;const{subChangeType:s,businessId:n,time:r,eventData:o}=e,{optUserInfo:a,channelInfo:l,userInfos:c}=o;let _={groupId:n,operation:s,operationTime:r};a&&(_.operatorInfo=qt(a)),s===R.CREATE&&([_.groupInfo]=((e=[])=>e.map((e=>{var t,i,s,n,r,o,a,l,c;const _=Wt(e.settingProfile)||{},d=e.extProfile||[],{targetId:u,baseInfo:h,userInfo:g}=e;return{groupId:u,groupName:null!==(t=_.name)&&void 0!==t?t:"",portraitUri:null!==(i=_.portraitUrl)&&void 0!==i?i:"",introduction:null!==(s=_.introduction)&&void 0!==s?s:"",notice:null!==(n=_.announcement)&&void 0!==n?n:"",extProfile:Wt(d),joinPermission:~~_.joinPerm,removeMemberPermission:~~_.removePerm,invitePermission:~~_.memInvitePerm,inviteHandlePermission:~~_.invitePerm,groupInfoEditPermission:~~_.profilePerm,memberInfoEditPermission:~~_.memProfilePerm,creatorId:null!==(r=null==h?void 0:h.creatorId)&&void 0!==r?r:"",ownerId:null!==(o=null==h?void 0:h.ownerId)&&void 0!==o?o:"",createTime:(null==h?void 0:h.createTime)||0,membersCount:null!==(a=null==h?void 0:h.memberCount)&&void 0!==a?a:0,remark:null!==(l=null==g?void 0:g.remarkName)&&void 0!==l?l:"",joinedTime:(null==g?void 0:g.joinTime)||0,role:null!==(c=null==g?void 0:g.role)&&void 0!==c?c:f.UNDEF}})))([l])),[R.CREATE,R.DISMISS].includes(s)||(_.memberInfos=c.map(qt)),null===(i=(t=this._watcher).groupOperation)||void 0===i||i.call(t,_)}))}_handleGroupProfileChange(e){e.forEach((e=>{var t,i,s,n,r,o;const{businessId:a,time:l,eventData:c,subChangeType:_,secondaryId:d}=e;switch(_){case A.GROUP_INFO_CHANGE:{const e=c.optUserInfo?qt(c.optUserInfo):void 0,[s]=Ht([c.channelInfo]),[n]=c.channelFullInfo?Ht([c.channelFullInfo]):[void 0],r={operatorInfo:e,groupInfo:s,changedGroupInfo:s,operationTime:l,fullGroupInfo:n};null===(i=(t=this._watcher).groupInfoChanged)||void 0===i||i.call(t,r);break}case A.MEMBER_PROFILE_CHANGE:{const e={groupId:a,operatorInfo:c.optUserInfo?qt(c.optUserInfo):void 0,memberInfo:qt(c.userInfos[0]),operationTime:l};null===(n=(s=this._watcher).groupMemberInfoChanged)||void 0===n||n.call(s,e);break}case A.GROUP_REMARK_DELETE:case A.GROUP_REMARK_SET:{const e=_===A.GROUP_REMARK_SET?p.ADD:p.REMOVE;null===(o=(r=this._watcher).groupRemarkChangedSync)||void 0===o||o.call(r,{groupId:a,operationType:e,operationTime:l,groupRemark:d});break}}}))}_handleFollowUserChange(e){e.forEach((e=>{var t,i;const{subChangeType:s,businessId:n,time:r,userGroupIds:o}=e,a=1===s?p.ADD:p.REMOVE;null===(i=(t=this._watcher).groupFollowsChangedSync)||void 0===i||i.call(t,{groupId:n,operationType:a,operationTime:r,userIds:o})}))}_handleUltraChannelChange(e,t){const i=[],s=[],n=[];t.forEach((e=>{const{subChangeType:t,targetId:r,msgTime:o,operatorId:a,busChannelType:l,time:c}=e,_=e.busChannel||"",d={conversationType:w.ULTRA_GROUP,targetId:r,channelId:_},u=this._chat.storage.getModel(d);switch(t){case $.PRIVATE_TO_PUBLIC:null==u||u.updateAttrs({channelType:X.PUBLIC}),i.push({targetId:r,channelId:_,changeType:z.PRIVATE_TO_PUBLIC,channelType:X.PUBLIC});break;case $.PUBLIC_TO_PRIVATE:null==u||u.updateAttrs({channelType:X.PRIVATE}),i.push({targetId:r,channelId:_,changeType:z.PUBLIC_TO_PRIVATE,channelType:X.PRIVATE});break;case $.PUBLIC_TO_PRIVATE_USER_NOT_IN:u&&this._chat.storage.removeConversation(u),i.push({targetId:r,channelId:_,changeType:z.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:l});break;case $.CHANNEL_DELETE:u&&this._chat.storage.removeConversation(u),s.push({targetId:r,channelId:_,channelType:l,deleteTime:c});break;case $.CHANNEL_USER_KICKED:n.push({targetId:r,channelId:_,userId:a,channelType:X.PRIVATE}),a===this.currentUserId&&u&&this._chat.storage.removeConversation(u);case $.PRIVATE_CHANNEL_USER_JOIN_PUBLIC:}})),i.length>0&&this._watcher.ultraGroupChannelChangeType(i),s.length>0&&this._watcher.ultraGroupChannelDelete(s),n.length>0&&this._watcher.ultraGroupChannelUserKicked(n)}_handleUserGroupStatus(e,i){return t(this,void 0,void 0,(function*(){const e=[],t=[],s=[],n=[],r=[];i.forEach((i=>{const{type:o,targetId:a,busChannelType:l,busChannel:c}=i,_=i.userGroupIds;switch(i.subChangeType){case ee.REMOVE_USER_GROUP:e.push({conversation:{conversationType:o,targetId:a},userGroupIds:_});break;case ee.JOIN_USER_GROUP:t.push({conversation:{conversationType:o,targetId:a},userGroupIds:_});break;case ee.EXIT_USER_GROUP:s.push({conversation:{conversationType:o,targetId:a},userGroupIds:_});break;case ee.CHANNEL_BIND_USER_GROUP:n.push({conversation:{conversationType:o,targetId:a,channelId:c},channelType:l,userGroupIds:_});break;case ee.CHANNEL_UNBIND_USER_GROUP:r.push({conversation:{conversationType:o,targetId:a,channelId:c},channelType:l,userGroupIds:_})}}));const o={};e.length>0&&(o.userGroupDisband=e),t.length>0&&(o.userAdded=t),s.length>0&&(o.userRemoved=s),n.length>0&&(o.userGroupBindChannel=n),r.length>0&&(o.userGroupUnBindChannel=r),this._watcher.userGroupStatus(o)}))}_updateUltraGroupWhenRecallMsg(e,t){const i=this._chat.storage.getModel(e);if(!i)return;const s={},{messageUId:n,sentTime:r}=e.content,{latestMessage:o}=i;o&&o.messageUId===n&&(s.latestMessage=U_(e,!0)),r&&i.lastReadTime<r&&i.unreadCount&&(s.unreadCount=i.unreadCount-1,t!==te.ALL&&t!==te.ME||!i.unreadMentionedCount||(s.unreadMentionedCount=i.unreadMentionedCount-1),t===te.ME&&i.unreadMentionedCount&&(s.unreadMentionedMeCount=i.unreadMentionedMeCount-1));const a=i.updateAttrs(s,e.sentTime);this._chat.storage.updateConversationStorage([i]),a&&this._watcher.conversation([{conversation:i.toIReceivedConversation(),updatedItems:a}])}subscribeUser(e,i,s){return t(this,void 0,void 0,(function*(){return this._subscribeManager.updateSubscribeRelation(e,i,ae.SUBSCRIBE,s)}))}unSubscribeUser(e,i){return t(this,void 0,void 0,(function*(){return yield this._subscribeManager.updateSubscribeRelation(e,i,ae.UNSUBSCRIBE)}))}getSubscribeUserList(e,i,s){var n;return t(this,void 0,void 0,(function*(){const t=null===(n=this._subscribeManager)||void 0===n?void 0:n.getSubscribeUserList(e,i,s);return gi(t)}))}getSubscribeUserStatus(e,i){var s;return t(this,void 0,void 0,(function*(){const t=null===(s=this._subscribeManager)||void 0===s?void 0:s.getSubscribeUserStatus(e,i);return gi(t||[])}))}updateMyUserProfile(e){var s;return t(this,void 0,void 0,(function*(){const t=Uc.encode(el,i(this,KT,"m",nf).call(this,e)),n=yield this._ctx.query($s.updUserProfile,this.currentUserId,t,void 0);if(!n.data)return n.wipe();const r=Uc.decode(tl,n.data.pbData);if(n.isOk){const{version:t}=r;return null===(s=this._subscribeManager)||void 0===s||s.updateOwnProfile(e,t),n.wipe()}const o=r.censorFailedFields;return Ei(n.code,"",o&&0!==o.length?{errorKeys:o,errorKey:o[0]}:void 0)}))}getMyUserProfile(){return this._subscribeManager.getOwnProfile()}getUserProfiles(e){return t(this,void 0,void 0,(function*(){return this._subscribeManager.getUserProfiles(e)}))}rtcSignaling(e,i,s,n){return t(this,void 0,void 0,(function*(){if(!s){return(yield this._ctx.send(new Or(i,n,e))).wipe()}return(yield this._ctx.query(i,e,n,void 0)).trans((e=>e.pbData))}))}rtcPing(e,i,s){return t(this,void 0,void 0,(function*(){const t=Qc(i,s),n=yield this.rtcSignaling(e,$s[$s.rtcPing],!0,t);if(!n.isOk)return n.wipe();const r=Uc.decode(ic,n.data);return gi(r)}))}get deviceId(){return this._ctx.appStorage.deviceId}setPushConfig(e){this._ctx.appStorage.setCustomDeviceId(e.deviceId),this._ctx.appStorage.setPackageName(e.packageName)}destroy(){t(void 0,void 0,void 0,(function*(){if(!F_)return;W_&&(clearTimeout(W_),W_=null);const e=yield F_;if(e){const{db:t}=e;K_.push(t)}F_=null}))}setNetwork(e,t){this._ctx.handleNetworkChange(e,t)}setCallInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Va,{key:i,dataContent:s}),n=yield this._ctx.query($s.reqCall,e,t,Va);return n.isOk?n.trans((e=>({key:e.key,value:e.dataContent}))):n.wipe()}))}setNotificationQuietHoursWithSetting(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(bl,e);return(yield this._ctx.query($s.addUnpush,this.currentUserId,t)).wipe()}))}removeNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){const e=Uc.encode(Ll,{nothing:0});return(yield this._ctx.query($s.delUnpush,this.currentUserId,e)).wipe()}))}getNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){const e=Uc.encode(Ul,{nothing:0});return(yield this._ctx.query($s.qryUnpush,this.currentUserId,e,Pl)).trans((({isUnpush:e,spanMinutes:t,startTime:i,level:s,timezone:n})=>e?{spanMinutes:t,startTime:i,level:s,timezone:n}:{spanMinutes:0,startTime:"",level:ye.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT}))}))}getStatsUrlList(){return t(this,void 0,void 0,(function*(){return gi(Hi.getStatsUrlList(this.naviInfo))}))}translateWithParams(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=0===n?e[0].identifier:this.currentUserId,r=this.userSettings.storage.get("value").transLan,o=[],a=[];let l;if(e.forEach((e=>{const{sourceLanguage:t,content:i}=e,s=e.targetLanguage||r;t!==s?i?o.push({messageUID:e.identifier,sourceLan:e.sourceLanguage,targetLan:e.targetLanguage||r,text:e.content,inputSource:n,transType:1}):a.push({identifier:e.identifier,from:n,code:D.TRANSLATION_TEXT_INVALID,translateInfo:{targetLanguage:s,translatedText:"",status:Cs.NONE}}):a.push({identifier:e.identifier,from:n,code:D.TRANSLATION_LANGUAGE_SAME,translateInfo:{targetLanguage:s,translatedText:"",status:Cs.NONE}})})),0===o.length)l=gi();else{const e=Uc.encode(wl,{businessType:3,businessInfo:Uc.encode(xl,{forceTrans:s,transInfos:o,model:i})});l=(yield this._ctx.query($s.upConvertMsg,t,e,Vl)).wipe()}return a.length>0&&setTimeout((()=>this._watcher.translateResponse(a)),0),l}))}getSubscribeUsersOnlineStatus(e){return t(this,void 0,void 0,(function*(){if(!this._subscribeManager)return gi([]);const t=[],s=new Set;this._subscribeManager.getSubscribeUserStatus(oe.ONLINE_STATUS,e).forEach((e=>{const{userId:i,details:n=[]}=e,r=n.map((e=>({platform:e.platform,isOnline:!!e.eventValue,updateTime:e.changeTime}))),o=r.some((e=>e.isOnline)),a={userId:i,isOnline:o,details:r};t.push(a),s.add(i)}));const n=e.filter((e=>!s.has(e)));if(0===n.length)return gi(t);const r=yield i(this,KT,"m",rf).call(this,oe.FRIEND_ONLINE_STATUS,n);return r.isOk?(r.data.list.forEach((e=>{const{subUserId:i,data:s}=e,n=s.map((e=>({platform:e.platformInfo,isOnline:!!e.value,updateTime:e.versionTime}))),r=n.some((e=>e.isOnline));var o;t.push((o={userId:i,isOnline:r,details:n},[re.iOS,re.Android,re.Web,re.PC,re.Mini,re.HarmonyOS].forEach((e=>{o.details.some((t=>t.platform===e))||o.details.push({platform:e,isOnline:!1,updateTime:0})})),o))})),gi(t)):r.wipe()}))}getAllRobots(){return t(this,void 0,void 0,(function*(){return this._ctx.getAllRobots(!1)}))}getMessagesByUIds(e,i){return t(this,void 0,void 0,(function*(){const{targetId:t,conversationType:s,channelId:n}=e,r=Uc.encode(Ua,{targetId:t,type:s,query:i.map((e=>({msgTime:0,msgUID:e,busChannel:n})))}),o=yield this._ctx.query($s.qryMsg,this._ctx.currentUserId,r,Pa);if(!o.isOk)return o.wipe();const{list:a,notExistMsgId:l}=o.data,c=this.currentUserId,_=i.map((e=>{const i=a.findIndex((t=>t.msgId===e));if(-1!==i){const e=a.splice(i,1)[0];return{message:y_(e,c,!1,t),messageUId:e.msgId,code:D.SUCCESS}}return l.includes(e)?{messageUId:e,code:D.RC_DB_DATA_NOT_FOUND}:{messageUId:e,code:D.SERVER_DATA_ERROR}}));return gi(_)}))}}var df;KT=new WeakSet,QT=function(e,t,i,s,n){this._watcher.robotsSynced(t,s)},XT=function(e,t){this._watcher.readReceiptResponseV5(t)},zT=function(e,t){this._watcher.speechToTextResponse(t)},ZT=function(e,t){this._watcher.messagesModified(t)},$T=function(e){this._watcher.messageModifiedSyncCompleted()},ef=function(e,t){this._watcher.ultraGroupMessageExpansionUpdated(t)},tf=function(e,t){this._watcher.ultraGroupMessageRecalled(t)},sf=function(e,t,i){t!==LE?t!==PE?this._handleEventChangeList(this._codec.formatEventChangeList(i)):this._handleConvertEvent(i):i.forEach((e=>{Uc.decode(Ml,new Uint8Array(e.eventData)).statusInfo.forEach((e=>{var t,i;const s=Jt(e);null===(i=(t=this._watcher).groupApplicationEvent)||void 0===i||i.call(t,s)}))}))},nf=function(e){const t={},{extraProfile:i}=e;return i&&(delete e.extraProfile,t.userExtProfile=Vg(i)),t.userProfile=Vg(e),t},rf=function(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode($a,{subType:e,subUsers:i.map((e=>({subUserId:e})))});return yield this._ctx.query($s.qrySubData,this.currentUserId,t,za)}))};class uf{constructor(e){df.set(this,void 0),s(this,df,e,"f")}get isSpeechToTextEnabled(){return!!(1&(i(this,df,"f").AIBusinessSub||0))}get isConversationListIncludeUltraGroup(){return jI(i(this,df,"f"))}get messageModifiableMinutes(){return i(this,df,"f").msgModifyMinute||0}get readReceiptVersion(){return e=(e=i(this,df,"f").grpRRVer)||0,Object.values(Ue).includes(e)?e:Ue.UNKNOWN;var e}get isServerSaveUnreadEnabled(){return 1===i(this,df,"f").serverSaveUnread}get messageSizeLimit(){return i(this,df,"f").msgMaxLengthV2||0}}df=new WeakMap;class hf{constructor(e){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.ctx=e,this.logger=e.logger}get validateConnected(){return()=>this.checkAuthed(!1)}get validateLogin(){return()=>this.checkAuthed(!0)}checkAuthed(e){return this.ctx.connectionStatus===ce.CONNECTED||this.ctx.userId&&e?gi(this.ctx.naviInfo):Ei(D.RC_NET_UNAVAILABLE)}}class gf extends hf{constructor(e,t){super(e),Object.defineProperty(this,"svr",{enumerable:!0,configurable:!0,writable:!0,value:t})}joinChatroom(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:i,extra:n,createIfNotExist:s}),t);const o=yield Ii.create("joinChatroom").validate("chatroomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isNumber("count",i,!0).fail(D.INVALID_PARAMETER_COUNT).isString("extra",n).fail(D.INVALID_PARAMETER_EXTRA).result().tryTrans(this.validateConnected).next((()=>{const t=Math.max(Math.min(i,50),-1)||10;return this.svr.joinChatroom(e,t,s,n)}));return this.logger.summary(r.A_JOIN_CHATROOM_R,o,t),o}))}quitChatroom(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_QUIT_CHATROOM_T,JSON.stringify({roomId:e}),t);const s=yield Ii.create("quitChatroom").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isString("extra",i).fail(D.INVALID_PARAMETER_EXTRA).result().tryTrans(this.validateConnected).next((()=>this.svr.quitChatroom(e,i)));return this.logger.summary(r.A_QUIT_CHATROOM_R,s,t),s}))}getChatroomInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CHATROOM_INFO_T,JSON.stringify({roomId:e,count:i,order:s}),t);const n=yield Ii.create("getChatroomInfo").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isLimitedInteger("count",i,0,20).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("order",s,0,2).fail(D.INVALID_PARAMETER_ORDER).result().tryTrans(this.validateConnected).next((()=>this.svr.getChatroomInfo(e,i||0,s||1)));return this.logger.summary(r.A_GET_CHATROOM_INFO_R,n,t),n}))}setChatroomEntry(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_CHATROOM_ENTRY_T,JSON.stringify({roomId:e,entry:i,isForce:s}),t);const n=yield Ii.create("setChatroomEntry").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("key",null==i?void 0:i.key,$t,!0).fail(D.INVALID_PARAMETER_KEY).validate("value",null==i?void 0:i.value,ei,!0).fail(D.INVALID_PARAMETER_VALUE).isLimitedString("notificationExtra",null==i?void 0:i.notificationExtra,0,2048).fail(D.INVALID_PARAMETER_NOTIFICATION_EXTRA).isBoolean("isAutoDelete",null==i?void 0:i.isAutoDelete).fail(D.INVALID_PARAMETER_IS_AUTO_DELETE).isBoolean("isSendNotification",null==i?void 0:i.isSendNotification).fail(D.INVALID_PARAMETER_IS_SEND_NOTIFICATION).result().tryTrans(this.validateConnected).next((()=>this.svr.setChatroomEntry(e,i,s)));return this.logger.summary(r.A_SET_CHATROOM_ENTRY_R,n,t),n}))}setChatroomEntries(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_CHATROOM_ENTRIES_T,JSON.stringify({roomId:e,entryOptions:i}),t);const s=yield Ii.create("setChatroomEntries").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isTypedArray("entries",null==i?void 0:i.entries,(e=>$t(null==e?void 0:e.key)&&ei(null==e?void 0:e.value)),!0).fail(D.INVALID_PARAMETER_ENTRIES).isLimitedArray("entryOptions.entries",null==i?void 0:i.entries,10,!0).fail(D.CHATROOM_KV_STORE_OUT_LIMIT).isBoolean("entryOptions.isForce",null==i?void 0:i.isForce).fail(D.INVALID_PARAMETER_IS_FORCE).isBoolean("entryOptions.isAutoDelete",null==i?void 0:i.isAutoDelete).fail(D.INVALID_PARAMETER_IS_AUTO_DELETE).result().tryTrans(this.validateConnected).next((()=>this.svr.setChatroomEntries(e,i)));return this.logger.summary(r.A_SET_CHATROOM_ENTRIES_R,s,t),s}))}removeChatroomEntry(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_CHATROOM_ENTRY_T,JSON.stringify({roomId:e,entry:i,isForce:s}),t);const n=yield Ii.create("removeChatroomEntry").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("entry.key",null==i?void 0:i.key,$t,!0).fail(D.INVALID_PARAMETER_KEY).isBoolean("entry.isSendNotification",null==i?void 0:i.isSendNotification).fail(D.INVALID_PARAMETER_IS_SEND_NOTIFICATION).isLimitedString("entry.notificationExtra",null==i?void 0:i.notificationExtra,0,2048).fail(D.INVALID_PARAMETER_NOTIFICATION_EXTRA).result().tryTrans(this.validateConnected).next((()=>this.svr.removeChatroomEntry(e,i,s)));return this.logger.summary(r.A_REMOVE_CHATROOM_ENTRY_R,n,t),n}))}removeChatroomEntries(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_CHATROOM_ENTRIES_T,JSON.stringify({roomId:e,entryOptions:i}),t);const s=yield Ii.create("removeChatroomEntries").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isLimitedTypedArray("keys",null==i?void 0:i.keys,10,$t,!0).fail(D.INVALID_PARAMETER_KEYS).isLimitedString("notificationExtra",null==i?void 0:i.notificationExtra,0,2048).fail(D.INVALID_PARAMETER_NOTIFICATION_EXTRA).result().tryTrans(this.validateConnected).next((()=>this.svr.removeChatroomEntries(e,i)));return this.logger.summary(r.A_REMOVE_CHATROOM_ENTRIES_R,s,t),s}))}getChatroomEntry(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CHATROOM_ENTRY_T,JSON.stringify({roomId:e,key:i}),t);const s=yield Ii.create("getChatroomEntry").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("key",i,$t,!0).fail(D.INVALID_PARAMETER_KEY).result().tryTrans(this.validateConnected).next((()=>this.svr.getChatroomEntry(e,i)));return this.logger.summary(r.A_GET_CHATROOM_ENTRY_R,s,t),s}))}getAllChatroomEntries(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CHATROOM_ENTRIES_T,JSON.stringify({roomId:e}),t);const i=yield Ii.create("getAllChatroomEntries").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).result().tryTrans(this.validateConnected).next((()=>this.svr.getAllChatroomEntries(e)));return this.logger.summary(r.A_GET_CHATROOM_ENTRIES_R,i,t),i}))}getChatroomHistoryMessages(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CHATROOM_HISTORY_MESSAGES_T,JSON.stringify({roomId:e,count:i,order:s,timestamp:n}),t);const o=yield Ii.create("getChatroomHistoryMessages").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isLimitedInteger("count",i,1,100).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("order",s,0,1).fail(D.INVALID_PARAMETER_ORDER).isTimestamp("timestamp",n).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((()=>this.svr.getChatroomHistoryMessages(e,n||0,i||20,s||0)));return this.logger.summary(r.A_GET_CHATROOM_HISTORY_MESSAGES_R,o,t,void 0,(({list:e})=>({size:e.length}))),o}))}setCheckChatRoomDuplicateMessage(e){return this.svr.setCheckChatRoomDuplicateMessage(e)}bindRTCRoomForChatroom(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BIND_RTC_FOR_CHATROOM_T,JSON.stringify({option:e}),t);const i=yield Ii.create("bindRTCRoomForChatroom").validate("chatRoomId",null==e?void 0:e.chatRoomId,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("rtcRoomId",null==e?void 0:e.rtcRoomId,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).result().tryTrans(this.validateConnected).next((()=>this.svr.bindRTCRoomForChatroom(e)));return this.logger.summary(r.A_BIND_RTC_FOR_CHATROOM_R,i,t),i}))}}const Ef=e=>{const{groupId:t,groupName:i,portraitUri:s,introduction:n,notice:r,extProfile:o,joinPermission:a,removeMemberPermission:l,invitePermission:c,inviteHandlePermission:_,groupInfoEditPermission:d,memberInfoEditPermission:u}=e;return JSON.parse(JSON.stringify({name:i,portraitUrl:s,introduction:n,announcement:r,joinPerm:a,removePerm:l,memInvitePerm:c,invitePerm:_,profilePerm:d,memProfilePerm:u}))},If=e=>{var t,i,s;return{removeMuteStatus:!(null!==(t=null==e?void 0:e.removeMuteStatus)&&void 0!==t&&!t),removeWhiteList:!(null!==(i=null==e?void 0:e.removeWhiteList)&&void 0!==i&&!i),removeFollow:!(null!==(s=null==e?void 0:e.removeFollow)&&void 0!==s&&!s)}},Tf=(e,t,i)=>e.validate("groupId",null==t?void 0:t.groupId,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedString("groupName",null==t?void 0:t.groupName,1,64,i).fail(D.INVALID_PARAMETER_GROUP_NAME).isString("portraitUri",null==t?void 0:t.portraitUri).isString("introduction",null==t?void 0:t.introduction).isString("notice",null==t?void 0:t.notice).validate("extProfile",null==t?void 0:t.extProfile,(e=>{if(!St(e))return!1;const t=Object.entries(e);return t.length<=10&&t.every((([e,t])=>Et(t)))})).isNumberEnum("joinPermission",null==t?void 0:t.joinPermission,g).isNumberEnum("removeMemberPermission",null==t?void 0:t.removeMemberPermission,E).isNumberEnum("invitePermission",null==t?void 0:t.invitePermission,E).isNumberEnum("inviteHandlePermission",null==t?void 0:t.inviteHandlePermission,T).isNumberEnum("groupInfoEditPermission",null==t?void 0:t.groupInfoEditPermission,E).isNumberEnum("memberInfoEditPermission",null==t?void 0:t.memberInfoEditPermission,I).fail(D.INVALID_PARAMETER_GROUP_INFO),ff=(e,t,i,s,n)=>e.isObject("option",s,n).fail(D.INVALID_PARAMETER_PAGING_QUERY_OPTION).isLimitedInteger("count",null==s?void 0:s.count,1,t,i).fail(D.INVALID_PARAMETER_COUNT).isString("pageToken",null==s?void 0:s.pageToken).fail(D.INVALID_PARAMETER_PAGING_QUERY_OPTION).isBoolean("order",null==s?void 0:s.order).fail(D.INVALID_PARAMETER_ORDER);class Rf extends hf{constructor(e,t){super(e),Object.defineProperty(this,"svr",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_userProfileEnabled",{enumerable:!0,configurable:!0,writable:!0,value:()=>{var e;return 1===(null===(e=this.ctx.naviInfo)||void 0===e?void 0:e.userProfile)?gi():Ei(D.RC_USER_PROFILE_SERVICE_UNAVAILABLE)}})}updateMyUserProfileVisibility(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UPDATE_MY_USER_PROFILE_VISIBILITY_T,e,t);const i=yield Ii.create("updateMyUserProfileVisibility").isNumberEnum("visibility",e,le,!0).fail(D.INVALID_PARAMETER_USER_PROFILE_VISIBILITY).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.updateMyUserProfileVisibility(e)));return this.logger.summary(r.A_UPDATE_MY_USER_PROFILE_VISIBILITY_R,i,t),i}))}getMyUserProfileVisibility(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_MY_USER_PROFILE_VISIBILITY_T,"",e);const t=yield this.validateConnected().tryTrans(this._userProfileEnabled).next((()=>this.svr.getMyUserProfileVisibility()));return this.logger.summary(r.A_GET_MY_USER_PROFILE_VISIBILITY_R,t,e),t}))}searchUserProfileByUniqueId(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEARCH_USER_PROFILE_BY_UNIQUE_ID_T,e,t);const i=yield Ii.create("searchUserProfileByUniqueId").isNotEmptyString("uniqueId",e,!0).fail(D.INVALID_PARAMETER_UNIQUE_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.searchUserProfileByUniqueId(e)));return this.logger.summary(r.A_SEARCH_USER_PROFILE_BY_UNIQUE_ID_R,i,t),i}))}addFriend(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_FRIEND_T,JSON.stringify({userId:e,directionType:i,extra:s}),t);const n=yield Ii.create("addFriend").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isNumberEnum("directionType",i,o,!0).fail(D.INVALID_PARAMETER_DIRECTION_TYPE).isLimitedString("extra",s,0,128).fail(D.INVALID_PARAMETER_EXTRA).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.addFriend(e,i,s||"")));return this.svr.addFriend(e,i,s||""),this.logger.summary(r.A_ADD_FRIEND_R,n,t),n}))}deleteFriends(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DELETE_FRIENDS_T,JSON.stringify({userIds:e,directionType:i}),t);const s=yield Ii.create("deleteFriends").isLimitedTypedArray("userIds",e,100,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).isNumberEnum("directionType",i,o,!0).fail(D.INVALID_PARAMETER_DIRECTION_TYPE).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.deleteFriends(e,i)));return this.logger.summary(r.A_DELETE_FRIENDS_R,s,t),s}))}acceptFriendRequest(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ACCEPT_FRIEND_REQUEST_T,e,t);const i=yield Ii.create("acceptFriendRequest").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.acceptFriendRequest(e)));return this.logger.summary(r.A_ACCEPT_FRIEND_REQUEST_R,i,t),i}))}refuseFriendRequest(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REFUSE_FRIEND_REQUEST_T,JSON.stringify({userId:e,reason:i}),t);const s=yield Ii.create("refuseFriendApplication").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isString("reason",i).fail(D.INVALID_PARAMETER_REASON).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.refuseFriendRequest(e,i)));return this.logger.summary(r.A_REFUSE_FRIEND_REQUEST_R,s,t),s}))}setFriendInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_FRIEND_INFO_T,JSON.stringify({userId:e,remark:i,extProfile:s}),t);const n=yield Ii.create("setFriendInfo").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isLimitedString("remark",i,0,64,!0).fail(D.INVALID_PARAMETER_REMARK).validate("extProfile",s,(e=>{if("object"!=typeof s)return!1;const t=Object.entries(s);return!(t.length>10||t.some((([e,t])=>!Et(t))))})).fail(D.INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setFriendInfo(e,i,s||{})));return this.logger.summary(r.A_SET_FRIEND_INFO_R,n,t),n}))}checkFriends(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CHECK_FRIENDS_T,JSON.stringify({userIds:e,directionType:i}),t);const s=yield Ii.create("checkFriends").isLimitedTypedArray("userIds",e,20,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).isNumberEnum("directionType",i,o,!0).fail(D.INVALID_PARAMETER_DIRECTION_TYPE).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.checkFriends(e,i)));return this.logger.summary(r.A_CHECK_FRIENDS_R,s,t,void 0,(e=>({size:e.length}))),s}))}getFriends(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_FRIENDS_T,JSON.stringify({directionType:e,option:i}),t);const s=yield Ii.create("getFriends").isNumberEnum("directionType",e,a,!0).fail(D.INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE).check((e=>ff(e,100,!1,i))).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t={count:(null==i?void 0:i.count)||50,pageToken:(null==i?void 0:i.pageToken)||"",order:!!(null==i?void 0:i.order)};return this.svr.getFriends(e,t)}));return this.logger.summary(r.A_GET_FRIENDS_R,s,t,void 0,(({data:e})=>({size:e.length}))),s}))}getFriendApplications(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_FRIEND_APPLICATIONS_T,JSON.stringify({option:e,types:i,status:s}),t);const n=yield Ii.create("getFriendApplications").check((t=>ff(t,100,!1,e))).check((e=>{e.isTypedArray("types",i,(t=>!e.isNumberEnum("type",t,_,!0).isFailed)).fail(D.INVALID_PARAMETER_FRIEND_APPLICATION_TYPE).isTypedArray("status",s,(t=>!e.isNumberEnum("status",t,d,!0).isFailed)).fail(D.INVALID_PARAMETER_FRIEND_APPLICATION_STATUS)})).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t={count:(null==e?void 0:e.count)||50,pageToken:(null==e?void 0:e.pageToken)||"",order:!!(null==e?void 0:e.order)},n=i&&0!==i.length?i:[1,2],r=s&&0!==s.length?s:[0,1,2,3];return this.svr.getFriendApplications(t,n,r)}));return this.logger.summary(r.A_GET_FRIEND_APPLICATIONS_R,n,t,void 0,(({data:e})=>({size:e.length}))),n}))}getFriendsInfo(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_FRIENDS_INFO_T,JSON.stringify({userIds:e}),t);const i=yield Ii.create("getFriendsInfo").isLimitedTypedArray("userIds",e,100,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getFriendsInfo(e)));return this.logger.summary(r.A_GET_FRIENDS_INFO_R,i,t,void 0,(e=>({size:e.length}))),i}))}searchFriendsInfo(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEARCH_FRIENDS_INFO_T,JSON.stringify({nickname:e}),t);const i=yield Ii.create("searchFriendsInfo").isLimitedString("nickname",e,1,64,!0).fail(D.INVALID_PARAMETER_NICK_NAME).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.searchFriendsInfo(e)));return this.logger.summary(r.A_SEARCH_FRIENDS_INFO_R,i,t,void 0,(e=>({size:e.length}))),i}))}setFriendAddPermission(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_FRIEND_ADD_PERMISSION_T,JSON.stringify({permission:e}),t);const i=yield Ii.create("setFriendAddPermission").isNumberEnum("permission",e,l,!0).fail(D.INVALID_PARAMETER_FRIEND_ADD_PERMISSION).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setFriendAddPermission(e)));return this.logger.summary(r.A_SET_FRIEND_ADD_PERMISSION_R,i,t),i}))}getFriendAddPermission(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_FRIEND_ADD_PERMISSION_T,JSON.stringify({}),e);const t=yield Ii.create("getFriendAddPermission").result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getFriendAddPermission()));return this.logger.summary(r.A_GET_FRIEND_ADD_PERMISSION_R,t,e),t}))}createGroup(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CREATE_GROUP_T,JSON.stringify({groupInfo:e,inviteeUserIds:i}),t);const s=yield Ii.create("createGroup").check((t=>Tf(t,e,!0))).isLimitedTypedArray("inviteeUserIds",i,30,Ut,!1,0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t=Ef(e);return this.svr.createGroup(e.groupId,t,e.extProfile||{},i||[])}));return this.logger.summary(r.A_CREATE_GROUP_R,s,t),s}))}updateGroupInfo(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UPDATE_GROUP_INFO_T,JSON.stringify({groupInfo:e}),t);const i=yield Ii.create("updateGroupInfo").check((t=>Tf(t,e,!1))).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t=Ef(e);return this.svr.updateGroupInfo(e.groupId,t,e.extProfile)}));return this.logger.summary(r.A_UPDATE_GROUP_INFO_R,i,t),i}))}getGroupsInfo(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_GROUPS_INFO_T,JSON.stringify({groupIds:e}),t);const i=yield Ii.create("getGroupsInfo").isLimitedTypedArray("groupIds",e,20,Pt,!0,1).fail(D.INVALID_PARAMETER_GROUP_IDS).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getGroupsInfo(e)));return this.logger.summary(r.A_GET_GROUPS_INFO_R,i,t,void 0,(e=>({size:e.length}))),i}))}kickGroupMembers(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_KICK_GROUP_MEMBERS_T,JSON.stringify({groupId:e,userIds:i,config:s}),t);const n=yield Ii.create("kickGroupMembers").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,100,Ut,!0,1).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.kickGroupMembers(e,i,If(s))));return this.logger.summary(r.A_KICK_GROUP_MEMBERS_R,n,t),n}))}quitGroup(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_QUIT_GROUP_T,JSON.stringify({groupId:e,config:i}),t);const s=yield Ii.create("quitGroup").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.quitGroup(e,If(i))));return this.logger.summary(r.A_QUIT_GROUP_R,s,t),s}))}dismissGroup(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DISMISS_GROUP_T,JSON.stringify({groupId:e}),t);const i=yield Ii.create("dismissGroup").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.dismissGroup(e)));return this.logger.summary(r.A_DISMISS_GROUP_R,i,t),i}))}transferGroupOwner(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_TRANSFER_GROUP_OWNER_T,JSON.stringify({groupId:e,newOwnerId:i,quit:s,config:n}),t);const o=yield Ii.create("transferGroupOwner").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("newOwnerId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.transferGroupOwner(e,i,!!s,If(n))));return this.logger.summary(r.A_TRANSFER_GROUP_OWNER_R,o,t),o}))}addGroupManagers(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_GROUP_MANAGERS_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("addGroupManagers").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,10,Ut,!0,1).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupManagers(p.ADD,e,i)));return this.logger.summary(r.A_ADD_GROUP_MANAGERS_R,s,t),s}))}removeGroupManagers(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_GROUP_MANAGERS_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("removeGroupManagers").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,10,Ut,!0,1).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupManagers(p.REMOVE,e,i)));return this.logger.summary(r.A_REMOVE_GROUP_MANAGERS_R,s,t),s}))}getGroupMembers(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_GROUP_MEMBERS_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("getGroupMembers").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,100,Ut,!0,1).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getGroupMembers(e,i)));return this.logger.summary(r.A_GET_GROUP_MEMBERS_R,s,t,void 0,(e=>({size:e.length}))),s}))}setGroupMemberInfo(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_GROUP_MEMBER_INFO_T,JSON.stringify({groupId:e,userId:i,nickname:s,extra:n}),t);const o=yield Ii.create("setGroupMemberInfo").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("userId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isLimitedString("nickname",s,0,64,!0).fail(D.INVALID_PARAMETER_NICK_NAME).isLimitedString("extra",n,0,128).fail(D.INVALID_PARAMETER_EXTRA).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupMemberInfo(e,i,s,n)));return this.logger.summary(r.A_SET_GROUP_MEMBER_INFO_R,o,t),o}))}searchGroupMembers(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEARCH_GROUP_MEMBERS_T,JSON.stringify({groupId:e,nickName:i,option:s}),t);const n=yield Ii.create("searchGroupMembers").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedString("nickName",i,1,64,!0).fail(D.INVALID_PARAMETER_NICK_NAME).check((e=>ff(e,200,!0,s,!0))).result().tryTrans(this.validateLogin).tryTrans(this._userProfileEnabled).next((()=>{const t={count:s.count,pageToken:s.pageToken||"",order:!!s.order};return this.svr.searchGroupMembers(e,i,t)}));return this.logger.summary(r.A_SEARCH_GROUP_MEMBERS_R,n,t,void 0,(({data:e})=>({size:e.length}))),n}))}getGroupMembersByRole(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_GROUP_MEMBERS_BY_ROLE_T,JSON.stringify({groupId:e,role:i,option:s}),t);const n=yield Ii.create("getGroupMembersByRole").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isNumberEnum("role",i,f,!0).fail(D.INVALID_PARAMETER_GROUP_MEMBER_ROLE).isLimitedInteger("count",s.count,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).isString("pageToken",s.pageToken).fail(D.INVALID_PARAMETER_PAGING_QUERY_OPTION).isNumberEnum("filterRobotType",s.filterRobotType,Ce).fail(D.INVALID_PARAMETER_PAGING_QUERY_OPTION).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t={count:s.count,pageToken:s.pageToken||"",order:!!s.order,filterRobotType:s.filterRobotType||Ce.ALL};return this.svr.getGroupMembersByRole(e,i,t)}));return this.logger.summary(r.A_GET_GROUP_MEMBERS_BY_ROLE_R,n,t,void 0,(({data:e})=>({size:e.length}))),n}))}addGroupFollows(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_GROUP_FOLLOWS_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("addGroupFollows").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,100,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupFollows(p.ADD,e,i)));return this.logger.summary(r.A_ADD_GROUP_FOLLOWS_R,s,t),s}))}removeGroupFollows(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_GROUP_FOLLOWS_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("removeGroupFollows").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,100,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupFollows(p.REMOVE,e,i)));return this.logger.summary(r.A_REMOVE_GROUP_FOLLOWS_R,s,t),s}))}getGroupFollows(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_GROUP_FOLLOWS_T,JSON.stringify({groupId:e}),t);const i=yield Ii.create("getGroupFollows").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getGroupFollows(e)));return this.logger.summary(r.A_GET_GROUP_FOLLOWS_R,i,t,void 0,(e=>({size:e.length}))),i}))}setGroupRemark(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_GROUP_REMARK_T,JSON.stringify({groupId:e,remark:i}),t);const s=yield Ii.create("setGroupRemark").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedString("remark",i,0,64,!0).fail(D.INVALID_PARAMETER_REMARK).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupRemark(e,i)));return this.logger.summary(r.A_SET_GROUP_REMARK_R,s,t),s}))}joinGroup(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_JOIN_GROUP_T,JSON.stringify({groupId:e}),t);const i=yield Ii.create("joinGroup").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.joinGroup(e)));return this.logger.summary(r.A_JOIN_GROUP_R,i,t),i}))}inviteUsersToGroup(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_INVITE_USERS_TO_GROUP_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("inviteUsersToGroup").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,30,Ut,!0,1).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.inviteUsersToGroup(e,i)));return this.logger.summary(r.A_INVITE_USERS_TO_GROUP_R,s,t),s}))}acceptGroupInvite(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ACCEPT_GROUP_INVITE_T,JSON.stringify({groupId:e,inviterId:i}),t);const s=yield Ii.create("acceptGroupInvite").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("inviterId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.memberInviteResponse({groupId:e,inviterId:i,optType:v.APPLICANT,optResult:S.ACCEPT})));return this.logger.summary(r.A_ACCEPT_GROUP_INVITE_R,s,t),s.wipe()}))}refuseGroupInvite(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REFUSE_GROUP_INVITE_T,JSON.stringify({groupId:e,inviterId:i,reason:s}),t);const n=yield Ii.create("refuseGroupInvite").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("inviterId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isLimitedString("reason",s,0,128).fail(D.INVALID_PARAMETER_REASON).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.memberInviteResponse({groupId:e,inviterId:i,optType:v.APPLICANT,optResult:S.REFUSE,reason:s})));return this.logger.summary(r.A_REFUSE_GROUP_INVITE_R,n,t),n.wipe()}))}acceptGroupApplication(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ACCEPT_GROUP_APPLICATION_T,JSON.stringify({groupId:e,joinUserId:i,inviterId:s}),t);const n=yield Ii.create("acceptGroupApplication").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("joinUserId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).validate("inviterId",s,Ut).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.memberInviteResponse({groupId:e,joinUserId:i,inviterId:s||"",optType:v.MANAGER,optResult:S.ACCEPT})));return this.logger.summary(r.A_ACCEPT_GROUP_APPLICATION_R,n,t),n.wipe()}))}refuseGroupApplication(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REFUSE_GROUP_APPLICATION_T,JSON.stringify({groupId:e,joinUserId:i,inviterId:s,reason:n}),t);const o=yield Ii.create("refuseGroupApplication").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("joinUserId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).validate("inviterId",s,Ut).fail(D.INVALID_PARAMETER_USER_ID).isLimitedString("reason",n,0,128).fail(D.INVALID_PARAMETER_REASON).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.memberInviteResponse({groupId:e,joinUserId:i,inviterId:s||"",optType:v.MANAGER,optResult:S.REFUSE,reason:n})));return this.logger.summary(r.A_REFUSE_GROUP_APPLICATION_R,o,t),o.wipe()}))}getGroupApplications(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_GROUP_APPLICATIONS_T,JSON.stringify({option:e,directions:i,status:s}),t);const{usingCppEngine:n}=this.ctx,o=yield Ii.create("getGroupApplications").check((t=>ff(t,200,!0,e,!0))).check((e=>{n&&e.isLimitedTypedArray("directions",i,Object.keys(y).length,(t=>!e.isNumberEnum("directions",t,y,!0).isFailed),!0,1).fail(D.INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION).isLimitedTypedArray("status",s,Object.keys(m).length,(t=>!e.isNumberEnum("status",t,m,!0).isFailed),!0,1).fail(D.INVALID_PARAMETER_GROUP_APPLICATION_STATUS)})).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t={count:e.count,pageToken:e.pageToken||"",order:!!e.order};return this.svr.getGroupApplications(t,i||[],s||[])}));return this.logger.summary(r.A_GET_GROUP_APPLICATIONS_R,o,t,void 0,(({data:e})=>({size:e.length}))),o}))}getJoinedGroupsByRole(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_JOINED_GROUPS_BY_ROLES_T,JSON.stringify({role:e,option:i}),t);const s=yield Ii.create("getJoinedGroupsByRole").isNumberEnum("role",e,f,!0).fail(D.INVALID_PARAMETER_GROUP_MEMBER_ROLE).check((e=>ff(e,100,!0,i,!0))).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t={count:i.count,pageToken:i.pageToken||"",order:!!i.order};return this.svr.getJoinedGroupsByRole(e,t)}));return this.logger.summary(r.A_GET_JOINED_GROUPS_BY_ROLES_R,s,t,void 0,(({data:e})=>({size:e.length}))),s}))}searchJoinedGroups(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEARCH_JOINED_GROUPS_T,JSON.stringify({groupName:e,option:i}),t);const s=yield Ii.create("searchJoinedGroups").isLimitedString("groupName",e,1,64,!0).fail(D.INVALID_PARAMETER_GROUP_NAME).check((e=>ff(e,200,!0,i,!0))).result().tryTrans(this.validateLogin).tryTrans(this._userProfileEnabled).next((()=>{const t={count:i.count,pageToken:i.pageToken||"",order:!!i.order};return this.svr.searchJoinedGroups(e,t)}));return this.logger.summary(r.A_SEARCH_JOINED_GROUPS_R,s,t,void 0,(({data:e})=>({size:e.length}))),s}))}getJoinedGroups(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_JOINED_GROUPS_T,JSON.stringify({groupIds:e}),t);const i=yield Ii.create("getJoinedGroups").isLimitedTypedArray("groupIds",e,20,Pt,!0,1).fail(D.INVALID_PARAMETER_GROUP_IDS).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getJoinedGroups(e)));return this.logger.summary(r.A_GET_JOINED_GROUPS_R,i,t,void 0,(e=>({size:e.length}))),i}))}}var Af,pf,mf,Sf;let vf=0;class Nf extends hf{constructor(e,t,i){super(i),Object.defineProperty(this,"_svr",{enumerable:!0,configurable:!0,writable:!0,value:t}),Af.set(this,void 0),pf.set(this,!1),mf.set(this,!0),Sf.set(this,""),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:++vf}),s(this,Af,Object.assign(Object.assign({},e),{tagFilter:Object.assign({},e.tagFilter)}),"f")}get hasMore(){return i(this,mf,"f")}get isLoading(){return i(this,pf,"f")}load(e){return t(this,void 0,void 0,(function*(){if(i(this,pf,"f"))return Ei(D.METHOD_BUSY);s(this,pf,!0,"f");const t=this.logger.createTraceId();this.logger.info(r.A_LOAD_CONVERSATION_LIST_T,JSON.stringify({count:e,loaderId:this._id,pageToken:i(this,Sf,"f")}),t);const n=yield Ii.create("ConversationListLoader.load").isLimitedInteger("count",e,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).next((()=>this._svr.loadConversationList(i(this,Sf,"f"),e,i(this,Af,"f"))));if(this.logger.summary(r.A_LOAD_CONVERSATION_LIST_R,n,t,{loaderId:this._id},(({pageToken:e,finished:t,list:i})=>({pageToken:e,finished:t,size:i.length}))),s(this,pf,!1,"f"),!n.isOk)return n.wipe();const{pageToken:o,finished:a,list:l}=n.data;return s(this,Sf,o,"f"),s(this,mf,!a,"f"),gi(l)}))}}var Of,yf,Cf,Mf,bf,Lf,Uf,Pf;Af=new WeakMap,pf=new WeakMap,mf=new WeakMap,Sf=new WeakMap;class Df extends hf{constructor(e,t){super(e),Of.add(this),Object.defineProperty(this,"svr",{enumerable:!0,configurable:!0,writable:!0,value:t})}saveEditedMessageDraft(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SAVE_EDITED_MSG_DRAFT_T,JSON.stringify({draft:e,identifier:s}),t);const n=yield Ii.create("saveEditedMessageDraft").check((e=>f_(e,s,B))).isString("draft",null==e?void 0:e.content,!0).fail(D.INVALID_PARAMETER_DRAFT).isNotEmptyString("messageUId",null==e?void 0:e.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().tryTrans(this.validateLogin).next((()=>this.svr.saveEditedMessageDraft(e,i(this,Of,"m",Cf).call(this,s))));return this.logger.summary(r.A_SAVE_EDITED_MSG_DRAFT_R,n,t),n}))}getEditedMessageDraft(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_EDITED_MSG_DRAFT_T,JSON.stringify({identifier:e}),t);const s=yield Ii.create("getEditedMessageDraft").check((t=>f_(t,e,B))).result().next((()=>this.svr.getEditedMessageDraft(i(this,Of,"m",Cf).call(this,e))));return this.logger.summary(r.A_GET_EDITED_MSG_DRAFT_R,s,t),s}))}clearEditedMessageDraft(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CLEAR_EDITED_MSG_DRAFT_T,JSON.stringify({identifier:e}),t);const s=yield Ii.create("clearEditedMessageDraft").check((t=>f_(t,e,B))).result().next((()=>this.svr.clearEditedMessageDraft(i(this,Of,"m",Cf).call(this,e))));return this.logger.summary(r.A_CLEAR_EDITED_MSG_DRAFT_R,s,t),s}))}createConversationListLoader(e){return t(this,void 0,void 0,(function*(){const{conversationTypes:t,order:i,channelId:s,tagFilter:n}=e||{};return yield Ii.create("createConversationListLoader").isTypedArray("conversationTypes",t,(e=>W(e,G))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).isLimitedInteger("order",i,0,1).fail(D.INVALID_PARAMETER_ORDER).validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).check((e=>{if(!n)return;const{tagIds:t}=n;e.isLimitedTypedArray("tagIds",t,20,pt,!1,0).fail(D.INVALID_PARAMETER_TAG_ID)})).result().tryTrans(this.validateConnected).trans((()=>new Nf(Object.assign(Object.assign({},e),{tagFilter:Object.assign({},n)}),this.svr,this.ctx)))}))}sendUltraGroupTypingStatus(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),s=null==e?void 0:e.conversationType;this.logger.info(r.A_SEND_UG_TYPING_T,JSON.stringify(e),t);const n=yield Ii.create("sendUltraGroupTypingStatus").check((t=>f_(t,e,F))).validate("conversationType",s,(()=>s===w.ULTRA_GROUP),!0).fail(D.CONVERSATION_TYPE_NOT_SUPPORT).result().tryTrans(this.validateConnected).next((()=>this.svr.sendUltraGroupTypingStatus(i(this,Of,"m",Cf).call(this,e))));return this.logger.summary(r.A_SEND_UG_TYPING_R,n,t),n}))}sendTypingStatus(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEND_TYPING_STATUS_T,JSON.stringify({identifier:e,typingContentType:i}),t);const s=yield Ii.create("sendTypingStatus").check((t=>f_(t,e,G))).isString("typingContentType",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).result().tryTrans(this.validateConnected).next((()=>{const s={messageType:"RC:TypSts",content:{typingContentType:i}};return this.ctx.sendMessage(e,s,t)}));return this.logger.summary(r.A_SEND_TYPING_STATUS_R,s,t),s}))}sendSyncReadStatusMessage(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_SYNC_READ_STATUS_T,JSON.stringify({identifier:e,timestamp:i}),s);const n=yield Ii.create("sendSyncReadStatusMessage").check((t=>f_(t,e,G))).isNumber("timestamp",i,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((n=>t(this,void 0,void 0,(function*(){if(n.serverSaveUnread)return Ei(D.SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN);if(1===n.sesDriven)return this.svr.updateConversationReadTime(e,i);const t={messageType:Q.SYNC_READ_STATUS,content:{lastMessageSendTime:i},directionalUserIdList:oi(e.conversationType,[this.ctx.userId])};return(yield this.ctx.sendMessage(e,t,s)).wipe()}))));return this.logger.summary(r.A_SYNC_READ_STATUS_R,n,s),n}))}clearUnreadCount(e){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_CLEAR_UNREAD_COUNT_T,JSON.stringify(e),s);const n=yield Ii.create("clearUnreadCount").check((t=>f_(t,e,F))).result().tryTrans((()=>this.checkAuthed(e.conversationType!==w.ULTRA_GROUP))).tryTrans((e=>e.serverSaveUnread?Ei(D.SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN):gi())).next((()=>t(this,void 0,void 0,(function*(){return e.conversationType!==w.ULTRA_GROUP||this.svr.ugSynced?this.svr.clearConversationUnreadCount(i(this,Of,"m",Cf).call(this,e)):Ei(D.METHOD_NOT_AVAILABLE)}))));return this.logger.summary(r.A_CLEAR_UNREAD_COUNT_R,n,s),n}))}clearAllUnreadCount(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_CLEAR_ALL_UNREAD_COUNT_T,null,e);const i=yield Ii.create("clearAllUnreadCount").result().tryTrans(this.validateLogin).tryTrans((e=>e.serverSaveUnread?Ei(D.SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN):gi())).next((()=>t(this,void 0,void 0,(function*(){return this.svr.clearAllSGUnreadCount()}))));return this.logger.summary(r.A_CLEAR_ALL_UNREAD_COUNT_R,i,e),i}))}clearUnreadCountByTimestamp(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CLEAR_UNREAD_COUNT_BY_TIME_T,JSON.stringify({identifier:e,timestamp:i}),t);const s=yield Ii.create("clearUnreadCountByTimestamp").check((t=>f_(t,e,G))).isTimestamp("timestamp",i).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateLogin).tryTrans((e=>e.serverSaveUnread?Ei(D.SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN):gi())).next((()=>this.svr.clearUnreadCountByTimestamp(e,i)));return this.logger.summary(r.A_CLEAR_UNREAD_COUNT_BY_TIME_R,s,t),s}))}sendReadReceiptRequest(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEND_READ_RECEIPT_REQ_T,JSON.stringify({identifier:e,messageUId:i}),t);const s=yield Ii.create("sendReadReceiptRequest").check((t=>f_(t,e,H))).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().tryTrans(this.validateConnected).next((()=>{const s={messageType:Q.READ_RECEIPT_REQUEST,content:{messageUId:i}};return this.ctx.sendMessage(e,s,t)}));return this.logger.summary(r.A_SEND_READ_RECEIPT_REQ_R,s,t),s.wipe()}))}sendReadReceiptMessage(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEND_READ_RECEIPT_T,JSON.stringify({identifier:e,messageUId:i,timestamp:s}),t);const n=yield Ii.create("sendReadReceiptMessage").check((t=>f_(t,e,j))).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("timestamp",s,1,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((()=>{const n={messageType:Q.READ_RECEIPT,content:{messageUId:i,lastMessageSendTime:s,type:1}};return this.ctx.sendMessage(e,n,t)}));return this.logger.summary(r.A_SEND_READ_RECEIPT_R,n,t),n.wipe()}))}sendReadReceipt(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_SEND_READ_RECEIPT_T,JSON.stringify({identifier:e,messageList:i}),s);const n=yield Ii.create("sendReadReceipt").check((t=>f_(t,e,H))).fail(D.INVALID_PARAMETER_TARGET_ID).check((e=>{St(i)&&!Object.keys(i).some((t=>{const s=i[t];return e.isLimitedTypedArray("messageList",s,Number.MAX_SAFE_INTEGER,pt,!0).isFailed}))||e.setFailed(D.MSG_LIMIT_ERROR)})).result().tryTrans(this.validateConnected).next((n=>t(this,void 0,void 0,(function*(){const t=n.grpRRVer||0;if(0!==t&&1!==t)return Ei(D.READ_RECEIPT_ERROR);if(1===t){const t=[];return Object.keys(i).forEach((e=>{t.push(...i[e])})),this.svr.sendReadReceiptV2(e.targetId,t,e.channelId)}const r={receiptMessageDic:i};return(yield this.ctx.sendMessage(e,{messageType:Q.READ_RECEIPT_RESPONSE,content:r},s)).wipe()}))));return this.logger.summary(r.A_SEND_READ_RECEIPT_R,n,s),n}))}getMessageReader(e,i,s){return t(this,void 0,void 0,(function*(){const n=this.logger.createTraceId();this.logger.info(r.A_GET_MSG_READER_T,JSON.stringify({targetId:e,messageUId:i,channelId:s}),n);const o=yield Ii.create("getMessageReader").validate("targetId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateConnected).next((n=>t(this,void 0,void 0,(function*(){return 1!==n.grpRRVer?Ei(D.READ_RECEIPT_ERROR):this.svr.getMessageReader(e,i,s||"")}))));return this.logger.summary(r.A_GET_MSG_READER_R,o,n,void 0,(({list:e})=>({size:e.length}))),o}))}sendReadReceiptMessageV4(e,i,s){return t(this,void 0,void 0,(function*(){const n=this.logger.createTraceId();this.logger.info(r.A_SEND_READ_RECEIPT_V4_T,JSON.stringify({conversation:e,endMsgUid:i,startMsgUid:s}),n);const o=yield Ii.create("sendReadReceiptMessageV4").check((t=>f_(t,e,G))).isNotEmptyString("endMsgUid",i,!0).fail(D.INVALID_PARAMETER_END_MESSAGE_UID).isNotEmptyString("startMsgUid",s).fail(D.INVALID_PARAMETER_START_MESSAGE_UID).result().tryTrans(this.validateConnected).next((n=>t(this,void 0,void 0,(function*(){return 3!==n.grpRRVer?Ei(D.READ_RECEIPT_V4_NOT_SUPPORT):this.svr.sendReadReceiptMessageV4(e,s||"",i)}))));return this.logger.summary(r.A_SEND_READ_RECEIPT_V4_R,o,n),o}))}getMessageReadReceiptV4(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_GET_READ_RECEIPT_V4_T,JSON.stringify({conversation:e,messageUId:i}),s);const n=yield Ii.create("getMessageReadReceiptV4").check((t=>f_(t,e,H))).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().tryTrans(this.validateConnected).next((s=>t(this,void 0,void 0,(function*(){return 3!==s.grpRRVer?Ei(D.READ_RECEIPT_V4_NOT_SUPPORT):this.svr.getMessageReadReceiptV4(e,i)}))));return this.logger.summary(r.A_GET_READ_RECEIPT_V4_R,n,s,void 0,(({list:e})=>({size:e.length}))),n}))}batchGetMessageReadReceiptInfoV4(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_BATCH_GET_READ_RECEIPT_INFO_V4_T,JSON.stringify({conversation:e,messageUIds:i}),s);const n=yield Ii.create("batchGetMessageReadReceiptInfoV4").check((t=>f_(t,e,H))).isTypedArray("messageUIds",i,pt,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().tryTrans(this.validateConnected).next((s=>t(this,void 0,void 0,(function*(){return 3!==s.grpRRVer?Ei(D.READ_RECEIPT_V4_NOT_SUPPORT):this.svr.batchGetMessageReadReceiptInfoV4(e,i)}))));return this.logger.summary(r.A_BATCH_GET_READ_RECEIPT_INFO_V4_R,n,s,void 0,(e=>({size:e.length}))),n}))}getConversationsIncludingRobots(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CONVERSATIONS_INCLUDING_ROBOTS_T,JSON.stringify({options:e}),t);const i=yield Ii.create("getConversationsIncludingRobots").isLimitedTypedArray("conversationTypes",null==e?void 0:e.conversationTypes,2,(e=>[w.PRIVATE,w.SYSTEM].includes(e)),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).isLimitedInteger("count",null==e?void 0:e.count,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).isTimestamp("timestamp",null==e?void 0:e.timestamp,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((()=>{const t=Object.assign(Object.assign({},e),{topPriority:!!e.topPriority});return this.svr.getConversationsIncludingRobots(t)}));return this.logger.summary(r.A_GET_CONVERSATIONS_INCLUDING_ROBOTS_R,i,t,void 0,(e=>({size:e.length}))),i}))}markRemoteConversationAsRead(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_MARK_REMOTE_CONVERSATION_AS_READ_T,JSON.stringify(e),t);const s=yield Ii.create("markRemoteConversationAsRead").check((t=>f_(t,e,k))).result().tryTrans(this.validateConnected).tryTrans((e=>e.serverSaveUnread?gi():Ei(D.SERVER_RECORD_UNREAD_COUNT_DISABLED))).next((()=>{if(e.conversationType===w.ULTRA_GROUP)return this.svr.clearConversationUnreadCount(i(this,Of,"m",Cf).call(this,e));const s={lastMessageSendTime:this.ctx.serverTime},n={messageType:Q.SYNC_READ_STATUS,content:s,directionalUserIdList:oi(e.conversationType,[this.ctx.userId])};return this.svr.markRemoteConversationAsRead(e,n,t)}));return this.logger.summary(r.A_MARK_REMOTE_CONVERSATION_AS_READ_R,s,t),s.wipe()}))}addMessageReaction(s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_MSG_REACTION_T,JSON.stringify(s),t);const n=yield Ii.create("addMessageReaction").check((e=>f_(e,null==s?void 0:s.conversationIdentifier,B))).isNotEmptyString("messageUId",null==s?void 0:s.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedString("reactionId",null==s?void 0:s.reactionId,1,16,!0).fail(D.REACTION_ID_INVALID).isObject("pushConfig",null==s?void 0:s.pushConfig).fail(D.INVALID_PARAMETER_PUSH_CONFIG).result().tryTrans(this.validateConnected).next((()=>{const{conversationIdentifier:t}=s,n=e(s,["conversationIdentifier"]);return this.svr.addMessageReaction(Object.assign(Object.assign({},n),{conversationIdentifier:i(this,Of,"m",Cf).call(this,t)}))}));return this.logger.summary(r.A_ADD_MSG_REACTION_R,n,t),n}))}removeMessageReaction(s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_MSG_REACTION_T,JSON.stringify(s),t);const n=yield Ii.create("removeMessageReaction").check((e=>f_(e,null==s?void 0:s.conversationIdentifier,B))).isNotEmptyString("messageUId",null==s?void 0:s.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedString("reactionId",null==s?void 0:s.reactionId,1,16,!0).fail(D.REACTION_ID_INVALID).isObject("pushConfig",null==s?void 0:s.pushConfig).fail(D.INVALID_PARAMETER_PUSH_CONFIG).result().tryTrans(this.validateConnected).next((()=>{const{conversationIdentifier:t}=s,n=e(s,["conversationIdentifier"]);return this.svr.removeMessageReaction(Object.assign(Object.assign({},n),{conversationIdentifier:i(this,Of,"m",Cf).call(this,t)}))}));return this.logger.summary(r.A_REMOVE_MSG_REACTION_R,n,t),n}))}batchGetMessageReactionSummaries(s){var n;return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_GET_MSG_REACTION_SUMMARIES_T,JSON.stringify(s),t);const o=yield Ii.create("batchGetMessageReactionSummaries").check((e=>f_(e,null==s?void 0:s.conversationIdentifier,B))).isTypedArray("messageUIds",null==s?void 0:s.messageUIds,(e=>pt(e)),!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("messageUIds",null===(n=null==s?void 0:s.messageUIds)||void 0===n?void 0:n.length,1,100,!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateConnected).next((()=>{const{conversationIdentifier:t}=s,n=e(s,["conversationIdentifier"]);return this.svr.batchGetMessageReactionSummaries(Object.assign({conversationIdentifier:i(this,Of,"m",Cf).call(this,t)},n))}));return this.logger.summary(r.A_BATCH_GET_MSG_REACTION_SUMMARIES_R,o,t),o}))}getMessageReactions(s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_MSG_REACTIONS_T,JSON.stringify(s),t);const n=yield Ii.create("getMessageReactions").check((e=>f_(e,null==s?void 0:s.conversationIdentifier,B))).isNotEmptyString("messageUId",null==s?void 0:s.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("count",null==s?void 0:s.count,1,50,!0).fail(D.INVALID_PARAMETER_COUNT).isString("pageToken",null==s?void 0:s.pageToken).fail(D.INVALID_PARAMETER_PAGE_TOKEN).result().tryTrans(this.validateConnected).next((()=>{const{conversationIdentifier:t}=s,n=e(s,["conversationIdentifier"]);return this.svr.getMessageReactions(Object.assign({conversationIdentifier:i(this,Of,"m",Cf).call(this,t)},n))}));return this.logger.summary(r.A_GET_MSG_REACTIONS_R,n,t,void 0,(({reactions:e})=>({size:e.length}))),n}))}getMessageReactionUsers(s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_MSG_REACTION_USERS_T,JSON.stringify(s),t);const n=yield Ii.create("getMessageReactionUsers").check((e=>f_(e,null==s?void 0:s.conversationIdentifier,B))).isNotEmptyString("messageUId",null==s?void 0:s.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedString("reactionId",null==s?void 0:s.reactionId,1,16,!0).fail(D.REACTION_ID_INVALID).isLimitedInteger("count",null==s?void 0:s.count,1,50,!0).fail(D.INVALID_PARAMETER_COUNT).isString("pageToken",null==s?void 0:s.pageToken).fail(D.INVALID_PARAMETER_PAGE_TOKEN).result().tryTrans(this.validateConnected).next((()=>{const{conversationIdentifier:t}=s,n=e(s,["conversationIdentifier"]);return this.svr.getMessageReactionUsers(Object.assign({conversationIdentifier:i(this,Of,"m",Cf).call(this,t)},n))}));return this.logger.summary(r.A_GET_MSG_REACTION_USERS_R,n,t,void 0,(({users:e})=>({size:e.length}))),n}))}}Of=new WeakSet,yf=function(e){var t;return!!(2&((null===(t=this.ctx.naviInfo)||void 0===t?void 0:t.ugDriven)||0))&&!e?"RCDefault":e},Cf=function(e){return e.conversationType!==w.ULTRA_GROUP?e:Object.assign(Object.assign({},e),{channelId:i(this,Of,"m",yf).call(this,e.channelId)})};class wf extends Wi{constructor(e,i,s,n){const r=os();r.setLogReader(((e,i,s,n)=>t(this,void 0,void 0,(function*(){return{logs:[]}})))),r.setLogWriter((e=>{n(e)})),super(e,i,s,r)}getTimestamp4RealtimeLog(){return 0}setTimestamp4RealtimeLog(e){}}let Gf=0,Vf=Date.now();const kf=e=>{const t=Date.now();return Vf!==t&&(Vf=t,Gf=0),[e,window.__RCCppContextBridge__.process.pid,t,Gf++].join("__")},xf=()=>t(void 0,void 0,void 0,(function*(){return Ei(D.NOT_SUPPORT,"Not support")}));class Ff{constructor(e,t){var i;Mf.add(this),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_cache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),bf.set(this,void 0),Lf.set(this,void 0),Uf.set(this,!1),Object.defineProperty(this,"_resolveMaps",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"loadConversationList",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"batchGetMessageReadReceiptInfoV4",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"getRealtimeConversations",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"getRealtimeConTotalUnreadCount",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"clearRealtimeConUnreadCount",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"removeRealtimeConversations",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"batchGetRealtimeConUnreadCount",{enumerable:!0,configurable:!0,writable:!0,value:xf});const n=t,o=e=>this._send2Main("onReceiveRendererLog",e),a=s(this,Lf,new wf(n.appkey,"IMLib","IM",o),"f");s(this,bf,o,"f"),a.setOutputLevel(n.logOutputLevel);const{ipcRenderer:l}=window.__RCCppContextBridge__;l.on("__RC_CHANNEL_NOTIFICATION_FROM_MAIN__",((t,i,...n)=>{const o=e[i];if(o){switch(i){case"ultraGroupEnable":s(this,Uf,!0,"f");break;case"onNaviDataChange":this._cache.naviInfo=n[0];break;case"onRTCDataChange":n[0]=new Uint8Array(n[0]);break;case"onConnected":s(this,Uf,!1,"f"),this._cache=n[1];break;case"onSuspend":s(this,Uf,!1,"f"),this._setConnectionStatus(ce.SUSPENDED);break;case"onDisconnected":s(this,Uf,!1,"f"),this._setConnectionStatus(ce.DISCONNECTED);break;case"onConnecting":this._setConnectionStatus(ce.CONNECTING)}o(...n)}else this.logger.error(r.L_UNSUPPORT_NTF_FROM_MAIN_E,i)})),l.on("__RC_CHANNEL_RESULT_FROM_MAIN__",((e,t,...i)=>{const s=this._resolveMaps[t];s&&(delete this._resolveMaps[t],s(...i))})),n.httpInMainProcess&&(Eo.httpReq=this.sendHTTPRequest.bind(this));const c={navigators:n.navigators,areaCode:n.areaCode,logServerUrl:n.logServerUrl,environment:n.environment,enableReadReceiptStorage:n.enableReadReceiptStorage,useNaviV2:null!==(i=n.useNaviV2)&&void 0!==i&&i,commitId:"38f2b6b488580bc24bb1fddd69df5e25adfcf61c"};if(l.send("__RC_INNER_COMMAND_INIT__",c),this._cache=this._callMainSync("getMainProcessCache"),"38f2b6b488580bc24bb1fddd69df5e25adfcf61c"!==this._cache.commitId)throw new Error("SDK version mismatch.")}get chat(){return this}get chatroom(){return this}get userSettings(){return this}get dataHosting(){return this}get logger(){return i(this,Lf,"f")}get ugSynced(){return i(this,Uf,"f")}_setConnectionStatus(e){this._cache.connectionStatus=e,e===ce.DISCONNECTED&&(this._cache.crtUserId="")}sendHTTPRequest(e){return this._callMain("sendHTTPRequest",e)}_callMain(e,...t){const{ipcRenderer:i}=window.__RCCppContextBridge__;return new Promise((s=>{const n=kf(e);this._resolveMaps[n]=s,i.send("__RC_CHANNEL_CALL_MAIN__",n,e,...t)}))}_send2Main(e,...t){window.__RCCppContextBridge__.ipcRenderer.send("__RC_CHANNEL_SEND_2_MAIN__",e,...t)}_callMainSync(e,...t){return window.__RCCppContextBridge__.ipcRenderer.sendSync("__RC_CHANNEL_CALL_MAIN_SYNC__",e,...t)}refetchNaviInfo(){return i(this,Mf,"m",Pf).call(this,"refetchNaviInfo")}get naviInfo(){return this._cache.naviInfo}createLogger(e,t){return new wf(this.appkey,e,t,i(this,bf,"f"))}get connectionStatus(){return this._cache.connectionStatus}get usingCppEngine(){return!0}connect(e,s,n,r){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"connect",e,s,n,r)}))}reportSDKInfo(e){this._send2Main("reportSDKInfo",e)}get connectedTime(){return this._cache.connectedTime}getHistoryMessage(e,t,s){return i(this,Mf,"m",Pf).call(this,"getHistoryMessage",e,t,s)}getContinuousMessages(e,t){return i(this,Mf,"m",Pf).call(this,"getContinuousMessages",e,t)}getHistoryMessagesByObjectNames(e,t){return i(this,Mf,"m",Pf).call(this,"getHistoryMessagesByObjectNames",e,t)}deleteRemoteMessage(e,t){return i(this,Mf,"m",Pf).call(this,"deleteRemoteMessage",e,t)}recallMsg(e,t){return i(this,Mf,"m",Pf).call(this,"recallMsg",e,t)}deleteRemoteMessageByTimestamp(e,t){return i(this,Mf,"m",Pf).call(this,"deleteRemoteMessageByTimestamp",e,t)}getTopConversationList(e,t,s){return i(this,Mf,"m",Pf).call(this,"getTopConversationList",e,t,s)}getUnreadConversationList(e,t){return i(this,Mf,"m",Pf).call(this,"getUnreadConversationList",e,t)}getAllConversationList(e,t){return i(this,Mf,"m",Pf).call(this,"getAllConversationList",e,t)}getConversationListByTimestamp(e,t){return i(this,Mf,"m",Pf).call(this,"getConversationListByTimestamp",e,t)}getUntaggedConversationListByPage(e,t,s){return i(this,Mf,"m",Pf).call(this,"getUntaggedConversationListByPage",e,t,s)}getConversation(e){return i(this,Mf,"m",Pf).call(this,"getConversation",e)}batchDeleteConversations(e){return i(this,Mf,"m",Pf).call(this,"batchDeleteConversations",e)}getTotalUnreadCount(e,t,s){return i(this,Mf,"m",Pf).call(this,"getTotalUnreadCount",e,t,s)}getConversationUnreadCount(e){return i(this,Mf,"m",Pf).call(this,"getConversationUnreadCount",e)}getTotalUnreadCountByLevels(e,t,s){return i(this,Mf,"m",Pf).call(this,"getTotalUnreadCountByLevels",e,t,s)}clearConversationUnreadCount(e){return i(this,Mf,"m",Pf).call(this,"clearConversationUnreadCount",e)}markRemoteConversationAsRead(e,t,s){return i(this,Mf,"m",Pf).call(this,"markRemoteConversationAsRead",e,t,s)}getFirstUnreadMessage(e){return i(this,Mf,"m",Pf).call(this,"getFirstUnreadMessage",e)}getFirstUnreadMessageDigest(e){return i(this,Mf,"m",Pf).call(this,"getFirstUnreadMessageDigest",e)}saveTextMessageDraft(e,t){return i(this,Mf,"m",Pf).call(this,"saveTextMessageDraft",e,t)}getTextMessageDraft(e){return i(this,Mf,"m",Pf).call(this,"getTextMessageDraft",e)}clearTextMessageDraft(e){return i(this,Mf,"m",Pf).call(this,"clearTextMessageDraft",e)}batchSetConversationToTop(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"batchSetConversationToTop",e,t,s,n)}batchSetConversationNotificationLevel(e,t){return i(this,Mf,"m",Pf).call(this,"batchSetConversationNotificationLevel",e,t)}batchSetConversationTranslateStrategy(e,t){return i(this,Mf,"m",Pf).call(this,"batchSetConversationTranslateStrategy",e,t)}sendMessage(e,t,s,n){const o=["sendMessageBefore",Date.now(),Math.floor(Math.random()*Date.now())].join("_");return n&&(this._resolveMaps[o]=e=>{try{n(e)}catch(e){this.logger.error(r.L_CALLBACK_E,JSON.stringify({error:null==e?void 0:e.stack,pos:"sendMsgBefore"}))}}),i(this,Mf,"m",Pf).call(this,"sendMessage",e,t,s,o)}sendReadReceiptV2(e,t,s){return i(this,Mf,"m",Pf).call(this,"sendReadReceiptV2",e,t,s)}getMessageReader(e,t,s){return i(this,Mf,"m",Pf).call(this,"getMessageReader",e,t,s)}sendReadReceiptMessageV4(e,t,s){return i(this,Mf,"m",Pf).call(this,"sendReadReceiptMessageV4",e,t,s)}getMessageReadReceiptV4(e,t){return i(this,Mf,"m",Pf).call(this,"getMessageReadReceiptV4",e,t)}updateConversationReadTime(e,t){return i(this,Mf,"m",Pf).call(this,"updateConversationReadTime",e,t)}disconnect(e,s){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"disconnect",e,s)}))}registerMessageType(e,t){this._send2Main("registerMessageType",e,t)}joinChatroom(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"joinChatroom",e,t,s,n)}quitChatroom(e,t){return i(this,Mf,"m",Pf).call(this,"quitChatroom",e,t)}getChatroomInfo(e,t,s){return i(this,Mf,"m",Pf).call(this,"getChatroomInfo",e,t,s)}getChatroomHistoryMessages(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"getChatroomHistoryMessages",e,t,s,n)}setChatroomEntry(e,t,s){return i(this,Mf,"m",Pf).call(this,"setChatroomEntry",e,t,s)}setChatroomEntries(e,t){return i(this,Mf,"m",Pf).call(this,"setChatroomEntries",e,t)}removeChatroomEntry(e,t,s){return i(this,Mf,"m",Pf).call(this,"removeChatroomEntry",e,t,s)}removeChatroomEntries(e,t){return i(this,Mf,"m",Pf).call(this,"removeChatroomEntries",e,t)}getChatroomEntry(e,t){return i(this,Mf,"m",Pf).call(this,"getChatroomEntry",e,t)}getAllChatroomEntries(e){return i(this,Mf,"m",Pf).call(this,"getAllChatroomEntries",e)}getFileToken(e,t,s,n,r,o){return i(this,Mf,"m",Pf).call(this,"getFileToken",e,t,s,n,r,o)}getFileUrl(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"getFileUrl",e,t,s,n)}setUserStatus(e){return i(this,Mf,"m",Pf).call(this,"setUserStatus",e)}getUserStatus(e){return i(this,Mf,"m",Pf).call(this,"getUserStatus",e)}clearConversations(e,t){return i(this,Mf,"m",Pf).call(this,"clearConversations",e,t)}addToBlacklist(e){return i(this,Mf,"m",Pf).call(this,"addToBlacklist",e)}removeFromBlacklist(e){return i(this,Mf,"m",Pf).call(this,"removeFromBlacklist",e)}getBlacklist(){return i(this,Mf,"m",Pf).call(this,"getBlacklist")}getBlacklistStatus(e){return i(this,Mf,"m",Pf).call(this,"getBlacklistStatus",e)}insertMessage(e,t){return i(this,Mf,"m",Pf).call(this,"insertMessage",e,t)}batchInsertMessage(e,t){return i(this,Mf,"m",Pf).call(this,"batchInsertMessage",e,t)}getLocalMessageCount(e){return i(this,Mf,"m",Pf).call(this,"getLocalMessageCount",e)}deleteLocalMessages(e){return i(this,Mf,"m",Pf).call(this,"deleteLocalMessages",e)}deleteLocalMessagesByTimestamp(e,t,s){return i(this,Mf,"m",Pf).call(this,"deleteLocalMessagesByTimestamp",e,t,s)}batchClearLocalMessagesByTimestamp(e){return i(this,Mf,"m",Pf).call(this,"batchClearLocalMessagesByTimestamp",e)}batchClearRemoteHistoryMessages(e,t){return i(this,Mf,"m",Pf).call(this,"batchClearRemoteHistoryMessages",e,t)}clearLocalMessages(e){return i(this,Mf,"m",Pf).call(this,"clearLocalMessages",e)}getMessage(e){return i(this,Mf,"m",Pf).call(this,"getMessage",e)}setMessageContent(e,t,s){return i(this,Mf,"m",Pf).call(this,"setMessageContent",e,t,s)}setMessageSearchField(e,t,s){return i(this,Mf,"m",Pf).call(this,"setMessageSearchField",e,t,s)}searchConversationByContent(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"searchConversationByContent",e,t,s,n)}searchConversationByContentWithAllChannel(e,t,s){return i(this,Mf,"m",Pf).call(this,"searchConversationByContentWithAllChannel",e,t,s)}searchMessagesWithParams(e){return i(this,Mf,"m",Pf).call(this,"searchMessagesWithParams",e)}getUnreadMentionedMessages(e){return i(this,Mf,"m",Pf).call(this,"getUnreadMentionedMessages",e)}getUnreadMentionedCount(e){return i(this,Mf,"m",Pf).call(this,"getUnreadMentionedCount",e)}getMessagesAroundTimestamp(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"getMessagesAroundTimestamp",e,t,s,n)}setMessageSentStatus(e,t){return i(this,Mf,"m",Pf).call(this,"setMessageSentStatus",e,t)}setMessageReceivedStatus(e,t){return i(this,Mf,"m",Pf).call(this,"setMessageReceivedStatus",e,t)}updateMessageReceiptStatus(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"updateMessageReceiptStatus",e,t,s,n)}clearUnreadCountByTimestamp(e,t){return i(this,Mf,"m",Pf).call(this,"clearUnreadCountByTimestamp",e,t)}clearAllSGUnreadCount(){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"clearAllSGUnreadCount")}))}get serverTime(){return Date.now()-this._cache.deltaTime}get deviceId(){return this._cache.deviceId}setPushConfig(e){}get userId(){return this._cache.crtUserId}bindRTCRoomForChatroom(e){return i(this,Mf,"m",Pf).call(this,"bindRTCRoomForChatroom",e)}rtcSignaling(e,s,n,r){return t(this,void 0,void 0,(function*(){const t=Array.prototype.slice.call(new Uint8Array(r));return(yield i(this,Mf,"m",Pf).call(this,"rtcSignaling",e,s,n,t)).trans((e=>new Uint8Array(e)))}))}rtcPing(e,t,s){return i(this,Mf,"m",Pf).call(this,"rtcPing",e,t,s)}createTag(e){return i(this,Mf,"m",Pf).call(this,"createTag",e)}removeTag(e){return i(this,Mf,"m",Pf).call(this,"removeTag",e)}updateTag(e){return i(this,Mf,"m",Pf).call(this,"updateTag",e)}getTagList(){return i(this,Mf,"m",Pf).call(this,"getTagList")}addTagForConversations(e,t){return i(this,Mf,"m",Pf).call(this,"addTagForConversations",e,t)}removeTagForConversations(e,t){return i(this,Mf,"m",Pf).call(this,"removeTagForConversations",e,t)}removeTagsForConversation(e,t){return i(this,Mf,"m",Pf).call(this,"removeTagsForConversation",e,t)}getConversationListByTag(e,t,s){return i(this,Mf,"m",Pf).call(this,"getConversationListByTag",e,t,s)}getUnreadCountByTag(e,t){return i(this,Mf,"m",Pf).call(this,"getUnreadCountByTag",e,t)}setConversationStatusInTag(e,t,s){return i(this,Mf,"m",Pf).call(this,"setConversationStatusInTag",e,t,s)}getTagsForConversation(e){return i(this,Mf,"m",Pf).call(this,"getTagsForConversation",e)}clearLocalData(){return i(this,Mf,"m",Pf).call(this,"clearLocalData")}setCallInfo(e,t,s){return i(this,Mf,"m",Pf).call(this,"setCallInfo",e,t,s)}getAllUnreadMentionedCount(){return i(this,Mf,"m",Pf).call(this,"getAllUnreadMentionedCount")}getUltraGroupList(e){return i(this,Mf,"m",Pf).call(this,"getUltraGroupList",e)}getBlockedUGList(){return i(this,Mf,"m",Pf).call(this,"getBlockedUGList")}getBlockedConversationList(e){return i(this,Mf,"m",Pf).call(this,"getBlockedConversationList",e)}sendUltraMessage(e,t,i,s){return this.sendMessage(e,t,i,s)}getConversationNotificationLevel(e){return i(this,Mf,"m",Pf).call(this,"getConversationNotificationLevel",e)}setConversationTypeNotificationLevel(e,t){return i(this,Mf,"m",Pf).call(this,"setConversationTypeNotificationLevel",e,t)}getConversationTypeNotificationLevel(e){return i(this,Mf,"m",Pf).call(this,"getConversationTypeNotificationLevel",e)}getUGUnreadCountForAllChannels(e,t,s){return i(this,Mf,"m",Pf).call(this,"getUGUnreadCountForAllChannels",e,t,s)}setUGDefaultNotificationLevel(e,t,s){return i(this,Mf,"m",Pf).call(this,"setUGDefaultNotificationLevel",e,t,s)}getUGDefaultNotificationLevel(e,t){return i(this,Mf,"m",Pf).call(this,"getUGDefaultNotificationLevel",e,t)}getUGUnreadInfoList(e){return i(this,Mf,"m",Pf).call(this,"getUGUnreadInfoList",e)}getOSInfo(){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"getOSInfo")}))}getProcessInfo(){return t(this,void 0,void 0,(function*(){const{process:e}=window.__RCCppContextBridge__,t={title:e.title,pid:e.pid,ppid:e.ppid,platform:e.platform,arch:e.arch,uptime:e.uptime(),cpuUsage:e.cpuUsage(),memoryUsage:e.memoryUsage(),resourceUsage:e.resourceUsage()};return gi(t)}))}getMainProcessInfo(){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"getMainProcessInfo")}))}setProxy(e){return i(this,Mf,"m",Pf).call(this,"setProxy",e)}getProxy(){return i(this,Mf,"m",Pf).call(this,"getProxy")}testProxy(e,t){return i(this,Mf,"m",Pf).call(this,"testProxy",e,t)}setCheckDuplicateMessage(e){return i(this,Mf,"m",Pf).call(this,"setCheckDuplicateMessage",e)}setCheckChatRoomDuplicateMessage(e){return i(this,Mf,"m",Pf).call(this,"setCheckChatRoomDuplicateMessage",e)}setNetwork(e,t){this._send2Main("setNetwork",e,t)}subscribeUser(e,t,s){return i(this,Mf,"m",Pf).call(this,"subscribeUser",e,t,s)}unSubscribeUser(e,t){return i(this,Mf,"m",Pf).call(this,"unSubscribeUser",e,t)}getSubscribeUserList(e,t,s){return i(this,Mf,"m",Pf).call(this,"getSubscribeUserList",e,t,s)}getSubscribeUserStatus(e,t){return i(this,Mf,"m",Pf).call(this,"getSubscribeUserStatus",e,t)}getConversations(e){return i(this,Mf,"m",Pf).call(this,"getConversations",e)}updateMyUserProfile(e){return i(this,Mf,"m",Pf).call(this,"updateMyUserProfile",e)}getUserProfiles(e){return i(this,Mf,"m",Pf).call(this,"getUserProfiles",e)}getMyUserProfile(){return i(this,Mf,"m",Pf).call(this,"getMyUserProfile")}updateMyUserProfileVisibility(e){return i(this,Mf,"m",Pf).call(this,"updateMyUserProfileVisibility",e)}getMyUserProfileVisibility(){return i(this,Mf,"m",Pf).call(this,"getMyUserProfileVisibility")}searchUserProfileByUniqueId(e){return i(this,Mf,"m",Pf).call(this,"searchUserProfileByUniqueId",e)}createGroup(e,s,n,r){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"createGroup",e,s,n,r)}))}updateGroupInfo(e,t,s){return i(this,Mf,"m",Pf).call(this,"updateGroupInfo",e,t,s)}getGroupsInfo(e){return i(this,Mf,"m",Pf).call(this,"getGroupsInfo",e)}kickGroupMembers(e,t,s){return i(this,Mf,"m",Pf).call(this,"kickGroupMembers",e,t,s)}quitGroup(e,t){return i(this,Mf,"m",Pf).call(this,"quitGroup",e,t)}dismissGroup(e){return i(this,Mf,"m",Pf).call(this,"dismissGroup",e)}transferGroupOwner(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"transferGroupOwner",e,t,s,n)}setGroupManagers(e,t,s){return i(this,Mf,"m",Pf).call(this,"setGroupManagers",e,t,s)}getGroupMembersByRole(e,t,s){return i(this,Mf,"m",Pf).call(this,"getGroupMembersByRole",e,t,s)}getGroupMembers(e,t){return i(this,Mf,"m",Pf).call(this,"getGroupMembers",e,t)}setGroupMemberInfo(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"setGroupMemberInfo",e,t,s,n)}searchGroupMembers(e,t,s){return i(this,Mf,"m",Pf).call(this,"searchGroupMembers",e,t,s)}joinGroup(e){return i(this,Mf,"m",Pf).call(this,"joinGroup",e)}inviteUsersToGroup(e,t){return i(this,Mf,"m",Pf).call(this,"inviteUsersToGroup",e,t)}memberInviteResponse(e){return i(this,Mf,"m",Pf).call(this,"memberInviteResponse",e)}getGroupApplications(e,t,s){return i(this,Mf,"m",Pf).call(this,"getGroupApplications",e,t,s)}getJoinedGroupsByRole(e,t){return i(this,Mf,"m",Pf).call(this,"getJoinedGroupsByRole",e,t)}searchJoinedGroups(e,t){return i(this,Mf,"m",Pf).call(this,"searchJoinedGroups",e,t)}getJoinedGroups(e){return i(this,Mf,"m",Pf).call(this,"getJoinedGroups",e)}setGroupRemark(e,t){return i(this,Mf,"m",Pf).call(this,"setGroupRemark",e,t)}setGroupFollows(e,t,s){return i(this,Mf,"m",Pf).call(this,"setGroupFollows",e,t,s)}getGroupFollows(e){return i(this,Mf,"m",Pf).call(this,"getGroupFollows",e)}addFriend(e,t,s){return i(this,Mf,"m",Pf).call(this,"addFriend",e,t,s)}deleteFriends(e,t){return i(this,Mf,"m",Pf).call(this,"deleteFriends",e,t)}acceptFriendRequest(e){return i(this,Mf,"m",Pf).call(this,"acceptFriendRequest",e)}refuseFriendRequest(e,t){return i(this,Mf,"m",Pf).call(this,"refuseFriendRequest",e,t)}setFriendInfo(e,t,s){return i(this,Mf,"m",Pf).call(this,"setFriendInfo",e,t,s)}checkFriends(e,t){return i(this,Mf,"m",Pf).call(this,"checkFriends",e,t)}getFriends(e,t){return i(this,Mf,"m",Pf).call(this,"getFriends",e,t)}getFriendApplications(e,t,s){return i(this,Mf,"m",Pf).call(this,"getFriendApplications",e,t,s)}getFriendsInfo(e){return i(this,Mf,"m",Pf).call(this,"getFriendsInfo",e)}searchFriendsInfo(e){return i(this,Mf,"m",Pf).call(this,"searchFriendsInfo",e)}setFriendAddPermission(e){return i(this,Mf,"m",Pf).call(this,"setFriendAddPermission",e)}getFriendAddPermission(){return i(this,Mf,"m",Pf).call(this,"getFriendAddPermission")}setNotificationQuietHoursWithSetting(e){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"setNotificationQuietHoursWithSetting",e)}))}removeNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"removeNotificationQuietHoursSetting")}))}getNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"getNotificationQuietHoursSetting")}))}getStatsUrlList(){return i(this,Mf,"m",Pf).call(this,"getStatsUrlList")}sendReadReceiptResponseV5(e,t){return i(this,Mf,"m",Pf).call(this,"sendReadReceiptResponseV5",e,t)}getMessageReadReceiptInfoV5ByIdentifiers(e){return i(this,Mf,"m",Pf).call(this,"getMessageReadReceiptInfoV5ByIdentifiers",e)}getMessagesReadReceiptUsersByPageV5(e,t,s){return i(this,Mf,"m",Pf).call(this,"getMessagesReadReceiptUsersByPageV5",e,t,s)}getMessagesReadReceiptByUsersV5(e,t,s){return i(this,Mf,"m",Pf).call(this,"getMessagesReadReceiptByUsersV5",e,t,s)}requestSpeechToTextForMessage(e,t){return i(this,Mf,"m",Pf).call(this,"requestSpeechToTextForMessage",e)}setMessageSpeechToTextVisible(e,t){return i(this,Mf,"m",Pf).call(this,"setMessageSpeechToTextVisible",e,t)}translateWithParams(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"translateWithParams",e,t,s,n)}setTranslationLanguage(e){return i(this,Mf,"m",Pf).call(this,"setTranslationLanguage",e)}getTranslationLanguage(){return i(this,Mf,"m",Pf).call(this,"getTranslationLanguage")}setAutoTranslateEnabled(e){return i(this,Mf,"m",Pf).call(this,"setAutoTranslateEnabled",e)}getAutoTranslateEnabled(){return i(this,Mf,"m",Pf).call(this,"getAutoTranslateEnabled")}modifyMessageWithParams(e){return i(this,Mf,"m",Pf).call(this,"modifyMessageWithParams",e)}refreshReferenceMessageWithParams(e,s,n,o){return t(this,void 0,void 0,(function*(){const t=(e,t)=>{const i=[e,Date.now(),Math.floor(Math.random()*Date.now())].join("_");return this._resolveMaps[i]=i=>{try{t(i)}catch(t){this.logger.error(r.L_CALLBACK_E,JSON.stringify({error:null==t?void 0:t.stack,pos:e}))}},i},a=t("localMessageBlock",o),l=t("remoteMessageBlock",n);return i(this,Mf,"m",Pf).call(this,"refreshReferenceMessageWithParams",e,s,l,a)}))}syncRemoteConversations(){return i(this,Mf,"m",Pf).call(this,"syncRemoteConversations")}sendUltraGroupTypingStatus(e){return i(this,Mf,"m",Pf).call(this,"sendUltraGroupTypingStatus",e)}getRemoteMessagesByUIds(e,t){return i(this,Mf,"m",Pf).call(this,"getRemoteMessagesByUIds",e,t)}getUGUnreadMentionedDigest(e){return i(this,Mf,"m",Pf).call(this,"getUGUnreadMentionedDigest",e)}deleteLocalUGMessagesForAllChannel(e,t){return i(this,Mf,"m",Pf).call(this,"deleteLocalUGMessagesForAllChannel",e,t)}updateUGMessageExpansion(e,t,s){return i(this,Mf,"m",Pf).call(this,"updateUGMessageExpansion",e,t,s)}getUGFirstUnreadMessageDigest(e){return i(this,Mf,"m",Pf).call(this,"getUGFirstUnreadMessageDigest",e)}getSubscribeUsersOnlineStatus(e){return i(this,Mf,"m",Pf).call(this,"getSubscribeUsersOnlineStatus",e)}saveEditedMessageDraft(e,t){return i(this,Mf,"m",Pf).call(this,"saveEditedMessageDraft",e,t)}getEditedMessageDraft(e){return i(this,Mf,"m",Pf).call(this,"getEditedMessageDraft",e)}clearEditedMessageDraft(e){return i(this,Mf,"m",Pf).call(this,"clearEditedMessageDraft",e)}getUnreadMentionMeConversationList(e,t){return i(this,Mf,"m",Pf).call(this,"getUnreadMentionMeConversationList",e,t)}getAllRobots(){return i(this,Mf,"m",Pf).call(this,"getAllRobots")}getConversationsIncludingRobots(e){return i(this,Mf,"m",Pf).call(this,"getConversationsIncludingRobots",e)}getMessagesByUIds(e,t){return i(this,Mf,"m",Pf).call(this,"getMessagesByUIds",e,t)}get appkey(){return this._initOptions.appkey}destroy(){}addMessageReaction(e){return i(this,Mf,"m",Pf).call(this,"addMessageReaction",e)}removeMessageReaction(e){return i(this,Mf,"m",Pf).call(this,"removeMessageReaction",e)}batchGetMessageReactionSummaries(e){return i(this,Mf,"m",Pf).call(this,"batchGetMessageReactionSummaries",e)}getMessageReactions(e){return i(this,Mf,"m",Pf).call(this,"getMessageReactions",e)}getMessageReactionUsers(e){return i(this,Mf,"m",Pf).call(this,"getMessageReactionUsers",e)}}var Bf,Hf,jf,Yf,Wf,qf,Jf,Kf,Qf;function Xf(e){return Object.assign({},e)}bf=new WeakMap,Lf=new WeakMap,Uf=new WeakMap,Mf=new WeakSet,Pf=function(e,...t){const{promise:i,resolve:s}=Ri(),n=kf(e);return this._resolveMaps[n]=({code:e,msg:t,data:i})=>{s(hi.from(e,t,i))},window.__RCCppContextBridge__.ipcRenderer.send("__RC_CHANNEL_CALL_MAIN__",n,e,...t),i};class zf{constructor(e){Bf.add(this),Object.defineProperty(this,"_token",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_pluginContextQueue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_pluginInstanseMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_engine",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chatroom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dataHosting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_versionInfo",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_typingInfo",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_compatibleMessageProccessor",{enumerable:!0,configurable:!0,writable:!0,value:{[Q.TYPING_STATUS]:this._processTypingStatusMessage.bind(this),[Q.INTERCEPT]:this._processInterceptMessage.bind(this)}}),Object.defineProperty(this,"_messageProccessor",{enumerable:!0,configurable:!0,writable:!0,value:{[Q.READ_RECEIPT]:this._processReadReceiptMessage.bind(this),[Q.READ_RECEIPT_REQUEST]:this._processReadReceiptRequestMessage.bind(this),[Q.READ_RECEIPT_RESPONSE]:this._processReadReceiptResponseMessage.bind(this)}}),Object.defineProperty(this,"_watcher",{enumerable:!0,configurable:!0,writable:!0,value:{message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connection:void 0,expansion:void 0,tag:void 0,userSettingsSynced:void 0,userSettingsChanged:void 0,conversationStatusSynced:void 0,robotsSynced:void 0,conversationTagChanged:void 0,pullFinished:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0,ultraGroupEnable:void 0,sgRelationsSynced:void 0,operateStatus:void 0,ultraGroupMessageExpansionUpdated:void 0,ultraGroupMessageRecalled:void 0,ultraGroupChannelChangeType:void 0,ultraGroupChannelUserKicked:void 0,ultraGroupChannelDelete:void 0,userGroupStatus:void 0,messageReadReceipt:void 0,syncReadStatus:void 0,subscribedUserStatusChange:void 0,subscribedRelationChange:void 0,syncSubscribedUserStatusFinished:void 0,ownUserProfileChanged:void 0,groupOperation:void 0,groupInfoChanged:void 0,groupMemberInfoChanged:void 0,groupApplicationEvent:void 0,groupRemarkChangedSync:void 0,groupFollowsChangedSync:void 0,friendAdd:void 0,friendDelete:void 0,friendApplicationStatusChanged:void 0,friendCleared:void 0,friendInfoChangedSync:void 0,databaseOpened:void 0,databaseUpgradeWillStart:void 0,databaseUpgrading:void 0,databaseUpgradeDidComplete:void 0,readReceiptResponseV5:void 0,speechToTextResponse:void 0,translateResponse:void 0,messagesModified:void 0,messageModifiedSyncCompleted:void 0,syncServerSaveUnreadCompleted:void 0,messageReaction:void 0}}),Object.defineProperty(this,"_typingInternalTimer",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"_typingExpireTime",{enumerable:!0,configurable:!0,writable:!0,value:2e3}),Object.defineProperty(this,"_typingChangedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rtcListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._options=Object.assign({},e),this.appkey=this._options.appkey,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.map((e=>e.replace(/\/$/g,"")));const t={onRTCDataChange:this._rtcDataChange.bind(this),onConnected:()=>this._onConnectionStatusChange(ce.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,ce.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,ce.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,ce.DISCONNECTED),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),conversationTag:this._conversationTagListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),userSettingsSynced:this._onUserSettingsSynced.bind(this),userSettingsChanged:this._onUserSettingsChanged.bind(this),conversationStatusSynced:this._onConversationStatusSynced.bind(this),robotsSynced:this._onRobotsSynced.bind(this),pullFinished:this._pullFinishedListener.bind(this),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),sgRelationsSynced:this._sgRelationsSyncedListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this),callInfo:this._callInfoListener.bind(this),ultraGroupChannelChangeType:this._ultraGroupChannelChangeTypeListener.bind(this),ultraGroupChannelUserKicked:this._ultraGroupChannelUserKickedListener.bind(this),ultraGroupChannelDelete:this._ultraGroupChannelDeleteListener.bind(this),onNaviDataChange:this._naviDataChange.bind(this),userGroupStatus:this._userGroupStatusListener.bind(this),messageReadReceipt:this._messageReadReceipt.bind(this),syncReadStatus:this._syncReadStatus.bind(this),subscribedUserStatusChange:this._subscribedUserStatusChange.bind(this),subscribedRelationChange:this._subscribedRelationChange.bind(this),syncSubscribedUserStatusFinished:this._syncSubscribedUserStatusFinished.bind(this),ownUserProfileChanged:this._ownUserProfileChanged.bind(this),groupOperation:this._groupOperation.bind(this),groupInfoChanged:this._groupInfoChanged.bind(this),groupMemberInfoChanged:this._groupMemberInfoChanged.bind(this),groupApplicationEvent:this._groupApplicationEvent.bind(this),groupRemarkChangedSync:this._groupRemarkChangedSync.bind(this),groupFollowsChangedSync:this._groupFollowsChangedSync.bind(this),friendAdd:this._friendAdd.bind(this),friendDelete:this._friendDelete.bind(this),friendApplicationStatusChanged:this._friendApplicationStatusChanged.bind(this),friendCleared:this._friendCleared.bind(this),friendInfoChangedSync:this._friendInfoChangedSync.bind(this),databaseOpened:this._databaseOpened.bind(this),databaseUpgradeWillStart:this._databaseUpgradeWillStart.bind(this),databaseUpgrading:this._databaseUpgrading.bind(this),databaseUpgradeDidComplete:this._databaseUpgradeDidComplete.bind(this),readReceiptResponseV5:this._readReceiptResponseV5.bind(this),speechToTextResponse:this._speechToTextResponse.bind(this),translateResponse:this._translateResponse.bind(this),messagesModified:this._messagesModified.bind(this),messageModifiedSyncCompleted:this._messageModifiedSyncCompleted.bind(this),syncServerSaveUnreadCompleted:this._syncServerSaveUnreadCompleted.bind(this),messageReaction:this._onMessageReaction.bind(this)},i=wt();this._engine=i?new Ff(t,this._options):new _f(t,this._options),this.logger=this._engine.logger,this._options.eventLoopBlockingCheck&&as.start(this.logger),this.sse=new c_(this,i),this.chatroom=new gf(this._engine,this._engine.chatroom),this.dataHosting=new Rf(this._engine,this._engine.dataHosting),this.chat=new Df(this._engine,this._engine.chat)}static init(e){if(this._context)return this._context.logger.warn(r.A_INIT_REPEAT_O),this._context;this._context=new zf(e),this._context.logger.info(r.L_INIT_O,JSON.stringify({appkey:e.appkey,navigators:e.navigators,typingExpireTime:e.typingExpireTime,runtime:Eo.tag})),this._context.logger.warn(r.L_IMSDK_VER_O,JSON.stringify({commitId:"38f2b6b488580bc24bb1fddd69df5e25adfcf61c",version:"5.44.0"}));const t=this._context._engine;return Eo.setNetworkStatusListener(t.setNetwork.bind(t)),this._context}static getContext(){return this._context}getOptions(){return this._options}static destroy(){return t(this,void 0,void 0,(function*(){this._context&&(this._context.logger.info(r.A_DESTROY_O),yield this._context._destroy(),this._context=void 0)}))}install(e,t){const i=this.logger.createTraceId();if(this.logger.info(r.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),i),this._pluginInstanseMap[e.tag])return this.logger.warn(r.L_INSTALL_PLUGIN_R,"repeat install",i),this._pluginInstanseMap[e.tag];const s="RCRTC"===e.tag?new d_(this):new __(this);let n=null;try{if(!e.verify(Eo))return null;n=e.setup(s,Eo,t)}catch(e){this.logger.error(r.L_INSTALL_PLUGIN_R,null==e?void 0:e.stack,i)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),n&&(this._pluginContextQueue.push(s),this._pluginInstanseMap[e.tag]=n),n}registerCustomSignalHandler(e,t){var i,s;null===(s=(i=this._engine).registerCustomSignalHandler)||void 0===s||s.call(i,e,t)}getAppSettings(){return this.validateLogin().trans((e=>new uf(e)))}_onConnectionStatusChange(e,t){var i,s;this.logger.warn(r.A_CONNECT_S,`status: ${e}, code: ${t}`),null===(s=(i=this._watcher).connection)||void 0===s||s.call(i,e,t),this._pluginContextQueue.forEach((i=>{var s;null===(s=i.onconnectionstatechange)||void 0===s||s.call(i,e,t)}))}_processTypingStatusMessage(e){return this._addTypingInfo(Xf(e)),!!this._watcher.typingState}_processInterceptMessage(e){const t={conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId,extra:e.content.extra};if(e.conversationType===w.ULTRA_GROUP){const{sourceType:i}=e.content;if(t.sourceType=i,(i===de.MSG_EXPANSION||i===de.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(r.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:e.message}))}}return this._MessageBlockedListener(t),!0}_processReadReceiptMessage(e){"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime,e.senderUserId)}_processReadReceiptRequestMessage(e){"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId)}_processReadReceiptResponseMessage(e){var t;const i=null===(t=e.content)||void 0===t?void 0:t.receiptMessageDic,{userId:s}=this._engine;i&&Array.isArray(i[s])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,i[s])}_messageReceiver(e,t,i){var s,n,o,a;if(!(null===(n=(s=this._compatibleMessageProccessor)[e.messageType])||void 0===n?void 0:n.call(s,e))&&!this._pluginContextQueue.some((t=>{if(!t.onmessage)return!1;try{return t.onmessage(Xf(e))}catch(e){return this.logger.error(r.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}})))return null===(a=(o=this._watcher).message)||void 0===a||a.call(o,Xf(e),t,i),e}_batchMessageReceiver(e,t,i){const s=[],n=[],o=[Q.READ_RECEIPT,Q.READ_RECEIPT_REQUEST,Q.READ_RECEIPT_RESPONSE];e.forEach((e=>{const r=this._messageReceiver(e,t,i);r&&o.includes(r.messageType)?n.push(r):r&&s.push(r)})),s.length&&this._watcher.batchMessage&&(this.logger.debug(r.L_BATCH_MESSAGE_O,s.map((e=>e.messageUId)).join(",")),this._watcher.batchMessage(s)),n.length&&n.forEach((e=>{this._messageProccessor[e.messageType]&&this._messageProccessor[e.messageType](e)}))}_chatroomInfoListener(e){var t,i;null===(i=(t=this._watcher).chatroomState)||void 0===i||i.call(t,e)}_conversationInfoListener(e){var t,i;null===(i=(t=this._watcher).conversationState)||void 0===i||i.call(t,e)}_expansionInfoListener(e){var t,i;null===(i=(t=this._watcher).expansion)||void 0===i||i.call(t,e)}_tagListener(){var e,t;null===(t=(e=this._watcher).tag)||void 0===t||t.call(e)}_onUserSettingsSynced(e){var t,i;null===(i=(t=this._watcher).userSettingsSynced)||void 0===i||i.call(t,e)}_onUserSettingsChanged(e){var t,i;null===(i=(t=this._watcher).userSettingsChanged)||void 0===i||i.call(t,e)}_onConversationStatusSynced(e){var t,i;null===(i=(t=this._watcher).conversationStatusSynced)||void 0===i||i.call(t,e)}_onRobotsSynced(e,t){var i,s;null===(s=(i=this._watcher).robotsSynced)||void 0===s||s.call(i,e,t)}_conversationTagListener(){var e,t;null===(t=(e=this._watcher).conversationTagChanged)||void 0===t||t.call(e)}_typingStatusListener(e){var t,i;null===(i=(t=this._watcher).typingState)||void 0===i||i.call(t,e)}_pullFinishedListener(){var e,t;null===(t=(e=this._watcher).pullFinished)||void 0===t||t.call(e)}_MessageBlockedListener(e){var t,i;null===(i=(t=this._watcher).messageBlocked)||void 0===i||i.call(t,e)}_callInfoListener(e){this._pluginContextQueue.forEach((t=>{try{t.onCallInfo&&t.onCallInfo(e)}catch(e){this.logger.warn(r.L_CALLBACK_E,null==e?void 0:e.stack)}}))}_ultraGroupEnableListener(){var e,t;null===(t=(e=this._watcher).ultraGroupEnable)||void 0===t||t.call(e)}_sgRelationsSyncedListener(e){var t,i;null===(i=(t=this._watcher).sgRelationsSynced)||void 0===i||i.call(t,e)}_operateStatusListener(e){var t,i;null===(i=(t=this._watcher).operateStatus)||void 0===i||i.call(t,e)}_ultraGroupMessageExpansionUpdatedListener(e){var t,i;null===(i=(t=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===i||i.call(t,e)}_ultraGroupMessageRecalledListener(e){var t,i;null===(i=(t=this._watcher).ultraGroupMessageRecalled)||void 0===i||i.call(t,e)}_ultraGroupChannelChangeTypeListener(e){var t,i;null===(i=(t=this._watcher).ultraGroupChannelChangeType)||void 0===i||i.call(t,e)}_ultraGroupChannelUserKickedListener(e){var t,i;null===(i=(t=this._watcher).ultraGroupChannelUserKicked)||void 0===i||i.call(t,e)}_ultraGroupChannelDeleteListener(e){var t,i;null===(i=(t=this._watcher).ultraGroupChannelDelete)||void 0===i||i.call(t,e)}_userGroupStatusListener(e){var t,i;null===(i=(t=this._watcher).userGroupStatus)||void 0===i||i.call(t,e)}_messageReadReceipt(e){var t,i;null===(i=(t=this._watcher).messageReadReceipt)||void 0===i||i.call(t,e)}_syncReadStatus(e){var t,i;null===(i=(t=this._watcher).syncReadStatus)||void 0===i||i.call(t,e)}_subscribedUserStatusChange(e){var t,i;null===(i=(t=this._watcher).subscribedUserStatusChange)||void 0===i||i.call(t,e)}_subscribedRelationChange(e){var t,i;null===(i=(t=this._watcher).subscribedRelationChange)||void 0===i||i.call(t,e)}_syncSubscribedUserStatusFinished(e){var t,i;this.logger.info(r.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S),null===(i=(t=this._watcher).syncSubscribedUserStatusFinished)||void 0===i||i.call(t,e)}_ownUserProfileChanged(e){var t,i;this.logger.info(r.L_OWN_USER_PROFILE_CHANGED_S),null===(i=(t=this._watcher).ownUserProfileChanged)||void 0===i||i.call(t,e)}_groupOperation(e){var t,i;null===(i=(t=this._watcher).groupOperation)||void 0===i||i.call(t,e)}_groupInfoChanged(e){var t,i;null===(i=(t=this._watcher).groupInfoChanged)||void 0===i||i.call(t,e)}_groupMemberInfoChanged(e){var t,i;null===(i=(t=this._watcher).groupMemberInfoChanged)||void 0===i||i.call(t,e)}_groupApplicationEvent(e){var t,i;null===(i=(t=this._watcher).groupApplicationEvent)||void 0===i||i.call(t,e)}_groupRemarkChangedSync(e){var t,i;null===(i=(t=this._watcher).groupRemarkChangedSync)||void 0===i||i.call(t,e)}_groupFollowsChangedSync(e){var t,i;null===(i=(t=this._watcher).groupFollowsChangedSync)||void 0===i||i.call(t,e)}_friendAdd(e){var t,i;null===(i=(t=this._watcher).friendAdd)||void 0===i||i.call(t,e)}_friendDelete(e){var t,i;null===(i=(t=this._watcher).friendDelete)||void 0===i||i.call(t,e)}_friendApplicationStatusChanged(e){var t,i;null===(i=(t=this._watcher).friendApplicationStatusChanged)||void 0===i||i.call(t,e)}_friendCleared(e){var t,i;null===(i=(t=this._watcher).friendCleared)||void 0===i||i.call(t,e)}_friendInfoChangedSync(e){var t,i;null===(i=(t=this._watcher).friendInfoChangedSync)||void 0===i||i.call(t,e)}_naviDataChange(e){this._pluginContextQueue.forEach((t=>{var i;null===(i=t.onnavidatachange)||void 0===i||i.call(t,e)}))}_databaseOpened(e,t){var i,s;null===(s=(i=this._watcher).databaseOpened)||void 0===s||s.call(i,e,t)}_databaseUpgradeWillStart(){var e,t;this.logger.info(r.L_DB_UPGRATE_START_S),null===(t=(e=this._watcher).databaseUpgradeWillStart)||void 0===t||t.call(e)}_databaseUpgrading(e){var t,i;this.logger.info(r.L_DB_UPGRATING_S,e),null===(i=(t=this._watcher).databaseUpgrading)||void 0===i||i.call(t,e)}_databaseUpgradeDidComplete(e){var t,i;this.logger.info(r.L_DB_UPGRATE_COMPLETE_S),null===(i=(t=this._watcher).databaseUpgradeDidComplete)||void 0===i||i.call(t,e)}_readReceiptResponseV5(e){var t,i;null===(i=(t=this._watcher).readReceiptResponseV5)||void 0===i||i.call(t,e)}_speechToTextResponse(e){var t,i;null===(i=(t=this._watcher).speechToTextResponse)||void 0===i||i.call(t,e)}_translateResponse(e){var t,i;null===(i=(t=this._watcher).translateResponse)||void 0===i||i.call(t,e)}_messagesModified(e){var t,i;null===(i=(t=this._watcher).messagesModified)||void 0===i||i.call(t,e)}_messageModifiedSyncCompleted(){var e,t;null===(t=(e=this._watcher).messageModifiedSyncCompleted)||void 0===t||t.call(e)}_syncServerSaveUnreadCompleted(){var e,t;null===(t=(e=this._watcher).syncServerSaveUnreadCompleted)||void 0===t||t.call(e)}_onMessageReaction(e){var t,i;null===(i=(t=this._watcher).messageReaction)||void 0===i||i.call(t,e)}assignWatcher(e){Object.keys(this._watcher).forEach((t=>{if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];this._watcher[t]=vt(i)||St(i)?i:void 0}}))}_resetWatcher(){Object.keys(this._watcher).forEach((e=>{this._watcher[e]=void 0}))}_addTypingInfo(e){const{senderUserId:t,conversationType:i,targetId:s,content:n,channelId:r}=e,{typingContentType:o}=n,a=`${i}#${s}#${r||""}`;this._typingInfo[a]||(this._typingInfo[a]=[]);const l=this._typingInfo[a].findIndex((e=>e.userId===t));l>=0&&this._typingInfo[a][l].messageType===o?this._typingInfo[a][l].timestamp=Date.now():(l>=0&&this._typingInfo[a].splice(l,1),this._typingInfo[a].push({userId:t,messageType:o,timestamp:Date.now()}),this._typingChangedList.includes(a)||this._typingChangedList.push(a),this._startCheckTypingInfo())}_startCheckTypingInfo(){-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((()=>{for(const e in this._typingInfo){const t=this._typingInfo[e].length;this._typingInfo[e]=this._typingInfo[e].filter((e=>Date.now()-e.timestamp<this._typingExpireTime)),this._typingInfo[e].length===t||this._typingChangedList.includes(e)||this._typingChangedList.push(e),0===this._typingInfo[e].length&&delete this._typingInfo[e]}this._notifyTypingChanged()}),500))}_notifyTypingChanged(){if(this._typingChangedList.length>0){const e=this._typingChangedList.map((e=>({conversationType:Number(e.split("#")[0]),targetId:e.split("#")[1],channelId:e.split("#")[2],list:this._typingInfo[e]||[]})));this._typingStatusListener(e),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)}getConnectedTime(){return this._engine.connectedTime}getServerTime(){return this._engine.serverTime}getDeviceId(){return this._engine.deviceId}setPushConfig(e){return this._engine.setPushConfig(e)}getCurrentUserId(){return this._engine.userId}getConnectionStatus(){return this._engine.connectionStatus}isConnected(){return this._engine.connectionStatus===ce.CONNECTED}_validateUserProfile(e){return 1!==e.userProfile?Ei(D.RC_USER_PROFILE_SERVICE_UNAVAILABLE):gi(e)}get validateConnected(){return()=>this.checkAuthed(!1)}get validateLogin(){return()=>this.checkAuthed(!0)}checkAuthed(e){return this._engine.connectionStatus===ce.CONNECTED||this._engine.userId&&e?gi(this._engine.naviInfo):Ei(D.RC_NET_UNAVAILABLE)}get token(){return this._token}refetchNaviInfo(){return t(this,void 0,void 0,(function*(){return this._engine.refetchNaviInfo()}))}connect(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:s}),t);const n=yield Ii.create("connect").isNotEmptyString("token",e).fail(D.RC_CONN_TOKEN_INCORRECT).result().next((()=>i(this,Bf,"m",Hf).call(this,e,!!s,t)));return this.logger.summary(r.A_CONNECT_R,n,t,void 0,(e=>({userId:e}))),n}))}disconnect(e,s){return t(this,void 0,void 0,(function*(){return this.logger.info(r.A_DISCONNECT_O,JSON.stringify({closeDB:e,disablePush:s})),i(this,Bf,"m",jf).call(this,e,s)}))}reconnect(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_RECONNECT_T,JSON.stringify({reconnectKickEnable:e}),t);const s=yield i(this,Bf,"m",Hf).call(this,this.token,!!e,t);return this.logger.summary(r.A_RECONNECT_R,s,t,void 0,(e=>({userId:e}))),s}))}_channelIdConvert(e,t){if(e!==w.ULTRA_GROUP)return t;const i=this.getNaviInfoFromCache();return!!(2&((null==i?void 0:i.ugDriven)||0))&&!t?"RCDefault":t}getNaviInfoFromCache(){return this._engine.naviInfo}registerMessageType(e,t,i,s=[],n=!1){const r={isPersited:t,isCounted:i,searchProps:s,isStatusMessage:n};!function(e,t){const i=ps.get(e);i&&!i.isCustom&&console.warn(`Builtin message type '${e}' cannot be registered`),t.isStatusMessage&&(t.isCounted=t.isPersited=!1),ps.set(e,Object.assign(Object.assign({},t),{isCustom:!0}))}(e,r),this._engine.registerMessageType(e,r)}_rtcDataChange(e){var t;null===(t=this._rtcListener)||void 0===t||t.call(this,e)}registerRTCSignalingListener(e){this._rtcListener=e}sendMessageByPlugin(e,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.L_SEND_MSG_T,JSON.stringify({identifier:e,messageType:s.messageType}),t);const o=yield i(this,Bf,"m",Wf).call(this,e,s,t,n);return this.logger.summary(r.L_SEND_MSG_R,o,t,void 0,(({messageId:t,messageUId:i,messageType:s})=>({messageId:t,messageUId:i,messageType:s,identifier:e}))),o}))}sendMessage(e,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEND_MSG_T,JSON.stringify({identifier:e,messageType:s.messageType}),t);const o=yield i(this,Bf,"m",Wf).call(this,e,s,t,n);return this.logger.summary(r.A_SEND_MSG_R,o,t,void 0,(({messageId:t,messageUId:i,messageType:s})=>({messageId:t,messageUId:i,messageType:s,identifier:e}))),o}))}updateMessageExpansion(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UPDATE_MSG_EXPANSION_T,JSON.stringify({expansion:e,attrs:s}),t);const n=yield Ii.create("updateMessageExpansion").check((t=>R_(t,s,Object.keys(e||{})))).check((t=>A_(t,e,s.canIncludeExpansion))).result().tryTrans(this.validateConnected).next((()=>{const n={put:e,mid:s.messageUId},r=Object.assign(Object.assign({},s),{channelId:this._channelIdConvert(s.conversationType,s.channelId)});return s.conversationType===w.ULTRA_GROUP?this._engine.chat.updateUGMessageExpansion(r,n,s.sentTime):i(this,Bf,"m",Jf).call(this,r,n,t)}));return this.logger.summary(r.A_UPDATE_MSG_EXPANSION_R,n,t),n}))}removeMessageExpansion(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_MSG_EXPANSION_T,JSON.stringify({keys:e,attrs:s}),t);const n=yield Ii.create("removeMessageExpansion").isLimitedTypedArray("keys",e,20,(e=>"string"==typeof e&&/^[A-Za-z0-9_=+-]+$/.test(e)),!0).fail(D.INVALID_PARAMETER_KEYS).check((t=>R_(t,s,e))).result().tryTrans(this.validateConnected).next((()=>{const n={del:e,mid:s.messageUId},r=Object.assign(Object.assign({},s),{channelId:this._channelIdConvert(s.conversationType,s.channelId)});return s.conversationType===w.ULTRA_GROUP?this._engine.chat.updateUGMessageExpansion(r,n,s.sentTime):i(this,Bf,"m",Jf).call(this,r,n,t)}));return this.logger.summary(r.A_REMOVE_MSG_EXPANSION_R,n,t),n}))}removeAllMessageExpansion(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_ALL_MSG_EXPANSION_T,JSON.stringify({attrs:e}),t);const s=yield Ii.create("removeAllMessageExpansion").check((t=>R_(t,e,[]))).check((t=>{e.conversationType!==w.ULTRA_GROUP&&t.setFailed(D.CONVERSATION_TYPE_NOT_SUPPORT)})).result().tryTrans(this.validateConnected).next((()=>{const s={clear:1,mid:e.messageUId},n=Object.assign(Object.assign({},e),{channelId:this._channelIdConvert(e.conversationType,e.channelId)});return e.conversationType===w.ULTRA_GROUP?this._engine.chat.updateUGMessageExpansion(n,s,e.sentTime):i(this,Bf,"m",Jf).call(this,n,s,t)}));return this.logger.summary(r.A_REMOVE_ALL_MSG_EXPANSION_R,s,t),s}))}sendReadReceiptV2(e,i,s,n){return t(this,void 0,void 0,(function*(){n=n||this.logger.createTraceId(),this.logger.info(r.A_SEND_READ_RECEIPT_V2_T,JSON.stringify({targetId:e,messageUIds:i,channelId:s}),n);const o=yield Ii.create("sendReadReceiptV2").validate("targetId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isLimitedTypedArray("messageUIds",i,Number.MAX_SAFE_INTEGER,pt,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateConnected).next((n=>t(this,void 0,void 0,(function*(){return 1!==n.grpRRVer?Ei(D.READ_RECEIPT_ERROR,"The read receipt switch is not on, please call the sendMessage method."):this._engine.chat.sendReadReceiptV2(e,i,s)}))));return this.logger.summary(r.A_SEND_READ_RECEIPT_V2_R,o,n),o}))}_destroy(){return t(this,void 0,void 0,(function*(){as.stop(),this._resetWatcher(),this._engine.destroy(),Eo.removeNetworkStatusListener(),yield i(this,Bf,"m",jf).call(this),this._pluginContextQueue.forEach((e=>{if(e.ondestroy)try{e.ondestroy()}catch(e){this.logger.error(r.L_CALLBACK_E,null==e?void 0:e.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={}}))}getHistoryMessage(e,s){return t(this,void 0,void 0,(function*(){const t=null==s?void 0:s.timestamp,n=null==s?void 0:s.count,o=null==s?void 0:s.order,a=null==s?void 0:s.messageType,l=this.logger.createTraceId();this.logger.info(r.A_GET_HISTORY_MSG_T,JSON.stringify({conversation:e,options:s}),l);const c=yield Ii.create("getHistoryMessage").check((t=>f_(t,e,x))).isLimitedInteger("timestamp",t,0,Number.MAX_SAFE_INTEGER).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("order",o,0,1).fail(D.INVALID_PARAMETER_ORDER).isLimitedInteger("count",n,1,100).fail(D.INVALID_PARAMETER_COUNT).isNotEmptyString("messageType",a).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).result().tryTrans(this.validateConnected).next((()=>{const s={timestamp:t||0,count:n||20,order:o||0,messageType:a||""},r=i(this,Bf,"m",Yf).call(this,e);return this._engine.getHistoryMessage(r,s,!0)}));return this.logger.summary(r.A_GET_HISTORY_MSG_R,c,l,void 0,(({list:e})=>({size:e.length}))),c}))}getContinuousMessages(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CONTINUOUS_MSGS_T,JSON.stringify({conversation:e,options:s}),t);const n=yield Ii.create("getContinuousMessages").check((t=>f_(t,e,V))).isLimitedInteger("timestamp",null==s?void 0:s.timestamp,0,Number.MAX_SAFE_INTEGER).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("count",null==s?void 0:s.count,1,100).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("order",null==s?void 0:s.order,0,1).fail(D.INVALID_PARAMETER_ORDER).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e),n={timestamp:s.timestamp||0,count:s.count||20,order:s.order||0,messageType:""};return this._engine.chat.getContinuousMessages(t,n)}));return this.logger.summary(r.A_GET_CONTINUOUS_MSGS_R,n,t,void 0,(({list:e})=>({size:e.length}))),n}))}getHistoryMessagesByObjectNames(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_HIS_MSGS_BY_OBJ_NAMES_T,JSON.stringify({conversation:e,option:s}),t);const n=yield Ii.create("getHistoryMessagesByObjectNames").check((t=>f_(t,e,F))).isLimitedInteger("timestamp",null==s?void 0:s.timestamp,0,Number.MAX_SAFE_INTEGER).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("count",null==s?void 0:s.count,1,100).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("order",null==s?void 0:s.order,0,1).fail(D.INVALID_PARAMETER_ORDER).isTypedArray("messageTypes",null==s?void 0:s.messageTypes,pt).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e),n={timestamp:s.timestamp||0,count:s.count||20,order:s.order||0,messageTypes:s.messageTypes||[]};return this._engine.chat.getHistoryMessagesByObjectNames(t,n)}));return this.logger.summary(r.A_GET_HIS_MSGS_BY_OBJ_NAMES_R,n,t,void 0,(({list:e})=>({size:e.length}))),n}))}getTopConversationList(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_GET_TOP_CONVERSATION_LIST_T,JSON.stringify({conversationTypes:e,channelId:i}),s);const n=yield Ii.create("getTopConversationList").isTypedArray("conversationTypes",e,(e=>W(e,k))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).validate("channelId",i,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateConnected).next((s=>t(this,void 0,void 0,(function*(){const t=jI(s);return t&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getTopConversationList(t,e,i)}))));return this.logger.summary(r.A_GET_TOP_CONVERSATION_LIST_R,n,s,void 0,(e=>({size:e.length}))),n}))}getUnreadConversationList(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_CONVERSATION_LIST_T,JSON.stringify({conversationTypes:e}),i);const s=yield Ii.create("getUnreadConversationList").isTypedArray("conversationTypes",e,(e=>W(e,k))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).result().tryTrans(this.validateConnected).next((i=>t(this,void 0,void 0,(function*(){const t=jI(i);return t&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getUnreadConversationList(t,e)}))));return this.logger.summary(r.A_GET_UNREAD_CONVERSATION_LIST_R,s,i,void 0,(e=>({size:e.length}))),s}))}getBlockedConversationList(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_BLOCKED_CONVERSATION_LIST_T,"",e);const i=yield Ii.create("getBlockedConversationList").result().tryTrans(this.validateConnected).next((e=>t(this,void 0,void 0,(function*(){const t=jI(e);return t&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getBlockedConversationList(t)}))));return this.logger.summary(r.A_GET_BLOCKED_CONVERSATION_LIST_R,i,e,void 0,(e=>({size:e.length}))),i}))}getAllConversationList(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_ALL_CONVERSATION_LIST_T,JSON.stringify({channelId:e}),i);const s=yield Ii.create("getAllConversationList").validate("channelId",e,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateLogin).next((i=>t(this,void 0,void 0,(function*(){const t=jI(i);return t&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getAllConversationList(t,e)}))));return this.logger.summary(r.A_GET_ALL_CONVERSATION_LIST_R,s,i,void 0,(e=>({size:e.length}))),s}))}getConversationList(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CONVERSATION_LIST_OLD_T,JSON.stringify(e),t);const i=wt()&&"string"!=typeof(null==e?void 0:e.channelId)?this.getAllConversationList(null==e?void 0:e.channelId):this.getConversationListByTimestamp(e),s=yield i;return this.logger.summary(r.A_GET_CONVERSATION_LIST_OLD_R,s,t,void 0,(e=>({size:e.length}))),s}))}getConversationListByTimestamp(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_CONVERSATION_LIST_BY_TIME_T,JSON.stringify(e),i);const s=yield Ii.create("getConversationListByTimestamp").isObject("params",e,!0).fail(D.CONVER_GET_ERROR,"params must be an object").isTimestamp("startTime",null==e?void 0:e.startTime,!0).fail(D.INVALID_PARAMETER_START_TIME).isLimitedInteger("count",null==e?void 0:e.count,1,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("order",null==e?void 0:e.order,0,1).fail(D.INVALID_PARAMETER_ORDER).validate("channelId",null==e?void 0:e.channelId,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).isTypedArray("conversationTypes",null==e?void 0:e.conversationTypes,(e=>W(e,k))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).isNumberEnum("unreadCountFilter",null==e?void 0:e.unreadCountFilter,we).fail(D.INVALID_PARAMETER_UNREAD_COUNT_FILTER).result().tryTrans((()=>this.checkAuthed(wt()))).next((i=>t(this,void 0,void 0,(function*(){const t=jI(i);return t&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getConversationListByTimestamp(e,t)}))));return this.logger.summary(r.A_GET_CONVERSATION_LIST_BY_TIME_R,s,i,void 0,(e=>({size:e.length}))),s}))}getConversation(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CONVERSATION_T,JSON.stringify(e),t);const s=yield Ii.create("getConversation").check((t=>f_(t,e,x))).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getConversation(t)}));return this.logger.summary(r.A_GET_CONVERSATION_R,s,t,e),s}))}removeConversation(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_CONVERSATION_T,JSON.stringify(e),t);const n=yield Ii.create("removeConversation").check((t=>f_(t,e,k))).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.batchDeleteConversations({identifiers:[t],deleteRemotely:!!s,deleteMessages:!1})}));return this.logger.summary(r.A_REMOVE_CONVERSATION_R,n,t),n}))}batchDeleteConversations(e){return t(this,void 0,void 0,(function*(){const s=null==e?void 0:e.identifiers,n=!!(null==e?void 0:e.deleteRemotely),o=!!(null==e?void 0:e.deleteMessages),a=this.logger.createTraceId();this.logger.info(r.A_BATCH_DEL_CONVERS_T,JSON.stringify({identifiers:s,deleteRemotely:n,deleteMessages:o}),a);const l=yield Ii.create("batchDeleteConversations").isLimitedArray("identifiers",s,100,!0,1).fail(D.INVALID_PARAMETER_CONVERSATION_LIST).result().tryTrans(this.validateConnected).next((()=>t(this,void 0,void 0,(function*(){const e=s.filter((e=>T_("",e,k).result().isOk)).map((e=>i(this,Bf,"m",Yf).call(this,e)));return 0===e.length?gi():this._engine.chat.batchDeleteConversations({identifiers:e,deleteRemotely:n,deleteMessages:o})}))));return this.logger.summary(r.A_BATCH_DEL_CONVERS_R,l,a),l.wipe()}))}getUltraGroupList(e){return t(this,void 0,void 0,(function*(){const i=null==e?void 0:e.targetId,s=null==e?void 0:e.channelType,n=this.logger.createTraceId();this.logger.info(r.A_GET_UG_LIST_T,JSON.stringify({targetId:i,channelType:s}),n);const o=yield Ii.create("getUltraGroupList").validate("targetId",i,Ut).fail(D.INVALID_PARAMETER_TARGET_ID).isNumberEnum("channelType",s,X).fail(D.INVALID_PARAMETER_CHANNEL_TYPE).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){return this._engine.chat.ugSynced?this._engine.chat.getUltraGroupList(e):Ei(D.METHOD_NOT_AVAILABLE)}))));return this.logger.summary(r.A_GET_UG_LIST_R,o,n,void 0,(e=>({size:e.length}))),o}))}getBlockedUGList(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_BLOCKED_UG_LIST_T,"",e);const i=yield Ii.create("getBlockedUGList").result().tryTrans(this.validateConnected).next((()=>t(this,void 0,void 0,(function*(){return this._engine.chat.ugSynced?this._engine.chat.getBlockedUGList():Ei(D.METHOD_NOT_AVAILABLE)}))));return this.logger.summary(r.A_GET_BLOCKED_UG_LIST_R,i,e,void 0,(e=>({size:e.length}))),i}))}getUnreadCount(e){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_COUNT_T,JSON.stringify(e),s);const n=yield Ii.create("getUnreadCount").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){if(e.conversationType===w.ULTRA_GROUP&&!this._engine.chat.ugSynced)return Ei(D.METHOD_NOT_AVAILABLE);const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getConversationUnreadCount(t)}))));return this.logger.summary(r.A_GET_UNREAD_COUNT_R,n,s,void 0,(e=>({unreadCount:e}))),n}))}getTotalUnreadCount(e,i,s){return t(this,void 0,void 0,(function*(){const n=this.logger.createTraceId();this.logger.info(r.A_GET_TOTAL_UNREAD_COUNT_T,JSON.stringify({conversationTypes:e,includeMuted:i,channelId:s}),n);const o=yield Ii.create("getTotalUnreadCount").validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).isTypedArray("conversationTypes",e,(e=>W(e,F))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).result().tryTrans(this.validateLogin).next((n=>t(this,void 0,void 0,(function*(){const t=jI(n);if(!t&&e&&e.includes(w.ULTRA_GROUP))return Ei(D.METHOD_NOT_SUPPORT);const r=e&&e.length>0?e:Y(t?k:G);return r.includes(w.ULTRA_GROUP)&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getTotalUnreadCount(r,!!i,s)}))));return this.logger.summary(r.A_GET_TOTAL_UNREAD_COUNT_R,o,n,void 0,(e=>({unreadCount:e}))),o}))}getTotalUnreadCountByLevels(e,i,s){return t(this,void 0,void 0,(function*(){const n=this.logger.createTraceId();this.logger.info(r.A_GET_TOTAL_UNREAD_COUNT_BY_LEVELS_T,JSON.stringify({conversationTypes:e,levels:i,isMentioned:s}),n);const o=yield Ii.create("getTotalUnreadCountByLevels").isLimitedTypedArray("conversationTypes",e,20,(e=>W(e,k)),!0).fail(D.CONVERSATION_TYPE_NOT_SUPPORT).isTypedArray("levels",i,Mt,!0).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){return e.includes(w.ULTRA_GROUP)&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getTotalUnreadCountByLevels(e,i,s)}))));return this.logger.summary(r.A_GET_TOTAL_UNREAD_COUNT_BY_LEVELS_R,o,n,void 0,(e=>({unreadCount:e}))),o}))}getFirstUnreadMessage(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_FIRST_UNREAD_MEG_T,JSON.stringify(e),t);const s=yield Ii.create("getFirstUnreadMessage").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getFirstUnreadMessage(t)}));return this.logger.summary(r.A_GET_FIRST_UNREAD_MSG_R,s,t,e),s}))}getFirstUnreadMessageDigest(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_FIRST_UNREAD_MSG_DIGEST_T,JSON.stringify(e),t);const s=yield Ii.create("getFirstUnreadMessageDigest").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getFirstUnreadMessageDigest(t)}));return this.logger.summary(r.A_GET_FIRST_UNREAD_MSG_DIGEST_R,s,t,e),s}))}batchSetConversationNotificationLevel(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_SET_CONVERSATION_NOTIFICATION_LEVEL_T,JSON.stringify({conversations:e,notificationLevel:s}),t);const n=Ii.create("batchSetConversationNotificationLevel"),o=yield n.isLimitedTypedArray("conversations",e,20,(e=>!T_("batchSetConversationNotificationLevel",e,k).isFailed),!0,1).fail(D.INVALID_PARAMETER_CONVERSATION_LIST).isNumberEnum("notificationLevel",s,Ee,!0).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateConnected).next((()=>{const t=e.map((e=>i(this,Bf,"m",Yf).call(this,e)));return this._engine.chat.batchSetConversationNotificationLevel(t,s)}));return this.logger.summary(r.A_BATCH_SET_CONVERSATION_NOTIFICATION_LEVEL_R,o,t),o}))}batchSetConversationToTop(e,s,n,o){return t(this,void 0,void 0,(function*(){const t=Ii.create("batchSetConversationToTop").isLimitedTypedArray("conversations",e,20,(e=>T_("batchSetConversationToTop",e,k).result().isOk),!0,1).fail(D.INVALID_PARAMETER_CONVERSATION_LIST).result().tryTrans((()=>e.every((e=>e.conversationType!==w.ULTRA_GROUP||!e.channelId||"RCDefault"===e.channelId))?gi():Ei(D.ONLY_DEFAULT_CHANNEL_SUPPORTS_PINNING))).tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const a=this.logger.createTraceId(),l=e.map((e=>i(this,Bf,"m",Yf).call(this,e)));this.logger.info(r.A_BATCH_SET_CONVERSATION_TO_TOP_T,JSON.stringify({conversations:l,isTop:s,isUpdateTime:n,isCreateConversation:o}),a);const c=yield this._engine.chat.batchSetConversationToTop(l,s,n,o);return this.logger.summary(r.A_BATCH_SET_CONVERSATION_TO_TOP_R,c,a),c}))}batchSetConversationTranslateStrategy(e,s){return t(this,void 0,void 0,(function*(){const t=Ii.create("batchSetConversationTranslateStrategy").isLimitedTypedArray("conversations",e,20,(e=>T_("",e,k).result().isOk),!0,1).fail(D.INVALID_PARAMETER_CONVERSATION_LIST).isNumberEnum("strategy",s,Ms,!0).fail(D.INVALID_PARAMETER_TRANSLATE_STRATEGY).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const n=this.logger.createTraceId();this.logger.info(r.A_BATCH_SET_CONVERSATION_TRANSLATE_STRATEGY_T,JSON.stringify({conversations:e,strategy:s}),n);const o=e.map((e=>i(this,Bf,"m",Yf).call(this,e))),a=yield this._engine.chat.batchSetConversationTranslateStrategy(o,s);return this.logger.summary(r.A_BATCH_SET_CONVERSATION_TRANSLATE_STRATEGY_R,a,n),a}))}saveTextMessageDraft(e,s){return t(this,void 0,void 0,(function*(){return yield T_("saveTextMessageDraft",e,F).isString("draft",s,!0).fail(D.INVALID_PARAMETER_DRAFT).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.saveTextMessageDraft(t,s)}))}))}getTextMessageDraft(e){return t(this,void 0,void 0,(function*(){return yield T_("getTextMessageDraft",e,F).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.getTextMessageDraft(t)}))}))}clearTextMessageDraft(e){return t(this,void 0,void 0,(function*(){return yield T_("clearTextMessageDraft",e,F).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.clearTextMessageDraft(t)}))}))}recallMessage(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),n={conversation:e,messageUId:null==s?void 0:s.messageUId};this.logger.info(r.A_RECALL_MESSAGE_T,JSON.stringify(n),t);const o=yield Ii.create("recallMessage").check((t=>f_(t,e,x))).isNotEmptyString("messageUId",s.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isInteger("sentTime",s.sentTime,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).isBoolean("disableNotification",s.disableNotification).fail(D.INVALID_PARAMETER_DISABLE_NOTIFICATION).isObject("pushConfig",s.pushConfig).fail(D.INVALID_PARAMETER_PUSH_CONFIG).isBoolean("disableUpdateLastMessage",s.disableUpdateLastMessage).fail(D.INVALID_DISABLE_UPDATE_LAST_MESSAGE).isLimitedTypedArray("directionalUserIdList",s.directionalUserIdList,300,Ut,!1,0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.recallMsg(t,s)}));return this.logger.summary(r.A_RECALL_MESSAGE_R,o,t,n),o}))}deleteRemoteMessage(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DEL_REMOTE_MSGS_T,JSON.stringify({conversation:e,messages:s}),t);const n=yield Ii.create("deleteRemoteMessage").check((t=>f_(t,e,k))).isLimitedTypedArray("messages",s,100,(e=>{if(!e||"object"!=typeof e)return!1;const{messageUId:t,sentTime:i,messageDirection:s}=e;return pt(t)&&(s===ue.SEND||s===ue.RECEIVE)&&ft({min:0})(i)}),!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.deleteRemoteMessage(t,s)}));return this.logger.summary(r.A_DEL_REMOTE_MSGS_R,n,t),n}))}deleteRemoteMessageByTimestamp(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DEL_REMOTE_MSGS_T,JSON.stringify({identifier:e,timestamp:s}),t);const n=yield Ii.create("deleteRemoteMessageByTimestamp").check((t=>f_(t,e,x))).isInteger("timestamp",s,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.deleteRemoteMessageByTimestamp(t,s)}));return this.logger.summary(r.A_DEL_REMOTE_MSGS_R,n,t),n}))}getFileToken(e,i,s,n,r,o){return t(this,void 0,void 0,(function*(){return Ii.create("getFileToken").isNumberEnum("fileType",e,J,!0).fail(D.INVALID_PARAMETER_MEDIA_TYPE).isString("fileName",i).fail(D.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME).validate("httpMethod",s,(e=>"POST"===e||"PUT"===e)).fail(D.BIZ_ERROR_INVALID_PARAMETER,"`httpMethod` is invalid").isString("queryString",n).fail(D.BIZ_ERROR_INVALID_PARAMETER,"`queryString` is invalid").isString("url",r).fail(D.BIZ_ERROR_INVALID_PARAMETER,"`url` is invalid").isInteger("size",o).fail(D.BIZ_ERROR_INVALID_PARAMETER,"`size` is invalid").result().tryTrans(this.validateConnected).next((a=>t(this,void 0,void 0,(function*(){const t=a.uploadServer||"",l=a.ossConfig||"";return(yield this._engine.getFileToken(e,i,s,n,r,o)).trans((e=>Object.assign(e,{qiniu:t,ossConfig:e.ossConfig||l})))}))))}))}getFileUrl(e,i,s,r){return t(this,void 0,void 0,(function*(){return yield Ii.create("getFileUrl").isNumberEnum("fileType",e,J,!0).fail(D.INVALID_PARAMETER_MEDIA_TYPE).isString("fileName",i).fail(D.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME).isString("saveName",r).fail(D.INVALID_PARAMETER_SAVE_NAME).isNumberEnum("serverType",s,n,!0).fail(D.INVALID_PARAMETER_SERVER_TYPE).result().tryTrans(this.validateConnected).next((()=>this._engine.getFileUrl(e,s,i,r||"")))}))}createTag(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_TAG_T,JSON.stringify({tagId:null==e?void 0:e.tagId,tagName:null==e?void 0:e.tagName}),t);const i=yield Ii.create("createTag").isLimitedString("tagId",null==e?void 0:e.tagId,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isLimitedString("tagName",null==e?void 0:e.tagName,1,15,!0).fail(D.INVALID_PARAMETER_TAG_NAME).result().tryTrans(this.validateConnected).next((()=>this._engine.createTag(e)));return this.logger.summary(r.A_ADD_TAG_R,i,t),i}))}removeTag(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_TAG_T,JSON.stringify({tagId:e}),t);const i=yield Ii.create("removeTag").isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).result().tryTrans(this.validateConnected).next((()=>this._engine.removeTag(e)));return this.logger.summary(r.A_REMOVE_TAG_R,i,t),i}))}updateTag(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UPDATE_TAG_T,JSON.stringify({tagId:null==e?void 0:e.tagId,tagName:null==e?void 0:e.tagName}),t);const i=yield Ii.create("updateTag").isLimitedString("tagId",null==e?void 0:e.tagId,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isLimitedString("tagName",null==e?void 0:e.tagName,1,15,!0).fail(D.INVALID_PARAMETER_TAG_NAME).result().tryTrans(this.validateConnected).next((()=>this._engine.updateTag(e)));return this.logger.summary(r.A_UPDATE_TAG_R,i,t),i}))}getTagList(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_TAGS_T,"",e);const t=yield this.validateLogin().next((()=>this._engine.getTagList()));return this.logger.summary(r.A_GET_TAGS_R,t,e,void 0,(e=>({size:e.length}))),t}))}addTagForConversations(e,s){return t(this,void 0,void 0,(function*(){const t=Ii.create("addTagForConversations").isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isTypedArray("conversations",s,(e=>T_("",e,G).result().isOk),!0).fail(D.INVALID_PARAMETER_CONVERSATIONS).isLimitedInteger("conversations",null==s?void 0:s.length,1,1e3,!0).fail(D.CONVER_OUT_LIMIT_ERROR).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const n=s.map((e=>i(this,Bf,"m",Yf).call(this,e))),o=this.logger.createTraceId();this.logger.info(r.A_ADD_TAG_FOR_CONVERSATIONS_T,JSON.stringify({tagId:e,conversations:n}),o);const a=yield this._engine.chat.addTagForConversations(e,n);return this.logger.summary(r.A_ADD_TAG_FOR_CONVERSATIONS_R,a,o),a}))}removeTagForConversations(e,s){return t(this,void 0,void 0,(function*(){const t=Ii.create("removeTagForConversations").isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isLimitedTypedArray("conversations",s,1e3,(e=>T_("",e,G).result().isOk),!0).fail(D.INVALID_PARAMETER_CONVERSATIONS).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const n=s.map((e=>i(this,Bf,"m",Yf).call(this,e))),o=this.logger.createTraceId();this.logger.info(r.A_REMOVE_TAG_FOR_CONVERS_T,JSON.stringify({tagId:e,conversations:n}),o);const a=yield this._engine.chat.removeTagForConversations(e,n);return this.logger.summary(r.A_REMOVE_TAG_FOR_CONVERS_R,a,o),a}))}removeTagsForConversation(e,s){return t(this,void 0,void 0,(function*(){const t=T_("removeTagsForConversation",e,G).isTypedArray("tagIds",s,(e=>Et(e)),!0).fail(D.INVALID_PARAMETER_TAG_ID).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const n=this.logger.createTraceId(),o=i(this,Bf,"m",Yf).call(this,e);this.logger.info(r.A_REMOVE_TAGS_FOR_CONVER_T,JSON.stringify({tagIds:s,conversation:o}),n);const a=yield this._engine.chat.removeTagsForConversation(o,s);return this.logger.summary(r.A_REMOVE_TAGS_FOR_CONVER_R,a,n),a}))}getConversationListByTag(e,i,s){return t(this,void 0,void 0,(function*(){const t=Ii.create("getConversationListByTag").isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isInteger("count",s,!0).fail(D.CONVER_OUT_LIMIT_ERROR).isLimitedInteger("startTime",i,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_START_TIME).result().tryTrans((()=>this.checkAuthed(wt())));if(!t.isOk)return t.wipe();const n=s<=0?20:Math.min(s,1e3);return this._engine.chat.getConversationListByTag(e,i,n)}))}getUnreadCountByTag(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_COUNT_BY_TAG_T,JSON.stringify({tagId:e,containMuted:i}),t);const s=yield Ii.create("getUnreadCountByTag").isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isBoolean("containMuted",i,!0).fail(D.INVALID_PARAMETER_CONTAIN_MUTED).result().tryTrans(this.validateLogin).next((()=>this._engine.chat.getUnreadCountByTag(e,i)));return this.logger.summary(r.A_GET_UNREAD_COUNT_BY_TAG_R,s,t),s}))}setConversationStatusInTag(e,s,n){return t(this,void 0,void 0,(function*(){const t=T_("setConversationStatusInTag",s,G).isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isBoolean("isTop",null==n?void 0:n.isTop,!0).fail(D.INVALID_PARAMETER_IS_TOP).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const o=this.logger.createTraceId(),a=i(this,Bf,"m",Yf).call(this,s);this.logger.info(r.A_SET_CONVER_TO_TOP_IN_TAG_T,JSON.stringify({tagId:e,conversation:a,isTop:n.isTop}),o);const l=yield this._engine.chat.setConversationStatusInTag(e,a,n);return this.logger.summary(r.A_SET_CONVER_TO_TOP_IN_TAG_R,l,o),l}))}getTagsForConversation(e){return t(this,void 0,void 0,(function*(){const t=T_("getTagsForConversation",e,G).result().tryTrans(this.validateLogin);if(!t.isOk)return t.wipe();const s=this.logger.createTraceId(),n=i(this,Bf,"m",Yf).call(this,e);this.logger.info(r.A_GET_TAGS_OF_CONVERSATION_T,JSON.stringify(n),s);const o=yield this._engine.chat.getTagsForConversation(n);return this.logger.summary(r.A_GET_TAGS_OF_CONVERSATION_R,o,s,void 0,(e=>({size:e.length}))),o}))}getUnreadMentionedCount(e){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_MENTIONED_COUNT_T,JSON.stringify(e),s);const n=yield Ii.create("getUnreadMentionedCount").check((t=>f_(t,e,B))).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){if(e.conversationType===w.ULTRA_GROUP&&!this._engine.chat.ugSynced)return Ei(D.METHOD_NOT_AVAILABLE);const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getUnreadMentionedCount(t)}))));return this.logger.summary(r.A_GET_UNREAD_MENTIONED_COUNT_R,n,s),n.trans(D_)}))}getAllUnreadMentionedCount(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_ALL_UNREAD_MENTIONED_COUNT_T,"",e);const t=yield this.validateLogin().next((()=>this._engine.chat.getAllUnreadMentionedCount()));return this.logger.summary(r.A_GET_ALL_UNREAD_MENTIONED_COUNT_R,t,e),t}))}getUltraGroupMessageListByMessageUId(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),n=s instanceof Array?s.map((e=>null==e?void 0:e.messageUId)):[],o=null==e?void 0:e.conversationType,a=null==e?void 0:e.targetId,l=null==e?void 0:e.channelId;this.logger.info(r.A_GET_UG_MSGS_BY_UID_T,JSON.stringify({conversationType:o,targetId:a,channelId:l,messageUIds:n}),t);const c=yield Ii.create("getUltraGroupMessageListByMessageUId").check((t=>f_(t,e,k))).isTypedArray("messages",s,(e=>pt(null==e?void 0:e.messageUId)),!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("messages",null==s?void 0:s.length,1,20,!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getRemoteMessagesByUIds(t,s.map((e=>e.messageUId)))}));return this.logger.summary(r.A_GET_UG_MSGS_BY_UID_R,c,t,c.isOk?{list:c.data.map((e=>e.messageUId))}:void 0),c.trans((e=>{const t={};return e.forEach((e=>{t[e.messageUId]=e})),t}))}))}getUGUnreadCountForAllChannels(e,i,s){return t(this,void 0,void 0,(function*(){const n=this.logger.createTraceId();this.logger.info(r.A_GET_UG_UNREAD_COUNT_FOR_ALL_CHANNELS_T,JSON.stringify({targetId:e,levels:s,isGetMentioned:i}),n);const o=yield Ii.create("getUGUnreadCountForAllChannels").validate("targetId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).check((e=>{e.isTypedArray("levels",s,(t=>!e.isNumberEnum("",t,Ee,!0).isFailed))})).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){return this._engine.chat.ugSynced?this._engine.chat.getUGUnreadCountForAllChannels(e,s||[],i):Ei(D.METHOD_NOT_AVAILABLE)}))));return this.logger.summary(r.A_GET_UG_UNREAD_COUNT_FOR_ALL_CHANNELS_R,o,n),o}))}getUGUnreadMentionedDigest(e){return t(this,void 0,void 0,(function*(){const t=null==e?void 0:e.targetId,i=null==e?void 0:e.channelId,s=null==e?void 0:e.sentTime,n=null==e?void 0:e.count,o=this.logger.createTraceId();this.logger.info(r.A_GET_UG_UNREAD_MENTIONED_DIGEST_T,JSON.stringify({targetId:t,channelId:i,sentTime:s,count:n}),o);const a=yield Ii.create("getUGUnreadMentionedDigest").validate("targetId",t,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("channelId",i,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).isLimitedInteger("count",n,1,50,!0).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("sentTime",s,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((()=>(e.channelId=this._channelIdConvert(w.ULTRA_GROUP,i),this._engine.chat.getUGUnreadMentionedDigest(e))));return this.logger.summary(r.A_GET_UG_UNREAD_MENTIONED_DIGEST_R,a,o,void 0,(e=>({size:e.length}))),a}))}getUGFirstUnreadMessageDigest(e){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_GET_UG_FIRST_UNREAD_MSG_DIGEST_T,JSON.stringify(e),s);const n=yield Ii.create("getUGFirstUnreadMessageDigest").validate("targetId",null==e?void 0:e.targetId,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("channelId",null==e?void 0:e.channelId,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateConnected).next((()=>t(this,void 0,void 0,(function*(){if(!this._engine.chat.ugSynced)return Ei(D.METHOD_NOT_AVAILABLE);const t=i(this,Bf,"m",Yf).call(this,Object.assign(Object.assign({},e),{conversationType:w.ULTRA_GROUP}));return this._engine.chat.getUGFirstUnreadMessageDigest(t)}))));return this.logger.summary(r.A_GET_UG_FIRST_UNREAD_MSG_DIGEST_R,n,s),n}))}getUGUnreadInfoList(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_UG_UNREAD_INFO_LIST_T,JSON.stringify({targetIds:e}),i);const s=yield Ii.create("getUGUnreadInfoList").isLimitedTypedArray("targetIds",e,20,(e=>Ut(e)),!0,1).fail(D.INVALID_PARAMETER_TARGET_ID).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){if(!this._engine.chat.ugSynced)return Ei(D.METHOD_NOT_AVAILABLE);const t=new Set(e);return this._engine.chat.getUGUnreadInfoList(Array.from(t))}))));return this.logger.summary(r.A_GET_UG_UNREAD_INFO_LIST_R,s,i,void 0,(e=>({size:e.length}))),s}))}getOSInfo(){return this._engine.getOSInfo()}getProcessInfo(){return this._engine.getProcessInfo()}getMainProcessInfo(){return this._engine.getMainProcessInfo()}setCallInfo(e,t,i){return this.validateConnected().next((()=>this._engine.setCallInfo(e,t,i)))}_validateSubDriven(e,t){const{subDriven:i=0}=e;switch(t){case oe.ONLINE_STATUS:return 1&i?gi(e):Ei(D.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE);case oe.USER_PROFILE:return 2&i?gi(e):Ei(D.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE);default:return Ei(D.INVALID_PARAMETER_SUBSCRIBE_TYPE)}}subscribeUser(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SUBSCRIBE_USER_STATUS_T,JSON.stringify({userIds:e,subscribeType:i,expiry:s}),t);const n=yield Ii.create("subscribeUser").isLimitedTypedArray("userIds",e,200,Ut,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS).isNumberEnum("subscribeType",i,oe,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_TYPE).isLimitedInteger("expiry",s,60,2592e3,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_EXPIRY).result().tryTrans(this.validateConnected).tryTrans((e=>this._validateSubDriven(e,i))).next((()=>this._engine.subscribeUser(e,i,s)));return this.logger.summary(r.A_SUBSCRIBE_USER_STATUS_R,n,t),n}))}unSubscribeUser(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UNSUBSCRIBE_USER_STATUS_T,JSON.stringify({userIds:e,subscribeType:i}),t);const s=yield Ii.create("unSubscribeUser").isLimitedTypedArray("userIds",e,200,Ut,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS).isNumberEnum("subscribeType",i,oe,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_TYPE).result().tryTrans(this.validateConnected).tryTrans((e=>this._validateSubDriven(e,i))).next((()=>this._engine.unSubscribeUser(e,i)));return this.logger.summary(r.A_UNSUBSCRIBE_USER_STATUS_R,s,t),s}))}getSubscribeUserList(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_SUBSCRIBE_USER_STATUS_LIST_T,JSON.stringify({subscribeType:e,count:i,offset:s}),t);const n=yield Ii.create("getSubscribeUserList").isNumberEnum("subscribeType",e,oe,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_TYPE).isLimitedInteger("count",i,1,200,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE).isLimitedInteger("offset",s,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_OFFSET).result().tryTrans(this.validateConnected).tryTrans((t=>this._validateSubDriven(t,e))).next((()=>this._engine.getSubscribeUserList(e,i,s)));return this.logger.summary(r.A_GET_SUBSCRIBE_USER_STATUS_LIST_R,n,t,void 0,(e=>({size:e.length}))),n}))}getSubscribeUserStatus(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_SUB_USERS_STATUS_T,JSON.stringify({subscribeType:e,userIds:i}),t);const s=yield Ii.create("getSubscribeUserStatus").isNumberEnum("subscribeType",e,oe,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_TYPE).isLimitedTypedArray("userIds",i,200,Ut,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS).result().tryTrans(this.validateConnected).tryTrans((t=>this._validateSubDriven(t,e))).next((()=>this._engine.getSubscribeUserStatus(e,i)));return this.logger.summary(r.A_GET_SUB_USERS_STATUS_R,s,t,void 0,(e=>({size:e.length}))),s}))}getSubscribeUsersOnlineStatus(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_SUB_USERS_ONLINE_STATUS_T,JSON.stringify({userIds:e}),t);const i=yield Ii.create("getSubscribeUsersOnlineStatus").isLimitedTypedArray("userIds",e,200,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).next((()=>this._engine.getSubscribeUsersOnlineStatus(e)));return this.logger.summary(r.A_GET_SUB_USERS_ONLINE_STATUS_R,i,t,void 0,(e=>({size:e.length}))),i}))}updateMyUserProfile(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UPDATE_MY_USER_PROFILE_T,JSON.stringify({profile:e}),t);const i=yield Ii.create("updateMyUserProfile").isObject("profile",e,!0).check((t=>{const{name:i,portraitUri:s,email:n,birthday:r,gender:o,location:a,role:l,level:c,extraProfile:_}=e;t.isString("name",i).isString("portraitUri",s).isString("email",n).isString("birthday",r).isNumber("gender",o).isString("location",a).isNumber("role",l).isNumber("level",c).isObject("extraProfile",_),!t.isFailed&&_&&Object.entries(_).forEach((([e,i])=>{t.isString("extraProfile",i,!0)}))})).fail(D.INVALID_PARAMETER_USER_PROFILE).result().tryTrans(this.validateConnected).tryTrans((e=>this._validateUserProfile(e))).next((()=>{const t={};return["name","portraitUri","email","birthday","gender","location","role","level"].forEach((i=>{const s=e[i];void 0!==s&&(t[i]=s)})),e.extraProfile&&(t.extraProfile=Object.assign({},e.extraProfile)),this._engine.updateMyUserProfile(t)}));return this.logger.summary(r.A_UPDATE_MY_USER_PROFILE_R,i,t),i}))}getUserProfiles(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_USER_PROFILES_T,JSON.stringify({userIds:e}),t);const i=yield Ii.create("getUserProfiles").isLimitedTypedArray("userIds",e,100,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateLogin).tryTrans((e=>this._validateUserProfile(e))).next((()=>this._engine.getUserProfiles(e)));return this.logger.summary(r.A_GET_USER_PROFILES_R,i,t,void 0,(e=>({size:e.length}))),i}))}getMyUserProfile(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_MY_USER_PROFILE_T,void 0,e);const t=yield Ii.create("getMyUserProfile").result().tryTrans(this.validateConnected).tryTrans((e=>this._validateUserProfile(e))).next((()=>this._engine.getMyUserProfile()));return this.logger.summary(r.A_GET_MY_USER_PROFILE_R,t,e),t}))}clearConversations(e,i){return t(this,void 0,void 0,(function*(){return this._engine.chat.clearConversations(e,i)}))}addToBlacklist(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_TO_BLACKLIST_T,JSON.stringify({userId:e}),t);const i=yield Ii.create("addToBlacklist").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).next((()=>this._engine.addToBlacklist(e)));return this.logger.summary(r.A_ADD_TO_BLACKLIST_R,i,t),i}))}removeFromBlacklist(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_FROM_BLACKLIST_T,JSON.stringify({userId:e}),t);const i=yield Ii.create("removeFromBlacklist").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).next((()=>this._engine.removeFromBlacklist(e)));return this.logger.summary(r.A_REMOVE_FROM_BLACKLIST_R,i,t),i}))}getBlacklist(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_BLACKLIST_T,void 0,e);const t=yield Ii.create("getBlacklist").result().tryTrans(this.validateConnected).next((()=>this._engine.getBlacklist()));return this.logger.summary(r.A_GET_BLACKLIST_R,t,e,void 0,(e=>({size:e.length}))),t}))}getBlacklistStatus(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_BLACKLIST_STATUS_T,JSON.stringify({userId:e}),t);const i=yield Ii.create("getBlacklistStatus").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).next((()=>this._engine.getBlacklistStatus(e)));return this.logger.summary(r.A_GET_BLACKLIST_STATUS_R,i,t),i}))}insertMessage(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_INSERT_MSG_T,JSON.stringify({conversation:e,params:s}),t);const n=yield Ii.create("insertMessage").check((t=>f_(t,e,F))).validate("senderUserId",s.senderUserId,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isObject("content",s.content,!0).fail(D.INVALID_PARAMETER_MESSAGE_CONTENT).check((e=>{const t=I_(s.messageType,s.content);t.isOk||e.setFailed(t.code)})).isNotEmptyString("messageType",s.messageType,!0).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).isNumberEnum("messageDirection",s.messageDirection,ue,!0).fail(D.INVALID_MESSAGE_DIRECTION).check((e=>{s.canIncludeExpansion&&s.expansion&&A_(e,s.expansion,!0)})).isTimestamp("sentTime",s.sentTime).fail(D.INVALID_PARAMETER_TIMESTAMP).isNumberEnum("sentStatus",s.sentStatus,ie).fail(D.INVALID_PARAMETER_SENT_STATUS).isTypedArray("directedUserIds",s.directedUserIds,Ut).fail(D.INVALID_PARAMETER_USERIDLIST).isString("searchContent",s.searchContent).fail(D.SEARCH_PROPS_LIMIT_ERROR).check((e=>{const{quoteInfo:t}=s;t&&e.isObject("quoteInfo",t,!0).isNotEmptyString("quoteInfo.messageUId",t.messageUId,!0).isNotEmptyString("quoteInfo.senderId",t.senderId,!0).isNotEmptyString("quoteInfo.objectName",t.objectName,!0).isNumberEnum("quoteInfo.quoteMessageStatus",t.quoteMessageStatus,Pe).fail(D.INVALID_PARAMETER_QUOTE_INFO)})).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.insertMessage(t,s)}));return this.logger.summary(r.A_INSERT_MSG_R,n,t),n}))}batchInsertMessage(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_INSERT_MSGS_T,JSON.stringify({count:null==e?void 0:e.length,checkDuplicate:i}),t);const s=Ii.create(""),n=yield Ii.create("batchInsertMessage").isLimitedTypedArray("messages",e,500,(e=>"object"==typeof e&&(f_(s,e,F),s.validate("senderUserId",e.senderUserId,Ut,!0).isNotEmptyString("messageType",e.messageType,!0).isObject("content",e.content,!0).isNumberEnum("messageDirection",e.messageDirection,ue,!0).check((t=>{e.canIncludeExpansion&&e.expansion&&A_(t,e.expansion,!0)})).isTimestamp("sentTime",e.sentTime).isNumberEnum("sentStatus",e.sentStatus,ie).isString("searchContent",e.searchContent).isNumber("receivedStatus",e.receivedStatus).isObject("receivedStatusInfo",e.receivedStatusInfo).isTypedArray("directedUserIds",e.directedUserIds,Ut).check((t=>{const{quoteInfo:i}=e;i&&t.isObject("quoteInfo",i,!0).isNotEmptyString("quoteInfo.messageUId",i.messageUId,!0).isNotEmptyString("quoteInfo.senderId",i.senderId,!0).isNotEmptyString("quoteInfo.objectName",i.objectName,!0).isNumberEnum("quoteInfo.quoteMessageStatus",i.quoteMessageStatus,Pe).fail(D.INVALID_PARAMETER_QUOTE_INFO)})),!s.isFailed)),!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateLogin).next((()=>{const t=e.map((e=>Object.assign(Object.assign({},e),{channelId:this._channelIdConvert(e.conversationType,e.channelId)})));return this._engine.batchInsertMessage(t,i)}));return this.logger.summary(r.A_BATCH_INSERT_MSGS_R,n,t),n}))}getLocalMessageCount(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_LOCAL_MSG_COUNT_T,JSON.stringify({conversation:e}),t);const s=yield Ii.create("getMessageCount").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.getLocalMessageCount(t)}));return this.logger.summary(r.A_GET_LOCAL_MSG_COUNT_R,s,t),s}))}deleteLocalMessages(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DELETE_LOCAL_MSGS_T,JSON.stringify({messageIds:e}),t);const i=yield Ii.create("deleteLocalMessages").isTypedArray("messageIds",e,(e=>Number.isInteger(e)),!0).fail(D.INVALID_PARAMETER_MESSAGE_ARRAY).result().tryTrans(this.validateLogin).next((()=>this._engine.deleteLocalMessages(e)));return this.logger.summary(r.A_DELETE_LOCAL_MSGS_R,i,t),i}))}deleteLocalMessagesByTimestamp(e,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DEL_LOCAL_MSGS_BY_TIME_T,JSON.stringify({conversation:e,timestamp:s,cleanSpace:n}),t);const o=yield Ii.create("deleteLocalMessagesByTimestamp").check((t=>f_(t,e,F))).isTimestamp("timestamp",s,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.deleteLocalMessagesByTimestamp(t,s,!!n)}));return this.logger.summary(r.A_DEL_LOCAL_MSGS_BY_TIME_R,o,t),o}))}batchClearLocalMessagesByTimestamp(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_CLEAR_LOCAL_MSGS_BY_TIME_T,JSON.stringify({options:e}),t);const i=yield Ii.create("batchClearLocalMessagesByTimestamp").check((t=>{t.isLimitedTypedArray("options",e,20,(e=>(f_(t,e,k),!t.isFailed&&ft({min:0})(e.timestamp)))).fail(D.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST)})).result().tryTrans(this.validateLogin).next((()=>{const t=e.map((e=>Object.assign(Object.assign({},e),{channelId:this._channelIdConvert(e.conversationType,e.channelId)})));return this._engine.batchClearLocalMessagesByTimestamp(t)}));return this.logger.summary(r.A_BATCH_CLEAR_LOCAL_MSGS_BY_TIME_R,i,t),i}))}batchClearRemoteHistoryMessages(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_CLEAR_REMOTE_MSG_T,JSON.stringify({options:e,isDeleteLocal:i}),t);const s=yield Ii.create("batchClearRemoteHistoryMessages").isLimitedArray("options",e,20,!0,1).check((t=>{e.forEach((e=>{f_(t,e,k).isTimestamp("timestamp",null==e?void 0:e.timestamp)}))})).fail(D.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST,void 0,!0).check((t=>{e.some((e=>e.conversationType===w.ULTRA_GROUP))&&t.setFailed(D.CONVERSATION_TYPE_NOT_SUPPORT)})).result().tryTrans(this.validateConnected).next((()=>this._engine.chat.batchClearRemoteHistoryMessages(e,!!i)));return this.logger.summary(r.A_BATCH_CLEAR_REMOTE_MSG_R,s,t),s}))}clearLocalMessages(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CLEAR_LOCAL_MSG_T,JSON.stringify({conversation:e}),t);const i=yield Ii.create("clearLocalMessages").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>this._engine.clearLocalMessages(e)));return this.logger.summary(r.A_CLEAR_LOCAL_MSG_R,i,t),i}))}getLocalMessage(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_LOCAL_MESSAGE_T,JSON.stringify({messageId:e}),t);const i=Ii.create("getLocalMessage").validate("messageId",e,(()=>pt(e)||Tt(e)),!0).fail(D.INVALID_PARAMETER_MESSAGE_ID).result(),s=yield i.next((()=>this._engine.getMessage(e)));return this.logger.summary(r.A_GET_LOCAL_MESSAGE_R,s,t,{messageId:e}),s}))}_innerSetMessageContent(e,i,s){return t(this,void 0,void 0,(function*(){return this._engine.setMessageContent(e,i,s)}))}setMessageContent(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_MSG_CONTENT_T,JSON.stringify({messageId:e,messageType:s}),t);const n=yield Ii.create("setMessageContent").isInteger("messageId",e,!0).fail(D.INVALID_PARAMETER_MESSAGE_ID).isNotEmptyString("messageType",s,!0).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).isObject("content",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_CONTENT).result().tryTrans(this.validateLogin).next((()=>{const t=JSON.stringify(i);return this._innerSetMessageContent(e,t,s)}));return this.logger.summary(r.A_SET_MSG_CONTENT_R,n,t),n}))}setMessageSearchField(e,i,s){return t(this,void 0,void 0,(function*(){return this._engine.setMessageSearchField(e,i,s)}))}setMessageSentStatus(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_E_SET_MSG_SENT_STATUS_T,JSON.stringify({messageId:e,sentStatus:i}),t);const s=yield Ii.create("setMessageSentStatus").isInteger("messageId",e,!0).fail(D.INVALID_PARAMETER_MESSAGE_ID).isNumberEnum("sentStatus",i,ie,!0).fail(D.INVALID_PARAMETER_SENT_STATUS).result().tryTrans(this.validateLogin).next((()=>this._engine.setMessageSentStatus(e,i)));return this.logger.summary(r.A_E_SET_MSG_SENT_STATUS_R,s,t),s}))}setMessageReceivedStatus(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_E_SET_MSG_RECEIVED_STATUS_T,JSON.stringify({messageId:e,receivedStatus:i}),t);const s=yield Ii.create("setMessageReceivedStatus").isInteger("messageId",e,!0).fail(D.INVALID_PARAMETER_MESSAGE_ID).isInteger("receivedStatus",i,!0).fail(D.INVALID_PARAMETER_RECEIVED_STATUS).result().tryTrans(this.validateLogin).next((()=>this._engine.setMessageReceivedStatus(e,i)));return this.logger.summary(r.A_E_SET_MSG_RECEIVED_STATUS_R,s,t),s}))}setMessageStatusToRead(e,i){return t(this,void 0,void 0,(function*(){const t=T_("setMessageStatusToRead",e,G).isNumber("timestamp",i,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateLogin);if(!t.isOk)return t.wipe();const s=this.logger.createTraceId(),{conversationType:n,targetId:o,channelId:a}=e;this.logger.info(r.A_E_SET_MESSAGE_STATUS_TO_READ_T,JSON.stringify({conversation:e,timestamp:i}),s);const l=yield this._engine.updateMessageReceiptStatus(n,o,i,a);return this.logger.summary(r.A_E_SET_MESSAGE_STATUS_TO_READ_R,l,s),l}))}setUserStatus(e){return t(this,void 0,void 0,(function*(){return this._engine.setUserStatus(e)}))}getUserStatus(e){return t(this,void 0,void 0,(function*(){return this._engine.getUserStatus(e)}))}searchConversationByContent(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=Ii.create("searchConversationByContent").isNotEmptyString("keyword",e,!0).fail(D.INVALID_PARAMETER_KEYWORD).isTypedArray("messageTypes",i,(e=>pt(e))).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).isTypedArray("conversationTypes",n,(e=>W(e,k))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).result().tryTrans(this.validateLogin);if(!t.isOk)return t.wipe();const o=this.logger.createTraceId();this.logger.info(r.A_E_SEARCH_CONVERSATION_BY_CONTENT_T,JSON.stringify({keyword:e,messageTypes:i,channelId:s,conversationTypes:n}),o);const a=yield this._engine.chat.searchConversationByContent(e,i&&0!==i.length?i:[Q.TEXT,Q.FILE],s||"",n&&0!==n.length?n:Y(k));return this.logger.summary(r.A_E_SEARCH_CONVERSATION_BY_CONTENT_R,a,o,void 0,(e=>({size:e.length}))),a}))}searchConversationByContentWithAllChannel(e,i,s){return t(this,void 0,void 0,(function*(){return this._engine.searchConversationByContentWithAllChannel(e,i&&0!==i.length?i:[Q.TEXT,Q.FILE],s&&0!==s.length?s:Y(k))}))}searchMessages(e,s){var n,r;return t(this,void 0,void 0,(function*(){const t=T_("searchMessages",e,F).isLimitedString("keyword",null==s?void 0:s.keyword,0,1e3,!0).fail(D.INVALID_PARAMETER_KEYWORD).isLimitedInteger("limit",null==s?void 0:s.limit,1,lt,!0).fail(D.INVALID_PARAMETER_LIMIT).isLimitedInteger("offset",null==s?void 0:s.offset,0,lt).fail(D.INVALID_PARAMETER_OFFSET).isLimitedInteger("order",null==s?void 0:s.order,0,1,!0).fail(D.INVALID_PARAMETER_ORDER).isObject("timeRange",s.timeRange).validate("timeRange",s.timeRange,(e=>{let{startTime:t,endTime:i}=e;return!t&&!i||!(t&&!Tt(t)||i&&!Tt(i))&&(t=null!=t?t:0,i=null!=i?i:Date.now(),t>=0&&t<=i)})).fail(D.INVALID_PARAMETER_TIMESTAMP).isTypedArray("objectNames",null===(n=null==s?void 0:s.messageFilter)||void 0===n?void 0:n.objectNames,(e=>"string"==typeof e&&e.length>0&&e.length<=128)).fail(D.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST).isTypedArray("senderIds",null===(r=null==s?void 0:s.messageFilter)||void 0===r?void 0:r.senderIds,Ut).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans((()=>wt()?gi():Ei(D.NOT_SUPPORT,"Only support electron platform."))).tryTrans(this.validateLogin);if(!t.isOk)return t.wipe();const o=i(this,Bf,"m",Yf).call(this,e);return(yield i(this,Bf,"m",Kf).call(this,Object.assign(Object.assign({},s),{conversationFilter:{conversationTypes:[o.conversationType],targetIds:[o.targetId],channelIds:"string"==typeof o.channelId?[o.channelId]:[]}}))).orSync((()=>gi({messages:[],totalMatched:0,conditionsMatched:0})))}))}searchMessagesWithParams(e){var s,n,r,o,a,l;return t(this,void 0,void 0,(function*(){const t=Ii.create("searchMessagesWithParams").isObject("params",e,!0).fail(D.BIZ_ERROR_INVALID_PARAMETER).isLimitedString("keyword",null==e?void 0:e.keyword,0,1e3).fail(D.INVALID_PARAMETER_KEYWORD).isLimitedInteger("limit",null==e?void 0:e.limit,1,lt,!0).fail(D.INVALID_PARAMETER_LIMIT).isLimitedInteger("offset",null==e?void 0:e.offset,0,lt).fail(D.INVALID_PARAMETER_OFFSET).isLimitedInteger("order",null==e?void 0:e.order,0,1,!0).fail(D.INVALID_PARAMETER_ORDER).isObject("timeRange",null==e?void 0:e.timeRange).validate("timeRange",null==e?void 0:e.timeRange,(e=>{let{startTime:t,endTime:i}=e;return!t&&!i||!(t&&!Tt(t)||i&&!Tt(i))&&(t=null!=t?t:0,i=null!=i?i:Date.now(),t>=0&&t<=i)})).fail(D.INVALID_PARAMETER_TIMESTAMP).isTypedArray("conversationTypes",null===(s=null==e?void 0:e.conversationFilter)||void 0===s?void 0:s.conversationTypes,(e=>W(e,F))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).isLimitedTypedArray("targetIds",null===(n=null==e?void 0:e.conversationFilter)||void 0===n?void 0:n.targetIds,20,Ut,!1,0).fail(D.INVALID_PARAMETER_TARGETID_LIST).isLimitedTypedArray("channelIds",null===(r=null==e?void 0:e.conversationFilter)||void 0===r?void 0:r.channelIds,10,bt,!1,0).fail(D.INVALID_PARAMETER_CHANNEL_ID).isLimitedTypedArray("senderIds",null===(o=null==e?void 0:e.messageFilter)||void 0===o?void 0:o.senderIds,20,Ut,!1,0).fail(D.INVALID_PARAMETER_USERIDLIST).isTypedArray("objectNames",null===(a=null==e?void 0:e.messageFilter)||void 0===a?void 0:a.objectNames,(e=>"string"==typeof e&&e.length>0&&e.length<=128)).fail(D.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST).result().tryTrans(this.validateLogin);return t.isOk?(e.limit=Math.min(e.limit,100),(null===(l=e.messageFilter)||void 0===l?void 0:l.objectNames)&&e.messageFilter.objectNames.length>300&&(e.messageFilter.objectNames=e.messageFilter.objectNames.slice(0,300)),i(this,Bf,"m",Kf).call(this,e)):t.wipe()}))}getMessagesAroundTimestamp(e,s,n,o){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_MSGS_AROUND_TIMESTAMP_T,JSON.stringify({conversation:e,timestamp:s,beforeCount:n,afterCount:o}),t);const a=yield Ii.create("getMessagesAroundTimestamp").check((t=>f_(t,e,F))).isLimitedInteger("timestamp",s,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("beforeCount",n,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_BEFORE).isLimitedInteger("afterCount",o,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_AFTER).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getMessagesAroundTimestamp(t,s,n,o)}));return this.logger.summary(r.A_GET_MSGS_AROUND_TIMESTAMP_R,a,t,void 0,(e=>({size:e.length}))),a}))}getUnreadMentionedMessages(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_MENTIONED_MSGS_T,JSON.stringify(e),t);const s=yield Ii.create("getUnreadMentionedMessages").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getUnreadMentionedMessages(t)}));return this.logger.summary(r.A_GET_UNREAD_MENTIONED_MSGS_R,s,t,void 0,(e=>({size:e.length}))),s}))}getUltraGroupDefaultNotificationLevel(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_UG_DEFAULT_NTF_LEVEL_T,JSON.stringify({targetId:e,channelId:i}),t);const s=yield Ii.create("getUltraGroupDefaultNotificationLevel").validate("targetId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("channelId",i,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateConnected).next((()=>{const t="string"==typeof i?this._channelIdConvert(w.ULTRA_GROUP,i):i;return this._engine.chat.getUGDefaultNotificationLevel(e,t)}));return this.logger.summary(r.A_GET_UG_DEFAULT_NTF_LEVEL_R,s,t),s}))}setUltraGroupDefaultNotificationLevel(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_UG_DEFAULT_NTF_LEVEL_T,JSON.stringify({targetId:e,notificationLevel:i,channelId:s}),t);const n=yield Ii.create("setUltraGroupDefaultNotificationLevel").validate("targetId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).isNumberEnum("notificationLevel",i,Ee,!0).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateConnected).next((()=>{const t="string"==typeof s?this._channelIdConvert(w.ULTRA_GROUP,s):s;return this._engine.chat.setUGDefaultNotificationLevel(e,i,t)}));return this.logger.summary(r.A_SET_UG_DEFAULT_NTF_LEVEL_R,n,t),n}))}getConversationNotificationLevel(e){return t(this,void 0,void 0,(function*(){const t=T_("getConversationNotificationLevel",e,k).result();return t.isOk?this._engine.chat.getConversationNotificationLevel(i(this,Bf,"m",Yf).call(this,e)):t.wipe()}))}setConversationTypeNotificationLevel(e,i){return t(this,void 0,void 0,(function*(){const t=Ii.create("setConversationTypeNotificationLevel").validate("conversationType",e,(()=>W(e,k)),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE).isNumberEnum("level",i,Ee,!0).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateConnected);return t.isOk?this._engine.chat.setConversationTypeNotificationLevel(e,i):t.wipe()}))}getConversationTypeNotificationLevel(e){return t(this,void 0,void 0,(function*(){const t=Ii.create("getConversationTypeNotificationLevel").validate("conversationType",e,(()=>W(e,k)),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE).result().tryTrans(this.validateConnected);return t.isOk?this._engine.chat.getConversationTypeNotificationLevel(e):t.wipe()}))}getRemoteHistoryMessages(e,s){return t(this,void 0,void 0,(function*(){const t=null==s?void 0:s.timestamp,n=null==s?void 0:s.count,o=null==s?void 0:s.order,a=this.logger.createTraceId();this.logger.info(r.A_GET_REMOTE_HISTORY_MSG_T,JSON.stringify({conversation:e,options:s}),a);const l=yield Ii.create("getRemoteHistoryMessages").check((t=>f_(t,e,x))).isLimitedInteger("timestamp",t,0,Number.MAX_SAFE_INTEGER).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("order",o,0,1).fail(D.INVALID_PARAMETER_ORDER).isLimitedInteger("count",n,1,100).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).next((()=>{const s={timestamp:t||0,count:n||20,order:o||0,messageType:""},r=i(this,Bf,"m",Yf).call(this,e);return this._engine.getHistoryMessage(r,s,!1)}));return this.logger.summary(r.A_GET_REMOTE_HISTORY_MSG_R,l,a,void 0,(({list:e})=>({size:e.length}))),l}))}clearLocalData(){return this.logger.info(r.A_CLEAR_LOCAL_CACHE_O),this._engine.clearLocalData()}createLogger(e,t){return this._engine.createLogger(e,t)}getConversations(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CONVERSATIONS_T,JSON.stringify({identifiers:e}),t);const s=yield Ii.create("getConversations").check((t=>{t.isLimitedTypedArray("identifiers",e,100,(e=>!f_(t,e,F).isFailed),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST)})).result().tryTrans(this.validateLogin).next((()=>{const t=e.map((e=>i(this,Bf,"m",Yf).call(this,e)));return this._engine.chat.getConversations(t)}));return this.logger.summary(r.A_GET_CONVERSATIONS_R,s,t,void 0,(e=>({size:e.length}))),s}))}setCheckDuplicateMessage(e){return this._engine.setCheckDuplicateMessage(!!e)}rtcSignaling(e,i,s,n){return t(this,void 0,void 0,(function*(){return yield this.validateConnected().next((()=>this._engine.rtcSignaling(e,i,s,n)))}))}rtcPing(e,t,i){return this._engine.rtcPing(e,t,i)}setProxy(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_PROXY_T,JSON.stringify({proxy:e}),t);const i=yield Ii.create("setProxy").check((t=>p_(t,e))).result().next((()=>this._engine.setProxy(e)));return this.logger.summary(r.A_SET_PROXY_R,i,t),i}))}getProxy(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_PROXY_T,JSON.stringify({}),e);const t=yield this._engine.getProxy();return this.logger.summary(r.A_GET_PROXY_R,t,e),t}))}testProxy(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_TEST_PROXY_T,JSON.stringify({proxy:e,testHost:i}),t);const s=yield Ii.create("testProxy").check((t=>p_(t,e))).isString("testHost",i,!0).fail(D.INVALID_PARAMETER_TESTHOST).result().next((()=>this._engine.testProxy(e,i)));return this.logger.summary(r.A_TEST_PROXY_R,s,t),s}))}getRealtimeConversations(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_REALTIME_CONVERSATIONS_T,JSON.stringify({count:e,startTime:i,order:s}),t);const n=yield Ii.create("getRealtimeConversations").isLimitedInteger("count",e,1,50,!0).fail(D.INVALID_PARAMETER_COUNT).isTimestamp("startTime",i,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("order",s,0,1,!0).fail(D.INVALID_PARAMETER_ORDER).result().tryTrans(this.validateConnected).tryTrans(P_).next((()=>this._engine.chat.getRealtimeConversations(e,i,s)));return this.logger.summary(r.A_GET_REALTIME_CONVERSATIONS_R,n,t,void 0,(e=>({size:e.length}))),n}))}getRealtimeConTotalUnreadCount(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_REALTIM_CON_TOTAL_UNREAD_COUNT_T,"",e);const t=yield this.validateConnected().tryTrans(P_).next((()=>this._engine.chat.getRealtimeConTotalUnreadCount()));return this.logger.summary(r.A_GET_REALTIM_CON_TOTAL_UNREAD_COUNT_R,t,e),t}))}clearRealtimeConUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CLEAR_REALTIME_CON_UNREAD_COUNT_T,JSON.stringify(e),t);const i=yield this.validateConnected().tryTrans(P_).next((()=>this._engine.chat.clearRealtimeConUnreadCount(e)));return this.logger.summary(r.A_CLEAR_REALTIME_CON_UNREAD_COUNT_R,i,t),i}))}removeRealtimeConversations(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_REALTIME_CONVERSATIONS_T,JSON.stringify(e),t);const i=yield Ii.create("removeRealtimeConversations").check((t=>{t.isLimitedTypedArray("identifiers",e,20,(e=>!f_(t,e,F).isFailed),!0).fail(D.INVALID_PARAMETER_CONVERSATION_LIST)})).result().tryTrans(this.validateConnected).tryTrans(P_).next((()=>this._engine.chat.removeRealtimeConversations(e)));return this.logger.summary(r.A_REMOVE_REALTIME_CONVERSATIONS_R,i,t),i}))}batchGetRealtimeConUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_GET_REALTIME_CON_UNREAD_COUNT_T,JSON.stringify(e),t);const i=yield Ii.create("batchGetRealtimeConUnreadCount").check((t=>{t.isLimitedTypedArray("identifiers",e,10,(e=>!f_(t,e,F).isFailed),!0).fail(D.INVALID_PARAMETER_CONVERSATION_LIST)})).result().tryTrans(this.validateConnected).tryTrans(P_).next((()=>this._engine.chat.batchGetRealtimeConUnreadCount(e)));return this.logger.summary(r.A_BATCH_GET_REALTIME_CON_UNREAD_COUNT_R,i,t,void 0,(e=>({size:e.length}))),i}))}setNotificationQuietHoursWithSetting(e){return Ii.create("setNotificationQuietHoursWithSetting").isObject("opts",e,!0).isString("timezone",e.timezone).fail(D.BIZ_ERROR_INVALID_PARAMETER).validate("startTime",e.startTime,(e=>/^\d{2}(:\d{2}){2}$/.test(e)),!0).fail(D.INVALID_PARAMETER_TIMESTRING).isLimitedNumber("spanMinutes",e.spanMinutes,1,1439,!0).fail(D.INVALID_PARAMETER_SPAN_MINUTES).isNumberEnum("level",e.level,ye,!0).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateConnected).next((()=>this._engine.setNotificationQuietHoursWithSetting(e)))}removeNotificationQuietHoursSetting(){return this.validateConnected().next((()=>this._engine.removeNotificationQuietHoursSetting()))}getNotificationQuietHoursSetting(){return this.validateConnected().next((()=>this._engine.getNotificationQuietHoursSetting()))}getStatsUrlList(){return this._engine.getStatsUrlList()}sendReadReceiptResponseV5(e,i){return t(this,void 0,void 0,(function*(){const t=T_("sendReadReceiptResponseV5",e,V).isTypedArray("messageUIdArray",i,(e=>Ut(e)),!0).fail(D.MSG_LIMIT_ERROR).isLimitedInteger("messageUIdArray",i.length,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).tryTrans((e=>4===e.grpRRVer?gi():Ei(D.READ_RECEIPT_ERROR)));return t.isOk?this._engine.chat.sendReadReceiptResponseV5(e,i):t.wipe()}))}getMessageReadReceiptInfoV5(e,i){return t(this,void 0,void 0,(function*(){const t=T_("getMessageReadReceiptInfoV5",e,V).isTypedArray("messageUIdArray",i,(e=>Ut(e)),!0).fail(D.MSG_LIMIT_ERROR).isLimitedInteger("messageUIdArray",i.length,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).tryTrans((e=>4===e.grpRRVer?gi():Ei(D.READ_RECEIPT_ERROR)));if(!t.isOk)return t.wipe();const s=i.map((t=>({identifier:e,messageUId:t})));return this._engine.chat.getMessageReadReceiptInfoV5ByIdentifiers(s)}))}getMessageReadReceiptInfoV5ByIdentifiers(e){return t(this,void 0,void 0,(function*(){const t=Ii.create(""),i=Ii.create("getMessageReadReceiptInfoV5ByIdentifiers").isTypedArray("identifiers",e,(e=>f_(t,e.identifier,V).isNotEmptyString("messageUId",e.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().isOk),!0).fail(D.MSG_LIMIT_ERROR).isLimitedInteger("messageUIdArray",e.length,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).tryTrans((e=>4===e.grpRRVer?gi():Ei(D.READ_RECEIPT_ERROR)));return i.isOk?this._engine.chat.getMessageReadReceiptInfoV5ByIdentifiers(e):i.wipe()}))}getMessagesReadReceiptUsersByPageV5(e,i,s){return t(this,void 0,void 0,(function*(){const t=T_("getMessageReadReceiptInfoV5",e,V).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isObject("option",s,!0).fail(D.BIZ_ERROR_INVALID_PARAMETER,"option type error").isString("pageToken",s.pageToken).fail(D.INVALID_PARAMETER_PAGING_QUERY_OPTION).isLimitedInteger("pageCount",s.pageCount,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).tryTrans((e=>4===e.grpRRVer?gi():Ei(D.READ_RECEIPT_ERROR)));return t.isOk?(s.order=1!==s.order?0:1,s.readStatus=1!==s.readStatus?0:1,this._engine.chat.getMessagesReadReceiptUsersByPageV5(e,i,s)):t.wipe()}))}getMessagesReadReceiptByUsersV5(e,i,s){return t(this,void 0,void 0,(function*(){const t=T_("getMessagesReadReceiptByUsersV5",e,V).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isTypedArray("userList",s,(e=>Ut(e)),!0).fail(D.INVALID_PARAMETER_USER_ID).isLimitedInteger("userList",s.length,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).tryTrans((e=>4===e.grpRRVer?gi():Ei(D.READ_RECEIPT_ERROR)));return t.isOk?this._engine.chat.getMessagesReadReceiptByUsersV5(e,i,s):t.wipe()}))}requestSpeechToTextForMessage(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REQUEST_SPEECH_TO_TEXT_FOR_MESSAGE_T,JSON.stringify({messageUId:e,option:i}),t);const s=yield Ii.create("requestSpeechToTextForMessage").isNotEmptyString("messageUId",e,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().tryTrans(this.validateConnected).tryTrans((e=>!!(1&(e.AIBusinessSub||0))?gi():Ei(D.SPEECH_TO_TEXT_DISABLE))).next((()=>this._engine.chat.requestSpeechToTextForMessage(e,i)));return this.logger.summary(r.A_REQUEST_SPEECH_TO_TEXT_FOR_MESSAGE_R,s,t),s}))}setMessageSpeechToTextVisible(e,i){return t(this,void 0,void 0,(function*(){return yield Ii.create("setMessageSpeechToTextVisible").isNumber("messageId",e,!0).fail(D.INVALID_PARAMETER_MESSAGE_ID).result().tryTrans(this.validateLogin).next((()=>this._engine.chat.setMessageSpeechToTextVisible(e,!!i)))}))}getUntaggedConversationListByPage(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_UNTAGGED_CONVERSATION_LIST_BY_PAGE_T,JSON.stringify({timestamp:e,count:i,topPriority:s}),t);const n=yield Ii.create("getUntaggedConversationListByPage").isLimitedInteger("timestamp",e,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).isInteger("count",i,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateLogin).next((()=>{const t=i<=0?20:Math.min(i,100);return this._engine.chat.getUntaggedConversationListByPage(e,t,!!s)}));return this.logger.summary(r.A_GET_UNTAGGED_CONVERSATION_LIST_BY_PAGE_R,n,t,void 0,(e=>({size:e.length}))),n}))}translateMessagesWithParams(e){var s;return t(this,void 0,void 0,(function*(){const t=wt(),n=yield Ii.create("translateMessagesWithParams").isTypedArray("list",null==e?void 0:e.list,(e=>e instanceof Os&&e.isValid(!t)),!0).fail(D.TRANSLATION_PARAMS_TYPE_INVALID).isLimitedInteger("list",null===(s=null==e?void 0:e.list)||void 0===s?void 0:s.length,1,10,!0).fail(D.TRANSLATION_PARAMS_LIST_INVALID).isNumberEnum("mode",null==e?void 0:e.mode,vs).fail(D.INVALID_PARAMETER_TRANSLATE_MODE).result().tryTrans(this.validateConnected);if(!n.isOk)return n.wipe();const{list:r,force:o,mode:a}=e;return i(this,Bf,"m",Qf).call(this,r,0,a,o)}))}translateTextsWithParams(e){var s;return t(this,void 0,void 0,(function*(){const t=yield Ii.create("translateTextsWithParams").isTypedArray("list",null==e?void 0:e.list,(e=>e instanceof ys&&e.isValid(!0)),!0).fail(D.TRANSLATION_PARAMS_TYPE_INVALID).isLimitedInteger("list",null===(s=null==e?void 0:e.list)||void 0===s?void 0:s.length,1,10,!0).fail(D.TRANSLATION_PARAMS_LIST_INVALID).isNumberEnum("mode",null==e?void 0:e.mode,vs).fail(D.INVALID_PARAMETER_TRANSLATE_MODE).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const{list:n,mode:r}=e;return i(this,Bf,"m",Qf).call(this,n,1,r)}))}setTranslationLanguage(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_TRANSLATION_LANGUAGE_T,JSON.stringify({language:e}),t);const i=yield Ii.create("setTranslationLanguage").isLimitedString("language",e,1,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_LAUGUAGE).result().tryTrans(this.validateConnected).next((()=>this._engine.userSettings.setTranslationLanguage(e)));return this.logger.summary(r.A_SET_TRANSLATION_LANGUAGE_R,i,t),i}))}getTranslationLanguage(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_TRANSLATION_LANGUAGE_T,void 0,e);const t=yield this.validateLogin().next((()=>this._engine.userSettings.getTranslationLanguage()));return this.logger.summary(r.A_GET_TRANSLATION_LANGUAGE_R,t,e),t}))}setAutoTranslateEnabled(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_AUTO_TRANSLATE_ENABLED_T,JSON.stringify({enabled:!!e}),t);const i=yield this.validateConnected().next((()=>this._engine.userSettings.setAutoTranslateEnabled(!!e)));return this.logger.summary(r.A_SET_AUTO_TRANSLATE_ENABLED_R,i,t),i}))}getAutoTranslateEnabled(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_AUTO_TRANSLATE_ENABLED_T,void 0,e);const t=yield this.validateLogin().next((()=>this._engine.userSettings.getAutoTranslateEnabled()));return this.logger.summary(r.A_GET_AUTO_TRANSLATE_ENABLED_R,t,e),t}))}modifyMessageWithParams(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),i=null==e?void 0:e.messageUId,s=null==e?void 0:e.messageContent;this.logger.info(r.A_MODIFY_MESSAGE_WITH_PARAMS_T,JSON.stringify({messageUId:i,conversation:null==e?void 0:e.conversation}),t);const n=yield Ii.create("modifyMessageWithParams").check((t=>f_(t,null==e?void 0:e.conversation,B))).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isObject("messageContent",s,!0).fail(D.INVALID_PARAMETER_MESSAGE_CONTENT).isLimitedInteger("messageContent",m_(JSON.stringify(s)),1,Fe,!0).fail(D.RC_MSG_CONTENT_EXCEED_LIMIT).result().tryTrans(this.validateConnected).next((()=>this._engine.chat.modifyMessageWithParams(e)));return this.logger.summary(r.A_MODIFY_MESSAGE_WITH_PARAMS_R,n,t),n}))}refreshReferenceMessageWithParams(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),i=null==e?void 0:e.messageUIds;this.logger.info(r.A_REFRESH_REFERENCE_MESSAGE_WITH_PARAMS_T,JSON.stringify({messageUIds:i}),t);const s=yield T_("refreshReferenceMessageWithParams",null==e?void 0:e.conversationIdentifier,B).isObject("params",e,!0).fail(D.BIZ_ERROR_INVALID_PARAMETER).isTypedArray("messageUIds",i,(e=>pt(e)),!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("messageUIds",null==i?void 0:i.length,1,20,!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateConnected).next((()=>this._engine.chat.refreshReferenceMessageWithParams(i,e.conversationIdentifier,e.remoteMessageBlock,e.localMessageBlock,e.messageInfoMap)));return this.logger.summary(r.A_REFRESH_REFERENCE_MESSAGE_WITH_PARAMS_R,s,t),s}))}syncRemoteConversations(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_SYNC_REMOTE_CONVERSATIONS_T,void 0,e);const t=yield this.validateConnected().next((()=>this._engine.chat.syncRemoteConversations()));return this.logger.summary(r.A_SYNC_REMOTE_CONVERSATIONS_R,t,e),t}))}deleteLocalUGMessagesForAllChannel(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DEL_LOCAL_UG_MSGS_FOR_ALL_CHANNEL_T,JSON.stringify({targetId:e,timestamp:i}),t);const s=yield Ii.create("deleteLocalUGMessagesForAllChannel").isNotEmptyString("targetId",e,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isTimestamp("timestamp",i,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateLogin).next((()=>this._engine.chat.deleteLocalUGMessagesForAllChannel(e,i)));return this.logger.summary(r.A_DEL_LOCAL_UG_MSGS_FOR_ALL_CHANNEL_R,s,t),s}))}getUnreadMentionMeConversationList(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_MENTION_ME_CONVERSATION_LIST_T,JSON.stringify({params:e}),i);const s=yield Ii.create("getUnreadMentionMeConversationList").isLimitedTypedArray("conversationTypes",null==e?void 0:e.conversationTypes,Number.MAX_SAFE_INTEGER,(e=>W(e,k)),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).isTimestamp("timestamp",null==e?void 0:e.timestamp,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("count",null==e?void 0:e.count,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).next((i=>t(this,void 0,void 0,(function*(){const t=jI(i);if(t){if(!this._engine.chat.ugSynced)return Ei(D.METHOD_NOT_AVAILABLE)}else if(e.conversationTypes=e.conversationTypes.filter((e=>e!==w.ULTRA_GROUP)),0===e.conversationTypes.length)return gi([]);return this._engine.chat.getUnreadMentionMeConversationList(e,t)}))));return this.logger.summary(r.A_GET_UNREAD_MENTION_ME_CONVERSATION_LIST_R,s,i,void 0,(e=>({size:e.length}))),s}))}getAllRobots(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_ALL_ROBOTS_T,void 0,e);const t=yield this.validateConnected().next((()=>this._engine.getAllRobots()));return this.logger.summary(r.A_GET_ALL_ROBOTS_R,t,e,void 0,(e=>({size:e.length}))),t}))}getRobotById(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_ROBOT_BY_ID_T,JSON.stringify({id:e}),i);const s=yield Ii.create("getRobotById").validate("id",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).result().tryTrans(this.validateConnected).next((()=>t(this,void 0,void 0,(function*(){return this._engine.getAllRobots()})))),n=s.trans((t=>t.find((t=>t.robotId===e))||null));return this.logger.summary(r.A_GET_ROBOT_BY_ID_R,s,i,{id:e,robot:n.data}),n}))}getMessagesByUIds(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_MESSAGES_T,JSON.stringify({conversation:e,messageUIds:i}),t);const s=yield Ii.create("getMessages").check((t=>f_(t,e,k))).isTypedArray("messageUIds",i,pt,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("messageUIds",null==i?void 0:i.length,1,20,!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateConnected).next((()=>{const t=Array.from(new Set(i));return this._engine.getMessagesByUIds(e,t)}));return this.logger.summary(r.A_GET_MESSAGES_R,s,t,void 0,(e=>{const t=Array.from(new Set(i)).filter((t=>!e.some((e=>e.messageUId===t))));return{size:e.length,missingMessageUIds:t}})),s}))}}Bf=new WeakSet,Hf=function(e,i,s){return t(this,void 0,void 0,(function*(){const n=yield Ii.create("connect").isNotEmptyString("token",e).fail(D.RC_CONN_TOKEN_INCORRECT).result().next((()=>t(this,void 0,void 0,(function*(){this._token=e;const t=yield Eo.getNetworkType();this._engine.setNetwork({status:!0,type:t},!0);const n=!!this._pluginInstanseMap.RCCallPlus;return this._engine.connect(e,i,n,s)}))));if(n.isOk){if(1!==this._engine.naviInfo.type){const e=dt.getInfo();this._engine.reportSDKInfo(e)}}return n}))},jf=function(e,i){return t(this,void 0,void 0,(function*(){return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},yield this._engine.disconnect(e,i),this._pluginContextQueue.forEach((e=>{if(e.ondisconnect)try{e.ondisconnect()}catch(e){this.logger.error(r.L_CALLBACK_E,null==e?void 0:e.stack)}})),Promise.resolve()}))},Yf=function(e){return Object.assign(Object.assign({},e),{channelId:this._channelIdConvert(e.conversationType,e.channelId)})},Wf=function(e,s,n,r){return t(this,void 0,void 0,(function*(){return yield Ii.create("sendMessage").check((t=>f_(t,e,F))).isObject("content",s.content,!0).fail(D.INVALID_PARAMETER_MESSAGE_CONTENT).check((e=>{const t=I_(s.messageType,s.content);t.isOk||e.setFailed(t.code)})).isNumber("messageId",s.messageId).fail(D.INVALID_PARAMETER_MESSAGE_ID).isBoolean("isStatusMessage",s.isStatusMessage).fail(D.INVALID_PARAMETER_IS_STATUS_MESSAGE).isBoolean("disableNotification",s.disableNotification).fail(D.INVALID_PARAMETER_DISABLE_NOTIFICATION).isString("pushContent",s.pushContent).fail(D.INVALID_PARAMETER_PUSH_CONTENT).isString("pushData",s.pushData).fail(D.INVALID_PARAMETER_PUSH_DATA).isObject("pushConfig",s.pushConfig).fail(D.INVALID_PARAMETER_PUSH_CONFIG).isBoolean("isVoipPush",s.isVoipPush).fail(D.INVALID_PARAMETER_IS_VOIP_PUSH).isBoolean("canIncludeExpansion",s.canIncludeExpansion).fail(D.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION).check((e=>{s.canIncludeExpansion&&s.expansion&&A_(e,s.expansion,!0)})).check((t=>{t.isBoolean("disableUpdateLastMessage",s.disableUpdateLastMessage).fail(D.INVALID_DISABLE_UPDATE_LAST_MESSAGE),t.isFailed||e.conversationType===w.ULTRA_GROUP&&s.disableUpdateLastMessage&&t.setFailed(D.INVALID_DISABLE_UPDATE_LAST_MESSAGE)})).check((t=>{if(!!t.isLimitedTypedArray("directionalUserIdList",s.directionalUserIdList,300,Ut,!1,0).fail(D.INVALID_PARAMETER_USERIDLIST).isFailed||!s.directionalUserIdList||0===s.directionalUserIdList.length)return;const{conversationType:i}=e;[w.GROUP,w.ULTRA_GROUP,w.APP_PUBLIC_SERVICE,w.PUBLIC_SERVICE].includes(i)||t.setFailed(D.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE)})).isBoolean("isMentioned",s.isMentioned).fail(D.INVALID_PARAMETER_IS_MENTIONED).check((e=>{if(!s.isMentioned)return void delete s.content.mentionedInfo;const t=s.content.mentionedInfo||{type:s.mentionedType,userIdList:s.mentionedUserIdList};!e.isNumberEnum("mentionedType",null==t?void 0:t.type,K,!0).fail(D.INVALID_PARAMETER_MENTIONED_TYPE).isTypedArray("mentionedUserIdList",null==t?void 0:t.userIdList,Ut,(null==t?void 0:t.type)===K.SINGAL).fail(D.INVALID_PARAMETER_USERIDLIST).isString("mentionedContent",null==t?void 0:t.mentionedContent).fail(D.INVALID_PARAMETER_MESSAGE_CONTENT).isFailed&&(s.content.mentionedInfo=t)})).check((e=>{const{quoteInfo:t}=s;t&&e.isObject("quoteInfo",t,!0).isNotEmptyString("quoteInfo.messageUId",t.messageUId,!0).isNotEmptyString("quoteInfo.senderId",t.senderId,!0).isNotEmptyString("quoteInfo.objectName",t.objectName,!0).isNumberEnum("quoteInfo.quoteMessageStatus",t.quoteMessageStatus,Pe).fail(D.INVALID_PARAMETER_QUOTE_INFO)})).result().tryTrans(this.validateConnected).tryTrans((t=>{if(!s.needReceipt)return gi(t);if(t.grpRRVer!==Ue.V5)return Ei(D.READ_RECEIPT_ERROR);const{conversationType:i}=e,{isPersited:n,isStatusMessage:r}=ms(s.messageType);return(i!==w.GROUP&&i!==w.PRIVATE||s.isStatusMessage||r||!n||i===w.GROUP&&s.directionalUserIdList&&s.directionalUserIdList.length>0)&&(s.needReceipt=!1),gi(t)})).tryTrans((t=>{const{conversationType:i}=e,{messageType:n}=s;if(i===w.SYSTEM&&n!==Q.SYNC_READ_STATUS)return Ei(D.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE);if(n===Q.STREAM_MESSAGE)return Ei(D.MESSAGE_NOT_SUPPORT_SENDING);if(n===Q.READ_RECEIPT_RESPONSE&&t.grpRRVer)return Ei(D.READ_RECEIPT_ERROR);const r=m_(JSON.stringify(s.content));if(r>Fe)return Ei(D.RC_MSG_CONTENT_EXCEED_LIMIT);const o=[Q.VOICE,Q.IMAGE,Q.LOCATION,Q.REFERENCE,Q.SIGHT,Q.COMBINE,Q.COMBINE_V2,Q.STREAM_MESSAGE],a=t.msgMaxLengthV2||0;return a&&!o.includes(n)&&r>a?Ei(D.RC_MSG_CONTENT_EXCEED_LIMIT):gi()})).next((()=>i(this,Bf,"m",qf).call(this,e,s,n,r)))}))},qf=function(e,t,s,n){const r=i(this,Bf,"m",Yf).call(this,e),{conversationType:o}=r;return o===w.ULTRA_GROUP?this._engine.sendUltraMessage(r,t,s,n):this._engine.sendMessage(r,t,s,n)},Jf=function(e,i,s){return t(this,void 0,void 0,(function*(){return(yield this._engine.sendMessage(e,{content:i,messageType:Q.EXPANSION_NOTIFY},s)).wipe()}))},Kf=function(e){return t(this,void 0,void 0,(function*(){const{startTime:t,endTime:i}=e.timeRange||{},s={startTime:null!=t?t:0,endTime:null!=i?i:Number.MAX_SAFE_INTEGER};e.timeRange=s;const n=this.logger.createTraceId();this.logger.info(r.A_SEARCH_MSGS_BY_PARAMS_T,JSON.stringify(e),n);const o=yield this._engine.searchMessagesWithParams(e);return this.logger.summary(r.A_SEARCH_MSGS_BY_PARAMS_R,o,n,void 0,(({messages:e})=>({size:e.length}))),o}))},Qf=function(e,i,s,n){return t(this,void 0,void 0,(function*(){return this._engine.translateWithParams(e.map((e=>e.toInnerParam())),s||vs.MECHANICAL,!!n,i)}))};export{zf as APIContext,xi as AreaCode,l_ as AssertRules,Ns as BaseTranslateParam,Wi as BasicLogger,C as ChatroomEntryType,b as ChatroomSyncStatusReason,L as ChatroomUserChangeType,U as ChrmMemBanType,P as ChrmMemOperateType,M as ChrmSyncStatus,Kc as Codec,wc as ConnectionStatus,w as ConversationType,we as ConversationUnreadCountFilter,o as DirectionType,D as ErrorCode,Hc as EventEmitter,J as FileType,Ce as FilterRobotType,l as FriendAddPermission,d as FriendApplicationStatus,_ as FriendApplicationType,c as FriendRelationType,y as GroupApplicationDirection,m as GroupApplicationStatus,O as GroupApplicationType,T as GroupInviteHandlePermission,g as GroupJoinPermission,I as GroupMemberInfoEditPermission,f as GroupMemberRole,R as GroupOperation,E as GroupOperationPermission,v as GroupOperationRole,S as GroupOperationStatus,p as GroupOperationType,Ue as GroupReadReceiptVersion,Ve as HttpMethod,Oe as InterruptionLevel,rs as LogDBProxy,Yi as LogL,Pc as LogLevel,Dc as LogSource,r as LogTagId,Fe as MAX_MESSAGE_CONTENT_BYTES,lt as MAX_U32_INTEGER,He as MAX_UPLOAD_FILE_SIZE,K as MentionedType,Me as MessageAuditType,de as MessageBlockSourceType,_e as MessageBlockType,ue as MessageDirection,Gi as MessageModifyStatus,De as MessageReactionOperationType,Q as MessageType,Ee as NotificationLevel,Ie as NotificationStatus,ne as OnlineStatus,se as OperateStatus,vc as PBCodec,re as Platform,__ as PluginContext,he as PushImportanceHonor,ye as PushNotificationQuietHoursLevel,a as QueryFriendsDirectionType,Pe as QuoteMessageStatus,ce as RCConnectionStatus,hi as RCResult,xc as RTCApiType,Bc as RTCJoinType,Gc as RTCMode,d_ as RTCPluginContext,Re as ReceivedStatus,Vi as ReferenceMessageStatus,ie as SentStatus,be as SpeechToTextStatus,zc as StreamMessageResponseEventType,ae as SubscribeOperationType,oe as SubscribeType,ui as SuspendablePromise,Os as TranslateMessageParam,vs as TranslateMode,Cs as TranslateStatus,Ms as TranslateStrategy,ys as TranslateTextParam,je as UPLOAD_FILE_CHUNK_SIZE,ut as UUId,z as UltraGroupChannelChangeType,X as UltraGroupChannelType,n as UploadMethod,le as UserProfileVisibility,ki as UserSettingsChangedKey,Le as UserType,Ii as Validator,dt as VersionManage,g_ as assert,os as createLogDBProxy,Ei as fail,ni as fixUrlProtocol,jc as forEach,ms as getMessageTypeDescription,qc as getUUID,Jc as getUUID22,Ss as hasMessageTypeDescription,Di as httpRequest,Rt as isArray,It as isBoolean,vt as isFunction,Ot as isHttpUrl,ft as isInteger,At as isLimitedString,Wc as isNull,Tt as isNumber,St as isObject,Et as isString,Nt as isUndefined,Ct as isValidConversationType,Lt as isValidEnum,Dt as isValidFileType,Pt as isValidGroupId,Ut as isValidTargetId,Yc as map,mt as notEmptyArray,yt as notEmptyObject,pt as notEmptyString,gi as ok,Ri as promiseWithResolvers,Eo as runtime,Gt as trans2IReceivedStatusInfo,Te as trans2NotificationLevel,fe as trans2NotificationStatus,Vt as transformReceivedStatusFlag,wt as usingCppEngine,E_ as validate};
|
|
15
|
+
function e(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(e);n<s.length;n++)t.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(i[s[n]]=e[s[n]])}return i}function t(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{l(s.next(e))}catch(e){r(e)}}function a(e){try{l(s.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))}function i(e,t,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(e):s?s.value:t.get(e)}function s(e,t,i,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,i):n?n.value=i:t.set(e,i),i}var n;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC",e[e.MINIO=5]="MINIO"}(n||(n={}));const r={L_IMSDK_VER_O:"L-imsdk_ver-O",A_INIT_REPEAT_O:"A_INIT_REPEAT_O",L_INIT_O:"L-init-O",A_DESTROY_O:"A_DESTROY_O",A_CONNECT_T:"A-connect-T",A_CONNECT_R:"A-connect-R",A_CONNECT_S:"A-connect-S",L_QUERY_CMP_T:"L-query_cmp-T",L_QUERY_CMP_R:"L-query_cmp-R",A_DISCONNECT_O:"A-disconnect-O",A_RECONNECT_T:"A-reconnect-T",A_RECONNECT_R:"A_RECONNECT_R",L_CONNECT_T:"L-connect-T",L_CONNECT_O:"L-connect-O",L_CONNECT_R:"L-connect-R",L_CONNECT_S:"L-connect-S",L_DB_UPGRATE_START_S:"L-db_upgrate_start-S",L_DB_UPGRATING_S:"L-db_upgrating-S",L_DB_UPGRATE_COMPLETE_S:"L-db_upgrate_complete-S",L_NOTIFY_ULTRA_ONLINE_S:"L-notify-ultra-online-S",L_ULTRA_SYNC_DONE_S:"L-ultra-sync-done-S",L_BATCH_MESSAGE_O:"L-BATCH_MESSAGE-O",A_MSG_LISTENER_E:"A-MSG_LISTENER-E",O:"L-original-O",T:"L-TEST-O",L_INSTALL_PLUGIN_T:"L-INSTALL_PLUGIN-T",L_INSTALL_PLUGIN_R:"L-INSTALL_PLUGIN-R",L_NAVI_CONF_E:"L-NAVI_CONF_ERROR-E",L_NAVI_CMP_R:"L-NAVI_CPM-R",A_SEND_MSG_T:"A-send_msg-T",A_SEND_MSG_R:"A-send_msg-R",L_SEND_MSG_T:"L-send_msg-T",L_SEND_MSG_R:"L-send_msg-R",A_SEND_TYPING_STATUS_T:"A-send_typing_status-T",A_SEND_TYPING_STATUS_R:"A-send_typing_status-R",A_SEND_READ_RECEIPT_REQ_T:"A-send_read_receipt_req-T",A_SEND_READ_RECEIPT_REQ_R:"A-send_read_receipt_req-R",L_PULL_MSG_T:"L-pull_msg-T",L_PULL_MSG_R:"L-pull_msg-R",L_PULL_MSG_E:"L-pull_msg-E",L_PULL_MSG_O:"L-pull_msg-O",L_PULL_ULTRA_MSG_T:"L-pull_ultra_msg-T",L_PULL_ULTRA_MSG_R:"L-pull_ultra_msg-R",L_PULL_UG_RELATIONS_T:"L-pull_ug_relations-T",L_PULL_UG_RELATIONS_R:"L-pull_ug_relations-R",L_PULL_CHATROOM_KV_T:"L-pull_chatroom_kv-T",L_PULL_CHATROOM_KV_R:"L-pull_chatroom_kv-R",L_PULL_CHATROOM_MSG_T:"L-pull_chatroom_msg-T",L_PULL_CHATROOM_MSG_R:"L-pull_chatroom_msg-R",L_RECV_MULTI_SYNC_MSG_O:"L-recv_multi_sync_msg-O",L_RECV_S_MSG_O:"L-recv_s_msg-O",A_DELETE_LOCAL_MSGS_T:"A-delete_local_msgs-T",A_DELETE_LOCAL_MSGS_R:"A-delete_local_msgs-R",A_RECALL_MESSAGE_T:"A-recall_msg-T",A_RECALL_MESSAGE_R:"A-recall_msg-R",A_RECALL_MESSAGE_E:"A-recall_msg-E",A_REGTYP_O:"A-regtyp-O",P_REGTYP_E:"P-regtype-E",L_GET_NAVI_T:"L-get_navi-T",L_GET_NAVI_R:"L-get_navi-R",L_REQUEST_T:"L-request-T",L_REQUEST_R:"L-request-R",L_PARSE_NAVI_E:"L-parse_navi-E",L_ENV_S:"L-Env-S",L_GET_INDEX_NAVI_S:"L-get_index_navi-S",A_JOIN_CHATROOM_T:"A-join_chatroom-T",A_JOIN_CHATROOM_R:"A-join_chatroom-R",L_REJOIN_CHATROOM_T:"L-rejoin_chatroom-T",L_REJOIN_CHATROOM_R:"L-rejoin_chatroom-R",A_QUIT_CHATROOM_T:"A-quit_chatroom-T",A_QUIT_CHATROOM_R:"A-quit_chatroom-R",A_GET_CHATROOM_INFO_T:"A-get_chatroom_info-T",A_GET_CHATROOM_INFO_R:"A-get_chatroom_info-R",A_SET_CHATROOM_ENTRY_T:"A-set_chatroom_entry-T",A_SET_CHATROOM_ENTRY_R:"A-set_chatroom_entry-R",A_SET_CHATROOM_ENTRIES_T:"A-set_chatroom_entries-T",A_SET_CHATROOM_ENTRIES_R:"A-set_chatroom_entries-R",A_REMOVE_CHATROOM_ENTRY_T:"A-remove_chatroom_entry-T",A_REMOVE_CHATROOM_ENTRY_R:"A-remove_chatroom_entry-R",A_REMOVE_CHATROOM_ENTRIES_T:"A-remove_chatroom_entries-T",A_REMOVE_CHATROOM_ENTRIES_R:"A-remove_chatroom_entries-R",A_GET_CHATROOM_ENTRY_T:"A-get_chatroom_entry-T",A_GET_CHATROOM_ENTRY_R:"A-get_chatroom_entry-R",A_GET_CHATROOM_ENTRIES_T:"A-get_chatroom_entries-T",A_GET_CHATROOM_ENTRIES_R:"A-get_chatroom_entries-R",A_BIND_RTC_FOR_CHATROOM_T:"A-bind_rtc_for_chatroom-T",A_BIND_RTC_FOR_CHATROOM_R:"A-bind_rtc_for_chatroom-R",L_MEDIA_S:"L-media-S",L_MEDIA_UPLOAD_T:"L-media_upload-T",L_MEDIA_UPLOAD_R:"L-media_upload-R",G_UPLOAD_LOG_S:"G-upload_log-S",G_REPORT_LOG_S:"G-report_log-S",G_UPLOAD_LOG_E:"G-upload_log-E",G_GET_REAL_TIMELOG_COMMAND_S:"G-get_real_timelog_command-S",L_CHECK_ALIVE_IM_T:"L-check_alive_im-T",L_CHECK_ALIVE_IM_R:"L-check_alive_im-R",L_CHECK_ALIVE_IM_S:"L-check_alive_im-S",A_GET_LOCAL_MESSAGE_T:"A-get_local_message-T",A_GET_LOCAL_MESSAGE_R:"A-get_local_message-R",A_GET_HISTORY_MSG_T:"A-get_history_msg-T",A_GET_HISTORY_MSG_R:"A-get_history_msg-R",A_GET_REMOTE_HISTORY_MSG_T:"A-get_remote_history_msg-T",A_GET_REMOTE_HISTORY_MSG_R:"A-get_remote_history_msg-R",L_CALLBACK_E:"L-callback-E",A_SEND_READ_RECEIPT_T:"A-send_read_receipt-T",A_SEND_READ_RECEIPT_R:"A-send_read_receipt-R",A_SEND_READ_RECEIPT_V2_T:"A-send_read_receipt_v2-T",A_SEND_READ_RECEIPT_V2_R:"A-send_read_receipt_v2-R",A_SYNC_READ_STATUS_T:"A-sync_read_status-T",A_SYNC_READ_STATUS_R:"A-sync_read_status-R",L_PB_ENCODE_E:"L-pb-encode-E",L_PB_DECODE_E:"L-pb-decode-E",L_NOTIFY_NAVI_CHANGE_E:"L-notify_navi_change-E",L_REPORT_FULL_LOG_O:"L-report_full_log-O",L_REPORT_FULL_LOG_T:"L-report_full_log-T",L_REPORT_FULL_LOG_R:"L-report_full_log-R",L_REPORT_LOG_POLICY_E:"L-parse_navi_logpolicy-E",L_UNSUPPORT_INDEXDB_O:"L-unsupport_IndexDB-O",L_LOGDB_OPEN_FAILED_E:"L-logDB_open_failed-E",L_LOGDB_CLOSED_S:"L-logDB_closed-S",L_LOGDB_ERROR_E:"L-logDB_error-S",L_LOGDB_ABORT_S:"L-logDB_abort-S",L_REALTIME_LOG_T:"L_REALTIME_LOG_T",L_REALTIME_LOG_R:"L_REALTIME_LOG_R",L_REALTIME_LOG_O:"L_REALTIME_LOG_O",L_SEND_RMTP_E:"L-send-rmtp-E",L_RECV_RMTP_O:"L-recv-rmtp-O",L_RECV_RMTP_E:"L-recv-rmtp-E",L_RECV_S_NTF_O:"L-recv_s_ntf_O",L_RECV_S_CMD_O:"L-recv_s_cmd_O",L_VER_REPORT_T:"L-VER_REPORT-T",L_VER_REPORT_R:"L-VER_REPORT-R",L_UNSUPPORT_NTF_FROM_MAIN_E:"L_UNSUPPORT_NTF_FROM_MAIN_E",A_REMOVE_PROXY_O:"A-remove_proxy-O",L_SET_PROXY_O:"L-set_proxy-O",L_TEST_PROXY_T:"L-test_proxy-T",L_TEST_PROXY_R:"L-test_proxy-R",L_WS_DISACCORD_E:"L-ws_disaccord-E",L_GET_STATIC_CONF_T:"L-get_static_conf-T",L_GET_STATIC_CONF_R:"L-get_static_conf-R",L_GET_STATIC_CONF_E:"L-get_static_conf-E",L_CLOUD_DISABLED:"L-cloud_disabled",L_CLOUD_OVERCLOCK:"L-cloud_overclock",L_CLOUD_APPKEY_REGION_E:"L-cloud_appkey_region_error",L_CLOUD_CONFIG_DATA_E:"L-cloud_config_data_error",L_CLOUD_SET_AREA_CODE_O:"L-cloud_set_area_code-O",L_CLOUD_SET_MRTR_O:"L-cloud_set_mrtr-O",L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S:"L-sync_subscribed_user_status_finished-S",L_PULL_SUBSCRIBED_USER_RELATION_T:"L-pull_subscribed_user_relation-T",L_PULL_SUBSCRIBED_USER_RELATION_R:"L-pull_subscribed_user_relation-R",L_PULL_SUBSCRIBED_USER_STATUS_T:"L-pull_subscribed_user_status-T",L_PULL_SUBSCRIBED_USER_STATUS_R:"L-pull_subscribed_user_status-R",L_OWN_USER_PROFILE_CHANGED_S:"L-own_user_profile_changed-S",L_QUERY_SUBSCRIBE_DATA_T:"L-query_subscribe_data-T",L_QUERY_SUBSCRIBE_DATA_R:"L-query_subscribe_data-R",L_PULL_USER_PROFILE_T:"L-pull_user_profile-T",L_PULL_USER_PROFILE_R:"L-pull_user_profile-R",L_PULL_OWN_PROFILE_T:"L-pull_own_profile-T",L_PULL_OWN_PROFILE_R:"L-pull_own_profile-R",L_QUERY_FRIEND_LIST_T:"L-query_friend_list-T",L_QUERY_FRIEND_LIST_R:"L-query_friend_list-R",L_PULL_USER_PROFILE_REQ_T:"L-pull_user_profile_req-T",L_PULL_USER_PROFILE_REQ_R:"L-pull_user_profile_req-R",L_SERVER_EVENT_NOTIFY_ONLINE_T:"L-server_event_notify_online-T",L_SERVER_EVENT_NOTIFY_ONLINE_R:"L-server_event_notify_online-R",L_PULL_EVENT_CHANGE_T:"L-pull_event_change-T",L_PULL_EVENT_CHANGE_R:"L-pull_event_change-R",L_PARSE_JSON_E:"L-parse_json-E",L_REQ_STREAM_MSG_CONTENT_T:"L-req_stream_msg_content-T",L_REQ_STREAM_MSG_CONTENT_R:"L-req_stream_msg_content-R",L_REQ_STREAM_MSG_CONTENT_O:"L-req_stream_msg_content-O",L_REQ_STREAM_MSG_CONTENT_E:"L-req_stream_msg_content-E",L_PULL_CONVERSATION_SETTINGS_T:"L-pull_conversation_settings-T",L_PULL_CONVERSATION_SETTINGS_R:"L-pull_conversation_settings-R",L_PULL_SG_RELATIONS_T:"L-pull_sg_relations-T",L_PULL_SG_RELATIONS_R:"L-pull_sg_relations-R",A_REMOVE_CONVERSATION_T:"A-remove_conversation-T",A_REMOVE_CONVERSATION_R:"A-remove_conversation-R",A_GET_CONVERSATION_T:"A-get_conversation-T",A_GET_CONVERSATION_R:"A-get_conversation-R",A_BATCH_SET_CONVERSATION_TO_TOP_T:"A-batch_set_conversation_to_top-T",A_BATCH_SET_CONVERSATION_TO_TOP_R:"A-batch_set_conversation_to_top-R",A_BATCH_SET_CONVERSATION_NOTIFICATION_LEVEL_T:"A-batch_set_convers_notification_level-T",A_BATCH_SET_CONVERSATION_NOTIFICATION_LEVEL_R:"A-batch_set_convers_notification_level-R",A_BATCH_SET_CONVERSATION_TRANSLATE_STRATEGY_T:"A-batch_set_convers_translate_strategy-T",A_BATCH_SET_CONVERSATION_TRANSLATE_STRATEGY_R:"A-batch_set_convers_translate_strategy-R",A_DELETE_REMOTE_MESSAGE_BY_TIMESTAMP_T:"A-delete_remote_message_by_timestamp-T",A_DELETE_REMOTE_MESSAGE_BY_TIMESTAMP_R:"A-delete_remote_message_by_timestamp-R",A_DEL_REMOTE_MSGS_T:"A-del_remote_msgs-T",A_DEL_REMOTE_MSGS_R:"A-del_remote_msgs-R",A_BATCH_CLEAR_REMOTE_MSG_T:"A-batch_clear_remote_msg-T",A_BATCH_CLEAR_REMOTE_MSG_R:"A-batch_clear_remote_msg-R",L_EVENT_LOOP_BLOCKING_S:"L-event_loop_blocking-S",A_E_SEARCH_CONVERSATION_BY_CONTENT_T:"A-e_search_conversation_by_content-T",A_E_SEARCH_CONVERSATION_BY_CONTENT_R:"A-e_search_conversation_by_content-R",A_LOAD_CONVERSATION_LIST_T:"A-load_conversation_list-T",A_LOAD_CONVERSATION_LIST_R:"A-load_conversation_list-R",P_GET_SYS_VERSION_E:"P-get_sys_version-E",A_CLEAR_LOCAL_CACHE_O:"A-clear_local_cache-O",A_E_SET_MESSAGE_STATUS_TO_READ_T:"A-e_set_message_status_to_read-T",A_E_SET_MESSAGE_STATUS_TO_READ_R:"A-e_set_message_status_to_read-R",A_SEARCH_MSGS_BY_PARAMS_T:"A-search_msgs_by_params-T",A_SEARCH_MSGS_BY_PARAMS_R:"A-search_msgs_by_params-R",A_GET_CHATROOM_HISTORY_MESSAGES_T:"A-get_chatroom_history_messages-T",A_GET_CHATROOM_HISTORY_MESSAGES_R:"A-get_chatroom_history_messages-R",A_REQUEST_SPEECH_TO_TEXT_FOR_MESSAGE_T:"A-request_speech_to_text_for_message-T",A_REQUEST_SPEECH_TO_TEXT_FOR_MESSAGE_R:"A-request_speech_to_text_for_message-R",L_SYNC_USER_SETTINGS_T:"L-sync_user_settings-T",L_SYNC_USER_SETTINGS_R:"L-sync_user_settings-R",A_ADD_TAG_T:"A-add_tag-T",A_ADD_TAG_R:"A-add_tag-R",A_REMOVE_TAG_T:"A-remove_tag-T",A_REMOVE_TAG_R:"A-remove_tag-R",A_UPDATE_TAG_T:"A-update_tag-T",A_UPDATE_TAG_R:"A-update_tag-R",A_GET_TAGS_T:"A-get_tags-T",A_GET_TAGS_R:"A-get_tags-R",A_ADD_TAG_FOR_CONVERSATIONS_T:"A-add_tag_for_conversations-T",A_ADD_TAG_FOR_CONVERSATIONS_R:"A-add_tag_for_conversations-R",A_GET_TAGS_OF_CONVERSATION_T:"A-get_tags_of_conversation-T",A_GET_TAGS_OF_CONVERSATION_R:"A-get_tags_of_conversation-R",A_SET_CONVER_TO_TOP_IN_TAG_T:"A-set_conver_to_top_in_tag-T",A_SET_CONVER_TO_TOP_IN_TAG_R:"A-set_conver_to_top_in_tag-R",A_REMOVE_TAG_FOR_CONVERS_T:"A-remove_tag_for_conversations-T",A_REMOVE_TAG_FOR_CONVERS_R:"A-remove_tag_for_conversations-R",A_REMOVE_TAGS_FOR_CONVER_T:"A-remove_tags_for_conversation-T",A_REMOVE_TAGS_FOR_CONVER_R:"A-remove_tags_for_conversation-R",A_GET_UNREAD_COUNT_BY_TAG_T:"A-get_unread_count_by_tag-T",A_GET_UNREAD_COUNT_BY_TAG_R:"A-get_unread_count_by_tag-R",A_GET_UNREAD_COUNT_T:"A-get_unread_count-T",A_GET_UNREAD_COUNT_R:"A-get_unread_count-R",A_GET_UNTAGGED_CONVERSATION_LIST_BY_PAGE_T:"A-get_untagged_conversation_list_by_page-T",A_GET_UNTAGGED_CONVERSATION_LIST_BY_PAGE_R:"A-get_untagged_conversation_list_by_page-R",A_SET_TRANSLATION_LANGUAGE_T:"A-set_translation_language-T",A_SET_TRANSLATION_LANGUAGE_R:"A-set_translation_language-R",A_GET_TRANSLATION_LANGUAGE_T:"A-get_translation_language-T",A_GET_TRANSLATION_LANGUAGE_R:"A-get_translation_language-R",A_SET_AUTO_TRANSLATE_ENABLED_T:"A-set_auto_translate_enabled-T",A_SET_AUTO_TRANSLATE_ENABLED_R:"A-set_auto_translate_enabled-R",A_GET_AUTO_TRANSLATE_ENABLED_T:"A-get_auto_translate_enabled-T",A_GET_AUTO_TRANSLATE_ENABLED_R:"A-get_auto_translate_enabled-R",L_PULL_OFFLINE_MESSAGE_FINISHED_S:"L-pull_offline_message_finished-S",A_MODIFY_MESSAGE_WITH_PARAMS_T:"A-modify_msg_with_params-T",A_MODIFY_MESSAGE_WITH_PARAMS_R:"A-modify_msg_with_params-R",A_REFRESH_REFERENCE_MESSAGE_WITH_PARAMS_T:"A-refresh_refer_msg_with_params-T",A_REFRESH_REFERENCE_MESSAGE_WITH_PARAMS_R:"A-refresh_refer_msg_with_params-R",L_PULL_MODIFY_MSG_T:"L-pull_modify_msg-T",L_PULL_MODIFY_MSG_R:"L-pull_modify_msg-R",A_BATCH_DEL_CONVERS_T:"A-batch_del_conversation-T",A_BATCH_DEL_CONVERS_R:"A-batch_del_conversation-R",A_SYNC_REMOTE_CONVERSATIONS_T:"A-e_sync_remote_conversations-T",A_SYNC_REMOTE_CONVERSATIONS_R:"A-e_sync_remote_conversations-R",L_UPDATE_MSG_BOX_TIME_O:"L-update_msg_box_time-O",A_SEND_UG_TYPING_T:"A-send_ug_typing-T",A_SEND_UG_TYPING_R:"A-send_ug_typing-R",A_GET_UG_LIST_T:"A-get_ug_list-T",A_GET_UG_LIST_R:"A-get_ug_list-R",A_GET_UG_MSGS_BY_UID_T:"A-get_ug_msgs_by_uid-T",A_GET_UG_MSGS_BY_UID_R:"A-get_ug_msgs_by_uid-R",A_GET_UG_UNREAD_MENTIONED_DIGEST_T:"A-get_ug_unread_mentioned_digest-T",A_GET_UG_UNREAD_MENTIONED_DIGEST_R:"A-get_ug_unread_mentioned_digest-R",A_GET_HIS_MSGS_BY_OBJ_NAMES_T:"A-get_his_msgs_by_obj_names-T",A_GET_HIS_MSGS_BY_OBJ_NAMES_R:"A-get_his_msgs_by_obj_names-R",A_GET_CONTINUOUS_MSGS_T:"A-get_continuous_msgs-T",A_GET_CONTINUOUS_MSGS_R:"A-get_continuous_msgs-R",A_GET_MSGS_AROUND_TIMESTAMP_T:"A-get_msgs_around_timestamp-T",A_GET_MSGS_AROUND_TIMESTAMP_R:"A-get_msgs_around_timestamp-R",A_CLEAR_LOCAL_MSG_T:"A-clear_local_msg-T",A_CLEAR_LOCAL_MSG_R:"A-clear_local_msg-R",A_DEL_LOCAL_MSGS_BY_TIME_T:"A-del_local_msgs_by_time-T",A_DEL_LOCAL_MSGS_BY_TIME_R:"A-del_local_msgs_by_time-R",A_BATCH_CLEAR_LOCAL_MSGS_BY_TIME_T:"A-batch_clear_local_msgs_by_time-T",A_BATCH_CLEAR_LOCAL_MSGS_BY_TIME_R:"A-batch_clear_local_msgs_by_time-R",A_DEL_LOCAL_UG_MSGS_FOR_ALL_CHANNEL_T:"A-del_local_ug_msgs_for_all_channel-T",A_DEL_LOCAL_UG_MSGS_FOR_ALL_CHANNEL_R:"A-del_local_ug_msgs_for_all_channel-R",A_UPDATE_MSG_EXPANSION_T:"A-update_msg_expansion-T",A_UPDATE_MSG_EXPANSION_R:"A-update_msg_expansion-R",A_REMOVE_MSG_EXPANSION_T:"A-remove_msg_expansion-T",A_REMOVE_MSG_EXPANSION_R:"A-remove_msg_expansion-R",A_REMOVE_ALL_MSG_EXPANSION_T:"A-remove_all_msg_expansion-T",A_REMOVE_ALL_MSG_EXPANSION_R:"A-remove_all_msg_expansion-R",A_INSERT_MSG_T:"A-insert_msg-T",A_INSERT_MSG_R:"A-insert_msg-R",A_BATCH_INSERT_MSGS_T:"A-batch_insert_msgs-T",A_BATCH_INSERT_MSGS_R:"A-batch_insert_msgs-R",A_SET_MSG_CONTENT_T:"A-set_msg_content-T",A_SET_MSG_CONTENT_R:"A-set_msg_content-R",A_SET_UG_DEFAULT_NTF_LEVEL_T:"A-set_ug_default_ntf_level-T",A_SET_UG_DEFAULT_NTF_LEVEL_R:"A-set_ug_default_ntf_level-R",A_GET_UG_DEFAULT_NTF_LEVEL_T:"A-get_ug_default_ntf_level-T",A_GET_UG_DEFAULT_NTF_LEVEL_R:"A-get_ug_default_ntf_level-R",A_GET_UG_UNREAD_COUNT_FOR_ALL_CHANNELS_T:"A-get_ug_unread_count_for_all_channels-T",A_GET_UG_UNREAD_COUNT_FOR_ALL_CHANNELS_R:"A-get_ug_unread_count_for_all_channels-R",A_GET_TOTAL_UNREAD_COUNT_BY_LEVELS_T:"A-get_total_unread_count_by_levels-T",A_GET_TOTAL_UNREAD_COUNT_BY_LEVELS_R:"A-get_total_unread_count_by_levels-R",A_GET_TOTAL_UNREAD_COUNT_T:"A-get_total_unread_count-T",A_GET_TOTAL_UNREAD_COUNT_R:"A-get_total_unread_count-R",A_GET_FIRST_UNREAD_MEG_T:"A-get_first_unread_msg-T",A_GET_FIRST_UNREAD_MSG_R:"A-get_first_unread_msg-R",A_GET_FIRST_UNREAD_MSG_DIGEST_T:"A-get_first_unread_msg_digest-T",A_GET_FIRST_UNREAD_MSG_DIGEST_R:"A-get_first_unread_msg_digest-R",A_GET_UNREAD_MENTIONED_MSGS_T:"A-get_unread_mentioned_msgs-T",A_GET_UNREAD_MENTIONED_MSGS_R:"A-get_unread_mentioned_msgs-R",A_GET_UG_UNREAD_INFO_LIST_T:"A-get_ug_unread_info_list-T",A_GET_UG_UNREAD_INFO_LIST_R:"A-get_ug_unread_info_list-R",A_GET_UG_FIRST_UNREAD_MSG_DIGEST_T:"A-get_ug_first_unread_msg_digest-T",A_GET_UG_FIRST_UNREAD_MSG_DIGEST_R:"A-get_ug_first_unread_msg_digest-R",A_GET_LOCAL_MSG_COUNT_T:"A-get_local_msg_count-T",A_GET_LOCAL_MSG_COUNT_R:"A-get_local_msg_count-R",A_GET_CONVERSATIONS_T:"A-get_conversations-T",A_GET_CONVERSATIONS_R:"A-get_conversations-R",A_GET_BLOCKED_UG_LIST_T:"A-get_blocked_ug_list-T",A_GET_BLOCKED_UG_LIST_R:"A-get_blocked_ug_list-R",A_CLEAR_UNREAD_COUNT_T:"A-clear_unread_count-T",A_CLEAR_UNREAD_COUNT_R:"A-clear_unread_count-R",A_CLEAR_ALL_UNREAD_COUNT_T:"A-clear_all_unread_count-T",A_CLEAR_ALL_UNREAD_COUNT_R:"A-clear_all_unread_count-R",A_GET_TOP_CONVERSATION_LIST_T:"A-get_top_conversation_list-T",A_GET_TOP_CONVERSATION_LIST_R:"A-get_top_conversation_list-R",A_GET_UNREAD_CONVERSATION_LIST_T:"A-get_unread_conversation_list-T",A_GET_UNREAD_CONVERSATION_LIST_R:"A-get_unread_conversation_list-R",A_GET_BLOCKED_CONVERSATION_LIST_T:"A-get_blocked_conversation_list-T",A_GET_BLOCKED_CONVERSATION_LIST_R:"A-get_blocked_conversation_list-R",A_GET_ALL_CONVERSATION_LIST_T:"A-get_all_conversation_list-T",A_GET_ALL_CONVERSATION_LIST_R:"A-get_all_conversation_list-R",A_GET_CONVERSATION_LIST_BY_TIME_T:"A-get_conversation_list_by_time-T",A_GET_CONVERSATION_LIST_BY_TIME_R:"A-get_conversation_list_by_time-R",A_GET_CONVERSATION_LIST_OLD_T:"A-get_conversation_list_old-T",A_GET_CONVERSATION_LIST_OLD_R:"A-get_conversation_list_old-R",A_GET_UNREAD_MENTIONED_COUNT_T:"A-get_unread_mentioned_count-T",A_GET_UNREAD_MENTIONED_COUNT_R:"A-get_unread_mentioned_count-R",A_GET_ALL_UNREAD_MENTIONED_COUNT_T:"A-get_all_unread_mentioned_count-T",A_GET_ALL_UNREAD_MENTIONED_COUNT_R:"A-get_all_unread_mentioned_count-R",A_GET_REALTIME_CONVERSATIONS_T:"A-get_realtime_conversations-T",A_GET_REALTIME_CONVERSATIONS_R:"A-get_realtime_conversations-R",A_GET_REALTIM_CON_TOTAL_UNREAD_COUNT_T:"A-get_realtime_con_total_unread_count-T",A_GET_REALTIM_CON_TOTAL_UNREAD_COUNT_R:"A-get_realtime_con_total_unread_count-R",A_CLEAR_REALTIME_CON_UNREAD_COUNT_T:"A-clear_realtime_con_unread_count-T",A_CLEAR_REALTIME_CON_UNREAD_COUNT_R:"A-clear_realtime_con_unread_count-R",A_REMOVE_REALTIME_CONVERSATIONS_T:"A-remove_realtime_conversations-T",A_REMOVE_REALTIME_CONVERSATIONS_R:"A-remove_realtime_conversations-R",A_BATCH_GET_REALTIME_CON_UNREAD_COUNT_T:"A-batch_get_realtime_con_unread_count-T",A_BATCH_GET_REALTIME_CON_UNREAD_COUNT_R:"A-batch_get_realtime_con_unread_count-R",A_GET_SUB_USERS_STATUS_T:"A-get_sub_users_status-T",A_GET_SUB_USERS_STATUS_R:"A-get_sub_users_status-R",A_GET_SUB_USERS_ONLINE_STATUS_T:"A-get_sub_users_online_status-T",A_GET_SUB_USERS_ONLINE_STATUS_R:"A-get_sub_users_online_status-R",A_SAVE_EDITED_MSG_DRAFT_T:"A-save_edited_msg_draft-T",A_SAVE_EDITED_MSG_DRAFT_R:"A-save_edited_msg_draft-R",A_GET_EDITED_MSG_DRAFT_T:"A-get_edited_msg_draft-T",A_GET_EDITED_MSG_DRAFT_R:"A-get_edited_msg_draft-R",A_CLEAR_EDITED_MSG_DRAFT_T:"A-clear_edited_msg_draft-T",A_CLEAR_EDITED_MSG_DRAFT_R:"A-clear_edited_msg_draft-R",A_GET_UNREAD_MENTION_ME_CONVERSATION_LIST_T:"A-get_unread_mention_me_conversation_list-T",A_GET_UNREAD_MENTION_ME_CONVERSATION_LIST_R:"A-get_unread_mention_me_conversation_list-R",A_GET_USER_PROFILES_T:"A-get_user_profiles-T",A_GET_USER_PROFILES_R:"A-get_user_profiles-R",A_ADD_TO_BLACKLIST_T:"A-add_to_blacklist-T",A_ADD_TO_BLACKLIST_R:"A-add_to_blacklist-R",A_REMOVE_FROM_BLACKLIST_T:"A-remove_from_blacklist-T",A_REMOVE_FROM_BLACKLIST_R:"A-remove_from_blacklist-R",A_GET_BLACKLIST_T:"A-get_blacklist-T",A_GET_BLACKLIST_R:"A-get_blacklist-R",A_GET_BLACKLIST_STATUS_T:"A-get_blacklist_status-T",A_GET_BLACKLIST_STATUS_R:"A-get_blacklist_status-R",A_E_SET_MSG_RECEIVED_STATUS_T:"A-e_set_msg_received_status-T",A_E_SET_MSG_RECEIVED_STATUS_R:"A-e_set_msg_received_status-R",A_E_SET_MSG_SENT_STATUS_T:"A-e_set_msg_sent_status-T",A_E_SET_MSG_SENT_STATUS_R:"A-e_set_msg_sent_status-R",A_E_SET_CHECK_DUPLICATE_MSG_T:"A-e_set_check_duplicate_msg-T",A_E_SET_CHECK_DUPLICATE_MSG_R:"A-e_set_check_duplicate_msg-R",A_SET_PROXY_T:"A-set_proxy-T",A_SET_PROXY_R:"A-set_proxy-R",A_GET_PROXY_T:"A-get_proxy-T",A_GET_PROXY_R:"A-get_proxy-R",A_TEST_PROXY_T:"A-test_proxy-T",A_TEST_PROXY_R:"A-test_proxy-R",A_CLEAR_UNREAD_COUNT_BY_TIME_T:"A-clear_unread_count_by_time-T",A_CLEAR_UNREAD_COUNT_BY_TIME_R:"A-clear_unread_count_by_time-R",A_GET_MSG_READER_T:"A-get_msg_reader-T",A_GET_MSG_READER_R:"A-get_msg_reader-R",A_SEND_READ_RECEIPT_V4_T:"A-send_read_receipt_v4-T",A_SEND_READ_RECEIPT_V4_R:"A-send_read_receipt_v4-R",A_GET_READ_RECEIPT_V4_T:"A-get_read_receipt_V4-T",A_GET_READ_RECEIPT_V4_R:"A-get_read_receipt_V4-R",A_BATCH_GET_READ_RECEIPT_INFO_V4_T:"A-batch_get_read_receipt_info_V4-T",A_BATCH_GET_READ_RECEIPT_INFO_V4_R:"A-batch_get_read_receipt_info_V4-R",A_GET_ALL_ROBOTS_T:"A-get_all_robots-T",A_GET_ALL_ROBOTS_R:"A-get_all_robots-R",A_GET_ROBOT_BY_ID_T:"A-get_robot_by_id-T",A_GET_ROBOT_BY_ID_R:"A-get_robot_by_id-R",A_ADD_FRIEND_T:"A-add_friend-T",A_ADD_FRIEND_R:"A-add_friend-R",A_DELETE_FRIENDS_T:"A-delete_friends-T",A_DELETE_FRIENDS_R:"A-delete_friends-R",A_ACCEPT_FRIEND_REQUEST_T:"A-accept_friend_request-T",A_ACCEPT_FRIEND_REQUEST_R:"A-accept_friend_request-R",A_REFUSE_FRIEND_REQUEST_T:"A-refuse_friend_request-T",A_REFUSE_FRIEND_REQUEST_R:"A-refuse_friend_request-R",A_SET_FRIEND_INFO_T:"A-set_friend_info-T",A_SET_FRIEND_INFO_R:"A-set_friend_info-R",A_CHECK_FRIENDS_T:"A-check_friends-T",A_CHECK_FRIENDS_R:"A-check_friends-R",A_GET_FRIENDS_T:"A-get_friends-T",A_GET_FRIENDS_R:"A-get_friends-R",A_GET_FRIEND_APPLICATIONS_T:"A-get_friend_applications-T",A_GET_FRIEND_APPLICATIONS_R:"A-get_friend_applications-R",A_GET_FRIENDS_INFO_T:"A-get_friends_info-T",A_GET_FRIENDS_INFO_R:"A-get_friends_info-R",A_SEARCH_FRIENDS_INFO_T:"A-search_friends_info-T",A_SEARCH_FRIENDS_INFO_R:"A-search_friends_info-R",A_SET_FRIEND_ADD_PERMISSION_T:"A-set_friend_add_permission-T",A_SET_FRIEND_ADD_PERMISSION_R:"A-set_friend_add_permission-R",A_GET_FRIEND_ADD_PERMISSION_T:"A-get_friend_add_permission-T",A_GET_FRIEND_ADD_PERMISSION_R:"A-get_friend_add_permission-R",A_CREATE_GROUP_T:"A-create_group-T",A_CREATE_GROUP_R:"A-create_group-R",A_UPDATE_GROUP_INFO_T:"A-update_group_info-T",A_UPDATE_GROUP_INFO_R:"A-update_group_info-R",A_GET_GROUPS_INFO_T:"A-get_groups_info-T",A_GET_GROUPS_INFO_R:"A-get_groups_info-R",A_KICK_GROUP_MEMBERS_T:"A-kick_group_members-T",A_KICK_GROUP_MEMBERS_R:"A-kick_group_members-R",A_QUIT_GROUP_T:"A-quit_group-T",A_QUIT_GROUP_R:"A-quit_group-R",A_DISMISS_GROUP_T:"A-dismiss_group-T",A_DISMISS_GROUP_R:"A-dismiss_group-R",A_TRANSFER_GROUP_OWNER_T:"A-transfer_group_owner-T",A_TRANSFER_GROUP_OWNER_R:"A-transfer_group_owner-R",A_ADD_GROUP_MANAGERS_T:"A-add_group_managers-T",A_ADD_GROUP_MANAGERS_R:"A-add_group_managers-R",A_REMOVE_GROUP_MANAGERS_T:"A-remove_group_managers-T",A_REMOVE_GROUP_MANAGERS_R:"A-remove_group_managers-R",A_GET_GROUP_MEMBERS_T:"A-get_group_members-T",A_GET_GROUP_MEMBERS_R:"A-get_group_members-R",A_SET_GROUP_MEMBER_INFO_T:"A-set_group_member_info-T",A_SET_GROUP_MEMBER_INFO_R:"A-set_group_member_info-R",A_SEARCH_GROUP_MEMBERS_T:"A-search_group_members-T",A_SEARCH_GROUP_MEMBERS_R:"A-search_group_members-R",A_JOIN_GROUP_T:"A-join_group-T",A_JOIN_GROUP_R:"A-join_group-R",A_INVITE_USERS_TO_GROUP_T:"A-invite_users_to_group-T",A_INVITE_USERS_TO_GROUP_R:"A-invite_users_to_group-R",A_ADD_GROUP_FOLLOWS_T:"A-add_group_follows-T",A_ADD_GROUP_FOLLOWS_R:"A-add_group_follows-R",A_REMOVE_GROUP_FOLLOWS_T:"A-remove_group_follows-T",A_REMOVE_GROUP_FOLLOWS_R:"A-remove_group_follows-R",A_GET_GROUP_FOLLOWS_T:"A-get_group_follows-T",A_GET_GROUP_FOLLOWS_R:"A-get_group_follows-R",A_SET_GROUP_REMARK_T:"A-set_group_remark-T",A_SET_GROUP_REMARK_R:"A-set_group_remark-R",A_GET_GROUP_MEMBERS_BY_ROLE_T:"A-get_group_members_by_role-T",A_GET_GROUP_MEMBERS_BY_ROLE_R:"A-get_group_members_by_role-R",A_ACCEPT_GROUP_INVITE_T:"A-accept_group_invite-T",A_ACCEPT_GROUP_INVITE_R:"A-accept_group_invite-R",A_REFUSE_GROUP_INVITE_T:"A-refuse_group_invite-T",A_REFUSE_GROUP_INVITE_R:"A-refuse_group_invite-R",A_ACCEPT_GROUP_APPLICATION_T:"A-accept_group_application-T",A_ACCEPT_GROUP_APPLICATION_R:"A-accept_group_application-R",A_REFUSE_GROUP_APPLICATION_T:"A-refuse_group_application-T",A_REFUSE_GROUP_APPLICATION_R:"A-refuse_group_application-R",A_GET_GROUP_APPLICATIONS_T:"A-get_group_applications-T",A_GET_GROUP_APPLICATIONS_R:"A-get_group_applications-R",A_GET_JOINED_GROUPS_BY_ROLES_T:"A-get_joined_groups_by_roles-T",A_GET_JOINED_GROUPS_BY_ROLES_R:"A-get_joined_groups_by_roles-R",A_SEARCH_JOINED_GROUPS_T:"A-search_joined_groups-T",A_SEARCH_JOINED_GROUPS_R:"A-search_joined_groups-R",A_GET_JOINED_GROUPS_T:"A-get_joined_groups-T",A_GET_JOINED_GROUPS_R:"A-get_joined_groups-R",A_SEARCH_USER_PROFILE_BY_UNIQUE_ID_T:"A-search_user_profile_by_unique_id-T",A_SEARCH_USER_PROFILE_BY_UNIQUE_ID_R:"A-search_user_profile_by_unique_id-R",A_UPDATE_MY_USER_PROFILE_VISIBILITY_T:"A-update_my_user_profile_visibility-T",A_UPDATE_MY_USER_PROFILE_VISIBILITY_R:"A-update_my_user_profile_visibility-R",A_GET_MY_USER_PROFILE_VISIBILITY_T:"A-get_my_user_profile_visibility-T",A_GET_MY_USER_PROFILE_VISIBILITY_R:"A-get_my_user_profile_visibility-R",A_SUBSCRIBE_USER_STATUS_T:"A-subscribe_user_status-T",A_SUBSCRIBE_USER_STATUS_R:"A-subscribe_user_status-R",A_UNSUBSCRIBE_USER_STATUS_T:"A-unsubscribe_user_status-T",A_UNSUBSCRIBE_USER_STATUS_R:"A-unsubscribe_user_status-R",A_GET_SUBSCRIBE_USER_STATUS_LIST_T:"A-get_subscribe_user_status_list-T",A_GET_SUBSCRIBE_USER_STATUS_LIST_R:"A-get_subscribe_user_status_list-R",A_GET_MY_USER_PROFILE_T:"A-get_my_user_profile-T",A_GET_MY_USER_PROFILE_R:"A-get_my_user_profile-R",A_UPDATE_MY_USER_PROFILE_T:"A-update_my_user_profile-T",A_UPDATE_MY_USER_PROFILE_R:"A-update_my_user_profile-R",A_GET_CONVERSATIONS_INCLUDING_ROBOTS_T:"A-get_conversations_including_robots-T",A_GET_CONVERSATIONS_INCLUDING_ROBOTS_R:"A-get_conversations_including_robots-R",L_PULL_SG_UNREAD_COUNT_T:"L-pull_sg_unread_count-T",L_PULL_SG_UNREAD_COUNT_R:"L-pull_sg_unread_count-R",A_MARK_REMOTE_CONVERSATION_AS_READ_T:"A-mark_remote_conversation_as_read-T",A_MARK_REMOTE_CONVERSATION_AS_READ_R:"A-mark_remote_conversation_as_read-R",A_ADD_MSG_REACTION_T:"A-add_msg_reaction-T",A_ADD_MSG_REACTION_R:"A-add_msg_reaction-R",A_REMOVE_MSG_REACTION_T:"A-remove_msg_reaction-T",A_REMOVE_MSG_REACTION_R:"A-remove_msg_reaction-R",A_BATCH_GET_MSG_REACTION_SUMMARIES_T:"A-batch_get_msg_reaction_summaries-T",A_BATCH_GET_MSG_REACTION_SUMMARIES_R:"A-batch_get_msg_reaction_summaries-R",A_GET_MSG_REACTIONS_T:"A-get_msg_reactions-T",A_GET_MSG_REACTIONS_R:"A-get_msg_reactions-R",A_GET_MSG_REACTION_USERS_T:"A-get_msg_reaction_users-T",A_GET_MSG_REACTION_USERS_R:"A-get_msg_reaction_users-R",L_EXEC_CUSTOM_CONVERSATION_STORAGE_EVICTION_E:"L-exec_custom_conversation_storage_eviction-E",A_GET_MESSAGES_T:"A-get_msgs-T",A_GET_MESSAGES_R:"A-get_msgs-R"};var o,a,l,c,_,d,u,h,g,E,I,T,f,R,A,p,m,S,v,N,O,y,C,M,b,L,U,P,D,w;!function(e){e[e.BOTH=2]="BOTH"}(o||(o={})),function(e){e[e.BOTH=2]="BOTH"}(a||(a={})),function(e){e[e.FREE=1]="FREE",e[e.NEED_VERIFY=2]="NEED_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(l||(l={})),function(e){e[e.NONE=0]="NONE",e[e.IN_MY_FRIEND_LIST=1]="IN_MY_FRIEND_LIST",e[e.IN_OTHER_FRIEND_LIST=2]="IN_OTHER_FRIEND_LIST",e[e.BOTH_WAY=3]="BOTH_WAY"}(c||(c={})),function(e){e[e.SENT=1]="SENT",e[e.RECEIVED=2]="RECEIVED"}(_||(_={})),function(e){e[e.UNHANDLED=0]="UNHANDLED",e[e.ACCEPTED=1]="ACCEPTED",e[e.REFUSED=2]="REFUSED",e[e.EXPIRED=3]="EXPIRED"}(d||(d={})),function(e){e[e.FRIEND_APPLICATION=31]="FRIEND_APPLICATION"}(u||(u={})),function(e){e[e.FRIEND_APPLY=0]="FRIEND_APPLY",e[e.FRIEND_REFUSE=1]="FRIEND_REFUSE",e[e.FRIEND_USER_INFO=2]="FRIEND_USER_INFO",e[e.FRIENDS_INPUT=3]="FRIENDS_INPUT",e[e.FRIEND_CLEAR=4]="FRIEND_CLEAR",e[e.FRIEND_INFO_CHANGE=5]="FRIEND_INFO_CHANGE",e[e.FRIEND_INFO_CHANGE_SYNC=6]="FRIEND_INFO_CHANGE_SYNC"}(h||(h={})),function(e){e[e.OWNER_VERIFY=0]="OWNER_VERIFY",e[e.FREE=1]="FREE",e[e.OWNER_OR_MANAGER_VERIFY=2]="OWNER_OR_MANAGER_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(g||(g={})),function(e){e[e.OWNER=0]="OWNER",e[e.OWNER_OR_MANAGER=1]="OWNER_OR_MANAGER",e[e.EVERYONE=2]="EVERYONE"}(E||(E={})),function(e){e[e.OWNER_OR_MANAGER_OR_SELF=0]="OWNER_OR_MANAGER_OR_SELF",e[e.OWNER_OR_SELF=1]="OWNER_OR_SELF",e[e.SELF=2]="SELF"}(I||(I={})),function(e){e[e.FREE=0]="FREE",e[e.INVITEE_VERIFY=1]="INVITEE_VERIFY"}(T||(T={})),function(e){e[e.UNDEF=0]="UNDEF",e[e.NORMAL=1]="NORMAL",e[e.MANAGER=2]="MANAGER",e[e.OWNER=3]="OWNER"}(f||(f={})),function(e){e[e.CREATE=0]="CREATE",e[e.JOIN=1]="JOIN",e[e.KICK=2]="KICK",e[e.QUIT=3]="QUIT",e[e.DISMISS=4]="DISMISS",e[e.ADD_MANAGER=5]="ADD_MANAGER",e[e.REMOVE_MANAGER=6]="REMOVE_MANAGER",e[e.TRANSFER_GROUP_OWNER=7]="TRANSFER_GROUP_OWNER"}(R||(R={})),function(e){e[e.GROUP_INFO_CHANGE=0]="GROUP_INFO_CHANGE",e[e.MEMBER_PROFILE_CHANGE=1]="MEMBER_PROFILE_CHANGE",e[e.GROUP_REMARK_SET=2]="GROUP_REMARK_SET",e[e.GROUP_REMARK_DELETE=3]="GROUP_REMARK_DELETE"}(A||(A={})),function(e){e[e.ADD=1]="ADD",e[e.REMOVE=2]="REMOVE"}(p||(p={})),function(e){e[e.MANAGER_UNHANDLED=0]="MANAGER_UNHANDLED",e[e.MANAGER_REFUSED=1]="MANAGER_REFUSED",e[e.INVITEE_UNHANDLED=2]="INVITEE_UNHANDLED",e[e.INVITEE_REFUSED=3]="INVITEE_REFUSED",e[e.JOINED=4]="JOINED",e[e.EXPIRED=5]="EXPIRED"}(m||(m={})),function(e){e[e.REFUSE=0]="REFUSE",e[e.ACCEPT=1]="ACCEPT"}(S||(S={})),function(e){e[e.APPLICANT=0]="APPLICANT",e[e.MANAGER=1]="MANAGER"}(v||(v={})),function(e){e[e.GROUP_OPERATION=11]="GROUP_OPERATION",e[e.GROUP_PROFILE_CHANGE=12]="GROUP_PROFILE_CHANGE",e[e.GROUP_APPLICATION_INVITATION=13]="GROUP_APPLICATION_INVITATION",e[e.GROUP_FOLLOW_USER_CHANGE=14]="GROUP_FOLLOW_USER_CHANGE"}(N||(N={})),function(e){e[e.APPLICATION=0]="APPLICATION",e[e.INVITATION=1]="INVITATION"}(O||(O={})),function(e){e[e.APPLICATION_SENT=0]="APPLICATION_SENT",e[e.INVITATION_SENT=1]="INVITATION_SENT",e[e.INVITATION_RECEIVED=2]="INVITATION_RECEIVED",e[e.APPLICATION_RECEIVED=3]="APPLICATION_RECEIVED"}(y||(y={})),function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(C||(C={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(M||(M={})),function(e){e[e.LeaveOnMyOwn=1]="LeaveOnMyOwn",e[e.OtherDeviceLogin=2]="OtherDeviceLogin"}(b||(b={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(L||(L={})),function(e){e[e.UnmuteUsers=0]="UnmuteUsers",e[e.MuteUsers=1]="MuteUsers",e[e.UnmuteAll=2]="UnmuteAll",e[e.MuteAll=3]="MuteAll",e[e.RemoveWhitelist=4]="RemoveWhitelist",e[e.AddWhitelist=5]="AddWhitelist",e[e.UnmuteGloble=6]="UnmuteGloble",e[e.MuteGloble=7]="MuteGloble"}(U||(U={})),function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(P||(P={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.NOT_IN_WHITELIST=407]="NOT_IN_WHITELIST",e[e.FORBIDDEN_IN_PRIVATE=20106]="FORBIDDEN_IN_PRIVATE",e[e.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",e[e.DANGEROUS_CONTENT=20112]="DANGEROUS_CONTENT",e[e.CONTENT_REVIEW_REJECTED=20113]="CONTENT_REVIEW_REJECTED",e[e.MESSAGE_OVER_MODIFY_TIME_FAIL=20114]="MESSAGE_OVER_MODIFY_TIME_FAIL",e[e.MESSAGE_SIZE_EXCEEDED=20115]="MESSAGE_SIZE_EXCEEDED",e[e.MESSAGE_UNSUPPORTED_MODIFY=20116]="MESSAGE_UNSUPPORTED_MODIFY",e[e.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",e[e.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",e[e.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",e[e.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",e[e.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",e[e.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET=24360]="RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET",e[e.RC_USER_PROFILE_KEY_NOT_EXIST=24361]="RC_USER_PROFILE_KEY_NOT_EXIST",e[e.RC_USER_PROFILE_EXT_KEY_NOT_EXIST=24362]="RC_USER_PROFILE_EXT_KEY_NOT_EXIST",e[e.RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT=24363]="RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT",e[e.RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT=24364]="RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT",e[e.RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT=24365]="RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT",e[e.RC_USER_PROFILE_USER_NOT_EXIST=24366]="RC_USER_PROFILE_USER_NOT_EXIST",e[e.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS=24367]="RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS",e[e.RC_USER_PROFILE_VALUE_EXCEED_RANGE=24368]="RC_USER_PROFILE_VALUE_EXCEED_RANGE",e[e.RC_USER_PROFILE_SERVICE_UNAVAILABLE=24369]="RC_USER_PROFILE_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",e[e.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",e[e.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",e[e.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",e[e.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",e[e.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",e[e.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",e[e.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",e[e.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",e[e.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",e[e.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",e[e.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",e[e.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",e[e.RC_ENTRUST_SERVER_ERROR=25402]="RC_ENTRUST_SERVER_ERROR",e[e.RC_ENTRUST_SERVER_PARAMETER_ERROR=25403]="RC_ENTRUST_SERVER_PARAMETER_ERROR",e[e.RC_GROUP_ILLEGAL_ERROR=25404]="RC_GROUP_ILLEGAL_ERROR",e[e.RC_GROUP_AUTHORITY_ERROR=25405]="RC_GROUP_AUTHORITY_ERROR",e[e.RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT=25406]="RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT",e[e.RC_GROUP_PARAMETER_FORMAT_ERROR=25407]="RC_GROUP_PARAMETER_FORMAT_ERROR",e[e.RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS=25408]="RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS",e[e.RC_GROUP_ID_ALREADY_EXIST=25409]="RC_GROUP_ID_ALREADY_EXIST",e[e.RC_GROUP_ID_NOT_EXIST=25410]="RC_GROUP_ID_NOT_EXIST",e[e.RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT=25411]="RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_MEMBERS_ALREADY_IN_GROUP=25412]="RC_GROUP_MEMBERS_ALREADY_IN_GROUP",e[e.RC_GROUP_NOT_ALLOW_SDK_OPERATION=25413]="RC_GROUP_NOT_ALLOW_SDK_OPERATION",e[e.RC_GROUP_NOT_ALLOW_JOIN=25414]="RC_GROUP_NOT_ALLOW_JOIN",e[e.RC_GROUP_EXT_KEY_NOT_EXIST=25415]="RC_GROUP_EXT_KEY_NOT_EXIST",e[e.RC_GROUP_REQUEST_OVERFREQUENCY=25416]="RC_GROUP_REQUEST_OVERFREQUENCY",e[e.RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK=25417]="RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK",e[e.RC_GROUP_USER_NOT_IN_GROUP=25418]="RC_GROUP_USER_NOT_IN_GROUP",e[e.RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT=25419]="RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP=25420]="RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP",e[e.RC_GROUP_APPLICATION_NOT_EXIST=25421]="RC_GROUP_APPLICATION_NOT_EXIST",e[e.RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT=25422]="RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_NAME_INVALID=25423]="RC_GROUP_NAME_INVALID",e[e.RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT=25424]="RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT",e[e.RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER=25425]="RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER",e[e.RC_GROUP_NO_INVITE_PERMISSION=25426]="RC_GROUP_NO_INVITE_PERMISSION",e[e.RC_GROUP_NEED_INVITEE_ACCEPT=25427]="RC_GROUP_NEED_INVITEE_ACCEPT",e[e.RC_GROUP_APPLICATION_ALREADY_HANDLE=25428]="RC_GROUP_APPLICATION_ALREADY_HANDLE",e[e.RC_GROUP_OLD_GROUP_NOT_ENTRUST=25429]="RC_GROUP_OLD_GROUP_NOT_ENTRUST",e[e.RC_GROUP_ID_INVALID=25430]="RC_GROUP_ID_INVALID",e[e.RC_PAGE_TOKEN_PARSING_FAILED=25432]="RC_PAGE_TOKEN_PARSING_FAILED",e[e.RC_FRIEND_ALREADY_FRIEND=25460]="RC_FRIEND_ALREADY_FRIEND",e[e.RC_FRIEND_NEED_ACCEPT=25461]="RC_FRIEND_NEED_ACCEPT",e[e.RC_FRIEND_IN_OTHER_BLACK_LIST=25462]="RC_FRIEND_IN_OTHER_BLACK_LIST",e[e.RC_FRIEND_NOT_IN_OTHER_WHITE_LIST=25463]="RC_FRIEND_NOT_IN_OTHER_WHITE_LIST",e[e.RC_FRIEND_IN_MY_BLACK_LIST=25464]="RC_FRIEND_IN_MY_BLACK_LIST",e[e.RC_FRIEND_NOT_IN_MY_WHITE_LIST=25465]="RC_FRIEND_NOT_IN_MY_WHITE_LIST",e[e.RC_FRIEND_APPLICATION_NOT_EXIST=25466]="RC_FRIEND_APPLICATION_NOT_EXIST",e[e.RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT=25467]="RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT",e[e.RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT=25468]="RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT",e[e.RC_FRIEND_NOT_FRIEND=25469]="RC_FRIEND_NOT_FRIEND",e[e.RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT=25470]="RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT",e[e.RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND=25471]="RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND",e[e.RC_FRIEND_NOT_EXIST=25472]="RC_FRIEND_NOT_EXIST",e[e.RC_FRIEND_NOT_ALLOW_ADD_SELF=25473]="RC_FRIEND_NOT_ALLOW_ADD_SELF",e[e.RC_FRIEND_NOT_SUPPORT_ROBOT=25474]="RC_FRIEND_NOT_SUPPORT_ROBOT",e[e.SERVICE_INFORMATION_AUDIT_FAILED=25480]="SERVICE_INFORMATION_AUDIT_FAILED",e[e.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",e[e.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",e[e.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",e[e.RC_READ_RECEIPT_V4_INVALID=26005]="RC_READ_RECEIPT_V4_INVALID",e[e.RC_SERVER_DRIVE_UNREAD_COUNT_INVALID=26006]="RC_SERVER_DRIVE_UNREAD_COUNT_INVALID",e[e.RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED=26007]="RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED",e[e.RC_SERVER_PARAMETER_MESSAGEUID_INVALID=26009]="RC_SERVER_PARAMETER_MESSAGEUID_INVALID",e[e.RC_SERVER_PARAMETER_INVALID=26010]="RC_SERVER_PARAMETER_INVALID",e[e.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE=26020]="RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE",e[e.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT=26021]="RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT",e[e.RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT=26022]="RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT",e[e.RC_FILE_SIZE_EXCEED_LIMIT=26106]="RC_FILE_SIZE_EXCEED_LIMIT",e[e.INVALID_PARAMETER_SIZE_NOT_FOUND=26107]="INVALID_PARAMETER_SIZE_NOT_FOUND",e[e.SERVICE_RRSV5_UNAVAILABLE=26314]="SERVICE_RRSV5_UNAVAILABLE",e[e.SERVICE_RRSV5_READ_RECEIPT_NOT_SUPPORT=26315]="SERVICE_RRSV5_READ_RECEIPT_NOT_SUPPORT",e[e.SERVICE_RRSV5_PARAM_LENGTH_EXCEED=26316]="SERVICE_RRSV5_PARAM_LENGTH_EXCEED",e[e.SERVICE_RRSV5_CONVERSATION_NOT_SUPPORT=26317]="SERVICE_RRSV5_CONVERSATION_NOT_SUPPORT",e[e.SERVICE_RRSV5_QUERY_NOT_SUPPORT=26318]="SERVICE_RRSV5_QUERY_NOT_SUPPORT",e[e.SERVICE_RRSV5_MESSAGE_SENDER_MISMATCH=26320]="SERVICE_RRSV5_MESSAGE_SENDER_MISMATCH",e[e.SERVICE_RRSV5_MESSAGE_RECEIPT_NEEDLESS=26321]="SERVICE_RRSV5_MESSAGE_RECEIPT_NEEDLESS",e[e.SERVICE_RRSV5_MESSAGE_NOT_EXIST=26322]="SERVICE_RRSV5_MESSAGE_NOT_EXIST",e[e.MSG_REACTION_LIMIT_REACHED=26323]="MSG_REACTION_LIMIT_REACHED",e[e.MSG_REACTION_USER_LIMIT_REACHED=26324]="MSG_REACTION_USER_LIMIT_REACHED",e[e.SERVICE_STT_UNAVAILABLE=28300]="SERVICE_STT_UNAVAILABLE",e[e.SERVICE_STT_CONVERTED_FAILED=28304]="SERVICE_STT_CONVERTED_FAILED",e[e.SERVICE_STT_INTERNAL_ERROR=28305]="SERVICE_STT_INTERNAL_ERROR",e[e.SERVICE_STT_PARAM_MISS=28306]="SERVICE_STT_PARAM_MISS",e[e.SERVICE_STT_USAGE_EXCEED=28307]="SERVICE_STT_USAGE_EXCEED",e[e.TRANS_SERVICE_NOT_OPEN=28400]="TRANS_SERVICE_NOT_OPEN",e[e.TRANS_FAILED=28401]="TRANS_FAILED",e[e.TRANS_INTERNAL_ERROR=28402]="TRANS_INTERNAL_ERROR",e[e.TRANS_PARAM_MISSING=28403]="TRANS_PARAM_MISSING",e[e.TRANS_PARAM_ERROR=28404]="TRANS_PARAM_ERROR",e[e.TRANS_QUOTA_LIMIT=28405]="TRANS_QUOTA_LIMIT",e[e.TRANS_TEXT_LENGTH_EXCEEDS_LIMIT=28406]="TRANS_TEXT_LENGTH_EXCEEDS_LIMIT",e[e.TRANS_LANGUAGE_NOT_SUPPORT=28407]="TRANS_LANGUAGE_NOT_SUPPORT",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",e[e.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.MESSAGE_NOT_SUPPORT_SENDING=30017]="MESSAGE_NOT_SUPPORT_SENDING",e[e.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",e[e.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",e[e.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",e[e.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",e[e.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",e[e.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",e[e.RC_TCP_RESET=32054]="RC_TCP_RESET",e[e.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",e[e.PROTOCOL_DECODE_ERROR=32546]="PROTOCOL_DECODE_ERROR",e[e.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.METHOD_BUSY=33103]="METHOD_BUSY",e[e.NOT_ALLOW_PULL_CONVERSATION=33301]="NOT_ALLOW_PULL_CONVERSATION",e[e.SDK_PULL_CONVERSATION=33302]="SDK_PULL_CONVERSATION",e[e.MODIFIED_MESSAGE_IS_NOT_SENT=33401]="MODIFIED_MESSAGE_IS_NOT_SENT",e[e.MODIFIED_MESSAGE_TIMEOUT=33402]="MODIFIED_MESSAGE_TIMEOUT",e[e.QUOTE_MSG_NOT_FOUND=33403]="QUOTE_MSG_NOT_FOUND",e[e.INVALID_PARAMETER_QUOTE_INFO=33404]="INVALID_PARAMETER_QUOTE_INFO",e[e.REACTION_ID_INVALID=33405]="REACTION_ID_INVALID",e[e.INVALID_PARAMETER_UNREAD_COUNT_FILTER=33406]="INVALID_PARAMETER_UNREAD_COUNT_FILTER",e[e.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",e[e.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",e[e.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.UPLOAD_FAIL=34011]="UPLOAD_FAIL",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",e[e.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",e[e.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",e[e.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",e[e.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",e[e.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",e[e.INVALID_PARAMETER_LAUGUAGE=34200]="INVALID_PARAMETER_LAUGUAGE",e[e.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",e[e.INVALID_PARAMETER_TIMESTAMP=34202]="INVALID_PARAMETER_TIMESTAMP",e[e.INVALID_PARAMETER_MESSAGE_UID=34203]="INVALID_PARAMETER_MESSAGE_UID",e[e.INVALID_PARAMETER_MESSAGE_ID=34204]="INVALID_PARAMETER_MESSAGE_ID",e[e.INVALID_PARAMETER_MESSAGE_CONTENT=34205]="INVALID_PARAMETER_MESSAGE_CONTENT",e[e.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",e[e.INVALID_PARAMETER_MEDIA_TYPE=34207]="INVALID_PARAMETER_MEDIA_TYPE",e[e.INVALID_PARAMETER_REQUEST_URL=34208]="INVALID_PARAMETER_REQUEST_URL",e[e.INVALID_PARAMETER_CONVERSATION_TYPE=34209]="INVALID_PARAMETER_CONVERSATION_TYPE",e[e.INVALID_PARAMETER_TARGET_ID=34210]="INVALID_PARAMETER_TARGET_ID",e[e.INVALID_PARAMETER_CHANNEL_ID=34211]="INVALID_PARAMETER_CHANNEL_ID",e[e.INVALID_PARAMETER_TAG_ID=34212]="INVALID_PARAMETER_TAG_ID",e[e.INVALID_PARAMETER_TAG_NAME=34213]="INVALID_PARAMETER_TAG_NAME",e[e.INVALID_PARAMETER_USER_ID=34214]="INVALID_PARAMETER_USER_ID",e[e.INVALID_PARAMETER_USERIDLIST=34215]="INVALID_PARAMETER_USERIDLIST",e[e.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME=34217]="INVALID_PARAMETER_DOWNLOADMEDIAFILENAME",e[e.INVALID_PARAMETER_MESSAGE_EXPANSION=34220]="INVALID_PARAMETER_MESSAGE_EXPANSION",e[e.INVALID_PARAMETER_NOTMEDIAMESSAGE=34223]="INVALID_PARAMETER_NOTMEDIAMESSAGE",e[e.INVALID_PARAMETER_TIMESTRING=34224]="INVALID_PARAMETER_TIMESTRING",e[e.INVALID_PARAMETER_CONVERSATION=34225]="INVALID_PARAMETER_CONVERSATION",e[e.INVALID_PARAMETER_NOTIFICATION_LEVEL=34228]="INVALID_PARAMETER_NOTIFICATION_LEVEL",e[e.INVALID_PARAMETER_MESSAGE_ARRAY=34229]="INVALID_PARAMETER_MESSAGE_ARRAY",e[e.INVALID_PARAMETER_RECEIVED_STATUS=34230]="INVALID_PARAMETER_RECEIVED_STATUS",e[e.INVALID_PARAMETER_CHANNEL_TYPE=34231]="INVALID_PARAMETER_CHANNEL_TYPE",e[e.INVALID_PARAMETER_COUNT=34232]="INVALID_PARAMETER_COUNT",e[e.INVALID_PARAMETER_MEDIA_URL=34235]="INVALID_PARAMETER_MEDIA_URL",e[e.INVALID_PARAMETER_UNIQUE_ID=34236]="INVALID_PARAMETER_UNIQUE_ID",e[e.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",e[e.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",e[e.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",e[e.INVALID_PARAMETER_CONVERSATIONS=34242]="INVALID_PARAMETER_CONVERSATIONS",e[e.INVALID_PARAMETER_SENT_STATUS=34244]="INVALID_PARAMETER_SENT_STATUS",e[e.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",e[e.INVALID_PARAMETER_RTCROOMID=34259]="INVALID_PARAMETER_RTCROOMID",e[e.INVALID_PARAMETER_KEY=34260]="INVALID_PARAMETER_KEY",e[e.INVALID_PARAMETER_KEYS=34261]="INVALID_PARAMETER_KEYS",e[e.INVALID_PARAMETER_VALUE=34262]="INVALID_PARAMETER_VALUE",e[e.INVALID_PARAMETER_ENTRIES=34263]="INVALID_PARAMETER_ENTRIES",e[e.INVALID_PARAMETER_NOTIFICATION_EXTRA=34264]="INVALID_PARAMETER_NOTIFICATION_EXTRA",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME=34271]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME",e[e.INVALID_PARAMETER_BEFORE=34272]="INVALID_PARAMETER_BEFORE",e[e.INVALID_PARAMETER_AFTER=34273]="INVALID_PARAMETER_AFTER",e[e.INVALID_PARAMETER_KEYWORD=34274]="INVALID_PARAMETER_KEYWORD",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST=34275]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST",e[e.INVALID_PARAMETER_OFFSET=34276]="INVALID_PARAMETER_OFFSET",e[e.INVALID_PARAMETER_START_TIME=34277]="INVALID_PARAMETER_START_TIME",e[e.INVALID_PARAMETER_END_TIME=34278]="INVALID_PARAMETER_END_TIME",e[e.INVALID_PARAMETER_LIMIT=34279]="INVALID_PARAMETER_LIMIT",e[e.INVALID_MESSAGE_DIRECTION=34280]="INVALID_MESSAGE_DIRECTION",e[e.INVALID_MESSAGE_SENT_STATUS=34281]="INVALID_MESSAGE_SENT_STATUS",e[e.INVALID_PARAMETER_TARGETID_LIST=34282]="INVALID_PARAMETER_TARGETID_LIST",e[e.INVALID_PARAMETER_SPAN_MINUTES=34283]="INVALID_PARAMETER_SPAN_MINUTES",e[e.INVALID_PARAMETER_CONVERSATION_TYPE_LIST=34284]="INVALID_PARAMETER_CONVERSATION_TYPE_LIST",e[e.INVALID_PARAMETER_CONVERSATION_LIST=34287]="INVALID_PARAMETER_CONVERSATION_LIST",e[e.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST=34288]="INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST",e[e.INVALID_PARAMETER_START_MESSAGE_UID=34289]="INVALID_PARAMETER_START_MESSAGE_UID",e[e.INVALID_PARAMETER_END_MESSAGE_UID=34290]="INVALID_PARAMETER_END_MESSAGE_UID",e[e.READ_RECEIPT_V4_NOT_SUPPORT=34291]="READ_RECEIPT_V4_NOT_SUPPORT",e[e.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34292]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",e[e.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE=34296]="RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE",e[e.RC_DB_NOT_INIT=34301]="RC_DB_NOT_INIT",e[e.RC_DB_CORRUPT=34302]="RC_DB_CORRUPT",e[e.RC_DB_SQL_ERROR=34303]="RC_DB_SQL_ERROR",e[e.RC_DB_DATA_NOT_FOUND=34304]="RC_DB_DATA_NOT_FOUND",e[e.RC_NET_DATA_ERROR=34305]="RC_NET_DATA_ERROR",e[e.INVALID_PARAMETER_SUBSCRIBE_TYPE=34306]="INVALID_PARAMETER_SUBSCRIBE_TYPE",e[e.INVALID_PARAMETER_SUBSCRIBE_EXPIRY=34307]="INVALID_PARAMETER_SUBSCRIBE_EXPIRY",e[e.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS=34308]="INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS",e[e.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE=34309]="INVALID_PARAMETER_SUBSCRIBE_PAGESIZE",e[e.SUB_PROCESS_EXIT=34310]="SUB_PROCESS_EXIT",e[e.ADDON_NOT_EXIST=34311]="ADDON_NOT_EXIST",e[e.INVALID_PARAMETER_USER_PROFILE=34312]="INVALID_PARAMETER_USER_PROFILE",e[e.INVALID_PARAMETER_USER_PROFILE_VISIBILITY=34313]="INVALID_PARAMETER_USER_PROFILE_VISIBILITY",e[e.INVALID_PARAMETER_EXTRA=34314]="INVALID_PARAMETER_EXTRA",e[e.DB_UPGRADE_FAILED=34315]="DB_UPGRADE_FAILED",e[e.INVALID_PARAMETER_GROUP_INFO=34318]="INVALID_PARAMETER_GROUP_INFO",e[e.INVALID_PARAMETER_GROUP_ID=34319]="INVALID_PARAMETER_GROUP_ID",e[e.INVALID_PARAMETER_GROUP_NAME=34320]="INVALID_PARAMETER_GROUP_NAME",e[e.INVALID_PARAMETER_GROUP_IDS=34321]="INVALID_PARAMETER_GROUP_IDS",e[e.INVALID_PARAMETER_GROUP_MEMBER_ROLE=34322]="INVALID_PARAMETER_GROUP_MEMBER_ROLE",e[e.INVALID_PARAMETER_GROUP_APPLICATION_STATUS=34323]="INVALID_PARAMETER_GROUP_APPLICATION_STATUS",e[e.INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION=34324]="INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION",e[e.INVALID_PARAMETER_NICK_NAME=34325]="INVALID_PARAMETER_NICK_NAME",e[e.INVALID_PARAMETER_REASON=34326]="INVALID_PARAMETER_REASON",e[e.INVALID_PARAMETER_REMARK=34327]="INVALID_PARAMETER_REMARK",e[e.INVALID_PARAMETER_PAGING_QUERY_OPTION=34328]="INVALID_PARAMETER_PAGING_QUERY_OPTION",e[e.NET_DATA_IS_SYNCHRONIZING=34329]="NET_DATA_IS_SYNCHRONIZING",e[e.INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE=34330]="INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE",e[e.INVALID_PARAMETER_DIRECTION_TYPE=34331]="INVALID_PARAMETER_DIRECTION_TYPE",e[e.INVALID_PARAMETER_FRIEND_APPLICATION_TYPE=34332]="INVALID_PARAMETER_FRIEND_APPLICATION_TYPE",e[e.INVALID_PARAMETER_FRIEND_APPLICATION_STATUS=34333]="INVALID_PARAMETER_FRIEND_APPLICATION_STATUS",e[e.INVALID_PARAMETER_FRIEND_ADD_PERMISSION=34334]="INVALID_PARAMETER_FRIEND_ADD_PERMISSION",e[e.INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS=34335]="INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS",e[e.RC_REAL_TIME_CONVERSATION_UNAVAILABLE=34336]="RC_REAL_TIME_CONVERSATION_UNAVAILABLE",e[e.SERVER_DATA_ERROR=34344]="SERVER_DATA_ERROR",e[e.INVALID_PARAMETER_MESSAGE_INFO_MAP=34345]="INVALID_PARAMETER_MESSAGE_INFO_MAP",e[e.INVALID_PARAMETER_PAGE_TOKEN=34346]="INVALID_PARAMETER_PAGE_TOKEN",e[e.SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN=34435]="SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN",e[e.SERVER_RECORD_UNREAD_COUNT_DISABLED=34436]="SERVER_RECORD_UNREAD_COUNT_DISABLED",e[e.DATABASEDISKFULL=34439]="DATABASEDISKFULL",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.NOT_SUPPORT=35004]="NOT_SUPPORT",e[e.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",e[e.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",e[e.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",e[e.INVALID_PARAMETER_MESSAGE_TYPE=35024]="INVALID_PARAMETER_MESSAGE_TYPE",e[e.INVALID_PARAMETER_ORDER=35025]="INVALID_PARAMETER_ORDER",e[e.INVALID_PARAMETER_DRAFT=35028]="INVALID_PARAMETER_DRAFT",e[e.INVALID_PARAMETER_MESSAGE=35029]="INVALID_PARAMETER_MESSAGE",e[e.INVALID_PARAMETER_PUSH_CONTENT=35030]="INVALID_PARAMETER_PUSH_CONTENT",e[e.INVALID_PARAMETER_SENDOPTIONS=35031]="INVALID_PARAMETER_SENDOPTIONS",e[e.INVALID_PARAMETER_CONTENT_DISPOSITION=35032]="INVALID_PARAMETER_CONTENT_DISPOSITION",e[e.INVALID_PARAMETER_SAVE_NAME=35033]="INVALID_PARAMETER_SAVE_NAME",e[e.INVALID_PARAMETER_SERVER_TYPE=35034]="INVALID_PARAMETER_SERVER_TYPE",e[e.INVALID_PARAMETER_CLEAN_SPACE=35035]="INVALID_PARAMETER_CLEAN_SPACE",e[e.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION=35036]="INVALID_PARAMETER_CAN_INCLUDE_EXPANSION",e[e.INVALID_PARAMETER_DISABLE_NOTIFICATION=35037]="INVALID_PARAMETER_DISABLE_NOTIFICATION",e[e.INVALID_PARAMETER_CHECK_DUPLICATE=35038]="INVALID_PARAMETER_CHECK_DUPLICATE",e[e.INVALID_PARAMETER_IS_AUTO_DELETE=35039]="INVALID_PARAMETER_IS_AUTO_DELETE",e[e.INVALID_PARAMETER_IS_SEND_NOTIFICATION=35040]="INVALID_PARAMETER_IS_SEND_NOTIFICATION",e[e.INVALID_PARAMETER_IS_FORCE=35041]="INVALID_PARAMETER_IS_FORCE",e[e.INVALID_PARAMETER_IS_TOP=35042]="INVALID_PARAMETER_IS_TOP",e[e.INVALID_PARAMETER_IS_UPDATE_TIME=35043]="INVALID_PARAMETER_IS_UPDATE_TIME",e[e.INVALID_PARAMETER_CONTAIN_MUTED=35044]="INVALID_PARAMETER_CONTAIN_MUTED",e[e.INVALID_PARAMETER_IS_STATUS_MESSAGE=35045]="INVALID_PARAMETER_IS_STATUS_MESSAGE",e[e.INVALID_PARAMETER_IS_MENTIONED=35046]="INVALID_PARAMETER_IS_MENTIONED",e[e.INVALID_PARAMETER_IS_VOIP_PUSH=35047]="INVALID_PARAMETER_IS_VOIP_PUSH",e[e.INVALID_PARAMETER_MENTIONED_TYPE=35048]="INVALID_PARAMETER_MENTIONED_TYPE",e[e.INVALID_PARAMETER_PUSH_CONFIG=35049]="INVALID_PARAMETER_PUSH_CONFIG",e[e.INVALID_PARAMETER_PUSH_DATA=35050]="INVALID_PARAMETER_PUSH_DATA",e[e.DNS_PROXY_TIMEOUT=35051]="DNS_PROXY_TIMEOUT",e[e.DNS_PROXY_ERROR=35052]="DNS_PROXY_ERROR",e[e.DNS_PROXY_DATA_ERROR=35053]="DNS_PROXY_DATA_ERROR",e[e.INVALID_DISABLE_UPDATE_LAST_MESSAGE=35054]="INVALID_DISABLE_UPDATE_LAST_MESSAGE",e[e.ONLY_DEFAULT_CHANNEL_SUPPORTS_PINNING=35055]="ONLY_DEFAULT_CHANNEL_SUPPORTS_PINNING",e[e.SEND_READ_RECEIPT_CONF_ERROR=35056]="SEND_READ_RECEIPT_CONF_ERROR",e[e.SPEECH_TO_TEXT_DISABLE=35057]="SPEECH_TO_TEXT_DISABLE",e[e.SPEECH_TO_TEXT_REQUEST_IN_PROCESS=35058]="SPEECH_TO_TEXT_REQUEST_IN_PROCESS",e[e.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED=35059]="SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED",e[e.TRANSLATION_PARAMS_TYPE_INVALID=35060]="TRANSLATION_PARAMS_TYPE_INVALID",e[e.TRANSLATION_PARAMS_LIST_INVALID=35061]="TRANSLATION_PARAMS_LIST_INVALID",e[e.INVALID_PARAMETER_TRANSLATE_STRATEGY=35062]="INVALID_PARAMETER_TRANSLATE_STRATEGY",e[e.TRANSLATION_LANGUAGE_SAME=35063]="TRANSLATION_LANGUAGE_SAME",e[e.INVALID_PARAMETER_TRANSLATE_MODE=35064]="INVALID_PARAMETER_TRANSLATE_MODE",e[e.TRANSLATION_TEXT_INVALID=35065]="TRANSLATION_TEXT_INVALID",e[e.MSG_BLOCK_SEND=35066]="MSG_BLOCK_SEND",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.STREAM_MESSAGE_DISABLE=39001]="STREAM_MESSAGE_DISABLE",e[e.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED=39002]="STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED",e[e.STREAM_MESSAGE_EXPANSION_KEY_ERROR=39003]="STREAM_MESSAGE_EXPANSION_KEY_ERROR",e[e.STREAM_MESSAGE_REQUEST_FAIL=39005]="STREAM_MESSAGE_REQUEST_FAIL",e[e.STREAM_MESSAGE_REQUEST_IN_PROCESS=39006]="STREAM_MESSAGE_REQUEST_IN_PROCESS",e[e.STREAM_MESSAGE_SYNCED=39007]="STREAM_MESSAGE_SYNCED",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.TIMEOUT=-1]="TIMEOUT"}(D||(D={})),function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(w||(w={}));const G=0,V=1,k=2,x=3,F=4,B=5,H=6,j=7,Y=e=>{const t=[w.PRIVATE,w.GROUP,w.SYSTEM,w.PUBLIC_SERVICE,w.APP_PUBLIC_SERVICE];switch(e){case G:return t;case V:return[w.PRIVATE,w.GROUP];case k:return[...t,w.ULTRA_GROUP];case x:return[...t,w.ULTRA_GROUP,w.CHATROOM];case F:return[...t,w.ULTRA_GROUP,w.CHATROOM,w.RTC_ROOM,w.CUSTOMER_SERVICE,w.DISCUSSION];case B:return[w.PRIVATE,w.GROUP,w.ULTRA_GROUP];case H:return[w.GROUP];case j:return[w.PRIVATE]}},W=(e,t)=>Y(t).includes(e);var q,J,K;!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"}(q||(q={})),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"}(J||(J={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(K||(K={}));const Q={TextMessage:"RC:TxtMsg",TEXT:"RC:TxtMsg",VOICE:"RC:VcMsg",HQ_VOICE:"RC:HQVCMsg",IMAGE:"RC:ImgMsg",GIF:"RC:GIFMsg",RICH_CONTENT:"RC:ImgTextMsg",LOCATION:"RC:LBSMsg",FILE:"RC:FileMsg",SIGHT:"RC:SightMsg",COMBINE:"RC:CombineMsg",COMBINE_V2:"RC:CombineV2Msg",CHRM_KV_NOTIFY:"RC:chrmKVNotiMsg",LOG_COMMAND:"RC:LogCmdMsg",EXPANSION_NOTIFY:"RC:MsgExMsg",REFERENCE:"RC:ReferenceMsg",RECALL:"RC:RcCmd",RECALL_MESSAGE_TYPE:"RC:RcCmd",RECALL_NOTIFICATION_MESSAGE:"RC:RcNtf",READ_RECEIPT:"RC:ReadNtf",READ_RECEIPT_REQUEST:"RC:RRReqMsg",READ_RECEIPT_RESPONSE:"RC:RRRspMsg",SYNC_READ_STATUS:"RC:SRSMsg",GROUP_READ_RECEIPT_REQUEST:"RC:RRMsg",READ_STATE:"RC:RSMsg",DELIVERED:"RC:Delivered",DELIVERED_MSG:"RC:DRMsg",CHATROOM_MERGE_CHANGE:"RC:ChrmMemChange",CHATROOM_SYNC_MSG:"RC:ChrmSyncMsg",CHATROOM_MERGE_BLOCK:"RC:ChrmBlockMsg",CHATROOM_MERGE_BAN:"RC:ChrmBanMsg",TYPING_STATUS:"RC:TypSts",INTERCEPT:"RC:InterceptMsg",CLOUD_CONTROL:"RC:CCConfigChangeRequestMsg",STREAM_MESSAGE:"RC:StreamMsg",COMMAND:"RC:CmdMsg",COMMAND_NOTIFICATION:"RC:CmdNtf",INFORMATION_NOTIFICATION:"RC:InfoNtf",GROUP_NOTIFICATION:"RC:GrpNtf"};var X,z,Z,$,ee,te,ie,se,ne,re,oe,ae,le,ce,_e,de,ue,he,ge,Ee,Ie;!function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(X||(X={})),function(e){e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(z||(z={})),function(e){e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY",e[e.MSG_RECALL=3]="MSG_RECALL",e[e.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",e[e.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE",e[e.UG_DEL=6]="UG_DEL"}(Z||(Z={})),function(e){e[e.CHANNEL_DELETE=1]="CHANNEL_DELETE",e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",e[e.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}($||($={})),function(e){e[e.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",e[e.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",e[e.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",e[e.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",e[e.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP"}(ee||(ee={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(te||(te={})),function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(ie||(ie={})),function(e){e[e.typing=0]="typing"}(se||(se={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}(ne||(ne={})),function(e){e[e.Other=0]="Other",e[e.iOS=1]="iOS",e[e.Android=2]="Android",e[e.Web=3]="Web",e[e.PC=4]="PC",e[e.Mini=5]="Mini",e[e.HarmonyOS=6]="HarmonyOS"}(re||(re={})),function(e){e[e.ONLINE_STATUS=1]="ONLINE_STATUS",e[e.USER_PROFILE=2]="USER_PROFILE",e[e.FRIEND_ONLINE_STATUS=3]="FRIEND_ONLINE_STATUS",e[e.FRIEND_USER_PROFILE=4]="FRIEND_USER_PROFILE"}(oe||(oe={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}(ae||(ae={})),function(e){e[e.NOT_SET=0]="NOT_SET",e[e.INVISIBLE=1]="INVISIBLE",e[e.EVERYONE=2]="EVERYONE",e[e.FriendVisible=3]="FriendVisible"}(le||(le={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(ce||(ce={})),function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(_e||(_e={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(de||(de={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(ue||(ue={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(he||(he={})),function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S",e.IM_CMP="IM-stats_cmp-S",e.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",e.IM_STATS_CS="IM-stats_cs-S",e.IM_NETWORK_CHANGE="IM-stats_network_change-S",e.L_CLOUD_INFO_FETCH_T="L-cloud_info_fetch-T",e.L_CLOUD_INFO_FETCH_R="L-cloud_info_fetch-R",e.IM_MSG_SEND="IM-msg_send-S",e.IM_MSG_RECEIVE="IM-msg_receive-S"}(ge||(ge={})),function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(Ee||(Ee={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(Ie||(Ie={}));const Te=e=>e===Ie.OPEN?Ee.AT_MESSAGE_NOTIFICATION:Ee.NOT_SET,fe=e=>e<=Ee.NOT_SET?Ie.CLOSE:Ie.OPEN;var Re,Ae,pe,me,Se,ve,Ne,Oe,ye;!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(Re||(Re={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(Ae||(Ae={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(pe||(pe={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(me||(me={})),function(e){e[e.CURRENT=2]="CURRENT"}(Se||(Se={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(ve||(ve={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Ne||(Ne={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(Oe||(Oe={})),function(e){e[e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT=0]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT",e[e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_MENTION_MESSAGE=1]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_MENTION_MESSAGE",e[e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_BLOCKED=5]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_BLOCKED"}(ye||(ye={}));const Ce={ALL:0,EXCLUDE_ROBOT:1,ROBOT_ONLY:2},Me={DISALLOW:0,ALLOW:1},be={NOT_CONVERTED:0,CONVERTING:1,SUCCESS:2,FAILED:3},Le={NORMAL:0,ROBOT:1},Ue={UNKNOWN:-1,V1:0,V2:1,V4:3,V5:4},Pe={DEFAULT:0,DELETED:1,RECALLED:2},De={ADDED:1,REMOVED:2,CLEARED:3},we={ALL:0,UNREAD_ONLY:1,MENTION_ONLY:2,NO_UNREAD:3};var Ge,Ve;!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"}(Ge||(Ge={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(Ve||(Ve={}));const ke=72e5,xe=6e4,Fe=131072,Be="5.46.0".replace(/-.+$/,""),He=5368709120,je=10485760,Ye="rongcloudsystem",We=864e5,qe="RCDeviceId",Je=e=>`navi_${e}`,Ke=(e,t)=>`RC-con-stat-ver-${e}-${t}`,Qe=(e,t)=>`RCV4-CONVER-${e}-${t}`,Xe=(e,t)=>`RCV4-ultragroupconversation-${e}-${t}`,ze=(e,t)=>`RC-con-type-settings-${e}-${t}`,Ze=(e,t)=>`outbox_${e}_${t}`,$e=(e,t)=>`inbox_${e}_${t}`,et=(e,t)=>`broadcastbox_${e}_${t}`,it=(e,t)=>`send_msg_${e}_${t}`,st=(e,t)=>`RC-us-${e}-${t}`,nt=e=>`rc-static-config-${e}`,rt=e=>`RC-cc-${e}`,ot=(e,t)=>`RC-RR-${e}-${t}`,at=e=>`RC-LI-${e}`,lt=Math.pow(2,31)-1,ct="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{},_t="engine";ct[_t]="5.46.0-c-tmp-alpha.1";class dt{static add(e,t){["imlib-next","engine","electron-main","electron-renderer","imlib-v2-adapter","Global_IM_UIKit","IMKit","imkit-store","rtclib","calllib","callplus","plugin-wechat-rtc"].includes(e)&&(ct[e]=t)}static validEngine(e){const t=e.match(/\d+\.\d+\.\d+/);if(!t)return!1;const i=t[0].split(".").map((e=>e.padStart(3,"0"))).join("");return ct[_t].match(/\d+\.\d+\.\d+/)[0].split(".").map((e=>e.padStart(3,"0"))).join("")>=i}static getInfo(){return ct}}const ut={gen:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=Math.floor(36*Math.random());return("x"===e?t:3&t|8).toString(36)})),genWithLen(e=22){const t=Date.now(),i=t.toString(36),s=Math.floor(Math.random()*t).toString(36),n=e-i.length-s.length;var r;return[s,i,n>0?(r=n,Array.from({length:r}).map((()=>Math.floor(36*Math.random()).toString(36))).join("")):""].join("").slice(0,e)}},ht=ut.genWithLen(22),gt=Date.now(),Et=e=>"string"==typeof e,It=e=>"boolean"==typeof e,Tt=e=>"number"==typeof e&&!Number.isNaN(e),ft=e=>t=>Number.isInteger(t)&&(void 0===e.min||t>=e.min)&&(void 0===e.max||t<=e.max),Rt=e=>-1!==Object.prototype.toString.call(e).indexOf("Array"),At=e=>t=>Et(t)&&(void 0===e.isTrim||0===t.length||t.trim().length>0)&&(void 0===e.minLength||t.length>=e.minLength)&&(void 0===e.maxLength||t.length<=e.maxLength)&&(void 0===e.validator||e.validator(t)),pt=e=>Et(e)&&e.length>0,mt=e=>Rt(e)&&e.length>0,St=e=>"[object Object]"===Object.prototype.toString.call(e),vt=e=>"function"==typeof e,Nt=e=>void 0===e||"[object Undefined]"===Object.prototype.toString.call(e),Ot=e=>Et(e)&&/https?:\/\//.test(e),yt=e=>{for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},Ct=e=>Tt(e)&&Object.prototype.hasOwnProperty.call(w,e),Mt=e=>Tt(e)&&Object.prototype.hasOwnProperty.call(Ee,e),bt=e=>{let t=!1;return Et(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Lt=e=>Object.values(e.type).includes(e.value),Ut=e=>At({minLength:1,maxLength:64})(e),Pt=e=>At({minLength:1,maxLength:64})(e)&&/^[a-zA-Z0-9+=\-_|:]*$/.test(e),Dt=e=>Tt(e)&&Object.prototype.hasOwnProperty.call(J,e),wt=()=>void 0!==(null===window||void 0===window?void 0:window.__RCCppContextBridge__),Gt=e=>({isRead:(e&Re.READ)===Re.READ,isListened:(e&Re.LISTENED)===Re.LISTENED,isDownload:(e&Re.DOWNLOADED)===Re.DOWNLOADED,isRetrieved:(e&Re.RETRIEVED)===Re.RETRIEVED}),Vt=e=>{let t=Re.UNREAD;return(null==e?void 0:e.isRead)&&(t|=Re.READ),(null==e?void 0:e.isListened)&&(t|=Re.LISTENED),(null==e?void 0:e.isDownload)&&(t|=Re.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=Re.RETRIEVED),t},kt=e=>[re.iOS,re.Android,re.Web,re.PC,re.Mini,re.HarmonyOS].map((t=>{const i=e.findIndex((e=>e.platform===t));return-1===i?{platform:t,changeTime:0,eventValue:0}:e[i]})),xt=(e,t,i)=>{const s=t.reduce(((e,t)=>(["gender","role","level"].includes(t.key)?e[t.key]=Number(t.value):e[t.key]=t.value,e)),{});return s.userId=e,i.forEach((e=>{s.extraProfile=s.extraProfile||{},s.extraProfile[e.key]=e.value})),s},Ft=(e,t,i)=>t?1===i?q.TLS:q.RMTP:"http"===e?q.WS:q.WSS,Bt=(e,t)=>{const{server:i,backupServer:s,bs:n,serverAddr:r,protocol:o,openTLS:a}=e;if(r){return[...r.filter((e=>e.addr))]}const l=[],c=[];return i&&c.push(i),(s||n||"").split(",").forEach((e=>{c.indexOf(e)<0&&c.push(e)})),c.forEach(((e,s)=>{e&&l.push({addr:e,protocol:Ft(o,t,a),weight:i.length-s,race:!1})})),[...l]},Ht=(e=[])=>e.map((e=>{const t=Wt(e.settingProfile),i=e.extProfile||[],{targetId:s,baseInfo:n,userInfo:r}=e;return JSON.parse(JSON.stringify(Object.assign(Object.assign({groupId:s},Yt(t)),{extProfile:i.length>0?Wt(i):void 0,creatorId:null==n?void 0:n.creatorId,ownerId:null==n?void 0:n.ownerId,createTime:null==n?void 0:n.createTime,membersCount:null==n?void 0:n.memberCount,remark:null==r?void 0:r.remarkName})))})),jt=e=>{if(void 0===e)return;const t=Number(e);return Number.isNaN(t)?void 0:t},Yt=e=>JSON.parse(JSON.stringify({groupName:e.name,portraitUri:e.portraitUrl,introduction:e.introduction,notice:e.announcement,joinPermission:jt(e.joinPerm),removeMemberPermission:jt(e.removePerm),invitePermission:jt(e.memInvitePerm),inviteHandlePermission:jt(e.invitePerm),groupInfoEditPermission:jt(e.profilePerm),memberInfoEditPermission:jt(e.memProfilePerm)})),Wt=e=>{let t={};return e&&0!==e.length?(e.forEach((e=>{t[e.key]=e.value})),t):t},qt=e=>{const{userId:t,name:i,portraitUrl:s,ext:n}=e,{role:r,joinTime:o,channelNickName:a,additional:l,isBot:c}=n||{};return{userId:t,name:i||"",portraitUri:s||"",nickname:a||"",extra:l||"",role:r||f.UNDEF,joinedTime:o||0,isRobot:!!c}},Jt=e=>{const{joinUserInfo:t,inviterInfo:i,processInfo:s}=e;return{groupId:e.targetId,joinMemberInfo:qt(t),inviterInfo:i&&i.userId?qt(i):void 0,operatorInfo:s&&s.userId?qt(s):void 0,status:e.status,direction:e.directionType,type:e.joinType,operationTime:e.applyTime||0,reason:e.detail||""}},Kt=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{}),Qt=(e,t)=>{if(e=e.replace(/\?$/,""),!t)return e;const i=Object.keys(t).map((e=>`${e}=${t[e]}`)).filter((e=>!!e));return i.length?[e,i.join("&")].join("?"):e};const Xt=(e,t)=>{const i=Math.floor(1e3*Math.random()%1e4),s=ut.gen(),n=(e=>{e=e||"-";const t=new Date;return`${t.getFullYear()}${e}${t.getMonth()+1}${e}${t.getDate()}`})(),r=(new Date).getTime();let o="";if(t){const e=t.split(".");o=`.${e[e.length-1]}`}return`${e}__RC-${n}_${i}_${r}${s}${o}`},zt=(e={},t={},i={})=>{const{channelIdMi:s,channelIdHW:n,channelIdOPPO:r,typeVivo:o,importanceHW:a,categoryHW:l,imageUrlHW:c,categoryVivo:_,importanceHonor:d,imageUrlHonor:u}=t,{APNS:h,FCM:g}=((e={},t={})=>{const{threadId:i,apnsCollapseId:s,category:n,richMediaUri:r,interruptionLevel:o}=e,{googleConfig:a}=t,l={};l["thread-id"]=i||"",l["apns-collapse-id"]=s||"",l.category=n||"",l.richMediaUri=r||"",l["interruption-level"]=o||"active";const c={};c.collapse_key=null==a?void 0:a.collapseKey,c.imageUrl=null==a?void 0:a.imageUrl;let _=null==a?void 0:a.priority;return _&&!["high","normal"].includes(_)&&(_="normal"),c.priority=_,{APNS:l,FCM:c}})(e,t),E=[{HW:{channelId:n||"",importance:a||"NORMAL",image:c||"",category:l||""}},{MI:{channelId:s||""}},{OPPO:{channelId:r||""}},{VIVO:{classification:o||"",category:_||""}},{APNS:h},{FCM:g},{HONOR:{importance:d||he.NORMAL,image:u||""}},{OHOS:{category:i.category||null,image:i.image||""}}];return JSON.stringify(E)},Zt=(e,t)=>{const i={},s={notificationId:t||""},n={};if(!e)return{iOSConfig:i,androidConfig:s,harmonyOSConfig:n};try{const t=JSON.parse(e);null==t||t.forEach((e=>{var t,r,o,a,l,c,_,d,u,h,g,E;const I=Object.keys(e);if(0===I.length)return;const T=I[0];switch(T){case"HW":return s.channelIdHW=null===(t=e[T])||void 0===t?void 0:t.channelId,s.importanceHW=null===(r=e[T])||void 0===r?void 0:r.importance,s.imageUrlHW=null===(o=e[T])||void 0===o?void 0:o.image,void(s.categoryHW=null===(a=e[T])||void 0===a?void 0:a.category);case"MI":return void(s.channelIdMi=null===(l=e[T])||void 0===l?void 0:l.channelId);case"OPPO":return void(s.channelIdOPPO=null===(c=e[T])||void 0===c?void 0:c.channelId);case"VIVO":return s.typeVivo=null===(_=e[T])||void 0===_?void 0:_.classification,void(s.categoryVivo=null===(d=e[T])||void 0===d?void 0:d.category);case"APNS":return i.threadId=e[T]["thread-id"],i.apnsCollapseId=e[T]["apns-collapse-id"],i.category=e[T].category,i.richMediaUri=e[T].richMediaUri,void(i.interruptionLevel=e[T]["interruption-level"]);case"FCM":return void(s.googleConfig={collapseKey:e[T].collapse_key||"",imageUrl:e[T].imageUrl||"",priority:e[T].priority||""});case"HONOR":return s.importanceHonor=null===(u=e[T])||void 0===u?void 0:u.importance,void(s.imageUrlHonor=null===(h=e[T])||void 0===h?void 0:h.image);case"OHOS":n.category=null===(g=e[T])||void 0===g?void 0:g.category,n.image=null===(E=e[T])||void 0===E?void 0:E.image}}))}catch(e){}return{iOSConfig:i,androidConfig:s,harmonyOSConfig:n}},$t=e=>{const t=/^[A-Za-z0-9_=+-]+$/.test(e),i=e.length;return t&&(i<=128&&i>=1)},ei=e=>{const{length:t}=e;return t<=4096&&t>=1},ti=(()=>{let e=0;return()=>{const t=((4294967295&Date.now())>>>0).toString(2),i=Math.floor(Math.random()*(Math.pow(2,8)-1)),s=t+e.toString(2).padStart(11,"0")+i.toString(2).padStart(8,"0");return e=2047&++e,parseInt(s,2)}})(),ii=()=>{const e=dt.getInfo();let t="electron";for(let i in e)"engine"!==i&&(t=["imlib-v2-adapter","imlib-next"].includes(i)?i:"electron");return t},si=(e,i,s)=>t(void 0,void 0,void 0,(function*(){const t=yield window.crypto.subtle.importKey("raw",(new TextEncoder).encode(i),"AES-CBC",!0,["decrypt"]),n=yield window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(s)},t,function(e){const t=null===window||void 0===window?void 0:window.atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return i.buffer}(e));return(new TextDecoder).decode(n)}));function ni(e,t){var i;if(!e)return"";const s="undefined"!=typeof window&&"https:"===(null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.protocol);return/^https?:\/\//.test(e)?s?e.replace(/^https?:\/\//i,"https://"):e:t!==q.HTTP||s?`https://${e}`:`http://${e}`}const ri=(e,t)=>{if(!e)return"";const{ossConfig:i=""}=e;let s="";try{const e=JSON.parse(i);if(e.length>0){const t=e.find((e=>e.minio));t&&(s=t.minio)}}catch(e){t.warn(r.L_PARSE_JSON_E,JSON.stringify({ossConfig:i,error:e}))}return s};const oi=(e,t)=>t&&0!==t.length?[w.GROUP,w.ULTRA_GROUP,w.APP_PUBLIC_SERVICE,w.PUBLIC_SERVICE].includes(e)?t:[]:t||[];class ai extends Error{constructor(e){super(e),this.name="RCError"}static InvalidParameters(e){return(null==e?void 0:e.length)?new ai(`Invalid parameter -> ${e}`):new ai("Invalid parameters.")}static ParameterTypeError(){return new ai("Wrong parameter type")}}var li;class ci{constructor(){li.set(this,!1)}stopPropagation(){s(this,li,!0,"f")}get isStopPropagation(){return i(this,li,"f")}}li=new WeakMap;class _i{constructor(){Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_piped",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}_addItem(e,t,i,s,n=0){const r=Symbol(),o=this._map.get(e)||this._map.set(e,[]).get(e),a={symbol:r,priority:Math.min(n,100),listener:t.bind(s),once:i},l=o.findIndex((e=>e.priority>n));return-1===l?o.push(a):o.splice(l,0,a),r}on(e,t,i,s=0){return this._addItem(e,t,!1,i,s)}once(e,t,i,s=0){return this._addItem(e,t,!0,i,s)}off(e){for(let[t,i]of this._map){const t=i.findIndex((t=>t.symbol===e));if(-1!==t)return void i.splice(t,1)}}emit(e,...t){const i=this._map.get(e);if(i&&i.length>0){const e=new ci;for(let s=0;s<i.length;s+=1){const{once:n,listener:r}=i[s];n&&i.splice(s,1);try{r(e,...t)}catch(e){null===console||void 0===console||console.error(e)}if(e.isStopPropagation)return}}[...this._piped.entries()].forEach((([i,s])=>{(0===s.length||s.includes(e))&&i.emit(e,...t)}))}removeAll(e){this._map.delete(e)}clear(){this._piped.clear(),this._map.clear()}pipe(e,t){this._piped.set(e,t||[])}}class di extends _i{constructor(e){super(),Object.defineProperty(this,"_name",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_versionQueue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_pullingPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_dataVersion",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"_invervalTimer",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"_started",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get length(){return this._versionQueue.length}get _isPulling(){return null!==this._pullingPromise}setInitVersion(e,t=!1){-1===this._dataVersion&&(this._dataVersion=e,t&&this._execPulling())}push(e){this._versionQueue.push(e),-1!==this._dataVersion&&this._execPulling()}_execPulling(){return t(this,void 0,void 0,(function*(){if(this._pullingPromise)return;this._pullingPromise=this._handleSyncData(this._dataVersion);const{isOk:e,data:t}=yield this._pullingPromise;if(this._pullingPromise=null,!e)return;if(void 0===(null==t?void 0:t.version)||t.version<this._dataVersion)throw new Error(`${this._name}: version error, please check: lastVersion: ${this._dataVersion}, newVersion: ${null==t?void 0:t.version}`);const{version:i,hasNext:s}=t,n=this._versionQueue.filter((e=>e>i));return this._versionQueue=[...n],this._dataVersion=i,s?this._execPulling():this._versionQueue.length>0?(this._versionQueue.length=0,this._execPulling()):void 0}))}startInterval(e,t){this._started||(this._started=!0,t&&this._execPulling(),this._invervalTimer=setInterval((()=>this._execPulling()),e))}stopInterval(){this._started&&(this._started=!1,clearInterval(this._invervalTimer),this._invervalTimer=-1)}reset(){this.stopInterval(),this._versionQueue.length=0,this._dataVersion=-1}}class ui{constructor(e,t){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((t=>{this._resolve=t,e(this._onResolve.bind(this))})),this._onCancel=t}_onResolve(e){this._resolve(e)}result(){return this._promise}abort(){this._onCancel(this._onResolve.bind(this))}}class hi{constructor(e,t,i){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===e,this.code=e,this.msg=t,this.data=i}static from(e,t,i){return new hi(e,t||`fail: ${e}`,i)}static ok(e,t){return new hi(0,t||"success",e)}static fail(e,t,i){return new hi(e,t||`fail: ${e}`,i)}next(e){return t(this,void 0,void 0,(function*(){return this.isOk?e(this.data):this.wipe()}))}or(e){return t(this,void 0,void 0,(function*(){return this.isOk?this:e(this.code)}))}orSync(e){return this.isOk?this:e(this.code)}trans(e){return this.isOk?gi(e(this.data)):this.wipe()}tryTrans(e){return this.isOk?e(this.data):this.wipe()}errmsg(){return JSON.stringify({code:this.code,msg:this.msg})}wipe(){return this.isOk?gi(void 0,this.msg):Ei(this.code,this.msg)}}const{ok:gi}=hi,{fail:Ei}=hi;class Ii{constructor(e){Object.defineProperty(this,"_apiName",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_isValid",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_code",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_errmsg",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}static create(e){return new Ii(e)}get isFailed(){return!this._isValid}fail(e,t,i=!1){return this.isFailed&&(0===this._code||i)&&(this._code=e,this._errmsg=t||this._errmsg),this}setFailed(e,t){return this._isValid=!1,this.fail(e,t)}result(){if(this.isFailed&&0===this._code)throw new Error("Validator: result() should not be called without fail()");return this.isFailed?Ei(this._code,this._errmsg):gi()}check(e){return this.isFailed||e(this),this}validate(e,t,i,s=!1){if(this.isFailed)return this;const n=s?i(t):null==t||i(t);return this._isValid=n,this.isFailed&&(this._errmsg=`param '${e}' is invalid`),this}assert(e,t,i,s=!1){if(this.isFailed)return this;if(this.validate(e,t,i,s),this.isFailed)throw ai.InvalidParameters(`'${e}' at '${this._apiName}'`);return this}isString(e,t,i=!1){return this.validate(e,t,(()=>"string"==typeof t),i)}assertString(e,t,i=!1){return this.assert(e,t,(()=>"string"==typeof t),i)}isHttpUrl(e,t,i=!1){return this.isNotEmptyString(e,t,i).validate(e,t,(e=>/^https?:\/\//.test(e)))}isNotEmptyString(e,t,i=!1){return this.isString(e,t,i).validate(e,t,(e=>e.trim().length>0),i)}assertNotEmptyString(e,t,i=!1){return this.assertString(e,t,i),this.assert(e,t,(e=>e.trim().length>0),i)}isLimitedString(e,t,i,s,n=!1){return this.isString(e,t,n).validate(e,t,(e=>e.length>=i&&e.length<=s),n)}assertLimitedString(e,t,i,s,n=!1){return this.assertString(e,t,n),this.assert(e,t,(e=>e.length>=i&&e.length<=s),n)}isBoolean(e,t,i=!1){return this.validate(e,t,(e=>"boolean"==typeof e),i)}assertBoolean(e,t,i=!1){return this.assert(e,t,(e=>"boolean"==typeof e),i)}isNumber(e,t,i=!1){return this.validate(e,t,(e=>"number"==typeof e&&!Number.isNaN(e)),i)}assertNumber(e,t,i=!1){return this.assert(e,t,(e=>"number"==typeof e&&!Number.isNaN(e)),i)}isLimitedNumber(e,t,i,s,n=!1){return this.isNumber(e,t,n).validate(e,t,(e=>e>=i&&e<=s),n)}assertLimitedNumber(e,t,i,s,n=!1){return this.assertNumber(e,t,n),this.assert(e,t,(e=>e>=i&&e<=s),n)}isInteger(e,t,i=!1){return this.validate(e,t,(e=>Number.isInteger(e)),i)}assertInteger(e,t,i=!1){return this.assert(e,t,(e=>Number.isInteger(e)),i)}isLimitedInteger(e,t,i,s,n=!1){return this.isInteger(e,t,n).validate(e,t,(e=>e>=i&&e<=s),n)}isTimestamp(e,t,i=!1){return this.isLimitedInteger(e,t,0,Number.MAX_SAFE_INTEGER,i)}assertLimitedInteger(e,t,i,s,n=!1){return this.assertInteger(e,t,n),this.assert(e,t,(e=>e>=i&&e<=s),n)}isArray(e,t,i=!1){return this.validate(e,t,(e=>-1!==Object.prototype.toString.call(e).indexOf("Array")),i)}assertArray(e,t,i=!1){return this.assert(e,t,(e=>-1!==Object.prototype.toString.call(e).indexOf("Array")),i)}isLimitedArray(e,t,i,s=!1,n=1){return this.isArray(e,t,s).validate(e,t,(e=>e.length>=n&&e.length<=i),s)}assertLimitedArray(e,t,i,s=!1,n=1){return this.assertArray(e,t,s),this.assert(e,t,(e=>e.length>=n&&e.length<=i),s)}isTypedArray(e,t,i,s=!1){return this.isArray(e,t,s).validate(e,t,(e=>e.every(i)),s)}assertTypedArray(e,t,i,s=!1){return this.assertArray(e,t,s),this.assert(e,t,(e=>e.every(i)),s)}isLimitedTypedArray(e,t,i,s,n=!1,r=1){return this.isLimitedArray(e,t,i,n,r).validate(e,t,(e=>e.every(s)),n)}assertLimitedTypedArray(e,t,i,s,n=!1,r=1){return this.assertLimitedArray(e,t,i,n,r),this.assert(e,t,(e=>e.every(s)),n)}isObject(e,t,i=!1){return this.validate(e,t,(e=>"[object Object]"===Object.prototype.toString.call(e)),i)}assertObject(e,t,i=!1){return this.assert(e,t,(e=>"[object Object]"===Object.prototype.toString.call(e)),i)}isStringEnum(e,t,i,s=!1){return this.isString(e,t,s).validate(e,t,(e=>Object.values(i).includes(e)),s)}isNumberEnum(e,t,i,s=!1){return this.isNumber(e,t,s).validate(e,t,(e=>Object.values(i).includes(e)),s)}assertValueOf(e,t,i,s=!1){return this.assert(e,t,(()=>Object.values(i).includes(t)),s)}isFunction(e,t,i=!1){return this.validate(e,t,(e=>"function"==typeof e),i)}assertFunction(e,t,i=!1){return this.assert(e,t,(e=>"function"==typeof e),i)}}const Ti="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function fi(e){let t,i,s,n,r,o,a,l="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c<e.length;)n=Ti.indexOf(e.charAt(c++)),r=Ti.indexOf(e.charAt(c++)),o=Ti.indexOf(e.charAt(c++)),a=Ti.indexOf(e.charAt(c++)),t=n<<2|r>>4,i=(15&r)<<4|o>>2,s=(3&o)<<6|a,l+=String.fromCharCode(t),64!==o&&(l+=String.fromCharCode(i)),64!==a&&(l+=String.fromCharCode(s));return l}const Ri=()=>{let e,t=new Promise((t=>{e=t}));return{resolve:e,promise:t}},Ai=1732584193,pi=4023233417,mi=2562383102,Si=271733878,vi=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Ni=[3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745];function Oi(e,t){return e<<t|e>>>32-t}function yi(e,t,i){return e&i|t&~i}function Ci(e,t,i){return e^t^i}function Mi(e,t,i){return t^(e|~i)}function bi(e){const t=[];for(let i=0;i<e.length;i+=4)t.push((e[i]||0)|(e[i+1]||0)<<8|(e[i+2]||0)<<16|(e[i+3]||0)<<24);return t}function Li(e){const t=new Uint8Array(4);return t[0]=255&e,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}function Ui(e){const t=8*e.length,i=e.length%64<56?56-e.length%64:120-e.length%64,s=new Uint8Array(e.length+i+8);s.set(e),s[e.length]=128;for(let t=1;t<i;t++)s[e.length+t]=0;const n=new Uint8Array(8),r=4294967295&t,o=4294967295&Math.floor(t/4294967296);n.set(Li(r),0),n.set(Li(o),4),s.set(n,e.length+i);let a=Ai,l=pi,c=mi,_=Si;for(let e=0;e<s.length;e+=64){const t=bi(s.slice(e,e+64)),i=a,n=l,r=c,o=_;for(let e=0;e<64;e++){let i,s;e<16?(i=(d=l)&c|~d&_,s=e):e<32?(i=yi(l,c,_),s=(5*e+1)%16):e<48?(i=Ci(l,c,_),s=(3*e+5)%16):(i=Mi(l,c,_),s=7*e%16);const n=_;_=c,c=l,l+=Oi(a+i+Ni[e]+t[s]&4294967295,vi[e]),a=n}a=a+i&4294967295,l=l+n&4294967295,c=c+r&4294967295,_=_+o&4294967295}var d;const u=new Uint8Array(16);return u.set(Li(a),0),u.set(Li(l),4),u.set(Li(c),8),u.set(Li(_),12),function(e){return Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join("")}(u)}function Pi(e){const t=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);const t=unescape(encodeURIComponent(e)).split("").map((e=>e.charCodeAt(0)));return new Uint8Array(t)}(e);return Ui(t)}function Di(e){const t=e.method||Ve.GET,i=e.timeout||xe,{headers:s,query:n,body:r,onProgress:o}=e,a=Qt(e.url,n),l=new XMLHttpRequest;if(l.open(t,a),s&&l.setRequestHeader)for(const e in s)l.setRequestHeader(e,s[e]);return function(e,t,i,s){return new ui((n=>{e.onreadystatechange=()=>{4===e.readyState&&n({data:e.responseText,status:e.status,xhr:e})},e.onerror=()=>{n({status:e.status})},s&&(e.upload.onprogress=e=>s(e)),0!==t&&setTimeout((()=>{e.abort(),n({status:e.status})}),t),e.send(i)}),(t=>{e.abort(),t({status:-1})}))}(l,i,r,o)}var wi;!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(wi||(wi={}));const Gi={SUCCESS:0,UPDATING:1,FAILED:2},Vi={DEFAULT:0,MODIFIED:1,RECALLED:2,DELETE:3},ki={TranslationLanguage:0,AutoTranslateEnable:1};var xi;!function(e){e[e.BJ=1]="BJ",e[e.SG=2]="SG",e[e.NA=3]="NA",e[e.SG_A=4]="SG_A",e[e.SG_B=4]="SG_B",e[e.SA=5]="SA",e[e.OM=6]="OM"}(xi||(xi={}));const Fi={[xi.BJ]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5yb25nLWVkZ2UuY29t","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ucm9uZy1lZGdlLmNvbQ==",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnJvbmctZWRnZS5jb20=","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5yb25nLWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5yb25nLWVkZ2UuY29t"]},[xi.SG]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zZy1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2ctbGlnaHQtZWRnZS5jb20=",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWxpZ2h0LWVkZ2UuY29t","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1saWdodC1lZGdlLmNvbQ=="]},[xi.NA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi51cy1saWdodC1lZGdlLmNvbQ==","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24udXMtbGlnaHQtZWRnZS5jb20=",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnVzLWxpZ2h0LWVkZ2UuY29t","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC51cy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy51cy1saWdodC1lZGdlLmNvbQ=="]},[xi.SG_B]:{naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWItbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1iLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1iLWxpZ2h0LWVkZ2UuY29t"]},[xi.SA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zYXUtbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2F1LWxpZ2h0LWVkZ2UuY29t",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNhdS1saWdodC1lZGdlLmNvbQ==","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zYXUtbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zYXUtbGlnaHQtZWRnZS5jb20="]},[xi.OM]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5vbS1saWdodC1lZGdlLmNvbQ==","bmF2LWIub20tbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ub20tbGlnaHQtZWRnZS5jb20=",protocol:q.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLm9tLWxpZ2h0LWVkZ2UuY29t","d3MtYi5vbS1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5vbS1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIub20tbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9kdWFsc3RhY2stc3RhdHMub20tbGlnaHQtZWRnZS5jb20="]}};function Bi(e){return xi[e]?e:xi.BJ}const Hi=new class{constructor(){Object.defineProperty(this,"initOption",{enumerable:!0,configurable:!0,writable:!0,value:{}})}init(e){this.initOption=e}getNaviUrlList(e,t){const{areaCode:i,navigators:s}=this.initOption||{},n=function(e=xi.BJ){return Fi[Bi(e)].naviUrlBase64}(i).map((e=>fi(e)));let r=[];const[,o]=e.split("@");t&&(r=o?o.split(";"):[]);const a=s&&s.length>0?[...r,...s]:[...r,...n];return a.filter(((e,t)=>a.indexOf(e)===t)).map((e=>ni(e)))}getLogUrlPolicyList(e,t){const{log:i,logPolicy:s}=e||{},{areaCode:n,logServerUrl:o}=this.initOption||{},a=function(e=xi.BJ){return Fi[Bi(e)].logUrlBase64}(n).map((e=>Object.assign(Object.assign({},e),{addr:fi(e.addr)}))),l=[],c={level:1,itv:6,times:5};if(i)l.push(...i.addrs),Object.assign(c,i.policy);else if(s)try{const e=JSON.parse(s);l.push({addr:e.url,protocol:q.HTTPS,weight:1}),c.level=e.level,c.itv=e.itv,c.times=e.times}catch(i){t.warn(r.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}const _=o?[{addr:o,protocol:q.HTTPS,weight:101},...l]:[...l,...a];return{policy:c,addrs:_.filter(((e,t)=>_.findIndex((t=>t.addr===e.addr&&t.protocol===e.protocol))===t)).map((e=>Object.assign(Object.assign({},e),{addr:ni(e.addr,e.protocol)}))).sort(((e,t)=>t.weight-e.weight))}}getMiniCmpUrlList(){var e;const t=function(e=xi.BJ){return Fi[Bi(e)].miniCmpBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>fi(e))),{miniCMPProxy:i}=this.initOption||{};return i&&i.length>0?i:t}getStaticConfigUrl(){var e;return function(e=xi.BJ){return Fi[Bi(e)].staticConfigUrlBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>fi(e)))}getCloudControllerUrl(e){var t;return function(e=xi.BJ){return Fi[Bi(e)].cloudControllerUrlBase64}(null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode).map((e=>fi(e)))}getAreaCode(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:xi.BJ}setAreaCode(e){return!(!e||!xi[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)}getStatsUrlList(e){var t;const{active:i,activeServer:s}=e||{};let n=(null==i?void 0:i.addrs)||[];const r=function(e=xi.BJ){return Fi[Bi(e)].statsUrlBase64}(null===(t=this.initOption)||void 0===t?void 0:t.areaCode).map((e=>fi(e))),o=[];return 0!==n.length?o.push(...n.sort(((e,t)=>t.weight-e.weight)).map((e=>ni(e.addr,e.protocol)))):s&&o.push(ni(s,q.HTTPS)),r.forEach((e=>{o.includes(e)||o.push(e)})),o}};class ji{constructor(e,t){Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"staticUrls",{enumerable:!0,configurable:!0,writable:!0,value:[]})}getStaticConfig(){var e;return t(this,void 0,void 0,(function*(){const t=this.getCache();if(t){try{const e=JSON.parse(t);if(Date.now()-(null==e?void 0:e.time)<18e5){const t=(yield this.decryptData(e.val)).resources.navi.slice();return t.sort(((e,t)=>t.weight-e.weight)),{navi:t.map((e=>ni(e.addr,e.protocol)))||[]}}}catch(e){this.logger.error(r.L_GET_STATIC_CONF_E,JSON.stringify({error:null==e?void 0:e.stack}))}this.clearCache()}const i=yield this._requestHandle();if(!i)return;const s=yield this.decryptData(i);if((null==s?void 0:s.areaCode)!==Hi.getAreaCode())return;this.setCache(JSON.stringify({time:Date.now(),val:i})),this.staticUrls=(null==s?void 0:s.bootstrap)||[];const n=null===(e=null==s?void 0:s.resources)||void 0===e?void 0:e.navi.slice();return n.sort(((e,t)=>t.weight-e.weight)),{navi:n.map((e=>ni(e.addr,e.protocol)))||[]}}))}_requestHandle(){return t(this,void 0,void 0,(function*(){let e=[...this.staticUrls,...Hi.getStaticConfigUrl()].map((e=>ni(e)));e=e.filter(((t,i)=>e.indexOf(t)===i));for(let t of e){this.logger.info(r.L_GET_STATIC_CONF_T,JSON.stringify({url:t}));const e=Date.now(),{code:i,data:s}=yield this.sendRequest(`${t}/${this.appkey}`);if(200===i)return this.logger.info(r.L_GET_STATIC_CONF_R,JSON.stringify({url:t,code:i,duration:Date.now()-e})),s;this.logger.warn(r.L_GET_STATIC_CONF_R,JSON.stringify({url:t,code:i,duration:Date.now()-e}))}}))}}var Yi;!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD",e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG"}(Yi||(Yi={}));class Wi{constructor(e,t,i,s){Object.defineProperty(this,"_appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_type",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"proxy",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"outputLevel",{enumerable:!0,configurable:!0,writable:!0,value:Yi.WARN}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Yi.DEBUG)}),Object.defineProperty(this,"info",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Yi.INFO)}),Object.defineProperty(this,"warn",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Yi.WARN)}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Yi.ERROR)}),Object.defineProperty(this,"__statistics",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Yi.STATISTICS)}),Object.defineProperty(this,"record",{enumerable:!0,configurable:!0,writable:!0,value:this.__statistics})}_write(e){const{tag:t,level:i,content:s,traceId:n}=e;/^[\w-]+$/.test(t)?i!==Yi.DEBUG&&this.proxy.write(e):console.error(`${(new Date).toISOString()}[${this._id}]['ERROR']: ${t} | ${s} | ${n}`)}createTraceId(){return""+ ++Wi._traceIdCount}getSessionId(){return ht}_stdout(e){const{time:t,tag:i,content:s,traceId:n,level:r,loggerId:o}=e;if(!console)return;if(r<=Yi.FATAL)return;if(r>this.outputLevel)return;const a=["error","warn","info","debug"][r-1],l=`${new Date(t).toISOString()}[${null!=o?o:this._id}][${(a||"stat").toUpperCase()}]: ${i} | ${s} | ${n}`;console[a||"warn"](l)}setOutputLevel(e){(e=>[Yi.DEBUG,Yi.INFO,Yi.WARN,Yi.ERROR].some((t=>t===e)))(e)&&(this.outputLevel=e)}_log(e,t,i,s){const n={time:Date.now(),level:e,tag:t,content:i,traceId:s,loggerId:this._id,sessionId:this.getSessionId(),type:this._type};this._stdout(n),this._write(n)}summary(e,t,i,s={},n,r){if(t.isOk){const r=null==n?void 0:n(t.data);this.info(e,JSON.stringify(Object.assign(Object.assign({isOk:!0},s),r)),i)}else{const n=null==r?void 0:r(t.data);this.warn(e,JSON.stringify(Object.assign(Object.assign({code:t.code,msg:t.msg},s),n)),i)}}}Object.defineProperty(Wi,"_traceIdCount",{enumerable:!0,configurable:!0,writable:!0,value:0});class qi{constructor(e,t,i,s,n=!1){Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"deviceInfo",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"logDB",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"disableLogReport",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"userId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"reportFailedNumber",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"itvByNavi",{enumerable:!0,configurable:!0,writable:!0,value:6}),Object.defineProperty(this,"timesByNavi",{enumerable:!0,configurable:!0,writable:!0,value:5})}_getLogs(e,i,s,n,r,o){return t(this,void 0,void 0,(function*(){let t=[];try{const r=yield this.logDB.read(e,i,s,n,o);Rt(r.logs)&&(t=r.logs.filter((e=>!(!e||"object"!=typeof e))))}catch(e){}return{logs:t}}))}checkStart(e,i){return t(this,void 0,void 0,(function*(){if(this.started)return;if(this.userId=e.userId,!e.logSwitch||this.disableLogReport)return;const{policy:t,addrs:s}=Hi.getLogUrlPolicyList(e,this.logger);this.started=!0,this.itvByNavi=t.itv,this.timesByNavi=t.times,s.length>0&&this.realtimeReport(s[0].addr,t.level,t.itv,i)}))}_sendLogs2Realtime(e,i,s,n){return t(this,void 0,void 0,(function*(){const{success:t,data:o}=yield this.compressLogs(e);if(!t)return{isOk:!1,itv:n};let a=Ot(s)?s:`https://${s}`;a+=`?version=5.46.0-c-tmp-alpha.1&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.getDeviceId()}&deviceInfo=${this.deviceInfo}&platform=Web`;const{status:l,data:c}=yield this.send({url:a,body:o,method:"POST"});if(200!==l)return this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(n+=n),this.reportFailedNumber++,{isOk:!1,itv:n};let _,d;if(this.reportFailedNumber=0,c)try{const e=JSON.parse(c);e.nextTime&&(n=e.nextTime),_=e.level,d=e.logSwitch}catch(e){this.logger.warn(r.L_PARSE_JSON_E,JSON.stringify({error:null==e?void 0:e.stack}),i)}return{isOk:!0,itv:n,level:_,logSwitch:d}}))}realtimeReport(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=Date.now(),r=this.logger.getTimestamp4RealtimeLog()||gt,o=Math.max(t-3e4,r+1),a=this.logger.createTraceId(),{logs:l}=yield this._getLogs(r,o,i,!0,a,n);if(0===l.length);else if(l.length>0){const{itv:t,level:n,logSwitch:r,isOk:o}=yield this._sendLogs2Realtime(l,a,e,s);if(o){const e=Math.max(...l.map((e=>e.time)));this.logger.setTimestamp4RealtimeLog(e+1),0===r&&(this.started=!1),void 0!==n&&(i=n)}s=t}this.started&&(s>=60&&this.itvByNavi<60&&(s=60),this.timer=setTimeout((()=>this.realtimeReport(e,i,s,n)),1e3*s))}))}report(e,i,s,n,o,a,l=!1){return t(this,void 0,void 0,(function*(){if("web"!==s.toLowerCase()||this.disableLogReport)return;const t=this.logger.createTraceId();this.logger.info(r.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:i,logId:o,messageUId:a,isCloudControl:l}),t);const{logs:c}=yield this._getLogs(e,i,Yi.DEBUG,!1,t);this.logger.info(r.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),t);let _,d=Ot(n)?n:`https://${n}`;if(d+=`?version=5.46.0-c-tmp-alpha.1&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.getDeviceId()}&deviceInfo=${this.deviceInfo}&platform=Web&logId=${o}`,c.length>0){const{success:e,data:t}=yield this.compressLogs(c);_=e?t:"compress failed"}else _="no data or no database";this.logger.debug(r.L_REPORT_FULL_LOG_O,"compress done",t),l&&(d+="&source=cloud");const{status:u}=yield this.send({url:d,body:_,method:"POST"});this.logger.info(r.L_REPORT_FULL_LOG_R,JSON.stringify({status:u}),t)}))}stop(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1}}const Ji=e=>{const{sessionId:t,level:i,loggerId:s,traceId:n,time:r,tag:o,type:a}=e;let{content:l}=e;Et(l)||(l=JSON.stringify(l));let c=i<0?l||"":JSON.stringify({content:l,traceId:n,from:s});return c=`"${c.replace(/"/g,'""')}"`,`${t},${r},${a},${i},${o},${c}\n`};function Ki(e){try{return!(!e||"object"!=typeof e)&&("number"==typeof e.time&&("string"==typeof e.tag&&("string"==typeof e.sessionId&&("string"==typeof e.type&&"number"==typeof e.level))))}catch(e){return!1}}var Qi,Xi,zi,Zi,$i,es,ts,is;function ss(){return t(this,void 0,void 0,(function*(){return{logs:[]}}))}function ns(){}class rs{constructor(e,t){Qi.set(this,void 0),Xi.set(this,void 0),s(this,Qi,e,"f"),s(this,Xi,t,"f")}read(e,s,n,r,o){return t(this,void 0,void 0,(function*(){try{const t=yield i(this,Qi,"f").call(this,e,s,n,r,o);if(!t||!Array.isArray(t.logs))return{logs:[]};return{logs:t.logs.filter(Ki)}}catch(e){return console.error("[LogDBProxy] read error",e),{logs:[]}}}))}write(e){try{i(this,Xi,"f").call(this,e)}catch(e){console.error("[LogDBProxy] write error",e)}}setLogReader(e){return"function"==typeof e&&s(this,Qi,e,"f"),this}setLogWriter(e){return"function"==typeof e&&s(this,Xi,e,"f"),this}}function os(){return new rs(ss,ns)}Qi=new WeakMap,Xi=new WeakMap;class as{static start(e){i(this,zi,"f",Zi)||(s(this,zi,e,"f",Zi),e.info(r.L_EVENT_LOOP_BLOCKING_S,"start"),i(this,zi,"m",is).call(this))}static stop(){i(this,zi,"f",Zi)&&(i(this,zi,"f",Zi).info(r.L_EVENT_LOOP_BLOCKING_S,"stop"),s(this,zi,null,"f",Zi),i(this,zi,"f",$i)&&(clearTimeout(i(this,zi,"f",$i)),s(this,zi,null,"f",$i)))}}zi=as,is=function e(){const t=Date.now();s(this,zi,setTimeout((()=>{const s=Date.now()-t;s>=i(this,zi,"f",ts)&&i(this,zi,"f",Zi).warn(r.L_EVENT_LOOP_BLOCKING_S,`delta time: ${s}ms`),i(this,zi,"m",e).call(this)}),i(this,zi,"f",es)),"f",$i)},Zi={value:null},$i={value:null},es={value:30},ts={value:1500};const ls=1,cs=2,_s=3;class ds{constructor(e){Object.defineProperty(this,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"uploadTask",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"taskLock",{enumerable:!0,configurable:!0,writable:!0,value:!0})}uploadLogCmdTask(e){this.uploadTask.push(e),this.enqueueTask()}reportLogCmdTask(e){var t,i,s,n;this.taskLock=!1;const r=null!==(t=e.startTime)&&void 0!==t?t:0,o=null!==(i=e.endTime)&&void 0!==i?i:0,a=null!==(s=e.platform)&&void 0!==s?s:"",l=null!==(n=e.uri)&&void 0!==n?n:"";e.logId!==this.logId&&""!==l&&(this.logId=e.logId,this.reporter.report(r,o,a,l,e.logId,"",!0).finally((()=>{this.taskLock=!0,this.uploadTask.length>0&&this.enqueueTask()})))}enqueueTask(){if(!this.taskLock)return;const e=this.uploadTask.shift();e&&this.reportLogCmdTask(e)}}class us{constructor(e,t,i){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"isEable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"expire",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"interval",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastRequestTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"uploadTaskManage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"changeAreaCode",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_cache",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.uploadTaskManage=new ds(i)}init(){try{const e=this.getLocalCloudControllerCache();this._cache=e?JSON.parse(e):{timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}}}catch(e){this._cache={timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}}}this._cache&&(this.interval=this._cache.cc.interval,this.expire=this._cache.cc.expire,this.timestamp=this._cache.timestamp||0,this.isEable=this._cache.cc.enable,this.lastRequestTime=this._cache.lastRequestTime,this.logCmdMsgTasks(this._cache),this.setMRTRConfig(this._handleMrtrData(this._cache.mrtr)))}isExire(){return(new Date).getTime()-this.timestamp<this.expire}isOverclock(){return(new Date).getTime()-this.lastRequestTime<this.interval}logCmdMsgTasks(e){if(e.uploadLog){const{tasks:t}=e.uploadLog;t.forEach((e=>{e.objectName===Q.LOG_COMMAND&&this.uploadTaskManage.uploadLogCmdTask(e)}))}}dataHandle(e){const t=this._cache;t.lastRequestTime=this.lastRequestTime,yt(e)&&(t.timestamp=e.timestamp,e.uploadLog&&!e.uploadLog.temporary&&(t.uploadLog=e.uploadLog),e.cc&&!e.cc.temporary&&(t.cc=e.cc),e.mrtr&&!e.mrtr.temporary&&(t.mrtr=this._handleMrtrData(e.mrtr)),e.mrtr&&this.setMRTRConfig(this._handleMrtrData(e.mrtr))),this.setCloudControllerCache(t),this.expire=t.cc.expire,this.interval=t.cc.interval,this.timestamp=t.timestamp,this.logCmdMsgTasks(e)}request(e,i,s){return t(this,void 0,void 0,(function*(){if(!this.isEable&&i===ls&&this.isExire())return this.logger.info(r.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),this.timestamp;if(!this.isEable&&i===cs&&this.isOverclock())return this.logger.info(r.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),this.timestamp;const t=ni(e);this.lastRequestTime=(new Date).getTime();const n=`${t}/v1/config`,o={"Content-Type":"application/json","RC-App-Key":this.appkey};s&&(o["RC-Token"]=s);const a={platform:"web",version:"5.46.0-c-tmp-alpha.1",timestamp:this.timestamp};this.logger.record(ge.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!s,uri:n}));const{code:l,data:c}=yield this.httpRequest(n,Ve.POST,o,a);if(this.logger.record(ge.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:c})),l===D.CLOUD_DATA_CENTER_INVALID&&c&&c.targetRegion){const e=c.targetRegion;if(this.changeAreaCode===e)return this.timestamp;const t=Hi.setAreaCode(e);this.logger.info(r.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:t,originAreaCode:Hi.getAreaCode(),newAreaCode:e})),this.changeAreaCode=e;const i=Hi.getCloudControllerUrl(e);return i[0]?this.request(i[0],_s):(this.logger.info(r.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:n,msg:"appkey region error"})),this.timestamp)}return c&&this.dataHandle(c),this.timestamp||this.lastRequestTime}))}_handleMrtrData(e){return{chatroom:(null==e?void 0:e.chatroom)||0,group:(null==e?void 0:e.group)||0,private:(null==e?void 0:e.private)||0,ultraGroup:(null==e?void 0:e.ultraGroup)||0,temporary:!!(null==e?void 0:e.temporary)}}}var hs,gs,Es,Is;const Ts=e=>e===D.RC_CONN_REDIRECTED;class fs extends _i{constructor(e,t,i){super(),hs.add(this),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"navi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_fromSuspend",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"token",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"curCmpUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"uuid",{enumerable:!0,configurable:!0,writable:!0,value:""}),Is.set(this,0),Object.defineProperty(this,"_doConnectReason",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_network",{enumerable:!0,configurable:!0,writable:!0,value:{status:!0,type:Ge.UNKONWN}}),Object.defineProperty(this,"_checkAliveTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_crtConnectionStatus",{enumerable:!0,configurable:!0,writable:!0,value:ce.DISCONNECTED}),Object.defineProperty(this,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_openCallPlus",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"cmpWeightCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_crtConnectionTask",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"reconnectTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_failedCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ALLOW_FAILED_TIMES",{enumerable:!0,configurable:!0,writable:!0,value:2})}getToken(){return this.token}get cid(){return`${this.uuid}_${this.retryCount}`}getCurrentUserId(){return this._crtUserId}setConnectionStatus(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus===ce.DISCONNECTED&&e===ce.CONNECTING&&(this._doConnectReason=Ne.CONNECT,i(this,hs,"m",Es).call(this)),this._crtConnectionStatus===ce.CONNECTED&&e===ce.SUSPENDED&&(t===D.RC_PING_EXCEED_LIMIT?this._doConnectReason=Ne.TIMEOUT:t===D.RC_CONN_REDIRECTED?this._doConnectReason=Ne.REDIRECTED:this._doConnectReason=Ne.RECONNECT),this._crtConnectionStatus===ce.CONNECTED){const s={bid:ii(),cod:t,net:this.getNetwork().type,dur:Date.now()-i(this,Is,"f"),cid:this.cid};this.logger.record(ge.IM_CONNECTION_DURATION,JSON.stringify(s)),e===ce.SUSPENDED&&i(this,hs,"m",Es).call(this)}switch(this._crtConnectionStatus=e,e){case ce.CONNECTED:this.logger.info(r.L_CONNECT_S,`status: ${e}`),this.checkAlive(),i(this,hs,"m",gs).call(this).emit("onConnected",this._fromSuspend);break;case ce.CONNECTING:this.logger.warn(r.L_CONNECT_S,`status: ${e}`),i(this,hs,"m",gs).call(this).emit("onConnecting");break;case ce.SUSPENDED:this._fromSuspend=!0,this.logger.warn(r.L_CONNECT_S,`status: ${e}, code: ${t}`),Ts(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),i(this,hs,"m",gs).call(this).emit("onSuspend",t);break;default:this._fromSuspend=!1,this._crtUserId="",this.logger.warn(r.L_CONNECT_S,`status: ${e}, code: ${t}`),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),i(this,hs,"m",gs).call(this).emit("onDisconnected",t)}}}getConnectionStatus(){return this._crtConnectionStatus}get isConnected(){return this._crtConnectionStatus===ce.CONNECTED}setNetwork(e,t){if(!t){const t={cid:this.cid,cn:e.type,on:this._network.type};this.logger.record(ge.IM_NETWORK_CHANGE,JSON.stringify(t))}this._network=e}getNetwork(){return this._network}connect(e,i,s,n){return t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus===ce.CONNECTED)return gi(this._crtUserId);if(this._crtConnectionTask)return this._crtConnectionTask;this._openCallPlus=s,this.token=e,this.setConnectionStatus(ce.CONNECTING);const{code:t,data:r}=yield this.try2Connect(e,i,!1,n,!0);return t!==D.SUCCESS?(this.setConnectionStatus(ce.DISCONNECTED,t),Ei(t)):(this.setConnectionStatus(ce.CONNECTED),gi(r))}))}try2Connect(e,i,s,n,r){return t(this,void 0,void 0,(function*(){if(this._crtConnectionTask)return this._crtConnectionTask;this._crtConnectionTask=this.createConnectionTask(e,i,s,n,r);const t=yield this._crtConnectionTask;return this._crtConnectionTask=null,t}))}createConnectionTask(e,i,n,o,a){return t(this,void 0,void 0,(function*(){const t={cid:this.cid,reason:this._doConnectReason,net:this.getNetwork().type,spr:0,sts:Date.now(),timelimit:0};this.logger.record(ge.IM_STATS_CS,JSON.stringify(t));const l={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this._doConnectReason},{code:c,data:_}=yield this.navi.request(e,n,!1,o,l);if(c!==D.SUCCESS)return Ei(c);const d=_;if(1===d.type)return Ei(D.PACKAGE_ENVIRONMENT_ERROR);this.logger.info(r.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:i}),o);const{code:u,data:h}=yield this._connectWithToken(e.replace(/@.+$/,"@"),d,i,o);if(a||u===D.SUCCESS||(this.retryCount+=1),Ts(u))return this.logger.warn(r.L_CONNECT_R,`redirect code: ${u}`,o),this.clearCmpWeightCache(),this.createConnectionTask(e,i,!0,o,a);if([D.RC_TCP_RESET,D.RC_CONN_ACK_TIMEOUT,D.RC_TCP_DISCONNECTED_NO_RMTP,D.CONNECTION_REFUSED].includes(u)&&this.cmpWeightCache&&this.cmpWeightCache.length>1){this.updateCmpWeight(this.curCmpUrl,!1);const t=this.cmpWeightCache.every((e=>e.failed));return a&&t?(this.logger.warn(r.L_CONNECT_R,`cpp code:${u},reture code:${D.SERVER_UNAVAILABLE}`,o),Ei(D.SERVER_UNAVAILABLE)):(this.logger.warn(r.L_CONNECT_R,`cmp ack timeout, code: ${u}`,o),this.setConnectionStatus(ce.SUSPENDED,u),this.setConnectionStatus(ce.CONNECTING),this.createConnectionTask(e,i,!1,o,a))}return u!==D.SUCCESS?(this.logger.warn(r.L_CONNECT_R,`code: ${u}`,o),Ei(u)):(this.logger.info(r.L_CONNECT_R,`userId: ${h}`,o),s(this,Is,Date.now(),"f"),this._crtUserId=h,gi(h))}))}try2Reconnect(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.debug(r.T,`try2Reconnect -> ignoreNaviCache: ${e}, reason: ${i}`,s),this.stopReconnectTimer();const n=()=>t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus!==ce.SUSPENDED)return;this.setConnectionStatus(ce.CONNECTING,i);const{code:t,isOk:r}=yield this.try2Connect(this.token,!0,e,s,!1);this.reconnectTimer=null,r?this.setConnectionStatus(ce.CONNECTED):[D.SERVER_UNAVAILABLE,D.TIMEOUT,D.RC_SOCKET_DISCONNECTED,D.RC_SOCKET_NOT_CREATED,D.RC_CONN_ACK_TIMEOUT,D.RC_TCP_RESET,D.RC_NAVI_REQ_FAILED,D.RC_NETWORK_DOWN,D.RC_TCP_DISCONNECTED_NO_RMTP].includes(t)?this._crtConnectionStatus===ce.CONNECTING&&(this.setConnectionStatus(ce.SUSPENDED,t),this.reconnectTimer=setTimeout(n,5e3)):this.setConnectionStatus(ce.DISCONNECTED,t)}));n()}))}onDisconnectByServer(e,t){return Ts(e)?(this.setConnectionStatus(ce.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===D.RC_UDP_DISCONNECTED?(this.setConnectionStatus(ce.SUSPENDED,e),void setTimeout((()=>{this.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(ce.DISCONNECTED,e)}onDisconenctUnusual(e){this.setConnectionStatus(ce.SUSPENDED,e),this.try2Reconnect(!1,e)}checkAlive(){return t(this,void 0,void 0,(function*(){if(this._crtConnectionStatus!==ce.CONNECTED)return this._failedCount=0,void this.logger.debug(r.L_CHECK_ALIVE_IM_S,"stop ping because of no connection");const e=this.logger.createTraceId();this.logger.debug(r.L_CHECK_ALIVE_IM_T,null,e);const t=yield this.sendPing(15e3);if(t===D.SUCCESS)return this.logger.debug(r.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,void(this._checkAliveTimer=setTimeout((()=>this.checkAlive()),15e3));if(this._crtConnectionStatus===ce.CONNECTED){if(this._failedCount+=1,this.logger.debug(r.L_CHECK_ALIVE_IM_R,`code: ${t}, count: ${this._failedCount}`,e),this._failedCount<this.ALLOW_FAILED_TIMES)return this.checkAlive();this._failedCount=0,this.logger.warn(r.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),yield this.close(!0),this.setConnectionStatus(ce.SUSPENDED,D.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,D.RC_PING_EXCEED_LIMIT)}}))}disconnect(e,i){return t(this,void 0,void 0,(function*(){return this.stopReconnectTimer(),this._crtConnectionTask&&(yield this._crtConnectionTask),this.setConnectionStatus(ce.DISCONNECTED,D.ACTIVE_DISCONNECT),this.close(!1,e,i)}))}stopReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}getCmpList(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return[...this.cmpWeightCache];const i=Bt(e,t);return this.cmpWeightCache=[...i],[...i]}updateCmpWeight(e,t,i){if(!this.cmpWeightCache)return;const s=this.cmpWeightCache.find((t=>i?t.addr===e&&t.protocol===q.QUIC:t.addr===e));if(s)if(t){const e=Math.max(...this.cmpWeightCache.map((e=>e.weight)));s.weight!==e&&(s.weight=e+1)}else{const e=Math.min(...this.cmpWeightCache.map((e=>e.weight)));s.weight!==e&&(s.weight=e-1),s.failed=!0}}clearCmpWeightCache(){this.cmpWeightCache=void 0}reconnect(e,t,i,s){this.token=e,this._openCallPlus=i,this.onDisconenctUnusual(s)}}Is=new WeakMap,hs=new WeakSet,gs=function(){return this},Es=function(){this.uuid=ut.gen(),this.retryCount=0};const Rs=e=>e.replace(/@.+$/,"@");class As{constructor(e,t,i,s=!0,n=!0,r=!1){Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"staticConfigManager",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"isRequestProfile",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"isUseDynamicNaviUrl",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"useNaviV2",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"crtRequest",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_environment",{enumerable:!0,configurable:!0,writable:!0,value:"default"})}getCatchKey(e){return e+(this._environment?`-${this._environment}`:"")}request(e,i,s,n,r){return t(this,void 0,void 0,(function*(){if(this.crtRequest)return this.crtRequest;this.crtRequest=this.sendRequest(e,i,s,n,r);const t=yield this.crtRequest;return this.crtRequest=null,t}))}sendRequest(e,i,s,n,o){var a;return t(this,void 0,void 0,(function*(){const t=Rs(e),l=this.getNaviCache(t);if(!i&&l){const{timestamp:e,naviInfo:t}=l;if(s||Date.now()-e<ke){if(this.logger.info(r.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:t}),n),o){const{uuid:e,retryCount:i,reason:s}=o,r={bid:ii(),ptc:pe.NAVI,cod:D.SUCCESS,net:o.type,dur:0,spr:0,pr:null!==(a=t.type)&&void 0!==a?a:0,hos:"",cache:me.LOCAL,v:Se.CURRENT,rsn:s,cid:`${e}_${i}`,count:i};this.logger.record(ge.IM_NAVI,JSON.stringify(r),n)}return gi(t)}}const c=Hi.getNaviUrlList(e,this.isUseDynamicNaviUrl);this.logger.info(r.L_GET_NAVI_T,JSON.stringify({token:e,uris:c}),n);let{code:_,data:d}=yield this.requestHandler(c,e,n,o);if(_===D.RC_NAVI_REQ_FAILED&&this.isRequestProfile){const t=yield this.staticConfigManager.getStaticConfig();if((null==t?void 0:t.navi)&&(null==t?void 0:t.navi.length)>0){const{navi:i}=t,s=yield this.requestHandler(i,e,n,o);_=s.code,d=s.data}}if(_!==D.SUCCESS)return this.logger.warn(r.L_GET_NAVI_R,_,n),Ei(_);const u=d;if(u.code&&200!==u.code)return this.logger.warn(r.L_GET_NAVI_R,u.code,n),Ei(this.transHttpCode(u.code));if(!(Bt(u).length>0)){const e={server:u.server,backupServer:u.backupServer,serverAddr:u.serverAddr,bs:u.bs};return this.logger.warn(r.L_GET_NAVI_R,`navi server address invalid: ${JSON.stringify(e)}`,n),Ei(D.SERVER_UNAVAILABLE)}return this.logger.info(r.L_GET_NAVI_R,JSON.stringify({naviInfo:u}),n),this.setNaviCache(t,u),gi(u)}))}requestHandler(e,i,s,n){return t(this,void 0,void 0,(function*(){for(let t=0,r=e.length;t<r;t+=1){const r=t===e.length-1,o=this.useV2Navi()?this.httpRequestV2:this.httpRequest,a=Date.now(),{code:l,data:c}=yield o.call(this,e[t],this.appkey,i,s,r),_={bid:ii(),ptc:pe.NAVI,cod:l,net:null==n?void 0:n.type,dur:Date.now()-a,spr:0,pr:(null==c?void 0:c.type)||0,hos:e[t],cache:me.REQUEST,v:Se.CURRENT,rsn:null==n?void 0:n.reason,cid:`${null==n?void 0:n.uuid}_${null==n?void 0:n.retryCount}`,count:null==n?void 0:n.retryCount};if(this.logger.record(ge.IM_NAVI,JSON.stringify(_),s),[D.SUCCESS,D.RC_CONN_TOKEN_INCORRECT,D.RC_LICENSE_EXPIRED].includes(l))return l===D.SUCCESS?gi(c):Ei(l)}return Ei(D.RC_NAVI_REQ_FAILED)}))}transHttpCode(e){switch(e){case 401:case 403:return D.RC_CONN_TOKEN_INCORRECT;case 416:return D.RC_LICENSE_EXPIRED;default:return D.RC_NAVI_REQ_FAILED}}getNaviInfoFromCache(e){const t=this.getNaviCache(Rs(e));return t?t.naviInfo:null}updateVoipCallInfo(e,t){const i=this.getNaviInfoFromCache(e);i&&this.setNaviCache(Rs(e),Object.assign(Object.assign({},i),{voipCallInfo:t}))}getNaviV2RequestOption(e){const{uri:t,token:i,platform:s,protocol:n,mac:r}=e;let o="";o=`${t}/v2/navi.json?cloud=0`;let a=`token=${encodeURIComponent(i)}&v=${Be}&platfrom=${s}`;return r&&(a+=`&m=${r}`),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":`conn=${n};rtc=4;log=2;iptype=v4,v6`},body:a,url:o,timeout:1e4}}useV2Navi(){return!0}}const ps=new Map([["RC:TxtMsg",{isCounted:!0,isPersited:!0}],["RC:ImgMsg",{isCounted:!0,isPersited:!0}],["RC:VcMsg",{isCounted:!0,isPersited:!0}],["RC:ImgTextMsg",{isCounted:!0,isPersited:!0,searchProps:["content","title"]}],["RC:FileMsg",{isCounted:!0,isPersited:!0,searchProps:["name"]}],["RC:HQVCMsg",{isCounted:!0,isPersited:!0}],["RC:LBSMsg",{isCounted:!0,isPersited:!0}],["RC:PSImgTxtMsg",{isCounted:!0,isPersited:!0}],["RC:PSMultiImgTxtMsg",{isCounted:!0,isPersited:!0}],["RCJrmf:RpMsg",{isCounted:!0,isPersited:!0}],["RCJrmf:RpOpendMsg",{isCounted:!0,isPersited:!0}],["RC:CombineMsg",{isCounted:!0,isPersited:!0}],["RC:CombineV2Msg",{isCounted:!0,isPersited:!0}],["RC:ReferenceMsg",{isCounted:!0,isPersited:!0,searchProps:["content"]}],["RC:SightMsg",{isCounted:!0,isPersited:!0}],["RC:GIFMsg",{isCounted:!0,isPersited:!0}],["RC:RLStart",{isCounted:!0,isPersited:!0}],["RC:RLEnd",{isCounted:!0,isPersited:!0}],["RC:StreamMsg",{isCounted:!0,isPersited:!0}],[Q.INFORMATION_NOTIFICATION,{isCounted:!1,isPersited:!0}],["RC:ContactNtf",{isCounted:!1,isPersited:!0}],["RC:ProfileNtf",{isCounted:!1,isPersited:!0}],[Q.COMMAND_NOTIFICATION,{isCounted:!1,isPersited:!0}],[Q.GROUP_NOTIFICATION,{isCounted:!1,isPersited:!0}],["RC:RcNtf",{isCounted:!1,isPersited:!0}],[Q.COMMAND,{isCounted:!1,isPersited:!1}],["RC:TypSts",{isCounted:!1,isPersited:!1,isStatusMessage:!0}],["RC:PSCmd",{isCounted:!1,isPersited:!1}],["RC:SRSMsg",{isCounted:!1,isPersited:!1}],["RC:RcCmd",{isCounted:!1,isPersited:!0}],["RC:RRReqMsg",{isCounted:!1,isPersited:!1}],["RC:RRRspMsg",{isCounted:!1,isPersited:!1}],["RC:CsChaR",{isCounted:!1,isPersited:!1}],["RC:CSCha",{isCounted:!1,isPersited:!1}],["RC:CsEva",{isCounted:!1,isPersited:!1}],["RC:CsContact",{isCounted:!1,isPersited:!1}],["RC:CsHs",{isCounted:!1,isPersited:!1}],["RC:CsHsR",{isCounted:!1,isPersited:!1}],["RC:CsSp",{isCounted:!1,isPersited:!1}],["RC:CsEnd",{isCounted:!1,isPersited:!1}],["RC:CsUpdate",{isCounted:!1,isPersited:!1}],["RC:ReadNtf",{isCounted:!1,isPersited:!1}],["RC:chrmKVNotiMsg",{isCounted:!1,isPersited:!1}],["RC:VCAccept",{isCounted:!1,isPersited:!1}],["RC:VCRinging",{isCounted:!1,isPersited:!1}],["RC:VCSummary",{isCounted:!1,isPersited:!1}],["RC:VCHangup",{isCounted:!1,isPersited:!1}],["RC:VCInvite",{isCounted:!1,isPersited:!1}],["RC:VCModifyMedia",{isCounted:!1,isPersited:!1}],["RC:VCModifyMem",{isCounted:!1,isPersited:!1}],["RC:MsgExMsg",{isCounted:!1,isPersited:!1}],["RC:Delivered",{isCounted:!1,isPersited:!1}],["RC:RRMsg",{isCounted:!1,isPersited:!1}],["RC:LogCmdMsg",{isCounted:!1,isPersited:!1}],["RC:InterceptMsg",{isCounted:!1,isPersited:!1,isStatusMessage:!0}],["RC:RLJoin",{isCounted:!1,isPersited:!1}],["RC:RLQuit",{isCounted:!1,isPersited:!1}],["RC:RL",{isCounted:!1,isPersited:!1,isStatusMessage:!0}],["RC:CCConfigChangeRequestMsg",{isCounted:!1,isPersited:!1}]]);function ms(e){return ps.get(e)}function Ss(e){return ps.has(e)}const vs={MECHANICAL:0,INTELLIGENT:1};class Ns{constructor(e,t,i,s){Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sourceLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"targetLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.identifier=e,this.sourceLanguage=t||"auto",this.targetLanguage=i,this.text=s}isValid(e){return"string"==typeof this.identifier&&this.identifier.length>0&&"string"==typeof this.sourceLanguage&&(void 0===this.targetLanguage||"string"==typeof this.targetLanguage)&&(e?"string"==typeof this.text:void 0===this.text||"string"==typeof this.text)}toInnerParam(){return{identifier:this.identifier,sourceLanguage:this.sourceLanguage,targetLanguage:this.targetLanguage,content:this.text}}}class Os extends Ns{constructor(e,t,i,s){super(e,t,i,s)}}class ys extends Ns{constructor(e,t,i){super(Pi(e),t,i,e)}}const Cs={NONE:0,TRANSLATING:1,SUCCESS:2,FAILED:3},Ms={DEFAULT:0,AUTO_ON:1,AUTO_OFF:2};class bs{static enable(){return!0}}const Ls=48,Us=64,Ps=80,Ds=96,ws=112,Gs="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Vs=e=>{const t={};for(let i=0;i<e.length-1;i++){const s=e.charAt(i)+e.charAt(i+1);t.hasOwnProperty(s)?t[s].push(i):t[s]=[i]}const i=[];let s=[];const n=function(){if(s.length>0){const e=s.join("");if(s=[],e.length>26){const t=Fs(e.length),s=String.fromCharCode(Ps|t.length);i.push(s+t)}else{const t=String.fromCharCode(Ds|e.length);i.push(t)}i.push(e)}};let r=0;for(;r<e.length;){const o=xs(t,e,r);if(o.length<2){s.push(e.charAt(r++));continue}if(o.length<4){s.push(e.substr(r,o.length)),r+=o.length;continue}const a=Fs(r-o.offset),l=Fs(o.length);if(a.length+l.length>=o.length){s.push(e.substr(r,o.length)),r+=o.length;continue}n();const c=String.fromCharCode(Us|a.length<<2|l.length);i.push(c+a+l),r+=o.length}n();const o=Fs(e.length),a=String.fromCharCode(Ls|o.length);return i.push(a+o),i.join("")},xs=(e,t,i)=>{const s={length:0,offset:-1};if(t.length,i>=t.length-1)return s;const n=e[t.charAt(i)+t.charAt(i+1)];if(n[0]===i)return s;const r=t.length-i;for(let e=0,o=n.length;e<o;e++){const o=n[e],a=i-o;if(a>238327)continue;const l=Math.min(r,a);if(l<=s.length)break;if(s.length>2&&t.charAt(o+s.length-1)!==t.charAt(i+s.length-1))continue;let c=2;for(let e=c;e<l&&t.charAt(o+e)===t.charAt(i+e);e++)c++;c>=s.length&&(s.length=c,s.offset=o)}return s},Fs=e=>{const t=[];let i=0;do{i=e%62,t.push(Gs.charAt(i)),e=(e-i)/62}while(e>0);return t.join("")},Bs=e=>{let t=0,i=0;for(let s=e.length-1;s>=0;s--){if(i=Gs.indexOf(e.charAt(s)),-1===i)throw new Error('decode number error, data is "'+e+'"');t=62*t+i}return t},Hs=()=>!("undefined"==typeof uni||!(e=>{const t=["request","getSystemInfo"];for(let i=0,s=t.length;i<s;i++)if(!e[t[i]])return!1;return!0})(uni)),js=e=>(["setItem","getItem","removeItem"].forEach((t=>{const i=e[t];e[t]=(...t)=>{try{return i.apply(e,t)}catch(e){null===console||void 0===console||console.error(e)}}})),e);var Ys,Ws,qs;class Js{constructor(e){Ys.add(this),Ws.set(this,void 0),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),s(this,Ws,e,"f"),this._logger=e.logger}open(e){return t(this,void 0,void 0,(function*(){return e=e.sort(((e,t)=>t.weight-e.weight)),i(this,Ys,"m",qs).call(this,e,i(this,Ws,"f"))}))}}Ws=new WeakMap,Ys=new WeakSet,qs=function e(s,n){return t(this,void 0,void 0,(function*(){if(0===s.length)return Ei(D.STREAM_MESSAGE_REQUEST_FAIL,"All addrs failed");const o=s.shift();let a=ni(o.addr,o.protocol);a=`${a}/v3/message/get_stream.json?sdkVersion=5.46.0-c-tmp-alpha.1&platform=Websocket&messageUID=${n.msgUId}`,this._logger.info(r.L_REQ_STREAM_MSG_CONTENT_O,`try open -> ${a}`);const l=yield this._openHandler(a,n);return l.or((r=>t(this,void 0,void 0,(function*(){return-1===r?i(this,Ys,"m",e).call(this,s,n):l}))))}))};class Ks extends Js{_openHandler(e,i){return t(this,void 0,void 0,(function*(){const{resolve:t,promise:s}=Ri(),n=new XMLHttpRequest;let o=!1,a=null;const l=e=>{o||(o=!0,a&&(clearTimeout(a),a=null),e.isOk||(this._logger.warn(r.L_REQ_STREAM_MSG_CONTENT_E,`req fail -> code: ${e.code}`),n.abort()),t(e))};return a=setTimeout((()=>l(Ei(-1,"timeout"))),i.timeout),n.onerror=e=>l(Ei(-1,"network error")),n.onreadystatechange=t=>{if(n.readyState!==XMLHttpRequest.HEADERS_RECEIVED)return;const s=n.getResponseHeader("Content-Type"),o=null==s?void 0:s.startsWith("text/event-stream");if(200!==n.status||!o)return void(n.onloadend=()=>{const e=JSON.parse(n.response);l(Ei(e.code,e.message))});l(gi());let a=0;n.onprogress=e=>{const t=n.response.slice(a);a=n.response.length,i.onRawContent(t)},n.onerror=t=>{this._logger.warn(r.L_REQ_STREAM_MSG_CONTENT_E,`network error in transit -> ${e}`),n.onprogress=null,n.abort(),i.onNetworkError(D.STREAM_MESSAGE_REQUEST_FAIL)}},n.open("GET",e,!0),n.setRequestHeader("Content-Type","application/json;charset=UTF-8"),n.setRequestHeader("App-Key",i.appkey),n.setRequestHeader("Authorization",`Bearer ${i.token}`),n.send(),s}))}}const Qs=Hs();let Xs=null;const zs=e=>t(void 0,void 0,void 0,(function*(){const t=yield Zs.getNetworkType();Xs({status:"online"===e.type,type:t})}));const Zs={tag:"browser",httpReq:e=>Di(e).result(),get localStorage(){return localStorage},get sessionStorage(){return sessionStorage},useNavi:!0,connectPlatform:"",isFromUniapp:Qs,createWebSocket:function(e,t){const i=new WebSocket(e,t);return i.binaryType="arraybuffer",Promise.resolve(gi({id:Date.now(),onClose(e){i.onclose=t=>{const{code:i,reason:s}=t;e(i,s)}},onError(e){i.onerror=e},onMessage(e){i.onmessage=t=>{e(t.data)}},onOpen(e){i.onopen=e},send(e){i.send(e)},close(e,t){i.close()}}))},getNetworkType(){const{type:e,effectiveType:t}=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:Ge.UNKONWN},i=e||t||Ge.UNKONWN;return Promise.resolve(i)},setNetworkStatusListener:function(e){Xs=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",zs),window.addEventListener("online",zs))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",zs),window.removeEventListener("online",zs)),Xs=null},createSSEClient:e=>gi(new Ks(e)),getApiVer:()=>{const{type:e,version:t}=Zs.runtimeInfo;return`browser|${e}|${t}`},get runtimeInfo(){const{userAgent:e}=navigator;let t,i;const s={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(const n in s){if(!s.hasOwnProperty(n))continue;let r=e.match(s[n]);if(r){i=n,t=r[1]||r[2];break}}return{type:i||"Unknown",version:t||"Unknown"}}};var $s;!function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgS=2]="ppMsgS",e[e.pgMsgS=3]="pgMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.prMsgS=7]="prMsgS",e[e.pbMsgP=8]="pbMsgP",e[e.qryPMsg=9]="qryPMsg",e[e.qryGMsg=10]="qryGMsg",e[e.qryCHMsg=11]="qryCHMsg",e[e.qryCMsg=12]="qryCMsg",e[e.qrySMsg=13]="qrySMsg",e[e.qryMCMsg=14]="qryMCMsg",e[e.qryMPMsg=15]="qryMPMsg",e[e.recallMsg=16]="recallMsg",e[e.rrMsg=17]="rrMsg",e[e.rrList=18]="rrList",e[e.s_ntf=19]="s_ntf",e[e.s_msg=20]="s_msg",e[e.s_stat=21]="s_stat",e[e.s_cmd=22]="s_cmd",e[e.s_us=23]="s_us",e[e.transLan=24]="transLan",e[e.autoTrans=25]="autoTrans",e[e.pullUS=26]="pullUS",e[e.sendMsgRead=27]="sendMsgRead",e[e.qryMsgRead=28]="qryMsgRead",e[e.qryMsgReadCntBatch=29]="qryMsgReadCntBatch",e[e.updRTime=30]="updRTime",e[e.qryRLBatch=31]="qryRLBatch",e[e.chatMsgS=32]="chatMsgS",e[e.qrySessionsAtt=33]="qrySessionsAtt",e[e.pullMsg=34]="pullMsg",e[e.qrySessions=35]="qrySessions",e[e.delSessions=36]="delSessions",e[e.delMsg=37]="delMsg",e[e.delUgMsg=38]="delUgMsg",e[e.delUgSe=39]="delUgSe",e[e.updRRTime=40]="updRRTime",e[e.qrySessionsUnread=41]="qrySessionsUnread",e[e.setTypeUnpush=42]="setTypeUnpush",e[e.chrmPull=43]="chrmPull",e[e.joinChrm=44]="joinChrm",e[e.joinChrmR=45]="joinChrmR",e[e.exitChrm=46]="exitChrm",e[e.queryChrmI=47]="queryChrmI",e[e.setKV=48]="setKV",e[e.delKV=49]="delKV",e[e.setKVS=50]="setKVS",e[e.delKVS=51]="delKVS",e[e.pullKV=52]="pullKV",e[e.qryRelation=53]="qryRelation",e[e.qryRelationR=54]="qryRelationR",e[e.qryRelationFilter=55]="qryRelationFilter",e[e.delRelation=56]="delRelation",e[e.delRelationBatch=57]="delRelationBatch",e[e.pullSe=58]="pullSe",e[e.pullSeAtts=59]="pullSeAtts",e[e.setSeAtt=60]="setSeAtt",e[e.qnTkn=61]="qnTkn",e[e.qnUrl=62]="qnUrl",e[e.aliUrl=63]="aliUrl",e[e.s3Url=64]="s3Url",e[e.stcUrl=65]="stcUrl",e[e.minioUrl=66]="minioUrl",e[e.cleanPMsg=67]="cleanPMsg",e[e.cleanGMsg=68]="cleanGMsg",e[e.cleanCMsg=69]="cleanCMsg",e[e.cleanSMsg=70]="cleanSMsg",e[e.cleanMCMsg=71]="cleanMCMsg",e[e.cleanMPMsg=72]="cleanMPMsg",e[e.cleanMsgBatch=73]="cleanMsgBatch",e[e.rtcPing=74]="rtcPing",e[e.rtc_ntf=75]="rtc_ntf",e[e.rtcSetOutData=76]="rtcSetOutData",e[e.rtcQryUserOutData=77]="rtcQryUserOutData",e[e.addSeTag=78]="addSeTag",e[e.delSeTag=79]="delSeTag",e[e.addTag=80]="addTag",e[e.delTag=81]="delTag",e[e.reportsdk=82]="reportsdk",e[e.pullUgSes=83]="pullUgSes",e[e.pullUgMsg=84]="pullUgMsg",e[e.ugMsg=85]="ugMsg",e[e.qryUgMsg=86]="qryUgMsg",e[e.updUgRTime=87]="updUgRTime",e[e.upMsgEx=88]="upMsgEx",e[e.modifyMsg=89]="modifyMsg",e[e.qryMsgChange=90]="qryMsgChange",e[e.qryMsg=91]="qryMsg",e[e.operate=92]="operate",e[e.s_opNtf=93]="s_opNtf",e[e.ugUnpushQuery=94]="ugUnpushQuery",e[e.ugUnpushSet=95]="ugUnpushSet",e[e.setRtcRoomId=96]="setRtcRoomId",e[e.qryUgUal=97]="qryUgUal",e[e.updUserSub=98]="updUserSub",e[e.pullUserSub=99]="pullUserSub",e[e.pullSubData=100]="pullSubData",e[e.qrySubData=101]="qrySubData",e[e.pullUserProfile=102]="pullUserProfile",e[e.pullOwnProfile=103]="pullOwnProfile",e[e.updProfilePermiss=104]="updProfilePermiss",e[e.qProfilePermiss=105]="qProfilePermiss",e[e.searchUserProfile=106]="searchUserProfile",e[e.updUserProfile=107]="updUserProfile",e[e.pullEventChange=108]="pullEventChange",e[e.channelCreate=109]="channelCreate",e[e.upChannelInfo=110]="upChannelInfo",e[e.qChannelInfo=111]="qChannelInfo",e[e.channelMemKick=112]="channelMemKick",e[e.channelMemQuit=113]="channelMemQuit",e[e.channelDismiss=114]="channelDismiss",e[e.channelTransfer=115]="channelTransfer",e[e.upChannelManager=116]="upChannelManager",e[e.qChannelMem=117]="qChannelMem",e[e.qChannelSpeMem=118]="qChannelSpeMem",e[e.upChannelMem=119]="upChannelMem",e[e.channelMemJoin=120]="channelMemJoin",e[e.channelMemInvite=121]="channelMemInvite",e[e.channelApplyResp=122]="channelApplyResp",e[e.qChannelApplyList=123]="qChannelApplyList",e[e.qChannelMemJoin=124]="qChannelMemJoin",e[e.qChannelMemSpeJoin=125]="qChannelMemSpeJoin",e[e.upChannelRemark=126]="upChannelRemark",e[e.qChannelRemark=127]="qChannelRemark",e[e.upChannelFollow=128]="upChannelFollow",e[e.qChannelFollow=129]="qChannelFollow",e[e.qSimpleUserProfile=130]="qSimpleUserProfile",e[e.friendAdd=131]="friendAdd",e[e.friendDel=132]="friendDel",e[e.friendHandle=133]="friendHandle",e[e.friendSetPf=134]="friendSetPf",e[e.friendCheck=135]="friendCheck",e[e.friendsQuery=136]="friendsQuery",e[e.friendApplyDel=137]="friendApplyDel",e[e.friendsInfoQry=138]="friendsInfoQry",e[e.friendAuthSet=139]="friendAuthSet",e[e.friendAuthGet=140]="friendAuthGet",e[e.addUnpush=141]="addUnpush",e[e.qryUnpush=142]="qryUnpush",e[e.delUnpush=143]="delUnpush",e[e.s_pubCall=144]="s_pubCall",e[e.reqCall=145]="reqCall",e[e.pullKvMsg=146]="pullKvMsg",e[e.readReceipt=147]="readReceipt",e[e.qryReceipt=148]="qryReceipt",e[e.qryReceiptBatch=149]="qryReceiptBatch",e[e.upConvertMsg=150]="upConvertMsg",e[e.pullModifyMsg=151]="pullModifyMsg",e[e.qAppBot=152]="qAppBot",e[e.qBot=153]="qBot",e[e.addPReaction=154]="addPReaction",e[e.rmPReaction=155]="rmPReaction",e[e.addGReaction=156]="addGReaction",e[e.rmGReaction=157]="rmGReaction",e[e.addUgReaction=158]="addUgReaction",e[e.rmUgReaction=159]="rmUgReaction",e[e.mReactBQ=160]="mReactBQ",e[e.ugMReactBQ=161]="ugMReactBQ",e[e.mReactQ=162]="mReactQ",e[e.ugMReactQ=163]="ugMReactQ",e[e.mReactUQ=164]="mReactUQ",e[e.ugMReactUQ=165]="ugMReactUQ"}($s||($s={}));const en=e=>{const t=$s[e];return t},tn=e=>$s[e],sn=0,nn=1,rn=2,on=3,an=4,ln=5,cn=6,_n=7,dn=12,un=13,hn=14,gn=4,En=3,In="rtcRJoin_data",Tn="rtcRExit",fn="rtcUPut",Rn="rtcUDel",An="rtcSetData",pn="userSetData",mn="rtcQryData",Sn="rtcDelData",vn="rtcToken",Nn="rtcUserState",On="rtcUList",yn="viewerJoinR",Cn="viewerExitR",Mn="rtcIdentityChange",bn="rtcInvite",Ln="rtcCancelInvite",Un="rtcInviteAnswer",Pn="rtcEndInvite",Dn="rtcQueryJoined",wn=0,Gn=1,Vn=2,kn=3,xn=4,Fn=5,Bn=6,Hn=7,jn=8,Yn=9,Wn=10,qn=11,Jn=12,Kn=13,Qn=14,Xn=15,zn=16,Zn=17,$n=18,er=19,tr=20,ir=1,sr=2,nr=4,rr=5,or=6,ar=7,lr=8,cr=9;class _r{static writeUTF(e){let{back:t,byteSize:i}=this._getBackAndByteSize(e);for(let e=0,i=t.length;e<i;e++)t[e]>255&&(t[e]&=255);return i<=255?[0,i].concat(t):[i>>8,255&i].concat(t)}static _getBackAndByteSize(e){const t=[];let i=0;if("string"==typeof e)for(let s=0,n=e.length;s<n;s++){const n=e.charCodeAt(s);n>=0&&n<=127?(i+=1,t.push(n)):n>=128&&n<=2047?(i+=2,t.push(192|31&n>>6),t.push(128|63&n)):n>=2048&&n<=65535&&(i+=3,t.push(224|15&n>>12),t.push(128|63&n>>6),t.push(128|63&n))}return{byteSize:i,back:t}}static readUTF(e){const t=[];let i,s,n=-1;const r=e;let o="";for(;++n<r.length;){let e=Number(r[n]);if(e===(127&e)||(240&~e?224&~e?192&~e||(e^=192,e=e<<6|128^r[++n]):(e^=224,e=e<<6|128^r[++n],e=e<<6|128^r[++n]):(e^=240,e=e<<6|128^r[++n],e=e<<6|128^r[++n],e=e<<6|128^r[++n])),!Number.isFinite(e)||e<0||e>1114111||Math.floor(e)!==e)throw RangeError(`Invalid code point: ${e}`);e<=65535?t.push(e):(e-=65536,i=e>>10|55296,s=e%1024|56320,t.push(i,s)),(n+1===r.length||t.length>16384)&&(o+=String.fromCharCode.apply(null,t),t.length=0)}return o}}class dr{constructor(e){Object.defineProperty(this,"_pool",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_position",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_poolLen",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._pool=e,this._poolLen=e.length}check(){return this._position>=this._pool.length}read2Byte(){const e=this;if(e.check())return-1;let t="";for(let i=0;i<2;i++){let i=e._pool[e._position++].toString(16);1===i.length&&(i=`0${i}`),t+=i.toString()}return parseInt(t,16)}readInt32(){return(this.readByte()<<24)+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()}readLong(){const e=this;if(e.check())return-1;let t="";for(let i=0;i<8;i++){let i=e._pool[e._position++].toString(16);1===i.length&&(i=`0${i}`),t+=i}return parseInt(t,16)}readByte(){if(this.check())return-1;let e=this._pool[this._position++];return e>255&&(e&=255),e}readUTF(){if(this.check())return"";const e=this.readByte()<<8|this.readByte(),t=this._position;this._position+=e;const i=this._pool.subarray(t,this._position);return _r.readUTF(i)}readAll(){return this._pool.subarray(this._position,this._poolLen)}}class ur{constructor(){Object.defineProperty(this,"_pool",{enumerable:!0,configurable:!0,writable:!0,value:[]})}writeByte(e){e>=0&&(e>255&&(e&=255),this._pool.push(e))}writeBuffer(e){this._pool=this._pool.concat([...new Int8Array(e)])}writeArr(e){this._pool=this._pool.concat(e)}writeUTF(e){const t=_r.writeUTF(e);this._pool=this._pool.concat(t)}getBytesArray(){return this._pool}}class hr{constructor(e,t=nn,i=!1,s=!1){Object.defineProperty(this,"command",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"qos",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_retain",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"dup",{enumerable:!0,configurable:!0,writable:!0,value:s})}static parse(e){return new hr(e>>4,(6&e)>>1,!(1&~e),(8&e)>0)}encode(){let e=this.command<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this.dup?8:0,e}}class gr{constructor(e){Object.defineProperty(this,"header",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:0})}read(e,t,i){this.readMessage(e,t,i)}readMessage(e,t,i){return{stream:e,length:t}}}class Er{constructor(e){Object.defineProperty(this,"_header",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"messageId",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._header=new hr(e,sn)}write(e){const t=this.getHeaderFlag();e.writeByte(t),this.writeMessage(e)}setHeaderQos(e){this._header.qos=e}getHeaderFlag(){return this._header.encode()}getArrayBuffer(){const e=new ur;this.write(e);const t=e.getBytesArray();return new Int8Array(t).buffer}}class Ir extends gr{constructor(){super(...arguments),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"userId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"messageId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"sessionId",{enumerable:!0,configurable:!0,writable:!0,value:""})}readMessage(e,t,i){if(e.readByte(),this.status=e.readByte(),t<=Ir.MESSAGE_LENGTH)return{stream:e,length:t};if(i===gn){const t=e.readByte();1&t&&(this.userId=e.readUTF()),2&t&&(this.sessionId=e.readUTF()),4&t&&(this.timestamp=e.readLong()),8&t&&(this.messageId=e.read2Byte())}else this.userId=e.readUTF(),this.sessionId=e.readUTF(),this.timestamp=e.readLong();return{stream:e,length:t}}}Object.defineProperty(Ir,"MESSAGE_LENGTH",{enumerable:!0,configurable:!0,writable:!0,value:2});class Tr extends Er{constructor(e){super(hn),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:e})}writeMessage(e){e.writeArr([0,this.status])}}class fr extends gr{constructor(){super(...arguments),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}readMessage(e,t){return e.readByte(),this.status=e.readByte(),this.data=e.readAll(),{stream:e,length:t}}}Object.defineProperty(fr,"MESSAGE_LENGTH",{enumerable:!0,configurable:!0,writable:!0,value:2});class Rr extends Er{constructor(){super(dn)}writeMessage(e){}}class Ar extends gr{constructor(e){super(e)}}class pr extends gr{constructor(){super(...arguments),Object.defineProperty(this,"messageId",{enumerable:!0,configurable:!0,writable:!0,value:0})}readMessage(e,t){const i=256*e.readByte()+e.readByte();return this.messageId=parseInt(i.toString(),10),{stream:e,length:t}}}class mr extends Er{writeMessage(e){const t=this.messageId,i=255&t,s=(65280&t)>>8;e.writeByte(s),e.writeByte(i)}}class Sr extends pr{constructor(e){super(e),Object.defineProperty(this,"topic",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"pbData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"targetId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"syncMsg",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.syncMsg=e.dup}readMessage(e,t){return this.date=e.readInt32(),this.topic=e.readUTF(),this.targetId=e.readUTF(),super.readMessage(e,t),this.pbData=e.readAll(),{stream:e,length:t}}}class vr extends mr{constructor(e,t,i,s){super(e),Object.defineProperty(this,"targetId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"pbData",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"topic",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.topic="string"==typeof t?t:tn(t)}writeMessage(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),super.writeMessage(e),e.writeBuffer(this.pbData)}}class Nr extends vr{constructor(e,t,i){super(ln,e,i,t)}}class Or extends vr{constructor(e,t,i){super(on,e,i,t)}}class yr extends pr{constructor(){super(...arguments),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"millisecond",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"messageUId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:0})}readMessage(e,t){return super.readMessage(e,t),this.date=e.readInt32(),this.status=256*e.readByte()+e.readByte(),this.millisecond=256*e.readByte()+e.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=e.readUTF(),{stream:e,length:t}}}class Cr extends mr{constructor(e){super(an),this.messageId=e}}class Mr extends mr{constructor(e){super(_n),this.messageId=e}}class br extends pr{constructor(){super(...arguments),Object.defineProperty(this,"pbData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:0})}readMessage(e,t){return super.readMessage(e,t),this.date=e.readInt32(),this.status=256*e.readByte()+e.readByte(),this.pbData=e.readAll(),{stream:e,length:t}}}const Lr=(e,t)=>{const i=new Uint8Array(e),s=new dr(i),n=s.readByte(),r=(e=>{const{command:t}=e;let i;switch(t){case rn:i=new Ir(e);break;case on:i=new Sr(e);break;case an:i=new yr(e);break;case cn:i=new br(e);break;case un:i=new Ar(e);break;case hn:i=new fr(e);break;default:console.error(`No support for deserializing ${t} messages`)}return i})(hr.parse(n));return r&&r.read(s,i.length-1,t),r};class Ur extends Js{_openHandler(e,t){const{resolve:i,promise:s}=Ri(),n=this._logger,o=wx.request({url:e,enableChunked:!0,method:"GET",timeout:t.timeout,header:{"Content-Type":"application/json;charset=UTF-8","App-Key":t.appkey,Authorization:`Bearer ${t.token}`},success(e){var t;if(200===e.statusCode&&(null===(t=e.header["Content-Type"])||void 0===t?void 0:t.startsWith("text/event-stream")))i(gi());else{const{code:t,message:s}=JSON.parse(e.data);i(Ei(t,s))}},fail(t){const{errMsg:s,errno:o}=t;n.warn(r.L_REQ_STREAM_MSG_CONTENT_E,JSON.stringify({url:e,errMsg:s,errno:o})),i(Ei(-1,t.errMsg))},complete(){n.debug(r.L_REQ_STREAM_MSG_CONTENT_O,`req complete -> ${e}`)}});return o.onChunkReceived((e=>{const i=_r.readUTF(new Uint8Array(e.data));n.debug(r.L_REQ_STREAM_MSG_CONTENT_O,`chunk received -> ${i}`),t.onRawContent(i)})),s}}const Pr=Hs(),Dr=js({setItem(e,t){wx.setStorage({key:e,data:t})},getItem:e=>wx.getStorageSync(e),removeItem(e){wx.removeStorage({key:e})}});let wr=null;const Gr=e=>{const{isConnected:t,networkType:i}=e;wr({status:t,type:i})};const Vr={tag:"wechat",httpReq(e){const t=e.method||Ve.GET,i=e.timeout||xe,{headers:s,query:n,body:r}=e,o=Qt(e.url,n);return new Promise((e=>{wx.request({url:o,method:t,header:s,timeout:i,data:r,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:D.RC_HTTP_REQ_FAIL})}})}))},localStorage:Dr,sessionStorage:Dr,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Pr,createWebSocket(e,t){const i=wx.connectSocket({url:e,protocols:t});return Promise.resolve(gi({id:Date.now(),onClose(e){i.onClose((t=>{e(t.code,t.reason)}))},onError(e){i.onError((t=>{e(t.errMsg),i.close()}))},onMessage(e){i.onMessage((t=>{e(t.data)}))},onOpen(e){i.onOpen(e)},send(e){i.send({data:e})},close(e,t){i.close({code:e,reason:t})}}))},getNetworkType:()=>new Promise((e=>{wx.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){wr=e,wx.onNetworkStatusChange(Gr)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(Gr),wr=null},createSSEClient:e=>gi(new Ur(e)),get runtimeInfo(){return{type:Vr.tag,version:"Unknown"}}},kr=Hs(),xr=js({setItem(e,t){my.setStorage({key:e,data:t})},getItem(e){const{data:t}=my.getStorageSync({key:e});return t},removeItem(e){my.removeStorage({key:e})}});let Fr=null;const Br=e=>{const{isConnected:t,networkType:i}=e;Fr({status:t,type:i})};const Hr={tag:"alipay",httpReq(e){const t=e.method||Ve.GET,i=e.timeout||xe,{headers:s,query:n,body:r}=e,o=Qt(e.url,n),a=e.dataType||"json";return new Promise((e=>{my.request({url:o,method:t,headers:s,timeout:i,data:r,dataType:a,success:t=>{e({data:t.data,status:t.status})},fail:()=>{e({status:D.RC_HTTP_REQ_FAIL})}})}))},localStorage:xr,sessionStorage:xr,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:kr,createWebSocket(e){const t=my.connectSocket({url:e,multiple:!0});return Promise.resolve(gi({id:Date.now(),onClose(e){t.onClose(e)},onError(e){t.onError((t=>{e(t.errMsg)}))},onMessage(e){t.onMessage((t=>{t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen(e){t.onOpen(e)},send(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close(){t.close()}}))},getNetworkType:()=>new Promise((e=>{my.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){Fr=e,my.onNetworkStatusChange(Br)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(Br),Fr=null},createSSEClient:e=>Ei(D.NOT_SUPPORT,"Not supported yet"),get runtimeInfo(){return{type:Hr.tag,version:"Unknown"}}},jr=Hs(),Yr=js({setItem(e,t){tt.setStorage({key:e,data:t})},getItem:e=>tt.getStorageSync(e),removeItem(e){tt.removeStorage({key:e})}});let Wr=null;const qr=e=>{const{isConnected:t,networkType:i}=e;Wr({status:t,type:i})};const Jr={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:jr,localStorage:Yr,sessionStorage:Yr,httpReq:e=>new Promise((t=>{tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success(e){const i=(null==e?void 0:e.data)||{},s={data:JSON.stringify(i),status:e.statusCode};t(s)},fail(e){t({status:D.RC_HTTP_REQ_FAIL})}})})),createWebSocket:(e,t)=>new Promise((i=>{const s=tt.connectSocket({url:e,protocols:t,fail:e=>i(Ei(D.RC_SOCKET_DISCONNECTED,e.errMsg))});i(gi({id:Date.now(),onOpen(e){s.onOpen(e)},onClose(e){s.onClose((t=>e(t.code,t.reason)))},onError(e){s.onError((t=>{s.close(),e(t.errMsg)}))},onMessage(e){s.onMessage((t=>e(t.data)))},send(e){s.send({data:e})},close(e,t){s.close({code:e,reason:t})}}))})),getNetworkType:()=>new Promise((e=>{tt.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){Wr=e,tt.onNetworkStatusChange(qr)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(qr),Wr=null},createSSEClient:e=>Ei(D.NOT_SUPPORT),get runtimeInfo(){return{type:Jr.tag,version:"Unknown"}}},Kr=Hs(),Qr=js({setItem(e,t){swan.setStorage({key:e,data:t})},getItem:e=>swan.getStorageSync(e),removeItem(e){swan.removeStorage({key:e})}});let Xr=null;const zr=e=>{const{isConnected:t,networkType:i}=e;Xr({status:t,type:i})};const Zr={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Kr,localStorage:Qr,sessionStorage:Qr,httpReq:e=>new Promise((t=>{swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success(e){const i=(null==e?void 0:e.data)||{},s={data:JSON.stringify(i),status:e.statusCode};t(s)},fail(e){t({status:D.RC_HTTP_REQ_FAIL})}})})),createWebSocket(e,t){const i=swan.connectSocket({url:e,protocols:t});return Promise.resolve(gi({id:Date.now(),onOpen(e){i.onOpen(e)},onClose(e){i.onClose((t=>e(t.code,t.reason)))},onError(e){i.onError((t=>e(t.errMsg)))},onMessage(e){i.onMessage((t=>e(t.data)))},send(e){i.send({data:e})},close(e,t){i.close({code:e,reason:t})}}))},getNetworkType(){return t(this,void 0,void 0,(function*(){return new Promise((e=>{swan.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})}))}))},setNetworkStatusListener:function(e){Xr=e,swan.onNetworkStatusChange(zr)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(zr),Xr=null},createSSEClient:e=>Ei(D.NOT_SUPPORT),get runtimeInfo(){return{type:Zr.tag,version:"Unknown"}}},$r=Hs(),eo=js({setItem(e,t){jd.setStorage({key:e,data:t})},getItem:e=>jd.getStorageSync(e),removeItem(e){jd.removeStorage({key:e})}});let to=null;const io=e=>{const{isConnected:t,networkType:i}=e;to({status:t,type:i})};const so={tag:"jingdong",httpReq(e){const t=e.method||Ve.GET,i=e.timeout||xe,{headers:s,query:n,body:r}=e,o=Qt(e.url,n);return new Promise((e=>{jd.request({url:o,method:t,header:s,timeout:i,data:r,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:D.RC_HTTP_REQ_FAIL})}})}))},localStorage:eo,sessionStorage:eo,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:$r,createWebSocket:(e,t)=>(jd.connectSocket({url:e,protocols:t}),Promise.resolve(gi({id:Date.now(),onClose(e){jd.onSocketClose((t=>{e(t.code,t.reason)}))},onError(e){jd.onSocketError((t=>{e(t.errMsg)}))},onMessage(e){jd.onSocketMessage((t=>{e(t.data)}))},onOpen(e){jd.onSocketOpen(e)},send(e){jd.sendSocketMessage({data:e})},close(e,t){jd.closeSocket({code:e,reason:t})}}))),getNetworkType:()=>new Promise((e=>{jd.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){to=e,jd.onNetworkStatusChange(io)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(io),to=null},createSSEClient:e=>Ei(D.NOT_SUPPORT),get runtimeInfo(){return{type:so.tag,version:"Unknown"}}},no=Hs(),ro=js({setItem(e,t){ks.setStorage({key:e,data:t})},getItem:e=>ks.getStorageSync(e),removeItem(e){ks.removeStorage({key:e})}});let oo=null;const ao=e=>{const{isConnected:t,networkType:i}=e;oo({status:t,type:i})};const lo={tag:"kuaishou",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:no,localStorage:ro,sessionStorage:ro,httpReq:e=>new Promise((t=>{ks.request({url:e.url,data:e.body,header:e.headers,method:e.method,success(e){const i=(null==e?void 0:e.data)||{},s={data:JSON.stringify(i),status:e.statusCode};t(s)},fail(e){t({status:D.RC_HTTP_REQ_FAIL})}})})),createWebSocket(e,t){const i=ks.connectSocket({url:e,protocols:t});return Promise.resolve(gi({id:Date.now(),onOpen(e){i.onOpen(e)},onClose(e){i.onClose((t=>e(t.code,t.reason)))},onError(e){i.onError((t=>e(t.errMsg)))},onMessage(e){i.onMessage((t=>e(t.data)))},send(e){i.send({data:e})},close(e,t){i.close({code:e,reason:t})}}))},getNetworkType:()=>new Promise((e=>{ks.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){oo=e,ks.onNetworkStatusChange(ao)},removeNetworkStatusListener:function(){ks.offNetworkStatusChange(ao),oo=null},createSSEClient:e=>Ei(D.NOT_SUPPORT),get runtimeInfo(){return{type:lo.tag,version:"Unknown"}}},co=js({setItem(e,t){uni.setStorage({key:e,data:t})},getItem:e=>uni.getStorageSync(e),removeItem(e){uni.removeStorage({key:e,success:()=>{}})}});let _o=null;const uo=e=>{const{isConnected:t,networkType:i}=e;_o({status:t,type:i})};const ho={tag:"uniapp",httpReq(e){const t=e.method||Ve.GET,i=e.timeout||xe,{headers:s,query:n,body:r}=e,o=Qt(e.url,n);return new Promise((e=>{uni.request({url:o,method:t,header:s,timeout:i,data:r,success:t=>{e({data:t.data,status:t.statusCode})},fail:()=>{e({status:D.RC_HTTP_REQ_FAIL})}})}))},localStorage:co,sessionStorage:co,useNavi:!0,get connectPlatform(){const{uniPlatform:e,osName:t}=uni.getSystemInfoSync();return["app","app-plus"].includes(e)&&t||""},isFromUniapp:!0,createWebSocket(e,t){const i={complete(){},url:e,protocols:t},s=uni.connectSocket(i);return Promise.resolve(gi({id:Date.now(),onClose(e){s.onClose((t=>{e(t.code,t.reason)}))},onError(e){s.onError((t=>{e(t.errMsg)}))},onMessage(e){s.onMessage((t=>{e(t.data)}))},onOpen(e){s.onOpen(e)},send(e){s.send({data:e})},close(e,t){s.close({code:e,reason:t})}}))},getNetworkType:()=>new Promise((e=>{uni.getNetworkType({success:({networkType:t})=>{e(t)},fail:()=>{e(Ge.UNKONWN)}})})),setNetworkStatusListener:function(e){_o=e,uni.onNetworkStatusChange(uo)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(uo),_o=null},createSSEClient:e=>Ei(D.NOT_SUPPORT),getApiVer:()=>{const e=uni.getSystemInfoSync(),{osAndroidAPILevel:t,deviceModel:i,deviceBrand:s,osVersion:n,osName:r}=e;return`${s||""}|${i||""}|${("android"===r?t:n)||""}|||uniapp`.replace(/-/g,"_")},get runtimeInfo(){return{type:ho.tag,version:"Unknown"}}},go=e=>e&&e.request&&e.getSystemInfo,Eo="undefined"!=typeof uni&&go(uni)?(()=>{switch(process.env.VUE_APP_PLATFORM){case"app-plus":case"app":case"app-harmony":return ho;case"mp-jd":return so;case"mp-baidu":return Zr;case"mp-toutiao":return Jr;case"mp-alipay":return Hr;case"mp-weixin":return Vr;case"mp-kuaishou":return lo;default:return Zs}})():"undefined"!=typeof jd&&go(jd)?so:"undefined"!=typeof my&&go(my)?Hr:"undefined"!=typeof tt&&go(tt)?Jr:"undefined"!=typeof ks&&go(ks)?lo:"undefined"!=typeof swan&&go(swan)?Zr:"undefined"!=typeof wx&&go(wx)?Vr:Zs,Io=function(){var e,t={},i=function(e){var t=function(e,i,n){if(void 0===e&&(e=t.DEFAULT_CAPACITY),void 0===i&&(i=t.DEFAULT_ENDIAN),void 0===n&&(n=t.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");i=!!i,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=i,this.noAssert=n};t.VERSION="5.0.1",t.LITTLE_ENDIAN=!0,t.BIG_ENDIAN=!1,t.DEFAULT_CAPACITY=16,t.DEFAULT_ENDIAN=t.BIG_ENDIAN,t.DEFAULT_NOASSERT=!1,t.Long=e||null;var i=t.prototype;i.__isByteBuffer__,Object.defineProperty(i,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var s=new ArrayBuffer(0),n=String.fromCharCode;function r(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function o(){var e=[],t=[];return function(){if(0===arguments.length)return t.join("")+n.apply(String,e);e.length+arguments.length>1024&&(t.push(n.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function a(e,t,i,s,n){var r,o,a=8*n-s-1,l=(1<<a)-1,c=l>>1,_=-7,d=i?n-1:0,u=i?-1:1,h=e[t+d];for(d+=u,r=h&(1<<-_)-1,h>>=-_,_+=a;_>0;r=256*r+e[t+d],d+=u,_-=8);for(o=r&(1<<-_)-1,r>>=-_,_+=s;_>0;o=256*o+e[t+d],d+=u,_-=8);if(0===r)r=1-c;else{if(r===l)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,s),r-=c}return(h?-1:1)*o*Math.pow(2,r-s)}function l(e,t,i,s,n,r){var o,a,l,c=8*r-n-1,_=(1<<c)-1,d=_>>1,u=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=s?0:r-1,g=s?1:-1,E=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=_):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+d>=1?u/l:u*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=_?(a=0,o=_):o+d>=1?(a=(t*l-1)*Math.pow(2,n),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,n),o=0));n>=8;e[i+h]=255&a,h+=g,a/=256,n-=8);for(o=o<<n|a,c+=n;c>0;e[i+h]=255&o,h+=g,o/=256,c-=8);e[i+h-g]|=128*E}t.accessor=function(){return Uint8Array},t.allocate=function(e,i,s){return new t(e,i,s)},t.concat=function(e,i,s,n){"boolean"!=typeof i&&"string"==typeof i||(n=s,s=i,i=void 0);for(var r,o=0,a=0,l=e.length;a<l;++a)t.isByteBuffer(e[a])||(e[a]=t.wrap(e[a],i)),(r=e[a].limit-e[a].offset)>0&&(o+=r);if(0===o)return new t(0,s,n);var c,_=new t(o,s,n);for(a=0;a<l;)(r=(c=e[a++]).limit-c.offset)<=0||(_.view.set(c.view.subarray(c.offset,c.limit),_.offset),_.offset+=r);return _.limit=_.offset,_.offset=0,_},t.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},t.type=function(){return ArrayBuffer},t.wrap=function(e,s,n,r){if("string"!=typeof s&&(r=n,n=s,s=void 0),"string"==typeof e)switch(void 0===s&&(s="utf8"),s){case"base64":return t.fromBase64(e,n);case"hex":return t.fromHex(e,n);case"binary":return t.fromBinary(e,n);case"utf8":return t.fromUTF8(e,n);case"debug":return t.fromDebug(e,n);default:throw Error("Unsupported encoding: "+s)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");var o;if(t.isByteBuffer(e))return(o=i.clone.call(e)).markedOffset=-1,o;if(e instanceof Uint8Array)o=new t(0,n,r),e.length>0&&(o.buffer=e.buffer,o.offset=e.byteOffset,o.limit=e.byteOffset+e.byteLength,o.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)o=new t(0,n,r),e.byteLength>0&&(o.buffer=e,o.offset=0,o.limit=e.byteLength,o.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");(o=new t(e.length,n,r)).limit=e.length;for(var a=0;a<e.length;++a)o.view[a]=e[a]}return o},i.writeBitSet=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var s,n=t,r=e.length,o=r>>3,a=0;for(t+=this.writeVarint32(r,t);o--;)s=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(s,t++);if(a<r){var l=0;for(s=0;a<r;)s|=(1&!!e[a++])<<l++;this.writeByte(s,t++)}return i?(this.offset=t,this):t-n},i.readBitSet=function(e){var t=void 0===e;t&&(e=this.offset);var i,s=this.readVarint32(e),n=s.value,r=n>>3,o=0,a=[];for(e+=s.length;r--;)i=this.readByte(e++),a[o++]=!!(1&i),a[o++]=!!(2&i),a[o++]=!!(4&i),a[o++]=!!(8&i),a[o++]=!!(16&i),a[o++]=!!(32&i),a[o++]=!!(64&i),a[o++]=!!(128&i);if(o<n){var l=0;for(i=this.readByte(e++);o<n;)a[o++]=!!(i>>l++&1)}return t&&(this.offset=e),a},i.readBytes=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}var s=this.slice(t,t+e);return i&&(this.offset+=e),s},i.writeBytes=i.append,i.writeInt8=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=1,this.view[t]=e,i&&(this.offset+=1),this},i.writeByte=i.writeInt8,i.readInt8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i=this.view[e];return 128&~i||(i=-(255-i+1)),t&&(this.offset+=1),i},i.readByte=i.readInt8,i.writeUint8=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=1,this.view[t]=e,i&&(this.offset+=1),this},i.writeUInt8=i.writeUint8,i.readUint8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i=this.view[e];return t&&(this.offset+=1),i},i.readUInt8=i.readUint8,i.writeInt16=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),i&&(this.offset+=2),this},i.writeShort=i.writeInt16,i.readInt16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var i=0;return this.littleEndian?(i=this.view[e],i|=this.view[e+1]<<8):(i=this.view[e]<<8,i|=this.view[e+1]),32768&~i||(i=-(65535-i+1)),t&&(this.offset+=2),i},i.readShort=i.readInt16,i.writeUint16=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),i&&(this.offset+=2),this},i.writeUInt16=i.writeUint16,i.readUint16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var i=0;return this.littleEndian?(i=this.view[e],i|=this.view[e+1]<<8):(i=this.view[e]<<8,i|=this.view[e+1]),t&&(this.offset+=2),i},i.readUInt16=i.readUint16,i.writeInt32=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),i&&(this.offset+=4),this},i.writeInt=i.writeInt32,i.readInt32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var i=0;return this.littleEndian?(i=this.view[e+2]<<16,i|=this.view[e+1]<<8,i|=this.view[e],i+=this.view[e+3]<<24>>>0):(i=this.view[e+1]<<16,i|=this.view[e+2]<<8,i|=this.view[e+3],i+=this.view[e]<<24>>>0),i|=0,t&&(this.offset+=4),i},i.readInt=i.readInt32,i.writeUint32=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),i&&(this.offset+=4),this},i.writeUInt32=i.writeUint32,i.readUint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var i=0;return this.littleEndian?(i=this.view[e+2]<<16,i|=this.view[e+1]<<8,i|=this.view[e],i+=this.view[e+3]<<24>>>0):(i=this.view[e+1]<<16,i|=this.view[e+2]<<8,i|=this.view[e+3],i+=this.view[e]<<24>>>0),t&&(this.offset+=4),i},i.readUInt32=i.readUint32,e&&(i.writeInt64=function(t,i){var s=void 0===i;if(s&&(i=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),i+=8;var n=this.buffer.byteLength;i>n&&this.resize((n*=2)>i?n:i),i-=8;var r=t.low,o=t.high;return this.littleEndian?(this.view[i+3]=r>>>24&255,this.view[i+2]=r>>>16&255,this.view[i+1]=r>>>8&255,this.view[i]=255&r,i+=4,this.view[i+3]=o>>>24&255,this.view[i+2]=o>>>16&255,this.view[i+1]=o>>>8&255,this.view[i]=255&o):(this.view[i]=o>>>24&255,this.view[i+1]=o>>>16&255,this.view[i+2]=o>>>8&255,this.view[i+3]=255&o,i+=4,this.view[i]=r>>>24&255,this.view[i+1]=r>>>16&255,this.view[i+2]=r>>>8&255,this.view[i+3]=255&r),s&&(this.offset+=8),this},i.writeLong=i.writeInt64,i.readInt64=function(t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var s=0,n=0;this.littleEndian?(s=this.view[t+2]<<16,s|=this.view[t+1]<<8,s|=this.view[t],s+=this.view[t+3]<<24>>>0,t+=4,n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0):(n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0,t+=4,s=this.view[t+1]<<16,s|=this.view[t+2]<<8,s|=this.view[t+3],s+=this.view[t]<<24>>>0);var r=new e(s,n,!1);return i&&(this.offset+=8),r},i.readLong=i.readInt64,i.writeUint64=function(t,i){var s=void 0===i;if(s&&(i=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),i+=8;var n=this.buffer.byteLength;i>n&&this.resize((n*=2)>i?n:i),i-=8;var r=t.low,o=t.high;return this.littleEndian?(this.view[i+3]=r>>>24&255,this.view[i+2]=r>>>16&255,this.view[i+1]=r>>>8&255,this.view[i]=255&r,i+=4,this.view[i+3]=o>>>24&255,this.view[i+2]=o>>>16&255,this.view[i+1]=o>>>8&255,this.view[i]=255&o):(this.view[i]=o>>>24&255,this.view[i+1]=o>>>16&255,this.view[i+2]=o>>>8&255,this.view[i+3]=255&o,i+=4,this.view[i]=r>>>24&255,this.view[i+1]=r>>>16&255,this.view[i+2]=r>>>8&255,this.view[i+3]=255&r),s&&(this.offset+=8),this},i.writeUInt64=i.writeUint64,i.readUint64=function(t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var s=0,n=0;this.littleEndian?(s=this.view[t+2]<<16,s|=this.view[t+1]<<8,s|=this.view[t],s+=this.view[t+3]<<24>>>0,t+=4,n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0):(n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0,t+=4,s=this.view[t+1]<<16,s|=this.view[t+2]<<8,s|=this.view[t+3],s+=this.view[t]<<24>>>0);var r=new e(s,n,!0);return i&&(this.offset+=8),r},i.readUInt64=i.readUint64),i.writeFloat32=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=4,l(this.view,e,t,this.littleEndian,23,4),i&&(this.offset+=4),this},i.writeFloat=i.writeFloat32,i.readFloat32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var i=a(this.view,e,this.littleEndian,23,4);return t&&(this.offset+=4),i},i.readFloat=i.readFloat32,i.writeFloat64=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=8;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=8,l(this.view,e,t,this.littleEndian,52,8),i&&(this.offset+=8),this},i.writeDouble=i.writeFloat64,i.readFloat64=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}var i=a(this.view,e,this.littleEndian,52,8);return t&&(this.offset+=8),i},i.readDouble=i.readFloat64,t.MAX_VARINT32_BYTES=5,t.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5},t.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},t.zigZagDecode32=function(e){return e>>>1^-(1&e)},i.writeVarint32=function(e,i){var s=void 0===i;if(s&&(i=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}var n,r=t.calculateVarint32(e);i+=r;var o=this.buffer.byteLength;for(i>o&&this.resize((o*=2)>i?o:i),i-=r,e>>>=0;e>=128;)n=127&e|128,this.view[i++]=n,e>>>=7;return this.view[i++]=e,s?(this.offset=i,this):r},i.writeVarint32ZigZag=function(e,i){return this.writeVarint32(t.zigZagEncode32(e),i)},i.readVarint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i,s=0,n=0;do{if(!this.noAssert&&e>this.limit){var r=Error("Truncated");throw r.truncated=!0,r}i=this.view[e++],s<5&&(n|=(127&i)<<7*s),++s}while(128&i);return n|=0,t?(this.offset=e,n):{value:n,length:s}},i.readVarint32ZigZag=function(e){var i=this.readVarint32(e);return"object"==typeof i?i.value=t.zigZagDecode32(i.value):i=t.zigZagDecode32(i),i},e&&(t.MAX_VARINT64_BYTES=10,t.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var i=t.toInt()>>>0,s=t.shiftRightUnsigned(28).toInt()>>>0,n=t.shiftRightUnsigned(56).toInt()>>>0;return 0==n?0==s?i<16384?i<128?1:2:i<1<<21?3:4:s<16384?s<128?5:6:s<1<<21?7:8:n<128?9:10},t.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},t.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},i.writeVarint64=function(i,s){var n=void 0===s;if(n&&(s=this.offset),!this.noAssert){if("number"==typeof i)i=e.fromNumber(i);else if("string"==typeof i)i=e.fromString(i);else if(!(i&&i instanceof e))throw TypeError("Illegal value: "+i+" (not an integer or Long)");if("number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+0) <= "+this.buffer.byteLength)}"number"==typeof i?i=e.fromNumber(i,!1):"string"==typeof i?i=e.fromString(i,!1):!1!==i.unsigned&&(i=i.toSigned());var r=t.calculateVarint64(i),o=i.toInt()>>>0,a=i.shiftRightUnsigned(28).toInt()>>>0,l=i.shiftRightUnsigned(56).toInt()>>>0;s+=r;var c=this.buffer.byteLength;switch(s>c&&this.resize((c*=2)>s?c:s),s-=r,r){case 10:this.view[s+9]=l>>>7&1;case 9:this.view[s+8]=9!==r?128|l:127&l;case 8:this.view[s+7]=8!==r?a>>>21|128:a>>>21&127;case 7:this.view[s+6]=7!==r?a>>>14|128:a>>>14&127;case 6:this.view[s+5]=6!==r?a>>>7|128:a>>>7&127;case 5:this.view[s+4]=5!==r?128|a:127&a;case 4:this.view[s+3]=4!==r?o>>>21|128:o>>>21&127;case 3:this.view[s+2]=3!==r?o>>>14|128:o>>>14&127;case 2:this.view[s+1]=2!==r?o>>>7|128:o>>>7&127;case 1:this.view[s]=1!==r?128|o:127&o}return n?(this.offset+=r,this):r},i.writeVarint64ZigZag=function(e,i){return this.writeVarint64(t.zigZagEncode64(e),i)},i.readVarint64=function(t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var s=t,n=0,r=0,o=0,a=0;if(n=127&(a=this.view[t++]),128&a&&(n|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(n|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(n|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(r=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(r|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(o=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(o|=(127&(a=this.view[t++]))<<7,128&a||this.noAssert&&void 0===a))))))))))throw Error("Buffer overrun");var l=e.fromBits(n|r<<28,r>>>4|o<<24,!1);return i?(this.offset=t,l):{value:l,length:t-s}},i.readVarint64ZigZag=function(i){var s=this.readVarint64(i);return s&&s.value instanceof e?s.value=t.zigZagDecode64(s.value):s=t.zigZagDecode64(s),s}),i.writeCString=function(e,t){var i=void 0===t;i&&(t=this.offset);var s,n=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(s=0;s<n;++s)if(0===e.charCodeAt(s))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}n=_.calculateUTF16asUTF8(r(e))[1],t+=n+1;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=n+1,_.encodeUTF16toUTF8(r(e),function(e){this.view[t++]=e}.bind(this)),this.view[t++]=0,i?(this.offset=t,this):n},i.readCString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i,s=e,n=-1;return _.decodeUTF8toUTF16(function(){if(0===n)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(n=this.view[e++])?null:n}.bind(this),i=o(),!0),t?(this.offset=e,i()):{string:i(),length:e-s}},i.writeIString=function(e,t){var i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var s,n=t;s=_.calculateUTF16asUTF8(r(e),this.noAssert)[1],t+=4+s;var o=this.buffer.byteLength;if(t>o&&this.resize((o*=2)>t?o:t),t-=4+s,this.littleEndian?(this.view[t+3]=s>>>24&255,this.view[t+2]=s>>>16&255,this.view[t+1]=s>>>8&255,this.view[t]=255&s):(this.view[t]=s>>>24&255,this.view[t+1]=s>>>16&255,this.view[t+2]=s>>>8&255,this.view[t+3]=255&s),t+=4,_.encodeUTF16toUTF8(r(e),function(e){this.view[t++]=e}.bind(this)),t!==n+4+s)throw RangeError("Illegal range: Truncated data, "+t+" == "+(t+4+s));return i?(this.offset=t,this):t-n},i.readIString=function(e){var i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var s=e,n=this.readUint32(e),r=this.readUTF8String(n,t.METRICS_BYTES,e+=4);return e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-s}},t.METRICS_CHARS="c",t.METRICS_BYTES="b",i.writeUTF8String=function(e,t){var i,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var n=t;i=_.calculateUTF16asUTF8(r(e))[1],t+=i;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=i,_.encodeUTF16toUTF8(r(e),function(e){this.view[t++]=e}.bind(this)),s?(this.offset=t,this):t-n},i.writeString=i.writeUTF8String,t.calculateUTF8Chars=function(e){return _.calculateUTF16asUTF8(r(e))[0]},t.calculateUTF8Bytes=function(e){return _.calculateUTF16asUTF8(r(e))[1]},t.calculateString=t.calculateUTF8Bytes,i.readUTF8String=function(e,i,s){"number"==typeof i&&(s=i,i=void 0);var n=void 0===s;if(n&&(s=this.offset),void 0===i&&(i=t.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+0) <= "+this.buffer.byteLength)}var r,a=0,l=s;if(i===t.METRICS_CHARS){if(r=o(),_.decodeUTF8(function(){return a<e&&s<this.limit?this.view[s++]:null}.bind(this),(function(e){++a,_.UTF8toUTF16(e,r)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return n?(this.offset=s,r()):{string:r(),length:s-l}}if(i===t.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+"+e+") <= "+this.buffer.byteLength)}var c=s+e;if(_.decodeUTF8toUTF16(function(){return s<c?this.view[s++]:null}.bind(this),r=o(),this.noAssert),s!==c)throw RangeError("Illegal range: Truncated data, "+s+" == "+c);return n?(this.offset=s,r()):{string:r(),length:s-l}}throw TypeError("Unsupported metrics: "+i)},i.readString=i.readUTF8String,i.writeVString=function(e,i){var s=void 0===i;if(s&&(i=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}var n,o,a=i;n=_.calculateUTF16asUTF8(r(e),this.noAssert)[1],o=t.calculateVarint32(n),i+=o+n;var l=this.buffer.byteLength;if(i>l&&this.resize((l*=2)>i?l:i),i-=o+n,i+=this.writeVarint32(n,i),_.encodeUTF16toUTF8(r(e),function(e){this.view[i++]=e}.bind(this)),i!==a+n+o)throw RangeError("Illegal range: Truncated data, "+i+" == "+(i+n+o));return s?(this.offset=i,this):i-a},i.readVString=function(e){var i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var s=e,n=this.readVarint32(e),r=this.readUTF8String(n.value,t.METRICS_BYTES,e+=n.length);return e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-s}},i.append=function(e,i,s){"number"!=typeof i&&"string"==typeof i||(s=i,i=void 0);var n=void 0===s;if(n&&(s=this.offset),!this.noAssert){if("number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,i));var r=e.limit-e.offset;if(r<=0)return this;s+=r;var o=this.buffer.byteLength;return s>o&&this.resize((o*=2)>s?o:s),s-=r,this.view.set(e.view.subarray(e.offset,e.limit),s),e.offset+=r,n&&(this.offset+=r),this},i.appendTo=function(e,t){return e.append(this,t),this},i.assert=function(e){return this.noAssert=!e,this},i.capacity=function(){return this.buffer.byteLength},i.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},i.clone=function(e){var i=new t(0,this.littleEndian,this.noAssert);return e?(i.buffer=new ArrayBuffer(this.buffer.byteLength),i.view=new Uint8Array(i.buffer)):(i.buffer=this.buffer,i.view=this.view),i.offset=this.offset,i.markedOffset=this.markedOffset,i.limit=this.limit,i},i.compact=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(0===e&&t===this.buffer.byteLength)return this;var i=t-e;if(0===i)return this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var n=new ArrayBuffer(i),r=new Uint8Array(n);return r.set(this.view.subarray(e,t)),this.buffer=n,this.view=r,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=i,this},i.copy=function(e,i){if(void 0===e&&(e=this.offset),void 0===i&&(i=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal end: Not an integer");if(i>>>=0,e<0||e>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+i+" <= "+this.buffer.byteLength)}if(e===i)return new t(0,this.littleEndian,this.noAssert);var s=i-e,n=new t(s,this.littleEndian,this.noAssert);return n.offset=0,n.limit=s,n.markedOffset>=0&&(n.markedOffset-=e),this.copyTo(n,0,e,i),n},i.copyTo=function(e,i,s,n){var r,o;if(!this.noAssert&&!t.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(i=(o=void 0===i)?e.offset:0|i,s=(r=void 0===s)?this.offset:0|s,n=void 0===n?this.limit:0|n,i<0||i>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+i+" <= "+e.buffer.byteLength);if(s<0||n>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+s+" <= "+this.buffer.byteLength);var a=n-s;return 0===a?e:(e.ensureCapacity(i+a),e.view.set(this.view.subarray(s,n),i),r&&(this.offset+=a),o&&(e.offset+=a),this)},i.ensureCapacity=function(e){var t=this.buffer.byteLength;return t<e?this.resize((t*=2)>e?t:e):this},i.fill=function(e,t,i){var s=void 0===t;if(s&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===i&&(i=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal end: Not an integer");if(i>>>=0,t<0||t>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+i+" <= "+this.buffer.byteLength)}if(t>=i)return this;for(;t<i;)this.view[t++]=e;return s&&(this.offset=t),this},i.flip=function(){return this.limit=this.offset,this.offset=0,this},i.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},i.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},i.LE=function(e){return this.littleEndian=void 0===e||!!e,this},i.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},i.prepend=function(e,i,s){"number"!=typeof i&&"string"==typeof i||(s=i,i=void 0);var n=void 0===s;if(n&&(s=this.offset),!this.noAssert){if("number"!=typeof s||s%1!=0)throw TypeError("Illegal offset: "+s+" (not an integer)");if((s>>>=0)<0||s+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+s+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,i));var r=e.limit-e.offset;if(r<=0)return this;var o=r-s;if(o>0){var a=new ArrayBuffer(this.buffer.byteLength+o),l=new Uint8Array(a);l.set(this.view.subarray(s,this.buffer.byteLength),r),this.buffer=a,this.view=l,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,s+=o}else new Uint8Array(this.buffer);return this.view.set(e.view.subarray(e.offset,e.limit),s-r),e.offset=e.limit,n&&(this.offset-=r),this},i.prependTo=function(e,t){return e.prepend(this,t),this},i.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},i.remaining=function(){return this.limit-this.offset},i.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},i.resize=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}if(this.buffer.byteLength<e){var t=new ArrayBuffer(e),i=new Uint8Array(t);i.set(this.view),this.buffer=t,this.view=i}return this},i.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},i.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},i.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var i=this.clone();return i.offset=e,i.limit=t,i},i.toBuffer=function(e){var t=this.offset,i=this.limit;if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: Not an integer");if(t>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal limit: Not an integer");if(i>>>=0,t<0||t>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+i+" <= "+this.buffer.byteLength)}if(!e&&0===t&&i===this.buffer.byteLength)return this.buffer;if(t===i)return s;var n=new ArrayBuffer(i-t);return new Uint8Array(n).set(new Uint8Array(this.buffer).subarray(t,i),0),n},i.toArrayBuffer=i.toBuffer,i.toString=function(e,t,i){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(i=t=e="utf8"),e){case"utf8":return this.toUTF8(t,i);case"base64":return this.toBase64(t,i);case"hex":return this.toHex(t,i);case"binary":return this.toBinary(t,i);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}};var c=function(){for(var e={},t=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],i=[],s=0,n=t.length;s<n;++s)i[t[s]]=s;return e.encode=function(e,i){for(var s,n;null!==(s=e());)i(t[s>>2&63]),n=(3&s)<<4,null!==(s=e())?(i(t[63&((n|=s>>4&15)|s>>4&15)]),n=(15&s)<<2,null!==(s=e())?(i(t[63&(n|s>>6&3)]),i(t[63&s])):(i(t[63&n]),i(61))):(i(t[63&n]),i(61),i(61))},e.decode=function(e,t){var s,n,r;function o(e){throw Error("Illegal character code: "+e)}for(;null!==(s=e());)if(void 0===(n=i[s])&&o(s),null!==(s=e())&&(void 0===(r=i[s])&&o(s),t(n<<2>>>0|(48&r)>>4),null!==(s=e()))){if(void 0===(n=i[s])){if(61===s)break;o(s)}if(t((15&r)<<4>>>0|(60&n)>>2),null!==(s=e())){if(void 0===(r=i[s])){if(61===s)break;o(s)}t((3&n)<<6>>>0|r)}}},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)},e}();i.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var i;return c.encode(function(){return e<t?this.view[e++]:null}.bind(this),i=o()),i()},t.fromBase64=function(e,i){if("string"!=typeof e)throw TypeError("str");var s=new t(e.length/4*3,i),n=0;return c.decode(r(e),(function(e){s.view[n++]=e})),s.limit=n,s},t.btoa=function(e){return t.fromBinary(e).toBase64()},t.atob=function(e){return t.fromBase64(e).toBinary()},i.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var i=[],s=[];e<t;)i.push(this.view[e++]),i.length>=1024&&(s.push(String.fromCharCode.apply(String,i)),i=[]);return s.join("")+String.fromCharCode.apply(String,i)},t.fromBinary=function(e,i){if("string"!=typeof e)throw TypeError("str");for(var s,n=0,r=e.length,o=new t(r,i);n<r;){if((s=e.charCodeAt(n))>255)throw RangeError("illegal char code: "+s);o.view[n++]=s}return o.limit=r,o},i.toDebug=function(e){for(var t,i=-1,s=this.buffer.byteLength,n="",r="",o="";i<s;){if(-1!==i&&(n+=(t=this.view[i])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(r+=t>32&&t<127?String.fromCharCode(t):".")),++i,e&&i>0&&i%16==0&&i!==s){for(;n.length<51;)n+=" ";o+=n+r+"\n",n=r=""}i===this.offset&&i===this.limit?n+=i===this.markedOffset?"!":"|":i===this.offset?n+=i===this.markedOffset?"[":"<":i===this.limit?n+=i===this.markedOffset?"]":">":n+=i===this.markedOffset?"'":e||0!==i&&i!==s?" ":""}if(e&&" "!==n){for(;n.length<51;)n+=" ";o+=n+r+"\n"}return e?o:n},t.fromDebug=function(e,i,s){for(var n,r,o=e.length,a=new t((o+1)/3|0,i,s),l=0,c=0,_=!1,d=!1,u=!1,h=!1,g=!1;l<o;){switch(n=e.charAt(l++)){case"!":if(!s){if(d||u||h){g=!0;break}d=u=h=!0}a.offset=a.markedOffset=a.limit=c,_=!1;break;case"|":if(!s){if(d||h){g=!0;break}d=h=!0}a.offset=a.limit=c,_=!1;break;case"[":if(!s){if(d||u){g=!0;break}d=u=!0}a.offset=a.markedOffset=c,_=!1;break;case"<":if(!s){if(d){g=!0;break}d=!0}a.offset=c,_=!1;break;case"]":if(!s){if(h||u){g=!0;break}h=u=!0}a.limit=a.markedOffset=c,_=!1;break;case">":if(!s){if(h){g=!0;break}h=!0}a.limit=c,_=!1;break;case"'":if(!s){if(u){g=!0;break}u=!0}a.markedOffset=c,_=!1;break;case" ":_=!1;break;default:if(!s&&_){g=!0;break}if(r=parseInt(n+e.charAt(l++),16),!s&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[c++]=r,_=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+l)}if(!s){if(!d||!h)throw TypeError("Illegal str: Missing offset or limit");if(c<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+o)}return a},i.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var i,s=new Array(t-e);e<t;)(i=this.view[e++])<16?s.push("0",i.toString(16)):s.push(i.toString(16));return s.join("")},t.fromHex=function(e,i,s){if(!s){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(var n,r=e.length,o=new t(r/2|0,i),a=0,l=0;a<r;a+=2){if(n=parseInt(e.substring(a,a+2),16),!s&&(!isFinite(n)||n<0||n>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[l++]=n}return o.limit=l,o};var _=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var i=null;for("number"==typeof e&&(i=e,e=function(){return null});null!==i||null!==(i=e());)i<128?t(127&i):i<2048?(t(i>>6&31|192),t(63&i|128)):i<65536?(t(i>>12&15|224),t(i>>6&63|128),t(63&i|128)):(t(i>>18&7|240),t(i>>12&63|128),t(i>>6&63|128),t(63&i|128)),i=null},decodeUTF8:function(e,t){for(var i,s,n,r,o=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(i=e());)if(128&i)if(192==(224&i))null===(s=e())&&o([i,s]),t((31&i)<<6|63&s);else if(224==(240&i))(null===(s=e())||null===(n=e()))&&o([i,s,n]),t((15&i)<<12|(63&s)<<6|63&n);else{if(240!=(248&i))throw RangeError("Illegal starting byte: "+i);(null===(s=e())||null===(n=e())||null===(r=e()))&&o([i,s,n,r]),t((7&i)<<18|(63&s)<<12|(63&n)<<6|63&r)}else t(i)},UTF16toUTF8:function(e,t){for(var i,s=null;null!==(i=null!==s?s:e());)i>=55296&&i<=57343&&null!==(s=e())&&s>=56320&&s<=57343?(t(1024*(i-55296)+s-56320+65536),s=null):t(i);null!==s&&t(s)},UTF8toUTF16:function(e,t){var i=null;for("number"==typeof e&&(i=e,e=function(){return null});null!==i||null!==(i=e());)i<=65535?t(i):(t(55296+((i-=65536)>>10)),t(i%1024+56320)),i=null},encodeUTF16toUTF8:function(t,i){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,i)}))},decodeUTF8toUTF16:function(t,i){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,i)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,i=0;null!==(t=e());)i+=t<128?1:t<2048?2:t<65536?3:4;return i},calculateUTF16asUTF8:function(t){var i=0,s=0;return e.UTF16toUTF8(t,(function(e){++i,s+=e<128?1:e<2048?2:e<65536?3:4})),[i,s]}};return e}();return i.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var i;try{_.decodeUTF8toUTF16(function(){return e<t?this.view[e++]:null}.bind(this),i=o())}catch(i){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return i()},t.fromUTF8=function(e,i,s){if(!s&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var n=new t(_.calculateUTF16asUTF8(r(e),!0)[1],i,s),o=0;return _.encodeUTF16toUTF8(r(e),(function(e){n.view[o++]=e})),n.limit=o,n},t}(function(){function e(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function t(e){return!0===(e&&e.__isLong__)}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t;var i={},s={};function n(e,t){var n,r,a;return t?(a=0<=(e>>>=0)&&e<256)&&(r=s[e])?r:(n=o(e,(0|e)<0?-1:0,!0),a&&(s[e]=n),n):(a=-128<=(e|=0)&&e<128)&&(r=i[e])?r:(n=o(e,e<0?-1:0,!1),a&&(i[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?E:g;if(t){if(e<0)return E;if(e>=d)return A}else{if(e<=-u)return p;if(e+1>=u)return R}return e<0?r(-e,t).neg():o(e%_|0,e/_|0,t)}function o(t,i,s){return new e(t,i,s)}e.fromInt=n,e.fromNumber=r,e.fromBits=o;var a=Math.pow;function l(e,t,i){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(i=t,t=!1):t=!!t,(i=i||10)<2||36<i)throw RangeError("radix");var s;if((s=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===s)return l(e.substring(1),t,i).neg();for(var n=r(a(i,8)),o=g,c=0;c<e.length;c+=8){var _=Math.min(8,e.length-c),d=parseInt(e.substring(c,c+_),i);if(_<8){var u=r(a(i,_));o=o.mul(u).add(r(d))}else o=(o=o.mul(n)).add(r(d))}return o.unsigned=t,o}function c(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?l(t):o(t.low,t.high,t.unsigned)}e.fromString=l,e.fromValue=c;var _=4294967296,d=_*_,u=d/2,h=n(1<<24),g=n(0);e.ZERO=g;var E=n(0,!0);e.UZERO=E;var I=n(1);e.ONE=I;var T=n(1,!0);e.UONE=T;var f=n(-1);e.NEG_ONE=f;var R=o(-1,2147483647,!1);e.MAX_VALUE=R;var A=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=A;var p=o(0,-2147483648,!1);e.MIN_VALUE=p;var m=e.prototype;return m.toInt=function(){return this.unsigned?this.low>>>0:this.low},m.toNumber=function(){return this.unsigned?(this.high>>>0)*_+(this.low>>>0):this.high*_+(this.low>>>0)},m.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(p)){var t=r(e),i=this.div(t),s=i.mul(t).sub(this);return i.toString(e)+s.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=r(a(e,6),this.unsigned),o=this,l="";;){var c=o.div(n),_=(o.sub(c.mul(n)).toInt()>>>0).toString(e);if((o=c).isZero())return _+l;for(;_.length<6;)_="0"+_;l=""+_+l}},m.getHighBits=function(){return this.high},m.getHighBitsUnsigned=function(){return this.high>>>0},m.getLowBits=function(){return this.low},m.getLowBitsUnsigned=function(){return this.low>>>0},m.getNumBitsAbs=function(){if(this.isNegative())return this.eq(p)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},m.isZero=function(){return 0===this.high&&0===this.low},m.isNegative=function(){return!this.unsigned&&this.high<0},m.isPositive=function(){return this.unsigned||this.high>=0},m.isOdd=function(){return!(1&~this.low)},m.isEven=function(){return!(1&this.low)},m.equals=function(e){return t(e)||(e=c(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},m.eq=m.equals,m.notEquals=function(e){return!this.eq(e)},m.neq=m.notEquals,m.lessThan=function(e){return this.comp(e)<0},m.lt=m.lessThan,m.lessThanOrEqual=function(e){return this.comp(e)<=0},m.lte=m.lessThanOrEqual,m.greaterThan=function(e){return this.comp(e)>0},m.gt=m.greaterThan,m.greaterThanOrEqual=function(e){return this.comp(e)>=0},m.gte=m.greaterThanOrEqual,m.compare=function(e){if(t(e)||(e=c(e)),this.eq(e))return 0;var i=this.isNegative(),s=e.isNegative();return i&&!s?-1:!i&&s?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},m.comp=m.compare,m.negate=function(){return!this.unsigned&&this.eq(p)?p:this.not().add(I)},m.neg=m.negate,m.add=function(e){t(e)||(e=c(e));var i=this.high>>>16,s=65535&this.high,n=this.low>>>16,r=65535&this.low,a=e.high>>>16,l=65535&e.high,_=e.low>>>16,d=0,u=0,h=0,g=0;return h+=(g+=r+(65535&e.low))>>>16,u+=(h+=n+_)>>>16,d+=(u+=s+l)>>>16,d+=i+a,o((h&=65535)<<16|(g&=65535),(d&=65535)<<16|(u&=65535),this.unsigned)},m.subtract=function(e){return t(e)||(e=c(e)),this.add(e.neg())},m.sub=m.subtract,m.multiply=function(e){if(this.isZero())return g;if(t(e)||(e=c(e)),e.isZero())return g;if(this.eq(p))return e.isOdd()?p:g;if(e.eq(p))return this.isOdd()?p:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(h)&&e.lt(h))return r(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,s=65535&this.high,n=this.low>>>16,a=65535&this.low,l=e.high>>>16,_=65535&e.high,d=e.low>>>16,u=65535&e.low,E=0,I=0,T=0,f=0;return T+=(f+=a*u)>>>16,I+=(T+=n*u)>>>16,T&=65535,I+=(T+=a*d)>>>16,E+=(I+=s*u)>>>16,I&=65535,E+=(I+=n*d)>>>16,I&=65535,E+=(I+=a*_)>>>16,E+=i*u+s*d+n*_+a*l,o((T&=65535)<<16|(f&=65535),(E&=65535)<<16|(I&=65535),this.unsigned)},m.mul=m.multiply,m.divide=function(e){if(t(e)||(e=c(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?E:g;var i,s,n;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return E;if(e.gt(this.shru(1)))return T;n=E}else{if(this.eq(p))return e.eq(I)||e.eq(f)?p:e.eq(p)?I:(i=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?I:f:(s=this.sub(e.mul(i)),n=i.add(s.div(e)));if(e.eq(p))return this.unsigned?E:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=g}for(s=this;s.gte(e);){i=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(i)/Math.LN2),l=o<=48?1:a(2,o-48),_=r(i),d=_.mul(e);d.isNegative()||d.gt(s);)d=(_=r(i-=l,this.unsigned)).mul(e);_.isZero()&&(_=I),n=n.add(_),s=s.sub(d)}return n},m.div=m.divide,m.modulo=function(e){return t(e)||(e=c(e)),this.sub(this.div(e).mul(e))},m.mod=m.modulo,m.not=function(){return o(~this.low,~this.high,this.unsigned)},m.and=function(e){return t(e)||(e=c(e)),o(this.low&e.low,this.high&e.high,this.unsigned)},m.or=function(e){return t(e)||(e=c(e)),o(this.low|e.low,this.high|e.high,this.unsigned)},m.xor=function(e){return t(e)||(e=c(e)),o(this.low^e.low,this.high^e.high,this.unsigned)},m.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):o(0,this.low<<e-32,this.unsigned)},m.shl=m.shiftLeft,m.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):o(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},m.shr=m.shiftRight,m.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var i=this.high;return e<32?o(this.low>>>e|i<<32-e,i>>>e,this.unsigned):o(32===e?i:i>>>e-32,0,this.unsigned)},m.shru=m.shiftRightUnsigned,m.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},m.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},m.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},m.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},m.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e}());return t.ByteBuffer=i,t.Long=i.Long||null,t.VERSION="5.0.3",t.WIRE_TYPES={},t.WIRE_TYPES.VARINT=0,t.WIRE_TYPES.BITS64=1,t.WIRE_TYPES.LDELIM=2,t.WIRE_TYPES.STARTGROUP=3,t.WIRE_TYPES.ENDGROUP=4,t.WIRE_TYPES.BITS32=5,t.PACKABLE_WIRE_TYPES=[t.WIRE_TYPES.VARINT,t.WIRE_TYPES.BITS64,t.WIRE_TYPES.BITS32],t.TYPES={int32:{name:"int32",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:t.WIRE_TYPES.VARINT,defaultValue:t.Long?t.Long.ZERO:void 0},uint64:{name:"uint64",wireType:t.WIRE_TYPES.VARINT,defaultValue:t.Long?t.Long.UZERO:void 0},sint64:{name:"sint64",wireType:t.WIRE_TYPES.VARINT,defaultValue:t.Long?t.Long.ZERO:void 0},bool:{name:"bool",wireType:t.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:t.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:t.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:t.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:t.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:t.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:t.WIRE_TYPES.BITS64,defaultValue:t.Long?t.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:t.WIRE_TYPES.BITS64,defaultValue:t.Long?t.Long.ZERO:void 0},float:{name:"float",wireType:t.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:t.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:t.WIRE_TYPES.STARTGROUP,defaultValue:null}},t.MAP_KEY_TYPES=[t.TYPES.int32,t.TYPES.sint32,t.TYPES.sfixed32,t.TYPES.uint32,t.TYPES.fixed32,t.TYPES.int64,t.TYPES.sint64,t.TYPES.sfixed64,t.TYPES.uint64,t.TYPES.fixed64,t.TYPES.bool,t.TYPES.string,t.TYPES.bytes],t.ID_MIN=1,t.ID_MAX=536870911,t.convertFieldsToCamelCase=!1,t.populateAccessors=!0,t.populateDefaults=!0,t.Util=((e={}).IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e),t.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,FQTYPEREF:/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},t.DotProto=function(e,t){var i={},s=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},n=s.prototype;n._readString=function(){var e='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;e.lastIndex=this.index-1;var i=e.exec(this.source);if(!i)throw Error("unterminated string");return this.index=e.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,i[1]},n.next=function(){if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();var e,i,s;do{for(e=!1;t.WHITESPACE.test(s=this.source.charAt(this.index));)if("\n"===s&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(s=this.source.charAt(this.index)))return"/";do{if("\n"===s&&++this.line,++this.index===this.source.length)return null;i=s,s=this.source.charAt(this.index)}while("*"!==i||"/"!==s);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;var n=this.index;if(t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(n++)))for(;n<this.source.length&&!t.DELIM.test(this.source.charAt(n));)++n;var r=this.source.substring(this.index,this.index=n);return'"'!==r&&"'"!==r||(this._stringOpen=r),r},n.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},n.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},n.omit=function(e){return this.peek()===e&&(this.next(),!0)},n.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},i.Tokenizer=s;var r=function(e){this.tn=new s(e),this.proto3=!1},o=r.prototype;function a(e,i){var s=-1,n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))s=parseInt(e);else if(t.NUMBER_HEX.test(e))s=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(n<0?"-":"")+e);s=parseInt(e.substring(1),8)}if(s=n*s|0,!i&&s<0)throw Error("illegal id value: "+(n<0?"-":"")+e);return s}function l(e){var i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return i*parseInt(e,10);if(t.NUMBER_HEX.test(e))return i*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return i*parseInt(e.substring(1),8);if("inf"===e)return i*(1/0);if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return i*parseFloat(e);throw Error("illegal number value: "+(i<0?"-":"")+e)}function c(e,t,i){void 0===e[t]?e[t]=i:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(i))}return o.parse=function(){var e,i,s={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},n=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!n||null!==s.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),s.package=e;break;case"import":if(!n)throw Error("unexpected 'import'");("public"===(e=this.tn.peek())||(i="weak"===e))&&this.tn.next(),e=this._readString(),this.tn.skip(";"),i||s.imports.push(e);break;case"syntax":if(!n)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(s.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(s,null),n=!1;break;case"enum":this._parseEnum(s),n=!1;break;case"option":this._parseOption(s);break;case"service":this._parseService(s);break;case"extend":this._parseExtend(s);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete s.name,s},r.parse=function(e){return new r(e).parse()},o._readString=function(){var e,t,i="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);i+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return i},o._readValue=function(e){var i=this.tn.peek();if('"'===i||"'"===i)return this._readString();if(this.tn.next(),t.NUMBER.test(i))return l(i);if(t.BOOL.test(i))return"true"===i.toLowerCase();if(e&&t.TYPEREF.test(i))return i;throw Error("illegal value: "+i)},o._parseOption=function(e,i){var s=this.tn.next(),n=!1;if("("===s&&(n=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal option name: "+s);var r=s;n&&(this.tn.skip(")"),r="("+r+")",s=this.tn.peek(),t.FQTYPEREF.test(s)&&(r+=s,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),i||this.tn.skip(";")},o._parseOptionValue=function(e,i){var s=this.tn.peek();if("{"!==s)c(e.options,i,this._readValue(!0));else for(this.tn.skip("{");"}"!==(s=this.tn.next());){if(!t.NAME.test(s))throw Error("illegal option name: "+i+"."+s);this.tn.omit(":")?c(e.options,i+"."+s,this._readValue(!0)):this._parseOptionValue(e,i+"."+s)}},o._parseService=function(e){var i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal service name at line "+this.tn.line+": "+i);var s={name:i,rpc:{},options:{}};for(this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(s);else{if("rpc"!==i)throw Error("illegal service token: "+i);this._parseServiceRPC(s)}this.tn.omit(";"),e.services.push(s)},o._parseServiceRPC=function(e){var i="rpc",s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal rpc service method name: "+s);var n=s,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}};if(this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.request_stream=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal rpc service request type: "+s);if(r.request=s,this.tn.skip(")"),"returns"!==(s=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+s);if(this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(r.response_stream=!0,s=this.tn.next()),r.response=s,this.tn.skip(")"),"{"===(s=this.tn.peek())){for(this.tn.next();"}"!==(s=this.tn.next());){if("option"!==s)throw Error("illegal rpc service token: "+s);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},o._parseMessage=function(e,i){var s=!!i,n=this.tn.next(),r={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(n))throw Error("illegal "+(s?"group":"message")+" name: "+n);for(r.name=n,s&&(this.tn.skip("="),i.id=a(this.tn.next()),r.isGroup=!0),"["===(n=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(n=this.tn.next());)if(t.RULE.test(n))this._parseMessageField(r,n);else if("oneof"===n)this._parseMessageOneOf(r);else if("enum"===n)this._parseEnum(r);else if("message"===n)this._parseMessage(r);else if("option"===n)this._parseOption(r);else if("service"===n)this._parseService(r);else if("extensions"===n)r.hasOwnProperty("extensions")?r.extensions=r.extensions.concat(this._parseExtensionRanges()):r.extensions=this._parseExtensionRanges();else if("reserved"===n)this._parseIgnored();else if("extend"===n)this._parseExtend(r);else{if(!t.TYPEREF.test(n))throw Error("illegal message token: "+n);if(!this.proto3)throw Error("illegal field rule: "+n);this._parseMessageField(r,"optional",n)}return this.tn.omit(";"),e.messages.push(r),r},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,i,s){if(!t.RULE.test(i))throw Error("illegal message field rule: "+i);var n,r={rule:i,type:"",name:"",options:{},id:0};if("map"===i){if(s)throw Error("illegal type: "+s);if(this.tn.skip("<"),n=this.tn.next(),!t.TYPE.test(n)&&!t.TYPEREF.test(n))throw Error("illegal message field type: "+n);if(r.keytype=n,this.tn.skip(","),n=this.tn.next(),!t.TYPE.test(n)&&!t.TYPEREF.test(n))throw Error("illegal message field: "+n);if(r.type=n,this.tn.skip(">"),n=this.tn.next(),!t.NAME.test(n))throw Error("illegal message field name: "+n);r.name=n,this.tn.skip("="),r.id=a(this.tn.next()),"["===(n=this.tn.peek())&&this._parseFieldOptions(r),this.tn.skip(";")}else if("group"===(s=void 0!==s?s:this.tn.next())){var o=this._parseMessage(e,r);if(!/^[A-Z]/.test(o.name))throw Error("illegal group name: "+o.name);r.type=o.name,r.name=o.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(r.type=s,n=this.tn.next(),!t.NAME.test(n))throw Error("illegal message field name: "+n);r.name=n,this.tn.skip("="),r.id=a(this.tn.next()),"["===(n=this.tn.peek())&&this._parseFieldOptions(r),this.tn.skip(";")}return e.fields.push(r),r},o._parseMessageOneOf=function(e){var i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal oneof name: "+i);var s,n=i,r=[];for(this.tn.skip("{");"}"!==(i=this.tn.next());)(s=this._parseMessageField(e,"optional",i)).oneof=n,r.push(s.id);this.tn.omit(";"),e.oneofs[n]=r},o._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},o._parseEnum=function(e){var i={name:"",values:[],options:{}},s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal name: "+s);for(i.name=s,this.tn.skip("{");"}"!==(s=this.tn.next());)if("option"===s)this._parseOption(i);else{if(!t.NAME.test(s))throw Error("illegal name: "+s);this.tn.skip("=");var n={name:s,id:a(this.tn.next(),!0)};"["===(s=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(n)}this.tn.omit(";"),e.enums.push(i)},o._parseExtensionRanges=function(){var t,i,s,n=[];do{for(i=[];;){switch(t=this.tn.next()){case"min":s=e.ID_MIN;break;case"max":s=e.ID_MAX;break;default:s=l(t)}if(i.push(s),2===i.length)break;if("to"!==this.tn.peek()){i.push(s);break}this.tn.next()}n.push(i)}while(this.tn.omit(","));return this.tn.skip(";"),n},o._parseExtend=function(e){var i=this.tn.next();if(!t.TYPEREF.test(i))throw Error("illegal extend reference: "+i);var s={ref:i,fields:[]};for(this.tn.skip("{");"}"!==(i=this.tn.next());)if(t.RULE.test(i))this._parseMessageField(s,i);else{if(!t.TYPEREF.test(i))throw Error("illegal extend token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(s,"optional",i)}return this.tn.omit(";"),e.messages.push(s),s},o.toString=function(){return"Parser at line "+this.tn.line},i.Parser=r,i}(t,t.Lang),t.Reflect=function(e){var t={},s=function(e,t,i){this.builder=e,this.parent=t,this.name=i,this.className},n=s.prototype;n.fqn=function(){for(var e=this.name,t=this;;){if(null==(t=t.parent))break;e=t.name+"."+e}return e},n.toString=function(e){return(e?this.className+" ":"")+this.fqn()},n.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},t.T=s;var r=function(e,t,i,n,r){s.call(this,e,t,i),this.className="Namespace",this.children=[],this.options=n||{},this.syntax=r||"proto2"},o=r.prototype=Object.create(s.prototype);o.getChildren=function(e){if(null==(e=e||null))return this.children.slice();for(var t=[],i=0,s=this.children.length;i<s;++i)this.children[i]instanceof e&&t.push(this.children[i]);return t},o.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof _.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof _.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},o.getChild=function(e){for(var t="number"==typeof e?"id":"name",i=0,s=this.children.length;i<s;++i)if(this.children[i][t]===e)return this.children[i];return null},o.resolve=function(e,i){var s,n="string"==typeof e?e.split("."):e,r=this,o=0;if(""===n[o]){for(;null!==r.parent;)r=r.parent;o++}do{do{if(!(r instanceof t.Namespace)){r=null;break}if(!(s=r.getChild(n[o]))||!(s instanceof t.T)||i&&!(s instanceof t.Namespace)){r=null;break}r=s,o++}while(o<n.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(e,i)}while(null!=r);return r},o.qn=function(e){var i=[],s=e;do{i.unshift(s.name),s=s.parent}while(null!==s);for(var n=1;n<=i.length;n++){var r=i.slice(i.length-n);if(e===this.resolve(r,e instanceof t.Namespace))return r.join(".")}return e.fqn()},o.build=function(){for(var e,t={},i=this.children,s=0,n=i.length;s<n;++s)(e=i[s])instanceof r&&(t[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(t,"$options",{value:this.buildOpt()}),t},o.buildOpt=function(){for(var e={},t=Object.keys(this.options),i=0,s=t.length;i<s;++i){var n=t[i],r=this.options[t[i]];e[n]=r}return e},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},t.Namespace=r;var a=function(t,i,s,n,r){if(this.type=t,this.resolvedType=i,this.isMapKey=s,this.syntax=n,this.name=r,s&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},l=a.prototype;function c(t,i){if(t&&"number"==typeof t.low&&"number"==typeof t.high&&"boolean"==typeof t.unsigned&&t.low==t.low&&t.high==t.high)return new e.Long(t.low,t.high,void 0===i?t.unsigned:i);if("string"==typeof t)return e.Long.fromString(t,i||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,i||!1);throw Error("not convertible to Long")}a.defaultFieldValue=function(t){if("string"==typeof t&&(t=e.TYPES[t]),void 0===t.defaultValue)throw Error("default value for type "+t.name+" is not supported");return t==e.TYPES.bytes?new i(0):t.defaultValue},l.toString=function(){return(this.name||"")+(this.isMapKey?"map":"value")+" element"},l.verifyValue=function(t){var s=this;function n(e,t){throw Error("Illegal value for "+s.toString(!0)+" of type "+s.type.name+": "+e+" ("+t+")")}switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof t||t==t&&t%1!=0)&&n(typeof t,"not an integer"),t>4294967295?0|t:t;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof t||t==t&&t%1!=0)&&n(typeof t,"not an integer"),t<0?t>>>0:t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return c(t,!1)}catch(e){n(typeof t,e.message)}else n(typeof t,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return c(t,!0)}catch(e){n(typeof t,e.message)}else n(typeof t,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof t&&n(typeof t,"not a boolean"),t;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof t&&n(typeof t,"not a number"),t;case e.TYPES.string:return"string"==typeof t||t&&t instanceof String||n(typeof t,"not a string"),""+t;case e.TYPES.bytes:return i.isByteBuffer(t)?t:i.wrap(t,"base64");case e.TYPES.enum:var r=this.resolvedType.getChildren(e.Reflect.Enum.Value);for(a=0;a<r.length;a++){if(r[a].name==t)return r[a].id;if(r[a].id==t)return r[a].id}if("proto3"===this.syntax)return("number"!=typeof t||t==t&&t%1!=0)&&n(typeof t,"not an integer"),(t>4294967295||t<0)&&n(typeof t,"not in range for uint32"),t;n(t,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(t&&"object"==typeof t||n(typeof t,"object expected"),t instanceof this.resolvedType.clazz)return t;if(t instanceof e.Builder.Message){var o={};for(var a in t)t.hasOwnProperty(a)&&(o[a]=t[a]);t=o}return new this.resolvedType.clazz(t)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+t+" (undefined type "+this.type+")")},l.calculateLength=function(t,s){if(null===s)return 0;var n;switch(this.type){case e.TYPES.int32:return s<0?i.calculateVarint64(s):i.calculateVarint32(s);case e.TYPES.uint32:return i.calculateVarint32(s);case e.TYPES.sint32:return i.calculateVarint32(i.zigZagEncode32(s));case e.TYPES.fixed32:case e.TYPES.sfixed32:case e.TYPES.float:return 4;case e.TYPES.int64:case e.TYPES.uint64:return i.calculateVarint64(s);case e.TYPES.sint64:return i.calculateVarint64(i.zigZagEncode64(s));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return i.calculateVarint32(s);case e.TYPES.double:return 8;case e.TYPES.string:return n=i.calculateUTF8Bytes(s),i.calculateVarint32(n)+n;case e.TYPES.bytes:if(s.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+s.remaining()+" bytes remaining");return i.calculateVarint32(s.remaining())+s.remaining();case e.TYPES.message:return n=this.resolvedType.calculate(s),i.calculateVarint32(n)+n;case e.TYPES.group:return(n=this.resolvedType.calculate(s))+i.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+s+" (unknown type)")},l.encodeValue=function(t,s,n){if(null===s)return n;switch(this.type){case e.TYPES.int32:s<0?n.writeVarint64(s):n.writeVarint32(s);break;case e.TYPES.uint32:n.writeVarint32(s);break;case e.TYPES.sint32:n.writeVarint32ZigZag(s);break;case e.TYPES.fixed32:n.writeUint32(s);break;case e.TYPES.sfixed32:n.writeInt32(s);break;case e.TYPES.int64:case e.TYPES.uint64:n.writeVarint64(s);break;case e.TYPES.sint64:n.writeVarint64ZigZag(s);break;case e.TYPES.fixed64:n.writeUint64(s);break;case e.TYPES.sfixed64:n.writeInt64(s);break;case e.TYPES.bool:"string"==typeof s?n.writeVarint32("false"===s.toLowerCase()?0:!!s):n.writeVarint32(s?1:0);break;case e.TYPES.enum:n.writeVarint32(s);break;case e.TYPES.float:n.writeFloat32(s);break;case e.TYPES.double:n.writeFloat64(s);break;case e.TYPES.string:n.writeVString(s);break;case e.TYPES.bytes:if(s.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+s.remaining()+" bytes remaining");var r=s.offset;n.writeVarint32(s.remaining()),n.append(s),s.offset=r;break;case e.TYPES.message:var o=(new i).LE();this.resolvedType.encode(s,o),n.writeVarint32(o.offset),n.append(o.flip());break;case e.TYPES.group:this.resolvedType.encode(s,n),n.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+s+" (unknown type)")}return n},l.decode=function(t,i,s){if(i!=this.type.wireType)throw Error("Unexpected wire type for element");var n,r;switch(this.type){case e.TYPES.int32:return 0|t.readVarint32();case e.TYPES.uint32:return t.readVarint32()>>>0;case e.TYPES.sint32:return 0|t.readVarint32ZigZag();case e.TYPES.fixed32:return t.readUint32()>>>0;case e.TYPES.sfixed32:return 0|t.readInt32();case e.TYPES.int64:return t.readVarint64();case e.TYPES.uint64:return t.readVarint64().toUnsigned();case e.TYPES.sint64:return t.readVarint64ZigZag();case e.TYPES.fixed64:return t.readUint64();case e.TYPES.sfixed64:return t.readInt64();case e.TYPES.bool:return!!t.readVarint32();case e.TYPES.enum:return t.readVarint32();case e.TYPES.float:return t.readFloat();case e.TYPES.double:return t.readDouble();case e.TYPES.string:return t.readVString();case e.TYPES.bytes:if(r=t.readVarint32(),t.remaining()<r)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+r+" required but got only "+t.remaining());return(n=t.clone()).limit=n.offset+r,t.offset+=r,n;case e.TYPES.message:return r=t.readVarint32(),this.resolvedType.decode(t,r);case e.TYPES.group:return this.resolvedType.decode(t,-1,s)}throw Error("[INTERNAL] Illegal decode type")},l.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return i.fromBinary(t)}},l.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},t.Element=a;var _=function(e,t,i,s,n,o){r.call(this,e,t,i,s,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!n,this._fields=null,this._fieldsById=null,this._fieldsByName=null},d=_.prototype=Object.create(r.prototype);function u(t,i){var s=i.readVarint32(),n=7&s,r=s>>>3;switch(n){case e.WIRE_TYPES.VARINT:do{s=i.readUint8()}while(!(128&~s));break;case e.WIRE_TYPES.BITS64:i.offset+=8;break;case e.WIRE_TYPES.LDELIM:s=i.readVarint32(),i.offset+=s;break;case e.WIRE_TYPES.STARTGROUP:u(r,i);break;case e.WIRE_TYPES.ENDGROUP:if(r===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+r+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:i.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+n)}return!0}d.build=function(t){if(this.clazz&&!t)return this.clazz;var s=function(e,t){var s=t.getChildren(e.Reflect.Message.Field),n=t.getChildren(e.Reflect.Message.OneOf),r=function(o,a){e.Builder.Message.call(this);for(var l=0,c=n.length;l<c;++l)this[n[l].name]=null;for(l=0,c=s.length;l<c;++l){var _=s[l];this[_.name]=_.repeated?[]:_.map?new e.Map(_):null,!_.required&&"proto3"!==t.syntax||null===_.defaultValue||(this[_.name]=_.defaultValue)}var d;if(arguments.length>0)if(1!==arguments.length||null===o||"object"!=typeof o||!("function"!=typeof o.encode||o instanceof r)||Array.isArray(o)||o instanceof e.Map||i.isByteBuffer(o)||o instanceof ArrayBuffer||e.Long&&o instanceof e.Long)for(l=0,c=arguments.length;l<c;++l)void 0!==(d=arguments[l])&&this.$set(s[l].name,d);else this.$set(o)},o=r.prototype=Object.create(e.Builder.Message.prototype);o.add=function(i,s,n){var r=t._fieldsByName[i];if(!n){if(!r)throw Error(this+"#"+i+" is undefined");if(!(r instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: "+r.toString(!0));if(!r.repeated)throw Error(this+"#"+i+" is not a repeated field");s=r.verifyValue(s,!0)}return null===this[i]&&(this[i]=[]),this[i].push(s),this},o.$add=o.add,o.set=function(i,s,n){if(i&&"object"==typeof i){for(var r in n=s,i)i.hasOwnProperty(r)&&void 0!==(s=i[r])&&void 0===t._oneofsByName[r]&&this.$set(r,s,n);return this}var o=t._fieldsByName[i];if(n)this[i]=s;else{if(!o)throw Error(this+"#"+i+" is not a field: undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: "+o.toString(!0));this[o.name]=s=o.verifyValue(s)}if(o&&o.oneof){var a=this[o.oneof.name];null!==s?(null!==a&&a!==o.name&&(this[a]=null),this[o.oneof.name]=o.name):a===i&&(this[o.oneof.name]=null)}return this},o.$set=o.set,o.get=function(i,s){if(s)return this[i];var n=t._fieldsByName[i];if(!(n&&n instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: undefined");if(!(n instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: "+n.toString(!0));return this[n.name]},o.$get=o.get;for(var a=0;a<s.length;a++){var l=s[a];l instanceof e.Reflect.Message.ExtensionField||t.builder.options.populateAccessors&&function(e){var i=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));i=i.substring(0,1).toUpperCase()+i.substring(1);var s=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),n=function(t,i){return this[e.name]=i?t:e.verifyValue(t),this},r=function(){return this[e.name]};null===t.getChild("set"+i)&&(o["set"+i]=n),null===t.getChild("set_"+s)&&(o["set_"+s]=n),null===t.getChild("get"+i)&&(o["get"+i]=r),null===t.getChild("get_"+s)&&(o["get_"+s]=r)}(l)}function c(t,s,n,r){if(null===t||"object"!=typeof t){if(r&&r instanceof e.Reflect.Enum){var o=e.Reflect.Enum.getName(r.object,t);if(null!==o)return o}return t}if(i.isByteBuffer(t))return s?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return n?t.toString():e.Long.fromValue(t);var a;if(Array.isArray(t))return a=[],t.forEach((function(e,t){a[t]=c(e,s,n,r)})),a;if(a={},t instanceof e.Map){for(var l=t.entries(),_=l.next();!_.done;_=l.next())a[t.keyElem.valueToString(_.value[0])]=c(_.value[1],s,n,t.valueElem.resolvedType);return a}var d=t.$type,u=void 0;for(var h in t)t.hasOwnProperty(h)&&(d&&(u=d.getChild(h))?a[h]=c(t[h],s,n,u.resolvedType):a[h]=c(t[h],s,n));return a}return o.encode=function(e,s){"boolean"==typeof e&&(s=e,e=void 0);var n=!1;e||(e=new i,n=!0);var r=e.littleEndian;try{return t.encode(this,e.LE(),s),(n?e.flip():e).LE(r)}catch(t){throw e.LE(r),t}},r.encode=function(e,t,i){return new r(e).encode(t,i)},o.calculate=function(){return t.calculate(this)},o.encodeDelimited=function(e,s){var n=!1;e||(e=new i,n=!0);var r=(new i).LE();return t.encode(this,r,s).flip(),e.writeVarint32(r.remaining()),e.append(r),n?e.flip():e},o.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},o.toArrayBuffer=o.encodeAB,o.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},o.toBuffer=o.encodeNB,o.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},o.toBase64=o.encode64,o.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},o.toHex=o.encodeHex,o.toRaw=function(e,t){return c(this,!!e,!!t,this.$type)},o.encodeJSON=function(){return JSON.stringify(c(this,!0,!0,this.$type))},r.decode=function(e,s,n){"string"==typeof s&&(n=s,s=-1),"string"==typeof e?e=i.wrap(e,n||"base64"):i.isByteBuffer(e)||(e=i.wrap(e));var r=e.littleEndian;try{var o=t.decode(e.LE(),s);return e.LE(r),o}catch(t){throw e.LE(r),t}},r.decodeDelimited=function(e,s){if("string"==typeof e?e=i.wrap(e,s||"base64"):i.isByteBuffer(e)||(e=i.wrap(e)),e.remaining()<1)return null;var n=e.offset,r=e.readVarint32();if(e.remaining()<r)return e.offset=n,null;try{var o=t.decode(e.slice(e.offset,e.offset+r).LE());return e.offset+=r,o}catch(t){throw e.offset+=r,t}},r.decode64=function(e){return r.decode(e,"base64")},r.decodeHex=function(e){return r.decode(e,"hex")},r.decodeJSON=function(e){return new r(JSON.parse(e))},o.toString=function(){return t.toString()},Object.defineProperty&&(Object.defineProperty(r,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),r}(e,this);this._fields=[],this._fieldsById={},this._fieldsByName={},this._oneofsByName={};for(var n,r=0,o=this.children.length;r<o;r++)if((n=this.children[r])instanceof I||n instanceof _||n instanceof R){if(s.hasOwnProperty(n.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+n.toString(!0)+" cannot override static property '"+n.name+"'");s[n.name]=n.build()}else if(n instanceof _.Field)n.build(),this._fields.push(n),this._fieldsById[n.id]=n,this._fieldsByName[n.name]=n;else if(n instanceof _.OneOf)this._oneofsByName[n.name]=n;else if(!(n instanceof _.OneOf||n instanceof f))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[r].toString(!0));return this.clazz=s},d.encode=function(e,t,i){for(var s,n,r=null,o=0,a=this._fields.length;o<a;++o)n=e[(s=this._fields[o]).name],s.required&&null===n?null===r&&(r=s):s.encode(i?n:s.verifyValue(n),t,e);if(null!==r){var l=Error("Missing at least one required field for "+this.toString(!0)+": "+r);throw l.encoded=t,l}return t},d.calculate=function(e){for(var t,i,s=0,n=0,r=this._fields.length;n<r;++n){if(i=e[(t=this._fields[n]).name],t.required&&null===i)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);s+=t.calculate(i,e)}return s},d.decode=function(t,i,s){"number"!=typeof i&&(i=-1);for(var n,r,o,a,l=t.offset,c=new this.clazz;t.offset<l+i||-1===i&&t.remaining()>0;){if(o=(n=t.readVarint32())>>>3,(r=7&n)===e.WIRE_TYPES.ENDGROUP){if(o!==s)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+o+" ("+(s?s+" expected":"not a group")+")");break}if(a=this._fieldsById[o]){if(a.repeated&&!a.options.packed)c[a.name].push(a.decode(r,t));else if(a.map){var _=a.decode(r,t);c[a.name].set(_[0],_[1])}else if(c[a.name]=a.decode(r,t),a.oneof){var d=c[a.oneof.name];null!==d&&d!==a.name&&(c[d]=null),c[a.oneof.name]=a.name}}else switch(r){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM:var h=t.readVarint32();t.offset+=h;break;case e.WIRE_TYPES.STARTGROUP:for(;u(o,t););break;default:throw Error("Illegal wire type for unknown field "+o+" in "+this.toString(!0)+"#decode: "+r)}}for(var g=0,E=this._fields.length;g<E;++g)if(null===c[(a=this._fields[g]).name])if("proto3"===this.syntax)c[a.name]=a.defaultValue;else{if(a.required){var I=Error("Missing at least one required field for "+this.toString(!0)+": "+a.name);throw I.decoded=c,I}e.populateDefaults&&null!==a.defaultValue&&(c[a.name]=a.defaultValue)}return c},t.Message=_;var h=function(t,i,n,r,o,a,l,c,d,u){s.call(this,t,i,a),this.className="Message.Field",this.required="required"===n,this.repeated="repeated"===n,this.map="map"===n,this.keyType=r||null,this.type=o,this.resolvedType=null,this.id=l,this.options=c||{},this.defaultValue=null,this.oneof=d||null,this.syntax=u||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof _.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},g=h.prototype=Object.create(s.prototype);g.build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax,this.name),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax,this.name)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},g.verifyValue=function(t,i){i=i||!1;var s,n=this;function r(e,t){throw Error("Illegal value for "+n.toString(!0)+" of type "+n.type.name+": "+e+" ("+t+")")}if(null===t)return this.required&&r(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&r(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!i){Array.isArray(t)||(t=[t]);var o=[];for(s=0;s<t.length;s++)o.push(this.element.verifyValue(t[s]));return o}return this.map&&!i?t instanceof e.Map?t:(t instanceof Object||r(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&r(typeof t,"no array expected"),this.element.verifyValue(t))},g.hasWirePresence=function(t,i){if("proto3"!==this.syntax)return null!==t;if(this.oneof&&i[this.oneof.name]===this.name)return!0;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return 0!==t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return 0!==t.low||0!==t.high;case e.TYPES.bool:return t;case e.TYPES.float:case e.TYPES.double:return 0!==t;case e.TYPES.string:return t.length>0;case e.TYPES.bytes:return t.remaining()>0;case e.TYPES.enum:return 0!==t;case e.TYPES.message:return null!==t;default:return!0}},g.encode=function(t,s,n){if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return s;try{var r;if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){s.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s.ensureCapacity(s.offset+=1);var o=s.offset;for(r=0;r<t.length;r++)this.element.encodeValue(this.id,t[r],s);var a=s.offset-o,l=i.calculateVarint32(a);if(l>1){var c=s.slice(o,s.offset);o+=l-1,s.offset=o,s.append(c)}s.writeVarint32(a,o-l)}else for(r=0;r<t.length;r++)s.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[r],s);else this.map?t.forEach((function(t,n,r){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);s.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s.writeVarint32(o),s.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,n,s),s.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,s)}),this):this.hasWirePresence(t,n)&&(s.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,s))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return s},g.calculate=function(t,s){if(t=this.verifyValue(t),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;var n=0;try{var r,o;if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),o=0,r=0;r<t.length;r++)o+=this.element.calculateLength(this.id,t[r]);n+=i.calculateVarint32(o),n+=o}else for(r=0;r<t.length;r++)n+=i.calculateVarint32(this.id<<3|this.type.wireType),n+=this.element.calculateLength(this.id,t[r]);else this.map?t.forEach((function(t,s,r){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,s)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n+=i.calculateVarint32(o),n+=o}),this):this.hasWirePresence(t,s)&&(n+=i.calculateVarint32(this.id<<3|this.type.wireType),n+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},g.decode=function(t,i,s){var n,r;if(!(!this.map&&t==this.type.wireType||!s&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!s){r=i.readVarint32(),r=i.offset+r;for(var o=[];i.offset<r;)o.push(this.decode(this.type.wireType,i,!0));return o}if(this.map){var l=a.defaultFieldValue(this.keyType);if(n=a.defaultFieldValue(this.type),r=i.readVarint32(),i.remaining()<r)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+r+" required but got only "+i.remaining());var c=i.clone();for(c.limit=c.offset+r,i.offset+=r;c.remaining()>0;){var _=c.readVarint32();t=7&_;var d=_>>>3;if(1===d)l=this.keyElement.decode(c,t,d);else{if(2!==d)throw Error("Unexpected tag in map field key/value submessage");n=this.element.decode(c,t,d)}}return[l,n]}return this.element.decode(i,t,this.id)},t.Message.Field=h;var E=function(e,t,i,s,n,r,o){h.call(this,e,t,i,null,s,n,r,o),this.extension};E.prototype=Object.create(h.prototype),t.Message.ExtensionField=E;t.Message.OneOf=function(e,t,i){s.call(this,e,t,i),this.fields=[]};var I=function(e,t,i,s,n){r.call(this,e,t,i,s,n),this.className="Enum",this.object=null};I.getName=function(e,t){for(var i,s=Object.keys(e),n=0;n<s.length;++n)if(e[i=s[n]]===t)return i;return null},(I.prototype=Object.create(r.prototype)).build=function(t){if(this.object&&!t)return this.object;for(var i=new e.Builder.Enum,s=this.getChildren(I.Value),n=0,r=s.length;n<r;++n)i[s[n].name]=s[n].id;return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=i},t.Enum=I;var T=function(e,t,i,n){s.call(this,e,t,i),this.className="Enum.Value",this.id=n};T.prototype=Object.create(s.prototype),t.Enum.Value=T;var f=function(e,t,i,n){s.call(this,e,t,i),this.field=n};f.prototype=Object.create(s.prototype),t.Extension=f;var R=function(e,t,i,s){r.call(this,e,t,i,s),this.className="Service",this.clazz=null};(R.prototype=Object.create(r.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){for(var s=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,i){setTimeout(i.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},n=s.prototype=Object.create(e.Builder.Service.prototype),r=t.getChildren(e.Reflect.Service.RPCMethod),o=0;o<r.length;o++)!function(e){n[e.name]=function(s,n){try{try{s=e.resolvedRequestType.clazz.decode(i.wrap(s))}catch(e){if(!(e instanceof TypeError))throw e}if(null===s||"object"!=typeof s)throw Error("Illegal arguments");s instanceof e.resolvedRequestType.clazz||(s=new e.resolvedRequestType.clazz(s)),this.rpcImpl(e.fqn(),s,(function(i,s){if(i)n(i);else{null===s&&(s="");try{s=e.resolvedResponseType.clazz.decode(s)}catch(e){}s&&s instanceof e.resolvedResponseType.clazz?n(null,s):n(Error("Illegal response type received in service method "+t.name+"#"+e.name))}}))}catch(e){setTimeout(n.bind(this,e),0)}},s[e.name]=function(t,i,n){new s(t)[e.name](i,n)},Object.defineProperty&&(Object.defineProperty(s[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(n[e.name],"$options",{value:s[e.name].$options}))}(r[o]);return Object.defineProperty&&(Object.defineProperty(s,"$options",{value:t.buildOpt()}),Object.defineProperty(n,"$options",{value:s.$options}),Object.defineProperty(s,"$type",{value:t}),Object.defineProperty(n,"$type",{value:t})),s}(e,this)},t.Service=R;var A=function(e,t,i,n){s.call(this,e,t,i),this.className="Service.Method",this.options=n||{}};(A.prototype=Object.create(s.prototype)).buildOpt=o.buildOpt,t.Service.Method=A;var p=function(e,t,i,s,n,r,o,a){A.call(this,e,t,i,a),this.className="Service.RPCMethod",this.requestName=s,this.responseName=n,this.requestStream=r,this.responseStream=o,this.resolvedRequestType=null,this.resolvedResponseType=null};return p.prototype=Object.create(A.prototype),t.Service.RPCMethod=p,t}(t),t.Builder=function(e,t,i){var s=function(e){this.ns=new i.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},n=s.prototype;function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}return s.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},s.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},s.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},s.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},s.isExtend=function(e){return"string"==typeof e.ref},n.reset=function(){return this.ptr=this.ns,this},n.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new i.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},n.create=function(t){if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(var n=[t];n.length>0;){if(t=n.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){var r=t.shift();if(s.isMessage(r)){var o=new i.Message(this,this.ptr,r.name,r.options,r.isGroup,r.syntax),a={};r.oneofs&&Object.keys(r.oneofs).forEach((function(e){o.addChild(a[e]=new i.Message.OneOf(this,o,e))}),this),r.fields&&r.fields.forEach((function(e){if(null!==o.getChild(0|e.id))throw Error("duplicate or invalid field id in "+o.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+o.name+"#"+e.name+": "+e.oneof);e=new i.Message.Field(this,o,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,r.syntax),t&&t.fields.push(e),o.addChild(e)}),this);var l=[];if(r.enums&&r.enums.forEach((function(e){l.push(e)})),r.messages&&r.messages.forEach((function(e){l.push(e)})),r.services&&r.services.forEach((function(e){l.push(e)})),r.extensions&&("number"==typeof r.extensions[0]?o.extensions=[r.extensions]:o.extensions=r.extensions),this.ptr.addChild(o),l.length>0){n.push(t),t=l,l=null,this.ptr=o,o=null;continue}l=null}else if(s.isEnum(r))o=new i.Enum(this,this.ptr,r.name,r.options,r.syntax),r.values.forEach((function(e){o.addChild(new i.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(s.isService(r))o=new i.Service(this,this.ptr,r.name,r.options),Object.keys(r.rpc).forEach((function(e){var t=r.rpc[e];o.addChild(new i.Service.RPCMethod(this,o,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(o);else{if(!s.isExtend(r))throw Error("not a valid definition: "+JSON.stringify(r));if(o=this.ptr.resolve(r.ref,!0))r.fields.forEach((function(t){if(null!==o.getChild(0|t.id))throw Error("duplicate extended field id in "+o.name+": "+t.id);if(o.extensions){var s=!1;if(o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(s=!0)})),!s)throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)")}var n=t.name;this.options.convertFieldsToCamelCase&&(n=e.Util.toCamelCase(n));var r=new i.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+n,t.id,t.options),a=new i.Extension(this,this.ptr,t.name,r);r.extension=a,this.ptr.addChild(a),o.addChild(r)}),this);else if(!/\.?google\.protobuf\./.test(r.ref))throw Error("extended message "+r.ref+" is not defined")}r=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},n.import=function(t,i){var s="/";if("string"==typeof i){if(e.Util.IS_NODE&&(i=require("path").resolve(i)),!0===this.files[i])return this.reset();this.files[i]=!0}else if("object"==typeof i){var n,o=i.root;if(e.Util.IS_NODE&&(o=require("path").resolve(o)),(o.indexOf("\\")>=0||i.file.indexOf("\\")>=0)&&(s="\\"),n=e.Util.IS_NODE?require("path").join(o,i.file):o+s+i.file,!0===this.files[n])return this.reset();this.files[n]=!0}if(t.imports&&t.imports.length>0){var a,l=!1;"object"==typeof i?(this.importRoot=i.root,l=!0,a=this.importRoot,i=i.file,(a.indexOf("\\")>=0||i.indexOf("\\")>=0)&&(s="\\")):"string"==typeof i?this.importRoot?a=this.importRoot:i.indexOf("/")>=0?""===(a=i.replace(/\/[^\/]*$/,""))&&(a="/"):i.indexOf("\\")>=0?(a=i.replace(/\\[^\\]*$/,""),s="\\"):a=".":a=null;for(var c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!a)throw Error("cannot determine import root");var _=t.imports[c];if("google/protobuf/descriptor.proto"===_)continue;if(_=e.Util.IS_NODE?require("path").join(a,_):a+s+_,!0===this.files[_])continue;/\.proto$/i.test(_)&&!e.DotProto&&(_=_.replace(/\.proto$/,".json"));var d=e.Util.fetch(_);if(null===d)throw Error("failed to import '"+_+"' in '"+i+"': file not found");/\.json$/i.test(_)?this.import(JSON.parse(d+""),_):this.import(e.DotProto.Parser.parse(d),_)}else i?/\.(\w+)$/.test(i)?this.import(t.imports[c],i.replace(/^(.+)\.(\w+)$/,(function(e,t,i){return t+"_import"+c+"."+i}))):this.import(t.imports[c],i+"_import"+c):this.import(t.imports[c]);l&&(this.importRoot=null)}t.package&&this.define(t.package),t.syntax&&r(t);var u=this.ptr;return t.options&&Object.keys(t.options).forEach((function(e){u.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=u),t.enums&&(this.create(t.enums),this.ptr=u),t.services&&(this.create(t.services),this.ptr=u),t.extends&&this.create(t.extends),this.reset()},n.resolveAll=function(){var s;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof i.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof i.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(s=(this.ptr instanceof i.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=s,s instanceof i.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==s.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(s instanceof i.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=s.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}"proto3"===this.ptr.syntax&&this.ptr.repeated&&void 0===this.ptr.options.packed&&-1!==e.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType)&&(this.ptr.options.packed=!0)}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((s=this.ptr.parent.resolve(this.ptr.requestName,!0))&&s instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=s,!((s=this.ptr.parent.resolve(this.ptr.responseName,!0))&&s instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=s}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},n.build=function(e){if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(var t="string"==typeof e?e.split("."):e,i=this.result,s=0;s<t.length;s++){if(!i[t[s]]){i=null;break}i=i[t[s]]}return i},n.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},n.toString=function(){return"Builder"},s.Message=function(){},s.Enum=function(){},s.Service=function(){},s}(t,t.Lang,t.Reflect),t.Map=function(e,t){var i=function(e,i){if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),i)for(var s=Object.keys(i),n=0;n<s.length;n++){var r=this.keyElem.valueFromString(s[n]),o=this.valueElem.verifyValue(i[s[n]]);this.map[this.keyElem.valueToString(r)]={key:r,value:o}}},s=i.prototype;function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}return s.clear=function(){this.map={}},s.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),i=t in this.map;return delete this.map[t],i},s.entries=function(){for(var e,t=[],i=Object.keys(this.map),s=0;s<i.length;s++)t.push([(e=this.map[i[s]]).key,e.value]);return n(t)},s.keys=function(){for(var e=[],t=Object.keys(this.map),i=0;i<t.length;i++)e.push(this.map[t[i]].key);return n(e)},s.values=function(){for(var e=[],t=Object.keys(this.map),i=0;i<t.length;i++)e.push(this.map[t[i]].value);return n(e)},s.forEach=function(e,t){for(var i,s=Object.keys(this.map),n=0;n<s.length;n++)e.call(t,(i=this.map[s[n]]).value,i.key,this)},s.set=function(e,t){var i=this.keyElem.verifyValue(e),s=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(i)]={key:i,value:s},this},s.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));if(t in this.map)return this.map[t].value},s.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},i}(0,t.Reflect),t.loadProto=function(e,i,s){return("string"==typeof i||i&&"string"==typeof i.file&&"string"==typeof i.root)&&(s=i,i=void 0),t.loadJson(t.DotProto.Parser.parse(e),i,s)},t.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=t.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=t.populateAccessors),new t.Builder(e)},t.loadJson=function(e,i,s){return("string"==typeof i||i&&"string"==typeof i.file&&"string"==typeof i.root)&&(s=i,i=null),i&&"object"==typeof i||(i=t.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),i.import(e,s),i.resolveAll(),i},t}(),To="NotifyMsg",fo="SyncRequestMsg",Ro="UpStreamMessage",Ao="DownStreamMessages",po="ChrmDownStreamMessages",mo="DownStreamMessage",So="ExtMsgData",vo="GetQNupTokenInput",No="GetDownloadUrlInput",Oo="GetQNupTokenOutput",yo="GetDownloadUrlOutput",Co="ChrmInput",Mo="ChrmOutput",bo="ChrmPullMsg",Lo="RelationQryInput",Uo="RelationQryFilter",Po="RelationsOutput",Do="QryRemindListReq",wo="QryRemindListResp",Go="CleanHisMsgInput",Vo="CleanMsgBatchReq",ko="QueryChatRoomInfoInput",xo="QueryChatRoomInfoOutput",Fo="HistoryMsgInput",Bo="HistoryMsgOuput",Ho="SessionsAttQryInput",jo="SessionsAttOutput",Yo="SessionMsgReadInput",Wo="DeleteSessionsInput",qo="QuerySessionsInput",Jo="QuerySessionsOutPut",Ko="RelationDelBatchReq",Qo="DeleteMsgInput",Xo="SetChrmKV",zo="SetChrmKVS",Zo="ChrmKVOutput",$o="ChrmKVSOutput",ea="QueryChrmKV",ta="SetUserSettingInput",ia="SetUserSettingOutput",sa="PullUserSettingInput",na="PullUserSettingOutput",ra="SessionReq",oa="SessionStates",aa="SessionStateModifyReq",la="GroupUnpushQuery",ca="GroupUnpushSet",_a="GroupUnpushResult",da="SessionStateModifyResp",ua="TypeUnpushInput",ha="TypeUnpushOutput",ga="GrpReadReceiptMsg",Ea="ReadReceipt",Ia="QueryReceiptReq",Ta="QueryReceiptBatchReq",fa="ReceiptResp",Ra="QueryReceiptBatchResp",Aa="GrpReadReceiptQryResp",pa="SessionTagAddInput",ma="SessionTagDelInput",Sa="UserSettingNotification",va="ReportSDKInput",Na="UltraGrpPullSes",Oa="UltraGrpPullMsg",ya="MsgChangeReq",Ca="ModifyMsgResp",Ma="QueryMsgChange",ba="EventChangeList",La="MsgChangeList",Ua="MsgQuery",Pa="MsgQueryAck",Da="OperateStatus",wa="OperateStatusNotify",Ga="SetRtcRoomIdInput",Va="CallInfoUpStream",ka="CallInfoDownStream",xa="KvInput",Fa="KvOutput",Ba="ReadReceiptMsg",Ha="ReceiptQryReq",ja="QueryReceiptResp",Ya="ReceiptCntQryReq",Wa="ReceiptCntQryResp",qa="UpdateUserSubReq",Ja="UpdateUserSubResp",Ka="PullUserSubReq",Qa="PUllUserSubResp",Xa="PullSubDataReq",za="PullSubDataResp",Za="SubDataDetail",$a="QrySubDataReq",el="UserProfile",tl="SetUserProfileResp",il="PullUserProfileReq",sl="UserProfiles",nl="UserProfileInput",rl="UserProfilePermission",ol="SearchUserProfile",al="ChannelsInput",ll="ChannelsOutput",cl="MultiChannels",_l="ModifyChannelsInput",dl="ChannelsQueryInput",ul="ChannelsListResult",hl="ChannelsInviteStatusInfos",gl="ChannelsUserInfos",El="ChannelsJoinedInfos",Il="ChannelsMemberUpdateInput",Tl="ChannelsMemberResponseInput",fl="ChannelsMembersInput",Rl="FriendInput",Al="FriendsInput",pl="FriendsCheckOutput",ml="FriendProfileInput",Sl="FriendProfileOutput",vl="FriendQueryInput",Nl="FriendsListInput",Ol="FriendLevelSet",yl="FriendUserInfos",Cl="FriendInviteInfos",Ml="ChannelApplyInfo",bl="AddUnpushPeriodInput",Ll="DeleteUnpushPeriodInput",Ul="QueryUnpushPeriodInput",Pl="QueryUnpushPeriodOutput",Dl="MsgReadEvent",wl="ConvertMsgInput",Gl="SpeechToTextInfo",Vl="ConvertMsgOutput",kl="SpeechToTextResult",xl="TransReq",Fl="TransResp",Bl="PullModifyMsgReq",Hl="PullModifyMsgResp",jl="SessionQryInput",Yl="SessionsOutput",Wl="SetUserStatusInput",ql="MCFollowInput",Jl="RtcQueryListInput",Kl="RtcKeyDeleteInput",Ql="RtcValueInfo",Xl="RtcUserListOutput",zl="RtcInput",Zl="RtcQryOutput",$l="RtcDataInput",ec="RtcSetDataInput",tc="RtcUserSetDataInput",ic="RtcOutput",sc="RtcTokenOutput",nc="RtcQueryUserJoinedInput",rc="RtcQueryUserJoinedOutput",oc="RtcViewerJoinedOutput",ac="RtcInviteInput",lc="RtcCancelInviteInput",cc="RtcInviteAnswerInput",_c="RtcEndInviteInput",dc="BotInput",uc="BotOutput",hc="ReactionInput",gc="ReactionAck",Ec="ReactionBatchQry",Ic="ReactionsOutput",Tc="ReactionQry",fc="ReactionOutput",Rc="ReactionUserOutput",Ac="ReactionEvent",pc=(e=>{let t=0,i="";e:do{const s=e.charCodeAt(t++),n=s&ws,r=15&s;let o;switch(n){case Us:const s=r>>2,a=3&r;if(0===s||0===a)throw new Error("Data parsing error,at "+t);let l=Bs(e.substr(t,s));const c=Bs(e.substr(t+=s,a));if(l=i.length-l,l+c>i.length)throw new Error("Data parsing error,at "+t);t+=a,i+=i.substr(l,c);break;case Ls:if(o=Bs(e.substr(t,r)),o!==i.length)throw console.log(i.length),console.log(o),new Error("Data parsing error,at "+t);t+=r;break e;case Ps:o=Bs(e.substr(t,r)),i+=e.substr(t+=r,o),t+=o;break;case Ds:i+=e.substr(t,r),t+=r;break;case ws:if(r>10)throw new Error("Data parsing error,at "+t);i+=e.substr(t,16+r),t+=16+r;break;default:throw new Error("Data parsing error,at "+t+" header:"+n)}}while(t<e.length);return i})("upackage Modules;\nmessEH4kprobuf {\n EJ8sSetUserStatusOutputEW5QV optional int32 nothing=1;\n }I41BaGI41CbInJ3111I72Mistring stEZ4I416EUJbubIA14dId=2Ib1GaSER6Ie2IhrepeatedI618guserid If2II41DIm4rkVoipDynamicI62Egquired I116n engineType = Im37Ea9Ig27jchannelNamEb4Iq35IN4IEb7iExtra = 3IK2RIM3DIl1GadEa6cKeyIQ3IjNotifyMsg IJ3LatIC3DIn4Ce64 tiI43UermId=Iw25Ik5HgdestroyIj44b=4Is6HjyncRequestIT2Mh64 syncTI426Ij5Gkbool ispollIC24Ib2IEX7cwebIY2HER7iPullSend=IW25EWIdKeepIp84a5IW4LgsendBoxID34Id24b=6EcLibroadcastEe9a7EeLcendIl37a8IH2KucompressioEnabled = 9IS5GiUpStreamMEG7Iw7LbseI814cnIdIDBRglassnamI78BEZHfontentI6B8Ie8IkpushText = Ie5GEY7fappDatIBC4Ig57I4GGbtoI9H6ds = Id5MfdelMsgI257IY5GIlC8Ea5Ir35Ia5GIP46iconfigFlaIN94IU55Ig1HlclientUniqueI356a0Il1MfextraCIa49a1IiDGdPushI9G6Ie44cExtEb4IqDNdbusCIxG6Eb4In5NhsystemIdEZ4Ii4GEZ8lenderPortraiIp14a2I8GMEF6cBitIw54a2IP2GfExtMsgIz65cextEB8c= 2IT2NemetadEZ7IH8GiReferenceI615crefIE18IP85IeBCEgEIXQMamIi77IYQNdfromIQ96IhJRI9CBIiMHI27AI42MetitleIeLMIQP4otemplateIdNoUseI82PIX84Ie25IhDRfConfigIi64IkDNIl1AInD8IG3CdDownI4HDbs IQUFEYHe listICHJIDNHIgMLffinishIJJ5IJPJI8LKIX3JIj18I1C4EZ7IzMMmcredibleStartEg7IQHMEg8bEnIXM8IVHGIXMPICNHeytes Eg8bedIXB7IANHdChrmIC6YIG16I06zIv2KIuSHIv2MIXVHIV8II1ZMI0EDIx2GIhJ7Iqb5IjY7IRCNegroupISCCIFRSIt87IFRQIAQ9I95DIuI4Ii8EIg5GIEg5IZ8JIcV7Ird7IO8GInIFIwPJIQb4direcEI4IrPKEZ6lplantform =1IqHMgisRemovId75IkPOfsourceIgPKI9SOIpHNI9SGIMEGI3JEEc8IIEJIbUGa1If5GILTLIm5NILTEIoVMcextIdn6I4A4Is57IcYSIGTKc32 IeA5bUnIO24IHTKIrTKIlNNgconvertIW36IETHISUPIy5NISUCIv5GISUPI065I1GCIu1BIHsIIyi5aqIOULISjAIlICIS14eenum IJGCIQ16fPERSONIC1AEG6aSIiGAeGROUPIQGAdTEMPEJ8Ip47oCUSTOMERSERVICEI2GAfNOTIFYIlFAbMCI2l8cMP=IK97eULTRAIJ18INE6ICNDkreateDiscusIuj5MR01KI667IaI7IItHI61GITuTIqy4I51JI256gInvitatIC2FIzzKI4A4I81HeLeaveID19IwyPIxz7IC2RcEviIKJ5I71LIA2BI51KbReIm44IA2SIP5WEx8bfoIB3zI314IN6MIFRJMA31UINgCMj31UIsRNeadminIZT9IuR9Ic7EhfirstTenI1JAI2SJg32 openIAK9IJC5I64NMN91FI71Depage IKiOdnumbIi75MuA1HIW1CId5FIJ37IA6IIg47I9B9ME61Ieotal Im1JbMeIC24ID14IPARIBzSEW4MLA1EEYKIFsBIE7NeextenIwF4ItbKaGISP4Il26Jy5L1IW1CIy5MIk4BbmeEe5Iq5oM7K17IHEwI31BIeKTJ07O1IE2FbSeMr717II3vI419IJ3MMW91NI2T9dFileIzSBdIMAGIkR4Iw37eAUDIOId3AdVIDEEF4IGA7cFILEi4I7H7eSIGHTIhGAlCOMBINE_HTMLIUGKlGetQNupTokenI54LIU29MVK1NIl57ckeyIFmQjhttpMethodIkyQhqueryStrIj56IvgNburIXA4InaNMQD16IuuMcsizIjuKI4k7bpTIY36I5X5Ic4HkdownloadUrlIg4iIRAGIg4Te fileI5PCIA2FIEt4J82Y1I72GIi5OMr11NIi56Ml11JIi5CIKATILDPMZJ15eadlinIY3RetokenIa3QcbosId15Ia3QfbosDatMV51KIaq8batIxm4c5;\nEVLfosskeyIxF5M1I1NhossPolicIH64MjM1NfossSigIg24IwqNiossBucketIt67c9;\nIBvMi3CredentiIlN5MmM1Oms3Algorithm =MlM1IEc9IY47IxwPa3IV39MfM1Pa3IV34eatureIxwRbs3Ia3DIxw4MHk1NicAuthorizIQj5M3O1SbtcIex7fSha256IAxKEhAIl38IB6NcstcIb2EIC6OeminioId2GILx8EjLIf2GIUxHEjCIh27ITxHEaCIj2DIZx4MpW1MIzH7Im24IMX5IgxJIGAAM1M16MpQ1LINLGMUl1UEeAIEUNIRKBIC1ymAdd2BlackListI8qWIOVEIAqAhmoveFromJB111aQISS4I61UImYXI61EIneMID2DIivLI319Mnw1KIL3eiBlockPushI11SgblockeeI41MkModifyPermiMC11HIjqSI29IMrK15M001KEQ7cfo MRL16IuB6I31MICeSIHfSIR19M531WIFzPIcmMcHasIc5TIsjWIu35I714dCodeIe1TI24MEV9IyV5eresulMdU19IJi9EbEI416ME915n_SUCCESS = 0x0IYK7EQ6fFAILURIEi4c0x0MG21JcrmIIrCfMpM1NI5yMbrmIo7hM2o1KIXmAM5K1MdjoinM6G17M1Q1NMHC15MEe1Qc32 I5u6cCouMOV1CMHP1GjhatroomBanIkC4MEe1Nh32 whiteIAG8IUj9IU4GdPullMU52qMYR18Il26IR4JI2z4IU16IKf7Ma52LMLd1KMp01HIi2BcNewIG7MIE28MWf1nMnA2JIpOEilationQryMMK1LMsC1QMNW1HIp4PMRc16Mhl19MvC2MeorderIC9JMLA27hEraseMsgMZY1AMWn1MM2R1AI89GIS6PIesMcqryIfsCMgB1IEU5MaB17Eg7M1f1MdbotTI457McQ1HIB6BgFilter MRD1MIC6zIe5BMeB19MCb1FbagM5x1KI867fTagTopIOyQdpageIfp8I26TI3FKIA48MbB1NEV8IwQ5binISSAIh2IbFiMTx19IPAMIEF4IOANIBFRa MXs1bIZ4eI34KIUUKMCR1gIcT9Ix3GMdu1Iemsg =IiNMdreadMZH27M501ObunEb4IiN5Is3PMnl1DMw61McverIVQ4Mm12NII28cminIj16MJJ2PIj1AIQENbUnIR37MrK16E87MXt1PIs16bMeIu18IdwHIv97bBoMHJ2AMdQ2DIn1DIWaMMzE2FIqNFcmsgIC66IYFMIb26M6Y25Mi31OMM025I4s7IRQHiQryRemindIlT4cReqIe2NMz12AIlXOIp7DI7EMIH37IUOPMZ917Ie2WbspImGGIZ7PItDSdReadIJ25I1EoIsCJM0R1NgtargetIMkK19IYWDgleanHisIy25IEKAI71TIE27M572SIE27MX12KI2E4I845I29DIQ7VIWZIIy24hMsgBatchI59AIMRCIW3GbinE64IT6JgHistoryImI7IWnSID4IIB4PIO6GIm9BIK6AI92PcsOuIdQJNgO231II2FbhaIc44IKkSMQN2HIjMMMQN2IIoMGIzRPb6;IzRcITVHMM215hChatRoomMZf1VI9Z5IcZOI8Z5IZq9Ia1SMZy2SIbS4iTotalNumsIV6CIvb9brmMSj16IIT6dnfosITsOEe7IynLMSv27IlUNIoz5M8q1IgPFollowInBSMp32CExJIqusaMMa216Ieb6Ih5IbMCJV1U1Ma41SdmpidM7838Ma41SIZGJI2tDIf6JMXy2HIzc8Mkn17cUrlMby2HM411EITd7MlD3DdarchIO34Im4PIS24IO3Ocid=Ie4IIM18I96ZIQ1AMxu18I76CIKDJIew5Io2PIn48Io2NIe65IM1OMIr1TMiF3DIn2UIbMIIvSEMLm2HIgOHMIA3cIjrCIOxnI4TKI5MhItfKggnoreCmMS03AIvQLbsgIqQhIM7HIoQEI4TNImQ6IMnNJkQf1IjQsMo127dsAttMa61FMgN1gI61BMbp1SeinboxMSC1QMVW27EaAIr5JIlA4IDR4Irh6Ido8IQfHIL27cMsgIfh4IR3LIghfI1lAMqM2UM813SIGfUIo2EMuT3rgDeleteSIK67M4W1LMh928IRH4MlM17M8X1LEeCNrR2E1IWzQI25uIQa5Jw371IC1DeOutPuID1vIM6EIR7rI1t8cDelIpnFM1B1HaOIDR7breEG6M8B1ObclI7p6IbPKIE1GIeYMIMrCMp13XI5sGMO52RIm7CIcFHIN56I5SOMMJ1ZI33OIfF9IyO8Ih18IFG4Ic74IbArI81AMUL3kIDI9IJN4MOU1NMH33CIrzLlhrmKVEntity IH7MMJF26IGFNevalueIw1PMh639IQSMInX4estampMUM2RInl5M5U1MM5F17MUJ1KcSetIW36ImIIIs3BeentryIKCOabMbl36IY3JMAe3GgnotificIaD8Io3GI4AJIwNJIq27bS MQU1HJr2P2IAB6Ju2o2IR26Men2OIt2FbieIvyBIv2FiFullUpdatIICNMz51EN9W1O1IV3IbSVIeC6IhFDIDDPMKc2YIljDIb17I75SET7IE58grrorKeyMB41OIq2HdkeysEI7MN41OIc1GIPLMIMJDIrIFIQ25MI22OMr717IPHKIMJIIgTMIa7JM594IMgA47fettingIKwRIv67INwOIdM5Izo8ICrKIO5AI4jJI82CISlSI92OIg15greserveI92MbupIwC4I92RI7z4II4rIg1EI92OMDf2FI32WInBMIa2Chtem itemMdy2NIi2BM8d1II91FMAQ1UMbd3iIiVMMyc3GIiH6IhV8Mvc3MI338Msc3JMU51AMdj17IuiGcTagIU35dtagsMmq2JEc7MYe1JMoJ1IEuJMD925MTl3AIqAUIT2EMAA26I334MXb18IY1OJUqU1Ic37MLz1GI32CI955Ii25EA5MK81hIN3OIx9KEWCIW35Iwp7EHAIweeII8SI3fTIOVCMlN25IO2HMC637esSileMeD2CbIsMc326I627cTagIi1BgAutoTraICt5Md01OIb15MqW26IVAPIY9nIeMnMdR25Mxh36IcQ5IzRNMJk3EI71RcSetI41eIqFHbunI414dLeveM6I3MIe1AgResult M1u1WM0u1hIF2TMiA1OIH7DMgt1BIXPgIDRGIx3HIOA4Iw36NMC101IucAIt3fIU9WIlBHIm2AI4WZIyZOIQ4XmGrpReadReceipM6b4DM6J2EIXy5MXk4OIGLHIa1QMX125M771HJd131Ia1BMTW1rMEh4AMpj4UMrJ1LM9M47dreadIKM6b4 MLO2MIc35ds= 5EW7MHP4KMtB3AIOiHId37IA5AIg3hIBFJIXcMMMj1GI83KMpg2PMnV2AMlg2MMFb17MPR2bMQE2JIg58MqI2NMRO25MkI28b EZObSiMIC25MHF3OMZP2CMcI28Mbv3PIFpMIr67MDJ1OEaCIChGIS4PIi1TJW871MxB1NIX8iIlEEI4B7MbH2IIaBEbspIYY5cresIhtXMSQ4KM711DM5117MzZ4OIf7BMoT1MI87EI03UEb9IYo9J53F1Ml62IIw1LJA8q1IC7LMXa25IV5UIt2VMtO1XMpO1TMQj15aCM2c1LMpP2AEW6Mn34GIZ27Iuu4Ec5E95Mxv4PMmd16dListMic2PMLe17Il15I3tGIl1CEe6In17Mtj3IIoTIIVbLI548MdD26cNumMcA1JcGrpMak17Im15MuL27IfVKEdCIrYLIoM5MuE2TMfj2EIveJfTagAddMg81iIAyRMn81uIC1DMq21OILZRdnameIzTKMOA39Ik45M2C5OcTopMTE5JIP29cDelJd482fDisTagI0eQIf4BMU81NMuS15MFS18NTE111IHQEgportSDKMxl1SgsdkInfoMlo1KI017Mlp1rhUltraGrpMKJ56M6718MrF3ZMY93aMrD1IIm1BMbH3hMdN1pIC24ehangeM2q2QMAt4TIlQII9sGIEtJM5K4NfmsgUIDMAG1JI0PGM203qMEu4HMJC2HIyx6IqK5IWM9I7RGEZ5I16NMx33NILeNI569Ih7nI0B7eeedCoIdYPMvn47fnlineTM4e1MI97II3JHeEventIh26IrS5IoGFEVBNt4501ehasNeML845a3IIsNIg2GInDIIL4BIPt6IF3NMlA1QeinessILZLMaM3QM6L1aMhY3IcngeI217MAw3OjriginalId MVw1PEa8MfQ3NMhc39hcondaryIMbQ3KI657eAdminM0b5OdaddiEG6dMarkIMt6Iv2MgperatorMRV5MMlU17bubIJ66M7N18IqBMIw29Ed8Mig5NM0736bMeMm84BIcRGcextMXu37ItyMMoB3AMb55KIBm6eeventI8m7MV846IkLLIyCKI8GAIwCzIxCHI52LMS33oMJd1ZMlW1MMvx2EIfBJIEONMvd1PIFOAIWBNIFODIVBqeisDelMSN3JJLBK1MJP3HIMBxIsk4MA046JSBZ1MvV1CJM991Mzn49Id15IZ15MkT25Mbd45IY95c //MSt4HEjFISTLI29AMPt2OI5A9MXQ2rIO48cAckM5F3oIH7EhnotExistMjr58IKXHbOpIFA4heStatus MW31XIMRTMzN1NM6C48Mdw3NM9S2bIh2DM2G27IZj8M5V2ZIuRHMSG25IJO8M6Q39I859In17MRz2CIXX8EcIjSummary suE86c= 4IILHIJ1CNH91N1M901GME03NIH68Mev2MEF4I1jAI634Eb4IJ6JIm37NXC1T1MT33WIF3DMHA3FdtRtcM4M35Mt31MM9q48brtEc7Md02LI71AMkL4tcCalMNC55MhQ28MMb2QIgHPddataISu7ICyIIY18IpGAJa161ILKIaaM2035MJ94IbKvMu41RIfoGEvEMwk1SIo17IvJJIp14M9E3REV7M8h2RMB22UMvi1SM601JIJRyI1PYMKY6LbrtIrN8MEm5OcndMEY7MP96JMln1KMQu3TMjx1jMpn3ZMGR1GML81NMvL1LMpN1CMsL1CMBi1LMBR1BIB4JMLM1BMdR1HEX5IuzNM364WMaW3EMQb1OMPJ5AI4xLimentionedIH7QcCntIK7DMzx2qM4I2RIeARMWh1LMVh1RIk28Mbe1IMiS17Ir64MJd46Mpf3LEbAM8a1nIrP4M1L4RbtmMnM1LMXl26MtL15bubIi5JIfl9M1K2GMSW2ChubDetailM7n68Mn81NIUbSMlg27cxpiIKY6MVO1LIg19Mdp6NM9p68ImMKIl3FMv54JIG3OMzv5NcubTMyv5FMVb2HIS5OMfo2aMho1CIa1IbUlIa1AIH3PMV015IAkEIA2PM1D1WMMr1dMXR4JcullICNKIe2CIM6xInADMxw2NIs69I9AaI9BQI93HMQV15fubDataIs7WMoT1SgneedAllMx668Iq5YMal2LID29IV8IER7IQ57IX8aMcL1dJb8J1Ik2EMj57ScStrMLv4RIfGBMtc2HIb16IQf5MYN4QIb99IClJI317IJLLhplatformMPN4CEbHMKK3RIF6HINYIcrySI8ASISNxIxEGgProfileIdJtIuXGI929IP17Ih45Myq55If17InUIEgGcExtEjAILPHEkCMW73iMwl2KMg33JIX17Mxd1QMiC3iIUYIpcensorFailedFielMPE15Mk13PIH29MYs1OMMK5QI11BMWh6HI68CII8CI91UMcu3sI31BMZL5AImDNEWAIB1UInytMGB46IBCRMdA29M7c6AMrC6NMKQ7MMi41YMwJ1ZIsBCbseMqz15ILDccextIHDFIx1IdBaseEj5abE98MrE2QIMH7MuH4IIE1GIE4MM4725MlS18MLT1NbwnIPpNMXI5JInNMMXI5EIrNIIy68MU22PMoC15MHC15M4s1TafMoi66MOi5OMOb4OIiB4hrocessCoMuP35Ia6NgsJoinedIP55Iiq8Ig6MEn8McE68MOX4DMha1GkFriendInvitIt66bfrEHFMxa1IEq6IX19Eo6EF9MJD5II1KSMc077IbrCdultiIA38IQvgI74HISE6MbM2EMp12HJBFR1EZ9dQuitIe18M1F27IJF8It47MDd1RMQn2QIcA8IehDMt51DIv1IIb3FIHd7Eg4MtD5QM0445IwnPEW5eWhiteMp13PEY4cAttMU316ITETM5d17JL6Q1If18jPageParam MAV67IC6NbidIA6QbroMsE67Mbt2OMiO5AI7LPID2BIDeMMXs27IAwdMa72hM8X6EMt038MyX4NMT728I73JMu657MaF3AI51FIOE4IMhEMwn1FMVl59Iu6kIgU4IjULIQJ4Mov58INK4MGU5MEfHIqrDIV1NI7K8IN1PIeK9IF1ZIvNAIH1PIUOBIJ1EIW2RIpZOMnP2FIm5HI214cExtIbX8MtJ2QbpTMpJ2TMxI7EMEq4RIOJLII2KIf9LIPE4ImyPMNq5BMkD3UdNickMJT6UMNE2AIR3QfremarkIA17Mof4LcisBIgL5M8s7NbanM0V7VMjQ58MMq27Iv4JMjp26MnF16JfLS1M8p1WIe5PMcr7OIe5CMMF3NISSDMUz6OI5DCI14eIdkcIMlSIdkDMID4NIdkKIkeOIECCI0e8MgA4MIgJNI48uIWHAILD4IMeBI2NOEZ9binI724El8ME91NMYR48I4UMMGX79I9UTIoF5IL8BMSz7KMI715Mhg5OdapplMDg28M3J2GIT3HIil7IT37MMU7MEa7Ion8MtL7IItEDgResponsJvET1IAD8IhU8Mo02OIjV8IoEPIK89MZX4KIZb8I887Mkj6RIS6EIY4QNX01T1MfT6HMH91HIbr8MhA5uMEe3XMHD28Ix1MMpz5NET6ES7IGYGI41EMvU8TIsWPICzKMnw6OIDz6I73OMPV7SI55jIU1JeCheckIg4SEXCIibPEhIIt7tIkJ9Iq2NMTG1JMqG2oIHYDInQkIM2PMWg6TMI21LI1ANIEuQMZl37EW4IGnNIlmPIkJMMN516Mfq5BII2IIDjuMh328Ma156MSW3TIA2AIxLPIuC7IkfqIFkEInLNIFkEMLW3GIY8PIRS7INKNMhB19I55lMGe5LIs2UI05MMko4CI5EQMr13NITJDI15NIaM7M2v3MIb7DM9b3HIYI7Mwu6IJ6KF1MpA45cSetMp01NMJB47IrJOMy41GM051VMC12lIwDEIOyHIREFIcMVI2AAIB1NIZABMq01REi6aAIMe4MYD35I25MIse6MgX6SIC8DIpVZJTz71M6A2GIrK5MmR18MBO1MMWS1QIbmXIWoBMlq1IMAC29I02SID1AEl5MDS1CI22XcoptIcoGIFfJIN75MmZ2DMnA1WIsG6MNK6OMi289MW138IW3WIh2EIS3OIH6PIPVGMnY1TIGwNIW1JdFullIQwCIoEIIGB4ME836IVCLMvb39IqD5I3JQIVCIIXGJID85If1SINS6M678CIIRaIn1HcAddMeU46ePerioMNq2TMrs6CM8d4MispanMinutM0E55IOWMIBM8MKZ3OgimezoneM2J5QIp2XMJK7cJ9191I91CMav1SbisMrR89MzC2OIf5BMoU5NIf5DIUWMIf58M3q8OIf5AMje2JMyg59J7wU1MHp2TMqh5GIK8HMWd27IoCSNgD4U1M1n2DIFcMMTC4CM4s1GMEE4GMeD46MvH1IMhZ86M3j5OMOQ39M9i35Mda1TMki39I5PNmSpeechToTextIEa4MX39sfobjectMIQ9VM7F9PIqB7fampleRMMs7MMhY3AdnelNMyE88IsmNfformatIthQMsN78Mg81II469Me44SI56jM6C19I76TMRi1MIQO9MQT7CMRh8KIJ16Mfv4KdransMvI2JEO5I085ctraEA6MWe2QcmodM5H3LMZ596dorceMi658IYwHI427MDb2IEP8IV34Ic36I42dIW1HIusREe7MQ546IDoNI514IehUbteMfc2SI315dFileIBh6Mqx7OMyv85aLMKd15IBBNI8M6EZ6MkU7MM9r65aSMAx86IKBKIU5CIP4pIN3CICBEIM3UMT54TEZ6IiFNM5E26MiB8NIp3BM7d1JMrG45M2B4Acq {MWr4IMNI77MUO4AMvh4dIvA9IJA9MhZ3AM3X2LMFD4KMk53AET8MWI27ICRMdnextMr65FMfJ9hIF3GM8n2HMMp5dIm2AIXKLII4DMQG4jMJ09DbacEB4I2W6creaMRA98MAV4OMbb7OMre2WMMV7UIx4DMpZ4HMg21GMvZ4PMyT1NEU7ET7MAV57MO92xIg7BMiL9uIN2EN8g3N1MUS4QI37MMrs6HMBa66Iqu6EB5Mc22LEcBIxALMMI36I0QNMfK26Iid6IJfMEZ7cMeCM3t4RIvh4brTM1w6KEW7eutOffEX5I8KGMjL7EMUx85EJ9IJKCMGc55IVy4M8c5BhKICK = 0IL16eREFUSMZi8BgCOEXISTMTC9HbTaIb74I91BgROOM =1MMI27MgC99MCz5PMvAAWM8u6CIoHDM3477ICxVM7P86IrpHbtcIGt5MnK1GMlB7LI01KcKeyIcw6MnL1Sdkey=EzKeValueMZi3UM236ZIN1FMGC1FMqw4MM8r4HII2DEa4I3G4IY1PMWJ8QI52CMUa25MKv4OM0f85Mjs4HMp68GIVL8Ii2MdroomMs52EEeCMoI6JMb7ANMgq3AIVbMkofflineKickMTF2CIX4FM4K7UI6l8MUx35MGj3KIV3GM1L3NMEL7AMam6FIF6LMO175M4e3IbtcMM61RI124Mhh15MVM4NMjq98Ea5IsUHID3CIkr5eInnerMWL5NMtO39bSyIZO4MfC85IVYJbIdIPL4btyM4P4BbidEJHIj7II1K9Me92II46MbinIm27McX5BEgMeouterEg8Mhc1HIvH4bryIwCPI91DM315NMXi85caInIp6JMUP26fnterioIwI7EUBIrMBIdU6Mm34AIwIIIQZNMf11AMmM7OMd117IjQ6Iz2FcSetJ23K1I4LIMNz4NI4L6MHn4OIV3AIFsNIV38MC38IInD6IZ3LIf7KIC25MtU1EIl2GMS71KIF1MMY71FI0AIIt5RcsInJx8B1ItAGbelIL4PIwRRIS2GIp7GIS2II12KMrD5fIjfPINSKMJ79RInN8Eb7IJFLfSetOutINCPIW3IIuOTIM99IZTOIcBBMst9QIcB5IrOKcQryIfB4Ir2LMIU3eIlC7I617INXcIA1NMBiAZMsX7SMF51PImU6IM9LdPullM5i6hIR8HIEW8IS9KI6Z9NR47Z2Ix2HIJ7PNIv6R1MMB28Iko5IkWJIF26mAnchorToVieweMmr3BEG6bToEW6IQ6NMPg16cserMtp18MF59rbtcMep2HMeY4HdevicMsb3BI89WMep8XIF3UIv6PIj2BMKY8CIfpGI655ID1LIUKSIe8XMN37cIhhHMo826MQ18REY5Mi226MLk5IMEdA8fimeoutMFk7LIA1EMhj47IEYNEb6IhM5Mv95NEY6MJk99IhDMeCanceMm7A6IY3oIz2UIa3TIz25IX3TIz2AI7oMEa4hAnswerInIy2WIx2NIV67janswerCodeIu2UIT6aIw2FMJXAPIoeOIOZ4M9i1NIGg6IFvKcEndIG7eIA37IF7TIA3AIN4TMKq48MnV3OIo19dKeysIJ7IcBotILWSMoW36MwK9IbotIgG6EsFIG15ffo botEuOEW4IozMMnG87MCW5MMiY2yMZD8EMB41GcMetMkTA5Mi4A7MxTA9MpoAPMrY2QMAA67IES5MA41OIn1CMQA4UIH4MMRA4PMDW18NRp201N9Q121MYj4KMps1KIm27MU53KM6fAKMij2OMcDBAM4j9NMcDBAM3j9NM4x5DMHuAHIV58MXM5AMqJ6IMCF36MT35NI318MUP65cQryJb6o1M9q4TMZa1RMtV3LcallMFL67IS6OM9c1BMf79JIJ46MT54NI62GME32MMfc1HMQW5HMjE25IYC7M4s86EG8MMZ6tIK1FMdt4qIs88Mqa1DMYE2BIq2BMal1SEf8JQ9r1J1GE1IU9VMUq2DIrFNIz6CMPXBTIpFSJSAM1Msl4XI88ZM355JES6M4117Jv2s1Mew1HIv2fMfC2RIs8DMiA3OICMDMdW1RM6o1LMCA76cserII25M9h6KIa5AM0618MFZ2JEbBMuD3tIC3IIa1KMBY2SJvFf2MF05FMAY1HIv5GMh57QIY7AMvX17b}\n3Q4C");var mc,Sc;class vc{constructor(e){mc.add(this),Object.defineProperty(this,"pbModules",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=Io.loadProto(e);this.pbModules=t.build("Modules").probuf}encode(e,t){return this.pbModules[e].encode(t).toArrayBuffer()}decode(e,t){try{const s=this.pbModules[e].decode(t);return i(this,mc,"m",Sc).call(this,s)}catch(t){const i=`name: ${e}, stack: ${t.stack}`;throw null===console||void 0===console||console.error("pb decode error!",i),t}}}var Nc,Oc,yc,Cc,Mc,bc,Lc;mc=new WeakSet,Sc=function e(t,s){if(t instanceof Array)return t.map((t=>i(this,mc,"m",e).call(this,t)));if(n=t,"[object Object]"!==Object.prototype.toString.call(n))return t;var n;if(t instanceof Io.ByteBuffer)return t.toArrayBuffer();if(t instanceof Io.Long)return s?t.toString():t.toNumber();const r={};return Object.keys(t).forEach((s=>{const n=t[s],o=t.$type.name===So&&"seqId"===s;r[s]=i(this,mc,"m",e).call(this,n,o)})),r},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"}(Nc||(Nc={})),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"}(Oc||(Oc={})),function(e){e[e.GROUP_SUCCESS=0]="GROUP_SUCCESS",e[e.GROUP_FAILURE=1]="GROUP_FAILURE"}(yc||(yc={})),function(e){e[e.IsSilent=1]="IsSilent",e[e.IsTop=2]="IsTop",e[e.Tags=3]="Tags",e[e.AutoTrans=4]="AutoTrans"}(Cc||(Cc={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Mc||(Mc={})),function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(bc||(bc={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Lc||(Lc={}));const Uc=new vc(pc);var Pc,Dc,wc,Gc,Vc,kc,xc,Fc,Bc;!function(e){e[e.LOG=0]="LOG",e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.STATISTICS=6]="STATISTICS",e[e.NONE=1e3]="NONE"}(Pc||(Pc={})),function(e){e.IM="IM",e.RTC="RTC"}(Dc||(Dc={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.USER_LOGOUT=19]="USER_LOGOUT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR"}(wc||(wc={})),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"}(Gc||(Gc={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(Vc||(Vc={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(kc||(kc={})),function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(xc||(xc={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Fc||(Fc={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Bc||(Bc={}));class Hc{constructor(){Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:{}})}on(e,t,i){const s=this._map[e]||(this._map[e]=[]);s.some((e=>e.listener===t&&e.target===i))||s.push({listener:t,target:i})}once(e,t,i){const s=this._map[e]||(this._map[e]=[]);s.some((e=>e.listener===t&&e.target===i))||s.push({listener:t,target:i,once:!0})}off(e,t,i){let s=this._map[e];s&&(s=s.filter((e=>e.listener!==t||e.target!==i)),s.length?this._map[e]=s:delete this._map[e])}emit(e,...t){const i=this._map[e];if(i)for(let e=0;e<i.length;e+=1){const{target:s,once:n,listener:r}=i[e];n&&(i.splice(e,1),e-=1);try{r.call(s,...t)}catch(e){null===console||void 0===console||console.error(e)}}}removeAll(e){delete this._map[e]}clear(){Object.keys(this._map).forEach(this.removeAll,this)}}const jc=(e,t,i)=>{const s=null==i?void 0:i.isReverse;St(e)&&(()=>{for(const i in e)t(e[i],i,e)})(),(Rt(e)||Et(e))&&(()=>{if(s)for(let i=e.length-1;i>=0;i--)t(e[i],i);else for(let i=0,s=e.length;i<s;i++)t(e[i],i)})()},Yc=(e,t)=>(jc(e,((i,s)=>{e[s]=t(i,s)})),e),Wc=e=>"[object Null]"===Object.prototype.toString.call(e),qc=()=>ut.gen(),Jc=()=>ut.genWithLen(22);class Kc{constructor(e){Object.defineProperty(this,"pbCodec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.pbCodec=new vc(e)}encode(e,t,i){return i?t:this.pbCodec.encode(e,t)}decode(e,t){return this.pbCodec.decode(e,t)}}const Qc=(e,t,i,s,n)=>{const r=s?Object.keys(s).map((e=>({key:e,value:s[e]}))):void 0,o=n?Object.keys(n).map((e=>({key:e,value:n[e]}))):void 0;return Uc.encode(zl,{roomType:e,broadcastType:t,joinType:i,innerDatas:r,outerDatas:o})},Xc=e=>{const t=Uc.decode(Xl,e),{users:i,token:s,sessionId:n,roomInfo:r,entries:o,offlineKickTime:a}=t,l={};return jc(i,(e=>{const{userId:t,userData:i}=e,s={};jc(i,(e=>{const{key:t,value:i}=e;s[t]=i})),l[t]=s})),{users:l,token:s,sessionId:n,roomInfo:r,kvEntries:o,offlineKickTime:a}};var zc,Zc,$c,e_,t_,i_,s_,n_,r_,o_,a_,l_;!function(e){e.INIT="INIT",e.DATA="DATA",e.END="END"}(zc||(zc={}));class c_ extends _i{constructor(e,t){super(),Zc.add(this),$c.set(this,void 0),e_.set(this,new Map),t_.set(this,void 0),s(this,$c,e,"f"),s(this,t_,t,"f")}requestStreamMessageContent(e){return t(this,void 0,void 0,(function*(){const t=i(this,Zc,"a",i_).createTraceId();i(this,Zc,"a",i_).info(r.L_REQ_STREAM_MSG_CONTENT_T,`messageUId: ${e}`,t);const s=yield Ii.create("requestStreamMessageContent").isLimitedString("messageUId",e,1,64,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID,"messageUId is invalid.").result().tryTrans(i(this,$c,"f").validateConnected).tryTrans((e=>{var t,i;return(null===(i=null===(t=null==e?void 0:e.streamServer)||void 0===t?void 0:t.addrs)||void 0===i?void 0:i.length)?gi(e.streamServer.addrs):Ei(D.STREAM_MESSAGE_DISABLE)})).next((t=>i(this,Zc,"m",a_).call(this,e,t)));return i(this,Zc,"a",i_).summary(r.L_REQ_STREAM_MSG_CONTENT_R,s,t,{messageUId:e}),s.wipe()}))}}$c=new WeakMap,e_=new WeakMap,t_=new WeakMap,Zc=new WeakSet,i_=function(){return i(this,$c,"f").logger},s_=function(e,t,s){const n=i(this,e_,"f").get(e);n&&(i(this,e_,"f").delete(e),i(this,Zc,"m",n_).call(this,e,zc.END,t,n.msg))},n_=function(e,t,i,s,n){this.emit("message",{code:i,messageUId:e,type:t,chunk:n,message:s})},r_=function(e,t){e.content=Object.assign(Object.assign({},e.content),t),i(this,$c,"f")._innerSetMessageContent(e.messageId,JSON.stringify(e.content),e.messageType)},o_=function(e,t,s){const n=i(this,e_,"f").get(t);let r,o;switch(e){case"init":n.msg&&i(this,Zc,"m",r_).call(this,n.msg,{content:"",stopReason:0,completeReason:0,isSynced:!1}),i(this,Zc,"m",n_).call(this,t,zc.INIT,D.SUCCESS,n.msg);break;case"complete":r=s.length?JSON.parse(s):{},o=r.complete||!1,n.msg&&i(this,Zc,"m",r_).call(this,n.msg,{stopReason:r.stopReason||0,completeReason:r.completeReason||0,complete:o,isSynced:o}),i(this,Zc,"m",s_).call(this,t,r.stopReason||0,o);break;default:r=JSON.parse(s),n.cached+=r.content,n.msg&&i(this,Zc,"m",r_).call(this,n.msg,{content:n.cached}),i(this,Zc,"m",n_).call(this,t,zc.DATA,D.SUCCESS,n.msg,{content:r.content,fullContent:n.cached})}},a_=function(e,s){return t(this,void 0,void 0,(function*(){if(i(this,e_,"f").has(e))return Ei(D.STREAM_MESSAGE_REQUEST_IN_PROCESS,`Request in process, msgUId: ${e}`);if(i(this,e_,"f").size>=3)return Ei(D.STREAM_MESSAGE_REQUEST_COUNT_LIMIT_EXCEEDED,"The request queue is full");const t=Eo.createSSEClient({logger:i(this,Zc,"a",i_),msgUId:e,appkey:i(this,$c,"f").appkey,token:i(this,$c,"f").token,timeout:3e4,onRawContent:t=>{t.split("\n\n").forEach((t=>{if(0===t.length)return;t.startsWith("data:")&&(t=`event:delta\n${t}`);const s=t.indexOf("\n"),n=t.slice(0,s).replace("event:",""),r=t.slice(s+1+5);i(this,Zc,"m",o_).call(this,n,e,r.trim())}))},onNetworkError:t=>{i(this,Zc,"m",s_).call(this,e,t,!1)}});if(!t.isOk)return t.wipe();const n=t.data,r={client:n,cached:"",msg:void 0};if(i(this,e_,"f").set(e,r),i(this,t_,"f")){const{code:t,data:s}=yield i(this,$c,"f").getLocalMessage(e);if(!s)return i(this,e_,"f").delete(e),Ei(t,`message not found, msgUId: ${e}`);if(s.content.isSynced)return i(this,e_,"f").delete(e),Ei(D.STREAM_MESSAGE_SYNCED,"synced");r.msg=s}const o=yield n.open(s.slice());return o.isOk||i(this,e_,"f").delete(e),o.wipe()}))};class __{constructor(e){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e})}__getContext(){return this._context}createCodec(e,t){return new Kc(t)}createPBCodec(e,t){return new vc(e)}refetchNaviInfo(){return t(this,void 0,void 0,(function*(){return this._context.refetchNaviInfo()}))}getNaviInfo(){return this._context.getNaviInfoFromCache()}getCoreVersion(){return"5.46.0-c-tmp-alpha.1"}getAPIVersion(){return"5.46.0-c-tmp-alpha.1"}getAppkey(){return this._context.appkey}getCurrentId(){return this._context.getCurrentUserId()}getUserToken(){return this._context.token}getConnectionStatus(){return this._context.getConnectionStatus()}getDeviceId(){return this._context.getDeviceId()}setPushConfig(e){this._context.setPushConfig(e)}sendMessage(e,t,i){return console.warn('[PluginContext] sendMessage is deprecated, please use "sendMessageTo" instead'),this.sendMessageTo({conversationType:e,targetId:t,channelId:i.channelId},i)}sendMessageTo(e,t){return this._context.sendMessageByPlugin(e,t)}registerMessageType(e,t,i,s=[]){this._context.registerMessageType(e,t,i,s)}getServerTime(){return this._context.getServerTime()}getOSInfo(){return this._context.getOSInfo()}getProcessInfo(){return this._context.getProcessInfo()}getMainProcessInfo(){return this._context.getMainProcessInfo()}setCallInfo(e,t,i){return this._context.setCallInfo(e,t,i)}createLogger(e,t){return this._context.createLogger(e,t)}getStatsUrlList(){return this._context.getStatsUrlList()}registerCustomSignalHandler(e,t){this._context.registerCustomSignalHandler(e,t)}}class d_ extends __{joinRTCRoom(e,i,s,n,r,o){return t(this,void 0,void 0,(function*(){const t=Qc(i,s,n,r,o),{code:a,buffer:l}=yield this.rtcSignaling(e,In,!0,t);let c;return a===D.SUCCESS&&l&&(c=Xc(l)),{code:a,data:c}}))}quitRTCRoom(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Wl,{status:0}),{code:i}=yield this.rtcSignaling(e,Tn,!0,t);return i}))}rtcPing(e,i,s){return t(this,void 0,void 0,(function*(){const{code:t}=yield this._context.rtcPing(e,i,s);return t}))}rtcPingResVersion(e,t,i){return this._context.rtcPing(e,t,i)}getRTCUserInfo(e){throw new Error("Method not implemented.")}setRTCUserInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Ql,{key:i,value:s}),{code:n}=yield this.rtcSignaling(e,fn,!0,t);return n}))}removeRTCUserInfo(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Kl,{key:i}),{code:s}=yield this.rtcSignaling(e,Rn,!1,t);return s}))}setRTCData(e,i,s,n,r,o){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ec,{interior:n,target:r,key:i,value:s,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),{code:a}=yield this.rtcSignaling(e,An,!1,t);return a}))}setRTCTotalRes(e,i,s,n,r=""){return t(this,void 0,void 0,(function*(){const t={objectName:n,content:[{key:i.name,value:i.content}],valueInfo:[{key:"uris",value:s},{key:"mcu_uris",value:r}]},o=Uc.encode(tc,t),{code:a}=yield this.rtcSignaling(e,pn,!0,o);return a}))}setRTCCDNUris(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(tc,{objectName:i,valueInfo:[{key:"cdn_uris",value:s}]}),{code:n}=yield this.rtcSignaling(e,pn,!0,t);return n}))}getRTCData(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=Uc.encode($l,{interior:s,target:n,key:i}),{code:r,buffer:o}=yield this.rtcSignaling(e,mn,!0,t);if(r!==D.SUCCESS||!o)return{code:r};const{outInfo:a}=Uc.decode(Zl,o),l={};return a.forEach((e=>{l[e.key]=e.value})),{code:r,data:l}}))}removeRTCData(e,i,s,n,r){return t(this,void 0,void 0,(function*(){const t=Uc.encode($l,{interior:s,target:n,key:i,objectName:null==r?void 0:r.name,content:null==r?void 0:r.content}),{code:o}=yield this.rtcSignaling(e,Sn,!1,t);return o}))}setRTCOutData(e,i,s,n){return t(this,void 0,void 0,(function*(){throw new Error("JSEngine's method not implemented.")}))}getRTCOutData(e,i){return t(this,void 0,void 0,(function*(){throw new Error("JSEngine's method not implemented.")}))}getRTCToken(e,i,s){return t(this,void 0,void 0,(function*(){const t=Qc(i,s),{code:n,buffer:r}=yield this.rtcSignaling(e,vn,!0,t);if(n!==D.SUCCESS||!r)return{code:n};const{rtcToken:o}=Uc.decode(sc,r);return{code:n,data:{rtcToken:o}}}))}setRTCState(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ql,{state:i}),{code:s}=yield this.rtcSignaling(e,Nn,!0,t);return s}))}getRTCUserList(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Jl,{order:2}),{code:i,buffer:s}=yield this.rtcSignaling(e,On,!0,t);if(i!==D.SUCCESS||!s)return{code:i};return{code:i,data:Xc(s)}}))}joinLivingRoomAsAudience(e,i,s){return t(this,void 0,void 0,(function*(){const t=Qc(i,s),{code:n,buffer:r}=yield this.rtcSignaling(e,yn,!0,t);if(n!==D.SUCCESS||!r)return{code:n};const{rtcToken:o,entries:a}=Uc.decode(oc,r);return{code:n,data:{token:o,kvEntries:a}}}))}quitLivingRoomAsAudience(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Wl,{status:0}),{code:i}=yield this.rtcSignaling(e,Cn,!0,t);return i}))}rtcIdentityChange(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(zl,{roomType:Gc.LIVE,broadcastType:s,identityChangeType:i,needSysChatroom:!1}),{code:n,buffer:r}=yield this.rtcSignaling(e,Mn,!0,t);if(n!==D.SUCCESS||!r)return{code:n};return{code:n,data:Xc(r)}}))}requestRoomPK(e){return t(this,void 0,void 0,(function*(){const{invitedRoomId:t,invitedUserId:i,inviteSessionId:s,inviteTimeout:n,inviteInfo:r,roomId:o}=e,a=Uc.encode(ac,{invitedRoomId:t,invitedUserId:i,inviteSessionId:s,timeoutTime:n,inviteInfo:r}),{code:l}=yield this.rtcSignaling(o,bn,!0,a);return l}))}cancelRoomPK(e){return t(this,void 0,void 0,(function*(){const{invitedRoomId:t,invitedUserId:i,inviteSessionId:s,inviteInfo:n,roomId:r}=e,o=Uc.encode(lc,{invitedRoomId:t,invitedUserId:i,inviteSessionId:s,inviteInfo:n}),{code:a}=yield this.rtcSignaling(r,Ln,!0,o);return a}))}responseRoomPK(e){return t(this,void 0,void 0,(function*(){const{inviteUserId:t,inviteRoomId:i,inviteSessionId:s,content:n,key:r,value:o,agree:a,roomId:l}=e,c=Uc.encode(cc,{inviteUserId:t,inviteRoomId:i,inviteSessionId:s,content:n,key:r,value:o,answerCode:a?1:0}),{code:_}=yield this.rtcSignaling(l,Un,!0,c);return _}))}endRoomPK(e){return t(this,void 0,void 0,(function*(){const{endRoomId:t,sessionId:i,content:s,keys:n,roomId:r}=e,o=Uc.encode(_c,{inviteRoomId:t,inviteSessionId:i,inviteContent:s,inviteRoomKeys:n}),{code:a}=yield this.rtcSignaling(r,Pn,!0,o);return a}))}registerRTCSignalListener(e){this._context.registerRTCSignalingListener(e)}rtcSignaling(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=yield this._context.rtcSignaling(e,i,s,n);return{code:t.code,buffer:t.data}}))}getRTCJoinedUserInfo(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(nc,{userId:e}),{code:i,buffer:s}=yield this.rtcSignaling("",Dn,!0,t);if(i!==D.SUCCESS||!s)return{code:i};return{code:i,data:Uc.decode(rc,s).info.map((e=>({deviceId:e.deviceId,roomId:e.roomId,joinTime:e.joinTime})))}}))}}!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.CHANNEL_ID=7]="CHANNEL_ID"}(l_||(l_={}));const u_={[l_.STRING]:pt,[l_.ONLY_STRING]:Et,[l_.NUMBER]:Tt,[l_.BOOLEAN]:e=>"boolean"==typeof e,[l_.OBJECT]:St,[l_.ARRAY]:Rt,[l_.CALLBACK]:e=>{let t=!0;return St(e)||(t=!1),(e=e||{}).onSuccess&&!vt(e.onSuccess)&&(t=!1),e.onError&&!vt(e.onError)&&(t=!1),t},[l_.CHANNEL_ID]:bt};class h_ extends Error{constructor(e){super(e),this.name="RCAssertError"}}const g_=(e,t,i,s=!1)=>{if(!E_(e,t,i,s))throw new h_(`'${e}' is invalid: ${JSON.stringify(t)}`)},E_=(e,t,i,s=!1)=>{i=u_[i]||i;const n=s?i(t):Nt(t)||null==t||i(t);return n||null===console||void 0===console||console.error(`'${e}' is invalid: ${JSON.stringify(t)}`),n},I_=(e,t)=>{if(!pt(e))return Ei(D.INVALID_PARAMETER_MESSAGE_TYPE);if(!Ss(e))return Ei(D.MESSAGE_NOT_REGISTERED);const{searchProps:i}=ms(e);if(!i||0===i.length)return gi();return i.every((e=>void 0!==t[e]))?gi():Ei(D.SEARCH_PROPS_LIMIT_ERROR)},T_=(e,t,i)=>f_(Ii.create(e),t,i),f_=(e,t,i)=>(e.isFailed||e.isObject("conversation",t,!0).fail(D.INVALID_PARAMETER_CONVERSATION).validate("conversationType",null==t?void 0:t.conversationType,(()=>W(null==t?void 0:t.conversationType,i)),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE).validate("targetId",null==t?void 0:t.targetId,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("channelId",null==t?void 0:t.channelId,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID),e),R_=(e,t,i)=>(e.check((e=>f_(e,t,B))).check((e=>{const s=null==t?void 0:t.messageType;pt(s)?s===Q.STREAM_MESSAGE&&i.includes("RC_Ext_StreamMsgSummary")&&e.setFailed(D.STREAM_MESSAGE_EXPANSION_KEY_ERROR):e.setFailed(D.INVALID_PARAMETER_MESSAGE_TYPE)})).check((e=>{(null==t?void 0:t.canIncludeExpansion)||e.setFailed(D.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION)})).isNotEmptyString("messageUId",null==t?void 0:t.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isTimestamp("sentTime",null==t?void 0:t.sentTime,!0).fail(D.INVALID_PARAMETER_TIMESTAMP),e),A_=(e,t,i)=>(e.check((e=>{i||e.setFailed(D.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION)})).isObject("expansion",t,!0).fail(D.INVALID_PARAMETER_MESSAGE_EXPANSION).check((e=>{const i=Object.keys(t);if(i.length>20||0===i.length)return void e.setFailed(D.EXPANSION_LIMIT_EXCEET);if(i.some((e=>!/^[A-Za-z0-9_=+-]+$/.test(e)||"string"!=typeof t[e])))return void e.setFailed(D.INVALID_PARAMETER_MESSAGE_EXPANSION);i.some((e=>e.length>32||t[e].length>4096))&&e.setFailed(D.EXPANSION_LIMIT_EXCEET)})),e),p_=(e,t)=>t?(e.isObject("proxy",t,!0).isString("socketHost",t.socksHost,!0).isNumber("socketPort",t.socksPort,!0).isString("socketUsername",t.socksUsername).isString("socketPassword",t.socksPassword).fail(D.INVALID_PARAMETER_PROXY),e):e;const m_=e=>function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);const t=unescape(encodeURIComponent(e)).split("").map((e=>e.charCodeAt(0)));return new Uint8Array(t)}(e).byteLength,S_=e=>({isPersited:!!(16&e),isCounted:!!(32&e),disableNotification:!!(512&e),receivedStatus:!!(2&e)?Re.RETRIEVED:Re.UNREAD,canIncludeExpansion:!!(1024&e)}),v_=(e,t,i,s,n)=>{let r=0;return e&&(r|=16),t&&(r|=32),i&&(r|=64),s&&(r|=512),n&&(r|=1024),r},N_=e=>{const t={};try{const i=JSON.parse(e);Object.entries(i).forEach((([e,i])=>{t[e]=i.v}))}catch(t){console.error(`parseMessageExpansion error: ${e}`,t)}return t},O_=(e,t,i,s)=>{const n=Uc.decode(Ro,e.pbData),r=en(e.topic);let o,a;if(r===$s.recallMsg){const e=JSON.parse(n.content);o=e.conversationType,a=e.targetId}else l=r,o={[$s.ppMsgP]:w.PRIVATE,[$s.pgMsgP]:w.GROUP,[$s.chatMsg]:w.CHATROOM,[$s.ugMsg]:w.ULTRA_GROUP,[$s.pcMsgP]:w.CUSTOMER_SERVICE,[$s.pbMsgP]:w.SYSTEM}[l]||w.PRIVATE,a=e.targetId;var l;const c=![w.GROUP,w.CHATROOM,w.RTC_ROOM,w.ULTRA_GROUP].includes(o),_=c?a:t,d=c?"":a,{isPersited:u,isCounted:h,isMentioned:g,disableNotification:E,canIncludeExpansion:I}=b_(n.sessionId);return{fromUserId:_,type:o,groupId:d,classname:n.classname,content:n.content,dataTime:i,status:v_(u,h,g,E,I),msgId:s,direction:ue.SEND,clientUniqueId:n.clientUniqueId,extraContent:n.extraContent,pushContent:n.pushText,configFlag:n.configFlag,pushExt:n.pushExt,busChannel:n.busChannel,toUserIds:n.toUserIds,optionBits:n.optionBits,refData:n.refData}},y_=(e,t,i=!1,s)=>{const{type:n,classname:r}=e,o=![w.GROUP,w.CHATROOM,w.RTC_ROOM,w.ULTRA_GROUP].includes(n)?s||e.fromUserId:e.groupId||s,{disableNotification:a,receivedStatus:l,canIncludeExpansion:c}=S_(e.status),_=e.direction===ue.SEND?ue.SEND:ue.RECEIVE,d=((e=0,t,i)=>{const{isVoipPush:s,isFilerWhiteBlacklist:n,disablePushTitle:r,forceShowDetailContent:o}=(e=>({isVoipPush:!!(1&e),isFilerWhiteBlacklist:!!(2&e),disablePushTitle:!!(4&e),forceShowDetailContent:!!(8&e)}))(e),a=Zt(null==i?void 0:i.pushConfigs,null==i?void 0:i.pushId);return Object.assign({pushTitle:(null==i?void 0:i.title)||"",pushContent:t||"",pushData:"",disablePushTitle:r,forceShowDetailContent:o,templateId:null==i?void 0:i.templateId},a)})(e.configFlag||0,e.pushContent,e.pushExt),{isInterrupt:u,isModifyMessage:h,isPrivateChannel:g,isStatusMessage:E}=(e=>{const t=e||0;return{isInterrupt:!!(2&t),isModifyMessage:!!(4&t),isPrivateChannel:!!(8&t),isStatusMessage:!!(64&t)}})(e.extStatus);let I,T,f;if(Ss(e.classname)){const t=ms(e.classname);I=t.isCounted,T=t.isPersited,f=!!t.isStatusMessage}else{const t=S_(e.status);I=t.isCounted,T=t.isPersited,f=E||!1}const R=(e=>{let t;try{t=JSON.parse(e),null===t&&(t=e)}catch(i){t=e}if(null==t?void 0:t.user){const{portrait:e,portraitUri:i}=t.user,s=e||i;s&&(t.user.portrait=t.user.portraitUri=s)}return t})(e.content),A=e.optionBits||0,p={conversationType:n,targetId:o,senderUserId:_===ue.SEND?t:e.fromUserId,messageType:r,messageUId:e.msgId,isPersited:T,isCounted:I,isMentioned:!!R.mentionedInfo,sentTime:e.dataTime,messageDirection:_,receivedTime:Date.now(),disableNotification:a,receivedStatus:l,receivedStatusInfo:Gt(l),canIncludeExpansion:c,content:R,expansion:e.extraContent?N_(e.extraContent):null,pushConfig:d,channelId:e.busChannel||"",isInterrupt:u,isModifyMessage:h,messageId:e.clientUniqueId||0,sentStatus:ie.SENT,isOffLineMessage:i,channelType:g?X.PRIVATE:X.PUBLIC,isStatusMessage:f,readReceiptInfo:void 0,directedUserIds:e.toUserIds,disableUpdateLastMessage:(1&A)>0,needReceipt:(2&A)>0,sendReceipt:!!(4&A)||void 0,modifyInfo:L_(e.convertExt),extraData:e.extMsgData?{seqId:e.extMsgData.seqId,sentTime:e.extMsgData.sendTime}:void 0,hasReactions:(64&A)>0};return e.refData&&(p.quoteInfo={messageUId:e.refData.msgId,senderId:e.refData.fromUserId,objectName:e.refData.classname,quoteMessageStatus:Pe.DEFAULT}),p},C_=(e,t,i,s=!1,n)=>{const r=y_(t,i,s,n);return r.messageType===Q.RECALL&&e.serverSaveUnread?(r.__innerData__={keepUnreadCount:!(16&t.optionBits)},r):r},M_=(e,t,i,s,n)=>{let r=0;const{isPersited:o,isCounted:a,isStatusMessage:l}=ms(e),c=n||l;return o&&!c&&(r|=1),a&&!c&&(r|=2),t&&(r|=4),i&&(r|=32),s&&(r|=64),r},b_=e=>({isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e),isMentioned:!!(4&e)}),L_=e=>{if(e)try{const{modify:t}=JSON.parse(e);if(t.time)return{timestamp:t.time,content:{},status:Gi.SUCCESS}}catch(t){console.error(`parse message modify info error: ${e}`,t)}},U_=(e,t)=>{const{sentTime:i,messageUId:s,isDelete:n,isAdmin:r,directionalUserIdList:o,extra:a}=e.content,l={recallTime:i,recallActionTime:e.sentTime,admin:!!r,delete:!!n,isDelete:!!n,operatorId:e.senderUserId,extra:a},c=Object.assign(Object.assign({},e),{content:l,messageType:Q.RECALL_NOTIFICATION_MESSAGE});return t&&(c.messageUId=s,c.sentTime=i,c.directedUserIds=o),c};function P_(e){return 1&~((null==e?void 0:e.sessionMode)||0)?Ei(D.RC_REAL_TIME_CONVERSATION_UNAVAILABLE):gi()}function D_(e){return Math.min(e,999)}class w_{constructor(e){Object.defineProperty(this,"_delayTime",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"subscribeData",{enumerable:!0,configurable:!0,writable:!0,value:{[oe.ONLINE_STATUS]:{},[oe.USER_PROFILE]:{}}}),Object.defineProperty(this,"_ownProfile",{enumerable:!0,configurable:!0,writable:!0,value:null})}clearSubscribeRelation(){this.subscribeData={[oe.ONLINE_STATUS]:{},[oe.USER_PROFILE]:{}}}clearSubscribeStatusData(e){e===oe.ONLINE_STATUS?Object.keys(this.subscribeData[e]).forEach((t=>{this.subscribeData[e][t].statusMap={}})):e===oe.USER_PROFILE&&Object.keys(this.subscribeData[e]).forEach((t=>{this.subscribeData[e][t].profile=void 0}))}getSubscribeUserData(e,t){const i=this.subscribeData[e][t];return i?Object.assign({},i):void 0}removeSubscribeUserData(e,t){delete this.subscribeData[e][t]}updateSubscribeUserData(e,t,i){this.subscribeData[e][t]=i}clearExpiredData(e){for(const t in this.subscribeData[e]){const i=this.subscribeData[e][t];i.expiry<(Date.now()+this._delayTime-i.subscribeTime)/1e3&&delete this.subscribeData[e][t]}}getSubscribeUserList(e,t,i){return[...Object.values(this.subscribeData[e])].sort(((e,t)=>e.subscribeTime-t.subscribeTime)).slice(i,i+t)}updateOwnProfile(e){var t;const i=Object.assign(Object.assign({},null===(t=this._ownProfile)||void 0===t?void 0:t.extraProfile),e.extraProfile);this._ownProfile=Object.assign(Object.assign(Object.assign({},this._ownProfile),e),{extraProfile:i})}getOwnProfile(){return this._ownProfile?Object.assign(Object.assign({},this._ownProfile),{extraProfile:Object.assign({},this._ownProfile.extraProfile)}):null}}class G_{constructor(e){Object.defineProperty(this,"_delayTime",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_relationshipStatusVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_subUserStatusVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_ownProfileVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_subStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._subStore=new w_(e)}updateRelationshipStatusVersion(e){e>this._relationshipStatusVersion&&(this._relationshipStatusVersion=e)}getRelationshipStatusVersion(){return this._relationshipStatusVersion}updateSubscribeUserStatusVersion(e){e>this._subUserStatusVersion&&(this._subUserStatusVersion=e)}getSubscribeUserStatusVersion(){return this._subUserStatusVersion}_filterSubscribeRelationData(e){return e.reduce(((e,t)=>(t.subUsers.forEach((i=>{let s=e.find((e=>e.subscribeType===t.subType&&e.userId===i.subUserId));s?s.subscribeTime<t.subTime&&(s.expiry=t.expiry,s.operationType=t.opType,s.subscribeTime=t.subTime):e.push({userId:i.subUserId,subscribeTime:t.subTime,subscribeType:t.subType,expiry:t.expiry,operationType:t.opType})})),e)),[])}updateSubscribeRelation(e,t=!1){const i=[],s=[],n=[];t&&this._subStore.clearSubscribeRelation();return this._filterSubscribeRelationData(e).forEach((e=>{var t,r;const{userId:o,subscribeTime:a,subscribeType:l,expiry:c,operationType:_}=e;if(_===ae.UNSUBSCRIBE)return this._subStore.removeSubscribeUserData(l,o),void n.push(e);const d=this._subStore.getSubscribeUserData(l,o);if(!(d&&d.subscribeTime>=a)){if(l===oe.ONLINE_STATUS){i.push(o);const e=(null===(t=d)||void 0===t?void 0:t.statusMap)||{};this._subStore.updateSubscribeUserData(l,o,{subscribeTime:a,expiry:c,userId:o,subscribeType:l,statusMap:e})}else{s.push(o);const e=null===(r=d)||void 0===r?void 0:r.profile;this._subStore.updateSubscribeUserData(l,o,{subscribeTime:a,expiry:c,userId:o,subscribeType:l,profile:e,isSubscribed:!0})}n.push(e)}})),{newSubscribeOnlineStatusList:i,newSubscribeUserProfileList:s,subscribeUserChangeList:n}}clearSubscribeStatus(){this._subStore.clearSubscribeStatusData(oe.ONLINE_STATUS),this._subStore.clearSubscribeStatusData(oe.USER_PROFILE)}updateSubscribeUserOnlineStatus(e){const t=[];return e.forEach((e=>{const i=e.subUserId,s=e.data,n=this._subStore.getSubscribeUserData(oe.ONLINE_STATUS,i);if(!n)return;const r=[],o=Object.assign({},n.statusMap);s.forEach((e=>{const t=e.platformInfo,i=e.versionTime,s=o[t];if(s&&s.changeTime>i)return;const n={eventValue:e.value,changeTime:i};o[t]=n,r.push(Object.assign(Object.assign({},n),{platform:t}))})),this._subStore.updateSubscribeUserData(oe.ONLINE_STATUS,i,{subscribeTime:n.subscribeTime,expiry:n.expiry,userId:i,subscribeType:oe.ONLINE_STATUS,statusMap:o}),t.push({userId:i,subscribeType:oe.ONLINE_STATUS,subscribeTime:n.subscribeTime,expiry:n.expiry,details:r})})),t}updateSubscribeUserProfile(e){const t=[];return e.forEach((e=>{const{userId:i,version:s,userProfile:n,userExtProfile:r}=e,o=this._subStore.getSubscribeUserData(oe.USER_PROFILE,i),a=xt(i,n,r);o?o.profile&&o.profile.version>=s||(this._subStore.updateSubscribeUserData(oe.USER_PROFILE,i,{subscribeTime:o.subscribeTime,expiry:o.expiry,userId:i,subscribeType:oe.USER_PROFILE,profile:{info:a,version:s},isSubscribed:o.isSubscribed}),o.isSubscribed&&t.push({userId:i,subscribeType:oe.USER_PROFILE,subscribeTime:o.subscribeTime,expiry:o.expiry,userProfile:Object.assign({},a)})):this._subStore.updateSubscribeUserData(oe.USER_PROFILE,i,{subscribeTime:0,expiry:0,userId:i,subscribeType:oe.USER_PROFILE,profile:{info:a,version:s},isSubscribed:!1})})),t}getSubscribeUserStatus(e,t){const i=[];return t.forEach((t=>{const s=this._subStore.getSubscribeUserData(e,t);if(!s||s.expiry<(Date.now()+this._delayTime-s.subscribeTime)/1e3)this._subStore.removeSubscribeUserData(e,t);else{const t={subscribeTime:s.subscribeTime,expiry:s.expiry,userId:s.userId,subscribeType:s.subscribeType};if(e===oe.ONLINE_STATUS){const{statusMap:e}=s,i=Object.keys(e).map((t=>Object.assign({platform:~~t},e[~~t])));t.details=kt(i)}else if(e===oe.USER_PROFILE&&!s.isSubscribed)return;i.push(t)}})),i}getUserProfiles(e){const t=[],i=[];return e.forEach((e=>{const s=this._subStore.getSubscribeUserData(oe.USER_PROFILE,e);if(!s||!s.profile)return void i.push(e);const{version:n,info:r}=s.profile;if(s.isSubscribed)return this._delayTime+Date.now()-n>6048e5?void i.push(e):void t.push(Object.assign(Object.assign({},r),{extraProfile:Object.assign({},r.extraProfile)}));this._delayTime+Date.now()-n>6e5?i.push(e):t.push(Object.assign(Object.assign({},r),{extraProfile:Object.assign({},r.extraProfile)}))})),{list:t,needQueryUserIds:i}}getSubscribeUserList(e,t,i){this._subStore.clearExpiredData(e);return this._subStore.getSubscribeUserList(e,t,i).map((t=>{const i={subscribeTime:t.subscribeTime,expiry:t.expiry,userId:t.userId,subscribeType:t.subscribeType};if(e===oe.ONLINE_STATUS){const e=Object.keys(t.statusMap).map((e=>Object.assign({platform:~~e},t.statusMap[~~e])));i.details=kt(e)}return i}))}updateOwnProfile(e,t){this._ownProfileVersion>t||this._subStore.updateOwnProfile(e)}getOwnProfile(){return this._subStore.getOwnProfile()}}class V_{constructor(e,t,i,s,n,r,o){Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_event",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_delayTime",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_isOpenUserProfile",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_subDriven",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_isPullingRelationship",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullRelationshipQueue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_pullRelationshipFailTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_isPullingSubUserStatus",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullSubUserStatusQueue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_pullSubUserStatusFailTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_subscribeService",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._subscribeService=new G_(s)}syncData(){return t(this,void 0,void 0,(function*(){this._subDriven&&(yield this._syncSubscribeRelationship(!1),yield this._syncSubscribeUserStatus(!0)),this._isOpenUserProfile&&(yield this.syncOwnProfile()),1&this._subDriven&&this._event.syncSubscribeUserStatusFinished(oe.ONLINE_STATUS),2&this._subDriven&&this._event.syncSubscribeUserStatusFinished(oe.USER_PROFILE),3&this._subDriven&&this._event.syncSubscribeUserStatusFinished(oe.FRIEND_ONLINE_STATUS),4&this._subDriven&&this._event.syncSubscribeUserStatusFinished(oe.FRIEND_USER_PROFILE)}))}startSyncSubscribeRelationship(e){return t(this,void 0,void 0,(function*(){this._pullRelationshipQueue.push(e),this._syncSubscribeRelationship()}))}_syncSubscribeRelationship(e=!0){return t(this,void 0,void 0,(function*(){this._isPullingRelationship||(this._isPullingRelationship=!0,yield this._pullSubscribeRelationship(e),this._isPullingRelationship=!1,this._pullRelationshipQueue.length>0&&(this._pullRelationshipQueue.length=0,yield this._syncSubscribeRelationship(e)))}))}_pullSubscribeRelationship(e,i=""){return t(this,void 0,void 0,(function*(){const t=this._subscribeService.getRelationshipStatusVersion(),s=this._logger.createTraceId();this._logger.info(r.L_PULL_SUBSCRIBED_USER_RELATION_T,JSON.stringify({version:t,_pageToken:i}),s);const n=Uc.encode(Ka,{version:t,pageToken:i}),o=yield this._ctx.query($s.pullUserSub,this._currentUserId,n,Qa);if(this._logger.summary(r.L_PULL_SUBSCRIBED_USER_RELATION_R,o,s),!o.isOk)return this._pullRelationshipFailTime++,this._pullRelationshipFailTime>5?void(this._pullRelationshipFailTime=0):this._pullSubscribeRelationship(e,i);this._pullRelationshipFailTime=0;const{list:a,version:l,hasNext:c,pageToken:_}=o.data;if(e){const{newSubscribeOnlineStatusList:e,newSubscribeUserProfileList:t,subscribeUserChangeList:i}=this._subscribeService.updateSubscribeRelation(a);i.length>0&&this._event.subscribeRelationChanged(i),e.length>0&&this._queryAndUpdateUserOnlineStatus(e),t.length>0&&this._queryAndUpdateUserProfile(t)}else this._subscribeService.updateSubscribeRelation(a,!i);this._subscribeService.updateRelationshipStatusVersion(l),this._pullRelationshipQueue=this._pullRelationshipQueue.filter((e=>e>l)),c&&(yield this._pullSubscribeRelationship(e,_))}))}startsyncSubscribeUserStatus(e){return t(this,void 0,void 0,(function*(){this._pullSubUserStatusQueue.push(e),this._syncSubscribeUserStatus()}))}_syncSubscribeUserStatus(e=!1){return t(this,void 0,void 0,(function*(){this._isPullingSubUserStatus||(this._isPullingSubUserStatus=!0,yield this._pullSubscribeUserStatus(e),this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue.length>0&&(this._pullSubUserStatusQueue.length=0,yield this._syncSubscribeUserStatus(e)))}))}_pullSubscribeUserStatus(e=!1,i=""){return t(this,void 0,void 0,(function*(){const t=this._subscribeService.getSubscribeUserStatusVersion(),s=this._logger.createTraceId();this._logger.info(r.L_PULL_SUBSCRIBED_USER_STATUS_T,JSON.stringify({version:t,_pageToken:i,needAllData:e}),s);const n=Uc.encode(Xa,{versionTime:t,needAllData:e,pageToken:i}),o=yield this._ctx.query($s.pullSubData,this._currentUserId,n,za);if(!o.isOk)return this._logger.warn(r.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:o.code,failTime:this._pullSubUserStatusFailTime}),s),this._pullSubUserStatusFailTime++,this._pullSubUserStatusFailTime>5?void(this._pullSubUserStatusFailTime=0):this._pullSubscribeUserStatus(e,i);this._pullSubUserStatusFailTime=0;let{list:a,versionTime:l,hasNext:c,pageToken:_,isFull:d}=o.data;this._logger.info(r.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:o.code}),s),this._pullSubUserStatusQueue=this._pullSubUserStatusQueue.filter((e=>e>l)),this._subscribeService.updateSubscribeUserStatusVersion(l);const u=[],h=[];a.forEach((e=>{switch(e.subType){case oe.ONLINE_STATUS:u.push(e);break;case oe.USER_PROFILE:h.push(e.subUserId);case oe.FRIEND_ONLINE_STATUS:case oe.FRIEND_USER_PROFILE:}})),d&&""===i&&this._subscribeService.clearSubscribeStatus(),u.length>0&&this._updateUserOnlineStatus(u,!d),h.length>0&&(yield this._queryAndUpdateUserProfile(h,!d)),c&&(yield this._pullSubscribeUserStatus(e,_))}))}_queryAndUpdateUserOnlineStatus(e){return t(this,void 0,void 0,(function*(){const t=this._logger.createTraceId();this._logger.info(r.L_QUERY_SUBSCRIBE_DATA_T,JSON.stringify(e),t);const i=Uc.encode($a,{subType:oe.ONLINE_STATUS,subUsers:e.map((e=>({subUserId:e})))}),s=yield this._ctx.query($s.qrySubData,this._currentUserId,i,za);this._logger.summary(r.L_QUERY_SUBSCRIBE_DATA_R,s,t),s.isOk&&this._updateUserOnlineStatus(s.data.list)}))}_updateUserOnlineStatus(e,t=!0){let i=this._subscribeService.updateSubscribeUserOnlineStatus(e);i=i.filter((e=>e.details&&e.details.length>0)),t&&i.length>0&&this._event.subscribeUserStatusChanged(i)}_queryAndUpdateUserProfile(e,i=!0){return t(this,void 0,void 0,(function*(){const t=this._logger.createTraceId();this._logger.info(r.L_PULL_USER_PROFILE_T,JSON.stringify(e),t);const s=Uc.encode(il,{userId:e}),n=new Nr($s.pullUserProfile,s,this._currentUserId),{code:o,data:a}=yield this._ctx.send(n,sl);if(this._logger.info(r.L_PULL_USER_PROFILE_R,JSON.stringify({code:o,data:a}),t),o!==D.SUCCESS)return Ei(o);const l=this._subscribeService.updateSubscribeUserProfile(a.UserProfile);return i&&l.length>0&&this._event.subscribeUserStatusChanged(l),gi(a.UserProfile)}))}updateUserStatus(e){return t(this,void 0,void 0,(function*(){const t=Uc.decode(Za,e.pbData);if(t.subType===oe.ONLINE_STATUS)this._updateUserOnlineStatus([t]);else if(t.subType===oe.USER_PROFILE)this._queryAndUpdateUserProfile([t.subUserId]);else if(t.subType===oe.FRIEND_ONLINE_STATUS){const e=t.data.map((e=>({changeTime:e.versionTime,eventValue:e.value,platform:e.platformInfo})));this._event.subscribeUserStatusChanged([{userId:t.subUserId,subscribeType:t.subType,subscribeTime:0,expiry:0,details:e}])}else if(t.subType===oe.FRIEND_USER_PROFILE){const e=yield this._queryAndUpdateUserProfile([t.subUserId]),{data:i}=e;i&&this._event.subscribeUserStatusChanged([{userId:t.subUserId,subscribeType:t.subType,subscribeTime:0,expiry:0,userProfile:xt(t.subUserId,i[0].userProfile,i[0].userExtProfile)}])}}))}getSubscribeUserStatus(e,t){return this._subscribeService.getSubscribeUserStatus(e,t)}getSubscribeUserList(e,t,i){return this._subscribeService.getSubscribeUserList(e,t,i)}updateSubscribeRelation(e,i,s,n=0){return t(this,void 0,void 0,(function*(){const t=Uc.encode(qa,{subType:i,opType:s,expiry:n,subUsers:e.map((e=>({subUserId:e})))}),r=yield this._ctx.query($s.updUserSub,this._currentUserId,t,Ja),{code:o,data:a,isOk:l}=r;if(o===D.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT)return Ei(o,"",a.subUsers.map((e=>e.subUserId)));if(!l)return r.wipe();const{subTime:c}=a;return this._subscribeService.updateSubscribeRelation([{subType:i,subTime:c,expiry:n,opType:s,subUsers:e.map((e=>({subUserId:e})))}]),s===ae.SUBSCRIBE&&(i===oe.ONLINE_STATUS?this._queryAndUpdateUserOnlineStatus(e):i===oe.USER_PROFILE&&this._queryAndUpdateUserProfile(e,!1)),r.wipe()}))}getUserProfiles(e){return t(this,void 0,void 0,(function*(){const{needQueryUserIds:t,list:i}=this._subscribeService.getUserProfiles(e);if(0===t.length)return gi(i);const s=yield this._queryAndUpdateUserProfile(t,!1);if(!s.isOk)return s.wipe();const n=s.data.map((e=>xt(e.userId,e.userProfile,e.userExtProfile)));return gi([...i,...n])}))}syncOwnProfile(e=!1){return t(this,void 0,void 0,(function*(){if(!this._isOpenUserProfile)return Ei(D.RC_USER_PROFILE_SERVICE_UNAVAILABLE);const t=this._logger.createTraceId();this._logger.info(r.L_PULL_OWN_PROFILE_T,"",t);const i=Uc.encode(nl,{nothing:1}),s=yield this._ctx.query($s.pullOwnProfile,this._currentUserId,i,el);if(this._logger.summary(r.L_PULL_OWN_PROFILE_R,s,t),!s.isOk)return s.wipe();const{userExtProfile:n,userProfile:o,version:a,userId:l}=s.data,c=xt(l,o,n);return this._subscribeService.updateOwnProfile(c,a),e&&this._event.ownUserProfileChanged(c),gi(c)}))}getOwnProfile(){return t(this,void 0,void 0,(function*(){const e=this._subscribeService.getOwnProfile();return e?gi(e):this.syncOwnProfile()}))}updateOwnProfile(e,i){return t(this,void 0,void 0,(function*(){this._subscribeService.updateOwnProfile(e,i)}))}}var k_;class x_ extends Wi{constructor(e,t,i,s){super(e,t,i,s),k_.set(this,gt)}setTimestamp4RealtimeLog(e){s(this,k_,e,"f")}getTimestamp4RealtimeLog(){return i(this,k_,"f")}}k_=new WeakMap;let F_=null;const B_="RC_LOGS",H_="RC_STATISTICS",j_={[B_]:["level","time"],[H_]:["level","time"]},Y_=(e,t,i)=>new Promise((s=>{const n=e.transaction(t,"readwrite").objectStore(t).index("time"),r=IDBKeyRange.upperBound(Date.now()-i),o=n.openCursor(r);o.onsuccess=e=>{const t=e.target.result;t?(t.delete(),t.continue()):s()},o.onerror=()=>{s()}}));let W_=null;const q_=e=>t(void 0,void 0,void 0,(function*(){const t=yield F_;if(!t)return;const{db:i}=t;yield Y_(i,B_,e),yield Y_(i,H_,e),W_=setTimeout((()=>q_(e)),6e5)})),J_=(e,t,i=168)=>{F_||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==Eo.runtimeInfo.type?F_=new Promise((s=>{const n=window.indexedDB;(e=>{const t=window.indexedDB;t.databases&&t.databases().then((i=>{i.forEach((i=>{i.name&&e.includes(i.name)&&t.deleteDatabase(i.name)}))}))})(["RC_ENGINE_DB",`RC_STATISTIC_${e}`]);const o=`RC_LOGS_${e}`,a=n.open(o,2);a.onerror=e=>{t.error(r.L_LOGDB_OPEN_FAILED_E,e.target.error),s(null)},a.onsuccess=n=>{const o=n.target.result;o?(o.onclose=e=>{F_=null,t.warn(r.L_LOGDB_CLOSED_S)},o.onerror=e=>{F_=null,t.error(r.L_LOGDB_ERROR_E,e.target.error)},o.onabort=e=>{t.info(r.L_LOGDB_ABORT_S,e.target.error)},q_(3600*Math.max(24,Math.min(168,i))*1e3),s({appkey:e,db:o})):s(null)},a.onupgradeneeded=e=>{const t=e.target.result;Object.keys(j_).forEach((e=>{t.objectStoreNames.contains(e)&&t.deleteObjectStore(e);const i=t.createObjectStore(e,{autoIncrement:!0});j_[e].forEach((e=>i.createIndex(e,e,{unique:!1})))}))}})):t.warn(r.L_UNSUPPORT_INDEXDB_O))},K_=[],Q_=(e,t,i)=>new Promise((s=>{const n=e.transaction(t,"readwrite");n.oncomplete=s,n.onabort=s;const r=n.objectStore(t);i.forEach((e=>{try{r.add(e)}catch(t){null===console||void 0===console||console.error("write failed ->",e,t)}}))})),X_=[];let z_=!1;const Z_=e=>t(void 0,void 0,void 0,(function*(){if(z_||0===X_.length)return;z_=!0;const t=X_.filter((e=>e.level<Yi.FATAL)),i=X_.filter((e=>e.level>=Yi.FATAL));X_.length=0,yield Q_(e,B_,i),yield Q_(e,H_,t),z_=!1,0===X_.length&&K_.length>0&&(K_.forEach((e=>e.close())),K_.length=0),setTimeout((()=>Z_(e)))})),$_=()=>{const e=os();return e.setLogReader(((e,i,s,n,r=B_)=>t(void 0,void 0,void 0,(function*(){const t=yield F_;return t?new Promise((o=>{const{db:a}=t,l=a.transaction(r,"readonly").objectStore(r),c=[],_=IDBKeyRange.bound(e,i),d=l.index("time").openCursor(_);d.onsuccess=e=>{const t=e.target.result;if(t){const e=t.value;e.level<=s&&(n?e.sessionId===ht:e.level>=0)&&c.push(e),t.continue()}else o({logs:c})},d.onerror=()=>{o({logs:[]})}})):{logs:[]}})))),e.setLogWriter((e=>{(e=>{t(void 0,void 0,void 0,(function*(){const t=yield F_;if(t){if(e.content&&Et(e.content))try{e.content=JSON.parse(e.content)}catch(e){}X_.push(e),Z_(t.db)}}))})(e)})),e},ed=144e5;if("undefined"!=typeof window){const e=(e,t)=>{const i=t.map((({sessionId:e,time:t,type:i,level:s,tag:n,traceId:r,loggerId:o,content:a})=>`${e},${t},${i},${s},${n},${r},${o},"${a}"\n`)),s=new Blob(i,{type:"text/csv"}),n=URL.createObjectURL(s),r=document.createElement("a");r.href=n,r.download=`${e}.csv`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)};window.__rongcloud_devtools__={logger:{get(i,s=Date.now()-ed,n=Date.now()){return t(this,void 0,void 0,(function*(){s=s<0?Date.now()+s:s,(n=n<=0?Date.now():n)-s>ed&&(s=n-ed);const t=os(),o=new x_(i,"RC-IM","IM",t);o.debug(r.T,`get logs: startTime ${s} endTime ${n}`),J_(i,o);const{logs:a}=yield t.read(s,n,Yi.DEBUG,!1);o.debug(r.T,`get logs ${a.length}`),e(`${i}-${s}-${n}`,a)}))}}}}class td extends qi{constructor(e,t,i,s,n){const{type:r,version:o}=Eo.runtimeInfo;super(e,`${r}|${o}|${t.getSessionId()}|${Eo.connectPlatform}`,s,t),Object.defineProperty(this,"tableName",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"appStorage",{enumerable:!0,configurable:!0,writable:!0,value:n})}getDeviceId(){return this.appStorage.deviceId}send(e){return Eo.httpReq(e)}checkStart(e){const i=Object.create(null,{checkStart:{get:()=>super.checkStart}});return t(this,void 0,void 0,(function*(){return yield((e,i)=>t(void 0,void 0,void 0,(function*(){const t=i.get("logReporter");t[`REPORT_SESSION_${e}`]={sessionId:ht},i.set("logReporter",t)})))(e.userId,this.appStorage),i.checkStart.call(this,e,this.tableName)}))}compressLogs(e){return t(this,void 0,void 0,(function*(){return{success:!0,data:Vs(e.map(Ji).join(""))}}))}realtimeReport(e,i,s){const n=Object.create(null,{realtimeReport:{get:()=>super.realtimeReport}});return t(this,void 0,void 0,(function*(){return n.realtimeReport.call(this,e,i,s,this.tableName)}))}}class id extends td{constructor(e,t,i){super(e,t,B_,t.proxy,i)}isReporter(){return t(this,void 0,void 0,(function*(){const e=yield((e,i)=>t(void 0,void 0,void 0,(function*(){const t=i.get("logReporter")[`REPORT_SESSION_${e}`];return(null==t?void 0:t.sessionId)===ht})))(this.userId,this.appStorage);return e}))}report(e,i,s,n,r,o,a=!1){const l=Object.create(null,{report:{get:()=>super.report}});return t(this,void 0,void 0,(function*(){const t=yield this.isReporter();if(!this.userId||t)return l.report.call(this,e,i,s,n,r,o,a)}))}}class sd extends td{constructor(e,t,i){super(e,t,H_,t.proxy,i)}}var nd,rd,od,ad,ld;class cd extends di{constructor(e,t,s){super("WebConversationSettings"),nd.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_storage",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:s}),rd.set(this,!1),this._ctx.on("sCmd",i(this,nd,"m",ad),this),this._ctx.on("onConnected",i(this,nd,"m",od),this)}_handleSyncData(e){return t(this,void 0,void 0,(function*(){return(yield i(this,nd,"m",ld).call(this,e)).trans((()=>({version:this._storage.get("conversationStatusVersion")})))}))}syncDataFromServer(){return t(this,void 0,void 0,(function*(){const e=this._storage.get("conversationStatusVersion");return yield i(this,nd,"m",ld).call(this,e),this._storage.get("conversationStatusVersion")}))}}rd=new WeakMap,nd=new WeakSet,od=function(){s(this,rd,!0,"f")},ad=function(e,t){const{type:i,time:s}=t;if(3===i)this.push(s),e.stopPropagation()},ld=function(e){return t(this,void 0,void 0,(function*(){const{logger:t}=this._ctx,n=t.createTraceId();t.info(r.L_PULL_CONVERSATION_SETTINGS_T,JSON.stringify({version:e}),n);const o=Uc.encode(ra,{time:e}),a=yield this._ctx.query($s.pullSeAtts,this._ctx.currentUserId,o,oa);if(a.isOk){const e=this._storage.updateBySessionStates(a.data.state);e.length&&this._emitter.emit("conversationStatusChanged",e)}const l=this._storage.get("conversationStatusVersion");return t.summary(r.L_PULL_CONVERSATION_SETTINGS_R,a,n,{version:e,nextVersion:l},(e=>({respVer:e.version}))),i(this,rd,"f")&&(s(this,rd,!1,"f"),this._emitter.emit("conversationStatusSynced",a.code)),a.wipe()}))};class _d{constructor(){Object.defineProperty(this,"_memData",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}syncDataFromLocalStorage(e){this._memData=this._syncDataHandler(e)}get(e){return this._memData[e].value}set(e,t){const i=this._memData[e],{key:s,stringify:n}=i;i.value=t;const r=n?JSON.stringify(t):t;Eo.localStorage.setItem(s,r)}delete(e){const t=this._memData[e];delete this._memData[e];const{key:i}=t;Eo.localStorage.removeItem(i)}}const dd=e=>{var t;return`${null!==(t=e.channelId)&&void 0!==t?t:""}_${e.conversationType}_${e.targetId}`},ud=e=>{const[t,i,...s]=e.split("_");return{channelId:t,conversationType:parseInt(i,10),targetId:s.join("_")}};var hd,gd,Ed,Id,Td;function fd(e){if(!e)return;if(Array.isArray(e))return e;return Object.entries(e).map((([e,{isTop:t}])=>({tagId:e,isTop:t})))}const Rd=()=>({latestMessage:null,lastReadTime:0,firstUnreadMessageType:"",firstUnreadMessageUId:"",firstUnreadTime:0,unreadCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,hasMentioned:!1,mentionedInfo:void 0,isTop:!1,notificationLevel:Ee.NOT_SET,translateStrategy:Ms.DEFAULT,tags:[],channelType:X.PUBLIC,operationTime:0,draft:"",hidden:!1,includeRobot:!1,version:0});class Ad{constructor(e){hd.set(this,void 0),gd.set(this,void 0),Ed.set(this,void 0),Id.set(this,Rd()),Td.set(this,[]),s(this,hd,e.conversationType,"f"),s(this,gd,e.targetId,"f"),s(this,Ed,e.channelId||"","f")}get conversationType(){return i(this,hd,"f")}get targetId(){return i(this,gd,"f")}get channelId(){return i(this,Ed,"f")}get version(){return i(this,Id,"f").version||0}get channelType(){return i(this,Id,"f").channelType}get hidden(){return!!i(this,Id,"f").hidden}get isTop(){return!!i(this,Id,"f").isTop}get notificationLevel(){return i(this,Id,"f").notificationLevel||Ee.NOT_SET}get translateStrategy(){return i(this,Id,"f").translateStrategy||Ms.DEFAULT}get tags(){return(i(this,Id,"f").tags||[]).map((e=>({tagId:e.tagId,isTop:e.isTop})))}get unreadCount(){return i(this,Id,"f").unreadCount||0}get unreadMentionedCount(){return i(this,Id,"f").unreadMentionedCount||0}get unreadMentionedMeCount(){return i(this,Id,"f").unreadMentionedMeCount||0}get hasMentioned(){return!!i(this,Id,"f").hasMentioned}get mentionedInfo(){return i(this,Id,"f").mentionedInfo}get lastReadTime(){return i(this,Id,"f").lastReadTime||0}get firstUnreadTime(){return i(this,Id,"f").firstUnreadTime||0}get firstUnreadMessageUId(){return i(this,Id,"f").firstUnreadMessageUId||""}get firstUnreadMessageType(){return i(this,Id,"f").firstUnreadMessageType||""}get latestMessage(){return i(this,Id,"f").latestMessage||null}get operationTime(){return i(this,Id,"f").operationTime||0}get draft(){return i(this,Id,"f").draft||""}get firstUnreadMessage(){return this.firstUnreadTime?{sentTime:this.firstUnreadTime,messageType:this.firstUnreadMessageType,messageUId:this.firstUnreadMessageUId}:null}get identifier(){return{conversationType:i(this,hd,"f"),targetId:i(this,gd,"f"),channelId:i(this,Ed,"f")}}get key(){return dd(this.identifier)}get includeRobot(){return!!i(this,Id,"f").includeRobot}toIReceivedConversation(){return Object.assign(Object.assign({},this.identifier),{latestMessage:this.latestMessage,unreadMessageCount:this.unreadCount,unreadMentionedCount:this.unreadMentionedCount,unreadMentionedMeCount:this.unreadMentionedMeCount,hasMentioned:this.hasMentioned,mentionedInfo:this.mentionedInfo,lastUnreadTime:0,notificationLevel:this.notificationLevel,translateStrategy:this.translateStrategy,notificationStatus:fe(this.notificationLevel),isTop:this.isTop,operationTime:this.operationTime,firstUnreadMessage:this.firstUnreadMessage,versionTime:0,draft:this.draft,includeRobot:this.includeRobot})}toStoragItem(e){const t={};return this.hidden&&(t.h=1),e||(this.isTop&&(t.to=1),this.notificationLevel!==Ee.NOT_SET&&(t.nl=this.notificationLevel),this.tags.length>0&&(t.tg=this.tags),this.translateStrategy!==Ms.DEFAULT&&(t.ts=this.translateStrategy)),t}remove(){this.updateAttrs(Object.assign(Object.assign({},Rd()),{tags:this.tags,isTop:this.isTop,notificationLevel:this.notificationLevel,translateStrategy:this.translateStrategy,hidden:!0}))}clearUnreadCount(e){const t={unreadCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,hasMentioned:!1,mentionedInfo:void 0,lastReadTime:e,firstUnreadTime:0,firstUnreadMessageType:void 0,firstUnreadMessageUId:void 0};return t.version=Math.max(this.version,e),this.updateAttrs(t,e)}updateAttrs(e,t=0){const s={},n={latestMessage:"latestMessage",unreadCount:"unreadMessageCount",hasMentioned:"hasMentioned",mentionedInfo:"mentionedInfo",notificationLevel:"notificationLevel",tags:"tags",isTop:"isTop",translateStrategy:"translateStrategy",unreadMentionedCount:"unreadMentionedCount",unreadMentionedMeCount:"unreadMentionedMeCount",lastReadTime:void 0,firstUnreadMessageType:void 0,firstUnreadMessageUId:void 0,firstUnreadTime:void 0,channelType:void 0,operationTime:void 0,draft:void 0,includeRobot:void 0,hidden:void 0,version:void 0};return Object.entries(n).forEach((([n,r])=>{const o=n;if(!Object.prototype.hasOwnProperty.call(e,o))return;const a=e[o];i(this,Id,"f")[o]!==a&&(i(this,Id,"f")[o]=a,r&&(s[r]={time:t,val:a}))})),Object.keys(s).length>0?s:null}addRecvMessageRecord(e,t,s){i(this,Td,"f").push([e,t,s]),this.removeRecvMessageRecords(e-12e4)}removeRecvMessageRecords(e){s(this,Td,i(this,Td,"f").filter((([t])=>t<=e)),"f")}calibrateUnreadCount(e,t){const{mentionCnt:s,mentionMeCnt:n,clearTime:r,firstUnreadMsg:o,cnt:a}=e,l=e.cutOffTime,c=s>0,_=n>0,d=c?{type:_?K.SINGAL:K.ALL,userIdList:_?[t]:void 0}:void 0,u={unreadCount:a,unreadMentionedCount:s,unreadMentionedMeCount:n,lastReadTime:r,firstUnreadTime:null==o?void 0:o.msgTime,firstUnreadMessageType:null==o?void 0:o.className,firstUnreadMessageUId:null==o?void 0:o.msgId,hasMentioned:c,mentionedInfo:d,version:l};i(this,Td,"f").forEach((([e,t,i])=>{e<=l||(u.version=Math.max(u.version,e),u.unreadCount+=t,i===K.SINGAL?u.unreadMentionedMeCount+=t:i===K.ALL&&(u.unreadMentionedCount+=t))}));const h=this.updateAttrs(u,r);return this.removeRecvMessageRecords(l),h}}hd=new WeakMap,gd=new WeakMap,Ed=new WeakMap,Id=new WeakMap,Td=new WeakMap;class pd extends Ad{toStoragItem(e){const t=super.toStoragItem(e);return this.unreadCount>0&&(t.c=this.unreadCount),this.unreadMentionedCount>0&&(t.mc=this.unreadMentionedCount),this.unreadMentionedMeCount>0&&(t.mmc=this.unreadMentionedMeCount),this.hasMentioned&&(t.hm=1),this.mentionedInfo&&(t.m=this.mentionedInfo),this.firstUnreadMessageUId&&(t.fuid=this.firstUnreadMessageUId),this.firstUnreadMessageType&&(t.fumt=this.firstUnreadMessageType),this.firstUnreadTime&&(t.fut=this.firstUnreadTime),this.lastReadTime&&(t.rt=this.lastReadTime),this.version&&(t.v=this.version),t}}class md extends Ad{toIReceivedConversation(){const e=super.toIReceivedConversation();return e.channelType=this.channelType,e}isDefaultChannel(){return!this.channelId||"RCDefault"===this.channelId}}var Sd,vd,Nd;const Od=e=>`${e.targetId}_${e.channelId||""}`;class yd extends _d{constructor(e){super(),Sd.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_conversationCachePolicy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"models",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"ugSentRecord",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const t=this._ctx.initOptions.conversationCachePolicy;this._conversationCachePolicy=t?{limit:"number"==typeof t.limit?t.limit:1e3,ultraGroupLimit:"number"==typeof t.ultraGroupLimit?t.ultraGroupLimit:5e3,customEviction:"function"==typeof t.customEviction?t.customEviction:void 0}:void 0}get enableReadReceiptStorage(){return this._ctx.initOptions.enableReadReceiptStorage}_syncDataHandler(e){const{localStorage:t}=Eo,{appkey:s,currentUserId:n,isDisableEmptyUGChannelId:r,isMemSesAttrs:o}=e,a=$e(s,n),l=Ze(s,n),c=et(s,n),_=Qe(s,n),d=Ke(s,n),u=Xe(s,n),h=ze(s,n),g=it(s,n),E=ot(s,n);t.removeItem(`RC-con-s-ver-${s}-${n}`),o&&t.removeItem(d),this.ugSentRecord.clear();const I=t.getItem(a)||"0",T=t.getItem(l)||"0",f=t.getItem(c)||"1",R=t.getItem(d)||"0",A=JSON.parse(t.getItem(h)||"{}"),p=JSON.parse(t.getItem(_)||"{}"),m=JSON.parse(t.getItem(u)||"{}"),S=JSON.parse(t.getItem(g)||"{}"),v=JSON.parse(t.getItem(E)||"{}");i(this,Sd,"m",vd).call(this,p,m,A,r);const N=Object.entries(v);N.length>0&&N.forEach((([e,t])=>{Object.entries(t).forEach((([e,i])=>{delete i.d,i.t<this._ctx.serverTime-We&&delete t[e]})),0===Object.keys(t).length&&delete v[e]}));return{inboxTime:{value:parseInt(I,10)||0,key:a},outboxTime:{value:parseInt(T,10)||0,key:l},broadcastTime:{value:parseInt(f,10)||0,key:c},conversationStatus:{value:p,key:_,stringify:!0},ultraGroupStatus:{value:m,key:u,stringify:!0},conversationStatusVersion:{value:parseInt(R,10)||0,key:d},conversationTypeGlobalSettings:{value:A,key:h,stringify:!0},sentRecord:{value:S,key:g,stringify:!0},readReceiptRecord:{value:v,key:E,stringify:!0}}}addUGSentRecord(e,t){this.ugSentRecord.set(e,t)}removeUGSentRecordByTimestamp(e){Array.from(this.ugSentRecord.entries()).forEach((([t,i])=>{i<=e&&this.ugSentRecord.delete(t)}))}isLocalSentUGMessage(e){return this.ugSentRecord.has(e)}addSentRecord(e,t){const i=this.get("sentRecord");i[e]=t,this.set("sentRecord",i)}removeSentRecord(e){const t=this.get("sentRecord");delete t[e],this.set("sentRecord",t)}removeSentRecordByTimestamp(e){const t=this.get("sentRecord");Object.keys(t).forEach((i=>{t[i]<=e&&delete t[i]})),this.set("sentRecord",t)}hasSentRecord(e){return!!this.get("sentRecord")[e]}addReadReceiptRequest(e,t){const{conversationType:i,content:s,senderUserId:n,sentTime:r}=e,{messageUId:o}=s;if(i!==w.GROUP||!o)return!1;if(!this.enableReadReceiptStorage)return!0;if(r<this._ctx.serverTime-We)return!1;const a=this.get("readReceiptRecord"),l=Od(e),c=a[l]=a[l]||{};c[o]={t:e.sentTime,sId:n===t?void 0:n};const _=Object.entries(c);if(_.length>30){const[e,t]=_.sort(((e,t)=>e[1].t-t[1].t)).pop();delete c[e]}return this.set("readReceiptRecord",a),!0}handleReadReceiptResponse(e,t){const{conversationType:i,content:s,senderUserId:n,sentTime:r}=e;if(i!==w.GROUP||!s.receiptMessageDic)return!1;if(!this.enableReadReceiptStorage)return!0;const o=n===t,{receiptMessageDic:a}=s,l=Od(e),c=this.get("readReceiptRecord"),_=c[l]=c[l]||{};if(o)Object.entries(a).forEach((([e,t])=>{t.forEach((e=>{delete _[e]}))})),0===Object.keys(_).length&&delete c[l];else{(a[t]||[]).forEach((e=>{const t=_[e];t&&(t.us=(t.us||[]).concat(n))}))}return this.set("readReceiptRecord",c),!0}getReadReceiptResponseUsers(e,t){var i;return(null===(i=(this.get("readReceiptRecord")[Od(e)]||{})[t])||void 0===i?void 0:i.us)||[]}createReadReceiptResponseContent(e){const t=this.get("readReceiptRecord")[Od(e)]||{},i={receiptMessageDic:{}};return Object.entries(t).forEach((([e,t])=>{t.sId&&(i.receiptMessageDic[t.sId]=i.receiptMessageDic[t.sId]||[],i.receiptMessageDic[t.sId].push(e))})),i}syncDataFromLocalStorage(e){super.syncDataFromLocalStorage(e),this.models.clear(),i(this,Sd,"m",Nd).call(this)}setConversationTypeNotificationLevel(e,t){const i=this.get("conversationTypeGlobalSettings");t===Ee.NOT_SET?delete i[e]:i[e]={nl:t},this.set("conversationTypeGlobalSettings",i)}getConversationTypeNotificationLevel(e){var t;return(null===(t=this.get("conversationTypeGlobalSettings")[e])||void 0===t?void 0:t.nl)||Ee.NOT_SET}getOrCreateModel(e,t){const{conversationType:i,targetId:s,channelId:n}=e;let r=this.getModel(e);if(!r){r=e.conversationType===w.ULTRA_GROUP?new md(e):new pd(e);const n=(i===w.PRIVATE||i===w.SYSTEM)&&this._ctx.robots.some((e=>e.robotId===s));r.updateAttrs({includeRobot:n}),t&&this.models.set(r.key,r)}return r}updateConversationStorage(e){const t=this.get("ultraGroupStatus"),i=this.get("conversationStatus");let s=!1,n=!1;const{isMemSesAttrs:r}=this._ctx;e.forEach((e=>{const{conversationType:o,key:a}=e,l=e.toStoragItem(r),c=Object.keys(l),_=0===c.length||1===c.length&&"h"===c[0],d=o===w.ULTRA_GROUP;d?n=!0:s=!0;const u=d?t:i;_?delete u[a]:u[a]=l})),s&&this._updateConversationStorage("conversationStatus",i),n&&this._updateConversationStorage("ultraGroupStatus",t)}_updateConversationStorage(e,t){if(!this._conversationCachePolicy)return void this.set(e,t);const{limit:i,ultraGroupLimit:s,customEviction:n}=this._conversationCachePolicy;if("ultraGroupStatus"===e&&this._ctx.isMemSesAttrs)return;const o="conversationStatus"===e?i:s;let a=Object.entries(t);if(a.length<=o)return void this.set(e,t);let l=a.map((([e,t])=>this.getModel(ud(e)))).filter((e=>!!e));if(n){const e=l.map((e=>e.toIReceivedConversation()));try{a=n(e).map((e=>{const i=dd(e);return[i,t[i]]})).filter((e=>!!e[1]))}catch(e){this._ctx.logger.error(r.L_EXEC_CUSTOM_CONVERSATION_STORAGE_EVICTION_E,(null==e?void 0:e.message)||"unknown error")}}else l=this._defaultEviction(l,o),a=l.map((e=>{const{key:i}=e;return[i,t[i]]})).filter((e=>!!e[1]));this.set(e,Object.fromEntries(a))}_defaultEviction(e,t){return e.sort(((e,t)=>{const i=e.version,s=t.version,n=e.isTop?1:0;return(t.isTop?1:0)-n||s-i})).slice(0,t)}updateBySessionStates(e){if(!(null==e?void 0:e.length))return[];let t=this.get("conversationStatusVersion");const i=new Map,s=new Set;e.forEach((e=>{const{channelId:n,busChannel:r,type:o,stateItem:a}=e,l=e.time;t=Math.max(t,l);const c={};if(null==a||a.forEach((e=>{const{tags:t,sessionStateType:i,value:s}=e;switch(i){case Cc.IsSilent:c.notificationLevel=parseInt(s,10);break;case Cc.IsTop:c.isTop="1"===s;break;case Cc.Tags:c.tags=t;break;case Cc.AutoTrans:c.translateStrategy=parseInt(s,10)}})),!n)return void(void 0!==c.notificationLevel&&this.setConversationTypeNotificationLevel(o,c.notificationLevel));const _={conversationType:o,targetId:n,channelId:r},d=this.getOrCreateModel(_,!0);s.add(d);const u=d.updateAttrs(c,l);if(u)if(i.has(d)){const e=i.get(d);Object.assign(e,u)}else i.set(d,u)})),this.set("conversationStatusVersion",t),this.updateConversationStorage(Array.from(s));return Array.from(i.entries()).map((([e,t])=>({conversation:e.toIReceivedConversation(),updatedItems:t})))}addRelations(e,t){e.forEach((e=>{const{userId:i,type:s,busChannel:n}=e,r={conversationType:s,targetId:i,channelId:n},o=this.getOrCreateModel(r,!0),a=((e,t)=>{var i,s,n;const{msg:r,isBot:o}=e;return{latestMessage:r?y_(r,t,!1,e.userId):void 0,lastReadTime:e.readMsgTime,unreadCount:e.unreadCount,operationTime:e.versionTime,unreadMentionedCount:e.remindCount,unreadMentionedMeCount:e.remindMeCount,firstUnreadMessageType:null===(i=e.msgInfo)||void 0===i?void 0:i.className,firstUnreadMessageUId:null===(s=e.msgInfo)||void 0===s?void 0:s.msgId,firstUnreadTime:null===(n=e.msgInfo)||void 0===n?void 0:n.msgTime,includeRobot:!!o}})(e,t);s===w.ULTRA_GROUP?o.updateAttrs(a):o.updateAttrs({latestMessage:a.latestMessage,operationTime:a.operationTime,includeRobot:a.includeRobot,hidden:!1})}))}getDrafts(e){const t=this.getModel(e);return(null==t?void 0:t.draft)||""}setDrafts(e,t){this.getOrCreateModel(e,!0).updateAttrs({draft:t})}deleteDrafts(e){const t=this.getModel(e);t&&t.updateAttrs({draft:""})}getCachedUGConversation(e,t){const i={conversationType:w.ULTRA_GROUP,targetId:e,channelId:t},s=this.getModel(i);return(null==s?void 0:s.toIReceivedConversation())||null}getAllUGModels(){const e=this.models.values();return Array.from(e).filter((e=>e.conversationType===w.ULTRA_GROUP)).map((e=>e))}getAllSGModels(){const e=this.models.values();return Array.from(e).filter((e=>e.conversationType!==w.ULTRA_GROUP)).map((e=>e))}getAllModels(){return Array.from(this.models.values())}getModel(e){const{conversationType:t,targetId:i}=e,s=dd(e),n=this.models.get(s);if(!n)return null;const r=(t===w.PRIVATE||t===w.SYSTEM)&&this._ctx.robots.some((e=>e.robotId===i));return n.updateAttrs({includeRobot:r}),n}removeConversation(e){const t=this.getModel(e);t&&(t.remove(),this.updateConversationStorage([t]))}getAllUnreadCount(e,t){let i=0;return this.getAllSGModels().forEach((s=>{var n;const{conversationType:r}=s;e.includes(r)&&(s.notificationLevel>Ee.NOT_SET&&!t||(i+=null!==(n=s.unreadCount)&&void 0!==n?n:0))})),i}getTagConversationCountMap(){const e=new Map;return this.getAllModels().forEach((t=>{const{tags:i}=t;i.length>0&&i.forEach((i=>{e.set(i.tagId,(e.get(i.tagId)||[]).concat(t.identifier))}))})),e}clearConversationUnreadCount(e,t){const i=this.getModel(e);if(!i)return null;const s=i.clearUnreadCount(t);return this.updateConversationStorage([i]),s?{conversation:i.toIReceivedConversation(),updatedItems:s}:null}}Sd=new WeakSet,vd=function(e,t,i,s){Object.keys(e).forEach((t=>{const s=ud(t);W(s.conversationType,G)?s.targetId||(i[s.conversationType]={nl:e[t].nl||Ee.NOT_SET},delete e[t]):delete e[t]})),Object.keys(t).forEach((e=>{const n=ud(e);if(n.conversationType===w.ULTRA_GROUP)return n.targetId?void(s&&!n.channelId&&delete t[e]):(i[n.conversationType]={nl:t[e].nl||Ee.NOT_SET},void delete t[e]);delete t[e]}))},Nd=function(){[...Object.entries(this.get("conversationStatus")),...Object.entries(this.get("ultraGroupStatus"))].forEach((([e,t])=>{const i=ud(e);if(!W(i.conversationType,k))return;this.getOrCreateModel(i,!0).updateAttrs((e=>{const{c:t,mc:i,mmc:s,hm:n,m:r,fut:o,fuid:a,fumt:l,nl:c,to:_,tg:d,rt:u,h:h,ts:g,v:E}=e;return{isTop:!!_,notificationLevel:c,tags:fd(d),unreadCount:t,unreadMentionedCount:i,unreadMentionedMeCount:s,hasMentioned:!!n,mentionedInfo:r,firstUnreadTime:o,firstUnreadMessageUId:a,firstUnreadMessageType:l,lastReadTime:u,hidden:!!h,translateStrategy:g,version:E||u}})(t),0)}))};function Cd(e){let t=e.length;for(;--t>=0;)e[t]=0}const Md=256,bd=286,Ld=30,Ud=15,Pd=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]),Dd=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]),wd=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Gd=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vd=new Array(576);Cd(Vd);const kd=new Array(60);Cd(kd);const xd=new Array(512);Cd(xd);const Fd=new Array(256);Cd(Fd);const Bd=new Array(29);Cd(Bd);const Hd=new Array(Ld);function Yd(e,t,i,s,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=n,this.has_stree=e&&e.length}let Wd,qd,Jd;function Kd(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}Cd(Hd);const Qd=e=>e<256?xd[e]:xd[256+(e>>>7)],Xd=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},zd=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,Xd(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)},Zd=(e,t,i)=>{zd(e,i[2*t],i[2*t+1])},$d=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},eu=(e,t,i)=>{const s=new Array(16);let n,r,o=0;for(n=1;n<=Ud;n++)o=o+i[n-1]<<1,s[n]=o;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=$d(s[t]++,t))}},tu=e=>{let t;for(t=0;t<bd;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Ld;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},iu=e=>{e.bi_valid>8?Xd(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},su=(e,t,i,s)=>{const n=2*t,r=2*i;return e[n]<e[r]||e[n]===e[r]&&s[t]<=s[i]},nu=(e,t,i)=>{const s=e.heap[i];let n=i<<1;for(;n<=e.heap_len&&(n<e.heap_len&&su(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!su(t,s,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=s},ru=(e,t,i)=>{let s,n,r,o,a=0;if(0!==e.sym_next)do{s=255&e.pending_buf[e.sym_buf+a++],s+=(255&e.pending_buf[e.sym_buf+a++])<<8,n=e.pending_buf[e.sym_buf+a++],0===s?Zd(e,n,t):(r=Fd[n],Zd(e,r+Md+1,t),o=Pd[r],0!==o&&(n-=Bd[r],zd(e,n,o)),s--,r=Qd(s),Zd(e,r,i),o=Dd[r],0!==o&&(s-=Hd[r],zd(e,s,o)))}while(a<e.sym_next);Zd(e,256,t)},ou=(e,t)=>{const i=t.dyn_tree,s=t.stat_desc.static_tree,n=t.stat_desc.has_stree,r=t.stat_desc.elems;let o,a,l,c=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<r;o++)0!==i[2*o]?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):i[2*o+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,i[2*l]=1,e.depth[l]=0,e.opt_len--,n&&(e.static_len-=s[2*l+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)nu(e,i,o);l=r;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],nu(e,i,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,i[2*l]=i[2*o]+i[2*a],e.depth[l]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,i[2*o+1]=i[2*a+1]=l,e.heap[1]=l++,nu(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,s=t.max_code,n=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let c,_,d,u,h,g,E=0;for(u=0;u<=Ud;u++)e.bl_count[u]=0;for(i[2*e.heap[e.heap_max]+1]=0,c=e.heap_max+1;c<573;c++)_=e.heap[c],u=i[2*i[2*_+1]+1]+1,u>l&&(u=l,E++),i[2*_+1]=u,_>s||(e.bl_count[u]++,h=0,_>=a&&(h=o[_-a]),g=i[2*_],e.opt_len+=g*(u+h),r&&(e.static_len+=g*(n[2*_+1]+h)));if(0!==E){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,E-=2}while(E>0);for(u=l;0!==u;u--)for(_=e.bl_count[u];0!==_;)d=e.heap[--c],d>s||(i[2*d+1]!==u&&(e.opt_len+=(u-i[2*d+1])*i[2*d],i[2*d+1]=u),_--)}})(e,t),eu(i,c,e.bl_count)},au=(e,t,i)=>{let s,n,r=-1,o=t[1],a=0,l=7,c=4;for(0===o&&(l=138,c=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)n=o,o=t[2*(s+1)+1],++a<l&&n===o||(a<c?e.bl_tree[2*n]+=a:0!==n?(n!==r&&e.bl_tree[2*n]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,r=n,0===o?(l=138,c=3):n===o?(l=6,c=3):(l=7,c=4))},lu=(e,t,i)=>{let s,n,r=-1,o=t[1],a=0,l=7,c=4;for(0===o&&(l=138,c=3),s=0;s<=i;s++)if(n=o,o=t[2*(s+1)+1],!(++a<l&&n===o)){if(a<c)do{Zd(e,n,e.bl_tree)}while(0!=--a);else 0!==n?(n!==r&&(Zd(e,n,e.bl_tree),a--),Zd(e,16,e.bl_tree),zd(e,a-3,2)):a<=10?(Zd(e,17,e.bl_tree),zd(e,a-3,3)):(Zd(e,18,e.bl_tree),zd(e,a-11,7));a=0,r=n,0===o?(l=138,c=3):n===o?(l=6,c=3):(l=7,c=4)}};let cu=!1;const _u=(e,t,i,s)=>{zd(e,0+(s?1:0),3),iu(e),Xd(e,i),Xd(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var du=(e,t,i,s)=>{let n,r,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&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<Md;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),ou(e,e.l_desc),ou(e,e.d_desc),o=(e=>{let t;for(au(e,e.dyn_ltree,e.l_desc.max_code),au(e,e.dyn_dtree,e.d_desc.max_code),ou(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Gd[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=n&&(n=r)):n=r=i+5,i+4<=n&&-1!==t?_u(e,t,i,s):4===e.strategy||r===n?(zd(e,2+(s?1:0),3),ru(e,Vd,kd)):(zd(e,4+(s?1:0),3),((e,t,i,s)=>{let n;for(zd(e,t-257,5),zd(e,i-1,5),zd(e,s-4,4),n=0;n<s;n++)zd(e,e.bl_tree[2*Gd[n]+1],3);lu(e,e.dyn_ltree,t-1),lu(e,e.dyn_dtree,i-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),ru(e,e.dyn_ltree,e.dyn_dtree)),tu(e),s&&iu(e)},uu={_tr_init:e=>{cu||((()=>{let e,t,i,s,n;const r=new Array(16);for(i=0,s=0;s<28;s++)for(Bd[s]=i,e=0;e<1<<Pd[s];e++)Fd[i++]=s;for(Fd[i-1]=s,n=0,s=0;s<16;s++)for(Hd[s]=n,e=0;e<1<<Dd[s];e++)xd[n++]=s;for(n>>=7;s<Ld;s++)for(Hd[s]=n<<7,e=0;e<1<<Dd[s]-7;e++)xd[256+n++]=s;for(t=0;t<=Ud;t++)r[t]=0;for(e=0;e<=143;)Vd[2*e+1]=8,e++,r[8]++;for(;e<=255;)Vd[2*e+1]=9,e++,r[9]++;for(;e<=279;)Vd[2*e+1]=7,e++,r[7]++;for(;e<=287;)Vd[2*e+1]=8,e++,r[8]++;for(eu(Vd,287,r),e=0;e<Ld;e++)kd[2*e+1]=5,kd[2*e]=$d(e,5);Wd=new Yd(Vd,Pd,257,bd,Ud),qd=new Yd(kd,Dd,0,Ld,Ud),Jd=new Yd(new Array(0),wd,0,19,7)})(),cu=!0),e.l_desc=new Kd(e.dyn_ltree,Wd),e.d_desc=new Kd(e.dyn_dtree,qd),e.bl_desc=new Kd(e.bl_tree,Jd),e.bi_buf=0,e.bi_valid=0,tu(e)},_tr_stored_block:_u,_tr_flush_block:du,_tr_tally:(e,t,i)=>(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++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(Fd[i]+Md+1)]++,e.dyn_dtree[2*Qd(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{zd(e,2,3),Zd(e,256,Vd),(e=>{16===e.bi_valid?(Xd(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 hu=(e,t,i,s)=>{let n=65535&e,r=e>>>16&65535,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{n=n+t[s++]|0,r=r+n|0}while(--o);n%=65521,r%=65521}return n|r<<16};const gu=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var Eu=(e,t,i,s)=>{const n=gu,r=s+i;e^=-1;for(let i=s;i<r;i++)e=e>>>8^n[255&(e^t[i])];return~e},Iu={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"},Tu={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:fu,_tr_stored_block:Ru,_tr_flush_block:Au,_tr_tally:pu,_tr_align:mu}=uu,{Z_NO_FLUSH:Su,Z_PARTIAL_FLUSH:vu,Z_FULL_FLUSH:Nu,Z_FINISH:Ou,Z_BLOCK:yu,Z_OK:Cu,Z_STREAM_END:Mu,Z_STREAM_ERROR:bu,Z_DATA_ERROR:Lu,Z_BUF_ERROR:Uu,Z_DEFAULT_COMPRESSION:Pu,Z_FILTERED:Du,Z_HUFFMAN_ONLY:wu,Z_RLE:Gu,Z_FIXED:Vu,Z_DEFAULT_STRATEGY:ku,Z_UNKNOWN:xu,Z_DEFLATED:Fu}=Tu,Bu=258,Hu=262,ju=42,Yu=113,Wu=666,qu=(e,t)=>(e.msg=Iu[t],t),Ju=e=>2*e-(e>4?9:0),Ku=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Qu=e=>{let t,i,s,n=e.w_size;t=e.hash_size,s=t;do{i=e.head[--s],e.head[s]=i>=n?i-n:0}while(--t);t=n,s=t;do{i=e.prev[--s],e.prev[s]=i>=n?i-n:0}while(--t)};let Xu=(e,t,i)=>(t<<e.hash_shift^i)&e.hash_mask;const zu=e=>{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},Zu=(e,t)=>{Au(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,zu(e.strm)},$u=(e,t)=>{e.pending_buf[e.pending++]=t},eh=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},th=(e,t,i,s)=>{let n=e.avail_in;return n>s&&(n=s),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),i),1===e.state.wrap?e.adler=hu(e.adler,t,n,i):2===e.state.wrap&&(e.adler=Eu(e.adler,t,n,i)),e.next_in+=n,e.total_in+=n,n)},ih=(e,t)=>{let i,s,n=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-Hu?e.strstart-(e.w_size-Hu):0,c=e.window,_=e.w_mask,d=e.prev,u=e.strstart+Bu;let h=c[r+o-1],g=c[r+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(i=t,c[i+o]===g&&c[i+o-1]===h&&c[i]===c[r]&&c[++i]===c[r+1]){r+=2,i++;do{}while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&r<u);if(s=Bu-(u-r),r=u-Bu,s>o){if(e.match_start=t,o=s,s>=a)break;h=c[r+o-1],g=c[r+o]}}}while((t=d[t&_])>l&&0!=--n);return o<=e.lookahead?o:e.lookahead},sh=e=>{const t=e.w_size;let i,s,n;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Hu)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Qu(e),s+=t),0===e.strm.avail_in)break;if(i=th(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=Xu(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=Xu(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<Hu&&0!==e.strm.avail_in)},nh=(e,t)=>{let i,s,n,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,a=e.strm.avail_in;do{if(i=65535,n=e.bi_valid+42>>3,e.strm.avail_out<n)break;if(n=e.strm.avail_out-n,s=e.strstart-e.block_start,i>s+e.strm.avail_in&&(i=s+e.strm.avail_in),i>n&&(i=n),i<r&&(0===i&&t!==Ou||t===Su||i!==s+e.strm.avail_in))break;o=t===Ou&&i===s+e.strm.avail_in?1:0,Ru(e,0,0,o),e.pending_buf[e.pending-4]=i,e.pending_buf[e.pending-3]=i>>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,zu(e.strm),s&&(s>i&&(s=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+s),e.strm.next_out),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s,e.block_start+=s,i-=s),i&&(th(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===o);return a-=e.strm.avail_in,a&&(a>=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<=a&&(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-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?4:t!==Su&&t!==Ou&&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&&(th(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,r=n>e.w_size?e.w_size:n,s=e.strstart-e.block_start,(s>=r||(s||t===Ou)&&t!==Su&&0===e.strm.avail_in&&s<=n)&&(i=s>n?n:s,o=t===Ou&&0===e.strm.avail_in&&i===s?1:0,Ru(e,e.block_start,i,o),e.block_start+=i,zu(e.strm)),o?3:1)},rh=(e,t)=>{let i,s;for(;;){if(e.lookahead<Hu){if(sh(e),e.lookahead<Hu&&t===Su)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=Xu(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Hu&&(e.match_length=ih(e,i)),e.match_length>=3)if(s=pu(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=Xu(e,e.ins_h,e.window[e.strstart+3-1]),i=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=Xu(e,e.ins_h,e.window[e.strstart+1]);else s=pu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(Zu(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Ou?(Zu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Zu(e,!1),0===e.strm.avail_out)?1:2},oh=(e,t)=>{let i,s,n;for(;;){if(e.lookahead<Hu){if(sh(e),e.lookahead<Hu&&t===Su)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=Xu(e,e.ins_h,e.window[e.strstart+3-1]),i=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!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Hu&&(e.match_length=ih(e,i),e.match_length<=5&&(e.strategy===Du||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,s=pu(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=Xu(e,e.ins_h,e.window[e.strstart+3-1]),i=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++,s&&(Zu(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(s=pu(e,0,e.window[e.strstart-1]),s&&Zu(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&&(s=pu(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Ou?(Zu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Zu(e,!1),0===e.strm.avail_out)?1:2};function ah(e,t,i,s,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=n}const lh=[new ah(0,0,0,0,nh),new ah(4,4,8,4,rh),new ah(4,5,16,8,rh),new ah(4,6,32,32,rh),new ah(4,4,16,16,oh),new ah(8,16,32,32,oh),new ah(8,16,128,128,oh),new ah(8,32,128,256,oh),new ah(32,128,258,1024,oh),new ah(32,258,258,4096,oh)];function ch(){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=Fu,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),Ku(this.dyn_ltree),Ku(this.dyn_dtree),Ku(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),Ku(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ku(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 _h=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==ju&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Yu&&t.status!==Wu?1:0},dh=e=>{if(_h(e))return qu(e,bu);e.total_in=e.total_out=0,e.data_type=xu;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?ju:Yu,e.adler=2===t.wrap?0:1,t.last_flush=-2,fu(t),Cu},uh=e=>{const t=dh(e);var i;return t===Cu&&((i=e.state).window_size=2*i.w_size,Ku(i.head),i.max_lazy_match=lh[i.level].max_lazy,i.good_match=lh[i.level].good_length,i.nice_match=lh[i.level].nice_length,i.max_chain_length=lh[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},hh=(e,t,i,s,n,r)=>{if(!e)return bu;let o=1;if(t===Pu&&(t=6),s<0?(o=0,s=-s):s>15&&(o=2,s-=16),n<1||n>9||i!==Fu||s<8||s>15||t<0||t>9||r<0||r>Vu||8===s&&1!==o)return qu(e,bu);8===s&&(s=9);const a=new ch;return e.state=a,a.strm=e,a.status=ju,a.wrap=o,a.gzhead=null,a.w_bits=s,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=n+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<n+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=r,a.method=i,uh(e)};var gh={deflateInit:(e,t)=>hh(e,t,Fu,15,8,ku),deflateInit2:hh,deflateReset:uh,deflateResetKeep:dh,deflateSetHeader:(e,t)=>_h(e)||2!==e.state.wrap?bu:(e.state.gzhead=t,Cu),deflate:(e,t)=>{if(_h(e)||t>yu||t<0)return e?qu(e,bu):bu;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===Wu&&t!==Ou)return qu(e,0===e.avail_out?Uu:bu);const s=i.last_flush;if(i.last_flush=t,0!==i.pending){if(zu(e),0===e.avail_out)return i.last_flush=-1,Cu}else if(0===e.avail_in&&Ju(t)<=Ju(s)&&t!==Ou)return qu(e,Uu);if(i.status===Wu&&0!==e.avail_in)return qu(e,Uu);if(i.status===ju&&0===i.wrap&&(i.status=Yu),i.status===ju){let t=Fu+(i.w_bits-8<<4)<<8,s=-1;if(s=i.strategy>=wu||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=s<<6,0!==i.strstart&&(t|=32),t+=31-t%31,eh(i,t),0!==i.strstart&&(eh(i,e.adler>>>16),eh(i,65535&e.adler)),e.adler=1,i.status=Yu,zu(e),0!==i.pending)return i.last_flush=-1,Cu}if(57===i.status)if(e.adler=0,$u(i,31),$u(i,139),$u(i,8),i.gzhead)$u(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),$u(i,255&i.gzhead.time),$u(i,i.gzhead.time>>8&255),$u(i,i.gzhead.time>>16&255),$u(i,i.gzhead.time>>24&255),$u(i,9===i.level?2:i.strategy>=wu||i.level<2?4:0),$u(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&($u(i,255&i.gzhead.extra.length),$u(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=Eu(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if($u(i,0),$u(i,0),$u(i,0),$u(i,0),$u(i,0),$u(i,9===i.level?2:i.strategy>=wu||i.level<2?4:0),$u(i,3),i.status=Yu,zu(e),0!==i.pending)return i.last_flush=-1,Cu;if(69===i.status){if(i.gzhead.extra){let t=i.pending,s=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+s>i.pending_buf_size;){let n=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=n,zu(e),0!==i.pending)return i.last_flush=-1,Cu;t=0,s-=n}let n=new Uint8Array(i.gzhead.extra);i.pending_buf.set(n.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending+=s,i.gzhead.hcrc&&i.pending>t&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-s,s)),zu(e),0!==i.pending)return i.last_flush=-1,Cu;s=0}t=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,$u(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>s&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-s,s)),zu(e),0!==i.pending)return i.last_flush=-1,Cu;s=0}t=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,$u(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>s&&(e.adler=Eu(e.adler,i.pending_buf,i.pending-s,s))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(zu(e),0!==i.pending))return i.last_flush=-1,Cu;$u(i,255&e.adler),$u(i,e.adler>>8&255),e.adler=0}if(i.status=Yu,zu(e),0!==i.pending)return i.last_flush=-1,Cu}if(0!==e.avail_in||0!==i.lookahead||t!==Su&&i.status!==Wu){let s=0===i.level?nh(i,t):i.strategy===wu?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(sh(e),0===e.lookahead)){if(t===Su)return 1;break}if(e.match_length=0,i=pu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Zu(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Ou?(Zu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Zu(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===Gu?((e,t)=>{let i,s,n,r;const o=e.window;for(;;){if(e.lookahead<=Bu){if(sh(e),e.lookahead<=Bu&&t===Su)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,s=o[n],s===o[++n]&&s===o[++n]&&s===o[++n])){r=e.strstart+Bu;do{}while(s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&n<r);e.match_length=Bu-(r-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=pu(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=pu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Zu(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Ou?(Zu(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Zu(e,!1),0===e.strm.avail_out)?1:2})(i,t):lh[i.level].func(i,t);if(3!==s&&4!==s||(i.status=Wu),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),Cu;if(2===s&&(t===vu?mu(i):t!==yu&&(Ru(i,0,0,!1),t===Nu&&(Ku(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),zu(e),0===e.avail_out))return i.last_flush=-1,Cu}return t!==Ou?Cu:i.wrap<=0?Mu:(2===i.wrap?($u(i,255&e.adler),$u(i,e.adler>>8&255),$u(i,e.adler>>16&255),$u(i,e.adler>>24&255),$u(i,255&e.total_in),$u(i,e.total_in>>8&255),$u(i,e.total_in>>16&255),$u(i,e.total_in>>24&255)):(eh(i,e.adler>>>16),eh(i,65535&e.adler)),zu(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?Cu:Mu)},deflateEnd:e=>{if(_h(e))return bu;const t=e.state.status;return e.state=null,t===Yu?qu(e,Lu):Cu},deflateSetDictionary:(e,t)=>{let i=t.length;if(_h(e))return bu;const s=e.state,n=s.wrap;if(2===n||1===n&&s.status!==ju||s.lookahead)return bu;if(1===n&&(e.adler=hu(e.adler,t,i,0)),s.wrap=0,i>=s.w_size){0===n&&(Ku(s.head),s.strstart=0,s.block_start=0,s.insert=0);let e=new Uint8Array(s.w_size);e.set(t.subarray(i-s.w_size,i),0),t=e,i=s.w_size}const r=e.avail_in,o=e.next_in,a=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,sh(s);s.lookahead>=3;){let e=s.strstart,t=s.lookahead-2;do{s.ins_h=Xu(s,s.ins_h,s.window[e+3-1]),s.prev[e&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=e,e++}while(--t);s.strstart=e,s.lookahead=2,sh(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,e.next_in=o,e.input=a,e.avail_in=r,s.wrap=n,Cu},deflateInfo:"pako deflate (from Nodeca project)"};const Eh=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ih={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Eh(i,t)&&(e[t]=i[t])}}return e},flattenChunks:e=>{let t=0;for(let i=0,s=e.length;i<s;i++)t+=e[i].length;const i=new Uint8Array(t);for(let t=0,s=0,n=e.length;t<n;t++){let n=e[t];i.set(n,s),s+=n.length}return i}};let Th=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Th=!1}const fh=new Uint8Array(256);for(let e=0;e<256;e++)fh[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;fh[254]=fh[254]=1;var Rh={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,s,n,r,o=e.length,a=0;for(n=0;n<o;n++)i=e.charCodeAt(n),55296==(64512&i)&&n+1<o&&(s=e.charCodeAt(n+1),56320==(64512&s)&&(i=65536+(i-55296<<10)+(s-56320),n++)),a+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(a),r=0,n=0;r<a;n++)i=e.charCodeAt(n),55296==(64512&i)&&n+1<o&&(s=e.charCodeAt(n+1),56320==(64512&s)&&(i=65536+(i-55296<<10)+(s-56320),n++)),i<128?t[r++]=i:i<2048?(t[r++]=192|i>>>6,t[r++]=128|63&i):i<65536?(t[r++]=224|i>>>12,t[r++]=128|i>>>6&63,t[r++]=128|63&i):(t[r++]=240|i>>>18,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i);return t},buf2string:(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s,n;const r=new Array(2*i);for(n=0,s=0;s<i;){let t=e[s++];if(t<128){r[n++]=t;continue}let o=fh[t];if(o>4)r[n++]=65533,s+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&s<i;)t=t<<6|63&e[s++],o--;o>1?r[n++]=65533:t<65536?r[n++]=t:(t-=65536,r[n++]=55296|t>>10&1023,r[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Th)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let s=0;s<t;s++)i+=String.fromCharCode(e[s]);return i})(r,n)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+fh[e[i]]>t?i:t}};var Ah=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 ph=Object.prototype.toString,{Z_NO_FLUSH:mh,Z_SYNC_FLUSH:Sh,Z_FULL_FLUSH:vh,Z_FINISH:Nh,Z_OK:Oh,Z_STREAM_END:yh,Z_DEFAULT_COMPRESSION:Ch,Z_DEFAULT_STRATEGY:Mh,Z_DEFLATED:bh}=Tu;function Lh(e){this.options=Ih.assign({level:Ch,method:bh,chunkSize:16384,windowBits:15,memLevel:8,strategy:Mh},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 Ah,this.strm.avail_out=0;let i=gh.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==Oh)throw new Error(Iu[i]);if(t.header&&gh.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Rh.string2buf(t.dictionary):"[object ArrayBuffer]"===ph.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=gh.deflateSetDictionary(this.strm,e),i!==Oh)throw new Error(Iu[i]);this._dict_set=!0}}Lh.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize;let n,r;if(this.ended)return!1;for(r=t===~~t?t:!0===t?Nh:mh,"string"==typeof e?i.input=Rh.string2buf(e):"[object ArrayBuffer]"===ph.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),(r===Sh||r===vh)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(n=gh.deflate(i,r),n===yh)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),n=gh.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Oh;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Lh.prototype.onData=function(e){this.chunks.push(e)},Lh.prototype.onEnd=function(e){e===Oh&&(this.result=Ih.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const Uh=16209;var Ph=function(e,t){let i,s,n,r,o,a,l,c,_,d,u,h,g,E,I,T,f,R,A,p,m,S,v,N;const O=e.state;i=e.next_in,v=e.input,s=i+(e.avail_in-5),n=e.next_out,N=e.output,r=n-(t-e.avail_out),o=n+(e.avail_out-257),a=O.dmax,l=O.wsize,c=O.whave,_=O.wnext,d=O.window,u=O.hold,h=O.bits,g=O.lencode,E=O.distcode,I=(1<<O.lenbits)-1,T=(1<<O.distbits)-1;e:do{h<15&&(u+=v[i++]<<h,h+=8,u+=v[i++]<<h,h+=8),f=g[u&I];t:for(;;){if(R=f>>>24,u>>>=R,h-=R,R=f>>>16&255,0===R)N[n++]=65535&f;else{if(!(16&R)){if(64&R){if(32&R){O.mode=16191;break e}e.msg="invalid literal/length code",O.mode=Uh;break e}f=g[(65535&f)+(u&(1<<R)-1)];continue t}for(A=65535&f,R&=15,R&&(h<R&&(u+=v[i++]<<h,h+=8),A+=u&(1<<R)-1,u>>>=R,h-=R),h<15&&(u+=v[i++]<<h,h+=8,u+=v[i++]<<h,h+=8),f=E[u&T];;){if(R=f>>>24,u>>>=R,h-=R,R=f>>>16&255,16&R){if(p=65535&f,R&=15,h<R&&(u+=v[i++]<<h,h+=8,h<R&&(u+=v[i++]<<h,h+=8)),p+=u&(1<<R)-1,p>a){e.msg="invalid distance too far back",O.mode=Uh;break e}if(u>>>=R,h-=R,R=n-r,p>R){if(R=p-R,R>c&&O.sane){e.msg="invalid distance too far back",O.mode=Uh;break e}if(m=0,S=d,0===_){if(m+=l-R,R<A){A-=R;do{N[n++]=d[m++]}while(--R);m=n-p,S=N}}else if(_<R){if(m+=l+_-R,R-=_,R<A){A-=R;do{N[n++]=d[m++]}while(--R);if(m=0,_<A){R=_,A-=R;do{N[n++]=d[m++]}while(--R);m=n-p,S=N}}}else if(m+=_-R,R<A){A-=R;do{N[n++]=d[m++]}while(--R);m=n-p,S=N}for(;A>2;)N[n++]=S[m++],N[n++]=S[m++],N[n++]=S[m++],A-=3;A&&(N[n++]=S[m++],A>1&&(N[n++]=S[m++]))}else{m=n-p;do{N[n++]=N[m++],N[n++]=N[m++],N[n++]=N[m++],A-=3}while(A>2);A&&(N[n++]=N[m++],A>1&&(N[n++]=N[m++]))}break}if(64&R){e.msg="invalid distance code",O.mode=Uh;break e}f=E[(65535&f)+(u&(1<<R)-1)]}}break}}while(i<s&&n<o);A=h>>3,i-=A,h-=A<<3,u&=(1<<h)-1,e.next_in=i,e.next_out=n,e.avail_in=i<s?s-i+5:5-(i-s),e.avail_out=n<o?o-n+257:257-(n-o),O.hold=u,O.bits=h};const Dh=15,wh=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]),Gh=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]),Vh=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]),kh=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 xh=(e,t,i,s,n,r,o,a)=>{const l=a.bits;let c,_,d,u,h,g,E=0,I=0,T=0,f=0,R=0,A=0,p=0,m=0,S=0,v=0,N=null;const O=new Uint16Array(16),y=new Uint16Array(16);let C,M,b,L=null;for(E=0;E<=Dh;E++)O[E]=0;for(I=0;I<s;I++)O[t[i+I]]++;for(R=l,f=Dh;f>=1&&0===O[f];f--);if(R>f&&(R=f),0===f)return n[r++]=20971520,n[r++]=20971520,a.bits=1,0;for(T=1;T<f&&0===O[T];T++);for(R<T&&(R=T),m=1,E=1;E<=Dh;E++)if(m<<=1,m-=O[E],m<0)return-1;if(m>0&&(0===e||1!==f))return-1;for(y[1]=0,E=1;E<Dh;E++)y[E+1]=y[E]+O[E];for(I=0;I<s;I++)0!==t[i+I]&&(o[y[t[i+I]]++]=I);if(0===e?(N=L=o,g=20):1===e?(N=wh,L=Gh,g=257):(N=Vh,L=kh,g=0),v=0,I=0,E=T,h=r,A=R,p=0,d=-1,S=1<<R,u=S-1,1===e&&S>852||2===e&&S>592)return 1;for(;;){C=E-p,o[I]+1<g?(M=0,b=o[I]):o[I]>=g?(M=L[o[I]-g],b=N[o[I]-g]):(M=96,b=0),c=1<<E-p,_=1<<A,T=_;do{_-=c,n[h+(v>>p)+_]=C<<24|M<<16|b}while(0!==_);for(c=1<<E-1;v&c;)c>>=1;if(0!==c?(v&=c-1,v+=c):v=0,I++,0==--O[E]){if(E===f)break;E=t[i+o[I]]}if(E>R&&(v&u)!==d){for(0===p&&(p=R),h+=T,A=E-p,m=1<<A;A+p<f&&(m-=O[A+p],!(m<=0));)A++,m<<=1;if(S+=1<<A,1===e&&S>852||2===e&&S>592)return 1;d=v&u,n[d]=R<<24|A<<16|h-r}}return 0!==v&&(n[h+v]=E-p<<24|64<<16),a.bits=R,0};const{Z_FINISH:Fh,Z_BLOCK:Bh,Z_TREES:Hh,Z_OK:jh,Z_STREAM_END:Yh,Z_NEED_DICT:Wh,Z_STREAM_ERROR:qh,Z_DATA_ERROR:Jh,Z_MEM_ERROR:Kh,Z_BUF_ERROR:Qh,Z_DEFLATED:Xh}=Tu,zh=16180,Zh=16190,$h=16191,eg=16192,tg=16194,ig=16199,sg=16200,ng=16206,rg=16209,og=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function ag(){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 lg=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<zh||t.mode>16211?1:0},cg=e=>{if(lg(e))return qh;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=zh,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,jh},_g=e=>{if(lg(e))return qh;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,cg(e)},dg=(e,t)=>{let i;if(lg(e))return qh;const s=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?qh:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,_g(e))},ug=(e,t)=>{if(!e)return qh;const i=new ag;e.state=i,i.strm=e,i.window=null,i.mode=zh;const s=dg(e,t);return s!==jh&&(e.state=null),s};let hg,gg,Eg=!0;const Ig=e=>{if(Eg){hg=new Int32Array(512),gg=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(xh(1,e.lens,0,288,hg,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;xh(2,e.lens,0,32,gg,0,e.work,{bits:5}),Eg=!1}e.lencode=hg,e.lenbits=9,e.distcode=gg,e.distbits=5},Tg=(e,t,i,s)=>{let n;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),s>=r.wsize?(r.window.set(t.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(n=r.wsize-r.wnext,n>s&&(n=s),r.window.set(t.subarray(i-s,i-s+n),r.wnext),(s-=n)?(r.window.set(t.subarray(i-s,i),0),r.wnext=s,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=n))),0};var fg={inflateReset:_g,inflateReset2:dg,inflateResetKeep:cg,inflateInit:e=>ug(e,15),inflateInit2:ug,inflate:(e,t)=>{let i,s,n,r,o,a,l,c,_,d,u,h,g,E,I,T,f,R,A,p,m,S,v=0;const N=new Uint8Array(4);let O,y;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(lg(e)||!e.output||!e.input&&0!==e.avail_in)return qh;i=e.state,i.mode===$h&&(i.mode=eg),o=e.next_out,n=e.output,l=e.avail_out,r=e.next_in,s=e.input,a=e.avail_in,c=i.hold,_=i.bits,d=a,u=l,S=jh;e:for(;;)switch(i.mode){case zh:if(0===i.wrap){i.mode=eg;break}for(;_<16;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(2&i.wrap&&35615===c){0===i.wbits&&(i.wbits=15),i.check=0,N[0]=255&c,N[1]=c>>>8&255,i.check=Eu(i.check,N,2,0),c=0,_=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",i.mode=rg;break}if((15&c)!==Xh){e.msg="unknown compression method",i.mode=rg;break}if(c>>>=4,_-=4,m=8+(15&c),0===i.wbits&&(i.wbits=m),m>15||m>i.wbits){e.msg="invalid window size",i.mode=rg;break}i.dmax=1<<i.wbits,i.flags=0,e.adler=i.check=1,i.mode=512&c?16189:$h,c=0,_=0;break;case 16181:for(;_<16;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(i.flags=c,(255&i.flags)!==Xh){e.msg="unknown compression method",i.mode=rg;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=rg;break}i.head&&(i.head.text=c>>8&1),512&i.flags&&4&i.wrap&&(N[0]=255&c,N[1]=c>>>8&255,i.check=Eu(i.check,N,2,0)),c=0,_=0,i.mode=16182;case 16182:for(;_<32;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.head&&(i.head.time=c),512&i.flags&&4&i.wrap&&(N[0]=255&c,N[1]=c>>>8&255,N[2]=c>>>16&255,N[3]=c>>>24&255,i.check=Eu(i.check,N,4,0)),c=0,_=0,i.mode=16183;case 16183:for(;_<16;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.head&&(i.head.xflags=255&c,i.head.os=c>>8),512&i.flags&&4&i.wrap&&(N[0]=255&c,N[1]=c>>>8&255,i.check=Eu(i.check,N,2,0)),c=0,_=0,i.mode=16184;case 16184:if(1024&i.flags){for(;_<16;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.length=c,i.head&&(i.head.extra_len=c),512&i.flags&&4&i.wrap&&(N[0]=255&c,N[1]=c>>>8&255,i.check=Eu(i.check,N,2,0)),c=0,_=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(h=i.length,h>a&&(h=a),h&&(i.head&&(m=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(s.subarray(r,r+h),m)),512&i.flags&&4&i.wrap&&(i.check=Eu(i.check,s,h,r)),a-=h,r+=h,i.length-=h),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break e;h=0;do{m=s[r+h++],i.head&&m&&i.length<65536&&(i.head.name+=String.fromCharCode(m))}while(m&&h<a);if(512&i.flags&&4&i.wrap&&(i.check=Eu(i.check,s,h,r)),a-=h,r+=h,m)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===a)break e;h=0;do{m=s[r+h++],i.head&&m&&i.length<65536&&(i.head.comment+=String.fromCharCode(m))}while(m&&h<a);if(512&i.flags&&4&i.wrap&&(i.check=Eu(i.check,s,h,r)),a-=h,r+=h,m)break e}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;_<16;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(4&i.wrap&&c!==(65535&i.check)){e.msg="header crc mismatch",i.mode=rg;break}c=0,_=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=$h;break;case 16189:for(;_<32;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}e.adler=i.check=og(c),c=0,_=0,i.mode=Zh;case Zh:if(0===i.havedict)return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=a,i.hold=c,i.bits=_,Wh;e.adler=i.check=1,i.mode=$h;case $h:if(t===Bh||t===Hh)break e;case eg:if(i.last){c>>>=7&_,_-=7&_,i.mode=ng;break}for(;_<3;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}switch(i.last=1&c,c>>>=1,_-=1,3&c){case 0:i.mode=16193;break;case 1:if(Ig(i),i.mode=ig,t===Hh){c>>>=2,_-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=rg}c>>>=2,_-=2;break;case 16193:for(c>>>=7&_,_-=7&_;_<32;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",i.mode=rg;break}if(i.length=65535&c,c=0,_=0,i.mode=tg,t===Hh)break e;case tg:i.mode=16195;case 16195:if(h=i.length,h){if(h>a&&(h=a),h>l&&(h=l),0===h)break e;n.set(s.subarray(r,r+h),o),a-=h,r+=h,l-=h,o+=h,i.length-=h;break}i.mode=$h;break;case 16196:for(;_<14;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(i.nlen=257+(31&c),c>>>=5,_-=5,i.ndist=1+(31&c),c>>>=5,_-=5,i.ncode=4+(15&c),c>>>=4,_-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=rg;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;_<3;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.lens[C[i.have++]]=7&c,c>>>=3,_-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,O={bits:i.lenbits},S=xh(0,i.lens,0,19,i.lencode,0,i.work,O),i.lenbits=O.bits,S){e.msg="invalid code lengths set",i.mode=rg;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;v=i.lencode[c&(1<<i.lenbits)-1],I=v>>>24,T=v>>>16&255,f=65535&v,!(I<=_);){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(f<16)c>>>=I,_-=I,i.lens[i.have++]=f;else{if(16===f){for(y=I+2;_<y;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(c>>>=I,_-=I,0===i.have){e.msg="invalid bit length repeat",i.mode=rg;break}m=i.lens[i.have-1],h=3+(3&c),c>>>=2,_-=2}else if(17===f){for(y=I+3;_<y;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}c>>>=I,_-=I,m=0,h=3+(7&c),c>>>=3,_-=3}else{for(y=I+7;_<y;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}c>>>=I,_-=I,m=0,h=11+(127&c),c>>>=7,_-=7}if(i.have+h>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=rg;break}for(;h--;)i.lens[i.have++]=m}}if(i.mode===rg)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=rg;break}if(i.lenbits=9,O={bits:i.lenbits},S=xh(1,i.lens,0,i.nlen,i.lencode,0,i.work,O),i.lenbits=O.bits,S){e.msg="invalid literal/lengths set",i.mode=rg;break}if(i.distbits=6,i.distcode=i.distdyn,O={bits:i.distbits},S=xh(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,O),i.distbits=O.bits,S){e.msg="invalid distances set",i.mode=rg;break}if(i.mode=ig,t===Hh)break e;case ig:i.mode=sg;case sg:if(a>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=a,i.hold=c,i.bits=_,Ph(e,u),o=e.next_out,n=e.output,l=e.avail_out,r=e.next_in,s=e.input,a=e.avail_in,c=i.hold,_=i.bits,i.mode===$h&&(i.back=-1);break}for(i.back=0;v=i.lencode[c&(1<<i.lenbits)-1],I=v>>>24,T=v>>>16&255,f=65535&v,!(I<=_);){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(T&&!(240&T)){for(R=I,A=T,p=f;v=i.lencode[p+((c&(1<<R+A)-1)>>R)],I=v>>>24,T=v>>>16&255,f=65535&v,!(R+I<=_);){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}c>>>=R,_-=R,i.back+=R}if(c>>>=I,_-=I,i.back+=I,i.length=f,0===T){i.mode=16205;break}if(32&T){i.back=-1,i.mode=$h;break}if(64&T){e.msg="invalid literal/length code",i.mode=rg;break}i.extra=15&T,i.mode=16201;case 16201:if(i.extra){for(y=i.extra;_<y;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.length+=c&(1<<i.extra)-1,c>>>=i.extra,_-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;v=i.distcode[c&(1<<i.distbits)-1],I=v>>>24,T=v>>>16&255,f=65535&v,!(I<=_);){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(!(240&T)){for(R=I,A=T,p=f;v=i.distcode[p+((c&(1<<R+A)-1)>>R)],I=v>>>24,T=v>>>16&255,f=65535&v,!(R+I<=_);){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}c>>>=R,_-=R,i.back+=R}if(c>>>=I,_-=I,i.back+=I,64&T){e.msg="invalid distance code",i.mode=rg;break}i.offset=f,i.extra=15&T,i.mode=16203;case 16203:if(i.extra){for(y=i.extra;_<y;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}i.offset+=c&(1<<i.extra)-1,c>>>=i.extra,_-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=rg;break}i.mode=16204;case 16204:if(0===l)break e;if(h=u-l,i.offset>h){if(h=i.offset-h,h>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=rg;break}h>i.wnext?(h-=i.wnext,g=i.wsize-h):g=i.wnext-h,h>i.length&&(h=i.length),E=i.window}else E=n,g=o-i.offset,h=i.length;h>l&&(h=l),l-=h,i.length-=h;do{n[o++]=E[g++]}while(--h);0===i.length&&(i.mode=sg);break;case 16205:if(0===l)break e;n[o++]=i.length,l--,i.mode=sg;break;case ng:if(i.wrap){for(;_<32;){if(0===a)break e;a--,c|=s[r++]<<_,_+=8}if(u-=l,e.total_out+=u,i.total+=u,4&i.wrap&&u&&(e.adler=i.check=i.flags?Eu(i.check,n,u,o-u):hu(i.check,n,u,o-u)),u=l,4&i.wrap&&(i.flags?c:og(c))!==i.check){e.msg="incorrect data check",i.mode=rg;break}c=0,_=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;_<32;){if(0===a)break e;a--,c+=s[r++]<<_,_+=8}if(4&i.wrap&&c!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=rg;break}c=0,_=0}i.mode=16208;case 16208:S=Yh;break e;case rg:S=Jh;break e;case 16210:return Kh;default:return qh}return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=a,i.hold=c,i.bits=_,(i.wsize||u!==e.avail_out&&i.mode<rg&&(i.mode<ng||t!==Fh))&&Tg(e,e.output,e.next_out,u-e.avail_out),d-=e.avail_in,u-=e.avail_out,e.total_in+=d,e.total_out+=u,i.total+=u,4&i.wrap&&u&&(e.adler=i.check=i.flags?Eu(i.check,n,u,e.next_out-u):hu(i.check,n,u,e.next_out-u)),e.data_type=i.bits+(i.last?64:0)+(i.mode===$h?128:0)+(i.mode===ig||i.mode===tg?256:0),(0===d&&0===u||t===Fh)&&S===jh&&(S=Qh),S},inflateEnd:e=>{if(lg(e))return qh;let t=e.state;return t.window&&(t.window=null),e.state=null,jh},inflateGetHeader:(e,t)=>{if(lg(e))return qh;const i=e.state;return 2&i.wrap?(i.head=t,t.done=!1,jh):qh},inflateSetDictionary:(e,t)=>{const i=t.length;let s,n,r;return lg(e)?qh:(s=e.state,0!==s.wrap&&s.mode!==Zh?qh:s.mode===Zh&&(n=1,n=hu(n,t,i,0),n!==s.check)?Jh:(r=Tg(e,t,i,i),r?(s.mode=16210,Kh):(s.havedict=1,jh)))},inflateInfo:"pako inflate (from Nodeca project)"};var Rg=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 Ag=Object.prototype.toString,{Z_NO_FLUSH:pg,Z_FINISH:mg,Z_OK:Sg,Z_STREAM_END:vg,Z_NEED_DICT:Ng,Z_STREAM_ERROR:Og,Z_DATA_ERROR:yg,Z_MEM_ERROR:Cg}=Tu;function Mg(e){this.options=Ih.assign({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 Ah,this.strm.avail_out=0;let i=fg.inflateInit2(this.strm,t.windowBits);if(i!==Sg)throw new Error(Iu[i]);if(this.header=new Rg,fg.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Rh.string2buf(t.dictionary):"[object ArrayBuffer]"===Ag.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=fg.inflateSetDictionary(this.strm,t.dictionary),i!==Sg)))throw new Error(Iu[i])}function bg(e,t){const i=new Mg(t);if(i.push(e),i.err)throw i.msg||Iu[i.err];return i.result}Mg.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize,n=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=t===~~t?t:!0===t?mg:pg,"[object ArrayBuffer]"===Ag.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),r=fg.inflate(i,o),r===Ng&&n&&(r=fg.inflateSetDictionary(i,n),r===Sg?r=fg.inflate(i,o):r===yg&&(r=Ng));i.avail_in>0&&r===vg&&i.state.wrap>0&&0!==e[i.next_in];)fg.inflateReset(i),r=fg.inflate(i,o);switch(r){case Og:case yg:case Ng:case Cg:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===vg))if("string"===this.options.to){let e=Rh.utf8border(i.output,i.next_out),t=i.next_out-e,n=Rh.buf2string(i.output,e);i.next_out=t,i.avail_out=s-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(n)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==Sg||0!==a){if(r===vg)return r=fg.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Mg.prototype.onData=function(e){this.chunks.push(e)},Mg.prototype.onEnd=function(e){e===Sg&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ih.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Lg={Inflate:Mg,inflate:bg,inflateRaw:function(e,t){return(t=t||{}).raw=!0,bg(e,t)},ungzip:bg,constants:Tu};const{Inflate:Ug,inflate:Pg,inflateRaw:Dg,ungzip:wg}=Lg;var Gg=wg;function Vg(e){return Object.keys(e).map((t=>{let i=e[t];return"string"!=typeof i&&(i=`${i}`),{key:t,value:i}}))}function kg(e,t,i,s){return Uc.encode(al,{targetId:e,type:w.GROUP,users:s,extProfile:i?Vg(i):void 0,settingProfile:Vg(t)})}const xg=(e,t)=>Uc.encode(Yo,{type:e.conversationType,msgTime:t,channelId:e.targetId,busChannel:e.channelId||""}),Fg=e=>{const{compressioEnabled:t,compressedData:i,info:s,pullTime:n,isFinished:r,pageToken:o}=Uc.decode(Po,e);if(t){const e=Gg(i);return Fg(e)}return{info:s,pullTime:n,isFinished:r,pageToken:o}},Bg=e=>{const t=Uc.decode(Ao,e);if(t.compressioEnabled){const e=Gg(t.compressedData);return Bg(e)}return t},Hg=e=>{const t=Uc.decode(po,e);if(t.compressioEnabled){const e=Gg(t.compressedData);return Hg(e)}const{syncTime:i,list:s}=t;return{syncTime:i,list:s.map((e=>Uc.decode(mo,new Uint8Array(e))))}},jg=e=>Uc.encode(Ia,Object.assign(Object.assign({},e),{compress:bs.enable()})),Yg=e=>{const t=Uc.decode(fa,e);if(t.compress){const e=Gg(t.compressData);return Yg(e)}return t},Wg=e=>{const t=Uc.decode(Ra,e);if(t.compress){const e=Gg(t.compressData);return Wg(e)}return t},qg=e=>{const{listType:t,result:i,page:s}=e,n=new Uint8Array(i);let r=[];switch(t){case 1:r=Uc.decode(gl,n).list;break;case 2:r=Uc.decode(hl,n).list;break;case 3:r=Uc.decode(El,n).list;break;case 11:r=Uc.decode(yl,n).list;break;case 12:r=Uc.decode(Cl,n).list}return Object.assign(Object.assign({},s),{list:r})},Jg=e=>Uc.encode(Fo,Object.assign(Object.assign({},e),{compressioEnabled:bs.enable(),ignoreCmd:!0})),Kg=e=>{const t=Uc.decode(Bo,e);if(t.compressioEnabled){const e=Gg(t.compressedData);return Kg(e)}return t},Qg=(e,t)=>Uc.encode(aa,{ignoreVersion:!0,version:e,state:t}),Xg=e=>{const t=Uc.decode(Hl,e);if(t.compress){const e=Gg(t.compressedData);return Xg(e)}return t},zg=e=>Uc.encode(ea,{timestamp:e,compressioEnabled:bs.enable()}),Zg=e=>{const t=Uc.decode(Zo,e);if(t.compressioEnabled){const e=Gg(t.compressedData);return Zg(e)}return t},$g=e=>{if(!e)return;const{pushTitle:t,iOSConfig:i,androidConfig:s,templateId:n,harmonyOSConfig:r}=e;return{title:t,pushConfigs:zt(i,s,r),pushId:null==s?void 0:s.notificationId,templateId:n}},eE=(e,t)=>{const{targetId:i,conversationType:s,channelId:n}=e,{messageType:r,isMentioned:o,disableNotification:a,canIncludeExpansion:l,pushConfig:c,directionalUserIdList:_,isVoipPush:d,isFilerWhiteBlacklist:u,content:h,pushContent:g,pushData:E,expansion:I,messageId:T,needReceipt:f,disableUpdateLastMessage:R,isStatusMessage:A,quoteInfo:p}=t,m=M_(r,o,a,l,A),S=((e,t,i,s)=>{let n=0;return e&&(n|=1),t&&(n|=2),i&&(n|=4),s&&(n|=8),n})(!!d,!u,!!(null==c?void 0:c.disablePushTitle),!!(null==c?void 0:c.forceShowDetailContent));let v;if(h.user&&h.user.portraitUri&&(h.user.portrait=h.user.portraitUri),l&&I){v={};for(const[e,t]of Object.entries(I))v[e]={v:t}}const N=$g(c),O=s===w.SYSTEM?i:void 0,{isPersited:y}=ms(r);let C=0;y&&R&&(C|=1),f&&(C|=2);const M=p?{msgId:p.messageUId,fromUserId:p.senderId,classname:p.objectName}:void 0;return Uc.encode(Ro,{sessionId:m,pushText:(null==c?void 0:c.pushContent)||g,appData:(null==c?void 0:c.pushData)||E,toUserIds:_,configFlag:S,classname:r,content:JSON.stringify(h),extraContent:v?JSON.stringify(v):void 0,pushExt:N,clientUniqueId:T,busChannel:n,systemId:O,optionBits:C,refData:M})},tE=e=>Uc.encode(dl,Object.assign(Object.assign({},e),{type:w.GROUP})),iE=e=>Uc.encode(Il,Object.assign(Object.assign({},e),{type:w.GROUP})),sE=e=>Uc.encode(_l,Object.assign(Object.assign({},e),{type:w.GROUP})),nE=e=>{const t=Uc.decode(Yl,e);if(t.compress){const e=Gg(t.compressedData);return nE(e)}return t},rE=e=>{const t=Uc.decode(Ic,e);if(t.compress){const e=Gg(t.compressedData);return rE(e)}return t},oE=e=>{const t=Uc.decode(fc,e);if(t.compress){const e=Gg(t.compressedData);return oE(e)}return t},aE=e=>{const t=Uc.decode(Rc,e);if(t.compress){const e=Gg(t.compressedData);return aE(e)}return t},lE=(e,t)=>{const i=[];return e.forEach((e=>{const{reactionId:s,reactionTime:n,userReact:r,user:o,userCnt:a}=e,l={messageUId:t,reactionId:s,reactionTime:n,hasCurrentUserReacted:r,totalCount:a,users:o.map((e=>({userId:e.userId,reactionTime:e.reactionTime})))};i.push(l)})),i},cE=e=>{const{targetId:t,type:i,busChannel:s,opType:n,msgId:r,reactionId:o,userCnt:a,users:l}=e;return{conversationIdentifier:{targetId:t,conversationType:i,channelId:s||""},messageUId:r,reactionId:o,operationType:n,totalCount:a,users:l.map((({userId:e,reactionTime:t})=>({reactionTime:t,userId:e})))}},_E={[ir]:D.RC_DISCONN_KICK,[sr]:D.RC_DISCONN_EXCEPTION,[rr]:D.RC_DISCONN_EXCEPTION,[or]:D.RC_CONN_REDIRECTED,[ar]:D.RC_CONN_TOKEN_EXPIRED,[lr]:D.RC_CONN_PROTO_VERSION_ERROR,[cr]:D.RC_ACCOUNT_CANCELLATION},dE={[wn]:D.SUCCESS,[Gn]:D.RC_CONN_PROTO_VERSION_ERROR,[Vn]:D.RC_CONN_IDENTIFIER_REJECTED,[kn]:D.RC_CONN_SERVER_UNAVAILABLE,[xn]:D.RC_CONN_TOKEN_INCORRECT,[Fn]:D.RC_CONN_NOT_AUTHRORIZED,[Bn]:D.RC_CONN_REDIRECTED,[Hn]:D.RC_CONN_PACKAGE_NAME_INVALID,[jn]:D.RC_CONN_APP_BLOCKED_OR_DELETED,[Yn]:D.RC_CONN_USER_BLOCKED,[Wn]:D.RC_CONN_TOKEN_EXPIRED,[qn]:D.RC_CONN_DEVICE_ERROR,[Jn]:D.RC_CONN_HOSTNAME_ERROR,[Kn]:D.RC_DISCONN_SAME_CLIENT_ON_LINE,[Qn]:D.RC_LISCENSE_COUNT_OUT_OF_LIMIT,[Xn]:D.RC_CONN_WRONG_CLUSTER,[zn]:D.RC_APP_AUTH_NOT_PASS,[Zn]:D.RC_OTP_USED,[$n]:D.RC_PLATFORM_ERROR,[er]:D.RC_ACCOUNT_CANCELLATION,[tr]:D.RC_LICENSE_EXPIRED},uE=e=>[$s.ppMsgS,$s.pgMsgS,$s.chatMsgS,$s.prMsgS].includes(e);var hE,gE,EE,IE,TE,fE,RE,AE,pE,mE,SE,vE,NE,OE,yE,CE;class ME extends di{constructor(e,t,s){super("WebSGMsgReceiver"),hE.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_storage",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_recvRecord",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this._ctx.on("sMsg",i(this,hE,"m",IE),this),this._ctx.on("syncMsg",i(this,hE,"m",EE),this)}_handleSyncData(e){var s;return t(this,void 0,void 0,(function*(){const{logger:t,currentUserId:n,connectedTime:o}=this._ctx,a=this._ctx.getNaviInfoFromCache(),l=this._storage.get("inboxTime"),c=this._storage.get("outboxTime"),_=this._storage.get("broadcastTime"),d=t.createTraceId();t.info(r.L_PULL_MSG_T,JSON.stringify({inboxTime:l,outboxTime:c,broadcastTime:_}),d);const u=Uc.encode(fo,{ispolling:!1,isPullSend:!0,syncTime:l,sendBoxSyncTime:c,broadcastSyncTime:_,compressioEnabled:bs.enable()}),h=yield this._ctx.query($s.pullMsg,n,u);if(!h.isOk)return t.warn(r.L_PULL_MSG_R,JSON.stringify({code:h.code}),d),h.wipe();const g=Bg(h.data.pbData),{list:E,finished:I,syncTime:T,broadcastSyncTime:f}=g;let R=c;const A=E.map((e=>{const t=C_(a,e,n,e.dataTime<o);return t.messageDirection===ue.SEND&&(R=Math.max(R,t.sentTime)),t}));this._storage.removeSentRecordByTimestamp(R-ME.MESSAGE_RECORD_TTL);const p=i(this,hE,"a",gE);let m=A.filter((e=>{if(e.senderUserId===n){const t=i(this,hE,"m",RE).call(this,e);if(!t){const t=i(this,hE,"m",fE).call(this,e);this._storage.addSentRecord(t,e.sentTime)}return!t}if(p)return!0;const t=!this._recvRecord.has(e.messageUId);return t&&this._recvRecord.set(e.messageUId,e.sentTime),t}));this._storage.set("inboxTime",T),this._storage.set("broadcastTime",f||1),this._storage.set("outboxTime",R),t.info(r.L_PULL_MSG_R,JSON.stringify({code:0,inboxTime:T,broadcastTime:f,outboxTime:R,msgCount:A.length,afterFilteredCount:m.length,hasNext:!I}),d);const S=Math.max(T,f||1,R);return 0===e&&this._emitter.emit("__firstOfflineMessageTime__",(null===(s=A[0])||void 0===s?void 0:s.sentTime)||0),i(this,hE,"m",TE).call(this,"pullMsg",m,!!I),i(this,hE,"m",pE).call(this,T),gi({version:S,hasNext:!I})}))}}hE=new WeakSet,gE=function(){var e;return 0!==(null===(e=this._ctx.getNaviInfoFromCache())||void 0===e?void 0:e.openHistoryMsg)},EE=function(e,t,s){const{conversationType:n}=t;n!==w.ULTRA_GROUP&&n!==w.CHATROOM&&(e.stopPropagation(),n===w.RTC_ROOM||uE(s)?i(this,hE,"m",TE).call(this,"syncMsg",[t],!0):i(this,hE,"m",AE).call(this,"syncMsg",t))},IE=function(e,t){const{conversationType:s,sentTime:n,isStatusMessage:r,messageUId:o}=t;if(s===w.CHATROOM||s===w.ULTRA_GROUP)return;if(e.stopPropagation(),r||s===w.RTC_ROOM)return void i(this,hE,"m",TE).call(this,"smsg",[t],!0);if(t.senderUserId===this._ctx.currentUserId)return void i(this,hE,"m",AE).call(this,"smsg",t);if(i(this,hE,"a",gE))return void this.push(n);this._recvRecord.has(o)||(this._recvRecord.set(o,n),i(this,hE,"m",TE).call(this,"smsg",[t],!0)),i(this,hE,"m",pE).call(this,n)},TE=function(e,t,i){this._emitter.emit("messages",e,t,i)},fE=function(e){return e.messageType===Q.RECALL?`Cmd:${e.content.messageUId}`:e.messageUId},RE=function(e){const t=i(this,hE,"m",fE).call(this,e);return this._storage.hasSentRecord(t)},AE=function(e,t){if(i(this,hE,"m",RE).call(this,t))return;const s=i(this,hE,"m",fE).call(this,t);this._storage.addSentRecord(s,t.sentTime),i(this,hE,"m",TE).call(this,e,[t],!0)},pE=function(e){if(i(this,hE,"a",gE))return;const t=e-ME.MESSAGE_RECORD_TTL;Array.from(this._recvRecord.entries()).forEach((([e,i])=>{i<=t&&this._recvRecord.delete(e)}))},Object.defineProperty(ME,"MESSAGE_RECORD_TTL",{enumerable:!0,configurable:!0,writable:!0,value:18e4});class bE extends di{constructor(e,t){super("WebUGMsgReceiver"),mE.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_storage",{enumerable:!0,configurable:!0,writable:!0,value:t}),this._ctx.on("syncMsg",i(this,mE,"m",vE),this),this._ctx.on("sCmd",i(this,mE,"m",SE),this)}markOnline(){return t(this,void 0,void 0,(function*(){const e=yield i(this,mE,"m",OE).call(this,0);if(!e.isOk)return this._ctx.logger.warn(r.L_NOTIFY_ULTRA_ONLINE_S,`fail to pull ug msg, code: ${e.code}`),e.wipe();this._ctx.logger.info(r.L_NOTIFY_ULTRA_ONLINE_S,"success");const{syncTime:t}=e.data,s=yield i(this,mE,"m",NE).call(this,0,[]);if(!s.isOk)return s.wipe();const n=s.data,o=n.length>0?n[n.length-1].versionTime:0,a=Math.max(t,o);return gi({relations:n,msgVersion:a})}))}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const t=yield i(this,mE,"m",OE).call(this,e);if(!t.isOk)return t.wipe();const{syncTime:s,finished:n,list:r}=t.data;if(null==r?void 0:r.length){const{currentUserId:e}=this._ctx,t=r.filter((e=>!this._storage.isLocalSentUGMessage(e.msgId))).map((t=>y_(t,e,!1)));t.length>0&&this._ctx.emit("messagesFromUG",t,s)}return this._storage.removeUGSentRecordByTimestamp(s),gi({version:s,hasNext:!n})}))}}mE=new WeakSet,SE=function(e,t){if(6===t.type)this.push(t.time),e.stopPropagation()},vE=function(e,t){t.conversationType===w.ULTRA_GROUP&&(this.push(t.sentTime),e.stopPropagation())},NE=function e(s,n){return t(this,void 0,void 0,(function*(){const{currentUserId:t,logger:o}=this._ctx,a=o.createTraceId();o.info(r.L_PULL_UG_RELATIONS_T,JSON.stringify({ver:s}),a);const l=Uc.encode(Na,{syncTime:s,isEraseMsgContent:!1}),c=yield this._ctx.query($s.pullUgSes,t,l,void 0);if(o.summary(r.L_PULL_UG_RELATIONS_R,c,a,{ver:s}),!c.isOk)return c.wipe();const{info:_,isFinished:d}=Fg(c.data.pbData);if(n.push(..._),!d){const t=_[_.length-1].versionTime;return i(this,mE,"m",e).call(this,t,n)}return gi(n)}))},OE=function(e){return t(this,void 0,void 0,(function*(){const{currentUserId:t,logger:i}=this._ctx,s=i.createTraceId();i.info(r.L_PULL_ULTRA_MSG_T,JSON.stringify({version:e}),s);const n=(o=e,Uc.encode(Oa,{syncTime:o,compressioEnabled:bs.enable()}));var o;const a=yield this._ctx.query($s.pullUgMsg,t,n);if(i.summary(r.L_PULL_ULTRA_MSG_R,a,s,{version:e}),!a.isOk)return a.wipe();const l=a.data;return gi(Bg(l.pbData))}))};const LE=13,UE=36,PE=41;class DE extends di{constructor(e,t){super("WebServerEventHandler"),yE.add(this),Object.defineProperty(this,"_con",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t})}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const t=this._logger.createTraceId();this._logger.info(r.L_PULL_EVENT_CHANGE_T,JSON.stringify({version:e}),t);const s=yield i(this,yE,"m",CE).call(this,e);if(this._logger.summary(r.L_PULL_EVENT_CHANGE_R,s,t,{version:e}),!s.isOk)return s.wipe();const{list:n,syncTime:o,hasNext:a}=s.data;if(n.length){const e=new Map;n.forEach((t=>{const i=t.changeType;e.has(i)?e.get(i).push(t):e.set(i,[t])})),Array.from(e.entries()).forEach((([e,t])=>{this.emit("serverEvent",e,t)}))}return gi({version:o,hasNext:a})}))}noticeOnline(){return t(this,void 0,void 0,(function*(){const e=this._logger.createTraceId();this._logger.info(r.L_SERVER_EVENT_NOTIFY_ONLINE_T,JSON.stringify({version:0}),e);const t=yield i(this,yE,"m",CE).call(this,0);return this._logger.summary(r.L_SERVER_EVENT_NOTIFY_ONLINE_R,t,e,{version:0}),t}))}}var wE,GE,VE;yE=new WeakSet,CE=function(e){const t=Uc.encode(Ma,{syncTime:e});return this._con.query($s.pullEventChange,this._con.getCurrentUserId(),t,ba)};class kE extends di{constructor(e){super("WebUGServerEventHandler"),wE.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e})}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Ma,{syncTime:e}),s=yield this._ctx.query($s.qryMsgChange,this._ctx.currentUserId,t,La);if(!s.isOk)return s.wipe();const{list:n,syncTime:r,hasNext:o}=s.data;return n&&n.length&&i(this,wE,"m",GE).call(this,n),gi({version:r,hasNext:o})}))}_handleReactions(e){const t=Object.values(De),i=e.map((e=>{const t=Uc.decode(Ac,new Uint8Array(e));return cE(t)})).filter((({operationType:e})=>t.includes(e)));i.length&&this._ctx.emit("messageReaction",{reactions:i})}}wE=new WeakSet,GE=function(e){const t=[],s=[],n=[],r=[],o=[],a=[];e.forEach((e=>{const{changeType:i}=e;switch(i){case 1:s.push(e);break;case 2:t.push(e);break;case 3:n.push(e);break;case 4:r.push(e);break;case 5:o.push(e);break;case 6:break;case 7:a.push(e.eventData)}})),s.length&&i(this,wE,"m",VE).call(this,s,1),t.length&&i(this,wE,"m",VE).call(this,t,2),n.length&&this.emit("ugMsgRecalled",n),r.length&&this._ctx.emit("ugChannelChanged",r),o.length&&this._ctx.emit("ugUserGroupChanged",o),this._handleReactions(a)},VE=function(e,t){const i=new Map;e.forEach((e=>{const{targetId:t,busChannel:s,msgUID:n}=e,r=`${t}-${s}`,o=i.get(r);o?o.messageUIds.push(n):i.set(r,{conversationIdentifier:{conversationType:w.ULTRA_GROUP,targetId:t,channelId:s},messageUIds:[n]})})),Array.from(i.entries()).forEach((([e,i])=>{1===t?this.emit("ugMsgExpansion",i.conversationIdentifier,i.messageUIds):this.emit("ugMsgModify",i.conversationIdentifier,i.messageUIds)}))};const xE=()=>t(void 0,void 0,void 0,(function*(){return Ei(D.NOT_SUPPORT,"Not support")}));var FE,BE,HE,jE,YE,WE,qE,JE,KE,QE,XE,zE,ZE,$E,eI,tI,iI,sI,nI,rI,oI,aI,lI,cI,_I,dI,uI,hI,gI,EI,II,TI,fI,RI,AI,pI,mI,SI,vI,NI,OI,yI,CI,MI,bI,LI,UI;class PI extends di{constructor(e,t){super("WebSGMsgModifyReceiver"),FE.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:t}),BE.set(this,!0),this._ctx.on("onConnected",i(this,FE,"m",HE),this)}_handleModifyNotifies(e){if(0===e.length)return;const{currentUserId:t}=this._ctx,i=[];e.forEach((({modifyType:e,msg:s})=>{const n=y_(s,t,!1);i.push(n);const{conversationType:r,targetId:o,channelId:a}=n,l=this.storage.getModel({conversationType:r,targetId:o,channelId:a});if(!l||!l.latestMessage)return;const{messageUId:c,messageType:_,content:d}=l.latestMessage;if(c!==n.messageUId){if(_===Q.REFERENCE){const{referMsgUid:e}=d;if(e!==n.messageUId)return;d.referMsg=n.content}}else l.updateAttrs({latestMessage:n})})),this._ctx.emit("messageModified",i)}_handleReactionNotifies(e){if(0===e.length)return;const t=Object.values(De),i=e.filter((({reaction:e})=>t.includes(e.opType))).map((({reaction:e})=>cE(e)));i.length&&this._ctx.emit("messageReaction",{reactions:i})}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const t=this._ctx.logger.createTraceId();this._ctx.logger.info(r.L_PULL_MODIFY_MSG_T,JSON.stringify({time:e}),t);const n=Uc.encode(Bl,{pullVersion:e,modifyType:[1,3],compress:bs.enable()}),o=yield this._ctx.query($s.pullModifyMsg,this._ctx.currentUserId,n,void 0);if(this._ctx.logger.summary(r.L_PULL_MODIFY_MSG_R,o,t),!o.isOk)return o.wipe();const{msg:a,nextVersion:l,finished:c}=Xg(o.data.pbData);return a&&a.length&&i(this,FE,"m",jE).call(this,a),i(this,BE,"f")&&(this._ctx.emit("messageModifiedSyncCompleted",!c),s(this,BE,!1,"f")),gi({version:l,hasNext:!c})}))}}BE=new WeakMap,FE=new WeakSet,HE=function(e,t){s(this,BE,!0,"f"),t||this.reset()},jE=function(e){const t=[],i=[];e.forEach((e=>{const{modifyType:s}=e;1===s?t.push(e):3===s&&i.push(e)})),this._handleModifyNotifies(t),this._handleReactionNotifies(i)};const DI=18e4;class wI extends _i{constructor(e,t,n){super(),YE.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_userSettins",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),WE.set(this,void 0),qE.set(this,void 0),JE.set(this,void 0),KE.set(this,void 0),QE.set(this,void 0),XE.set(this,!1),zE.set(this,void 0),ZE.set(this,!1),uI.set(this,1),Object.defineProperty(this,"getUntaggedConversationListByPage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),yI.set(this,new Set),Object.defineProperty(this,"searchConversationByContent",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setMessageSpeechToTextVisible",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"syncRemoteConversations",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getHistoryMessagesByObjectNames",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getContinuousMessages",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getMessagesAroundTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"deleteLocalUGMessagesForAllChannel",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getUnreadMentionedMessages",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getFirstUnreadMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getConversations",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"clearConversations",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"saveEditedMessageDraft",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getEditedMessageDraft",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"clearEditedMessageDraft",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"clearUnreadCountByTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:xE}),s(this,zE,new _i,"f"),s(this,QE,n,"f"),this.storage=new yd(e),this.settings=new cd(this._ctx,this.storage,this),s(this,WE,new bE(this._ctx,this.storage),"f"),s(this,qE,new ME(this._ctx,this.storage,i(this,zE,"f")),"f"),s(this,JE,new kE(this._ctx),"f"),s(this,KE,new PI(this._ctx,this.storage),"f"),i(this,zE,"f").on("messages",i(this,YE,"m",oI),this),i(this,zE,"f").on("__firstOfflineMessageTime__",((e,t)=>{i(this,KE,"f").setInitVersion(t||this._ctx.connectedTime)}),this),i(this,JE,"f").on("ugMsgModify",i(this,YE,"m",EI),this),i(this,JE,"f").on("ugMsgExpansion",i(this,YE,"m",II),this),i(this,JE,"f").on("ugMsgRecalled",i(this,YE,"m",TI),this),this._ctx.on("onConnected",i(this,YE,"m",dI),this),this._ctx.on("onDisconnected",i(this,YE,"m",AI),this),this._ctx.on("onSuspend",i(this,YE,"m",AI),this),this._ctx.on("sCmd",i(this,YE,"m",pI),this),this._ctx.on("sNtf",i(this,YE,"m",mI),this),this._ctx.on("signal",i(this,YE,"m",SI),this),this._ctx.on("serverEvent",i(this,YE,"m",aI),this),this._ctx.on("robotsSynced",i(this,YE,"m",$E),this)}get ugSynced(){return i(this,XE,"f")}getConversationListByTimestamp(e,s){return t(this,void 0,void 0,(function*(){const{count:t,startTime:n,order:r,conversationTypes:o}=e;if(!s)return i(this,YE,"m",vI).call(this,n,t,r||0,o);const a=0!==n||r?n:Number.MAX_SAFE_INTEGER;let l=this.storage.getAllModels();o&&o.length>0&&(l=l.filter((e=>o.includes(e.conversationType)))),l=l.filter((e=>!e.hidden&&(e.conversationType!==w.ULTRA_GROUP||!e.channelId||"RCDefault"===e.channelId)&&(r?e.operationTime>a:e.operationTime<a))).sort(((e,t)=>e.operationTime-t.operationTime));const c=Math.min(l.length,t),_=r?l.slice(0,c):l.slice(l.length-c);return r||_.reverse(),gi(_.map((e=>e.toIReceivedConversation())))}))}getTopConversationList(e,s,n){return t(this,void 0,void 0,(function*(){const t=((null==s?void 0:s.length)||0)>0?s:Y(e?k:G),r="string"==typeof n&&""!==n,o=this.storage.getAllModels().filter((i=>i.isTop&&!i.hidden&&t.includes(i.conversationType)&&(i.conversationType!==w.ULTRA_GROUP&&(!r||i.channelId===n)||e&&(!i.channelId||"RCDefault"===i.channelId)))).sort(((e,t)=>e.operationTime-t.operationTime)).map((e=>e.toIReceivedConversation()));return i(this,YE,"m",NI).call(this,o)}))}getBlockedConversationList(){return t(this,void 0,void 0,(function*(){const{includeUg:e}=this._ctx,t=this.storage.getAllModels().filter((t=>!t.hidden&&t.notificationLevel>Ee.NOT_SET&&(t.conversationType!==w.ULTRA_GROUP||e&&(!t.channelId||"RCDefault"===t.channelId)))).sort(((e,t)=>e.operationTime-t.operationTime)).map((e=>e.toIReceivedConversation()));return i(this,YE,"m",NI).call(this,t)}))}getUnreadConversationList(e,s){return t(this,void 0,void 0,(function*(){const t=((null==s?void 0:s.length)||0)>0?s:Y(e?k:G),n=this.storage.getAllModels().filter((i=>i.unreadCount>0&&t.includes(i.conversationType)&&(i.conversationType!==w.ULTRA_GROUP||e&&(!i.channelId||"RCDefault"===i.channelId)))).sort(((e,t)=>e.operationTime-t.operationTime)).map((e=>e.toIReceivedConversation()));return i(this,YE,"m",NI).call(this,n)}))}getAllConversationList(e,s){return t(this,void 0,void 0,(function*(){const t="string"==typeof s;if(e){const e=this.storage.getAllModels().filter((e=>!(e.hidden||(e.conversationType===w.ULTRA_GROUP||t&&e.channelId!==s)&&e.channelId&&"RCDefault"!==e.channelId))).sort(((e,t)=>e.operationTime-t.operationTime)).map((e=>e.toIReceivedConversation()));return gi(e)}return(yield i(this,YE,"m",vI).call(this,0,1e3,0)).trans((e=>e.filter((e=>!t||e.channelId===s))))}))}getTotalUnreadCount(e,i,s){return t(this,void 0,void 0,(function*(){let t=0;return this.storage.getAllModels().forEach((n=>{n.unreadCount>0&&e.includes(n.conversationType)&&(n.conversationType!==w.ULTRA_GROUP&&(!s&&!n.channelId||n.channelId===s)||n.conversationType===w.ULTRA_GROUP&&(""===n.channelId||"RCDefault"===n.channelId))&&(i||n.notificationLevel<=Ee.NOT_SET)&&(t+=n.unreadCount)})),gi(t)}))}getConversation(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getOrCreateModel(e,!1).toIReceivedConversation(),s=yield i(this,YE,"m",NI).call(this,[t]);return s.isOk?s.trans((e=>e[0])):gi(t)}))}batchSetConversationToTop(e,s,n,r){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),n=yield i(this,YE,"m",OI).call(this,e,t,s);if(!n.isOk)return n.wipe();const{version:o,updateVersion:a}=n.data,l=e.map((e=>{const t=this.storage.getOrCreateModel(e,!0);return t.updateAttrs({isTop:s,hidden:!r&&t.hidden,operationTime:t.hidden&&r?Date.now():t.operationTime}),t}));return this.storage.updateConversationStorage(l),a&&this.storage.set("conversationStatusVersion",o),gi()}))}batchSetConversationNotificationLevel(e,s){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),n=yield i(this,YE,"m",OI).call(this,e,t,void 0,s);if(!n.isOk)return n.wipe();const{version:r,updateVersion:o}=n.data,a=e.map((e=>{const t=this.storage.getOrCreateModel(e,!0);return t.updateAttrs({notificationLevel:s}),t}));return this.storage.updateConversationStorage(a),o&&this.storage.set("conversationStatusVersion",r),gi()}))}batchSetConversationTranslateStrategy(e,s){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),n=yield i(this,YE,"m",OI).call(this,e,t,void 0,void 0,s);if(!n.isOk)return n.wipe();const{version:r,updateVersion:o}=n.data,a=e.map((e=>{const t=this.storage.getOrCreateModel(e,!0);return t.updateAttrs({translateStrategy:s}),t}));return this.storage.updateConversationStorage(a),o&&this.storage.set("conversationStatusVersion",r),gi()}))}getConversationNotificationLevel(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getOrCreateModel(e,!1);return gi(t.notificationLevel)}))}getConversationTypeNotificationLevel(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getConversationTypeNotificationLevel(e);return gi(t)}))}setConversationTypeNotificationLevel(e,i){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),{currentUserId:s}=this._ctx,n=Uc.encode(ua,{type:e,unpushLevel:i,version:t,ignoreVersion:!0}),r=yield this._ctx.query($s.setTypeUnpush,s,n,ha);if(!r.isOk)return r.wipe();const{version:o,updateVersion:a}=r.data;return this.storage.setConversationTypeNotificationLevel(e,i),a&&this.storage.set("conversationStatusVersion",o),gi()}))}clearAllSGUnreadCount(){return t(this,void 0,void 0,(function*(){const e=this.storage.getAllSGModels(),t=this._ctx.serverTime;return e.forEach((e=>e.clearUnreadCount(t))),this.storage.updateConversationStorage(e),gi()}))}deleteRemoteMessage(e,i){return t(this,void 0,void 0,(function*(){const t=i.map((e=>({msgDataTime:e.sentTime,msgId:e.messageUId,direct:e.messageDirection}))),s=Uc.encode(Qo,{type:e.conversationType,busChannel:e.channelId,conversationId:e.targetId,msgs:t}),n=e.conversationType===w.ULTRA_GROUP?$s.delUgMsg:$s.delMsg,r=yield this._ctx.query(n,this._ctx.currentUserId,s);if(!r.isOk)return r.wipe();if(!this._ctx.includeUg)return gi();const o=this.storage.getModel(e);if(o){const{latestMessage:e}=o;e&&i.some((t=>t.messageUId===e.messageUId))&&o.updateAttrs({latestMessage:null})}return gi()}))}deleteRemoteMessageByTimestamp(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Go,{conversationType:e.conversationType,targetId:e.targetId,busChannel:e.channelId,dataTime:i}),s=GI[e.conversationType],n=yield this._ctx.query(s,this._ctx.currentUserId,t);if(!n.isOk)return n.wipe();if(!this._ctx.includeUg)return gi();const r=this.storage.getModel(e);if(r){const{latestMessage:e}=r;e&&(0===i||e.sentTime<=i)&&r.updateAttrs({latestMessage:null})}return gi()}))}batchClearRemoteHistoryMessages(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Vo,{input:e.map((e=>({conversationType:e.conversationType,targetId:e.targetId,busChannel:e.channelId,dataTime:e.timestamp||0})))}),i=yield this._ctx.query($s.cleanMsgBatch,this._ctx.currentUserId,t);return i.isOk?(e.forEach((e=>{const t=this.storage.getModel(e);if(t){const{latestMessage:i}=t;i&&(!e.timestamp||i.sentTime<=e.timestamp)&&t.updateAttrs({latestMessage:null})}})),gi()):i.wipe()}))}sendReadReceiptResponseV5(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Ea,{targetId:e.targetId,type:e.conversationType,channelId:e.channelId,readType:0,msgIds:i}),s=i[0];return(yield this._ctx.query($s.readReceipt,s,t)).wipe()}))}getMessageReadReceiptInfoV5ByIdentifiers(e){return t(this,void 0,void 0,(function*(){const t=new Map;e.forEach((e=>{const i=dd(e.identifier),s=t.get(i)||new Set;s.add(e.messageUId),t.set(i,s)}));const i=(e=>Uc.encode(Ta,{items:e,compress:bs.enable()}))(Array.from(t.entries()).map((([e,t])=>{const i=ud(e);return{targetId:i.targetId,type:i.conversationType,busChannel:i.channelId,msgIds:Array.from(t)}}))),s=yield this._ctx.query($s.qryReceiptBatch,e[0].messageUId,i);if(!s.isOk)return s.wipe();const n=s.data,{item:r}=Wg(n.pbData),o=[];return r.forEach((e=>{var t;const i={conversationType:e.type,targetId:e.targetId,channelId:e.busChannel};null===(t=e.msg)||void 0===t||t.forEach((({msgId:e,unreadCnt:t,readCnt:s,totalCnt:n})=>{o.push({identifier:i,messageUId:e,unreadCount:t,readCount:s,totalCount:n})}))})),gi(o)}))}getMessagesReadReceiptUsersByPageV5(e,i,s){return t(this,void 0,void 0,(function*(){const t=0===s.readStatus?1:2,n=jg({targetId:e.targetId,type:e.conversationType,busChannel:e.channelId,msgIds:[i],qryType:1,pageType:1,pageToken:s.pageToken,pageSize:s.pageCount,readType:t,order:s.order?0:1}),r=yield this._ctx.query($s.qryReceipt,i,n);if(!r.isOk)return r.wipe();const o=r.data,{resp:a,pageToken:l}=Yg(o.pbData),c=a[0];return gi({pageToken:l||"",totalCount:1===t?c.readCnt:c.unreadCnt,users:(1===t?c.readUser:c.unreadUser).map((e=>{const{userId:t,mentioned:i,receiptTime:s}=e;return{userId:t,timestamp:s||0,isMentioned:!!i}}))})}))}getMessagesReadReceiptByUsersV5(e,i,s){return t(this,void 0,void 0,(function*(){const t=jg({targetId:e.targetId,type:e.conversationType,busChannel:e.channelId,msgIds:[i],qryType:2,users:s}),n=yield this._ctx.query($s.qryReceipt,i,t);if(!n.isOk)return n.wipe();const r=n.data,{resp:o}=Yg(r.pbData),a=o[0];return gi({pageToken:"",totalCount:0,users:[...a.readUser,...a.unreadUser].map((e=>{const{userId:t,mentioned:i,receiptTime:s}=e;return{userId:t,timestamp:s||0,isMentioned:!!i}}))})}))}requestSpeechToTextForMessage(e,s){return t(this,void 0,void 0,(function*(){const t=Ii.create("requestSpeechToTextForMessage").isObject("option",s,!0).fail(D.BIZ_ERROR_INVALID_PARAMETER,"option type error").validate("messageType",null==s?void 0:s.messageType,(e=>e===Q.HQ_VOICE||e===Q.VOICE),!0).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).check((e=>{if(s.messageType===Q.HQ_VOICE)e.validate("numberOfChannels",s.numberOfChannels,(e=>1===e),!0).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"numberOfChannels invalid").validate("sampleRate",s.sampleRate,(e=>16e3===e||8e3===e),!0).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"sampleRate invalid").isString("format",s.format).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"format invalid").isHttpUrl("remoteUrl",s.remoteUrl,!0).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"remoteUrl invalid");else{const{content:t}=s;e.isNotEmptyString("content",t,!0).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"content invalid")}})).isLimitedInteger("duration",s.duration,1,60,!0).fail(D.SPEECH_TO_TEXT_MESSAGE_CONTENT_UNSUPPORTED,"duration invalid").result();return t.isOk?i(this,yI,"f").has(e)?Ei(D.SPEECH_TO_TEXT_REQUEST_IN_PROCESS,"speech to text request in process"):(i(this,YE,"m",CI).call(this,e,s),gi()):t.wipe()}))}modifyMessageWithParams(e){return t(this,void 0,void 0,(function*(){const{messageUId:t,messageContent:i,conversation:s}=e,n=Uc.encode(ya,{targetId:s.targetId,type:s.conversationType,busChannel:s.channelId,msgUID:t,msgTime:0,content:JSON.stringify(i),fromUserId:""}),r=yield this._ctx.query($s.modifyMsg,this._ctx.currentUserId,n,Ca);if(!r.isOk)return r.wipe();const o=this.storage.getModel(s);if(o){const{latestMessage:e,conversationType:s}=o;e&&e.messageUId===t&&(e.content=i,e.isModifyMessage=!0,e.modifyInfo=s===w.ULTRA_GROUP?void 0:{timestamp:r.data.modifyTime,status:Gi.SUCCESS,content:{}},o.updateAttrs({latestMessage:e}))}return gi()}))}refreshReferenceMessageWithParams(e,s,n,r,o){return t(this,void 0,void 0,(function*(){const t=Ii.create("refreshReferenceMessageWithParams").validate("messageInfoMap",o,(t=>t&&e.every((e=>t[e]&&pt(t[e])))),!0).fail(D.INVALID_PARAMETER_MESSAGE_INFO_MAP).result();return t.isOk?(setTimeout((()=>{r([]),i(this,YE,"m",bI).call(this,e,s,n,o)}),0),gi()):t.wipe()}))}addTagForConversations(e,i){return t(this,void 0,void 0,(function*(){if(!this._userSettins.hasTag(e))return Ei(D.TAG_NOT_EXIST);const t=this.storage.get("conversationStatusVersion"),s=Date.now(),{currentUserId:n}=this._ctx,r=i.map((t=>({type:t.conversationType,channelId:t.targetId,busChannel:t.channelId,time:s,stateItem:[{sessionStateType:Cc.Tags,value:"",tags:[{tagId:e}]}]}))),o=Qg(t,r),a=yield this._ctx.query($s.addTag,n,o,da);if(!a.isOk)return a.wipe();const{version:l,updateVersion:c}=a.data,_=new Map;i.forEach((t=>{const i=this.storage.getOrCreateModel(t,!0),s={},{tags:n}=i;n.some((t=>t.tagId===e))||(s.tags=n.concat({tagId:e}),_.set(i,s))}));const d=[],u=[];return Array.from(_.entries()).forEach((([e,t])=>{u.push(e);const i=e.updateAttrs(t,l);i&&d.push({conversation:e.toIReceivedConversation(),updatedItems:i})})),this.storage.updateConversationStorage(u),c&&this.storage.set("conversationStatusVersion",l),d.length>0&&this.emit("conversationStatusChanged",d),gi()}))}getTagsForConversation(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getOrCreateModel(e,!1),i=this._userSettins.getTags(),s=t.tags.map((e=>{var t;return{tagId:e.tagId,tagName:null===(t=i[e.tagId])||void 0===t?void 0:t.tagName}}));return gi(s)}))}setConversationStatusInTag(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),{isTop:n}=s,r=this.storage.getOrCreateModel(i,!1),{tags:o}=r,a=o.find((t=>t.tagId===e));if(!a)return Ei(D.NO_TAG_IN_CONVER);const l=Qg(t,[{type:i.conversationType,channelId:i.targetId,busChannel:i.channelId,time:Date.now(),stateItem:[{sessionStateType:Cc.Tags,value:"",tags:[{tagId:e,isTop:n}]}]}]),{currentUserId:c}=this._ctx,_=yield this._ctx.query($s.addTag,c,l,da);if(!_.isOk)return _.wipe();const{version:d,updateVersion:u}=_.data;return a.isTop=n,r.updateAttrs({tags:o},d),this.storage.updateConversationStorage([r]),u&&this.storage.set("conversationStatusVersion",d),gi()}))}removeTagForConversations(e,i){return t(this,void 0,void 0,(function*(){const t=this.storage.get("conversationStatusVersion"),s=Qg(t,i.map((t=>({type:t.conversationType,channelId:t.targetId,busChannel:t.channelId,time:Date.now(),stateItem:[{sessionStateType:Cc.Tags,value:"",tags:[{tagId:e}]}]})))),{currentUserId:n}=this._ctx,r=yield this._ctx.query($s.delTag,n,s,da);if(!r.isOk)return r.wipe();const{version:o,updateVersion:a}=r.data,l=i.map((t=>{const i=this.storage.getOrCreateModel(t,!0),{tags:s}=i,n={tags:s.filter((t=>t.tagId!==e))};return i.updateAttrs(n,o),i}));return this.storage.updateConversationStorage(l),a&&this.storage.set("conversationStatusVersion",o),gi()}))}removeTagsForConversation(e,i){return t(this,void 0,void 0,(function*(){const{currentUserId:t}=this._ctx,s=this.storage.get("conversationStatusVersion"),n=Qg(s,[{type:e.conversationType,channelId:e.targetId,busChannel:e.channelId,time:Date.now(),stateItem:[{sessionStateType:Cc.Tags,value:"",tags:i.map((e=>({tagId:e})))}]}]),r=yield this._ctx.query($s.delTag,t,n,da);if(!r.isOk)return r.wipe();const{version:o,updateVersion:a}=r.data,l=this.storage.getOrCreateModel(e,!0),{tags:c}=l,_={tags:c.filter((e=>!i.includes(e.tagId)))};return l.updateAttrs(_,o),this.storage.updateConversationStorage([l]),a&&this.storage.set("conversationStatusVersion",o),gi()}))}getConversationListByTag(e,s,n){return t(this,void 0,void 0,(function*(){if(!this._userSettins.hasTag(e))return gi([]);const t=s||Number.MAX_SAFE_INTEGER,r=this.storage.getAllSGModels().filter((i=>i.operationTime<t&&i.tags.some((t=>t.tagId===e)))).sort(((e,t)=>t.operationTime-e.operationTime)).slice(0,n);if(0===r.length)return gi([]);const o=r.map((t=>Object.assign(Object.assign({},t.toIReceivedConversation()),{isTopInTag:t.tags.some((t=>t.tagId===e&&t.isTop))})));return i(this,YE,"m",NI).call(this,o)}))}getUnreadCountByTag(e,i){return t(this,void 0,void 0,(function*(){let t=0;return this.storage.getAllSGModels().forEach((s=>{var n;if(s.tags.some((t=>t.tagId===e))){if(s.notificationLevel>Ee.NOT_SET&&!i)return;t+=null!==(n=s.unreadCount)&&void 0!==n?n:0}})),gi(t)}))}batchDeleteConversations(e){return t(this,void 0,void 0,(function*(){const{identifiers:t,deleteMessages:i}=e,s=Uc.encode(Ko,{relation:t.map((({conversationType:e,targetId:t,channelId:i})=>({conversationType:e,conversationId:t,busChannel:i}))),cleanMsg:i}),n=yield this._ctx.query($s.delRelationBatch,this._ctx.currentUserId,s,void 0);return n.isOk&&t.forEach((e=>{const t=this.storage.getModel(e);t&&this.storage.removeConversation(t)})),n.wipe()}))}sendReadReceiptV2(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ga,{msgId:i,channelId:s});return(yield this._ctx.query($s.rrMsg,e,t)).wipe()}))}sendUltraGroupTypingStatus(e){return t(this,void 0,void 0,(function*(){const{conversationType:t,channelId:i,targetId:s}=e,n=Uc.encode(Da,{targetId:s,type:t,busChannel:i||"",opType:0}),r=new Or($s.operate,n,s);r.setHeaderQos(nn);return(yield this._ctx.send(r)).wipe()}))}getUltraGroupList(e){return t(this,void 0,void 0,(function*(){const{targetId:t,channelType:i}=e||{},s=this.storage.getAllUGModels().filter((e=>!(void 0!==t&&t!==e.targetId||void 0!==i&&i!==e.channelType))).sort(((e,t)=>{var i,s;const n=(null===(i=e.latestMessage)||void 0===i?void 0:i.sentTime)||0;return((null===(s=t.latestMessage)||void 0===s?void 0:s.sentTime)||0)-n})).map((e=>{const t=e.toIReceivedConversation();return t.unreadMentionedCount=D_(t.unreadMentionedCount||0),t.unreadMessageCount=D_(t.unreadMessageCount||0),t.unreadMentionedMeCount=D_(t.unreadMentionedMeCount||0),t}));return gi(s)}))}getRemoteMessagesByUIds(e,s){return t(this,void 0,void 0,(function*(){const{currentUserId:t}=this._ctx,n=yield i(this,YE,"m",MI).call(this,e,s);if(!n.isOk)return n.wipe();const{list:r,notExistMsgId:o}=n.data,a=r.map((i=>y_(i,t,!1,e.targetId)));return gi(a)}))}getUGUnreadMentionedDigest(e){return t(this,void 0,void 0,(function*(){const{targetId:t,channelId:i,sentTime:s,count:n}=e,r=Uc.encode(Do,{groupId:t,busChannel:i,msgTime:s,size:n}),o=yield this._ctx.query($s.qryUgUal,this._ctx.currentUserId,r,wo);if(!o.isOk)return o.wipe();const{msgInfo:a}=o.data;return gi(a.map((e=>({messageUId:e.msgId,sentTime:e.msgTime,messageType:e.className,mentionedType:e.remindType}))))}))}updateUGMessageExpansion(e,i,s){var n;return t(this,void 0,void 0,(function*(){const{currentUserId:t}=this._ctx,{mid:r,put:o,del:a,clear:l}=i,c=Uc.encode(ya,{fromUserId:t,targetId:e.targetId,type:e.conversationType,busChannel:e.channelId,msgUID:r,msgTime:s,content:JSON.stringify(i)}),_=yield this._ctx.query($s.upMsgEx,e.targetId,c);if(_.isOk){const t=null===(n=this.storage.getModel(e))||void 0===n?void 0:n.latestMessage;(null==t?void 0:t.messageUId)===r&&(l?t.expansion={}:o?t.expansion=Object.assign(Object.assign({},t.expansion),o):a&&t.expansion&&a.forEach((e=>{delete t.expansion[e]})))}return _.wipe()}))}setUGDefaultNotificationLevel(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ca,{unpushLevel:i,busChannel:s});return(yield this._ctx.query($s.ugUnpushSet,e,t)).wipe()}))}getUGDefaultNotificationLevel(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(la,{busChannel:i}),s=yield this._ctx.query($s.ugUnpushQuery,e,t,_a);if(!s.isOk)return s.wipe();const{unpushLevel:n}=s.data;return gi(n)}))}getUnreadMentionedCount(e){var i;return t(this,void 0,void 0,(function*(){const t=this.storage.getModel(e);return gi(null!==(i=null==t?void 0:t.unreadMentionedCount)&&void 0!==i?i:0)}))}getAllUnreadMentionedCount(){return t(this,void 0,void 0,(function*(){const e=this.storage.getAllSGModels().reduce(((e,t)=>e+t.unreadMentionedCount),0);return gi(e)}))}getTotalUnreadCountByLevels(e,i,s){return t(this,void 0,void 0,(function*(){let t=0;return this.storage.getAllModels().forEach((n=>{if(!e.includes(n.conversationType))return;const{notificationLevel:r,unreadCount:o,unreadMentionedCount:a}=n;(0===i.length||i.includes(r))&&(t+=s?a:o)})),gi(t)}))}getConversationUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getModel(e);return gi(t?t.unreadCount:0)}))}getFirstUnreadMessageDigest(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getModel(e);if(!t)return gi(null);const i=t.firstUnreadMessage;return gi(i?{messageUId:i.messageUId||"",sentTime:i.sentTime}:null)}))}getUGUnreadCountForAllChannels(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.storage.getAllUGModels().reduce(((t,n)=>{const r=s?n.unreadMentionedCount:n.unreadCount;if(!r||n.targetId!==e)return t;const o=n.notificationLevel||Ee.NOT_SET;return!i.length||i.includes(o)?t+r:t}),0);return gi(D_(t))}))}getUGUnreadInfoList(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getAllUGModels().filter((t=>e.includes(t.targetId))).map((e=>({conversationType:e.conversationType,type:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadMessageCount:D_(e.unreadCount||0),mentionedCount:D_(e.unreadMentionedCount||0),mentionedMeCount:D_(e.unreadMentionedMeCount||0),notificationLevel:e.notificationLevel||Ee.NOT_SET})));return gi(t)}))}getUGFirstUnreadMessageDigest(e){return t(this,void 0,void 0,(function*(){const t=this.storage.getModel(e),i=null==t?void 0:t.firstUnreadMessage;return i?gi(i):Ei(D.RC_DB_DATA_NOT_FOUND)}))}getBlockedUGList(){return t(this,void 0,void 0,(function*(){const e=this.storage.getAllUGModels().filter((e=>e.notificationLevel>Ee.NOT_SET)).map((e=>e.toIReceivedConversation()));return gi(e)}))}clearConversationUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=this._ctx.serverTime;if(e.conversationType===w.ULTRA_GROUP){const i=xg(e,t),s=new Or($s.updUgRTime,i,this._ctx.currentUserId);s.setHeaderQos(nn);const n=yield this._ctx.send(s);if(!n.isOk)return n.wipe()}return this.storage.clearConversationUnreadCount(e,t),gi()}))}getRealtimeConversations(e,s,n){return t(this,void 0,void 0,(function*(){const t=yield i(this,YE,"m",UI).call(this,s,n,e,[],Ce.ALL,$s.qrySessions);if(!t.isOk)return t.wipe();const{currentUserId:r}=this._ctx,o=t.data.info.map((e=>{const{unreadCount:t,busChannel:i,type:s,userId:n,versionTime:o,msg:a}=e,l=this.storage.getOrCreateModel({conversationType:s,targetId:n,channelId:i||""},!1);return Object.assign(Object.assign({},l.toIReceivedConversation()),{unreadMessageCount:t,operationTime:o,latestMessage:a?y_(a,r,!1,n):null})})).sort(((e,t)=>{var i,s;const r=(null===(i=e.latestMessage)||void 0===i?void 0:i.sentTime)||0,o=(null===(s=t.latestMessage)||void 0===s?void 0:s.sentTime)||0;return 0===n?o-r:r-o}));return gi(o)}))}getRealtimeConTotalUnreadCount(){return t(this,void 0,void 0,(function*(){const e=Uc.encode(Ho,{nothing:1});return(yield this._ctx.query($s.qrySessionsAtt,this._ctx.currentUserId,e,jo)).trans((e=>e.totalUnreadCount))}))}clearRealtimeConUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=this._ctx.serverTime;this.storage.clearConversationUnreadCount(e,this._ctx.serverTime);const i=xg(e,t),s=new Or($s.updRRTime,i,this._ctx.currentUserId);return(yield this._ctx.send(s)).wipe()}))}removeRealtimeConversations(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Wo,{sessions:e.map((e=>({type:e.conversationType,channelId:e.targetId,busChannel:e.channelId})))});return(yield this._ctx.query($s.delSessions,this._ctx.currentUserId,t)).wipe()}))}batchGetRealtimeConUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(qo,{sessions:e.map((e=>({type:e.conversationType,channelId:e.targetId,busChannel:e.channelId})))});return(yield this._ctx.query($s.qrySessionsUnread,this._ctx.currentUserId,t,Jo)).trans((e=>e.sessions.map((e=>({conversationType:e.type,targetId:e.channelId,channelId:e.busChannel||"",unreadCount:e.unreadCount||0})))))}))}getUnreadMentionMeConversationList(e,s){return t(this,void 0,void 0,(function*(){const{count:t,conversationTypes:n}=e,r=e.timestamp||Number.MAX_SAFE_INTEGER;if(s){const e=this.storage.getAllModels().filter((e=>e.operationTime<r&&e.unreadMentionedCount>0&&n.includes(e.conversationType)&&(e.conversationType!==w.ULTRA_GROUP||!e.channelId||"RCDefault"===e.channelId))).sort(((e,t)=>t.operationTime-e.operationTime)).slice(0,t);return gi(e.map((e=>e.toIReceivedConversation())))}const o=this.storage.getAllSGModels().filter((e=>e.operationTime<r&&e.unreadMentionedCount>0&&n.includes(e.conversationType))).sort(((e,t)=>t.operationTime-e.operationTime)).slice(0,t).map((e=>e.toIReceivedConversation()));return i(this,YE,"m",NI).call(this,o)}))}loadConversationList(e,i,s){return t(this,void 0,void 0,(function*(){const t=((e,t,i)=>{const{conversationTypes:s,tagFilter:n={},order:r,channelId:o}=i,{tagIds:a,topPriority:l}=n;return Uc.encode(Uo,{type:s,count:t,order:r,tags:a,isTagTop:!!l,pageToken:e,compress:bs.enable()})})(e,i,s),n=yield this._ctx.query($s.qryRelationFilter,this._ctx.currentUserId,t,void 0);if(!n.isOk)return n.wipe();const{pageToken:r,isFinished:o,info:a}=Fg(n.data.pbData),l=a.map((e=>{const{busChannel:t,type:i,userId:s}=e,n={conversationType:i,targetId:s,channelId:t||""},r=this.storage.getOrCreateModel(n,!1);return Object.assign(Object.assign({},r.toIReceivedConversation()),{operationTime:e.versionTime,latestMessage:e.msg?y_(e.msg,this._ctx.currentUserId,!1,s):null})}));return gi({pageToken:r||"",finished:!!o,list:l})}))}updateConversationReadTime(e,i){return t(this,void 0,void 0,(function*(){const t=xg(e,i),s=new Or($s.updRTime,t,this._ctx.currentUserId);return(yield this._ctx.send(s)).wipe()}))}getMessageReader(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ga,{msgId:[i],channelId:s});return(yield this._ctx.query($s.rrList,e,t,Aa)).trans((e=>({totalMemberCount:e.totalMemberNum,list:e.list})))}))}sendReadReceiptMessageV4(e,i,s){return t(this,void 0,void 0,(function*(){const{conversationType:t,targetId:n,channelId:r}=e,o=Uc.encode(Ba,{targetId:n,type:t,busChannel:r,startMsgId:i,endMsgId:s}),a=new Or($s.sendMsgRead,o,n);return(yield this._ctx.send(a)).wipe()}))}getMessageReadReceiptV4(e,i){return t(this,void 0,void 0,(function*(){const{targetId:t,channelId:s=""}=e,n=Uc.encode(Ha,{targetId:t,busChannel:s,msgId:i});return(yield this._ctx.query($s.qryMsgRead,t,n,ja)).trans((({list:e,num:t,readCnt:i})=>({list:e.map((e=>({userId:e.userId,readTime:e.receiptTime}))),totalCount:t,readCount:i})))}))}batchGetMessageReadReceiptInfoV4(e,i){return t(this,void 0,void 0,(function*(){const{targetId:t,conversationType:s,channelId:n}=e,r=Uc.encode(Ya,{type:s,busChannel:n,msgId:i});return(yield this._ctx.query($s.qryMsgReadCntBatch,t,r,Wa)).trans((({result:t})=>t.map((t=>Object.assign({messageUId:t.msgId,readedCount:t.cnt,totalCount:t.tmn},e)))))}))}getConversationsIncludingRobots(e){return t(this,void 0,void 0,(function*(){const{count:t,conversationTypes:s}=e;if(!this._ctx.includeUg)return i(this,YE,"m",vI).call(this,e.timestamp,t,0,s,Ce.ROBOT_ONLY);let n=e.timestamp||Number.MAX_SAFE_INTEGER;const r=this.storage.getAllSGModels().filter((e=>e.includeRobot&&e.operationTime<n&&s.includes(e.conversationType))).sort(((e,t)=>t.operationTime-e.operationTime)).slice(0,t);return gi(r.map((e=>e.toIReceivedConversation())))}))}markRemoteConversationAsRead(e,s,n){return t(this,void 0,void 0,(function*(){const t=yield i(this,QE,"f").sendMessage(e,s,n);if(!t.isOk)return t.wipe();const{sentTime:r}=t.data,o=this.storage.getModel(e);return o&&(o.clearUnreadCount(r),this.storage.updateConversationStorage([o])),t.wipe()}))}_updateMessageReaction(e,i){return t(this,void 0,void 0,(function*(){const{conversationIdentifier:t,pushConfig:s,reactionId:n,messageUId:r}=i,{targetId:o,conversationType:a,channelId:l}=t,c=$g(s),_=Uc.encode(hc,{targetId:o,type:a,busChannel:l,msgId:r,reactionId:n,pushExt:c,appData:null==s?void 0:s.pushData,pushText:null==s?void 0:s.pushContent});return(yield this._ctx.query(e,o,_,gc)).wipe()}))}addMessageReaction(e){return t(this,void 0,void 0,(function*(){const t={[w.PRIVATE]:$s.addPReaction,[w.GROUP]:$s.addGReaction,[w.ULTRA_GROUP]:$s.addUgReaction}[e.conversationIdentifier.conversationType];return this._updateMessageReaction(t,e)}))}removeMessageReaction(e){const t={[w.PRIVATE]:$s.rmPReaction,[w.GROUP]:$s.rmGReaction,[w.ULTRA_GROUP]:$s.rmUgReaction}[e.conversationIdentifier.conversationType];return this._updateMessageReaction(t,e)}batchGetMessageReactionSummaries(e){var i;return t(this,void 0,void 0,(function*(){const{conversationIdentifier:t,messageUIds:s}=e,{targetId:n,conversationType:r,channelId:o}=t,a=r===w.ULTRA_GROUP?$s.ugMReactBQ:$s.mReactBQ,l=Uc.encode(Ec,{targetId:n,type:r,busChannel:o,msgId:s,compress:bs.enable(),allUser:!1}),c=yield this._ctx.query(a,s[0],l,void 0);if(!c.isOk)return c.wipe();const{msgReaction:_}=rE(c.data.pbData),d={};return s.forEach((e=>{d[e]=[]})),null===(i=_)||void 0===i||i.forEach((e=>{d[e.msgId]=lE(e.reaction,e.msgId)})),gi(d)}))}getMessageReactions(e){return t(this,void 0,void 0,(function*(){const{conversationIdentifier:t,pageToken:i,count:s,messageUId:n}=e,{targetId:r,conversationType:o,channelId:a}=t,l=o===w.ULTRA_GROUP?$s.ugMReactQ:$s.mReactQ,c=Uc.encode(Tc,{targetId:r,type:o,busChannel:a,msgId:n,size:s,pageToken:i,compress:bs.enable(),allUser:!1}),_=yield this._ctx.query(l,n,c,void 0);if(!_.isOk)return _.wipe();const{pageToken:d,reaction:u}=oE(_.data.pbData),h={pageToken:d||"",reactions:lE(u,n)};return gi(h)}))}getMessageReactionUsers(e){return t(this,void 0,void 0,(function*(){const{conversationIdentifier:t,pageToken:i,count:s,messageUId:n,reactionId:r}=e,{targetId:o,conversationType:a,channelId:l}=t,c=a===w.ULTRA_GROUP?$s.ugMReactUQ:$s.mReactUQ,_=Uc.encode(Tc,{targetId:o,type:a,busChannel:l,msgId:n,reactionId:r,size:s,pageToken:i,compress:bs.enable()}),d=yield this._ctx.query(c,n,_,void 0);if(!d.isOk)return d.wipe();const{pageToken:u,reaction:h}=aE(d.data.pbData),g=h.user,E={pageToken:u||"",totalCount:h.userCnt,users:g.map((({userId:e,reactionTime:t})=>({userId:e,reactionTime:t})))};return gi(E)}))}}WE=new WeakMap,qE=new WeakMap,JE=new WeakMap,KE=new WeakMap,QE=new WeakMap,XE=new WeakMap,zE=new WeakMap,ZE=new WeakMap,uI=new WeakMap,yI=new WeakMap,YE=new WeakSet,$E=function(e,t,i){if(t!==D.SUCCESS||!this._ctx.includeUg||0===i.length)return;const s=[w.PRIVATE,w.SYSTEM];this.storage.getAllSGModels().filter((e=>s.includes(e.conversationType)&&i.some((t=>t.robotId===e.targetId)))).forEach((e=>e.updateAttrs({includeRobot:!0})))},eI=function(e,t){const{conversationType:i,targetId:s,channelId:n,senderUserId:r}=e;if(i!==w.PRIVATE)return!1;if(r===this._ctx.currentUserId){const r={conversationType:i,targetId:s,channelId:n},o=this.storage.getOrCreateModel(r,!0);if(o.version<e.sentTime){const i=o.clearUnreadCount(e.sentTime);i&&t.set(o,Object.assign(Object.assign({},t.get(o)),i))}}return!0},tI=function(e,t,i,s){const{conversationType:n,targetId:r,channelId:o,senderUserId:a,content:l}=t;if(a!==this._ctx.currentUserId)return!1;const c={conversationType:n,targetId:r,channelId:o},_=this.storage.getOrCreateModel(c,!0);if(_.version>=t.sentTime)return!1;const d=_.clearUnreadCount(t.sentTime);return d&&i.set(_,Object.assign(Object.assign({},i.get(_)),d)),_.removeRecvMessageRecords(t.sentTime),1!==e.sesDriven||(t.isOffLineMessage&&s.push(Object.assign(Object.assign({},c),{timestamp:l.lastMessageSendTime})),!1)},iI=function(e,t){const{conversationType:i,targetId:s,channelId:n,content:r}=e,o={conversationType:i,targetId:s,channelId:n},a=i===w.PRIVATE?{privateReadReceipt:Object.assign(Object.assign({},o),{endMsgTime:r.endMsgTime})}:{groupReadReceipt:Object.assign(Object.assign({},o),{totalCount:r.tmn,readedCount:r.rrn,messageUId:r.msgId})};t.push(a)},sI=function(e,t,i,s){var n;const{content:r,conversationType:o,targetId:a,channelId:l,isPersited:c,isStatusMessage:_,isCounted:d,messageType:u,isMentioned:h,senderUserId:g,disableUpdateLastMessage:E}=e;if(!W(o,k))return;if(_||!c)return;if(P_(i).isOk)return;const I={conversationType:o,targetId:a,channelId:l},T=this.storage.getOrCreateModel(I,!0),f=g===s,R=u===Q.RECALL,A=e.sentTime>T.version,p=T.hidden&&!A,m={};A&&(m.hidden=!1);const S=()=>{const i=T.updateAttrs(m,e.sentTime);i&&t.set(T,Object.assign(Object.assign({},t.get(T)),i))};if(!p&&(!R||T.hidden)&&e.sentTime>=T.operationTime&&(m.operationTime=e.sentTime),p||E||T.latestMessage&&!(e.sentTime>=T.latestMessage.sentTime)||(m.latestMessage=i.supportRecallRefactor&&R?U_(e,!0):e),!A)return void S();if(m.version=e.sentTime,R){let{sentTime:t,originalFromUserId:i}=r;return i||(i=g),t&&t>T.lastReadTime&&!(null===(n=e.__innerData__)||void 0===n?void 0:n.keepUnreadCount)&&i!==s&&(m.unreadCount=Math.max(T.unreadCount-1,0),0===m.unreadCount&&(m.firstUnreadMessageUId="",m.firstUnreadTime=0,m.firstUnreadMessageType="",m.unreadMentionedCount=0,m.unreadMentionedMeCount=0,m.hasMentioned=!1,m.mentionedInfo=void 0),T.addRecvMessageRecord(t,-1)),void S()}if(f||!d)return void S();let v;if(m.unreadCount=T.unreadCount+1,0===T.unreadCount&&(m.firstUnreadMessageUId=e.messageUId,m.firstUnreadTime=e.sentTime,m.firstUnreadMessageType=e.messageType),r.mentionedInfo){const{type:e,userIdList:t}=r.mentionedInfo,i=e===K.ALL||e===K.SINGAL&&(null==t?void 0:t.includes(s));i&&(v=e,m.hasMentioned=i,m.mentionedInfo={type:e,userIdList:t},m.unreadMentionedCount=T.unreadMentionedCount+1,e===K.SINGAL&&(m.unreadMentionedMeCount=T.unreadMentionedMeCount+1))}T.addRecvMessageRecord(e.sentTime,1,v),S()},nI=function(e,t){const{conversationType:i,targetId:s,channelId:n,content:r}=e,o={conversationType:i,targetId:s,channelId:n||""},{put:a,del:l,mid:c,clear:_}=r;if(a?t.push({updatedExpansion:Object.assign(Object.assign({},o),{messageUId:c,expansion:a})}):l&&t.push({deletedExpansion:Object.assign(Object.assign({},o),{messageUId:c,deletedKeys:l})}),!this._ctx.includeUg)return;const d=this.storage.getModel(o);d&&d.latestMessage&&d.latestMessage.messageUId===c&&(_?d.latestMessage.expansion={}:a?d.latestMessage.expansion=Object.assign(Object.assign({},d.latestMessage.expansion),a):l&&d.latestMessage.expansion&&l.forEach((e=>{delete d.latestMessage.expansion[e]})))},rI=function(e){const{currentUserId:t}=this._ctx,s=this._ctx.getNaviInfoFromCache(),n={v4ReadReceipts:[],v4SyncNotify:[],expansions:[],logCmdMessages:[],cloudControllerMessages:[],messages:[],updateModels:new Map};return n.messages=e.filter((e=>{switch(e.messageType){case Q.DELIVERED:case Q.DELIVERED_MSG:return!1;case Q.LOG_COMMAND:return n.logCmdMessages.push(e),!1;case Q.CLOUD_CONTROL:return n.cloudControllerMessages.push(e),!1;case Q.READ_RECEIPT:return i(this,YE,"m",eI).call(this,e,n.updateModels);case Q.SYNC_READ_STATUS:return i(this,YE,"m",tI).call(this,s,e,n.updateModels,n.v4SyncNotify);case Q.READ_STATE:return i(this,YE,"m",iI).call(this,e,n.v4ReadReceipts),!1;case Q.READ_RECEIPT_REQUEST:return this.storage.addReadReceiptRequest(e,t);case Q.READ_RECEIPT_RESPONSE:return this.storage.handleReadReceiptResponse(e,t);case Q.EXPANSION_NOTIFY:return i(this,YE,"m",nI).call(this,e,n.expansions),!1;default:return i(this,YE,"m",sI).call(this,e,n.updateModels,s,t),!0}})),n},oI=function(e,t,n,r){e.stopPropagation(),this._ctx.recordReceivedMessagesForStatistics(n);const{messages:o,v4ReadReceipts:a,v4SyncNotify:l,expansions:c,logCmdMessages:_,cloudControllerMessages:d,updateModels:u}=i(this,YE,"m",rI).call(this,n);if(l.length&&this.emit("syncReadStatusV4",l),o.length&&this.emit("messages",t,o,r),!i(this,ZE,"f")&&"pullMsg"===t&&r&&(s(this,ZE,!0,"f"),this.emit("offlineFinished"),i(this,KE,"f").startInterval(DI,!0)),c.length&&this.emit("expansions",c),a.length&&this.emit("readReceiptV4",a),u.size){const e=[],t=[];Array.from(u.entries()).forEach((([i,s])=>{t.push(i),e.push({conversation:i.toIReceivedConversation(),updatedItems:s})})),this.storage.updateConversationStorage(t),this.emit("conversationStatusChanged",e)}this._ctx.handleLogCmdMessages(_),this._ctx.handleCloudControllerMessage(d)},aI=function(e,t,i){if(t!==UE)return;e.stopPropagation();const s=[];i.forEach((e=>{const{subChangeType:t}=e;if(0!==t)return;const i=Uc.decode(Dl,new Uint8Array(e.eventData)),{msgId:n,unreadCnt:r,readCnt:o,readList:a,totalCnt:l}=i;s.push({identifier:{conversationType:e.channelType,targetId:e.businessId,channelId:e.secondaryId},messageUId:n,users:a.map((e=>({userId:e.userId,timestamp:e.receiptTime,isMentioned:!!e.mentioned}))),readCount:o,unreadCount:r,totalCount:l})})),this._ctx.emit("readReceiptResponseV5",s)},lI=function(e){return t(this,void 0,void 0,(function*(){s(this,ZE,!1,"f"),e||(i(this,qE,"f").setInitVersion(0),this._ctx.includeUg&&i(this,YE,"m",hI).call(this)),this._ctx.svrUnread&&(e||this.storage.getAllSGModels().forEach((e=>e.clearUnreadCount(0))),yield i(this,YE,"m",cI).call(this,0),this.emit("syncServerSaveUnreadCompleted")),i(this,qE,"f").startInterval(DI,!0)}))},cI=function e(s,n=new Map,o){return t(this,void 0,void 0,(function*(){const{logger:t,currentUserId:a}=this._ctx,l=t.createTraceId();t.info(r.L_PULL_SG_UNREAD_COUNT_T,JSON.stringify({version:s,pageToken:o}),l);const c=((e,t)=>Uc.encode(jl,{version:e,compress:bs.enable(),pageToken:t}))(s,o),_=yield this._ctx.query($s.pullSe,a,c,void 0);if(!_.isOk)return void t.warn(r.L_PULL_SG_UNREAD_COUNT_R,_.errmsg(),l);const{session:d,pageToken:u}=nE(_.data.pbData);if(t.summary(r.L_PULL_SG_UNREAD_COUNT_R,_,l,{nextPageToken:u}),d.forEach((e=>{const{targetId:t,type:i,busChannel:s,unread:r}=e,o={conversationType:i,targetId:t,channelId:s},l=this.storage.getOrCreateModel(o,!0),c=l.calibrateUnreadCount(r,a);c&&n.set(l,Object.assign(Object.assign({},n.get(l)),c))})),u)return i(this,YE,"m",e).call(this,s,n,u);this.storage.updateConversationStorage(Array.from(n.keys()))}))},_I=function(e){return t(this,void 0,void 0,(function*(){if(!e){this.settings.reset();const e=yield this.settings.syncDataFromServer();this.settings.setInitVersion(e)}this._ctx.isConnected&&this.settings.startInterval(DI,!0)}))},dI=function(e,t){s(this,XE,!1,"f"),t||this.storage.syncDataFromLocalStorage(this._ctx),i(this,YE,"m",_I).call(this,t),i(this,YE,"m",lI).call(this,t),this._ctx.ugEnabel&&i(this,YE,"m",RI).call(this,t)},hI=function e(){return t(this,void 0,void 0,(function*(){if(!this._ctx.isConnected)return;const{logger:t}=this._ctx,n=t.createTraceId(),o=i(this,uI,"f");t.info(r.L_PULL_SG_RELATIONS_T,JSON.stringify({startTime:o}),n);const a=yield i(this,YE,"m",UI).call(this,o,1,1e3);if(!a.isOk)return t.warn(r.L_PULL_SG_RELATIONS_R,a.errmsg(),n),void setTimeout((()=>i(this,YE,"m",e).call(this)),1e3);const{info:l,isFinished:c,pullTime:_}=a.data;if(s(this,uI,_,"f"),t.info(r.L_PULL_SG_RELATIONS_R,JSON.stringify({startTime:o,isFinished:c,pullTime:_}),n),this.storage.addRelations(l,this._ctx.currentUserId),!c)return i(this,YE,"m",e).call(this);this.emit("sgRelationsSynced",D.SUCCESS)}))},gI=function(e,s,n){return t(this,void 0,void 0,(function*(){const t=yield i(this,YE,"m",MI).call(this,e,s);if(!t.isOk)return;const r=t.data.list.map((t=>y_(t,this._ctx.currentUserId,!1,e.targetId))),o=this.storage.getModel(e);if(o&&o.latestMessage){const e=r.find((e=>e.messageUId===o.latestMessage.messageUId));e&&o.updateAttrs({latestMessage:e})}2===n?this._ctx.emit("messageModified",r):1===n&&this._ctx.emit("ugMsgExpansionUpdated",r)}))},EI=function(e,t,s){i(this,YE,"m",gI).call(this,t,s,2)},II=function(e,t,s){i(this,YE,"m",gI).call(this,t,s,1)},TI=function(e,t){const s=t.map((e=>{const{targetId:t,busChannel:s,msgUID:n,msgTime:r,operatorId:o,remindType:a}=e,l={conversationType:w.ULTRA_GROUP,targetId:t,channelId:s||""},c=Object.assign(Object.assign({},l),{messageUId:n,sentTime:r}),_=Object.assign(Object.assign({},l),{sentTime:r,messageUId:n,senderUserId:o,content:c,messageDirection:1,messageType:Q.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:Re.UNREAD,receivedStatusInfo:Gt(Re.UNREAD)}),d=this.storage.getModel(l);return d&&i(this,YE,"m",fI).call(this,d,_,a),_}));this._ctx.emit("ugMsgRecalled",s)},fI=function(e,t,i){const s={},{messageUId:n,sentTime:r}=t.content,{latestMessage:o}=e;o&&o.messageUId===n&&(s.latestMessage=U_(t,!0)),r&&e.lastReadTime<r&&e.unreadCount&&(s.unreadCount=e.unreadCount-1,i!==K.ALL&&i!==K.SINGAL||!e.unreadMentionedCount||(s.unreadMentionedCount=e.unreadMentionedCount-1),i===K.SINGAL&&e.unreadMentionedCount&&(s.unreadMentionedMeCount=e.unreadMentionedMeCount-1));const a=e.updateAttrs(s,r);this.storage.updateConversationStorage([e]),a&&this.emit("conversationStatusChanged",[{conversation:e.toIReceivedConversation(),updatedItems:a}])},RI=function(e){return t(this,void 0,void 0,(function*(){const e=yield i(this,WE,"f").markOnline();if(!e.isOk)return;const{relations:t,msgVersion:n}=e.data;this.storage.addRelations(t,this._ctx.currentUserId),s(this,XE,!0,"f"),this.emit("ultraGroupEnable"),i(this,WE,"f").setInitVersion(n),i(this,WE,"f").startInterval(DI,!0),i(this,JE,"f").setInitVersion(n),i(this,JE,"f").startInterval(DI,!0)}))},AI=function(){s(this,XE,!1,"f"),this.settings.stopInterval(),i(this,WE,"f").reset(),i(this,qE,"f").reset(),i(this,JE,"f").reset()},pI=function(e,s){return t(this,void 0,void 0,(function*(){if(3===s.type)return e.stopPropagation(),void this.settings.push(s.time);if(7===s.type)return e.stopPropagation(),void i(this,JE,"f").push(s.time);if(12===s.type)return e.stopPropagation(),void i(this,KE,"f").push(s.time);if(13===s.type){e.stopPropagation();const t=new Map;if(yield i(this,YE,"m",cI).call(this,s.time,t),t.size>0){const e=Array.from(t.entries()).map((([e,t])=>({conversation:e.toIReceivedConversation(),updatedItems:t})));this.emit("conversationStatusChanged",e)}}}))},mI=function(e,t){1===t.type&&(e.stopPropagation(),i(this,qE,"f").push(t.time))},SI=function(e,t,i){const{syncMsg:s}=t,n=en(t.topic);if(s&&n===$s.updUgRTime){e.stopPropagation();const{channelId:i,busChannel:s,msgTime:n}=Uc.decode(Yo,t.pbData),r=this.storage.clearConversationUnreadCount({conversationType:w.ULTRA_GROUP,targetId:i,channelId:s||""},n);r&&this.emit("conversationStatusChanged",[r])}},vI=function(e,s,n,r,o){return t(this,void 0,void 0,(function*(){const{currentUserId:t}=this._ctx,a=yield i(this,YE,"m",UI).call(this,e,n||0,s,r,o);if(!a.isOk)return a.wipe();const{info:l,isFinished:c,pullTime:_}=a.data,d=l.map((e=>{const{userId:i,type:s,busChannel:n}=e,r=this.storage.getOrCreateModel({conversationType:s,targetId:i,channelId:n},!1);return Object.assign(Object.assign({},r.toIReceivedConversation()),{operationTime:e.versionTime,latestMessage:e.msg?y_(e.msg,t,!1,i):null})}));return gi(d)}))},NI=function(e){return t(this,void 0,void 0,(function*(){if(this._ctx.includeUg)return gi(e);const{currentUserId:t}=this._ctx,s=e.filter((({conversationType:e})=>e!==w.ULTRA_GROUP)).map((({conversationType:e,targetId:t,channelId:i})=>({conversationType:e,conversationId:t,busChannel:i})));if(0===s.length)return gi(e);const n=Uc.encode(Ko,{relation:s.slice(0,100)}),r=yield this._ctx.query($s.qryRLBatch,this._ctx.currentUserId,n,void 0);if(!r.isOk)return r.wipe();const{info:o}=i(this,YE,"m",LI).call(this,r.data.pbData);return o.forEach((i=>{if(!i.msg)return;const s=e.find((e=>(e.channelId||"")===(i.busChannel||"")&&e.targetId===i.userId&&e.conversationType===i.type));s.latestMessage=y_(i.msg,t,!1,i.userId),s.includeRobot=!!i.isBot})),gi(e)}))},OI=function(e,i,s,n,r){return t(this,void 0,void 0,(function*(){const t=[];void 0!==s&&t.push({sessionStateType:Cc.IsTop,value:s?"1":"0"}),void 0!==n&&t.push({sessionStateType:Cc.IsSilent,value:n.toString()}),void 0!==r&&t.push({sessionStateType:Cc.AutoTrans,value:r.toString()});const o=Qg(i,e.map((e=>({type:e.conversationType,channelId:e.targetId,busChannel:e.channelId,stateItem:t}))));return this._ctx.query($s.setSeAtt,this._ctx.currentUserId,o,da)}))},CI=function(e,s){return t(this,void 0,void 0,(function*(){i(this,yI,"f").add(e);const t=s.messageType===Q.HQ_VOICE?{msgId:e,objectName:s.messageType,content:s.remoteUrl,sampleRate:s.sampleRate,channelNumber:s.numberOfChannels,format:s.format}:{msgId:e,objectName:s.messageType,content:s.content},n=Uc.encode(wl,{businessType:1,businessInfo:Uc.encode(Gl,t)}),r=yield this._ctx.query($s.upConvertMsg,e,n,Vl);i(this,yI,"f").delete(e);const{code:o}=r;let a;if(r.isOk){const e=Uc.decode(kl,new Uint8Array(r.data.businessResult));a={status:be.SUCCESS,text:e.result}}else a={status:be.FAILED,text:""};this._ctx.emit("speechToTextResponse",{code:o,messageUId:e,sttInfo:a})}))},MI=function(e,t){const{targetId:i,conversationType:s,channelId:n}=e,r=Uc.encode(Ua,{targetId:i,type:s,query:t.map((e=>({msgTime:0,msgUID:e,busChannel:n})))});return this._ctx.query($s.qryMsg,this._ctx.currentUserId,r,Pa)},bI=function(e,s,n,r){return t(this,void 0,void 0,(function*(){const t=Object.values(r),o=[...new Set([...e,...t])],{isOk:a,code:l,data:c}=yield i(this,YE,"m",MI).call(this,s,o);if(!a)return void n(e.map((e=>({messageUId:e,code:l}))));const{list:_,notExistMsgId:d}=c,u=new Map(_.map((e=>{const t=y_(e,this._ctx.currentUserId,!1,s.targetId);return[t.messageUId,t]}))),h=e.map((e=>{const t=u.get(e);if(!t)return d.includes(e)?{messageUId:e,code:D.RC_DB_DATA_NOT_FOUND}:{messageUId:e,code:D.SERVER_DATA_ERROR};if(t.messageType!==Q.REFERENCE)return{messageUId:e,code:D.INVALID_PARAMETER_MESSAGE_TYPE};const i=r[e],s=u.get(i),n=t.content;return s?(n.referMsg=s.content,n.referMsgStatus=s.isModifyMessage?Vi.MODIFIED:Vi.DEFAULT,{messageUId:e,message:t,code:D.SUCCESS}):d.includes(i)?(n.referMsgStatus=Vi.DELETE,{messageUId:e,code:D.RC_DB_DATA_NOT_FOUND,message:t}):(n.referMsgStatus=Vi.DEFAULT,{messageUId:e,code:D.SERVER_DATA_ERROR,message:t})}));n(h)}))},LI=function(e){const t=Fg(e);return this._ctx.getNaviInfoFromCache().supportRecallRefactor&&t.info.forEach((e=>{const{msg:t}=e;if(t&&t.classname===Q.RECALL){const e=JSON.parse(t.content),{messageUId:i,sentTime:s,extra:n}=e,r={recallTime:s,recallActionTime:t.dataTime,admin:!!e.isAdmin,delete:!!e.isDelete,isDelete:!!e.isDelete,operatorId:t.fromUserId,extra:n};t.classname=Q.RECALL_NOTIFICATION_MESSAGE,t.content=JSON.stringify(r),t.msgId=i,t.dataTime=s||t.dataTime}})),t},UI=function(e,s,n,r,o,a=$s.qryRelationR){return t(this,void 0,void 0,(function*(){const{currentUserId:t}=this._ctx,l=((e,t,i,s,n)=>Uc.encode(Lo,{startTime:e,order:t,count:i,compressioEnabled:bs.enable(),channelType:s,botType:n}))(e,s,n,r,o);return(yield this._ctx.query(a,t,l)).trans((e=>i(this,YE,"m",LI).call(this,e.pbData)))}))};const GI={[w.PRIVATE]:$s.cleanPMsg,[w.GROUP]:$s.cleanGMsg,[w.CUSTOMER_SERVICE]:$s.cleanCMsg,[w.SYSTEM]:$s.cleanSMsg,[w.APP_PUBLIC_SERVICE]:$s.cleanMCMsg,[w.PUBLIC_SERVICE]:$s.cleanMPMsg,[w.ULTRA_GROUP]:$s.cleanGMsg},VI=(e,t,i,s,n,r,o,a,l,c)=>{var _;const d=l?`&protocolVer=${l}`:"";return`${i}://${s}/websocket?appId=${n}&token=${encodeURIComponent(r)}&sdkVer=${Be}&pid=${a}&deviceId=${encodeURIComponent(e)}${1===c?`&baggage=${encodeURIComponent(`cid=${o}`)}`:""}&apiVer=${encodeURIComponent((null===(_=Eo.getApiVer)||void 0===_?void 0:_.call(Eo))||`${Eo.tag}||`)}${Eo.connectPlatform?`&platform=${Eo.connectPlatform}`:""}${d}${Eo.isFromUniapp?`&appIdentifier=${encodeURIComponent(t)}`:""}`};class kI extends fs{constructor(e,t,i,s){super(e,t,i),Object.defineProperty(this,"appStorage",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_socket",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_connectedTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_socketIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_serverSessionId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_localConnectedTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_idCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_generateMessageId",{enumerable:!0,configurable:!0,writable:!0,value:()=>(this._idCount>=65535&&(this._idCount=0),++this._idCount)}),Object.defineProperty(this,"_pingResolve",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_messageIds",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_syncMessageIds",{enumerable:!0,configurable:!0,writable:!0,value:{}})}getConnectedTime(){return this._connectedTime}getLocalConnectedTime(){return this._localConnectedTime}getCrtServerTime(){return Date.now()-this._localConnectedTime+this._connectedTime}getDelayTime(){return this._localConnectedTime-this._connectedTime}_connectWithToken(e,i,s,n){return t(this,void 0,void 0,(function*(){const{openAnti:t,type:s,baggageEnabled:o}=i,a=this.getCmpList(i);this.logger.debug(r.L_NAVI_CMP_R,JSON.stringify(a),n);const l=a.filter(((e,t)=>a.findIndex((t=>t.addr===e.addr))===t)).sort(((e,t)=>e.weight>t.weight?-1:1));if(0===l.length)return this.logger.error(r.L_NAVI_CONF_E,"no service available",n),Ei(D.SERVER_UNAVAILABLE);const c=1===t?gn:En;for(let t=0;t<l.length;t+=1){const{protocol:i,addr:r,weight:a}=l[t],_=VI(this.appStorage.deviceId,this.appStorage.packageName,i===q.WS?"ws":"wss",r,this.appkey,e,this.cid,"",c,o),d=Date.now(),{code:u,data:h}=yield this.connectWebSocket(_,c,n),g=this.cmpWeightCache.findIndex((e=>e.addr===r)),E={bid:ii(),ptc:pe.WS,cod:u,net:this.getNetwork().type,dur:Date.now()-d,spr:0,pr:s||0,hos:r,idx:g,rct:this.retryCount?ve.RECONNECT:ve.CONNECT,cid:this.cid,v:Se.CURRENT,rsn:this._doConnectReason,count:this.retryCount,weight:a,ssid:this._serverSessionId};if(this.logger.record(ge.IM_WEBSOCKET,JSON.stringify(E),n),u!==D.RC_SOCKET_DISCONNECTED&&u!==D.TIMEOUT)return u!==D.SUCCESS?Ei(u):(this._localConnectedTime=Math.floor((Date.now()+d)/2),this._socket=h.socket,this.updateCmpWeight(l[t].addr,!0),this.curCmpUrl=l[t].addr,gi(h.userId))}return Ei(D.SERVER_UNAVAILABLE)}))}connectWebSocket(e,i,s){return t(this,void 0,void 0,(function*(){this.logger.info(r.L_CONNECT_O,`connect start: ${e}`,s);const{resolve:t,promise:n}=Ri(),{data:o,code:a,msg:l}=yield Eo.createWebSocket(e);if(a!==D.SUCCESS||!o)return Ei(a,l);this._socketIndex=o.id;let c=D.SUCCESS;const _=setTimeout((()=>{this.logger.warn(r.L_CONNECT_S,"timeout",s),c=D.TIMEOUT,"wechat"===Eo.tag?o.close():(t(Ei(D.TIMEOUT)),this.onSocketEnd(o,D.TIMEOUT,s))}),5e3);return o.onOpen((()=>{this.logger.info(r.L_CONNECT_S,"socket opened",s),clearTimeout(_)})),o.onError((e=>{this.logger.warn(r.L_CONNECT_S,"socket error",s),console.error(e),clearTimeout(_);const i=D.RC_SOCKET_DISCONNECTED;t(Ei(i)),this.onSocketEnd(o,i,s)})),o.onClose((()=>{this.logger.info(r.L_CONNECT_S,"socket close",s);const e=c===D.SUCCESS?D.RC_SOCKET_DISCONNECTED:c;t(Ei(e)),this.onSocketEnd(o,e,s)})),o.onMessage((e=>{if(this._socketIndex!==o.id)return void this.logger.warn(r.L_WS_DISACCORD_E,JSON.stringify({socketIndex:this._socketIndex,curSocketId:o.id}));if("[object ArrayBuffer]"!==Object.prototype.toString.call(e))return;const n=Lr(e,i);if(n){if(n instanceof Ir){const e=n.status;if(e!==wn)return this.logger.warn(r.L_CONNECT_O,`connect failed: ${e}`,s),c=(e=>dE[e])(e),o.close(),void t(Ei(c));this.logger.info(r.L_CONNECT_O,"connect success",s);const{timestamp:i,userId:a,messageId:l,sessionId:_}=n;return this._serverSessionId=_,this._connectedTime=i,this._idCount=l,void t(gi({userId:a,socket:o}))}if(n instanceof fr){const e=n.status;return this.logger.info(r.T,`recv disconnect signal -> status: ${e}`),void this.onRecvDisconnect(e,o)}this._onReceiveSignal(n)}})),n}))}_qosNeedAck(e){if(e.header.qos!==sn)return e instanceof Sr&&!e.syncMsg?(this.logger.debug(r.O,`send pubAck -> ${e.messageId} ${e.topic}`),void this.sendOnly(new Cr(e.messageId))):void(e instanceof br&&this._messageIds[e.messageId]&&(this.logger.debug(r.O,`send queryCon -> ${e.messageId}`),this.sendOnly(new Mr(e.messageId))))}_publishReader(e){return t(this,void 0,void 0,(function*(){const{syncMsg:t,topic:i,messageId:s}=e;if(this.logger.debug(r.O,`recv PublishReader -> messageId: ${s} ${i}`),i===pn)return;if(!t||uE(en(i)))return void this.emit("signal",e);const n=yield new Promise((e=>{this._syncMessageIds[s]=e}));delete this._syncMessageIds[s],this.emit("signal",e,n)}))}_onReceiveSignal(e){return t(this,void 0,void 0,(function*(){if(e instanceof Ar&&this._pingResolve)return this._pingResolve(D.SUCCESS),void(this._pingResolve=void 0);if(this._qosNeedAck(e),e instanceof yr||e instanceof br){const{messageId:t}=e;this.logger.debug(r.O,`recv ack -> messageId: ${t}`);const i=this._messageIds[t];i&&(i(e),delete this._messageIds[t]);const s=this._syncMessageIds[t];s&&(delete this._syncMessageIds[t],s(e))}e instanceof Sr&&(yield this._publishReader(e))}))}onRecvDisconnect(e,t){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer((e=>_E[e])(e)))}onSocketEnd(e,t,i){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(t),this._pingResolve&&(this._pingResolve(t),this._pingResolve=void 0))}clearResolves(){for(const e in this._messageIds){const t=this._messageIds[e];delete this._messageIds[e],t(D.RC_SOCKET_DISCONNECTED)}}sendPing(e){return new Promise((t=>{this._pingResolve=t,setTimeout((()=>t(D.TIMEOUT)),e),this.sendOnly(new Rr)}))}sendOnly(e){this._socket&&((e instanceof Or||e instanceof Nr)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getArrayBuffer()))}_sendHandler(e){return t(this,void 0,void 0,(function*(){if(!this._socket)return Ei(D.RC_NET_CHANNEL_INVALID);const t=this._generateMessageId();e.messageId=t,this._socket.send(e.getArrayBuffer());const i=yield new Promise((e=>{this._messageIds[t]=e,setTimeout((()=>{this._messageIds[t]&&delete this._messageIds[t],e(D.TIMEOUT)}),3e4)})),s="number"==typeof i?i:i.status;return D.SUCCESS,"number"==typeof i?Ei(i):s===D.SUCCESS?gi(i):Ei(s,"",i)}))}query(e,i,s,n,r){return t(this,void 0,void 0,(function*(){this.logger.createTraceId(),tn(e);const t=new Nr(e,s,i);r&&t.setHeaderQos(r);const o=yield this._sendHandler(t),{data:a,isOk:l}=o;return l&&void 0!==n?gi(Uc.decode(n,a.pbData)):o}))}send(e,i){return t(this,void 0,void 0,(function*(){const t=yield this._sendHandler(e);if(!t.data)return t.wipe();if(t.data instanceof yr)return t;const s=t.data,n=i&&s.pbData&&[D.SUCCESS,D.CHATROOM_KV_STORE_NOT_ALL_SUCCESS,D.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT,D.RC_USER_PROFILE_KEY_NOT_EXIST,D.RC_USER_PROFILE_EXT_KEY_NOT_EXIST,D.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS,D.RC_USER_PROFILE_VALUE_EXCEED_RANGE,D.RC_GROUP_PARAMETER_FORMAT_ERROR].indexOf(s.status)>=0?Uc.decode(i,s.pbData):s;return 0!==s.status?Ei(s.status,void 0,i&&s.pbData?n:null):gi(n)}))}close(e,i,s){return t(this,void 0,void 0,(function*(){s&&(yield this.sendOnly(new Tr(nr))),this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()}))}}const xI={};function FI(){return{code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,location:"",monitor:0,joinMChrm:!1,openMp:0,openUS:1,grpMsgLimit:0,isFormatted:0,gifSize:2048,logSwitch:0,logPolicy:"",compDays:0,msgAck:"",activeServer:"",qnAddr:"",extkitSwitch:0,alone:!1,voipServer:"",offlinelogserver:"",backupServer:Hi.getMiniCmpUrlList().join(",")}}class BI extends As{constructor(e,t,i,s,n="default",r){super(e,t,i,Eo.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol),Eo.useNavi,r),Object.defineProperty(this,"_appStorage",{enumerable:!0,configurable:!0,writable:!0,value:s}),this._environment=n}httpRequest(e,i,s,n,o){return t(this,void 0,void 0,(function*(){const t=`${e}/navi.js?appId=${i}&token=${encodeURIComponent(s)}&callBack=x&v=${Be}&r=${Date.now()}&env=${this._environment}&p=${Eo.tag}`;this.logger.debug(r.L_REQUEST_T,`req navi => ${t}`,n);const a=yield Eo.httpReq({url:t,timeout:1e4,dataType:"text"});if(200!==a.status)return this.logger.debug(r.L_REQUEST_R,`request navi failed: ${a.status}`,n),!Eo.useNavi&&o?gi(FI()):Ei(this.transHttpCode(a.status));try{let e=a.data.match(/{[\d\D]+}/)[0];0===e.indexOf('{\\"code\\":')&&(e=JSON.parse(`"${e}"`));const i=JSON.parse(e);return i.protocol=/^https/.test(t)?"https":"http",i.code&&200!==i.code?Ei(this.transHttpCode(i.code)):(Eo.useNavi||(i.server="",i.backupServer=Hi.getMiniCmpUrlList().join(","),i.logSwitch=0),gi(i))}catch(e){this.logger.error(r.L_PARSE_NAVI_E,a.data,n)}return Ei(D.RC_NAVI_REQ_FAILED)}))}httpRequestV2(e,i,s,n,o){return t(this,void 0,void 0,(function*(){const t=this.getNaviV2RequestOption({appkey:i,token:s,uri:e,platform:Eo.tag,protocol:(/^https/.test(e)?q.WSS:q.WS).toString()});this.logger.debug(r.L_REQUEST_T,`req navi => ${t.url}`,n);const a=yield Eo.httpReq(t);if(200!==a.status)return this.logger.debug(r.L_REQUEST_R,`request navi failed: ${a.status}`,n),!Eo.useNavi&&o?gi(FI()):Ei(this.transHttpCode(a.status));try{let e=a.data;const i="object"!=typeof e?JSON.parse(e):e;if(i.protocol=/^https/.test(t.url)?"https":"http",!Eo.useNavi){i.logSwitch=0;const e=Hi.getMiniCmpUrlList();i.serverAddr=e.map(((i,s)=>({addr:i,protocol:/^https/.test(t.url)?q.WSS:q.WS,weight:e.length-s})))}return gi(i)}catch(e){this.logger.error(r.L_PARSE_NAVI_E,a.data,n)}return Ei(D.RC_NAVI_REQ_FAILED)}))}getNaviCache(e){const t=this.getCatchKey(e);if(xI[t])return xI[t];const i=this._appStorage.get("naviInfo");if(!i)return null;let s;try{s=JSON.parse(i)}catch(e){s=[]}if(0===s.length)return null;const n=s.find((t=>t.token===e&&t.environment===this._environment))||null;return xI[t]=n,n}setNaviCache(e,t){let i=[];const s=Date.now(),n=this._appStorage.get("naviInfo");if(n){try{i=JSON.parse(n)}catch(e){i=[]}i.length>0&&(i=i.filter((t=>s-t.timestamp<ke&&(e!==t.token||this._environment!==t.environment))))}const r={timestamp:s,naviInfo:t,token:e,environment:this._environment};i.push(r),this._appStorage.set("naviInfo",JSON.stringify(i)),xI[this.getCatchKey(e)]=r}}class HI{constructor(){Object.defineProperty(this,"recallMsgMap",{enumerable:!0,configurable:!0,writable:!0,value:new Set})}}function jI(e){const t=!(1&~(e.ugMsg||0)),i=!(1&~(e.sessionCfg||0));return t&&i}class YI extends us{constructor(e,t,i,s){super(t,e,i),Object.defineProperty(this,"_appStorage",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_mrtr",{enumerable:!0,configurable:!0,writable:!0,value:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}});const{type:n,version:r}=Eo.runtimeInfo;this.model=`Web|${n}|${r}`,this.init()}httpRequest(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=n;t.deviceId=this._appStorage.deviceId,t.model=this.model;const o={url:e,method:i,headers:s,body:JSON.stringify(t)},a=this.logger.createTraceId();this.logger.info(r.L_REQUEST_T,JSON.stringify(o),a);const{status:l,data:c=""}=yield Eo.httpReq(o);this.logger.info(r.L_REQUEST_R,JSON.stringify({status:l,data:c}),a);try{const e=JSON.parse(c),t=e.data;return{code:parseInt(e.code,10),data:t}}catch(e){return this.logger.warn(r.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:l,data:c,error:e})),{code:l,msg:e}}}))}setCloudControllerCache(e){this._appStorage.set("cloudControllerData",JSON.stringify(e))}getLocalCloudControllerCache(){return this._appStorage.get("cloudControllerData")}setMRTRConfig(e){this.logger.info(r.L_CLOUD_SET_MRTR_O,JSON.stringify(e)),this._mrtr=e}getMRTRConfig(){return this._mrtr}}class WI extends ji{constructor(e,t,i){super(e,t),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_appStorage",{enumerable:!0,configurable:!0,writable:!0,value:i})}getCache(){return this._appStorage.get("staticConf")}setCache(e){this._appStorage.set("staticConf",e)}clearCache(){this._appStorage.delete("staticConf")}sendRequest(e){return t(this,void 0,void 0,(function*(){const{status:t,data:i}=yield Eo.httpReq({url:e});return{code:t,data:i}}))}decryptData(e){return t(this,void 0,void 0,(function*(){try{const t=yield si(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91");return JSON.parse(t)}catch(e){this.logger.error(r.L_GET_STATIC_CONF_E,JSON.stringify({error:null==e?void 0:e.stack}))}}))}}class qI extends _d{constructor(){super(),Object.defineProperty(this,"_deviceId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_customDeviceId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_packageName",{enumerable:!0,configurable:!0,writable:!0,value:""});let e="";const{localStorage:t,tag:i}=Eo;"browser"!==i?(e=t.getItem(qe)||"",e||(e=ut.genWithLen(22),t.setItem(qe,e))):e=ht,this._deviceId=e}setPackageName(e){this._packageName=e}get deviceId(){return this._customDeviceId||this._deviceId}get packageName(){return this._packageName}setCustomDeviceId(e){this._customDeviceId=e}_syncDataHandler(e){const{appkey:t}=e,{localStorage:i}=Eo,s=rt(t),n=i.getItem(s),r=nt(t),o=i.getItem(r),a=Je(t),l=i.getItem(a),c=at(t),_=i.getItem(c);return{cloudControllerData:{value:n,key:s},staticConf:{value:o,key:r},naviInfo:{value:l,key:a},logReporter:{value:_?JSON.parse(_):{},key:c,stringify:!0}}}}var JI,KI,QI,XI,zI,ZI,$I,eT,tT,iT;const sT=[$s.chatMsg,$s.ugMsg,$s.recallMsg,$s.ppMsgS,$s.pgMsgS,$s.ppMsgP,$s.pgMsgP,$s.pcMsgP,$s.prMsgS,$s.pbMsgP,$s.chatMsgS];class nT extends _i{constructor(e){var t;super(),JI.add(this),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"navi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_connection",{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,"send",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"query",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"connect",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disconnect",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"userStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),KI.set(this,void 0),QI.set(this,void 0),XI.set(this,void 0),zI.set(this,void 0),ZI.set(this,void 0),Object.defineProperty(this,"_robots",{enumerable:!0,configurable:!0,writable:!0,value:{robots:[],isSynced:!1}}),this.appStorage=new qI,this.appStorage.syncDataFromLocalStorage(this);const{appkey:n,loggerProxy:r,environment:o,useNaviV2:a,logOutputLevel:l,logExpireTime:c,areaCode:_,navigators:d,logServerUrl:u,miniCMPProxy:h}=e,g=r||$_(),E=this.logger=new x_(e.appkey,"IMLib","IM",g);E.setOutputLevel(l),r||J_(n,this.logger,c),Hi.init({areaCode:_,navigators:d,logServerUrl:u,miniCMPProxy:h}),this.navi=new BI(n,this.logger,new WI(n,this.logger,this.appStorage),this.appStorage,o||"default",!!a);const I=this._connection=new kI(n,this.navi,this.logger,this.appStorage);this.send=this._connection.send.bind(this._connection),this.query=this._connection.query.bind(this._connection),this.sendOnly=this._connection.sendOnly.bind(this._connection),this.connect=this._connection.connect.bind(this._connection),this.disconnect=this._connection.disconnect.bind(this._connection),I.on("onConnected",i(this,JI,"m",$I),this),I.on("onDisconnected",i(this,JI,"m",tT),this),I.on("onSuspend",i(this,JI,"m",eT),this),I.on("signal",i(this,JI,"m",iT),this),I.pipe(this),s(this,QI,new id(n,E,this.appStorage),"f"),s(this,XI,new sd(n,E,this.appStorage),"f"),s(this,zI,new YI(n,E,i(this,QI,"f"),this.appStorage),"f"),t=this,[{set value(e){s(t,ZI,e,"f")}}.value]=Hi.getCloudControllerUrl(),this.userStorage=new HI,s(this,KI,new DE(I,E),"f"),i(this,KI,"f").pipe(this),"browser"===Eo.tag&&i(this,zI,"f").request(i(this,ZI,"f"),ls)}get isConnected(){return this._connection.isConnected}get connectionStatus(){return this._connection.getConnectionStatus()}get currentUserId(){return this._connection.getCurrentUserId()}get currentToken(){return this._connection.getToken()}get serverTime(){return this._connection.getCrtServerTime()}get delayTime(){return this._connection.getDelayTime()}get connectedTime(){return this._connection.getConnectedTime()}get ugEnabel(){return!(1&~(this.getNaviInfoFromCache().ugMsg||0))}get isDisableEmptyUGChannelId(){return!(2&~(this.getNaviInfoFromCache().ugDriven||0))}get includeUg(){return jI(this.getNaviInfoFromCache())}get isMemSesAttrs(){var e;return(8&((null===(e=this.getNaviInfoFromCache())||void 0===e?void 0:e.sessionCfg)||0))>0}get svrUnread(){return 1===this.getNaviInfoFromCache().serverSaveUnread}get logReporter(){return i(this,QI,"f")}get statisticReporter(){return i(this,XI,"f")}get appkey(){return this.initOptions.appkey}get initOptions(){return this._initOptions}getNaviInfoFromCache(){return this.navi.getNaviInfoFromCache(this.currentToken)}get robots(){return this._robots.robots.slice()}getAllRobots(e){return t(this,void 0,void 0,(function*(){let t=this._robots.robots.slice();if(!e&&this._robots.isSynced)return gi(t);const i=Uc.encode(dc,{ids:[]}),s=yield this._connection.query($s.qAppBot,this.currentUserId,i,uc);if(!s.isOk)return e&&this.emit("robotsSynced",s.code,[],[],[]),Ei(s.code,s.msg,t);let n=Math.max(...t.map((e=>e.updateTime)));const r=[],o=s.data.bots.map((e=>{const t={robotId:e.id,name:e.name,portraitUri:e.portraitUrl,robotType:e.type||"",metadata:Object.fromEntries(e.metadata.map((e=>[e.key,e.value]))),createTime:e.createTime,updateTime:e.updateTime};return t.updateTime>n&&r.push(t),t})),a=t.filter((e=>!o.some((t=>t.robotId===e.robotId))));return this._robots.isSynced=!0,this._robots.robots=o,e&&this.emit("robotsSynced",s.code,o.slice(),r,a),gi(o.slice())}))}handleCloudControllerMessage(e){return t(this,void 0,void 0,(function*(){if(0===e.length)return;if(e.shift().senderUserId!==Ye)return this.handleCloudControllerMessage(e);const t=this._connection.getToken(),s=(yield i(this,zI,"f").request(i(this,ZI,"f"),_s,t))||0,n=e.filter((e=>e.sentTime>s));return this.handleCloudControllerMessage(n)}))}handleLogCmdMessages(e){e.forEach((e=>{if(e.senderUserId!==Ye)return;const{startTime:t,endTime:s,platform:n,logId:r,uri:o}=e.content;i(this,QI,"f").report(parseInt(t,10),parseInt(s,10),n,o,r,e.messageUId)}))}handleNetworkChange(e,t){if(this._connection.setNetwork(e,t),e.status&&i(this,ZI,"f")){const e=this._connection.getToken();i(this,zI,"f").request(i(this,ZI,"f"),cs,e)}}checkIfNeedRecordMessageUId(e,t){const s=i(this,zI,"f").getMRTRConfig();if(!s)return!1;const n=function(e){if(!e)return Math.floor(4294967296*Math.random());let t=0;if(0===e.length)return t;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return Math.abs(t)}(t);let r=0;switch(e){case w.PRIVATE:r=s.private;break;case w.GROUP:r=s.group;break;case w.CHATROOM:r=s.chatroom;break;case w.ULTRA_GROUP:r=s.ultraGroup}return!!r&&n%(1/r)==0}recordReceivedMessagesForStatistics(e){if(0===e.length)return;const{connectedTime:t}=this,i=e.filter((e=>e.sentTime>=t&&this.checkIfNeedRecordMessageUId(e.conversationType,e.messageUId))).map((e=>e.messageUId));if(0===i.length)return;const s=Date.now();this.logger.record(ge.IM_MSG_RECEIVE,JSON.stringify({client_ts:s,server_deltatime:s-this.serverTime,msg_ids:i.join(",")}))}}var rT,oT,aT;KI=new WeakMap,QI=new WeakMap,XI=new WeakMap,zI=new WeakMap,ZI=new WeakMap,JI=new WeakSet,$I=function(e,s){return t(this,void 0,void 0,(function*(){s||this.getAllRobots(!0);const e=yield i(this,KI,"f").noticeOnline();if(!e.isOk)return;if(s)i(this,KI,"f").startInterval(18e4,!0);else{const{syncTime:t,hasNext:s}=e.data;i(this,KI,"f").setInitVersion(t),i(this,KI,"f").startInterval(18e4,!!s)}const t=this.getNaviInfoFromCache();i(this,QI,"f").checkStart(t),i(this,XI,"f").checkStart(t)}))},eT=function(e,t){i(this,KI,"f").stopInterval()},tT=function(e){this._robots.isSynced=!1,this._robots.robots=[],i(this,KI,"f").reset(),i(this,QI,"f").stop(),i(this,XI,"f").stop()},iT=function(e,t,s){const{topic:n,syncMsg:o,targetId:a,date:l,pbData:c}=t,_=en(n),d=this.getNaviInfoFromCache();if(_)if(this.logger.debug(r.L_RECV_RMTP_O,n),o&&sT.includes(_)){e.stopPropagation();const{timestamp:i=this.serverTime,messageUId:n=""}=s||{},r=O_(t,this.currentUserId,i,n),o=C_(d,r,this.currentUserId,!1,t.targetId);this.emit("syncMsg",o,_)}else{if(_===$s.s_ntf){e.stopPropagation();const i=Uc.decode(To,t.pbData),{type:s,chrmId:n,time:o}=i;return this.logger.info(r.L_RECV_S_NTF_O,`type: ${s}, chrmId: ${n}, time: ${o}`),void this.emit("sNtf",i)}if(_===$s.s_cmd){e.stopPropagation();const s=Uc.decode(To,t.pbData),{type:n,chrmId:o,time:a}=s;if(this.logger.info(r.L_RECV_S_CMD_O,`type: ${n}, chrmId: ${o}, time: ${a}`),11===n)return void i(this,KI,"f").push(a);this.emit("sCmd",s)}if(_===$s.s_msg){e.stopPropagation();const i=Uc.decode(mo,t.pbData),s=C_(d,i,this.currentUserId,!1);this.emit("sMsg",s)}}else{this.logger.warn(r.L_RECV_RMTP_E,`unknown topic: ${n}`),e.stopPropagation();const t={name:n,targetId:a,data:c,timestamp:l};this.emit("unknownSignal",t)}};const lT=(e,t,i)=>{let s=0;return e&&(s|=1),t&&(s|=2),i&&(s|=4),s},cT=(e,t,i)=>({chatroomId:e,key:t.key,value:t.value,timestamp:t.version,type:i?C.DELETE:C.UPDATE});class _T extends di{constructor(e,t,i){super("WebChatroomKVStore"),rT.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_chatroomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:i}),oT.set(this,new Map),Object.defineProperty(this,"_emittedEntriesSynced",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const{logger:t}=this._ctx,s=t.createTraceId(),n=this._chatroomId,o={chatroomId:n,timestamp:e};t.info(r.L_PULL_CHATROOM_KV_T,JSON.stringify(o),s);const a=yield this._ctx.query($s.pullKV,n,zg(e),void 0);if(!a.isOk)return t.warn(r.L_PULL_CHATROOM_KV_R,JSON.stringify(Object.assign(Object.assign({},o),{code:a.code})),s),a.wipe();const{bFullUpdate:l,entries:c,syncTime:_}=Zg(a.data.pbData);t.info(r.L_PULL_CHATROOM_KV_R,JSON.stringify(Object.assign(Object.assign({},o),{newVersion:_})),s);const d=new Map;return l&&(Array.from(i(this,oT,"f").values()).forEach((e=>{d.set(e.key,cT(n,e,!0))})),i(this,oT,"f").clear()),Array.from(c.values()).forEach((e=>{const{isDelete:t}={isAutoDelete:!!(1&(s=e.status)),isOverwrite:!!(2&s),isDelete:!!(4&s)};var s;const r=(e=>{const{key:t,value:i,timestamp:s,uid:n,version:r}=e;return{key:t,value:i,userId:n,version:r}})(e);t?i(this,oT,"f").delete(r.key):i(this,oT,"f").set(r.key,r),d.set(r.key,cT(n,r,t))})),this._emittedEntriesSynced||(this._emittedEntriesSynced=!0,this._emitter.emit("chatroom",{entriesSynced:n})),d.size>0&&this._emitter.emit("chatroom",{updatedEntries:Array.from(d.values())}),gi({version:_})}))}setEntry(e,s){return t(this,void 0,void 0,(function*(){const t=yield i(this,rT,"m",aT).call(this,e,s,!1);return t.isOk&&i(this,oT,"f").set(e.key,{key:e.key,value:e.value,userId:this._ctx.currentUserId,version:this._ctx.serverTime}),t}))}removeEntry(e,s){return t(this,void 0,void 0,(function*(){const t=yield i(this,rT,"m",aT).call(this,{key:e.key,value:"",isAutoDelete:!1,isSendNotification:e.isSendNotification,notificationExtra:e.notificationExtra},s,!0);return t.isOk&&i(this,oT,"f").delete(e.key),t}))}setEntries(e){return t(this,void 0,void 0,(function*(){const{serverTime:t}=this._ctx,s=e.entries.map((s=>{var n;const r=i(this,oT,"f").get(s.key);return{key:s.key,value:s.value,uid:this._ctx.currentUserId,version:null!==(n=null==r?void 0:r.version)&&void 0!==n?n:t,status:lT(!!e.isAutoDelete,e.isForce||!1,!1)}})),n=Uc.encode(zo,{entry:s}),r=yield this._ctx.query($s.setKVS,this._chatroomId,n,$o);if(!r.isOk&&r.code!==D.CHATROOM_KV_STORE_NOT_ALL_SUCCESS)return r.wipe();const{errorKeys:o,keysVersion:a}=r.data,l=new Map;return null==a||a.forEach((e=>{l.set(e.key,e.version)})),e.entries.forEach((e=>{const{key:t}=e,s=l.get(t);s&&i(this,oT,"f").set(t,{key:t,value:e.value,userId:this._ctx.currentUserId,version:s})})),r.wipe()}))}removeEntries(e){return t(this,void 0,void 0,(function*(){const t=lT(!1,!1,!0),{serverTime:s}=this._ctx,n=Uc.encode(zo,{entry:e.keys.map((e=>{var n;const r=i(this,oT,"f").get(e);return{key:e,status:t,value:"",uid:this._ctx.currentUserId,version:null!==(n=null==r?void 0:r.version)&&void 0!==n?n:s}}))}),r=yield this._ctx.query($s.delKVS,this._chatroomId,n,$o);if(!r.isOk&&r.code!==D.CHATROOM_KV_STORE_NOT_ALL_SUCCESS)return r.wipe();const{errorKeys:o}=r.data,a=new Set;return null==o||o.forEach((e=>a.add(e.key))),e.keys.forEach((e=>{a.has(e)||i(this,oT,"f").delete(e)})),r.wipe()}))}getEntry(e){if(!i(this,oT,"f").has(e))return null;return i(this,oT,"f").get(e).value}getAllEntries(){const e=Array.from(i(this,oT,"f").entries()).map((([e,t])=>[e,t.value]));return Object.fromEntries(e)}}var dT,uT,hT,gT,ET,IT,TT,fT,RT,AT,pT,mT,ST,vT,NT,OT,yT,CT,MT,bT,LT,UT;oT=new WeakMap,rT=new WeakSet,aT=function(e,s,n){var r;return t(this,void 0,void 0,(function*(){const{serverTime:t}=this._ctx,o=i(this,oT,"f").get(e.key),a=lT(!!e.isAutoDelete,s,n),l={entry:{key:e.key,value:e.value,uid:this._ctx.currentUserId,version:null!==(r=null==o?void 0:o.version)&&void 0!==r?r:t,status:a}};e.isSendNotification&&(l.type=w.CHATROOM,l.bNotify=!0,l.notification={sessionId:M_(Q.CHRM_KV_NOTIFY,!1,!1,!1),classname:Q.CHRM_KV_NOTIFY,content:JSON.stringify({key:e.key,value:e.value,extra:e.notificationExtra,type:n?C.DELETE:C.UPDATE})});const c=Uc.encode(Xo,l);return(yield this._ctx.query(n?$s.delKV:$s.setKV,this._chatroomId,c)).wipe()}))};class PT extends di{constructor(e,t,i,n){super("WebChatroomMessageReceiver"),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_chatroomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:n}),dT.set(this,0),s(this,dT,i,"f")}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const{logger:t}=this._ctx,s=t.createTraceId(),n={chatroomId:this._chatroomId,version:e};t.info(r.L_PULL_CHATROOM_MSG_T,JSON.stringify(n),s);const o=((e,t)=>Uc.encode(bo,{syncTime:e,count:t,compressioEnabled:bs.enable()}))(e,i(this,dT,"f")),a=yield this._ctx.query($s.chrmPull,this._chatroomId,o,void 0);if(t.summary(r.L_PULL_CHATROOM_MSG_R,a,s,n),!a.isOk)return a.wipe();const{currentUserId:l}=this._ctx,{list:c,syncTime:_}=Hg(a.data.pbData);if(c.length>0){const e=c.map((e=>y_(e,l,!1,this._chatroomId)));this._emitter.emit("message",e,this._chatroomId)}return gi({version:_})}))}}dT=new WeakMap;class DT{constructor(e,t,i,n,r){uT.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"initCount",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:r}),hT.set(this,void 0),gT.set(this,void 0),s(this,hT,new PT(this._ctx,this.roomId,i,n),"f"),s(this,gT,new _T(this._ctx,this.roomId,n),"f")}startInterval(){const e=18e4;i(this,hT,"f").setInitVersion(0),i(this,hT,"f").startInterval(e,!0),i(this,uT,"a",ET)&&(i(this,gT,"f").setInitVersion(0),i(this,gT,"f").startInterval(e,!0))}restartInterval(){const e=18e4;this.stopInterval(),i(this,gT,"f").startInterval(e,!0),i(this,hT,"f").startInterval(e,!0)}stopInterval(){i(this,hT,"f").stopInterval(),i(this,gT,"f").stopInterval()}handleMessageNotify(e){i(this,hT,"f").push(e)}handleKVNotify(e){i(this,gT,"f").push(e)}setEntry(e,s){return t(this,void 0,void 0,(function*(){return i(this,gT,"f").setEntry(e,s)}))}setEntries(e){return t(this,void 0,void 0,(function*(){return i(this,gT,"f").setEntries(e)}))}removeEntry(e,s){return t(this,void 0,void 0,(function*(){return i(this,gT,"f").removeEntry(e,s)}))}removeEntries(e){return t(this,void 0,void 0,(function*(){return i(this,gT,"f").removeEntries(e)}))}getEntry(e){return i(this,gT,"f").getEntry(e)}getAllEntries(){return i(this,gT,"f").getAllEntries()}}hT=new WeakMap,gT=new WeakMap,uT=new WeakSet,ET=function(){var e;return!!(null===(e=this._ctx.getNaviInfoFromCache())||void 0===e?void 0:e.kvStorage)};const wT=e=>{const{joinTime:t,createTime:i,memberCount:s,chatroomBanState:n,whiteListState:r}=e;return{createTime:i,joinTime:t,memberCount:s,isAllChatroomBanned:!(1&~(n||0)),isCurrentUserBanned:!(2&~(n||0)),isCurrentChatroomBanned:!(4&~(n||0)),isCurrentChatroomInWhitelist:!(1&~(r||0))}};class GT extends _i{constructor(e){super(),IT.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),TT.set(this,new Map),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),fT.set(this,void 0),Object.defineProperty(this,"setCheckChatRoomDuplicateMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),this.logger=e.logger,s(this,fT,new _i,"f"),i(this,fT,"f").on("message",i(this,IT,"m",AT),this),i(this,fT,"f").on("chatroom",i(this,IT,"m",RT),this),this._ctx.on("onConnected",i(this,IT,"m",ST),this),this._ctx.on("onDisconnected",i(this,IT,"m",pT),this),this._ctx.on("onSuspend",i(this,IT,"m",mT),this),this._ctx.on("sNtf",i(this,IT,"m",NT),this),this._ctx.on("sCmd",i(this,IT,"m",OT),this),this._ctx.on("syncMsg",i(this,IT,"m",vT),this),this._ctx.on("sMsg",i(this,IT,"m",vT),this)}joinChatroom(e,s,n,r){return t(this,void 0,void 0,(function*(){const t=yield i(this,IT,"m",MT).call(this,e,n,r);if(!t.isOk)return t.wipe();let o=i(this,TT,"f").get(e);return o||(o=new DT(this._ctx,e,s,i(this,fT,"f"),r),i(this,TT,"f").set(e,o),o.startInterval()),t.trans(wT)}))}quitChatroom(e,s){return t(this,void 0,void 0,(function*(){if(!i(this,TT,"f").get(e))return gi();i(this,IT,"m",bT).call(this,e);const t=Uc.encode(Co,{nothing:1,extra:s});return(yield this._ctx.query($s.exitChrm,e,t)).wipe()}))}getChatroomInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ko,{count:i,order:s});return(yield this._ctx.query($s.queryChrmI,e,t,xo)).trans((e=>{const{userTotalNums:t,userInfos:i}=e;return{userCount:t,userInfos:i.map((({id:e,time:t})=>({id:e,time:t})))}}))}))}setChatroomEntry(e,s,n){return t(this,void 0,void 0,(function*(){return i(this,IT,"m",LT).call(this,e).next((e=>e.setEntry(s,n)))}))}setChatroomEntries(e,s){return t(this,void 0,void 0,(function*(){return i(this,IT,"m",LT).call(this,e).next((e=>e.setEntries(s)))}))}removeChatroomEntry(e,s,n){return t(this,void 0,void 0,(function*(){return i(this,IT,"m",LT).call(this,e).next((e=>e.removeEntry(s,n)))}))}removeChatroomEntries(e,s){return t(this,void 0,void 0,(function*(){return i(this,IT,"m",LT).call(this,e).next((e=>e.removeEntries(s)))}))}getChatroomEntry(e,s){return t(this,void 0,void 0,(function*(){const t=i(this,TT,"f").get(e);if(t){const e=t.getEntry(s);return null===e?Ei(D.CHATROOM_KEY_NOT_EXIST):gi(e)}return(yield i(this,IT,"m",UT).call(this,e)).tryTrans((e=>{const t=e[s];return void 0===t?Ei(D.CHATROOM_KEY_NOT_EXIST):gi(t)}))}))}getAllChatroomEntries(e){return t(this,void 0,void 0,(function*(){const t=i(this,TT,"f").get(e);return t?gi(t.getAllEntries()):i(this,IT,"m",UT).call(this,e)}))}getChatroomHistoryMessages(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=Jg({targetId:e,time:i,count:s,order:n}),{currentUserId:r}=this._ctx,o=yield this._ctx.query($s.qryCHMsg,e,t);if(!o.isOk)return o.wipe();const a=Kg(o.data.pbData);return gi({hasMore:!!a.hasMsg,list:a.list.map((t=>y_(t,r,!1,e)))})}))}bindRTCRoomForChatroom(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Ga,{rtcRoomId:e.rtcRoomId});return(yield this._ctx.query($s.setRtcRoomId,e.chatRoomId,t)).wipe()}))}}var VT,kT,xT,FT;TT=new WeakMap,fT=new WeakMap,IT=new WeakSet,RT=function(e,t){e.stopPropagation(),this.emit("chatroom",t)},AT=function(e,t,s){e.stopPropagation(),this._ctx.recordReceivedMessagesForStatistics(t),i(this,IT,"m",yT).call(this,t,s,!1)},pT=function(){for(const e of i(this,TT,"f").values())e.stopInterval();i(this,TT,"f").clear()},mT=function(){for(const e of i(this,TT,"f").values())e.stopInterval()},ST=function(e,t){if(t)for(const e of i(this,TT,"f").values())i(this,IT,"m",CT).call(this,e)},vT=function(e,t){t.conversationType===w.CHATROOM&&(e.stopPropagation(),i(this,IT,"m",yT).call(this,[t],t.targetId,!0))},NT=function(e,t){const{type:s,chrmId:n,time:r}=t;if(2!==s)return;e.stopPropagation();const o=i(this,TT,"f").get(n);o&&o.handleMessageNotify(r)},OT=function(e,t){const{type:s,chrmId:n,time:r,destroyType:o}=t;if(2!==s&&4!==s)return;e.stopPropagation();const a=i(this,TT,"f").get(n);return a?4===s?(i(this,TT,"f").delete(n),void this.emit("chatroom",{chatroomDestroyed:n,chatroomDestroyedType:o})):void a.handleKVNotify(r):void 0},yT=function(e,t,s){if(!(i(this,TT,"f").get(t)||s&&e[0].messageType===Q.CHATROOM_MERGE_BLOCK))return;const n=e.filter((e=>{var s;const{messageType:n}=e;if(n===Q.CHATROOM_MERGE_CHANGE){const t=function(e){const t={},i=[],s=e.content.memberCount||0;return Array.isArray(e.content.userList)&&e.content.userList.forEach((e=>{t[e.userId]=e.status,i.push({userId:e.userId,action:e.status,extra:e.extra})})),{users:t,chatroomId:e.targetId,memberCount:s,userList:i}}(e);return this.emit("chatroom",{userChange:t}),!1}if(n===Q.CHATROOM_MERGE_BAN){const t=function(e){const{chatroomId:t,operateType:i,durationTime:s,operateTime:n,userList:r,extra:o}=e.content;return{chatroomId:t,banType:i,durationTime:s,operateTime:n,userIdList:r,extra:o||""}}(e);return this.emit("chatroom",{chatroomNotifyBan:t}),!1}if(n===Q.CHATROOM_SYNC_MSG){const t=function(e){const{chatroomId:t,status:i,reason:s,time:n,extra:r}=e.content;return{chatroomId:t,status:i,reason:s,time:n,extra:r||""}}(e);return this.emit("chatroom",{chatroomNotifyMultiLoginSync:t}),!1}if(n===Q.CHATROOM_MERGE_BLOCK){const n=function(e){const{chatroomId:t,operateType:i,durationTime:s,operateTime:n,userList:r,extra:o}=e.content;return{chatroomId:t,operateType:i,durationTime:s,operateTime:n,userIdList:r,extra:o||""}}(e);return n.operateType===P.Blocked&&(null===(s=null==n?void 0:n.userIdList)||void 0===s?void 0:s.includes(this._ctx.currentUserId))&&i(this,IT,"m",bT).call(this,t),this.emit("chatroom",{chatroomNotifyBlock:n}),!1}return!0}));n.length>0&&this.emit("message",n,t)},CT=function(e){return t(this,void 0,void 0,(function*(){const{roomId:t,extra:s}=e,n=this.logger.createTraceId();this.logger.info(r.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:t}),n);const o=yield i(this,IT,"m",MT).call(this,t,!1,s);this.logger.summary(r.L_REJOIN_CHATROOM_R,o,n,{chatroomId:t});const{code:a,isOk:l,data:c}=o;if(!l)return a!==D.RC_CHATROOM_USER_KICKED&&a!==D.RC_CHATROOM_NOT_EXIST||i(this,TT,"f").delete(t),void this.emit("chatroom",{rejoinedRoom:{chatroomId:t,errorCode:a}});e.restartInterval();const _=wT(c);this.emit("chatroom",{rejoinedRoom:Object.assign(Object.assign({chatroomId:t},_),{count:e.initCount})})}))},MT=function(e,t,i){const s=Uc.encode(Co,{extra:i,nothing:1}),n=t?$s.joinChrm:$s.joinChrmR;return this._ctx.query(n,e,s,Mo)},bT=function(e){const t=i(this,TT,"f").get(e);t&&(t.stopInterval(),i(this,TT,"f").delete(e))},LT=function(e){const t=i(this,TT,"f").get(e);return t?gi(t):Ei(D.NOT_IN_CHATROOM)},UT=function(e){return t(this,void 0,void 0,(function*(){const t=yield this._ctx.query($s.pullKV,e,zg(0),void 0);if(!t.isOk)return t.wipe();const{entries:i}=Zg(t.data.pbData);return gi(i.reduce(((e,t)=>(e[t.key]=t.value,e)),{}))}))};class BT extends _d{_syncDataHandler(e){const{localStorage:t}=Eo,{appkey:i,currentUserId:s}=e,n=st(i,s),r=t.getItem(n)||"{}",{version:o,tags:a,transLan:l,autoTrans:c}=JSON.parse(r);return{value:{value:{version:o||0,tags:a||{},transLan:l||"zh",autoTrans:c||!1},key:n,stringify:!0}}}get version(){return this.get("value").version||0}get tags(){return this.get("value").tags||{}}forceUpdate(e){this.set("value",e)}addTag(e,t){const{tags:i,autoTrans:s,transLan:n}=this.get("value");i[e.tagId]={tagName:e.tagName,createdTime:t},this.set("value",{version:t,tags:i,autoTrans:s,transLan:n})}deleteTag(e,t){const{tags:i,autoTrans:s,transLan:n}=this.get("value");delete i[e],this.set("value",{version:t,tags:i,autoTrans:s,transLan:n})}}class HT extends di{constructor(e){super("UserSettings"),VT.add(this),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),kT.set(this,!1),this.storage=new BT,this._ctx.on("onConnected",this._handleConnected,this),this._ctx.on("onDisconnected",this._handleDisconnected,this),this._ctx.on("onSuspend",this._handleDisconnected,this),this._ctx.on("signal",this._handleSignal,this)}_handleConnected(){this.storage.syncDataFromLocalStorage(this._ctx),s(this,kT,!0,"f");const{version:e}=this.storage;this.setInitVersion(e),this.push(e)}_handleDisconnected(){this.reset()}_handleSignal(e,t){if(en(t.topic)===$s.s_us){const{version:i}=Uc.decode(Sa,t.pbData);this.push(i),e.stopPropagation()}}_handleSyncData(e){return t(this,void 0,void 0,(function*(){const{currentUserId:t,logger:s}=this._ctx,n=this._ctx.getNaviInfoFromCache(),o=s.createTraceId();s.info(r.L_SYNC_USER_SETTINGS_T,`version: ${e}`,o);const a=Uc.encode(sa,{version:e,ipType:n.ipType||0}),l=yield this._ctx.query($s.pullUS,t,a,na);if(s.summary(r.L_SYNC_USER_SETTINGS_R,l,o),!l.isOk)return i(this,VT,"m",xT).call(this,l.code),l.wipe();const{version:c,items:_}=l.data;let d=!1,u=!1,h=!1,g="";const{transLan:E,autoTrans:I,tags:T}=this.storage.get("value"),f={version:c,transLan:E,autoTrans:I,tags:T};return null==_||_.forEach((e=>{const{key:t,value:i}=e;switch(t){case"Tag":f.tags={},e.tags.forEach((e=>{f.tags[e.tagId]={tagName:e.name,createdTime:e.createdTime}})),d=!0;break;case"transLan":h=!0,f.transLan=_r.readUTF(new Uint8Array(i));break;case"autoTrans":u=!0,f.autoTrans="1"===_r.readUTF(new Uint8Array(i));break;case"VoipInfo":g=_r.readUTF(new Uint8Array(i))}})),this.storage.set("value",f),d&&this.emit("tagsChanged"),h&&this.emit("userSettingsChanged",{key:ki.TranslationLanguage,value:f.transLan}),u&&this.emit("userSettingsChanged",{key:ki.AutoTranslateEnable,value:f.autoTrans}),g&&this.emit("voipInfoChanged",g),i(this,VT,"m",xT).call(this,l.code),gi({version:c})}))}hasTag(e){return!!this.storage.tags[e]}getTags(){return this.storage.tags}createTag(e){return t(this,void 0,void 0,(function*(){const{version:t}=this.storage,{currentUserId:i}=this._ctx,s=Uc.encode(pa,{version:t,tags:[{tagId:e.tagId,name:e.tagName}],ignoreVersion:!0}),n=yield this._ctx.query($s.addSeTag,i,s,ia);if(n.isOk){const{version:i,updateVersion:s}=n.data;this.storage.addTag(e,s?i:t)}return n.wipe()}))}removeTag(e){return t(this,void 0,void 0,(function*(){const{version:t}=this.storage,{currentUserId:i}=this._ctx,s=Uc.encode(ma,{version:t,tags:[{tagId:e}],ignoreVersion:!0}),n=yield this._ctx.query($s.delSeTag,i,s,ia);if(n.isOk){const{version:i,updateVersion:s}=n.data;this.storage.deleteTag(e,s?i:t)}return n.wipe()}))}setTranslationLanguage(e){return t(this,void 0,void 0,(function*(){return i(this,VT,"m",FT).call(this,$s.transLan,e)}))}getTranslationLanguage(){return t(this,void 0,void 0,(function*(){return gi(this.storage.get("value").transLan||"zh")}))}setAutoTranslateEnabled(e){return t(this,void 0,void 0,(function*(){return i(this,VT,"m",FT).call(this,$s.autoTrans,e?"1":"0")}))}getAutoTranslateEnabled(){return t(this,void 0,void 0,(function*(){return gi(this.storage.get("value").autoTrans)}))}}kT=new WeakMap,VT=new WeakSet,xT=function(e){i(this,kT,"f")&&(s(this,kT,!1,"f"),this.emit("userSettingsSynced",e))},FT=function(e,i){return t(this,void 0,void 0,(function*(){const{version:t}=this.storage,{currentUserId:s}=this._ctx,n=Uc.encode(ta,{version:t,value:i,ignoreVersion:!0}),r=yield this._ctx.query(e,s,n,ia);if(r.isOk){const{version:t,updateVersion:s}=r.data,{transLan:n,autoTrans:o,tags:a,version:l}=this.storage.get("value"),c={version:s?t:l,transLan:n,autoTrans:o,tags:a};switch(e){case $s.transLan:c.transLan=i;break;case $s.autoTrans:c.autoTrans="1"===i}this.storage.set("value",c)}return r.wipe()}))};const jT=e=>{var t;return{userId:e.userId,name:e.name,portraitUri:e.portraitUrl,remark:null!==(t=e.remarkName)&&void 0!==t?t:"",directionType:e.friendType,extProfile:Object.fromEntries(e.extProfile.map((e=>[e.key,e.value]))),addTime:e.relationTime,inBlackList:!!e.flag}},YT=e=>{var t,i;const{targetId:s,settingProfile:n,extProfile:r,baseInfo:o,userInfo:a}=e,l=Kt(n||[]),c=Kt(r||[]);return{groupId:s,groupName:l.name||"",portraitUri:l.portraitUrl||"",introduction:l.introduction||"",notice:l.announcement||"",extProfile:c,joinPermission:~~l.joinPerm,removeMemberPermission:~~l.removePerm,invitePermission:~~l.memInvitePerm,inviteHandlePermission:~~l.invitePerm,groupInfoEditPermission:~~l.profilePerm,memberInfoEditPermission:~~l.memProfilePerm,creatorId:(null==o?void 0:o.creatorId)||"",ownerId:(null==o?void 0:o.ownerId)||"",createTime:(null==o?void 0:o.createTime)||0,membersCount:(null==o?void 0:o.memberCount)||0,remark:null!==(t=null==a?void 0:a.remarkName)&&void 0!==t?t:"",joinedTime:(null==a?void 0:a.joinTime)||0,role:null!==(i=null==a?void 0:a.role)&&void 0!==i?i:f.UNDEF}};class WT{constructor(e){Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"searchFriendsInfo",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"searchGroupMembers",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"searchJoinedGroups",{enumerable:!0,configurable:!0,writable:!0,value:xE})}updateMyUserProfileVisibility(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(rl,{permission:e});return(yield this.ctx.query($s.updProfilePermiss,this.ctx.currentUserId,t)).wipe()}))}getMyUserProfileVisibility(){return t(this,void 0,void 0,(function*(){const e=Uc.encode(nl,{nothing:1});return(yield this.ctx.query($s.qProfilePermiss,this.ctx.currentUserId,e,rl)).trans((e=>e.permission))}))}searchUserProfileByUniqueId(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ol,{uniqueId:e}),i=yield this.ctx.query($s.searchUserProfile,this.ctx.currentUserId,t,el);if(!i.isOk)return i.wipe();const{userId:s,userProfile:n,userExtProfile:r}=i.data,o=xt(s,n,r);return gi(o)}))}createGroup(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=kg(e,i,s,n),r=yield this.ctx.query($s.channelCreate,e,t,void 0);if(r.isOk||!r.data)return r.wipe();const o=Uc.decode(ll,r.data.pbData),a={errorKeys:o.censorFailedFields,processCode:o.processCode||0};return Ei(r.code,r.msg,a)}))}updateGroupInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=kg(e,i,s),n=yield this.ctx.query($s.upChannelInfo,e,t,void 0);if(n.isOk||!n.data)return n.wipe();const r=Uc.decode(ll,n.data.pbData);return Ei(n.code,n.msg,{errorKeys:r.censorFailedFields})}))}getGroupsInfo(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(cl,{type:w.GROUP,list:e.map((e=>({targetId:e})))}),i=yield this.ctx.query($s.qChannelInfo,e[0],t,ul);if(!i.isOk)return i.wipe();const{list:s}=qg(i.data);return gi(s.map(YT))}))}kickGroupMembers(e,i,s){return t(this,void 0,void 0,(function*(){const t=sE({targetId:e,users:i,settingInfo:{isQuit:!0,isDelBan:s.removeMuteStatus,isDelAttention:s.removeFollow,isDelWhite:s.removeWhiteList}});return(yield this.ctx.query($s.channelMemKick,e,t)).wipe()}))}quitGroup(e,i){return t(this,void 0,void 0,(function*(){const t=sE({targetId:e,settingInfo:{isQuit:!0,isDelBan:i.removeMuteStatus,isDelAttention:i.removeFollow,isDelWhite:i.removeWhiteList}});return(yield this.ctx.query($s.channelMemQuit,e,t)).wipe()}))}dismissGroup(e){return t(this,void 0,void 0,(function*(){const t=sE({targetId:e});return(yield this.ctx.query($s.channelDismiss,e,t)).wipe()}))}transferGroupOwner(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=sE({targetId:e,settingInfo:{isQuit:s,isDelBan:n.removeMuteStatus,isDelAttention:n.removeFollow,isDelWhite:n.removeWhiteList},users:[i]});return(yield this.ctx.query($s.channelTransfer,e,t)).wipe()}))}setGroupManagers(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(_l,{targetId:i,type:w.GROUP,users:s,operateType:e});return(yield this.ctx.query($s.upChannelManager,i,t)).wipe()}))}setGroupFollows(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(_l,{targetId:i,type:w.GROUP,users:s,operateType:e});return(yield this.ctx.query($s.upChannelFollow,i,t)).wipe()}))}getGroupFollows(e){return t(this,void 0,void 0,(function*(){const t=tE({targetId:e}),i=yield this.ctx.query($s.qChannelFollow,this.ctx.currentUserId,t,ul);if(!i.isOk)return i.wipe();const{list:s}=qg(i.data),n=s.map((e=>({userId:e.userId,time:e.opTime})));return gi(n)}))}setGroupRemark(e,i){return t(this,void 0,void 0,(function*(){const t=iE({targetId:e,operateType:i?p.ADD:p.REMOVE,channelNickName:i});return(yield this.ctx.query($s.upChannelRemark,e,t)).wipe()}))}addFriend(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Rl,{targetId:e,type:i,info:s});return(yield this.ctx.query($s.friendAdd,this.ctx.currentUserId,t,ll)).trans((e=>({processCode:e.processCode||0})))}))}deleteFriends(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Al,{targetId:e,type:i});return(yield this.ctx.query($s.friendDel,this.ctx.currentUserId,t)).wipe()}))}acceptFriendRequest(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Rl,{targetId:e,type:1});return(yield this.ctx.query($s.friendHandle,this.ctx.currentUserId,t)).wipe()}))}refuseFriendRequest(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Rl,{targetId:e,type:2,info:i});return(yield this.ctx.query($s.friendHandle,this.ctx.currentUserId,t)).wipe()}))}setFriendInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(ml,{targetId:e,remarkName:i,extProfile:Object.entries(s).map((([e,t])=>({key:e,value:t})))}),n=yield this.ctx.query($s.friendSetPf,this.ctx.currentUserId,t,void 0);if(n.isOk||!n.data)return n.wipe();const r=Uc.decode(Sl,n.data.pbData);return Ei(n.code,"",{errorKeys:r.censorFailedFields})}))}checkFriends(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Al,{targetId:e,type:i});return(yield this.ctx.query($s.friendCheck,this.ctx.currentUserId,t,pl)).trans((({list:e})=>e.map((e=>({userId:e.targetId,relationType:e.status})))))}))}getFriends(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(vl,{queryType:11,friendType:e,page:{size:i.count,order:i.order?0:1,pageToken:i.pageToken}}),s=yield this.ctx.query($s.friendsQuery,this.ctx.currentUserId,t,ul);if(!s.isOk)return s.wipe();const{pageToken:n,hasNext:r}=s.data.page,{list:o}=qg(s.data),a={pageToken:r&&n?n:"",data:o.map(jT)};return gi(a)}))}getFriendApplications(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(vl,{queryType:12,page:{size:e.count,pageToken:e.pageToken,order:e.order?0:1}}),i=yield this.ctx.query($s.friendsQuery,this.ctx.currentUserId,t,ul);if(!i.isOk)return i.wipe();const{pageToken:s,hasNext:n}=i.data.page,{list:r}=qg(i.data),o={pageToken:n&&s?s:"",data:r.map((e=>({userId:e.userId,name:e.name,portraitUri:e.portraitUrl,applicationType:e.type,applicationStatus:e.status,operationTime:e.operateTime,extra:e.info||""})))};return gi(o)}))}getFriendsInfo(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Nl,{targetId:e});return(yield this.ctx.query($s.friendsInfoQry,this.ctx.currentUserId,t,yl)).trans((e=>e.list.map(jT)))}))}setFriendAddPermission(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Ol,{level:e});return(yield this.ctx.query($s.friendAuthSet,this.ctx.currentUserId,t)).wipe()}))}getFriendAddPermission(){return t(this,void 0,void 0,(function*(){const{currentUserId:e}=this.ctx,t=Uc.encode(Rl,{targetId:e});return(yield this.ctx.query($s.friendAuthGet,e,t,Ol)).trans((e=>e.level))}))}getGroupMembers(e,i){return t(this,void 0,void 0,(function*(){const t=tE({targetId:e,ids:i}),s=yield this.ctx.query($s.qChannelSpeMem,e,t,ul);if(!s.isOk)return s.wipe();const{list:n}=qg(s.data),r=n.map(qt);return gi(r)}))}setGroupMemberInfo(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=iE({targetId:e,userId:i,channelNickName:s,additional:n}),r=yield this.ctx.query($s.upChannelMem,e,t,void 0);if(r.isOk||!r.data)return r.wipe();const o=Uc.decode(ll,r.data.pbData);return Ei(r.code,r.msg,{errorKeys:o.censorFailedFields})}))}getGroupMembersByRole(e,i,s){return t(this,void 0,void 0,(function*(){const t=tE({targetId:e,roleType:i,botType:s.filterRobotType,page:{size:s.count,order:s.order?0:1,pageToken:s.pageToken}}),n=yield this.ctx.query($s.qChannelMem,e,t,ul);if(!n.isOk)return n.wipe();const{pageToken:r,hasNext:o}=n.data.page,{list:a}=qg(n.data),l={pageToken:o&&r?r:"",data:a.map(qt)};return gi(l)}))}joinGroup(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(fl,{targetId:e,type:w.GROUP});return(yield this.ctx.query($s.channelMemJoin,e,t,ll)).trans((e=>({processCode:e.processCode||0})))}))}inviteUsersToGroup(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode(fl,{targetId:e,type:w.GROUP,userIds:i});return(yield this.ctx.query($s.channelMemInvite,e,t,ll)).trans((e=>({processCode:e.processCode||0})))}))}memberInviteResponse(e){return t(this,void 0,void 0,(function*(){const{groupId:t,inviterId:i,optType:s,optResult:n,joinUserId:r,reason:o}=e,a=Uc.encode(Tl,{targetId:t,type:w.GROUP,optType:s,optResult:n,inviterId:i,joinUserId:r,detail:o});return(yield this.ctx.query($s.channelApplyResp,t,a,ll)).trans((e=>({processCode:e.processCode||0})))}))}getGroupApplications(e,i,s){return t(this,void 0,void 0,(function*(){const t=tE({page:{size:e.count,pageToken:e.pageToken,order:e.order?0:1}}),i=yield this.ctx.query($s.qChannelApplyList,this.ctx.currentUserId,t,ul);if(!i.isOk)return i.wipe();const{pageToken:s,hasNext:n,list:r}=qg(i.data),o=r.map(Jt);return gi({data:o,pageToken:n&&s?s:""})}))}getJoinedGroupsByRole(e,i){return t(this,void 0,void 0,(function*(){const t=tE({roleType:e,page:{size:i.count,pageToken:i.pageToken,order:i.order?1:0}}),s=yield this.ctx.query($s.qChannelMemJoin,this.ctx.currentUserId,t,ul);if(!s.isOk)return s.wipe();const{pageToken:n,hasNext:r}=s.data.page,{list:o}=qg(s.data),a=o.map(YT);return gi({data:a,pageToken:r&&n?n:""})}))}getJoinedGroups(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(dl,{type:w.GROUP,ids:e}),i=yield this.ctx.query($s.qChannelMemSpeJoin,this.ctx.currentUserId,t,ul);if(!i.isOk)return i.wipe();const{list:s}=qg(i.data),n=s.map(YT);return gi(n)}))}}const qT={[N.GROUP_OPERATION]:e=>"ChannelEventData",[N.GROUP_PROFILE_CHANGE]:e=>"ChannelEventData",[u.FRIEND_APPLICATION]:e=>({0:"FriendApplyEvent",1:"FriendApplyEvent",2:"FriendUserInfo",3:"FriendsInput",5:"FriendTypeChangeEvent",6:"FriendUpdateEvent"}[e])};class JT{constructor(e){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e})}decodeByPBName(e,t,i){let s=e;const n={}[t];try{s=e.length>0&&Uc.decode(t,e),vt(n)&&(s=n.call(this,s,i))}catch(e){this.logger.error(r.L_PB_DECODE_E,t)}return s}formatEventChangeList(e){return e.map((e=>{const{businessId:t,time:i,changeType:s,originalId:n,originalTime:r,secondaryId:o,isAdmin:a,additionalMark:l,operatorId:c,subChangeType:_,secondaryType:d,remindType:u,isRemindMe:h,extIds:g,eventData:E}=e;let I;return E&&(I=this._formatEventData(E,s,_)),{businessId:t,changeType:s,originalId:n,time:i,originalTime:r,secondaryId:o||"",isAdmin:a,additionalMark:l,operatorId:c,subChangeType:_,userGroupIds:g,secondaryType:d,remindType:u,isRemindMe:h,eventData:I}}))}_formatEventData(e,t,i){let s={};return e&&qT[t]&&qT[t](i)&&(s=Uc.decode(qT[t](i),e)||{}),s}}var KT,QT,XT,zT,ZT,$T,ef,tf,sf,nf,rf;const of={[w.PRIVATE]:$s.qryPMsg,[w.GROUP]:$s.qryGMsg,[w.CHATROOM]:$s.qryCHMsg,[w.CUSTOMER_SERVICE]:$s.qryCMsg,[w.SYSTEM]:$s.qrySMsg,[w.APP_PUBLIC_SERVICE]:$s.qryMCMsg,[w.PUBLIC_SERVICE]:$s.qryMPMsg,[w.ULTRA_GROUP]:$s.qryUgMsg},af=(e,t,i,s,n,r)=>{const{isCounted:o,isPersited:a,isStatusMessage:l}=ms(t.messageType),{conversationType:c,targetId:_,channelId:d}=e;return{conversationType:c,targetId:_,channelId:d||"",senderUserId:n,messageDirection:ue.SEND,isCounted:o,isMentioned:!!t.isMentioned,content:t.content,messageType:t.messageType,isOffLineMessage:!1,isPersited:a,messageUId:i,sentTime:s,receivedTime:0,disableNotification:!!t.disableNotification,isStatusMessage:!!l,canIncludeExpansion:!!t.canIncludeExpansion,expansion:t.canIncludeExpansion?t.expansion:null,receivedStatus:Re.UNREAD,receivedStatusInfo:Gt(Re.UNREAD),pushConfig:t.pushConfig,isInterrupt:t.isInterrupt,messageId:r||0,sentStatus:ie.SENT,directedUserIds:t.directionalUserIdList,disableUpdateLastMessage:t.disableUpdateLastMessage,needReceipt:t.needReceipt}},lf=[N.GROUP_OPERATION,N.GROUP_PROFILE_CHANGE,N.GROUP_APPLICATION_INVITATION,N.GROUP_FOLLOW_USER_CHANGE],cf=[u.FRIEND_APPLICATION];class _f{constructor(e,t){KT.add(this),Object.defineProperty(this,"_watcher",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_userSettings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subscribeManager",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_openCallPlus",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_chat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_chatroom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dataHosting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_codec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_signalHandlerMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_latestPullKVMsgTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_handleInnerMsgOptions",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{const{messageType:i}=t;return i===Q.SYNC_READ_STATUS&&(t.directionalUserIdList=oi(e.conversationType,[this.currentUserId])),i===Q.READ_RECEIPT_RESPONSE&&(t.content.receiptMessageDic&&0!==Object.keys(t.content.receiptMessageDic).length||(t.content=this._chat.storage.createReadReceiptResponseContent(e)),t.directionalUserIdList=Object.keys(t.content.receiptMessageDic)),t}}),Object.defineProperty(this,"getOSInfo",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getProcessInfo",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getMainProcessInfo",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setProxy",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getProxy",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"testProxy",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setUserStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getUserStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"addToBlacklist",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"removeFromBlacklist",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getBlacklist",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getBlacklistStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"insertMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"batchInsertMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getLocalMessageCount",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"deleteLocalMessages",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"deleteLocalMessagesByTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"batchClearLocalMessagesByTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"clearLocalMessages",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"getMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setMessageContent",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setMessageSearchField",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"searchConversationByContentWithAllChannel",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"searchMessagesWithParams",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setMessageSentStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"updateMessageReceiptStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setMessageReceivedStatus",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"clearLocalData",{enumerable:!0,configurable:!0,writable:!0,value:xE}),Object.defineProperty(this,"setCheckDuplicateMessage",{enumerable:!0,configurable:!0,writable:!0,value:xE});const s=this._ctx=new nT(t),{logger:n}=s;this._codec=new JT(n),this._userSettings=new HT(s),this._chat=new wI(s,this._userSettings,this),this._chatroom=new GT(s),this._dataHosting=new WT(s),this._chat.on("messages",this._handleChatMessages,this),this._chat.on("offlineFinished",(()=>this._watcher.pullFinished()),this),this._chat.on("syncReadStatusV4",this._handleSyncReadStatusV4,this),this._chat.on("expansions",this._handleExpansions,this),this._chat.on("readReceiptV4",this._handleReadReceiptV4,this),this._chat.on("conversationStatusChanged",this._conversationStatusChanged,this),this._chat.on("conversationStatusSynced",((e,t)=>this._watcher.conversationStatusSynced(t)),this),this._chat.on("sgRelationsSynced",((e,t)=>this._watcher.sgRelationsSynced(t)),this),this._chat.on("ultraGroupEnable",(()=>this._watcher.ultraGroupEnable()),this),this._chat.on("syncServerSaveUnreadCompleted",(()=>this._watcher.syncServerSaveUnreadCompleted()),this),this._chatroom.on("message",this._handleChatroomMessages,this),this._chatroom.on("chatroom",this._handlerChatroomEvent,this),s.on("sCmd",this._handleSCmdNotify,this),s.on("signal",this._handleSignal,this),s.on("onConnected",this.onConnected,this),s.on("onDisconnected",this.onDisconnected,this),s.on("onConnecting",this.onConnecting,this),s.on("onSuspend",this.onSuspend,this),s.on("messagesFromUG",this._handleMessagesFromUltraGroup,this),s.on("serverEvent",i(this,KT,"m",sf),this),s.on("readReceiptResponseV5",i(this,KT,"m",XT),this),s.on("speechToTextResponse",i(this,KT,"m",zT),this),s.on("ugUserGroupChanged",this._handleUserGroupStatus,this),s.on("ugChannelChanged",this._handleUltraChannelChange,this),s.on("messageModified",i(this,KT,"m",ZT),this),s.on("messageModifiedSyncCompleted",i(this,KT,"m",$T),this),s.on("ugMsgExpansionUpdated",i(this,KT,"m",ef),this),s.on("ugMsgRecalled",i(this,KT,"m",tf),this),s.on("robotsSynced",i(this,KT,"m",QT),this),s.on("messageReaction",((e,t)=>this._watcher.messageReaction(t))),s.on("unknownSignal",((e,t)=>this._handleUnknownSignal(t)),this),this._userSettings.on("voipInfoChanged",this._naviChangeHandler,this),this._userSettings.on("tagsChanged",(()=>this._watcher.tag()),this),this._userSettings.on("userSettingsSynced",((e,t)=>this._watcher.userSettingsSynced(t)),this),this._userSettings.on("userSettingsChanged",((e,t)=>this._watcher.userSettingsChanged(t)),this)}get appkey(){return this._initOptions.appkey}get chat(){return this._chat}get chatroom(){return this._chatroom}get userSettings(){return this._userSettings}get dataHosting(){return this._dataHosting}get usingCppEngine(){return!1}get logger(){return this._ctx.logger}registerCustomSignalHandler(e,t){"function"==typeof t&&e.forEach((e=>{const i=this._signalHandlerMap.get(e)||new Set;i.add(t),this._signalHandlerMap.set(e,i)}))}_handleUnknownSignal(e){const{name:t}=e,i=this._signalHandlerMap.get(t);i&&Array.from(i).forEach((i=>{try{i(e)}catch(e){console.error(`execute custom signal('${t}') handler err.`,e)}}))}onConnected(e,t){const i=this._ctx.getNaviInfoFromCache();this._initSubscribeManager(i),this._openCallPlus&&this._syncCallPullKVMsg(),this._watcher.onConnected(t)}onDisconnected(e,t){this._resetMemoryState(),this._watcher.onDisconnected(t)}onSuspend(e,t){this._watcher.onSuspend(t)}onConnecting(e){this._watcher.onConnecting()}_handleSyncReadStatusV4(e,t){t.forEach((e=>this._watcher.syncReadStatus(e)))}_handleReadReceiptV4(e,t){t.forEach((e=>this._watcher.messageReadReceipt(e)))}_handleExpansions(e,t){t.forEach((e=>this._watcher.expansion(e)))}_conversationStatusChanged(e,t){const i=t.some((e=>{var t;return void 0!==(null===(t=e.updatedItems)||void 0===t?void 0:t.tags)}));this._watcher.conversation(t),i&&this._watcher.conversationTag()}_initSubscribeManager(e){(e.subDriven||e.userProfile)&&(this._subscribeManager||(this._subscribeManager=new V_(this._ctx,{syncSubscribeUserStatusFinished:e=>{var t,i;null===(i=(t=this._watcher).syncSubscribedUserStatusFinished)||void 0===i||i.call(t,e)},subscribeUserStatusChanged:e=>{var t,i;null===(i=(t=this._watcher).subscribedUserStatusChange)||void 0===i||i.call(t,e)},subscribeRelationChanged:e=>{var t,i;null===(i=(t=this._watcher).subscribedRelationChange)||void 0===i||i.call(t,e)},ownUserProfileChanged:e=>{var t,i;null===(i=(t=this._watcher).ownUserProfileChanged)||void 0===i||i.call(t,e)}},this.currentUserId,this._ctx.delayTime,this.logger,!!e.userProfile,e.subDriven||0)),this._subscribeManager.syncData())}createLogger(e,t){return new x_(this.appkey,e,t,this.logger.proxy)}refetchNaviInfo(){return this._ctx.navi.request(this._ctx.currentToken,!0,!0,this.logger.createTraceId())}get naviInfo(){return this._ctx.getNaviInfoFromCache()}get connectedTime(){return this._ctx.connectedTime}get connectionStatus(){return this._ctx.connectionStatus}connect(e,i,s,n){return t(this,void 0,void 0,(function*(){return this._openCallPlus=s,this._ctx.connect(e,i,s,n)}))}_handleMessagesFromUltraGroup(e,t,i){const s=new Map,n=[];t.forEach((e=>{var t,i,r;const{targetId:o,content:a,messageUId:l,channelId:c,isMentioned:_,isCounted:d,senderUserId:u,messageType:h,sentTime:g,channelType:E,isPersited:I}=e,T={conversationType:w.ULTRA_GROUP,targetId:o,channelId:c||""},f=this._chat.storage.getOrCreateModel(T,!0),R=s.get(f)||{params:{channelType:E},time:g};s.set(f,R),R.time=g;const{params:A}=R;if(I&&(A.hidden=!1,A.latestMessage=e,A.operationTime=g),d&&u!==this.currentUserId&&h!==Q.RECALL_NOTIFICATION_MESSAGE){A.unreadCount=(A.unreadCount||f.unreadCount)+1;const e=(null===(t=null==a?void 0:a.mentionedInfo)||void 0===t?void 0:t.type)===K.ALL;_&&(e||(null===(r=null===(i=null==a?void 0:a.mentionedInfo)||void 0===i?void 0:i.userIdList)||void 0===r?void 0:r.includes(this.currentUserId)))&&(A.unreadMentionedCount=(A.unreadMentionedCount||f.unreadMentionedCount)+1,e||(A.unreadMentionedMeCount=(A.unreadMentionedMeCount||f.unreadMentionedMeCount)+1),A.hasMentioned=!0,A.mentionedInfo=null==a?void 0:a.mentionedInfo),f.firstUnreadMessage||A.firstUnreadMessageUId||(A.firstUnreadMessageType=h,A.firstUnreadMessageUId=l,A.firstUnreadTime=g)}n.push(e)}));const r=[],o=[];Array.from(s.entries()).forEach((([e,{params:t,time:i}])=>{r.push(e);const s=e.updateAttrs(t,i);s&&o.push({conversation:e.toIReceivedConversation(),updatedItems:s})})),this._chat.storage.updateConversationStorage(r),o.length>0&&this._watcher.conversation(o),this._batchMessage(n)}_handleChatroomMessages(e,t,i){this._watcher.batchMessage(t)}_handlerChatroomEvent(e,t){this._watcher.chatroom(t)}_handleChatMessages(e,t,i,s){this._watcher.batchMessage(i)}_handleSignal(e,t,i){var s;const{syncMsg:n,topic:r}=t;if(n)return void this._receiveSyncMsg(t,i);switch(en(r)){case $s.rtc_ntf:this._watcher.onRTCDataChange(t.pbData);break;case $s.s_opNtf:this._pullOperateStatusNotify(t);break;case $s.s_pubCall:this._pubCallInfo(t);break;case $s.s_stat:null===(s=this._subscribeManager)||void 0===s||s.updateUserStatus(t)}}_handleSCmdNotify(e,t){var i,s,n;const{time:r,type:o}=t;switch(o){case 8:null===(i=this._subscribeManager)||void 0===i||i.startsyncSubscribeUserStatus(r);break;case 9:null===(s=this._subscribeManager)||void 0===s||s.startSyncSubscribeRelationship(r);break;case 10:null===(n=this._subscribeManager)||void 0===n||n.syncOwnProfile(!0)}}_receiveMessageExpansion(e){const{content:t,channelId:i="",conversationType:s,targetId:n}=e,{put:r,del:o,mid:a}=t;r&&this._watcher.expansion({updatedExpansion:{messageUId:a,expansion:r,channelId:i,conversationType:s,targetId:n}}),o&&this._watcher.expansion({deletedExpansion:{messageUId:a,deletedKeys:o,channelId:i,conversationType:s,targetId:n}})}_clearConversationUnreadCount(e,t,i,s,n){const r=this._chat.storage.clearConversationUnreadCount({conversationType:e,targetId:t,channelId:i},n);s&&r&&this._watcher.conversation([r])}_updateSGModelCacheAfterSent(e){const{conversationType:t,isPersited:i,targetId:s,channelId:n,sentTime:r,disableUpdateLastMessage:o,messageType:a,messageUId:l,content:c}=e;if(!W(t,G))return;const _=this.naviInfo,d={conversationType:t,targetId:s,channelId:n},u=this._chat.storage.getOrCreateModel(d,!0),h={},g=a===Q.RECALL;if(i){g&&!u.hidden||(h.operationTime=r),h.hidden=!1;const t=g?c.sentTime:r;o||u.latestMessage&&!(u.latestMessage.sentTime<=t)||(h.latestMessage=_.supportRecallRefactor&&g?U_(e,!0):e)}if(this._ctx.includeUg&&a===Q.EXPANSION_NOTIFY&&u.latestMessage&&u.latestMessage.messageUId===l){const{put:e,del:t,clear:i}=c;i?u.latestMessage.expansion={}:e?u.latestMessage.expansion=Object.assign(Object.assign({},u.latestMessage.expansion),e):t&&u.latestMessage.expansion&&t.forEach((e=>{delete u.latestMessage.expansion[e]}))}const E=u.updateAttrs(h,e.sentTime);this._chat.storage.updateConversationStorage([u]),E&&this._watcher.conversation([{conversation:u.toIReceivedConversation(),updatedItems:E}])}_receiveSyncMsg(e,t){var i;switch(en(e.topic)){case $s.updRTime:this._receivesyncReadStatus(e);break;case $s.updUserSub:null===(i=this._subscribeManager)||void 0===i||i.startSyncSubscribeRelationship(t.timestamp)}}_batchMessage(e){this._watcher.batchMessage(e)}_pubCallInfo(e){const{key:t,dataContent:i,maxTime:s}=Uc.decode(ka,e.pbData);this._latestPullKVMsgTimestamp=s,this._watcher.callInfo(JSON.stringify({list:[{key:t,value:i}]}))}_receivesyncReadStatus(e){const t=Uc.decode(Yo,e.pbData),{type:i,channelId:s,msgTime:n,busChannel:r}=t;this._clearConversationUnreadCount(i,s,r||"",!0,n),this._watcher.syncReadStatus({conversationType:i,targetId:s,channelId:r,timestamp:n})}_syncCallPullKVMsg(){return t(this,void 0,void 0,(function*(){if(!this._ctx.isConnected)return;const e=Uc.encode(xa,{syncTime:this._latestPullKVMsgTimestamp}),{isOk:t,data:i}=yield this._ctx.query($s.pullKvMsg,this.currentUserId,e,Fa);t&&i&&(this._latestPullKVMsgTimestamp=i.maxTime,this._watcher.callInfo(JSON.stringify({list:i.info})))}))}getHistoryMessage(e,i,s){return t(this,void 0,void 0,(function*(){const{conversationType:t,targetId:s,channelId:n}=e,{timestamp:r,count:o,order:a}=i,l=of[t],{currentUserId:c}=this,_=Jg({targetId:s,busChannel:n,time:r||(1===a?1:this._ctx.serverTime+6e4),count:o,order:a}),d=t===w.CHATROOM?s:c,u=yield this._ctx.query(l,d,_,void 0);if(!u.isOk)return u.wipe();const h=Kg(u.data.pbData),g=h.list.map((e=>{const t=y_(e,c,!1,s);if(t.messageDirection===ue.SEND){const e=this._chat.storage.getReadReceiptResponseUsers(t,t.messageUId);t.readReceiptInfo={isReceiptRequestMessage:!0,readerList:e}}return t}));return gi({hasMore:!!h.hasMsg,list:0===a?g.reverse():g})}))}reportSDKInfo(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),i=JSON.stringify(e);this.logger.info(r.L_VER_REPORT_T,i,t);const s=Uc.encode(va,{sdkInfo:i}),n=yield this._ctx.query($s.reportsdk,this._ctx.currentUserId,s);this.logger.summary(r.L_VER_REPORT_R,n,t)}))}saveTextMessageDraft(e,i){return t(this,void 0,void 0,(function*(){return this._chat.storage.setDrafts(e,i),gi()}))}getTextMessageDraft(e){return t(this,void 0,void 0,(function*(){const t=this._chat.storage.getDrafts(e);return gi(t)}))}clearTextMessageDraft(e){return t(this,void 0,void 0,(function*(){return this._chat.storage.deleteDrafts(e),gi()}))}sendMessage(e,i,s,n){return t(this,void 0,void 0,(function*(){const{conversationType:t,targetId:s}=e;i=this._handleInnerMsgOptions(e,i);let r=!1;[w.PRIVATE,w.GROUP].includes(t)&&(i.isStatusMessage||ms(i.messageType).isStatusMessage)&&(r=!0);const o=r?(a=t,{[w.PRIVATE]:$s.ppMsgS,[w.GROUP]:$s.pgMsgS}[a]):(e=>({[w.PRIVATE]:$s.ppMsgP,[w.GROUP]:$s.pgMsgP,[w.CHATROOM]:$s.chatMsg,[w.CUSTOMER_SERVICE]:$s.pcMsgP,[w.RTC_ROOM]:$s.prMsgS,[w.SYSTEM]:$s.pbMsgP}[e]))(t)||$s.ppMsgP;var a;i.messageId||(i.messageId=ti());const{messageId:l}=i,c=eE(e,i),_=new Or($s[o],c,t===w.SYSTEM?this.currentUserId:s);if(_.setHeaderQos(nn),r)return this._ctx.sendOnly(_),gi(af(e,Object.assign(Object.assign({},i),{isStatusMessage:r}),"",0,this.currentUserId,l));const d=this._ctx.serverTime,u=af(e,Object.assign(Object.assign({},i),{isStatusMessage:r}),"",d,this.currentUserId,l);null==n||n(l);const h=Date.now(),{code:g,isOk:E,msg:I,data:T}=yield this._ctx.send(_);if(!E)return this._ctx.checkIfNeedRecordMessageUId(t)&&this.logger.record(ge.IM_MSG_SEND,JSON.stringify({channel:t,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._ctx.serverTime,cod:g})),u.sentStatus=ie.FAILED,Ei(g,I,u);const{timestamp:f,messageUId:R}=T;return u.sentTime=f,u.messageUId=R,this._sendMessageSuccessHandle(u),this._ctx.checkIfNeedRecordMessageUId(t,R)&&this.logger.record(ge.IM_MSG_SEND,JSON.stringify({msg_id:R,channel:t,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._ctx.serverTime,cod:g})),gi(u)}))}_sendMessageSuccessHandle(e){e.conversationType!==w.CHATROOM&&this._chat.storage.addSentRecord(e.messageUId,e.sentTime),this._updateSGModelCacheAfterSent(e);const{messageType:t}=e;t===Q.READ_RECEIPT_REQUEST&&this._chat.storage.addReadReceiptRequest(e,this.currentUserId),t===Q.READ_RECEIPT_RESPONSE&&this._chat.storage.handleReadReceiptResponse(e,this.currentUserId)}recallMsg(e,i){return t(this,void 0,void 0,(function*(){const{targetId:t,conversationType:s}=e,n=e.channelId||"",{user:r,extra:o,isDelete:a,directionalUserIdList:l,disableUpdateLastMessage:c,messageUId:_,sentTime:d,disableNotification:u,pushConfig:h,pushContent:g,isAdmin:E}=i,I={conversationType:s,targetId:t,messageUId:_,sentTime:d,channelId:n,isDelete:!!a,isAdmin:!!E};r&&(I.user=r),o&&(I.extra=o);const T={content:I,messageType:Q.RECALL,disableNotification:u,pushConfig:h,pushContent:(null==h?void 0:h.pushContent)||g,disableUpdateLastMessage:c,directionalUserIdList:oi(s,l)},f=eE(e,T),R=new Or($s.recallMsg,f,this.currentUserId);R.setHeaderQos(nn);const A=yield this._ctx.send(R);if(!A.isOk)return A.wipe();const p=A.data;s!==w.ULTRA_GROUP&&(p.messageUId=`Cmd:${_}`);const m=af(e,T,p.messageUId,p.timestamp,this.currentUserId);return s===w.ULTRA_GROUP?(this._chat.storage.addUGSentRecord(p.messageUId,p.timestamp),this._updateUltraGroupWhenRecallMsg(m)):(this._chat.storage.addSentRecord(p.messageUId,p.timestamp),this._updateSGModelCacheAfterSent(m)),gi(m)}))}_naviChangeHandler(e,t){this._ctx.navi.updateVoipCallInfo(this._ctx.currentToken,t);const i=this._ctx.getNaviInfoFromCache();this._watcher.onNaviDataChange(Object.assign({},i))}getFileToken(e,i,s,n,r,o){return t(this,void 0,void 0,(function*(){let t;t=n&&"uploads"!==n?i||"":Xt(e,i);const a=this.naviInfo,l=ri(a,this.logger);let c="";l||(c=JSON.stringify({uploadDomain:l}));const _=Uc.encode(vo,{type:e,key:t,httpMethod:s||"",queryString:n||"",url:r||"",ext:c,size:o?Math.ceil(o):0,ipType:a.ipType||0});return(yield this._ctx.query($s.qnTkn,this.currentUserId,_,Oo)).trans((e=>Object.assign(Object.assign({},e),{fileName:t,downloadAuthInfo:e.downloadAuthInfo?JSON.parse(e.downloadAuthInfo):null})))}))}getFileUrl(e,i,s,r){return t(this,void 0,void 0,(function*(){const t=this.naviInfo;let o,a="",l="";i===n.QINIU?o=$s.qnUrl:i===n.AWS?o=$s.s3Url:i===n.STC?o=$s.stcUrl:i===n.MINIO?(o=$s.minioUrl,a=ri(t,this.logger),l=JSON.stringify({url:a})):o=$s.aliUrl;const c=Uc.encode(No,{type:e,key:s,fileName:r,ext:l,size:-1,ipType:t.ipType||0});return(yield this._ctx.query(o,this.currentUserId,c,yo)).trans((({downloadUrl:e})=>({downloadUrl:e})))}))}disconnect(e,i){return t(this,void 0,void 0,(function*(){return yield this._ctx.disconnect(e,i),this._resetMemoryState(),gi()}))}_resetMemoryState(){this._subscribeManager&&delete this._subscribeManager}registerMessageType(e,t){}get serverTime(){return this._ctx.serverTime}get userId(){return this._ctx.currentUserId}get currentUserId(){return this._ctx.currentUserId}createTag(e){return t(this,void 0,void 0,(function*(){return this._userSettings.hasTag(e.tagId)?Ei(D.TAG_EXISTS):this._userSettings.createTag(e)}))}removeTag(e){return t(this,void 0,void 0,(function*(){return this._userSettings.hasTag(e)?this._userSettings.removeTag(e):Ei(D.TAG_NOT_EXIST)}))}updateTag(e){return t(this,void 0,void 0,(function*(){return this._userSettings.hasTag(e.tagId)?this._userSettings.createTag(e):Ei(D.TAG_NOT_EXIST)}))}getTagList(){var e;return t(this,void 0,void 0,(function*(){const t=this._userSettings.getTags(),i=this._chat.storage.getTagConversationCountMap(),s=[];for(const n in t)s.push({tagId:n,tagName:t[n].tagName,createdTime:t[n].createdTime,conversationCount:(null===(e=i.get(n))||void 0===e?void 0:e.length)||0});return gi(s)}))}sendUltraMessage(e,i,s,n){return t(this,void 0,void 0,(function*(){const{targetId:t}=e;i.messageId||(i.messageId=ti());const{messageId:s}=i,r=eE(e,i),o=new Or($s.ugMsg,r,t);o.setHeaderQos(nn);const a=this._ctx.serverTime,l=af(e,Object.assign({},i),"",a,this.currentUserId,s);n&&n(s);const c=Date.now(),{code:_,data:d}=yield this._ctx.send(o);if(_!==D.SUCCESS)return this._ctx.checkIfNeedRecordMessageUId(w.ULTRA_GROUP)&&this.logger.record(ge.IM_MSG_SEND,JSON.stringify({channel:w.ULTRA_GROUP,start_ts:c,client_ts:Date.now(),server_deltatime:Date.now()-this._ctx.serverTime,cod:_})),l.sentStatus=ie.FAILED,Ei(_,void 0,l);const{timestamp:u,messageUId:h}=d;l.sentTime=u,l.messageUId=h,this._ctx.checkIfNeedRecordMessageUId(w.ULTRA_GROUP,h)&&this.logger.record(ge.IM_MSG_SEND,JSON.stringify({msg_id:h,channel:w.ULTRA_GROUP,start_ts:c,client_ts:Date.now(),server_deltatime:Date.now()-this._ctx.serverTime,cod:_})),this._chat.storage.addUGSentRecord(h,u);const g=this._chat.storage.getOrCreateModel(e,!0),E=g.updateAttrs({operationTime:u,latestMessage:Object.assign({},l)},u);return E&&this._watcher.conversation([{conversation:g.toIReceivedConversation(),updatedItems:E}]),gi(l)}))}_pullOperateStatusNotify(e){if(!this._ctx.isConnected)return;const t=(e=>{const{type:t,notifyType:i,info:s,summary:n}=e,r=[],o=[],a=!(2&~i),l=!(1&~i);return l&&Array.isArray(s)&&s.forEach((e=>{const{targetId:t,busChannel:i,userId:s,opType:n,optime:o}=e;r.push({targetId:t,channelId:i,userId:s,operationType:n,operationTime:o})})),a&&Array.isArray(n)&&n.forEach((e=>{const{targetId:t,busChannel:i,count:s,opType:n}=e;o.push({targetId:t,channelId:i,count:s,operationType:n})})),{conversationType:t,info:r,summary:o,hasInfo:l,hasSummary:a}})(Uc.decode(wa,e.pbData));this._watcher.operateStatus(t)}_handleConvertEvent(e){var t,i;const s=[];e.filter((e=>0===e.subChangeType)).forEach((e=>{const{results:t}=Uc.decode(Fl,new Uint8Array(e.eventData));s.push(...t.map((e=>({identifier:e.messageUID,from:e.inputSource,code:e.code,translateInfo:{targetLanguage:e.targetLan,translatedText:e.transResult||"",status:e.code===D.SUCCESS?Cs.SUCCESS:Cs.FAILED}}))))})),s.length&&(null===(i=(t=this._watcher).translateResponse)||void 0===i||i.call(t,s))}_handleEventChangeList(e){const t={Group:{map:{},types:lf},Friend:{map:{},types:cf}},i=(e,t,i)=>{e[t]||(e[t]=[]),e[t].push(i)};e.forEach((e=>{const{changeType:s}=e;for(const n in t)if(t[n].types.includes(s)){i(t[n].map,s,e);break}}));const s={Group:this._processChangeMapGroup.bind(this),Friend:this._processChangeMapFriend.bind(this)};for(const e in t)Object.keys(t[e].map).length>0&&s[e](t[e].map)}_processChangeMapGroup(e){const{GROUP_OPERATION:t,GROUP_PROFILE_CHANGE:i,GROUP_FOLLOW_USER_CHANGE:s}=N;e[t]&&this._handleGroupOperation(e[t]),e[i]&&this._handleGroupProfileChange(e[i]),e[s]&&this._handleFollowUserChange(e[s])}_processChangeMapFriend(e){(e[u.FRIEND_APPLICATION]||[]).forEach((e=>{var t,i,s,n,r,o,a,l,c,_;const{subChangeType:u,businessId:g,time:E,eventData:I}=e,{FRIEND_APPLY:T,FRIEND_REFUSE:f,FRIEND_USER_INFO:R,FRIENDS_INPUT:A,FRIEND_CLEAR:p,FRIEND_INFO_CHANGE:m,FRIEND_INFO_CHANGE_SYNC:S}=h;switch(u){case T:case f:{const e=u===T?d.UNHANDLED:d.REFUSED;null===(i=(t=this._watcher).friendApplicationStatusChanged)||void 0===i||i.call(t,{userId:g,applicationType:I.applyType,applicationStatus:e,directionType:I.friendType,operationTime:E,extra:I.info||""});break}case R:null===(n=(s=this._watcher).friendAdd)||void 0===n||n.call(s,{userId:g,name:I.name,portraitUri:I.portraitUrl,directionType:I.friendType,operationTime:E});break;case A:null===(o=(r=this._watcher).friendDelete)||void 0===o||o.call(r,{userIds:I.targetId,directionType:I.type,operationTime:E});break;case p:null===(l=(a=this._watcher).friendCleared)||void 0===l||l.call(a,E);break;case m:break;case S:null===(_=(c=this._watcher).friendInfoChangedSync)||void 0===_||_.call(c,{userId:g,remark:I.remarkname,extProfile:I.extProfile,operationTime:E})}}))}_handleGroupOperation(e){e.forEach((e=>{var t,i;const{subChangeType:s,businessId:n,time:r,eventData:o}=e,{optUserInfo:a,channelInfo:l,userInfos:c}=o;let _={groupId:n,operation:s,operationTime:r};a&&(_.operatorInfo=qt(a)),s===R.CREATE&&([_.groupInfo]=((e=[])=>e.map((e=>{var t,i,s,n,r,o,a,l,c;const _=Wt(e.settingProfile)||{},d=e.extProfile||[],{targetId:u,baseInfo:h,userInfo:g}=e;return{groupId:u,groupName:null!==(t=_.name)&&void 0!==t?t:"",portraitUri:null!==(i=_.portraitUrl)&&void 0!==i?i:"",introduction:null!==(s=_.introduction)&&void 0!==s?s:"",notice:null!==(n=_.announcement)&&void 0!==n?n:"",extProfile:Wt(d),joinPermission:~~_.joinPerm,removeMemberPermission:~~_.removePerm,invitePermission:~~_.memInvitePerm,inviteHandlePermission:~~_.invitePerm,groupInfoEditPermission:~~_.profilePerm,memberInfoEditPermission:~~_.memProfilePerm,creatorId:null!==(r=null==h?void 0:h.creatorId)&&void 0!==r?r:"",ownerId:null!==(o=null==h?void 0:h.ownerId)&&void 0!==o?o:"",createTime:(null==h?void 0:h.createTime)||0,membersCount:null!==(a=null==h?void 0:h.memberCount)&&void 0!==a?a:0,remark:null!==(l=null==g?void 0:g.remarkName)&&void 0!==l?l:"",joinedTime:(null==g?void 0:g.joinTime)||0,role:null!==(c=null==g?void 0:g.role)&&void 0!==c?c:f.UNDEF}})))([l])),[R.CREATE,R.DISMISS].includes(s)||(_.memberInfos=c.map(qt)),null===(i=(t=this._watcher).groupOperation)||void 0===i||i.call(t,_)}))}_handleGroupProfileChange(e){e.forEach((e=>{var t,i,s,n,r,o;const{businessId:a,time:l,eventData:c,subChangeType:_,secondaryId:d}=e;switch(_){case A.GROUP_INFO_CHANGE:{const e=c.optUserInfo?qt(c.optUserInfo):void 0,[s]=Ht([c.channelInfo]),[n]=c.channelFullInfo?Ht([c.channelFullInfo]):[void 0],r={operatorInfo:e,groupInfo:s,changedGroupInfo:s,operationTime:l,fullGroupInfo:n};null===(i=(t=this._watcher).groupInfoChanged)||void 0===i||i.call(t,r);break}case A.MEMBER_PROFILE_CHANGE:{const e={groupId:a,operatorInfo:c.optUserInfo?qt(c.optUserInfo):void 0,memberInfo:qt(c.userInfos[0]),operationTime:l};null===(n=(s=this._watcher).groupMemberInfoChanged)||void 0===n||n.call(s,e);break}case A.GROUP_REMARK_DELETE:case A.GROUP_REMARK_SET:{const e=_===A.GROUP_REMARK_SET?p.ADD:p.REMOVE;null===(o=(r=this._watcher).groupRemarkChangedSync)||void 0===o||o.call(r,{groupId:a,operationType:e,operationTime:l,groupRemark:d});break}}}))}_handleFollowUserChange(e){e.forEach((e=>{var t,i;const{subChangeType:s,businessId:n,time:r,userGroupIds:o}=e,a=1===s?p.ADD:p.REMOVE;null===(i=(t=this._watcher).groupFollowsChangedSync)||void 0===i||i.call(t,{groupId:n,operationType:a,operationTime:r,userIds:o})}))}_handleUltraChannelChange(e,t){const i=[],s=[],n=[];t.forEach((e=>{const{subChangeType:t,targetId:r,msgTime:o,operatorId:a,busChannelType:l,time:c}=e,_=e.busChannel||"",d={conversationType:w.ULTRA_GROUP,targetId:r,channelId:_},u=this._chat.storage.getModel(d);switch(t){case $.PRIVATE_TO_PUBLIC:null==u||u.updateAttrs({channelType:X.PUBLIC}),i.push({targetId:r,channelId:_,changeType:z.PRIVATE_TO_PUBLIC,channelType:X.PUBLIC});break;case $.PUBLIC_TO_PRIVATE:null==u||u.updateAttrs({channelType:X.PRIVATE}),i.push({targetId:r,channelId:_,changeType:z.PUBLIC_TO_PRIVATE,channelType:X.PRIVATE});break;case $.PUBLIC_TO_PRIVATE_USER_NOT_IN:u&&this._chat.storage.removeConversation(u),i.push({targetId:r,channelId:_,changeType:z.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:l});break;case $.CHANNEL_DELETE:u&&this._chat.storage.removeConversation(u),s.push({targetId:r,channelId:_,channelType:l,deleteTime:c});break;case $.CHANNEL_USER_KICKED:n.push({targetId:r,channelId:_,userId:a,channelType:X.PRIVATE}),a===this.currentUserId&&u&&this._chat.storage.removeConversation(u);case $.PRIVATE_CHANNEL_USER_JOIN_PUBLIC:}})),i.length>0&&this._watcher.ultraGroupChannelChangeType(i),s.length>0&&this._watcher.ultraGroupChannelDelete(s),n.length>0&&this._watcher.ultraGroupChannelUserKicked(n)}_handleUserGroupStatus(e,i){return t(this,void 0,void 0,(function*(){const e=[],t=[],s=[],n=[],r=[];i.forEach((i=>{const{type:o,targetId:a,busChannelType:l,busChannel:c}=i,_=i.userGroupIds;switch(i.subChangeType){case ee.REMOVE_USER_GROUP:e.push({conversation:{conversationType:o,targetId:a},userGroupIds:_});break;case ee.JOIN_USER_GROUP:t.push({conversation:{conversationType:o,targetId:a},userGroupIds:_});break;case ee.EXIT_USER_GROUP:s.push({conversation:{conversationType:o,targetId:a},userGroupIds:_});break;case ee.CHANNEL_BIND_USER_GROUP:n.push({conversation:{conversationType:o,targetId:a,channelId:c},channelType:l,userGroupIds:_});break;case ee.CHANNEL_UNBIND_USER_GROUP:r.push({conversation:{conversationType:o,targetId:a,channelId:c},channelType:l,userGroupIds:_})}}));const o={};e.length>0&&(o.userGroupDisband=e),t.length>0&&(o.userAdded=t),s.length>0&&(o.userRemoved=s),n.length>0&&(o.userGroupBindChannel=n),r.length>0&&(o.userGroupUnBindChannel=r),this._watcher.userGroupStatus(o)}))}_updateUltraGroupWhenRecallMsg(e,t){const i=this._chat.storage.getModel(e);if(!i)return;const s={},{messageUId:n,sentTime:r}=e.content,{latestMessage:o}=i;o&&o.messageUId===n&&(s.latestMessage=U_(e,!0)),r&&i.lastReadTime<r&&i.unreadCount&&(s.unreadCount=i.unreadCount-1,t!==te.ALL&&t!==te.ME||!i.unreadMentionedCount||(s.unreadMentionedCount=i.unreadMentionedCount-1),t===te.ME&&i.unreadMentionedCount&&(s.unreadMentionedMeCount=i.unreadMentionedMeCount-1));const a=i.updateAttrs(s,e.sentTime);this._chat.storage.updateConversationStorage([i]),a&&this._watcher.conversation([{conversation:i.toIReceivedConversation(),updatedItems:a}])}subscribeUser(e,i,s){return t(this,void 0,void 0,(function*(){return this._subscribeManager.updateSubscribeRelation(e,i,ae.SUBSCRIBE,s)}))}unSubscribeUser(e,i){return t(this,void 0,void 0,(function*(){return yield this._subscribeManager.updateSubscribeRelation(e,i,ae.UNSUBSCRIBE)}))}getSubscribeUserList(e,i,s){var n;return t(this,void 0,void 0,(function*(){const t=null===(n=this._subscribeManager)||void 0===n?void 0:n.getSubscribeUserList(e,i,s);return gi(t)}))}getSubscribeUserStatus(e,i){var s;return t(this,void 0,void 0,(function*(){const t=null===(s=this._subscribeManager)||void 0===s?void 0:s.getSubscribeUserStatus(e,i);return gi(t||[])}))}updateMyUserProfile(e){var s;return t(this,void 0,void 0,(function*(){const t=Uc.encode(el,i(this,KT,"m",nf).call(this,e)),n=yield this._ctx.query($s.updUserProfile,this.currentUserId,t,void 0);if(!n.data)return n.wipe();const r=Uc.decode(tl,n.data.pbData);if(n.isOk){const{version:t}=r;return null===(s=this._subscribeManager)||void 0===s||s.updateOwnProfile(e,t),n.wipe()}const o=r.censorFailedFields;return Ei(n.code,"",o&&0!==o.length?{errorKeys:o,errorKey:o[0]}:void 0)}))}getMyUserProfile(){return this._subscribeManager.getOwnProfile()}getUserProfiles(e){return t(this,void 0,void 0,(function*(){return this._subscribeManager.getUserProfiles(e)}))}rtcSignaling(e,i,s,n){return t(this,void 0,void 0,(function*(){if(!s){return(yield this._ctx.send(new Or(i,n,e))).wipe()}return(yield this._ctx.query(i,e,n,void 0)).trans((e=>e.pbData))}))}rtcPing(e,i,s){return t(this,void 0,void 0,(function*(){const t=Qc(i,s),n=yield this.rtcSignaling(e,$s[$s.rtcPing],!0,t);if(!n.isOk)return n.wipe();const r=Uc.decode(ic,n.data);return gi(r)}))}get deviceId(){return this._ctx.appStorage.deviceId}setPushConfig(e){this._ctx.appStorage.setCustomDeviceId(e.deviceId),this._ctx.appStorage.setPackageName(e.packageName)}destroy(){t(void 0,void 0,void 0,(function*(){if(!F_)return;W_&&(clearTimeout(W_),W_=null);const e=yield F_;if(e){const{db:t}=e;K_.push(t)}F_=null}))}setNetwork(e,t){this._ctx.handleNetworkChange(e,t)}setCallInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=Uc.encode(Va,{key:i,dataContent:s}),n=yield this._ctx.query($s.reqCall,e,t,Va);return n.isOk?n.trans((e=>({key:e.key,value:e.dataContent}))):n.wipe()}))}setNotificationQuietHoursWithSetting(e){return t(this,void 0,void 0,(function*(){const t=Uc.encode(bl,e);return(yield this._ctx.query($s.addUnpush,this.currentUserId,t)).wipe()}))}removeNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){const e=Uc.encode(Ll,{nothing:0});return(yield this._ctx.query($s.delUnpush,this.currentUserId,e)).wipe()}))}getNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){const e=Uc.encode(Ul,{nothing:0});return(yield this._ctx.query($s.qryUnpush,this.currentUserId,e,Pl)).trans((({isUnpush:e,spanMinutes:t,startTime:i,level:s,timezone:n})=>e?{spanMinutes:t,startTime:i,level:s,timezone:n}:{spanMinutes:0,startTime:"",level:ye.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT}))}))}getStatsUrlList(){return t(this,void 0,void 0,(function*(){return gi(Hi.getStatsUrlList(this.naviInfo))}))}translateWithParams(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=0===n?e[0].identifier:this.currentUserId,r=this.userSettings.storage.get("value").transLan,o=[],a=[];let l;if(e.forEach((e=>{const{sourceLanguage:t,content:i}=e,s=e.targetLanguage||r;t!==s?i?o.push({messageUID:e.identifier,sourceLan:e.sourceLanguage,targetLan:e.targetLanguage||r,text:e.content,inputSource:n,transType:1}):a.push({identifier:e.identifier,from:n,code:D.TRANSLATION_TEXT_INVALID,translateInfo:{targetLanguage:s,translatedText:"",status:Cs.NONE}}):a.push({identifier:e.identifier,from:n,code:D.TRANSLATION_LANGUAGE_SAME,translateInfo:{targetLanguage:s,translatedText:"",status:Cs.NONE}})})),0===o.length)l=gi();else{const e=Uc.encode(wl,{businessType:3,businessInfo:Uc.encode(xl,{forceTrans:s,transInfos:o,model:i})});l=(yield this._ctx.query($s.upConvertMsg,t,e,Vl)).wipe()}return a.length>0&&setTimeout((()=>this._watcher.translateResponse(a)),0),l}))}getSubscribeUsersOnlineStatus(e){return t(this,void 0,void 0,(function*(){if(!this._subscribeManager)return gi([]);const t=[],s=new Set;this._subscribeManager.getSubscribeUserStatus(oe.ONLINE_STATUS,e).forEach((e=>{const{userId:i,details:n=[]}=e,r=n.map((e=>({platform:e.platform,isOnline:!!e.eventValue,updateTime:e.changeTime}))),o=r.some((e=>e.isOnline)),a={userId:i,isOnline:o,details:r};t.push(a),s.add(i)}));const n=e.filter((e=>!s.has(e)));if(0===n.length)return gi(t);const r=yield i(this,KT,"m",rf).call(this,oe.FRIEND_ONLINE_STATUS,n);return r.isOk?(r.data.list.forEach((e=>{const{subUserId:i,data:s}=e,n=s.map((e=>({platform:e.platformInfo,isOnline:!!e.value,updateTime:e.versionTime}))),r=n.some((e=>e.isOnline));var o;t.push((o={userId:i,isOnline:r,details:n},[re.iOS,re.Android,re.Web,re.PC,re.Mini,re.HarmonyOS].forEach((e=>{o.details.some((t=>t.platform===e))||o.details.push({platform:e,isOnline:!1,updateTime:0})})),o))})),gi(t)):r.wipe()}))}getAllRobots(){return t(this,void 0,void 0,(function*(){return this._ctx.getAllRobots(!1)}))}getMessagesByUIds(e,i){return t(this,void 0,void 0,(function*(){const{targetId:t,conversationType:s,channelId:n}=e,r=Uc.encode(Ua,{targetId:t,type:s,query:i.map((e=>({msgTime:0,msgUID:e,busChannel:n})))}),o=yield this._ctx.query($s.qryMsg,this._ctx.currentUserId,r,Pa);if(!o.isOk)return o.wipe();const{list:a,notExistMsgId:l}=o.data,c=this.currentUserId,_=i.map((e=>{const i=a.findIndex((t=>t.msgId===e));if(-1!==i){const e=a.splice(i,1)[0];return{message:y_(e,c,!1,t),messageUId:e.msgId,code:D.SUCCESS}}return l.includes(e)?{messageUId:e,code:D.RC_DB_DATA_NOT_FOUND}:{messageUId:e,code:D.SERVER_DATA_ERROR}}));return gi(_)}))}}var df;KT=new WeakSet,QT=function(e,t,i,s,n){this._watcher.robotsSynced(t,s)},XT=function(e,t){this._watcher.readReceiptResponseV5(t)},zT=function(e,t){this._watcher.speechToTextResponse(t)},ZT=function(e,t){this._watcher.messagesModified(t)},$T=function(e){this._watcher.messageModifiedSyncCompleted()},ef=function(e,t){this._watcher.ultraGroupMessageExpansionUpdated(t)},tf=function(e,t){this._watcher.ultraGroupMessageRecalled(t)},sf=function(e,t,i){t!==LE?t!==PE?this._handleEventChangeList(this._codec.formatEventChangeList(i)):this._handleConvertEvent(i):i.forEach((e=>{Uc.decode(Ml,new Uint8Array(e.eventData)).statusInfo.forEach((e=>{var t,i;const s=Jt(e);null===(i=(t=this._watcher).groupApplicationEvent)||void 0===i||i.call(t,s)}))}))},nf=function(e){const t={},{extraProfile:i}=e;return i&&(delete e.extraProfile,t.userExtProfile=Vg(i)),t.userProfile=Vg(e),t},rf=function(e,i){return t(this,void 0,void 0,(function*(){const t=Uc.encode($a,{subType:e,subUsers:i.map((e=>({subUserId:e})))});return yield this._ctx.query($s.qrySubData,this.currentUserId,t,za)}))};class uf{constructor(e){df.set(this,void 0),s(this,df,e,"f")}get isSpeechToTextEnabled(){return!!(1&(i(this,df,"f").AIBusinessSub||0))}get isConversationListIncludeUltraGroup(){return jI(i(this,df,"f"))}get messageModifiableMinutes(){return i(this,df,"f").msgModifyMinute||0}get readReceiptVersion(){return e=(e=i(this,df,"f").grpRRVer)||0,Object.values(Ue).includes(e)?e:Ue.UNKNOWN;var e}get isServerSaveUnreadEnabled(){return 1===i(this,df,"f").serverSaveUnread}get messageSizeLimit(){return i(this,df,"f").msgMaxLengthV2||0}}df=new WeakMap;class hf{constructor(e){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.ctx=e,this.logger=e.logger}get validateConnected(){return()=>this.checkAuthed(!1)}get validateLogin(){return()=>this.checkAuthed(!0)}checkAuthed(e){return this.ctx.connectionStatus===ce.CONNECTED||this.ctx.userId&&e?gi(this.ctx.naviInfo):Ei(D.RC_NET_UNAVAILABLE)}}class gf extends hf{constructor(e,t){super(e),Object.defineProperty(this,"svr",{enumerable:!0,configurable:!0,writable:!0,value:t})}joinChatroom(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:i,extra:n,createIfNotExist:s}),t);const o=yield Ii.create("joinChatroom").validate("chatroomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isNumber("count",i,!0).fail(D.INVALID_PARAMETER_COUNT).isString("extra",n).fail(D.INVALID_PARAMETER_EXTRA).result().tryTrans(this.validateConnected).next((()=>{const t=Math.max(Math.min(i,50),-1)||10;return this.svr.joinChatroom(e,t,s,n)}));return this.logger.summary(r.A_JOIN_CHATROOM_R,o,t),o}))}quitChatroom(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_QUIT_CHATROOM_T,JSON.stringify({roomId:e}),t);const s=yield Ii.create("quitChatroom").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isString("extra",i).fail(D.INVALID_PARAMETER_EXTRA).result().tryTrans(this.validateConnected).next((()=>this.svr.quitChatroom(e,i)));return this.logger.summary(r.A_QUIT_CHATROOM_R,s,t),s}))}getChatroomInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CHATROOM_INFO_T,JSON.stringify({roomId:e,count:i,order:s}),t);const n=yield Ii.create("getChatroomInfo").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isLimitedInteger("count",i,0,20).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("order",s,0,2).fail(D.INVALID_PARAMETER_ORDER).result().tryTrans(this.validateConnected).next((()=>this.svr.getChatroomInfo(e,i||0,s||1)));return this.logger.summary(r.A_GET_CHATROOM_INFO_R,n,t),n}))}setChatroomEntry(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_CHATROOM_ENTRY_T,JSON.stringify({roomId:e,entry:i,isForce:s}),t);const n=yield Ii.create("setChatroomEntry").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("key",null==i?void 0:i.key,$t,!0).fail(D.INVALID_PARAMETER_KEY).validate("value",null==i?void 0:i.value,ei,!0).fail(D.INVALID_PARAMETER_VALUE).isLimitedString("notificationExtra",null==i?void 0:i.notificationExtra,0,2048).fail(D.INVALID_PARAMETER_NOTIFICATION_EXTRA).isBoolean("isAutoDelete",null==i?void 0:i.isAutoDelete).fail(D.INVALID_PARAMETER_IS_AUTO_DELETE).isBoolean("isSendNotification",null==i?void 0:i.isSendNotification).fail(D.INVALID_PARAMETER_IS_SEND_NOTIFICATION).result().tryTrans(this.validateConnected).next((()=>this.svr.setChatroomEntry(e,i,s)));return this.logger.summary(r.A_SET_CHATROOM_ENTRY_R,n,t),n}))}setChatroomEntries(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_CHATROOM_ENTRIES_T,JSON.stringify({roomId:e,entryOptions:i}),t);const s=yield Ii.create("setChatroomEntries").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isTypedArray("entries",null==i?void 0:i.entries,(e=>$t(null==e?void 0:e.key)&&ei(null==e?void 0:e.value)),!0).fail(D.INVALID_PARAMETER_ENTRIES).isLimitedArray("entryOptions.entries",null==i?void 0:i.entries,10,!0).fail(D.CHATROOM_KV_STORE_OUT_LIMIT).isBoolean("entryOptions.isForce",null==i?void 0:i.isForce).fail(D.INVALID_PARAMETER_IS_FORCE).isBoolean("entryOptions.isAutoDelete",null==i?void 0:i.isAutoDelete).fail(D.INVALID_PARAMETER_IS_AUTO_DELETE).result().tryTrans(this.validateConnected).next((()=>this.svr.setChatroomEntries(e,i)));return this.logger.summary(r.A_SET_CHATROOM_ENTRIES_R,s,t),s}))}removeChatroomEntry(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_CHATROOM_ENTRY_T,JSON.stringify({roomId:e,entry:i,isForce:s}),t);const n=yield Ii.create("removeChatroomEntry").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("entry.key",null==i?void 0:i.key,$t,!0).fail(D.INVALID_PARAMETER_KEY).isBoolean("entry.isSendNotification",null==i?void 0:i.isSendNotification).fail(D.INVALID_PARAMETER_IS_SEND_NOTIFICATION).isLimitedString("entry.notificationExtra",null==i?void 0:i.notificationExtra,0,2048).fail(D.INVALID_PARAMETER_NOTIFICATION_EXTRA).result().tryTrans(this.validateConnected).next((()=>this.svr.removeChatroomEntry(e,i,s)));return this.logger.summary(r.A_REMOVE_CHATROOM_ENTRY_R,n,t),n}))}removeChatroomEntries(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_CHATROOM_ENTRIES_T,JSON.stringify({roomId:e,entryOptions:i}),t);const s=yield Ii.create("removeChatroomEntries").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isLimitedTypedArray("keys",null==i?void 0:i.keys,10,$t,!0).fail(D.INVALID_PARAMETER_KEYS).isLimitedString("notificationExtra",null==i?void 0:i.notificationExtra,0,2048).fail(D.INVALID_PARAMETER_NOTIFICATION_EXTRA).result().tryTrans(this.validateConnected).next((()=>this.svr.removeChatroomEntries(e,i)));return this.logger.summary(r.A_REMOVE_CHATROOM_ENTRIES_R,s,t),s}))}getChatroomEntry(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CHATROOM_ENTRY_T,JSON.stringify({roomId:e,key:i}),t);const s=yield Ii.create("getChatroomEntry").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("key",i,$t,!0).fail(D.INVALID_PARAMETER_KEY).result().tryTrans(this.validateConnected).next((()=>this.svr.getChatroomEntry(e,i)));return this.logger.summary(r.A_GET_CHATROOM_ENTRY_R,s,t),s}))}getAllChatroomEntries(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CHATROOM_ENTRIES_T,JSON.stringify({roomId:e}),t);const i=yield Ii.create("getAllChatroomEntries").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).result().tryTrans(this.validateConnected).next((()=>this.svr.getAllChatroomEntries(e)));return this.logger.summary(r.A_GET_CHATROOM_ENTRIES_R,i,t),i}))}getChatroomHistoryMessages(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CHATROOM_HISTORY_MESSAGES_T,JSON.stringify({roomId:e,count:i,order:s,timestamp:n}),t);const o=yield Ii.create("getChatroomHistoryMessages").validate("roomId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isLimitedInteger("count",i,1,100).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("order",s,0,1).fail(D.INVALID_PARAMETER_ORDER).isTimestamp("timestamp",n).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((()=>this.svr.getChatroomHistoryMessages(e,n||0,i||20,s||0)));return this.logger.summary(r.A_GET_CHATROOM_HISTORY_MESSAGES_R,o,t,void 0,(({list:e})=>({size:e.length}))),o}))}setCheckChatRoomDuplicateMessage(e){return this.svr.setCheckChatRoomDuplicateMessage(e)}bindRTCRoomForChatroom(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BIND_RTC_FOR_CHATROOM_T,JSON.stringify({option:e}),t);const i=yield Ii.create("bindRTCRoomForChatroom").validate("chatRoomId",null==e?void 0:e.chatRoomId,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("rtcRoomId",null==e?void 0:e.rtcRoomId,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).result().tryTrans(this.validateConnected).next((()=>this.svr.bindRTCRoomForChatroom(e)));return this.logger.summary(r.A_BIND_RTC_FOR_CHATROOM_R,i,t),i}))}}const Ef=e=>{const{groupId:t,groupName:i,portraitUri:s,introduction:n,notice:r,extProfile:o,joinPermission:a,removeMemberPermission:l,invitePermission:c,inviteHandlePermission:_,groupInfoEditPermission:d,memberInfoEditPermission:u}=e;return JSON.parse(JSON.stringify({name:i,portraitUrl:s,introduction:n,announcement:r,joinPerm:a,removePerm:l,memInvitePerm:c,invitePerm:_,profilePerm:d,memProfilePerm:u}))},If=e=>{var t,i,s;return{removeMuteStatus:!(null!==(t=null==e?void 0:e.removeMuteStatus)&&void 0!==t&&!t),removeWhiteList:!(null!==(i=null==e?void 0:e.removeWhiteList)&&void 0!==i&&!i),removeFollow:!(null!==(s=null==e?void 0:e.removeFollow)&&void 0!==s&&!s)}},Tf=(e,t,i)=>e.validate("groupId",null==t?void 0:t.groupId,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedString("groupName",null==t?void 0:t.groupName,1,64,i).fail(D.INVALID_PARAMETER_GROUP_NAME).isString("portraitUri",null==t?void 0:t.portraitUri).isString("introduction",null==t?void 0:t.introduction).isString("notice",null==t?void 0:t.notice).validate("extProfile",null==t?void 0:t.extProfile,(e=>{if(!St(e))return!1;const t=Object.entries(e);return t.length<=10&&t.every((([e,t])=>Et(t)))})).isNumberEnum("joinPermission",null==t?void 0:t.joinPermission,g).isNumberEnum("removeMemberPermission",null==t?void 0:t.removeMemberPermission,E).isNumberEnum("invitePermission",null==t?void 0:t.invitePermission,E).isNumberEnum("inviteHandlePermission",null==t?void 0:t.inviteHandlePermission,T).isNumberEnum("groupInfoEditPermission",null==t?void 0:t.groupInfoEditPermission,E).isNumberEnum("memberInfoEditPermission",null==t?void 0:t.memberInfoEditPermission,I).fail(D.INVALID_PARAMETER_GROUP_INFO),ff=(e,t,i,s,n)=>e.isObject("option",s,n).fail(D.INVALID_PARAMETER_PAGING_QUERY_OPTION).isLimitedInteger("count",null==s?void 0:s.count,1,t,i).fail(D.INVALID_PARAMETER_COUNT).isString("pageToken",null==s?void 0:s.pageToken).fail(D.INVALID_PARAMETER_PAGING_QUERY_OPTION).isBoolean("order",null==s?void 0:s.order).fail(D.INVALID_PARAMETER_ORDER);class Rf extends hf{constructor(e,t){super(e),Object.defineProperty(this,"svr",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_userProfileEnabled",{enumerable:!0,configurable:!0,writable:!0,value:()=>{var e;return 1===(null===(e=this.ctx.naviInfo)||void 0===e?void 0:e.userProfile)?gi():Ei(D.RC_USER_PROFILE_SERVICE_UNAVAILABLE)}})}updateMyUserProfileVisibility(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UPDATE_MY_USER_PROFILE_VISIBILITY_T,e,t);const i=yield Ii.create("updateMyUserProfileVisibility").isNumberEnum("visibility",e,le,!0).fail(D.INVALID_PARAMETER_USER_PROFILE_VISIBILITY).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.updateMyUserProfileVisibility(e)));return this.logger.summary(r.A_UPDATE_MY_USER_PROFILE_VISIBILITY_R,i,t),i}))}getMyUserProfileVisibility(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_MY_USER_PROFILE_VISIBILITY_T,"",e);const t=yield this.validateConnected().tryTrans(this._userProfileEnabled).next((()=>this.svr.getMyUserProfileVisibility()));return this.logger.summary(r.A_GET_MY_USER_PROFILE_VISIBILITY_R,t,e),t}))}searchUserProfileByUniqueId(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEARCH_USER_PROFILE_BY_UNIQUE_ID_T,e,t);const i=yield Ii.create("searchUserProfileByUniqueId").isNotEmptyString("uniqueId",e,!0).fail(D.INVALID_PARAMETER_UNIQUE_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.searchUserProfileByUniqueId(e)));return this.logger.summary(r.A_SEARCH_USER_PROFILE_BY_UNIQUE_ID_R,i,t),i}))}addFriend(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_FRIEND_T,JSON.stringify({userId:e,directionType:i,extra:s}),t);const n=yield Ii.create("addFriend").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isNumberEnum("directionType",i,o,!0).fail(D.INVALID_PARAMETER_DIRECTION_TYPE).isLimitedString("extra",s,0,128).fail(D.INVALID_PARAMETER_EXTRA).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.addFriend(e,i,s||"")));return this.svr.addFriend(e,i,s||""),this.logger.summary(r.A_ADD_FRIEND_R,n,t),n}))}deleteFriends(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DELETE_FRIENDS_T,JSON.stringify({userIds:e,directionType:i}),t);const s=yield Ii.create("deleteFriends").isLimitedTypedArray("userIds",e,100,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).isNumberEnum("directionType",i,o,!0).fail(D.INVALID_PARAMETER_DIRECTION_TYPE).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.deleteFriends(e,i)));return this.logger.summary(r.A_DELETE_FRIENDS_R,s,t),s}))}acceptFriendRequest(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ACCEPT_FRIEND_REQUEST_T,e,t);const i=yield Ii.create("acceptFriendRequest").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.acceptFriendRequest(e)));return this.logger.summary(r.A_ACCEPT_FRIEND_REQUEST_R,i,t),i}))}refuseFriendRequest(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REFUSE_FRIEND_REQUEST_T,JSON.stringify({userId:e,reason:i}),t);const s=yield Ii.create("refuseFriendApplication").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isString("reason",i).fail(D.INVALID_PARAMETER_REASON).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.refuseFriendRequest(e,i)));return this.logger.summary(r.A_REFUSE_FRIEND_REQUEST_R,s,t),s}))}setFriendInfo(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_FRIEND_INFO_T,JSON.stringify({userId:e,remark:i,extProfile:s}),t);const n=yield Ii.create("setFriendInfo").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isLimitedString("remark",i,0,64,!0).fail(D.INVALID_PARAMETER_REMARK).validate("extProfile",s,(e=>{if("object"!=typeof s)return!1;const t=Object.entries(s);return!(t.length>10||t.some((([e,t])=>!Et(t))))})).fail(D.INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setFriendInfo(e,i,s||{})));return this.logger.summary(r.A_SET_FRIEND_INFO_R,n,t),n}))}checkFriends(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CHECK_FRIENDS_T,JSON.stringify({userIds:e,directionType:i}),t);const s=yield Ii.create("checkFriends").isLimitedTypedArray("userIds",e,20,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).isNumberEnum("directionType",i,o,!0).fail(D.INVALID_PARAMETER_DIRECTION_TYPE).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.checkFriends(e,i)));return this.logger.summary(r.A_CHECK_FRIENDS_R,s,t,void 0,(e=>({size:e.length}))),s}))}getFriends(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_FRIENDS_T,JSON.stringify({directionType:e,option:i}),t);const s=yield Ii.create("getFriends").isNumberEnum("directionType",e,a,!0).fail(D.INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE).check((e=>ff(e,100,!1,i))).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t={count:(null==i?void 0:i.count)||50,pageToken:(null==i?void 0:i.pageToken)||"",order:!!(null==i?void 0:i.order)};return this.svr.getFriends(e,t)}));return this.logger.summary(r.A_GET_FRIENDS_R,s,t,void 0,(({data:e})=>({size:e.length}))),s}))}getFriendApplications(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_FRIEND_APPLICATIONS_T,JSON.stringify({option:e,types:i,status:s}),t);const n=yield Ii.create("getFriendApplications").check((t=>ff(t,100,!1,e))).check((e=>{e.isTypedArray("types",i,(t=>!e.isNumberEnum("type",t,_,!0).isFailed)).fail(D.INVALID_PARAMETER_FRIEND_APPLICATION_TYPE).isTypedArray("status",s,(t=>!e.isNumberEnum("status",t,d,!0).isFailed)).fail(D.INVALID_PARAMETER_FRIEND_APPLICATION_STATUS)})).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t={count:(null==e?void 0:e.count)||50,pageToken:(null==e?void 0:e.pageToken)||"",order:!!(null==e?void 0:e.order)},n=i&&0!==i.length?i:[1,2],r=s&&0!==s.length?s:[0,1,2,3];return this.svr.getFriendApplications(t,n,r)}));return this.logger.summary(r.A_GET_FRIEND_APPLICATIONS_R,n,t,void 0,(({data:e})=>({size:e.length}))),n}))}getFriendsInfo(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_FRIENDS_INFO_T,JSON.stringify({userIds:e}),t);const i=yield Ii.create("getFriendsInfo").isLimitedTypedArray("userIds",e,100,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getFriendsInfo(e)));return this.logger.summary(r.A_GET_FRIENDS_INFO_R,i,t,void 0,(e=>({size:e.length}))),i}))}searchFriendsInfo(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEARCH_FRIENDS_INFO_T,JSON.stringify({nickname:e}),t);const i=yield Ii.create("searchFriendsInfo").isLimitedString("nickname",e,1,64,!0).fail(D.INVALID_PARAMETER_NICK_NAME).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.searchFriendsInfo(e)));return this.logger.summary(r.A_SEARCH_FRIENDS_INFO_R,i,t,void 0,(e=>({size:e.length}))),i}))}setFriendAddPermission(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_FRIEND_ADD_PERMISSION_T,JSON.stringify({permission:e}),t);const i=yield Ii.create("setFriendAddPermission").isNumberEnum("permission",e,l,!0).fail(D.INVALID_PARAMETER_FRIEND_ADD_PERMISSION).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setFriendAddPermission(e)));return this.logger.summary(r.A_SET_FRIEND_ADD_PERMISSION_R,i,t),i}))}getFriendAddPermission(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_FRIEND_ADD_PERMISSION_T,JSON.stringify({}),e);const t=yield Ii.create("getFriendAddPermission").result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getFriendAddPermission()));return this.logger.summary(r.A_GET_FRIEND_ADD_PERMISSION_R,t,e),t}))}createGroup(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CREATE_GROUP_T,JSON.stringify({groupInfo:e,inviteeUserIds:i}),t);const s=yield Ii.create("createGroup").check((t=>Tf(t,e,!0))).isLimitedTypedArray("inviteeUserIds",i,30,Ut,!1,0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t=Ef(e);return this.svr.createGroup(e.groupId,t,e.extProfile||{},i||[])}));return this.logger.summary(r.A_CREATE_GROUP_R,s,t),s}))}updateGroupInfo(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UPDATE_GROUP_INFO_T,JSON.stringify({groupInfo:e}),t);const i=yield Ii.create("updateGroupInfo").check((t=>Tf(t,e,!1))).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t=Ef(e);return this.svr.updateGroupInfo(e.groupId,t,e.extProfile)}));return this.logger.summary(r.A_UPDATE_GROUP_INFO_R,i,t),i}))}getGroupsInfo(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_GROUPS_INFO_T,JSON.stringify({groupIds:e}),t);const i=yield Ii.create("getGroupsInfo").isLimitedTypedArray("groupIds",e,20,Pt,!0,1).fail(D.INVALID_PARAMETER_GROUP_IDS).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getGroupsInfo(e)));return this.logger.summary(r.A_GET_GROUPS_INFO_R,i,t,void 0,(e=>({size:e.length}))),i}))}kickGroupMembers(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_KICK_GROUP_MEMBERS_T,JSON.stringify({groupId:e,userIds:i,config:s}),t);const n=yield Ii.create("kickGroupMembers").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,100,Ut,!0,1).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.kickGroupMembers(e,i,If(s))));return this.logger.summary(r.A_KICK_GROUP_MEMBERS_R,n,t),n}))}quitGroup(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_QUIT_GROUP_T,JSON.stringify({groupId:e,config:i}),t);const s=yield Ii.create("quitGroup").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.quitGroup(e,If(i))));return this.logger.summary(r.A_QUIT_GROUP_R,s,t),s}))}dismissGroup(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DISMISS_GROUP_T,JSON.stringify({groupId:e}),t);const i=yield Ii.create("dismissGroup").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.dismissGroup(e)));return this.logger.summary(r.A_DISMISS_GROUP_R,i,t),i}))}transferGroupOwner(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_TRANSFER_GROUP_OWNER_T,JSON.stringify({groupId:e,newOwnerId:i,quit:s,config:n}),t);const o=yield Ii.create("transferGroupOwner").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("newOwnerId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.transferGroupOwner(e,i,!!s,If(n))));return this.logger.summary(r.A_TRANSFER_GROUP_OWNER_R,o,t),o}))}addGroupManagers(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_GROUP_MANAGERS_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("addGroupManagers").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,10,Ut,!0,1).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupManagers(p.ADD,e,i)));return this.logger.summary(r.A_ADD_GROUP_MANAGERS_R,s,t),s}))}removeGroupManagers(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_GROUP_MANAGERS_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("removeGroupManagers").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,10,Ut,!0,1).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupManagers(p.REMOVE,e,i)));return this.logger.summary(r.A_REMOVE_GROUP_MANAGERS_R,s,t),s}))}getGroupMembers(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_GROUP_MEMBERS_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("getGroupMembers").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,100,Ut,!0,1).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getGroupMembers(e,i)));return this.logger.summary(r.A_GET_GROUP_MEMBERS_R,s,t,void 0,(e=>({size:e.length}))),s}))}setGroupMemberInfo(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_GROUP_MEMBER_INFO_T,JSON.stringify({groupId:e,userId:i,nickname:s,extra:n}),t);const o=yield Ii.create("setGroupMemberInfo").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("userId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isLimitedString("nickname",s,0,64,!0).fail(D.INVALID_PARAMETER_NICK_NAME).isLimitedString("extra",n,0,128).fail(D.INVALID_PARAMETER_EXTRA).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupMemberInfo(e,i,s,n)));return this.logger.summary(r.A_SET_GROUP_MEMBER_INFO_R,o,t),o}))}searchGroupMembers(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEARCH_GROUP_MEMBERS_T,JSON.stringify({groupId:e,nickName:i,option:s}),t);const n=yield Ii.create("searchGroupMembers").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedString("nickName",i,1,64,!0).fail(D.INVALID_PARAMETER_NICK_NAME).check((e=>ff(e,200,!0,s,!0))).result().tryTrans(this.validateLogin).tryTrans(this._userProfileEnabled).next((()=>{const t={count:s.count,pageToken:s.pageToken||"",order:!!s.order};return this.svr.searchGroupMembers(e,i,t)}));return this.logger.summary(r.A_SEARCH_GROUP_MEMBERS_R,n,t,void 0,(({data:e})=>({size:e.length}))),n}))}getGroupMembersByRole(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_GROUP_MEMBERS_BY_ROLE_T,JSON.stringify({groupId:e,role:i,option:s}),t);const n=yield Ii.create("getGroupMembersByRole").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isNumberEnum("role",i,f,!0).fail(D.INVALID_PARAMETER_GROUP_MEMBER_ROLE).isLimitedInteger("count",s.count,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).isString("pageToken",s.pageToken).fail(D.INVALID_PARAMETER_PAGING_QUERY_OPTION).isNumberEnum("filterRobotType",s.filterRobotType,Ce).fail(D.INVALID_PARAMETER_PAGING_QUERY_OPTION).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t={count:s.count,pageToken:s.pageToken||"",order:!!s.order,filterRobotType:s.filterRobotType||Ce.ALL};return this.svr.getGroupMembersByRole(e,i,t)}));return this.logger.summary(r.A_GET_GROUP_MEMBERS_BY_ROLE_R,n,t,void 0,(({data:e})=>({size:e.length}))),n}))}addGroupFollows(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_GROUP_FOLLOWS_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("addGroupFollows").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,100,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupFollows(p.ADD,e,i)));return this.logger.summary(r.A_ADD_GROUP_FOLLOWS_R,s,t),s}))}removeGroupFollows(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_GROUP_FOLLOWS_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("removeGroupFollows").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,100,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupFollows(p.REMOVE,e,i)));return this.logger.summary(r.A_REMOVE_GROUP_FOLLOWS_R,s,t),s}))}getGroupFollows(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_GROUP_FOLLOWS_T,JSON.stringify({groupId:e}),t);const i=yield Ii.create("getGroupFollows").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getGroupFollows(e)));return this.logger.summary(r.A_GET_GROUP_FOLLOWS_R,i,t,void 0,(e=>({size:e.length}))),i}))}setGroupRemark(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_GROUP_REMARK_T,JSON.stringify({groupId:e,remark:i}),t);const s=yield Ii.create("setGroupRemark").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedString("remark",i,0,64,!0).fail(D.INVALID_PARAMETER_REMARK).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.setGroupRemark(e,i)));return this.logger.summary(r.A_SET_GROUP_REMARK_R,s,t),s}))}joinGroup(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_JOIN_GROUP_T,JSON.stringify({groupId:e}),t);const i=yield Ii.create("joinGroup").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.joinGroup(e)));return this.logger.summary(r.A_JOIN_GROUP_R,i,t),i}))}inviteUsersToGroup(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_INVITE_USERS_TO_GROUP_T,JSON.stringify({groupId:e,userIds:i}),t);const s=yield Ii.create("inviteUsersToGroup").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).isLimitedTypedArray("userIds",i,30,Ut,!0,1).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.inviteUsersToGroup(e,i)));return this.logger.summary(r.A_INVITE_USERS_TO_GROUP_R,s,t),s}))}acceptGroupInvite(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ACCEPT_GROUP_INVITE_T,JSON.stringify({groupId:e,inviterId:i}),t);const s=yield Ii.create("acceptGroupInvite").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("inviterId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.memberInviteResponse({groupId:e,inviterId:i,optType:v.APPLICANT,optResult:S.ACCEPT})));return this.logger.summary(r.A_ACCEPT_GROUP_INVITE_R,s,t),s.wipe()}))}refuseGroupInvite(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REFUSE_GROUP_INVITE_T,JSON.stringify({groupId:e,inviterId:i,reason:s}),t);const n=yield Ii.create("refuseGroupInvite").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("inviterId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isLimitedString("reason",s,0,128).fail(D.INVALID_PARAMETER_REASON).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.memberInviteResponse({groupId:e,inviterId:i,optType:v.APPLICANT,optResult:S.REFUSE,reason:s})));return this.logger.summary(r.A_REFUSE_GROUP_INVITE_R,n,t),n.wipe()}))}acceptGroupApplication(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ACCEPT_GROUP_APPLICATION_T,JSON.stringify({groupId:e,joinUserId:i,inviterId:s}),t);const n=yield Ii.create("acceptGroupApplication").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("joinUserId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).validate("inviterId",s,Ut).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.memberInviteResponse({groupId:e,joinUserId:i,inviterId:s||"",optType:v.MANAGER,optResult:S.ACCEPT})));return this.logger.summary(r.A_ACCEPT_GROUP_APPLICATION_R,n,t),n.wipe()}))}refuseGroupApplication(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REFUSE_GROUP_APPLICATION_T,JSON.stringify({groupId:e,joinUserId:i,inviterId:s,reason:n}),t);const o=yield Ii.create("refuseGroupApplication").validate("groupId",e,Pt,!0).fail(D.INVALID_PARAMETER_GROUP_ID).validate("joinUserId",i,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).validate("inviterId",s,Ut).fail(D.INVALID_PARAMETER_USER_ID).isLimitedString("reason",n,0,128).fail(D.INVALID_PARAMETER_REASON).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.memberInviteResponse({groupId:e,joinUserId:i,inviterId:s||"",optType:v.MANAGER,optResult:S.REFUSE,reason:n})));return this.logger.summary(r.A_REFUSE_GROUP_APPLICATION_R,o,t),o.wipe()}))}getGroupApplications(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_GROUP_APPLICATIONS_T,JSON.stringify({option:e,directions:i,status:s}),t);const{usingCppEngine:n}=this.ctx,o=yield Ii.create("getGroupApplications").check((t=>ff(t,200,!0,e,!0))).check((e=>{n&&e.isLimitedTypedArray("directions",i,Object.keys(y).length,(t=>!e.isNumberEnum("directions",t,y,!0).isFailed),!0,1).fail(D.INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION).isLimitedTypedArray("status",s,Object.keys(m).length,(t=>!e.isNumberEnum("status",t,m,!0).isFailed),!0,1).fail(D.INVALID_PARAMETER_GROUP_APPLICATION_STATUS)})).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t={count:e.count,pageToken:e.pageToken||"",order:!!e.order};return this.svr.getGroupApplications(t,i||[],s||[])}));return this.logger.summary(r.A_GET_GROUP_APPLICATIONS_R,o,t,void 0,(({data:e})=>({size:e.length}))),o}))}getJoinedGroupsByRole(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_JOINED_GROUPS_BY_ROLES_T,JSON.stringify({role:e,option:i}),t);const s=yield Ii.create("getJoinedGroupsByRole").isNumberEnum("role",e,f,!0).fail(D.INVALID_PARAMETER_GROUP_MEMBER_ROLE).check((e=>ff(e,100,!0,i,!0))).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>{const t={count:i.count,pageToken:i.pageToken||"",order:!!i.order};return this.svr.getJoinedGroupsByRole(e,t)}));return this.logger.summary(r.A_GET_JOINED_GROUPS_BY_ROLES_R,s,t,void 0,(({data:e})=>({size:e.length}))),s}))}searchJoinedGroups(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEARCH_JOINED_GROUPS_T,JSON.stringify({groupName:e,option:i}),t);const s=yield Ii.create("searchJoinedGroups").isLimitedString("groupName",e,1,64,!0).fail(D.INVALID_PARAMETER_GROUP_NAME).check((e=>ff(e,200,!0,i,!0))).result().tryTrans(this.validateLogin).tryTrans(this._userProfileEnabled).next((()=>{const t={count:i.count,pageToken:i.pageToken||"",order:!!i.order};return this.svr.searchJoinedGroups(e,t)}));return this.logger.summary(r.A_SEARCH_JOINED_GROUPS_R,s,t,void 0,(({data:e})=>({size:e.length}))),s}))}getJoinedGroups(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_JOINED_GROUPS_T,JSON.stringify({groupIds:e}),t);const i=yield Ii.create("getJoinedGroups").isLimitedTypedArray("groupIds",e,20,Pt,!0,1).fail(D.INVALID_PARAMETER_GROUP_IDS).result().tryTrans(this.validateConnected).tryTrans(this._userProfileEnabled).next((()=>this.svr.getJoinedGroups(e)));return this.logger.summary(r.A_GET_JOINED_GROUPS_R,i,t,void 0,(e=>({size:e.length}))),i}))}}var Af,pf,mf,Sf;let vf=0;class Nf extends hf{constructor(e,t,i){super(i),Object.defineProperty(this,"_svr",{enumerable:!0,configurable:!0,writable:!0,value:t}),Af.set(this,void 0),pf.set(this,!1),mf.set(this,!0),Sf.set(this,""),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:++vf}),s(this,Af,Object.assign(Object.assign({},e),{tagFilter:Object.assign({},e.tagFilter)}),"f")}get hasMore(){return i(this,mf,"f")}get isLoading(){return i(this,pf,"f")}load(e){return t(this,void 0,void 0,(function*(){if(i(this,pf,"f"))return Ei(D.METHOD_BUSY);s(this,pf,!0,"f");const t=this.logger.createTraceId();this.logger.info(r.A_LOAD_CONVERSATION_LIST_T,JSON.stringify({count:e,loaderId:this._id,pageToken:i(this,Sf,"f")}),t);const n=yield Ii.create("ConversationListLoader.load").isLimitedInteger("count",e,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).next((()=>this._svr.loadConversationList(i(this,Sf,"f"),e,i(this,Af,"f"))));if(this.logger.summary(r.A_LOAD_CONVERSATION_LIST_R,n,t,{loaderId:this._id},(({pageToken:e,finished:t,list:i})=>({pageToken:e,finished:t,size:i.length}))),s(this,pf,!1,"f"),!n.isOk)return n.wipe();const{pageToken:o,finished:a,list:l}=n.data;return s(this,Sf,o,"f"),s(this,mf,!a,"f"),gi(l)}))}}var Of,yf,Cf,Mf,bf,Lf,Uf,Pf;Af=new WeakMap,pf=new WeakMap,mf=new WeakMap,Sf=new WeakMap;class Df extends hf{constructor(e,t){super(e),Of.add(this),Object.defineProperty(this,"svr",{enumerable:!0,configurable:!0,writable:!0,value:t})}saveEditedMessageDraft(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SAVE_EDITED_MSG_DRAFT_T,JSON.stringify({draft:e,identifier:s}),t);const n=yield Ii.create("saveEditedMessageDraft").check((e=>f_(e,s,B))).isString("draft",null==e?void 0:e.content,!0).fail(D.INVALID_PARAMETER_DRAFT).isNotEmptyString("messageUId",null==e?void 0:e.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().tryTrans(this.validateLogin).next((()=>this.svr.saveEditedMessageDraft(e,i(this,Of,"m",Cf).call(this,s))));return this.logger.summary(r.A_SAVE_EDITED_MSG_DRAFT_R,n,t),n}))}getEditedMessageDraft(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_EDITED_MSG_DRAFT_T,JSON.stringify({identifier:e}),t);const s=yield Ii.create("getEditedMessageDraft").check((t=>f_(t,e,B))).result().next((()=>this.svr.getEditedMessageDraft(i(this,Of,"m",Cf).call(this,e))));return this.logger.summary(r.A_GET_EDITED_MSG_DRAFT_R,s,t),s}))}clearEditedMessageDraft(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CLEAR_EDITED_MSG_DRAFT_T,JSON.stringify({identifier:e}),t);const s=yield Ii.create("clearEditedMessageDraft").check((t=>f_(t,e,B))).result().next((()=>this.svr.clearEditedMessageDraft(i(this,Of,"m",Cf).call(this,e))));return this.logger.summary(r.A_CLEAR_EDITED_MSG_DRAFT_R,s,t),s}))}createConversationListLoader(e){return t(this,void 0,void 0,(function*(){const{conversationTypes:t,order:i,channelId:s,tagFilter:n}=e||{};return yield Ii.create("createConversationListLoader").isTypedArray("conversationTypes",t,(e=>W(e,G))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).isLimitedInteger("order",i,0,1).fail(D.INVALID_PARAMETER_ORDER).validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).check((e=>{if(!n)return;const{tagIds:t}=n;e.isLimitedTypedArray("tagIds",t,20,pt,!1,0).fail(D.INVALID_PARAMETER_TAG_ID)})).result().tryTrans(this.validateConnected).trans((()=>new Nf(Object.assign(Object.assign({},e),{tagFilter:Object.assign({},n)}),this.svr,this.ctx)))}))}sendUltraGroupTypingStatus(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),s=null==e?void 0:e.conversationType;this.logger.info(r.A_SEND_UG_TYPING_T,JSON.stringify(e),t);const n=yield Ii.create("sendUltraGroupTypingStatus").check((t=>f_(t,e,F))).validate("conversationType",s,(()=>s===w.ULTRA_GROUP),!0).fail(D.CONVERSATION_TYPE_NOT_SUPPORT).result().tryTrans(this.validateConnected).next((()=>this.svr.sendUltraGroupTypingStatus(i(this,Of,"m",Cf).call(this,e))));return this.logger.summary(r.A_SEND_UG_TYPING_R,n,t),n}))}sendTypingStatus(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEND_TYPING_STATUS_T,JSON.stringify({identifier:e,typingContentType:i}),t);const s=yield Ii.create("sendTypingStatus").check((t=>f_(t,e,G))).isString("typingContentType",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).result().tryTrans(this.validateConnected).next((()=>{const s={messageType:"RC:TypSts",content:{typingContentType:i}};return this.ctx.sendMessage(e,s,t)}));return this.logger.summary(r.A_SEND_TYPING_STATUS_R,s,t),s}))}sendSyncReadStatusMessage(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_SYNC_READ_STATUS_T,JSON.stringify({identifier:e,timestamp:i}),s);const n=yield Ii.create("sendSyncReadStatusMessage").check((t=>f_(t,e,G))).isNumber("timestamp",i,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((n=>t(this,void 0,void 0,(function*(){if(n.serverSaveUnread)return Ei(D.SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN);if(1===n.sesDriven)return this.svr.updateConversationReadTime(e,i);const t={messageType:Q.SYNC_READ_STATUS,content:{lastMessageSendTime:i},directionalUserIdList:oi(e.conversationType,[this.ctx.userId])};return(yield this.ctx.sendMessage(e,t,s)).wipe()}))));return this.logger.summary(r.A_SYNC_READ_STATUS_R,n,s),n}))}clearUnreadCount(e){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_CLEAR_UNREAD_COUNT_T,JSON.stringify(e),s);const n=yield Ii.create("clearUnreadCount").check((t=>f_(t,e,F))).result().tryTrans((()=>this.checkAuthed(e.conversationType!==w.ULTRA_GROUP))).tryTrans((e=>e.serverSaveUnread?Ei(D.SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN):gi())).next((()=>t(this,void 0,void 0,(function*(){return e.conversationType!==w.ULTRA_GROUP||this.svr.ugSynced?this.svr.clearConversationUnreadCount(i(this,Of,"m",Cf).call(this,e)):Ei(D.METHOD_NOT_AVAILABLE)}))));return this.logger.summary(r.A_CLEAR_UNREAD_COUNT_R,n,s),n}))}clearAllUnreadCount(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_CLEAR_ALL_UNREAD_COUNT_T,null,e);const i=yield Ii.create("clearAllUnreadCount").result().tryTrans(this.validateLogin).tryTrans((e=>e.serverSaveUnread?Ei(D.SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN):gi())).next((()=>t(this,void 0,void 0,(function*(){return this.svr.clearAllSGUnreadCount()}))));return this.logger.summary(r.A_CLEAR_ALL_UNREAD_COUNT_R,i,e),i}))}clearUnreadCountByTimestamp(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CLEAR_UNREAD_COUNT_BY_TIME_T,JSON.stringify({identifier:e,timestamp:i}),t);const s=yield Ii.create("clearUnreadCountByTimestamp").check((t=>f_(t,e,G))).isTimestamp("timestamp",i).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateLogin).tryTrans((e=>e.serverSaveUnread?Ei(D.SERVER_RECORD_UNREAD_COUNT_ENABLED_FORBIDDEN):gi())).next((()=>this.svr.clearUnreadCountByTimestamp(e,i)));return this.logger.summary(r.A_CLEAR_UNREAD_COUNT_BY_TIME_R,s,t),s}))}sendReadReceiptRequest(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEND_READ_RECEIPT_REQ_T,JSON.stringify({identifier:e,messageUId:i}),t);const s=yield Ii.create("sendReadReceiptRequest").check((t=>f_(t,e,H))).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().tryTrans(this.validateConnected).next((()=>{const s={messageType:Q.READ_RECEIPT_REQUEST,content:{messageUId:i}};return this.ctx.sendMessage(e,s,t)}));return this.logger.summary(r.A_SEND_READ_RECEIPT_REQ_R,s,t),s.wipe()}))}sendReadReceiptMessage(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEND_READ_RECEIPT_T,JSON.stringify({identifier:e,messageUId:i,timestamp:s}),t);const n=yield Ii.create("sendReadReceiptMessage").check((t=>f_(t,e,j))).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("timestamp",s,1,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((()=>{const n={messageType:Q.READ_RECEIPT,content:{messageUId:i,lastMessageSendTime:s,type:1}};return this.ctx.sendMessage(e,n,t)}));return this.logger.summary(r.A_SEND_READ_RECEIPT_R,n,t),n.wipe()}))}sendReadReceipt(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_SEND_READ_RECEIPT_T,JSON.stringify({identifier:e,messageList:i}),s);const n=yield Ii.create("sendReadReceipt").check((t=>f_(t,e,H))).fail(D.INVALID_PARAMETER_TARGET_ID).check((e=>{St(i)&&!Object.keys(i).some((t=>{const s=i[t];return e.isLimitedTypedArray("messageList",s,Number.MAX_SAFE_INTEGER,pt,!0).isFailed}))||e.setFailed(D.MSG_LIMIT_ERROR)})).result().tryTrans(this.validateConnected).next((n=>t(this,void 0,void 0,(function*(){const t=n.grpRRVer||0;if(0!==t&&1!==t)return Ei(D.READ_RECEIPT_ERROR);if(1===t){const t=[];return Object.keys(i).forEach((e=>{t.push(...i[e])})),this.svr.sendReadReceiptV2(e.targetId,t,e.channelId)}const r={receiptMessageDic:i};return(yield this.ctx.sendMessage(e,{messageType:Q.READ_RECEIPT_RESPONSE,content:r},s)).wipe()}))));return this.logger.summary(r.A_SEND_READ_RECEIPT_R,n,s),n}))}getMessageReader(e,i,s){return t(this,void 0,void 0,(function*(){const n=this.logger.createTraceId();this.logger.info(r.A_GET_MSG_READER_T,JSON.stringify({targetId:e,messageUId:i,channelId:s}),n);const o=yield Ii.create("getMessageReader").validate("targetId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateConnected).next((n=>t(this,void 0,void 0,(function*(){return 1!==n.grpRRVer?Ei(D.READ_RECEIPT_ERROR):this.svr.getMessageReader(e,i,s||"")}))));return this.logger.summary(r.A_GET_MSG_READER_R,o,n,void 0,(({list:e})=>({size:e.length}))),o}))}sendReadReceiptMessageV4(e,i,s){return t(this,void 0,void 0,(function*(){const n=this.logger.createTraceId();this.logger.info(r.A_SEND_READ_RECEIPT_V4_T,JSON.stringify({conversation:e,endMsgUid:i,startMsgUid:s}),n);const o=yield Ii.create("sendReadReceiptMessageV4").check((t=>f_(t,e,G))).isNotEmptyString("endMsgUid",i,!0).fail(D.INVALID_PARAMETER_END_MESSAGE_UID).isNotEmptyString("startMsgUid",s).fail(D.INVALID_PARAMETER_START_MESSAGE_UID).result().tryTrans(this.validateConnected).next((n=>t(this,void 0,void 0,(function*(){return 3!==n.grpRRVer?Ei(D.READ_RECEIPT_V4_NOT_SUPPORT):this.svr.sendReadReceiptMessageV4(e,s||"",i)}))));return this.logger.summary(r.A_SEND_READ_RECEIPT_V4_R,o,n),o}))}getMessageReadReceiptV4(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_GET_READ_RECEIPT_V4_T,JSON.stringify({conversation:e,messageUId:i}),s);const n=yield Ii.create("getMessageReadReceiptV4").check((t=>f_(t,e,H))).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().tryTrans(this.validateConnected).next((s=>t(this,void 0,void 0,(function*(){return 3!==s.grpRRVer?Ei(D.READ_RECEIPT_V4_NOT_SUPPORT):this.svr.getMessageReadReceiptV4(e,i)}))));return this.logger.summary(r.A_GET_READ_RECEIPT_V4_R,n,s,void 0,(({list:e})=>({size:e.length}))),n}))}batchGetMessageReadReceiptInfoV4(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_BATCH_GET_READ_RECEIPT_INFO_V4_T,JSON.stringify({conversation:e,messageUIds:i}),s);const n=yield Ii.create("batchGetMessageReadReceiptInfoV4").check((t=>f_(t,e,H))).isTypedArray("messageUIds",i,pt,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().tryTrans(this.validateConnected).next((s=>t(this,void 0,void 0,(function*(){return 3!==s.grpRRVer?Ei(D.READ_RECEIPT_V4_NOT_SUPPORT):this.svr.batchGetMessageReadReceiptInfoV4(e,i)}))));return this.logger.summary(r.A_BATCH_GET_READ_RECEIPT_INFO_V4_R,n,s,void 0,(e=>({size:e.length}))),n}))}getConversationsIncludingRobots(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CONVERSATIONS_INCLUDING_ROBOTS_T,JSON.stringify({options:e}),t);const i=yield Ii.create("getConversationsIncludingRobots").isLimitedTypedArray("conversationTypes",null==e?void 0:e.conversationTypes,2,(e=>[w.PRIVATE,w.SYSTEM].includes(e)),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).isLimitedInteger("count",null==e?void 0:e.count,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).isTimestamp("timestamp",null==e?void 0:e.timestamp,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((()=>{const t=Object.assign(Object.assign({},e),{topPriority:!!e.topPriority});return this.svr.getConversationsIncludingRobots(t)}));return this.logger.summary(r.A_GET_CONVERSATIONS_INCLUDING_ROBOTS_R,i,t,void 0,(e=>({size:e.length}))),i}))}markRemoteConversationAsRead(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_MARK_REMOTE_CONVERSATION_AS_READ_T,JSON.stringify(e),t);const s=yield Ii.create("markRemoteConversationAsRead").check((t=>f_(t,e,k))).result().tryTrans(this.validateConnected).tryTrans((e=>e.serverSaveUnread?gi():Ei(D.SERVER_RECORD_UNREAD_COUNT_DISABLED))).next((()=>{if(e.conversationType===w.ULTRA_GROUP)return this.svr.clearConversationUnreadCount(i(this,Of,"m",Cf).call(this,e));const s={lastMessageSendTime:this.ctx.serverTime},n={messageType:Q.SYNC_READ_STATUS,content:s,directionalUserIdList:oi(e.conversationType,[this.ctx.userId])};return this.svr.markRemoteConversationAsRead(e,n,t)}));return this.logger.summary(r.A_MARK_REMOTE_CONVERSATION_AS_READ_R,s,t),s.wipe()}))}addMessageReaction(s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_MSG_REACTION_T,JSON.stringify(s),t);const n=yield Ii.create("addMessageReaction").check((e=>f_(e,null==s?void 0:s.conversationIdentifier,B))).isNotEmptyString("messageUId",null==s?void 0:s.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedString("reactionId",null==s?void 0:s.reactionId,1,16,!0).fail(D.REACTION_ID_INVALID).isObject("pushConfig",null==s?void 0:s.pushConfig).fail(D.INVALID_PARAMETER_PUSH_CONFIG).result().tryTrans(this.validateConnected).next((()=>{const{conversationIdentifier:t}=s,n=e(s,["conversationIdentifier"]);return this.svr.addMessageReaction(Object.assign(Object.assign({},n),{conversationIdentifier:i(this,Of,"m",Cf).call(this,t)}))}));return this.logger.summary(r.A_ADD_MSG_REACTION_R,n,t),n}))}removeMessageReaction(s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_MSG_REACTION_T,JSON.stringify(s),t);const n=yield Ii.create("removeMessageReaction").check((e=>f_(e,null==s?void 0:s.conversationIdentifier,B))).isNotEmptyString("messageUId",null==s?void 0:s.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedString("reactionId",null==s?void 0:s.reactionId,1,16,!0).fail(D.REACTION_ID_INVALID).isObject("pushConfig",null==s?void 0:s.pushConfig).fail(D.INVALID_PARAMETER_PUSH_CONFIG).result().tryTrans(this.validateConnected).next((()=>{const{conversationIdentifier:t}=s,n=e(s,["conversationIdentifier"]);return this.svr.removeMessageReaction(Object.assign(Object.assign({},n),{conversationIdentifier:i(this,Of,"m",Cf).call(this,t)}))}));return this.logger.summary(r.A_REMOVE_MSG_REACTION_R,n,t),n}))}batchGetMessageReactionSummaries(s){var n;return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_GET_MSG_REACTION_SUMMARIES_T,JSON.stringify(s),t);const o=yield Ii.create("batchGetMessageReactionSummaries").check((e=>f_(e,null==s?void 0:s.conversationIdentifier,B))).isTypedArray("messageUIds",null==s?void 0:s.messageUIds,(e=>pt(e)),!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("messageUIds",null===(n=null==s?void 0:s.messageUIds)||void 0===n?void 0:n.length,1,100,!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateConnected).next((()=>{const{conversationIdentifier:t}=s,n=e(s,["conversationIdentifier"]);return this.svr.batchGetMessageReactionSummaries(Object.assign({conversationIdentifier:i(this,Of,"m",Cf).call(this,t)},n))}));return this.logger.summary(r.A_BATCH_GET_MSG_REACTION_SUMMARIES_R,o,t),o}))}getMessageReactions(s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_MSG_REACTIONS_T,JSON.stringify(s),t);const n=yield Ii.create("getMessageReactions").check((e=>f_(e,null==s?void 0:s.conversationIdentifier,B))).isNotEmptyString("messageUId",null==s?void 0:s.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("count",null==s?void 0:s.count,1,50,!0).fail(D.INVALID_PARAMETER_COUNT).isString("pageToken",null==s?void 0:s.pageToken).fail(D.INVALID_PARAMETER_PAGE_TOKEN).result().tryTrans(this.validateConnected).next((()=>{const{conversationIdentifier:t}=s,n=e(s,["conversationIdentifier"]);return this.svr.getMessageReactions(Object.assign({conversationIdentifier:i(this,Of,"m",Cf).call(this,t)},n))}));return this.logger.summary(r.A_GET_MSG_REACTIONS_R,n,t,void 0,(({reactions:e})=>({size:e.length}))),n}))}getMessageReactionUsers(s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_MSG_REACTION_USERS_T,JSON.stringify(s),t);const n=yield Ii.create("getMessageReactionUsers").check((e=>f_(e,null==s?void 0:s.conversationIdentifier,B))).isNotEmptyString("messageUId",null==s?void 0:s.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedString("reactionId",null==s?void 0:s.reactionId,1,16,!0).fail(D.REACTION_ID_INVALID).isLimitedInteger("count",null==s?void 0:s.count,1,50,!0).fail(D.INVALID_PARAMETER_COUNT).isString("pageToken",null==s?void 0:s.pageToken).fail(D.INVALID_PARAMETER_PAGE_TOKEN).result().tryTrans(this.validateConnected).next((()=>{const{conversationIdentifier:t}=s,n=e(s,["conversationIdentifier"]);return this.svr.getMessageReactionUsers(Object.assign({conversationIdentifier:i(this,Of,"m",Cf).call(this,t)},n))}));return this.logger.summary(r.A_GET_MSG_REACTION_USERS_R,n,t,void 0,(({users:e})=>({size:e.length}))),n}))}}Of=new WeakSet,yf=function(e){var t;return!!(2&((null===(t=this.ctx.naviInfo)||void 0===t?void 0:t.ugDriven)||0))&&!e?"RCDefault":e},Cf=function(e){return e.conversationType!==w.ULTRA_GROUP?e:Object.assign(Object.assign({},e),{channelId:i(this,Of,"m",yf).call(this,e.channelId)})};class wf extends Wi{constructor(e,i,s,n){const r=os();r.setLogReader(((e,i,s,n)=>t(this,void 0,void 0,(function*(){return{logs:[]}})))),r.setLogWriter((e=>{n(e)})),super(e,i,s,r)}getTimestamp4RealtimeLog(){return 0}setTimestamp4RealtimeLog(e){}}let Gf=0,Vf=Date.now();const kf=e=>{const t=Date.now();return Vf!==t&&(Vf=t,Gf=0),[e,window.__RCCppContextBridge__.process.pid,t,Gf++].join("__")},xf=()=>t(void 0,void 0,void 0,(function*(){return Ei(D.NOT_SUPPORT,"Not support")}));class Ff{constructor(e,t){var i;Mf.add(this),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_cache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),bf.set(this,void 0),Lf.set(this,void 0),Uf.set(this,!1),Object.defineProperty(this,"_resolveMaps",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"loadConversationList",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"batchGetMessageReadReceiptInfoV4",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"getRealtimeConversations",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"getRealtimeConTotalUnreadCount",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"clearRealtimeConUnreadCount",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"removeRealtimeConversations",{enumerable:!0,configurable:!0,writable:!0,value:xf}),Object.defineProperty(this,"batchGetRealtimeConUnreadCount",{enumerable:!0,configurable:!0,writable:!0,value:xf});const n=t,o=e=>this._send2Main("onReceiveRendererLog",e),a=s(this,Lf,new wf(n.appkey,"IMLib","IM",o),"f");s(this,bf,o,"f"),a.setOutputLevel(n.logOutputLevel);const{ipcRenderer:l}=window.__RCCppContextBridge__;l.on("__RC_CHANNEL_NOTIFICATION_FROM_MAIN__",((t,i,...n)=>{const o=e[i];if(o){switch(i){case"ultraGroupEnable":s(this,Uf,!0,"f");break;case"onNaviDataChange":this._cache.naviInfo=n[0];break;case"onRTCDataChange":n[0]=new Uint8Array(n[0]);break;case"onConnected":s(this,Uf,!1,"f"),this._cache=n[1];break;case"onSuspend":s(this,Uf,!1,"f"),this._setConnectionStatus(ce.SUSPENDED);break;case"onDisconnected":s(this,Uf,!1,"f"),this._setConnectionStatus(ce.DISCONNECTED);break;case"onConnecting":this._setConnectionStatus(ce.CONNECTING)}o(...n)}else this.logger.error(r.L_UNSUPPORT_NTF_FROM_MAIN_E,i)})),l.on("__RC_CHANNEL_RESULT_FROM_MAIN__",((e,t,...i)=>{const s=this._resolveMaps[t];s&&(delete this._resolveMaps[t],s(...i))})),n.httpInMainProcess&&(Eo.httpReq=this.sendHTTPRequest.bind(this));const c={navigators:n.navigators,areaCode:n.areaCode,logServerUrl:n.logServerUrl,environment:n.environment,enableReadReceiptStorage:n.enableReadReceiptStorage,useNaviV2:null!==(i=n.useNaviV2)&&void 0!==i&&i,commitId:"62fcd7e06c6290bc087e82c396154c11d48a169a"};if(l.send("__RC_INNER_COMMAND_INIT__",c),this._cache=this._callMainSync("getMainProcessCache"),"62fcd7e06c6290bc087e82c396154c11d48a169a"!==this._cache.commitId)throw new Error("SDK version mismatch.")}get chat(){return this}get chatroom(){return this}get userSettings(){return this}get dataHosting(){return this}get logger(){return i(this,Lf,"f")}get ugSynced(){return i(this,Uf,"f")}_setConnectionStatus(e){this._cache.connectionStatus=e,e===ce.DISCONNECTED&&(this._cache.crtUserId="")}sendHTTPRequest(e){return this._callMain("sendHTTPRequest",e)}_callMain(e,...t){const{ipcRenderer:i}=window.__RCCppContextBridge__;return new Promise((s=>{const n=kf(e);this._resolveMaps[n]=s,i.send("__RC_CHANNEL_CALL_MAIN__",n,e,...t)}))}_send2Main(e,...t){window.__RCCppContextBridge__.ipcRenderer.send("__RC_CHANNEL_SEND_2_MAIN__",e,...t)}_callMainSync(e,...t){return window.__RCCppContextBridge__.ipcRenderer.sendSync("__RC_CHANNEL_CALL_MAIN_SYNC__",e,...t)}refetchNaviInfo(){return i(this,Mf,"m",Pf).call(this,"refetchNaviInfo")}get naviInfo(){return this._cache.naviInfo}createLogger(e,t){return new wf(this.appkey,e,t,i(this,bf,"f"))}get connectionStatus(){return this._cache.connectionStatus}get usingCppEngine(){return!0}connect(e,s,n,r){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"connect",e,s,n,r)}))}reportSDKInfo(e){this._send2Main("reportSDKInfo",e)}get connectedTime(){return this._cache.connectedTime}getHistoryMessage(e,t,s){return i(this,Mf,"m",Pf).call(this,"getHistoryMessage",e,t,s)}getContinuousMessages(e,t){return i(this,Mf,"m",Pf).call(this,"getContinuousMessages",e,t)}getHistoryMessagesByObjectNames(e,t){return i(this,Mf,"m",Pf).call(this,"getHistoryMessagesByObjectNames",e,t)}deleteRemoteMessage(e,t){return i(this,Mf,"m",Pf).call(this,"deleteRemoteMessage",e,t)}recallMsg(e,t){return i(this,Mf,"m",Pf).call(this,"recallMsg",e,t)}deleteRemoteMessageByTimestamp(e,t){return i(this,Mf,"m",Pf).call(this,"deleteRemoteMessageByTimestamp",e,t)}getTopConversationList(e,t,s){return i(this,Mf,"m",Pf).call(this,"getTopConversationList",e,t,s)}getUnreadConversationList(e,t){return i(this,Mf,"m",Pf).call(this,"getUnreadConversationList",e,t)}getAllConversationList(e,t){return i(this,Mf,"m",Pf).call(this,"getAllConversationList",e,t)}getConversationListByTimestamp(e,t){return i(this,Mf,"m",Pf).call(this,"getConversationListByTimestamp",e,t)}getUntaggedConversationListByPage(e,t,s){return i(this,Mf,"m",Pf).call(this,"getUntaggedConversationListByPage",e,t,s)}getConversation(e){return i(this,Mf,"m",Pf).call(this,"getConversation",e)}batchDeleteConversations(e){return i(this,Mf,"m",Pf).call(this,"batchDeleteConversations",e)}getTotalUnreadCount(e,t,s){return i(this,Mf,"m",Pf).call(this,"getTotalUnreadCount",e,t,s)}getConversationUnreadCount(e){return i(this,Mf,"m",Pf).call(this,"getConversationUnreadCount",e)}getTotalUnreadCountByLevels(e,t,s){return i(this,Mf,"m",Pf).call(this,"getTotalUnreadCountByLevels",e,t,s)}clearConversationUnreadCount(e){return i(this,Mf,"m",Pf).call(this,"clearConversationUnreadCount",e)}markRemoteConversationAsRead(e,t,s){return i(this,Mf,"m",Pf).call(this,"markRemoteConversationAsRead",e,t,s)}getFirstUnreadMessage(e){return i(this,Mf,"m",Pf).call(this,"getFirstUnreadMessage",e)}getFirstUnreadMessageDigest(e){return i(this,Mf,"m",Pf).call(this,"getFirstUnreadMessageDigest",e)}saveTextMessageDraft(e,t){return i(this,Mf,"m",Pf).call(this,"saveTextMessageDraft",e,t)}getTextMessageDraft(e){return i(this,Mf,"m",Pf).call(this,"getTextMessageDraft",e)}clearTextMessageDraft(e){return i(this,Mf,"m",Pf).call(this,"clearTextMessageDraft",e)}batchSetConversationToTop(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"batchSetConversationToTop",e,t,s,n)}batchSetConversationNotificationLevel(e,t){return i(this,Mf,"m",Pf).call(this,"batchSetConversationNotificationLevel",e,t)}batchSetConversationTranslateStrategy(e,t){return i(this,Mf,"m",Pf).call(this,"batchSetConversationTranslateStrategy",e,t)}sendMessage(e,t,s,n){const o=["sendMessageBefore",Date.now(),Math.floor(Math.random()*Date.now())].join("_");return n&&(this._resolveMaps[o]=e=>{try{n(e)}catch(e){this.logger.error(r.L_CALLBACK_E,JSON.stringify({error:null==e?void 0:e.stack,pos:"sendMsgBefore"}))}}),i(this,Mf,"m",Pf).call(this,"sendMessage",e,t,s,o)}sendReadReceiptV2(e,t,s){return i(this,Mf,"m",Pf).call(this,"sendReadReceiptV2",e,t,s)}getMessageReader(e,t,s){return i(this,Mf,"m",Pf).call(this,"getMessageReader",e,t,s)}sendReadReceiptMessageV4(e,t,s){return i(this,Mf,"m",Pf).call(this,"sendReadReceiptMessageV4",e,t,s)}getMessageReadReceiptV4(e,t){return i(this,Mf,"m",Pf).call(this,"getMessageReadReceiptV4",e,t)}updateConversationReadTime(e,t){return i(this,Mf,"m",Pf).call(this,"updateConversationReadTime",e,t)}disconnect(e,s){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"disconnect",e,s)}))}registerMessageType(e,t){this._send2Main("registerMessageType",e,t)}joinChatroom(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"joinChatroom",e,t,s,n)}quitChatroom(e,t){return i(this,Mf,"m",Pf).call(this,"quitChatroom",e,t)}getChatroomInfo(e,t,s){return i(this,Mf,"m",Pf).call(this,"getChatroomInfo",e,t,s)}getChatroomHistoryMessages(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"getChatroomHistoryMessages",e,t,s,n)}setChatroomEntry(e,t,s){return i(this,Mf,"m",Pf).call(this,"setChatroomEntry",e,t,s)}setChatroomEntries(e,t){return i(this,Mf,"m",Pf).call(this,"setChatroomEntries",e,t)}removeChatroomEntry(e,t,s){return i(this,Mf,"m",Pf).call(this,"removeChatroomEntry",e,t,s)}removeChatroomEntries(e,t){return i(this,Mf,"m",Pf).call(this,"removeChatroomEntries",e,t)}getChatroomEntry(e,t){return i(this,Mf,"m",Pf).call(this,"getChatroomEntry",e,t)}getAllChatroomEntries(e){return i(this,Mf,"m",Pf).call(this,"getAllChatroomEntries",e)}getFileToken(e,t,s,n,r,o){return i(this,Mf,"m",Pf).call(this,"getFileToken",e,t,s,n,r,o)}getFileUrl(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"getFileUrl",e,t,s,n)}setUserStatus(e){return i(this,Mf,"m",Pf).call(this,"setUserStatus",e)}getUserStatus(e){return i(this,Mf,"m",Pf).call(this,"getUserStatus",e)}clearConversations(e,t){return i(this,Mf,"m",Pf).call(this,"clearConversations",e,t)}addToBlacklist(e){return i(this,Mf,"m",Pf).call(this,"addToBlacklist",e)}removeFromBlacklist(e){return i(this,Mf,"m",Pf).call(this,"removeFromBlacklist",e)}getBlacklist(){return i(this,Mf,"m",Pf).call(this,"getBlacklist")}getBlacklistStatus(e){return i(this,Mf,"m",Pf).call(this,"getBlacklistStatus",e)}insertMessage(e,t){return i(this,Mf,"m",Pf).call(this,"insertMessage",e,t)}batchInsertMessage(e,t){return i(this,Mf,"m",Pf).call(this,"batchInsertMessage",e,t)}getLocalMessageCount(e){return i(this,Mf,"m",Pf).call(this,"getLocalMessageCount",e)}deleteLocalMessages(e){return i(this,Mf,"m",Pf).call(this,"deleteLocalMessages",e)}deleteLocalMessagesByTimestamp(e,t,s){return i(this,Mf,"m",Pf).call(this,"deleteLocalMessagesByTimestamp",e,t,s)}batchClearLocalMessagesByTimestamp(e){return i(this,Mf,"m",Pf).call(this,"batchClearLocalMessagesByTimestamp",e)}batchClearRemoteHistoryMessages(e,t){return i(this,Mf,"m",Pf).call(this,"batchClearRemoteHistoryMessages",e,t)}clearLocalMessages(e){return i(this,Mf,"m",Pf).call(this,"clearLocalMessages",e)}getMessage(e){return i(this,Mf,"m",Pf).call(this,"getMessage",e)}setMessageContent(e,t,s){return i(this,Mf,"m",Pf).call(this,"setMessageContent",e,t,s)}setMessageSearchField(e,t,s){return i(this,Mf,"m",Pf).call(this,"setMessageSearchField",e,t,s)}searchConversationByContent(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"searchConversationByContent",e,t,s,n)}searchConversationByContentWithAllChannel(e,t,s){return i(this,Mf,"m",Pf).call(this,"searchConversationByContentWithAllChannel",e,t,s)}searchMessagesWithParams(e){return i(this,Mf,"m",Pf).call(this,"searchMessagesWithParams",e)}getUnreadMentionedMessages(e){return i(this,Mf,"m",Pf).call(this,"getUnreadMentionedMessages",e)}getUnreadMentionedCount(e){return i(this,Mf,"m",Pf).call(this,"getUnreadMentionedCount",e)}getMessagesAroundTimestamp(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"getMessagesAroundTimestamp",e,t,s,n)}setMessageSentStatus(e,t){return i(this,Mf,"m",Pf).call(this,"setMessageSentStatus",e,t)}setMessageReceivedStatus(e,t){return i(this,Mf,"m",Pf).call(this,"setMessageReceivedStatus",e,t)}updateMessageReceiptStatus(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"updateMessageReceiptStatus",e,t,s,n)}clearUnreadCountByTimestamp(e,t){return i(this,Mf,"m",Pf).call(this,"clearUnreadCountByTimestamp",e,t)}clearAllSGUnreadCount(){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"clearAllSGUnreadCount")}))}get serverTime(){return Date.now()-this._cache.deltaTime}get deviceId(){return this._cache.deviceId}setPushConfig(e){}get userId(){return this._cache.crtUserId}bindRTCRoomForChatroom(e){return i(this,Mf,"m",Pf).call(this,"bindRTCRoomForChatroom",e)}rtcSignaling(e,s,n,r){return t(this,void 0,void 0,(function*(){const t=Array.prototype.slice.call(new Uint8Array(r));return(yield i(this,Mf,"m",Pf).call(this,"rtcSignaling",e,s,n,t)).trans((e=>new Uint8Array(e)))}))}rtcPing(e,t,s){return i(this,Mf,"m",Pf).call(this,"rtcPing",e,t,s)}createTag(e){return i(this,Mf,"m",Pf).call(this,"createTag",e)}removeTag(e){return i(this,Mf,"m",Pf).call(this,"removeTag",e)}updateTag(e){return i(this,Mf,"m",Pf).call(this,"updateTag",e)}getTagList(){return i(this,Mf,"m",Pf).call(this,"getTagList")}addTagForConversations(e,t){return i(this,Mf,"m",Pf).call(this,"addTagForConversations",e,t)}removeTagForConversations(e,t){return i(this,Mf,"m",Pf).call(this,"removeTagForConversations",e,t)}removeTagsForConversation(e,t){return i(this,Mf,"m",Pf).call(this,"removeTagsForConversation",e,t)}getConversationListByTag(e,t,s){return i(this,Mf,"m",Pf).call(this,"getConversationListByTag",e,t,s)}getUnreadCountByTag(e,t){return i(this,Mf,"m",Pf).call(this,"getUnreadCountByTag",e,t)}setConversationStatusInTag(e,t,s){return i(this,Mf,"m",Pf).call(this,"setConversationStatusInTag",e,t,s)}getTagsForConversation(e){return i(this,Mf,"m",Pf).call(this,"getTagsForConversation",e)}clearLocalData(){return i(this,Mf,"m",Pf).call(this,"clearLocalData")}setCallInfo(e,t,s){return i(this,Mf,"m",Pf).call(this,"setCallInfo",e,t,s)}getAllUnreadMentionedCount(){return i(this,Mf,"m",Pf).call(this,"getAllUnreadMentionedCount")}getUltraGroupList(e){return i(this,Mf,"m",Pf).call(this,"getUltraGroupList",e)}getBlockedUGList(){return i(this,Mf,"m",Pf).call(this,"getBlockedUGList")}getBlockedConversationList(e){return i(this,Mf,"m",Pf).call(this,"getBlockedConversationList",e)}sendUltraMessage(e,t,i,s){return this.sendMessage(e,t,i,s)}getConversationNotificationLevel(e){return i(this,Mf,"m",Pf).call(this,"getConversationNotificationLevel",e)}setConversationTypeNotificationLevel(e,t){return i(this,Mf,"m",Pf).call(this,"setConversationTypeNotificationLevel",e,t)}getConversationTypeNotificationLevel(e){return i(this,Mf,"m",Pf).call(this,"getConversationTypeNotificationLevel",e)}getUGUnreadCountForAllChannels(e,t,s){return i(this,Mf,"m",Pf).call(this,"getUGUnreadCountForAllChannels",e,t,s)}setUGDefaultNotificationLevel(e,t,s){return i(this,Mf,"m",Pf).call(this,"setUGDefaultNotificationLevel",e,t,s)}getUGDefaultNotificationLevel(e,t){return i(this,Mf,"m",Pf).call(this,"getUGDefaultNotificationLevel",e,t)}getUGUnreadInfoList(e){return i(this,Mf,"m",Pf).call(this,"getUGUnreadInfoList",e)}getOSInfo(){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"getOSInfo")}))}getProcessInfo(){return t(this,void 0,void 0,(function*(){const{process:e}=window.__RCCppContextBridge__,t={title:e.title,pid:e.pid,ppid:e.ppid,platform:e.platform,arch:e.arch,uptime:e.uptime(),cpuUsage:e.cpuUsage(),memoryUsage:e.memoryUsage(),resourceUsage:e.resourceUsage()};return gi(t)}))}getMainProcessInfo(){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"getMainProcessInfo")}))}setProxy(e){return i(this,Mf,"m",Pf).call(this,"setProxy",e)}getProxy(){return i(this,Mf,"m",Pf).call(this,"getProxy")}testProxy(e,t){return i(this,Mf,"m",Pf).call(this,"testProxy",e,t)}setCheckDuplicateMessage(e){return i(this,Mf,"m",Pf).call(this,"setCheckDuplicateMessage",e)}setCheckChatRoomDuplicateMessage(e){return i(this,Mf,"m",Pf).call(this,"setCheckChatRoomDuplicateMessage",e)}setNetwork(e,t){this._send2Main("setNetwork",e,t)}subscribeUser(e,t,s){return i(this,Mf,"m",Pf).call(this,"subscribeUser",e,t,s)}unSubscribeUser(e,t){return i(this,Mf,"m",Pf).call(this,"unSubscribeUser",e,t)}getSubscribeUserList(e,t,s){return i(this,Mf,"m",Pf).call(this,"getSubscribeUserList",e,t,s)}getSubscribeUserStatus(e,t){return i(this,Mf,"m",Pf).call(this,"getSubscribeUserStatus",e,t)}getConversations(e){return i(this,Mf,"m",Pf).call(this,"getConversations",e)}updateMyUserProfile(e){return i(this,Mf,"m",Pf).call(this,"updateMyUserProfile",e)}getUserProfiles(e){return i(this,Mf,"m",Pf).call(this,"getUserProfiles",e)}getMyUserProfile(){return i(this,Mf,"m",Pf).call(this,"getMyUserProfile")}updateMyUserProfileVisibility(e){return i(this,Mf,"m",Pf).call(this,"updateMyUserProfileVisibility",e)}getMyUserProfileVisibility(){return i(this,Mf,"m",Pf).call(this,"getMyUserProfileVisibility")}searchUserProfileByUniqueId(e){return i(this,Mf,"m",Pf).call(this,"searchUserProfileByUniqueId",e)}createGroup(e,s,n,r){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"createGroup",e,s,n,r)}))}updateGroupInfo(e,t,s){return i(this,Mf,"m",Pf).call(this,"updateGroupInfo",e,t,s)}getGroupsInfo(e){return i(this,Mf,"m",Pf).call(this,"getGroupsInfo",e)}kickGroupMembers(e,t,s){return i(this,Mf,"m",Pf).call(this,"kickGroupMembers",e,t,s)}quitGroup(e,t){return i(this,Mf,"m",Pf).call(this,"quitGroup",e,t)}dismissGroup(e){return i(this,Mf,"m",Pf).call(this,"dismissGroup",e)}transferGroupOwner(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"transferGroupOwner",e,t,s,n)}setGroupManagers(e,t,s){return i(this,Mf,"m",Pf).call(this,"setGroupManagers",e,t,s)}getGroupMembersByRole(e,t,s){return i(this,Mf,"m",Pf).call(this,"getGroupMembersByRole",e,t,s)}getGroupMembers(e,t){return i(this,Mf,"m",Pf).call(this,"getGroupMembers",e,t)}setGroupMemberInfo(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"setGroupMemberInfo",e,t,s,n)}searchGroupMembers(e,t,s){return i(this,Mf,"m",Pf).call(this,"searchGroupMembers",e,t,s)}joinGroup(e){return i(this,Mf,"m",Pf).call(this,"joinGroup",e)}inviteUsersToGroup(e,t){return i(this,Mf,"m",Pf).call(this,"inviteUsersToGroup",e,t)}memberInviteResponse(e){return i(this,Mf,"m",Pf).call(this,"memberInviteResponse",e)}getGroupApplications(e,t,s){return i(this,Mf,"m",Pf).call(this,"getGroupApplications",e,t,s)}getJoinedGroupsByRole(e,t){return i(this,Mf,"m",Pf).call(this,"getJoinedGroupsByRole",e,t)}searchJoinedGroups(e,t){return i(this,Mf,"m",Pf).call(this,"searchJoinedGroups",e,t)}getJoinedGroups(e){return i(this,Mf,"m",Pf).call(this,"getJoinedGroups",e)}setGroupRemark(e,t){return i(this,Mf,"m",Pf).call(this,"setGroupRemark",e,t)}setGroupFollows(e,t,s){return i(this,Mf,"m",Pf).call(this,"setGroupFollows",e,t,s)}getGroupFollows(e){return i(this,Mf,"m",Pf).call(this,"getGroupFollows",e)}addFriend(e,t,s){return i(this,Mf,"m",Pf).call(this,"addFriend",e,t,s)}deleteFriends(e,t){return i(this,Mf,"m",Pf).call(this,"deleteFriends",e,t)}acceptFriendRequest(e){return i(this,Mf,"m",Pf).call(this,"acceptFriendRequest",e)}refuseFriendRequest(e,t){return i(this,Mf,"m",Pf).call(this,"refuseFriendRequest",e,t)}setFriendInfo(e,t,s){return i(this,Mf,"m",Pf).call(this,"setFriendInfo",e,t,s)}checkFriends(e,t){return i(this,Mf,"m",Pf).call(this,"checkFriends",e,t)}getFriends(e,t){return i(this,Mf,"m",Pf).call(this,"getFriends",e,t)}getFriendApplications(e,t,s){return i(this,Mf,"m",Pf).call(this,"getFriendApplications",e,t,s)}getFriendsInfo(e){return i(this,Mf,"m",Pf).call(this,"getFriendsInfo",e)}searchFriendsInfo(e){return i(this,Mf,"m",Pf).call(this,"searchFriendsInfo",e)}setFriendAddPermission(e){return i(this,Mf,"m",Pf).call(this,"setFriendAddPermission",e)}getFriendAddPermission(){return i(this,Mf,"m",Pf).call(this,"getFriendAddPermission")}setNotificationQuietHoursWithSetting(e){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"setNotificationQuietHoursWithSetting",e)}))}removeNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"removeNotificationQuietHoursSetting")}))}getNotificationQuietHoursSetting(){return t(this,void 0,void 0,(function*(){return i(this,Mf,"m",Pf).call(this,"getNotificationQuietHoursSetting")}))}getStatsUrlList(){return i(this,Mf,"m",Pf).call(this,"getStatsUrlList")}sendReadReceiptResponseV5(e,t){return i(this,Mf,"m",Pf).call(this,"sendReadReceiptResponseV5",e,t)}getMessageReadReceiptInfoV5ByIdentifiers(e){return i(this,Mf,"m",Pf).call(this,"getMessageReadReceiptInfoV5ByIdentifiers",e)}getMessagesReadReceiptUsersByPageV5(e,t,s){return i(this,Mf,"m",Pf).call(this,"getMessagesReadReceiptUsersByPageV5",e,t,s)}getMessagesReadReceiptByUsersV5(e,t,s){return i(this,Mf,"m",Pf).call(this,"getMessagesReadReceiptByUsersV5",e,t,s)}requestSpeechToTextForMessage(e,t){return i(this,Mf,"m",Pf).call(this,"requestSpeechToTextForMessage",e)}setMessageSpeechToTextVisible(e,t){return i(this,Mf,"m",Pf).call(this,"setMessageSpeechToTextVisible",e,t)}translateWithParams(e,t,s,n){return i(this,Mf,"m",Pf).call(this,"translateWithParams",e,t,s,n)}setTranslationLanguage(e){return i(this,Mf,"m",Pf).call(this,"setTranslationLanguage",e)}getTranslationLanguage(){return i(this,Mf,"m",Pf).call(this,"getTranslationLanguage")}setAutoTranslateEnabled(e){return i(this,Mf,"m",Pf).call(this,"setAutoTranslateEnabled",e)}getAutoTranslateEnabled(){return i(this,Mf,"m",Pf).call(this,"getAutoTranslateEnabled")}modifyMessageWithParams(e){return i(this,Mf,"m",Pf).call(this,"modifyMessageWithParams",e)}refreshReferenceMessageWithParams(e,s,n,o){return t(this,void 0,void 0,(function*(){const t=(e,t)=>{const i=[e,Date.now(),Math.floor(Math.random()*Date.now())].join("_");return this._resolveMaps[i]=i=>{try{t(i)}catch(t){this.logger.error(r.L_CALLBACK_E,JSON.stringify({error:null==t?void 0:t.stack,pos:e}))}},i},a=t("localMessageBlock",o),l=t("remoteMessageBlock",n);return i(this,Mf,"m",Pf).call(this,"refreshReferenceMessageWithParams",e,s,l,a)}))}syncRemoteConversations(){return i(this,Mf,"m",Pf).call(this,"syncRemoteConversations")}sendUltraGroupTypingStatus(e){return i(this,Mf,"m",Pf).call(this,"sendUltraGroupTypingStatus",e)}getRemoteMessagesByUIds(e,t){return i(this,Mf,"m",Pf).call(this,"getRemoteMessagesByUIds",e,t)}getUGUnreadMentionedDigest(e){return i(this,Mf,"m",Pf).call(this,"getUGUnreadMentionedDigest",e)}deleteLocalUGMessagesForAllChannel(e,t){return i(this,Mf,"m",Pf).call(this,"deleteLocalUGMessagesForAllChannel",e,t)}updateUGMessageExpansion(e,t,s){return i(this,Mf,"m",Pf).call(this,"updateUGMessageExpansion",e,t,s)}getUGFirstUnreadMessageDigest(e){return i(this,Mf,"m",Pf).call(this,"getUGFirstUnreadMessageDigest",e)}getSubscribeUsersOnlineStatus(e){return i(this,Mf,"m",Pf).call(this,"getSubscribeUsersOnlineStatus",e)}saveEditedMessageDraft(e,t){return i(this,Mf,"m",Pf).call(this,"saveEditedMessageDraft",e,t)}getEditedMessageDraft(e){return i(this,Mf,"m",Pf).call(this,"getEditedMessageDraft",e)}clearEditedMessageDraft(e){return i(this,Mf,"m",Pf).call(this,"clearEditedMessageDraft",e)}getUnreadMentionMeConversationList(e,t){return i(this,Mf,"m",Pf).call(this,"getUnreadMentionMeConversationList",e,t)}getAllRobots(){return i(this,Mf,"m",Pf).call(this,"getAllRobots")}getConversationsIncludingRobots(e){return i(this,Mf,"m",Pf).call(this,"getConversationsIncludingRobots",e)}getMessagesByUIds(e,t){return i(this,Mf,"m",Pf).call(this,"getMessagesByUIds",e,t)}get appkey(){return this._initOptions.appkey}destroy(){}addMessageReaction(e){return i(this,Mf,"m",Pf).call(this,"addMessageReaction",e)}removeMessageReaction(e){return i(this,Mf,"m",Pf).call(this,"removeMessageReaction",e)}batchGetMessageReactionSummaries(e){return i(this,Mf,"m",Pf).call(this,"batchGetMessageReactionSummaries",e)}getMessageReactions(e){return i(this,Mf,"m",Pf).call(this,"getMessageReactions",e)}getMessageReactionUsers(e){return i(this,Mf,"m",Pf).call(this,"getMessageReactionUsers",e)}}var Bf,Hf,jf,Yf,Wf,qf,Jf,Kf,Qf;function Xf(e){return Object.assign({},e)}bf=new WeakMap,Lf=new WeakMap,Uf=new WeakMap,Mf=new WeakSet,Pf=function(e,...t){const{promise:i,resolve:s}=Ri(),n=kf(e);return this._resolveMaps[n]=({code:e,msg:t,data:i})=>{s(hi.from(e,t,i))},window.__RCCppContextBridge__.ipcRenderer.send("__RC_CHANNEL_CALL_MAIN__",n,e,...t),i};class zf{constructor(e){Bf.add(this),Object.defineProperty(this,"_token",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_pluginContextQueue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_pluginInstanseMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_engine",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chatroom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dataHosting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_versionInfo",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_typingInfo",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_compatibleMessageProccessor",{enumerable:!0,configurable:!0,writable:!0,value:{[Q.TYPING_STATUS]:this._processTypingStatusMessage.bind(this),[Q.INTERCEPT]:this._processInterceptMessage.bind(this)}}),Object.defineProperty(this,"_messageProccessor",{enumerable:!0,configurable:!0,writable:!0,value:{[Q.READ_RECEIPT]:this._processReadReceiptMessage.bind(this),[Q.READ_RECEIPT_REQUEST]:this._processReadReceiptRequestMessage.bind(this),[Q.READ_RECEIPT_RESPONSE]:this._processReadReceiptResponseMessage.bind(this)}}),Object.defineProperty(this,"_watcher",{enumerable:!0,configurable:!0,writable:!0,value:{message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connection:void 0,expansion:void 0,tag:void 0,userSettingsSynced:void 0,userSettingsChanged:void 0,conversationStatusSynced:void 0,robotsSynced:void 0,conversationTagChanged:void 0,pullFinished:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0,ultraGroupEnable:void 0,sgRelationsSynced:void 0,operateStatus:void 0,ultraGroupMessageExpansionUpdated:void 0,ultraGroupMessageRecalled:void 0,ultraGroupChannelChangeType:void 0,ultraGroupChannelUserKicked:void 0,ultraGroupChannelDelete:void 0,userGroupStatus:void 0,messageReadReceipt:void 0,syncReadStatus:void 0,subscribedUserStatusChange:void 0,subscribedRelationChange:void 0,syncSubscribedUserStatusFinished:void 0,ownUserProfileChanged:void 0,groupOperation:void 0,groupInfoChanged:void 0,groupMemberInfoChanged:void 0,groupApplicationEvent:void 0,groupRemarkChangedSync:void 0,groupFollowsChangedSync:void 0,friendAdd:void 0,friendDelete:void 0,friendApplicationStatusChanged:void 0,friendCleared:void 0,friendInfoChangedSync:void 0,databaseOpened:void 0,databaseUpgradeWillStart:void 0,databaseUpgrading:void 0,databaseUpgradeDidComplete:void 0,readReceiptResponseV5:void 0,speechToTextResponse:void 0,translateResponse:void 0,messagesModified:void 0,messageModifiedSyncCompleted:void 0,syncServerSaveUnreadCompleted:void 0,messageReaction:void 0}}),Object.defineProperty(this,"_typingInternalTimer",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"_typingExpireTime",{enumerable:!0,configurable:!0,writable:!0,value:2e3}),Object.defineProperty(this,"_typingChangedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rtcListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._options=Object.assign({},e),this.appkey=this._options.appkey,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.map((e=>e.replace(/\/$/g,"")));const t={onRTCDataChange:this._rtcDataChange.bind(this),onConnected:()=>this._onConnectionStatusChange(ce.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,ce.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,ce.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,ce.DISCONNECTED),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),conversationTag:this._conversationTagListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),userSettingsSynced:this._onUserSettingsSynced.bind(this),userSettingsChanged:this._onUserSettingsChanged.bind(this),conversationStatusSynced:this._onConversationStatusSynced.bind(this),robotsSynced:this._onRobotsSynced.bind(this),pullFinished:this._pullFinishedListener.bind(this),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),sgRelationsSynced:this._sgRelationsSyncedListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this),callInfo:this._callInfoListener.bind(this),ultraGroupChannelChangeType:this._ultraGroupChannelChangeTypeListener.bind(this),ultraGroupChannelUserKicked:this._ultraGroupChannelUserKickedListener.bind(this),ultraGroupChannelDelete:this._ultraGroupChannelDeleteListener.bind(this),onNaviDataChange:this._naviDataChange.bind(this),userGroupStatus:this._userGroupStatusListener.bind(this),messageReadReceipt:this._messageReadReceipt.bind(this),syncReadStatus:this._syncReadStatus.bind(this),subscribedUserStatusChange:this._subscribedUserStatusChange.bind(this),subscribedRelationChange:this._subscribedRelationChange.bind(this),syncSubscribedUserStatusFinished:this._syncSubscribedUserStatusFinished.bind(this),ownUserProfileChanged:this._ownUserProfileChanged.bind(this),groupOperation:this._groupOperation.bind(this),groupInfoChanged:this._groupInfoChanged.bind(this),groupMemberInfoChanged:this._groupMemberInfoChanged.bind(this),groupApplicationEvent:this._groupApplicationEvent.bind(this),groupRemarkChangedSync:this._groupRemarkChangedSync.bind(this),groupFollowsChangedSync:this._groupFollowsChangedSync.bind(this),friendAdd:this._friendAdd.bind(this),friendDelete:this._friendDelete.bind(this),friendApplicationStatusChanged:this._friendApplicationStatusChanged.bind(this),friendCleared:this._friendCleared.bind(this),friendInfoChangedSync:this._friendInfoChangedSync.bind(this),databaseOpened:this._databaseOpened.bind(this),databaseUpgradeWillStart:this._databaseUpgradeWillStart.bind(this),databaseUpgrading:this._databaseUpgrading.bind(this),databaseUpgradeDidComplete:this._databaseUpgradeDidComplete.bind(this),readReceiptResponseV5:this._readReceiptResponseV5.bind(this),speechToTextResponse:this._speechToTextResponse.bind(this),translateResponse:this._translateResponse.bind(this),messagesModified:this._messagesModified.bind(this),messageModifiedSyncCompleted:this._messageModifiedSyncCompleted.bind(this),syncServerSaveUnreadCompleted:this._syncServerSaveUnreadCompleted.bind(this),messageReaction:this._onMessageReaction.bind(this)},i=wt();this._engine=i?new Ff(t,this._options):new _f(t,this._options),this.logger=this._engine.logger,this._options.eventLoopBlockingCheck&&as.start(this.logger),this.sse=new c_(this,i),this.chatroom=new gf(this._engine,this._engine.chatroom),this.dataHosting=new Rf(this._engine,this._engine.dataHosting),this.chat=new Df(this._engine,this._engine.chat)}static init(e){if(this._context)return this._context.logger.warn(r.A_INIT_REPEAT_O),this._context;this._context=new zf(e),this._context.logger.info(r.L_INIT_O,JSON.stringify({appkey:e.appkey,navigators:e.navigators,typingExpireTime:e.typingExpireTime,runtime:Eo.tag})),this._context.logger.warn(r.L_IMSDK_VER_O,JSON.stringify({commitId:"62fcd7e06c6290bc087e82c396154c11d48a169a",version:"5.46.0-c-tmp-alpha.1"}));const t=this._context._engine;return Eo.setNetworkStatusListener(t.setNetwork.bind(t)),this._context}static getContext(){return this._context}getOptions(){return this._options}static destroy(){return t(this,void 0,void 0,(function*(){this._context&&(this._context.logger.info(r.A_DESTROY_O),yield this._context._destroy(),this._context=void 0)}))}install(e,t){const i=this.logger.createTraceId();if(this.logger.info(r.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),i),this._pluginInstanseMap[e.tag])return this.logger.warn(r.L_INSTALL_PLUGIN_R,"repeat install",i),this._pluginInstanseMap[e.tag];const s="RCRTC"===e.tag?new d_(this):new __(this);let n=null;try{if(!e.verify(Eo))return null;n=e.setup(s,Eo,t)}catch(e){this.logger.error(r.L_INSTALL_PLUGIN_R,null==e?void 0:e.stack,i)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),n&&(this._pluginContextQueue.push(s),this._pluginInstanseMap[e.tag]=n),n}registerCustomSignalHandler(e,t){var i,s;null===(s=(i=this._engine).registerCustomSignalHandler)||void 0===s||s.call(i,e,t)}getAppSettings(){return this.validateLogin().trans((e=>new uf(e)))}_onConnectionStatusChange(e,t){var i,s;this.logger.warn(r.A_CONNECT_S,`status: ${e}, code: ${t}`),null===(s=(i=this._watcher).connection)||void 0===s||s.call(i,e,t),this._pluginContextQueue.forEach((i=>{var s;null===(s=i.onconnectionstatechange)||void 0===s||s.call(i,e,t)}))}_processTypingStatusMessage(e){return this._addTypingInfo(Xf(e)),!!this._watcher.typingState}_processInterceptMessage(e){const t={conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId,extra:e.content.extra};if(e.conversationType===w.ULTRA_GROUP){const{sourceType:i}=e.content;if(t.sourceType=i,(i===de.MSG_EXPANSION||i===de.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(r.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:e.message}))}}return this._MessageBlockedListener(t),!0}_processReadReceiptMessage(e){"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime,e.senderUserId)}_processReadReceiptRequestMessage(e){"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId)}_processReadReceiptResponseMessage(e){var t;const i=null===(t=e.content)||void 0===t?void 0:t.receiptMessageDic,{userId:s}=this._engine;i&&Array.isArray(i[s])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,i[s])}_messageReceiver(e,t,i){var s,n,o,a;if(!(null===(n=(s=this._compatibleMessageProccessor)[e.messageType])||void 0===n?void 0:n.call(s,e))&&!this._pluginContextQueue.some((t=>{if(!t.onmessage)return!1;try{return t.onmessage(Xf(e))}catch(e){return this.logger.error(r.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}})))return null===(a=(o=this._watcher).message)||void 0===a||a.call(o,Xf(e),t,i),e}_batchMessageReceiver(e,t,i){const s=[],n=[],o=[Q.READ_RECEIPT,Q.READ_RECEIPT_REQUEST,Q.READ_RECEIPT_RESPONSE];e.forEach((e=>{const r=this._messageReceiver(e,t,i);r&&o.includes(r.messageType)?n.push(r):r&&s.push(r)})),s.length&&this._watcher.batchMessage&&(this.logger.debug(r.L_BATCH_MESSAGE_O,s.map((e=>e.messageUId)).join(",")),this._watcher.batchMessage(s)),n.length&&n.forEach((e=>{this._messageProccessor[e.messageType]&&this._messageProccessor[e.messageType](e)}))}_chatroomInfoListener(e){var t,i;null===(i=(t=this._watcher).chatroomState)||void 0===i||i.call(t,e)}_conversationInfoListener(e){var t,i;null===(i=(t=this._watcher).conversationState)||void 0===i||i.call(t,e)}_expansionInfoListener(e){var t,i;null===(i=(t=this._watcher).expansion)||void 0===i||i.call(t,e)}_tagListener(){var e,t;null===(t=(e=this._watcher).tag)||void 0===t||t.call(e)}_onUserSettingsSynced(e){var t,i;null===(i=(t=this._watcher).userSettingsSynced)||void 0===i||i.call(t,e)}_onUserSettingsChanged(e){var t,i;null===(i=(t=this._watcher).userSettingsChanged)||void 0===i||i.call(t,e)}_onConversationStatusSynced(e){var t,i;null===(i=(t=this._watcher).conversationStatusSynced)||void 0===i||i.call(t,e)}_onRobotsSynced(e,t){var i,s;null===(s=(i=this._watcher).robotsSynced)||void 0===s||s.call(i,e,t)}_conversationTagListener(){var e,t;null===(t=(e=this._watcher).conversationTagChanged)||void 0===t||t.call(e)}_typingStatusListener(e){var t,i;null===(i=(t=this._watcher).typingState)||void 0===i||i.call(t,e)}_pullFinishedListener(){var e,t;null===(t=(e=this._watcher).pullFinished)||void 0===t||t.call(e)}_MessageBlockedListener(e){var t,i;null===(i=(t=this._watcher).messageBlocked)||void 0===i||i.call(t,e)}_callInfoListener(e){this._pluginContextQueue.forEach((t=>{try{t.onCallInfo&&t.onCallInfo(e)}catch(e){this.logger.warn(r.L_CALLBACK_E,null==e?void 0:e.stack)}}))}_ultraGroupEnableListener(){var e,t;null===(t=(e=this._watcher).ultraGroupEnable)||void 0===t||t.call(e)}_sgRelationsSyncedListener(e){var t,i;null===(i=(t=this._watcher).sgRelationsSynced)||void 0===i||i.call(t,e)}_operateStatusListener(e){var t,i;null===(i=(t=this._watcher).operateStatus)||void 0===i||i.call(t,e)}_ultraGroupMessageExpansionUpdatedListener(e){var t,i;null===(i=(t=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===i||i.call(t,e)}_ultraGroupMessageRecalledListener(e){var t,i;null===(i=(t=this._watcher).ultraGroupMessageRecalled)||void 0===i||i.call(t,e)}_ultraGroupChannelChangeTypeListener(e){var t,i;null===(i=(t=this._watcher).ultraGroupChannelChangeType)||void 0===i||i.call(t,e)}_ultraGroupChannelUserKickedListener(e){var t,i;null===(i=(t=this._watcher).ultraGroupChannelUserKicked)||void 0===i||i.call(t,e)}_ultraGroupChannelDeleteListener(e){var t,i;null===(i=(t=this._watcher).ultraGroupChannelDelete)||void 0===i||i.call(t,e)}_userGroupStatusListener(e){var t,i;null===(i=(t=this._watcher).userGroupStatus)||void 0===i||i.call(t,e)}_messageReadReceipt(e){var t,i;null===(i=(t=this._watcher).messageReadReceipt)||void 0===i||i.call(t,e)}_syncReadStatus(e){var t,i;null===(i=(t=this._watcher).syncReadStatus)||void 0===i||i.call(t,e)}_subscribedUserStatusChange(e){var t,i;null===(i=(t=this._watcher).subscribedUserStatusChange)||void 0===i||i.call(t,e)}_subscribedRelationChange(e){var t,i;null===(i=(t=this._watcher).subscribedRelationChange)||void 0===i||i.call(t,e)}_syncSubscribedUserStatusFinished(e){var t,i;this.logger.info(r.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S),null===(i=(t=this._watcher).syncSubscribedUserStatusFinished)||void 0===i||i.call(t,e)}_ownUserProfileChanged(e){var t,i;this.logger.info(r.L_OWN_USER_PROFILE_CHANGED_S),null===(i=(t=this._watcher).ownUserProfileChanged)||void 0===i||i.call(t,e)}_groupOperation(e){var t,i;null===(i=(t=this._watcher).groupOperation)||void 0===i||i.call(t,e)}_groupInfoChanged(e){var t,i;null===(i=(t=this._watcher).groupInfoChanged)||void 0===i||i.call(t,e)}_groupMemberInfoChanged(e){var t,i;null===(i=(t=this._watcher).groupMemberInfoChanged)||void 0===i||i.call(t,e)}_groupApplicationEvent(e){var t,i;null===(i=(t=this._watcher).groupApplicationEvent)||void 0===i||i.call(t,e)}_groupRemarkChangedSync(e){var t,i;null===(i=(t=this._watcher).groupRemarkChangedSync)||void 0===i||i.call(t,e)}_groupFollowsChangedSync(e){var t,i;null===(i=(t=this._watcher).groupFollowsChangedSync)||void 0===i||i.call(t,e)}_friendAdd(e){var t,i;null===(i=(t=this._watcher).friendAdd)||void 0===i||i.call(t,e)}_friendDelete(e){var t,i;null===(i=(t=this._watcher).friendDelete)||void 0===i||i.call(t,e)}_friendApplicationStatusChanged(e){var t,i;null===(i=(t=this._watcher).friendApplicationStatusChanged)||void 0===i||i.call(t,e)}_friendCleared(e){var t,i;null===(i=(t=this._watcher).friendCleared)||void 0===i||i.call(t,e)}_friendInfoChangedSync(e){var t,i;null===(i=(t=this._watcher).friendInfoChangedSync)||void 0===i||i.call(t,e)}_naviDataChange(e){this._pluginContextQueue.forEach((t=>{var i;null===(i=t.onnavidatachange)||void 0===i||i.call(t,e)}))}_databaseOpened(e,t){var i,s;null===(s=(i=this._watcher).databaseOpened)||void 0===s||s.call(i,e,t)}_databaseUpgradeWillStart(){var e,t;this.logger.info(r.L_DB_UPGRATE_START_S),null===(t=(e=this._watcher).databaseUpgradeWillStart)||void 0===t||t.call(e)}_databaseUpgrading(e){var t,i;this.logger.info(r.L_DB_UPGRATING_S,e),null===(i=(t=this._watcher).databaseUpgrading)||void 0===i||i.call(t,e)}_databaseUpgradeDidComplete(e){var t,i;this.logger.info(r.L_DB_UPGRATE_COMPLETE_S),null===(i=(t=this._watcher).databaseUpgradeDidComplete)||void 0===i||i.call(t,e)}_readReceiptResponseV5(e){var t,i;null===(i=(t=this._watcher).readReceiptResponseV5)||void 0===i||i.call(t,e)}_speechToTextResponse(e){var t,i;null===(i=(t=this._watcher).speechToTextResponse)||void 0===i||i.call(t,e)}_translateResponse(e){var t,i;null===(i=(t=this._watcher).translateResponse)||void 0===i||i.call(t,e)}_messagesModified(e){var t,i;null===(i=(t=this._watcher).messagesModified)||void 0===i||i.call(t,e)}_messageModifiedSyncCompleted(){var e,t;null===(t=(e=this._watcher).messageModifiedSyncCompleted)||void 0===t||t.call(e)}_syncServerSaveUnreadCompleted(){var e,t;null===(t=(e=this._watcher).syncServerSaveUnreadCompleted)||void 0===t||t.call(e)}_onMessageReaction(e){var t,i;null===(i=(t=this._watcher).messageReaction)||void 0===i||i.call(t,e)}assignWatcher(e){Object.keys(this._watcher).forEach((t=>{if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];this._watcher[t]=vt(i)||St(i)?i:void 0}}))}_resetWatcher(){Object.keys(this._watcher).forEach((e=>{this._watcher[e]=void 0}))}_addTypingInfo(e){const{senderUserId:t,conversationType:i,targetId:s,content:n,channelId:r}=e,{typingContentType:o}=n,a=`${i}#${s}#${r||""}`;this._typingInfo[a]||(this._typingInfo[a]=[]);const l=this._typingInfo[a].findIndex((e=>e.userId===t));l>=0&&this._typingInfo[a][l].messageType===o?this._typingInfo[a][l].timestamp=Date.now():(l>=0&&this._typingInfo[a].splice(l,1),this._typingInfo[a].push({userId:t,messageType:o,timestamp:Date.now()}),this._typingChangedList.includes(a)||this._typingChangedList.push(a),this._startCheckTypingInfo())}_startCheckTypingInfo(){-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((()=>{for(const e in this._typingInfo){const t=this._typingInfo[e].length;this._typingInfo[e]=this._typingInfo[e].filter((e=>Date.now()-e.timestamp<this._typingExpireTime)),this._typingInfo[e].length===t||this._typingChangedList.includes(e)||this._typingChangedList.push(e),0===this._typingInfo[e].length&&delete this._typingInfo[e]}this._notifyTypingChanged()}),500))}_notifyTypingChanged(){if(this._typingChangedList.length>0){const e=this._typingChangedList.map((e=>({conversationType:Number(e.split("#")[0]),targetId:e.split("#")[1],channelId:e.split("#")[2],list:this._typingInfo[e]||[]})));this._typingStatusListener(e),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)}getConnectedTime(){return this._engine.connectedTime}getServerTime(){return this._engine.serverTime}getDeviceId(){return this._engine.deviceId}setPushConfig(e){return this._engine.setPushConfig(e)}getCurrentUserId(){return this._engine.userId}getConnectionStatus(){return this._engine.connectionStatus}isConnected(){return this._engine.connectionStatus===ce.CONNECTED}_validateUserProfile(e){return 1!==e.userProfile?Ei(D.RC_USER_PROFILE_SERVICE_UNAVAILABLE):gi(e)}get validateConnected(){return()=>this.checkAuthed(!1)}get validateLogin(){return()=>this.checkAuthed(!0)}checkAuthed(e){return this._engine.connectionStatus===ce.CONNECTED||this._engine.userId&&e?gi(this._engine.naviInfo):Ei(D.RC_NET_UNAVAILABLE)}get token(){return this._token}refetchNaviInfo(){return t(this,void 0,void 0,(function*(){return this._engine.refetchNaviInfo()}))}connect(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:s}),t);const n=yield Ii.create("connect").isNotEmptyString("token",e).fail(D.RC_CONN_TOKEN_INCORRECT).result().next((()=>i(this,Bf,"m",Hf).call(this,e,!!s,t)));return this.logger.summary(r.A_CONNECT_R,n,t,void 0,(e=>({userId:e}))),n}))}disconnect(e,s){return t(this,void 0,void 0,(function*(){return this.logger.info(r.A_DISCONNECT_O,JSON.stringify({closeDB:e,disablePush:s})),i(this,Bf,"m",jf).call(this,e,s)}))}reconnect(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_RECONNECT_T,JSON.stringify({reconnectKickEnable:e}),t);const s=yield i(this,Bf,"m",Hf).call(this,this.token,!!e,t);return this.logger.summary(r.A_RECONNECT_R,s,t,void 0,(e=>({userId:e}))),s}))}_channelIdConvert(e,t){if(e!==w.ULTRA_GROUP)return t;const i=this.getNaviInfoFromCache();return!!(2&((null==i?void 0:i.ugDriven)||0))&&!t?"RCDefault":t}getNaviInfoFromCache(){return this._engine.naviInfo}registerMessageType(e,t,i,s=[],n=!1){const r={isPersited:t,isCounted:i,searchProps:s,isStatusMessage:n};!function(e,t){const i=ps.get(e);i&&!i.isCustom&&console.warn(`Builtin message type '${e}' cannot be registered`),t.isStatusMessage&&(t.isCounted=t.isPersited=!1),ps.set(e,Object.assign(Object.assign({},t),{isCustom:!0}))}(e,r),this._engine.registerMessageType(e,r)}_rtcDataChange(e){var t;null===(t=this._rtcListener)||void 0===t||t.call(this,e)}registerRTCSignalingListener(e){this._rtcListener=e}sendMessageByPlugin(e,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.L_SEND_MSG_T,JSON.stringify({identifier:e,messageType:s.messageType}),t);const o=yield i(this,Bf,"m",Wf).call(this,e,s,t,n);return this.logger.summary(r.L_SEND_MSG_R,o,t,void 0,(({messageId:t,messageUId:i,messageType:s})=>({messageId:t,messageUId:i,messageType:s,identifier:e}))),o}))}sendMessage(e,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SEND_MSG_T,JSON.stringify({identifier:e,messageType:s.messageType}),t);const o=yield i(this,Bf,"m",Wf).call(this,e,s,t,n);return this.logger.summary(r.A_SEND_MSG_R,o,t,void 0,(({messageId:t,messageUId:i,messageType:s})=>({messageId:t,messageUId:i,messageType:s,identifier:e}))),o}))}updateMessageExpansion(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UPDATE_MSG_EXPANSION_T,JSON.stringify({expansion:e,attrs:s}),t);const n=yield Ii.create("updateMessageExpansion").check((t=>R_(t,s,Object.keys(e||{})))).check((t=>A_(t,e,s.canIncludeExpansion))).result().tryTrans(this.validateConnected).next((()=>{const n={put:e,mid:s.messageUId},r=Object.assign(Object.assign({},s),{channelId:this._channelIdConvert(s.conversationType,s.channelId)});return s.conversationType===w.ULTRA_GROUP?this._engine.chat.updateUGMessageExpansion(r,n,s.sentTime):i(this,Bf,"m",Jf).call(this,r,n,t)}));return this.logger.summary(r.A_UPDATE_MSG_EXPANSION_R,n,t),n}))}removeMessageExpansion(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_MSG_EXPANSION_T,JSON.stringify({keys:e,attrs:s}),t);const n=yield Ii.create("removeMessageExpansion").isLimitedTypedArray("keys",e,20,(e=>"string"==typeof e&&/^[A-Za-z0-9_=+-]+$/.test(e)),!0).fail(D.INVALID_PARAMETER_KEYS).check((t=>R_(t,s,e))).result().tryTrans(this.validateConnected).next((()=>{const n={del:e,mid:s.messageUId},r=Object.assign(Object.assign({},s),{channelId:this._channelIdConvert(s.conversationType,s.channelId)});return s.conversationType===w.ULTRA_GROUP?this._engine.chat.updateUGMessageExpansion(r,n,s.sentTime):i(this,Bf,"m",Jf).call(this,r,n,t)}));return this.logger.summary(r.A_REMOVE_MSG_EXPANSION_R,n,t),n}))}removeAllMessageExpansion(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_ALL_MSG_EXPANSION_T,JSON.stringify({attrs:e}),t);const s=yield Ii.create("removeAllMessageExpansion").check((t=>R_(t,e,[]))).check((t=>{e.conversationType!==w.ULTRA_GROUP&&t.setFailed(D.CONVERSATION_TYPE_NOT_SUPPORT)})).result().tryTrans(this.validateConnected).next((()=>{const s={clear:1,mid:e.messageUId},n=Object.assign(Object.assign({},e),{channelId:this._channelIdConvert(e.conversationType,e.channelId)});return e.conversationType===w.ULTRA_GROUP?this._engine.chat.updateUGMessageExpansion(n,s,e.sentTime):i(this,Bf,"m",Jf).call(this,n,s,t)}));return this.logger.summary(r.A_REMOVE_ALL_MSG_EXPANSION_R,s,t),s}))}sendReadReceiptV2(e,i,s,n){return t(this,void 0,void 0,(function*(){n=n||this.logger.createTraceId(),this.logger.info(r.A_SEND_READ_RECEIPT_V2_T,JSON.stringify({targetId:e,messageUIds:i,channelId:s}),n);const o=yield Ii.create("sendReadReceiptV2").validate("targetId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isLimitedTypedArray("messageUIds",i,Number.MAX_SAFE_INTEGER,pt,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateConnected).next((n=>t(this,void 0,void 0,(function*(){return 1!==n.grpRRVer?Ei(D.READ_RECEIPT_ERROR,"The read receipt switch is not on, please call the sendMessage method."):this._engine.chat.sendReadReceiptV2(e,i,s)}))));return this.logger.summary(r.A_SEND_READ_RECEIPT_V2_R,o,n),o}))}_destroy(){return t(this,void 0,void 0,(function*(){as.stop(),this._resetWatcher(),this._engine.destroy(),Eo.removeNetworkStatusListener(),yield i(this,Bf,"m",jf).call(this),this._pluginContextQueue.forEach((e=>{if(e.ondestroy)try{e.ondestroy()}catch(e){this.logger.error(r.L_CALLBACK_E,null==e?void 0:e.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={}}))}getHistoryMessage(e,s){return t(this,void 0,void 0,(function*(){const t=null==s?void 0:s.timestamp,n=null==s?void 0:s.count,o=null==s?void 0:s.order,a=null==s?void 0:s.messageType,l=this.logger.createTraceId();this.logger.info(r.A_GET_HISTORY_MSG_T,JSON.stringify({conversation:e,options:s}),l);const c=yield Ii.create("getHistoryMessage").check((t=>f_(t,e,x))).isLimitedInteger("timestamp",t,0,Number.MAX_SAFE_INTEGER).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("order",o,0,1).fail(D.INVALID_PARAMETER_ORDER).isLimitedInteger("count",n,1,100).fail(D.INVALID_PARAMETER_COUNT).isNotEmptyString("messageType",a).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).result().tryTrans(this.validateConnected).next((()=>{const s={timestamp:t||0,count:n||20,order:o||0,messageType:a||""},r=i(this,Bf,"m",Yf).call(this,e);return this._engine.getHistoryMessage(r,s,!0)}));return this.logger.summary(r.A_GET_HISTORY_MSG_R,c,l,void 0,(({list:e})=>({size:e.length}))),c}))}getContinuousMessages(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CONTINUOUS_MSGS_T,JSON.stringify({conversation:e,options:s}),t);const n=yield Ii.create("getContinuousMessages").check((t=>f_(t,e,V))).isLimitedInteger("timestamp",null==s?void 0:s.timestamp,0,Number.MAX_SAFE_INTEGER).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("count",null==s?void 0:s.count,1,100).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("order",null==s?void 0:s.order,0,1).fail(D.INVALID_PARAMETER_ORDER).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e),n={timestamp:s.timestamp||0,count:s.count||20,order:s.order||0,messageType:""};return this._engine.chat.getContinuousMessages(t,n)}));return this.logger.summary(r.A_GET_CONTINUOUS_MSGS_R,n,t,void 0,(({list:e})=>({size:e.length}))),n}))}getHistoryMessagesByObjectNames(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_HIS_MSGS_BY_OBJ_NAMES_T,JSON.stringify({conversation:e,option:s}),t);const n=yield Ii.create("getHistoryMessagesByObjectNames").check((t=>f_(t,e,F))).isLimitedInteger("timestamp",null==s?void 0:s.timestamp,0,Number.MAX_SAFE_INTEGER).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("count",null==s?void 0:s.count,1,100).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("order",null==s?void 0:s.order,0,1).fail(D.INVALID_PARAMETER_ORDER).isTypedArray("messageTypes",null==s?void 0:s.messageTypes,pt).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e),n={timestamp:s.timestamp||0,count:s.count||20,order:s.order||0,messageTypes:s.messageTypes||[]};return this._engine.chat.getHistoryMessagesByObjectNames(t,n)}));return this.logger.summary(r.A_GET_HIS_MSGS_BY_OBJ_NAMES_R,n,t,void 0,(({list:e})=>({size:e.length}))),n}))}getTopConversationList(e,i){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_GET_TOP_CONVERSATION_LIST_T,JSON.stringify({conversationTypes:e,channelId:i}),s);const n=yield Ii.create("getTopConversationList").isTypedArray("conversationTypes",e,(e=>W(e,k))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).validate("channelId",i,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateConnected).next((s=>t(this,void 0,void 0,(function*(){const t=jI(s);return t&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getTopConversationList(t,e,i)}))));return this.logger.summary(r.A_GET_TOP_CONVERSATION_LIST_R,n,s,void 0,(e=>({size:e.length}))),n}))}getUnreadConversationList(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_CONVERSATION_LIST_T,JSON.stringify({conversationTypes:e}),i);const s=yield Ii.create("getUnreadConversationList").isTypedArray("conversationTypes",e,(e=>W(e,k))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).result().tryTrans(this.validateConnected).next((i=>t(this,void 0,void 0,(function*(){const t=jI(i);return t&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getUnreadConversationList(t,e)}))));return this.logger.summary(r.A_GET_UNREAD_CONVERSATION_LIST_R,s,i,void 0,(e=>({size:e.length}))),s}))}getBlockedConversationList(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_BLOCKED_CONVERSATION_LIST_T,"",e);const i=yield Ii.create("getBlockedConversationList").result().tryTrans(this.validateConnected).next((e=>t(this,void 0,void 0,(function*(){const t=jI(e);return t&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getBlockedConversationList(t)}))));return this.logger.summary(r.A_GET_BLOCKED_CONVERSATION_LIST_R,i,e,void 0,(e=>({size:e.length}))),i}))}getAllConversationList(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_ALL_CONVERSATION_LIST_T,JSON.stringify({channelId:e}),i);const s=yield Ii.create("getAllConversationList").validate("channelId",e,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateLogin).next((i=>t(this,void 0,void 0,(function*(){const t=jI(i);return t&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getAllConversationList(t,e)}))));return this.logger.summary(r.A_GET_ALL_CONVERSATION_LIST_R,s,i,void 0,(e=>({size:e.length}))),s}))}getConversationList(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CONVERSATION_LIST_OLD_T,JSON.stringify(e),t);const i=wt()&&"string"!=typeof(null==e?void 0:e.channelId)?this.getAllConversationList(null==e?void 0:e.channelId):this.getConversationListByTimestamp(e),s=yield i;return this.logger.summary(r.A_GET_CONVERSATION_LIST_OLD_R,s,t,void 0,(e=>({size:e.length}))),s}))}getConversationListByTimestamp(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_CONVERSATION_LIST_BY_TIME_T,JSON.stringify(e),i);const s=yield Ii.create("getConversationListByTimestamp").isObject("params",e,!0).fail(D.CONVER_GET_ERROR,"params must be an object").isTimestamp("startTime",null==e?void 0:e.startTime,!0).fail(D.INVALID_PARAMETER_START_TIME).isLimitedInteger("count",null==e?void 0:e.count,1,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("order",null==e?void 0:e.order,0,1).fail(D.INVALID_PARAMETER_ORDER).validate("channelId",null==e?void 0:e.channelId,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).isTypedArray("conversationTypes",null==e?void 0:e.conversationTypes,(e=>W(e,k))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).isNumberEnum("unreadCountFilter",null==e?void 0:e.unreadCountFilter,we).fail(D.INVALID_PARAMETER_UNREAD_COUNT_FILTER).result().tryTrans((()=>this.checkAuthed(wt()))).next((i=>t(this,void 0,void 0,(function*(){const t=jI(i);return t&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getConversationListByTimestamp(e,t)}))));return this.logger.summary(r.A_GET_CONVERSATION_LIST_BY_TIME_R,s,i,void 0,(e=>({size:e.length}))),s}))}getConversation(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CONVERSATION_T,JSON.stringify(e),t);const s=yield Ii.create("getConversation").check((t=>f_(t,e,x))).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getConversation(t)}));return this.logger.summary(r.A_GET_CONVERSATION_R,s,t,e),s}))}removeConversation(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_CONVERSATION_T,JSON.stringify(e),t);const n=yield Ii.create("removeConversation").check((t=>f_(t,e,k))).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.batchDeleteConversations({identifiers:[t],deleteRemotely:!!s,deleteMessages:!1})}));return this.logger.summary(r.A_REMOVE_CONVERSATION_R,n,t),n}))}batchDeleteConversations(e){return t(this,void 0,void 0,(function*(){const s=null==e?void 0:e.identifiers,n=!!(null==e?void 0:e.deleteRemotely),o=!!(null==e?void 0:e.deleteMessages),a=this.logger.createTraceId();this.logger.info(r.A_BATCH_DEL_CONVERS_T,JSON.stringify({identifiers:s,deleteRemotely:n,deleteMessages:o}),a);const l=yield Ii.create("batchDeleteConversations").isLimitedArray("identifiers",s,100,!0,1).fail(D.INVALID_PARAMETER_CONVERSATION_LIST).result().tryTrans(this.validateConnected).next((()=>t(this,void 0,void 0,(function*(){const e=s.filter((e=>T_("",e,k).result().isOk)).map((e=>i(this,Bf,"m",Yf).call(this,e)));return 0===e.length?gi():this._engine.chat.batchDeleteConversations({identifiers:e,deleteRemotely:n,deleteMessages:o})}))));return this.logger.summary(r.A_BATCH_DEL_CONVERS_R,l,a),l.wipe()}))}getUltraGroupList(e){return t(this,void 0,void 0,(function*(){const i=null==e?void 0:e.targetId,s=null==e?void 0:e.channelType,n=this.logger.createTraceId();this.logger.info(r.A_GET_UG_LIST_T,JSON.stringify({targetId:i,channelType:s}),n);const o=yield Ii.create("getUltraGroupList").validate("targetId",i,Ut).fail(D.INVALID_PARAMETER_TARGET_ID).isNumberEnum("channelType",s,X).fail(D.INVALID_PARAMETER_CHANNEL_TYPE).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){return this._engine.chat.ugSynced?this._engine.chat.getUltraGroupList(e):Ei(D.METHOD_NOT_AVAILABLE)}))));return this.logger.summary(r.A_GET_UG_LIST_R,o,n,void 0,(e=>({size:e.length}))),o}))}getBlockedUGList(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_BLOCKED_UG_LIST_T,"",e);const i=yield Ii.create("getBlockedUGList").result().tryTrans(this.validateConnected).next((()=>t(this,void 0,void 0,(function*(){return this._engine.chat.ugSynced?this._engine.chat.getBlockedUGList():Ei(D.METHOD_NOT_AVAILABLE)}))));return this.logger.summary(r.A_GET_BLOCKED_UG_LIST_R,i,e,void 0,(e=>({size:e.length}))),i}))}getUnreadCount(e){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_COUNT_T,JSON.stringify(e),s);const n=yield Ii.create("getUnreadCount").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){if(e.conversationType===w.ULTRA_GROUP&&!this._engine.chat.ugSynced)return Ei(D.METHOD_NOT_AVAILABLE);const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getConversationUnreadCount(t)}))));return this.logger.summary(r.A_GET_UNREAD_COUNT_R,n,s,void 0,(e=>({unreadCount:e}))),n}))}getTotalUnreadCount(e,i,s){return t(this,void 0,void 0,(function*(){const n=this.logger.createTraceId();this.logger.info(r.A_GET_TOTAL_UNREAD_COUNT_T,JSON.stringify({conversationTypes:e,includeMuted:i,channelId:s}),n);const o=yield Ii.create("getTotalUnreadCount").validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).isTypedArray("conversationTypes",e,(e=>W(e,F))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).result().tryTrans(this.validateLogin).next((n=>t(this,void 0,void 0,(function*(){const t=jI(n);if(!t&&e&&e.includes(w.ULTRA_GROUP))return Ei(D.METHOD_NOT_SUPPORT);const r=e&&e.length>0?e:Y(t?k:G);return r.includes(w.ULTRA_GROUP)&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getTotalUnreadCount(r,!!i,s)}))));return this.logger.summary(r.A_GET_TOTAL_UNREAD_COUNT_R,o,n,void 0,(e=>({unreadCount:e}))),o}))}getTotalUnreadCountByLevels(e,i,s){return t(this,void 0,void 0,(function*(){const n=this.logger.createTraceId();this.logger.info(r.A_GET_TOTAL_UNREAD_COUNT_BY_LEVELS_T,JSON.stringify({conversationTypes:e,levels:i,isMentioned:s}),n);const o=yield Ii.create("getTotalUnreadCountByLevels").isLimitedTypedArray("conversationTypes",e,20,(e=>W(e,k)),!0).fail(D.CONVERSATION_TYPE_NOT_SUPPORT).isTypedArray("levels",i,Mt,!0).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){return e.includes(w.ULTRA_GROUP)&&!this._engine.chat.ugSynced?Ei(D.METHOD_NOT_AVAILABLE):this._engine.chat.getTotalUnreadCountByLevels(e,i,s)}))));return this.logger.summary(r.A_GET_TOTAL_UNREAD_COUNT_BY_LEVELS_R,o,n,void 0,(e=>({unreadCount:e}))),o}))}getFirstUnreadMessage(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_FIRST_UNREAD_MEG_T,JSON.stringify(e),t);const s=yield Ii.create("getFirstUnreadMessage").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getFirstUnreadMessage(t)}));return this.logger.summary(r.A_GET_FIRST_UNREAD_MSG_R,s,t,e),s}))}getFirstUnreadMessageDigest(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_FIRST_UNREAD_MSG_DIGEST_T,JSON.stringify(e),t);const s=yield Ii.create("getFirstUnreadMessageDigest").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getFirstUnreadMessageDigest(t)}));return this.logger.summary(r.A_GET_FIRST_UNREAD_MSG_DIGEST_R,s,t,e),s}))}batchSetConversationNotificationLevel(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_SET_CONVERSATION_NOTIFICATION_LEVEL_T,JSON.stringify({conversations:e,notificationLevel:s}),t);const n=Ii.create("batchSetConversationNotificationLevel"),o=yield n.isLimitedTypedArray("conversations",e,20,(e=>!T_("batchSetConversationNotificationLevel",e,k).isFailed),!0,1).fail(D.INVALID_PARAMETER_CONVERSATION_LIST).isNumberEnum("notificationLevel",s,Ee,!0).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateConnected).next((()=>{const t=e.map((e=>i(this,Bf,"m",Yf).call(this,e)));return this._engine.chat.batchSetConversationNotificationLevel(t,s)}));return this.logger.summary(r.A_BATCH_SET_CONVERSATION_NOTIFICATION_LEVEL_R,o,t),o}))}batchSetConversationToTop(e,s,n,o){return t(this,void 0,void 0,(function*(){const t=Ii.create("batchSetConversationToTop").isLimitedTypedArray("conversations",e,20,(e=>T_("batchSetConversationToTop",e,k).result().isOk),!0,1).fail(D.INVALID_PARAMETER_CONVERSATION_LIST).result().tryTrans((()=>e.every((e=>e.conversationType!==w.ULTRA_GROUP||!e.channelId||"RCDefault"===e.channelId))?gi():Ei(D.ONLY_DEFAULT_CHANNEL_SUPPORTS_PINNING))).tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const a=this.logger.createTraceId(),l=e.map((e=>i(this,Bf,"m",Yf).call(this,e)));this.logger.info(r.A_BATCH_SET_CONVERSATION_TO_TOP_T,JSON.stringify({conversations:l,isTop:s,isUpdateTime:n,isCreateConversation:o}),a);const c=yield this._engine.chat.batchSetConversationToTop(l,s,n,o);return this.logger.summary(r.A_BATCH_SET_CONVERSATION_TO_TOP_R,c,a),c}))}batchSetConversationTranslateStrategy(e,s){return t(this,void 0,void 0,(function*(){const t=Ii.create("batchSetConversationTranslateStrategy").isLimitedTypedArray("conversations",e,20,(e=>T_("",e,k).result().isOk),!0,1).fail(D.INVALID_PARAMETER_CONVERSATION_LIST).isNumberEnum("strategy",s,Ms,!0).fail(D.INVALID_PARAMETER_TRANSLATE_STRATEGY).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const n=this.logger.createTraceId();this.logger.info(r.A_BATCH_SET_CONVERSATION_TRANSLATE_STRATEGY_T,JSON.stringify({conversations:e,strategy:s}),n);const o=e.map((e=>i(this,Bf,"m",Yf).call(this,e))),a=yield this._engine.chat.batchSetConversationTranslateStrategy(o,s);return this.logger.summary(r.A_BATCH_SET_CONVERSATION_TRANSLATE_STRATEGY_R,a,n),a}))}saveTextMessageDraft(e,s){return t(this,void 0,void 0,(function*(){return yield T_("saveTextMessageDraft",e,F).isString("draft",s,!0).fail(D.INVALID_PARAMETER_DRAFT).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.saveTextMessageDraft(t,s)}))}))}getTextMessageDraft(e){return t(this,void 0,void 0,(function*(){return yield T_("getTextMessageDraft",e,F).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.getTextMessageDraft(t)}))}))}clearTextMessageDraft(e){return t(this,void 0,void 0,(function*(){return yield T_("clearTextMessageDraft",e,F).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.clearTextMessageDraft(t)}))}))}recallMessage(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),n={conversation:e,messageUId:null==s?void 0:s.messageUId};this.logger.info(r.A_RECALL_MESSAGE_T,JSON.stringify(n),t);const o=yield Ii.create("recallMessage").check((t=>f_(t,e,x))).isNotEmptyString("messageUId",s.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isInteger("sentTime",s.sentTime,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).isBoolean("disableNotification",s.disableNotification).fail(D.INVALID_PARAMETER_DISABLE_NOTIFICATION).isObject("pushConfig",s.pushConfig).fail(D.INVALID_PARAMETER_PUSH_CONFIG).isBoolean("disableUpdateLastMessage",s.disableUpdateLastMessage).fail(D.INVALID_DISABLE_UPDATE_LAST_MESSAGE).isLimitedTypedArray("directionalUserIdList",s.directionalUserIdList,300,Ut,!1,0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.recallMsg(t,s)}));return this.logger.summary(r.A_RECALL_MESSAGE_R,o,t,n),o}))}deleteRemoteMessage(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DEL_REMOTE_MSGS_T,JSON.stringify({conversation:e,messages:s}),t);const n=yield Ii.create("deleteRemoteMessage").check((t=>f_(t,e,k))).isLimitedTypedArray("messages",s,100,(e=>{if(!e||"object"!=typeof e)return!1;const{messageUId:t,sentTime:i,messageDirection:s}=e;return pt(t)&&(s===ue.SEND||s===ue.RECEIVE)&&ft({min:0})(i)}),!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.deleteRemoteMessage(t,s)}));return this.logger.summary(r.A_DEL_REMOTE_MSGS_R,n,t),n}))}deleteRemoteMessageByTimestamp(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DEL_REMOTE_MSGS_T,JSON.stringify({identifier:e,timestamp:s}),t);const n=yield Ii.create("deleteRemoteMessageByTimestamp").check((t=>f_(t,e,x))).isInteger("timestamp",s,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.deleteRemoteMessageByTimestamp(t,s)}));return this.logger.summary(r.A_DEL_REMOTE_MSGS_R,n,t),n}))}getFileToken(e,i,s,n,r,o){return t(this,void 0,void 0,(function*(){return Ii.create("getFileToken").isNumberEnum("fileType",e,J,!0).fail(D.INVALID_PARAMETER_MEDIA_TYPE).isString("fileName",i).fail(D.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME).validate("httpMethod",s,(e=>"POST"===e||"PUT"===e)).fail(D.BIZ_ERROR_INVALID_PARAMETER,"`httpMethod` is invalid").isString("queryString",n).fail(D.BIZ_ERROR_INVALID_PARAMETER,"`queryString` is invalid").isString("url",r).fail(D.BIZ_ERROR_INVALID_PARAMETER,"`url` is invalid").isInteger("size",o).fail(D.BIZ_ERROR_INVALID_PARAMETER,"`size` is invalid").result().tryTrans(this.validateConnected).next((a=>t(this,void 0,void 0,(function*(){const t=a.uploadServer||"",l=a.ossConfig||"";return(yield this._engine.getFileToken(e,i,s,n,r,o)).trans((e=>Object.assign(e,{qiniu:t,ossConfig:e.ossConfig||l})))}))))}))}getFileUrl(e,i,s,r){return t(this,void 0,void 0,(function*(){return yield Ii.create("getFileUrl").isNumberEnum("fileType",e,J,!0).fail(D.INVALID_PARAMETER_MEDIA_TYPE).isString("fileName",i).fail(D.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME).isString("saveName",r).fail(D.INVALID_PARAMETER_SAVE_NAME).isNumberEnum("serverType",s,n,!0).fail(D.INVALID_PARAMETER_SERVER_TYPE).result().tryTrans(this.validateConnected).next((()=>this._engine.getFileUrl(e,s,i,r||"")))}))}createTag(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_TAG_T,JSON.stringify({tagId:null==e?void 0:e.tagId,tagName:null==e?void 0:e.tagName}),t);const i=yield Ii.create("createTag").isLimitedString("tagId",null==e?void 0:e.tagId,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isLimitedString("tagName",null==e?void 0:e.tagName,1,15,!0).fail(D.INVALID_PARAMETER_TAG_NAME).result().tryTrans(this.validateConnected).next((()=>this._engine.createTag(e)));return this.logger.summary(r.A_ADD_TAG_R,i,t),i}))}removeTag(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_TAG_T,JSON.stringify({tagId:e}),t);const i=yield Ii.create("removeTag").isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).result().tryTrans(this.validateConnected).next((()=>this._engine.removeTag(e)));return this.logger.summary(r.A_REMOVE_TAG_R,i,t),i}))}updateTag(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UPDATE_TAG_T,JSON.stringify({tagId:null==e?void 0:e.tagId,tagName:null==e?void 0:e.tagName}),t);const i=yield Ii.create("updateTag").isLimitedString("tagId",null==e?void 0:e.tagId,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isLimitedString("tagName",null==e?void 0:e.tagName,1,15,!0).fail(D.INVALID_PARAMETER_TAG_NAME).result().tryTrans(this.validateConnected).next((()=>this._engine.updateTag(e)));return this.logger.summary(r.A_UPDATE_TAG_R,i,t),i}))}getTagList(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_TAGS_T,"",e);const t=yield this.validateLogin().next((()=>this._engine.getTagList()));return this.logger.summary(r.A_GET_TAGS_R,t,e,void 0,(e=>({size:e.length}))),t}))}addTagForConversations(e,s){return t(this,void 0,void 0,(function*(){const t=Ii.create("addTagForConversations").isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isTypedArray("conversations",s,(e=>T_("",e,G).result().isOk),!0).fail(D.INVALID_PARAMETER_CONVERSATIONS).isLimitedInteger("conversations",null==s?void 0:s.length,1,1e3,!0).fail(D.CONVER_OUT_LIMIT_ERROR).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const n=s.map((e=>i(this,Bf,"m",Yf).call(this,e))),o=this.logger.createTraceId();this.logger.info(r.A_ADD_TAG_FOR_CONVERSATIONS_T,JSON.stringify({tagId:e,conversations:n}),o);const a=yield this._engine.chat.addTagForConversations(e,n);return this.logger.summary(r.A_ADD_TAG_FOR_CONVERSATIONS_R,a,o),a}))}removeTagForConversations(e,s){return t(this,void 0,void 0,(function*(){const t=Ii.create("removeTagForConversations").isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isLimitedTypedArray("conversations",s,1e3,(e=>T_("",e,G).result().isOk),!0).fail(D.INVALID_PARAMETER_CONVERSATIONS).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const n=s.map((e=>i(this,Bf,"m",Yf).call(this,e))),o=this.logger.createTraceId();this.logger.info(r.A_REMOVE_TAG_FOR_CONVERS_T,JSON.stringify({tagId:e,conversations:n}),o);const a=yield this._engine.chat.removeTagForConversations(e,n);return this.logger.summary(r.A_REMOVE_TAG_FOR_CONVERS_R,a,o),a}))}removeTagsForConversation(e,s){return t(this,void 0,void 0,(function*(){const t=T_("removeTagsForConversation",e,G).isTypedArray("tagIds",s,(e=>Et(e)),!0).fail(D.INVALID_PARAMETER_TAG_ID).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const n=this.logger.createTraceId(),o=i(this,Bf,"m",Yf).call(this,e);this.logger.info(r.A_REMOVE_TAGS_FOR_CONVER_T,JSON.stringify({tagIds:s,conversation:o}),n);const a=yield this._engine.chat.removeTagsForConversation(o,s);return this.logger.summary(r.A_REMOVE_TAGS_FOR_CONVER_R,a,n),a}))}getConversationListByTag(e,i,s){return t(this,void 0,void 0,(function*(){const t=Ii.create("getConversationListByTag").isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isInteger("count",s,!0).fail(D.CONVER_OUT_LIMIT_ERROR).isLimitedInteger("startTime",i,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_START_TIME).result().tryTrans((()=>this.checkAuthed(wt())));if(!t.isOk)return t.wipe();const n=s<=0?20:Math.min(s,1e3);return this._engine.chat.getConversationListByTag(e,i,n)}))}getUnreadCountByTag(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_COUNT_BY_TAG_T,JSON.stringify({tagId:e,containMuted:i}),t);const s=yield Ii.create("getUnreadCountByTag").isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isBoolean("containMuted",i,!0).fail(D.INVALID_PARAMETER_CONTAIN_MUTED).result().tryTrans(this.validateLogin).next((()=>this._engine.chat.getUnreadCountByTag(e,i)));return this.logger.summary(r.A_GET_UNREAD_COUNT_BY_TAG_R,s,t),s}))}setConversationStatusInTag(e,s,n){return t(this,void 0,void 0,(function*(){const t=T_("setConversationStatusInTag",s,G).isLimitedString("tagId",e,1,10,!0).fail(D.INVALID_PARAMETER_TAG_ID).isBoolean("isTop",null==n?void 0:n.isTop,!0).fail(D.INVALID_PARAMETER_IS_TOP).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const o=this.logger.createTraceId(),a=i(this,Bf,"m",Yf).call(this,s);this.logger.info(r.A_SET_CONVER_TO_TOP_IN_TAG_T,JSON.stringify({tagId:e,conversation:a,isTop:n.isTop}),o);const l=yield this._engine.chat.setConversationStatusInTag(e,a,n);return this.logger.summary(r.A_SET_CONVER_TO_TOP_IN_TAG_R,l,o),l}))}getTagsForConversation(e){return t(this,void 0,void 0,(function*(){const t=T_("getTagsForConversation",e,G).result().tryTrans(this.validateLogin);if(!t.isOk)return t.wipe();const s=this.logger.createTraceId(),n=i(this,Bf,"m",Yf).call(this,e);this.logger.info(r.A_GET_TAGS_OF_CONVERSATION_T,JSON.stringify(n),s);const o=yield this._engine.chat.getTagsForConversation(n);return this.logger.summary(r.A_GET_TAGS_OF_CONVERSATION_R,o,s,void 0,(e=>({size:e.length}))),o}))}getUnreadMentionedCount(e){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_MENTIONED_COUNT_T,JSON.stringify(e),s);const n=yield Ii.create("getUnreadMentionedCount").check((t=>f_(t,e,B))).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){if(e.conversationType===w.ULTRA_GROUP&&!this._engine.chat.ugSynced)return Ei(D.METHOD_NOT_AVAILABLE);const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getUnreadMentionedCount(t)}))));return this.logger.summary(r.A_GET_UNREAD_MENTIONED_COUNT_R,n,s),n.trans(D_)}))}getAllUnreadMentionedCount(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_ALL_UNREAD_MENTIONED_COUNT_T,"",e);const t=yield this.validateLogin().next((()=>this._engine.chat.getAllUnreadMentionedCount()));return this.logger.summary(r.A_GET_ALL_UNREAD_MENTIONED_COUNT_R,t,e),t}))}getUltraGroupMessageListByMessageUId(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),n=s instanceof Array?s.map((e=>null==e?void 0:e.messageUId)):[],o=null==e?void 0:e.conversationType,a=null==e?void 0:e.targetId,l=null==e?void 0:e.channelId;this.logger.info(r.A_GET_UG_MSGS_BY_UID_T,JSON.stringify({conversationType:o,targetId:a,channelId:l,messageUIds:n}),t);const c=yield Ii.create("getUltraGroupMessageListByMessageUId").check((t=>f_(t,e,k))).isTypedArray("messages",s,(e=>pt(null==e?void 0:e.messageUId)),!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("messages",null==s?void 0:s.length,1,20,!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateConnected).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getRemoteMessagesByUIds(t,s.map((e=>e.messageUId)))}));return this.logger.summary(r.A_GET_UG_MSGS_BY_UID_R,c,t,c.isOk?{list:c.data.map((e=>e.messageUId))}:void 0),c.trans((e=>{const t={};return e.forEach((e=>{t[e.messageUId]=e})),t}))}))}getUGUnreadCountForAllChannels(e,i,s){return t(this,void 0,void 0,(function*(){const n=this.logger.createTraceId();this.logger.info(r.A_GET_UG_UNREAD_COUNT_FOR_ALL_CHANNELS_T,JSON.stringify({targetId:e,levels:s,isGetMentioned:i}),n);const o=yield Ii.create("getUGUnreadCountForAllChannels").validate("targetId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).check((e=>{e.isTypedArray("levels",s,(t=>!e.isNumberEnum("",t,Ee,!0).isFailed))})).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){return this._engine.chat.ugSynced?this._engine.chat.getUGUnreadCountForAllChannels(e,s||[],i):Ei(D.METHOD_NOT_AVAILABLE)}))));return this.logger.summary(r.A_GET_UG_UNREAD_COUNT_FOR_ALL_CHANNELS_R,o,n),o}))}getUGUnreadMentionedDigest(e){return t(this,void 0,void 0,(function*(){const t=null==e?void 0:e.targetId,i=null==e?void 0:e.channelId,s=null==e?void 0:e.sentTime,n=null==e?void 0:e.count,o=this.logger.createTraceId();this.logger.info(r.A_GET_UG_UNREAD_MENTIONED_DIGEST_T,JSON.stringify({targetId:t,channelId:i,sentTime:s,count:n}),o);const a=yield Ii.create("getUGUnreadMentionedDigest").validate("targetId",t,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("channelId",i,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).isLimitedInteger("count",n,1,50,!0).fail(D.INVALID_PARAMETER_COUNT).isLimitedInteger("sentTime",s,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateConnected).next((()=>(e.channelId=this._channelIdConvert(w.ULTRA_GROUP,i),this._engine.chat.getUGUnreadMentionedDigest(e))));return this.logger.summary(r.A_GET_UG_UNREAD_MENTIONED_DIGEST_R,a,o,void 0,(e=>({size:e.length}))),a}))}getUGFirstUnreadMessageDigest(e){return t(this,void 0,void 0,(function*(){const s=this.logger.createTraceId();this.logger.info(r.A_GET_UG_FIRST_UNREAD_MSG_DIGEST_T,JSON.stringify(e),s);const n=yield Ii.create("getUGFirstUnreadMessageDigest").validate("targetId",null==e?void 0:e.targetId,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("channelId",null==e?void 0:e.channelId,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateConnected).next((()=>t(this,void 0,void 0,(function*(){if(!this._engine.chat.ugSynced)return Ei(D.METHOD_NOT_AVAILABLE);const t=i(this,Bf,"m",Yf).call(this,Object.assign(Object.assign({},e),{conversationType:w.ULTRA_GROUP}));return this._engine.chat.getUGFirstUnreadMessageDigest(t)}))));return this.logger.summary(r.A_GET_UG_FIRST_UNREAD_MSG_DIGEST_R,n,s),n}))}getUGUnreadInfoList(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_UG_UNREAD_INFO_LIST_T,JSON.stringify({targetIds:e}),i);const s=yield Ii.create("getUGUnreadInfoList").isLimitedTypedArray("targetIds",e,20,(e=>Ut(e)),!0,1).fail(D.INVALID_PARAMETER_TARGET_ID).result().tryTrans(this.validateLogin).next((()=>t(this,void 0,void 0,(function*(){if(!this._engine.chat.ugSynced)return Ei(D.METHOD_NOT_AVAILABLE);const t=new Set(e);return this._engine.chat.getUGUnreadInfoList(Array.from(t))}))));return this.logger.summary(r.A_GET_UG_UNREAD_INFO_LIST_R,s,i,void 0,(e=>({size:e.length}))),s}))}getOSInfo(){return this._engine.getOSInfo()}getProcessInfo(){return this._engine.getProcessInfo()}getMainProcessInfo(){return this._engine.getMainProcessInfo()}setCallInfo(e,t,i){return this.validateConnected().next((()=>this._engine.setCallInfo(e,t,i)))}_validateSubDriven(e,t){const{subDriven:i=0}=e;switch(t){case oe.ONLINE_STATUS:return 1&i?gi(e):Ei(D.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE);case oe.USER_PROFILE:return 2&i?gi(e):Ei(D.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE);default:return Ei(D.INVALID_PARAMETER_SUBSCRIBE_TYPE)}}subscribeUser(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SUBSCRIBE_USER_STATUS_T,JSON.stringify({userIds:e,subscribeType:i,expiry:s}),t);const n=yield Ii.create("subscribeUser").isLimitedTypedArray("userIds",e,200,Ut,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS).isNumberEnum("subscribeType",i,oe,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_TYPE).isLimitedInteger("expiry",s,60,2592e3,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_EXPIRY).result().tryTrans(this.validateConnected).tryTrans((e=>this._validateSubDriven(e,i))).next((()=>this._engine.subscribeUser(e,i,s)));return this.logger.summary(r.A_SUBSCRIBE_USER_STATUS_R,n,t),n}))}unSubscribeUser(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UNSUBSCRIBE_USER_STATUS_T,JSON.stringify({userIds:e,subscribeType:i}),t);const s=yield Ii.create("unSubscribeUser").isLimitedTypedArray("userIds",e,200,Ut,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS).isNumberEnum("subscribeType",i,oe,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_TYPE).result().tryTrans(this.validateConnected).tryTrans((e=>this._validateSubDriven(e,i))).next((()=>this._engine.unSubscribeUser(e,i)));return this.logger.summary(r.A_UNSUBSCRIBE_USER_STATUS_R,s,t),s}))}getSubscribeUserList(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_SUBSCRIBE_USER_STATUS_LIST_T,JSON.stringify({subscribeType:e,count:i,offset:s}),t);const n=yield Ii.create("getSubscribeUserList").isNumberEnum("subscribeType",e,oe,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_TYPE).isLimitedInteger("count",i,1,200,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE).isLimitedInteger("offset",s,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_OFFSET).result().tryTrans(this.validateConnected).tryTrans((t=>this._validateSubDriven(t,e))).next((()=>this._engine.getSubscribeUserList(e,i,s)));return this.logger.summary(r.A_GET_SUBSCRIBE_USER_STATUS_LIST_R,n,t,void 0,(e=>({size:e.length}))),n}))}getSubscribeUserStatus(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_SUB_USERS_STATUS_T,JSON.stringify({subscribeType:e,userIds:i}),t);const s=yield Ii.create("getSubscribeUserStatus").isNumberEnum("subscribeType",e,oe,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_TYPE).isLimitedTypedArray("userIds",i,200,Ut,!0).fail(D.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS).result().tryTrans(this.validateConnected).tryTrans((t=>this._validateSubDriven(t,e))).next((()=>this._engine.getSubscribeUserStatus(e,i)));return this.logger.summary(r.A_GET_SUB_USERS_STATUS_R,s,t,void 0,(e=>({size:e.length}))),s}))}getSubscribeUsersOnlineStatus(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_SUB_USERS_ONLINE_STATUS_T,JSON.stringify({userIds:e}),t);const i=yield Ii.create("getSubscribeUsersOnlineStatus").isLimitedTypedArray("userIds",e,200,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateConnected).next((()=>this._engine.getSubscribeUsersOnlineStatus(e)));return this.logger.summary(r.A_GET_SUB_USERS_ONLINE_STATUS_R,i,t,void 0,(e=>({size:e.length}))),i}))}updateMyUserProfile(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_UPDATE_MY_USER_PROFILE_T,JSON.stringify({profile:e}),t);const i=yield Ii.create("updateMyUserProfile").isObject("profile",e,!0).check((t=>{const{name:i,portraitUri:s,email:n,birthday:r,gender:o,location:a,role:l,level:c,extraProfile:_}=e;t.isString("name",i).isString("portraitUri",s).isString("email",n).isString("birthday",r).isNumber("gender",o).isString("location",a).isNumber("role",l).isNumber("level",c).isObject("extraProfile",_),!t.isFailed&&_&&Object.entries(_).forEach((([e,i])=>{t.isString("extraProfile",i,!0)}))})).fail(D.INVALID_PARAMETER_USER_PROFILE).result().tryTrans(this.validateConnected).tryTrans((e=>this._validateUserProfile(e))).next((()=>{const t={};return["name","portraitUri","email","birthday","gender","location","role","level"].forEach((i=>{const s=e[i];void 0!==s&&(t[i]=s)})),e.extraProfile&&(t.extraProfile=Object.assign({},e.extraProfile)),this._engine.updateMyUserProfile(t)}));return this.logger.summary(r.A_UPDATE_MY_USER_PROFILE_R,i,t),i}))}getUserProfiles(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_USER_PROFILES_T,JSON.stringify({userIds:e}),t);const i=yield Ii.create("getUserProfiles").isLimitedTypedArray("userIds",e,100,Ut,!0).fail(D.INVALID_PARAMETER_USERIDLIST).result().tryTrans(this.validateLogin).tryTrans((e=>this._validateUserProfile(e))).next((()=>this._engine.getUserProfiles(e)));return this.logger.summary(r.A_GET_USER_PROFILES_R,i,t,void 0,(e=>({size:e.length}))),i}))}getMyUserProfile(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_MY_USER_PROFILE_T,void 0,e);const t=yield Ii.create("getMyUserProfile").result().tryTrans(this.validateConnected).tryTrans((e=>this._validateUserProfile(e))).next((()=>this._engine.getMyUserProfile()));return this.logger.summary(r.A_GET_MY_USER_PROFILE_R,t,e),t}))}clearConversations(e,i){return t(this,void 0,void 0,(function*(){return this._engine.chat.clearConversations(e,i)}))}addToBlacklist(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_ADD_TO_BLACKLIST_T,JSON.stringify({userId:e}),t);const i=yield Ii.create("addToBlacklist").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).next((()=>this._engine.addToBlacklist(e)));return this.logger.summary(r.A_ADD_TO_BLACKLIST_R,i,t),i}))}removeFromBlacklist(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_FROM_BLACKLIST_T,JSON.stringify({userId:e}),t);const i=yield Ii.create("removeFromBlacklist").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).next((()=>this._engine.removeFromBlacklist(e)));return this.logger.summary(r.A_REMOVE_FROM_BLACKLIST_R,i,t),i}))}getBlacklist(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_BLACKLIST_T,void 0,e);const t=yield Ii.create("getBlacklist").result().tryTrans(this.validateConnected).next((()=>this._engine.getBlacklist()));return this.logger.summary(r.A_GET_BLACKLIST_R,t,e,void 0,(e=>({size:e.length}))),t}))}getBlacklistStatus(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_BLACKLIST_STATUS_T,JSON.stringify({userId:e}),t);const i=yield Ii.create("getBlacklistStatus").validate("userId",e,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans(this.validateConnected).next((()=>this._engine.getBlacklistStatus(e)));return this.logger.summary(r.A_GET_BLACKLIST_STATUS_R,i,t),i}))}insertMessage(e,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_INSERT_MSG_T,JSON.stringify({conversation:e,params:s}),t);const n=yield Ii.create("insertMessage").check((t=>f_(t,e,F))).validate("senderUserId",s.senderUserId,Ut,!0).fail(D.INVALID_PARAMETER_USER_ID).isObject("content",s.content,!0).fail(D.INVALID_PARAMETER_MESSAGE_CONTENT).check((e=>{const t=I_(s.messageType,s.content);t.isOk||e.setFailed(t.code)})).isNotEmptyString("messageType",s.messageType,!0).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).isNumberEnum("messageDirection",s.messageDirection,ue,!0).fail(D.INVALID_MESSAGE_DIRECTION).check((e=>{s.canIncludeExpansion&&s.expansion&&A_(e,s.expansion,!0)})).isTimestamp("sentTime",s.sentTime).fail(D.INVALID_PARAMETER_TIMESTAMP).isNumberEnum("sentStatus",s.sentStatus,ie).fail(D.INVALID_PARAMETER_SENT_STATUS).isTypedArray("directedUserIds",s.directedUserIds,Ut).fail(D.INVALID_PARAMETER_USERIDLIST).isString("searchContent",s.searchContent).fail(D.SEARCH_PROPS_LIMIT_ERROR).check((e=>{const{quoteInfo:t}=s;t&&e.isObject("quoteInfo",t,!0).isNotEmptyString("quoteInfo.messageUId",t.messageUId,!0).isNotEmptyString("quoteInfo.senderId",t.senderId,!0).isNotEmptyString("quoteInfo.objectName",t.objectName,!0).isNumberEnum("quoteInfo.quoteMessageStatus",t.quoteMessageStatus,Pe).fail(D.INVALID_PARAMETER_QUOTE_INFO)})).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.insertMessage(t,s)}));return this.logger.summary(r.A_INSERT_MSG_R,n,t),n}))}batchInsertMessage(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_INSERT_MSGS_T,JSON.stringify({count:null==e?void 0:e.length,checkDuplicate:i}),t);const s=Ii.create(""),n=yield Ii.create("batchInsertMessage").isLimitedTypedArray("messages",e,500,(e=>"object"==typeof e&&(f_(s,e,F),s.validate("senderUserId",e.senderUserId,Ut,!0).isNotEmptyString("messageType",e.messageType,!0).isObject("content",e.content,!0).isNumberEnum("messageDirection",e.messageDirection,ue,!0).check((t=>{e.canIncludeExpansion&&e.expansion&&A_(t,e.expansion,!0)})).isTimestamp("sentTime",e.sentTime).isNumberEnum("sentStatus",e.sentStatus,ie).isString("searchContent",e.searchContent).isNumber("receivedStatus",e.receivedStatus).isObject("receivedStatusInfo",e.receivedStatusInfo).isTypedArray("directedUserIds",e.directedUserIds,Ut).check((t=>{const{quoteInfo:i}=e;i&&t.isObject("quoteInfo",i,!0).isNotEmptyString("quoteInfo.messageUId",i.messageUId,!0).isNotEmptyString("quoteInfo.senderId",i.senderId,!0).isNotEmptyString("quoteInfo.objectName",i.objectName,!0).isNumberEnum("quoteInfo.quoteMessageStatus",i.quoteMessageStatus,Pe).fail(D.INVALID_PARAMETER_QUOTE_INFO)})),!s.isFailed)),!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateLogin).next((()=>{const t=e.map((e=>Object.assign(Object.assign({},e),{channelId:this._channelIdConvert(e.conversationType,e.channelId)})));return this._engine.batchInsertMessage(t,i)}));return this.logger.summary(r.A_BATCH_INSERT_MSGS_R,n,t),n}))}getLocalMessageCount(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_LOCAL_MSG_COUNT_T,JSON.stringify({conversation:e}),t);const s=yield Ii.create("getMessageCount").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.getLocalMessageCount(t)}));return this.logger.summary(r.A_GET_LOCAL_MSG_COUNT_R,s,t),s}))}deleteLocalMessages(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DELETE_LOCAL_MSGS_T,JSON.stringify({messageIds:e}),t);const i=yield Ii.create("deleteLocalMessages").isTypedArray("messageIds",e,(e=>Number.isInteger(e)),!0).fail(D.INVALID_PARAMETER_MESSAGE_ARRAY).result().tryTrans(this.validateLogin).next((()=>this._engine.deleteLocalMessages(e)));return this.logger.summary(r.A_DELETE_LOCAL_MSGS_R,i,t),i}))}deleteLocalMessagesByTimestamp(e,s,n){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DEL_LOCAL_MSGS_BY_TIME_T,JSON.stringify({conversation:e,timestamp:s,cleanSpace:n}),t);const o=yield Ii.create("deleteLocalMessagesByTimestamp").check((t=>f_(t,e,F))).isTimestamp("timestamp",s,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.deleteLocalMessagesByTimestamp(t,s,!!n)}));return this.logger.summary(r.A_DEL_LOCAL_MSGS_BY_TIME_R,o,t),o}))}batchClearLocalMessagesByTimestamp(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_CLEAR_LOCAL_MSGS_BY_TIME_T,JSON.stringify({options:e}),t);const i=yield Ii.create("batchClearLocalMessagesByTimestamp").check((t=>{t.isLimitedTypedArray("options",e,20,(e=>(f_(t,e,k),!t.isFailed&&ft({min:0})(e.timestamp)))).fail(D.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST)})).result().tryTrans(this.validateLogin).next((()=>{const t=e.map((e=>Object.assign(Object.assign({},e),{channelId:this._channelIdConvert(e.conversationType,e.channelId)})));return this._engine.batchClearLocalMessagesByTimestamp(t)}));return this.logger.summary(r.A_BATCH_CLEAR_LOCAL_MSGS_BY_TIME_R,i,t),i}))}batchClearRemoteHistoryMessages(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_CLEAR_REMOTE_MSG_T,JSON.stringify({options:e,isDeleteLocal:i}),t);const s=yield Ii.create("batchClearRemoteHistoryMessages").isLimitedArray("options",e,20,!0,1).check((t=>{e.forEach((e=>{f_(t,e,k).isTimestamp("timestamp",null==e?void 0:e.timestamp)}))})).fail(D.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST,void 0,!0).check((t=>{e.some((e=>e.conversationType===w.ULTRA_GROUP))&&t.setFailed(D.CONVERSATION_TYPE_NOT_SUPPORT)})).result().tryTrans(this.validateConnected).next((()=>this._engine.chat.batchClearRemoteHistoryMessages(e,!!i)));return this.logger.summary(r.A_BATCH_CLEAR_REMOTE_MSG_R,s,t),s}))}clearLocalMessages(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CLEAR_LOCAL_MSG_T,JSON.stringify({conversation:e}),t);const i=yield Ii.create("clearLocalMessages").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>this._engine.clearLocalMessages(e)));return this.logger.summary(r.A_CLEAR_LOCAL_MSG_R,i,t),i}))}getLocalMessage(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_LOCAL_MESSAGE_T,JSON.stringify({messageId:e}),t);const i=Ii.create("getLocalMessage").validate("messageId",e,(()=>pt(e)||Tt(e)),!0).fail(D.INVALID_PARAMETER_MESSAGE_ID).result(),s=yield i.next((()=>this._engine.getMessage(e)));return this.logger.summary(r.A_GET_LOCAL_MESSAGE_R,s,t,{messageId:e}),s}))}_innerSetMessageContent(e,i,s){return t(this,void 0,void 0,(function*(){return this._engine.setMessageContent(e,i,s)}))}setMessageContent(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_MSG_CONTENT_T,JSON.stringify({messageId:e,messageType:s}),t);const n=yield Ii.create("setMessageContent").isInteger("messageId",e,!0).fail(D.INVALID_PARAMETER_MESSAGE_ID).isNotEmptyString("messageType",s,!0).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).isObject("content",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_CONTENT).result().tryTrans(this.validateLogin).next((()=>{const t=JSON.stringify(i);return this._innerSetMessageContent(e,t,s)}));return this.logger.summary(r.A_SET_MSG_CONTENT_R,n,t),n}))}setMessageSearchField(e,i,s){return t(this,void 0,void 0,(function*(){return this._engine.setMessageSearchField(e,i,s)}))}setMessageSentStatus(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_E_SET_MSG_SENT_STATUS_T,JSON.stringify({messageId:e,sentStatus:i}),t);const s=yield Ii.create("setMessageSentStatus").isInteger("messageId",e,!0).fail(D.INVALID_PARAMETER_MESSAGE_ID).isNumberEnum("sentStatus",i,ie,!0).fail(D.INVALID_PARAMETER_SENT_STATUS).result().tryTrans(this.validateLogin).next((()=>this._engine.setMessageSentStatus(e,i)));return this.logger.summary(r.A_E_SET_MSG_SENT_STATUS_R,s,t),s}))}setMessageReceivedStatus(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_E_SET_MSG_RECEIVED_STATUS_T,JSON.stringify({messageId:e,receivedStatus:i}),t);const s=yield Ii.create("setMessageReceivedStatus").isInteger("messageId",e,!0).fail(D.INVALID_PARAMETER_MESSAGE_ID).isInteger("receivedStatus",i,!0).fail(D.INVALID_PARAMETER_RECEIVED_STATUS).result().tryTrans(this.validateLogin).next((()=>this._engine.setMessageReceivedStatus(e,i)));return this.logger.summary(r.A_E_SET_MSG_RECEIVED_STATUS_R,s,t),s}))}setMessageStatusToRead(e,i){return t(this,void 0,void 0,(function*(){const t=T_("setMessageStatusToRead",e,G).isNumber("timestamp",i,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateLogin);if(!t.isOk)return t.wipe();const s=this.logger.createTraceId(),{conversationType:n,targetId:o,channelId:a}=e;this.logger.info(r.A_E_SET_MESSAGE_STATUS_TO_READ_T,JSON.stringify({conversation:e,timestamp:i}),s);const l=yield this._engine.updateMessageReceiptStatus(n,o,i,a);return this.logger.summary(r.A_E_SET_MESSAGE_STATUS_TO_READ_R,l,s),l}))}setUserStatus(e){return t(this,void 0,void 0,(function*(){return this._engine.setUserStatus(e)}))}getUserStatus(e){return t(this,void 0,void 0,(function*(){return this._engine.getUserStatus(e)}))}searchConversationByContent(e,i,s,n){return t(this,void 0,void 0,(function*(){const t=Ii.create("searchConversationByContent").isNotEmptyString("keyword",e,!0).fail(D.INVALID_PARAMETER_KEYWORD).isTypedArray("messageTypes",i,(e=>pt(e))).fail(D.INVALID_PARAMETER_MESSAGE_TYPE).validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).isTypedArray("conversationTypes",n,(e=>W(e,k))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).result().tryTrans(this.validateLogin);if(!t.isOk)return t.wipe();const o=this.logger.createTraceId();this.logger.info(r.A_E_SEARCH_CONVERSATION_BY_CONTENT_T,JSON.stringify({keyword:e,messageTypes:i,channelId:s,conversationTypes:n}),o);const a=yield this._engine.chat.searchConversationByContent(e,i&&0!==i.length?i:[Q.TEXT,Q.FILE],s||"",n&&0!==n.length?n:Y(k));return this.logger.summary(r.A_E_SEARCH_CONVERSATION_BY_CONTENT_R,a,o,void 0,(e=>({size:e.length}))),a}))}searchConversationByContentWithAllChannel(e,i,s){return t(this,void 0,void 0,(function*(){return this._engine.searchConversationByContentWithAllChannel(e,i&&0!==i.length?i:[Q.TEXT,Q.FILE],s&&0!==s.length?s:Y(k))}))}searchMessages(e,s){var n,r;return t(this,void 0,void 0,(function*(){const t=T_("searchMessages",e,F).isLimitedString("keyword",null==s?void 0:s.keyword,0,1e3,!0).fail(D.INVALID_PARAMETER_KEYWORD).isLimitedInteger("limit",null==s?void 0:s.limit,1,lt,!0).fail(D.INVALID_PARAMETER_LIMIT).isLimitedInteger("offset",null==s?void 0:s.offset,0,lt).fail(D.INVALID_PARAMETER_OFFSET).isLimitedInteger("order",null==s?void 0:s.order,0,1,!0).fail(D.INVALID_PARAMETER_ORDER).isObject("timeRange",s.timeRange).validate("timeRange",s.timeRange,(e=>{let{startTime:t,endTime:i}=e;return!t&&!i||!(t&&!Tt(t)||i&&!Tt(i))&&(t=null!=t?t:0,i=null!=i?i:Date.now(),t>=0&&t<=i)})).fail(D.INVALID_PARAMETER_TIMESTAMP).isTypedArray("objectNames",null===(n=null==s?void 0:s.messageFilter)||void 0===n?void 0:n.objectNames,(e=>"string"==typeof e&&e.length>0&&e.length<=128)).fail(D.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST).isTypedArray("senderIds",null===(r=null==s?void 0:s.messageFilter)||void 0===r?void 0:r.senderIds,Ut).fail(D.INVALID_PARAMETER_USER_ID).result().tryTrans((()=>wt()?gi():Ei(D.NOT_SUPPORT,"Only support electron platform."))).tryTrans(this.validateLogin);if(!t.isOk)return t.wipe();const o=i(this,Bf,"m",Yf).call(this,e);return(yield i(this,Bf,"m",Kf).call(this,Object.assign(Object.assign({},s),{conversationFilter:{conversationTypes:[o.conversationType],targetIds:[o.targetId],channelIds:"string"==typeof o.channelId?[o.channelId]:[]}}))).orSync((()=>gi({messages:[],totalMatched:0,conditionsMatched:0})))}))}searchMessagesWithParams(e){var s,n,r,o,a,l;return t(this,void 0,void 0,(function*(){const t=Ii.create("searchMessagesWithParams").isObject("params",e,!0).fail(D.BIZ_ERROR_INVALID_PARAMETER).isLimitedString("keyword",null==e?void 0:e.keyword,0,1e3).fail(D.INVALID_PARAMETER_KEYWORD).isLimitedInteger("limit",null==e?void 0:e.limit,1,lt,!0).fail(D.INVALID_PARAMETER_LIMIT).isLimitedInteger("offset",null==e?void 0:e.offset,0,lt).fail(D.INVALID_PARAMETER_OFFSET).isLimitedInteger("order",null==e?void 0:e.order,0,1,!0).fail(D.INVALID_PARAMETER_ORDER).isObject("timeRange",null==e?void 0:e.timeRange).validate("timeRange",null==e?void 0:e.timeRange,(e=>{let{startTime:t,endTime:i}=e;return!t&&!i||!(t&&!Tt(t)||i&&!Tt(i))&&(t=null!=t?t:0,i=null!=i?i:Date.now(),t>=0&&t<=i)})).fail(D.INVALID_PARAMETER_TIMESTAMP).isTypedArray("conversationTypes",null===(s=null==e?void 0:e.conversationFilter)||void 0===s?void 0:s.conversationTypes,(e=>W(e,F))).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).isLimitedTypedArray("targetIds",null===(n=null==e?void 0:e.conversationFilter)||void 0===n?void 0:n.targetIds,20,Ut,!1,0).fail(D.INVALID_PARAMETER_TARGETID_LIST).isLimitedTypedArray("channelIds",null===(r=null==e?void 0:e.conversationFilter)||void 0===r?void 0:r.channelIds,10,bt,!1,0).fail(D.INVALID_PARAMETER_CHANNEL_ID).isLimitedTypedArray("senderIds",null===(o=null==e?void 0:e.messageFilter)||void 0===o?void 0:o.senderIds,20,Ut,!1,0).fail(D.INVALID_PARAMETER_USERIDLIST).isTypedArray("objectNames",null===(a=null==e?void 0:e.messageFilter)||void 0===a?void 0:a.objectNames,(e=>"string"==typeof e&&e.length>0&&e.length<=128)).fail(D.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST).result().tryTrans(this.validateLogin);return t.isOk?(e.limit=Math.min(e.limit,100),(null===(l=e.messageFilter)||void 0===l?void 0:l.objectNames)&&e.messageFilter.objectNames.length>300&&(e.messageFilter.objectNames=e.messageFilter.objectNames.slice(0,300)),i(this,Bf,"m",Kf).call(this,e)):t.wipe()}))}getMessagesAroundTimestamp(e,s,n,o){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_MSGS_AROUND_TIMESTAMP_T,JSON.stringify({conversation:e,timestamp:s,beforeCount:n,afterCount:o}),t);const a=yield Ii.create("getMessagesAroundTimestamp").check((t=>f_(t,e,F))).isLimitedInteger("timestamp",s,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("beforeCount",n,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_BEFORE).isLimitedInteger("afterCount",o,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_AFTER).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getMessagesAroundTimestamp(t,s,n,o)}));return this.logger.summary(r.A_GET_MSGS_AROUND_TIMESTAMP_R,a,t,void 0,(e=>({size:e.length}))),a}))}getUnreadMentionedMessages(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_MENTIONED_MSGS_T,JSON.stringify(e),t);const s=yield Ii.create("getUnreadMentionedMessages").check((t=>f_(t,e,F))).result().tryTrans(this.validateLogin).next((()=>{const t=i(this,Bf,"m",Yf).call(this,e);return this._engine.chat.getUnreadMentionedMessages(t)}));return this.logger.summary(r.A_GET_UNREAD_MENTIONED_MSGS_R,s,t,void 0,(e=>({size:e.length}))),s}))}getUltraGroupDefaultNotificationLevel(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_UG_DEFAULT_NTF_LEVEL_T,JSON.stringify({targetId:e,channelId:i}),t);const s=yield Ii.create("getUltraGroupDefaultNotificationLevel").validate("targetId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("channelId",i,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).result().tryTrans(this.validateConnected).next((()=>{const t="string"==typeof i?this._channelIdConvert(w.ULTRA_GROUP,i):i;return this._engine.chat.getUGDefaultNotificationLevel(e,t)}));return this.logger.summary(r.A_GET_UG_DEFAULT_NTF_LEVEL_R,s,t),s}))}setUltraGroupDefaultNotificationLevel(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_UG_DEFAULT_NTF_LEVEL_T,JSON.stringify({targetId:e,notificationLevel:i,channelId:s}),t);const n=yield Ii.create("setUltraGroupDefaultNotificationLevel").validate("targetId",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).validate("channelId",s,bt).fail(D.INVALID_PARAMETER_CHANNEL_ID).isNumberEnum("notificationLevel",i,Ee,!0).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateConnected).next((()=>{const t="string"==typeof s?this._channelIdConvert(w.ULTRA_GROUP,s):s;return this._engine.chat.setUGDefaultNotificationLevel(e,i,t)}));return this.logger.summary(r.A_SET_UG_DEFAULT_NTF_LEVEL_R,n,t),n}))}getConversationNotificationLevel(e){return t(this,void 0,void 0,(function*(){const t=T_("getConversationNotificationLevel",e,k).result();return t.isOk?this._engine.chat.getConversationNotificationLevel(i(this,Bf,"m",Yf).call(this,e)):t.wipe()}))}setConversationTypeNotificationLevel(e,i){return t(this,void 0,void 0,(function*(){const t=Ii.create("setConversationTypeNotificationLevel").validate("conversationType",e,(()=>W(e,k)),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE).isNumberEnum("level",i,Ee,!0).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateConnected);return t.isOk?this._engine.chat.setConversationTypeNotificationLevel(e,i):t.wipe()}))}getConversationTypeNotificationLevel(e){return t(this,void 0,void 0,(function*(){const t=Ii.create("getConversationTypeNotificationLevel").validate("conversationType",e,(()=>W(e,k)),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE).result().tryTrans(this.validateConnected);return t.isOk?this._engine.chat.getConversationTypeNotificationLevel(e):t.wipe()}))}getRemoteHistoryMessages(e,s){return t(this,void 0,void 0,(function*(){const t=null==s?void 0:s.timestamp,n=null==s?void 0:s.count,o=null==s?void 0:s.order,a=this.logger.createTraceId();this.logger.info(r.A_GET_REMOTE_HISTORY_MSG_T,JSON.stringify({conversation:e,options:s}),a);const l=yield Ii.create("getRemoteHistoryMessages").check((t=>f_(t,e,x))).isLimitedInteger("timestamp",t,0,Number.MAX_SAFE_INTEGER).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("order",o,0,1).fail(D.INVALID_PARAMETER_ORDER).isLimitedInteger("count",n,1,100).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).next((()=>{const s={timestamp:t||0,count:n||20,order:o||0,messageType:""},r=i(this,Bf,"m",Yf).call(this,e);return this._engine.getHistoryMessage(r,s,!1)}));return this.logger.summary(r.A_GET_REMOTE_HISTORY_MSG_R,l,a,void 0,(({list:e})=>({size:e.length}))),l}))}clearLocalData(){return this.logger.info(r.A_CLEAR_LOCAL_CACHE_O),this._engine.clearLocalData()}createLogger(e,t){return this._engine.createLogger(e,t)}getConversations(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_CONVERSATIONS_T,JSON.stringify({identifiers:e}),t);const s=yield Ii.create("getConversations").check((t=>{t.isLimitedTypedArray("identifiers",e,100,(e=>!f_(t,e,F).isFailed),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST)})).result().tryTrans(this.validateLogin).next((()=>{const t=e.map((e=>i(this,Bf,"m",Yf).call(this,e)));return this._engine.chat.getConversations(t)}));return this.logger.summary(r.A_GET_CONVERSATIONS_R,s,t,void 0,(e=>({size:e.length}))),s}))}setCheckDuplicateMessage(e){return this._engine.setCheckDuplicateMessage(!!e)}rtcSignaling(e,i,s,n){return t(this,void 0,void 0,(function*(){return yield this.validateConnected().next((()=>this._engine.rtcSignaling(e,i,s,n)))}))}rtcPing(e,t,i){return this._engine.rtcPing(e,t,i)}setProxy(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_PROXY_T,JSON.stringify({proxy:e}),t);const i=yield Ii.create("setProxy").check((t=>p_(t,e))).result().next((()=>this._engine.setProxy(e)));return this.logger.summary(r.A_SET_PROXY_R,i,t),i}))}getProxy(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_PROXY_T,JSON.stringify({}),e);const t=yield this._engine.getProxy();return this.logger.summary(r.A_GET_PROXY_R,t,e),t}))}testProxy(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_TEST_PROXY_T,JSON.stringify({proxy:e,testHost:i}),t);const s=yield Ii.create("testProxy").check((t=>p_(t,e))).isString("testHost",i,!0).fail(D.INVALID_PARAMETER_TESTHOST).result().next((()=>this._engine.testProxy(e,i)));return this.logger.summary(r.A_TEST_PROXY_R,s,t),s}))}getRealtimeConversations(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_REALTIME_CONVERSATIONS_T,JSON.stringify({count:e,startTime:i,order:s}),t);const n=yield Ii.create("getRealtimeConversations").isLimitedInteger("count",e,1,50,!0).fail(D.INVALID_PARAMETER_COUNT).isTimestamp("startTime",i,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("order",s,0,1,!0).fail(D.INVALID_PARAMETER_ORDER).result().tryTrans(this.validateConnected).tryTrans(P_).next((()=>this._engine.chat.getRealtimeConversations(e,i,s)));return this.logger.summary(r.A_GET_REALTIME_CONVERSATIONS_R,n,t,void 0,(e=>({size:e.length}))),n}))}getRealtimeConTotalUnreadCount(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_REALTIM_CON_TOTAL_UNREAD_COUNT_T,"",e);const t=yield this.validateConnected().tryTrans(P_).next((()=>this._engine.chat.getRealtimeConTotalUnreadCount()));return this.logger.summary(r.A_GET_REALTIM_CON_TOTAL_UNREAD_COUNT_R,t,e),t}))}clearRealtimeConUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_CLEAR_REALTIME_CON_UNREAD_COUNT_T,JSON.stringify(e),t);const i=yield this.validateConnected().tryTrans(P_).next((()=>this._engine.chat.clearRealtimeConUnreadCount(e)));return this.logger.summary(r.A_CLEAR_REALTIME_CON_UNREAD_COUNT_R,i,t),i}))}removeRealtimeConversations(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REMOVE_REALTIME_CONVERSATIONS_T,JSON.stringify(e),t);const i=yield Ii.create("removeRealtimeConversations").check((t=>{t.isLimitedTypedArray("identifiers",e,20,(e=>!f_(t,e,F).isFailed),!0).fail(D.INVALID_PARAMETER_CONVERSATION_LIST)})).result().tryTrans(this.validateConnected).tryTrans(P_).next((()=>this._engine.chat.removeRealtimeConversations(e)));return this.logger.summary(r.A_REMOVE_REALTIME_CONVERSATIONS_R,i,t),i}))}batchGetRealtimeConUnreadCount(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_BATCH_GET_REALTIME_CON_UNREAD_COUNT_T,JSON.stringify(e),t);const i=yield Ii.create("batchGetRealtimeConUnreadCount").check((t=>{t.isLimitedTypedArray("identifiers",e,10,(e=>!f_(t,e,F).isFailed),!0).fail(D.INVALID_PARAMETER_CONVERSATION_LIST)})).result().tryTrans(this.validateConnected).tryTrans(P_).next((()=>this._engine.chat.batchGetRealtimeConUnreadCount(e)));return this.logger.summary(r.A_BATCH_GET_REALTIME_CON_UNREAD_COUNT_R,i,t,void 0,(e=>({size:e.length}))),i}))}setNotificationQuietHoursWithSetting(e){return Ii.create("setNotificationQuietHoursWithSetting").isObject("opts",e,!0).isString("timezone",e.timezone).fail(D.BIZ_ERROR_INVALID_PARAMETER).validate("startTime",e.startTime,(e=>/^\d{2}(:\d{2}){2}$/.test(e)),!0).fail(D.INVALID_PARAMETER_TIMESTRING).isLimitedNumber("spanMinutes",e.spanMinutes,1,1439,!0).fail(D.INVALID_PARAMETER_SPAN_MINUTES).isNumberEnum("level",e.level,ye,!0).fail(D.INVALID_PARAMETER_NOTIFICATION_LEVEL).result().tryTrans(this.validateConnected).next((()=>this._engine.setNotificationQuietHoursWithSetting(e)))}removeNotificationQuietHoursSetting(){return this.validateConnected().next((()=>this._engine.removeNotificationQuietHoursSetting()))}getNotificationQuietHoursSetting(){return this.validateConnected().next((()=>this._engine.getNotificationQuietHoursSetting()))}getStatsUrlList(){return this._engine.getStatsUrlList()}sendReadReceiptResponseV5(e,i){return t(this,void 0,void 0,(function*(){const t=T_("sendReadReceiptResponseV5",e,V).isTypedArray("messageUIdArray",i,(e=>Ut(e)),!0).fail(D.MSG_LIMIT_ERROR).isLimitedInteger("messageUIdArray",i.length,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).tryTrans((e=>4===e.grpRRVer?gi():Ei(D.READ_RECEIPT_ERROR)));return t.isOk?this._engine.chat.sendReadReceiptResponseV5(e,i):t.wipe()}))}getMessageReadReceiptInfoV5(e,i){return t(this,void 0,void 0,(function*(){const t=T_("getMessageReadReceiptInfoV5",e,V).isTypedArray("messageUIdArray",i,(e=>Ut(e)),!0).fail(D.MSG_LIMIT_ERROR).isLimitedInteger("messageUIdArray",i.length,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).tryTrans((e=>4===e.grpRRVer?gi():Ei(D.READ_RECEIPT_ERROR)));if(!t.isOk)return t.wipe();const s=i.map((t=>({identifier:e,messageUId:t})));return this._engine.chat.getMessageReadReceiptInfoV5ByIdentifiers(s)}))}getMessageReadReceiptInfoV5ByIdentifiers(e){return t(this,void 0,void 0,(function*(){const t=Ii.create(""),i=Ii.create("getMessageReadReceiptInfoV5ByIdentifiers").isTypedArray("identifiers",e,(e=>f_(t,e.identifier,V).isNotEmptyString("messageUId",e.messageUId,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().isOk),!0).fail(D.MSG_LIMIT_ERROR).isLimitedInteger("messageUIdArray",e.length,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).tryTrans((e=>4===e.grpRRVer?gi():Ei(D.READ_RECEIPT_ERROR)));return i.isOk?this._engine.chat.getMessageReadReceiptInfoV5ByIdentifiers(e):i.wipe()}))}getMessagesReadReceiptUsersByPageV5(e,i,s){return t(this,void 0,void 0,(function*(){const t=T_("getMessageReadReceiptInfoV5",e,V).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isObject("option",s,!0).fail(D.BIZ_ERROR_INVALID_PARAMETER,"option type error").isString("pageToken",s.pageToken).fail(D.INVALID_PARAMETER_PAGING_QUERY_OPTION).isLimitedInteger("pageCount",s.pageCount,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).tryTrans((e=>4===e.grpRRVer?gi():Ei(D.READ_RECEIPT_ERROR)));return t.isOk?(s.order=1!==s.order?0:1,s.readStatus=1!==s.readStatus?0:1,this._engine.chat.getMessagesReadReceiptUsersByPageV5(e,i,s)):t.wipe()}))}getMessagesReadReceiptByUsersV5(e,i,s){return t(this,void 0,void 0,(function*(){const t=T_("getMessagesReadReceiptByUsersV5",e,V).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isTypedArray("userList",s,(e=>Ut(e)),!0).fail(D.INVALID_PARAMETER_USER_ID).isLimitedInteger("userList",s.length,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).tryTrans((e=>4===e.grpRRVer?gi():Ei(D.READ_RECEIPT_ERROR)));return t.isOk?this._engine.chat.getMessagesReadReceiptByUsersV5(e,i,s):t.wipe()}))}requestSpeechToTextForMessage(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_REQUEST_SPEECH_TO_TEXT_FOR_MESSAGE_T,JSON.stringify({messageUId:e,option:i}),t);const s=yield Ii.create("requestSpeechToTextForMessage").isNotEmptyString("messageUId",e,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).result().tryTrans(this.validateConnected).tryTrans((e=>!!(1&(e.AIBusinessSub||0))?gi():Ei(D.SPEECH_TO_TEXT_DISABLE))).next((()=>this._engine.chat.requestSpeechToTextForMessage(e,i)));return this.logger.summary(r.A_REQUEST_SPEECH_TO_TEXT_FOR_MESSAGE_R,s,t),s}))}setMessageSpeechToTextVisible(e,i){return t(this,void 0,void 0,(function*(){return yield Ii.create("setMessageSpeechToTextVisible").isNumber("messageId",e,!0).fail(D.INVALID_PARAMETER_MESSAGE_ID).result().tryTrans(this.validateLogin).next((()=>this._engine.chat.setMessageSpeechToTextVisible(e,!!i)))}))}getUntaggedConversationListByPage(e,i,s){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_UNTAGGED_CONVERSATION_LIST_BY_PAGE_T,JSON.stringify({timestamp:e,count:i,topPriority:s}),t);const n=yield Ii.create("getUntaggedConversationListByPage").isLimitedInteger("timestamp",e,0,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).isInteger("count",i,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateLogin).next((()=>{const t=i<=0?20:Math.min(i,100);return this._engine.chat.getUntaggedConversationListByPage(e,t,!!s)}));return this.logger.summary(r.A_GET_UNTAGGED_CONVERSATION_LIST_BY_PAGE_R,n,t,void 0,(e=>({size:e.length}))),n}))}translateMessagesWithParams(e){var s;return t(this,void 0,void 0,(function*(){const t=wt(),n=yield Ii.create("translateMessagesWithParams").isTypedArray("list",null==e?void 0:e.list,(e=>e instanceof Os&&e.isValid(!t)),!0).fail(D.TRANSLATION_PARAMS_TYPE_INVALID).isLimitedInteger("list",null===(s=null==e?void 0:e.list)||void 0===s?void 0:s.length,1,10,!0).fail(D.TRANSLATION_PARAMS_LIST_INVALID).isNumberEnum("mode",null==e?void 0:e.mode,vs).fail(D.INVALID_PARAMETER_TRANSLATE_MODE).result().tryTrans(this.validateConnected);if(!n.isOk)return n.wipe();const{list:r,force:o,mode:a}=e;return i(this,Bf,"m",Qf).call(this,r,0,a,o)}))}translateTextsWithParams(e){var s;return t(this,void 0,void 0,(function*(){const t=yield Ii.create("translateTextsWithParams").isTypedArray("list",null==e?void 0:e.list,(e=>e instanceof ys&&e.isValid(!0)),!0).fail(D.TRANSLATION_PARAMS_TYPE_INVALID).isLimitedInteger("list",null===(s=null==e?void 0:e.list)||void 0===s?void 0:s.length,1,10,!0).fail(D.TRANSLATION_PARAMS_LIST_INVALID).isNumberEnum("mode",null==e?void 0:e.mode,vs).fail(D.INVALID_PARAMETER_TRANSLATE_MODE).result().tryTrans(this.validateConnected);if(!t.isOk)return t.wipe();const{list:n,mode:r}=e;return i(this,Bf,"m",Qf).call(this,n,1,r)}))}setTranslationLanguage(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_TRANSLATION_LANGUAGE_T,JSON.stringify({language:e}),t);const i=yield Ii.create("setTranslationLanguage").isLimitedString("language",e,1,Number.MAX_SAFE_INTEGER,!0).fail(D.INVALID_PARAMETER_LAUGUAGE).result().tryTrans(this.validateConnected).next((()=>this._engine.userSettings.setTranslationLanguage(e)));return this.logger.summary(r.A_SET_TRANSLATION_LANGUAGE_R,i,t),i}))}getTranslationLanguage(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_TRANSLATION_LANGUAGE_T,void 0,e);const t=yield this.validateLogin().next((()=>this._engine.userSettings.getTranslationLanguage()));return this.logger.summary(r.A_GET_TRANSLATION_LANGUAGE_R,t,e),t}))}setAutoTranslateEnabled(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_SET_AUTO_TRANSLATE_ENABLED_T,JSON.stringify({enabled:!!e}),t);const i=yield this.validateConnected().next((()=>this._engine.userSettings.setAutoTranslateEnabled(!!e)));return this.logger.summary(r.A_SET_AUTO_TRANSLATE_ENABLED_R,i,t),i}))}getAutoTranslateEnabled(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_AUTO_TRANSLATE_ENABLED_T,void 0,e);const t=yield this.validateLogin().next((()=>this._engine.userSettings.getAutoTranslateEnabled()));return this.logger.summary(r.A_GET_AUTO_TRANSLATE_ENABLED_R,t,e),t}))}modifyMessageWithParams(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),i=null==e?void 0:e.messageUId,s=null==e?void 0:e.messageContent;this.logger.info(r.A_MODIFY_MESSAGE_WITH_PARAMS_T,JSON.stringify({messageUId:i,conversation:null==e?void 0:e.conversation}),t);const n=yield Ii.create("modifyMessageWithParams").check((t=>f_(t,null==e?void 0:e.conversation,B))).isNotEmptyString("messageUId",i,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isObject("messageContent",s,!0).fail(D.INVALID_PARAMETER_MESSAGE_CONTENT).isLimitedInteger("messageContent",m_(JSON.stringify(s)),1,Fe,!0).fail(D.RC_MSG_CONTENT_EXCEED_LIMIT).result().tryTrans(this.validateConnected).next((()=>this._engine.chat.modifyMessageWithParams(e)));return this.logger.summary(r.A_MODIFY_MESSAGE_WITH_PARAMS_R,n,t),n}))}refreshReferenceMessageWithParams(e){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId(),i=null==e?void 0:e.messageUIds;this.logger.info(r.A_REFRESH_REFERENCE_MESSAGE_WITH_PARAMS_T,JSON.stringify({messageUIds:i}),t);const s=yield T_("refreshReferenceMessageWithParams",null==e?void 0:e.conversationIdentifier,B).isObject("params",e,!0).fail(D.BIZ_ERROR_INVALID_PARAMETER).isTypedArray("messageUIds",i,(e=>pt(e)),!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("messageUIds",null==i?void 0:i.length,1,20,!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateConnected).next((()=>this._engine.chat.refreshReferenceMessageWithParams(i,e.conversationIdentifier,e.remoteMessageBlock,e.localMessageBlock,e.messageInfoMap)));return this.logger.summary(r.A_REFRESH_REFERENCE_MESSAGE_WITH_PARAMS_R,s,t),s}))}syncRemoteConversations(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_SYNC_REMOTE_CONVERSATIONS_T,void 0,e);const t=yield this.validateConnected().next((()=>this._engine.chat.syncRemoteConversations()));return this.logger.summary(r.A_SYNC_REMOTE_CONVERSATIONS_R,t,e),t}))}deleteLocalUGMessagesForAllChannel(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_DEL_LOCAL_UG_MSGS_FOR_ALL_CHANNEL_T,JSON.stringify({targetId:e,timestamp:i}),t);const s=yield Ii.create("deleteLocalUGMessagesForAllChannel").isNotEmptyString("targetId",e,!0).fail(D.INVALID_PARAMETER_TARGET_ID).isTimestamp("timestamp",i,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).result().tryTrans(this.validateLogin).next((()=>this._engine.chat.deleteLocalUGMessagesForAllChannel(e,i)));return this.logger.summary(r.A_DEL_LOCAL_UG_MSGS_FOR_ALL_CHANNEL_R,s,t),s}))}getUnreadMentionMeConversationList(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_UNREAD_MENTION_ME_CONVERSATION_LIST_T,JSON.stringify({params:e}),i);const s=yield Ii.create("getUnreadMentionMeConversationList").isLimitedTypedArray("conversationTypes",null==e?void 0:e.conversationTypes,Number.MAX_SAFE_INTEGER,(e=>W(e,k)),!0).fail(D.INVALID_PARAMETER_CONVERSATION_TYPE_LIST).isTimestamp("timestamp",null==e?void 0:e.timestamp,!0).fail(D.INVALID_PARAMETER_TIMESTAMP).isLimitedInteger("count",null==e?void 0:e.count,1,100,!0).fail(D.INVALID_PARAMETER_COUNT).result().tryTrans(this.validateConnected).next((i=>t(this,void 0,void 0,(function*(){const t=jI(i);if(t){if(!this._engine.chat.ugSynced)return Ei(D.METHOD_NOT_AVAILABLE)}else if(e.conversationTypes=e.conversationTypes.filter((e=>e!==w.ULTRA_GROUP)),0===e.conversationTypes.length)return gi([]);return this._engine.chat.getUnreadMentionMeConversationList(e,t)}))));return this.logger.summary(r.A_GET_UNREAD_MENTION_ME_CONVERSATION_LIST_R,s,i,void 0,(e=>({size:e.length}))),s}))}getAllRobots(){return t(this,void 0,void 0,(function*(){const e=this.logger.createTraceId();this.logger.info(r.A_GET_ALL_ROBOTS_T,void 0,e);const t=yield this.validateConnected().next((()=>this._engine.getAllRobots()));return this.logger.summary(r.A_GET_ALL_ROBOTS_R,t,e,void 0,(e=>({size:e.length}))),t}))}getRobotById(e){return t(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.info(r.A_GET_ROBOT_BY_ID_T,JSON.stringify({id:e}),i);const s=yield Ii.create("getRobotById").validate("id",e,Ut,!0).fail(D.INVALID_PARAMETER_TARGET_ID).result().tryTrans(this.validateConnected).next((()=>t(this,void 0,void 0,(function*(){return this._engine.getAllRobots()})))),n=s.trans((t=>t.find((t=>t.robotId===e))||null));return this.logger.summary(r.A_GET_ROBOT_BY_ID_R,s,i,{id:e,robot:n.data}),n}))}getMessagesByUIds(e,i){return t(this,void 0,void 0,(function*(){const t=this.logger.createTraceId();this.logger.info(r.A_GET_MESSAGES_T,JSON.stringify({conversation:e,messageUIds:i}),t);const s=yield Ii.create("getMessages").check((t=>f_(t,e,k))).isTypedArray("messageUIds",i,pt,!0).fail(D.INVALID_PARAMETER_MESSAGE_UID).isLimitedInteger("messageUIds",null==i?void 0:i.length,1,20,!0).fail(D.MSG_LIMIT_ERROR).result().tryTrans(this.validateConnected).next((()=>{const t=Array.from(new Set(i));return this._engine.getMessagesByUIds(e,t)}));return this.logger.summary(r.A_GET_MESSAGES_R,s,t,void 0,(e=>{const t=Array.from(new Set(i)).filter((t=>!e.some((e=>e.messageUId===t))));return{size:e.length,missingMessageUIds:t}})),s}))}}Bf=new WeakSet,Hf=function(e,i,s){return t(this,void 0,void 0,(function*(){const n=yield Ii.create("connect").isNotEmptyString("token",e).fail(D.RC_CONN_TOKEN_INCORRECT).result().next((()=>t(this,void 0,void 0,(function*(){this._token=e;const t=yield Eo.getNetworkType();this._engine.setNetwork({status:!0,type:t},!0);const n=!!this._pluginInstanseMap.RCCallPlus;return this._engine.connect(e,i,n,s)}))));if(n.isOk){if(1!==this._engine.naviInfo.type){const e=dt.getInfo();this._engine.reportSDKInfo(e)}}return n}))},jf=function(e,i){return t(this,void 0,void 0,(function*(){return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},yield this._engine.disconnect(e,i),this._pluginContextQueue.forEach((e=>{if(e.ondisconnect)try{e.ondisconnect()}catch(e){this.logger.error(r.L_CALLBACK_E,null==e?void 0:e.stack)}})),Promise.resolve()}))},Yf=function(e){return Object.assign(Object.assign({},e),{channelId:this._channelIdConvert(e.conversationType,e.channelId)})},Wf=function(e,s,n,r){return t(this,void 0,void 0,(function*(){return yield Ii.create("sendMessage").check((t=>f_(t,e,F))).isObject("content",s.content,!0).fail(D.INVALID_PARAMETER_MESSAGE_CONTENT).check((e=>{const t=I_(s.messageType,s.content);t.isOk||e.setFailed(t.code)})).isNumber("messageId",s.messageId).fail(D.INVALID_PARAMETER_MESSAGE_ID).isBoolean("isStatusMessage",s.isStatusMessage).fail(D.INVALID_PARAMETER_IS_STATUS_MESSAGE).isBoolean("disableNotification",s.disableNotification).fail(D.INVALID_PARAMETER_DISABLE_NOTIFICATION).isString("pushContent",s.pushContent).fail(D.INVALID_PARAMETER_PUSH_CONTENT).isString("pushData",s.pushData).fail(D.INVALID_PARAMETER_PUSH_DATA).isObject("pushConfig",s.pushConfig).fail(D.INVALID_PARAMETER_PUSH_CONFIG).isBoolean("isVoipPush",s.isVoipPush).fail(D.INVALID_PARAMETER_IS_VOIP_PUSH).isBoolean("canIncludeExpansion",s.canIncludeExpansion).fail(D.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION).check((e=>{s.canIncludeExpansion&&s.expansion&&A_(e,s.expansion,!0)})).check((t=>{t.isBoolean("disableUpdateLastMessage",s.disableUpdateLastMessage).fail(D.INVALID_DISABLE_UPDATE_LAST_MESSAGE),t.isFailed||e.conversationType===w.ULTRA_GROUP&&s.disableUpdateLastMessage&&t.setFailed(D.INVALID_DISABLE_UPDATE_LAST_MESSAGE)})).check((t=>{if(!!t.isLimitedTypedArray("directionalUserIdList",s.directionalUserIdList,300,Ut,!1,0).fail(D.INVALID_PARAMETER_USERIDLIST).isFailed||!s.directionalUserIdList||0===s.directionalUserIdList.length)return;const{conversationType:i}=e;[w.GROUP,w.ULTRA_GROUP,w.APP_PUBLIC_SERVICE,w.PUBLIC_SERVICE].includes(i)||t.setFailed(D.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE)})).isBoolean("isMentioned",s.isMentioned).fail(D.INVALID_PARAMETER_IS_MENTIONED).check((e=>{if(!s.isMentioned)return void delete s.content.mentionedInfo;const t=s.content.mentionedInfo||{type:s.mentionedType,userIdList:s.mentionedUserIdList};!e.isNumberEnum("mentionedType",null==t?void 0:t.type,K,!0).fail(D.INVALID_PARAMETER_MENTIONED_TYPE).isTypedArray("mentionedUserIdList",null==t?void 0:t.userIdList,Ut,(null==t?void 0:t.type)===K.SINGAL).fail(D.INVALID_PARAMETER_USERIDLIST).isString("mentionedContent",null==t?void 0:t.mentionedContent).fail(D.INVALID_PARAMETER_MESSAGE_CONTENT).isFailed&&(s.content.mentionedInfo=t)})).check((e=>{const{quoteInfo:t}=s;t&&e.isObject("quoteInfo",t,!0).isNotEmptyString("quoteInfo.messageUId",t.messageUId,!0).isNotEmptyString("quoteInfo.senderId",t.senderId,!0).isNotEmptyString("quoteInfo.objectName",t.objectName,!0).isNumberEnum("quoteInfo.quoteMessageStatus",t.quoteMessageStatus,Pe).fail(D.INVALID_PARAMETER_QUOTE_INFO)})).result().tryTrans(this.validateConnected).tryTrans((t=>{if(!s.needReceipt)return gi(t);if(t.grpRRVer!==Ue.V5)return Ei(D.READ_RECEIPT_ERROR);const{conversationType:i}=e,{isPersited:n,isStatusMessage:r}=ms(s.messageType);return(i!==w.GROUP&&i!==w.PRIVATE||s.isStatusMessage||r||!n||i===w.GROUP&&s.directionalUserIdList&&s.directionalUserIdList.length>0)&&(s.needReceipt=!1),gi(t)})).tryTrans((t=>{const{conversationType:i}=e,{messageType:n}=s;if(i===w.SYSTEM&&n!==Q.SYNC_READ_STATUS)return Ei(D.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE);if(n===Q.STREAM_MESSAGE)return Ei(D.MESSAGE_NOT_SUPPORT_SENDING);if(n===Q.READ_RECEIPT_RESPONSE&&t.grpRRVer)return Ei(D.READ_RECEIPT_ERROR);const r=m_(JSON.stringify(s.content));if(r>Fe)return Ei(D.RC_MSG_CONTENT_EXCEED_LIMIT);const o=[Q.VOICE,Q.IMAGE,Q.LOCATION,Q.REFERENCE,Q.SIGHT,Q.COMBINE,Q.COMBINE_V2,Q.STREAM_MESSAGE],a=t.msgMaxLengthV2||0;return a&&!o.includes(n)&&r>a?Ei(D.RC_MSG_CONTENT_EXCEED_LIMIT):gi()})).next((()=>i(this,Bf,"m",qf).call(this,e,s,n,r)))}))},qf=function(e,t,s,n){const r=i(this,Bf,"m",Yf).call(this,e),{conversationType:o}=r;return o===w.ULTRA_GROUP?this._engine.sendUltraMessage(r,t,s,n):this._engine.sendMessage(r,t,s,n)},Jf=function(e,i,s){return t(this,void 0,void 0,(function*(){return(yield this._engine.sendMessage(e,{content:i,messageType:Q.EXPANSION_NOTIFY},s)).wipe()}))},Kf=function(e){return t(this,void 0,void 0,(function*(){const{startTime:t,endTime:i}=e.timeRange||{},s={startTime:null!=t?t:0,endTime:null!=i?i:Number.MAX_SAFE_INTEGER};e.timeRange=s;const n=this.logger.createTraceId();this.logger.info(r.A_SEARCH_MSGS_BY_PARAMS_T,JSON.stringify(e),n);const o=yield this._engine.searchMessagesWithParams(e);return this.logger.summary(r.A_SEARCH_MSGS_BY_PARAMS_R,o,n,void 0,(({messages:e})=>({size:e.length}))),o}))},Qf=function(e,i,s,n){return t(this,void 0,void 0,(function*(){return this._engine.translateWithParams(e.map((e=>e.toInnerParam())),s||vs.MECHANICAL,!!n,i)}))};export{zf as APIContext,xi as AreaCode,l_ as AssertRules,Ns as BaseTranslateParam,Wi as BasicLogger,C as ChatroomEntryType,b as ChatroomSyncStatusReason,L as ChatroomUserChangeType,U as ChrmMemBanType,P as ChrmMemOperateType,M as ChrmSyncStatus,Kc as Codec,wc as ConnectionStatus,w as ConversationType,we as ConversationUnreadCountFilter,o as DirectionType,D as ErrorCode,Hc as EventEmitter,J as FileType,Ce as FilterRobotType,l as FriendAddPermission,d as FriendApplicationStatus,_ as FriendApplicationType,c as FriendRelationType,y as GroupApplicationDirection,m as GroupApplicationStatus,O as GroupApplicationType,T as GroupInviteHandlePermission,g as GroupJoinPermission,I as GroupMemberInfoEditPermission,f as GroupMemberRole,R as GroupOperation,E as GroupOperationPermission,v as GroupOperationRole,S as GroupOperationStatus,p as GroupOperationType,Ue as GroupReadReceiptVersion,Ve as HttpMethod,Oe as InterruptionLevel,rs as LogDBProxy,Yi as LogL,Pc as LogLevel,Dc as LogSource,r as LogTagId,Fe as MAX_MESSAGE_CONTENT_BYTES,lt as MAX_U32_INTEGER,He as MAX_UPLOAD_FILE_SIZE,K as MentionedType,Me as MessageAuditType,de as MessageBlockSourceType,_e as MessageBlockType,ue as MessageDirection,Gi as MessageModifyStatus,De as MessageReactionOperationType,Q as MessageType,Ee as NotificationLevel,Ie as NotificationStatus,ne as OnlineStatus,se as OperateStatus,vc as PBCodec,re as Platform,__ as PluginContext,he as PushImportanceHonor,ye as PushNotificationQuietHoursLevel,a as QueryFriendsDirectionType,Pe as QuoteMessageStatus,ce as RCConnectionStatus,hi as RCResult,xc as RTCApiType,Bc as RTCJoinType,Gc as RTCMode,d_ as RTCPluginContext,Re as ReceivedStatus,Vi as ReferenceMessageStatus,ie as SentStatus,be as SpeechToTextStatus,zc as StreamMessageResponseEventType,ae as SubscribeOperationType,oe as SubscribeType,ui as SuspendablePromise,Os as TranslateMessageParam,vs as TranslateMode,Cs as TranslateStatus,Ms as TranslateStrategy,ys as TranslateTextParam,je as UPLOAD_FILE_CHUNK_SIZE,ut as UUId,z as UltraGroupChannelChangeType,X as UltraGroupChannelType,n as UploadMethod,le as UserProfileVisibility,ki as UserSettingsChangedKey,Le as UserType,Ii as Validator,dt as VersionManage,g_ as assert,os as createLogDBProxy,Ei as fail,ni as fixUrlProtocol,jc as forEach,ms as getMessageTypeDescription,qc as getUUID,Jc as getUUID22,Ss as hasMessageTypeDescription,Di as httpRequest,Rt as isArray,It as isBoolean,vt as isFunction,Ot as isHttpUrl,ft as isInteger,At as isLimitedString,Wc as isNull,Tt as isNumber,St as isObject,Et as isString,Nt as isUndefined,Ct as isValidConversationType,Lt as isValidEnum,Dt as isValidFileType,Pt as isValidGroupId,Ut as isValidTargetId,Yc as map,mt as notEmptyArray,yt as notEmptyObject,pt as notEmptyString,gi as ok,Ri as promiseWithResolvers,Eo as runtime,Gt as trans2IReceivedStatusInfo,Te as trans2NotificationLevel,fe as trans2NotificationStatus,Vt as transformReceivedStatusFlag,wt as usingCppEngine,E_ as validate};
|