@rongcloud/electron 5.48.0-alpha.1 → 5.48.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 CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e,t=require("path"),i=require("electron"),r=require("os"),s=require("child_process"),n=(require("module"),require("crypto")),o=require("fs"),a=require("url"),l=require("http"),c=require("https"),h=require("zlib"),u=require("net"),d=require("events"),E=require("tls"),I="undefined"!=typeof document?document.currentScript:null;function _(e,t,i,r){return new(i||(i=Promise))((function(s,n){function o(e){try{l(r.next(e))}catch(e){n(e)}}function a(e){try{l(r.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}function f(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)}function g(e,t,i,r,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s?s.value=i:t.set(e,i),i}!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"}(e||(e={}));const R="L-connect-S",p="L-TEST-O",T="L-request-T",N="L-request-R",S="L-parse_navi-E",O="L-rejoin_chatroom-T",C="L-rejoin_chatroom-R",v="L-get_static_conf-E",m="L-cloud_config_data_error",A="L-cloud_set_mrtr-O",M="L-parse_json-E",y="L-event_loop_blocking-S",b="L-pull_offline_message_finished-S";var P,L,U,D,w,V,k,G,F,B,H,x,J,Y,j,W,K,X,Z,q,Q,$,z,ee,te,ie,re,se,ne,oe;!function(e){e[e.BOTH=2]="BOTH"}(P||(P={})),function(e){e[e.BOTH=2]="BOTH"}(L||(L={})),function(e){e[e.FREE=1]="FREE",e[e.NEED_VERIFY=2]="NEED_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(U||(U={})),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"}(D||(D={})),function(e){e[e.SENT=1]="SENT",e[e.RECEIVED=2]="RECEIVED"}(w||(w={})),function(e){e[e.UNHANDLED=0]="UNHANDLED",e[e.ACCEPTED=1]="ACCEPTED",e[e.REFUSED=2]="REFUSED",e[e.EXPIRED=3]="EXPIRED"}(V||(V={})),function(e){e[e.FRIEND_APPLICATION=31]="FRIEND_APPLICATION"}(k||(k={})),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"}(G||(G={})),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"}(F||(F={})),function(e){e[e.OWNER=0]="OWNER",e[e.OWNER_OR_MANAGER=1]="OWNER_OR_MANAGER",e[e.EVERYONE=2]="EVERYONE"}(B||(B={})),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"}(H||(H={})),function(e){e[e.FREE=0]="FREE",e[e.INVITEE_VERIFY=1]="INVITEE_VERIFY"}(x||(x={})),function(e){e[e.UNDEF=0]="UNDEF",e[e.NORMAL=1]="NORMAL",e[e.MANAGER=2]="MANAGER",e[e.OWNER=3]="OWNER"}(J||(J={})),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"}(Y||(Y={})),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"}(j||(j={})),function(e){e[e.ADD=1]="ADD",e[e.REMOVE=2]="REMOVE"}(W||(W={})),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"}(K||(K={})),function(e){e[e.REFUSE=0]="REFUSE",e[e.ACCEPT=1]="ACCEPT"}(X||(X={})),function(e){e[e.APPLICANT=0]="APPLICANT",e[e.MANAGER=1]="MANAGER"}(Z||(Z={})),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"}(q||(q={})),function(e){e[e.APPLICATION=0]="APPLICATION",e[e.INVITATION=1]="INVITATION"}(Q||(Q={})),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"}($||($={})),function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(z||(z={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ee||(ee={})),function(e){e[e.LeaveOnMyOwn=1]="LeaveOnMyOwn",e[e.OtherDeviceLogin=2]="OtherDeviceLogin"}(te||(te={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ie||(ie={})),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"}(re||(re={})),function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(se||(se={})),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.RC_MESSAGE_EXPANSION_DISABLED=22210]="RC_MESSAGE_EXPANSION_DISABLED",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RC_GROUP_COUNT_EXCEED_LIMIT=22412]="RC_GROUP_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_JOIN_COUNT_EXCEED_LIMIT=22413]="RC_GROUP_JOIN_COUNT_EXCEED_LIMIT",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.RC_CHATROOM_ACTIVE_COUNT_EXCEED_LIMIT=23450]="RC_CHATROOM_ACTIVE_COUNT_EXCEED_LIMIT",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"}(ne||(ne={})),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"}(oe||(oe={}));const ae=0,le=1,ce=2,he=3,ue=4,de=5,Ee=6,Ie=7,_e=e=>{const t=[oe.PRIVATE,oe.GROUP,oe.SYSTEM,oe.PUBLIC_SERVICE,oe.APP_PUBLIC_SERVICE];switch(e){case ae:return t;case le:return[oe.PRIVATE,oe.GROUP];case ce:return[...t,oe.ULTRA_GROUP];case he:return[...t,oe.ULTRA_GROUP,oe.CHATROOM];case ue:return[...t,oe.ULTRA_GROUP,oe.CHATROOM,oe.RTC_ROOM,oe.CUSTOMER_SERVICE,oe.DISCUSSION];case de:return[oe.PRIVATE,oe.GROUP,oe.ULTRA_GROUP];case Ee:return[oe.GROUP];case Ie:return[oe.PRIVATE]}};var fe;!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"}(fe||(fe={}));const ge=function(){var e,t={},i=function(e){var t=function(e,i,s){if(void 0===e&&(e=t.DEFAULT_CAPACITY),void 0===i&&(i=t.DEFAULT_ENDIAN),void 0===s&&(s=t.DEFAULT_NOASSERT),!s){if((e|=0)<0)throw RangeError("Illegal capacity");i=!!i,s=!!s}this.buffer=0===e?r: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=s};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 r=new ArrayBuffer(0),s=String.fromCharCode;function n(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("")+s.apply(String,e);e.length+arguments.length>1024&&(t.push(s.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function a(e,t,i,r,s){var n,o,a=8*s-r-1,l=(1<<a)-1,c=l>>1,h=-7,u=i?s-1:0,d=i?-1:1,E=e[t+u];for(u+=d,n=E&(1<<-h)-1,E>>=-h,h+=a;h>0;n=256*n+e[t+u],u+=d,h-=8);for(o=n&(1<<-h)-1,n>>=-h,h+=r;h>0;o=256*o+e[t+u],u+=d,h-=8);if(0===n)n=1-c;else{if(n===l)return o?NaN:1/0*(E?-1:1);o+=Math.pow(2,r),n-=c}return(E?-1:1)*o*Math.pow(2,n-r)}function l(e,t,i,r,s,n){var o,a,l,c=8*n-s-1,h=(1<<c)-1,u=h>>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,E=r?0:n-1,I=r?1:-1,_=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=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*l-1)*Math.pow(2,s),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),o=0));s>=8;e[i+E]=255&a,E+=I,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;e[i+E]=255&o,E+=I,o/=256,c-=8);e[i+E-I]|=128*_}t.accessor=function(){return Uint8Array},t.allocate=function(e,i,r){return new t(e,i,r)},t.concat=function(e,i,r,s){"boolean"!=typeof i&&"string"==typeof i||(s=r,r=i,i=void 0);for(var n,o=0,a=0,l=e.length;a<l;++a)t.isByteBuffer(e[a])||(e[a]=t.wrap(e[a],i)),(n=e[a].limit-e[a].offset)>0&&(o+=n);if(0===o)return new t(0,r,s);var c,h=new t(o,r,s);for(a=0;a<l;)(n=(c=e[a++]).limit-c.offset)<=0||(h.view.set(c.view.subarray(c.offset,c.limit),h.offset),h.offset+=n);return h.limit=h.offset,h.offset=0,h},t.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},t.type=function(){return ArrayBuffer},t.wrap=function(e,r,s,n){if("string"!=typeof r&&(n=s,s=r,r=void 0),"string"==typeof e)switch(void 0===r&&(r="utf8"),r){case"base64":return t.fromBase64(e,s);case"hex":return t.fromHex(e,s);case"binary":return t.fromBinary(e,s);case"utf8":return t.fromUTF8(e,s);case"debug":return t.fromDebug(e,s);default:throw Error("Unsupported encoding: "+r)}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,s,n),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,s,n),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,s,n)).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 r,s=t,n=e.length,o=n>>3,a=0;for(t+=this.writeVarint32(n,t);o--;)r=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(r,t++);if(a<n){var l=0;for(r=0;a<n;)r|=(1&!!e[a++])<<l++;this.writeByte(r,t++)}return i?(this.offset=t,this):t-s},i.readBitSet=function(e){var t=void 0===e;t&&(e=this.offset);var i,r=this.readVarint32(e),s=r.value,n=s>>3,o=0,a=[];for(e+=r.length;n--;)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<s){var l=0;for(i=this.readByte(e++);o<s;)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 r=this.slice(t,t+e);return i&&(this.offset+=e),r},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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=void 0===i;if(r&&(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 s=this.buffer.byteLength;i>s&&this.resize((s*=2)>i?s:i),i-=8;var n=t.low,o=t.high;return this.littleEndian?(this.view[i+3]=n>>>24&255,this.view[i+2]=n>>>16&255,this.view[i+1]=n>>>8&255,this.view[i]=255&n,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]=n>>>24&255,this.view[i+1]=n>>>16&255,this.view[i+2]=n>>>8&255,this.view[i+3]=255&n),r&&(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 r=0,s=0;this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0,t+=4,s=this.view[t+2]<<16,s|=this.view[t+1]<<8,s|=this.view[t],s+=this.view[t+3]<<24>>>0):(s=this.view[t+1]<<16,s|=this.view[t+2]<<8,s|=this.view[t+3],s+=this.view[t]<<24>>>0,t+=4,r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0);var n=new e(r,s,!1);return i&&(this.offset+=8),n},i.readLong=i.readInt64,i.writeUint64=function(t,i){var r=void 0===i;if(r&&(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 s=this.buffer.byteLength;i>s&&this.resize((s*=2)>i?s:i),i-=8;var n=t.low,o=t.high;return this.littleEndian?(this.view[i+3]=n>>>24&255,this.view[i+2]=n>>>16&255,this.view[i+1]=n>>>8&255,this.view[i]=255&n,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]=n>>>24&255,this.view[i+1]=n>>>16&255,this.view[i+2]=n>>>8&255,this.view[i+3]=255&n),r&&(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 r=0,s=0;this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0,t+=4,s=this.view[t+2]<<16,s|=this.view[t+1]<<8,s|=this.view[t],s+=this.view[t+3]<<24>>>0):(s=this.view[t+1]<<16,s|=this.view[t+2]<<8,s|=this.view[t+3],s+=this.view[t]<<24>>>0,t+=4,r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0);var n=new e(r,s,!0);return i&&(this.offset+=8),n},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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=void 0===i;if(r&&(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 s,n=t.calculateVarint32(e);i+=n;var o=this.buffer.byteLength;for(i>o&&this.resize((o*=2)>i?o:i),i-=n,e>>>=0;e>=128;)s=127&e|128,this.view[i++]=s,e>>>=7;return this.view[i++]=e,r?(this.offset=i,this):n},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,r=0,s=0;do{if(!this.noAssert&&e>this.limit){var n=Error("Truncated");throw n.truncated=!0,n}i=this.view[e++],r<5&&(s|=(127&i)<<7*r),++r}while(128&i);return s|=0,t?(this.offset=e,s):{value:s,length:r}},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,r=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0;return 0==s?0==r?i<16384?i<128?1:2:i<1<<21?3:4:r<16384?r<128?5:6:r<1<<21?7:8:s<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,r){var s=void 0===r;if(s&&(r=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 r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+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 n=t.calculateVarint64(i),o=i.toInt()>>>0,a=i.shiftRightUnsigned(28).toInt()>>>0,l=i.shiftRightUnsigned(56).toInt()>>>0;r+=n;var c=this.buffer.byteLength;switch(r>c&&this.resize((c*=2)>r?c:r),r-=n,n){case 10:this.view[r+9]=l>>>7&1;case 9:this.view[r+8]=9!==n?128|l:127&l;case 8:this.view[r+7]=8!==n?a>>>21|128:a>>>21&127;case 7:this.view[r+6]=7!==n?a>>>14|128:a>>>14&127;case 6:this.view[r+5]=6!==n?a>>>7|128:a>>>7&127;case 5:this.view[r+4]=5!==n?128|a:127&a;case 4:this.view[r+3]=4!==n?o>>>21|128:o>>>21&127;case 3:this.view[r+2]=3!==n?o>>>14|128:o>>>14&127;case 2:this.view[r+1]=2!==n?o>>>7|128:o>>>7&127;case 1:this.view[r]=1!==n?128|o:127&o}return s?(this.offset+=n,this):n},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 r=t,s=0,n=0,o=0,a=0;if(s=127&(a=this.view[t++]),128&a&&(s|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(n=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===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)&&(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(s|n<<28,n>>>4|o<<24,!1);return i?(this.offset=t,l):{value:l,length:t-r}},i.readVarint64ZigZag=function(i){var r=this.readVarint64(i);return r&&r.value instanceof e?r.value=t.zigZagDecode64(r.value):r=t.zigZagDecode64(r),r}),i.writeCString=function(e,t){var i=void 0===t;i&&(t=this.offset);var r,s=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;r<s;++r)if(0===e.charCodeAt(r))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)}s=h.calculateUTF16asUTF8(n(e))[1],t+=s+1;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=s+1,h.encodeUTF16toUTF8(n(e),function(e){this.view[t++]=e}.bind(this)),this.view[t++]=0,i?(this.offset=t,this):s},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,r=e,s=-1;return h.decodeUTF8toUTF16(function(){if(0===s)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(s=this.view[e++])?null:s}.bind(this),i=o(),!0),t?(this.offset=e,i()):{string:i(),length:e-r}},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 r,s=t;r=h.calculateUTF16asUTF8(n(e),this.noAssert)[1],t+=4+r;var o=this.buffer.byteLength;if(t>o&&this.resize((o*=2)>t?o:t),t-=4+r,this.littleEndian?(this.view[t+3]=r>>>24&255,this.view[t+2]=r>>>16&255,this.view[t+1]=r>>>8&255,this.view[t]=255&r):(this.view[t]=r>>>24&255,this.view[t+1]=r>>>16&255,this.view[t+2]=r>>>8&255,this.view[t+3]=255&r),t+=4,h.encodeUTF16toUTF8(n(e),function(e){this.view[t++]=e}.bind(this)),t!==s+4+r)throw RangeError("Illegal range: Truncated data, "+t+" == "+(t+4+r));return i?(this.offset=t,this):t-s},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 r=e,s=this.readUint32(e),n=this.readUTF8String(s,t.METRICS_BYTES,e+=4);return e+=n.length,i?(this.offset=e,n.string):{string:n.string,length:e-r}},t.METRICS_CHARS="c",t.METRICS_BYTES="b",i.writeUTF8String=function(e,t){var i,r=void 0===t;if(r&&(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 s=t;i=h.calculateUTF16asUTF8(n(e))[1],t+=i;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=i,h.encodeUTF16toUTF8(n(e),function(e){this.view[t++]=e}.bind(this)),r?(this.offset=t,this):t-s},i.writeString=i.writeUTF8String,t.calculateUTF8Chars=function(e){return h.calculateUTF16asUTF8(n(e))[0]},t.calculateUTF8Bytes=function(e){return h.calculateUTF16asUTF8(n(e))[1]},t.calculateString=t.calculateUTF8Bytes,i.readUTF8String=function(e,i,r){"number"==typeof i&&(r=i,i=void 0);var s=void 0===r;if(s&&(r=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 r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var n,a=0,l=r;if(i===t.METRICS_CHARS){if(n=o(),h.decodeUTF8(function(){return a<e&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++a,h.UTF8toUTF16(e,n)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return s?(this.offset=r,n()):{string:n(),length:r-l}}if(i===t.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}var c=r+e;if(h.decodeUTF8toUTF16(function(){return r<c?this.view[r++]:null}.bind(this),n=o(),this.noAssert),r!==c)throw RangeError("Illegal range: Truncated data, "+r+" == "+c);return s?(this.offset=r,n()):{string:n(),length:r-l}}throw TypeError("Unsupported metrics: "+i)},i.readString=i.readUTF8String,i.writeVString=function(e,i){var r=void 0===i;if(r&&(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 s,o,a=i;s=h.calculateUTF16asUTF8(n(e),this.noAssert)[1],o=t.calculateVarint32(s),i+=o+s;var l=this.buffer.byteLength;if(i>l&&this.resize((l*=2)>i?l:i),i-=o+s,i+=this.writeVarint32(s,i),h.encodeUTF16toUTF8(n(e),function(e){this.view[i++]=e}.bind(this)),i!==a+s+o)throw RangeError("Illegal range: Truncated data, "+i+" == "+(i+s+o));return r?(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 r=e,s=this.readVarint32(e),n=this.readUTF8String(s.value,t.METRICS_BYTES,e+=s.length);return e+=n.length,i?(this.offset=e,n.string):{string:n.string,length:e-r}},i.append=function(e,i,r){"number"!=typeof i&&"string"==typeof i||(r=i,i=void 0);var s=void 0===r;if(s&&(r=this.offset),!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,i));var n=e.limit-e.offset;if(n<=0)return this;r+=n;var o=this.buffer.byteLength;return r>o&&this.resize((o*=2)>r?o:r),r-=n,this.view.set(e.view.subarray(e.offset,e.limit),r),e.offset+=n,s&&(this.offset+=n),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=r,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var s=new ArrayBuffer(i),n=new Uint8Array(s);return n.set(this.view.subarray(e,t)),this.buffer=s,this.view=n,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 r=i-e,s=new t(r,this.littleEndian,this.noAssert);return s.offset=0,s.limit=r,s.markedOffset>=0&&(s.markedOffset-=e),this.copyTo(s,0,e,i),s},i.copyTo=function(e,i,r,s){var n,o;if(!this.noAssert&&!t.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(i=(o=void 0===i)?e.offset:0|i,r=(n=void 0===r)?this.offset:0|r,s=void 0===s?this.limit:0|s,i<0||i>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+i+" <= "+e.buffer.byteLength);if(r<0||s>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+r+" <= "+this.buffer.byteLength);var a=s-r;return 0===a?e:(e.ensureCapacity(i+a),e.view.set(this.view.subarray(r,s),i),n&&(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 r=void 0===t;if(r&&(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 r&&(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,r){"number"!=typeof i&&"string"==typeof i||(r=i,i=void 0);var s=void 0===r;if(s&&(r=this.offset),!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,i));var n=e.limit-e.offset;if(n<=0)return this;var o=n-r;if(o>0){var a=new ArrayBuffer(this.buffer.byteLength+o),l=new Uint8Array(a);l.set(this.view.subarray(r,this.buffer.byteLength),n),this.buffer=a,this.view=l,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,r+=o}else new Uint8Array(this.buffer);return this.view.set(e.view.subarray(e.offset,e.limit),r-n),e.offset=e.limit,s&&(this.offset-=n),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 r;var s=new ArrayBuffer(i-t);return new Uint8Array(s).set(new Uint8Array(this.buffer).subarray(t,i),0),s},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=[],r=0,s=t.length;r<s;++r)i[t[r]]=r;return e.encode=function(e,i){for(var r,s;null!==(r=e());)i(t[r>>2&63]),s=(3&r)<<4,null!==(r=e())?(i(t[63&((s|=r>>4&15)|r>>4&15)]),s=(15&r)<<2,null!==(r=e())?(i(t[63&(s|r>>6&3)]),i(t[63&r])):(i(t[63&s]),i(61))):(i(t[63&s]),i(61),i(61))},e.decode=function(e,t){var r,s,n;function o(e){throw Error("Illegal character code: "+e)}for(;null!==(r=e());)if(void 0===(s=i[r])&&o(r),null!==(r=e())&&(void 0===(n=i[r])&&o(r),t(s<<2>>>0|(48&n)>>4),null!==(r=e()))){if(void 0===(s=i[r])){if(61===r)break;o(r)}if(t((15&n)<<4>>>0|(60&s)>>2),null!==(r=e())){if(void 0===(n=i[r])){if(61===r)break;o(r)}t((3&s)<<6>>>0|n)}}},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 r=new t(e.length/4*3,i),s=0;return c.decode(n(e),(function(e){r.view[s++]=e})),r.limit=s,r},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=[],r=[];e<t;)i.push(this.view[e++]),i.length>=1024&&(r.push(String.fromCharCode.apply(String,i)),i=[]);return r.join("")+String.fromCharCode.apply(String,i)},t.fromBinary=function(e,i){if("string"!=typeof e)throw TypeError("str");for(var r,s=0,n=e.length,o=new t(n,i);s<n;){if((r=e.charCodeAt(s))>255)throw RangeError("illegal char code: "+r);o.view[s++]=r}return o.limit=n,o},i.toDebug=function(e){for(var t,i=-1,r=this.buffer.byteLength,s="",n="",o="";i<r;){if(-1!==i&&(s+=(t=this.view[i])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(n+=t>32&&t<127?String.fromCharCode(t):".")),++i,e&&i>0&&i%16==0&&i!==r){for(;s.length<51;)s+=" ";o+=s+n+"\n",s=n=""}i===this.offset&&i===this.limit?s+=i===this.markedOffset?"!":"|":i===this.offset?s+=i===this.markedOffset?"[":"<":i===this.limit?s+=i===this.markedOffset?"]":">":s+=i===this.markedOffset?"'":e||0!==i&&i!==r?" ":""}if(e&&" "!==s){for(;s.length<51;)s+=" ";o+=s+n+"\n"}return e?o:s},t.fromDebug=function(e,i,r){for(var s,n,o=e.length,a=new t((o+1)/3|0,i,r),l=0,c=0,h=!1,u=!1,d=!1,E=!1,I=!1;l<o;){switch(s=e.charAt(l++)){case"!":if(!r){if(u||d||E){I=!0;break}u=d=E=!0}a.offset=a.markedOffset=a.limit=c,h=!1;break;case"|":if(!r){if(u||E){I=!0;break}u=E=!0}a.offset=a.limit=c,h=!1;break;case"[":if(!r){if(u||d){I=!0;break}u=d=!0}a.offset=a.markedOffset=c,h=!1;break;case"<":if(!r){if(u){I=!0;break}u=!0}a.offset=c,h=!1;break;case"]":if(!r){if(E||d){I=!0;break}E=d=!0}a.limit=a.markedOffset=c,h=!1;break;case">":if(!r){if(E){I=!0;break}E=!0}a.limit=c,h=!1;break;case"'":if(!r){if(d){I=!0;break}d=!0}a.markedOffset=c,h=!1;break;case" ":h=!1;break;default:if(!r&&h){I=!0;break}if(n=parseInt(s+e.charAt(l++),16),!r&&(isNaN(n)||n<0||n>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[c++]=n,h=!0}if(I)throw TypeError("Illegal str: Invalid symbol at "+l)}if(!r){if(!u||!E)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,r=new Array(t-e);e<t;)(i=this.view[e++])<16?r.push("0",i.toString(16)):r.push(i.toString(16));return r.join("")},t.fromHex=function(e,i,r){if(!r){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 s,n=e.length,o=new t(n/2|0,i),a=0,l=0;a<n;a+=2){if(s=parseInt(e.substring(a,a+2),16),!r&&(!isFinite(s)||s<0||s>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[l++]=s}return o.limit=l,o};var h=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,r,s,n,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===(r=e())&&o([i,r]),t((31&i)<<6|63&r);else if(224==(240&i))(null===(r=e())||null===(s=e()))&&o([i,r,s]),t((15&i)<<12|(63&r)<<6|63&s);else{if(240!=(248&i))throw RangeError("Illegal starting byte: "+i);(null===(r=e())||null===(s=e())||null===(n=e()))&&o([i,r,s,n]),t((7&i)<<18|(63&r)<<12|(63&s)<<6|63&n)}else t(i)},UTF16toUTF8:function(e,t){for(var i,r=null;null!==(i=null!==r?r:e());)i>=55296&&i<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(i-55296)+r-56320+65536),r=null):t(i);null!==r&&t(r)},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,r=0;return e.UTF16toUTF8(t,(function(e){++i,r+=e<128?1:e<2048?2:e<65536?3:4})),[i,r]}};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{h.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,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var s=new t(h.calculateUTF16asUTF8(n(e),!0)[1],i,r),o=0;return h.encodeUTF16toUTF8(n(e),(function(e){s.view[o++]=e})),s.limit=o,s},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={},r={};function s(e,t){var s,n,a;return t?(a=0<=(e>>>=0)&&e<256)&&(n=r[e])?n:(s=o(e,(0|e)<0?-1:0,!0),a&&(r[e]=s),s):(a=-128<=(e|=0)&&e<128)&&(n=i[e])?n:(s=o(e,e<0?-1:0,!1),a&&(i[e]=s),s)}function n(e,t){if(isNaN(e)||!isFinite(e))return t?_:I;if(t){if(e<0)return _;if(e>=u)return T}else{if(e<=-d)return N;if(e+1>=d)return p}return e<0?n(-e,t).neg():o(e%h|0,e/h|0,t)}function o(t,i,r){return new e(t,i,r)}e.fromInt=s,e.fromNumber=n,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 I;if("number"==typeof t?(i=t,t=!1):t=!!t,(i=i||10)<2||36<i)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return l(e.substring(1),t,i).neg();for(var s=n(a(i,8)),o=I,c=0;c<e.length;c+=8){var h=Math.min(8,e.length-c),u=parseInt(e.substring(c,c+h),i);if(h<8){var d=n(a(i,h));o=o.mul(d).add(n(u))}else o=(o=o.mul(s)).add(n(u))}return o.unsigned=t,o}function c(t){return t instanceof e?t:"number"==typeof t?n(t):"string"==typeof t?l(t):o(t.low,t.high,t.unsigned)}e.fromString=l,e.fromValue=c;var h=4294967296,u=h*h,d=u/2,E=s(1<<24),I=s(0);e.ZERO=I;var _=s(0,!0);e.UZERO=_;var f=s(1);e.ONE=f;var g=s(1,!0);e.UONE=g;var R=s(-1);e.NEG_ONE=R;var p=o(-1,2147483647,!1);e.MAX_VALUE=p;var T=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=T;var N=o(0,-2147483648,!1);e.MIN_VALUE=N;var S=e.prototype;return S.toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},S.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(N)){var t=n(e),i=this.div(t),r=i.mul(t).sub(this);return i.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var s=n(a(e,6),this.unsigned),o=this,l="";;){var c=o.div(s),h=(o.sub(c.mul(s)).toInt()>>>0).toString(e);if((o=c).isZero())return h+l;for(;h.length<6;)h="0"+h;l=""+h+l}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(N)?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},S.isZero=function(){return 0===this.high&&0===this.low},S.isNegative=function(){return!this.unsigned&&this.high<0},S.isPositive=function(){return this.unsigned||this.high>=0},S.isOdd=function(){return!(1&~this.low)},S.isEven=function(){return!(1&this.low)},S.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)},S.eq=S.equals,S.notEquals=function(e){return!this.eq(e)},S.neq=S.notEquals,S.lessThan=function(e){return this.comp(e)<0},S.lt=S.lessThan,S.lessThanOrEqual=function(e){return this.comp(e)<=0},S.lte=S.lessThanOrEqual,S.greaterThan=function(e){return this.comp(e)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(e){return this.comp(e)>=0},S.gte=S.greaterThanOrEqual,S.compare=function(e){if(t(e)||(e=c(e)),this.eq(e))return 0;var i=this.isNegative(),r=e.isNegative();return i&&!r?-1:!i&&r?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},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(N)?N:this.not().add(f)},S.neg=S.negate,S.add=function(e){t(e)||(e=c(e));var i=this.high>>>16,r=65535&this.high,s=this.low>>>16,n=65535&this.low,a=e.high>>>16,l=65535&e.high,h=e.low>>>16,u=0,d=0,E=0,I=0;return E+=(I+=n+(65535&e.low))>>>16,d+=(E+=s+h)>>>16,u+=(d+=r+l)>>>16,u+=i+a,o((E&=65535)<<16|(I&=65535),(u&=65535)<<16|(d&=65535),this.unsigned)},S.subtract=function(e){return t(e)||(e=c(e)),this.add(e.neg())},S.sub=S.subtract,S.multiply=function(e){if(this.isZero())return I;if(t(e)||(e=c(e)),e.isZero())return I;if(this.eq(N))return e.isOdd()?N:I;if(e.eq(N))return this.isOdd()?N:I;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(E)&&e.lt(E))return n(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,r=65535&this.high,s=this.low>>>16,a=65535&this.low,l=e.high>>>16,h=65535&e.high,u=e.low>>>16,d=65535&e.low,_=0,f=0,g=0,R=0;return g+=(R+=a*d)>>>16,f+=(g+=s*d)>>>16,g&=65535,f+=(g+=a*u)>>>16,_+=(f+=r*d)>>>16,f&=65535,_+=(f+=s*u)>>>16,f&=65535,_+=(f+=a*h)>>>16,_+=i*d+r*u+s*h+a*l,o((g&=65535)<<16|(R&=65535),(_&=65535)<<16|(f&=65535),this.unsigned)},S.mul=S.multiply,S.divide=function(e){if(t(e)||(e=c(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?_:I;var i,r,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return _;if(e.gt(this.shru(1)))return g;s=_}else{if(this.eq(N))return e.eq(f)||e.eq(R)?N:e.eq(N)?f:(i=this.shr(1).div(e).shl(1)).eq(I)?e.isNegative()?f:R:(r=this.sub(e.mul(i)),s=i.add(r.div(e)));if(e.eq(N))return this.unsigned?_:I;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();s=I}for(r=this;r.gte(e);){i=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(i)/Math.LN2),l=o<=48?1:a(2,o-48),h=n(i),u=h.mul(e);u.isNegative()||u.gt(r);)u=(h=n(i-=l,this.unsigned)).mul(e);h.isZero()&&(h=f),s=s.add(h),r=r.sub(u)}return s},S.div=S.divide,S.modulo=function(e){return t(e)||(e=c(e)),this.sub(this.div(e).mul(e))},S.mod=S.modulo,S.not=function(){return o(~this.low,~this.high,this.unsigned)},S.and=function(e){return t(e)||(e=c(e)),o(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return t(e)||(e=c(e)),o(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return t(e)||(e=c(e)),o(this.low^e.low,this.high^e.high,this.unsigned)},S.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)},S.shl=S.shiftLeft,S.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)},S.shr=S.shiftRight,S.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)},S.shru=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},S.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},S.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]},S.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={},r=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},s=r.prototype;s._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]},s.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,r;do{for(e=!1;t.WHITESPACE.test(r=this.source.charAt(this.index));)if("\n"===r&&++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("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;i=r,r=this.source.charAt(this.index)}while("*"!==i||"/"!==r);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;var s=this.index;if(t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(s++)))for(;s<this.source.length&&!t.DELIM.test(this.source.charAt(s));)++s;var n=this.source.substring(this.index,this.index=s);return'"'!==n&&"'"!==n||(this._stringOpen=n),n},s.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},s.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},s.omit=function(e){return this.peek()===e&&(this.next(),!0)},s.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},i.Tokenizer=r;var n=function(e){this.tn=new r(e),this.proto3=!1},o=n.prototype;function a(e,i){var r=-1,s=1;if("-"==e.charAt(0)&&(s=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(s<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=s*r|0,!i&&r<0)throw Error("illegal id value: "+(s<0?"-":"")+e);return r}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,r={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},s=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!s||null!==r.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),r.package=e;break;case"import":if(!s)throw Error("unexpected 'import'");("public"===(e=this.tn.peek())||(i="weak"===e))&&this.tn.next(),e=this._readString(),this.tn.skip(";"),i||r.imports.push(e);break;case"syntax":if(!s)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(r.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(r,null),s=!1;break;case"enum":this._parseEnum(r),s=!1;break;case"option":this._parseOption(r);break;case"service":this._parseService(r);break;case"extend":this._parseExtend(r);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete r.name,r},n.parse=function(e){return new n(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 r=this.tn.next(),s=!1;if("("===r&&(s=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal option name: "+r);var n=r;s&&(this.tn.skip(")"),n="("+n+")",r=this.tn.peek(),t.FQTYPEREF.test(r)&&(n+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,n),i||this.tn.skip(";")},o._parseOptionValue=function(e,i){var r=this.tn.peek();if("{"!==r)c(e.options,i,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+i+"."+r);this.tn.omit(":")?c(e.options,i+"."+r,this._readValue(!0)):this._parseOptionValue(e,i+"."+r)}},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 r={name:i,rpc:{},options:{}};for(this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(r);else{if("rpc"!==i)throw Error("illegal service token: "+i);this._parseServiceRPC(r)}this.tn.omit(";"),e.services.push(r)},o._parseServiceRPC=function(e){var i="rpc",r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal rpc service method name: "+r);var s=r,n={request:null,response:null,request_stream:!1,response_stream:!1,options:{}};if(this.tn.skip("("),"stream"===(r=this.tn.next()).toLowerCase()&&(n.request_stream=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal rpc service request type: "+r);if(n.request=r,this.tn.skip(")"),"returns"!==(r=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+r);if(this.tn.skip("("),"stream"===(r=this.tn.next()).toLowerCase()&&(n.response_stream=!0,r=this.tn.next()),n.response=r,this.tn.skip(")"),"{"===(r=this.tn.peek())){for(this.tn.next();"}"!==(r=this.tn.next());){if("option"!==r)throw Error("illegal rpc service token: "+r);this._parseOption(n)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][s]=n},o._parseMessage=function(e,i){var r=!!i,s=this.tn.next(),n={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(s))throw Error("illegal "+(r?"group":"message")+" name: "+s);for(n.name=s,r&&(this.tn.skip("="),i.id=a(this.tn.next()),n.isGroup=!0),"["===(s=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(n,s);else if("oneof"===s)this._parseMessageOneOf(n);else if("enum"===s)this._parseEnum(n);else if("message"===s)this._parseMessage(n);else if("option"===s)this._parseOption(n);else if("service"===s)this._parseService(n);else if("extensions"===s)n.hasOwnProperty("extensions")?n.extensions=n.extensions.concat(this._parseExtensionRanges()):n.extensions=this._parseExtensionRanges();else if("reserved"===s)this._parseIgnored();else if("extend"===s)this._parseExtend(n);else{if(!t.TYPEREF.test(s))throw Error("illegal message token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(n,"optional",s)}return this.tn.omit(";"),e.messages.push(n),n},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,i,r){if(!t.RULE.test(i))throw Error("illegal message field rule: "+i);var s,n={rule:i,type:"",name:"",options:{},id:0};if("map"===i){if(r)throw Error("illegal type: "+r);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(n.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(n.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);n.name=s,this.tn.skip("="),n.id=a(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(n),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){var o=this._parseMessage(e,n);if(!/^[A-Z]/.test(o.name))throw Error("illegal group name: "+o.name);n.type=o.name,n.name=o.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(r)&&!t.TYPEREF.test(r))throw Error("illegal message field type: "+r);if(n.type=r,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);n.name=s,this.tn.skip("="),n.id=a(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(n),this.tn.skip(";")}return e.fields.push(n),n},o._parseMessageOneOf=function(e){var i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal oneof name: "+i);var r,s=i,n=[];for(this.tn.skip("{");"}"!==(i=this.tn.next());)(r=this._parseMessageField(e,"optional",i)).oneof=s,n.push(r.id);this.tn.omit(";"),e.oneofs[s]=n},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:{}},r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal name: "+r);for(i.name=r,this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(i);else{if(!t.NAME.test(r))throw Error("illegal name: "+r);this.tn.skip("=");var s={name:r,id:a(this.tn.next(),!0)};"["===(r=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(s)}this.tn.omit(";"),e.enums.push(i)},o._parseExtensionRanges=function(){var t,i,r,s=[];do{for(i=[];;){switch(t=this.tn.next()){case"min":r=e.ID_MIN;break;case"max":r=e.ID_MAX;break;default:r=l(t)}if(i.push(r),2===i.length)break;if("to"!==this.tn.peek()){i.push(r);break}this.tn.next()}s.push(i)}while(this.tn.omit(","));return this.tn.skip(";"),s},o._parseExtend=function(e){var i=this.tn.next();if(!t.TYPEREF.test(i))throw Error("illegal extend reference: "+i);var r={ref:i,fields:[]};for(this.tn.skip("{");"}"!==(i=this.tn.next());)if(t.RULE.test(i))this._parseMessageField(r,i);else{if(!t.TYPEREF.test(i))throw Error("illegal extend token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(r,"optional",i)}return this.tn.omit(";"),e.messages.push(r),r},o.toString=function(){return"Parser at line "+this.tn.line},i.Parser=n,i}(t,t.Lang),t.Reflect=function(e){var t={},r=function(e,t,i){this.builder=e,this.parent=t,this.name=i,this.className},s=r.prototype;s.fqn=function(){for(var e=this.name,t=this;;){if(null==(t=t.parent))break;e=t.name+"."+e}return e},s.toString=function(e){return(e?this.className+" ":"")+this.fqn()},s.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},t.T=r;var n=function(e,t,i,s,n){r.call(this,e,t,i),this.className="Namespace",this.children=[],this.options=s||{},this.syntax=n||"proto2"},o=n.prototype=Object.create(r.prototype);o.getChildren=function(e){if(null==(e=e||null))return this.children.slice();for(var t=[],i=0,r=this.children.length;i<r;++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 h.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof h.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,r=this.children.length;i<r;++i)if(this.children[i][t]===e)return this.children[i];return null},o.resolve=function(e,i){var r,s="string"==typeof e?e.split("."):e,n=this,o=0;if(""===s[o]){for(;null!==n.parent;)n=n.parent;o++}do{do{if(!(n instanceof t.Namespace)){n=null;break}if(!(r=n.getChild(s[o]))||!(r instanceof t.T)||i&&!(r instanceof t.Namespace)){n=null;break}n=r,o++}while(o<s.length);if(null!=n)break;if(null!==this.parent)return this.parent.resolve(e,i)}while(null!=n);return n},o.qn=function(e){var i=[],r=e;do{i.unshift(r.name),r=r.parent}while(null!==r);for(var s=1;s<=i.length;s++){var n=i.slice(i.length-s);if(e===this.resolve(n,e instanceof t.Namespace))return n.join(".")}return e.fqn()},o.build=function(){for(var e,t={},i=this.children,r=0,s=i.length;r<s;++r)(e=i[r])instanceof n&&(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,r=t.length;i<r;++i){var s=t[i],n=this.options[t[i]];e[s]=n}return e},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},t.Namespace=n;var a=function(t,i,r,s,n){if(this.type=t,this.resolvedType=i,this.isMapKey=r,this.syntax=s,this.name=n,r&&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 r=this;function s(e,t){throw Error("Illegal value for "+r.toString(!0)+" of type "+r.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)&&s(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)&&s(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){s(typeof t,e.message)}else s(typeof t,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return c(t,!0)}catch(e){s(typeof t,e.message)}else s(typeof t,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof t&&s(typeof t,"not a boolean"),t;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof t&&s(typeof t,"not a number"),t;case e.TYPES.string:return"string"==typeof t||t&&t instanceof String||s(typeof t,"not a string"),""+t;case e.TYPES.bytes:return i.isByteBuffer(t)?t:i.wrap(t,"base64");case e.TYPES.enum:var n=this.resolvedType.getChildren(e.Reflect.Enum.Value);for(a=0;a<n.length;a++){if(n[a].name==t)return n[a].id;if(n[a].id==t)return n[a].id}if("proto3"===this.syntax)return("number"!=typeof t||t==t&&t%1!=0)&&s(typeof t,"not an integer"),(t>4294967295||t<0)&&s(typeof t,"not in range for uint32"),t;s(t,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(t&&"object"==typeof t||s(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,r){if(null===r)return 0;var s;switch(this.type){case e.TYPES.int32:return r<0?i.calculateVarint64(r):i.calculateVarint32(r);case e.TYPES.uint32:return i.calculateVarint32(r);case e.TYPES.sint32:return i.calculateVarint32(i.zigZagEncode32(r));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(r);case e.TYPES.sint64:return i.calculateVarint64(i.zigZagEncode64(r));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return i.calculateVarint32(r);case e.TYPES.double:return 8;case e.TYPES.string:return s=i.calculateUTF8Bytes(r),i.calculateVarint32(s)+s;case e.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");return i.calculateVarint32(r.remaining())+r.remaining();case e.TYPES.message:return s=this.resolvedType.calculate(r),i.calculateVarint32(s)+s;case e.TYPES.group:return(s=this.resolvedType.calculate(r))+i.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")},l.encodeValue=function(t,r,s){if(null===r)return s;switch(this.type){case e.TYPES.int32:r<0?s.writeVarint64(r):s.writeVarint32(r);break;case e.TYPES.uint32:s.writeVarint32(r);break;case e.TYPES.sint32:s.writeVarint32ZigZag(r);break;case e.TYPES.fixed32:s.writeUint32(r);break;case e.TYPES.sfixed32:s.writeInt32(r);break;case e.TYPES.int64:case e.TYPES.uint64:s.writeVarint64(r);break;case e.TYPES.sint64:s.writeVarint64ZigZag(r);break;case e.TYPES.fixed64:s.writeUint64(r);break;case e.TYPES.sfixed64:s.writeInt64(r);break;case e.TYPES.bool:"string"==typeof r?s.writeVarint32("false"===r.toLowerCase()?0:!!r):s.writeVarint32(r?1:0);break;case e.TYPES.enum:s.writeVarint32(r);break;case e.TYPES.float:s.writeFloat32(r);break;case e.TYPES.double:s.writeFloat64(r);break;case e.TYPES.string:s.writeVString(r);break;case e.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");var n=r.offset;s.writeVarint32(r.remaining()),s.append(r),r.offset=n;break;case e.TYPES.message:var o=(new i).LE();this.resolvedType.encode(r,o),s.writeVarint32(o.offset),s.append(o.flip());break;case e.TYPES.group:this.resolvedType.encode(r,s),s.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")}return s},l.decode=function(t,i,r){if(i!=this.type.wireType)throw Error("Unexpected wire type for element");var s,n;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(n=t.readVarint32(),t.remaining()<n)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+n+" required but got only "+t.remaining());return(s=t.clone()).limit=s.offset+n,t.offset+=n,s;case e.TYPES.message:return n=t.readVarint32(),this.resolvedType.decode(t,n);case e.TYPES.group:return this.resolvedType.decode(t,-1,r)}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 h=function(e,t,i,r,s,o){n.call(this,e,t,i,r,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!s,this._fields=null,this._fieldsById=null,this._fieldsByName=null},u=h.prototype=Object.create(n.prototype);function d(t,i){var r=i.readVarint32(),s=7&r,n=r>>>3;switch(s){case e.WIRE_TYPES.VARINT:do{r=i.readUint8()}while(!(128&~r));break;case e.WIRE_TYPES.BITS64:i.offset+=8;break;case e.WIRE_TYPES.LDELIM:r=i.readVarint32(),i.offset+=r;break;case e.WIRE_TYPES.STARTGROUP:d(n,i);break;case e.WIRE_TYPES.ENDGROUP:if(n===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+n+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:i.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+s)}return!0}u.build=function(t){if(this.clazz&&!t)return this.clazz;var r=function(e,t){var r=t.getChildren(e.Reflect.Message.Field),s=t.getChildren(e.Reflect.Message.OneOf),n=function(o,a){e.Builder.Message.call(this);for(var l=0,c=s.length;l<c;++l)this[s[l].name]=null;for(l=0,c=r.length;l<c;++l){var h=r[l];this[h.name]=h.repeated?[]:h.map?new e.Map(h):null,!h.required&&"proto3"!==t.syntax||null===h.defaultValue||(this[h.name]=h.defaultValue)}var u;if(arguments.length>0)if(1!==arguments.length||null===o||"object"!=typeof o||!("function"!=typeof o.encode||o instanceof n)||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!==(u=arguments[l])&&this.$set(r[l].name,u);else this.$set(o)},o=n.prototype=Object.create(e.Builder.Message.prototype);o.add=function(i,r,s){var n=t._fieldsByName[i];if(!s){if(!n)throw Error(this+"#"+i+" is undefined");if(!(n instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: "+n.toString(!0));if(!n.repeated)throw Error(this+"#"+i+" is not a repeated field");r=n.verifyValue(r,!0)}return null===this[i]&&(this[i]=[]),this[i].push(r),this},o.$add=o.add,o.set=function(i,r,s){if(i&&"object"==typeof i){for(var n in s=r,i)i.hasOwnProperty(n)&&void 0!==(r=i[n])&&void 0===t._oneofsByName[n]&&this.$set(n,r,s);return this}var o=t._fieldsByName[i];if(s)this[i]=r;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]=r=o.verifyValue(r)}if(o&&o.oneof){var a=this[o.oneof.name];null!==r?(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,r){if(r)return this[i];var s=t._fieldsByName[i];if(!(s&&s instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: "+s.toString(!0));return this[s.name]},o.$get=o.get;for(var a=0;a<r.length;a++){var l=r[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 r=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),s=function(t,i){return this[e.name]=i?t:e.verifyValue(t),this},n=function(){return this[e.name]};null===t.getChild("set"+i)&&(o["set"+i]=s),null===t.getChild("set_"+r)&&(o["set_"+r]=s),null===t.getChild("get"+i)&&(o["get"+i]=n),null===t.getChild("get_"+r)&&(o["get_"+r]=n)}(l)}function c(t,r,s,n){if(null===t||"object"!=typeof t){if(n&&n instanceof e.Reflect.Enum){var o=e.Reflect.Enum.getName(n.object,t);if(null!==o)return o}return t}if(i.isByteBuffer(t))return r?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return s?t.toString():e.Long.fromValue(t);var a;if(Array.isArray(t))return a=[],t.forEach((function(e,t){a[t]=c(e,r,s,n)})),a;if(a={},t instanceof e.Map){for(var l=t.entries(),h=l.next();!h.done;h=l.next())a[t.keyElem.valueToString(h.value[0])]=c(h.value[1],r,s,t.valueElem.resolvedType);return a}var u=t.$type,d=void 0;for(var E in t)t.hasOwnProperty(E)&&(u&&(d=u.getChild(E))?a[E]=c(t[E],r,s,d.resolvedType):a[E]=c(t[E],r,s));return a}return o.encode=function(e,r){"boolean"==typeof e&&(r=e,e=void 0);var s=!1;e||(e=new i,s=!0);var n=e.littleEndian;try{return t.encode(this,e.LE(),r),(s?e.flip():e).LE(n)}catch(t){throw e.LE(n),t}},n.encode=function(e,t,i){return new n(e).encode(t,i)},o.calculate=function(){return t.calculate(this)},o.encodeDelimited=function(e,r){var s=!1;e||(e=new i,s=!0);var n=(new i).LE();return t.encode(this,n,r).flip(),e.writeVarint32(n.remaining()),e.append(n),s?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))},n.decode=function(e,r,s){"string"==typeof r&&(s=r,r=-1),"string"==typeof e?e=i.wrap(e,s||"base64"):i.isByteBuffer(e)||(e=i.wrap(e));var n=e.littleEndian;try{var o=t.decode(e.LE(),r);return e.LE(n),o}catch(t){throw e.LE(n),t}},n.decodeDelimited=function(e,r){if("string"==typeof e?e=i.wrap(e,r||"base64"):i.isByteBuffer(e)||(e=i.wrap(e)),e.remaining()<1)return null;var s=e.offset,n=e.readVarint32();if(e.remaining()<n)return e.offset=s,null;try{var o=t.decode(e.slice(e.offset,e.offset+n).LE());return e.offset+=n,o}catch(t){throw e.offset+=n,t}},n.decode64=function(e){return n.decode(e,"base64")},n.decodeHex=function(e){return n.decode(e,"hex")},n.decodeJSON=function(e){return new n(JSON.parse(e))},o.toString=function(){return t.toString()},Object.defineProperty&&(Object.defineProperty(n,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:n.$options}),Object.defineProperty(n,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),n}(e,this);this._fields=[],this._fieldsById={},this._fieldsByName={},this._oneofsByName={};for(var s,n=0,o=this.children.length;n<o;n++)if((s=this.children[n])instanceof f||s instanceof h||s instanceof p){if(r.hasOwnProperty(s.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+s.toString(!0)+" cannot override static property '"+s.name+"'");r[s.name]=s.build()}else if(s instanceof h.Field)s.build(),this._fields.push(s),this._fieldsById[s.id]=s,this._fieldsByName[s.name]=s;else if(s instanceof h.OneOf)this._oneofsByName[s.name]=s;else if(!(s instanceof h.OneOf||s instanceof R))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[n].toString(!0));return this.clazz=r},u.encode=function(e,t,i){for(var r,s,n=null,o=0,a=this._fields.length;o<a;++o)s=e[(r=this._fields[o]).name],r.required&&null===s?null===n&&(n=r):r.encode(i?s:r.verifyValue(s),t,e);if(null!==n){var l=Error("Missing at least one required field for "+this.toString(!0)+": "+n);throw l.encoded=t,l}return t},u.calculate=function(e){for(var t,i,r=0,s=0,n=this._fields.length;s<n;++s){if(i=e[(t=this._fields[s]).name],t.required&&null===i)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(i,e)}return r},u.decode=function(t,i,r){"number"!=typeof i&&(i=-1);for(var s,n,o,a,l=t.offset,c=new this.clazz;t.offset<l+i||-1===i&&t.remaining()>0;){if(o=(s=t.readVarint32())>>>3,(n=7&s)===e.WIRE_TYPES.ENDGROUP){if(o!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+o+" ("+(r?r+" expected":"not a group")+")");break}if(a=this._fieldsById[o]){if(a.repeated&&!a.options.packed)c[a.name].push(a.decode(n,t));else if(a.map){var h=a.decode(n,t);c[a.name].set(h[0],h[1])}else if(c[a.name]=a.decode(n,t),a.oneof){var u=c[a.oneof.name];null!==u&&u!==a.name&&(c[u]=null),c[a.oneof.name]=a.name}}else switch(n){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 E=t.readVarint32();t.offset+=E;break;case e.WIRE_TYPES.STARTGROUP:for(;d(o,t););break;default:throw Error("Illegal wire type for unknown field "+o+" in "+this.toString(!0)+"#decode: "+n)}}for(var I=0,_=this._fields.length;I<_;++I)if(null===c[(a=this._fields[I]).name])if("proto3"===this.syntax)c[a.name]=a.defaultValue;else{if(a.required){var f=Error("Missing at least one required field for "+this.toString(!0)+": "+a.name);throw f.decoded=c,f}e.populateDefaults&&null!==a.defaultValue&&(c[a.name]=a.defaultValue)}return c},t.Message=h;var E=function(t,i,s,n,o,a,l,c,u,d){r.call(this,t,i,a),this.className="Message.Field",this.required="required"===s,this.repeated="repeated"===s,this.map="map"===s,this.keyType=n||null,this.type=o,this.resolvedType=null,this.id=l,this.options=c||{},this.defaultValue=null,this.oneof=u||null,this.syntax=d||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof h.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},I=E.prototype=Object.create(r.prototype);I.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)},I.verifyValue=function(t,i){i=i||!1;var r,s=this;function n(e,t){throw Error("Illegal value for "+s.toString(!0)+" of type "+s.type.name+": "+e+" ("+t+")")}if(null===t)return this.required&&n(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&n(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!i){Array.isArray(t)||(t=[t]);var o=[];for(r=0;r<t.length;r++)o.push(this.element.verifyValue(t[r]));return o}return this.map&&!i?t instanceof e.Map?t:(t instanceof Object||n(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&n(typeof t,"no array expected"),this.element.verifyValue(t))},I.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}},I.encode=function(t,r,s){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 r;try{var n;if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){r.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1);var o=r.offset;for(n=0;n<t.length;n++)this.element.encodeValue(this.id,t[n],r);var a=r.offset-o,l=i.calculateVarint32(a);if(l>1){var c=r.slice(o,r.offset);o+=l-1,r.offset=o,r.append(c)}r.writeVarint32(a,o-l)}else for(n=0;n<t.length;n++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[n],r);else this.map?t.forEach((function(t,s,n){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,s)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);r.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),r.writeVarint32(o),r.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,s,r),r.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,r)}),this):this.hasWirePresence(t,s)&&(r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,r))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return r},I.calculate=function(t,r){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 s=0;try{var n,o;if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(s+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),o=0,n=0;n<t.length;n++)o+=this.element.calculateLength(this.id,t[n]);s+=i.calculateVarint32(o),s+=o}else for(n=0;n<t.length;n++)s+=i.calculateVarint32(this.id<<3|this.type.wireType),s+=this.element.calculateLength(this.id,t[n]);else this.map?t.forEach((function(t,r,n){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);s+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s+=i.calculateVarint32(o),s+=o}),this):this.hasWirePresence(t,r)&&(s+=i.calculateVarint32(this.id<<3|this.type.wireType),s+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return s},I.decode=function(t,i,r){var s,n;if(!(!this.map&&t==this.type.wireType||!r&&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&&!r){n=i.readVarint32(),n=i.offset+n;for(var o=[];i.offset<n;)o.push(this.decode(this.type.wireType,i,!0));return o}if(this.map){var l=a.defaultFieldValue(this.keyType);if(s=a.defaultFieldValue(this.type),n=i.readVarint32(),i.remaining()<n)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+n+" required but got only "+i.remaining());var c=i.clone();for(c.limit=c.offset+n,i.offset+=n;c.remaining()>0;){var h=c.readVarint32();t=7&h;var u=h>>>3;if(1===u)l=this.keyElement.decode(c,t,u);else{if(2!==u)throw Error("Unexpected tag in map field key/value submessage");s=this.element.decode(c,t,u)}}return[l,s]}return this.element.decode(i,t,this.id)},t.Message.Field=E;var _=function(e,t,i,r,s,n,o){E.call(this,e,t,i,null,r,s,n,o),this.extension};_.prototype=Object.create(E.prototype),t.Message.ExtensionField=_;t.Message.OneOf=function(e,t,i){r.call(this,e,t,i),this.fields=[]};var f=function(e,t,i,r,s){n.call(this,e,t,i,r,s),this.className="Enum",this.object=null};f.getName=function(e,t){for(var i,r=Object.keys(e),s=0;s<r.length;++s)if(e[i=r[s]]===t)return i;return null},(f.prototype=Object.create(n.prototype)).build=function(t){if(this.object&&!t)return this.object;for(var i=new e.Builder.Enum,r=this.getChildren(f.Value),s=0,n=r.length;s<n;++s)i[r[s].name]=r[s].id;return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=i},t.Enum=f;var g=function(e,t,i,s){r.call(this,e,t,i),this.className="Enum.Value",this.id=s};g.prototype=Object.create(r.prototype),t.Enum.Value=g;var R=function(e,t,i,s){r.call(this,e,t,i),this.field=s};R.prototype=Object.create(r.prototype),t.Extension=R;var p=function(e,t,i,r){n.call(this,e,t,i,r),this.className="Service",this.clazz=null};(p.prototype=Object.create(n.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){for(var r=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)}},s=r.prototype=Object.create(e.Builder.Service.prototype),n=t.getChildren(e.Reflect.Service.RPCMethod),o=0;o<n.length;o++)!function(e){s[e.name]=function(r,s){try{try{r=e.resolvedRequestType.clazz.decode(i.wrap(r))}catch(e){if(!(e instanceof TypeError))throw e}if(null===r||"object"!=typeof r)throw Error("Illegal arguments");r instanceof e.resolvedRequestType.clazz||(r=new e.resolvedRequestType.clazz(r)),this.rpcImpl(e.fqn(),r,(function(i,r){if(i)s(i);else{null===r&&(r="");try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}r&&r instanceof e.resolvedResponseType.clazz?s(null,r):s(Error("Illegal response type received in service method "+t.name+"#"+e.name))}}))}catch(e){setTimeout(s.bind(this,e),0)}},r[e.name]=function(t,i,s){new r(t)[e.name](i,s)},Object.defineProperty&&(Object.defineProperty(r[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(s[e.name],"$options",{value:r[e.name].$options}))}(n[o]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:t.buildOpt()}),Object.defineProperty(s,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:t}),Object.defineProperty(s,"$type",{value:t})),r}(e,this)},t.Service=p;var T=function(e,t,i,s){r.call(this,e,t,i),this.className="Service.Method",this.options=s||{}};(T.prototype=Object.create(r.prototype)).buildOpt=o.buildOpt,t.Service.Method=T;var N=function(e,t,i,r,s,n,o,a){T.call(this,e,t,i,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=s,this.requestStream=n,this.responseStream=o,this.resolvedRequestType=null,this.resolvedResponseType=null};return N.prototype=Object.create(T.prototype),t.Service.RPCMethod=N,t}(t),t.Builder=function(e,t,i){var r=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||{}},s=r.prototype;function n(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,n(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}return r.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},r.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},r.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},r.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},r.isExtend=function(e){return"string"==typeof e.ref},s.reset=function(){return this.ptr=this.ns,this},s.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},s.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 s=[t];s.length>0;){if(t=s.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){var n=t.shift();if(r.isMessage(n)){var o=new i.Message(this,this.ptr,n.name,n.options,n.isGroup,n.syntax),a={};n.oneofs&&Object.keys(n.oneofs).forEach((function(e){o.addChild(a[e]=new i.Message.OneOf(this,o,e))}),this),n.fields&&n.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,n.syntax),t&&t.fields.push(e),o.addChild(e)}),this);var l=[];if(n.enums&&n.enums.forEach((function(e){l.push(e)})),n.messages&&n.messages.forEach((function(e){l.push(e)})),n.services&&n.services.forEach((function(e){l.push(e)})),n.extensions&&("number"==typeof n.extensions[0]?o.extensions=[n.extensions]:o.extensions=n.extensions),this.ptr.addChild(o),l.length>0){s.push(t),t=l,l=null,this.ptr=o,o=null;continue}l=null}else if(r.isEnum(n))o=new i.Enum(this,this.ptr,n.name,n.options,n.syntax),n.values.forEach((function(e){o.addChild(new i.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(r.isService(n))o=new i.Service(this,this.ptr,n.name,n.options),Object.keys(n.rpc).forEach((function(e){var t=n.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(!r.isExtend(n))throw Error("not a valid definition: "+JSON.stringify(n));if(o=this.ptr.resolve(n.ref,!0))n.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 r=!1;if(o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r)throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)")}var s=t.name;this.options.convertFieldsToCamelCase&&(s=e.Util.toCamelCase(s));var n=new i.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+s,t.id,t.options),a=new i.Extension(this,this.ptr,t.name,n);n.extension=a,this.ptr.addChild(a),o.addChild(n)}),this);else if(!/\.?google\.protobuf\./.test(n.ref))throw Error("extended message "+n.ref+" is not defined")}n=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},s.import=function(t,i){var r="/";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 s,o=i.root;if(e.Util.IS_NODE&&(o=require("path").resolve(o)),(o.indexOf("\\")>=0||i.file.indexOf("\\")>=0)&&(r="\\"),s=e.Util.IS_NODE?require("path").join(o,i.file):o+r+i.file,!0===this.files[s])return this.reset();this.files[s]=!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)&&(r="\\")):"string"==typeof i?this.importRoot?a=this.importRoot:i.indexOf("/")>=0?""===(a=i.replace(/\/[^\/]*$/,""))&&(a="/"):i.indexOf("\\")>=0?(a=i.replace(/\\[^\\]*$/,""),r="\\"):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 h=t.imports[c];if("google/protobuf/descriptor.proto"===h)continue;if(h=e.Util.IS_NODE?require("path").join(a,h):a+r+h,!0===this.files[h])continue;/\.proto$/i.test(h)&&!e.DotProto&&(h=h.replace(/\.proto$/,".json"));var u=e.Util.fetch(h);if(null===u)throw Error("failed to import '"+h+"' in '"+i+"': file not found");/\.json$/i.test(h)?this.import(JSON.parse(u+""),h):this.import(e.DotProto.Parser.parse(u),h)}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&&n(t);var d=this.ptr;return t.options&&Object.keys(t.options).forEach((function(e){d.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=d),t.enums&&(this.create(t.enums),this.ptr=d),t.services&&(this.create(t.services),this.ptr=d),t.extends&&this.create(t.extends),this.reset()},s.resolveAll=function(){var r;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(!(r=(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=r,r instanceof i.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof i.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.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(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}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()},s.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,r=0;r<t.length;r++){if(!i[t[r]]){i=null;break}i=i[t[r]]}return i},s.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},s.toString=function(){return"Builder"},r.Message=function(){},r.Enum=function(){},r.Service=function(){},r}(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 r=Object.keys(i),s=0;s<r.length;s++){var n=this.keyElem.valueFromString(r[s]),o=this.valueElem.verifyValue(i[r[s]]);this.map[this.keyElem.valueToString(n)]={key:n,value:o}}},r=i.prototype;function s(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}return r.clear=function(){this.map={}},r.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),i=t in this.map;return delete this.map[t],i},r.entries=function(){for(var e,t=[],i=Object.keys(this.map),r=0;r<i.length;r++)t.push([(e=this.map[i[r]]).key,e.value]);return s(t)},r.keys=function(){for(var e=[],t=Object.keys(this.map),i=0;i<t.length;i++)e.push(this.map[t[i]].key);return s(e)},r.values=function(){for(var e=[],t=Object.keys(this.map),i=0;i<t.length;i++)e.push(this.map[t[i]].value);return s(e)},r.forEach=function(e,t){for(var i,r=Object.keys(this.map),s=0;s<r.length;s++)e.call(t,(i=this.map[r[s]]).value,i.key,this)},r.set=function(e,t){var i=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(i)]={key:i,value:r},this},r.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));if(t in this.map)return this.map[t].value},r.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},i}(0,t.Reflect),t.loadProto=function(e,i,r){return("string"==typeof i||i&&"string"==typeof i.file&&"string"==typeof i.root)&&(r=i,i=void 0),t.loadJson(t.DotProto.Parser.parse(e),i,r)},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,r){return("string"==typeof i||i&&"string"==typeof i.file&&"string"==typeof i.root)&&(r=i,i=null),i&&"object"==typeof i||(i=t.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),i.import(e,r),i.resolveAll(),i},t}(),Re=48,pe=64,Te=80,Ne=96,Se=112,Oe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ce=e=>{let t=0,i=0;for(let r=e.length-1;r>=0;r--){if(i=Oe.indexOf(e.charAt(r)),-1===i)throw new Error('decode number error, data is "'+e+'"');t=62*t+i}return t},ve=(e=>{let t=0,i="";e:do{const r=e.charCodeAt(t++),s=r&Se,n=15&r;let o;switch(s){case pe:const r=n>>2,a=3&n;if(0===r||0===a)throw new Error("Data parsing error,at "+t);let l=Ce(e.substr(t,r));const c=Ce(e.substr(t+=r,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 Re:if(o=Ce(e.substr(t,n)),o!==i.length)throw console.log(i.length),console.log(o),new Error("Data parsing error,at "+t);t+=n;break e;case Te:o=Ce(e.substr(t,n)),i+=e.substr(t+=n,o),t+=o;break;case Ne:i+=e.substr(t,n),t+=n;break;case Se:if(n>10)throw new Error("Data parsing error,at "+t);i+=e.substr(t,16+n),t+=16+n;break;default:throw new Error("Data parsing error,at "+t+" header:"+s)}}while(t<e.length);return i})("upackage Modules;\nmessEH4kprobuf {\n EJ8iNotifyMsgEM5QR required int32 type = 1;\nET4hoptionalET4k64 time = 2ETFostring chrmId=3ExIp32 destroyType=4EY4a}IO2BkSyncRequestIT2Mh64 syncTI426IX27EX9kbool ispollIC24Ib2IEX7cwebIY2HER7iPullSend=IW25EWIiKeeping=5IW4LgsendBoxID34Id24b=6EcLibroadcastEe9a7EeLcendIl37a8IH2KucompressioEnabled = 9IS5GiUpStreamMEG7Iw7LbseI814cnIdIU5JIY78flassnaI78CEZHiontent = Ic5GEX7gpushTexEY4Ie5GEY7jappData = Ig57frepeatIc1AltoUserIds = Id5MfdelMsgI257IY5GI817Ea6Ir35Ia5GIP46iconfigFlaIN94IU55Ig1HlclientUniqueI356a0Il1MfextraCIa49a1IiDGePushEEa4Ie45cExtEb4IqDNjbusChannelEb4In5NhsystemIdEZ4Ii4GEZ8lenderPortraiIp14a2I8GMEF6cBitIw54a2IP2GfExtMsgIz65cextEB8c= 2IT2NemetadEZ7IH8GiReferenceI615crefIE18IP85IeBCEgEIcB6Ii1HIi77IS3GEV7dfromIQ96IhJRI9CBIM35I82CI27AI42MetitleIeLMs32 templateIdNoUseI82PIX84Ie25IhDRfConfigIi64IkDNIl1AInD8IG3CdDownI4HDbs I5H8IME7EYHe listICHJIDNHIgMLffinishIJJ5IJPJI8LKIX3JIj18I1C4EZ7IzMMmcredibleStartEg7IQHMEg8bEnIXM8IVHGIXMPICNHeytes Eg8bedIXB7IANHdChrmIC6YIG16I06zIv2KIuSHIv2MIXVHIV8II7QFI0EKIx2GIhJ7I7X4IjY8IRCNegroupISCCIFRSIt87IFRQIAQ9I95DIuI4Ii8EIg5GetatusIZ8JIcV7IgG5IO8IInIFIwPJIQb4direcEI4IrPKEZ6kplantform =ImPHEY6gisRemovId75IkPOfsourceIgPKI9SOIpHNI9SGIMEGI3JEEc8IIEJIbUGa1If5GILTLIm5NILTEIoVMfextStaIP76a2Is57IcYSIGTKc32 IeA5bUnIO24IHTKIrTKIlNNgconvertIW36IETHISUPIy5NISUCIv5GISUPI065I1GCIu1BILSFIyi8aqIOULISjAIlICIS14eenum IJGCIQ16fPERSONIC1AEG6aSIiGAeGROUPIQGAdTEMPEJ8Ip47oCUSTOMERSERVICEI2GAfNOTIFYIlFAbMCI2l8cMP=IK97eULTRAIJ18INE6Io29dFileIl2BdIMAGIW14Ik27eAUDIOIi2AdVIDEEF4Ii27cFILEi4Id27eSIGHTIT2AlCOMBINE_HTMLIZ28IA6CrGetQNupTokenInput IBMFIU29IHuNIS87ckeyI1MQjhttpMethodIWYQhqueryStrIrs6IhGNburIAE4IZANICn6IgUMcsizIVUKIqJ7bpTIY36Ir65Ic4FIqQ4gloadUrlIe4iI6PGIe4TefileNIDfBIY3OITZNIY36INZJIY3CIA8TcOutIX3JIBr8eadlinIY3RetokenIa3QcbosId15Ia3QfbosDatI7dKICO8batIZK4c5;\nEVLfosskeyI8H5IdpNhossPolicIH64ILuNfossSigIg24IYONiossBucketIt67c9;\nInSMl3Credential IOuQms3Algorithm =INuIEc9IY47IZUPa3IV39IHuPa3IV34eatureIZURbs3Ia3DIZU4EeMltcAuthorizatICY7IfvObtcIGV7fSha256ImUKEhAIl38IB6NcstcIb2EIC6OeminioId2GIxU8EjLIf2GI6VHEjCIh27I5VHEaCIj2DIBV4MR41MIzH7Im24dInfoIIVKIGAAIdt6IRyLIDJEIhFMIs1FcUrlIlF8I7oGIFKLImH6dnothIFN6Ig4NInh8IAV9IR1CIAIPIS1aMAD1CICbMdjoinIDX7I8hNereateILvQl32 memberCouIVmCIOgGjhatroomBanIke4ILvNl32 whiteListEd8I6bHIU44dPullMbM1qIfi8Il26IR4JIgm4IU16IpO7MhM1LISuKIptHkRelationQryIk8CIC19IEtJIZiMIp2RIYr6Mo019M2S1MeorderIC7JMSP17hEraseMsgIgnAMd21MI9gAI87GIS4PIzXMcqryI0YCI1nBIR4CcchaEC9I8uOdbotTI457Ijf9IB6JgFilter Mq21FJC661Ie5BIrz9IJqFbagMCC1KI867fTagTopIjdQdpageIAX8I26TI3DKIA48asIcHFIb27EV8ImL5binIrL5I94GIh27bFiMaC19IPAMIED4IOANIBDRa Me71bIZ4eI34KIY35I7HFI88QIeOGbusMdM1NMk91Iemsg =IiLMdreadMgW17IahObunEb4IiL5Is3PMu01DIHmMcverIVO4MtG1NII28cminIj16MQY1PIj1AIQENbUnIR37Ig55dmsgIIH97Me81MIs16bMeIu18I8eHIv97bBoMOY1AMkf1DIn1DIYVMM6U1FI5PFcmsgIC66IYFMIb26MDn15IDlOMTF15IZZ7IROHiQryRemindIlR4cReqIe2NM6H1AIlVOIp7DI7EMIH37IUOPI4r7Ie2WbspImGGIZ7PIzUHgleanHisEh5IxHAIErJeargetIZ6CMvJ1SIr37MNE1KIlB4IkF5Il6DI95VIA4HIy25hMsgBatchIo6AI5PCIW3GbinE64IC49IP5ClueryChatRoomIo44IKfRIpP5IIQOIoP5IFf9Ia1SIrNDI81FIHJ4iTotalNumsIVCCIbS9drmMeIsd4IyJ6cnfoMGG15IfcKEe7IecLMF127IRLNaiINL9IG3DgHistoryI29FMIf1HI09HMF32cIZVCIEbnIB9KIjMGIuRPIGVLhignoreCmMPt1AIK4NbOuIJVJMTi1Mb=1MRc1Ta=MZz1GIw36bhaIVB4ICRNM7h1KIJRMM7h1IIf4wIYWMI2aHbSeIWq5dsAttIQkFIirUI61NMwA1SeinboxIIoQMSP17EaAIr5JIlA4INE4IhL6ITS8Mwt1HIL27gMsgReadIR3LIXZZIrOGMk72OIC16M5u1SINLUgDeleteSIF57Io2EI2B7ET7IPP5IWx7IVI9I14JJQd01IN3CIJTMIHcBIx3uIVM5Jw371IC1DeOutPuID1vIai8cDelImRFIhmHcOpIIv25breEG6IomObclI4T6IoOKIE1GIJaMIJVCMcs1XI2WGMZO1RIh6CISDHIeA6IvPOI2vZI33OIVD9IoM8Ih18I5E4IX64ITDxMl61AMHC2eI3G9I9L4Mh02NM4u1CIp4KI8W4iKVEntity IH7MMUY16IBENevalueIw1PMUx19IGQMIdV4estampMVd1RIjX5Ml51MIlq7IAvKcSetIW36IhHIIs3BeentryIKCOabMOc26IY3JMxU2GgnotificIaD8Io3GI4AJMkb2IIq28bS M661HJr2P2IR26Mr41MIt2HbieI1hBIv2FiFullUpdatIO9NMAJ1ENv41O1IV3IbSVIk96InCDIJAPMRq1YIheDIb17I75SET7IE58hrrorKeysIHmNIq2HdkeysEI7ITmOIc1GIVIMISGDIxFFIQ25dCodeIb1KIxp7IVEKISGIImQMIa7JIf1HnSetUserSettingIJfOIv6AIxjHIjJCIvj8I8mKIO5AI0eJI82CIOgSI92OIg15greserveI92MbupIwC4I92RdPullII4rIg1EI92OMUv1FI32WInBMIa2Chtem itemIfBDIi2LMuB1II91FIiRMIQw8MUR2iIoSMMrQ2GIiH6InS8MoQ2MI338MlQ2JIHT9MJB28IveGcTagIU35dtagsMt42JEc7MKD1JMu11IEuJMzf15MMZ2AIqAUIT2EMwg16I334MzG18IY1OJVmU1Ic37M7Y1GI32CI955Ii25EA5MG31hIN3OIx9KEWCIW35Ixl7EHAI2ceII8SI9cTIOVCMBK25IO2HMJK27esSileM4Q16IF16bIsMOc16I627cTagIi1BgAutoTraIDp5InZJIb1AfModifyIVAPIY9nIeMnaGMqV2AIcQ5IzRNMCY2EI71RcSetI41eIqFHbunI414dLeveM7R19Ie1NeResulIUsOMnS1AMmS1hIF2TMe51OIH7DMSS1BIXPgIDRGIx3HIOA4Iw36NI7101IucAIt3fIU9WIlBHIm2AI4WZIyZOIQ4XmGrpReadReceipMzO3DMsr1EIdv5I26HIGLOMP21EIX19MmP1rMUT3AM1T3PMAD1QMP837dreadIhK6b4 MUv1MIc35ds= 5EW7MXB3KMXQ2AIlgHId37IVIAIg3hIYDJIuaMIF47Mcy1NI836MyB2PMw22AMuB2MMYU17MYy1bMZl1JIg58Mzp1NMav15Mtp18b EZObSiMRj15MvT2OMiw1CMlp18IF4GduserIMe5IcnMIr67MgE1OEaCIZfGIS4PIi1TJW871MQ71NIX8iIlEEI4B7Mko1IIaBEbspIvW5cresI4sXMiC3KIUzDISz7MFM3OIf7BMCO1MI87EI03UEb9Ivm9J53F1MEn1IIw1LJA8q1IC7LMg725IV5UIt2VMMK1XMIK1TMjc15aCMQW1LMq92AEW6I6r9MNT19IZ25IHt4Ec5E95MDi3PMAY16dListMr92PMjY17Il15IQrGIl1CEe6In17MNw2IIlTDMU225IsZLI548M6u16cNumMz81JcGrpMhg17Im15MqQ37IcVKEdCIEXLIoM5MNv1TMoG2EIIdJeTagAdMvi1MIWkbIXwDMA71uIC1DMD11OILZRdnameIzTKMXf29Ik45MIy3OcTopMj04JIP29cDelJd412Mr51BMHQ15McP18NqB111IHPEgportSDKMQg1SgsdkInfoIT16Ib2DgltraGrpMa346MT318M0j2ZMhe2aMEA1IIm1BMkk2hM0K1pIC24ehangeMBL2QMQd3TIlOIIWoGIbpJMRd3NfmsgUIDMXC1JI0NGMBV2qMUe3HMc32HILu6IqI5IWK9I7PGEZ5I16NM6Z2NILcNI569Ih7nMl527eeedCoIdWPMBY37enlineMRa1NI97II3HHeEventIh26IrQ5IZZFEVBN9p301dhasNMzK36a3IIqNIg2GInDIIL4BIPr6IF3NM871QeinessILXLMjr2QMTH1aMq13IcngeI217Mo83OjriginalId Myp1PEa8Mov2NMq539hcondaryIMkv2KI657eAdminMGL4OdaddiEG6dMarkIMr6Iv2MgperatorMhF4MM8R17bubIJ66MUJ18IqBMIw29Ed8MyQ4NM9c26bMeMQL3BICcGcextILo6MLL3HMxg2GMrp3KIBk6eeventI8k7M9L36IkLLIyCKI8GAIwCzIxCHI52LMfZ1VMA14jMkW1MIfNGIfBQIEONMIa1PIFOAIWBNIFODIVBqeisDelMbs2JJLBK1MSu2HIMBxIsi4M3O15JSBa1MIS1CJM991IUC8Id16IZ15M8M25M5o35IY95c //IE2GEjGISTLI29AIQZNI5AAM0K2rIO48cAckM1O4oIH7EhnotExistMzb48IKXHbOpIFA4heStatus MW11XIMRTMzL1NMiG17M7t1DMcL2mIh2DMPC27IZj8MYO2ZIuRHMpC25IJO8MWx29I859In17MdG3CIXX8EcIjSummary suE86c= 4IILHIJ1CNH71N1I9yGMXr2NIH68Mxm2MEF4I1jAI634Eb4IJ6JIm37NXA1T1Mmu2WIF3DMMD1DfSetRtcMX035Mt11MI927b rEc8MU73KgallInfoMzL28MkT2QIbGPddataINt7I7wIIY18IkFAJa161IGJIaaMGq25MR216I42CbKvMp11RIanGEvEMEg1SIo17IqIJIp14IdDAIO4HEV7MWZ2RMTx1UMqf1SI1zJIEQyIwNYMgx3KcartImM8MPV4OcndMEY7Mas4JMsG1AMf01OMas4VM1t1TIO4II49HMBO1GMGE3Mdnum ID8IMkK1CMnI1CM6f1LM6O1BIB4JMGJ1BMYO1HEX5IpyNM7a3WM7G1BMLY1RMp15AIzvLimentionedIH7QcCntIK7DMNq2qMMD2RIeARMRe1LMQe1RIk28MWb1IMdP17Ir64fresultMzO3KEbBM3X1nImO4M5p3RbtmMiJ1MMGy15MoJ15bubIi5JIak9MJF2GMkR2ChubDetailEe4EH4Mi71NIPaSM3c27cxpiIFX6MQM1LIg19Ib4MI227If4AIl3RMzZ3JIG3OMAf4NcubTM9f4FMnW2HIS5OMxj2aMcl1CIa1IbUlIa1AIH3PIQz5I5jEIA2PMwB1WMHo1dMbv3JcullICNKIe2CIM6xInADMFs2NIs69I9AaI9BQI93HMLU15fubDataIs7WMjS1SgneedAllM8q48Iq5YMsg2LID29IV8IER7IQ57IX8aMXK1dJb8J1Ik2EI6GNItq5cStrMPN4RIfGBMBY2HIb16IQf5Mcr3QIb99I7kJI317IJLLhplatformMTr3CEbHMiC3RIF6HINYIcrySI8ASISNxIxEGgProfileIdJtIuXGI929IP17Ih45Eb4If18InUIEgGcExtEjAILPHEkCMo23iMEh2KMyy2JIX17Msc1QM083iIUYIpcensorFailedFielMKD15M2x2PIH29MNH2HIA6GI3TII11AMhQ5HI68CII8CI91UMqk3sI31BePermiM8u15ImDNEWAMju2LdarchI7BRMU629MEK5AMAC3IIBf5Mwd3DMZ21hMnH1ZIoACbseMhw15IHCccextIDCFIx1IdBaseEj5abE98MiA2QIIG7MtL17IC4IIE19IE4MMv225McQ18MCR1NbwnILoNMXj4JIjMMMXj4EInMIIy68ML74PMfA15M8A15Mvp1TafMvQ56Mts4OMtr15Ic2MiprocessCoM8K35Ia6NgsJoinedIP55Iep8Ig6MEn8IkR5IOK8Mi948MYY1GlFriendInviteEj5bfrEHFMoY1IEq6IX19Eo6EF9MJg4IIxISMji57IXqCdultiIA38IMugI74HISE6MSI2EMgz1HJBFR1EZ9dQuitIe18MsB27IJF8It47M4b1RMHj2QIcA8IagDMp41DIv1IIb3FIDc7Eg4Mtg4QMKv35IsmPEW5eWhiteM3w2PEY4cAttMQ216ITETMwa17JL6Q1If18jPageParam Iog4IC6QbidIA6QbroMNP57MSp2OMir4AI7LPID2BI9dMMOo27I6vdMR52hM2W2BMhX19M8N4PMK528I73JMuZ47Mo93AI51FIOE4IIgEMnl1FM8716Iu6nIgU4IjULIQJ4Mjd16INK6MGx4MEfHImqDIV1NI7K8IN1PIeK9IF1ZIvNAIH1PIUOBIJ1EIW2RIpZOMeN2FIm5HI214cExtIbX8MkH2QbpTMgH2TM416EMVJ1OMGJ56IOJIII2KIf9LIPE4IixPMNH5BMb93UdNickMod5UMEC2AIR3QfremarkIA17MyU4LcisBIgL5MFa6NbanM7D6VMjt48MDm27Iv4JMal26MjE16JfLS1Mzm1WIe5PMjZ6OIe5CMDB3NISSDMp22HI5DJI14eIdkcIMlSIdkDMW74NIdkKIkeOIECCI0e8Mu44MIgJNI48uIWHAILD4IMeBI2NOEZ9binI724El8MA81NMsI48I4UMMNF69I9UTIoF5IL8BMZh6KME615Mh95OdapplM4e28MuG2GIT3HIil7IT37MTC6MEa7Ion8MHO5HItEEgResponsJvET1IAD8IhU8Mfy1OIjV8IoEPIK89MtO4KIZb8I887MFu5RIS6EIY4QNX01T1IMJDMD81LIbr8Mrz4uM5a3XM8B28Ix1MMXi4MIy1qIU1JeCheckMd84MEY6EXCIbYPEhIIm4tIdG9Iq2NMIC1JMaB2oIAVDIgNkIM2PID5MIBzSMaC1HII16I7rQMJe37EW4I9kNIejPIdGMMG216MpI5BII2II6guMWz18Mnp46MCP3TIA2AIqIPM0917IdcqI8hEIgINI8hEM5P3GIY8PIKP7IGHNMa819I55lIs2EMjh1OIs2DI05MMrf4CI5EQMbw2NMYF1DI15NITJ7Mmn3MIb7DMtT3HIYI7IDw4J6KT1Mw145cSetIixNMQ247IrJOIwuPIpCFI0LVIQ8AIB1NIx8BI7wREi6aAIdZ4Mg635IQ3MI9a6Mxv5SIa6DI6RZJku71INWHIE35MqP2DMv11WI7B6MVe5PEt6IY45MAo1KIDeHcoptIRiBIpLOMvP1PIePGMvP1TIOnNIW1JdFullIYnCIfBII774MDx26IM8LMuQ39Ih95IIDQIM8IIiOJITw5If1SIcM6IW87IUsSIXLDIn1HcAddM0G46ePerioMMf2TMzC6CMUO4MispanMinutMMz45IdQMIQG8MJO3OgimezoneMeC5QIp2XMal1XIdW5J9191I91CMRQ6SbisM6179M332OIf5BMGD5NIf5DIjQMIf58MIP7OIf5AI1HHMvQ27I9ASN0y3U1MQa2DIpTMMnw3CMXg1GMYy3GMyx36MO61IMH676MqO5OMiC39MTU35M6P1TM4V39M6m2NmSpeechToTextIEa4M7a7sfobjectIDkEMyf3QMZ31NfampleRMKr6MM1L3AjnelNumber ISePfformatITZQMLd68I9xII469Myx5SI56jMZ019I76TMuW1MIlL9I517MMl6OIJ17MMe4KdransMK62JEO5I085ctraEA6MvR2QcmodMP33LM9c76dorceMPp48I8oHI427McO2IEP8IV34Ic36I42dIW1HIUkREe7Mkr36InfNI514IqaUbteM4Q2SI315dFileINa6Mow6OMYS75aLMnR15IBBNIYi6EZ6MDk6MMtA65aSMkT76IKBKIU5CIP4pIN3CICBEIM3UMnr3TEZ6IiFNMY226MgA7NIp3BMaR1JMB345MMx3Acq {Mqb4IMqZ67Mo84AMFS4dIvA9IJA9M1M3AMSK2LMZz3KM9t2AET8Mz627ICRMdnextMYp4FMFq7hIF3GMXa2HM3Y5dIm2AIXKLII4DMk24jMtW7DbacEB4I2W6creaM1h78M7K4OM4t6OMGS2WMpm6UIx4DM9K4HMBw1GMFK4PMGl6NEU7ET7MrD57Mrx1xIg7BMIs7uIN2ENSS3N1MoE4QI37MMyN8HMoD66IBs6EB5M5r1LEcBIxALMl536I0QNM8926Iid6IJfMEZ7cMeCMNd4RjclearTime=MrL6NeutOffEX5I8KGMCd6EgfirstUnEJ7IJKCMxK55Iqv4MpK5BgKICK = Mus37eREFUSMNf7BgCOEXISTMX55LgtcValueM6R3UMrg5ZIN1FIxpRdroomMXL15M5v3NMZ988Ea5I8HHIq2CI0e5eInnerM6s4NMYy29bSyIpA4MOE75IlKJbIdIf74btyMex3BbidEJHI8RIIH69MNk1IIwmAIr2CbinIm27MC45BEgMeouterEg8MXG1HcRtcIVhSIfv7Ih5KMPh5KIZ95IC4JIU16mAnchorToVieweMty2BEG6bToEW6Ik9KcBotM5J1SMUK26IHyHcBotIY36EsFIG15ffo botEuOEW4IdJMM0A65b1;MjH4MMVP1yIBL8MYA4FME249MXz76Mys66Mkz7AMcK8PMeP1QMht47Me915MJ72CMI34EIn1AM2x2UIH4MM3x2PIQV8NEg101JMP21MAW3KI2sKIm27MAt1KMtA8KMVa1OMPj8AMFh7NMPj8AMEh7NMbi4DM4Q8HIV58M484AMN35IMs226M5q3NI318M1955cQryJb6o1Mlc3TImZRMZJ2LcallMm457IS6OIMbBMLO7JIJ46M9t2NI62GMR21MIsbHMxH4HMwD15IYC7Mk876EG8MtI5tIK1FMFg3qIs88I3aDMlD1BIq2BInkSEf8JQ9r1J1GE1IU9VMAj2DIrFNIz6CMC39TIpFSJSAM1MUY3XI88ZMfr3JES6Iv44Jv2v1IrvHIv2fMsB1RIs8DMV12OICMDIOnMduserIJnMM6s56cserII25MgQ5KIa5AEe5Mr74MEbBMh42tIC3IIa1KMOX1SJvFf2Mrm3FI7lHIv5GMEp5QIY7AIskHePSelfMXu6QN501d1d32 pMaM18M4B1MIRg6M1r3IcSrsMrA1Mj64 lastMsgIt86IT9McdelIO9Eb}\n3TV9");var me,Ae;var Me,ye,be,Pe,Le,Ue,De;me=new WeakSet,Ae=function e(t,i){if(t instanceof Array)return t.map((t=>f(this,me,"m",e).call(this,t)));if(r=t,"[object Object]"!==Object.prototype.toString.call(r))return t;var r;if(t instanceof ge.ByteBuffer)return t.toArrayBuffer();if(t instanceof ge.Long)return i?t.toString():t.toNumber();const s={};return Object.keys(t).forEach((i=>{const r=t[i],n="ExtMsgData"===t.$type.name&&"seqId"===i;s[i]=f(this,me,"m",e).call(this,r,n)})),s},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"}(Me||(Me={})),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"}(ye||(ye={})),function(e){e[e.IsSilent=1]="IsSilent",e[e.IsTop=2]="IsTop",e[e.Tags=3]="Tags",e[e.AutoTrans=4]="AutoTrans"}(be||(be={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Pe||(Pe={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Le||(Le={})),new class{constructor(e){me.add(this),Object.defineProperty(this,"pbModules",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=ge.loadProto(e);this.pbModules=t.build("Modules").probuf}encode(e,t){return this.pbModules[e].encode(t).toArrayBuffer()}decode(e,t){try{const i=this.pbModules[e].decode(t);return f(this,me,"m",Ae).call(this,i)}catch(t){const i=`name: ${e}, stack: ${t.stack}`;throw null===console||void 0===console||console.error("pb decode error!",i),t}}}(ve),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"}(Ue||(Ue={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(De||(De={}));const we="RC:TxtMsg",Ve="RC:VcMsg",ke="RC:HQVCMsg",Ge="RC:LogCmdMsg",Fe="RC:MsgExMsg",Be="RC:ReferenceMsg",He="RC:RcCmd",xe="RC:RcNtf",Je="RC:ReadNtf",Ye="RC:RRReqMsg",je="RC:RRRspMsg",We="RC:SRSMsg",Ke="RC:RRMsg",Xe="RC:RSMsg",Ze="RC:Delivered",qe="RC:DRMsg",Qe="RC:ChrmMemChange",$e="RC:ChrmSyncMsg",ze="RC:ChrmBlockMsg",et="RC:ChrmBanMsg",tt="RC:CCConfigChangeRequestMsg",it="RC:CmdMsg",rt="RC:CmdNtf",st="RC:InfoNtf",nt="RC:GrpNtf";var ot,at,lt,ct,ht,ut,dt,Et,It,_t,ft,gt,Rt,pt,Tt,Nt,St,Ot,Ct,vt,mt;!function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(ot||(ot={})),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"}(at||(at={})),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"}(lt||(lt={})),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"}(ct||(ct={})),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"}(ht||(ht={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(ut||(ut={})),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"}(dt||(dt={})),function(e){e[e.typing=0]="typing"}(Et||(Et={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}(It||(It={})),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"}(_t||(_t={})),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"}(ft||(ft={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}(gt||(gt={})),function(e){e[e.NOT_SET=0]="NOT_SET",e[e.INVISIBLE=1]="INVISIBLE",e[e.EVERYONE=2]="EVERYONE",e[e.FriendVisible=3]="FriendVisible"}(Rt||(Rt={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(pt||(pt={})),function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Tt||(Tt={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(Nt||(Nt={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(St||(St={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(Ot||(Ot={})),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"}(Ct||(Ct={})),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"}(vt||(vt={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(mt||(mt={}));const At=e=>e<=vt.NOT_SET?mt.CLOSE:mt.OPEN;var Mt,yt,bt,Pt,Lt,Ut,Dt,wt,Vt;!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"}(Mt||(Mt={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(yt||(yt={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(bt||(bt={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(Pt||(Pt={})),function(e){e[e.CURRENT=2]="CURRENT"}(Lt||(Lt={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(Ut||(Ut={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Dt||(Dt={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(wt||(wt={})),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"}(Vt||(Vt={}));const kt=0,Gt=0,Ft=0;var Bt,Ht;!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"}(Bt||(Bt={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(Ht||(Ht={}));const xt=72e5,Jt=6e4,Yt="5.48.0".replace(/-.+$/,""),jt="rongcloudsystem",Wt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{},Kt="engine";Wt[Kt]="5.48.0-alpha.1";class Xt{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)&&(Wt[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 Wt[Kt].match(/\d+\.\d+\.\d+/)[0].split(".").map((e=>e.padStart(3,"0"))).join("")>=i}static getInfo(){return Wt}}const Zt={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),r=Math.floor(Math.random()*t).toString(36),s=e-i.length-r.length;var n;return[r,i,s>0?(n=s,Array.from({length:n}).map((()=>Math.floor(36*Math.random()).toString(36))).join("")):""].join("").slice(0,e)}},qt=Zt.genWithLen(22),Qt=Date.now(),$t=e=>-1!==Object.prototype.toString.call(e).indexOf("Array"),zt=e=>(e=>"string"==typeof e)(e)&&/https?:\/\//.test(e),ei=e=>{for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},ti=e=>({isRead:(e&Mt.READ)===Mt.READ,isListened:(e&Mt.LISTENED)===Mt.LISTENED,isDownload:(e&Mt.DOWNLOADED)===Mt.DOWNLOADED,isRetrieved:(e&Mt.RETRIEVED)===Mt.RETRIEVED}),ii=e=>[_t.iOS,_t.Android,_t.Web,_t.PC,_t.Mini,_t.HarmonyOS].map((t=>{const i=e.findIndex((e=>e.platform===t));return-1===i?{platform:t,changeTime:0,eventValue:0}:e[i]})),ri=(e,t,i)=>t?1===i?fe.TLS:fe.RMTP:"http"===e?fe.WS:fe.WSS,si=(e,t)=>{const{server:i,backupServer:r,bs:s,serverAddr:n,protocol:o,openTLS:a}=e;if(n){return[...n.filter((e=>e.addr))]}const l=[],c=[];return i&&c.push(i),(r||s||"").split(",").forEach((e=>{c.indexOf(e)<0&&c.push(e)})),c.forEach(((e,r)=>{e&&l.push({addr:e,protocol:ri(o,t,a),weight:i.length-r,race:!1})})),[...l]},ni=e=>{if(void 0===e)return;const t=Number(e);return Number.isNaN(t)?void 0:t},oi=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{}),ai=(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},li=(e,t)=>{const i=Math.floor(1e3*Math.random()%1e4),r=Zt.gen(),s=(e=>{e=e||"-";const t=new Date;return`${t.getFullYear()}${e}${t.getMonth()+1}${e}${t.getDate()}`})(),n=(new Date).getTime();let o="";if(t){const e=t.split(".");o=`.${e[e.length-1]}`}return`${e}__RC-${s}_${i}_${n}${r}${o}`},ci=(e={},t={},i={})=>{const{channelIdMi:r,templateIdMi:s,templateParamMi:n,channelIdHW:o,channelIdOPPO:a,typeVivo:l,importanceHW:c,categoryHW:h,imageUrlHW:u,categoryVivo:d,importanceHonor:E,imageUrlHonor:I}=t,{APNS:_,FCM:f}=((e={},t={})=>{const{threadId:i,apnsCollapseId:r,category:s,richMediaUri:n,interruptionLevel:o}=e,{googleConfig:a}=t,l={};l["thread-id"]=i||"",l["apns-collapse-id"]=r||"",l.category=s||"",l.richMediaUri=n||"",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 h=null==a?void 0:a.priority;return h&&!["high","normal"].includes(h)&&(h="normal"),c.priority=h,{APNS:l,FCM:c}})(e,t),g=[{HW:{channelId:o||"",importance:c||"NORMAL",image:u||"",category:h||""}},{MI:Object.assign(Object.assign({channelId:r||""},s?{templateId:s}:{}),n&&Object.keys(n).length>0?{templateParam:n}:{})},{OPPO:{channelId:a||""}},{VIVO:{classification:l||"",category:d||""}},{APNS:_},{FCM:f},{HONOR:{importance:E||Ot.NORMAL,image:I||""}},{OHOS:{category:i.category||null,image:i.image||""}}];return JSON.stringify(g)},hi=()=>{const e=Xt.getInfo();let t="electron";for(let i in e)"engine"!==i&&(t=["imlib-v2-adapter","imlib-next"].includes(i)?i:"electron");return t};function ui(e,t){var i;if(!e)return"";const r="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)?r?e.replace(/^https?:\/\//i,"https://"):e:t!==fe.HTTP||r?`https://${e}`:`http://${e}`}const di=(e,t)=>{if(!e)return"";const{ossConfig:i=""}=e;let r="";try{const e=JSON.parse(i);if(e.length>0){const t=e.find((e=>e.minio));t&&(r=t.minio)}}catch(e){t.warn(M,JSON.stringify({ossConfig:i,error:e}))}return r};var Ei;class Ii{constructor(){Ei.set(this,!1)}stopPropagation(){g(this,Ei,!0)}get isStopPropagation(){return f(this,Ei,"f")}}Ei=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,r,s=0){const n=Symbol(),o=this._map.get(e)||this._map.set(e,[]).get(e),a={symbol:n,priority:Math.min(s,100),listener:t.bind(r),once:i},l=o.findIndex((e=>e.priority>s));return-1===l?o.push(a):o.splice(l,0,a),n}on(e,t,i,r=0){return this._addItem(e,t,!1,i,r)}once(e,t,i,r=0){return this._addItem(e,t,!0,i,r)}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 Ii;for(let r=0;r<i.length;r+=1){const{once:s,listener:n}=i[r];s&&i.splice(r,1);try{n(e,...t)}catch(e){null===console||void 0===console||console.error(e)}if(e.isStopPropagation)return}}[...this._piped.entries()].forEach((([i,r])=>{(0===r.length||r.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 fi{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 fi(e,t||`fail: ${e}`,i)}static ok(e,t){return new fi(0,t||"success",e)}static fail(e,t,i){return new fi(e,t||`fail: ${e}`,i)}next(e){return _(this,void 0,void 0,(function*(){return this.isOk?e(this.data):this.wipe()}))}or(e){return _(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):Ri(this.code,this.msg)}}const{ok:gi}=fi,{fail:Ri}=fi,pi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Ti(e){let t,i,r,s,n,o,a,l="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c<e.length;)s=pi.indexOf(e.charAt(c++)),n=pi.indexOf(e.charAt(c++)),o=pi.indexOf(e.charAt(c++)),a=pi.indexOf(e.charAt(c++)),t=s<<2|n>>4,i=(15&n)<<4|o>>2,r=(3&o)<<6|a,l+=String.fromCharCode(t),64!==o&&(l+=String.fromCharCode(i)),64!==a&&(l+=String.fromCharCode(r));return l}const Ni=()=>{let e,t=new Promise((t=>{e=t}));return{resolve:e,promise:t}};function Si(e={}){const t={};return Object.keys(e).forEach((i=>{"x-user-agent"!==i.toLowerCase()&&(t[i]=e[i])})),t["X-User-Agent"]=["Web",...Object.entries(Xt.getInfo()).map((([e,t])=>`${e}@${t}`))].join("|"),t}function Oi(e){if(!e||0===e.length)return[];const t=new Set;return e.forEach((e=>{t.add(e)})),Array.from(t)}var Ci;!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(Ci||(Ci={}));const vi=0,mi=1;var Ai;!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"}(Ai||(Ai={}));const Mi={[Ai.BJ]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5yb25nLWVkZ2UuY29t","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ucm9uZy1lZGdlLmNvbQ==",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnJvbmctZWRnZS5jb20=","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5yb25nLWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5yb25nLWVkZ2UuY29t"]},[Ai.SG]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zZy1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2ctbGlnaHQtZWRnZS5jb20=",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWxpZ2h0LWVkZ2UuY29t","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1saWdodC1lZGdlLmNvbQ=="]},[Ai.NA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi51cy1saWdodC1lZGdlLmNvbQ==","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24udXMtbGlnaHQtZWRnZS5jb20=",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnVzLWxpZ2h0LWVkZ2UuY29t","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC51cy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy51cy1saWdodC1lZGdlLmNvbQ=="]},[Ai.SG_B]:{naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWItbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1iLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1iLWxpZ2h0LWVkZ2UuY29t"]},[Ai.SA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zYXUtbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2F1LWxpZ2h0LWVkZ2UuY29t",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNhdS1saWdodC1lZGdlLmNvbQ==","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zYXUtbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zYXUtbGlnaHQtZWRnZS5jb20="]},[Ai.OM]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5vbS1saWdodC1lZGdlLmNvbQ==","bmF2LWIub20tbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ub20tbGlnaHQtZWRnZS5jb20=",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLm9tLWxpZ2h0LWVkZ2UuY29t","d3MtYi5vbS1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5vbS1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIub20tbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9kdWFsc3RhY2stc3RhdHMub20tbGlnaHQtZWRnZS5jb20="]}};function yi(e){return Ai[e]?e:Ai.BJ}const bi=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:r}=this.initOption||{},s=function(e=Ai.BJ){return Mi[yi(e)].naviUrlBase64}(i).map((e=>Ti(e)));let n=[];const[,o]=e.split("@");t&&(n=o?o.split(";"):[]);const a=r&&r.length>0?[...n,...r]:[...n,...s];return a.filter(((e,t)=>a.indexOf(e)===t)).map((e=>ui(e)))}getLogUrlPolicyList(e,t){const{log:i,logPolicy:r}=e||{},{areaCode:s,logServerUrl:n}=this.initOption||{},o=function(e=Ai.BJ){return Mi[yi(e)].logUrlBase64}(s).map((e=>Object.assign(Object.assign({},e),{addr:Ti(e.addr)}))),a=[],l={level:1,itv:6,times:5};if(i)a.push(...i.addrs),Object.assign(l,i.policy);else if(r)try{const e=JSON.parse(r);a.push({addr:e.url,protocol:fe.HTTPS,weight:1}),l.level=e.level,l.itv=e.itv,l.times=e.times}catch(i){t.warn("L-parse_navi_logpolicy-E",JSON.stringify({policy:e.logPolicy}))}const c=n?[{addr:n,protocol:fe.HTTPS,weight:101},...a]:[...a,...o];return{policy:l,addrs:c.filter(((e,t)=>c.findIndex((t=>t.addr===e.addr&&t.protocol===e.protocol))===t)).map((e=>Object.assign(Object.assign({},e),{addr:ui(e.addr,e.protocol)}))).sort(((e,t)=>t.weight-e.weight))}}getMiniCmpUrlList(){var e;const t=function(e=Ai.BJ){return Mi[yi(e)].miniCmpBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>Ti(e))),{miniCMPProxy:i}=this.initOption||{};return i&&i.length>0?i:t}getStaticConfigUrl(){var e;return function(e=Ai.BJ){return Mi[yi(e)].staticConfigUrlBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>Ti(e)))}getCloudControllerUrl(e){var t;return function(e=Ai.BJ){return Mi[yi(e)].cloudControllerUrlBase64}(null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode).map((e=>Ti(e)))}getAreaCode(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:Ai.BJ}setAreaCode(e){return!(!e||!Ai[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)}getStatsUrlList(e){var t;const{active:i,activeServer:r}=e||{};let s=(null==i?void 0:i.addrs)||[];const n=function(e=Ai.BJ){return Mi[yi(e)].statsUrlBase64}(null===(t=this.initOption)||void 0===t?void 0:t.areaCode).map((e=>Ti(e))),o=[];return 0!==s.length?o.push(...s.sort(((e,t)=>t.weight-e.weight)).map((e=>ui(e.addr,e.protocol)))):r&&o.push(ui(r,fe.HTTPS)),n.forEach((e=>{o.includes(e)||o.push(e)})),o}};class Pi{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(){return _(this,void 0,void 0,(function*(){var e;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=>ui(e.addr,e.protocol)))||[]}}}catch(e){this.logger.error(v,JSON.stringify({error:null==e?void 0:e.stack}))}this.clearCache()}const i=yield this._requestHandle();if(!i)return;const r=yield this.decryptData(i);if((null==r?void 0:r.areaCode)!==bi.getAreaCode())return;this.setCache(JSON.stringify({time:Date.now(),val:i})),this.staticUrls=(null==r?void 0:r.bootstrap)||[];const s=null===(e=null==r?void 0:r.resources)||void 0===e?void 0:e.navi.slice();return s.sort(((e,t)=>t.weight-e.weight)),{navi:s.map((e=>ui(e.addr,e.protocol)))||[]}}))}_requestHandle(){return _(this,void 0,void 0,(function*(){let e=[...this.staticUrls,...bi.getStaticConfigUrl()].map((e=>ui(e)));e=e.filter(((t,i)=>e.indexOf(t)===i));for(let t of e){const e="L-get_static_conf-R";this.logger.info("L-get_static_conf-T",JSON.stringify({url:t}));const i=Date.now(),{code:r,data:s}=yield this.sendRequest(`${t}/${this.appkey}`);if(200===r)return this.logger.info(e,JSON.stringify({url:t,code:r,duration:Date.now()-i})),s;this.logger.warn(e,JSON.stringify({url:t,code:r,duration:Date.now()-i}))}}))}}var Li;!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"}(Li||(Li={}));class Ui{constructor(e,t,i,r){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:r}),Object.defineProperty(this,"outputLevel",{enumerable:!0,configurable:!0,writable:!0,value:Li.WARN}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Li.DEBUG)}),Object.defineProperty(this,"info",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Li.INFO)}),Object.defineProperty(this,"warn",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Li.WARN)}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Li.ERROR)}),Object.defineProperty(this,"__statistics",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Li.STATISTICS)}),Object.defineProperty(this,"record",{enumerable:!0,configurable:!0,writable:!0,value:this.__statistics})}_write(e){const{tag:t,level:i,content:r,traceId:s}=e;/^[\w-]+$/.test(t)?i!==Li.DEBUG&&this.proxy.write(e):console.error(`${(new Date).toISOString()}[${this._id}]['ERROR']: ${t} | ${r} | ${s}`)}createTraceId(){return""+ ++Ui._traceIdCount}getSessionId(){return qt}_stdout(e){const{time:t,tag:i,content:r,traceId:s,level:n,loggerId:o}=e;if(!console)return;if(n<=Li.FATAL)return;if(n>this.outputLevel)return;const a=["error","warn","info","debug"][n-1],l=`${new Date(t).toISOString()}[${null!=o?o:this._id}][${(a||"stat").toUpperCase()}]: ${i} | ${r} | ${s}`;console[a||"warn"](l)}setOutputLevel(e){(e=>[Li.DEBUG,Li.INFO,Li.WARN,Li.ERROR].some((t=>t===e)))(e)&&(this.outputLevel=e)}_log(e,t,i,r){const s={time:Date.now(),level:e,tag:t,content:i,traceId:r,loggerId:this._id,sessionId:this.getSessionId(),type:this._type};this._stdout(s),this._write(s)}summary(e,t,i,r={},s,n){if(t.isOk){const n=null==s?void 0:s(t.data);this.info(e,JSON.stringify(Object.assign(Object.assign({isOk:!0},r),n)),i)}else{const s=null==n?void 0:n(t.data);this.warn(e,JSON.stringify(Object.assign(Object.assign({code:t.code,msg:t.msg},r),s)),i)}}}Object.defineProperty(Ui,"_traceIdCount",{enumerable:!0,configurable:!0,writable:!0,value:0});class Di{constructor(e,t,i,r,s=!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:r}),Object.defineProperty(this,"disableLogReport",{enumerable:!0,configurable:!0,writable:!0,value:s}),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,t,i,r,s,n){return _(this,void 0,void 0,(function*(){let s=[];try{const o=yield this.logDB.read(e,t,i,r,n);$t(o.logs)&&(s=o.logs.filter((e=>!(!e||"object"!=typeof e))))}catch(e){}return{logs:s}}))}checkStart(e,t){return _(this,void 0,void 0,(function*(){if(this.started)return;if(this.userId=e.userId,!e.logSwitch||this.disableLogReport)return;const{policy:i,addrs:r}=bi.getLogUrlPolicyList(e,this.logger);this.started=!0,this.itvByNavi=i.itv,this.timesByNavi=i.times,r.length>0&&this.realtimeReport(r[0].addr,i.level,i.itv,t)}))}_sendLogs2Realtime(e,t,i,r){return _(this,void 0,void 0,(function*(){const{success:s,data:n}=yield this.compressLogs(e);if(!s)return{isOk:!1,itv:r};let o=zt(i)?i:`https://${i}`;o+=`?version=5.48.0-alpha.1&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.getDeviceId()}&deviceInfo=${this.deviceInfo}&platform=Web`;const{status:a,data:l}=yield this.send({url:o,body:n,method:"POST"});if(200!==a)return this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(r+=r),this.reportFailedNumber++,{isOk:!1,itv:r};let c,h;if(this.reportFailedNumber=0,l)try{const e=JSON.parse(l);e.nextTime&&(r=e.nextTime),c=e.level,h=e.logSwitch}catch(e){this.logger.warn(M,JSON.stringify({error:null==e?void 0:e.stack}),t)}return{isOk:!0,itv:r,level:c,logSwitch:h}}))}realtimeReport(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=Date.now(),n=this.logger.getTimestamp4RealtimeLog()||Qt,o=Math.max(s-3e4,n+1),a=this.logger.createTraceId(),{logs:l}=yield this._getLogs(n,o,t,!0,a,r);if(0===l.length);else if(l.length>0){const{itv:r,level:s,logSwitch:n,isOk:o}=yield this._sendLogs2Realtime(l,a,e,i);if(o){const e=Math.max(...l.map((e=>e.time)));this.logger.setTimestamp4RealtimeLog(e+1),0===n&&(this.started=!1),void 0!==s&&(t=s)}i=r}this.started&&(i>=60&&this.itvByNavi<60&&(i=60),this.timer=setTimeout((()=>this.realtimeReport(e,t,i,r)),1e3*i))}))}report(e,t,i,r,s,n){return _(this,arguments,void 0,(function*(e,t,i,r,s,n,o=!1){if("web"!==i.toLowerCase()||this.disableLogReport)return;const a=this.logger.createTraceId(),l="L-report_full_log-O";this.logger.info("L-report_full_log-T",JSON.stringify({startTime:e,endTime:t,logId:s,messageUId:n,isCloudControl:o}),a);const{logs:c}=yield this._getLogs(e,t,Li.DEBUG,!1,a);this.logger.info(l,JSON.stringify({count:c.length}),a);let h,u=zt(r)?r:`https://${r}`;if(u+=`?version=5.48.0-alpha.1&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.getDeviceId()}&deviceInfo=${this.deviceInfo}&platform=Web&logId=${s}`,c.length>0){const{success:e,data:t}=yield this.compressLogs(c);h=e?t:"compress failed"}else h="no data or no database";this.logger.debug(l,"compress done",a),o&&(u+="&source=cloud");const{status:d}=yield this.send({url:u,body:h,method:"POST"});this.logger.info("L-report_full_log-R",JSON.stringify({status:d}),a)}))}stop(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1}}function wi(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 Vi,ki,Gi,Fi,Bi,Hi,xi,Ji;function Yi(){return _(this,void 0,void 0,(function*(){return{logs:[]}}))}function ji(){}class Wi{constructor(e,t){Vi.set(this,void 0),ki.set(this,void 0),g(this,Vi,e),g(this,ki,t)}read(e,t,i,r,s){return _(this,void 0,void 0,(function*(){try{const n=yield f(this,Vi,"f").call(this,e,t,i,r,s);if(!n||!Array.isArray(n.logs))return{logs:[]};return{logs:n.logs.filter(wi)}}catch(e){return console.error("[LogDBProxy] read error",e),{logs:[]}}}))}write(e){try{f(this,ki,"f").call(this,e)}catch(e){console.error("[LogDBProxy] write error",e)}}setLogReader(e){return"function"==typeof e&&g(this,Vi,e),this}setLogWriter(e){return"function"==typeof e&&g(this,ki,e),this}}Vi=new WeakMap,ki=new WeakMap;class Ki{static start(e){f(this,Gi,"f",Fi)||(g(this,Gi,e,0,Fi),e.info(y,"start"),f(this,Gi,"m",Ji).call(this))}static stop(){f(this,Gi,"f",Fi)&&(f(this,Gi,"f",Fi).info(y,"stop"),g(this,Gi,null,0,Fi),f(this,Gi,"f",Bi)&&(clearTimeout(f(this,Gi,"f",Bi)),g(this,Gi,null,0,Bi)))}}Gi=Ki,Ji=function e(){const t=Date.now();g(this,Gi,setTimeout((()=>{const i=Date.now()-t;i>=f(this,Gi,"f",xi)&&f(this,Gi,"f",Fi).warn(y,`delta time: ${i}ms`),f(this,Gi,"m",e).call(this)}),f(this,Gi,"f",Hi)),0,Bi)},Fi={value:null},Bi={value:null},Hi={value:30},xi={value:1500};const Xi=1,Zi=2,qi=3;class Qi{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,r,s;this.taskLock=!1;const n=null!==(t=e.startTime)&&void 0!==t?t:0,o=null!==(i=e.endTime)&&void 0!==i?i:0,a=null!==(r=e.platform)&&void 0!==r?r:"",l=null!==(s=e.uri)&&void 0!==s?s:"";e.logId!==this.logId&&""!==l&&(this.logId=e.logId,this.reporter.report(n,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 $i{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 Qi(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===Ge&&this.uploadTaskManage.uploadLogCmdTask(e)}))}}dataHandle(e){const t=this._cache;t.lastRequestTime=this.lastRequestTime,ei(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,t,i){return _(this,void 0,void 0,(function*(){if(!this.isEable&&t===Xi&&this.isExire())return this.logger.info("L-cloud_disabled",JSON.stringify({msg:"cloud controller is disabled"})),this.timestamp;if(!this.isEable&&t===Zi&&this.isOverclock())return this.logger.info("L-cloud_overclock",JSON.stringify({msg:"cloud controller is overclock"})),this.timestamp;const r=ui(e);this.lastRequestTime=(new Date).getTime();const s=`${r}/v1/config`,n={"Content-Type":"application/json","RC-App-Key":this.appkey};i&&(n["RC-Token"]=i);const o={platform:"web",version:"5.48.0-alpha.1",timestamp:this.timestamp};this.logger.record(Ct.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!i,uri:s}));const{code:a,data:l}=yield this.httpRequest(s,Ht.POST,n,o);if(this.logger.record(Ct.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:l})),a===ne.CLOUD_DATA_CENTER_INVALID&&l&&l.targetRegion){const e=l.targetRegion;if(this.changeAreaCode===e)return this.timestamp;const t=bi.setAreaCode(e);this.logger.info("L-cloud_set_area_code-O",JSON.stringify({isChangeSuccess:t,originAreaCode:bi.getAreaCode(),newAreaCode:e})),this.changeAreaCode=e;const i=bi.getCloudControllerUrl(e);return i[0]?this.request(i[0],qi):(this.logger.info("L-cloud_appkey_region_error",JSON.stringify({appkey:this.appkey,uri:s,msg:"appkey region error"})),this.timestamp)}return l&&this.dataHandle(l),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 zi,er,tr,ir;const rr=e=>e===ne.RC_CONN_REDIRECTED;class sr extends _i{constructor(e,t,i){super(),zi.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:""}),ir.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:Bt.UNKONWN}}),Object.defineProperty(this,"_checkAliveTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_crtConnectionStatus",{enumerable:!0,configurable:!0,writable:!0,value:pt.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===pt.DISCONNECTED&&e===pt.CONNECTING&&(this._doConnectReason=Dt.CONNECT,f(this,zi,"m",tr).call(this)),this._crtConnectionStatus===pt.CONNECTED&&e===pt.SUSPENDED&&(t===ne.RC_PING_EXCEED_LIMIT?this._doConnectReason=Dt.TIMEOUT:t===ne.RC_CONN_REDIRECTED?this._doConnectReason=Dt.REDIRECTED:this._doConnectReason=Dt.RECONNECT),this._crtConnectionStatus===pt.CONNECTED){const i={bid:hi(),cod:t,net:this.getNetwork().type,dur:Date.now()-f(this,ir,"f"),cid:this.cid};this.logger.record(Ct.IM_CONNECTION_DURATION,JSON.stringify(i)),e===pt.SUSPENDED&&f(this,zi,"m",tr).call(this)}switch(this._crtConnectionStatus=e,e){case pt.CONNECTED:this.logger.info(R,`status: ${e}`),this.checkAlive(),f(this,zi,"m",er).call(this).emit("onConnected",this._fromSuspend);break;case pt.CONNECTING:this.logger.warn(R,`status: ${e}`),f(this,zi,"m",er).call(this).emit("onConnecting");break;case pt.SUSPENDED:this._fromSuspend=!0,this.logger.warn(R,`status: ${e}, code: ${t}`),rr(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),f(this,zi,"m",er).call(this).emit("onSuspend",t);break;default:this._fromSuspend=!1,this._crtUserId="",this.logger.warn(R,`status: ${e}, code: ${t}`),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),f(this,zi,"m",er).call(this).emit("onDisconnected",t)}}}getConnectionStatus(){return this._crtConnectionStatus}get isConnected(){return this._crtConnectionStatus===pt.CONNECTED}setNetwork(e,t){if(!t){const t={cid:this.cid,cn:e.type,on:this._network.type};this.logger.record(Ct.IM_NETWORK_CHANGE,JSON.stringify(t))}this._network=e}getNetwork(){return this._network}connect(e,t,i,r){return _(this,void 0,void 0,(function*(){if(this._crtConnectionStatus===pt.CONNECTED)return gi(this._crtUserId);if(this._crtConnectionTask)return this._crtConnectionTask;this._openCallPlus=i,this.token=e,this.setConnectionStatus(pt.CONNECTING);const{code:s,data:n}=yield this.try2Connect(e,t,!1,r,!0);return s!==ne.SUCCESS?(this.setConnectionStatus(pt.DISCONNECTED,s),Ri(s)):(this.setConnectionStatus(pt.CONNECTED),gi(n))}))}try2Connect(e,t,i,r,s){return _(this,void 0,void 0,(function*(){if(this._crtConnectionTask)return this._crtConnectionTask;this._crtConnectionTask=this.createConnectionTask(e,t,i,r,s);const n=yield this._crtConnectionTask;return this._crtConnectionTask=null,n}))}createConnectionTask(e,t,i,r,s){return _(this,void 0,void 0,(function*(){const n="L-connect-R",o={cid:this.cid,reason:this._doConnectReason,net:this.getNetwork().type,spr:0,sts:Date.now(),timelimit:0};this.logger.record(Ct.IM_STATS_CS,JSON.stringify(o));const a={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this._doConnectReason},{code:l,data:c}=yield this.navi.request(e,i,!1,r,a);if(l!==ne.SUCCESS)return Ri(l);const h=c;if(1===h.type)return Ri(ne.PACKAGE_ENVIRONMENT_ERROR);this.logger.info("L-connect-T",JSON.stringify({token:e,reconnectKickEnable:t}),r);const{code:u,data:d}=yield this._connectWithToken(e.replace(/@.+$/,"@"),h,t,r);if(s||u===ne.SUCCESS||(this.retryCount+=1),rr(u))return this.logger.warn(n,`redirect code: ${u}`,r),this.clearCmpWeightCache(),this.createConnectionTask(e,t,!0,r,s);if([ne.RC_TCP_RESET,ne.RC_CONN_ACK_TIMEOUT,ne.RC_TCP_DISCONNECTED_NO_RMTP,ne.CONNECTION_REFUSED].includes(u)&&this.cmpWeightCache&&this.cmpWeightCache.length>1){this.updateCmpWeight(this.curCmpUrl,!1);const i=this.cmpWeightCache.every((e=>e.failed));return s&&i?(this.logger.warn(n,`cpp code:${u},reture code:${ne.SERVER_UNAVAILABLE}`,r),Ri(ne.SERVER_UNAVAILABLE)):(this.logger.warn(n,`cmp ack timeout, code: ${u}`,r),this.setConnectionStatus(pt.SUSPENDED,u),this.setConnectionStatus(pt.CONNECTING),this.createConnectionTask(e,t,!1,r,s))}return u!==ne.SUCCESS?(this.logger.warn(n,`code: ${u}`,r),Ri(u)):(this.logger.info(n,`userId: ${d}`,r),g(this,ir,Date.now()),this._crtUserId=d,gi(d))}))}try2Reconnect(e,t){return _(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.debug(p,`try2Reconnect -> ignoreNaviCache: ${e}, reason: ${t}`,i),this.stopReconnectTimer();const r=()=>_(this,void 0,void 0,(function*(){if(this._crtConnectionStatus!==pt.SUSPENDED)return;this.setConnectionStatus(pt.CONNECTING,t);const{code:s,isOk:n}=yield this.try2Connect(this.token,!0,e,i,!1);this.reconnectTimer=null,n?this.setConnectionStatus(pt.CONNECTED):[ne.SERVER_UNAVAILABLE,ne.TIMEOUT,ne.RC_SOCKET_DISCONNECTED,ne.RC_SOCKET_NOT_CREATED,ne.RC_CONN_ACK_TIMEOUT,ne.RC_TCP_RESET,ne.RC_NAVI_REQ_FAILED,ne.RC_NETWORK_DOWN,ne.RC_TCP_DISCONNECTED_NO_RMTP].includes(s)?this._crtConnectionStatus===pt.CONNECTING&&(this.setConnectionStatus(pt.SUSPENDED,s),this.reconnectTimer=setTimeout(r,5e3)):this.setConnectionStatus(pt.DISCONNECTED,s)}));r()}))}onDisconnectByServer(e,t){return rr(e)?(this.setConnectionStatus(pt.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===ne.RC_UDP_DISCONNECTED?(this.setConnectionStatus(pt.SUSPENDED,e),void setTimeout((()=>{this.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(pt.DISCONNECTED,e)}onDisconenctUnusual(e){this.setConnectionStatus(pt.SUSPENDED,e),this.try2Reconnect(!1,e)}checkAlive(){return _(this,void 0,void 0,(function*(){const e="L-check_alive_im-R",t="L-check_alive_im-S";if(this._crtConnectionStatus!==pt.CONNECTED)return this._failedCount=0,void this.logger.debug(t,"stop ping because of no connection");const i=this.logger.createTraceId();this.logger.debug("L-check_alive_im-T",null,i);const r=yield this.sendPing(15e3);if(r===ne.SUCCESS)return this.logger.debug(e,r,i),this._failedCount=0,void(this._checkAliveTimer=setTimeout((()=>this.checkAlive()),15e3));if(this._crtConnectionStatus===pt.CONNECTED){if(this._failedCount+=1,this.logger.debug(e,`code: ${r}, count: ${this._failedCount}`,i),this._failedCount<this.ALLOW_FAILED_TIMES)return this.checkAlive();this._failedCount=0,this.logger.warn(t,"ping timeout, close connection to reconnect!"),yield this.close(!0),this.setConnectionStatus(pt.SUSPENDED,ne.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,ne.RC_PING_EXCEED_LIMIT)}}))}disconnect(e,t){return _(this,void 0,void 0,(function*(){return this.stopReconnectTimer(),this._crtConnectionTask&&(yield this._crtConnectionTask),this.setConnectionStatus(pt.DISCONNECTED,ne.ACTIVE_DISCONNECT),this.close(!1,e,t)}))}stopReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}getCmpList(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return[...this.cmpWeightCache];const i=si(e,t);return this.cmpWeightCache=[...i],[...i]}updateCmpWeight(e,t,i){if(!this.cmpWeightCache)return;const r=this.cmpWeightCache.find((t=>i?t.addr===e&&t.protocol===fe.QUIC:t.addr===e));if(r)if(t){const e=Math.max(...this.cmpWeightCache.map((e=>e.weight)));r.weight!==e&&(r.weight=e+1)}else{const e=Math.min(...this.cmpWeightCache.map((e=>e.weight)));r.weight!==e&&(r.weight=e-1),r.failed=!0}}clearCmpWeightCache(){this.cmpWeightCache=void 0}reconnect(e,t,i,r){this.token=e,this._openCallPlus=i,this.onDisconenctUnusual(r)}}ir=new WeakMap,zi=new WeakSet,er=function(){return this},tr=function(){this.uuid=Zt.gen(),this.retryCount=0};const nr=e=>e.replace(/@.+$/,"@");class or{constructor(e,t,i,r=!0,s=!0,n=!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:r}),Object.defineProperty(this,"isUseDynamicNaviUrl",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"useNaviV2",{enumerable:!0,configurable:!0,writable:!0,value:n}),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,t,i,r,s){return _(this,void 0,void 0,(function*(){if(this.crtRequest)return this.crtRequest;this.crtRequest=this.sendRequest(e,t,i,r,s);const n=yield this.crtRequest;return this.crtRequest=null,n}))}sendRequest(e,t,i,r,s){return _(this,void 0,void 0,(function*(){var n;const o="L-get_navi-R",a=nr(e),l=this.getNaviCache(a);if(!t&&l){const{timestamp:e,naviInfo:t}=l;if(i||Date.now()-e<xt){if(this.logger.info(T,JSON.stringify({fromCache:!0,naviInfo:t}),r),s){const{uuid:e,retryCount:i,reason:o}=s,a={bid:hi(),ptc:bt.NAVI,cod:ne.SUCCESS,net:s.type,dur:0,spr:0,pr:null!==(n=t.type)&&void 0!==n?n:0,hos:"",cache:Pt.LOCAL,v:Lt.CURRENT,rsn:o,cid:`${e}_${i}`,count:i};this.logger.record(Ct.IM_NAVI,JSON.stringify(a),r)}return gi(t)}}const c=bi.getNaviUrlList(e,this.isUseDynamicNaviUrl);this.logger.info("L-get_navi-T",JSON.stringify({token:e,uris:c}),r);let{code:h,data:u}=yield this.requestHandler(c,e,r,s);if(h===ne.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,n=yield this.requestHandler(i,e,r,s);h=n.code,u=n.data}}if(h!==ne.SUCCESS)return this.logger.warn(o,h,r),Ri(h);const d=u;if(d.code&&200!==d.code)return this.logger.warn(o,d.code,r),Ri(this.transHttpCode(d.code));if(!(si(d).length>0)){const e={server:d.server,backupServer:d.backupServer,serverAddr:d.serverAddr,bs:d.bs};return this.logger.warn(o,`navi server address invalid: ${JSON.stringify(e)}`,r),Ri(ne.SERVER_UNAVAILABLE)}return this.logger.info(o,JSON.stringify({naviInfo:d}),r),this.setNaviCache(a,d),gi(d)}))}requestHandler(e,t,i,r){return _(this,void 0,void 0,(function*(){for(let s=0,n=e.length;s<n;s+=1){const n=s===e.length-1,o=this.useV2Navi()?this.httpRequestV2:this.httpRequest,a=Date.now(),{code:l,data:c}=yield o.call(this,e[s],this.appkey,t,i,n),h={bid:hi(),ptc:bt.NAVI,cod:l,net:null==r?void 0:r.type,dur:Date.now()-a,spr:0,pr:(null==c?void 0:c.type)||0,hos:e[s],cache:Pt.REQUEST,v:Lt.CURRENT,rsn:null==r?void 0:r.reason,cid:`${null==r?void 0:r.uuid}_${null==r?void 0:r.retryCount}`,count:null==r?void 0:r.retryCount};if(this.logger.record(Ct.IM_NAVI,JSON.stringify(h),i),[ne.SUCCESS,ne.RC_CONN_TOKEN_INCORRECT,ne.RC_LICENSE_EXPIRED].includes(l))return l===ne.SUCCESS?gi(c):Ri(l)}return Ri(ne.RC_NAVI_REQ_FAILED)}))}transHttpCode(e){switch(e){case 401:case 403:return ne.RC_CONN_TOKEN_INCORRECT;case 416:return ne.RC_LICENSE_EXPIRED;default:return ne.RC_NAVI_REQ_FAILED}}getNaviInfoFromCache(e){const t=this.getNaviCache(nr(e));return t?t.naviInfo:null}updateVoipCallInfo(e,t){const i=this.getNaviInfoFromCache(e);i&&this.setNaviCache(nr(e),Object.assign(Object.assign({},i),{voipCallInfo:t}))}getNaviV2RequestOption(e){const{uri:t,token:i,platform:r,protocol:s,mac:n}=e;let o="";o=`${t}/v2/navi.json?cloud=0`;let a=`token=${encodeURIComponent(i)}&v=${Yt}&platfrom=${r}`;return n&&(a+=`&m=${n}`),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":`conn=${s};rtc=4;log=2;iptype=v4,v6`},body:a,url:o,timeout:1e4}}useV2Navi(){return!0}}const ar=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}],[st,{isCounted:!1,isPersited:!0}],["RC:ContactNtf",{isCounted:!1,isPersited:!0}],["RC:ProfileNtf",{isCounted:!1,isPersited:!0}],[rt,{isCounted:!1,isPersited:!0}],[nt,{isCounted:!1,isPersited:!0}],["RC:RcNtf",{isCounted:!1,isPersited:!0}],[it,{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 lr(){return Array.from(ar.keys()).map((e=>Object.assign({objectName:e},ar.get(e)))).filter((e=>!e.isCustom))}const cr=0,hr=0,ur=4,dr=5;var Er;!function(e){e.P_INIT_O="P-init-O",e.P_DB_OPEN_O="P-db_open-O",e.P_DB_UPGRATE_START_S="P-db_upgrate_start-S",e.P_DB_UPGRATING_S="P-db_upgrating-S",e.P_DB_UPGRATE_COMPLETE_S="P-db_upgrate_complete-S",e.P_CALL_MAIN_SYNC_E="P-call_main_sync-E",e.P_CALL_MAIN_E="P-call_main-E",e.P_SEND_2_MAIN_E="P-send_2_main-E",e.P_CALL_ADDON_E="P-call_addon-E",e.P_CALL_ADDON_T="P-call_addon-T",e.P_CALL_ADDON_O="P-call_addon-O",e.P_CALL_ADDON_R="P-call_addon-R",e.P_CALL_EXTRA_E="P-call_extra-E",e.P_CONNECT_S="P-connect-S",e.P_CONNECT_T="P-connect-T",e.P_CONNECT_R="P-connect-R",e.P_CONNECT_E="P-connect-E",e.P_CONNECT_ENTRY_S="P-connect_entry-S",e.P_REPORT_VER_O="P-report_version-O",e.P_PARSE_JSON_MSGS_E="P-parse_json_messsages-E",e.P_PARSE_JSON_MSGS_R="P-parse_json_messsages-R",e.P_RECEIVE_MESSAGE_E="P-receive_message-E",e.P_HTTP_REQ_E="P-http_request-E",e.P_SET_MSG_EXTEN_O="P-set_msg_extension-O",e.P_SEND_MSG_T="P-send_msg-T",e.P_SEND_MSG_R="P-send_msg-R",e.P_PARSE_JSON_SUBSCRIBE_DATA_E="P-parse_json_subscribe_data-E",e.P_PARSE_JSON_USER_PROFILE_E="P-parse_json_user_profile-E",e.P_PARSE_JSON_USER_PROFILE_LIST_E="P-parse_json_user_profile_list-E",e.P_WRITE_LOG_O="P_WRITE_LOG_O",e.P_PARSE_JSON_E="P-parse_json-E",e.L_HANDLE_LOW_PRIORITY_MESSAGES_T="L-handle_low_priority_messages-T",e.L_HANDLE_LOW_PRIORITY_MESSAGES_R="L-handle_low_priority_messages-R",e.L_JS_FUNC_EXEC_O="L-js_func_execute-O",e.L_JS_FUNC_EXEC_E="L-js_func_execute-E",e.L_HADNLE_RECALL_CMD_T="L-handle_recall_cmd-T",e.L_HADNLE_RECALL_CMD_R="L-handle_recall_cmd-R"}(Er||(Er={}));const Ir=e=>{if(o.existsSync(e))return;const i=t.resolve(e,"..");o.existsSync(i)||Ir(i),o.mkdirSync(e)},_r=e=>Object.entries(e).map((([e,t])=>({key:e,value:String(t)}))),fr=e=>({removeMute:!!(null==e?void 0:e.removeMuteStatus),removeWhiteList:!!(null==e?void 0:e.removeWhiteList),removeFavoriteMembers:!!(null==e?void 0:e.removeFollow)}),gr=()=>"undefined"==typeof __dirname?t.dirname(a.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:I&&"SCRIPT"===I.tagName.toUpperCase()&&I.src||new URL("index.cjs",document.baseURI).href)):__dirname;function Rr(e){return JSON.parse(e).list.map((e=>e.value))}const pr=t.resolve(gr(),"binding",`electron-${r.platform()}-${r.arch()}.node`),Tr={addon:null};try{let e=require;Tr.addon=e(pr)}catch(e){console.error("error ->",pr,"\n",e)}Tr.addon||console.error("error -> cannot find module: ",pr);const Nr=Tr.addon,Sr=(e,t)=>{let i,r=Buffer.from(e),s=r.length;for(t.push(s),i=0;i<s;i++)t.push(r[i])},Or=e=>"string"==typeof e,Cr=e=>Or(e)?e.toUpperCase():"",vr=(e,t)=>{let i="";return 2!==e.length?i="Unexpected number of bytes received.":5!==e[0]?i=`Unexpected SOCKS version number: ${e[0]}.`:255===e[1]?i="No acceptable authentication methods were offered.":-1===t.indexOf(e[1])&&(i=`Unexpected SOCKS authentication method: ${e[1]}.`),i},mr=e=>{let t="";return 2!==e.length?t="Unexpected number of bytes received.":1!==e[0]?t=`Unexpected authentication method code: ${e[0]}.`:0!==e[1]&&(t=`Username and password authentication failure: ${e[1]}.`),t};var Ar=e=>{let t=Cr(e.method)||"GET";const i=e.pathname||"/",r=e.headers||{},s=e.search||"";r.Host=e.host||"loclahost";let n="";n=`${t} ${i+s} HTTP/1.1\n`;for(const e in r)if(Object.hasOwnProperty.call(r,e)){n+=`${e}: ${r[e]}\n`}return e.body&&(n+=`Content-Length: ${e.body.length}\n`),n+="\n","POST"===t&&e.body&&(n+=`${e.body}`),n},Mr=e=>new Promise((t=>{let i,r;e.socket.once("data",(r=>{let s,n=vr(r,i);if(!n)return 2===r[1]?(e.socket.once("data",(i=>{let r=mr(i);r?e.emit("error",new Error(`SOCKS authentication failed. ${r}`)):t()})),s=[1],Sr(e.socksUsername,s),Sr(e.socksPassword,s),void e.write(Buffer.from(s))):void t();e.emit("error",new Error(`SOCKS authentication failed. ${n}`))})),i=[0],e.socksUsername&&i.push(2),r=Buffer.alloc(2+i.length),r[0]=5,r[1]=i.length,i.forEach(((e,t)=>{r[2+t]=e})),e.write(r)})),yr=(e,t,i)=>new Promise((r=>{let s,n;switch(e.socket.once("data",(t=>{let i;5!==t[0]?i=`Unexpected SOCKS version number: ${t[0]}.`:0!==t[1]?i=`${(e=>{switch(e){case 1:return"General SOCKS server failure";case 2:return"Connection not allowed by ruleset";case 3:return"Network unreachable";case 4:return"Host unreachable";case 5:return"Connection refused";case 6:return"TTL expired";case 7:return"Command not supported";case 8:return"Address type not supported";default:return`Unknown status code ${e}`}})(t[1])}.`:0!==t[2]&&(i="The reserved byte must be 0x00."),i?e.emit("error",new Error(`SOCKS connection failed. ${i}`)):r()})),s=[],s.push(5),s.push(1),s.push(0),u.isIP(t)){case 0:s.push(3),Sr(t,s);break;case 4:s.push(1),((e,t)=>{let i,r,s=e.split(".");for(i=0;i<4;i++)r=parseInt(s[i],10),t.push(r)})(t,s);break;case 6:e.emit("error",new Error("Does not support IPV6"))}s.length+=2,n=Buffer.from(s),n.writeUInt16BE(i,n.length-2),e.write(n)}));class br extends d.EventEmitter{constructor(e){super(),Object.defineProperty(this,"socket",{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,"socksHost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"socksPort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"socksUsername",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"socksPassword",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"readable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.socket=new u.Socket,this.options=e,this.socksHost=e.socksHost||"localhost",this.socksPort=e.socksPort||1080,this.socksUsername=e.socksUsername||"",this.socksPassword=e.socksPassword||"",this.socket.on("error",(e=>{this.emit("error",e)})),this.on("error",(()=>{this.socket.destroyed||this.socket.destroy()})),this.on("end",this.end)}ref(){return this.socket.ref()}unref(){return this.socket.unref()}setTimeout(e,t){return this.socket.setTimeout(e,t)}setNoDelay(e){return this.socket.setNoDelay(e)}setKeepAlive(e,t){return this.socket.setKeepAlive(e,t)}address(){return this.socket.address()}cork(){return this.socket.cork()}uncork(){return this.socket.uncork()}pause(){return this.socket.pause()}resume(){return this.socket.resume()}pipe(e){return this.socket.pipe(e)}end(e,t){let i=this.socket.end(e,t);return this.writable=this.socket.writable,i}destroy(e){return this.socket.destroy(e)}setEncoding(e){return this.socket.setEncoding(e)}write(e,t,i){return this.socket.write(e,t,i)}read(e){return this.socket.read(e)}connect(e,t){if("string"==typeof e&&/^\d+$/.test(e)&&(e=parseInt(e,10)),!Number.isInteger(e)||e<1||e>65535)throw new TypeError(`Invalid port: ${e}`);if(!t||"string"!=typeof t)throw new TypeError(`Invalid host: ${t}`);return this.socket.connect({port:this.socksPort,host:this.socksHost},(()=>_(this,void 0,void 0,(function*(){yield Mr(this),yield yr(this,t,e),this.onProxied();const i=Ar(this.options);this.socket.write(Buffer.from(i))})))),this}onProxied(){this.socket.on("close",(e=>{this.emit("close",e)})),this.socket.on("end",(()=>{this.emit("end")})),this.socket.on("data",(e=>{this.emit("data",e)})),this.writable=!0,this.readable=!0,this.emit("connect")}}const Pr=e=>{let t,{hostname:i,port:r}=e;return!e.host||i&&r||(t=e.host.split(":")),!r&&t&&(r=parseInt(t[1],10)||0),!i&&t&&([i]=t),new br(e).connect(r,i)};class Lr extends l.Agent{constructor(e){super(),Object.defineProperty(this,"createConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.createConnection=Pr}}const Ur=(e,t,i)=>((t=Object.assign(Object.assign({},t),a.parse(e))).port||(t.port=80),t.agent=new Lr(t),l.request(t,i)),Dr=e=>{let t,i;return t=Pr(e),i=t.onProxied,t.onProxied=()=>{e.socket=t.socket,e.hostname?e.servername=e.hostname:e.host&&([e.servername]=e.host.split(":")),t.socket=E.connect(e,(()=>{t.authorized=t.socket.authorized,i.call(t)})),t.socket.on("error",(e=>{t.emit("error",e)}))},t};class wr extends c.Agent{constructor(e,t){super(t),Object.defineProperty(this,"socksHost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"socksPort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"createConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=e,this.socksHost=t.socksHost||"localhost",this.socksPort=t.socksPort||1080,this.createConnection=Dr}}const Vr=(e,t,i,r)=>{let s;return t.protocol="https:",!t.port&&t.host&&([t.port,t.port]=t.host.split(":")),t.port||(t.port=443),s=new wr(e,t),t.agent=s,c.request(e,t,i)};let kr=null;function Gr(e,t,i=!1){return Fr(e,Object.assign(Object.assign({},t),{headers:Si(t.headers)}),i)}function Fr(e,t,i=!1){const{url:r,headers:s,body:n,method:o,query:a,timeout:u=Jt}=t;return new Promise((t=>{const d=/^https/.test(r);let E={headers:Object.assign(Object.assign({},s),{"Accept-Encoding":"gzip, br"}),method:o};d&&(E.rejectUnauthorized=i);let I=null;kr?(E=Object.assign(Object.assign({},E),kr),E.body=n,I=d?Vr:Ur):(I=l.request,d&&(E.agent=new c.Agent(E),I=c.request));const _=I(ai(r,a),E,(e=>{var i,r;const s=e.statusCode;let n="";if("gzip"===(null===(i=e.headers)||void 0===i?void 0:i["content-encoding"])){const i=h.createGunzip();e.pipe(i),i.on("data",(e=>{n+=e})),i.on("end",(()=>{t({status:s,data:n})}))}else if("br"===(null===(r=e.headers)||void 0===r?void 0:r["content-encoding"])){const i=h.createBrotliDecompress();e.pipe(i),i.on("data",(e=>{n+=e})),i.on("end",(()=>{t({status:s,data:n})}))}else e.setEncoding("utf8"),e.on("data",(e=>{n+=e})),e.once("end",(()=>{t({status:s||0,data:n})}))}));_.once("timeout",(()=>{e.warn(Er.P_HTTP_REQ_E,JSON.stringify({msg:"timeout",url:r,method:o,query:a,timeout:u})),t({status:0})})),_.setTimeout(u),_.once("error",(i=>{e.warn(Er.P_HTTP_REQ_E,JSON.stringify({msg:i.stack,url:r,method:o,query:a,timeout:u})),t({status:0})})),_.write(n),_.end()}))}function Br(e,t){return e?(kr=Object.assign(Object.assign({},kr),e),t.info("L-set_proxy-O",JSON.stringify({socks5Proxy:kr})),gi()):(kr=null,t.info("A-remove_proxy-O"),gi())}function Hr(){return gi(kr||void 0)}var xr;!function(e){e[e.ERROR=-1]="ERROR",e[e.RESPONSE=0]="RESPONSE",e[e.CALLBACK=1]="CALLBACK"}(xr||(xr={}));class Jr{constructor(e,t,i,r){Object.defineProperty(this,"p",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"emit",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"callback",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"errorHandle",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"count",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maps",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this.p.on("message",(e=>{const{type:t,data:s}=e;switch(t){case xr.RESPONSE:{const{reqId:e,success:t,data:i}=s,r=this.maps[e];if(!r)return;r({success:t,data:i}),delete this.maps[e];break}case xr.CALLBACK:null==i||i(s);break;case xr.ERROR:{const{msg:e}=s;null==r||r(e)}}})),this.p.on("error",(e=>{null==r||r(`SubProcessProxy error ${e}`)})),this.p.on("exit",((e,t)=>{if(0!==e){for(const e in this.maps)if(Object.prototype.hasOwnProperty.call(this.maps,e)){(0,this.maps[e])({success:!0,data:{code:ne.SUB_PROCESS_EXIT,msg:"sub process exit"}})}null==r||r(`SubProcessProxy exit ${e} ${t}`,!0)}})),this.p.on("close",((e,t)=>{console.log("SubProcessProxy close",e,t)}))}call(e,...t){return _(this,void 0,void 0,(function*(){return this.p.killed||this.p.exitCode?Promise.resolve({success:!1,data:{code:ne.SUB_PROCESS_EXIT,msg:"sub process exit"}}):new Promise((i=>{const r=++this.count;this.maps[r]=i;const s={reqId:r,method:e,args:t,hasResponse:!0};this.p.send(s)}))}))}send(e,...t){return _(this,void 0,void 0,(function*(){var i;(this.p.killed||this.p.exitCode)&&(null===(i=this.errorHandle)||void 0===i||i.call(this,"sub process exit"));const r={reqId:-1,method:e,args:t};this.p.send(r)}))}destroy(){this.send("destroy")}}const Yr=(e,t,i)=>_(void 0,void 0,void 0,(function*(){const{startTime:r,endTime:s,level:n,isRealtimeReport:o}=e,a=yield((e,t,i,r,s)=>_(void 0,void 0,void 0,(function*(){const{resolve:n,promise:o}=Ni();Nr.getLog(e,t,i,r,(e=>{n(gi(e))}),(e=>{n(Ri(e))}));const a=yield o;if(!a.isOk)return a.wipe();let l=0;const c=JSON.parse(a.data).filter((e=>(l+=(e=>e.content.length+e.tag.length+e.sessionId.length+e.type.length+2+13+6)(e),!!s||e.level>0)));return gi({logs:c,size:l})})))(n,r,s,300,o);if(!a.isOk)return;let{logs:l,size:c}=a.data;if(0===l.length)return;if((t+=c)>=20971520)return;if(l.length<300)return void i.push(...l);let{time:h}=l[l.length-1];return r===h&&(h+=1),e.startTime=h,i.push(...l.filter((e=>e.time<h))),Yr(e,t,i)})),jr=[];let Wr=!1;const Kr=()=>_(void 0,void 0,void 0,(function*(){if(Wr||0===jr.length)return;Wr=!0;const e=jr.shift(),{resolve:t,args:i}=e,r=[];yield Yr(i,0,r),t({logs:r,dbReady:!0}),Wr=!1,Kr()}));class Xr extends Di{constructor(e,t,i,r=!1,s){super(e,`Electron|${process.versions.electron}|${process.arch}|${process.platform}`,s,i,r),Object.defineProperty(this,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_subProcess",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}getDeviceId(){return this.deviceId}send(e){return Gr(this.logger,e)}stop(){this._subProcess&&this._subProcess.destroy(),super.stop()}compressLogs(e){return _(this,void 0,void 0,(function*(){if(!this._subProcess){const e="sub-process.cjs.js",i=s.fork(t.resolve(gr(),e),{stdio:["inherit","inherit","inherit","ipc"]});this._subProcess=new Jr(i)}const{success:i,data:r}=yield this._subProcess.call("compressLogs",e);return i?{success:i,data:r.data}:{success:i,data:""}}))}}const Zr="rc-realtime-log-timestamp";let qr=!1;const Qr=()=>{const e=new Wi(Yi,ji);return e.setLogReader(((e,t,i,r)=>_(void 0,void 0,void 0,(function*(){const{logs:s}=yield(n={startTime:e,endTime:t,level:i,isRealtimeReport:r},_(void 0,void 0,void 0,(function*(){return new Promise((e=>{jr.push({resolve:e,args:n}),Kr()}))})));var n;return{logs:s}})))),e.setLogWriter((e=>{es(e)})),e};let $r,zr=[];const es=e=>{qr&&(zr.push(e),$r||($r=setImmediate((()=>(()=>{if($r&&(clearImmediate($r),$r=null),!zr.length)return;const e=zr.splice(0).map((e=>{const{sessionId:t,level:i,time:r,type:s,tag:n,loggerId:o,content:a,traceId:l}=e;return{level:i,time:r,type:s,tag:n,sessionId:`${qt}:${qt===t?"main":t}`,content:JSON.stringify({loggerId:o,content:a,traceId:l})}})),t=JSON.stringify(e);Nr.writeLog(t)})()))))};class ts extends Ui{constructor(e,t,i,r){super(e,t,i,r),qr||(qr=!0)}getTimestamp4RealtimeLog(){const e=Nr.getStoreValue(Zr);return parseInt(e,10)||0}setTimestamp4RealtimeLog(e){Nr.setStoreValue(Zr,e.toString())}recvRendererLog(e){this._stdout(e),this._write(e)}destroy(){qr=!1}}const is=()=>{const e=Date.now(),t=[r.arch(),r.platform(),process.pid,e,Math.floor(Math.random()*e)].join("__");return i=t,n.createHash("md5").update(i).digest("hex");var i};class rs{constructor(e){Object.defineProperty(this,"_callCppProxy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_setTime",{enumerable:!0,configurable:!0,writable:!0,value:15962112e5})}_setToProtocol(e,t,i){const r=JSON.stringify(i);"{}"!==r&&e.info(Er.P_SET_MSG_EXTEN_O,JSON.stringify({messageUId:t,ext:i})),this._callCppProxy("setMessageExtension",1,"1",t,r,"")}setLocalFromExtMsg(e,t){const{channelId:i,conversationType:r,targetId:s,content:n,sentTime:o}=t,a=n,l=a.put,c=this._callCppProxy("getMessage",a.mid),h=JSON.parse(c).extMsg,u=JSON.parse(h||"{}");if(l)for(const e in l){const t=u[e];t&&t.ts<o-this._setTime?(t.v=l[e],t.ts=o-this._setTime):(u[e]={v:"",ts:0},u[e].v=l[e],u[e].ts=o-this._setTime)}a.del&&a.del.forEach((e=>{delete u[e]})),this._setToProtocol(e,a.mid,u)}parseReceiveExpansion(e){const t=JSON.parse(e.extMsg||"{}"),i={};for(const e in t)i[e]=t[e].v;return i}}const ss=[fe.RMTP,fe.TLS];"darwin"===process.platform&&ss.push(fe.QUIC);const ns=e=>`RongCloud/navis/${e}/navi-cache.json`,os=e=>`RongCloud/caches/${e}/staticConfig.json`,as=e=>`RongCloud/cloudControl/${e}/cloudControl.json`;function ls(e="IPv4"){const t=r.networkInterfaces(),i=[];for(const r of Object.values(t))if(r&&-1!==Object.prototype.toString.call(r).indexOf("Array")){const t=r.filter((t=>{return!(t.internal||(i=t.mac,/^(0{1,2}[:-]){5}0{1,2}$/.test(i))||t.family&&t.family!==e);var i})).map((e=>e.mac));i.push(...t)}return i.length?[...i].sort()[0]:""}class cs extends or{constructor(e,i,r,s){super(e,i,s),Object.defineProperty(this,"naviPath",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_caches",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this.naviPath=`${r}/${ns(e)}`;const n=t.dirname(this.naviPath);o.existsSync(n)||Ir(n)}httpRequest(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=`token=${encodeURIComponent(i)}&v=${Yt}&p=PC&ev=5.48.0-alpha.1&m=${ls()}`,n=`${e}/navi.json?r=${Date.now()}&env=${this._environment}`;this.logger.info(T,JSON.stringify({url:n,body:s}),r);const o=yield Gr(this.logger,{method:"POST",headers:{appId:t},body:s,url:n,timeout:1e4});if(200!==o.status)return this.logger.warn(N,JSON.stringify({url:n,code:o.status}),r),Ri(this.transHttpCode(o.status));this.logger.info(N,JSON.stringify({url:n,data:o.data}),r);try{const e=JSON.parse(o.data),t=/^https/.test(n)?"https":"http";return e.protocol=t,e.code&&200!==e.code?Ri(this.transHttpCode(e.code)):gi(e)}catch(e){return this.logger.error(S,o.data,r),Ri(ne.RC_NAVI_REQ_FAILED)}}))}httpRequestV2(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=this.getNaviV2RequestOption({appkey:t,token:i,uri:e,platform:"electron",protocol:ss.join(","),mac:ls()});this.logger.info(T,JSON.stringify({url:s.url,body:s.body,headers:s.headers}),r);const n=yield Gr(this.logger,s);if(200!==n.status)return this.logger.warn(N,JSON.stringify({url:s.url,code:n.status}),r),Ri(this.transHttpCode(n.status));this.logger.info(N,JSON.stringify({url:s.url,data:n.data}),r);try{const e=JSON.parse(n.data),t=/^https/.test(s.url)?"https":"http";return e.protocol=t,gi(e)}catch(e){return this.logger.error(S,n.data,r),Ri(ne.RC_NAVI_REQ_FAILED)}}))}getNaviCache(e){const t=this.getCatchKey(e),i=this._caches[t];if(i)return i;if(!o.existsSync(this.naviPath))return null;const r=o.readFileSync(this.naviPath,{encoding:"utf8"});try{this._caches=JSON.parse(r);return this._caches[t]}catch(e){this.logger.error(S,r)}return null}setNaviCache(e,t){const i=Date.now(),r=this.getCatchKey(e);if(ei(this._caches))for(const e in this._caches){(i-this._caches[e].timestamp>xt||r===e)&&delete this._caches[e]}this._caches[r]={token:e,naviInfo:t,timestamp:Date.now(),environment:this._environment},o.writeFileSync(this.naviPath,JSON.stringify(this._caches))}setEnvironment(e){this._environment=e}setUseNaviV2(e){this.useNaviV2=e}}var hs,us,ds,Es,Is,_s;function fs(e,t,i,...r){const s=e.createTraceId();let n;if(e.info(Er.P_CALL_ADDON_T,JSON.stringify({method:i,params:r}),s),!Nr[i])throw e.error(Er.P_CALL_ADDON_E,`Method ${i} not found in addon`,s),new Error(`Method ${i} not found in addon`);try{n=Nr[i](...r)}catch(t){throw e.error(Er.P_CALL_ADDON_E,JSON.stringify({stack:null==t?void 0:t.stack,method:i}),s),t}return e.info(Er.P_CALL_ADDON_R,JSON.stringify({method:i,result:t?n:void 0}),s),n}class gs{static create(e,t,i){return new gs(e,t,null!=i?i:e.createTraceId())}constructor(e,t,i){hs.add(this),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_method",{enumerable:!0,configurable:!0,writable:!0,value: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,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._traceId=null!=i?i:this._logger.createTraceId(),this._promise=new Promise((e=>{this._resolve=e}))}invoke(...e){return f(this,hs,"m",us).call(this,!0,...e)}asyncInvoke(...e){return f(this,hs,"m",us).call(this,!1,...e)}ok(e){this._flush(gi(e))}fail(e,t){this._flush(Ri(e,"",t))}_flush(e){this._logger.summary(Er.P_CALL_ADDON_R,e,this._traceId),setImmediate((()=>this._resolve(e)))}flush(e){this._flush(e)}result(){return this._promise}}hs=new WeakSet,us=function(e,...t){let i;const{_method:r,_traceId:s,_logger:n}=this;n.info(Er.P_CALL_ADDON_T,JSON.stringify({method:r,params:t}),s);try{i=Nr[r](...t)}catch(e){throw n.error(Er.P_CALL_ADDON_E,JSON.stringify({stack:null==e?void 0:e.stack,method:r}),s),e}return e&&i!==ne.SUCCESS&&this.fail(i),this},function(e){e[e.SUCCESS=0]="SUCCESS",e[e.NOT_INIT=-1]="NOT_INIT",e[e.CANCELED=-2]="CANCELED",e[e.REPEAT=-3]="REPEAT"}(_s||(_s={}));class Rs extends sr{getConnectedTime(){return this._connectedTime}constructor(e,t,i,r){super(e,i,r),ds.add(this),Object.defineProperty(this,"callCppProxy",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_connectedTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_naviInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_excludeLogTag",{enumerable:!0,configurable:!0,writable:!0,value:["P-API_RCGetValueForKey-T","P-API_RCGetValueForKey-E","P-API_RCGetValueForKey-R","P-API_RCSetValueForKey-T","P-API_RCSetValueForKey-E","P-API_RCSetValueForKey-R"]}),Object.defineProperty(this,"_connectingTask",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_tcpDuration",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pingResolve",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.callCppProxy("setConnectionStatusListener",f(this,ds,"m",Es).bind(this),((e,t,i)=>{this.logger.info(Er.P_DB_OPEN_O,JSON.stringify({code:e,recreate:t,recreateReason:i})),this.emit("onDBOpen",e,t,i)}),(()=>this.recvPong(ne.SUCCESS)),f(this,ds,"m",Is).bind(this),this._onHandshakeResult.bind(this),(()=>{this.logger.info(Er.P_DB_UPGRATE_START_S),this.emit("onDBUpgrateStart")}),(e=>{this.logger.info(Er.P_DB_UPGRATING_S,e),this.emit("onDBUpgrading",e)}),(e=>{this.logger.info(Er.P_DB_UPGRATE_COMPLETE_S,e),this.emit("onDBUpgradeComplete",e)}))}_connectWithToken(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=this._connectingTask=gs.create(this.logger,"connectWithToken",r);this._naviInfo=t;let n={};const{data:o}=Hr();o&&(n={proxy_passwd:o.socksPassword||"",proxy_name:o.socksUsername||"",proxy_port:o.socksPort||1082,proxy_host:o.socksHost||"localhost",proxy_type:0});const a=JSON.stringify(Object.assign(Object.assign({},n),{call_plus:this._openCallPlus,cid:this.cid})),l=this.getCmpList(t,!0).filter((e=>ss.includes(e.protocol))).sort(((e,t)=>t.weight-e.weight)),c=[];l.forEach((e=>{const t=c.find((t=>t.addr===e.addr));t?t.protocol!==fe.QUIC&&e.protocol!==fe.QUIC||(t.race=!0,t.protocol=fe.QUIC):(e.race=!1,c.push(e))})),this.logger.info(Er.P_CONNECT_T,JSON.stringify({}),r);const h=Date.now(),u=yield s.asyncInvoke(e,Yt,JSON.stringify(Object.assign(Object.assign({},t),{serverAddr:c,tagBlacklist:this._excludeLogTag.join(",")})),i,a).result();this.logger.summary(Er.P_CONNECT_R,u,r,{data:u.data});const{cid:d,userId:E,sessionId:I}=JSON.parse(u.data),_=Date.now()-(h+this._tcpDuration),f={bid:hi(),cod:u.code,net:this.getNetwork().type,dur:_,spr:0,cid:d,v:Lt.CURRENT,count:this.retryCount,sts:Date.now(),ssid:I};return this.logger.record(Ct.IM_CMP_RMTP,JSON.stringify(f)),this._connectingTask=null,u.trans((e=>(this._connectedTime=Date.now()-this.callCppProxy("getDeltaTime"),E)))}))}close(e,t,i){return _(this,void 0,void 0,(function*(){if(!e){const e=gs.create(this.logger,"disconnect");yield e.asyncInvoke("boolean"!=typeof t||t,!!i,(()=>e.ok()),(t=>e.fail(t))).result()}}))}sendPing(e){return new Promise((t=>{this.pingResolve=t,this.callCppProxy("sendHeartbeat"),setTimeout((()=>this.recvPong(ne.TIMEOUT)),e)}))}recvPong(e){this.pingResolve&&(this.pingResolve(e),this.pingResolve=null)}recvConnectRes(e,t,i){t?this.onDisconnectByServer(e,i):e===ne.RC_SOCKET_DISCONNECTED&&this.getConnectionStatus()!==pt.CONNECTED||this.onDisconenctUnusual(e)}_onHandshakeResult(e){var t;const{code:i,target_addr:{host:r,port:s,index:n,mode:o},timing:{transport_duration:a,dns_duration:l}}=e,c=4===o,h=this.cmpWeightCache.findIndex((e=>e.addr===`${r}:${s}`)),u={bid:hi(),ptc:bt.TCP,cod:i,net:this.getNetwork().type,dur:a,spr:0,pr:(null===(t=this._naviInfo)||void 0===t?void 0:t.type)||0,hos:`${r}:${s}`,idx:h,rct:this.retryCount?Ut.RECONNECT:Ut.CONNECT,cid:this.cid,v:Lt.CURRENT,rsn:this._doConnectReason,ddu:l,count:this.retryCount,weight:h>=0?this.cmpWeightCache[h].weight:-1};if(this.logger.record(Ct.IM_CMP,JSON.stringify(u)),this.logger.info(Er.P_CONNECT_ENTRY_S,JSON.stringify({code:i,host:r,port:s,duration:a,dnsDuration:l,index:n,isQuic:c})),i===_s.SUCCESS)this.curCmpUrl=`${r}:${s}`,this.updateCmpWeight(`${r}:${s}`,!0,c);else if(i!==_s.NOT_INIT){const e=s&&0!==s?`${r}:${s}`:`${r}`;this.updateCmpWeight(e,!1)}}}ds=new WeakSet,Es=function(e,t){10!==e&&(this._connectingTask?e===ne.SUCCESS?this._connectingTask.ok(t):this._connectingTask.fail(e,t):this.logger.warn(Er.P_CONNECT_E,JSON.stringify({msg:"connect complete but no connecting task"})))},Is=function(e,t){switch(this.logger.info(Er.P_CONNECT_S,JSON.stringify({status:e,delay:t})),e){case ne.RC_CONN_REDIRECTED:this.recvConnectRes(e,!0);break;case 11:case 10:case 12:break;case ne.CONNECTION_REFUSED:case ne.RC_SOCKET_DISCONNECTED:case ne.RC_SOCKET_NOT_CREATED:case ne.RC_CONN_ACK_TIMEOUT:case ne.RC_TCP_RESET:this.recvConnectRes(e,!1);break;case ne.RC_UDP_DISCONNECTED:this.recvConnectRes(e,!0,t);break;default:this.recvConnectRes(e,!0)}};class ps extends Pi{constructor(e,i,r){super(e,i),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"dbpath",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_cachePath",{enumerable:!0,configurable:!0,writable:!0,value:""}),this._cachePath=`${r}/${os(e)}`;const s=t.dirname(this._cachePath);o.existsSync(s)||Ir(s)}getCache(){if(!o.existsSync(this._cachePath))return null;return o.readFileSync(this._cachePath,{encoding:"utf8"})||null}setCache(e){o.writeFileSync(this._cachePath,e)}clearCache(){o.writeFileSync(this._cachePath,"")}sendRequest(e){return _(this,void 0,void 0,(function*(){const{status:t,data:i}=yield Gr(this.logger,{url:e,body:""});return{code:t,data:i}}))}decryptData(e){return _(this,void 0,void 0,(function*(){try{const t=yield((e,t,i)=>_(void 0,void 0,void 0,(function*(){const r=n.createDecipheriv("aes-256-cbc",t,i);let s=r.update(e,"base64","utf-8");return s+=r.final("utf8"),s})))(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91");return JSON.parse(t)}catch(e){this.logger.error(v,JSON.stringify({error:null==e?void 0:e.stack}))}}))}}class Ts extends $i{constructor(e,i,r,s,n){super(i,e,r),Object.defineProperty(this,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"catchFilePath",{enumerable:!0,configurable:!0,writable:!0,value:""}),this.model=`Electron|${process.platform}|${process.arch}`,this.catchFilePath=`${n}/${as(e)}`;const a=t.dirname(this.catchFilePath);o.existsSync(a)||Ir(a),this.init()}httpRequest(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=r;s.deviceId=this.deviceId,s.model=this.model;const n={url:e,method:t,headers:i,body:JSON.stringify(s)},o=this.logger.createTraceId();this.logger.info(T,JSON.stringify(n),o);const{status:a,data:l=""}=yield Gr(this.logger,n);this.logger.info(N,JSON.stringify({status:a,data:l}),o);try{const e=JSON.parse(l);return{code:a,data:e.data}}catch(e){return this.logger.warn(m,JSON.stringify({status:a,data:l,error:e})),{code:a,msg:e}}}))}setCloudControllerCache(e){o.writeFileSync(this.catchFilePath,JSON.stringify(e))}getLocalCloudControllerCache(){if(!o.existsSync(this.catchFilePath))return null;return o.readFileSync(this.catchFilePath,{encoding:"utf8"})}setMRTRConfig(e){const t={mrtrChatroom:e.chatroom,mrtrGroup:e.group,mrtrPrivate:e.private,mrtrUltraGroup:e.ultraGroup};this.logger.info(A,JSON.stringify(t)),Nr.setCloudConfig(JSON.stringify(t))}}const Ns=[Ge,tt,Fe,We,Xe,Ye,je,Je,Ke,Ze,qe],Ss=()=>({logCmdQueue:[],cloudControllerVers:[],srsmsgs:[],readNtfs:[],expansionMsgQueue:new Map,v1ReceiptMsgs:[],privateRSMsgs:[],groupRSMsgs:new Map,rrmsgs:new Map,messageUIds:new Set});class Os{constructor(){Object.defineProperty(this,"_report",{enumerable:!0,configurable:!0,writable:!0,value:Ss()}),Object.defineProperty(this,"_count",{enumerable:!0,configurable:!0,writable:!0,value:0})}isLowPriorityMessage(e){return Ns.includes(e)}isEmpty(){return 0===this._count}get count(){return this._count}push(e,t){this._count++;const{messageType:i,senderUserId:r,content:s}=e;if(i!==Ge)if(i!==tt)if(i!==We)if(i!==Fe)if(i!==Je){if(i===Ye){const{messageUId:t}=s;if(!t)return;return this._report.messageUIds.add(t),void this._report.v1ReceiptMsgs.push(e)}if(i===je){const i=s.receiptMessageDic;if(r!==t){const r=i[t];if(!r||0===r.length)return;return r.forEach((e=>this._report.messageUIds.add(e))),void this._report.v1ReceiptMsgs.push(e)}return Object.values(i).forEach((e=>{e.forEach((e=>this._report.messageUIds.add(e)))})),void this._report.v1ReceiptMsgs.push(e)}i!==Ke?i===Xe&&this._handleRSMsg(e):this._handleRRMsg(e)}else this._handleReadNtf(e);else this._handleExpansionNotify(e);else this._handleSRSMsg(e,t);else r===jt&&this._report.cloudControllerVers.push(e.sentTime);else if(r===jt){const{startTime:t,endTime:i,platform:r,logId:n,uri:o}=s;this._report.logCmdQueue.push({startTime:parseInt(t,10),endTime:parseInt(i,10),platform:r,logId:n,uri:o,messageUId:e.messageUId})}}_handleRSMsg(e){const{senderUserId:t,content:i,conversationType:r,targetId:s,channelId:n}=e;if(r===oe.PRIVATE){const e=this._report.privateRSMsgs.find((e=>e.conversationType===r&&e.targetId===s&&e.channelId===n));return void(e?e.timestamp=Math.max(e.timestamp,i.endMsgTime):this._report.privateRSMsgs.push({conversationType:r,targetId:s,channelId:n,timestamp:i.endMsgTime}))}const{msgId:o,rrn:a,tmn:l}=i,c=this._report.groupRSMsgs.get(o);c?(c.totalCount=l,c.readedCount=a):this._report.groupRSMsgs.set(o,{totalCount:l,readedCount:a}),this._report.messageUIds.add(o)}_handleRRMsg(e){const{msgId:t}=e.content;this._report.rrmsgs.set(t,e),this._report.messageUIds.add(t)}_handleExpansionNotify(e){const{put:t,mid:i,del:r,clear:s}=e.content;this._report.messageUIds.add(i),this._report.expansionMsgQueue.has(i)&&!s?this._report.expansionMsgQueue.get(i).push({put:t,del:r,clear:s}):this._report.expansionMsgQueue.set(i,[{put:t,del:r,clear:s}])}_handleSRSMsg(e,t){const{conversationType:i,targetId:r,channelId:s,senderUserId:n}=e;n===t&&(this._report.srsmsgs=this._report.srsmsgs.filter((e=>e.conversationType!==i||e.targetId!==r||e.channelId!==s)),this._report.srsmsgs.push(e))}_handleReadNtf(e){const{conversationType:t,targetId:i,channelId:r}=e;t===oe.PRIVATE&&(this._report.readNtfs=this._report.readNtfs.filter((s=>s.conversationType!==t||s.targetId!==i||s.channelId!==r||s.senderUserId!==e.senderUserId)),this._report.readNtfs.push(e))}build(){const e=this._report;return this._report=Ss(),this._count=0,e}}class Cs{constructor(e){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e})}gen(e,t){return(...i)=>{this.logger.info(Er.L_JS_FUNC_EXEC_O,e);try{t(...i)}catch(t){this.logger.error(Er.L_JS_FUNC_EXEC_E,`name: ${e}\n${t.stack}`),console.warn("L-js_callback_exception-E: args -> ",...i)}}}}function vs(e){return{type:e.conversationType,targetId:e.targetId,channelId:e.channelId||""}}function ms(e){const{userId:t,nickname:i,groupNickname:r,portraitUrl:s,joinTime:n,role:o,extra:a,isRobot:l}=e;return{userId:t,name:i||"",portraitUri:s||"",nickname:r||"",role:o||0,joinedTime:n||0,extra:a||"",isRobot:!!l}}function As(e){return e&&0!==e.length?e.map(ms):[]}var Ms,ys,bs,Ps,Ls,Us,Ds,ws,Vs,ks,Gs,Fs,Bs,Hs,xs,Js,Ys,js,Ws,Ks,Xs,Zs,qs,Qs,$s,zs,en,tn,rn,sn,nn,on,an,ln,cn,hn,un,dn,En,In,_n,fn,gn;!function(e){e[e.cuid=1]="cuid",e[e.uid=2]="uid",e[e.all=4]="all"}(_n||(_n={}));class Rn{constructor(e,t){Ms.add(this),Object.defineProperty(this,"_dispatchEvent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_msgExpansionHandler",{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,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"navi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tcpMgr",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_environment",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_staticConfigManager",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cloudController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cloudControllerUri",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"cloudControllerLock",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"cloudControllerMsgs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_deviceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_enableReadReceiptStorage",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isConnected",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_offlineFinishedPending",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullOfflineMessageFinished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_lowPriorityMessageHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_catcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_needDispatchMessageModifiedSyncCompleted",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_opts",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_buildSubscribeEventData",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=[];try{const{list:i}=JSON.parse(e);i.forEach((e=>{const{userId:i,subscribeType:r,subscribeTime:s,duration:n,operationType:o,details:a=[],userProfile:l}=JSON.parse(e.obj),c={userId:i,subscribeType:r,subscribeTime:s,expiry:n,operationType:o};[ft.ONLINE_STATUS,ft.FRIEND_ONLINE_STATUS].includes(r)&&(c.details=a.map((e=>{const{changeTime:t,changeValue:i,platform:r}=JSON.parse(e);return{changeTime:t,eventValue:i,platform:r}}))),[ft.USER_PROFILE,ft.FRIEND_USER_PROFILE].includes(r)&&(c.userProfile=this._string2userProfileInfo(l)),t.push(c)}))}catch(t){this.logger.error(Er.P_PARSE_JSON_SUBSCRIBE_DATA_E,JSON.stringify({error:null==t?void 0:t.stack,data:e}))}return t}}),Object.defineProperty(this,"_chatroomCache",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"rtcHeartbeatResolves",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this._opts=e;const{dbpath:i,appkey:r,logOutputLevel:s,disableLogReport:n,eventLoopBlockingCheck:o,enableSyncEmptyTopConversation:a}=e,l=this._deviceId=is(),c=Qr();this.logger=new ts(r,"RC-M","IM",c),this._catcher=new Cs(this.logger),Nr.initWithAppkey(r,i,Yt,this.logger.getSessionId()),Nr.setConsoleLogLevel(s+1),this.logger.setOutputLevel(s),this.reporter=new Xr(r,l,this.logger,n,c),this.logger.info(Er.P_INIT_O,JSON.stringify({appkey:r,dbpath:i,proto_commit:Nr.getNodeVersion(),deviceId:l,commit:"cde31834a5a3b0e318c0710fc21f0d10ec140eca",processName:process.title,processPId:process.pid,disableLogReport:n,eventLoopBlockingCheck:o})),o&&Ki.start(this.logger),fs(this.logger,!1,"setDeviceId",l),this._staticConfigManager=new ps(r,this.logger,i),this._lowPriorityMessageHandler=new Os,this.navi=new cs(r,this.logger,i,this._staticConfigManager),this.tcpMgr=new Rs(r,this._callCppProxy.bind(this),this.navi,this.logger),this.tcpMgr.on("onConnected",this.onConnected,this),this.tcpMgr.on("onSuspend",this.onSuspend,this),this.tcpMgr.on("onDisconnected",this.onDisconnected,this),this.tcpMgr.on("onConnecting",this.onConnecting,this),this.tcpMgr.on("onDBOpen",this.dbOpened,this),this.tcpMgr.on("onDBUpgrateStart",this.dbUpgradeStart,this),this.tcpMgr.on("onDBUpgrading",this.dbUpgrading,this),this.tcpMgr.on("onDBUpgradeComplete",this.dbUpgradeComplete,this),this._enableCreateEmptyTopConversation(a),this._initCloudController(r,l,i),this._registerBuildinMessageTypes(),Nr.setOnReceiveMessageListener(this._catcher.gen("setOnReceiveMessageListener[0]",f(this,Ms,"m",Hs).bind(this)),this._catcher.gen("setOnReceiveMessageListener[1]",f(this,Ms,"m",xs).bind(this)),this._catcher.gen("setOnReceiveMessageListener[2]",this._handleMessageModified.bind(this))),Nr.setRTConversationListener(this._catcher.gen("setRTConversationListener",(e=>this._dispatchEvent("sgRelationsSynced",e)))),this._setConversationStatusListener(),this._setPushNotificationListener(),this._setRTCHeartbeatListener(),this._setRTCLivingRoomEventListener(),this._setChatroomEventListener(),this._setCallInfoListener(),this._setSubscribeEventListener(),this._setUserProfileListener(),this._setEntrustGroupListener(),this._setFriendEventListener(),Nr.setReadReceiptListener(this._catcher.gen("setReadReceiptListener",((e,t)=>{const i=JSON.parse(t).map((e=>({identifier:{conversationType:e.conIdentifier.type,targetId:e.conIdentifier.targetId,channelId:e.conIdentifier.channelId},messageUId:e.msgUid,readCount:e.readCount,unreadCount:e.unreadCount,totalCount:e.totalCount,users:e.readUsers.map((e=>({userId:e.userId,timestamp:e.receiptTime,isMentioned:e.mentioned})))})));this._dispatchEvent("readReceiptResponseV5",i)}))),Nr.setTranslateEventListener(this._catcher.gen("setTranslateEventListener",(e=>{const t=JSON.parse(e).map((e=>({translateInfo:{targetLanguage:e.translateResult.targetLanguage,translatedText:e.translateResult.translatedText,status:e.translateResult.translateStatus},code:e.code,identifier:e.messageRecognitionIdentifier.messageUid,from:e.messageRecognitionIdentifier.inputSource})));this._dispatchEvent("translateResponse",t)}))),this._msgExpansionHandler=new rs(this._callCppProxy.bind(this)),Nr.setUltraGroupListener(this._catcher.gen("setUltraGroupListener[0]",(e=>this._dispatchEvent("ultraGroupEnable"))),this._catcher.gen("setUltraGroupListener[1]",((e,t,i)=>f(this,Ms,"m",Ps).call(this,e,t,i))),this._catcher.gen("setUltraGroupListener[2]",(e=>f(this,Ms,"m",Ls).call(this,e))),this._catcher.gen("setUltraGroupListener[3]",(e=>f(this,Ms,"m",Us).call(this,e))),this._catcher.gen("setUltraGroupListener[4]",(e=>f(this,Ms,"m",Ds).call(this,e))),this._catcher.gen("setUltraGroupListener[5]",(e=>f(this,Ms,"m",ws).call(this,e))),this._catcher.gen("setUltraGroupListener[6]",(e=>f(this,Ms,"m",Vs).call(this,e))),this._catcher.gen("setUltraGroupListener[7]",(e=>f(this,Ms,"m",ys).call(this,e))),this._catcher.gen("setUltraGroupListener[8]",(e=>f(this,Ms,"m",bs).call(this,e)))),Nr.setRobotEventListener(this._catcher.gen("setRobotEventListener",((e,t)=>{this._dispatchEvent("robotsSynced",e,f(this,Ms,"m",In).call(this,t))}))),Nr.setMessageReactionListener(this._catcher.gen("setMessageReactionListener",(e=>{const t=JSON.parse(e).map((e=>{var t,{conversationIdentifier:i}=e,r=
1
+ "use strict";var e,t=require("path"),i=require("electron"),r=require("os"),s=require("child_process"),n=(require("module"),require("crypto")),o=require("fs"),a=require("url"),l=require("http"),c=require("https"),h=require("zlib"),u=require("net"),d=require("events"),E=require("tls"),I="undefined"!=typeof document?document.currentScript:null;function _(e,t,i,r){return new(i||(i=Promise))((function(s,n){function o(e){try{l(r.next(e))}catch(e){n(e)}}function a(e){try{l(r.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}function f(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)}function g(e,t,i,r,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s?s.value=i:t.set(e,i),i}!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"}(e||(e={}));const R="L-connect-S",p="L-TEST-O",T="L-request-T",N="L-request-R",S="L-parse_navi-E",O="L-rejoin_chatroom-T",C="L-rejoin_chatroom-R",v="L-get_static_conf-E",m="L-cloud_config_data_error",A="L-cloud_set_mrtr-O",M="L-parse_json-E",y="L-event_loop_blocking-S",b="L-pull_offline_message_finished-S";var P,L,U,D,w,V,k,G,F,B,H,x,J,Y,j,W,K,X,Z,q,Q,$,z,ee,te,ie,re,se,ne,oe;!function(e){e[e.BOTH=2]="BOTH"}(P||(P={})),function(e){e[e.BOTH=2]="BOTH"}(L||(L={})),function(e){e[e.FREE=1]="FREE",e[e.NEED_VERIFY=2]="NEED_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(U||(U={})),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"}(D||(D={})),function(e){e[e.SENT=1]="SENT",e[e.RECEIVED=2]="RECEIVED"}(w||(w={})),function(e){e[e.UNHANDLED=0]="UNHANDLED",e[e.ACCEPTED=1]="ACCEPTED",e[e.REFUSED=2]="REFUSED",e[e.EXPIRED=3]="EXPIRED"}(V||(V={})),function(e){e[e.FRIEND_APPLICATION=31]="FRIEND_APPLICATION"}(k||(k={})),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"}(G||(G={})),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"}(F||(F={})),function(e){e[e.OWNER=0]="OWNER",e[e.OWNER_OR_MANAGER=1]="OWNER_OR_MANAGER",e[e.EVERYONE=2]="EVERYONE"}(B||(B={})),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"}(H||(H={})),function(e){e[e.FREE=0]="FREE",e[e.INVITEE_VERIFY=1]="INVITEE_VERIFY"}(x||(x={})),function(e){e[e.UNDEF=0]="UNDEF",e[e.NORMAL=1]="NORMAL",e[e.MANAGER=2]="MANAGER",e[e.OWNER=3]="OWNER"}(J||(J={})),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"}(Y||(Y={})),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"}(j||(j={})),function(e){e[e.ADD=1]="ADD",e[e.REMOVE=2]="REMOVE"}(W||(W={})),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"}(K||(K={})),function(e){e[e.REFUSE=0]="REFUSE",e[e.ACCEPT=1]="ACCEPT"}(X||(X={})),function(e){e[e.APPLICANT=0]="APPLICANT",e[e.MANAGER=1]="MANAGER"}(Z||(Z={})),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"}(q||(q={})),function(e){e[e.APPLICATION=0]="APPLICATION",e[e.INVITATION=1]="INVITATION"}(Q||(Q={})),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"}($||($={})),function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(z||(z={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ee||(ee={})),function(e){e[e.LeaveOnMyOwn=1]="LeaveOnMyOwn",e[e.OtherDeviceLogin=2]="OtherDeviceLogin"}(te||(te={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ie||(ie={})),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"}(re||(re={})),function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(se||(se={})),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.RC_MESSAGE_EXPANSION_DISABLED=22210]="RC_MESSAGE_EXPANSION_DISABLED",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RC_GROUP_COUNT_EXCEED_LIMIT=22412]="RC_GROUP_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_JOIN_COUNT_EXCEED_LIMIT=22413]="RC_GROUP_JOIN_COUNT_EXCEED_LIMIT",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.RC_CHATROOM_ACTIVE_COUNT_EXCEED_LIMIT=23450]="RC_CHATROOM_ACTIVE_COUNT_EXCEED_LIMIT",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"}(ne||(ne={})),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"}(oe||(oe={}));const ae=0,le=1,ce=2,he=3,ue=4,de=5,Ee=6,Ie=7,_e=e=>{const t=[oe.PRIVATE,oe.GROUP,oe.SYSTEM,oe.PUBLIC_SERVICE,oe.APP_PUBLIC_SERVICE];switch(e){case ae:return t;case le:return[oe.PRIVATE,oe.GROUP];case ce:return[...t,oe.ULTRA_GROUP];case he:return[...t,oe.ULTRA_GROUP,oe.CHATROOM];case ue:return[...t,oe.ULTRA_GROUP,oe.CHATROOM,oe.RTC_ROOM,oe.CUSTOMER_SERVICE,oe.DISCUSSION];case de:return[oe.PRIVATE,oe.GROUP,oe.ULTRA_GROUP];case Ee:return[oe.GROUP];case Ie:return[oe.PRIVATE]}};var fe;!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"}(fe||(fe={}));const ge=function(){var e,t={},i=function(e){var t=function(e,i,s){if(void 0===e&&(e=t.DEFAULT_CAPACITY),void 0===i&&(i=t.DEFAULT_ENDIAN),void 0===s&&(s=t.DEFAULT_NOASSERT),!s){if((e|=0)<0)throw RangeError("Illegal capacity");i=!!i,s=!!s}this.buffer=0===e?r: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=s};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 r=new ArrayBuffer(0),s=String.fromCharCode;function n(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("")+s.apply(String,e);e.length+arguments.length>1024&&(t.push(s.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function a(e,t,i,r,s){var n,o,a=8*s-r-1,l=(1<<a)-1,c=l>>1,h=-7,u=i?s-1:0,d=i?-1:1,E=e[t+u];for(u+=d,n=E&(1<<-h)-1,E>>=-h,h+=a;h>0;n=256*n+e[t+u],u+=d,h-=8);for(o=n&(1<<-h)-1,n>>=-h,h+=r;h>0;o=256*o+e[t+u],u+=d,h-=8);if(0===n)n=1-c;else{if(n===l)return o?NaN:1/0*(E?-1:1);o+=Math.pow(2,r),n-=c}return(E?-1:1)*o*Math.pow(2,n-r)}function l(e,t,i,r,s,n){var o,a,l,c=8*n-s-1,h=(1<<c)-1,u=h>>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,E=r?0:n-1,I=r?1:-1,_=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=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*l-1)*Math.pow(2,s),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),o=0));s>=8;e[i+E]=255&a,E+=I,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;e[i+E]=255&o,E+=I,o/=256,c-=8);e[i+E-I]|=128*_}t.accessor=function(){return Uint8Array},t.allocate=function(e,i,r){return new t(e,i,r)},t.concat=function(e,i,r,s){"boolean"!=typeof i&&"string"==typeof i||(s=r,r=i,i=void 0);for(var n,o=0,a=0,l=e.length;a<l;++a)t.isByteBuffer(e[a])||(e[a]=t.wrap(e[a],i)),(n=e[a].limit-e[a].offset)>0&&(o+=n);if(0===o)return new t(0,r,s);var c,h=new t(o,r,s);for(a=0;a<l;)(n=(c=e[a++]).limit-c.offset)<=0||(h.view.set(c.view.subarray(c.offset,c.limit),h.offset),h.offset+=n);return h.limit=h.offset,h.offset=0,h},t.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},t.type=function(){return ArrayBuffer},t.wrap=function(e,r,s,n){if("string"!=typeof r&&(n=s,s=r,r=void 0),"string"==typeof e)switch(void 0===r&&(r="utf8"),r){case"base64":return t.fromBase64(e,s);case"hex":return t.fromHex(e,s);case"binary":return t.fromBinary(e,s);case"utf8":return t.fromUTF8(e,s);case"debug":return t.fromDebug(e,s);default:throw Error("Unsupported encoding: "+r)}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,s,n),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,s,n),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,s,n)).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 r,s=t,n=e.length,o=n>>3,a=0;for(t+=this.writeVarint32(n,t);o--;)r=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(r,t++);if(a<n){var l=0;for(r=0;a<n;)r|=(1&!!e[a++])<<l++;this.writeByte(r,t++)}return i?(this.offset=t,this):t-s},i.readBitSet=function(e){var t=void 0===e;t&&(e=this.offset);var i,r=this.readVarint32(e),s=r.value,n=s>>3,o=0,a=[];for(e+=r.length;n--;)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<s){var l=0;for(i=this.readByte(e++);o<s;)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 r=this.slice(t,t+e);return i&&(this.offset+=e),r},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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=void 0===i;if(r&&(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 s=this.buffer.byteLength;i>s&&this.resize((s*=2)>i?s:i),i-=8;var n=t.low,o=t.high;return this.littleEndian?(this.view[i+3]=n>>>24&255,this.view[i+2]=n>>>16&255,this.view[i+1]=n>>>8&255,this.view[i]=255&n,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]=n>>>24&255,this.view[i+1]=n>>>16&255,this.view[i+2]=n>>>8&255,this.view[i+3]=255&n),r&&(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 r=0,s=0;this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0,t+=4,s=this.view[t+2]<<16,s|=this.view[t+1]<<8,s|=this.view[t],s+=this.view[t+3]<<24>>>0):(s=this.view[t+1]<<16,s|=this.view[t+2]<<8,s|=this.view[t+3],s+=this.view[t]<<24>>>0,t+=4,r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0);var n=new e(r,s,!1);return i&&(this.offset+=8),n},i.readLong=i.readInt64,i.writeUint64=function(t,i){var r=void 0===i;if(r&&(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 s=this.buffer.byteLength;i>s&&this.resize((s*=2)>i?s:i),i-=8;var n=t.low,o=t.high;return this.littleEndian?(this.view[i+3]=n>>>24&255,this.view[i+2]=n>>>16&255,this.view[i+1]=n>>>8&255,this.view[i]=255&n,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]=n>>>24&255,this.view[i+1]=n>>>16&255,this.view[i+2]=n>>>8&255,this.view[i+3]=255&n),r&&(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 r=0,s=0;this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0,t+=4,s=this.view[t+2]<<16,s|=this.view[t+1]<<8,s|=this.view[t],s+=this.view[t+3]<<24>>>0):(s=this.view[t+1]<<16,s|=this.view[t+2]<<8,s|=this.view[t+3],s+=this.view[t]<<24>>>0,t+=4,r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0);var n=new e(r,s,!0);return i&&(this.offset+=8),n},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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r: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 r=void 0===i;if(r&&(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 s,n=t.calculateVarint32(e);i+=n;var o=this.buffer.byteLength;for(i>o&&this.resize((o*=2)>i?o:i),i-=n,e>>>=0;e>=128;)s=127&e|128,this.view[i++]=s,e>>>=7;return this.view[i++]=e,r?(this.offset=i,this):n},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,r=0,s=0;do{if(!this.noAssert&&e>this.limit){var n=Error("Truncated");throw n.truncated=!0,n}i=this.view[e++],r<5&&(s|=(127&i)<<7*r),++r}while(128&i);return s|=0,t?(this.offset=e,s):{value:s,length:r}},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,r=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0;return 0==s?0==r?i<16384?i<128?1:2:i<1<<21?3:4:r<16384?r<128?5:6:r<1<<21?7:8:s<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,r){var s=void 0===r;if(s&&(r=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 r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+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 n=t.calculateVarint64(i),o=i.toInt()>>>0,a=i.shiftRightUnsigned(28).toInt()>>>0,l=i.shiftRightUnsigned(56).toInt()>>>0;r+=n;var c=this.buffer.byteLength;switch(r>c&&this.resize((c*=2)>r?c:r),r-=n,n){case 10:this.view[r+9]=l>>>7&1;case 9:this.view[r+8]=9!==n?128|l:127&l;case 8:this.view[r+7]=8!==n?a>>>21|128:a>>>21&127;case 7:this.view[r+6]=7!==n?a>>>14|128:a>>>14&127;case 6:this.view[r+5]=6!==n?a>>>7|128:a>>>7&127;case 5:this.view[r+4]=5!==n?128|a:127&a;case 4:this.view[r+3]=4!==n?o>>>21|128:o>>>21&127;case 3:this.view[r+2]=3!==n?o>>>14|128:o>>>14&127;case 2:this.view[r+1]=2!==n?o>>>7|128:o>>>7&127;case 1:this.view[r]=1!==n?128|o:127&o}return s?(this.offset+=n,this):n},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 r=t,s=0,n=0,o=0,a=0;if(s=127&(a=this.view[t++]),128&a&&(s|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(n=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===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)&&(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(s|n<<28,n>>>4|o<<24,!1);return i?(this.offset=t,l):{value:l,length:t-r}},i.readVarint64ZigZag=function(i){var r=this.readVarint64(i);return r&&r.value instanceof e?r.value=t.zigZagDecode64(r.value):r=t.zigZagDecode64(r),r}),i.writeCString=function(e,t){var i=void 0===t;i&&(t=this.offset);var r,s=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;r<s;++r)if(0===e.charCodeAt(r))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)}s=h.calculateUTF16asUTF8(n(e))[1],t+=s+1;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=s+1,h.encodeUTF16toUTF8(n(e),function(e){this.view[t++]=e}.bind(this)),this.view[t++]=0,i?(this.offset=t,this):s},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,r=e,s=-1;return h.decodeUTF8toUTF16(function(){if(0===s)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(s=this.view[e++])?null:s}.bind(this),i=o(),!0),t?(this.offset=e,i()):{string:i(),length:e-r}},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 r,s=t;r=h.calculateUTF16asUTF8(n(e),this.noAssert)[1],t+=4+r;var o=this.buffer.byteLength;if(t>o&&this.resize((o*=2)>t?o:t),t-=4+r,this.littleEndian?(this.view[t+3]=r>>>24&255,this.view[t+2]=r>>>16&255,this.view[t+1]=r>>>8&255,this.view[t]=255&r):(this.view[t]=r>>>24&255,this.view[t+1]=r>>>16&255,this.view[t+2]=r>>>8&255,this.view[t+3]=255&r),t+=4,h.encodeUTF16toUTF8(n(e),function(e){this.view[t++]=e}.bind(this)),t!==s+4+r)throw RangeError("Illegal range: Truncated data, "+t+" == "+(t+4+r));return i?(this.offset=t,this):t-s},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 r=e,s=this.readUint32(e),n=this.readUTF8String(s,t.METRICS_BYTES,e+=4);return e+=n.length,i?(this.offset=e,n.string):{string:n.string,length:e-r}},t.METRICS_CHARS="c",t.METRICS_BYTES="b",i.writeUTF8String=function(e,t){var i,r=void 0===t;if(r&&(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 s=t;i=h.calculateUTF16asUTF8(n(e))[1],t+=i;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=i,h.encodeUTF16toUTF8(n(e),function(e){this.view[t++]=e}.bind(this)),r?(this.offset=t,this):t-s},i.writeString=i.writeUTF8String,t.calculateUTF8Chars=function(e){return h.calculateUTF16asUTF8(n(e))[0]},t.calculateUTF8Bytes=function(e){return h.calculateUTF16asUTF8(n(e))[1]},t.calculateString=t.calculateUTF8Bytes,i.readUTF8String=function(e,i,r){"number"==typeof i&&(r=i,i=void 0);var s=void 0===r;if(s&&(r=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 r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var n,a=0,l=r;if(i===t.METRICS_CHARS){if(n=o(),h.decodeUTF8(function(){return a<e&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++a,h.UTF8toUTF16(e,n)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return s?(this.offset=r,n()):{string:n(),length:r-l}}if(i===t.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}var c=r+e;if(h.decodeUTF8toUTF16(function(){return r<c?this.view[r++]:null}.bind(this),n=o(),this.noAssert),r!==c)throw RangeError("Illegal range: Truncated data, "+r+" == "+c);return s?(this.offset=r,n()):{string:n(),length:r-l}}throw TypeError("Unsupported metrics: "+i)},i.readString=i.readUTF8String,i.writeVString=function(e,i){var r=void 0===i;if(r&&(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 s,o,a=i;s=h.calculateUTF16asUTF8(n(e),this.noAssert)[1],o=t.calculateVarint32(s),i+=o+s;var l=this.buffer.byteLength;if(i>l&&this.resize((l*=2)>i?l:i),i-=o+s,i+=this.writeVarint32(s,i),h.encodeUTF16toUTF8(n(e),function(e){this.view[i++]=e}.bind(this)),i!==a+s+o)throw RangeError("Illegal range: Truncated data, "+i+" == "+(i+s+o));return r?(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 r=e,s=this.readVarint32(e),n=this.readUTF8String(s.value,t.METRICS_BYTES,e+=s.length);return e+=n.length,i?(this.offset=e,n.string):{string:n.string,length:e-r}},i.append=function(e,i,r){"number"!=typeof i&&"string"==typeof i||(r=i,i=void 0);var s=void 0===r;if(s&&(r=this.offset),!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,i));var n=e.limit-e.offset;if(n<=0)return this;r+=n;var o=this.buffer.byteLength;return r>o&&this.resize((o*=2)>r?o:r),r-=n,this.view.set(e.view.subarray(e.offset,e.limit),r),e.offset+=n,s&&(this.offset+=n),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=r,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var s=new ArrayBuffer(i),n=new Uint8Array(s);return n.set(this.view.subarray(e,t)),this.buffer=s,this.view=n,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 r=i-e,s=new t(r,this.littleEndian,this.noAssert);return s.offset=0,s.limit=r,s.markedOffset>=0&&(s.markedOffset-=e),this.copyTo(s,0,e,i),s},i.copyTo=function(e,i,r,s){var n,o;if(!this.noAssert&&!t.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(i=(o=void 0===i)?e.offset:0|i,r=(n=void 0===r)?this.offset:0|r,s=void 0===s?this.limit:0|s,i<0||i>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+i+" <= "+e.buffer.byteLength);if(r<0||s>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+r+" <= "+this.buffer.byteLength);var a=s-r;return 0===a?e:(e.ensureCapacity(i+a),e.view.set(this.view.subarray(r,s),i),n&&(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 r=void 0===t;if(r&&(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 r&&(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,r){"number"!=typeof i&&"string"==typeof i||(r=i,i=void 0);var s=void 0===r;if(s&&(r=this.offset),!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,i));var n=e.limit-e.offset;if(n<=0)return this;var o=n-r;if(o>0){var a=new ArrayBuffer(this.buffer.byteLength+o),l=new Uint8Array(a);l.set(this.view.subarray(r,this.buffer.byteLength),n),this.buffer=a,this.view=l,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,r+=o}else new Uint8Array(this.buffer);return this.view.set(e.view.subarray(e.offset,e.limit),r-n),e.offset=e.limit,s&&(this.offset-=n),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 r;var s=new ArrayBuffer(i-t);return new Uint8Array(s).set(new Uint8Array(this.buffer).subarray(t,i),0),s},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=[],r=0,s=t.length;r<s;++r)i[t[r]]=r;return e.encode=function(e,i){for(var r,s;null!==(r=e());)i(t[r>>2&63]),s=(3&r)<<4,null!==(r=e())?(i(t[63&((s|=r>>4&15)|r>>4&15)]),s=(15&r)<<2,null!==(r=e())?(i(t[63&(s|r>>6&3)]),i(t[63&r])):(i(t[63&s]),i(61))):(i(t[63&s]),i(61),i(61))},e.decode=function(e,t){var r,s,n;function o(e){throw Error("Illegal character code: "+e)}for(;null!==(r=e());)if(void 0===(s=i[r])&&o(r),null!==(r=e())&&(void 0===(n=i[r])&&o(r),t(s<<2>>>0|(48&n)>>4),null!==(r=e()))){if(void 0===(s=i[r])){if(61===r)break;o(r)}if(t((15&n)<<4>>>0|(60&s)>>2),null!==(r=e())){if(void 0===(n=i[r])){if(61===r)break;o(r)}t((3&s)<<6>>>0|n)}}},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 r=new t(e.length/4*3,i),s=0;return c.decode(n(e),(function(e){r.view[s++]=e})),r.limit=s,r},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=[],r=[];e<t;)i.push(this.view[e++]),i.length>=1024&&(r.push(String.fromCharCode.apply(String,i)),i=[]);return r.join("")+String.fromCharCode.apply(String,i)},t.fromBinary=function(e,i){if("string"!=typeof e)throw TypeError("str");for(var r,s=0,n=e.length,o=new t(n,i);s<n;){if((r=e.charCodeAt(s))>255)throw RangeError("illegal char code: "+r);o.view[s++]=r}return o.limit=n,o},i.toDebug=function(e){for(var t,i=-1,r=this.buffer.byteLength,s="",n="",o="";i<r;){if(-1!==i&&(s+=(t=this.view[i])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(n+=t>32&&t<127?String.fromCharCode(t):".")),++i,e&&i>0&&i%16==0&&i!==r){for(;s.length<51;)s+=" ";o+=s+n+"\n",s=n=""}i===this.offset&&i===this.limit?s+=i===this.markedOffset?"!":"|":i===this.offset?s+=i===this.markedOffset?"[":"<":i===this.limit?s+=i===this.markedOffset?"]":">":s+=i===this.markedOffset?"'":e||0!==i&&i!==r?" ":""}if(e&&" "!==s){for(;s.length<51;)s+=" ";o+=s+n+"\n"}return e?o:s},t.fromDebug=function(e,i,r){for(var s,n,o=e.length,a=new t((o+1)/3|0,i,r),l=0,c=0,h=!1,u=!1,d=!1,E=!1,I=!1;l<o;){switch(s=e.charAt(l++)){case"!":if(!r){if(u||d||E){I=!0;break}u=d=E=!0}a.offset=a.markedOffset=a.limit=c,h=!1;break;case"|":if(!r){if(u||E){I=!0;break}u=E=!0}a.offset=a.limit=c,h=!1;break;case"[":if(!r){if(u||d){I=!0;break}u=d=!0}a.offset=a.markedOffset=c,h=!1;break;case"<":if(!r){if(u){I=!0;break}u=!0}a.offset=c,h=!1;break;case"]":if(!r){if(E||d){I=!0;break}E=d=!0}a.limit=a.markedOffset=c,h=!1;break;case">":if(!r){if(E){I=!0;break}E=!0}a.limit=c,h=!1;break;case"'":if(!r){if(d){I=!0;break}d=!0}a.markedOffset=c,h=!1;break;case" ":h=!1;break;default:if(!r&&h){I=!0;break}if(n=parseInt(s+e.charAt(l++),16),!r&&(isNaN(n)||n<0||n>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[c++]=n,h=!0}if(I)throw TypeError("Illegal str: Invalid symbol at "+l)}if(!r){if(!u||!E)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,r=new Array(t-e);e<t;)(i=this.view[e++])<16?r.push("0",i.toString(16)):r.push(i.toString(16));return r.join("")},t.fromHex=function(e,i,r){if(!r){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 s,n=e.length,o=new t(n/2|0,i),a=0,l=0;a<n;a+=2){if(s=parseInt(e.substring(a,a+2),16),!r&&(!isFinite(s)||s<0||s>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[l++]=s}return o.limit=l,o};var h=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,r,s,n,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===(r=e())&&o([i,r]),t((31&i)<<6|63&r);else if(224==(240&i))(null===(r=e())||null===(s=e()))&&o([i,r,s]),t((15&i)<<12|(63&r)<<6|63&s);else{if(240!=(248&i))throw RangeError("Illegal starting byte: "+i);(null===(r=e())||null===(s=e())||null===(n=e()))&&o([i,r,s,n]),t((7&i)<<18|(63&r)<<12|(63&s)<<6|63&n)}else t(i)},UTF16toUTF8:function(e,t){for(var i,r=null;null!==(i=null!==r?r:e());)i>=55296&&i<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(i-55296)+r-56320+65536),r=null):t(i);null!==r&&t(r)},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,r=0;return e.UTF16toUTF8(t,(function(e){++i,r+=e<128?1:e<2048?2:e<65536?3:4})),[i,r]}};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{h.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,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var s=new t(h.calculateUTF16asUTF8(n(e),!0)[1],i,r),o=0;return h.encodeUTF16toUTF8(n(e),(function(e){s.view[o++]=e})),s.limit=o,s},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={},r={};function s(e,t){var s,n,a;return t?(a=0<=(e>>>=0)&&e<256)&&(n=r[e])?n:(s=o(e,(0|e)<0?-1:0,!0),a&&(r[e]=s),s):(a=-128<=(e|=0)&&e<128)&&(n=i[e])?n:(s=o(e,e<0?-1:0,!1),a&&(i[e]=s),s)}function n(e,t){if(isNaN(e)||!isFinite(e))return t?_:I;if(t){if(e<0)return _;if(e>=u)return T}else{if(e<=-d)return N;if(e+1>=d)return p}return e<0?n(-e,t).neg():o(e%h|0,e/h|0,t)}function o(t,i,r){return new e(t,i,r)}e.fromInt=s,e.fromNumber=n,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 I;if("number"==typeof t?(i=t,t=!1):t=!!t,(i=i||10)<2||36<i)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return l(e.substring(1),t,i).neg();for(var s=n(a(i,8)),o=I,c=0;c<e.length;c+=8){var h=Math.min(8,e.length-c),u=parseInt(e.substring(c,c+h),i);if(h<8){var d=n(a(i,h));o=o.mul(d).add(n(u))}else o=(o=o.mul(s)).add(n(u))}return o.unsigned=t,o}function c(t){return t instanceof e?t:"number"==typeof t?n(t):"string"==typeof t?l(t):o(t.low,t.high,t.unsigned)}e.fromString=l,e.fromValue=c;var h=4294967296,u=h*h,d=u/2,E=s(1<<24),I=s(0);e.ZERO=I;var _=s(0,!0);e.UZERO=_;var f=s(1);e.ONE=f;var g=s(1,!0);e.UONE=g;var R=s(-1);e.NEG_ONE=R;var p=o(-1,2147483647,!1);e.MAX_VALUE=p;var T=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=T;var N=o(0,-2147483648,!1);e.MIN_VALUE=N;var S=e.prototype;return S.toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},S.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(N)){var t=n(e),i=this.div(t),r=i.mul(t).sub(this);return i.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var s=n(a(e,6),this.unsigned),o=this,l="";;){var c=o.div(s),h=(o.sub(c.mul(s)).toInt()>>>0).toString(e);if((o=c).isZero())return h+l;for(;h.length<6;)h="0"+h;l=""+h+l}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(N)?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},S.isZero=function(){return 0===this.high&&0===this.low},S.isNegative=function(){return!this.unsigned&&this.high<0},S.isPositive=function(){return this.unsigned||this.high>=0},S.isOdd=function(){return!(1&~this.low)},S.isEven=function(){return!(1&this.low)},S.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)},S.eq=S.equals,S.notEquals=function(e){return!this.eq(e)},S.neq=S.notEquals,S.lessThan=function(e){return this.comp(e)<0},S.lt=S.lessThan,S.lessThanOrEqual=function(e){return this.comp(e)<=0},S.lte=S.lessThanOrEqual,S.greaterThan=function(e){return this.comp(e)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(e){return this.comp(e)>=0},S.gte=S.greaterThanOrEqual,S.compare=function(e){if(t(e)||(e=c(e)),this.eq(e))return 0;var i=this.isNegative(),r=e.isNegative();return i&&!r?-1:!i&&r?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},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(N)?N:this.not().add(f)},S.neg=S.negate,S.add=function(e){t(e)||(e=c(e));var i=this.high>>>16,r=65535&this.high,s=this.low>>>16,n=65535&this.low,a=e.high>>>16,l=65535&e.high,h=e.low>>>16,u=0,d=0,E=0,I=0;return E+=(I+=n+(65535&e.low))>>>16,d+=(E+=s+h)>>>16,u+=(d+=r+l)>>>16,u+=i+a,o((E&=65535)<<16|(I&=65535),(u&=65535)<<16|(d&=65535),this.unsigned)},S.subtract=function(e){return t(e)||(e=c(e)),this.add(e.neg())},S.sub=S.subtract,S.multiply=function(e){if(this.isZero())return I;if(t(e)||(e=c(e)),e.isZero())return I;if(this.eq(N))return e.isOdd()?N:I;if(e.eq(N))return this.isOdd()?N:I;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(E)&&e.lt(E))return n(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,r=65535&this.high,s=this.low>>>16,a=65535&this.low,l=e.high>>>16,h=65535&e.high,u=e.low>>>16,d=65535&e.low,_=0,f=0,g=0,R=0;return g+=(R+=a*d)>>>16,f+=(g+=s*d)>>>16,g&=65535,f+=(g+=a*u)>>>16,_+=(f+=r*d)>>>16,f&=65535,_+=(f+=s*u)>>>16,f&=65535,_+=(f+=a*h)>>>16,_+=i*d+r*u+s*h+a*l,o((g&=65535)<<16|(R&=65535),(_&=65535)<<16|(f&=65535),this.unsigned)},S.mul=S.multiply,S.divide=function(e){if(t(e)||(e=c(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?_:I;var i,r,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return _;if(e.gt(this.shru(1)))return g;s=_}else{if(this.eq(N))return e.eq(f)||e.eq(R)?N:e.eq(N)?f:(i=this.shr(1).div(e).shl(1)).eq(I)?e.isNegative()?f:R:(r=this.sub(e.mul(i)),s=i.add(r.div(e)));if(e.eq(N))return this.unsigned?_:I;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();s=I}for(r=this;r.gte(e);){i=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(i)/Math.LN2),l=o<=48?1:a(2,o-48),h=n(i),u=h.mul(e);u.isNegative()||u.gt(r);)u=(h=n(i-=l,this.unsigned)).mul(e);h.isZero()&&(h=f),s=s.add(h),r=r.sub(u)}return s},S.div=S.divide,S.modulo=function(e){return t(e)||(e=c(e)),this.sub(this.div(e).mul(e))},S.mod=S.modulo,S.not=function(){return o(~this.low,~this.high,this.unsigned)},S.and=function(e){return t(e)||(e=c(e)),o(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return t(e)||(e=c(e)),o(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return t(e)||(e=c(e)),o(this.low^e.low,this.high^e.high,this.unsigned)},S.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)},S.shl=S.shiftLeft,S.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)},S.shr=S.shiftRight,S.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)},S.shru=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},S.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},S.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]},S.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={},r=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},s=r.prototype;s._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]},s.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,r;do{for(e=!1;t.WHITESPACE.test(r=this.source.charAt(this.index));)if("\n"===r&&++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("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;i=r,r=this.source.charAt(this.index)}while("*"!==i||"/"!==r);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;var s=this.index;if(t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(s++)))for(;s<this.source.length&&!t.DELIM.test(this.source.charAt(s));)++s;var n=this.source.substring(this.index,this.index=s);return'"'!==n&&"'"!==n||(this._stringOpen=n),n},s.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},s.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},s.omit=function(e){return this.peek()===e&&(this.next(),!0)},s.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},i.Tokenizer=r;var n=function(e){this.tn=new r(e),this.proto3=!1},o=n.prototype;function a(e,i){var r=-1,s=1;if("-"==e.charAt(0)&&(s=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(s<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=s*r|0,!i&&r<0)throw Error("illegal id value: "+(s<0?"-":"")+e);return r}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,r={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},s=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!s||null!==r.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),r.package=e;break;case"import":if(!s)throw Error("unexpected 'import'");("public"===(e=this.tn.peek())||(i="weak"===e))&&this.tn.next(),e=this._readString(),this.tn.skip(";"),i||r.imports.push(e);break;case"syntax":if(!s)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(r.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(r,null),s=!1;break;case"enum":this._parseEnum(r),s=!1;break;case"option":this._parseOption(r);break;case"service":this._parseService(r);break;case"extend":this._parseExtend(r);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete r.name,r},n.parse=function(e){return new n(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 r=this.tn.next(),s=!1;if("("===r&&(s=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal option name: "+r);var n=r;s&&(this.tn.skip(")"),n="("+n+")",r=this.tn.peek(),t.FQTYPEREF.test(r)&&(n+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,n),i||this.tn.skip(";")},o._parseOptionValue=function(e,i){var r=this.tn.peek();if("{"!==r)c(e.options,i,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+i+"."+r);this.tn.omit(":")?c(e.options,i+"."+r,this._readValue(!0)):this._parseOptionValue(e,i+"."+r)}},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 r={name:i,rpc:{},options:{}};for(this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(r);else{if("rpc"!==i)throw Error("illegal service token: "+i);this._parseServiceRPC(r)}this.tn.omit(";"),e.services.push(r)},o._parseServiceRPC=function(e){var i="rpc",r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal rpc service method name: "+r);var s=r,n={request:null,response:null,request_stream:!1,response_stream:!1,options:{}};if(this.tn.skip("("),"stream"===(r=this.tn.next()).toLowerCase()&&(n.request_stream=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal rpc service request type: "+r);if(n.request=r,this.tn.skip(")"),"returns"!==(r=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+r);if(this.tn.skip("("),"stream"===(r=this.tn.next()).toLowerCase()&&(n.response_stream=!0,r=this.tn.next()),n.response=r,this.tn.skip(")"),"{"===(r=this.tn.peek())){for(this.tn.next();"}"!==(r=this.tn.next());){if("option"!==r)throw Error("illegal rpc service token: "+r);this._parseOption(n)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][s]=n},o._parseMessage=function(e,i){var r=!!i,s=this.tn.next(),n={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(s))throw Error("illegal "+(r?"group":"message")+" name: "+s);for(n.name=s,r&&(this.tn.skip("="),i.id=a(this.tn.next()),n.isGroup=!0),"["===(s=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(n,s);else if("oneof"===s)this._parseMessageOneOf(n);else if("enum"===s)this._parseEnum(n);else if("message"===s)this._parseMessage(n);else if("option"===s)this._parseOption(n);else if("service"===s)this._parseService(n);else if("extensions"===s)n.hasOwnProperty("extensions")?n.extensions=n.extensions.concat(this._parseExtensionRanges()):n.extensions=this._parseExtensionRanges();else if("reserved"===s)this._parseIgnored();else if("extend"===s)this._parseExtend(n);else{if(!t.TYPEREF.test(s))throw Error("illegal message token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(n,"optional",s)}return this.tn.omit(";"),e.messages.push(n),n},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,i,r){if(!t.RULE.test(i))throw Error("illegal message field rule: "+i);var s,n={rule:i,type:"",name:"",options:{},id:0};if("map"===i){if(r)throw Error("illegal type: "+r);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(n.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(n.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);n.name=s,this.tn.skip("="),n.id=a(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(n),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){var o=this._parseMessage(e,n);if(!/^[A-Z]/.test(o.name))throw Error("illegal group name: "+o.name);n.type=o.name,n.name=o.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(r)&&!t.TYPEREF.test(r))throw Error("illegal message field type: "+r);if(n.type=r,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);n.name=s,this.tn.skip("="),n.id=a(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(n),this.tn.skip(";")}return e.fields.push(n),n},o._parseMessageOneOf=function(e){var i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal oneof name: "+i);var r,s=i,n=[];for(this.tn.skip("{");"}"!==(i=this.tn.next());)(r=this._parseMessageField(e,"optional",i)).oneof=s,n.push(r.id);this.tn.omit(";"),e.oneofs[s]=n},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:{}},r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal name: "+r);for(i.name=r,this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(i);else{if(!t.NAME.test(r))throw Error("illegal name: "+r);this.tn.skip("=");var s={name:r,id:a(this.tn.next(),!0)};"["===(r=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(s)}this.tn.omit(";"),e.enums.push(i)},o._parseExtensionRanges=function(){var t,i,r,s=[];do{for(i=[];;){switch(t=this.tn.next()){case"min":r=e.ID_MIN;break;case"max":r=e.ID_MAX;break;default:r=l(t)}if(i.push(r),2===i.length)break;if("to"!==this.tn.peek()){i.push(r);break}this.tn.next()}s.push(i)}while(this.tn.omit(","));return this.tn.skip(";"),s},o._parseExtend=function(e){var i=this.tn.next();if(!t.TYPEREF.test(i))throw Error("illegal extend reference: "+i);var r={ref:i,fields:[]};for(this.tn.skip("{");"}"!==(i=this.tn.next());)if(t.RULE.test(i))this._parseMessageField(r,i);else{if(!t.TYPEREF.test(i))throw Error("illegal extend token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(r,"optional",i)}return this.tn.omit(";"),e.messages.push(r),r},o.toString=function(){return"Parser at line "+this.tn.line},i.Parser=n,i}(t,t.Lang),t.Reflect=function(e){var t={},r=function(e,t,i){this.builder=e,this.parent=t,this.name=i,this.className},s=r.prototype;s.fqn=function(){for(var e=this.name,t=this;;){if(null==(t=t.parent))break;e=t.name+"."+e}return e},s.toString=function(e){return(e?this.className+" ":"")+this.fqn()},s.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},t.T=r;var n=function(e,t,i,s,n){r.call(this,e,t,i),this.className="Namespace",this.children=[],this.options=s||{},this.syntax=n||"proto2"},o=n.prototype=Object.create(r.prototype);o.getChildren=function(e){if(null==(e=e||null))return this.children.slice();for(var t=[],i=0,r=this.children.length;i<r;++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 h.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof h.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,r=this.children.length;i<r;++i)if(this.children[i][t]===e)return this.children[i];return null},o.resolve=function(e,i){var r,s="string"==typeof e?e.split("."):e,n=this,o=0;if(""===s[o]){for(;null!==n.parent;)n=n.parent;o++}do{do{if(!(n instanceof t.Namespace)){n=null;break}if(!(r=n.getChild(s[o]))||!(r instanceof t.T)||i&&!(r instanceof t.Namespace)){n=null;break}n=r,o++}while(o<s.length);if(null!=n)break;if(null!==this.parent)return this.parent.resolve(e,i)}while(null!=n);return n},o.qn=function(e){var i=[],r=e;do{i.unshift(r.name),r=r.parent}while(null!==r);for(var s=1;s<=i.length;s++){var n=i.slice(i.length-s);if(e===this.resolve(n,e instanceof t.Namespace))return n.join(".")}return e.fqn()},o.build=function(){for(var e,t={},i=this.children,r=0,s=i.length;r<s;++r)(e=i[r])instanceof n&&(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,r=t.length;i<r;++i){var s=t[i],n=this.options[t[i]];e[s]=n}return e},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},t.Namespace=n;var a=function(t,i,r,s,n){if(this.type=t,this.resolvedType=i,this.isMapKey=r,this.syntax=s,this.name=n,r&&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 r=this;function s(e,t){throw Error("Illegal value for "+r.toString(!0)+" of type "+r.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)&&s(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)&&s(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){s(typeof t,e.message)}else s(typeof t,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return c(t,!0)}catch(e){s(typeof t,e.message)}else s(typeof t,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof t&&s(typeof t,"not a boolean"),t;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof t&&s(typeof t,"not a number"),t;case e.TYPES.string:return"string"==typeof t||t&&t instanceof String||s(typeof t,"not a string"),""+t;case e.TYPES.bytes:return i.isByteBuffer(t)?t:i.wrap(t,"base64");case e.TYPES.enum:var n=this.resolvedType.getChildren(e.Reflect.Enum.Value);for(a=0;a<n.length;a++){if(n[a].name==t)return n[a].id;if(n[a].id==t)return n[a].id}if("proto3"===this.syntax)return("number"!=typeof t||t==t&&t%1!=0)&&s(typeof t,"not an integer"),(t>4294967295||t<0)&&s(typeof t,"not in range for uint32"),t;s(t,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(t&&"object"==typeof t||s(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,r){if(null===r)return 0;var s;switch(this.type){case e.TYPES.int32:return r<0?i.calculateVarint64(r):i.calculateVarint32(r);case e.TYPES.uint32:return i.calculateVarint32(r);case e.TYPES.sint32:return i.calculateVarint32(i.zigZagEncode32(r));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(r);case e.TYPES.sint64:return i.calculateVarint64(i.zigZagEncode64(r));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return i.calculateVarint32(r);case e.TYPES.double:return 8;case e.TYPES.string:return s=i.calculateUTF8Bytes(r),i.calculateVarint32(s)+s;case e.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");return i.calculateVarint32(r.remaining())+r.remaining();case e.TYPES.message:return s=this.resolvedType.calculate(r),i.calculateVarint32(s)+s;case e.TYPES.group:return(s=this.resolvedType.calculate(r))+i.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")},l.encodeValue=function(t,r,s){if(null===r)return s;switch(this.type){case e.TYPES.int32:r<0?s.writeVarint64(r):s.writeVarint32(r);break;case e.TYPES.uint32:s.writeVarint32(r);break;case e.TYPES.sint32:s.writeVarint32ZigZag(r);break;case e.TYPES.fixed32:s.writeUint32(r);break;case e.TYPES.sfixed32:s.writeInt32(r);break;case e.TYPES.int64:case e.TYPES.uint64:s.writeVarint64(r);break;case e.TYPES.sint64:s.writeVarint64ZigZag(r);break;case e.TYPES.fixed64:s.writeUint64(r);break;case e.TYPES.sfixed64:s.writeInt64(r);break;case e.TYPES.bool:"string"==typeof r?s.writeVarint32("false"===r.toLowerCase()?0:!!r):s.writeVarint32(r?1:0);break;case e.TYPES.enum:s.writeVarint32(r);break;case e.TYPES.float:s.writeFloat32(r);break;case e.TYPES.double:s.writeFloat64(r);break;case e.TYPES.string:s.writeVString(r);break;case e.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");var n=r.offset;s.writeVarint32(r.remaining()),s.append(r),r.offset=n;break;case e.TYPES.message:var o=(new i).LE();this.resolvedType.encode(r,o),s.writeVarint32(o.offset),s.append(o.flip());break;case e.TYPES.group:this.resolvedType.encode(r,s),s.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")}return s},l.decode=function(t,i,r){if(i!=this.type.wireType)throw Error("Unexpected wire type for element");var s,n;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(n=t.readVarint32(),t.remaining()<n)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+n+" required but got only "+t.remaining());return(s=t.clone()).limit=s.offset+n,t.offset+=n,s;case e.TYPES.message:return n=t.readVarint32(),this.resolvedType.decode(t,n);case e.TYPES.group:return this.resolvedType.decode(t,-1,r)}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 h=function(e,t,i,r,s,o){n.call(this,e,t,i,r,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!s,this._fields=null,this._fieldsById=null,this._fieldsByName=null},u=h.prototype=Object.create(n.prototype);function d(t,i){var r=i.readVarint32(),s=7&r,n=r>>>3;switch(s){case e.WIRE_TYPES.VARINT:do{r=i.readUint8()}while(!(128&~r));break;case e.WIRE_TYPES.BITS64:i.offset+=8;break;case e.WIRE_TYPES.LDELIM:r=i.readVarint32(),i.offset+=r;break;case e.WIRE_TYPES.STARTGROUP:d(n,i);break;case e.WIRE_TYPES.ENDGROUP:if(n===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+n+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:i.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+s)}return!0}u.build=function(t){if(this.clazz&&!t)return this.clazz;var r=function(e,t){var r=t.getChildren(e.Reflect.Message.Field),s=t.getChildren(e.Reflect.Message.OneOf),n=function(o,a){e.Builder.Message.call(this);for(var l=0,c=s.length;l<c;++l)this[s[l].name]=null;for(l=0,c=r.length;l<c;++l){var h=r[l];this[h.name]=h.repeated?[]:h.map?new e.Map(h):null,!h.required&&"proto3"!==t.syntax||null===h.defaultValue||(this[h.name]=h.defaultValue)}var u;if(arguments.length>0)if(1!==arguments.length||null===o||"object"!=typeof o||!("function"!=typeof o.encode||o instanceof n)||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!==(u=arguments[l])&&this.$set(r[l].name,u);else this.$set(o)},o=n.prototype=Object.create(e.Builder.Message.prototype);o.add=function(i,r,s){var n=t._fieldsByName[i];if(!s){if(!n)throw Error(this+"#"+i+" is undefined");if(!(n instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: "+n.toString(!0));if(!n.repeated)throw Error(this+"#"+i+" is not a repeated field");r=n.verifyValue(r,!0)}return null===this[i]&&(this[i]=[]),this[i].push(r),this},o.$add=o.add,o.set=function(i,r,s){if(i&&"object"==typeof i){for(var n in s=r,i)i.hasOwnProperty(n)&&void 0!==(r=i[n])&&void 0===t._oneofsByName[n]&&this.$set(n,r,s);return this}var o=t._fieldsByName[i];if(s)this[i]=r;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]=r=o.verifyValue(r)}if(o&&o.oneof){var a=this[o.oneof.name];null!==r?(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,r){if(r)return this[i];var s=t._fieldsByName[i];if(!(s&&s instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+i+" is not a field: "+s.toString(!0));return this[s.name]},o.$get=o.get;for(var a=0;a<r.length;a++){var l=r[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 r=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),s=function(t,i){return this[e.name]=i?t:e.verifyValue(t),this},n=function(){return this[e.name]};null===t.getChild("set"+i)&&(o["set"+i]=s),null===t.getChild("set_"+r)&&(o["set_"+r]=s),null===t.getChild("get"+i)&&(o["get"+i]=n),null===t.getChild("get_"+r)&&(o["get_"+r]=n)}(l)}function c(t,r,s,n){if(null===t||"object"!=typeof t){if(n&&n instanceof e.Reflect.Enum){var o=e.Reflect.Enum.getName(n.object,t);if(null!==o)return o}return t}if(i.isByteBuffer(t))return r?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return s?t.toString():e.Long.fromValue(t);var a;if(Array.isArray(t))return a=[],t.forEach((function(e,t){a[t]=c(e,r,s,n)})),a;if(a={},t instanceof e.Map){for(var l=t.entries(),h=l.next();!h.done;h=l.next())a[t.keyElem.valueToString(h.value[0])]=c(h.value[1],r,s,t.valueElem.resolvedType);return a}var u=t.$type,d=void 0;for(var E in t)t.hasOwnProperty(E)&&(u&&(d=u.getChild(E))?a[E]=c(t[E],r,s,d.resolvedType):a[E]=c(t[E],r,s));return a}return o.encode=function(e,r){"boolean"==typeof e&&(r=e,e=void 0);var s=!1;e||(e=new i,s=!0);var n=e.littleEndian;try{return t.encode(this,e.LE(),r),(s?e.flip():e).LE(n)}catch(t){throw e.LE(n),t}},n.encode=function(e,t,i){return new n(e).encode(t,i)},o.calculate=function(){return t.calculate(this)},o.encodeDelimited=function(e,r){var s=!1;e||(e=new i,s=!0);var n=(new i).LE();return t.encode(this,n,r).flip(),e.writeVarint32(n.remaining()),e.append(n),s?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))},n.decode=function(e,r,s){"string"==typeof r&&(s=r,r=-1),"string"==typeof e?e=i.wrap(e,s||"base64"):i.isByteBuffer(e)||(e=i.wrap(e));var n=e.littleEndian;try{var o=t.decode(e.LE(),r);return e.LE(n),o}catch(t){throw e.LE(n),t}},n.decodeDelimited=function(e,r){if("string"==typeof e?e=i.wrap(e,r||"base64"):i.isByteBuffer(e)||(e=i.wrap(e)),e.remaining()<1)return null;var s=e.offset,n=e.readVarint32();if(e.remaining()<n)return e.offset=s,null;try{var o=t.decode(e.slice(e.offset,e.offset+n).LE());return e.offset+=n,o}catch(t){throw e.offset+=n,t}},n.decode64=function(e){return n.decode(e,"base64")},n.decodeHex=function(e){return n.decode(e,"hex")},n.decodeJSON=function(e){return new n(JSON.parse(e))},o.toString=function(){return t.toString()},Object.defineProperty&&(Object.defineProperty(n,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:n.$options}),Object.defineProperty(n,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),n}(e,this);this._fields=[],this._fieldsById={},this._fieldsByName={},this._oneofsByName={};for(var s,n=0,o=this.children.length;n<o;n++)if((s=this.children[n])instanceof f||s instanceof h||s instanceof p){if(r.hasOwnProperty(s.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+s.toString(!0)+" cannot override static property '"+s.name+"'");r[s.name]=s.build()}else if(s instanceof h.Field)s.build(),this._fields.push(s),this._fieldsById[s.id]=s,this._fieldsByName[s.name]=s;else if(s instanceof h.OneOf)this._oneofsByName[s.name]=s;else if(!(s instanceof h.OneOf||s instanceof R))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[n].toString(!0));return this.clazz=r},u.encode=function(e,t,i){for(var r,s,n=null,o=0,a=this._fields.length;o<a;++o)s=e[(r=this._fields[o]).name],r.required&&null===s?null===n&&(n=r):r.encode(i?s:r.verifyValue(s),t,e);if(null!==n){var l=Error("Missing at least one required field for "+this.toString(!0)+": "+n);throw l.encoded=t,l}return t},u.calculate=function(e){for(var t,i,r=0,s=0,n=this._fields.length;s<n;++s){if(i=e[(t=this._fields[s]).name],t.required&&null===i)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(i,e)}return r},u.decode=function(t,i,r){"number"!=typeof i&&(i=-1);for(var s,n,o,a,l=t.offset,c=new this.clazz;t.offset<l+i||-1===i&&t.remaining()>0;){if(o=(s=t.readVarint32())>>>3,(n=7&s)===e.WIRE_TYPES.ENDGROUP){if(o!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+o+" ("+(r?r+" expected":"not a group")+")");break}if(a=this._fieldsById[o]){if(a.repeated&&!a.options.packed)c[a.name].push(a.decode(n,t));else if(a.map){var h=a.decode(n,t);c[a.name].set(h[0],h[1])}else if(c[a.name]=a.decode(n,t),a.oneof){var u=c[a.oneof.name];null!==u&&u!==a.name&&(c[u]=null),c[a.oneof.name]=a.name}}else switch(n){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 E=t.readVarint32();t.offset+=E;break;case e.WIRE_TYPES.STARTGROUP:for(;d(o,t););break;default:throw Error("Illegal wire type for unknown field "+o+" in "+this.toString(!0)+"#decode: "+n)}}for(var I=0,_=this._fields.length;I<_;++I)if(null===c[(a=this._fields[I]).name])if("proto3"===this.syntax)c[a.name]=a.defaultValue;else{if(a.required){var f=Error("Missing at least one required field for "+this.toString(!0)+": "+a.name);throw f.decoded=c,f}e.populateDefaults&&null!==a.defaultValue&&(c[a.name]=a.defaultValue)}return c},t.Message=h;var E=function(t,i,s,n,o,a,l,c,u,d){r.call(this,t,i,a),this.className="Message.Field",this.required="required"===s,this.repeated="repeated"===s,this.map="map"===s,this.keyType=n||null,this.type=o,this.resolvedType=null,this.id=l,this.options=c||{},this.defaultValue=null,this.oneof=u||null,this.syntax=d||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof h.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},I=E.prototype=Object.create(r.prototype);I.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)},I.verifyValue=function(t,i){i=i||!1;var r,s=this;function n(e,t){throw Error("Illegal value for "+s.toString(!0)+" of type "+s.type.name+": "+e+" ("+t+")")}if(null===t)return this.required&&n(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&n(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!i){Array.isArray(t)||(t=[t]);var o=[];for(r=0;r<t.length;r++)o.push(this.element.verifyValue(t[r]));return o}return this.map&&!i?t instanceof e.Map?t:(t instanceof Object||n(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&n(typeof t,"no array expected"),this.element.verifyValue(t))},I.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}},I.encode=function(t,r,s){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 r;try{var n;if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){r.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1);var o=r.offset;for(n=0;n<t.length;n++)this.element.encodeValue(this.id,t[n],r);var a=r.offset-o,l=i.calculateVarint32(a);if(l>1){var c=r.slice(o,r.offset);o+=l-1,r.offset=o,r.append(c)}r.writeVarint32(a,o-l)}else for(n=0;n<t.length;n++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[n],r);else this.map?t.forEach((function(t,s,n){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,s)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);r.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),r.writeVarint32(o),r.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,s,r),r.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,r)}),this):this.hasWirePresence(t,s)&&(r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,r))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return r},I.calculate=function(t,r){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 s=0;try{var n,o;if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(s+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),o=0,n=0;n<t.length;n++)o+=this.element.calculateLength(this.id,t[n]);s+=i.calculateVarint32(o),s+=o}else for(n=0;n<t.length;n++)s+=i.calculateVarint32(this.id<<3|this.type.wireType),s+=this.element.calculateLength(this.id,t[n]);else this.map?t.forEach((function(t,r,n){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);s+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s+=i.calculateVarint32(o),s+=o}),this):this.hasWirePresence(t,r)&&(s+=i.calculateVarint32(this.id<<3|this.type.wireType),s+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return s},I.decode=function(t,i,r){var s,n;if(!(!this.map&&t==this.type.wireType||!r&&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&&!r){n=i.readVarint32(),n=i.offset+n;for(var o=[];i.offset<n;)o.push(this.decode(this.type.wireType,i,!0));return o}if(this.map){var l=a.defaultFieldValue(this.keyType);if(s=a.defaultFieldValue(this.type),n=i.readVarint32(),i.remaining()<n)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+n+" required but got only "+i.remaining());var c=i.clone();for(c.limit=c.offset+n,i.offset+=n;c.remaining()>0;){var h=c.readVarint32();t=7&h;var u=h>>>3;if(1===u)l=this.keyElement.decode(c,t,u);else{if(2!==u)throw Error("Unexpected tag in map field key/value submessage");s=this.element.decode(c,t,u)}}return[l,s]}return this.element.decode(i,t,this.id)},t.Message.Field=E;var _=function(e,t,i,r,s,n,o){E.call(this,e,t,i,null,r,s,n,o),this.extension};_.prototype=Object.create(E.prototype),t.Message.ExtensionField=_;t.Message.OneOf=function(e,t,i){r.call(this,e,t,i),this.fields=[]};var f=function(e,t,i,r,s){n.call(this,e,t,i,r,s),this.className="Enum",this.object=null};f.getName=function(e,t){for(var i,r=Object.keys(e),s=0;s<r.length;++s)if(e[i=r[s]]===t)return i;return null},(f.prototype=Object.create(n.prototype)).build=function(t){if(this.object&&!t)return this.object;for(var i=new e.Builder.Enum,r=this.getChildren(f.Value),s=0,n=r.length;s<n;++s)i[r[s].name]=r[s].id;return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=i},t.Enum=f;var g=function(e,t,i,s){r.call(this,e,t,i),this.className="Enum.Value",this.id=s};g.prototype=Object.create(r.prototype),t.Enum.Value=g;var R=function(e,t,i,s){r.call(this,e,t,i),this.field=s};R.prototype=Object.create(r.prototype),t.Extension=R;var p=function(e,t,i,r){n.call(this,e,t,i,r),this.className="Service",this.clazz=null};(p.prototype=Object.create(n.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){for(var r=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)}},s=r.prototype=Object.create(e.Builder.Service.prototype),n=t.getChildren(e.Reflect.Service.RPCMethod),o=0;o<n.length;o++)!function(e){s[e.name]=function(r,s){try{try{r=e.resolvedRequestType.clazz.decode(i.wrap(r))}catch(e){if(!(e instanceof TypeError))throw e}if(null===r||"object"!=typeof r)throw Error("Illegal arguments");r instanceof e.resolvedRequestType.clazz||(r=new e.resolvedRequestType.clazz(r)),this.rpcImpl(e.fqn(),r,(function(i,r){if(i)s(i);else{null===r&&(r="");try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}r&&r instanceof e.resolvedResponseType.clazz?s(null,r):s(Error("Illegal response type received in service method "+t.name+"#"+e.name))}}))}catch(e){setTimeout(s.bind(this,e),0)}},r[e.name]=function(t,i,s){new r(t)[e.name](i,s)},Object.defineProperty&&(Object.defineProperty(r[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(s[e.name],"$options",{value:r[e.name].$options}))}(n[o]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:t.buildOpt()}),Object.defineProperty(s,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:t}),Object.defineProperty(s,"$type",{value:t})),r}(e,this)},t.Service=p;var T=function(e,t,i,s){r.call(this,e,t,i),this.className="Service.Method",this.options=s||{}};(T.prototype=Object.create(r.prototype)).buildOpt=o.buildOpt,t.Service.Method=T;var N=function(e,t,i,r,s,n,o,a){T.call(this,e,t,i,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=s,this.requestStream=n,this.responseStream=o,this.resolvedRequestType=null,this.resolvedResponseType=null};return N.prototype=Object.create(T.prototype),t.Service.RPCMethod=N,t}(t),t.Builder=function(e,t,i){var r=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||{}},s=r.prototype;function n(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,n(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}return r.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},r.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},r.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},r.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},r.isExtend=function(e){return"string"==typeof e.ref},s.reset=function(){return this.ptr=this.ns,this},s.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},s.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 s=[t];s.length>0;){if(t=s.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){var n=t.shift();if(r.isMessage(n)){var o=new i.Message(this,this.ptr,n.name,n.options,n.isGroup,n.syntax),a={};n.oneofs&&Object.keys(n.oneofs).forEach((function(e){o.addChild(a[e]=new i.Message.OneOf(this,o,e))}),this),n.fields&&n.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,n.syntax),t&&t.fields.push(e),o.addChild(e)}),this);var l=[];if(n.enums&&n.enums.forEach((function(e){l.push(e)})),n.messages&&n.messages.forEach((function(e){l.push(e)})),n.services&&n.services.forEach((function(e){l.push(e)})),n.extensions&&("number"==typeof n.extensions[0]?o.extensions=[n.extensions]:o.extensions=n.extensions),this.ptr.addChild(o),l.length>0){s.push(t),t=l,l=null,this.ptr=o,o=null;continue}l=null}else if(r.isEnum(n))o=new i.Enum(this,this.ptr,n.name,n.options,n.syntax),n.values.forEach((function(e){o.addChild(new i.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(r.isService(n))o=new i.Service(this,this.ptr,n.name,n.options),Object.keys(n.rpc).forEach((function(e){var t=n.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(!r.isExtend(n))throw Error("not a valid definition: "+JSON.stringify(n));if(o=this.ptr.resolve(n.ref,!0))n.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 r=!1;if(o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r)throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)")}var s=t.name;this.options.convertFieldsToCamelCase&&(s=e.Util.toCamelCase(s));var n=new i.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+s,t.id,t.options),a=new i.Extension(this,this.ptr,t.name,n);n.extension=a,this.ptr.addChild(a),o.addChild(n)}),this);else if(!/\.?google\.protobuf\./.test(n.ref))throw Error("extended message "+n.ref+" is not defined")}n=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},s.import=function(t,i){var r="/";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 s,o=i.root;if(e.Util.IS_NODE&&(o=require("path").resolve(o)),(o.indexOf("\\")>=0||i.file.indexOf("\\")>=0)&&(r="\\"),s=e.Util.IS_NODE?require("path").join(o,i.file):o+r+i.file,!0===this.files[s])return this.reset();this.files[s]=!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)&&(r="\\")):"string"==typeof i?this.importRoot?a=this.importRoot:i.indexOf("/")>=0?""===(a=i.replace(/\/[^\/]*$/,""))&&(a="/"):i.indexOf("\\")>=0?(a=i.replace(/\\[^\\]*$/,""),r="\\"):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 h=t.imports[c];if("google/protobuf/descriptor.proto"===h)continue;if(h=e.Util.IS_NODE?require("path").join(a,h):a+r+h,!0===this.files[h])continue;/\.proto$/i.test(h)&&!e.DotProto&&(h=h.replace(/\.proto$/,".json"));var u=e.Util.fetch(h);if(null===u)throw Error("failed to import '"+h+"' in '"+i+"': file not found");/\.json$/i.test(h)?this.import(JSON.parse(u+""),h):this.import(e.DotProto.Parser.parse(u),h)}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&&n(t);var d=this.ptr;return t.options&&Object.keys(t.options).forEach((function(e){d.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=d),t.enums&&(this.create(t.enums),this.ptr=d),t.services&&(this.create(t.services),this.ptr=d),t.extends&&this.create(t.extends),this.reset()},s.resolveAll=function(){var r;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(!(r=(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=r,r instanceof i.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof i.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.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(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}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()},s.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,r=0;r<t.length;r++){if(!i[t[r]]){i=null;break}i=i[t[r]]}return i},s.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},s.toString=function(){return"Builder"},r.Message=function(){},r.Enum=function(){},r.Service=function(){},r}(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 r=Object.keys(i),s=0;s<r.length;s++){var n=this.keyElem.valueFromString(r[s]),o=this.valueElem.verifyValue(i[r[s]]);this.map[this.keyElem.valueToString(n)]={key:n,value:o}}},r=i.prototype;function s(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}return r.clear=function(){this.map={}},r.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),i=t in this.map;return delete this.map[t],i},r.entries=function(){for(var e,t=[],i=Object.keys(this.map),r=0;r<i.length;r++)t.push([(e=this.map[i[r]]).key,e.value]);return s(t)},r.keys=function(){for(var e=[],t=Object.keys(this.map),i=0;i<t.length;i++)e.push(this.map[t[i]].key);return s(e)},r.values=function(){for(var e=[],t=Object.keys(this.map),i=0;i<t.length;i++)e.push(this.map[t[i]].value);return s(e)},r.forEach=function(e,t){for(var i,r=Object.keys(this.map),s=0;s<r.length;s++)e.call(t,(i=this.map[r[s]]).value,i.key,this)},r.set=function(e,t){var i=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(i)]={key:i,value:r},this},r.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));if(t in this.map)return this.map[t].value},r.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},i}(0,t.Reflect),t.loadProto=function(e,i,r){return("string"==typeof i||i&&"string"==typeof i.file&&"string"==typeof i.root)&&(r=i,i=void 0),t.loadJson(t.DotProto.Parser.parse(e),i,r)},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,r){return("string"==typeof i||i&&"string"==typeof i.file&&"string"==typeof i.root)&&(r=i,i=null),i&&"object"==typeof i||(i=t.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),i.import(e,r),i.resolveAll(),i},t}(),Re=48,pe=64,Te=80,Ne=96,Se=112,Oe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ce=e=>{let t=0,i=0;for(let r=e.length-1;r>=0;r--){if(i=Oe.indexOf(e.charAt(r)),-1===i)throw new Error('decode number error, data is "'+e+'"');t=62*t+i}return t},ve=(e=>{let t=0,i="";e:do{const r=e.charCodeAt(t++),s=r&Se,n=15&r;let o;switch(s){case pe:const r=n>>2,a=3&n;if(0===r||0===a)throw new Error("Data parsing error,at "+t);let l=Ce(e.substr(t,r));const c=Ce(e.substr(t+=r,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 Re:if(o=Ce(e.substr(t,n)),o!==i.length)throw console.log(i.length),console.log(o),new Error("Data parsing error,at "+t);t+=n;break e;case Te:o=Ce(e.substr(t,n)),i+=e.substr(t+=n,o),t+=o;break;case Ne:i+=e.substr(t,n),t+=n;break;case Se:if(n>10)throw new Error("Data parsing error,at "+t);i+=e.substr(t,16+n),t+=16+n;break;default:throw new Error("Data parsing error,at "+t+" header:"+s)}}while(t<e.length);return i})("upackage Modules;\nmessEH4kprobuf {\n EJ8iNotifyMsgEM5QR required int32 type = 1;\nET4hoptionalET4k64 time = 2ETFostring chrmId=3ExIp32 destroyType=4EY4a}IO2BkSyncRequestIT2Mh64 syncTI426IX27EX9kbool ispollIC24Ib2IEX7cwebIY2HER7iPullSend=IW25EWIiKeeping=5IW4LgsendBoxID34Id24b=6EcLibroadcastEe9a7EeLcendIl37a8IH2KucompressioEnabled = 9IS5GiUpStreamMEG7Iw7LbseI814cnIdIU5JIY78flassnaI78CEZHiontent = Ic5GEX7gpushTexEY4Ie5GEY7jappData = Ig57frepeatIc1AltoUserIds = Id5MfdelMsgI257IY5GI817Ea6Ir35Ia5GIP46iconfigFlaIN94IU55Ig1HlclientUniqueI356a0Il1MfextraCIa49a1IiDGePushEEa4Ie45cExtEb4IqDNjbusChannelEb4In5NhsystemIdEZ4Ii4GEZ8lenderPortraiIp14a2I8GMEF6cBitIw54a2IP2GfExtMsgIz65cextEB8c= 2IT2NemetadEZ7IH8GiReferenceI615crefIE18IP85IeBCEgEIcB6Ii1HIi77IS3GEV7dfromIQ96IhJRI9CBIM35I82CI27AI42MetitleIeLMs32 templateIdNoUseI82PIX84Ie25IhDRfConfigIi64IkDNIl1AInD8IG3CdDownI4HDbs I5H8IME7EYHe listICHJIDNHIgMLffinishIJJ5IJPJI8LKIX3JIj18I1C4EZ7IzMMmcredibleStartEg7IQHMEg8bEnIXM8IVHGIXMPICNHeytes Eg8bedIXB7IANHdChrmIC6YIG16I06zIv2KIuSHIv2MIXVHIV8II7QFI0EKIx2GIhJ7I7X4IjY8IRCNegroupISCCIFRSIt87IFRQIAQ9I95DIuI4Ii8EIg5GetatusIZ8JIcV7IgG5IO8IInIFIwPJIQb4direcEI4IrPKEZ6kplantform =ImPHEY6gisRemovId75IkPOfsourceIgPKI9SOIpHNI9SGIMEGI3JEEc8IIEJIbUGa1If5GILTLIm5NILTEIoVMfextStaIP76a2Is57IcYSIGTKc32 IeA5bUnIO24IHTKIrTKIlNNgconvertIW36IETHISUPIy5NISUCIv5GISUPI065I1GCIu1BILSFIyi8aqIOULISjAIlICIS14eenum IJGCIQ16fPERSONIC1AEG6aSIiGAeGROUPIQGAdTEMPEJ8Ip47oCUSTOMERSERVICEI2GAfNOTIFYIlFAbMCI2l8cMP=IK97eULTRAIJ18INE6Io29dFileIl2BdIMAGIW14Ik27eAUDIOIi2AdVIDEEF4Ii27cFILEi4Id27eSIGHTIT2AlCOMBINE_HTMLIZ28IA6CrGetQNupTokenInput IBMFIU29IHuNIS87ckeyI1MQjhttpMethodIWYQhqueryStrIrs6IhGNburIAE4IZANICn6IgUMcsizIVUKIqJ7bpTIY36Ir65Ic4FIqQ4gloadUrlIe4iI6PGIe4TefileNIDfBIY3OITZNIY36INZJIY3CIA8TcOutIX3JIBr8eadlinIY3RetokenIa3QcbosId15Ia3QfbosDatI7dKICO8batIZK4c5;\nEVLfosskeyI8H5IdpNhossPolicIH64ILuNfossSigIg24IYONiossBucketIt67c9;\nInSMl3Credential IOuQms3Algorithm =INuIEc9IY47IZUPa3IV39IHuPa3IV34eatureIZURbs3Ia3DIZU4EeMltcAuthorizatICY7IfvObtcIGV7fSha256ImUKEhAIl38IB6NcstcIb2EIC6OeminioId2GIxU8EjLIf2GI6VHEjCIh27I5VHEaCIj2DIBV4MR41MIzH7Im24dInfoIIVKIGAAIdt6IRyLIDJEIhFMIs1FcUrlIlF8I7oGIFKLImH6dnothIFN6Ig4NInh8IAV9IR1CIAIPIS1aMAD1CICbMdjoinIDX7I8hNereateILvQl32 memberCouIVmCIOgGjhatroomBanIke4ILvNl32 whiteListEd8I6bHIU44dPullMbM1qIfi8Il26IR4JIgm4IU16IpO7MhM1LISuKIptHkRelationQryIk8CIC19IEtJIZiMIp2RIYr6Mo019M2S1MeorderIC7JMSP17hEraseMsgIgnAMd21MI9gAI87GIS4PIzXMcqryI0YCI1nBIR4CcchaEC9I8uOdbotTI457Ijf9IB6JgFilter Mq21FJC661Ie5BIrz9IJqFbagMCC1KI867fTagTopIjdQdpageIAX8I26TI3DKIA48asIcHFIb27EV8ImL5binIrL5I94GIh27bFiMaC19IPAMIED4IOANIBDRa Me71bIZ4eI34KIY35I7HFI88QIeOGbusMdM1NMk91Iemsg =IiLMdreadMgW17IahObunEb4IiL5Is3PMu01DIHmMcverIVO4MtG1NII28cminIj16MQY1PIj1AIQENbUnIR37Ig55dmsgIIH97Me81MIs16bMeIu18I8eHIv97bBoMOY1AMkf1DIn1DIYVMM6U1FI5PFcmsgIC66IYFMIb26MDn15IDlOMTF15IZZ7IROHiQryRemindIlR4cReqIe2NM6H1AIlVOIp7DI7EMIH37IUOPI4r7Ie2WbspImGGIZ7PIzUHgleanHisEh5IxHAIErJeargetIZ6CMvJ1SIr37MNE1KIlB4IkF5Il6DI95VIA4HIy25hMsgBatchIo6AI5PCIW3GbinE64IC49IP5ClueryChatRoomIo44IKfRIpP5IIQOIoP5IFf9Ia1SIrNDI81FIHJ4iTotalNumsIVCCIbS9drmMeIsd4IyJ6cnfoMGG15IfcKEe7IecLMF127IRLNaiINL9IG3DgHistoryI29FMIf1HI09HMF32cIZVCIEbnIB9KIjMGIuRPIGVLhignoreCmMPt1AIK4NbOuIJVJMTi1Mb=1MRc1Ta=MZz1GIw36bhaIVB4ICRNM7h1KIJRMM7h1IIf4wIYWMI2aHbSeIWq5dsAttIQkFIirUI61NMwA1SeinboxIIoQMSP17EaAIr5JIlA4INE4IhL6ITS8Mwt1HIL27gMsgReadIR3LIXZZIrOGMk72OIC16M5u1SINLUgDeleteSIF57Io2EI2B7ET7IPP5IWx7IVI9I14JJQd01IN3CIJTMIHcBIx3uIVM5Jw371IC1DeOutPuID1vIai8cDelImRFIhmHcOpIIv25breEG6IomObclI4T6IoOKIE1GIJaMIJVCMcs1XI2WGMZO1RIh6CISDHIeA6IvPOI2vZI33OIVD9IoM8Ih18I5E4IX64ITDxMl61AMHC2eI3G9I9L4Mh02NM4u1CIp4KI8W4iKVEntity IH7MMUY16IBENevalueIw1PMUx19IGQMIdV4estampMVd1RIjX5Ml51MIlq7IAvKcSetIW36IhHIIs3BeentryIKCOabMOc26IY3JMxU2GgnotificIaD8Io3GI4AJMkb2IIq28bS M661HJr2P2IR26Mr41MIt2HbieI1hBIv2FiFullUpdatIO9NMAJ1ENv41O1IV3IbSVIk96InCDIJAPMRq1YIheDIb17I75SET7IE58hrrorKeysIHmNIq2HdkeysEI7ITmOIc1GIVIMISGDIxFFIQ25dCodeIb1KIxp7IVEKISGIImQMIa7JIf1HnSetUserSettingIJfOIv6AIxjHIjJCIvj8I8mKIO5AI0eJI82CIOgSI92OIg15greserveI92MbupIwC4I92RdPullII4rIg1EI92OMUv1FI32WInBMIa2Chtem itemIfBDIi2LMuB1II91FIiRMIQw8MUR2iIoSMMrQ2GIiH6InS8MoQ2MI338MlQ2JIHT9MJB28IveGcTagIU35dtagsMt42JEc7MKD1JMu11IEuJMzf15MMZ2AIqAUIT2EMwg16I334MzG18IY1OJVmU1Ic37M7Y1GI32CI955Ii25EA5MG31hIN3OIx9KEWCIW35Ixl7EHAI2ceII8SI9cTIOVCMBK25IO2HMJK27esSileM4Q16IF16bIsMOc16I627cTagIi1BgAutoTraIDp5InZJIb1AfModifyIVAPIY9nIeMnaGMqV2AIcQ5IzRNMCY2EI71RcSetI41eIqFHbunI414dLeveM7R19Ie1NeResulIUsOMnS1AMmS1hIF2TMe51OIH7DMSS1BIXPgIDRGIx3HIOA4Iw36NI7101IucAIt3fIU9WIlBHIm2AI4WZIyZOIQ4XmGrpReadReceipMzO3DMsr1EIdv5I26HIGLOMP21EIX19MmP1rMUT3AM1T3PMAD1QMP837dreadIhK6b4 MUv1MIc35ds= 5EW7MXB3KMXQ2AIlgHId37IVIAIg3hIYDJIuaMIF47Mcy1NI836MyB2PMw22AMuB2MMYU17MYy1bMZl1JIg58Mzp1NMav15Mtp18b EZObSiMRj15MvT2OMiw1CMlp18IF4GduserIMe5IcnMIr67MgE1OEaCIZfGIS4PIi1TJW871MQ71NIX8iIlEEI4B7Mko1IIaBEbspIvW5cresI4sXMiC3KIUzDISz7MFM3OIf7BMCO1MI87EI03UEb9Ivm9J53F1MEn1IIw1LJA8q1IC7LMg725IV5UIt2VMMK1XMIK1TMjc15aCMQW1LMq92AEW6I6r9MNT19IZ25IHt4Ec5E95MDi3PMAY16dListMr92PMjY17Il15IQrGIl1CEe6In17MNw2IIlTDMU225IsZLI548M6u16cNumMz81JcGrpMhg17Im15MqQ37IcVKEdCIEXLIoM5MNv1TMoG2EIIdJeTagAdMvi1MIWkbIXwDMA71uIC1DMD11OILZRdnameIzTKMXf29Ik45MIy3OcTopMj04JIP29cDelJd412Mr51BMHQ15McP18NqB111IHPEgportSDKMQg1SgsdkInfoIT16Ib2DgltraGrpMa346MT318M0j2ZMhe2aMEA1IIm1BMkk2hM0K1pIC24ehangeMBL2QMQd3TIlOIIWoGIbpJMRd3NfmsgUIDMXC1JI0NGMBV2qMUe3HMc32HILu6IqI5IWK9I7PGEZ5I16NM6Z2NILcNI569Ih7nMl527eeedCoIdWPMBY37enlineMRa1NI97II3HHeEventIh26IrQ5IZZFEVBN9p301dhasNMzK36a3IIqNIg2GInDIIL4BIPr6IF3NM871QeinessILXLMjr2QMTH1aMq13IcngeI217Mo83OjriginalId Myp1PEa8Mov2NMq539hcondaryIMkv2KI657eAdminMGL4OdaddiEG6dMarkIMr6Iv2MgperatorMhF4MM8R17bubIJ66MUJ18IqBMIw29Ed8MyQ4NM9c26bMeMQL3BICcGcextILo6MLL3HMxg2GMrp3KIBk6eeventI8k7M9L36IkLLIyCKI8GAIwCzIxCHI52LMfZ1VMA14jMkW1MIfNGIfBQIEONMIa1PIFOAIWBNIFODIVBqeisDelMbs2JJLBK1MSu2HIMBxIsi4M3O15JSBa1MIS1CJM991IUC8Id16IZ15M8M25M5o35IY95c //IE2GEjGISTLI29AIQZNI5AAM0K2rIO48cAckM1O4oIH7EhnotExistMzb48IKXHbOpIFA4heStatus MW11XIMRTMzL1NMiG17M7t1DMcL2mIh2DMPC27IZj8MYO2ZIuRHMpC25IJO8MWx29I859In17MdG3CIXX8EcIjSummary suE86c= 4IILHIJ1CNH71N1I9yGMXr2NIH68Mxm2MEF4I1jAI634Eb4IJ6JIm37NXA1T1Mmu2WIF3DMMD1DfSetRtcMX035Mt11MI927b rEc8MU73KgallInfoMzL28MkT2QIbGPddataINt7I7wIIY18IkFAJa161IGJIaaMGq25MR216I42CbKvMp11RIanGEvEMEg1SIo17IqIJIp14IdDAIO4HEV7MWZ2RMTx1UMqf1SI1zJIEQyIwNYMgx3KcartImM8MPV4OcndMEY7Mas4JMsG1AMf01OMas4VM1t1TIO4II49HMBO1GMGE3Mdnum ID8IMkK1CMnI1CM6f1LM6O1BIB4JMGJ1BMYO1HEX5IpyNM7a3WM7G1BMLY1RMp15AIzvLimentionedIH7QcCntIK7DMNq2qMMD2RIeARMRe1LMQe1RIk28MWb1IMdP17Ir64fresultMzO3KEbBM3X1nImO4M5p3RbtmMiJ1MMGy15MoJ15bubIi5JIak9MJF2GMkR2ChubDetailEe4EH4Mi71NIPaSM3c27cxpiIFX6MQM1LIg19Ib4MI227If4AIl3RMzZ3JIG3OMAf4NcubTM9f4FMnW2HIS5OMxj2aMcl1CIa1IbUlIa1AIH3PIQz5I5jEIA2PMwB1WMHo1dMbv3JcullICNKIe2CIM6xInADMFs2NIs69I9AaI9BQI93HMLU15fubDataIs7WMjS1SgneedAllM8q48Iq5YMsg2LID29IV8IER7IQ57IX8aMXK1dJb8J1Ik2EI6GNItq5cStrMPN4RIfGBMBY2HIb16IQf5Mcr3QIb99I7kJI317IJLLhplatformMTr3CEbHMiC3RIF6HINYIcrySI8ASISNxIxEGgProfileIdJtIuXGI929IP17Ih45Eb4If18InUIEgGcExtEjAILPHEkCMo23iMEh2KMyy2JIX17Msc1QM083iIUYIpcensorFailedFielMKD15M2x2PIH29MNH2HIA6GI3TII11AMhQ5HI68CII8CI91UMqk3sI31BePermiM8u15ImDNEWAMju2LdarchI7BRMU629MEK5AMAC3IIBf5Mwd3DMZ21hMnH1ZIoACbseMhw15IHCccextIDCFIx1IdBaseEj5abE98MiA2QIIG7MtL17IC4IIE19IE4MMv225McQ18MCR1NbwnILoNMXj4JIjMMMXj4EInMIIy68ML74PMfA15M8A15Mvp1TafMvQ56Mts4OMtr15Ic2MiprocessCoM8K35Ia6NgsJoinedIP55Iep8Ig6MEn8IkR5IOK8Mi948MYY1GlFriendInviteEj5bfrEHFMoY1IEq6IX19Eo6EF9MJg4IIxISMji57IXqCdultiIA38IMugI74HISE6MSI2EMgz1HJBFR1EZ9dQuitIe18MsB27IJF8It47M4b1RMHj2QIcA8IagDMp41DIv1IIb3FIDc7Eg4Mtg4QMKv35IsmPEW5eWhiteM3w2PEY4cAttMQ216ITETMwa17JL6Q1If18jPageParam Iog4IC6QbidIA6QbroMNP57MSp2OMir4AI7LPID2BI9dMMOo27I6vdMR52hM2W2BMhX19M8N4PMK528I73JMuZ47Mo93AI51FIOE4IIgEMnl1FM8716Iu6nIgU4IjULIQJ4Mjd16INK6MGx4MEfHImqDIV1NI7K8IN1PIeK9IF1ZIvNAIH1PIUOBIJ1EIW2RIpZOMeN2FIm5HI214cExtIbX8MkH2QbpTMgH2TM416EMVJ1OMGJ56IOJIII2KIf9LIPE4IixPMNH5BMb93UdNickMod5UMEC2AIR3QfremarkIA17MyU4LcisBIgL5MFa6NbanM7D6VMjt48MDm27Iv4JMal26MjE16JfLS1Mzm1WIe5PMjZ6OIe5CMDB3NISSDMp22HI5DJI14eIdkcIMlSIdkDMW74NIdkKIkeOIECCI0e8Mu44MIgJNI48uIWHAILD4IMeBI2NOEZ9binI724El8MA81NMsI48I4UMMNF69I9UTIoF5IL8BMZh6KME615Mh95OdapplM4e28MuG2GIT3HIil7IT37MTC6MEa7Ion8MHO5HItEEgResponsJvET1IAD8IhU8Mfy1OIjV8IoEPIK89MtO4KIZb8I887MFu5RIS6EIY4QNX01T1IMJDMD81LIbr8Mrz4uM5a3XM8B28Ix1MMXi4MIy1qIU1JeCheckMd84MEY6EXCIbYPEhIIm4tIdG9Iq2NMIC1JMaB2oIAVDIgNkIM2PID5MIBzSMaC1HII16I7rQMJe37EW4I9kNIejPIdGMMG216MpI5BII2II6guMWz18Mnp46MCP3TIA2AIqIPM0917IdcqI8hEIgINI8hEM5P3GIY8PIKP7IGHNMa819I55lIs2EMjh1OIs2DI05MMrf4CI5EQMbw2NMYF1DI15NITJ7Mmn3MIb7DMtT3HIYI7IDw4J6KT1Mw145cSetIixNMQ247IrJOIwuPIpCFI0LVIQ8AIB1NIx8BI7wREi6aAIdZ4Mg635IQ3MI9a6Mxv5SIa6DI6RZJku71INWHIE35MqP2DMv11WI7B6MVe5PEt6IY45MAo1KIDeHcoptIRiBIpLOMvP1PIePGMvP1TIOnNIW1JdFullIYnCIfBII774MDx26IM8LMuQ39Ih95IIDQIM8IIiOJITw5If1SIcM6IW87IUsSIXLDIn1HcAddM0G46ePerioMMf2TMzC6CMUO4MispanMinutMMz45IdQMIQG8MJO3OgimezoneMeC5QIp2XMal1XIdW5J9191I91CMRQ6SbisM6179M332OIf5BMGD5NIf5DIjQMIf58MIP7OIf5AI1HHMvQ27I9ASN0y3U1MQa2DIpTMMnw3CMXg1GMYy3GMyx36MO61IMH676MqO5OMiC39MTU35M6P1TM4V39M6m2NmSpeechToTextIEa4M7a7sfobjectIDkEMyf3QMZ31NfampleRMKr6MM1L3AjnelNumber ISePfformatITZQMLd68I9xII469Myx5SI56jMZ019I76TMuW1MIlL9I517MMl6OIJ17MMe4KdransMK62JEO5I085ctraEA6MvR2QcmodMP33LM9c76dorceMPp48I8oHI427McO2IEP8IV34Ic36I42dIW1HIUkREe7Mkr36InfNI514IqaUbteM4Q2SI315dFileINa6Mow6OMYS75aLMnR15IBBNIYi6EZ6MDk6MMtA65aSMkT76IKBKIU5CIP4pIN3CICBEIM3UMnr3TEZ6IiFNMY226MgA7NIp3BMaR1JMB345MMx3Acq {Mqb4IMqZ67Mo84AMFS4dIvA9IJA9M1M3AMSK2LMZz3KM9t2AET8Mz627ICRMdnextMYp4FMFq7hIF3GMXa2HM3Y5dIm2AIXKLII4DMk24jMtW7DbacEB4I2W6creaM1h78M7K4OM4t6OMGS2WMpm6UIx4DM9K4HMBw1GMFK4PMGl6NEU7ET7MrD57Mrx1xIg7BMIs7uIN2ENSS3N1MoE4QI37MMyN8HMoD66IBs6EB5M5r1LEcBIxALMl536I0QNM8926Iid6IJfMEZ7cMeCMNd4RjclearTime=MrL6NeutOffEX5I8KGMCd6EgfirstUnEJ7IJKCMxK55Iqv4MpK5BgKICK = Mus37eREFUSMNf7BgCOEXISTMX55LgtcValueM6R3UMrg5ZIN1FIxpRdroomMXL15M5v3NMZ988Ea5I8HHIq2CI0e5eInnerM6s4NMYy29bSyIpA4MOE75IlKJbIdIf74btyMex3BbidEJHI8RIIH69MNk1IIwmAIr2CbinIm27MC45BEgMeouterEg8MXG1HcRtcIVhSIfv7Ih5KMPh5KIZ95IC4JIU16mAnchorToVieweMty2BEG6bToEW6Ik9KcBotM5J1SMUK26IHyHcBotIY36EsFIG15ffo botEuOEW4IdJMM0A65b1;MjH4MMVP1yIBL8MYA4FME249MXz76Mys66Mkz7AMcK8PMeP1QMht47Me915MJ72CMI34EIn1AM2x2UIH4MM3x2PIQV8NEg101JMP21MAW3KI2sKIm27MAt1KMtA8KMVa1OMPj8AMFh7NMPj8AMEh7NMbi4DM4Q8HIV58M484AMN35IMs226M5q3NI318M1955cQryJb6o1Mlc3TImZRMZJ2LcallMm457IS6OIMbBMLO7JIJ46M9t2NI62GMR21MIsbHMxH4HMwD15IYC7Mk876EG8MtI5tIK1FMFg3qIs88I3aDMlD1BIq2BInkSEf8JQ9r1J1GE1IU9VMAj2DIrFNIz6CMC39TIpFSJSAM1MUY3XI88ZMfr3JES6Iv44Jv2v1IrvHIv2fMsB1RIs8DMV12OICMDIOnMduserIJnMM6s56cserII25MgQ5KIa5AEe5Mr74MEbBMh42tIC3IIa1KMOX1SJvFf2Mrm3FI7lHIv5GMEp5QIY7AIskHePSelfMXu6QN501d1d32 pMaM18M4B1MIRg6M1r3IcSrsMrA1Mj64 lastMsgIt86IT9McdelIO9Eb}\n3TV9");var me,Ae;var Me,ye,be,Pe,Le,Ue,De;me=new WeakSet,Ae=function e(t,i){if(t instanceof Array)return t.map((t=>f(this,me,"m",e).call(this,t)));if(r=t,"[object Object]"!==Object.prototype.toString.call(r))return t;var r;if(t instanceof ge.ByteBuffer)return t.toArrayBuffer();if(t instanceof ge.Long)return i?t.toString():t.toNumber();const s={};return Object.keys(t).forEach((i=>{const r=t[i],n="ExtMsgData"===t.$type.name&&"seqId"===i;s[i]=f(this,me,"m",e).call(this,r,n)})),s},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"}(Me||(Me={})),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"}(ye||(ye={})),function(e){e[e.IsSilent=1]="IsSilent",e[e.IsTop=2]="IsTop",e[e.Tags=3]="Tags",e[e.AutoTrans=4]="AutoTrans"}(be||(be={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Pe||(Pe={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Le||(Le={})),new class{constructor(e){me.add(this),Object.defineProperty(this,"pbModules",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=ge.loadProto(e);this.pbModules=t.build("Modules").probuf}encode(e,t){return this.pbModules[e].encode(t).toArrayBuffer()}decode(e,t){try{const i=this.pbModules[e].decode(t);return f(this,me,"m",Ae).call(this,i)}catch(t){const i=`name: ${e}, stack: ${t.stack}`;throw null===console||void 0===console||console.error("pb decode error!",i),t}}}(ve),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"}(Ue||(Ue={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(De||(De={}));const we="RC:TxtMsg",Ve="RC:VcMsg",ke="RC:HQVCMsg",Ge="RC:LogCmdMsg",Fe="RC:MsgExMsg",Be="RC:ReferenceMsg",He="RC:RcCmd",xe="RC:RcNtf",Je="RC:ReadNtf",Ye="RC:RRReqMsg",je="RC:RRRspMsg",We="RC:SRSMsg",Ke="RC:RRMsg",Xe="RC:RSMsg",Ze="RC:Delivered",qe="RC:DRMsg",Qe="RC:ChrmMemChange",$e="RC:ChrmSyncMsg",ze="RC:ChrmBlockMsg",et="RC:ChrmBanMsg",tt="RC:CCConfigChangeRequestMsg",it="RC:CmdMsg",rt="RC:CmdNtf",st="RC:InfoNtf",nt="RC:GrpNtf";var ot,at,lt,ct,ht,ut,dt,Et,It,_t,ft,gt,Rt,pt,Tt,Nt,St,Ot,Ct,vt,mt;!function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(ot||(ot={})),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"}(at||(at={})),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"}(lt||(lt={})),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"}(ct||(ct={})),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"}(ht||(ht={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(ut||(ut={})),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"}(dt||(dt={})),function(e){e[e.typing=0]="typing"}(Et||(Et={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}(It||(It={})),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"}(_t||(_t={})),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"}(ft||(ft={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}(gt||(gt={})),function(e){e[e.NOT_SET=0]="NOT_SET",e[e.INVISIBLE=1]="INVISIBLE",e[e.EVERYONE=2]="EVERYONE",e[e.FriendVisible=3]="FriendVisible"}(Rt||(Rt={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(pt||(pt={})),function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Tt||(Tt={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(Nt||(Nt={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(St||(St={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(Ot||(Ot={})),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"}(Ct||(Ct={})),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"}(vt||(vt={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(mt||(mt={}));const At=e=>e<=vt.NOT_SET?mt.CLOSE:mt.OPEN;var Mt,yt,bt,Pt,Lt,Ut,Dt,wt,Vt;!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"}(Mt||(Mt={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(yt||(yt={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(bt||(bt={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(Pt||(Pt={})),function(e){e[e.CURRENT=2]="CURRENT"}(Lt||(Lt={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(Ut||(Ut={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Dt||(Dt={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(wt||(wt={})),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"}(Vt||(Vt={}));const kt=0,Gt=0,Ft=0;var Bt,Ht;!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"}(Bt||(Bt={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(Ht||(Ht={}));const xt=72e5,Jt=6e4,Yt="5.48.1".replace(/-.+$/,""),jt="rongcloudsystem",Wt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{},Kt="engine";Wt[Kt]="5.48.1";class Xt{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)&&(Wt[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 Wt[Kt].match(/\d+\.\d+\.\d+/)[0].split(".").map((e=>e.padStart(3,"0"))).join("")>=i}static getInfo(){return Wt}}const Zt={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),r=Math.floor(Math.random()*t).toString(36),s=e-i.length-r.length;var n;return[r,i,s>0?(n=s,Array.from({length:n}).map((()=>Math.floor(36*Math.random()).toString(36))).join("")):""].join("").slice(0,e)}},qt=Zt.genWithLen(22),Qt=Date.now(),$t=e=>-1!==Object.prototype.toString.call(e).indexOf("Array"),zt=e=>(e=>"string"==typeof e)(e)&&/https?:\/\//.test(e),ei=e=>{for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},ti=e=>({isRead:(e&Mt.READ)===Mt.READ,isListened:(e&Mt.LISTENED)===Mt.LISTENED,isDownload:(e&Mt.DOWNLOADED)===Mt.DOWNLOADED,isRetrieved:(e&Mt.RETRIEVED)===Mt.RETRIEVED}),ii=e=>[_t.iOS,_t.Android,_t.Web,_t.PC,_t.Mini,_t.HarmonyOS].map((t=>{const i=e.findIndex((e=>e.platform===t));return-1===i?{platform:t,changeTime:0,eventValue:0}:e[i]})),ri=(e,t,i)=>t?1===i?fe.TLS:fe.RMTP:"http"===e?fe.WS:fe.WSS,si=(e,t)=>{const{server:i,backupServer:r,bs:s,serverAddr:n,protocol:o,openTLS:a}=e;if(n){return[...n.filter((e=>e.addr))]}const l=[],c=[];return i&&c.push(i),(r||s||"").split(",").forEach((e=>{c.indexOf(e)<0&&c.push(e)})),c.forEach(((e,r)=>{e&&l.push({addr:e,protocol:ri(o,t,a),weight:i.length-r,race:!1})})),[...l]},ni=e=>{if(void 0===e)return;const t=Number(e);return Number.isNaN(t)?void 0:t},oi=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{}),ai=(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},li=(e,t)=>{const i=Math.floor(1e3*Math.random()%1e4),r=Zt.gen(),s=(e=>{e=e||"-";const t=new Date;return`${t.getFullYear()}${e}${t.getMonth()+1}${e}${t.getDate()}`})(),n=(new Date).getTime();let o="";if(t){const e=t.split(".");o=`.${e[e.length-1]}`}return`${e}__RC-${s}_${i}_${n}${r}${o}`},ci=(e={},t={},i={})=>{const{channelIdMi:r,templateIdMi:s,templateParamMi:n,channelIdHW:o,channelIdOPPO:a,typeVivo:l,importanceHW:c,categoryHW:h,imageUrlHW:u,categoryVivo:d,importanceHonor:E,imageUrlHonor:I}=t,{APNS:_,FCM:f}=((e={},t={})=>{const{threadId:i,apnsCollapseId:r,category:s,richMediaUri:n,interruptionLevel:o}=e,{googleConfig:a}=t,l={};l["thread-id"]=i||"",l["apns-collapse-id"]=r||"",l.category=s||"",l.richMediaUri=n||"",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 h=null==a?void 0:a.priority;return h&&!["high","normal"].includes(h)&&(h="normal"),c.priority=h,{APNS:l,FCM:c}})(e,t),g=[{HW:{channelId:o||"",importance:c||"NORMAL",image:u||"",category:h||""}},{MI:Object.assign(Object.assign({channelId:r||""},s?{templateId:s}:{}),n&&Object.keys(n).length>0?{templateParam:n}:{})},{OPPO:{channelId:a||""}},{VIVO:{classification:l||"",category:d||""}},{APNS:_},{FCM:f},{HONOR:{importance:E||Ot.NORMAL,image:I||""}},{OHOS:{category:i.category||null,image:i.image||""}}];return JSON.stringify(g)},hi=()=>{const e=Xt.getInfo();let t="electron";for(let i in e)"engine"!==i&&(t=["imlib-v2-adapter","imlib-next"].includes(i)?i:"electron");return t};function ui(e,t){var i;if(!e)return"";const r="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)?r?e.replace(/^https?:\/\//i,"https://"):e:t!==fe.HTTP||r?`https://${e}`:`http://${e}`}const di=(e,t)=>{if(!e)return"";const{ossConfig:i=""}=e;let r="";try{const e=JSON.parse(i);if(e.length>0){const t=e.find((e=>e.minio));t&&(r=t.minio)}}catch(e){t.warn(M,JSON.stringify({ossConfig:i,error:e}))}return r};var Ei;class Ii{constructor(){Ei.set(this,!1)}stopPropagation(){g(this,Ei,!0)}get isStopPropagation(){return f(this,Ei,"f")}}Ei=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,r,s=0){const n=Symbol(),o=this._map.get(e)||this._map.set(e,[]).get(e),a={symbol:n,priority:Math.min(s,100),listener:t.bind(r),once:i},l=o.findIndex((e=>e.priority>s));return-1===l?o.push(a):o.splice(l,0,a),n}on(e,t,i,r=0){return this._addItem(e,t,!1,i,r)}once(e,t,i,r=0){return this._addItem(e,t,!0,i,r)}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 Ii;for(let r=0;r<i.length;r+=1){const{once:s,listener:n}=i[r];s&&i.splice(r,1);try{n(e,...t)}catch(e){null===console||void 0===console||console.error(e)}if(e.isStopPropagation)return}}[...this._piped.entries()].forEach((([i,r])=>{(0===r.length||r.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 fi{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 fi(e,t||`fail: ${e}`,i)}static ok(e,t){return new fi(0,t||"success",e)}static fail(e,t,i){return new fi(e,t||`fail: ${e}`,i)}next(e){return _(this,void 0,void 0,(function*(){return this.isOk?e(this.data):this.wipe()}))}or(e){return _(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):Ri(this.code,this.msg)}}const{ok:gi}=fi,{fail:Ri}=fi,pi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Ti(e){let t,i,r,s,n,o,a,l="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c<e.length;)s=pi.indexOf(e.charAt(c++)),n=pi.indexOf(e.charAt(c++)),o=pi.indexOf(e.charAt(c++)),a=pi.indexOf(e.charAt(c++)),t=s<<2|n>>4,i=(15&n)<<4|o>>2,r=(3&o)<<6|a,l+=String.fromCharCode(t),64!==o&&(l+=String.fromCharCode(i)),64!==a&&(l+=String.fromCharCode(r));return l}const Ni=()=>{let e,t=new Promise((t=>{e=t}));return{resolve:e,promise:t}};function Si(e={}){const t={};return Object.keys(e).forEach((i=>{"x-user-agent"!==i.toLowerCase()&&(t[i]=e[i])})),t["X-User-Agent"]=["Web",...Object.entries(Xt.getInfo()).map((([e,t])=>`${e}@${t}`))].join("|"),t}function Oi(e){if(!e||0===e.length)return[];const t=new Set;return e.forEach((e=>{t.add(e)})),Array.from(t)}var Ci;!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(Ci||(Ci={}));const vi=0,mi=1;var Ai;!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"}(Ai||(Ai={}));const Mi={[Ai.BJ]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5yb25nLWVkZ2UuY29t","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ucm9uZy1lZGdlLmNvbQ==",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnJvbmctZWRnZS5jb20=","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5yb25nLWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5yb25nLWVkZ2UuY29t"]},[Ai.SG]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zZy1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2ctbGlnaHQtZWRnZS5jb20=",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWxpZ2h0LWVkZ2UuY29t","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1saWdodC1lZGdlLmNvbQ=="]},[Ai.NA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi51cy1saWdodC1lZGdlLmNvbQ==","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24udXMtbGlnaHQtZWRnZS5jb20=",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnVzLWxpZ2h0LWVkZ2UuY29t","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC51cy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy51cy1saWdodC1lZGdlLmNvbQ=="]},[Ai.SG_B]:{naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWItbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1iLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1iLWxpZ2h0LWVkZ2UuY29t"]},[Ai.SA]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zYXUtbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2F1LWxpZ2h0LWVkZ2UuY29t",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNhdS1saWdodC1lZGdlLmNvbQ==","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zYXUtbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zYXUtbGlnaHQtZWRnZS5jb20="]},[Ai.OM]:{naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5vbS1saWdodC1lZGdlLmNvbQ==","bmF2LWIub20tbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ub20tbGlnaHQtZWRnZS5jb20=",protocol:fe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLm9tLWxpZ2h0LWVkZ2UuY29t","d3MtYi5vbS1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5vbS1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIub20tbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9kdWFsc3RhY2stc3RhdHMub20tbGlnaHQtZWRnZS5jb20="]}};function yi(e){return Ai[e]?e:Ai.BJ}const bi=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:r}=this.initOption||{},s=function(e=Ai.BJ){return Mi[yi(e)].naviUrlBase64}(i).map((e=>Ti(e)));let n=[];const[,o]=e.split("@");t&&(n=o?o.split(";"):[]);const a=r&&r.length>0?[...n,...r]:[...n,...s];return a.filter(((e,t)=>a.indexOf(e)===t)).map((e=>ui(e)))}getLogUrlPolicyList(e,t){const{log:i,logPolicy:r}=e||{},{areaCode:s,logServerUrl:n}=this.initOption||{},o=function(e=Ai.BJ){return Mi[yi(e)].logUrlBase64}(s).map((e=>Object.assign(Object.assign({},e),{addr:Ti(e.addr)}))),a=[],l={level:1,itv:6,times:5};if(i)a.push(...i.addrs),Object.assign(l,i.policy);else if(r)try{const e=JSON.parse(r);a.push({addr:e.url,protocol:fe.HTTPS,weight:1}),l.level=e.level,l.itv=e.itv,l.times=e.times}catch(i){t.warn("L-parse_navi_logpolicy-E",JSON.stringify({policy:e.logPolicy}))}const c=n?[{addr:n,protocol:fe.HTTPS,weight:101},...a]:[...a,...o];return{policy:l,addrs:c.filter(((e,t)=>c.findIndex((t=>t.addr===e.addr&&t.protocol===e.protocol))===t)).map((e=>Object.assign(Object.assign({},e),{addr:ui(e.addr,e.protocol)}))).sort(((e,t)=>t.weight-e.weight))}}getMiniCmpUrlList(){var e;const t=function(e=Ai.BJ){return Mi[yi(e)].miniCmpBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>Ti(e))),{miniCMPProxy:i}=this.initOption||{};return i&&i.length>0?i:t}getStaticConfigUrl(){var e;return function(e=Ai.BJ){return Mi[yi(e)].staticConfigUrlBase64}(null===(e=this.initOption)||void 0===e?void 0:e.areaCode).map((e=>Ti(e)))}getCloudControllerUrl(e){var t;return function(e=Ai.BJ){return Mi[yi(e)].cloudControllerUrlBase64}(null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode).map((e=>Ti(e)))}getAreaCode(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:Ai.BJ}setAreaCode(e){return!(!e||!Ai[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)}getStatsUrlList(e){var t;const{active:i,activeServer:r}=e||{};let s=(null==i?void 0:i.addrs)||[];const n=function(e=Ai.BJ){return Mi[yi(e)].statsUrlBase64}(null===(t=this.initOption)||void 0===t?void 0:t.areaCode).map((e=>Ti(e))),o=[];return 0!==s.length?o.push(...s.sort(((e,t)=>t.weight-e.weight)).map((e=>ui(e.addr,e.protocol)))):r&&o.push(ui(r,fe.HTTPS)),n.forEach((e=>{o.includes(e)||o.push(e)})),o}};class Pi{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(){return _(this,void 0,void 0,(function*(){var e;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=>ui(e.addr,e.protocol)))||[]}}}catch(e){this.logger.error(v,JSON.stringify({error:null==e?void 0:e.stack}))}this.clearCache()}const i=yield this._requestHandle();if(!i)return;const r=yield this.decryptData(i);if((null==r?void 0:r.areaCode)!==bi.getAreaCode())return;this.setCache(JSON.stringify({time:Date.now(),val:i})),this.staticUrls=(null==r?void 0:r.bootstrap)||[];const s=null===(e=null==r?void 0:r.resources)||void 0===e?void 0:e.navi.slice();return s.sort(((e,t)=>t.weight-e.weight)),{navi:s.map((e=>ui(e.addr,e.protocol)))||[]}}))}_requestHandle(){return _(this,void 0,void 0,(function*(){let e=[...this.staticUrls,...bi.getStaticConfigUrl()].map((e=>ui(e)));e=e.filter(((t,i)=>e.indexOf(t)===i));for(let t of e){const e="L-get_static_conf-R";this.logger.info("L-get_static_conf-T",JSON.stringify({url:t}));const i=Date.now(),{code:r,data:s}=yield this.sendRequest(`${t}/${this.appkey}`);if(200===r)return this.logger.info(e,JSON.stringify({url:t,code:r,duration:Date.now()-i})),s;this.logger.warn(e,JSON.stringify({url:t,code:r,duration:Date.now()-i}))}}))}}var Li;!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"}(Li||(Li={}));class Ui{constructor(e,t,i,r){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:r}),Object.defineProperty(this,"outputLevel",{enumerable:!0,configurable:!0,writable:!0,value:Li.WARN}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Li.DEBUG)}),Object.defineProperty(this,"info",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Li.INFO)}),Object.defineProperty(this,"warn",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Li.WARN)}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Li.ERROR)}),Object.defineProperty(this,"__statistics",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Li.STATISTICS)}),Object.defineProperty(this,"record",{enumerable:!0,configurable:!0,writable:!0,value:this.__statistics})}_write(e){const{tag:t,level:i,content:r,traceId:s}=e;/^[\w-]+$/.test(t)?i!==Li.DEBUG&&this.proxy.write(e):console.error(`${(new Date).toISOString()}[${this._id}]['ERROR']: ${t} | ${r} | ${s}`)}createTraceId(){return""+ ++Ui._traceIdCount}getSessionId(){return qt}_stdout(e){const{time:t,tag:i,content:r,traceId:s,level:n,loggerId:o}=e;if(!console)return;if(n<=Li.FATAL)return;if(n>this.outputLevel)return;const a=["error","warn","info","debug"][n-1],l=`${new Date(t).toISOString()}[${null!=o?o:this._id}][${(a||"stat").toUpperCase()}]: ${i} | ${r} | ${s}`;console[a||"warn"](l)}setOutputLevel(e){(e=>[Li.DEBUG,Li.INFO,Li.WARN,Li.ERROR].some((t=>t===e)))(e)&&(this.outputLevel=e)}_log(e,t,i,r){const s={time:Date.now(),level:e,tag:t,content:i,traceId:r,loggerId:this._id,sessionId:this.getSessionId(),type:this._type};this._stdout(s),this._write(s)}summary(e,t,i,r={},s,n){if(t.isOk){const n=null==s?void 0:s(t.data);this.info(e,JSON.stringify(Object.assign(Object.assign({isOk:!0},r),n)),i)}else{const s=null==n?void 0:n(t.data);this.warn(e,JSON.stringify(Object.assign(Object.assign({code:t.code,msg:t.msg},r),s)),i)}}}Object.defineProperty(Ui,"_traceIdCount",{enumerable:!0,configurable:!0,writable:!0,value:0});class Di{constructor(e,t,i,r,s=!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:r}),Object.defineProperty(this,"disableLogReport",{enumerable:!0,configurable:!0,writable:!0,value:s}),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,t,i,r,s,n){return _(this,void 0,void 0,(function*(){let s=[];try{const o=yield this.logDB.read(e,t,i,r,n);$t(o.logs)&&(s=o.logs.filter((e=>!(!e||"object"!=typeof e))))}catch(e){}return{logs:s}}))}checkStart(e,t){return _(this,void 0,void 0,(function*(){if(this.started)return;if(this.userId=e.userId,!e.logSwitch||this.disableLogReport)return;const{policy:i,addrs:r}=bi.getLogUrlPolicyList(e,this.logger);this.started=!0,this.itvByNavi=i.itv,this.timesByNavi=i.times,r.length>0&&this.realtimeReport(r[0].addr,i.level,i.itv,t)}))}_sendLogs2Realtime(e,t,i,r){return _(this,void 0,void 0,(function*(){const{success:s,data:n}=yield this.compressLogs(e);if(!s)return{isOk:!1,itv:r};let o=zt(i)?i:`https://${i}`;o+=`?version=5.48.1&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.getDeviceId()}&deviceInfo=${this.deviceInfo}&platform=Web`;const{status:a,data:l}=yield this.send({url:o,body:n,method:"POST"});if(200!==a)return this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(r+=r),this.reportFailedNumber++,{isOk:!1,itv:r};let c,h;if(this.reportFailedNumber=0,l)try{const e=JSON.parse(l);e.nextTime&&(r=e.nextTime),c=e.level,h=e.logSwitch}catch(e){this.logger.warn(M,JSON.stringify({error:null==e?void 0:e.stack}),t)}return{isOk:!0,itv:r,level:c,logSwitch:h}}))}realtimeReport(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=Date.now(),n=this.logger.getTimestamp4RealtimeLog()||Qt,o=Math.max(s-3e4,n+1),a=this.logger.createTraceId(),{logs:l}=yield this._getLogs(n,o,t,!0,a,r);if(0===l.length);else if(l.length>0){const{itv:r,level:s,logSwitch:n,isOk:o}=yield this._sendLogs2Realtime(l,a,e,i);if(o){const e=Math.max(...l.map((e=>e.time)));this.logger.setTimestamp4RealtimeLog(e+1),0===n&&(this.started=!1),void 0!==s&&(t=s)}i=r}this.started&&(i>=60&&this.itvByNavi<60&&(i=60),this.timer=setTimeout((()=>this.realtimeReport(e,t,i,r)),1e3*i))}))}report(e,t,i,r,s,n){return _(this,arguments,void 0,(function*(e,t,i,r,s,n,o=!1){if("web"!==i.toLowerCase()||this.disableLogReport)return;const a=this.logger.createTraceId(),l="L-report_full_log-O";this.logger.info("L-report_full_log-T",JSON.stringify({startTime:e,endTime:t,logId:s,messageUId:n,isCloudControl:o}),a);const{logs:c}=yield this._getLogs(e,t,Li.DEBUG,!1,a);this.logger.info(l,JSON.stringify({count:c.length}),a);let h,u=zt(r)?r:`https://${r}`;if(u+=`?version=5.48.1&appkey=${this.appkey}&userId=${encodeURIComponent(this.userId)}&deviceId=${this.getDeviceId()}&deviceInfo=${this.deviceInfo}&platform=Web&logId=${s}`,c.length>0){const{success:e,data:t}=yield this.compressLogs(c);h=e?t:"compress failed"}else h="no data or no database";this.logger.debug(l,"compress done",a),o&&(u+="&source=cloud");const{status:d}=yield this.send({url:u,body:h,method:"POST"});this.logger.info("L-report_full_log-R",JSON.stringify({status:d}),a)}))}stop(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1}}function wi(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 Vi,ki,Gi,Fi,Bi,Hi,xi,Ji;function Yi(){return _(this,void 0,void 0,(function*(){return{logs:[]}}))}function ji(){}class Wi{constructor(e,t){Vi.set(this,void 0),ki.set(this,void 0),g(this,Vi,e),g(this,ki,t)}read(e,t,i,r,s){return _(this,void 0,void 0,(function*(){try{const n=yield f(this,Vi,"f").call(this,e,t,i,r,s);if(!n||!Array.isArray(n.logs))return{logs:[]};return{logs:n.logs.filter(wi)}}catch(e){return console.error("[LogDBProxy] read error",e),{logs:[]}}}))}write(e){try{f(this,ki,"f").call(this,e)}catch(e){console.error("[LogDBProxy] write error",e)}}setLogReader(e){return"function"==typeof e&&g(this,Vi,e),this}setLogWriter(e){return"function"==typeof e&&g(this,ki,e),this}}Vi=new WeakMap,ki=new WeakMap;class Ki{static start(e){f(this,Gi,"f",Fi)||(g(this,Gi,e,0,Fi),e.info(y,"start"),f(this,Gi,"m",Ji).call(this))}static stop(){f(this,Gi,"f",Fi)&&(f(this,Gi,"f",Fi).info(y,"stop"),g(this,Gi,null,0,Fi),f(this,Gi,"f",Bi)&&(clearTimeout(f(this,Gi,"f",Bi)),g(this,Gi,null,0,Bi)))}}Gi=Ki,Ji=function e(){const t=Date.now();g(this,Gi,setTimeout((()=>{const i=Date.now()-t;i>=f(this,Gi,"f",xi)&&f(this,Gi,"f",Fi).warn(y,`delta time: ${i}ms`),f(this,Gi,"m",e).call(this)}),f(this,Gi,"f",Hi)),0,Bi)},Fi={value:null},Bi={value:null},Hi={value:30},xi={value:1500};const Xi=1,Zi=2,qi=3;class Qi{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,r,s;this.taskLock=!1;const n=null!==(t=e.startTime)&&void 0!==t?t:0,o=null!==(i=e.endTime)&&void 0!==i?i:0,a=null!==(r=e.platform)&&void 0!==r?r:"",l=null!==(s=e.uri)&&void 0!==s?s:"";e.logId!==this.logId&&""!==l&&(this.logId=e.logId,this.reporter.report(n,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 $i{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 Qi(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===Ge&&this.uploadTaskManage.uploadLogCmdTask(e)}))}}dataHandle(e){const t=this._cache;t.lastRequestTime=this.lastRequestTime,ei(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,t,i){return _(this,void 0,void 0,(function*(){if(!this.isEable&&t===Xi&&this.isExire())return this.logger.info("L-cloud_disabled",JSON.stringify({msg:"cloud controller is disabled"})),this.timestamp;if(!this.isEable&&t===Zi&&this.isOverclock())return this.logger.info("L-cloud_overclock",JSON.stringify({msg:"cloud controller is overclock"})),this.timestamp;const r=ui(e);this.lastRequestTime=(new Date).getTime();const s=`${r}/v1/config`,n={"Content-Type":"application/json","RC-App-Key":this.appkey};i&&(n["RC-Token"]=i);const o={platform:"web",version:"5.48.1",timestamp:this.timestamp};this.logger.record(Ct.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!i,uri:s}));const{code:a,data:l}=yield this.httpRequest(s,Ht.POST,n,o);if(this.logger.record(Ct.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:l})),a===ne.CLOUD_DATA_CENTER_INVALID&&l&&l.targetRegion){const e=l.targetRegion;if(this.changeAreaCode===e)return this.timestamp;const t=bi.setAreaCode(e);this.logger.info("L-cloud_set_area_code-O",JSON.stringify({isChangeSuccess:t,originAreaCode:bi.getAreaCode(),newAreaCode:e})),this.changeAreaCode=e;const i=bi.getCloudControllerUrl(e);return i[0]?this.request(i[0],qi):(this.logger.info("L-cloud_appkey_region_error",JSON.stringify({appkey:this.appkey,uri:s,msg:"appkey region error"})),this.timestamp)}return l&&this.dataHandle(l),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 zi,er,tr,ir;const rr=e=>e===ne.RC_CONN_REDIRECTED;class sr extends _i{constructor(e,t,i){super(),zi.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:""}),ir.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:Bt.UNKONWN}}),Object.defineProperty(this,"_checkAliveTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_crtConnectionStatus",{enumerable:!0,configurable:!0,writable:!0,value:pt.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===pt.DISCONNECTED&&e===pt.CONNECTING&&(this._doConnectReason=Dt.CONNECT,f(this,zi,"m",tr).call(this)),this._crtConnectionStatus===pt.CONNECTED&&e===pt.SUSPENDED&&(t===ne.RC_PING_EXCEED_LIMIT?this._doConnectReason=Dt.TIMEOUT:t===ne.RC_CONN_REDIRECTED?this._doConnectReason=Dt.REDIRECTED:this._doConnectReason=Dt.RECONNECT),this._crtConnectionStatus===pt.CONNECTED){const i={bid:hi(),cod:t,net:this.getNetwork().type,dur:Date.now()-f(this,ir,"f"),cid:this.cid};this.logger.record(Ct.IM_CONNECTION_DURATION,JSON.stringify(i)),e===pt.SUSPENDED&&f(this,zi,"m",tr).call(this)}switch(this._crtConnectionStatus=e,e){case pt.CONNECTED:this.logger.info(R,`status: ${e}`),this.checkAlive(),f(this,zi,"m",er).call(this).emit("onConnected",this._fromSuspend);break;case pt.CONNECTING:this.logger.warn(R,`status: ${e}`),f(this,zi,"m",er).call(this).emit("onConnecting");break;case pt.SUSPENDED:this._fromSuspend=!0,this.logger.warn(R,`status: ${e}, code: ${t}`),rr(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),f(this,zi,"m",er).call(this).emit("onSuspend",t);break;default:this._fromSuspend=!1,this._crtUserId="",this.logger.warn(R,`status: ${e}, code: ${t}`),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),f(this,zi,"m",er).call(this).emit("onDisconnected",t)}}}getConnectionStatus(){return this._crtConnectionStatus}get isConnected(){return this._crtConnectionStatus===pt.CONNECTED}setNetwork(e,t){if(!t){const t={cid:this.cid,cn:e.type,on:this._network.type};this.logger.record(Ct.IM_NETWORK_CHANGE,JSON.stringify(t))}this._network=e}getNetwork(){return this._network}connect(e,t,i,r){return _(this,void 0,void 0,(function*(){if(this._crtConnectionStatus===pt.CONNECTED)return gi(this._crtUserId);if(this._crtConnectionTask)return this._crtConnectionTask;this._openCallPlus=i,this.token=e,this.setConnectionStatus(pt.CONNECTING);const{code:s,data:n}=yield this.try2Connect(e,t,!1,r,!0);return s!==ne.SUCCESS?(this.setConnectionStatus(pt.DISCONNECTED,s),Ri(s)):(this.setConnectionStatus(pt.CONNECTED),gi(n))}))}try2Connect(e,t,i,r,s){return _(this,void 0,void 0,(function*(){if(this._crtConnectionTask)return this._crtConnectionTask;this._crtConnectionTask=this.createConnectionTask(e,t,i,r,s);const n=yield this._crtConnectionTask;return this._crtConnectionTask=null,n}))}createConnectionTask(e,t,i,r,s){return _(this,void 0,void 0,(function*(){const n="L-connect-R",o={cid:this.cid,reason:this._doConnectReason,net:this.getNetwork().type,spr:0,sts:Date.now(),timelimit:0};this.logger.record(Ct.IM_STATS_CS,JSON.stringify(o));const a={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this._doConnectReason},{code:l,data:c}=yield this.navi.request(e,i,!1,r,a);if(l!==ne.SUCCESS)return Ri(l);const h=c;if(1===h.type)return Ri(ne.PACKAGE_ENVIRONMENT_ERROR);this.logger.info("L-connect-T",JSON.stringify({token:e,reconnectKickEnable:t}),r);const{code:u,data:d}=yield this._connectWithToken(e.replace(/@.+$/,"@"),h,t,r);if(s||u===ne.SUCCESS||(this.retryCount+=1),rr(u))return this.logger.warn(n,`redirect code: ${u}`,r),this.clearCmpWeightCache(),this.createConnectionTask(e,t,!0,r,s);if([ne.RC_TCP_RESET,ne.RC_CONN_ACK_TIMEOUT,ne.RC_TCP_DISCONNECTED_NO_RMTP,ne.CONNECTION_REFUSED].includes(u)&&this.cmpWeightCache&&this.cmpWeightCache.length>1){this.updateCmpWeight(this.curCmpUrl,!1);const i=this.cmpWeightCache.every((e=>e.failed));return s&&i?(this.logger.warn(n,`cpp code:${u},reture code:${ne.SERVER_UNAVAILABLE}`,r),Ri(ne.SERVER_UNAVAILABLE)):(this.logger.warn(n,`cmp ack timeout, code: ${u}`,r),this.setConnectionStatus(pt.SUSPENDED,u),this.setConnectionStatus(pt.CONNECTING),this.createConnectionTask(e,t,!1,r,s))}return u!==ne.SUCCESS?(this.logger.warn(n,`code: ${u}`,r),Ri(u)):(this.logger.info(n,`userId: ${d}`,r),g(this,ir,Date.now()),this._crtUserId=d,gi(d))}))}try2Reconnect(e,t){return _(this,void 0,void 0,(function*(){const i=this.logger.createTraceId();this.logger.debug(p,`try2Reconnect -> ignoreNaviCache: ${e}, reason: ${t}`,i),this.stopReconnectTimer();const r=()=>_(this,void 0,void 0,(function*(){if(this._crtConnectionStatus!==pt.SUSPENDED)return;this.setConnectionStatus(pt.CONNECTING,t);const{code:s,isOk:n}=yield this.try2Connect(this.token,!0,e,i,!1);this.reconnectTimer=null,n?this.setConnectionStatus(pt.CONNECTED):[ne.SERVER_UNAVAILABLE,ne.TIMEOUT,ne.RC_SOCKET_DISCONNECTED,ne.RC_SOCKET_NOT_CREATED,ne.RC_CONN_ACK_TIMEOUT,ne.RC_TCP_RESET,ne.RC_NAVI_REQ_FAILED,ne.RC_NETWORK_DOWN,ne.RC_TCP_DISCONNECTED_NO_RMTP].includes(s)?this._crtConnectionStatus===pt.CONNECTING&&(this.setConnectionStatus(pt.SUSPENDED,s),this.reconnectTimer=setTimeout(r,5e3)):this.setConnectionStatus(pt.DISCONNECTED,s)}));r()}))}onDisconnectByServer(e,t){return rr(e)?(this.setConnectionStatus(pt.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===ne.RC_UDP_DISCONNECTED?(this.setConnectionStatus(pt.SUSPENDED,e),void setTimeout((()=>{this.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(pt.DISCONNECTED,e)}onDisconenctUnusual(e){this.setConnectionStatus(pt.SUSPENDED,e),this.try2Reconnect(!1,e)}checkAlive(){return _(this,void 0,void 0,(function*(){const e="L-check_alive_im-R",t="L-check_alive_im-S";if(this._crtConnectionStatus!==pt.CONNECTED)return this._failedCount=0,void this.logger.debug(t,"stop ping because of no connection");const i=this.logger.createTraceId();this.logger.debug("L-check_alive_im-T",null,i);const r=yield this.sendPing(15e3);if(r===ne.SUCCESS)return this.logger.debug(e,r,i),this._failedCount=0,void(this._checkAliveTimer=setTimeout((()=>this.checkAlive()),15e3));if(this._crtConnectionStatus===pt.CONNECTED){if(this._failedCount+=1,this.logger.debug(e,`code: ${r}, count: ${this._failedCount}`,i),this._failedCount<this.ALLOW_FAILED_TIMES)return this.checkAlive();this._failedCount=0,this.logger.warn(t,"ping timeout, close connection to reconnect!"),yield this.close(!0),this.setConnectionStatus(pt.SUSPENDED,ne.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,ne.RC_PING_EXCEED_LIMIT)}}))}disconnect(e,t){return _(this,void 0,void 0,(function*(){return this.stopReconnectTimer(),this._crtConnectionTask&&(yield this._crtConnectionTask),this.setConnectionStatus(pt.DISCONNECTED,ne.ACTIVE_DISCONNECT),this.close(!1,e,t)}))}stopReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}getCmpList(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return[...this.cmpWeightCache];const i=si(e,t);return this.cmpWeightCache=[...i],[...i]}updateCmpWeight(e,t,i){if(!this.cmpWeightCache)return;const r=this.cmpWeightCache.find((t=>i?t.addr===e&&t.protocol===fe.QUIC:t.addr===e));if(r)if(t){const e=Math.max(...this.cmpWeightCache.map((e=>e.weight)));r.weight!==e&&(r.weight=e+1)}else{const e=Math.min(...this.cmpWeightCache.map((e=>e.weight)));r.weight!==e&&(r.weight=e-1),r.failed=!0}}clearCmpWeightCache(){this.cmpWeightCache=void 0}reconnect(e,t,i,r){this.token=e,this._openCallPlus=i,this.onDisconenctUnusual(r)}}ir=new WeakMap,zi=new WeakSet,er=function(){return this},tr=function(){this.uuid=Zt.gen(),this.retryCount=0};const nr=e=>e.replace(/@.+$/,"@");class or{constructor(e,t,i,r=!0,s=!0,n=!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:r}),Object.defineProperty(this,"isUseDynamicNaviUrl",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"useNaviV2",{enumerable:!0,configurable:!0,writable:!0,value:n}),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,t,i,r,s){return _(this,void 0,void 0,(function*(){if(this.crtRequest)return this.crtRequest;this.crtRequest=this.sendRequest(e,t,i,r,s);const n=yield this.crtRequest;return this.crtRequest=null,n}))}sendRequest(e,t,i,r,s){return _(this,void 0,void 0,(function*(){var n;const o="L-get_navi-R",a=nr(e),l=this.getNaviCache(a);if(!t&&l){const{timestamp:e,naviInfo:t}=l;if(i||Date.now()-e<xt){if(this.logger.info(T,JSON.stringify({fromCache:!0,naviInfo:t}),r),s){const{uuid:e,retryCount:i,reason:o}=s,a={bid:hi(),ptc:bt.NAVI,cod:ne.SUCCESS,net:s.type,dur:0,spr:0,pr:null!==(n=t.type)&&void 0!==n?n:0,hos:"",cache:Pt.LOCAL,v:Lt.CURRENT,rsn:o,cid:`${e}_${i}`,count:i};this.logger.record(Ct.IM_NAVI,JSON.stringify(a),r)}return gi(t)}}const c=bi.getNaviUrlList(e,this.isUseDynamicNaviUrl);this.logger.info("L-get_navi-T",JSON.stringify({token:e,uris:c}),r);let{code:h,data:u}=yield this.requestHandler(c,e,r,s);if(h===ne.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,n=yield this.requestHandler(i,e,r,s);h=n.code,u=n.data}}if(h!==ne.SUCCESS)return this.logger.warn(o,h,r),Ri(h);const d=u;if(d.code&&200!==d.code)return this.logger.warn(o,d.code,r),Ri(this.transHttpCode(d.code));if(!(si(d).length>0)){const e={server:d.server,backupServer:d.backupServer,serverAddr:d.serverAddr,bs:d.bs};return this.logger.warn(o,`navi server address invalid: ${JSON.stringify(e)}`,r),Ri(ne.SERVER_UNAVAILABLE)}return this.logger.info(o,JSON.stringify({naviInfo:d}),r),this.setNaviCache(a,d),gi(d)}))}requestHandler(e,t,i,r){return _(this,void 0,void 0,(function*(){for(let s=0,n=e.length;s<n;s+=1){const n=s===e.length-1,o=this.useV2Navi()?this.httpRequestV2:this.httpRequest,a=Date.now(),{code:l,data:c}=yield o.call(this,e[s],this.appkey,t,i,n),h={bid:hi(),ptc:bt.NAVI,cod:l,net:null==r?void 0:r.type,dur:Date.now()-a,spr:0,pr:(null==c?void 0:c.type)||0,hos:e[s],cache:Pt.REQUEST,v:Lt.CURRENT,rsn:null==r?void 0:r.reason,cid:`${null==r?void 0:r.uuid}_${null==r?void 0:r.retryCount}`,count:null==r?void 0:r.retryCount};if(this.logger.record(Ct.IM_NAVI,JSON.stringify(h),i),[ne.SUCCESS,ne.RC_CONN_TOKEN_INCORRECT,ne.RC_LICENSE_EXPIRED].includes(l))return l===ne.SUCCESS?gi(c):Ri(l)}return Ri(ne.RC_NAVI_REQ_FAILED)}))}transHttpCode(e){switch(e){case 401:case 403:return ne.RC_CONN_TOKEN_INCORRECT;case 416:return ne.RC_LICENSE_EXPIRED;default:return ne.RC_NAVI_REQ_FAILED}}getNaviInfoFromCache(e){const t=this.getNaviCache(nr(e));return t?t.naviInfo:null}updateVoipCallInfo(e,t){const i=this.getNaviInfoFromCache(e);i&&this.setNaviCache(nr(e),Object.assign(Object.assign({},i),{voipCallInfo:t}))}getNaviV2RequestOption(e){const{uri:t,token:i,platform:r,protocol:s,mac:n}=e;let o="";o=`${t}/v2/navi.json?cloud=0`;let a=`token=${encodeURIComponent(i)}&v=${Yt}&platfrom=${r}`;return n&&(a+=`&m=${n}`),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":`conn=${s};rtc=4;log=2;iptype=v4,v6`},body:a,url:o,timeout:1e4}}useV2Navi(){return!0}}const ar=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}],[st,{isCounted:!1,isPersited:!0}],["RC:ContactNtf",{isCounted:!1,isPersited:!0}],["RC:ProfileNtf",{isCounted:!1,isPersited:!0}],[rt,{isCounted:!1,isPersited:!0}],[nt,{isCounted:!1,isPersited:!0}],["RC:RcNtf",{isCounted:!1,isPersited:!0}],[it,{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 lr(){return Array.from(ar.keys()).map((e=>Object.assign({objectName:e},ar.get(e)))).filter((e=>!e.isCustom))}const cr=0,hr=0,ur=4,dr=5;var Er;!function(e){e.P_INIT_O="P-init-O",e.P_DB_OPEN_O="P-db_open-O",e.P_DB_UPGRATE_START_S="P-db_upgrate_start-S",e.P_DB_UPGRATING_S="P-db_upgrating-S",e.P_DB_UPGRATE_COMPLETE_S="P-db_upgrate_complete-S",e.P_CALL_MAIN_SYNC_E="P-call_main_sync-E",e.P_CALL_MAIN_E="P-call_main-E",e.P_SEND_2_MAIN_E="P-send_2_main-E",e.P_CALL_ADDON_E="P-call_addon-E",e.P_CALL_ADDON_T="P-call_addon-T",e.P_CALL_ADDON_O="P-call_addon-O",e.P_CALL_ADDON_R="P-call_addon-R",e.P_CALL_EXTRA_E="P-call_extra-E",e.P_CONNECT_S="P-connect-S",e.P_CONNECT_T="P-connect-T",e.P_CONNECT_R="P-connect-R",e.P_CONNECT_E="P-connect-E",e.P_CONNECT_ENTRY_S="P-connect_entry-S",e.P_REPORT_VER_O="P-report_version-O",e.P_PARSE_JSON_MSGS_E="P-parse_json_messsages-E",e.P_PARSE_JSON_MSGS_R="P-parse_json_messsages-R",e.P_RECEIVE_MESSAGE_E="P-receive_message-E",e.P_HTTP_REQ_E="P-http_request-E",e.P_SET_MSG_EXTEN_O="P-set_msg_extension-O",e.P_SEND_MSG_T="P-send_msg-T",e.P_SEND_MSG_R="P-send_msg-R",e.P_PARSE_JSON_SUBSCRIBE_DATA_E="P-parse_json_subscribe_data-E",e.P_PARSE_JSON_USER_PROFILE_E="P-parse_json_user_profile-E",e.P_PARSE_JSON_USER_PROFILE_LIST_E="P-parse_json_user_profile_list-E",e.P_WRITE_LOG_O="P_WRITE_LOG_O",e.P_PARSE_JSON_E="P-parse_json-E",e.L_HANDLE_LOW_PRIORITY_MESSAGES_T="L-handle_low_priority_messages-T",e.L_HANDLE_LOW_PRIORITY_MESSAGES_R="L-handle_low_priority_messages-R",e.L_JS_FUNC_EXEC_O="L-js_func_execute-O",e.L_JS_FUNC_EXEC_E="L-js_func_execute-E",e.L_HADNLE_RECALL_CMD_T="L-handle_recall_cmd-T",e.L_HADNLE_RECALL_CMD_R="L-handle_recall_cmd-R"}(Er||(Er={}));const Ir=e=>{if(o.existsSync(e))return;const i=t.resolve(e,"..");o.existsSync(i)||Ir(i),o.mkdirSync(e)},_r=e=>Object.entries(e).map((([e,t])=>({key:e,value:String(t)}))),fr=e=>({removeMute:!!(null==e?void 0:e.removeMuteStatus),removeWhiteList:!!(null==e?void 0:e.removeWhiteList),removeFavoriteMembers:!!(null==e?void 0:e.removeFollow)}),gr=()=>"undefined"==typeof __dirname?t.dirname(a.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:I&&"SCRIPT"===I.tagName.toUpperCase()&&I.src||new URL("index.cjs",document.baseURI).href)):__dirname;function Rr(e){return JSON.parse(e).list.map((e=>e.value))}const pr=t.resolve(gr(),"binding",`electron-${r.platform()}-${r.arch()}.node`),Tr={addon:null};try{let e=require;Tr.addon=e(pr)}catch(e){console.error("error ->",pr,"\n",e)}Tr.addon||console.error("error -> cannot find module: ",pr);const Nr=Tr.addon,Sr=(e,t)=>{let i,r=Buffer.from(e),s=r.length;for(t.push(s),i=0;i<s;i++)t.push(r[i])},Or=e=>"string"==typeof e,Cr=e=>Or(e)?e.toUpperCase():"",vr=(e,t)=>{let i="";return 2!==e.length?i="Unexpected number of bytes received.":5!==e[0]?i=`Unexpected SOCKS version number: ${e[0]}.`:255===e[1]?i="No acceptable authentication methods were offered.":-1===t.indexOf(e[1])&&(i=`Unexpected SOCKS authentication method: ${e[1]}.`),i},mr=e=>{let t="";return 2!==e.length?t="Unexpected number of bytes received.":1!==e[0]?t=`Unexpected authentication method code: ${e[0]}.`:0!==e[1]&&(t=`Username and password authentication failure: ${e[1]}.`),t};var Ar=e=>{let t=Cr(e.method)||"GET";const i=e.pathname||"/",r=e.headers||{},s=e.search||"";r.Host=e.host||"loclahost";let n="";n=`${t} ${i+s} HTTP/1.1\n`;for(const e in r)if(Object.hasOwnProperty.call(r,e)){n+=`${e}: ${r[e]}\n`}return e.body&&(n+=`Content-Length: ${e.body.length}\n`),n+="\n","POST"===t&&e.body&&(n+=`${e.body}`),n},Mr=e=>new Promise((t=>{let i,r;e.socket.once("data",(r=>{let s,n=vr(r,i);if(!n)return 2===r[1]?(e.socket.once("data",(i=>{let r=mr(i);r?e.emit("error",new Error(`SOCKS authentication failed. ${r}`)):t()})),s=[1],Sr(e.socksUsername,s),Sr(e.socksPassword,s),void e.write(Buffer.from(s))):void t();e.emit("error",new Error(`SOCKS authentication failed. ${n}`))})),i=[0],e.socksUsername&&i.push(2),r=Buffer.alloc(2+i.length),r[0]=5,r[1]=i.length,i.forEach(((e,t)=>{r[2+t]=e})),e.write(r)})),yr=(e,t,i)=>new Promise((r=>{let s,n;switch(e.socket.once("data",(t=>{let i;5!==t[0]?i=`Unexpected SOCKS version number: ${t[0]}.`:0!==t[1]?i=`${(e=>{switch(e){case 1:return"General SOCKS server failure";case 2:return"Connection not allowed by ruleset";case 3:return"Network unreachable";case 4:return"Host unreachable";case 5:return"Connection refused";case 6:return"TTL expired";case 7:return"Command not supported";case 8:return"Address type not supported";default:return`Unknown status code ${e}`}})(t[1])}.`:0!==t[2]&&(i="The reserved byte must be 0x00."),i?e.emit("error",new Error(`SOCKS connection failed. ${i}`)):r()})),s=[],s.push(5),s.push(1),s.push(0),u.isIP(t)){case 0:s.push(3),Sr(t,s);break;case 4:s.push(1),((e,t)=>{let i,r,s=e.split(".");for(i=0;i<4;i++)r=parseInt(s[i],10),t.push(r)})(t,s);break;case 6:e.emit("error",new Error("Does not support IPV6"))}s.length+=2,n=Buffer.from(s),n.writeUInt16BE(i,n.length-2),e.write(n)}));class br extends d.EventEmitter{constructor(e){super(),Object.defineProperty(this,"socket",{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,"socksHost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"socksPort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"socksUsername",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"socksPassword",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"readable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.socket=new u.Socket,this.options=e,this.socksHost=e.socksHost||"localhost",this.socksPort=e.socksPort||1080,this.socksUsername=e.socksUsername||"",this.socksPassword=e.socksPassword||"",this.socket.on("error",(e=>{this.emit("error",e)})),this.on("error",(()=>{this.socket.destroyed||this.socket.destroy()})),this.on("end",this.end)}ref(){return this.socket.ref()}unref(){return this.socket.unref()}setTimeout(e,t){return this.socket.setTimeout(e,t)}setNoDelay(e){return this.socket.setNoDelay(e)}setKeepAlive(e,t){return this.socket.setKeepAlive(e,t)}address(){return this.socket.address()}cork(){return this.socket.cork()}uncork(){return this.socket.uncork()}pause(){return this.socket.pause()}resume(){return this.socket.resume()}pipe(e){return this.socket.pipe(e)}end(e,t){let i=this.socket.end(e,t);return this.writable=this.socket.writable,i}destroy(e){return this.socket.destroy(e)}setEncoding(e){return this.socket.setEncoding(e)}write(e,t,i){return this.socket.write(e,t,i)}read(e){return this.socket.read(e)}connect(e,t){if("string"==typeof e&&/^\d+$/.test(e)&&(e=parseInt(e,10)),!Number.isInteger(e)||e<1||e>65535)throw new TypeError(`Invalid port: ${e}`);if(!t||"string"!=typeof t)throw new TypeError(`Invalid host: ${t}`);return this.socket.connect({port:this.socksPort,host:this.socksHost},(()=>_(this,void 0,void 0,(function*(){yield Mr(this),yield yr(this,t,e),this.onProxied();const i=Ar(this.options);this.socket.write(Buffer.from(i))})))),this}onProxied(){this.socket.on("close",(e=>{this.emit("close",e)})),this.socket.on("end",(()=>{this.emit("end")})),this.socket.on("data",(e=>{this.emit("data",e)})),this.writable=!0,this.readable=!0,this.emit("connect")}}const Pr=e=>{let t,{hostname:i,port:r}=e;return!e.host||i&&r||(t=e.host.split(":")),!r&&t&&(r=parseInt(t[1],10)||0),!i&&t&&([i]=t),new br(e).connect(r,i)};class Lr extends l.Agent{constructor(e){super(),Object.defineProperty(this,"createConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.createConnection=Pr}}const Ur=(e,t,i)=>((t=Object.assign(Object.assign({},t),a.parse(e))).port||(t.port=80),t.agent=new Lr(t),l.request(t,i)),Dr=e=>{let t,i;return t=Pr(e),i=t.onProxied,t.onProxied=()=>{e.socket=t.socket,e.hostname?e.servername=e.hostname:e.host&&([e.servername]=e.host.split(":")),t.socket=E.connect(e,(()=>{t.authorized=t.socket.authorized,i.call(t)})),t.socket.on("error",(e=>{t.emit("error",e)}))},t};class wr extends c.Agent{constructor(e,t){super(t),Object.defineProperty(this,"socksHost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"socksPort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"createConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=e,this.socksHost=t.socksHost||"localhost",this.socksPort=t.socksPort||1080,this.createConnection=Dr}}const Vr=(e,t,i,r)=>{let s;return t.protocol="https:",!t.port&&t.host&&([t.port,t.port]=t.host.split(":")),t.port||(t.port=443),s=new wr(e,t),t.agent=s,c.request(e,t,i)};let kr=null;function Gr(e,t,i=!1){return Fr(e,Object.assign(Object.assign({},t),{headers:Si(t.headers)}),i)}function Fr(e,t,i=!1){const{url:r,headers:s,body:n,method:o,query:a,timeout:u=Jt}=t;return new Promise((t=>{const d=/^https/.test(r);let E={headers:Object.assign(Object.assign({},s),{"Accept-Encoding":"gzip, br"}),method:o};d&&(E.rejectUnauthorized=i);let I=null;kr?(E=Object.assign(Object.assign({},E),kr),E.body=n,I=d?Vr:Ur):(I=l.request,d&&(E.agent=new c.Agent(E),I=c.request));const _=I(ai(r,a),E,(e=>{var i,r;const s=e.statusCode;let n="";if("gzip"===(null===(i=e.headers)||void 0===i?void 0:i["content-encoding"])){const i=h.createGunzip();e.pipe(i),i.on("data",(e=>{n+=e})),i.on("end",(()=>{t({status:s,data:n})}))}else if("br"===(null===(r=e.headers)||void 0===r?void 0:r["content-encoding"])){const i=h.createBrotliDecompress();e.pipe(i),i.on("data",(e=>{n+=e})),i.on("end",(()=>{t({status:s,data:n})}))}else e.setEncoding("utf8"),e.on("data",(e=>{n+=e})),e.once("end",(()=>{t({status:s||0,data:n})}))}));_.once("timeout",(()=>{e.warn(Er.P_HTTP_REQ_E,JSON.stringify({msg:"timeout",url:r,method:o,query:a,timeout:u})),t({status:0})})),_.setTimeout(u),_.once("error",(i=>{e.warn(Er.P_HTTP_REQ_E,JSON.stringify({msg:i.stack,url:r,method:o,query:a,timeout:u})),t({status:0})})),_.write(n),_.end()}))}function Br(e,t){return e?(kr=Object.assign(Object.assign({},kr),e),t.info("L-set_proxy-O",JSON.stringify({socks5Proxy:kr})),gi()):(kr=null,t.info("A-remove_proxy-O"),gi())}function Hr(){return gi(kr||void 0)}var xr;!function(e){e[e.ERROR=-1]="ERROR",e[e.RESPONSE=0]="RESPONSE",e[e.CALLBACK=1]="CALLBACK"}(xr||(xr={}));class Jr{constructor(e,t,i,r){Object.defineProperty(this,"p",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"emit",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"callback",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"errorHandle",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"count",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maps",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this.p.on("message",(e=>{const{type:t,data:s}=e;switch(t){case xr.RESPONSE:{const{reqId:e,success:t,data:i}=s,r=this.maps[e];if(!r)return;r({success:t,data:i}),delete this.maps[e];break}case xr.CALLBACK:null==i||i(s);break;case xr.ERROR:{const{msg:e}=s;null==r||r(e)}}})),this.p.on("error",(e=>{null==r||r(`SubProcessProxy error ${e}`)})),this.p.on("exit",((e,t)=>{if(0!==e){for(const e in this.maps)if(Object.prototype.hasOwnProperty.call(this.maps,e)){(0,this.maps[e])({success:!0,data:{code:ne.SUB_PROCESS_EXIT,msg:"sub process exit"}})}null==r||r(`SubProcessProxy exit ${e} ${t}`,!0)}})),this.p.on("close",((e,t)=>{console.log("SubProcessProxy close",e,t)}))}call(e,...t){return _(this,void 0,void 0,(function*(){return this.p.killed||this.p.exitCode?Promise.resolve({success:!1,data:{code:ne.SUB_PROCESS_EXIT,msg:"sub process exit"}}):new Promise((i=>{const r=++this.count;this.maps[r]=i;const s={reqId:r,method:e,args:t,hasResponse:!0};this.p.send(s)}))}))}send(e,...t){return _(this,void 0,void 0,(function*(){var i;(this.p.killed||this.p.exitCode)&&(null===(i=this.errorHandle)||void 0===i||i.call(this,"sub process exit"));const r={reqId:-1,method:e,args:t};this.p.send(r)}))}destroy(){this.send("destroy")}}const Yr=(e,t,i)=>_(void 0,void 0,void 0,(function*(){const{startTime:r,endTime:s,level:n,isRealtimeReport:o}=e,a=yield((e,t,i,r,s)=>_(void 0,void 0,void 0,(function*(){const{resolve:n,promise:o}=Ni();Nr.getLog(e,t,i,r,(e=>{n(gi(e))}),(e=>{n(Ri(e))}));const a=yield o;if(!a.isOk)return a.wipe();let l=0;const c=JSON.parse(a.data).filter((e=>(l+=(e=>e.content.length+e.tag.length+e.sessionId.length+e.type.length+2+13+6)(e),!!s||e.level>0)));return gi({logs:c,size:l})})))(n,r,s,300,o);if(!a.isOk)return;let{logs:l,size:c}=a.data;if(0===l.length)return;if((t+=c)>=20971520)return;if(l.length<300)return void i.push(...l);let{time:h}=l[l.length-1];return r===h&&(h+=1),e.startTime=h,i.push(...l.filter((e=>e.time<h))),Yr(e,t,i)})),jr=[];let Wr=!1;const Kr=()=>_(void 0,void 0,void 0,(function*(){if(Wr||0===jr.length)return;Wr=!0;const e=jr.shift(),{resolve:t,args:i}=e,r=[];yield Yr(i,0,r),t({logs:r,dbReady:!0}),Wr=!1,Kr()}));class Xr extends Di{constructor(e,t,i,r=!1,s){super(e,`Electron|${process.versions.electron}|${process.arch}|${process.platform}`,s,i,r),Object.defineProperty(this,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_subProcess",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}getDeviceId(){return this.deviceId}send(e){return Gr(this.logger,e)}stop(){this._subProcess&&this._subProcess.destroy(),super.stop()}compressLogs(e){return _(this,void 0,void 0,(function*(){if(!this._subProcess){const e="sub-process.cjs.js",i=s.fork(t.resolve(gr(),e),{stdio:["inherit","inherit","inherit","ipc"]});this._subProcess=new Jr(i)}const{success:i,data:r}=yield this._subProcess.call("compressLogs",e);return i?{success:i,data:r.data}:{success:i,data:""}}))}}const Zr="rc-realtime-log-timestamp";let qr=!1;const Qr=()=>{const e=new Wi(Yi,ji);return e.setLogReader(((e,t,i,r)=>_(void 0,void 0,void 0,(function*(){const{logs:s}=yield(n={startTime:e,endTime:t,level:i,isRealtimeReport:r},_(void 0,void 0,void 0,(function*(){return new Promise((e=>{jr.push({resolve:e,args:n}),Kr()}))})));var n;return{logs:s}})))),e.setLogWriter((e=>{es(e)})),e};let $r,zr=[];const es=e=>{qr&&(zr.push(e),$r||($r=setImmediate((()=>(()=>{if($r&&(clearImmediate($r),$r=null),!zr.length)return;const e=zr.splice(0).map((e=>{const{sessionId:t,level:i,time:r,type:s,tag:n,loggerId:o,content:a,traceId:l}=e;return{level:i,time:r,type:s,tag:n,sessionId:`${qt}:${qt===t?"main":t}`,content:JSON.stringify({loggerId:o,content:a,traceId:l})}})),t=JSON.stringify(e);Nr.writeLog(t)})()))))};class ts extends Ui{constructor(e,t,i,r){super(e,t,i,r),qr||(qr=!0)}getTimestamp4RealtimeLog(){const e=Nr.getStoreValue(Zr);return parseInt(e,10)||0}setTimestamp4RealtimeLog(e){Nr.setStoreValue(Zr,e.toString())}recvRendererLog(e){this._stdout(e),this._write(e)}destroy(){qr=!1}}const is=()=>{const e=Date.now(),t=[r.arch(),r.platform(),process.pid,e,Math.floor(Math.random()*e)].join("__");return i=t,n.createHash("md5").update(i).digest("hex");var i};class rs{constructor(e){Object.defineProperty(this,"_callCppProxy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_setTime",{enumerable:!0,configurable:!0,writable:!0,value:15962112e5})}_setToProtocol(e,t,i){const r=JSON.stringify(i);"{}"!==r&&e.info(Er.P_SET_MSG_EXTEN_O,JSON.stringify({messageUId:t,ext:i})),this._callCppProxy("setMessageExtension",1,"1",t,r,"")}setLocalFromExtMsg(e,t){const{channelId:i,conversationType:r,targetId:s,content:n,sentTime:o}=t,a=n,l=a.put,c=this._callCppProxy("getMessage",a.mid),h=JSON.parse(c).extMsg,u=JSON.parse(h||"{}");if(l)for(const e in l){const t=u[e];t&&t.ts<o-this._setTime?(t.v=l[e],t.ts=o-this._setTime):(u[e]={v:"",ts:0},u[e].v=l[e],u[e].ts=o-this._setTime)}a.del&&a.del.forEach((e=>{delete u[e]})),this._setToProtocol(e,a.mid,u)}parseReceiveExpansion(e){const t=JSON.parse(e.extMsg||"{}"),i={};for(const e in t)i[e]=t[e].v;return i}}const ss=[fe.RMTP,fe.TLS];"darwin"===process.platform&&ss.push(fe.QUIC);const ns=e=>`RongCloud/navis/${e}/navi-cache.json`,os=e=>`RongCloud/caches/${e}/staticConfig.json`,as=e=>`RongCloud/cloudControl/${e}/cloudControl.json`;function ls(e="IPv4"){const t=r.networkInterfaces(),i=[];for(const r of Object.values(t))if(r&&-1!==Object.prototype.toString.call(r).indexOf("Array")){const t=r.filter((t=>{return!(t.internal||(i=t.mac,/^(0{1,2}[:-]){5}0{1,2}$/.test(i))||t.family&&t.family!==e);var i})).map((e=>e.mac));i.push(...t)}return i.length?[...i].sort()[0]:""}class cs extends or{constructor(e,i,r,s){super(e,i,s),Object.defineProperty(this,"naviPath",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_caches",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this.naviPath=`${r}/${ns(e)}`;const n=t.dirname(this.naviPath);o.existsSync(n)||Ir(n)}httpRequest(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=`token=${encodeURIComponent(i)}&v=${Yt}&p=PC&ev=5.48.1&m=${ls()}`,n=`${e}/navi.json?r=${Date.now()}&env=${this._environment}`;this.logger.info(T,JSON.stringify({url:n,body:s}),r);const o=yield Gr(this.logger,{method:"POST",headers:{appId:t},body:s,url:n,timeout:1e4});if(200!==o.status)return this.logger.warn(N,JSON.stringify({url:n,code:o.status}),r),Ri(this.transHttpCode(o.status));this.logger.info(N,JSON.stringify({url:n,data:o.data}),r);try{const e=JSON.parse(o.data),t=/^https/.test(n)?"https":"http";return e.protocol=t,e.code&&200!==e.code?Ri(this.transHttpCode(e.code)):gi(e)}catch(e){return this.logger.error(S,o.data,r),Ri(ne.RC_NAVI_REQ_FAILED)}}))}httpRequestV2(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=this.getNaviV2RequestOption({appkey:t,token:i,uri:e,platform:"electron",protocol:ss.join(","),mac:ls()});this.logger.info(T,JSON.stringify({url:s.url,body:s.body,headers:s.headers}),r);const n=yield Gr(this.logger,s);if(200!==n.status)return this.logger.warn(N,JSON.stringify({url:s.url,code:n.status}),r),Ri(this.transHttpCode(n.status));this.logger.info(N,JSON.stringify({url:s.url,data:n.data}),r);try{const e=JSON.parse(n.data),t=/^https/.test(s.url)?"https":"http";return e.protocol=t,gi(e)}catch(e){return this.logger.error(S,n.data,r),Ri(ne.RC_NAVI_REQ_FAILED)}}))}getNaviCache(e){const t=this.getCatchKey(e),i=this._caches[t];if(i)return i;if(!o.existsSync(this.naviPath))return null;const r=o.readFileSync(this.naviPath,{encoding:"utf8"});try{this._caches=JSON.parse(r);return this._caches[t]}catch(e){this.logger.error(S,r)}return null}setNaviCache(e,t){const i=Date.now(),r=this.getCatchKey(e);if(ei(this._caches))for(const e in this._caches){(i-this._caches[e].timestamp>xt||r===e)&&delete this._caches[e]}this._caches[r]={token:e,naviInfo:t,timestamp:Date.now(),environment:this._environment},o.writeFileSync(this.naviPath,JSON.stringify(this._caches))}setEnvironment(e){this._environment=e}setUseNaviV2(e){this.useNaviV2=e}}var hs,us,ds,Es,Is,_s;function fs(e,t,i,...r){const s=e.createTraceId();let n;if(e.info(Er.P_CALL_ADDON_T,JSON.stringify({method:i,params:r}),s),!Nr[i])throw e.error(Er.P_CALL_ADDON_E,`Method ${i} not found in addon`,s),new Error(`Method ${i} not found in addon`);try{n=Nr[i](...r)}catch(t){throw e.error(Er.P_CALL_ADDON_E,JSON.stringify({stack:null==t?void 0:t.stack,method:i}),s),t}return e.info(Er.P_CALL_ADDON_R,JSON.stringify({method:i,result:t?n:void 0}),s),n}class gs{static create(e,t,i){return new gs(e,t,null!=i?i:e.createTraceId())}constructor(e,t,i){hs.add(this),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_method",{enumerable:!0,configurable:!0,writable:!0,value: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,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._traceId=null!=i?i:this._logger.createTraceId(),this._promise=new Promise((e=>{this._resolve=e}))}invoke(...e){return f(this,hs,"m",us).call(this,!0,...e)}asyncInvoke(...e){return f(this,hs,"m",us).call(this,!1,...e)}ok(e){this._flush(gi(e))}fail(e,t){this._flush(Ri(e,"",t))}_flush(e){this._logger.summary(Er.P_CALL_ADDON_R,e,this._traceId),setImmediate((()=>this._resolve(e)))}flush(e){this._flush(e)}result(){return this._promise}}hs=new WeakSet,us=function(e,...t){let i;const{_method:r,_traceId:s,_logger:n}=this;n.info(Er.P_CALL_ADDON_T,JSON.stringify({method:r,params:t}),s);try{i=Nr[r](...t)}catch(e){throw n.error(Er.P_CALL_ADDON_E,JSON.stringify({stack:null==e?void 0:e.stack,method:r}),s),e}return e&&i!==ne.SUCCESS&&this.fail(i),this},function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED",e[e.CANCELLED=2]="CANCELLED",e[e.SKIPPED=3]="SKIPPED"}(_s||(_s={}));class Rs extends sr{getConnectedTime(){return this._connectedTime}constructor(e,t,i,r){super(e,i,r),ds.add(this),Object.defineProperty(this,"callCppProxy",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_connectedTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_naviInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_excludeLogTag",{enumerable:!0,configurable:!0,writable:!0,value:["P-API_RCGetValueForKey-T","P-API_RCGetValueForKey-E","P-API_RCGetValueForKey-R","P-API_RCSetValueForKey-T","P-API_RCSetValueForKey-E","P-API_RCSetValueForKey-R"]}),Object.defineProperty(this,"_connectingTask",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_tcpDuration",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pingResolve",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.callCppProxy("setConnectionStatusListener",f(this,ds,"m",Es).bind(this),((e,t,i)=>{this.logger.info(Er.P_DB_OPEN_O,JSON.stringify({code:e,recreate:t,recreateReason:i})),this.emit("onDBOpen",e,t,i)}),(()=>this.recvPong(ne.SUCCESS)),f(this,ds,"m",Is).bind(this),this._onHandshakeResult.bind(this),(()=>{this.logger.info(Er.P_DB_UPGRATE_START_S),this.emit("onDBUpgrateStart")}),(e=>{this.logger.info(Er.P_DB_UPGRATING_S,e),this.emit("onDBUpgrading",e)}),(e=>{this.logger.info(Er.P_DB_UPGRATE_COMPLETE_S,e),this.emit("onDBUpgradeComplete",e)}))}_connectWithToken(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=this._connectingTask=gs.create(this.logger,"connectWithToken",r);this.curCmpUrl="",this._naviInfo=t;let n={};const{data:o}=Hr();o&&(n={proxy_passwd:o.socksPassword||"",proxy_name:o.socksUsername||"",proxy_port:o.socksPort||1082,proxy_host:o.socksHost||"localhost",proxy_type:0});const a=JSON.stringify(Object.assign(Object.assign({},n),{call_plus:this._openCallPlus,cid:this.cid})),l=this.getCmpList(t,!0).filter((e=>ss.includes(e.protocol))).sort(((e,t)=>t.weight-e.weight)),c=[];l.forEach((e=>{const t=c.find((t=>t.addr===e.addr));t?t.protocol!==fe.QUIC&&e.protocol!==fe.QUIC||(t.race=!0,t.protocol=fe.QUIC):(e.race=!1,c.push(e))})),this.logger.info(Er.P_CONNECT_T,JSON.stringify({}),r);const h=Date.now(),u=yield s.asyncInvoke(e,Yt,JSON.stringify(Object.assign(Object.assign({},t),{serverAddr:c,tagBlacklist:this._excludeLogTag.join(",")})),i,a).result();this.logger.summary(Er.P_CONNECT_R,u,r,{data:u.data});const{cid:d,userId:E,sessionId:I}=JSON.parse(u.data),_=Date.now()-(h+this._tcpDuration),f={bid:hi(),cod:u.code,net:this.getNetwork().type,dur:_,spr:0,cid:d,v:Lt.CURRENT,count:this.retryCount,sts:Date.now(),ssid:I};return this.logger.record(Ct.IM_CMP_RMTP,JSON.stringify(f)),this._connectingTask=null,u.trans((e=>(this._connectedTime=Date.now()-this.callCppProxy("getDeltaTime"),E)))}))}close(e,t,i){return _(this,void 0,void 0,(function*(){if(!e){const e=gs.create(this.logger,"disconnect");yield e.asyncInvoke("boolean"!=typeof t||t,!!i,(()=>e.ok()),(t=>e.fail(t))).result()}}))}sendPing(e){return new Promise((t=>{this.pingResolve=t,this.callCppProxy("sendHeartbeat"),setTimeout((()=>this.recvPong(ne.TIMEOUT)),e)}))}recvPong(e){this.pingResolve&&(this.pingResolve(e),this.pingResolve=null)}recvConnectRes(e,t,i){t?this.onDisconnectByServer(e,i):e===ne.RC_SOCKET_DISCONNECTED&&this.getConnectionStatus()!==pt.CONNECTED||this.onDisconenctUnusual(e)}_onHandshakeResult(e){var t;const{code:i,outcome:r,route_selected:s,target_addr:{host:n,port:o,index:a,mode:l},timing:{transport_duration:c,dns_duration:h}}=e,u=4===l,d=this.cmpWeightCache.findIndex((e=>e.addr===`${n}:${o}`)),E={bid:hi(),ptc:bt.TCP,cod:i,net:this.getNetwork().type,dur:c,spr:0,pr:(null===(t=this._naviInfo)||void 0===t?void 0:t.type)||0,hos:`${n}:${o}`,idx:d,rct:this.retryCount?Ut.RECONNECT:Ut.CONNECT,cid:this.cid,v:Lt.CURRENT,rsn:this._doConnectReason,ddu:h,count:this.retryCount,weight:d>=0?this.cmpWeightCache[d].weight:-1};if(this.logger.record(Ct.IM_CMP,JSON.stringify(E)),this.logger.info(Er.P_CONNECT_ENTRY_S,JSON.stringify({code:i,host:n,port:o,duration:c,dnsDuration:h,index:a,isQuic:u})),s&&(this.curCmpUrl=`${n}:${o}`),r===_s.SUCCESS)this.updateCmpWeight(`${n}:${o}`,!0,u);else if(r===_s.FAILED){const e=o&&0!==o?`${n}:${o}`:`${n}`;this.updateCmpWeight(e,!1)}}}ds=new WeakSet,Es=function(e,t){10!==e&&(this._connectingTask?e===ne.SUCCESS?this._connectingTask.ok(t):this._connectingTask.fail(e,t):this.logger.warn(Er.P_CONNECT_E,JSON.stringify({msg:"connect complete but no connecting task"})))},Is=function(e,t){switch(this.logger.info(Er.P_CONNECT_S,JSON.stringify({status:e,delay:t})),e){case ne.RC_CONN_REDIRECTED:this.recvConnectRes(e,!0);break;case 11:case 10:case 12:break;case ne.CONNECTION_REFUSED:case ne.RC_SOCKET_DISCONNECTED:case ne.RC_SOCKET_NOT_CREATED:case ne.RC_CONN_ACK_TIMEOUT:case ne.RC_TCP_RESET:this.recvConnectRes(e,!1);break;case ne.RC_UDP_DISCONNECTED:this.recvConnectRes(e,!0,t);break;default:this.recvConnectRes(e,!0)}};class ps extends Pi{constructor(e,i,r){super(e,i),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"dbpath",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_cachePath",{enumerable:!0,configurable:!0,writable:!0,value:""}),this._cachePath=`${r}/${os(e)}`;const s=t.dirname(this._cachePath);o.existsSync(s)||Ir(s)}getCache(){if(!o.existsSync(this._cachePath))return null;return o.readFileSync(this._cachePath,{encoding:"utf8"})||null}setCache(e){o.writeFileSync(this._cachePath,e)}clearCache(){o.writeFileSync(this._cachePath,"")}sendRequest(e){return _(this,void 0,void 0,(function*(){const{status:t,data:i}=yield Gr(this.logger,{url:e,body:""});return{code:t,data:i}}))}decryptData(e){return _(this,void 0,void 0,(function*(){try{const t=yield((e,t,i)=>_(void 0,void 0,void 0,(function*(){const r=n.createDecipheriv("aes-256-cbc",t,i);let s=r.update(e,"base64","utf-8");return s+=r.final("utf8"),s})))(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91");return JSON.parse(t)}catch(e){this.logger.error(v,JSON.stringify({error:null==e?void 0:e.stack}))}}))}}class Ts extends $i{constructor(e,i,r,s,n){super(i,e,r),Object.defineProperty(this,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"catchFilePath",{enumerable:!0,configurable:!0,writable:!0,value:""}),this.model=`Electron|${process.platform}|${process.arch}`,this.catchFilePath=`${n}/${as(e)}`;const a=t.dirname(this.catchFilePath);o.existsSync(a)||Ir(a),this.init()}httpRequest(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=r;s.deviceId=this.deviceId,s.model=this.model;const n={url:e,method:t,headers:i,body:JSON.stringify(s)},o=this.logger.createTraceId();this.logger.info(T,JSON.stringify(n),o);const{status:a,data:l=""}=yield Gr(this.logger,n);this.logger.info(N,JSON.stringify({status:a,data:l}),o);try{const e=JSON.parse(l);return{code:a,data:e.data}}catch(e){return this.logger.warn(m,JSON.stringify({status:a,data:l,error:e})),{code:a,msg:e}}}))}setCloudControllerCache(e){o.writeFileSync(this.catchFilePath,JSON.stringify(e))}getLocalCloudControllerCache(){if(!o.existsSync(this.catchFilePath))return null;return o.readFileSync(this.catchFilePath,{encoding:"utf8"})}setMRTRConfig(e){const t={mrtrChatroom:e.chatroom,mrtrGroup:e.group,mrtrPrivate:e.private,mrtrUltraGroup:e.ultraGroup};this.logger.info(A,JSON.stringify(t)),Nr.setCloudConfig(JSON.stringify(t))}}const Ns=[Ge,tt,Fe,We,Xe,Ye,je,Je,Ke,Ze,qe],Ss=()=>({logCmdQueue:[],cloudControllerVers:[],srsmsgs:[],readNtfs:[],expansionMsgQueue:new Map,v1ReceiptMsgs:[],privateRSMsgs:[],groupRSMsgs:new Map,rrmsgs:new Map,messageUIds:new Set});class Os{constructor(){Object.defineProperty(this,"_report",{enumerable:!0,configurable:!0,writable:!0,value:Ss()}),Object.defineProperty(this,"_count",{enumerable:!0,configurable:!0,writable:!0,value:0})}isLowPriorityMessage(e){return Ns.includes(e)}isEmpty(){return 0===this._count}get count(){return this._count}push(e,t){this._count++;const{messageType:i,senderUserId:r,content:s}=e;if(i!==Ge)if(i!==tt)if(i!==We)if(i!==Fe)if(i!==Je){if(i===Ye){const{messageUId:t}=s;if(!t)return;return this._report.messageUIds.add(t),void this._report.v1ReceiptMsgs.push(e)}if(i===je){const i=s.receiptMessageDic;if(r!==t){const r=i[t];if(!r||0===r.length)return;return r.forEach((e=>this._report.messageUIds.add(e))),void this._report.v1ReceiptMsgs.push(e)}return Object.values(i).forEach((e=>{e.forEach((e=>this._report.messageUIds.add(e)))})),void this._report.v1ReceiptMsgs.push(e)}i!==Ke?i===Xe&&this._handleRSMsg(e):this._handleRRMsg(e)}else this._handleReadNtf(e);else this._handleExpansionNotify(e);else this._handleSRSMsg(e,t);else r===jt&&this._report.cloudControllerVers.push(e.sentTime);else if(r===jt){const{startTime:t,endTime:i,platform:r,logId:n,uri:o}=s;this._report.logCmdQueue.push({startTime:parseInt(t,10),endTime:parseInt(i,10),platform:r,logId:n,uri:o,messageUId:e.messageUId})}}_handleRSMsg(e){const{senderUserId:t,content:i,conversationType:r,targetId:s,channelId:n}=e;if(r===oe.PRIVATE){const e=this._report.privateRSMsgs.find((e=>e.conversationType===r&&e.targetId===s&&e.channelId===n));return void(e?e.timestamp=Math.max(e.timestamp,i.endMsgTime):this._report.privateRSMsgs.push({conversationType:r,targetId:s,channelId:n,timestamp:i.endMsgTime}))}const{msgId:o,rrn:a,tmn:l}=i,c=this._report.groupRSMsgs.get(o);c?(c.totalCount=l,c.readedCount=a):this._report.groupRSMsgs.set(o,{totalCount:l,readedCount:a}),this._report.messageUIds.add(o)}_handleRRMsg(e){const{msgId:t}=e.content;this._report.rrmsgs.set(t,e),this._report.messageUIds.add(t)}_handleExpansionNotify(e){const{put:t,mid:i,del:r,clear:s}=e.content;this._report.messageUIds.add(i),this._report.expansionMsgQueue.has(i)&&!s?this._report.expansionMsgQueue.get(i).push({put:t,del:r,clear:s}):this._report.expansionMsgQueue.set(i,[{put:t,del:r,clear:s}])}_handleSRSMsg(e,t){const{conversationType:i,targetId:r,channelId:s,senderUserId:n}=e;n===t&&(this._report.srsmsgs=this._report.srsmsgs.filter((e=>e.conversationType!==i||e.targetId!==r||e.channelId!==s)),this._report.srsmsgs.push(e))}_handleReadNtf(e){const{conversationType:t,targetId:i,channelId:r}=e;t===oe.PRIVATE&&(this._report.readNtfs=this._report.readNtfs.filter((s=>s.conversationType!==t||s.targetId!==i||s.channelId!==r||s.senderUserId!==e.senderUserId)),this._report.readNtfs.push(e))}build(){const e=this._report;return this._report=Ss(),this._count=0,e}}class Cs{constructor(e){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e})}gen(e,t){return(...i)=>{this.logger.info(Er.L_JS_FUNC_EXEC_O,e);try{t(...i)}catch(t){this.logger.error(Er.L_JS_FUNC_EXEC_E,`name: ${e}\n${t.stack}`),console.warn("L-js_callback_exception-E: args -> ",...i)}}}}function vs(e){return{type:e.conversationType,targetId:e.targetId,channelId:e.channelId||""}}function ms(e){const{userId:t,nickname:i,groupNickname:r,portraitUrl:s,joinTime:n,role:o,extra:a,isRobot:l}=e;return{userId:t,name:i||"",portraitUri:s||"",nickname:r||"",role:o||0,joinedTime:n||0,extra:a||"",isRobot:!!l}}function As(e){return e&&0!==e.length?e.map(ms):[]}var Ms,ys,bs,Ps,Ls,Us,Ds,ws,Vs,ks,Gs,Fs,Bs,Hs,xs,Js,Ys,js,Ws,Ks,Xs,Zs,qs,Qs,$s,zs,en,tn,rn,sn,nn,on,an,ln,cn,hn,un,dn,En,In,_n,fn,gn;!function(e){e[e.cuid=1]="cuid",e[e.uid=2]="uid",e[e.all=4]="all"}(_n||(_n={}));class Rn{constructor(e,t){Ms.add(this),Object.defineProperty(this,"_dispatchEvent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_msgExpansionHandler",{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,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"navi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tcpMgr",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_environment",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_staticConfigManager",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cloudController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cloudControllerUri",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"cloudControllerLock",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"cloudControllerMsgs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_deviceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_enableReadReceiptStorage",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isConnected",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_offlineFinishedPending",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullOfflineMessageFinished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_lowPriorityMessageHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_catcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_needDispatchMessageModifiedSyncCompleted",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_opts",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_buildSubscribeEventData",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=[];try{const{list:i}=JSON.parse(e);i.forEach((e=>{const{userId:i,subscribeType:r,subscribeTime:s,duration:n,operationType:o,details:a=[],userProfile:l}=JSON.parse(e.obj),c={userId:i,subscribeType:r,subscribeTime:s,expiry:n,operationType:o};[ft.ONLINE_STATUS,ft.FRIEND_ONLINE_STATUS].includes(r)&&(c.details=a.map((e=>{const{changeTime:t,changeValue:i,platform:r}=JSON.parse(e);return{changeTime:t,eventValue:i,platform:r}}))),[ft.USER_PROFILE,ft.FRIEND_USER_PROFILE].includes(r)&&(c.userProfile=this._string2userProfileInfo(l)),t.push(c)}))}catch(t){this.logger.error(Er.P_PARSE_JSON_SUBSCRIBE_DATA_E,JSON.stringify({error:null==t?void 0:t.stack,data:e}))}return t}}),Object.defineProperty(this,"_chatroomCache",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"rtcHeartbeatResolves",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this._opts=e;const{dbpath:i,appkey:r,logOutputLevel:s,disableLogReport:n,eventLoopBlockingCheck:o,enableSyncEmptyTopConversation:a}=e,l=this._deviceId=is(),c=Qr();this.logger=new ts(r,"RC-M","IM",c),this._catcher=new Cs(this.logger),Nr.initWithAppkey(r,i,Yt,this.logger.getSessionId()),Nr.setConsoleLogLevel(s+1),this.logger.setOutputLevel(s),this.reporter=new Xr(r,l,this.logger,n,c),this.logger.info(Er.P_INIT_O,JSON.stringify({appkey:r,dbpath:i,proto_commit:Nr.getNodeVersion(),deviceId:l,commit:"d5bd8e7ccfe53e86ad9ceabb86e10852b5e02b5a",processName:process.title,processPId:process.pid,disableLogReport:n,eventLoopBlockingCheck:o})),o&&Ki.start(this.logger),fs(this.logger,!1,"setDeviceId",l),this._staticConfigManager=new ps(r,this.logger,i),this._lowPriorityMessageHandler=new Os,this.navi=new cs(r,this.logger,i,this._staticConfigManager),this.tcpMgr=new Rs(r,this._callCppProxy.bind(this),this.navi,this.logger),this.tcpMgr.on("onConnected",this.onConnected,this),this.tcpMgr.on("onSuspend",this.onSuspend,this),this.tcpMgr.on("onDisconnected",this.onDisconnected,this),this.tcpMgr.on("onConnecting",this.onConnecting,this),this.tcpMgr.on("onDBOpen",this.dbOpened,this),this.tcpMgr.on("onDBUpgrateStart",this.dbUpgradeStart,this),this.tcpMgr.on("onDBUpgrading",this.dbUpgrading,this),this.tcpMgr.on("onDBUpgradeComplete",this.dbUpgradeComplete,this),this._enableCreateEmptyTopConversation(a),this._initCloudController(r,l,i),this._registerBuildinMessageTypes(),Nr.setOnReceiveMessageListener(this._catcher.gen("setOnReceiveMessageListener[0]",f(this,Ms,"m",Hs).bind(this)),this._catcher.gen("setOnReceiveMessageListener[1]",f(this,Ms,"m",xs).bind(this)),this._catcher.gen("setOnReceiveMessageListener[2]",this._handleMessageModified.bind(this))),Nr.setRTConversationListener(this._catcher.gen("setRTConversationListener",(e=>this._dispatchEvent("sgRelationsSynced",e)))),this._setConversationStatusListener(),this._setPushNotificationListener(),this._setRTCHeartbeatListener(),this._setRTCLivingRoomEventListener(),this._setChatroomEventListener(),this._setCallInfoListener(),this._setSubscribeEventListener(),this._setUserProfileListener(),this._setEntrustGroupListener(),this._setFriendEventListener(),Nr.setReadReceiptListener(this._catcher.gen("setReadReceiptListener",((e,t)=>{const i=JSON.parse(t).map((e=>({identifier:{conversationType:e.conIdentifier.type,targetId:e.conIdentifier.targetId,channelId:e.conIdentifier.channelId},messageUId:e.msgUid,readCount:e.readCount,unreadCount:e.unreadCount,totalCount:e.totalCount,users:e.readUsers.map((e=>({userId:e.userId,timestamp:e.receiptTime,isMentioned:e.mentioned})))})));this._dispatchEvent("readReceiptResponseV5",i)}))),Nr.setTranslateEventListener(this._catcher.gen("setTranslateEventListener",(e=>{const t=JSON.parse(e).map((e=>({translateInfo:{targetLanguage:e.translateResult.targetLanguage,translatedText:e.translateResult.translatedText,status:e.translateResult.translateStatus},code:e.code,identifier:e.messageRecognitionIdentifier.messageUid,from:e.messageRecognitionIdentifier.inputSource})));this._dispatchEvent("translateResponse",t)}))),this._msgExpansionHandler=new rs(this._callCppProxy.bind(this)),Nr.setUltraGroupListener(this._catcher.gen("setUltraGroupListener[0]",(e=>this._dispatchEvent("ultraGroupEnable"))),this._catcher.gen("setUltraGroupListener[1]",((e,t,i)=>f(this,Ms,"m",Ps).call(this,e,t,i))),this._catcher.gen("setUltraGroupListener[2]",(e=>f(this,Ms,"m",Ls).call(this,e))),this._catcher.gen("setUltraGroupListener[3]",(e=>f(this,Ms,"m",Us).call(this,e))),this._catcher.gen("setUltraGroupListener[4]",(e=>f(this,Ms,"m",Ds).call(this,e))),this._catcher.gen("setUltraGroupListener[5]",(e=>f(this,Ms,"m",ws).call(this,e))),this._catcher.gen("setUltraGroupListener[6]",(e=>f(this,Ms,"m",Vs).call(this,e))),this._catcher.gen("setUltraGroupListener[7]",(e=>f(this,Ms,"m",ys).call(this,e))),this._catcher.gen("setUltraGroupListener[8]",(e=>f(this,Ms,"m",bs).call(this,e)))),Nr.setRobotEventListener(this._catcher.gen("setRobotEventListener",((e,t)=>{this._dispatchEvent("robotsSynced",e,f(this,Ms,"m",In).call(this,t))}))),Nr.setMessageReactionListener(this._catcher.gen("setMessageReactionListener",(e=>{const t=JSON.parse(e).map((e=>{var t,{conversationIdentifier:i}=e,r=
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
- function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(i[r[s]]=e[r[s]])}return i}(e,["conversationIdentifier"]);return Object.assign({conversationIdentifier:(t=i,{conversationType:t.type,targetId:t.targetId,channelId:t.channelId})},r)}));this._dispatchEvent("messageReaction",{reactions:t})})))}_setDeviceInfo(){const{model:e}=r.cpus()[0];let t=r.release();try{"darwin"===process.platform?t=s.execSync("sw_vers -ProductVersion",{encoding:"utf-8"}):"win32"===process.platform&&(t=s.execSync("ver",{encoding:"utf-8"}))}catch(e){this.logger.error("P-get_sys_version-E",JSON.stringify({error:e}))}Nr.setDeviceInfo("",e,"PC",t,"","")}_initCloudController(e,t,i){const r=bi.getCloudControllerUrl();[this.cloudControllerUri]=r,this.cloudController=new Ts(e,this.logger,this.reporter,t,i),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,Xi)}callProxy(e,...t){return _(this,void 0,void 0,(function*(){const i=this[e];if(!i)return this.logger.warn(Er.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"})),Ri(ne.NOT_SUPPORT);let r="";try{return yield i.call(this,...t)}catch(t){r=JSON.stringify({error:null==t?void 0:t.stack,method:e}),this.logger.error(Er.P_CALL_MAIN_E,r)}return Ri(ne.MAIN_PROCESS_ERROR,r)}))}sendProxy(e,...t){return _(this,void 0,void 0,(function*(){const i=this[e];if(i)try{i.call(this,...t)}catch(t){this.logger.error(Er.P_CALL_MAIN_E,JSON.stringify({error:null==t?void 0:t.stack,method:e}))}else this.logger.warn(Er.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"}))}))}setRenderInitOption(e){const{navigators:t,areaCode:i,logServerUrl:r,environment:s,useNaviV2:n,enableReadReceiptStorage:o}=e;this._environment=s||"default",this.navi.setEnvironment(this._environment),this._enableReadReceiptStorage=o,this.navi.setUseNaviV2(n),bi.init({areaCode:i,navigators:t,logServerUrl:r})}onConnected(e,t){this._isConnected=!0;const i=this.getNaviInfoFromCache();this.reporter.checkStart(i,""),this._try2RejoinChatroom();const r=this.getMainProcessCache();this._dispatchEvent("onConnected",t,r),this._offlineFinishedPending&&(this._offlineFinishedPending=!1,this.logger.info(b),this._dispatchEvent("pullFinished")),this._needDispatchMessageModifiedSyncCompleted&&(this._needDispatchMessageModifiedSyncCompleted=!1,this._dispatchEvent("messageModifiedSyncCompleted"))}onConnecting(){this._isConnected=!1,this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._needDispatchMessageModifiedSyncCompleted=!0,this._dispatchEvent("onConnecting")}onSuspend(e,t){this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._dispatchEvent("onSuspend",t)}onDisconnected(e,t){this._isConnected=!1,this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._dispatchEvent("onDisconnected",t)}dbOpened(e,t,i,r){this._dispatchEvent("databaseOpened",t,i)}dbUpgradeStart(){this._dispatchEvent("databaseUpgradeWillStart")}dbUpgrading(e,t){this._dispatchEvent("databaseUpgrading",t)}dbUpgradeComplete(e,t){this._dispatchEvent("databaseUpgradeDidComplete",t)}_callCppProxy(e,...t){const i=this.logger.createTraceId();try{this.logger.debug(Er.P_CALL_ADDON_O,JSON.stringify({method:e,content:t}),i);return Nr[e](...t)}catch(t){throw this.logger.error(Er.P_CALL_ADDON_E,JSON.stringify({stack:null==t?void 0:t.stack,method:e}),i),t}}refetchNaviInfo(){return this.navi.request(this.tcpMgr.getToken(),!0,!0,this.logger.createTraceId())}sendHTTPRequest(e){return Fr(this.logger,e)}onReceiveRendererLog(e){this.logger.recvRendererLog(e)}setNetwork(e,t){if(this.tcpMgr.setNetwork(e,t),e.status&&this.cloudController){const e=this.tcpMgr.getToken();this.cloudController.request(this.cloudControllerUri,Zi,e)}}destroy(){Ki.stop(),this.reporter.stop(),this.logger.destroy(),Nr.destroy()}getHistoryMessagesByObjectNames(e,t){return _(this,void 0,void 0,(function*(){const{conversationType:i,targetId:r,channelId:s}=e,{timestamp:n,count:o,order:a,messageTypes:l}=t,c=o+1,h=fs(this.logger,!1,"getHistoryMessagesByObjectNames",i,r,n,c,l,0===a,s||""),u=JSON.parse(h).list.reverse().map((({obj:e})=>this._buildMessage(e)));return gi({list:c===u.length?u.slice(1,c):u,hasMore:o<u.length})}))}_updateMessageReceiptStatus(e,t,i,r){return fs(this.logger,!0,"updateMessageReceiptStatus",e,t,i,r||"")}updateMessageReceiptStatus(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=this._updateMessageReceiptStatus(e,t,i,r);return gi(s)}))}getNaviInfoFromCache(){return this.tcpMgr.getConnectionStatus()!==pt.CONNECTED?null:this.navi.getNaviInfoFromCache(this.tcpMgr.getToken())}getConnectedTime(){return this.tcpMgr.getConnectedTime()}_getServerTime(){return Date.now()-Nr.getDeltaTime()}_getCurrentUserId(){return this.tcpMgr.getCurrentUserId()}getMainProcessCache(){const e=this.tcpMgr.getConnectedTime(),t=this.tcpMgr.getConnectionStatus(),i=this.getNaviInfoFromCache(),r=this.tcpMgr.getCurrentUserId();return{connectedTime:e,deviceId:this._deviceId,crtUserId:r,naviInfo:i,connectionStatus:t,deltaTime:Nr.getDeltaTime(),commitId:"cde31834a5a3b0e318c0710fc21f0d10ec140eca"}}_enableCreateEmptyTopConversation(e){fs(this.logger,!1,"enableCreateEmptyTopConversation",e)}_registerBuildinMessageTypes(){lr().forEach((e=>{this.registerMessageType(e.objectName,e)}))}_parseMessageJsonContent(e,t){let i;try{i=e?JSON.parse(e):{}}catch(r){i=e,this.logger.error(Er.P_PARSE_JSON_MSGS_E,JSON.stringify({content:e,messageId:t}))}return i}_buildSupportExt(e,t){let i=null;return e&&(i=this._msgExpansionHandler.parseReceiveExpansion(t)),i}_handleReadReceiptRequest(e){const t=JSON.parse(e),i=this.getNaviInfoFromCache();if(!(null==i?void 0:i.grpRRVer))return t;const{hasRespond:r,readerInfo:s={},readCount:n,totalCount:o,readerList:a=[]}=t,l={readCount:n,totalCount:o};if(1===(null==i?void 0:i.grpRRVer)){const e=[];for(const t in s)e.push({userId:t,readTime:s[t]});l.readerList=e,l.hasRespond=r}return 3===(null==i?void 0:i.grpRRVer)&&(l.readerList=a),l}_buildMessage(e,t){const i=JSON.parse(e);return f(this,Ms,"m",ks).call(this,i,t)}_updateReadReceiptInfo(e,t){const i=f(this,Ms,"m",nn).call(this,e);if(!i.isOk)return;const r=i.data,s=r.readReceiptRequest?JSON.parse(r.readReceiptRequest):{},n=Object.assign(Object.assign({},s),t);fs(this.logger,!1,"updateReadReceiptRequestInfo",e,JSON.stringify(n))}_buildConversation(e){const t=JSON.parse(e);return f(this,Ms,"m",Gs).call(this,t)}_convertResultList(e,t){let{list:i}=JSON.parse(e);return i=i.map((e=>{const i=JSON.parse(e.obj);return t?t(i):i})),i}_getMessagesByUIds(e){if(0===e.length)return[];const t=fs(this.logger,!1,"getMessageByUids",e);return JSON.parse(t).list.map((e=>f(this,Ms,"m",ks).call(this,JSON.parse(e.obj))))}_handleLowPriorityMessages(e,t){if(this._lowPriorityMessageHandler.isEmpty())return;const i=Date.now(),{count:r}=this._lowPriorityMessageHandler,s=this.logger.createTraceId();this.logger.info(Er.L_HANDLE_LOW_PRIORITY_MESSAGES_T,JSON.stringify({startTime:i,count:r}),s);const n=this._lowPriorityMessageHandler.build(),{srsmsgs:o,readNtfs:a,expansionMsgQueue:l,v1ReceiptMsgs:c,privateRSMsgs:h,groupRSMsgs:u,rrmsgs:d,logCmdQueue:E,cloudControllerVers:I,messageUIds:_}=n,f=new Map;this._getMessagesByUIds([..._.values()]).forEach((e=>{f.set(e.messageUId,e)})),this._handleExpansionMsgQueue(l,f),this._sendMessageNotification(a,!1),this._handlerReadReceiptMsgV1(c,f,e),this._handleSRSMsgs(o,t),this._handlerPrivateRSMsgs(h),this._handlerGroupRSMsgs(u,f),this._handlerRRMsgs(d,f),I.length>0&&(this.cloudControllerMsgs.push(...I),this._ccMsgHandler()),E.forEach((e=>{const{startTime:t,endTime:i,platform:r,logId:s,uri:n,messageUId:o}=e;this.reporter.report(t,i,r,n,s,o)})),this.logger.info(Er.L_HANDLE_LOW_PRIORITY_MESSAGES_R,JSON.stringify({startTime:i,cost:Date.now()-i}),s)}_updateReadReceiptRequestInfoList(e){if(0===e.length)return;const t=e.map((e=>JSON.stringify({message_uid:e.messageUId,request_info:JSON.stringify(e.readReceiptInfo)})));fs(this.logger,!1,"updateReadReceiptRequestInfoList",t)}_handlerRRMsgs(e,t){const i=[],r=[];Array.from(e.entries()).forEach((([e,s])=>{const n=t.get(e);if(!n)return;const{rrn:o,tmn:a}=s.content;let l=n.readReceiptInfo||{};l=Object.assign(Object.assign({},l),{readCount:o,totalCount:a}),n.readReceiptInfo=l,i.push({messageUId:e,readReceiptInfo:l}),r.push(s)})),this._updateReadReceiptRequestInfoList(i),this._sendMessageNotification(r,!1)}_handlerGroupRSMsgs(e,t){const i=[],r=[];Array.from(e.entries()).forEach((([e,{totalCount:s,readedCount:n}])=>{const o=t.get(e);if(!o)return;const{conversationType:a,targetId:l,channelId:c}=o;let h=o.readReceiptInfo||{};h=Object.assign(Object.assign({},h),{readCount:n,totalCount:s}),o.readReceiptInfo=h,i.push({messageUId:e,readReceiptInfo:h}),r.push({conversationType:a,targetId:l,channelId:c,readedCount:n,totalCount:s,messageUId:e})})),this._updateReadReceiptRequestInfoList(i),r.forEach((e=>this._sendMessageReadReceipt({groupReadReceipt:e})))}_handlerPrivateRSMsgs(e){e.forEach((e=>{const{conversationType:t,targetId:i,channelId:r,timestamp:s}=e;this._updateMessageReceiptStatus(t,i,s,r||""),this._sendMessageReadReceipt({privateReadReceipt:{conversationType:t,targetId:i,channelId:r||"",endMsgTime:s}})}))}_handleSRSMsgs(e,t){1!==this.getNaviInfoFromCache().sesDriven?this._sendMessageNotification(e,!1):e.forEach((e=>{const{conversationType:i,targetId:r,channelId:s,sentTime:n,content:o}=e;n>t||this._sendsyncReadStatus({conversationType:i,targetId:r,channelId:s,timestamp:o.lastMessageSendTime})}))}_handlerReadReceiptMsgV1(e,t,i){if(0===e.length)return;const r=new Set,s=[];e.forEach((e=>{const{messageType:n,senderUserId:o,content:a}=e;if(n===Ye){const{messageUId:n}=a,l=t.get(n);if(!l||l.senderUserId!==o)return;return l.readReceiptInfo=o===i?{isReceiptRequestMessage:!0,readerList:[]}:{isReceiptRequestMessage:!0,hasRespond:!1},r.add(l),void s.push(e)}const l=a.receiptMessageDic;if(o===i)return Object.values(l).forEach((e=>{e.forEach((e=>{const i=t.get(e);i&&(i.readReceiptInfo=Object.assign(Object.assign({},i.readReceiptInfo),{hasRespond:!0}),r.add(i))}))})),void s.push(e);const c=l[i];c&&0!==c.length&&(c.forEach((e=>{const i=t.get(e);if(!i)return;const s=i.readReceiptInfo,n=((null==s?void 0:s.readerList)||[]).concat(o);i.readReceiptInfo=Object.assign(Object.assign({},i.readReceiptInfo),{readerList:n}),r.add(i)})),s.push(e))})),this._enableReadReceiptStorage&&this._updateReadReceiptRequestInfoList(Array.from(r.values()).map((e=>({messageUId:e.messageUId,readReceiptInfo:e.readReceiptInfo})))),this._sendMessageNotification(s,!1)}_handleExpansionMsgQueue(e,t){if(0===e.size)return;const i=[],r=[];Array.from(e.entries()).forEach((([e,s])=>{const n=t.get(e);if(!n||!s.length)return;const o=new Set,a=new Set;let l=n.expansion||{};s.forEach((({put:e,del:t,clear:i})=>{if(i)return Object.keys(l).forEach((e=>{o.add(e),a.clear()})),void(l={});e&&(Object.keys(e).forEach((e=>{o.delete(e),a.add(e)})),l=Object.assign(Object.assign({},l),e)),t&&t.forEach((e=>{o.add(e),a.delete(e),delete l[e]}))})),n.expansion=l;const c={};Object.keys(l).forEach((e=>{c[e]={v:l[e]}})),i.push({messageUId:e,expansion:JSON.stringify(c)});const h={},{conversationType:u,targetId:d,channelId:E}=n;let I=!1;o.size>0&&(I=!0,h.deletedExpansion={conversationType:u,targetId:d,channelId:E||"",messageUId:e,deletedKeys:Array.from(o)}),a.size>0&&(I=!0,h.updatedExpansion={conversationType:u,targetId:d,channelId:E||"",messageUId:e,expansion:l}),I&&r.push(h)})),f(this,Ms,"m",Js).call(this,i),r.forEach((e=>this._dispatchEvent("expansion",e)))}_handleHighPriorityMessages(e,t){const i=e.filter((e=>{const{messageType:t,conversationType:i}=e;return t!==xe&&(t===He?f(this,Ms,"m",Ys).call(this,e,"highPriorityMessages"):i!==oe.CHATROOM||f(this,Ms,"m",Bs).call(this,e))}));this._sendMessageNotification(i,t)}_ccMsgHandler(){return _(this,void 0,void 0,(function*(){var e;if(!this.cloudControllerLock)return;this.cloudControllerLock=!1;if(this.cloudControllerMsgs.shift()){const t=this.tcpMgr.getToken(),i=(yield null===(e=this.cloudController)||void 0===e?void 0:e.request(this.cloudControllerUri,qi,t))||0;this.cloudControllerMsgs=this.cloudControllerMsgs.filter((e=>e>i)),this.cloudControllerLock=!0,this._ccMsgHandler()}}))}_sendMessageNotification(e,t){e.length>0&&this._dispatchEvent("batchMessage",e,void 0,t)}_sendPullOfflineFinished(){this._isConnected?(this.logger.info(b),this._dispatchEvent("pullFinished")):this._offlineFinishedPending=!0}_handleMessageModified(e,t,i){const r=JSON.parse(e).list.map((({obj:e})=>this._buildMessage(e)));if(1===i)r.length&&this._dispatchEvent("messagesModified",r);else if(2===i){const e=r.filter((e=>f(this,Ms,"m",Ys).call(this,e,"messageModified")));this._sendMessageNotification(e,!1)}this._needDispatchMessageModifiedSyncCompleted&&!t&&this._isConnected&&(this._needDispatchMessageModifiedSyncCompleted=!1,this._dispatchEvent("messageModifiedSyncCompleted"))}_handleChatroomKVUpdate(e){const t=JSON.parse(e).list.map((({obj:e})=>{const{roomId:t,key:i,value:r,operator:s,version:n,isDeleted:o}=JSON.parse(e);return{chatroomId:t,key:i,value:r,timestamp:n,type:o?z.DELETE:z.UPDATE}}));t.length&&this._sendChatroomEvents({updatedEntries:t})}_handleChatroomFullKVSync(e,t,i){const r=this._chatroomCache.get(e);if(!r)return;r.isKVSynced||(r.isKVSynced=!0,this._sendChatroomEvents({entriesSynced:e}));const s=e=>JSON.parse(e).list.map((({obj:e})=>JSON.parse(e))).reduce(((e,t)=>e.set(t.key,t)),new Map),n=s(t),o=s(i),a=[];Array.from(n.entries()).forEach((([e,t])=>{const{roomId:i,value:r,operator:s,version:n,isDeleted:l}=t,c=o.get(e);c?(o.delete(e),a.push({chatroomId:i,key:e,value:c.value,timestamp:c.version,type:z.UPDATE})):a.push({chatroomId:i,key:e,value:r,timestamp:n,type:z.DELETE})})),Array.from(o.entries()).forEach((([t,i])=>{a.push({chatroomId:e,key:t,value:i.value,timestamp:i.version,type:z.UPDATE})})),a.length&&this._sendChatroomEvents({updatedEntries:a})}_sendChatroomEvents(e){this._dispatchEvent("chatroom",e)}_sendMessageReadReceipt(e){this._dispatchEvent("messageReadReceipt",e)}_sendsyncReadStatus(e){this._dispatchEvent("syncReadStatus",e)}_setConversationStatusListener(){Nr.setConversationStatusListener(this._catcher.gen("setConversationStatusListener[0]",(e=>{const t=JSON.parse(e).list.map((e=>{const t=JSON.parse(e.obj),i={conversation:{channelId:t.channelId,conversationType:t.conversationType,targetId:t.targetId},updatedItems:{}};return t.status.forEach((e=>{const{type:t,value:r}=JSON.parse(e.item);if(1===t){const e=Number(r)||vt.NOT_SET;i.updatedItems.notificationLevel={val:e,time:0},i.updatedItems.notificationStatus={val:At(e),time:0}}else 2===t?i.updatedItems.isTop={val:"1"===r,time:0}:4===t&&(i.updatedItems.translateStrategy={val:Number(r),time:0})})),i}));t.length>0&&this._dispatchEvent("conversation",t)})),this._catcher.gen("setConversationStatusListener[1]",(e=>{this._dispatchEvent("conversationTag")})),this._catcher.gen("setConversationStatusListener[2]",((e,t,i,r)=>{this._clearUnreadCountByTimestamp({conversationType:e,targetId:t,channelId:i},r),this._sendsyncReadStatus({conversationType:e,targetId:t,channelId:i,timestamp:r})})),this._catcher.gen("setConversationStatusListener[3]",(e=>this._dispatchEvent("conversationStatusSynced",e))),this._catcher.gen("setConversationStatusListener[4]",(()=>{this._dispatchEvent("syncServerSaveUnreadCompleted")})),this._catcher.gen("setConversationStatusListener[5]",(e=>{const t=f(this,Ms,"m",Fs).call(this,e,"OnConversationUnreadChanged");if(!t.isOk)return;const i=t.data.map((e=>({conversation:e,updatedItems:{unreadMessageCount:{val:e.unreadMessageCount,time:0},hasMentioned:{val:!!e.hasMentioned,time:0}}})));this._dispatchEvent("conversation",i)})))}_setPushNotificationListener(){Nr.setPushNotificationListener(this._catcher.gen("setPushNotificationListener[0]",(e=>this._getRTCProfile())),this._catcher.gen("setPushNotificationListener[1]",(()=>this._dispatchEvent("tag"))),this._catcher.gen("setPushNotificationListener[2]",(e=>this._dispatchEvent("userSettingsSynced",e))),this._catcher.gen("setPushNotificationListener[3]",(e=>this._dispatchEvent("userSettingsChanged",{key:mi,value:e}))),this._catcher.gen("setPushNotificationListener[4]",(e=>this._dispatchEvent("userSettingsChanged",{key:vi,value:e}))))}_getRTCProfile(){const e=this._callCppProxy("getRTCProfile");if(!e)return;const t=this.tcpMgr.getToken();this.navi.updateVoipCallInfo(t,e);const i=this.navi.getNaviInfoFromCache(t);this._dispatchEvent("onNaviDataChange",i)}_setRTCLivingRoomEventListener(){Nr.setRTCRoomEventListener(this._catcher.gen("setRTCRoomEventListener",(e=>{this._dispatchEvent("onRTCDataChange",Array.prototype.slice.call(e))})))}_setChatroomEventListener(){Nr.setChatroomEventListener(this._catcher.gen("setChatroomEventListener[0]",((e,t)=>this._sendChatroomEvents({chatroomDestroyed:e,chatroomDestroyedType:t})))),Nr.setChatroomStatusListener(this._catcher.gen("setChatroomEventListener[1]",((e,t,i)=>this._handleChatroomFullKVSync(e,t,i))),this._catcher.gen("setChatroomEventListener[2]",(e=>this._handleChatroomKVUpdate(e))))}_setCallInfoListener(){Nr.setCallInfoListener(this._catcher.gen("setCallInfoListener[0]",(e=>{const t=[];try{JSON.parse(e).list.forEach((e=>{Object.entries(e).forEach((([e,i])=>{t.push({key:e,value:i})}))}))}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e}))}this._dispatchEvent("callInfo",JSON.stringify({list:t}))})))}_setSubscribeEventListener(){Nr.setSubscribeEventListener(this._catcher.gen("setSubscribeEventListener[0]",(()=>{})),this._catcher.gen("setSubscribeEventListener[1]",(e=>{this._dispatchEvent("syncSubscribedUserStatusFinished",e)})),this._catcher.gen("setSubscribeEventListener[2]",(e=>{const t=this._buildSubscribeEventData(e).map((e=>({userId:e.userId,subscribeType:e.subscribeType,subscribeTime:e.subscribeTime,expiry:e.expiry,operationType:e.operationType})));this._dispatchEvent("subscribedRelationChange",t)})),this._catcher.gen("setSubscribeEventListener[3]",(e=>{const t=this._buildSubscribeEventData(e).map((e=>{const{userId:t,subscribeType:i,subscribeTime:r,expiry:s,details:n,userProfile:o}=e,a={userId:t,subscribeType:i,subscribeTime:r,expiry:s};return[ft.ONLINE_STATUS,ft.FRIEND_ONLINE_STATUS].includes(i)?a.details=n:[ft.USER_PROFILE,ft.FRIEND_USER_PROFILE].includes(i)&&(a.userProfile=o),a}));this._dispatchEvent("subscribedUserStatusChange",t)})))}_setUserProfileListener(){Nr.setUserProfileListener(this._catcher.gen("setUserProfileListener[0]",(e=>{this._dispatchEvent("syncSubscribedUserStatusFinished",e)})),this._catcher.gen("setUserProfileListener[1]",(e=>{this._dispatchEvent("ownUserProfileChanged",this._string2userProfileInfo(e))})))}_onGroupOperationChanged(e,t,i,r,s){let n,o,a=[];try{n=JSON.parse(r),a=JSON.parse(s),o=JSON.parse(e);let l={groupId:n[0]?n[0].groupId:"",operatorInfo:ms(o),operation:t,operationTime:i};0===t?[l.groupInfo]=this._convertGroupInfoList(n):l.memberInfos=As(a),this._dispatchEvent("groupOperation",l)}catch(t){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:t,groupInfoJson:r,membersJson:s,operatorInfo:e}))}}_onGroupInfoChanged(e,t,i,r,s,n){try{const o=this._convertUpdateGroupInfoList(JSON.parse(s))[0];switch(e){case j.GROUP_INFO_CHANGE:const s=JSON.parse(i),a={operatorInfo:s.userId?ms(s):void 0,operationTime:n,groupInfo:o,changedGroupInfo:o,fullGroupInfo:r?this._convertUpdateGroupInfoList(JSON.parse(r))[0]:o};this._dispatchEvent("groupInfoChanged",a);break;case j.GROUP_REMARK_DELETE:case j.GROUP_REMARK_SET:{const i=e===j.GROUP_REMARK_SET?W.ADD:W.REMOVE;this._dispatchEvent("groupRemarkChangedSync",{groupId:t,operationType:i,operationTime:n,groupRemark:(null==o?void 0:o.remark)||""});break}}}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfoJson:s,operatorInfoJson:i}))}}_onGroupMemberInfoChanged(e,t,i,r){try{const s=JSON.parse(t),n=JSON.parse(i),o={groupId:e,operatorInfo:s.userId?ms(s):void 0,memberInfo:ms(n),operationTime:r};this._dispatchEvent("groupMemberInfoChanged",o)}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e,operatorInfoJson:t,updateMemberInfoJson:i}))}}_onGroupRequestChanged(e,t,i,r){try{const e=JSON.parse(i),{groupId:t,joinUser:s,approverUser:n,inviterUser:o,type:a,status:l,direction:c,remark:h}=e,u=Object.assign(Object.assign(Object.assign(Object.assign({groupId:t},s&&{joinMemberInfo:ms(s)}),o&&o.userId&&{inviterInfo:ms(o)}),n&&n.userId&&{operatorInfo:ms(n)}),{status:l,direction:c,type:a,operationTime:r,reason:h});this._dispatchEvent("groupApplicationEvent",u)}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfo:t,requestInfoJson:i}))}}_onFavoriteMembersChanged(e,t,i,r){try{const s=JSON.parse(i);let n=[];s&&$t(s.list)&&(n=s.list.map((e=>e.value))),this._dispatchEvent("groupFollowsChangedSync",{groupId:e,operationType:t,operationTime:r,userIds:n})}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e,memberIds:i}))}}_setEntrustGroupListener(){Nr.setEntrustGroupListener(this._catcher.gen("setEntrustGroupListener[0]",this._onGroupOperationChanged.bind(this)),this._catcher.gen("setEntrustGroupListener[1]",this._onGroupInfoChanged.bind(this)),this._catcher.gen("setEntrustGroupListener[2]",this._onGroupMemberInfoChanged.bind(this)),this._catcher.gen("setEntrustGroupListener[3]",this._onGroupRequestChanged.bind(this)),this._catcher.gen("setEntrustGroupListener[4]",this._onFavoriteMembersChanged.bind(this)))}_onFriendApplicationStatusChanged(e,t,i,r,s,n){this._dispatchEvent("friendApplicationStatusChanged",{userId:e,applicationType:t,applicationStatus:i,directionType:r,operationTime:s,extra:null!=n?n:""})}_onFriendAdd(e,t,i,r,s){this._dispatchEvent("friendAdd",{userId:t,name:i,portraitUri:r,directionType:e,operationTime:s})}_onFriendDelete(e,t,i){const r={directionType:e,operationTime:i,userIds:JSON.parse(t).list.map((e=>e.value))};this._dispatchEvent("friendDelete",r)}_onFriendsClearedFromServer(e){this._dispatchEvent("friendCleared",e)}_onFriendInfoChangedSync(e,t,i){try{const r=JSON.parse(i);this._dispatchEvent("friendInfoChangedSync",{userId:e,remark:t,extProfile:r.list,operationTime:0})}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e,profiles:i}))}}_setFriendEventListener(){Nr.setFriendEventListener(this._catcher.gen("setFriendEventListener[0]",this._onFriendApplicationStatusChanged.bind(this)),this._catcher.gen("setFriendEventListener[1]",this._onFriendAdd.bind(this)),this._catcher.gen("setFriendEventListener[2]",this._onFriendDelete.bind(this)),this._catcher.gen("setFriendEventListener[3]",this._onFriendsClearedFromServer.bind(this)),this._catcher.gen("setFriendEventListener[4]",this._onFriendInfoChangedSync.bind(this)))}registerMessageType(e,t){t.isPersited=e!==He&&t.isPersited;let i=0;const{isCounted:r,isCustom:s,isStatusMessage:n,searchProps:o,isPersited:a}=t;a&&(i|=1),r&&(i|=2),n&&(i=16),s&&function(e,t){const i=ar.get(e);i&&!i.isCustom&&console.warn(`Builtin message type '${e}' cannot be registered`),t.isStatusMessage&&(t.isCounted=t.isPersited=!1),ar.set(e,Object.assign(Object.assign({},t),{isCustom:!0}))}(e,t),fs(this.logger,!1,"registerMessageType",e,i,o||[])}connect(e,t,i,r){return this.tcpMgr.connect(e,t,i,r)}reconnect(e,t,i){const r=ne.RC_SOCKET_DISCONNECTED;return this.tcpMgr.reconnect(e,t,i,r)}reportSDKInfo(e){const t=JSON.stringify(Object.assign(Object.assign({},e),{"electron-main":"5.48.0-alpha.1"}));this.logger.info(Er.P_REPORT_VER_O,t),fs(this.logger,!1,"uploadSDKVersion",t,"")}disconnect(e,t){return _(this,void 0,void 0,(function*(){return e=e||!0,this._chatroomCache.clear(),this.reporter.stop(),Br(null,this.logger),yield this.tcpMgr.disconnect(e,t),gi()}))}setUserStatus(e){const t=gs.create(this.logger,"setUserStatus");return t.asyncInvoke(e,(()=>t.ok()),(e=>t.fail(e))).result()}getUserStatus(e){const t=gs.create(this.logger,"getUserStatus");return t.asyncInvoke(e,(e=>t.ok({status:e})),(e=>t.fail(e))).result()}_handleDirectionalUserIdList(e,t){let{messageType:i,content:r,directionalUserIdList:s=[]}=e;const n=t===oe.GROUP;if(i===je&&r.receiptMessageDic&&n)for(const e in r.receiptMessageDic)s.push(e);return i===We&&(s=((e,t)=>t&&0!==t.length?[oe.GROUP,oe.ULTRA_GROUP,oe.APP_PUBLIC_SERVICE,oe.PUBLIC_SERVICE].includes(e)?t:[]:t||[])(t,[this._getCurrentUserId()])),s}_handleMessage2Callback(e,t){switch(e.messageType){case Fe:this._msgExpansionHandler.setLocalFromExtMsg(this.logger,e);break;case Ye:this._enableReadReceiptStorage&&this._updateReadReceiptInfo(t.content.messageUId,{isReceiptRequestMessage:!0,readerList:[]});break;case je:if(this._enableReadReceiptStorage){const{receiptMessageDic:e}=t.content;if(!e)return;for(const t in e)e[t].forEach((e=>{this._updateReadReceiptInfo(e,{isReceiptRequestMessage:!0,hasRespond:!0})}))}}}sendMessage(e,t,i,r){return _(this,void 0,void 0,(function*(){const{conversationType:s,targetId:n,channelId:o}=e;let{messageType:a,content:l,expansion:c,pushConfig:h,pushContent:u="",pushData:d="",directionalUserIdList:E=[],disableNotification:I=!1,canIncludeExpansion:_=!1,isVoipPush:f=!1,messageId:g=0,disableUpdateLastMessage:R,needReceipt:p,quoteInfo:T}=t,{iOSConfig:N,androidConfig:S,harmonyOSConfig:O,templateId:C="",pushTitle:v="",pushContent:m=u,pushData:A=d,disablePushTitle:M=!1,forceShowDetailContent:y=!1}=h||{};const b=ci(N,S,O);u=m,d=A;const P=(null==S?void 0:S.notificationId)||"";E=this._handleDirectionalUserIdList(t,s);const L={};for(const e in c)L[e]={v:c[e]};const U=C;this.logger.info(Er.P_SEND_MSG_T,JSON.stringify({messageType:a,conversationType:s,targetId:n,channelId:o}),i);const D=gs.create(this.logger,"sendMessage"),w=fs(this.logger,!1,"sendMessage",((e,r)=>{const s=this._buildMessage(e,!1);this.logger.info(Er.P_SEND_MSG_R,JSON.stringify({code:r,messageUId:s.messageUId}),i),r!==ne.SENSITIVE_REPLACE?(this._handleMessage2Callback(s,t),D.ok(s)):D.fail(r)}),((e,t)=>{const r=this._buildMessage(e,!1);this.logger.warn(Er.P_SEND_MSG_R,JSON.stringify({code:t,messageId:r.messageId}),i),r.sentTime=Date.now()-Nr.getDeltaTime(),D.fail(t,r)}),s,n,a,JSON.stringify(l),E,I,M,y,u,d,P,v,b,U,_,JSON.stringify(L),f,o||"",g,!!R,!!p,(null==T?void 0:T.messageUId)||"",(null==T?void 0:T.senderId)||"",(null==T?void 0:T.objectName)||""),V=JSON.parse(w);return null==r||r(V.messageId),D.result()}))}recallMsg(e,t){return _(this,void 0,void 0,(function*(){var i;const r=e.channelId||"",{targetId:s,conversationType:n}=e,{user:o,pushContent:a,extra:l,pushConfig:c,disableNotification:h,isDelete:u,directionalUserIdList:d,disableUpdateLastMessage:E,isAdmin:I,messageUId:g,sentTime:R}=t,p={conversationType:n,targetId:s,messageUId:g,sentTime:R,user:o,extra:l,channelId:r,isDelete:u||!1,isAdmin:I};o&&(p.user=o),l&&(p.extra=l);const T={conversationType:n,targetId:s,senderUserId:this.tcpMgr.getCurrentUserId(),content:p,objectName:He,messageUid:g,direction:St.SEND,status:Mt.UNREAD,sentTime:R,channelId:r},N=this._buildMessage(JSON.stringify(T),!1),S=gs.create(this.logger,"recallMessage");return S.asyncInvoke((e=>_(this,void 0,void 0,(function*(){f(this,Ms,"m",Ys).call(this,N,"recall"),n===oe.ULTRA_GROUP&&this._dispatchEvent("ultraGroupMessageRecalled",[N]),N.pushConfig=c,S.ok(N)}))),(e=>S.fail(e)),He,JSON.stringify(p),h||!1,(null==c?void 0:c.disablePushTitle)||!1,(null==c?void 0:c.forceShowDetailContent)||!1,a||"",(null==c?void 0:c.pushData)||"",(null===(i=null==c?void 0:c.androidConfig)||void 0===i?void 0:i.notificationId)||"",(null==c?void 0:c.pushTitle)||"",ci(null==c?void 0:c.iOSConfig,null==c?void 0:c.androidConfig,null==c?void 0:c.harmonyOSConfig),(null==c?void 0:c.templateId)||"",r,d||[],g,null!=E&&E).result()}))}getHistoryMessage(e,t,i){return _(this,void 0,void 0,(function*(){return i?gi(f(this,Ms,"m",js).call(this,e,t)):f(this,Ms,"m",Ws).call(this,e,t)}))}getContinuousMessages(e,t){return _(this,void 0,void 0,(function*(){const{timestamp:i,count:r,order:s}=t,{conversationType:n,targetId:o,channelId:a}=e,l=gs.create(this.logger,"getContinuousMessages",this.logger.createTraceId());return(yield l.asyncInvoke(n,o,i,r,((e,t,i)=>l.ok({listJson:e,hasMore:i,nextTime:t})),(e=>l.fail(e)),0===s,a||"").result()).trans((({listJson:e,hasMore:t,nextTime:i})=>({list:JSON.parse(e).list.map((({obj:e})=>this._buildMessage(e))).reverse(),hasMore:!!t,timestamp:i})))}))}deleteRemoteMessage(e,t){const{conversationType:i,targetId:r,channelId:s}=e,n=JSON.stringify(t),o=this.logger.createTraceId(),a=gs.create(this.logger,"deleteRemoteHistoryMessages",o);return a.asyncInvoke(i,r,n,!1,s||"",(()=>a.ok()),(e=>a.fail(e))).result()}deleteRemoteMessageByTimestamp(e,t){const i=this.logger.createTraceId(),r=gs.create(this.logger,"clearRemoteHistoryMessages",i);return r.asyncInvoke(e.conversationType,e.targetId,t,(()=>r.ok()),(e=>r.fail(e)),e.channelId||"").result()}clearLocalMessages(e){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",Ks).call(this,e),gi()}))}getConversationListByTimestamp(e,t){return _(this,void 0,void 0,(function*(){const{channelId:i,count:r,startTime:s,order:n,conversationTypes:o,topPriority:a,unreadCountFilter:l}=e,c=(o&&o.length>0?o:_e(t?ce:ae)).map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):i,channelIdValid:e===oe.ULTRA_GROUP||"string"==typeof i}))),h={sendTime:s,limit:r,sort:a?1:0,unreadFilter:l||Ft},u=gs.create(this.logger,"getConversationListByPageWithTopPriorityV2"),d=yield u.invoke(c,h,((e,t)=>u.flush(fi.from(e,void 0,t)))).result();return d.isOk?f(this,Ms,"m",Fs).call(this,d.data,"getConversationListByPageWithTopPriorityV2"):d.wipe()}))}getTopConversationList(e,t,i){return _(this,void 0,void 0,(function*(){const r=(((null==t?void 0:t.length)||0)>0?t:_e(e?ce:ae)).map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):i,channelIdValid:e===oe.ULTRA_GROUP||"string"==typeof i}))),s=fs(this.logger,!1,"getTopConversationsV2",r);return f(this,Ms,"m",Fs).call(this,s,"getTopConversationsV2")}))}getUnreadConversationList(e,t){return _(this,void 0,void 0,(function*(){const i=(((null==t?void 0:t.length)||0)>0?t:_e(e?ce:ae)).map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):"",channelIdValid:e===oe.ULTRA_GROUP}))),r=fs(this.logger,!1,"getUnreadConversationListV2",i);return f(this,Ms,"m",Fs).call(this,r,"getUnreadConversationListV2")}))}getAllConversationList(e,t){return _(this,void 0,void 0,(function*(){const i=_e(e?ce:ae).map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):t,channelIdValid:e===oe.ULTRA_GROUP||"string"==typeof t}))),r=fs(this.logger,!1,"getConversationsV2",i);return f(this,Ms,"m",Fs).call(this,r,"getConversationsV2")}))}getUntaggedConversationListByPage(e,t,i){return _(this,void 0,void 0,(function*(){const r=fs(this.logger,!1,"getConversationsByPageWithoutTag",e,t,i);return f(this,Ms,"m",Fs).call(this,r,"getConversationsByPageWithoutTag")}))}getConversation(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,s=f(this,Ms,"m",qs).call(this,e);if(s)return gi(s);const n=f(this,Ms,"m",js).call(this,e,{timestamp:0,count:1,order:0,messageType:""}),o=(null==n?void 0:n.list[0])||null,a=JSON.parse(fs(this.logger,!1,"getConversationStatus",JSON.stringify([{conversation_type:t,target_id:i,channel_id:r,channel_id_valid:"string"==typeof r&&r.length>0}])))[0],l=!!(null==a?void 0:a.is_top),c=(null==a?void 0:a.translate_strategy)||cr,h=(yield this.getConversationNotificationLevel(e)).data,u={conversationType:t,targetId:i,channelId:r,latestMessage:o,lastUnreadTime:0,isTop:l,notificationLevel:h,notificationStatus:At(h),translateStrategy:c,unreadMessageCount:f(this,Ms,"m",Qs).call(this,e)};return gi(u)}))}batchDeleteConversations(e){const{identifiers:t,deleteRemotely:i,deleteMessages:r}=e,s=gs.create(this.logger,"batchDeleteConversations",this.logger.createTraceId());return s.invoke({conversationIdentifiers:t.map((e=>({type:e.conversationType,targetId:e.targetId,channelId:e.channelId||""}))),deleteMessages:r,deleteRemotely:i},(()=>s.ok()),(e=>s.fail(e))).result()}clearConversations(e,t){return _(this,void 0,void 0,(function*(){const t=(e instanceof Array?e:_e(ce)).map((e=>({conversationType:e,channelIdValid:!1}))),i=fs(this.logger,!0,"clearConversationsV2",t);return i===ne.SUCCESS?gi():Ri(i)}))}getTotalUnreadCount(e,t,i){return _(this,void 0,void 0,(function*(){const r=e.map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):i,channelIdValid:e===oe.ULTRA_GROUP||"string"==typeof i})));let s=fs(this.logger,!0,"getTotalUnreadCount2",r,t);return gi(s)}))}getConversationUnreadCount(e){return _(this,void 0,void 0,(function*(){const t=f(this,Ms,"m",Qs).call(this,e);return gi(t)}))}clearConversationUnreadCount(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e;if(t===oe.ULTRA_GROUP){const e=this._getServerTime(),s=gs.create(this.logger,"setReadTimestamp",this.logger.createTraceId());return s.asyncInvoke(t,i,e,(()=>s.ok()),(e=>s.fail(e)),r||"").result()}return f(this,Ms,"m",$s).call(this,e),gi()}))}clearAllSGUnreadCount(){return _(this,void 0,void 0,(function*(){const e=yield this.getUnreadConversationList(!1);return e.isOk?(e.data.forEach((e=>{e.conversationType!==oe.ULTRA_GROUP&&f(this,Ms,"m",$s).call(this,e)})),gi()):e.wipe()}))}_clearUnreadCountByTimestamp(e,t){const{conversationType:i,targetId:r,channelId:s}=e;fs(this.logger,!1,"clearUnreadCountByTimestamp",i,r,t,s||"")}clearUnreadCountByTimestamp(e,t){return _(this,void 0,void 0,(function*(){return this._clearUnreadCountByTimestamp(e,t),gi()}))}getFirstUnreadMessage(e){return _(this,void 0,void 0,(function*(){const t=f(this,Ms,"m",zs).call(this,e);return gi(t)}))}getFirstUnreadMessageDigest(e){return _(this,void 0,void 0,(function*(){const t=f(this,Ms,"m",zs).call(this,e);return gi(t?{messageUId:t.messageUId,sentTime:t.sentTime}:null)}))}batchSetConversationToTop(e,t,i,r){return f(this,Ms,"m",en).call(this,e,-1,t?1:0,-1,i,r)}batchSetConversationNotificationLevel(e,t){const i=this.logger.createTraceId(),r=gs.create(this.logger,"setBlockPushLevelInBatches",i),s=e.map((e=>({conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,level:t})));return r.asyncInvoke(JSON.stringify(s),(()=>r.ok()),(e=>r.fail(e))).result()}batchSetConversationTranslateStrategy(e,t){return f(this,Ms,"m",en).call(this,e,-1,-1,t,!1,!1)}setConversationTypeNotificationLevel(e,t){const i=gs.create(this.logger,"setBlockPushLevelForType",this.logger.createTraceId());return i.asyncInvoke(e,t,(()=>i.ok()),(e=>i.fail(e))).result()}getConversationTypeNotificationLevel(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!0,"getBlockPushLevelForType",e);return gi(t)}))}searchConversationByContent(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=this.logger.createTraceId(),n=gs.create(this.logger,"searchConversationByContentV2",s),o=r.map((e=>({conversationType:e,channelId:i,channelIdValid:!0}))),a=yield n.asyncInvoke(o,e,t,((e,t,i)=>{e===ne.SUCCESS?n.ok({result:t,matchedNumber:i}):n.fail(e)})).result();return a.isOk?a.trans((e=>JSON.parse(e.result).map((e=>f(this,Ms,"m",Gs).call(this,e))))):gi([])}))}searchConversationByContentWithAllChannel(e,t,i){return _(this,void 0,void 0,(function*(){i=i||_e(ae);const r=this.logger.createTraceId(),s=gs.create(this.logger,"searchConversationByContentV2",r),n=i.map((e=>({conversationType:e,channelIdValid:!1}))),o=yield s.asyncInvoke(n,e,t,((e,t,i)=>{e===ne.SUCCESS?s.ok({result:t,matchedNumber:i}):s.fail(e)})).result();return o.isOk?o.trans((e=>JSON.parse(e.result).map((e=>f(this,Ms,"m",Gs).call(this,e))))):gi([])}))}searchMessagesWithParams(e){return _(this,void 0,void 0,(function*(){var t,i,r,s,n;const o=this.logger.createTraceId(),a=function(e){if(!e)return[];let t=[];const i=e=>{if(0===t.length)return void t.push(...e);const i=[];e.forEach((e=>{i.push(...t.map((t=>Object.assign(Object.assign({},t),e))))})),t=i},{conversationTypes:r=[],targetIds:s=[],channelIds:n=[]}=e,o=Oi(r).map((e=>({conversationType:e}))),a=Oi(s).map((e=>({targetId:e}))),l=Oi(n).length?n.map((e=>({channelId:e}))):[{channelIdValid:!1}];return i(o),i(a),i(l),t}(e.conversationFilter),l={keyword:e.keyword,limit:e.limit,desc:!e.order,offset:null!==(t=e.offset)&&void 0!==t?t:0,needMatchCount:!0,startTime:null===(i=e.timeRange)||void 0===i?void 0:i.startTime,endTime:null===(r=e.timeRange)||void 0===r?void 0:r.endTime,objectNames:Oi((null===(s=e.messageFilter)||void 0===s?void 0:s.objectNames)||[]),senderIds:Oi((null===(n=e.messageFilter)||void 0===n?void 0:n.senderIds)||[])},c=gs.create(this.logger,"searchMessage",o);return(yield c.invoke(a,l,((e,t,i,r)=>{e===ne.SUCCESS?c.ok({result:t,totalMatched:i,conditionsMatched:r}):c.fail(e)})).result()).trans((({result:e,totalMatched:t,conditionsMatched:i})=>({messages:JSON.parse(e).list.map((e=>JSON.parse(e.obj))).map((e=>f(this,Ms,"m",ks).call(this,e))),totalMatched:t,conditionsMatched:i})))}))}getUnreadMentionedMessages(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!1,"getUnreadMentionedMessages",t,i,r||""),n=JSON.parse(s).list.map((({obj:e})=>f(this,Ms,"m",ks).call(this,JSON.parse(e))));return gi(n)}))}getUnreadMentionedCount(e){return _(this,void 0,void 0,(function*(){var t;const i=f(this,Ms,"m",qs).call(this,e);return gi(null!==(t=null==i?void 0:i.unreadMentionedCount)&&void 0!==t?t:0)}))}addToBlacklist(e){const t=gs.create(this.logger,"addToBlacklist",this.logger.createTraceId());return t.asyncInvoke(e,(()=>t.ok()),(e=>t.fail(e))).result()}removeFromBlacklist(e){const t=gs.create(this.logger,"removeFromBlacklist",this.logger.createTraceId());return t.asyncInvoke(e,(()=>t.ok()),(e=>t.fail(e))).result()}getBlacklist(){const e=gs.create(this.logger,"getBlacklist",this.logger.createTraceId());return e.asyncInvoke((t=>e.ok(t)),(t=>e.fail(t))).result()}getBlacklistStatus(e){const t=gs.create(this.logger,"getBlacklistStatus",this.logger.createTraceId());return t.asyncInvoke(e,(e=>t.ok(e)),(e=>t.fail(e))).result()}insertMessage(e,t){return _(this,void 0,void 0,(function*(){const i=f(this,Ms,"m",tn).call(this,e,t);return-1===i.messageId?Ri(ne.MSG_INSERT_ERROR,"insert message failed",i):gi(i)}))}batchInsertMessage(e){return _(this,arguments,void 0,(function*(e,t=!1){const i=e.map((e=>{const{content:t,senderUserId:i,messageType:r,messageDirection:s,receivedStatus:n=0,sentStatus:o,sentTime:a,searchContent:l,isUnread:c,messageUId:h,disableNotification:u,canIncludeExpansion:d,expansion:E,channelId:I,conversationType:_,targetId:f,source:g,isMentioned:R,receivedStatusInfo:p,directedUserIds:T,disableUpdateLastMessage:N}=e,S=p?(e=>{let t=Mt.UNREAD;return(null==e?void 0:e.isRead)&&(t|=Mt.READ),(null==e?void 0:e.isListened)&&(t|=Mt.LISTENED),(null==e?void 0:e.isDownload)&&(t|=Mt.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=Mt.RETRIEVED),t})(p):n,O=a||0,C={};if(E)for(const e in E)C[e]={v:E[e],ts:O};const v=e.quoteInfo?{messageUId:e.quoteInfo.messageUId,senderId:e.quoteInfo.senderId,objectName:e.quoteInfo.objectName,quoteMessageStatus:e.quoteInfo.quoteMessageStatus||Gt}:void 0;return{conversationType:_,targetId:f,channelId:I||"",direction:s,senderUserId:i,status:o||10,sentTime:O,objectName:r,content:JSON.stringify(t),messageUid:h||"",noNotification:!!u,supportExt:!!d,extMsg:JSON.stringify(C),readStatus:S,searchContent:l||"",isUnread:!!c,source:g||"",isMention:R,directedUsers:T,disableUpdateLastMessage:!!N,quoteInfo:v}}));return fs(this.logger,!0,"insertMessages",JSON.stringify(i),t)?gi(!0):Ri(ne.MSG_INSERT_ERROR)}))}getLocalMessageCount(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!0,"getMessageCount",t,i,r||"");return gi(s)}))}getMessageCountDetail(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"queryConversationDailyMessageCount");return(yield i.invoke(vs(e),t.startTime,t.endTime,((e,t)=>i.flush(fi.from(e,void 0,t))),(e=>i.fail(e))).result()).trans((e=>JSON.parse(e).map((({dateMs:e,count:t})=>({dateMs:e,messageCount:t})))))}))}deleteLocalMessages(e){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",rn).call(this,e),gi()}))}deleteLocalMessagesByTimestamp(e,t,i){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",sn).call(this,e,t,i),gi()}))}batchClearLocalMessagesByTimestamp(e){return _(this,void 0,void 0,(function*(){const t=e.map((e=>({conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId||"",send_time:e.timestamp})));return fs(this.logger,!1,"deleteMessageBySendTimeInBatches",JSON.stringify(t)),gi()}))}batchClearRemoteHistoryMessages(e,t){const i=e.map((e=>({conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId||"",send_time:e.timestamp}))),r=gs.create(this.logger,"deleteRemoteMessageBySendTimeInBatches",this.logger.createTraceId());return r.asyncInvoke(JSON.stringify(i),!!t,(()=>r.ok()),(e=>r.fail(e))).result()}getMessage(e){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",on).call(this,e)}))}setMessageContent(e,t,i){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",an).call(this,e,t,i),gi()}))}setMessageSearchField(e,t,i){return _(this,void 0,void 0,(function*(){return fs(this.logger,!1,"setMessageSearchField",e,t,i),gi()}))}setMessageSentStatus(e,t){return _(this,void 0,void 0,(function*(){return fs(this.logger,!1,"setMessageSentStatus",e,t),gi()}))}setMessageReceivedStatus(e,t){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",ln).call(this,e,t),gi()}))}saveTextMessageDraft(e,t){return _(this,void 0,void 0,(function*(){const{conversationType:i,targetId:r,channelId:s}=e;return fs(this.logger,!1,"saveTextMessageDraft",i,r,t,s||"")?gi():Ri(ne.DRAFT_SAVE_ERROR)}))}getTextMessageDraft(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!0,"getTextMessageDraft",t,i,r||"");return gi(s)}))}clearTextMessageDraft(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e;return fs(this.logger,!1,"clearTextMessageDraft",t,i,r||"")?gi():Ri(ne.DRAFT_REMOVE_ERROR)}))}getConversationNotificationLevel(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!0,"getBlockPushLevelForConversation",i,r||"",t);return gi(s)}))}getTotalUnreadCountByLevels(e,t,i){return _(this,void 0,void 0,(function*(){const r=e.map((e=>({conversationType:e,channelIdValid:!1}))),s=fs(this.logger,!0,"getUnreadAndMentionCountByLevel",r,t);return 0!==s.code?Ri(s.code):gi(i?s.mention:s.unread)}))}sendReadReceiptV2(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"sendReadReceipt",this.logger.createTraceId()),s=yield r.asyncInvoke(e,i||"",t,(()=>r.ok()),(e=>r.fail(e))).result();return s.isOk&&t.forEach((e=>{this._updateReadReceiptInfo(e,{hasRespond:!0});const t=f(this,Ms,"m",nn).call(this,e);t.isOk&&f(this,Ms,"m",ln).call(this,t.data.messageId,1)})),s}))}getMessageReader(e,t,i){const r=gs.create(this.logger,"getMessageReader",this.logger.createTraceId());return r.asyncInvoke(e,i,t,((e,i)=>{const s=[],n={};JSON.parse(e).list.forEach((e=>{const{id:t,time:i}=JSON.parse(e.obj);s.push({userId:t,readTime:i}),n[t]=i}));const o={readerInfo:n,readCount:s.length,totalCount:i};this._updateReadReceiptInfo(t,o),r.ok({list:s,totalMemberCount:i})}),(e=>r.fail(e))).result()}sendReadReceiptMessageV4(e,t,i){const r=gs.create(this.logger,"sendMessageReadReceipt",this.logger.createTraceId()),{conversationType:s,targetId:n,channelId:o}=e;return r.asyncInvoke(s,n,o||"",t,i,(()=>r.ok()),(e=>r.fail(e))).result()}getMessageReadReceiptV4(e,t){const{targetId:i,channelId:r}=e,s=gs.create(this.logger,"getMessageReadReceipt",this.logger.createTraceId());return s.asyncInvoke(i,r||"",t,((e,i,r)=>_(this,void 0,void 0,(function*(){const n=[],o=this._callCppProxy("getMessage",t),a=JSON.parse(o);try{JSON.parse(r).list.forEach((e=>{const{id:t,time:i}=JSON.parse(e.obj);n.push({userId:t,readTime:i})}))}catch(e){this.logger.error(Er.P_PARSE_JSON_E,`method: getMessageReadReceipt, info: ${r}, error: ${e}`)}let{readerList:l=[],readCount:c=0}=JSON.parse(a.readReceiptRequest||"{}"),h=!1;l.length<n.length&&(l=n,h=!0),c<i&&(c=i,h=!0),h&&this._callCppProxy("updateReadReceiptRequestInfo",t,JSON.stringify({readerList:l,readCount:c,totalCount:e})),s.ok({list:n,totalCount:e,readCount:c})}))),(e=>s.fail(e))).result()}updateConversationReadTime(e,t){const i=gs.create(this.logger,"updateConversationReadTime",this.logger.createTraceId()),{conversationType:r,targetId:s,channelId:n}=e;return i.asyncInvoke(r,s,n||"",t,(()=>i.ok()),(e=>i.fail(e))).result()}_try2RejoinChatroom(){if(0===this._chatroomCache.size)return;const e=this.logger.createTraceId();this._chatroomCache.forEach((t=>_(this,void 0,void 0,(function*(){const{chatroomId:i,count:r,extra:s}=t;this.logger.info(O,i,e);const n=yield this._joinChrm(i,r,!1,!0,s);this.logger.summary(C,n,e);const{code:o,isOk:a,data:l}=n;a?this._sendChatroomEvents({rejoinedRoom:Object.assign({chatroomId:i,count:r},l)}):(o!==ne.RC_CHATROOM_USER_KICKED&&o!==ne.RC_CHATROOM_NOT_EXIST||this._chatroomCache.delete(i),this._sendChatroomEvents({rejoinedRoom:{chatroomId:i,errorCode:o}}))}))))}_joinChrm(e,t,i,r,s){const n=i?"joinChatRoom":"joinExistChatRoom";r||f(this,Ms,"m",Xs).call(this,e,!0,!0);const o=gs.create(this.logger,n,this.logger.createTraceId());return o.asyncInvoke(e,t,((i,n,a,l,c,h,u)=>{this._chatroomCache.set(e,{chatroomId:e,count:t,extra:s||"",isKVSynced:r}),o.ok({createTime:Number(i),memberCount:n,isAllChatroomBanned:a,isCurrentUserBanned:l,isCurrentChatroomBanned:c,isCurrentChatroomInWhitelist:h,joinTime:u})}),(e=>o.fail(e)),s||"").result()}joinChatroom(e,t,i,r){return _(this,void 0,void 0,(function*(){return this._joinChrm(e,t,i,!1,r)}))}quitChatroom(e,t){this._chatroomCache.delete(e);const i=gs.create(this.logger,"quitChatRoom",this.logger.createTraceId());return i.asyncInvoke(e,(()=>i.ok()),(e=>i.fail(e)),t||"").result()}getChatroomInfo(e,t,i){const r=gs.create(this.logger,"getChatroomInfo",this.logger.createTraceId());return r.asyncInvoke(e,t,i,((e,t)=>{const i=(e?JSON.parse(e).list:[]).map((e=>JSON.parse(e.obj)));r.ok({userInfos:i,userCount:t})}),(e=>r.fail(e))).result()}getChatroomHistoryMessages(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=this.logger.createTraceId(),n=gs.create(this.logger,"getChatroomHistoryMessage",s);return n.asyncInvoke(e,t,i,r,(e=>{let t;try{t=JSON.parse(e)}catch(e){t={list:[],hasMore:!1}}const{list:i}=t;if(i&&i.length)try{t.list=i.map((e=>this._buildMessage(e.obj)))}catch(e){t.list=[]}n.ok(t)}),(e=>n.fail(e)),"").result()}))}setChatroomEntry(e,t,i){const r=gs.create(this.logger,"setChatroomStatus",this.logger.createTraceId());return r.asyncInvoke(e,t.key,t.value,!!t.isAutoDelete,i,!!t.isSendNotification,t.notificationExtra||"",(()=>r.ok()),(e=>r.fail(e))).result()}setChatroomEntries(e,t){const i=gs.create(this.logger,"setChatroomKV");return i.asyncInvoke(e,JSON.stringify(t.entries),!!t.isAutoDelete,!!t.isForce,(()=>i.ok()),(e=>i.fail(e))).result()}removeChatroomEntry(e,t,i){const r=gs.create(this.logger,"deleteChatroomStatus",this.logger.createTraceId());return r.asyncInvoke(e,t.key,i,!!t.isSendNotification,t.notificationExtra||"",(()=>r.ok()),(e=>r.fail(e))).result()}removeChatroomEntries(e,t){const i=gs.create(this.logger,"deleteChatroomKV",this.logger.createTraceId());return i.asyncInvoke(e,t.keys,!1,(()=>i.ok()),(e=>i.fail(e))).result()}getChatroomEntry(e,t){return _(this,void 0,void 0,(function*(){return(yield this.getAllChatroomEntries(e)).tryTrans((e=>{const i=e[t];return"string"!=typeof i?Ri(ne.CHATROOM_KEY_NOT_EXIST):gi(i)}))}))}getAllChatroomEntries(e){const t=gs.create(this.logger,"getChatroomKV",this.logger.createTraceId());return t.asyncInvoke(e,(e=>{const i={};try{(e?JSON.parse(e):{list:[]}).list.forEach((({obj:e})=>{const t=JSON.parse(e);i[t.key]=t.value?t.value:""}))}catch(e){}t.ok(i)}),(e=>t.fail(e))).result()}getFileToken(e,t,i,r,s,n){let o;i=i||"",s=s||"",o=(r=r||"")&&"uploads"!==r?t||"":li(e,t);const a=this.getNaviInfoFromCache(),l={uploadDomain:di(a,this.logger),env:this._environment};n=n?Math.ceil(n):0;const c=gs.create(this.logger,"getUploadToken");return c.asyncInvoke(e,o,i,r,s,JSON.stringify(l),n,a.ipType||0,((e,t,i,r,s,n,a,l,h,u,d,E,I,_,f,g,R,p,T,N,S,O,C,v)=>{c.ok({token:e,deadline:0,bosToken:t,bosDate:i,path:r,osskeyId:s,ossPolicy:n,ossSign:a,ossBucketName:l,fileName:o,s3Credential:h,s3Algorithm:u,s3Date:d,s3Policy:E,s3Signature:I,s3BucketName:_,stcAuthorization:f,stcContentSha256:g,stcDate:R,stcBucketName:p,minioAuthorization:T,minioContentSha256:N,minioDate:S,minioBucketName:O,downloadAuthInfo:C?JSON.parse(C):null})}),(e=>c.fail(e))).result()}getFileUrl(e,t,i,r){const s=this.getNaviInfoFromCache(),n=di(s,this.logger),o=this.logger.createTraceId(),a=gs.create(this.logger,"getDownloadUrl",o);return a.asyncInvoke(e,i,r,t-1,JSON.stringify({url:n}),-1,s.ipType||0,(e=>a.ok({downloadUrl:e})),(e=>a.fail(e))).result()}clearLocalData(){return _(this,void 0,void 0,(function*(){const e=fs(this.logger,!0,"clearData");return gi(e)}))}getDeviceId(){return this._deviceId}getVoIPKey(e,t){return new Promise((i=>{this._callCppProxy("getVoIPKey",e,t,"",(e=>{setTimeout((()=>{i({code:ne.SUCCESS,data:e})}),0)}),(e=>{setTimeout((()=>{i({code:e})}),0)}))}))}bindRTCRoomForChatroom(e){const t=gs.create(this.logger,"bindRTCRoomForChatroom",this.logger.createTraceId());return t.asyncInvoke(e.chatRoomId,e.rtcRoomId,(()=>t.ok()),(e=>t.fail(e))).result()}rtcSignaling(e,t,i,r){const s=gs.create(this.logger,"rtcSignaling");return s.asyncInvoke(e,t,i,r,(e=>{const t=Array.prototype.slice.call(e);s.ok(t)}),(e=>s.fail(e)),30).result()}_setRTCHeartbeatListener(){Nr.setRTCHeartbeatListener(this._catcher.gen("setRTCHeartbeatListener[0]",((e,t)=>{const i=this.rtcHeartbeatResolves[e];if(!i)return;const r=i.find((e=>""===e.seqId));r&&(r.seqId=t)})),this._catcher.gen("setRTCHeartbeatListener[1]",((e,t,i,r)=>{const s=this.rtcHeartbeatResolves[e];if(!s)return;const n=s.findIndex((e=>e.seqId===i));-1!==n&&s.splice(n,1)[0].resolve({code:t,data:{version:Number(r)}})})))}rtcPing(e,t,i){const{promise:r,resolve:s}=Ni(),n={resolve:s,seqId:""},o=this.rtcHeartbeatResolves[e];return o?o.push(n):this.rtcHeartbeatResolves[e]=[n],fs(this.logger,!1,"sendRTCHeartbeat",[e],30),r}createTag(e){const t=gs.create(this.logger,"addTag");return t.asyncInvoke(e.tagId,e.tagName,(()=>t.ok()),(e=>t.fail(e))).result()}removeTag(e){const t=gs.create(this.logger,"deleteTag");return t.asyncInvoke(e,(()=>t.ok()),(e=>t.fail(e))).result()}updateTag(e){const t=gs.create(this.logger,"renameTag");return t.asyncInvoke(e.tagId,e.tagName,(()=>t.ok()),(e=>t.fail(e))).result()}getTagList(){return _(this,void 0,void 0,(function*(){const e=fs(this.logger,!1,"getTags"),t=this._convertResultList(e,(e=>({tagId:e.tagId,tagName:e.tagName,conversationCount:e.conversationCount,createdTime:e.tagTime})));return gi(t)}))}addTagForConversations(e,t){const i=gs.create(this.logger,"addConversationsForTag"),r=t.map((({conversationType:e,targetId:t,channelId:i})=>({type:e,targetId:t,channelId:i})));return i.asyncInvoke(e,JSON.stringify(r),(()=>i.ok()),(e=>i.fail(e))).result()}removeTagForConversations(e,t){const i=gs.create(this.logger,"removeConversationsForTag"),r=t.map((({conversationType:e,targetId:t,channelId:i})=>({type:e,targetId:t,channelId:i})));return i.asyncInvoke(e,JSON.stringify(r),(()=>i.ok()),(e=>i.fail(e))).result()}removeTagsForConversation(e,t){const i=gs.create(this.logger,"removeTagsForConversation");return i.asyncInvoke(e.conversationType,e.targetId,e.channelId||"",t,(()=>i.ok()),(e=>i.fail(e))).result()}getConversationListByTag(e,t,i){return _(this,void 0,void 0,(function*(){const r=fs(this.logger,!1,"getConversationsForTagByPage",e,t,i,""),s=this._convertResultList(r,(e=>Object.assign(Object.assign({},this._buildConversation(JSON.stringify(e))),{isTopInTag:e.topForTag})));return gi(s)}))}getUnreadCountByTag(e,t){return _(this,void 0,void 0,(function*(){const i=fs(this.logger,!0,"getConversationUnreadCountForTag",e,t);return gi(i)}))}setConversationStatusInTag(e,t,i){const r=gs.create(this.logger,"setConversationToTopForTag");return r.asyncInvoke(e,t.conversationType,t.targetId,t.channelId||"",!!i.isTop,(()=>r.ok()),(e=>r.fail(e))).result()}getTagsForConversation(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!1,"getTagsForConversation",e.conversationType,e.targetId,e.channelId||""),i=this._convertResultList(t,(e=>({tagId:e.tagId,tagName:e.tagName,isTop:e.isTop,createdTime:e.tagTime})));return gi(i)}))}getAllUnreadMentionedCount(){return _(this,void 0,void 0,(function*(){const e=[oe.GROUP].map((e=>({conversationType:e,channelIdValid:!1}))),t=fs(this.logger,!0,"getUnreadAndMentionCountV2",e);return 0!==t.code?Ri(t.code):gi(t.mention)}))}getOSInfo(){return _(this,void 0,void 0,(function*(){const e={arch:r.arch(),platform:r.platform(),type:r.type(),version:r.version(),release:r.release(),uptime:r.uptime(),cpus:r.cpus(),freemem:r.freemem(),totalmem:r.totalmem(),networkInterfaces:r.networkInterfaces()};return gi(e)}))}getMainProcessInfo(){return _(this,void 0,void 0,(function*(){return gi({title:process.title,pid:process.pid,ppid:process.ppid,platform:process.platform,arch:process.arch,uptime:process.uptime(),cpuUsage:process.cpuUsage(),memoryUsage:process.memoryUsage(),resourceUsage:process.resourceUsage()})}))}setCallInfo(e,t,i){const r=gs.create(this.logger,"callInfoSignaling");return r.asyncInvoke(e,t,i,((e,t)=>r.ok({key:e,value:t})),(e=>r.fail(e))).result()}setProxy(e){return _(this,void 0,void 0,(function*(){return this.tcpMgr.getConnectionStatus()!==pt.DISCONNECTED?Ri(ne.RC_CONN_PROXY_UNAVAILABLE):Br(e,this.logger)}))}getProxy(){return Promise.resolve(Hr())}testProxy(e,t){return function(e,t,i){return _(this,void 0,void 0,(function*(){const{resolve:r,promise:s}=Ni(),n=/^https/.test(t)?Vr:Ur,o=i.createTraceId();i.info("L-test_proxy-T",JSON.stringify({proxy:e,testHost:t}),o);const a=n(t,Object.assign(Object.assign({},e),{headers:Si()}),(e=>{const t=200===e.statusCode;e.setEncoding("utf8");let i="";e.on("data",(e=>{i+=e})),e.once("end",(()=>{const s=t?gi(i):Ri(ne.RC_HTTP_REQ_FAIL,`fail: ${e.statusCode}`,i);r(s)}))}));a.once("timeout",(()=>r(Ri(ne.TIMEOUT)))),a.once("error",(e=>r(Ri(ne.RC_HTTP_REQ_FAIL,e.stack)))),a.end();const l=yield s;return i.summary("L-test_proxy-R",l,o),l.wipe()}))}(e,t,this.logger)}setCheckDuplicateMessage(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!0,"checkDuplicateMessage",e);return gi(t)}))}subscribeUser(e,t,i){const r=gs.create(this.logger,"updateSubscribeStatus");return r.asyncInvoke(t,gt.SUBSCRIBE,e,(()=>r.ok()),((e,t)=>r.fail(e,t)),i).result()}unSubscribeUser(e,t){const i=gs.create(this.logger,"updateSubscribeStatus");return i.asyncInvoke(t,gt.UNSUBSCRIBE,e,(()=>i.ok()),((e,t)=>i.fail(e,t)),0).result()}getSubscribeUserList(e,t,i){return _(this,void 0,void 0,(function*(){const r=fs(this.logger,!1,"getSubscribeUserList",e,t,i),s=this._buildSubscribeEventData(r).map((e=>{const{userId:t,subscribeType:i,subscribeTime:r,expiry:s,details:n}=e,o={userId:t,subscribeType:i,subscribeTime:r,expiry:s};return i===ft.ONLINE_STATUS&&(o.details=ii(n)),o}));return gi(s)}))}setCheckChatRoomDuplicateMessage(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!1,"setDuplicateMessageConfig",[oe.CHATROOM],_n.cuid,e);return t===ne.SUCCESS?gi():Ri(t)}))}getSubscribeUserStatus(e,t){return _(this,void 0,void 0,(function*(){return(yield f(this,Ms,"m",En).call(this,[e],t)).trans((e=>{const t=this._buildSubscribeEventData(e).map((e=>{const{userId:t,subscribeType:i,subscribeTime:r,expiry:s,details:n}=e,o={userId:t,subscribeType:i,subscribeTime:r,expiry:s};return i===ft.ONLINE_STATUS&&(o.details=ii(n)),o}));return t}))}))}updateMyUserProfile(e){const t=[],i=[];Object.keys(e).forEach((r=>{var s;if("extraProfile"===r&&e.extraProfile){if(e.extraProfile){const{extraProfile:t}=e;Object.keys(t).forEach((e=>{i.push(JSON.stringify({key:e,value:t[e]||""}))}))}}else t.push(JSON.stringify({key:r,value:(null===(s=e[r])||void 0===s?void 0:s.toString())||""}))}));const r=gs.create(this.logger,"updateUserProfile");return r.invoke(t,i,((e,t)=>{if(e===ne.SUCCESS)r.ok();else{const i=Rr(t);r.fail(e,{errorKey:i[0],errorKeys:i})}})).result()}getUserProfiles(e){const t=gs.create(this.logger,"getUserProfiles");return t.invoke(e,((e,i)=>{e===ne.SUCCESS?t.ok(this._string2UserProfileInfoList(i)):t.fail(e)})).result()}getMyUserProfile(){const e=gs.create(this.logger,"getOwnUserProfile");return e.asyncInvoke(((t,i)=>{e.flush(fi.from(t).trans((()=>this._string2userProfileInfo(i))))})).result()}_string2userProfileInfo(e){var t;try{const i=JSON.parse(e),r=i.userProfile.reduce(((e,t)=>{const i=JSON.parse(t);return["gender","role","level"].includes(i.key)?e[i.key]=Number(i.value):e[i.key]=i.value,e}),{});return r.userId=i.userId,r.extraProfile=(null===(t=i.userExtProfile)||void 0===t?void 0:t.reduce(((e,t)=>{const i=JSON.parse(t);return e[i.key]=i.value,e}),{}))||{},r}catch(t){this.logger.error(Er.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return{}}_string2UserProfileInfoList(e){try{return JSON.parse(e).list.map((e=>this._string2userProfileInfo(e.obj)))}catch(t){this.logger.error(Er.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return[]}updateMyUserProfileVisibility(e){const t=gs.create(this.logger,"updateUserProfilePermission");return t.invoke(e,(()=>t.ok()),(e=>t.fail(e))).result()}getMyUserProfileVisibility(){const e=gs.create(this.logger,"getUserProfilePermission");return e.asyncInvoke(((t,i)=>{e.flush(fi.from(t).trans((()=>i)))})).result()}searchUserProfileByUniqueId(e){const t=gs.create(this.logger,"getUserProfileByUniqueId");return t.asyncInvoke(e,((e,i)=>{t.flush(fi.from(e).trans((()=>this._string2userProfileInfo(i))))})).result()}getMessagesAroundTimestamp(e,t,i,r){return _(this,void 0,void 0,(function*(){const{conversationType:s,targetId:n,channelId:o}=e,a=fs(this.logger,!1,"getMatchedMessage",s,n,t,i,r,o||""),l=JSON.parse(a).list.map((({obj:e})=>this._buildMessage(e)));return gi(l)}))}getConversations(e){return _(this,void 0,void 0,(function*(){const t=f(this,Ms,"m",cn).call(this,e);return gi(t)}))}handleErrorCode(e,t){e!==ne.SUCCESS&&setTimeout((()=>t(Ri(e))),0)}_convertGroupInfoList(e,t=!1){return e&&0!==e.length?e.map((e=>{const{groupId:t,baseInfo:i,createTime:r,createUserId:s,extraInfo:n,memberCount:o,ownerId:a,remark:l,joinTime:c,role:h}=e,u=oi(i),d=oi(n);return{groupId:t,groupName:u.name||"",portraitUri:u.portraitUrl||"",introduction:u.introduction||"",notice:u.announcement||"",joinPermission:~~u.joinPerm,removeMemberPermission:~~u.removePerm,invitePermission:~~u.memInvitePerm,inviteHandlePermission:~~u.invitePerm,groupInfoEditPermission:~~u.profilePerm,memberInfoEditPermission:~~u.memProfilePerm,extProfile:d,creatorId:s||"",ownerId:a||"",createTime:r||0,membersCount:o||0,remark:l||"",joinedTime:c||0,role:h||J.UNDEF}})):[]}_convertUpdateGroupInfoList(e){return e&&0!==e.length?e.map((e=>{const{groupId:t,baseInfo:i,createTime:r,createUserId:s,extraInfo:n,memberCount:o,ownerId:a,remark:l,joinTime:c,role:h}=e,u=oi(i),d=oi(n);return JSON.parse(JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({groupId:t},(e=>JSON.parse(JSON.stringify({groupName:e.name,portraitUri:e.portraitUrl,introduction:e.introduction,notice:e.announcement,joinPermission:ni(e.joinPerm),removeMemberPermission:ni(e.removePerm),invitePermission:ni(e.memInvitePerm),inviteHandlePermission:ni(e.invitePerm),groupInfoEditPermission:ni(e.profilePerm),memberInfoEditPermission:ni(e.memProfilePerm)})))(u)),n.length>0&&{extProfile:d}),s&&{creatorId:s}),a&&{ownerId:a}),r&&{createTime:r}),o&&{membersCount:o}),l&&{remark:l}),c&&{joinedTime:c}),h&&{role:h})))})):[]}createGroup(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=_r(t),n=_r(i||{}),o=gs.create(this.logger,"createGroup");return o.invoke(e,r||[],JSON.stringify(s),JSON.stringify(n),(e=>{const t=JSON.parse(e),{code:i,processCode:r,censorFailedFields:s,failedUserInfos:n}=t;i===ne.SUCCESS?o.ok():o.fail(i,{processCode:r,errorKeys:s,failedUserInfos:n.map(ms)})})).result()}))}updateGroupInfo(e,t,i){return _(this,void 0,void 0,(function*(){const r=_r(t),s=_r(i||{}),n=gs.create(this.logger,"updateGroupInfo");return n.invoke(e,JSON.stringify(r),JSON.stringify(s),((e,t,i,r)=>{e===ne.SUCCESS?n.ok():n.fail(e,{errorKeys:Rr(r)})})).result()}))}getGroupsInfo(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"getGroupInfoByIds");return t.invoke(e,((e,i,r,s)=>{const n=fi.from(e).trans((()=>{const e=JSON.parse(s);return this._convertGroupInfoList(e)}));t.flush(n)})).result()}))}kickGroupMembers(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"kickOutGroupMember");return r.invoke(e,t,JSON.stringify(fr(i)),((e,t)=>r.flush(fi.from(e)))).result()}))}quitGroup(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"quitGroup");return i.invoke(e,JSON.stringify(fr(t)),((e,t)=>i.flush(fi.from(e)))).result()}))}dismissGroup(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"disbandGroup");return t.invoke(e,((e,i)=>t.flush(fi.from(e)))).result()}))}transferGroupOwner(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=gs.create(this.logger,"transferGroup");return s.invoke(e,t,i,JSON.stringify(fr(r)),((e,t)=>s.flush(fi.from(e)))).result()}))}setGroupManagers(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"updateGroupAdmins");return r.invoke(t,i,e,((e,t)=>r.flush(fi.from(e)))).result()}))}getGroupMembersByRole(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"getGroupMembers");return r.invoke(e,t===J.UNDEF?[1,2,3]:[t],i.pageToken,i.count,i.order?1:0,i.filterRobotType,((e,t,i,s)=>{if(e!==ne.SUCCESS)return void r.fail(e);const n=As(JSON.parse(s));r.ok({totalCount:i||0,data:n,pageToken:t||""})})).result()}))}getGroupMembers(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getGroupMembersByIds");return i.invoke(e,t,((e,t,r,s)=>{const n=fi.from(e).trans((()=>As(JSON.parse(s))));i.flush(n)})).result()}))}setGroupMemberInfo(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=gs.create(this.logger,"updateGroupMemberInfo");return s.invoke(e,t,i,r||"",((e,t,i,r)=>{e===ne.SUCCESS?s.ok():s.fail(e,{errorKeys:Rr(r)})})).result()}))}searchGroupMembers(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"getGroupMembersByNickname");return r.invoke(e,t,i.pageToken,i.count,i.order?1:0,((e,t,i,s)=>{if(e!==ne.SUCCESS)return void r.fail(e);const n=As(JSON.parse(s));r.ok({totalCount:i||0,data:n,pageToken:t||""})})).result()}))}joinGroup(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"joinGroup");return t.invoke(e,((e,i,r)=>{e===ne.SUCCESS?t.ok({processCode:i}):t.fail(e)})).result()}))}inviteUsersToGroup(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"inviteUsersToGroup");return i.invoke(e,t,(e=>{const t=JSON.parse(e),{code:r,processCode:s,failedUserInfos:n}=t,o={processCode:s,failedUserInfos:As(n)};i.flush(fi.from(r,void 0,o))})).result()}))}memberInviteResponse(e){return _(this,void 0,void 0,(function*(){const{groupId:t,inviterId:i,optType:r,optResult:s,joinUserId:n,reason:o}=e,a=1===r?1:0,l=a&&n?n:"",c=gs.create(this.logger,"handleGroupInvite");return c.invoke(t,l,i,s,a,o||"",((e,t,i)=>{const r=fi.from(e).trans((()=>({processCode:t})));c.flush(r)})).result()}))}getGroupApplications(e,t,i){return _(this,void 0,void 0,(function*(){const r=e.order?1:0,s=gs.create(this.logger,"getGroupRequests");return s.invoke(t,i,"",e.pageToken||"",e.count,r,((e,t,i,r)=>{if(e!==ne.SUCCESS)return void s.fail(e);const n=JSON.parse(r).map((e=>{const{groupId:t,joinUser:i,approverUser:r,inviterUser:s,type:n,status:o,direction:a,operateTime:l,remark:c}=e;return{groupId:t,joinMemberInfo:i,inviterInfo:s,operatorInfo:r,status:o,direction:a,type:n,operationTime:l,reason:c}}));s.ok({totalCount:i,data:n,pageToken:t})})).result()}))}getJoinedGroupsByRole(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getGroups"),r=t.order?1:0,s=e===J.UNDEF?[1,2,3]:[e];return i.invoke(s,t.pageToken,t.count,r,((e,t,r,s)=>{if(e!==ne.SUCCESS)return void i.fail(e);const n=JSON.parse(s),o=this._convertGroupInfoList(n);i.ok({totalCount:r,data:o,pageToken:t})})).result()}))}searchJoinedGroups(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getGroupsByGroupName");return i.invoke(e,t.pageToken,t.count,t.order?1:0,((e,t,r,s)=>{if(e!==ne.SUCCESS)return void i.fail(e);const n=JSON.parse(s),o=this._convertGroupInfoList(n);i.ok({totalCount:r,data:o,pageToken:t})})).result()}))}getJoinedGroups(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"getGroupsByIds");return t.invoke(e,((e,i,r,s)=>{if(e!==ne.SUCCESS)return void t.fail(e);const n=JSON.parse(s),o=this._convertGroupInfoList(n);t.ok(o)})).result()}))}setGroupRemark(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"updateGroupRemark");return i.invoke(e,t,t?W.ADD:W.REMOVE,((e,t)=>i.flush(fi.from(e)))).result()}))}setGroupFollows(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"updateFavoriteMembers",this.logger.createTraceId());return r.invoke(t,i,e,((e,t)=>r.flush(fi.from(e)))).result()}))}getGroupFollows(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"getGroupFavoriteMembers");return t.invoke(e,"",1e3,0,((e,i,r,s)=>{const n=fi.from(e).trans((()=>JSON.parse(s).map((e=>({userId:e.userId,time:e.followTime})))));t.flush(n)})).result()}))}addFriend(e,t,i){const r=gs.create(this.logger,"addFriend");return r.invoke(e,t,i,((e,t,i)=>{e===ne.SUCCESS?r.ok({processCode:t}):r.fail(e)})).result()}deleteFriends(e,t){const i=gs.create(this.logger,"removeFriends",this.logger.createTraceId());return i.invoke(e,t,((e,t)=>i.flush(fi.from(e)))).result()}acceptFriendRequest(e){const t=gs.create(this.logger,"acceptFriendRequest",this.logger.createTraceId());return t.invoke(e,"",((e,i)=>t.flush(fi.from(e)))).result()}refuseFriendRequest(e,t){const i=gs.create(this.logger,"rejectFriendRequest",this.logger.createTraceId());return i.invoke(e,t||"",((e,t)=>i.flush(fi.from(e)))).result()}setFriendInfo(e,t,i){const r=gs.create(this.logger,"setFriendInfo"),s=_r(i);return r.invoke(e,t,JSON.stringify(s),((e,t,i,s)=>{e===ne.SUCCESS?r.ok():r.fail(e,{errorKeys:Rr(s)})})).result()}checkFriends(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"checkFriendRelationship");return(yield i.invoke(e,t,((e,t)=>{e===ne.SUCCESS?i.ok(t):i.fail(e)})).result()).trans((e=>JSON.parse(e).map((e=>{const{userId:t,status:i}=e;return{userId:t,relationType:i}}))))}))}getFriends(e,t){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"getFriends",this.logger.createTraceId());return(yield t.invoke(e,0,((e,i)=>{e===ne.SUCCESS?t.ok(i):t.fail(e)})).result()).trans((e=>{const t=JSON.parse(e);return{data:this._convertFriendInfo(t),pageToken:""}}))}))}getFriendApplications(e,t,i){const r=gs.create(this.logger,"getFriendRequestListByPage",this.logger.createTraceId());return r.invoke([1,2].every((e=>t.includes(e)))?3:t[0],i,e.count,e.pageToken,e.order?1:0,((e,t,i)=>{if(e!==ne.SUCCESS)return void r.fail(e);const s=JSON.parse(i).map((e=>({userId:e.userId,name:e.name,portraitUri:e.portraitUrl,applicationType:e.friendRequestType,applicationStatus:e.friendRequestStatus,operationTime:e.operateTime,extra:e.extra})));r.ok({pageToken:t,data:s})})).result()}_convertFriendInfo(e){return e.map((e=>{const{userId:t,userName:i,remark:r,portraitUrl:s,friendType:n,extProfiles:o,addTime:a,friendAttribute:l}=e;return{userId:t,name:i,portraitUri:s,remark:r,directionType:n,extProfile:o,addTime:a,inBlackList:!!l}}))}getFriendsInfo(e){const t=gs.create(this.logger,"getFriendByIds");return t.invoke(e,((e,i)=>{if(e!==ne.SUCCESS)return void t.fail(e);const r=JSON.parse(i),s=this._convertFriendInfo(r);t.ok(s)})).result()}searchFriendsInfo(e){const t=gs.create(this.logger,"getFriendByNickname");return t.invoke(e,((e,i)=>{if(e!==ne.SUCCESS)return void t.fail(e);const r=JSON.parse(i),s=this._convertFriendInfo(r);t.ok(s)})).result()}setFriendAddPermission(e){const t=gs.create(this.logger,"setFriendAuthPermission");return t.invoke(e,(e=>{e!==ne.SUCCESS?t.fail(e):t.ok()})).result()}getFriendAddPermission(){const e=gs.create(this.logger,"getFriendAuthPermission");return e.invoke(((t,i)=>{t!==ne.SUCCESS?e.fail(t):e.ok(i)})).result()}setNotificationQuietHoursWithSetting(e){const{startTime:t,spanMinutes:i,level:r,timezone:s}=e,n=gs.create(this.logger,"addPushSetting");return n.invoke(t,i,r,s||"",(()=>n.ok()),(e=>n.fail(e))).result()}removeNotificationQuietHoursSetting(){const e=gs.create(this.logger,"removePushSetting");return e.invoke((()=>e.ok()),(t=>e.fail(t))).result()}getNotificationQuietHoursSetting(){const e=gs.create(this.logger,"queryPushSetting");return e.invoke(((t,i,r,s)=>{const n={startTime:t,spanMinutes:i,level:r,timezone:s};e.ok(n)}),(t=>e.fail(t))).result()}setDataBaseLogConfig(e){this._callCppProxy("setDataBaseLogConfig",e)}getStatsUrlList(){return _(this,void 0,void 0,(function*(){return gi(bi.getStatsUrlList(this.getNaviInfoFromCache()))}))}sendReadReceiptResponseV5(e,t){const i=gs.create(this.logger,"sendReadReceiptByReadReceiptType");return i.invoke(e.conversationType,e.targetId,e.channelId||"",hr,t,((e,t,r)=>{e!==ne.SUCCESS?i.fail(e):i.ok()})).result()}getMessageReadReceiptInfoV5ByIdentifiers(e){return _(this,void 0,void 0,(function*(){const t=e.map((({identifier:e,messageUId:t})=>({conIdentifier:{type:e.conversationType,targetId:e.targetId,channelId:e.channelId||""},uid:t}))),i=gs.create(this.logger,"getReadReceiptCount");return(yield i.invoke(JSON.stringify(t),((e,t)=>{e!==ne.SUCCESS?i.fail(e):i.ok(t)})).result()).trans((e=>JSON.parse(e).map((e=>({identifier:{conversationType:e.conIdentifier.type,targetId:e.conIdentifier.targetId,channelId:e.conIdentifier.channelId},messageUId:e.msgUid,readCount:e.readCount,unreadCount:e.unreadCount,totalCount:e.totalCount})))))}))}getMessagesReadReceiptUsersByPageV5(e,t,i){const r=gs.create(this.logger,"getReadReceiptUsersByUid");return r.invoke(e.conversationType,e.targetId,e.channelId||"",t,i.pageToken||"",!i.readStatus,i.pageCount,0===i.order,((e,t,i,s)=>{if(e!==ne.SUCCESS)return void r.fail(e);const n={pageToken:t,totalCount:s,users:JSON.parse(i).map((e=>JSON.parse(e))).map((e=>({userId:e.userId,timestamp:e.receiptTime,isMentioned:!!e.mentioned})))};r.ok(n)})).result()}getMessagesReadReceiptByUsersV5(e,t,i){const r=gs.create(this.logger,"getReadReceiptStatusForUsersInMessage");return r.invoke(e.conversationType,e.targetId,e.channelId||"",t,i,((e,t,i,s)=>{if(e!==ne.SUCCESS)return void r.fail(e);const n=JSON.parse(i).map((e=>JSON.parse(e))).map((e=>({userId:e.userId,timestamp:e.receiptTime,isMentioned:!!e.mentioned})));r.ok({pageToken:"",totalCount:0,users:n})})).result()}requestSpeechToTextForMessage(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!0,"speechToText",e,((t,i)=>{const r=JSON.parse(i),s={status:r.status,text:r.text,isVisible:r.visible};setImmediate((()=>{this._dispatchEvent("speechToTextResponse",{code:t,messageUId:e,sttInfo:s})}))}));return t===ne.SUCCESS?gi():Ri(t)}))}setMessageSpeechToTextVisible(e,t){return _(this,void 0,void 0,(function*(){const i=fs(this.logger,!0,"updateSpeechToTextVisible",e,t);return i===ne.SUCCESS?gi():Ri(i)}))}setTranslationLanguage(e){const t=gs.create(this.logger,"setPushSetting");return t.invoke(ur,e,(()=>t.ok()),(e=>t.fail(e))).result()}getTranslationLanguage(){return _(this,void 0,void 0,(function*(){const e=fs(this.logger,!0,"getPushSetting",ur);return gi(e)}))}setAutoTranslateEnabled(e){const t=gs.create(this.logger,"setPushSetting");return t.invoke(dr,e?"1":"0",(()=>t.ok()),(e=>t.fail(e))).result()}getAutoTranslateEnabled(){return _(this,void 0,void 0,(function*(){const e=fs(this.logger,!0,"getPushSetting",dr);return gi("1"===e)}))}translateWithParams(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=fs(this.logger,!0,"getPushSetting",ur)||"zh",n=gs.create(this.logger,"translateMessages"),o=e.map((e=>({messageRecognitionIdentifier:{messageUid:e.identifier,customText:0===r?"":e.content,inputSource:r},sourceLanguage:e.sourceLanguage,targetLanguage:e.targetLanguage||s})));return n.invoke(o,{forceRetranslate:i,translationServiceType:t},(e=>{e!==ne.SUCCESS?n.fail(e):n.ok()})).result()}))}modifyMessageWithParams(e){const t=JSON.stringify(e.messageContent),i=gs.create(this.logger,"editMessage",this.logger.createTraceId());return i.asyncInvoke((()=>i.ok()),(e=>i.fail(e)),e.messageUId,t).result()}refreshReferenceMessageWithParams(e,t,i,r){const s=gs.create(this.logger,"getQuotingMessageByUId");return s.asyncInvoke(t.conversationType,t.targetId,t.channelId||"",e,(e=>{s.fail(e)}),(e=>{s.ok(),setTimeout((()=>f(this,Ms,"m",un).call(this,e,r)),0)}),(e=>{s.ok(),setTimeout((()=>f(this,Ms,"m",un).call(this,e,i)),0)})).result()}syncRemoteConversations(){return _(this,void 0,void 0,(function*(){const e=fs(this.logger,!0,"getRemoteConversations");return e===ne.SUCCESS?gi():Ri(e)}))}sendUltraGroupTypingStatus(e){const t=gs.create(this.logger,"sendUGOperateStatus",this.logger.createTraceId());return t.asyncInvoke(e.targetId,0,e.channelId,(()=>t.ok()),(e=>t.fail(e))).result()}getUltraGroupList(e){return _(this,void 0,void 0,(function*(){const t=null==e?void 0:e.targetId,i=null==e?void 0:e.channelType,r=fs(this.logger,!1,"getUGConversationListForAllChannel"),s=JSON.parse(r).list.map((({obj:e})=>{const t=JSON.parse(e);return f(this,Ms,"m",Gs).call(this,t)})).filter((e=>!("string"==typeof t&&t!==e.targetId||"number"==typeof i&&i!==e.channelType))).sort(((e,t)=>{var i,r;const s=(null===(i=e.latestMessage)||void 0===i?void 0:i.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-s}));return gi(s)}))}getRemoteMessagesByUIds(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getRemoteMessageByUids",this.logger.createTraceId()),{targetId:r,conversationType:s,channelId:n}=e;return(yield i.asyncInvoke(r,s,t.map((e=>({messageUId:e,channelId:n||"",sentTime:0}))),(e=>i.ok(e)),(e=>i.fail(e))).result()).trans((e=>JSON.parse(e).list.map((({obj:e})=>{const t=JSON.parse(e);return f(this,Ms,"m",ks).call(this,t)}))))}))}getUGUnreadMentionedDigest(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"getUltraGroupUnreadMentionedDigest",this.logger.createTraceId()),{targetId:i,channelId:r,sentTime:s,count:n}=e;return(yield t.asyncInvoke(i,r||"",s,n,(e=>t.ok(e)),(e=>t.fail(e))).result()).trans((e=>{const t=JSON.parse(e).list.map((({obj:e})=>{const{msgUId:t,objectName:i,sentTime:r,isMentionedAll:s}=JSON.parse(e);return{messageUId:t,messageType:i,sentTime:r,mentionedType:s?De.ALL:De.SINGAL}}));return t}))}))}deleteLocalUGMessagesForAllChannel(e,t){return _(this,void 0,void 0,(function*(){return fs(this.logger,!1,"clearUGMessageByTimestamp",e,t,!1),gi()}))}updateUGMessageExpansion(e,t,i){const r=gs.create(this.logger,"updateUGMessageExpansion",this.logger.createTraceId());return r.asyncInvoke(e.targetId,t.mid,i,JSON.stringify(t),e.channelId,(()=>r.ok()),(e=>r.fail(e))).result()}setUGDefaultNotificationLevel(e,t,i){const r=gs.create(this.logger,"setDefaultBlockPushLevel",this.logger.createTraceId());return r.asyncInvoke(e,i||"",oe.ULTRA_GROUP,t,(()=>r.ok()),(e=>r.fail(e))).result()}getUGDefaultNotificationLevel(e,t){const i=gs.create(this.logger,"getDefaultBlockPushLevel",this.logger.createTraceId());return i.asyncInvoke(e,t||"",oe.ULTRA_GROUP,(e=>i.ok(e)),(e=>i.fail(e))).result()}getUGUnreadCountForAllChannels(e,t,i){return _(this,void 0,void 0,(function*(){if(t.length>0){const r=fs(this.logger,!0,i?"getUltraGroupUnreadMentionedCount":"getUltraGroupUnreadCount",e,t);return gi(r)}const r=fs(this.logger,!0,i?"getUGMentionCount":"getUGUnreadCount",e);return gi(r)}))}getUGUnreadInfoList(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!1,"getInfoForConversations",e),i=JSON.parse(t).list.map((({obj:e})=>{const{targetId:t,conversationType:i,channelId:r,unreadCount:s,mentionCount:n,mentionMeCount:o,blockStatus:a}=JSON.parse(e);return{targetId:t,conversationType:i,channelId:r,unreadCount:s,mentionedCount:n,mentionedMeCount:o,notificationLevel:a,type:oe.ULTRA_GROUP,unreadMessageCount:s}}));return gi(i)}))}getUGFirstUnreadMessageDigest(e){return _(this,void 0,void 0,(function*(){const t=f(this,Ms,"m",zs).call(this,e);return t?gi({sentTime:t.sentTime,messageType:t.messageType,messageUId:t.messageUId}):Ri(ne.RC_DB_DATA_NOT_FOUND)}))}getBlockedUGList(){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",dn).call(this,[{conversationType:oe.ULTRA_GROUP,channelIdValid:!1}])}))}getBlockedConversationList(e){return _(this,void 0,void 0,(function*(){const t=_e(e?ce:ae).map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):"",channelIdValid:e===oe.ULTRA_GROUP})));return f(this,Ms,"m",dn).call(this,t).trans((e=>e.reverse()))}))}getSubscribeUsersOnlineStatus(e){return _(this,void 0,void 0,(function*(){return(yield f(this,Ms,"m",En).call(this,[ft.ONLINE_STATUS,ft.FRIEND_ONLINE_STATUS],e)).trans((e=>JSON.parse(e).list.map((({obj:e})=>{const{userId:t,details:i=[]}=JSON.parse(e),r=i.map((e=>{const{changeTime:t,changeValue:i,platform:r}=JSON.parse(e);return{platform:r,isOnline:!!i,updateTime:t}})),s=r.some((e=>e.isOnline));return n={userId:t,isOnline:s,details:r},[_t.iOS,_t.Android,_t.Web,_t.PC,_t.Mini,_t.HarmonyOS].forEach((e=>{n.details.some((t=>t.platform===e))||n.details.push({platform:e,isOnline:!1,updateTime:0})})),n;var n}))))}))}saveEditedMessageDraft(e,t){return _(this,void 0,void 0,(function*(){const i=fs(this.logger,!1,"saveEditedMessageDraft",vs(t),e.messageUId,e.content);return i===ne.SUCCESS?gi():Ri(i)}))}getEditedMessageDraft(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!1,"getConversationMetadata",vs(e)).find((e=>"edited_message_draft"===e.key));if(!t)return gi(null);const{msg_uid:i,content:r}=JSON.parse(t.value);return gi({messageUId:i,content:r})}))}clearEditedMessageDraft(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!1,"removeConversationMetadata",vs(e),["edited_message_draft"]);return t===ne.SUCCESS?gi():Ri(t)}))}getUnreadMentionMeConversationList(e,t){return _(this,void 0,void 0,(function*(){const{timestamp:t,count:i,conversationTypes:r}=e,s=r.map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?"RCDefault":"",channelIdValid:e===oe.ULTRA_GROUP}))),n=fs(this.logger,!1,"getUnreadMentionMeConversationsByPageWithTopPriority",s,t,i,!!e.topPriority),{code:o,list:a}=JSON.parse(n);if(o!==ne.SUCCESS)return Ri(o);const l=a.map((e=>this._buildConversation(e.obj)));return gi(l)}))}getAllRobots(){return _(this,void 0,void 0,(function*(){const e=gs.create(this.logger,"getAllRobots");return e.asyncInvoke(((t,i)=>{const r=f(this,Ms,"m",In).call(this,i);t!==ne.SUCCESS?e.fail(t,r):e.ok(r)})).result()}))}getConversationsIncludingRobots(e){return _(this,void 0,void 0,(function*(){const{conversationTypes:t,count:i,timestamp:r,topPriority:s}=e,n=gs.create(this.logger,"getConversationsIncludingRobots");return n.invoke(t.map((e=>({conversationType:e,channelId:"",targetId:"",channelIdValid:!1}))),r,i,s,((e,t)=>{e!==ne.SUCCESS?n.fail(e):n.flush(f(this,Ms,"m",Fs).call(this,t,"getConversationsIncludingRobots"))})).result()}))}markRemoteConversationAsRead(e,t,i){return _(this,void 0,void 0,(function*(){const r=yield this.sendMessage(e,t,i);if(r.isOk){const{sentTime:t}=r.data;this._clearUnreadCountByTimestamp(e,t)}return r.wipe()}))}getMessagesByUIds(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getMessagesByUIds");return i.invoke({conversationQueryParam:Object.assign(Object.assign({},vs(e)),{channelIdValid:"string"==typeof e.channelId}),messageUIds:t,enableRemoteQuery:!0},(e=>{const t=JSON.parse(e).list.map((e=>{const{message:t,messageUId:i,code:r}=e;return{messageUId:i,message:t?f(this,Ms,"m",ks).call(this,t):void 0,code:r}}));i.ok(t)}),(e=>{i.fail(e)})).result()}))}_trans2ICppUpdateMessageReactionParam(e){var t;const{messageUId:i,reactionId:r,pushConfig:s}=e;return{messageUId:i,reactionId:r,pushConfig:{forceShowDetail:(null==s?void 0:s.forceShowDetailContent)||!1,templateId:(null==s?void 0:s.templateId)||"",content:(null==s?void 0:s.pushContent)||"",disableTitle:(null==s?void 0:s.disablePushTitle)||!1,id:(null===(t=null==s?void 0:s.androidConfig)||void 0===t?void 0:t.notificationId)||"",data:(null==s?void 0:s.pushData)||"",config:ci(null==s?void 0:s.iOSConfig,null==s?void 0:s.androidConfig,null==s?void 0:s.harmonyOSConfig),title:(null==s?void 0:s.pushTitle)||""}}}addMessageReaction(e){const t=gs.create(this.logger,"addMessageReaction"),i=this._trans2ICppUpdateMessageReactionParam(e);return t.invoke(i,(e=>t.flush(fi.from(e)))).result()}removeMessageReaction(e){const t=gs.create(this.logger,"removeMessageReaction"),i=this._trans2ICppUpdateMessageReactionParam(e);return t.invoke(i,(e=>t.flush(fi.from(e)))).result()}_trans2CppConversationQueryParam(e){const{conversationType:t,targetId:i,channelId:r}=e;return{conversationType:t,targetId:i,channelId:t===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,r):r,channelIdValid:"string"==typeof r}}batchGetMessageReactionSummaries(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"batchGetMessageReactionSummaries"),{conversationIdentifier:i,messageUIds:r}=e,s={messageUIds:r,conversationQueryParam:this._trans2CppConversationQueryParam(i)},n=yield t.invoke(s,((e,i)=>t.flush(fi.from(e,"",i)))).result();if(!n.isOk)return n.wipe();const o=JSON.parse(n.data);return gi(o)}))}getMessageReactions(e){const t=gs.create(this.logger,"getMessageReactions"),{pageToken:i,messageUId:r,count:s}=e,n={messageUId:r,count:s,pageToken:i||""};return t.invoke(n,((e,i,r)=>{if(e!==ne.SUCCESS)return void t.fail(e);const s={pageToken:r,reactions:JSON.parse(i)};t.ok(s)})).result()}getMessageReactionUsers(e){const t=gs.create(this.logger,"getReactionUsers"),{pageToken:i,reactionId:r,count:s,messageUId:n}=e,o={messageUId:n,reactionId:r,count:s,pageToken:i||""};return t.invoke(o,((e,i,r,s)=>{if(e!==ne.SUCCESS)return void t.fail(e);const n={totalCount:r,pageToken:s,users:JSON.parse(i)};t.ok(n)})).result()}syncReadStatus(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"syncConversationReadStatus"),s=vs(e),n=yield r.invoke(s,t,(e=>r.flush(fi.from(e)))).result();return n.isOk&&i&&this._clearUnreadCountByTimestamp(e,t),n.wipe()}))}}Ms=new WeakSet,ys=function(e){const t=JSON.parse(e).list.map((({obj:e})=>JSON.parse(e))),i=[],r=[],s=[];t.forEach((e=>{const{changeTime:t,changeType:n,channelId:o,channelType:a,targetId:l,userId:c}=e;switch(n){case ct.CHANNEL_DELETE:r.push({targetId:l,channelId:o,channelType:a,deleteTime:t});break;case ct.PUBLIC_TO_PRIVATE:i.push({targetId:l,channelId:o,changeType:at.PUBLIC_TO_PRIVATE,channelType:ot.PRIVATE});break;case ct.PRIVATE_TO_PUBLIC:i.push({targetId:l,channelId:o,changeType:at.PRIVATE_TO_PUBLIC,channelType:ot.PUBLIC});break;case ct.PRIVATE_CHANNEL_USER_JOIN_PUBLIC:break;case ct.CHANNEL_USER_KICKED:s.push({targetId:l,channelId:o,userId:c,channelType:a});break;case ct.PUBLIC_TO_PRIVATE_USER_NOT_IN:i.push({targetId:l,channelId:o,changeType:at.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:a})}})),i.length>0&&this._dispatchEvent("ultraGroupChannelChangeType",i),r.length>0&&this._dispatchEvent("ultraGroupChannelDelete",r),s.length>0&&this._dispatchEvent("ultraGroupChannelUserKicked",s)},bs=function(e){const t=JSON.parse(e).list.map((({obj:e})=>JSON.parse(e))),i=[],r=[],s=[],n=[],o=[],a=oe.ULTRA_GROUP;t.forEach((e=>{const{targetId:t,userGroupId:l,eventType:c,channelId:h,channelType:u}=e;switch(c){case ht.REMOVE_USER_GROUP:i.push({conversation:{conversationType:a,targetId:t},userGroupIds:l});break;case ht.JOIN_USER_GROUP:r.push({conversation:{conversationType:a,targetId:t},userGroupIds:l});break;case ht.EXIT_USER_GROUP:s.push({conversation:{conversationType:a,targetId:t},userGroupIds:l});break;case ht.CHANNEL_BIND_USER_GROUP:n.push({conversation:{conversationType:a,targetId:t,channelId:h},channelType:u,userGroupIds:l});break;case ht.CHANNEL_UNBIND_USER_GROUP:o.push({conversation:{conversationType:a,targetId:t,channelId:h},channelType:u,userGroupIds:l})}}));const l={};i.length>0&&(l.userGroupDisband=i),r.length>0&&(l.userAdded=r),s.length>0&&(l.userRemoved=s),n.length>0&&(l.userGroupBindChannel=n),o.length>0&&(l.userGroupUnBindChannel=o),this._dispatchEvent("userGroupStatus",l)},Ps=function(e,t,i){return _(this,void 0,void 0,(function*(){const r=(yield this.getConversation({conversationType:oe.ULTRA_GROUP,targetId:e,channelId:t})).data;this._dispatchEvent("conversation",[{conversation:r,updatedItems:{unreadMessageCount:{val:r.unreadMessageCount,time:i}}}])}))},Ls=function(e){const t=JSON.parse(e).list.map((({obj:e})=>{const{channelId:t,operateTime:i,operateType:r,targetId:s,userId:n}=JSON.parse(e);return{channelId:t,operationType:r,operationTime:i,targetId:s,userId:n}}));this._dispatchEvent("operateStatus",{conversationType:oe.ULTRA_GROUP,info:t,hasInfo:!0,hasSummary:!1,summary:[]})},Us=function(e){const t=JSON.parse(e).list.map((({obj:e})=>{const{targetId:t,channelId:i,userNum:r,operateType:s}=JSON.parse(e);return{targetId:t,channelId:i,count:r,operationType:s}}));this._dispatchEvent("operateStatus",{conversationType:oe.ULTRA_GROUP,info:[],hasInfo:!1,hasSummary:!0,summary:t})},Ds=function(e){const t=JSON.parse(e).list.map((({obj:e})=>this._buildMessage(e)));this._dispatchEvent("ultraGroupMessageExpansionUpdated",t)},ws=function(e){const t=JSON.parse(e).list.map((({obj:e})=>this._buildMessage(e)));this._dispatchEvent("messagesModified",t)},Vs=function(e){const t=JSON.parse(e).list.map((({obj:e})=>{const{channelId:t,conversationType:i,isAdmin:r,isDel:s,mentionType:n,msgUId:o,operatorId:a,sentTime:l,targetId:c}=JSON.parse(e);return{targetId:c,conversationType:i,sentTime:l,messageUId:o,senderUserId:a,channelId:t,content:{conversationType:i,targetId:c,channelId:t,isAdmin:r,isDelete:s,sentTime:l,messageUId:o},messageDirection:1,messageType:He,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:Mt.UNREAD,receivedStatusInfo:ti(Mt.UNREAD)}}));t.length>0&&(t.slice().forEach((e=>f(this,Ms,"m",Ys).call(this,e,"ugRecall"))),this._dispatchEvent("ultraGroupMessageRecalled",t))},ks=function(e,t){const{channelId:i,senderUserId:r,content:s,objectName:n,direction:o,status:a,messageId:l,sentTime:c,readReceiptRequest:h,supportExt:u,pushContent:d,pushTitle:E,pushId:I,pushConfig:_,templateId:f,disableTitle:g,forcePushDetail:R,hasMore:p,directedUsers:T,noNotification:N,disableUpdateLastMessage:S,needReceipt:O,sendReceipt:C,contentRecognition:v,convertExt:m,editTime:A,editContent:M,editStatus:y,quotedMsgStatus:b,hasChanged:P,quoteInfo:L,hasReactions:U}=e;let{conversationType:D,targetId:w,messageUid:V}=e,k=this._parseMessageJsonContent(s,l);const G=!!k.mentionedInfo;if(n===He&&r===this.tcpMgr.getCurrentUserId()&&(D=k.conversationType,w=k.targetId,V=k.messageUId),m){const e=JSON.parse(m);if(e.trans){const{targetLanguage:t,translatedText:i,translateStatus:r}=e.trans,s={targetLanguage:t,translatedText:i,status:r};k.translateInfo=s}}if(n===Ve||n===ke){const e=v?JSON.parse(v):{status:kt,text:"",visible:!1},t={status:e.status,text:e.text,isVisible:e.visible};k.sttInfo=t}const F=(B=n,ar.get(B)||{isPersited:!1,isCounted:!1,isStatusMessage:!1});var B;let H=this._buildSupportExt(u,e);const x=void 0===(J=t)||"[object Undefined]"===Object.prototype.toString.call(J)?c<this.tcpMgr.getConnectedTime():t;var J;let Y={};_&&(Y=((e,t)=>{const i={},r={notificationId:t||""},s={};if(!e)return{iOSConfig:i,androidConfig:r,harmonyOSConfig:s};try{const t=JSON.parse(e);null==t||t.forEach((e=>{var t,n,o,a,l,c,h,u,d,E,I,_,f,g;const R=Object.keys(e);if(0===R.length)return;const p=R[0];switch(p){case"HW":return r.channelIdHW=null===(t=e[p])||void 0===t?void 0:t.channelId,r.importanceHW=null===(n=e[p])||void 0===n?void 0:n.importance,r.imageUrlHW=null===(o=e[p])||void 0===o?void 0:o.image,void(r.categoryHW=null===(a=e[p])||void 0===a?void 0:a.category);case"MI":return r.channelIdMi=null===(l=e[p])||void 0===l?void 0:l.channelId,r.templateIdMi=null===(c=e[p])||void 0===c?void 0:c.templateId,void(r.templateParamMi=null===(h=e[p])||void 0===h?void 0:h.templateParam);case"OPPO":return void(r.channelIdOPPO=null===(u=e[p])||void 0===u?void 0:u.channelId);case"VIVO":return r.typeVivo=null===(d=e[p])||void 0===d?void 0:d.classification,void(r.categoryVivo=null===(E=e[p])||void 0===E?void 0:E.category);case"APNS":return i.threadId=e[p]["thread-id"],i.apnsCollapseId=e[p]["apns-collapse-id"],i.category=e[p].category,i.richMediaUri=e[p].richMediaUri,void(i.interruptionLevel=e[p]["interruption-level"]);case"FCM":return void(r.googleConfig={collapseKey:e[p].collapse_key||"",imageUrl:e[p].imageUrl||"",priority:e[p].priority||""});case"HONOR":return r.importanceHonor=null===(I=e[p])||void 0===I?void 0:I.importance,void(r.imageUrlHonor=null===(_=e[p])||void 0===_?void 0:_.image);case"OHOS":s.category=null===(f=e[p])||void 0===f?void 0:f.category,s.image=null===(g=e[p])||void 0===g?void 0:g.image}}))}catch(e){}return{iOSConfig:i,androidConfig:r,harmonyOSConfig:s}})(_,I));const j=Object.assign(Object.assign({},Y),{pushTitle:E,pushContent:d,pushData:d,disablePushTitle:g,forceShowDetailContent:R,templateId:f}),W={channelId:i,conversationType:D,targetId:w,senderUserId:r,content:k||{},messageType:n,messageUId:V||"",messageDirection:o,isOffLineMessage:x,sentTime:c,receivedTime:0,isPersited:F.isPersited,isCounted:F.isCounted,isMentioned:G,disableNotification:N,isStatusMessage:F.isStatusMessage||!1,canIncludeExpansion:u,expansion:u?H:null,receivedStatus:0,receivedStatusInfo:void 0,sentStatus:void 0,messageId:l,pushConfig:j,hasMore:p,directedUserIds:T||[],disableUpdateLastMessage:S,needReceipt:O,sendReceipt:C,hasReactions:U};if(L&&(W.quoteInfo=L),o===St.RECEIVE?(W.receivedStatus=a,W.receivedStatusInfo=ti(a)):W.sentStatus=a,h){const e=this._handleReadReceiptRequest(h);W.readReceiptInfo=e}return D===oe.ULTRA_GROUP?W.isModifyMessage=!!P:(W.isModifyMessage=!(!A&&!y),W.isModifyMessage&&(W.modifyInfo={timestamp:A,content:M?JSON.parse(M):{},status:y})),n===Be&&(W.content.referMsgStatus=b),W},Gs=function(e){const{channelId:t,conversationType:i,targetId:r,lastestMsg:s,isTop:n,blockStatus:o,matchCount:a,hasUnreadMention:l,unreadCount:c,mentionCount:h,mentionMeCount:u,conversationTime:d,draft:E,translateStrategy:I,channelType:_,metadata:f,includeRobot:g,entrustInfo:R}=e,p=-1===JSON.parse(s).messageId?null:this._buildMessage(s),T=f?JSON.parse(f):{},N=T.edited_message_draft?JSON.parse(T.edited_message_draft):void 0,S=JSON.parse(R),O={name:S.name,portraitUri:S.portraitUrl};return{channelId:t,conversationType:i,targetId:r,channelType:_,unreadMessageCount:c,unreadMentionedCount:h,unreadMentionedMeCount:u,hasMentioned:l,latestMessage:p,notificationStatus:At(o),isTop:n,lastUnreadTime:0,matchCount:a,operationTime:d,notificationLevel:o,draft:E,translateStrategy:I,editedMessageDraft:N?{messageUId:N.msg_uid,content:N.content}:void 0,includeRobot:!!g,dataMgmtInfo:O}},Fs=function(e,t){try{const{list:t}=JSON.parse(e),i=t.map((e=>this._buildConversation(e.obj)));return gi(i)}catch(e){const i=`parse conversation list result error, method: ${t}`;return Ri(ne.MAIN_PROCESS_ERROR,i)}},Bs=function(e){var t;const{messageType:i,targetId:r}=e;if(i===Qe){const t=function(e){const t={},i=[],r=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:r,userList:i}}(e);return this._sendChatroomEvents({userChange:t}),!1}if(i===$e){const t=function(e){const{chatroomId:t,status:i,reason:r,time:s,extra:n}=e.content;return{chatroomId:t,status:i,reason:r,time:s,extra:n||""}}(e);return this._sendChatroomEvents({chatroomNotifyMultiLoginSync:t}),!1}if(i===ze){const i=function(e){const{chatroomId:t,operateType:i,durationTime:r,operateTime:s,userList:n,extra:o}=e.content;return{chatroomId:t,operateType:i,durationTime:r,operateTime:s,userIdList:n,extra:o||""}}(e);return i.operateType===se.Blocked&&(null===(t=null==i?void 0:i.userIdList)||void 0===t?void 0:t.includes(this.tcpMgr.getCurrentUserId()))&&this._chatroomCache.delete(r),this._sendChatroomEvents({chatroomNotifyBlock:i}),!1}if(i===et){const t=function(e){const{chatroomId:t,operateType:i,durationTime:r,operateTime:s,userList:n,extra:o}=e.content;return{chatroomId:t,banType:i,durationTime:r,operateTime:s,userIdList:n,extra:o||""}}(e);return this._sendChatroomEvents({chatroomNotifyBan:t}),!1}return!0},Hs=function(e){const t=JSON.parse(e),i=f(this,Ms,"m",ks).call(this,t,!1),{messageType:r,conversationType:s}=i;if(r!==He||s!==oe.ULTRA_GROUP){if(this._lowPriorityMessageHandler.isLowPriorityMessage(r)){const e=this.tcpMgr.getCurrentUserId();return this._lowPriorityMessageHandler.push(i,e),void this._handleLowPriorityMessages(e,this.tcpMgr.getConnectedTime())}this._handleHighPriorityMessages([i],!1)}},xs=function(e,t){const i=this.tcpMgr.getConnectedTime(),r=this.tcpMgr.getCurrentUserId(),s=[],n=[];JSON.parse(e).list.forEach((e=>{const t=JSON.parse(e.obj),o=t.sentTime<i,a=f(this,Ms,"m",ks).call(this,t,o),{messageType:l}=a;this._lowPriorityMessageHandler.isLowPriorityMessage(l)?this._lowPriorityMessageHandler.push(a,r):o?s.push(a):n.push(a)})),s.length>0&&this._handleHighPriorityMessages(s,!!t);let o=!1;(!t||n.length>0)&&!this._pullOfflineMessageFinished&&(o=this._pullOfflineMessageFinished=!0),n.length>0&&this._handleHighPriorityMessages(n,!!t),(this._pullOfflineMessageFinished||this._lowPriorityMessageHandler.count>=1e4)&&this._handleLowPriorityMessages(r,i),o&&this._sendPullOfflineFinished()},Js=function(e){0!==e.length&&fs(this.logger,!1,"setExtraMessageInBatches",e)},Ys=function(e,t){var i;const{messageUId:r,sentTime:s,isAdmin:n,isDelete:o,extra:a}=e.content,l=this.logger.createTraceId();if(this.logger.info(Er.L_HADNLE_RECALL_CMD_T,JSON.stringify({recalledMessageUId:r,isDelete:o,source:t}),l),"number"!=typeof s||"string"!=typeof r||!r.length)return this.logger.warn(Er.L_HADNLE_RECALL_CMD_R,"Invalid message",l),!1;const c=f(this,Ms,"m",on).call(this,r);if(!c.isOk)return this.logger.info(Er.L_HADNLE_RECALL_CMD_R,"Msg Not Found",l),!1;const h=c.data;if(o)return f(this,Ms,"m",rn).call(this,[h.messageId],s),this.logger.info(Er.L_HADNLE_RECALL_CMD_R,`Delete Msg, messageId: ${h.messageId}`,l),!0;if(h.messageType===xe)return this.logger.info(Er.L_HADNLE_RECALL_CMD_R,"Msg has been processed",l),!1;(null===(i=h.receivedStatusInfo)||void 0===i?void 0:i.isRead)||f(this,Ms,"m",ln).call(this,h.messageId,1,s);const u={operatorId:e.senderUserId,recallTime:h.sentTime,originalObjectName:h.messageType,originalMessageContent:h.content,recallActionTime:e.sentTime,admin:!!n,delete:!!o,isDelete:!!o,extra:a};return e.content.user&&(u.user=e.content.user),e.content.extra&&(u.extra=e.content.extra),h.messageType===we&&(u.recallContent=h.content.content),f(this,Ms,"m",an).call(this,h.messageId,JSON.stringify(u),xe),this.logger.info(Er.L_HADNLE_RECALL_CMD_R,`Replace Msg with RC:RcNtf, messageId: ${h.messageId}`,l),!0},js=function(e,t){const{timestamp:i,count:r,order:s,messageType:n}=t,{conversationType:o,targetId:a,channelId:l}=e,c=fs(this.logger,!1,"getHistoryMessages",o,a,i,r+1,n,0===s,l||""),h=JSON.parse(c).list.map((({obj:e})=>this._buildMessage(e))).reverse();return{list:r===h.length-1?h.slice(1):h,hasMore:r<h.length}},Ws=function(e,t){return _(this,void 0,void 0,(function*(){const{timestamp:i,count:r,order:s}=t,{conversationType:n,targetId:o,channelId:a}=e,l=gs.create(this.logger,"getRemoteHistoryMessages",this.logger.createTraceId());return(yield l.asyncInvoke(n,o,i,r,((e,t)=>l.ok({listJson:e,hasMore:t})),(e=>l.fail(e)),s,!0,a||"",!0).result()).trans((({listJson:e,hasMore:t})=>{const i=JSON.parse(e).list.map((({obj:e})=>this._buildMessage(e)));return 0===s&&i.reverse(),{list:i,hasMore:!!t}}))}))},Ks=function(e){const{conversationType:t,targetId:i,channelId:r}=e;fs(this.logger,!1,"clearMessages",t,i,r||"")},Xs=function(e,t,i){fs(this.logger,!1,"deleteChatroomMessageAndKV",e,t,i)},Zs=function(e){var t;return!!(2&((null===(t=this.getNaviInfoFromCache())||void 0===t?void 0:t.ugDriven)||0))&&!e?"RCDefault":e||""},qs=function(e){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!1,"getConversation",t,i,r||"");return s?this._buildConversation(s):null},Qs=function(e){const{conversationType:t,targetId:i,channelId:r}=e;return fs(this.logger,!0,"getUnreadCount",t,i,r||"")},$s=function(e){const{conversationType:t,targetId:i,channelId:r}=e;return fs(this.logger,!1,"clearUnreadCount",t,i,r||"")},zs=function(e){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!0,"getTheFirstUnreadMessage",t,i,r||""),n=this._buildMessage(s);return-1!==n.messageId?n:null},en=function(e,t,i,r,s,n){const o=this.logger.createTraceId(),a=gs.create(this.logger,"updateConversationStatus",o),l=JSON.stringify(e.map((e=>({conversation_query_param:{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,channel_id_valid:"string"==typeof e.channelId&&e.channelId.length>0},block_op:t,translate_strategy_op:r,top_op:i,create_conversation:!!n,update_time:!!s}))));return a.invoke(l,(()=>a.ok()),(e=>a.fail(e))).result()},tn=function(e,t){const{conversationType:i,targetId:r,channelId:s}=e,{content:n,senderUserId:o,messageType:a,messageDirection:l,readStatus:c,sentStatus:h,sentTime:u,searchContent:d,isUnread:E,messageUId:I,disableNotification:_,canIncludeExpansion:f,expansion:g,directedUserIds:R,disableUpdateLastMessage:p,quoteInfo:T}=t,N=u||0,S={};if(g)for(const e in g)S[e]={v:g[e],ts:N};const O=()=>{},C=fs(this.logger,!0,"insertMessage",i,r,o,a,JSON.stringify(n),O,O,l,c||1,h||30,N,d||"",E?0:1,I||"",!!_,!!f,JSON.stringify(S),s||"",R||[],!!p,(null==T?void 0:T.messageUId)||"",(null==T?void 0:T.senderId)||"",(null==T?void 0:T.objectName)||"",(null==T?void 0:T.quoteMessageStatus)||0),v=this._buildMessage(C,!1);return v.messageUId=I,v.sentTime=u,v},rn=function(e,t=0){fs(this.logger,!1,"deleteMessages",e,t)},sn=function(e,t,i){fs(this.logger,!1,"deleteMessagesByTimestamp",e.conversationType,e.targetId,t,i,e.channelId||"")},nn=function(e){const t=fs(this.logger,!0,"getMessage",e),i=JSON.parse(t);return i.messageId<=0?Ri(ne.RC_DB_DATA_NOT_FOUND,`msg not found: ${e}`):gi(i)},on=function(e){return f(this,Ms,"m",nn).call(this,e).trans((e=>f(this,Ms,"m",ks).call(this,e,!1)))},an=function(e,t,i){return fs(this.logger,!1,"setMessageContent",e,t,i)},ln=function(e,t,i=0){fs(this.logger,!1,"setMessageReceivedStatus",e,t,i)},cn=function(e){const t=e.map((e=>{const{conversationType:t,targetId:i,channelId:r=""}=e;return{targetId:i,channelId:r,type:t}})),i=fs(this.logger,!0,"getConversations",JSON.stringify(t));return JSON.parse(i).list.map((e=>this._buildConversation(e.obj)))},hn=function(e){let t=[];return e&&e.length>0&&(t=e.map((e=>{const t=JSON.parse(e.obj);return{messageUId:t.msg_uid,message:t.msg?this._buildMessage(t.msg):void 0,code:t.code}}))),t},un=function(e,t){try{const{list:i}=JSON.parse(e);t(f(this,Ms,"m",hn).call(this,i))}catch(t){this.logger.error(Er.P_PARSE_JSON_MSGS_E,e)}},dn=function(e){const t=fs(this.logger,!1,"getBlockedConversations",e);return f(this,Ms,"m",Fs).call(this,t,"getBlockedConversations")},En=function(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getSubscribeStatusByUserIds",this.logger.createTraceId());return i.invoke(e,t,((e,t)=>{e!==ne.SUCCESS?i.fail(e):i.ok(t)})).result()}))},In=function(e){return JSON.parse(e).list.map((e=>{const t=JSON.parse(e);return{robotId:t.robotId,name:t.robotName,portraitUri:t.robotPortrait,robotType:t.robotType,metadata:t.metadata?JSON.parse(t.metadata):{},createTime:t.createTime,updateTime:t.updateTime}}))};class pn{static init(e){if(f(this,fn,"f",gn))return f(this,fn,"f",gn);if(!e.appkey)throw new Error("Initializ failed, `appkey` is required!");const r={appkey:e.appkey,dbpath:e.dbpath||t.resolve(i.app.getPath("userData")),logOutputLevel:e.logOutputLevel||Li.WARN,enableSyncEmptyTopConversation:!!e.enableSyncEmptyTopConversation,disableLogReport:!!e.disableLogReport,eventLoopBlockingCheck:!!e.eventLoopBlockingCheck,environment:e.environment||"default",reconnectKickEnable:!!e.reconnectKickEnable,runInMainProcess:!!e.runInMainProcess};return g(this,fn,new fn(r),0,gn),f(this,fn,"f",gn)}constructor(e){Object.defineProperty(this,"_rendererInitOptions",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_svr",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_senders",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),this._svr=new Rn(e,this._send2AllRenderer.bind(this)),this._initIpcEventListeners(),i.app.on("before-quit",(()=>this.destroy())),i.app.on("window-all-closed",(()=>this.destroy()))}_initIpcEventListeners(){i.ipcMain.on("__RC_CHANNEL_CALL_MAIN_SYNC__",((e,t,...i)=>{e.returnValue=this._svr[t].call(this._svr,...i)})),i.ipcMain.on("__RC_CHANNEL_CALL_MAIN__",((e,t,i,...r)=>_(this,[e,t,i,...r],void 0,(function*({sender:e},t,i,...r){if(!this._senders.has(e))return void this._send2Renderer(e,"__RC_CHANNEL_RESULT_FROM_MAIN__",t,Ri(ne.BIZ_ERROR_CLIENT_NOT_INIT));let s;if("sendMessage"===i){const[t,i,n,o]=r;s=this._svr.sendMessage(t,i,n,(t=>{this._send2Renderer(e,"__RC_CHANNEL_RESULT_FROM_MAIN__",o,t)}))}else if("refreshReferenceMessageWithParams"===i){const[t,i,n,o]=r;s=this._svr.refreshReferenceMessageWithParams(t,i,(t=>{this._send2Renderer(e,"__RC_CHANNEL_RESULT_FROM_MAIN__",n,t)}),(t=>{this._send2Renderer(e,"__RC_CHANNEL_RESULT_FROM_MAIN__",o,t)}))}else s=this._svr[i].apply(this._svr,r);s instanceof Promise&&(s=yield s),this._send2Renderer(e,"__RC_CHANNEL_RESULT_FROM_MAIN__",t,s)})))),i.ipcMain.on("__RC_CHANNEL_SEND_2_MAIN__",(({sender:e},t,...i)=>{this._senders.has(e)&&this._svr[t].apply(this._svr,i)})),i.ipcMain.on("__RC_INNER_COMMAND_INIT__",this._registerRenderers.bind(this))}_registerRenderers(e,t){if("cde31834a5a3b0e318c0710fc21f0d10ec140eca"!==t.commitId)return;const{sender:i}=e;this._rendererInitOptions||(this._rendererInitOptions=t,this._svr.setRenderInitOption(t)),this._senders.has(i)||(this._senders.add(i),i.once("destroyed",(()=>{this._senders.delete(i)})))}_send2Renderer(e,t,...i){e.isDestroyed()?this._senders.delete(e):e.send(t,...i)}_send2AllRenderer(e,...t){this._senders.forEach((i=>{this._send2Renderer(i,"__RC_CHANNEL_NOTIFICATION_FROM_MAIN__",e,...t)}))}getCppProto(){return{destroy:()=>{console.warn("`.getCppProto().destroy()` has being deprecated, use `.destroy()` instead."),this.destroy()}}}destroy(){this._svr.destroy()}getDeviceId(){return this._svr.getDeviceId()}getServerTime(){return this._svr.getConnectedTime()}setDatabaseOperationTimeThreshold(e){return this._svr.setDataBaseLogConfig(e)}}fn=pn,gn={value:void 0};module.exports=e=>pn.init(e);
16
+ function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(i[r[s]]=e[r[s]])}return i}(e,["conversationIdentifier"]);return Object.assign({conversationIdentifier:(t=i,{conversationType:t.type,targetId:t.targetId,channelId:t.channelId})},r)}));this._dispatchEvent("messageReaction",{reactions:t})})))}_setDeviceInfo(){const{model:e}=r.cpus()[0];let t=r.release();try{"darwin"===process.platform?t=s.execSync("sw_vers -ProductVersion",{encoding:"utf-8"}):"win32"===process.platform&&(t=s.execSync("ver",{encoding:"utf-8"}))}catch(e){this.logger.error("P-get_sys_version-E",JSON.stringify({error:e}))}Nr.setDeviceInfo("",e,"PC",t,"","")}_initCloudController(e,t,i){const r=bi.getCloudControllerUrl();[this.cloudControllerUri]=r,this.cloudController=new Ts(e,this.logger,this.reporter,t,i),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,Xi)}callProxy(e,...t){return _(this,void 0,void 0,(function*(){const i=this[e];if(!i)return this.logger.warn(Er.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"})),Ri(ne.NOT_SUPPORT);let r="";try{return yield i.call(this,...t)}catch(t){r=JSON.stringify({error:null==t?void 0:t.stack,method:e}),this.logger.error(Er.P_CALL_MAIN_E,r)}return Ri(ne.MAIN_PROCESS_ERROR,r)}))}sendProxy(e,...t){return _(this,void 0,void 0,(function*(){const i=this[e];if(i)try{i.call(this,...t)}catch(t){this.logger.error(Er.P_CALL_MAIN_E,JSON.stringify({error:null==t?void 0:t.stack,method:e}))}else this.logger.warn(Er.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"}))}))}setRenderInitOption(e){const{navigators:t,areaCode:i,logServerUrl:r,environment:s,useNaviV2:n,enableReadReceiptStorage:o}=e;this._environment=s||"default",this.navi.setEnvironment(this._environment),this._enableReadReceiptStorage=o,this.navi.setUseNaviV2(n),bi.init({areaCode:i,navigators:t,logServerUrl:r})}onConnected(e,t){this._isConnected=!0;const i=this.getNaviInfoFromCache();this.reporter.checkStart(i,""),this._try2RejoinChatroom();const r=this.getMainProcessCache();this._dispatchEvent("onConnected",t,r),this._offlineFinishedPending&&(this._offlineFinishedPending=!1,this.logger.info(b),this._dispatchEvent("pullFinished")),this._needDispatchMessageModifiedSyncCompleted&&(this._needDispatchMessageModifiedSyncCompleted=!1,this._dispatchEvent("messageModifiedSyncCompleted"))}onConnecting(){this._isConnected=!1,this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._needDispatchMessageModifiedSyncCompleted=!0,this._dispatchEvent("onConnecting")}onSuspend(e,t){this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._dispatchEvent("onSuspend",t)}onDisconnected(e,t){this._isConnected=!1,this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._dispatchEvent("onDisconnected",t)}dbOpened(e,t,i,r){this._dispatchEvent("databaseOpened",t,i)}dbUpgradeStart(){this._dispatchEvent("databaseUpgradeWillStart")}dbUpgrading(e,t){this._dispatchEvent("databaseUpgrading",t)}dbUpgradeComplete(e,t){this._dispatchEvent("databaseUpgradeDidComplete",t)}_callCppProxy(e,...t){const i=this.logger.createTraceId();try{this.logger.debug(Er.P_CALL_ADDON_O,JSON.stringify({method:e,content:t}),i);return Nr[e](...t)}catch(t){throw this.logger.error(Er.P_CALL_ADDON_E,JSON.stringify({stack:null==t?void 0:t.stack,method:e}),i),t}}refetchNaviInfo(){return this.navi.request(this.tcpMgr.getToken(),!0,!0,this.logger.createTraceId())}sendHTTPRequest(e){return Fr(this.logger,e)}onReceiveRendererLog(e){this.logger.recvRendererLog(e)}setNetwork(e,t){if(this.tcpMgr.setNetwork(e,t),e.status&&this.cloudController){const e=this.tcpMgr.getToken();this.cloudController.request(this.cloudControllerUri,Zi,e)}}destroy(){Ki.stop(),this.reporter.stop(),this.logger.destroy(),Nr.destroy()}getHistoryMessagesByObjectNames(e,t){return _(this,void 0,void 0,(function*(){const{conversationType:i,targetId:r,channelId:s}=e,{timestamp:n,count:o,order:a,messageTypes:l}=t,c=o+1,h=fs(this.logger,!1,"getHistoryMessagesByObjectNames",i,r,n,c,l,0===a,s||""),u=JSON.parse(h).list.reverse().map((({obj:e})=>this._buildMessage(e)));return gi({list:c===u.length?u.slice(1,c):u,hasMore:o<u.length})}))}_updateMessageReceiptStatus(e,t,i,r){return fs(this.logger,!0,"updateMessageReceiptStatus",e,t,i,r||"")}updateMessageReceiptStatus(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=this._updateMessageReceiptStatus(e,t,i,r);return gi(s)}))}getNaviInfoFromCache(){return this.tcpMgr.getConnectionStatus()!==pt.CONNECTED?null:this.navi.getNaviInfoFromCache(this.tcpMgr.getToken())}getConnectedTime(){return this.tcpMgr.getConnectedTime()}_getServerTime(){return Date.now()-Nr.getDeltaTime()}_getCurrentUserId(){return this.tcpMgr.getCurrentUserId()}getMainProcessCache(){const e=this.tcpMgr.getConnectedTime(),t=this.tcpMgr.getConnectionStatus(),i=this.getNaviInfoFromCache(),r=this.tcpMgr.getCurrentUserId();return{connectedTime:e,deviceId:this._deviceId,crtUserId:r,naviInfo:i,connectionStatus:t,deltaTime:Nr.getDeltaTime(),commitId:"d5bd8e7ccfe53e86ad9ceabb86e10852b5e02b5a"}}_enableCreateEmptyTopConversation(e){fs(this.logger,!1,"enableCreateEmptyTopConversation",e)}_registerBuildinMessageTypes(){lr().forEach((e=>{this.registerMessageType(e.objectName,e)}))}_parseMessageJsonContent(e,t){let i;try{i=e?JSON.parse(e):{}}catch(r){i=e,this.logger.error(Er.P_PARSE_JSON_MSGS_E,JSON.stringify({content:e,messageId:t}))}return i}_buildSupportExt(e,t){let i=null;return e&&(i=this._msgExpansionHandler.parseReceiveExpansion(t)),i}_handleReadReceiptRequest(e){const t=JSON.parse(e),i=this.getNaviInfoFromCache();if(!(null==i?void 0:i.grpRRVer))return t;const{hasRespond:r,readerInfo:s={},readCount:n,totalCount:o,readerList:a=[]}=t,l={readCount:n,totalCount:o};if(1===(null==i?void 0:i.grpRRVer)){const e=[];for(const t in s)e.push({userId:t,readTime:s[t]});l.readerList=e,l.hasRespond=r}return 3===(null==i?void 0:i.grpRRVer)&&(l.readerList=a),l}_buildMessage(e,t){const i=JSON.parse(e);return f(this,Ms,"m",ks).call(this,i,t)}_updateReadReceiptInfo(e,t){const i=f(this,Ms,"m",nn).call(this,e);if(!i.isOk)return;const r=i.data,s=r.readReceiptRequest?JSON.parse(r.readReceiptRequest):{},n=Object.assign(Object.assign({},s),t);fs(this.logger,!1,"updateReadReceiptRequestInfo",e,JSON.stringify(n))}_buildConversation(e){const t=JSON.parse(e);return f(this,Ms,"m",Gs).call(this,t)}_convertResultList(e,t){let{list:i}=JSON.parse(e);return i=i.map((e=>{const i=JSON.parse(e.obj);return t?t(i):i})),i}_getMessagesByUIds(e){if(0===e.length)return[];const t=fs(this.logger,!1,"getMessageByUids",e);return JSON.parse(t).list.map((e=>f(this,Ms,"m",ks).call(this,JSON.parse(e.obj))))}_handleLowPriorityMessages(e,t){if(this._lowPriorityMessageHandler.isEmpty())return;const i=Date.now(),{count:r}=this._lowPriorityMessageHandler,s=this.logger.createTraceId();this.logger.info(Er.L_HANDLE_LOW_PRIORITY_MESSAGES_T,JSON.stringify({startTime:i,count:r}),s);const n=this._lowPriorityMessageHandler.build(),{srsmsgs:o,readNtfs:a,expansionMsgQueue:l,v1ReceiptMsgs:c,privateRSMsgs:h,groupRSMsgs:u,rrmsgs:d,logCmdQueue:E,cloudControllerVers:I,messageUIds:_}=n,f=new Map;this._getMessagesByUIds([..._.values()]).forEach((e=>{f.set(e.messageUId,e)})),this._handleExpansionMsgQueue(l,f),this._sendMessageNotification(a,!1),this._handlerReadReceiptMsgV1(c,f,e),this._handleSRSMsgs(o,t),this._handlerPrivateRSMsgs(h),this._handlerGroupRSMsgs(u,f),this._handlerRRMsgs(d,f),I.length>0&&(this.cloudControllerMsgs.push(...I),this._ccMsgHandler()),E.forEach((e=>{const{startTime:t,endTime:i,platform:r,logId:s,uri:n,messageUId:o}=e;this.reporter.report(t,i,r,n,s,o)})),this.logger.info(Er.L_HANDLE_LOW_PRIORITY_MESSAGES_R,JSON.stringify({startTime:i,cost:Date.now()-i}),s)}_updateReadReceiptRequestInfoList(e){if(0===e.length)return;const t=e.map((e=>JSON.stringify({message_uid:e.messageUId,request_info:JSON.stringify(e.readReceiptInfo)})));fs(this.logger,!1,"updateReadReceiptRequestInfoList",t)}_handlerRRMsgs(e,t){const i=[],r=[];Array.from(e.entries()).forEach((([e,s])=>{const n=t.get(e);if(!n)return;const{rrn:o,tmn:a}=s.content;let l=n.readReceiptInfo||{};l=Object.assign(Object.assign({},l),{readCount:o,totalCount:a}),n.readReceiptInfo=l,i.push({messageUId:e,readReceiptInfo:l}),r.push(s)})),this._updateReadReceiptRequestInfoList(i),this._sendMessageNotification(r,!1)}_handlerGroupRSMsgs(e,t){const i=[],r=[];Array.from(e.entries()).forEach((([e,{totalCount:s,readedCount:n}])=>{const o=t.get(e);if(!o)return;const{conversationType:a,targetId:l,channelId:c}=o;let h=o.readReceiptInfo||{};h=Object.assign(Object.assign({},h),{readCount:n,totalCount:s}),o.readReceiptInfo=h,i.push({messageUId:e,readReceiptInfo:h}),r.push({conversationType:a,targetId:l,channelId:c,readedCount:n,totalCount:s,messageUId:e})})),this._updateReadReceiptRequestInfoList(i),r.forEach((e=>this._sendMessageReadReceipt({groupReadReceipt:e})))}_handlerPrivateRSMsgs(e){e.forEach((e=>{const{conversationType:t,targetId:i,channelId:r,timestamp:s}=e;this._updateMessageReceiptStatus(t,i,s,r||""),this._sendMessageReadReceipt({privateReadReceipt:{conversationType:t,targetId:i,channelId:r||"",endMsgTime:s}})}))}_handleSRSMsgs(e,t){1!==this.getNaviInfoFromCache().sesDriven?this._sendMessageNotification(e,!1):e.forEach((e=>{const{conversationType:i,targetId:r,channelId:s,sentTime:n,content:o}=e;n>t||this._sendsyncReadStatus({conversationType:i,targetId:r,channelId:s,timestamp:o.lastMessageSendTime})}))}_handlerReadReceiptMsgV1(e,t,i){if(0===e.length)return;const r=new Set,s=[];e.forEach((e=>{const{messageType:n,senderUserId:o,content:a}=e;if(n===Ye){const{messageUId:n}=a,l=t.get(n);if(!l||l.senderUserId!==o)return;return l.readReceiptInfo=o===i?{isReceiptRequestMessage:!0,readerList:[]}:{isReceiptRequestMessage:!0,hasRespond:!1},r.add(l),void s.push(e)}const l=a.receiptMessageDic;if(o===i)return Object.values(l).forEach((e=>{e.forEach((e=>{const i=t.get(e);i&&(i.readReceiptInfo=Object.assign(Object.assign({},i.readReceiptInfo),{hasRespond:!0}),r.add(i))}))})),void s.push(e);const c=l[i];c&&0!==c.length&&(c.forEach((e=>{const i=t.get(e);if(!i)return;const s=i.readReceiptInfo,n=((null==s?void 0:s.readerList)||[]).concat(o);i.readReceiptInfo=Object.assign(Object.assign({},i.readReceiptInfo),{readerList:n}),r.add(i)})),s.push(e))})),this._enableReadReceiptStorage&&this._updateReadReceiptRequestInfoList(Array.from(r.values()).map((e=>({messageUId:e.messageUId,readReceiptInfo:e.readReceiptInfo})))),this._sendMessageNotification(s,!1)}_handleExpansionMsgQueue(e,t){if(0===e.size)return;const i=[],r=[];Array.from(e.entries()).forEach((([e,s])=>{const n=t.get(e);if(!n||!s.length)return;const o=new Set,a=new Set;let l=n.expansion||{};s.forEach((({put:e,del:t,clear:i})=>{if(i)return Object.keys(l).forEach((e=>{o.add(e),a.clear()})),void(l={});e&&(Object.keys(e).forEach((e=>{o.delete(e),a.add(e)})),l=Object.assign(Object.assign({},l),e)),t&&t.forEach((e=>{o.add(e),a.delete(e),delete l[e]}))})),n.expansion=l;const c={};Object.keys(l).forEach((e=>{c[e]={v:l[e]}})),i.push({messageUId:e,expansion:JSON.stringify(c)});const h={},{conversationType:u,targetId:d,channelId:E}=n;let I=!1;o.size>0&&(I=!0,h.deletedExpansion={conversationType:u,targetId:d,channelId:E||"",messageUId:e,deletedKeys:Array.from(o)}),a.size>0&&(I=!0,h.updatedExpansion={conversationType:u,targetId:d,channelId:E||"",messageUId:e,expansion:l}),I&&r.push(h)})),f(this,Ms,"m",Js).call(this,i),r.forEach((e=>this._dispatchEvent("expansion",e)))}_handleHighPriorityMessages(e,t){const i=e.filter((e=>{const{messageType:t,conversationType:i}=e;return t!==xe&&(t===He?f(this,Ms,"m",Ys).call(this,e,"highPriorityMessages"):i!==oe.CHATROOM||f(this,Ms,"m",Bs).call(this,e))}));this._sendMessageNotification(i,t)}_ccMsgHandler(){return _(this,void 0,void 0,(function*(){var e;if(!this.cloudControllerLock)return;this.cloudControllerLock=!1;if(this.cloudControllerMsgs.shift()){const t=this.tcpMgr.getToken(),i=(yield null===(e=this.cloudController)||void 0===e?void 0:e.request(this.cloudControllerUri,qi,t))||0;this.cloudControllerMsgs=this.cloudControllerMsgs.filter((e=>e>i)),this.cloudControllerLock=!0,this._ccMsgHandler()}}))}_sendMessageNotification(e,t){e.length>0&&this._dispatchEvent("batchMessage",e,void 0,t)}_sendPullOfflineFinished(){this._isConnected?(this.logger.info(b),this._dispatchEvent("pullFinished")):this._offlineFinishedPending=!0}_handleMessageModified(e,t,i){const r=JSON.parse(e).list.map((({obj:e})=>this._buildMessage(e)));if(1===i)r.length&&this._dispatchEvent("messagesModified",r);else if(2===i){const e=r.filter((e=>f(this,Ms,"m",Ys).call(this,e,"messageModified")));this._sendMessageNotification(e,!1)}this._needDispatchMessageModifiedSyncCompleted&&!t&&this._isConnected&&(this._needDispatchMessageModifiedSyncCompleted=!1,this._dispatchEvent("messageModifiedSyncCompleted"))}_handleChatroomKVUpdate(e){const t=JSON.parse(e).list.map((({obj:e})=>{const{roomId:t,key:i,value:r,operator:s,version:n,isDeleted:o}=JSON.parse(e);return{chatroomId:t,key:i,value:r,timestamp:n,type:o?z.DELETE:z.UPDATE}}));t.length&&this._sendChatroomEvents({updatedEntries:t})}_handleChatroomFullKVSync(e,t,i){const r=this._chatroomCache.get(e);if(!r)return;r.isKVSynced||(r.isKVSynced=!0,this._sendChatroomEvents({entriesSynced:e}));const s=e=>JSON.parse(e).list.map((({obj:e})=>JSON.parse(e))).reduce(((e,t)=>e.set(t.key,t)),new Map),n=s(t),o=s(i),a=[];Array.from(n.entries()).forEach((([e,t])=>{const{roomId:i,value:r,operator:s,version:n,isDeleted:l}=t,c=o.get(e);c?(o.delete(e),a.push({chatroomId:i,key:e,value:c.value,timestamp:c.version,type:z.UPDATE})):a.push({chatroomId:i,key:e,value:r,timestamp:n,type:z.DELETE})})),Array.from(o.entries()).forEach((([t,i])=>{a.push({chatroomId:e,key:t,value:i.value,timestamp:i.version,type:z.UPDATE})})),a.length&&this._sendChatroomEvents({updatedEntries:a})}_sendChatroomEvents(e){this._dispatchEvent("chatroom",e)}_sendMessageReadReceipt(e){this._dispatchEvent("messageReadReceipt",e)}_sendsyncReadStatus(e){this._dispatchEvent("syncReadStatus",e)}_setConversationStatusListener(){Nr.setConversationStatusListener(this._catcher.gen("setConversationStatusListener[0]",(e=>{const t=JSON.parse(e).list.map((e=>{const t=JSON.parse(e.obj),i={conversation:{channelId:t.channelId,conversationType:t.conversationType,targetId:t.targetId},updatedItems:{}};return t.status.forEach((e=>{const{type:t,value:r}=JSON.parse(e.item);if(1===t){const e=Number(r)||vt.NOT_SET;i.updatedItems.notificationLevel={val:e,time:0},i.updatedItems.notificationStatus={val:At(e),time:0}}else 2===t?i.updatedItems.isTop={val:"1"===r,time:0}:4===t&&(i.updatedItems.translateStrategy={val:Number(r),time:0})})),i}));t.length>0&&this._dispatchEvent("conversation",t)})),this._catcher.gen("setConversationStatusListener[1]",(e=>{this._dispatchEvent("conversationTag")})),this._catcher.gen("setConversationStatusListener[2]",((e,t,i,r)=>{this._clearUnreadCountByTimestamp({conversationType:e,targetId:t,channelId:i},r),this._sendsyncReadStatus({conversationType:e,targetId:t,channelId:i,timestamp:r})})),this._catcher.gen("setConversationStatusListener[3]",(e=>this._dispatchEvent("conversationStatusSynced",e))),this._catcher.gen("setConversationStatusListener[4]",(()=>{this._dispatchEvent("syncServerSaveUnreadCompleted")})),this._catcher.gen("setConversationStatusListener[5]",(e=>{const t=f(this,Ms,"m",Fs).call(this,e,"OnConversationUnreadChanged");if(!t.isOk)return;const i=t.data.map((e=>({conversation:e,updatedItems:{unreadMessageCount:{val:e.unreadMessageCount,time:0},hasMentioned:{val:!!e.hasMentioned,time:0}}})));this._dispatchEvent("conversation",i)})))}_setPushNotificationListener(){Nr.setPushNotificationListener(this._catcher.gen("setPushNotificationListener[0]",(e=>this._getRTCProfile())),this._catcher.gen("setPushNotificationListener[1]",(()=>this._dispatchEvent("tag"))),this._catcher.gen("setPushNotificationListener[2]",(e=>this._dispatchEvent("userSettingsSynced",e))),this._catcher.gen("setPushNotificationListener[3]",(e=>this._dispatchEvent("userSettingsChanged",{key:mi,value:e}))),this._catcher.gen("setPushNotificationListener[4]",(e=>this._dispatchEvent("userSettingsChanged",{key:vi,value:e}))))}_getRTCProfile(){const e=this._callCppProxy("getRTCProfile");if(!e)return;const t=this.tcpMgr.getToken();this.navi.updateVoipCallInfo(t,e);const i=this.navi.getNaviInfoFromCache(t);this._dispatchEvent("onNaviDataChange",i)}_setRTCLivingRoomEventListener(){Nr.setRTCRoomEventListener(this._catcher.gen("setRTCRoomEventListener",(e=>{this._dispatchEvent("onRTCDataChange",Array.prototype.slice.call(e))})))}_setChatroomEventListener(){Nr.setChatroomEventListener(this._catcher.gen("setChatroomEventListener[0]",((e,t)=>this._sendChatroomEvents({chatroomDestroyed:e,chatroomDestroyedType:t})))),Nr.setChatroomStatusListener(this._catcher.gen("setChatroomEventListener[1]",((e,t,i)=>this._handleChatroomFullKVSync(e,t,i))),this._catcher.gen("setChatroomEventListener[2]",(e=>this._handleChatroomKVUpdate(e))))}_setCallInfoListener(){Nr.setCallInfoListener(this._catcher.gen("setCallInfoListener[0]",(e=>{const t=[];try{JSON.parse(e).list.forEach((e=>{Object.entries(e).forEach((([e,i])=>{t.push({key:e,value:i})}))}))}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e}))}this._dispatchEvent("callInfo",JSON.stringify({list:t}))})))}_setSubscribeEventListener(){Nr.setSubscribeEventListener(this._catcher.gen("setSubscribeEventListener[0]",(()=>{})),this._catcher.gen("setSubscribeEventListener[1]",(e=>{this._dispatchEvent("syncSubscribedUserStatusFinished",e)})),this._catcher.gen("setSubscribeEventListener[2]",(e=>{const t=this._buildSubscribeEventData(e).map((e=>({userId:e.userId,subscribeType:e.subscribeType,subscribeTime:e.subscribeTime,expiry:e.expiry,operationType:e.operationType})));this._dispatchEvent("subscribedRelationChange",t)})),this._catcher.gen("setSubscribeEventListener[3]",(e=>{const t=this._buildSubscribeEventData(e).map((e=>{const{userId:t,subscribeType:i,subscribeTime:r,expiry:s,details:n,userProfile:o}=e,a={userId:t,subscribeType:i,subscribeTime:r,expiry:s};return[ft.ONLINE_STATUS,ft.FRIEND_ONLINE_STATUS].includes(i)?a.details=n:[ft.USER_PROFILE,ft.FRIEND_USER_PROFILE].includes(i)&&(a.userProfile=o),a}));this._dispatchEvent("subscribedUserStatusChange",t)})))}_setUserProfileListener(){Nr.setUserProfileListener(this._catcher.gen("setUserProfileListener[0]",(e=>{this._dispatchEvent("syncSubscribedUserStatusFinished",e)})),this._catcher.gen("setUserProfileListener[1]",(e=>{this._dispatchEvent("ownUserProfileChanged",this._string2userProfileInfo(e))})))}_onGroupOperationChanged(e,t,i,r,s){let n,o,a=[];try{n=JSON.parse(r),a=JSON.parse(s),o=JSON.parse(e);let l={groupId:n[0]?n[0].groupId:"",operatorInfo:ms(o),operation:t,operationTime:i};0===t?[l.groupInfo]=this._convertGroupInfoList(n):l.memberInfos=As(a),this._dispatchEvent("groupOperation",l)}catch(t){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:t,groupInfoJson:r,membersJson:s,operatorInfo:e}))}}_onGroupInfoChanged(e,t,i,r,s,n){try{const o=this._convertUpdateGroupInfoList(JSON.parse(s))[0];switch(e){case j.GROUP_INFO_CHANGE:const s=JSON.parse(i),a={operatorInfo:s.userId?ms(s):void 0,operationTime:n,groupInfo:o,changedGroupInfo:o,fullGroupInfo:r?this._convertUpdateGroupInfoList(JSON.parse(r))[0]:o};this._dispatchEvent("groupInfoChanged",a);break;case j.GROUP_REMARK_DELETE:case j.GROUP_REMARK_SET:{const i=e===j.GROUP_REMARK_SET?W.ADD:W.REMOVE;this._dispatchEvent("groupRemarkChangedSync",{groupId:t,operationType:i,operationTime:n,groupRemark:(null==o?void 0:o.remark)||""});break}}}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfoJson:s,operatorInfoJson:i}))}}_onGroupMemberInfoChanged(e,t,i,r){try{const s=JSON.parse(t),n=JSON.parse(i),o={groupId:e,operatorInfo:s.userId?ms(s):void 0,memberInfo:ms(n),operationTime:r};this._dispatchEvent("groupMemberInfoChanged",o)}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e,operatorInfoJson:t,updateMemberInfoJson:i}))}}_onGroupRequestChanged(e,t,i,r){try{const e=JSON.parse(i),{groupId:t,joinUser:s,approverUser:n,inviterUser:o,type:a,status:l,direction:c,remark:h}=e,u=Object.assign(Object.assign(Object.assign(Object.assign({groupId:t},s&&{joinMemberInfo:ms(s)}),o&&o.userId&&{inviterInfo:ms(o)}),n&&n.userId&&{operatorInfo:ms(n)}),{status:l,direction:c,type:a,operationTime:r,reason:h});this._dispatchEvent("groupApplicationEvent",u)}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfo:t,requestInfoJson:i}))}}_onFavoriteMembersChanged(e,t,i,r){try{const s=JSON.parse(i);let n=[];s&&$t(s.list)&&(n=s.list.map((e=>e.value))),this._dispatchEvent("groupFollowsChangedSync",{groupId:e,operationType:t,operationTime:r,userIds:n})}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e,memberIds:i}))}}_setEntrustGroupListener(){Nr.setEntrustGroupListener(this._catcher.gen("setEntrustGroupListener[0]",this._onGroupOperationChanged.bind(this)),this._catcher.gen("setEntrustGroupListener[1]",this._onGroupInfoChanged.bind(this)),this._catcher.gen("setEntrustGroupListener[2]",this._onGroupMemberInfoChanged.bind(this)),this._catcher.gen("setEntrustGroupListener[3]",this._onGroupRequestChanged.bind(this)),this._catcher.gen("setEntrustGroupListener[4]",this._onFavoriteMembersChanged.bind(this)))}_onFriendApplicationStatusChanged(e,t,i,r,s,n){this._dispatchEvent("friendApplicationStatusChanged",{userId:e,applicationType:t,applicationStatus:i,directionType:r,operationTime:s,extra:null!=n?n:""})}_onFriendAdd(e,t,i,r,s){this._dispatchEvent("friendAdd",{userId:t,name:i,portraitUri:r,directionType:e,operationTime:s})}_onFriendDelete(e,t,i){const r={directionType:e,operationTime:i,userIds:JSON.parse(t).list.map((e=>e.value))};this._dispatchEvent("friendDelete",r)}_onFriendsClearedFromServer(e){this._dispatchEvent("friendCleared",e)}_onFriendInfoChangedSync(e,t,i){try{const r=JSON.parse(i);this._dispatchEvent("friendInfoChangedSync",{userId:e,remark:t,extProfile:r.list,operationTime:0})}catch(e){this.logger.error(Er.P_PARSE_JSON_E,JSON.stringify({error:e,profiles:i}))}}_setFriendEventListener(){Nr.setFriendEventListener(this._catcher.gen("setFriendEventListener[0]",this._onFriendApplicationStatusChanged.bind(this)),this._catcher.gen("setFriendEventListener[1]",this._onFriendAdd.bind(this)),this._catcher.gen("setFriendEventListener[2]",this._onFriendDelete.bind(this)),this._catcher.gen("setFriendEventListener[3]",this._onFriendsClearedFromServer.bind(this)),this._catcher.gen("setFriendEventListener[4]",this._onFriendInfoChangedSync.bind(this)))}registerMessageType(e,t){t.isPersited=e!==He&&t.isPersited;let i=0;const{isCounted:r,isCustom:s,isStatusMessage:n,searchProps:o,isPersited:a}=t;a&&(i|=1),r&&(i|=2),n&&(i=16),s&&function(e,t){const i=ar.get(e);i&&!i.isCustom&&console.warn(`Builtin message type '${e}' cannot be registered`),t.isStatusMessage&&(t.isCounted=t.isPersited=!1),ar.set(e,Object.assign(Object.assign({},t),{isCustom:!0}))}(e,t),fs(this.logger,!1,"registerMessageType",e,i,o||[])}connect(e,t,i,r){return this.tcpMgr.connect(e,t,i,r)}reconnect(e,t,i){const r=ne.RC_SOCKET_DISCONNECTED;return this.tcpMgr.reconnect(e,t,i,r)}reportSDKInfo(e){const t=JSON.stringify(Object.assign(Object.assign({},e),{"electron-main":"5.48.1"}));this.logger.info(Er.P_REPORT_VER_O,t),fs(this.logger,!1,"uploadSDKVersion",t,"")}disconnect(e,t){return _(this,void 0,void 0,(function*(){return e=e||!0,this._chatroomCache.clear(),this.reporter.stop(),Br(null,this.logger),yield this.tcpMgr.disconnect(e,t),gi()}))}setUserStatus(e){const t=gs.create(this.logger,"setUserStatus");return t.asyncInvoke(e,(()=>t.ok()),(e=>t.fail(e))).result()}getUserStatus(e){const t=gs.create(this.logger,"getUserStatus");return t.asyncInvoke(e,(e=>t.ok({status:e})),(e=>t.fail(e))).result()}_handleDirectionalUserIdList(e,t){let{messageType:i,content:r,directionalUserIdList:s=[]}=e;const n=t===oe.GROUP;if(i===je&&r.receiptMessageDic&&n)for(const e in r.receiptMessageDic)s.push(e);return i===We&&(s=((e,t)=>t&&0!==t.length?[oe.GROUP,oe.ULTRA_GROUP,oe.APP_PUBLIC_SERVICE,oe.PUBLIC_SERVICE].includes(e)?t:[]:t||[])(t,[this._getCurrentUserId()])),s}_handleMessage2Callback(e,t){switch(e.messageType){case Fe:this._msgExpansionHandler.setLocalFromExtMsg(this.logger,e);break;case Ye:this._enableReadReceiptStorage&&this._updateReadReceiptInfo(t.content.messageUId,{isReceiptRequestMessage:!0,readerList:[]});break;case je:if(this._enableReadReceiptStorage){const{receiptMessageDic:e}=t.content;if(!e)return;for(const t in e)e[t].forEach((e=>{this._updateReadReceiptInfo(e,{isReceiptRequestMessage:!0,hasRespond:!0})}))}}}sendMessage(e,t,i,r){return _(this,void 0,void 0,(function*(){const{conversationType:s,targetId:n,channelId:o}=e;let{messageType:a,content:l,expansion:c,pushConfig:h,pushContent:u="",pushData:d="",directionalUserIdList:E=[],disableNotification:I=!1,canIncludeExpansion:_=!1,isVoipPush:f=!1,messageId:g=0,disableUpdateLastMessage:R,needReceipt:p,quoteInfo:T}=t,{iOSConfig:N,androidConfig:S,harmonyOSConfig:O,templateId:C="",pushTitle:v="",pushContent:m=u,pushData:A=d,disablePushTitle:M=!1,forceShowDetailContent:y=!1}=h||{};const b=ci(N,S,O);u=m,d=A;const P=(null==S?void 0:S.notificationId)||"";E=this._handleDirectionalUserIdList(t,s);const L={};for(const e in c)L[e]={v:c[e]};const U=C;this.logger.info(Er.P_SEND_MSG_T,JSON.stringify({messageType:a,conversationType:s,targetId:n,channelId:o}),i);const D=gs.create(this.logger,"sendMessage"),w=fs(this.logger,!1,"sendMessage",((e,r)=>{const s=this._buildMessage(e,!1);this.logger.info(Er.P_SEND_MSG_R,JSON.stringify({code:r,messageUId:s.messageUId}),i),r!==ne.SENSITIVE_REPLACE?(this._handleMessage2Callback(s,t),D.ok(s)):D.fail(r)}),((e,t)=>{const r=this._buildMessage(e,!1);this.logger.warn(Er.P_SEND_MSG_R,JSON.stringify({code:t,messageId:r.messageId}),i),r.sentTime=Date.now()-Nr.getDeltaTime(),D.fail(t,r)}),s,n,a,JSON.stringify(l),E,I,M,y,u,d,P,v,b,U,_,JSON.stringify(L),f,o||"",g,!!R,!!p,(null==T?void 0:T.messageUId)||"",(null==T?void 0:T.senderId)||"",(null==T?void 0:T.objectName)||""),V=JSON.parse(w);return null==r||r(V.messageId),D.result()}))}recallMsg(e,t){return _(this,void 0,void 0,(function*(){var i;const r=e.channelId||"",{targetId:s,conversationType:n}=e,{user:o,pushContent:a,extra:l,pushConfig:c,disableNotification:h,isDelete:u,directionalUserIdList:d,disableUpdateLastMessage:E,isAdmin:I,messageUId:g,sentTime:R}=t,p={conversationType:n,targetId:s,messageUId:g,sentTime:R,user:o,extra:l,channelId:r,isDelete:u||!1,isAdmin:I};o&&(p.user=o),l&&(p.extra=l);const T={conversationType:n,targetId:s,senderUserId:this.tcpMgr.getCurrentUserId(),content:p,objectName:He,messageUid:g,direction:St.SEND,status:Mt.UNREAD,sentTime:R,channelId:r},N=this._buildMessage(JSON.stringify(T),!1),S=gs.create(this.logger,"recallMessage");return S.asyncInvoke((e=>_(this,void 0,void 0,(function*(){f(this,Ms,"m",Ys).call(this,N,"recall"),n===oe.ULTRA_GROUP&&this._dispatchEvent("ultraGroupMessageRecalled",[N]),N.pushConfig=c,S.ok(N)}))),(e=>S.fail(e)),He,JSON.stringify(p),h||!1,(null==c?void 0:c.disablePushTitle)||!1,(null==c?void 0:c.forceShowDetailContent)||!1,a||"",(null==c?void 0:c.pushData)||"",(null===(i=null==c?void 0:c.androidConfig)||void 0===i?void 0:i.notificationId)||"",(null==c?void 0:c.pushTitle)||"",ci(null==c?void 0:c.iOSConfig,null==c?void 0:c.androidConfig,null==c?void 0:c.harmonyOSConfig),(null==c?void 0:c.templateId)||"",r,d||[],g,null!=E&&E).result()}))}getHistoryMessage(e,t,i){return _(this,void 0,void 0,(function*(){return i?gi(f(this,Ms,"m",js).call(this,e,t)):f(this,Ms,"m",Ws).call(this,e,t)}))}getContinuousMessages(e,t){return _(this,void 0,void 0,(function*(){const{timestamp:i,count:r,order:s}=t,{conversationType:n,targetId:o,channelId:a}=e,l=gs.create(this.logger,"getContinuousMessages",this.logger.createTraceId());return(yield l.asyncInvoke(n,o,i,r,((e,t,i)=>l.ok({listJson:e,hasMore:i,nextTime:t})),(e=>l.fail(e)),0===s,a||"").result()).trans((({listJson:e,hasMore:t,nextTime:i})=>({list:JSON.parse(e).list.map((({obj:e})=>this._buildMessage(e))).reverse(),hasMore:!!t,timestamp:i})))}))}deleteRemoteMessage(e,t){const{conversationType:i,targetId:r,channelId:s}=e,n=JSON.stringify(t),o=this.logger.createTraceId(),a=gs.create(this.logger,"deleteRemoteHistoryMessages",o);return a.asyncInvoke(i,r,n,!1,s||"",(()=>a.ok()),(e=>a.fail(e))).result()}deleteRemoteMessageByTimestamp(e,t){const i=this.logger.createTraceId(),r=gs.create(this.logger,"clearRemoteHistoryMessages",i);return r.asyncInvoke(e.conversationType,e.targetId,t,(()=>r.ok()),(e=>r.fail(e)),e.channelId||"").result()}clearLocalMessages(e){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",Ks).call(this,e),gi()}))}getConversationListByTimestamp(e,t){return _(this,void 0,void 0,(function*(){const{channelId:i,count:r,startTime:s,order:n,conversationTypes:o,topPriority:a,unreadCountFilter:l}=e,c=(o&&o.length>0?o:_e(t?ce:ae)).map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):i,channelIdValid:e===oe.ULTRA_GROUP||"string"==typeof i}))),h={sendTime:s,limit:r,sort:a?1:0,unreadFilter:l||Ft},u=gs.create(this.logger,"getConversationListByPageWithTopPriorityV2"),d=yield u.invoke(c,h,((e,t)=>u.flush(fi.from(e,void 0,t)))).result();return d.isOk?f(this,Ms,"m",Fs).call(this,d.data,"getConversationListByPageWithTopPriorityV2"):d.wipe()}))}getTopConversationList(e,t,i){return _(this,void 0,void 0,(function*(){const r=(((null==t?void 0:t.length)||0)>0?t:_e(e?ce:ae)).map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):i,channelIdValid:e===oe.ULTRA_GROUP||"string"==typeof i}))),s=fs(this.logger,!1,"getTopConversationsV2",r);return f(this,Ms,"m",Fs).call(this,s,"getTopConversationsV2")}))}getUnreadConversationList(e,t){return _(this,void 0,void 0,(function*(){const i=(((null==t?void 0:t.length)||0)>0?t:_e(e?ce:ae)).map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):"",channelIdValid:e===oe.ULTRA_GROUP}))),r=fs(this.logger,!1,"getUnreadConversationListV2",i);return f(this,Ms,"m",Fs).call(this,r,"getUnreadConversationListV2")}))}getAllConversationList(e,t){return _(this,void 0,void 0,(function*(){const i=_e(e?ce:ae).map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):t,channelIdValid:e===oe.ULTRA_GROUP||"string"==typeof t}))),r=fs(this.logger,!1,"getConversationsV2",i);return f(this,Ms,"m",Fs).call(this,r,"getConversationsV2")}))}getUntaggedConversationListByPage(e,t,i){return _(this,void 0,void 0,(function*(){const r=fs(this.logger,!1,"getConversationsByPageWithoutTag",e,t,i);return f(this,Ms,"m",Fs).call(this,r,"getConversationsByPageWithoutTag")}))}getConversation(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,s=f(this,Ms,"m",qs).call(this,e);if(s)return gi(s);const n=f(this,Ms,"m",js).call(this,e,{timestamp:0,count:1,order:0,messageType:""}),o=(null==n?void 0:n.list[0])||null,a=JSON.parse(fs(this.logger,!1,"getConversationStatus",JSON.stringify([{conversation_type:t,target_id:i,channel_id:r,channel_id_valid:"string"==typeof r&&r.length>0}])))[0],l=!!(null==a?void 0:a.is_top),c=(null==a?void 0:a.translate_strategy)||cr,h=(yield this.getConversationNotificationLevel(e)).data,u={conversationType:t,targetId:i,channelId:r,latestMessage:o,lastUnreadTime:0,isTop:l,notificationLevel:h,notificationStatus:At(h),translateStrategy:c,unreadMessageCount:f(this,Ms,"m",Qs).call(this,e)};return gi(u)}))}batchDeleteConversations(e){const{identifiers:t,deleteRemotely:i,deleteMessages:r}=e,s=gs.create(this.logger,"batchDeleteConversations",this.logger.createTraceId());return s.invoke({conversationIdentifiers:t.map((e=>({type:e.conversationType,targetId:e.targetId,channelId:e.channelId||""}))),deleteMessages:r,deleteRemotely:i},(()=>s.ok()),(e=>s.fail(e))).result()}clearConversations(e,t){return _(this,void 0,void 0,(function*(){const t=(e instanceof Array?e:_e(ce)).map((e=>({conversationType:e,channelIdValid:!1}))),i=fs(this.logger,!0,"clearConversationsV2",t);return i===ne.SUCCESS?gi():Ri(i)}))}getTotalUnreadCount(e,t,i){return _(this,void 0,void 0,(function*(){const r=e.map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):i,channelIdValid:e===oe.ULTRA_GROUP||"string"==typeof i})));let s=fs(this.logger,!0,"getTotalUnreadCount2",r,t);return gi(s)}))}getConversationUnreadCount(e){return _(this,void 0,void 0,(function*(){const t=f(this,Ms,"m",Qs).call(this,e);return gi(t)}))}clearConversationUnreadCount(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e;if(t===oe.ULTRA_GROUP){const e=this._getServerTime(),s=gs.create(this.logger,"setReadTimestamp",this.logger.createTraceId());return s.asyncInvoke(t,i,e,(()=>s.ok()),(e=>s.fail(e)),r||"").result()}return f(this,Ms,"m",$s).call(this,e),gi()}))}clearAllSGUnreadCount(){return _(this,void 0,void 0,(function*(){const e=yield this.getUnreadConversationList(!1);return e.isOk?(e.data.forEach((e=>{e.conversationType!==oe.ULTRA_GROUP&&f(this,Ms,"m",$s).call(this,e)})),gi()):e.wipe()}))}_clearUnreadCountByTimestamp(e,t){const{conversationType:i,targetId:r,channelId:s}=e;fs(this.logger,!1,"clearUnreadCountByTimestamp",i,r,t,s||"")}clearUnreadCountByTimestamp(e,t){return _(this,void 0,void 0,(function*(){return this._clearUnreadCountByTimestamp(e,t),gi()}))}getFirstUnreadMessage(e){return _(this,void 0,void 0,(function*(){const t=f(this,Ms,"m",zs).call(this,e);return gi(t)}))}getFirstUnreadMessageDigest(e){return _(this,void 0,void 0,(function*(){const t=f(this,Ms,"m",zs).call(this,e);return gi(t?{messageUId:t.messageUId,sentTime:t.sentTime}:null)}))}batchSetConversationToTop(e,t,i,r){return f(this,Ms,"m",en).call(this,e,-1,t?1:0,-1,i,r)}batchSetConversationNotificationLevel(e,t){const i=this.logger.createTraceId(),r=gs.create(this.logger,"setBlockPushLevelInBatches",i),s=e.map((e=>({conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,level:t})));return r.asyncInvoke(JSON.stringify(s),(()=>r.ok()),(e=>r.fail(e))).result()}batchSetConversationTranslateStrategy(e,t){return f(this,Ms,"m",en).call(this,e,-1,-1,t,!1,!1)}setConversationTypeNotificationLevel(e,t){const i=gs.create(this.logger,"setBlockPushLevelForType",this.logger.createTraceId());return i.asyncInvoke(e,t,(()=>i.ok()),(e=>i.fail(e))).result()}getConversationTypeNotificationLevel(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!0,"getBlockPushLevelForType",e);return gi(t)}))}searchConversationByContent(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=this.logger.createTraceId(),n=gs.create(this.logger,"searchConversationByContentV2",s),o=r.map((e=>({conversationType:e,channelId:i,channelIdValid:!0}))),a=yield n.asyncInvoke(o,e,t,((e,t,i)=>{e===ne.SUCCESS?n.ok({result:t,matchedNumber:i}):n.fail(e)})).result();return a.isOk?a.trans((e=>JSON.parse(e.result).map((e=>f(this,Ms,"m",Gs).call(this,e))))):gi([])}))}searchConversationByContentWithAllChannel(e,t,i){return _(this,void 0,void 0,(function*(){i=i||_e(ae);const r=this.logger.createTraceId(),s=gs.create(this.logger,"searchConversationByContentV2",r),n=i.map((e=>({conversationType:e,channelIdValid:!1}))),o=yield s.asyncInvoke(n,e,t,((e,t,i)=>{e===ne.SUCCESS?s.ok({result:t,matchedNumber:i}):s.fail(e)})).result();return o.isOk?o.trans((e=>JSON.parse(e.result).map((e=>f(this,Ms,"m",Gs).call(this,e))))):gi([])}))}searchMessagesWithParams(e){return _(this,void 0,void 0,(function*(){var t,i,r,s,n;const o=this.logger.createTraceId(),a=function(e){if(!e)return[];let t=[];const i=e=>{if(0===t.length)return void t.push(...e);const i=[];e.forEach((e=>{i.push(...t.map((t=>Object.assign(Object.assign({},t),e))))})),t=i},{conversationTypes:r=[],targetIds:s=[],channelIds:n=[]}=e,o=Oi(r).map((e=>({conversationType:e}))),a=Oi(s).map((e=>({targetId:e}))),l=Oi(n).length?n.map((e=>({channelId:e}))):[{channelIdValid:!1}];return i(o),i(a),i(l),t}(e.conversationFilter),l={keyword:e.keyword,limit:e.limit,desc:!e.order,offset:null!==(t=e.offset)&&void 0!==t?t:0,needMatchCount:!0,startTime:null===(i=e.timeRange)||void 0===i?void 0:i.startTime,endTime:null===(r=e.timeRange)||void 0===r?void 0:r.endTime,objectNames:Oi((null===(s=e.messageFilter)||void 0===s?void 0:s.objectNames)||[]),senderIds:Oi((null===(n=e.messageFilter)||void 0===n?void 0:n.senderIds)||[])},c=gs.create(this.logger,"searchMessage",o);return(yield c.invoke(a,l,((e,t,i,r)=>{e===ne.SUCCESS?c.ok({result:t,totalMatched:i,conditionsMatched:r}):c.fail(e)})).result()).trans((({result:e,totalMatched:t,conditionsMatched:i})=>({messages:JSON.parse(e).list.map((e=>JSON.parse(e.obj))).map((e=>f(this,Ms,"m",ks).call(this,e))),totalMatched:t,conditionsMatched:i})))}))}getUnreadMentionedMessages(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!1,"getUnreadMentionedMessages",t,i,r||""),n=JSON.parse(s).list.map((({obj:e})=>f(this,Ms,"m",ks).call(this,JSON.parse(e))));return gi(n)}))}getUnreadMentionedCount(e){return _(this,void 0,void 0,(function*(){var t;const i=f(this,Ms,"m",qs).call(this,e);return gi(null!==(t=null==i?void 0:i.unreadMentionedCount)&&void 0!==t?t:0)}))}addToBlacklist(e){const t=gs.create(this.logger,"addToBlacklist",this.logger.createTraceId());return t.asyncInvoke(e,(()=>t.ok()),(e=>t.fail(e))).result()}removeFromBlacklist(e){const t=gs.create(this.logger,"removeFromBlacklist",this.logger.createTraceId());return t.asyncInvoke(e,(()=>t.ok()),(e=>t.fail(e))).result()}getBlacklist(){const e=gs.create(this.logger,"getBlacklist",this.logger.createTraceId());return e.asyncInvoke((t=>e.ok(t)),(t=>e.fail(t))).result()}getBlacklistStatus(e){const t=gs.create(this.logger,"getBlacklistStatus",this.logger.createTraceId());return t.asyncInvoke(e,(e=>t.ok(e)),(e=>t.fail(e))).result()}insertMessage(e,t){return _(this,void 0,void 0,(function*(){const i=f(this,Ms,"m",tn).call(this,e,t);return-1===i.messageId?Ri(ne.MSG_INSERT_ERROR,"insert message failed",i):gi(i)}))}batchInsertMessage(e){return _(this,arguments,void 0,(function*(e,t=!1){const i=e.map((e=>{const{content:t,senderUserId:i,messageType:r,messageDirection:s,receivedStatus:n=0,sentStatus:o,sentTime:a,searchContent:l,isUnread:c,messageUId:h,disableNotification:u,canIncludeExpansion:d,expansion:E,channelId:I,conversationType:_,targetId:f,source:g,isMentioned:R,receivedStatusInfo:p,directedUserIds:T,disableUpdateLastMessage:N}=e,S=p?(e=>{let t=Mt.UNREAD;return(null==e?void 0:e.isRead)&&(t|=Mt.READ),(null==e?void 0:e.isListened)&&(t|=Mt.LISTENED),(null==e?void 0:e.isDownload)&&(t|=Mt.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=Mt.RETRIEVED),t})(p):n,O=a||0,C={};if(E)for(const e in E)C[e]={v:E[e],ts:O};const v=e.quoteInfo?{messageUId:e.quoteInfo.messageUId,senderId:e.quoteInfo.senderId,objectName:e.quoteInfo.objectName,quoteMessageStatus:e.quoteInfo.quoteMessageStatus||Gt}:void 0;return{conversationType:_,targetId:f,channelId:I||"",direction:s,senderUserId:i,status:o||10,sentTime:O,objectName:r,content:JSON.stringify(t),messageUid:h||"",noNotification:!!u,supportExt:!!d,extMsg:JSON.stringify(C),readStatus:S,searchContent:l||"",isUnread:!!c,source:g||"",isMention:R,directedUsers:T,disableUpdateLastMessage:!!N,quoteInfo:v}}));return fs(this.logger,!0,"insertMessages",JSON.stringify(i),t)?gi(!0):Ri(ne.MSG_INSERT_ERROR)}))}getLocalMessageCount(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!0,"getMessageCount",t,i,r||"");return gi(s)}))}getMessageCountDetail(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"queryConversationDailyMessageCount");return(yield i.invoke(vs(e),t.startTime,t.endTime,((e,t)=>i.flush(fi.from(e,void 0,t))),(e=>i.fail(e))).result()).trans((e=>JSON.parse(e).map((({dateMs:e,count:t})=>({dateMs:e,messageCount:t})))))}))}deleteLocalMessages(e){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",rn).call(this,e),gi()}))}deleteLocalMessagesByTimestamp(e,t,i){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",sn).call(this,e,t,i),gi()}))}batchClearLocalMessagesByTimestamp(e){return _(this,void 0,void 0,(function*(){const t=e.map((e=>({conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId||"",send_time:e.timestamp})));return fs(this.logger,!1,"deleteMessageBySendTimeInBatches",JSON.stringify(t)),gi()}))}batchClearRemoteHistoryMessages(e,t){const i=e.map((e=>({conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId||"",send_time:e.timestamp}))),r=gs.create(this.logger,"deleteRemoteMessageBySendTimeInBatches",this.logger.createTraceId());return r.asyncInvoke(JSON.stringify(i),!!t,(()=>r.ok()),(e=>r.fail(e))).result()}getMessage(e){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",on).call(this,e)}))}setMessageContent(e,t,i){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",an).call(this,e,t,i),gi()}))}setMessageSearchField(e,t,i){return _(this,void 0,void 0,(function*(){return fs(this.logger,!1,"setMessageSearchField",e,t,i),gi()}))}setMessageSentStatus(e,t){return _(this,void 0,void 0,(function*(){return fs(this.logger,!1,"setMessageSentStatus",e,t),gi()}))}setMessageReceivedStatus(e,t){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",ln).call(this,e,t),gi()}))}saveTextMessageDraft(e,t){return _(this,void 0,void 0,(function*(){const{conversationType:i,targetId:r,channelId:s}=e;return fs(this.logger,!1,"saveTextMessageDraft",i,r,t,s||"")?gi():Ri(ne.DRAFT_SAVE_ERROR)}))}getTextMessageDraft(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!0,"getTextMessageDraft",t,i,r||"");return gi(s)}))}clearTextMessageDraft(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e;return fs(this.logger,!1,"clearTextMessageDraft",t,i,r||"")?gi():Ri(ne.DRAFT_REMOVE_ERROR)}))}getConversationNotificationLevel(e){return _(this,void 0,void 0,(function*(){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!0,"getBlockPushLevelForConversation",i,r||"",t);return gi(s)}))}getTotalUnreadCountByLevels(e,t,i){return _(this,void 0,void 0,(function*(){const r=e.map((e=>({conversationType:e,channelIdValid:!1}))),s=fs(this.logger,!0,"getUnreadAndMentionCountByLevel",r,t);return 0!==s.code?Ri(s.code):gi(i?s.mention:s.unread)}))}sendReadReceiptV2(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"sendReadReceipt",this.logger.createTraceId()),s=yield r.asyncInvoke(e,i||"",t,(()=>r.ok()),(e=>r.fail(e))).result();return s.isOk&&t.forEach((e=>{this._updateReadReceiptInfo(e,{hasRespond:!0});const t=f(this,Ms,"m",nn).call(this,e);t.isOk&&f(this,Ms,"m",ln).call(this,t.data.messageId,1)})),s}))}getMessageReader(e,t,i){const r=gs.create(this.logger,"getMessageReader",this.logger.createTraceId());return r.asyncInvoke(e,i,t,((e,i)=>{const s=[],n={};JSON.parse(e).list.forEach((e=>{const{id:t,time:i}=JSON.parse(e.obj);s.push({userId:t,readTime:i}),n[t]=i}));const o={readerInfo:n,readCount:s.length,totalCount:i};this._updateReadReceiptInfo(t,o),r.ok({list:s,totalMemberCount:i})}),(e=>r.fail(e))).result()}sendReadReceiptMessageV4(e,t,i){const r=gs.create(this.logger,"sendMessageReadReceipt",this.logger.createTraceId()),{conversationType:s,targetId:n,channelId:o}=e;return r.asyncInvoke(s,n,o||"",t,i,(()=>r.ok()),(e=>r.fail(e))).result()}getMessageReadReceiptV4(e,t){const{targetId:i,channelId:r}=e,s=gs.create(this.logger,"getMessageReadReceipt",this.logger.createTraceId());return s.asyncInvoke(i,r||"",t,((e,i,r)=>_(this,void 0,void 0,(function*(){const n=[],o=this._callCppProxy("getMessage",t),a=JSON.parse(o);try{JSON.parse(r).list.forEach((e=>{const{id:t,time:i}=JSON.parse(e.obj);n.push({userId:t,readTime:i})}))}catch(e){this.logger.error(Er.P_PARSE_JSON_E,`method: getMessageReadReceipt, info: ${r}, error: ${e}`)}let{readerList:l=[],readCount:c=0}=JSON.parse(a.readReceiptRequest||"{}"),h=!1;l.length<n.length&&(l=n,h=!0),c<i&&(c=i,h=!0),h&&this._callCppProxy("updateReadReceiptRequestInfo",t,JSON.stringify({readerList:l,readCount:c,totalCount:e})),s.ok({list:n,totalCount:e,readCount:c})}))),(e=>s.fail(e))).result()}updateConversationReadTime(e,t){const i=gs.create(this.logger,"updateConversationReadTime",this.logger.createTraceId()),{conversationType:r,targetId:s,channelId:n}=e;return i.asyncInvoke(r,s,n||"",t,(()=>i.ok()),(e=>i.fail(e))).result()}_try2RejoinChatroom(){if(0===this._chatroomCache.size)return;const e=this.logger.createTraceId();this._chatroomCache.forEach((t=>_(this,void 0,void 0,(function*(){const{chatroomId:i,count:r,extra:s}=t;this.logger.info(O,i,e);const n=yield this._joinChrm(i,r,!1,!0,s);this.logger.summary(C,n,e);const{code:o,isOk:a,data:l}=n;a?this._sendChatroomEvents({rejoinedRoom:Object.assign({chatroomId:i,count:r},l)}):(o!==ne.RC_CHATROOM_USER_KICKED&&o!==ne.RC_CHATROOM_NOT_EXIST||this._chatroomCache.delete(i),this._sendChatroomEvents({rejoinedRoom:{chatroomId:i,errorCode:o}}))}))))}_joinChrm(e,t,i,r,s){const n=i?"joinChatRoom":"joinExistChatRoom";r||f(this,Ms,"m",Xs).call(this,e,!0,!0);const o=gs.create(this.logger,n,this.logger.createTraceId());return o.asyncInvoke(e,t,((i,n,a,l,c,h,u)=>{this._chatroomCache.set(e,{chatroomId:e,count:t,extra:s||"",isKVSynced:r}),o.ok({createTime:Number(i),memberCount:n,isAllChatroomBanned:a,isCurrentUserBanned:l,isCurrentChatroomBanned:c,isCurrentChatroomInWhitelist:h,joinTime:u})}),(e=>o.fail(e)),s||"").result()}joinChatroom(e,t,i,r){return _(this,void 0,void 0,(function*(){return this._joinChrm(e,t,i,!1,r)}))}quitChatroom(e,t){this._chatroomCache.delete(e);const i=gs.create(this.logger,"quitChatRoom",this.logger.createTraceId());return i.asyncInvoke(e,(()=>i.ok()),(e=>i.fail(e)),t||"").result()}getChatroomInfo(e,t,i){const r=gs.create(this.logger,"getChatroomInfo",this.logger.createTraceId());return r.asyncInvoke(e,t,i,((e,t)=>{const i=(e?JSON.parse(e).list:[]).map((e=>JSON.parse(e.obj)));r.ok({userInfos:i,userCount:t})}),(e=>r.fail(e))).result()}getChatroomHistoryMessages(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=this.logger.createTraceId(),n=gs.create(this.logger,"getChatroomHistoryMessage",s);return n.asyncInvoke(e,t,i,r,(e=>{let t;try{t=JSON.parse(e)}catch(e){t={list:[],hasMore:!1}}const{list:i}=t;if(i&&i.length)try{t.list=i.map((e=>this._buildMessage(e.obj)))}catch(e){t.list=[]}n.ok(t)}),(e=>n.fail(e)),"").result()}))}setChatroomEntry(e,t,i){const r=gs.create(this.logger,"setChatroomStatus",this.logger.createTraceId());return r.asyncInvoke(e,t.key,t.value,!!t.isAutoDelete,i,!!t.isSendNotification,t.notificationExtra||"",(()=>r.ok()),(e=>r.fail(e))).result()}setChatroomEntries(e,t){const i=gs.create(this.logger,"setChatroomKV");return i.asyncInvoke(e,JSON.stringify(t.entries),!!t.isAutoDelete,!!t.isForce,(()=>i.ok()),(e=>i.fail(e))).result()}removeChatroomEntry(e,t,i){const r=gs.create(this.logger,"deleteChatroomStatus",this.logger.createTraceId());return r.asyncInvoke(e,t.key,i,!!t.isSendNotification,t.notificationExtra||"",(()=>r.ok()),(e=>r.fail(e))).result()}removeChatroomEntries(e,t){const i=gs.create(this.logger,"deleteChatroomKV",this.logger.createTraceId());return i.asyncInvoke(e,t.keys,!1,(()=>i.ok()),(e=>i.fail(e))).result()}getChatroomEntry(e,t){return _(this,void 0,void 0,(function*(){return(yield this.getAllChatroomEntries(e)).tryTrans((e=>{const i=e[t];return"string"!=typeof i?Ri(ne.CHATROOM_KEY_NOT_EXIST):gi(i)}))}))}getAllChatroomEntries(e){const t=gs.create(this.logger,"getChatroomKV",this.logger.createTraceId());return t.asyncInvoke(e,(e=>{const i={};try{(e?JSON.parse(e):{list:[]}).list.forEach((({obj:e})=>{const t=JSON.parse(e);i[t.key]=t.value?t.value:""}))}catch(e){}t.ok(i)}),(e=>t.fail(e))).result()}getFileToken(e,t,i,r,s,n){let o;i=i||"",s=s||"",o=(r=r||"")&&"uploads"!==r?t||"":li(e,t);const a=this.getNaviInfoFromCache(),l={uploadDomain:di(a,this.logger),env:this._environment};n=n?Math.ceil(n):0;const c=gs.create(this.logger,"getUploadToken");return c.asyncInvoke(e,o,i,r,s,JSON.stringify(l),n,a.ipType||0,((e,t,i,r,s,n,a,l,h,u,d,E,I,_,f,g,R,p,T,N,S,O,C,v)=>{c.ok({token:e,deadline:0,bosToken:t,bosDate:i,path:r,osskeyId:s,ossPolicy:n,ossSign:a,ossBucketName:l,fileName:o,s3Credential:h,s3Algorithm:u,s3Date:d,s3Policy:E,s3Signature:I,s3BucketName:_,stcAuthorization:f,stcContentSha256:g,stcDate:R,stcBucketName:p,minioAuthorization:T,minioContentSha256:N,minioDate:S,minioBucketName:O,downloadAuthInfo:C?JSON.parse(C):null})}),(e=>c.fail(e))).result()}getFileUrl(e,t,i,r){const s=this.getNaviInfoFromCache(),n=di(s,this.logger),o=this.logger.createTraceId(),a=gs.create(this.logger,"getDownloadUrl",o);return a.asyncInvoke(e,i,r,t-1,JSON.stringify({url:n}),-1,s.ipType||0,(e=>a.ok({downloadUrl:e})),(e=>a.fail(e))).result()}clearLocalData(){return _(this,void 0,void 0,(function*(){const e=fs(this.logger,!0,"clearData");return gi(e)}))}getDeviceId(){return this._deviceId}getVoIPKey(e,t){return new Promise((i=>{this._callCppProxy("getVoIPKey",e,t,"",(e=>{setTimeout((()=>{i({code:ne.SUCCESS,data:e})}),0)}),(e=>{setTimeout((()=>{i({code:e})}),0)}))}))}bindRTCRoomForChatroom(e){const t=gs.create(this.logger,"bindRTCRoomForChatroom",this.logger.createTraceId());return t.asyncInvoke(e.chatRoomId,e.rtcRoomId,(()=>t.ok()),(e=>t.fail(e))).result()}rtcSignaling(e,t,i,r){const s=gs.create(this.logger,"rtcSignaling");return s.asyncInvoke(e,t,i,r,(e=>{const t=Array.prototype.slice.call(e);s.ok(t)}),(e=>s.fail(e)),30).result()}_setRTCHeartbeatListener(){Nr.setRTCHeartbeatListener(this._catcher.gen("setRTCHeartbeatListener[0]",((e,t)=>{const i=this.rtcHeartbeatResolves[e];if(!i)return;const r=i.find((e=>""===e.seqId));r&&(r.seqId=t)})),this._catcher.gen("setRTCHeartbeatListener[1]",((e,t,i,r)=>{const s=this.rtcHeartbeatResolves[e];if(!s)return;const n=s.findIndex((e=>e.seqId===i));-1!==n&&s.splice(n,1)[0].resolve({code:t,data:{version:Number(r)}})})))}rtcPing(e,t,i){const{promise:r,resolve:s}=Ni(),n={resolve:s,seqId:""},o=this.rtcHeartbeatResolves[e];return o?o.push(n):this.rtcHeartbeatResolves[e]=[n],fs(this.logger,!1,"sendRTCHeartbeat",[e],30),r}createTag(e){const t=gs.create(this.logger,"addTag");return t.asyncInvoke(e.tagId,e.tagName,(()=>t.ok()),(e=>t.fail(e))).result()}removeTag(e){const t=gs.create(this.logger,"deleteTag");return t.asyncInvoke(e,(()=>t.ok()),(e=>t.fail(e))).result()}updateTag(e){const t=gs.create(this.logger,"renameTag");return t.asyncInvoke(e.tagId,e.tagName,(()=>t.ok()),(e=>t.fail(e))).result()}getTagList(){return _(this,void 0,void 0,(function*(){const e=fs(this.logger,!1,"getTags"),t=this._convertResultList(e,(e=>({tagId:e.tagId,tagName:e.tagName,conversationCount:e.conversationCount,createdTime:e.tagTime})));return gi(t)}))}addTagForConversations(e,t){const i=gs.create(this.logger,"addConversationsForTag"),r=t.map((({conversationType:e,targetId:t,channelId:i})=>({type:e,targetId:t,channelId:i})));return i.asyncInvoke(e,JSON.stringify(r),(()=>i.ok()),(e=>i.fail(e))).result()}removeTagForConversations(e,t){const i=gs.create(this.logger,"removeConversationsForTag"),r=t.map((({conversationType:e,targetId:t,channelId:i})=>({type:e,targetId:t,channelId:i})));return i.asyncInvoke(e,JSON.stringify(r),(()=>i.ok()),(e=>i.fail(e))).result()}removeTagsForConversation(e,t){const i=gs.create(this.logger,"removeTagsForConversation");return i.asyncInvoke(e.conversationType,e.targetId,e.channelId||"",t,(()=>i.ok()),(e=>i.fail(e))).result()}getConversationListByTag(e,t,i){return _(this,void 0,void 0,(function*(){const r=fs(this.logger,!1,"getConversationsForTagByPage",e,t,i,""),s=this._convertResultList(r,(e=>Object.assign(Object.assign({},this._buildConversation(JSON.stringify(e))),{isTopInTag:e.topForTag})));return gi(s)}))}getUnreadCountByTag(e,t){return _(this,void 0,void 0,(function*(){const i=fs(this.logger,!0,"getConversationUnreadCountForTag",e,t);return gi(i)}))}setConversationStatusInTag(e,t,i){const r=gs.create(this.logger,"setConversationToTopForTag");return r.asyncInvoke(e,t.conversationType,t.targetId,t.channelId||"",!!i.isTop,(()=>r.ok()),(e=>r.fail(e))).result()}getTagsForConversation(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!1,"getTagsForConversation",e.conversationType,e.targetId,e.channelId||""),i=this._convertResultList(t,(e=>({tagId:e.tagId,tagName:e.tagName,isTop:e.isTop,createdTime:e.tagTime})));return gi(i)}))}getAllUnreadMentionedCount(){return _(this,void 0,void 0,(function*(){const e=[oe.GROUP].map((e=>({conversationType:e,channelIdValid:!1}))),t=fs(this.logger,!0,"getUnreadAndMentionCountV2",e);return 0!==t.code?Ri(t.code):gi(t.mention)}))}getOSInfo(){return _(this,void 0,void 0,(function*(){const e={arch:r.arch(),platform:r.platform(),type:r.type(),version:r.version(),release:r.release(),uptime:r.uptime(),cpus:r.cpus(),freemem:r.freemem(),totalmem:r.totalmem(),networkInterfaces:r.networkInterfaces()};return gi(e)}))}getMainProcessInfo(){return _(this,void 0,void 0,(function*(){return gi({title:process.title,pid:process.pid,ppid:process.ppid,platform:process.platform,arch:process.arch,uptime:process.uptime(),cpuUsage:process.cpuUsage(),memoryUsage:process.memoryUsage(),resourceUsage:process.resourceUsage()})}))}setCallInfo(e,t,i){const r=gs.create(this.logger,"callInfoSignaling");return r.asyncInvoke(e,t,i,((e,t)=>r.ok({key:e,value:t})),(e=>r.fail(e))).result()}setProxy(e){return _(this,void 0,void 0,(function*(){return this.tcpMgr.getConnectionStatus()!==pt.DISCONNECTED?Ri(ne.RC_CONN_PROXY_UNAVAILABLE):Br(e,this.logger)}))}getProxy(){return Promise.resolve(Hr())}testProxy(e,t){return function(e,t,i){return _(this,void 0,void 0,(function*(){const{resolve:r,promise:s}=Ni(),n=/^https/.test(t)?Vr:Ur,o=i.createTraceId();i.info("L-test_proxy-T",JSON.stringify({proxy:e,testHost:t}),o);const a=n(t,Object.assign(Object.assign({},e),{headers:Si()}),(e=>{const t=200===e.statusCode;e.setEncoding("utf8");let i="";e.on("data",(e=>{i+=e})),e.once("end",(()=>{const s=t?gi(i):Ri(ne.RC_HTTP_REQ_FAIL,`fail: ${e.statusCode}`,i);r(s)}))}));a.once("timeout",(()=>r(Ri(ne.TIMEOUT)))),a.once("error",(e=>r(Ri(ne.RC_HTTP_REQ_FAIL,e.stack)))),a.end();const l=yield s;return i.summary("L-test_proxy-R",l,o),l.wipe()}))}(e,t,this.logger)}setCheckDuplicateMessage(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!0,"checkDuplicateMessage",e);return gi(t)}))}subscribeUser(e,t,i){const r=gs.create(this.logger,"updateSubscribeStatus");return r.asyncInvoke(t,gt.SUBSCRIBE,e,(()=>r.ok()),((e,t)=>r.fail(e,t)),i).result()}unSubscribeUser(e,t){const i=gs.create(this.logger,"updateSubscribeStatus");return i.asyncInvoke(t,gt.UNSUBSCRIBE,e,(()=>i.ok()),((e,t)=>i.fail(e,t)),0).result()}getSubscribeUserList(e,t,i){return _(this,void 0,void 0,(function*(){const r=fs(this.logger,!1,"getSubscribeUserList",e,t,i),s=this._buildSubscribeEventData(r).map((e=>{const{userId:t,subscribeType:i,subscribeTime:r,expiry:s,details:n}=e,o={userId:t,subscribeType:i,subscribeTime:r,expiry:s};return i===ft.ONLINE_STATUS&&(o.details=ii(n)),o}));return gi(s)}))}setCheckChatRoomDuplicateMessage(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!1,"setDuplicateMessageConfig",[oe.CHATROOM],_n.cuid,e);return t===ne.SUCCESS?gi():Ri(t)}))}getSubscribeUserStatus(e,t){return _(this,void 0,void 0,(function*(){return(yield f(this,Ms,"m",En).call(this,[e],t)).trans((e=>{const t=this._buildSubscribeEventData(e).map((e=>{const{userId:t,subscribeType:i,subscribeTime:r,expiry:s,details:n}=e,o={userId:t,subscribeType:i,subscribeTime:r,expiry:s};return i===ft.ONLINE_STATUS&&(o.details=ii(n)),o}));return t}))}))}updateMyUserProfile(e){const t=[],i=[];Object.keys(e).forEach((r=>{var s;if("extraProfile"===r&&e.extraProfile){if(e.extraProfile){const{extraProfile:t}=e;Object.keys(t).forEach((e=>{i.push(JSON.stringify({key:e,value:t[e]||""}))}))}}else t.push(JSON.stringify({key:r,value:(null===(s=e[r])||void 0===s?void 0:s.toString())||""}))}));const r=gs.create(this.logger,"updateUserProfile");return r.invoke(t,i,((e,t)=>{if(e===ne.SUCCESS)r.ok();else{const i=Rr(t);r.fail(e,{errorKey:i[0],errorKeys:i})}})).result()}getUserProfiles(e){const t=gs.create(this.logger,"getUserProfiles");return t.invoke(e,((e,i)=>{e===ne.SUCCESS?t.ok(this._string2UserProfileInfoList(i)):t.fail(e)})).result()}getMyUserProfile(){const e=gs.create(this.logger,"getOwnUserProfile");return e.asyncInvoke(((t,i)=>{e.flush(fi.from(t).trans((()=>this._string2userProfileInfo(i))))})).result()}_string2userProfileInfo(e){var t;try{const i=JSON.parse(e),r=i.userProfile.reduce(((e,t)=>{const i=JSON.parse(t);return["gender","role","level"].includes(i.key)?e[i.key]=Number(i.value):e[i.key]=i.value,e}),{});return r.userId=i.userId,r.extraProfile=(null===(t=i.userExtProfile)||void 0===t?void 0:t.reduce(((e,t)=>{const i=JSON.parse(t);return e[i.key]=i.value,e}),{}))||{},r}catch(t){this.logger.error(Er.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return{}}_string2UserProfileInfoList(e){try{return JSON.parse(e).list.map((e=>this._string2userProfileInfo(e.obj)))}catch(t){this.logger.error(Er.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return[]}updateMyUserProfileVisibility(e){const t=gs.create(this.logger,"updateUserProfilePermission");return t.invoke(e,(()=>t.ok()),(e=>t.fail(e))).result()}getMyUserProfileVisibility(){const e=gs.create(this.logger,"getUserProfilePermission");return e.asyncInvoke(((t,i)=>{e.flush(fi.from(t).trans((()=>i)))})).result()}searchUserProfileByUniqueId(e){const t=gs.create(this.logger,"getUserProfileByUniqueId");return t.asyncInvoke(e,((e,i)=>{t.flush(fi.from(e).trans((()=>this._string2userProfileInfo(i))))})).result()}getMessagesAroundTimestamp(e,t,i,r){return _(this,void 0,void 0,(function*(){const{conversationType:s,targetId:n,channelId:o}=e,a=fs(this.logger,!1,"getMatchedMessage",s,n,t,i,r,o||""),l=JSON.parse(a).list.map((({obj:e})=>this._buildMessage(e)));return gi(l)}))}getConversations(e){return _(this,void 0,void 0,(function*(){const t=f(this,Ms,"m",cn).call(this,e);return gi(t)}))}handleErrorCode(e,t){e!==ne.SUCCESS&&setTimeout((()=>t(Ri(e))),0)}_convertGroupInfoList(e,t=!1){return e&&0!==e.length?e.map((e=>{const{groupId:t,baseInfo:i,createTime:r,createUserId:s,extraInfo:n,memberCount:o,ownerId:a,remark:l,joinTime:c,role:h}=e,u=oi(i),d=oi(n);return{groupId:t,groupName:u.name||"",portraitUri:u.portraitUrl||"",introduction:u.introduction||"",notice:u.announcement||"",joinPermission:~~u.joinPerm,removeMemberPermission:~~u.removePerm,invitePermission:~~u.memInvitePerm,inviteHandlePermission:~~u.invitePerm,groupInfoEditPermission:~~u.profilePerm,memberInfoEditPermission:~~u.memProfilePerm,extProfile:d,creatorId:s||"",ownerId:a||"",createTime:r||0,membersCount:o||0,remark:l||"",joinedTime:c||0,role:h||J.UNDEF}})):[]}_convertUpdateGroupInfoList(e){return e&&0!==e.length?e.map((e=>{const{groupId:t,baseInfo:i,createTime:r,createUserId:s,extraInfo:n,memberCount:o,ownerId:a,remark:l,joinTime:c,role:h}=e,u=oi(i),d=oi(n);return JSON.parse(JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({groupId:t},(e=>JSON.parse(JSON.stringify({groupName:e.name,portraitUri:e.portraitUrl,introduction:e.introduction,notice:e.announcement,joinPermission:ni(e.joinPerm),removeMemberPermission:ni(e.removePerm),invitePermission:ni(e.memInvitePerm),inviteHandlePermission:ni(e.invitePerm),groupInfoEditPermission:ni(e.profilePerm),memberInfoEditPermission:ni(e.memProfilePerm)})))(u)),n.length>0&&{extProfile:d}),s&&{creatorId:s}),a&&{ownerId:a}),r&&{createTime:r}),o&&{membersCount:o}),l&&{remark:l}),c&&{joinedTime:c}),h&&{role:h})))})):[]}createGroup(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=_r(t),n=_r(i||{}),o=gs.create(this.logger,"createGroup");return o.invoke(e,r||[],JSON.stringify(s),JSON.stringify(n),(e=>{const t=JSON.parse(e),{code:i,processCode:r,censorFailedFields:s,failedUserInfos:n}=t;i===ne.SUCCESS?o.ok():o.fail(i,{processCode:r,errorKeys:s,failedUserInfos:n.map(ms)})})).result()}))}updateGroupInfo(e,t,i){return _(this,void 0,void 0,(function*(){const r=_r(t),s=_r(i||{}),n=gs.create(this.logger,"updateGroupInfo");return n.invoke(e,JSON.stringify(r),JSON.stringify(s),((e,t,i,r)=>{e===ne.SUCCESS?n.ok():n.fail(e,{errorKeys:Rr(r)})})).result()}))}getGroupsInfo(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"getGroupInfoByIds");return t.invoke(e,((e,i,r,s)=>{const n=fi.from(e).trans((()=>{const e=JSON.parse(s);return this._convertGroupInfoList(e)}));t.flush(n)})).result()}))}kickGroupMembers(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"kickOutGroupMember");return r.invoke(e,t,JSON.stringify(fr(i)),((e,t)=>r.flush(fi.from(e)))).result()}))}quitGroup(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"quitGroup");return i.invoke(e,JSON.stringify(fr(t)),((e,t)=>i.flush(fi.from(e)))).result()}))}dismissGroup(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"disbandGroup");return t.invoke(e,((e,i)=>t.flush(fi.from(e)))).result()}))}transferGroupOwner(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=gs.create(this.logger,"transferGroup");return s.invoke(e,t,i,JSON.stringify(fr(r)),((e,t)=>s.flush(fi.from(e)))).result()}))}setGroupManagers(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"updateGroupAdmins");return r.invoke(t,i,e,((e,t)=>r.flush(fi.from(e)))).result()}))}getGroupMembersByRole(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"getGroupMembers");return r.invoke(e,t===J.UNDEF?[1,2,3]:[t],i.pageToken,i.count,i.order?1:0,i.filterRobotType,((e,t,i,s)=>{if(e!==ne.SUCCESS)return void r.fail(e);const n=As(JSON.parse(s));r.ok({totalCount:i||0,data:n,pageToken:t||""})})).result()}))}getGroupMembers(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getGroupMembersByIds");return i.invoke(e,t,((e,t,r,s)=>{const n=fi.from(e).trans((()=>As(JSON.parse(s))));i.flush(n)})).result()}))}setGroupMemberInfo(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=gs.create(this.logger,"updateGroupMemberInfo");return s.invoke(e,t,i,r||"",((e,t,i,r)=>{e===ne.SUCCESS?s.ok():s.fail(e,{errorKeys:Rr(r)})})).result()}))}searchGroupMembers(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"getGroupMembersByNickname");return r.invoke(e,t,i.pageToken,i.count,i.order?1:0,((e,t,i,s)=>{if(e!==ne.SUCCESS)return void r.fail(e);const n=As(JSON.parse(s));r.ok({totalCount:i||0,data:n,pageToken:t||""})})).result()}))}joinGroup(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"joinGroup");return t.invoke(e,((e,i,r)=>{e===ne.SUCCESS?t.ok({processCode:i}):t.fail(e)})).result()}))}inviteUsersToGroup(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"inviteUsersToGroup");return i.invoke(e,t,(e=>{const t=JSON.parse(e),{code:r,processCode:s,failedUserInfos:n}=t,o={processCode:s,failedUserInfos:As(n)};i.flush(fi.from(r,void 0,o))})).result()}))}memberInviteResponse(e){return _(this,void 0,void 0,(function*(){const{groupId:t,inviterId:i,optType:r,optResult:s,joinUserId:n,reason:o}=e,a=1===r?1:0,l=a&&n?n:"",c=gs.create(this.logger,"handleGroupInvite");return c.invoke(t,l,i,s,a,o||"",((e,t,i)=>{const r=fi.from(e).trans((()=>({processCode:t})));c.flush(r)})).result()}))}getGroupApplications(e,t,i){return _(this,void 0,void 0,(function*(){const r=e.order?1:0,s=gs.create(this.logger,"getGroupRequests");return s.invoke(t,i,"",e.pageToken||"",e.count,r,((e,t,i,r)=>{if(e!==ne.SUCCESS)return void s.fail(e);const n=JSON.parse(r).map((e=>{const{groupId:t,joinUser:i,approverUser:r,inviterUser:s,type:n,status:o,direction:a,operateTime:l,remark:c}=e;return{groupId:t,joinMemberInfo:i,inviterInfo:s,operatorInfo:r,status:o,direction:a,type:n,operationTime:l,reason:c}}));s.ok({totalCount:i,data:n,pageToken:t})})).result()}))}getJoinedGroupsByRole(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getGroups"),r=t.order?1:0,s=e===J.UNDEF?[1,2,3]:[e];return i.invoke(s,t.pageToken,t.count,r,((e,t,r,s)=>{if(e!==ne.SUCCESS)return void i.fail(e);const n=JSON.parse(s),o=this._convertGroupInfoList(n);i.ok({totalCount:r,data:o,pageToken:t})})).result()}))}searchJoinedGroups(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getGroupsByGroupName");return i.invoke(e,t.pageToken,t.count,t.order?1:0,((e,t,r,s)=>{if(e!==ne.SUCCESS)return void i.fail(e);const n=JSON.parse(s),o=this._convertGroupInfoList(n);i.ok({totalCount:r,data:o,pageToken:t})})).result()}))}getJoinedGroups(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"getGroupsByIds");return t.invoke(e,((e,i,r,s)=>{if(e!==ne.SUCCESS)return void t.fail(e);const n=JSON.parse(s),o=this._convertGroupInfoList(n);t.ok(o)})).result()}))}setGroupRemark(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"updateGroupRemark");return i.invoke(e,t,t?W.ADD:W.REMOVE,((e,t)=>i.flush(fi.from(e)))).result()}))}setGroupFollows(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"updateFavoriteMembers",this.logger.createTraceId());return r.invoke(t,i,e,((e,t)=>r.flush(fi.from(e)))).result()}))}getGroupFollows(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"getGroupFavoriteMembers");return t.invoke(e,"",1e3,0,((e,i,r,s)=>{const n=fi.from(e).trans((()=>JSON.parse(s).map((e=>({userId:e.userId,time:e.followTime})))));t.flush(n)})).result()}))}addFriend(e,t,i){const r=gs.create(this.logger,"addFriend");return r.invoke(e,t,i,((e,t,i)=>{e===ne.SUCCESS?r.ok({processCode:t}):r.fail(e)})).result()}deleteFriends(e,t){const i=gs.create(this.logger,"removeFriends",this.logger.createTraceId());return i.invoke(e,t,((e,t)=>i.flush(fi.from(e)))).result()}acceptFriendRequest(e){const t=gs.create(this.logger,"acceptFriendRequest",this.logger.createTraceId());return t.invoke(e,"",((e,i)=>t.flush(fi.from(e)))).result()}refuseFriendRequest(e,t){const i=gs.create(this.logger,"rejectFriendRequest",this.logger.createTraceId());return i.invoke(e,t||"",((e,t)=>i.flush(fi.from(e)))).result()}setFriendInfo(e,t,i){const r=gs.create(this.logger,"setFriendInfo"),s=_r(i);return r.invoke(e,t,JSON.stringify(s),((e,t,i,s)=>{e===ne.SUCCESS?r.ok():r.fail(e,{errorKeys:Rr(s)})})).result()}checkFriends(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"checkFriendRelationship");return(yield i.invoke(e,t,((e,t)=>{e===ne.SUCCESS?i.ok(t):i.fail(e)})).result()).trans((e=>JSON.parse(e).map((e=>{const{userId:t,status:i}=e;return{userId:t,relationType:i}}))))}))}getFriends(e,t){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"getFriends",this.logger.createTraceId());return(yield t.invoke(e,0,((e,i)=>{e===ne.SUCCESS?t.ok(i):t.fail(e)})).result()).trans((e=>{const t=JSON.parse(e);return{data:this._convertFriendInfo(t),pageToken:""}}))}))}getFriendApplications(e,t,i){const r=gs.create(this.logger,"getFriendRequestListByPage",this.logger.createTraceId());return r.invoke([1,2].every((e=>t.includes(e)))?3:t[0],i,e.count,e.pageToken,e.order?1:0,((e,t,i)=>{if(e!==ne.SUCCESS)return void r.fail(e);const s=JSON.parse(i).map((e=>({userId:e.userId,name:e.name,portraitUri:e.portraitUrl,applicationType:e.friendRequestType,applicationStatus:e.friendRequestStatus,operationTime:e.operateTime,extra:e.extra})));r.ok({pageToken:t,data:s})})).result()}_convertFriendInfo(e){return e.map((e=>{const{userId:t,userName:i,remark:r,portraitUrl:s,friendType:n,extProfiles:o,addTime:a,friendAttribute:l}=e;return{userId:t,name:i,portraitUri:s,remark:r,directionType:n,extProfile:o,addTime:a,inBlackList:!!l}}))}getFriendsInfo(e){const t=gs.create(this.logger,"getFriendByIds");return t.invoke(e,((e,i)=>{if(e!==ne.SUCCESS)return void t.fail(e);const r=JSON.parse(i),s=this._convertFriendInfo(r);t.ok(s)})).result()}searchFriendsInfo(e){const t=gs.create(this.logger,"getFriendByNickname");return t.invoke(e,((e,i)=>{if(e!==ne.SUCCESS)return void t.fail(e);const r=JSON.parse(i),s=this._convertFriendInfo(r);t.ok(s)})).result()}setFriendAddPermission(e){const t=gs.create(this.logger,"setFriendAuthPermission");return t.invoke(e,(e=>{e!==ne.SUCCESS?t.fail(e):t.ok()})).result()}getFriendAddPermission(){const e=gs.create(this.logger,"getFriendAuthPermission");return e.invoke(((t,i)=>{t!==ne.SUCCESS?e.fail(t):e.ok(i)})).result()}setNotificationQuietHoursWithSetting(e){const{startTime:t,spanMinutes:i,level:r,timezone:s}=e,n=gs.create(this.logger,"addPushSetting");return n.invoke(t,i,r,s||"",(()=>n.ok()),(e=>n.fail(e))).result()}removeNotificationQuietHoursSetting(){const e=gs.create(this.logger,"removePushSetting");return e.invoke((()=>e.ok()),(t=>e.fail(t))).result()}getNotificationQuietHoursSetting(){const e=gs.create(this.logger,"queryPushSetting");return e.invoke(((t,i,r,s)=>{const n={startTime:t,spanMinutes:i,level:r,timezone:s};e.ok(n)}),(t=>e.fail(t))).result()}setDataBaseLogConfig(e){this._callCppProxy("setDataBaseLogConfig",e)}getStatsUrlList(){return _(this,void 0,void 0,(function*(){return gi(bi.getStatsUrlList(this.getNaviInfoFromCache()))}))}sendReadReceiptResponseV5(e,t){const i=gs.create(this.logger,"sendReadReceiptByReadReceiptType");return i.invoke(e.conversationType,e.targetId,e.channelId||"",hr,t,((e,t,r)=>{e!==ne.SUCCESS?i.fail(e):i.ok()})).result()}getMessageReadReceiptInfoV5ByIdentifiers(e){return _(this,void 0,void 0,(function*(){const t=e.map((({identifier:e,messageUId:t})=>({conIdentifier:{type:e.conversationType,targetId:e.targetId,channelId:e.channelId||""},uid:t}))),i=gs.create(this.logger,"getReadReceiptCount");return(yield i.invoke(JSON.stringify(t),((e,t)=>{e!==ne.SUCCESS?i.fail(e):i.ok(t)})).result()).trans((e=>JSON.parse(e).map((e=>({identifier:{conversationType:e.conIdentifier.type,targetId:e.conIdentifier.targetId,channelId:e.conIdentifier.channelId},messageUId:e.msgUid,readCount:e.readCount,unreadCount:e.unreadCount,totalCount:e.totalCount})))))}))}getMessagesReadReceiptUsersByPageV5(e,t,i){const r=gs.create(this.logger,"getReadReceiptUsersByUid");return r.invoke(e.conversationType,e.targetId,e.channelId||"",t,i.pageToken||"",!i.readStatus,i.pageCount,0===i.order,((e,t,i,s)=>{if(e!==ne.SUCCESS)return void r.fail(e);const n={pageToken:t,totalCount:s,users:JSON.parse(i).map((e=>JSON.parse(e))).map((e=>({userId:e.userId,timestamp:e.receiptTime,isMentioned:!!e.mentioned})))};r.ok(n)})).result()}getMessagesReadReceiptByUsersV5(e,t,i){const r=gs.create(this.logger,"getReadReceiptStatusForUsersInMessage");return r.invoke(e.conversationType,e.targetId,e.channelId||"",t,i,((e,t,i,s)=>{if(e!==ne.SUCCESS)return void r.fail(e);const n=JSON.parse(i).map((e=>JSON.parse(e))).map((e=>({userId:e.userId,timestamp:e.receiptTime,isMentioned:!!e.mentioned})));r.ok({pageToken:"",totalCount:0,users:n})})).result()}requestSpeechToTextForMessage(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!0,"speechToText",e,((t,i)=>{const r=JSON.parse(i),s={status:r.status,text:r.text,isVisible:r.visible};setImmediate((()=>{this._dispatchEvent("speechToTextResponse",{code:t,messageUId:e,sttInfo:s})}))}));return t===ne.SUCCESS?gi():Ri(t)}))}setMessageSpeechToTextVisible(e,t){return _(this,void 0,void 0,(function*(){const i=fs(this.logger,!0,"updateSpeechToTextVisible",e,t);return i===ne.SUCCESS?gi():Ri(i)}))}setTranslationLanguage(e){const t=gs.create(this.logger,"setPushSetting");return t.invoke(ur,e,(()=>t.ok()),(e=>t.fail(e))).result()}getTranslationLanguage(){return _(this,void 0,void 0,(function*(){const e=fs(this.logger,!0,"getPushSetting",ur);return gi(e)}))}setAutoTranslateEnabled(e){const t=gs.create(this.logger,"setPushSetting");return t.invoke(dr,e?"1":"0",(()=>t.ok()),(e=>t.fail(e))).result()}getAutoTranslateEnabled(){return _(this,void 0,void 0,(function*(){const e=fs(this.logger,!0,"getPushSetting",dr);return gi("1"===e)}))}translateWithParams(e,t,i,r){return _(this,void 0,void 0,(function*(){const s=fs(this.logger,!0,"getPushSetting",ur)||"zh",n=gs.create(this.logger,"translateMessages"),o=e.map((e=>({messageRecognitionIdentifier:{messageUid:e.identifier,customText:0===r?"":e.content,inputSource:r},sourceLanguage:e.sourceLanguage,targetLanguage:e.targetLanguage||s})));return n.invoke(o,{forceRetranslate:i,translationServiceType:t},(e=>{e!==ne.SUCCESS?n.fail(e):n.ok()})).result()}))}modifyMessageWithParams(e){const t=JSON.stringify(e.messageContent),i=gs.create(this.logger,"editMessage",this.logger.createTraceId());return i.asyncInvoke((()=>i.ok()),(e=>i.fail(e)),e.messageUId,t).result()}refreshReferenceMessageWithParams(e,t,i,r){const s=gs.create(this.logger,"getQuotingMessageByUId");return s.asyncInvoke(t.conversationType,t.targetId,t.channelId||"",e,(e=>{s.fail(e)}),(e=>{s.ok(),setTimeout((()=>f(this,Ms,"m",un).call(this,e,r)),0)}),(e=>{s.ok(),setTimeout((()=>f(this,Ms,"m",un).call(this,e,i)),0)})).result()}syncRemoteConversations(){return _(this,void 0,void 0,(function*(){const e=fs(this.logger,!0,"getRemoteConversations");return e===ne.SUCCESS?gi():Ri(e)}))}sendUltraGroupTypingStatus(e){const t=gs.create(this.logger,"sendUGOperateStatus",this.logger.createTraceId());return t.asyncInvoke(e.targetId,0,e.channelId,(()=>t.ok()),(e=>t.fail(e))).result()}getUltraGroupList(e){return _(this,void 0,void 0,(function*(){const t=null==e?void 0:e.targetId,i=null==e?void 0:e.channelType,r=fs(this.logger,!1,"getUGConversationListForAllChannel"),s=JSON.parse(r).list.map((({obj:e})=>{const t=JSON.parse(e);return f(this,Ms,"m",Gs).call(this,t)})).filter((e=>!("string"==typeof t&&t!==e.targetId||"number"==typeof i&&i!==e.channelType))).sort(((e,t)=>{var i,r;const s=(null===(i=e.latestMessage)||void 0===i?void 0:i.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-s}));return gi(s)}))}getRemoteMessagesByUIds(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getRemoteMessageByUids",this.logger.createTraceId()),{targetId:r,conversationType:s,channelId:n}=e;return(yield i.asyncInvoke(r,s,t.map((e=>({messageUId:e,channelId:n||"",sentTime:0}))),(e=>i.ok(e)),(e=>i.fail(e))).result()).trans((e=>JSON.parse(e).list.map((({obj:e})=>{const t=JSON.parse(e);return f(this,Ms,"m",ks).call(this,t)}))))}))}getUGUnreadMentionedDigest(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"getUltraGroupUnreadMentionedDigest",this.logger.createTraceId()),{targetId:i,channelId:r,sentTime:s,count:n}=e;return(yield t.asyncInvoke(i,r||"",s,n,(e=>t.ok(e)),(e=>t.fail(e))).result()).trans((e=>{const t=JSON.parse(e).list.map((({obj:e})=>{const{msgUId:t,objectName:i,sentTime:r,isMentionedAll:s}=JSON.parse(e);return{messageUId:t,messageType:i,sentTime:r,mentionedType:s?De.ALL:De.SINGAL}}));return t}))}))}deleteLocalUGMessagesForAllChannel(e,t){return _(this,void 0,void 0,(function*(){return fs(this.logger,!1,"clearUGMessageByTimestamp",e,t,!1),gi()}))}updateUGMessageExpansion(e,t,i){const r=gs.create(this.logger,"updateUGMessageExpansion",this.logger.createTraceId());return r.asyncInvoke(e.targetId,t.mid,i,JSON.stringify(t),e.channelId,(()=>r.ok()),(e=>r.fail(e))).result()}setUGDefaultNotificationLevel(e,t,i){const r=gs.create(this.logger,"setDefaultBlockPushLevel",this.logger.createTraceId());return r.asyncInvoke(e,i||"",oe.ULTRA_GROUP,t,(()=>r.ok()),(e=>r.fail(e))).result()}getUGDefaultNotificationLevel(e,t){const i=gs.create(this.logger,"getDefaultBlockPushLevel",this.logger.createTraceId());return i.asyncInvoke(e,t||"",oe.ULTRA_GROUP,(e=>i.ok(e)),(e=>i.fail(e))).result()}getUGUnreadCountForAllChannels(e,t,i){return _(this,void 0,void 0,(function*(){if(t.length>0){const r=fs(this.logger,!0,i?"getUltraGroupUnreadMentionedCount":"getUltraGroupUnreadCount",e,t);return gi(r)}const r=fs(this.logger,!0,i?"getUGMentionCount":"getUGUnreadCount",e);return gi(r)}))}getUGUnreadInfoList(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!1,"getInfoForConversations",e),i=JSON.parse(t).list.map((({obj:e})=>{const{targetId:t,conversationType:i,channelId:r,unreadCount:s,mentionCount:n,mentionMeCount:o,blockStatus:a}=JSON.parse(e);return{targetId:t,conversationType:i,channelId:r,unreadCount:s,mentionedCount:n,mentionedMeCount:o,notificationLevel:a,type:oe.ULTRA_GROUP,unreadMessageCount:s}}));return gi(i)}))}getUGFirstUnreadMessageDigest(e){return _(this,void 0,void 0,(function*(){const t=f(this,Ms,"m",zs).call(this,e);return t?gi({sentTime:t.sentTime,messageType:t.messageType,messageUId:t.messageUId}):Ri(ne.RC_DB_DATA_NOT_FOUND)}))}getBlockedUGList(){return _(this,void 0,void 0,(function*(){return f(this,Ms,"m",dn).call(this,[{conversationType:oe.ULTRA_GROUP,channelIdValid:!1}])}))}getBlockedConversationList(e){return _(this,void 0,void 0,(function*(){const t=_e(e?ce:ae).map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,""):"",channelIdValid:e===oe.ULTRA_GROUP})));return f(this,Ms,"m",dn).call(this,t).trans((e=>e.reverse()))}))}getSubscribeUsersOnlineStatus(e){return _(this,void 0,void 0,(function*(){return(yield f(this,Ms,"m",En).call(this,[ft.ONLINE_STATUS,ft.FRIEND_ONLINE_STATUS],e)).trans((e=>JSON.parse(e).list.map((({obj:e})=>{const{userId:t,details:i=[]}=JSON.parse(e),r=i.map((e=>{const{changeTime:t,changeValue:i,platform:r}=JSON.parse(e);return{platform:r,isOnline:!!i,updateTime:t}})),s=r.some((e=>e.isOnline));return n={userId:t,isOnline:s,details:r},[_t.iOS,_t.Android,_t.Web,_t.PC,_t.Mini,_t.HarmonyOS].forEach((e=>{n.details.some((t=>t.platform===e))||n.details.push({platform:e,isOnline:!1,updateTime:0})})),n;var n}))))}))}saveEditedMessageDraft(e,t){return _(this,void 0,void 0,(function*(){const i=fs(this.logger,!1,"saveEditedMessageDraft",vs(t),e.messageUId,e.content);return i===ne.SUCCESS?gi():Ri(i)}))}getEditedMessageDraft(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!1,"getConversationMetadata",vs(e)).find((e=>"edited_message_draft"===e.key));if(!t)return gi(null);const{msg_uid:i,content:r}=JSON.parse(t.value);return gi({messageUId:i,content:r})}))}clearEditedMessageDraft(e){return _(this,void 0,void 0,(function*(){const t=fs(this.logger,!1,"removeConversationMetadata",vs(e),["edited_message_draft"]);return t===ne.SUCCESS?gi():Ri(t)}))}getUnreadMentionMeConversationList(e,t){return _(this,void 0,void 0,(function*(){const{timestamp:t,count:i,conversationTypes:r}=e,s=r.map((e=>({conversationType:e,channelId:e===oe.ULTRA_GROUP?"RCDefault":"",channelIdValid:e===oe.ULTRA_GROUP}))),n=fs(this.logger,!1,"getUnreadMentionMeConversationsByPageWithTopPriority",s,t,i,!!e.topPriority),{code:o,list:a}=JSON.parse(n);if(o!==ne.SUCCESS)return Ri(o);const l=a.map((e=>this._buildConversation(e.obj)));return gi(l)}))}getAllRobots(){return _(this,void 0,void 0,(function*(){const e=gs.create(this.logger,"getAllRobots");return e.asyncInvoke(((t,i)=>{const r=f(this,Ms,"m",In).call(this,i);t!==ne.SUCCESS?e.fail(t,r):e.ok(r)})).result()}))}getConversationsIncludingRobots(e){return _(this,void 0,void 0,(function*(){const{conversationTypes:t,count:i,timestamp:r,topPriority:s}=e,n=gs.create(this.logger,"getConversationsIncludingRobots");return n.invoke(t.map((e=>({conversationType:e,channelId:"",targetId:"",channelIdValid:!1}))),r,i,s,((e,t)=>{e!==ne.SUCCESS?n.fail(e):n.flush(f(this,Ms,"m",Fs).call(this,t,"getConversationsIncludingRobots"))})).result()}))}markRemoteConversationAsRead(e,t,i){return _(this,void 0,void 0,(function*(){const r=yield this.sendMessage(e,t,i);if(r.isOk){const{sentTime:t}=r.data;this._clearUnreadCountByTimestamp(e,t)}return r.wipe()}))}getMessagesByUIds(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getMessagesByUIds");return i.invoke({conversationQueryParam:Object.assign(Object.assign({},vs(e)),{channelIdValid:"string"==typeof e.channelId}),messageUIds:t,enableRemoteQuery:!0},(e=>{const t=JSON.parse(e).list.map((e=>{const{message:t,messageUId:i,code:r}=e;return{messageUId:i,message:t?f(this,Ms,"m",ks).call(this,t):void 0,code:r}}));i.ok(t)}),(e=>{i.fail(e)})).result()}))}_trans2ICppUpdateMessageReactionParam(e){var t;const{messageUId:i,reactionId:r,pushConfig:s}=e;return{messageUId:i,reactionId:r,pushConfig:{forceShowDetail:(null==s?void 0:s.forceShowDetailContent)||!1,templateId:(null==s?void 0:s.templateId)||"",content:(null==s?void 0:s.pushContent)||"",disableTitle:(null==s?void 0:s.disablePushTitle)||!1,id:(null===(t=null==s?void 0:s.androidConfig)||void 0===t?void 0:t.notificationId)||"",data:(null==s?void 0:s.pushData)||"",config:ci(null==s?void 0:s.iOSConfig,null==s?void 0:s.androidConfig,null==s?void 0:s.harmonyOSConfig),title:(null==s?void 0:s.pushTitle)||""}}}addMessageReaction(e){const t=gs.create(this.logger,"addMessageReaction"),i=this._trans2ICppUpdateMessageReactionParam(e);return t.invoke(i,(e=>t.flush(fi.from(e)))).result()}removeMessageReaction(e){const t=gs.create(this.logger,"removeMessageReaction"),i=this._trans2ICppUpdateMessageReactionParam(e);return t.invoke(i,(e=>t.flush(fi.from(e)))).result()}_trans2CppConversationQueryParam(e){const{conversationType:t,targetId:i,channelId:r}=e;return{conversationType:t,targetId:i,channelId:t===oe.ULTRA_GROUP?f(this,Ms,"m",Zs).call(this,r):r,channelIdValid:"string"==typeof r}}batchGetMessageReactionSummaries(e){return _(this,void 0,void 0,(function*(){const t=gs.create(this.logger,"batchGetMessageReactionSummaries"),{conversationIdentifier:i,messageUIds:r}=e,s={messageUIds:r,conversationQueryParam:this._trans2CppConversationQueryParam(i)},n=yield t.invoke(s,((e,i)=>t.flush(fi.from(e,"",i)))).result();if(!n.isOk)return n.wipe();const o=JSON.parse(n.data);return gi(o)}))}getMessageReactions(e){const t=gs.create(this.logger,"getMessageReactions"),{pageToken:i,messageUId:r,count:s}=e,n={messageUId:r,count:s,pageToken:i||""};return t.invoke(n,((e,i,r)=>{if(e!==ne.SUCCESS)return void t.fail(e);const s={pageToken:r,reactions:JSON.parse(i)};t.ok(s)})).result()}getMessageReactionUsers(e){const t=gs.create(this.logger,"getReactionUsers"),{pageToken:i,reactionId:r,count:s,messageUId:n}=e,o={messageUId:n,reactionId:r,count:s,pageToken:i||""};return t.invoke(o,((e,i,r,s)=>{if(e!==ne.SUCCESS)return void t.fail(e);const n={totalCount:r,pageToken:s,users:JSON.parse(i)};t.ok(n)})).result()}syncReadStatus(e,t,i){return _(this,void 0,void 0,(function*(){const r=gs.create(this.logger,"syncConversationReadStatus"),s=vs(e),n=yield r.invoke(s,t,(e=>r.flush(fi.from(e)))).result();return n.isOk&&i&&this._clearUnreadCountByTimestamp(e,t),n.wipe()}))}}Ms=new WeakSet,ys=function(e){const t=JSON.parse(e).list.map((({obj:e})=>JSON.parse(e))),i=[],r=[],s=[];t.forEach((e=>{const{changeTime:t,changeType:n,channelId:o,channelType:a,targetId:l,userId:c}=e;switch(n){case ct.CHANNEL_DELETE:r.push({targetId:l,channelId:o,channelType:a,deleteTime:t});break;case ct.PUBLIC_TO_PRIVATE:i.push({targetId:l,channelId:o,changeType:at.PUBLIC_TO_PRIVATE,channelType:ot.PRIVATE});break;case ct.PRIVATE_TO_PUBLIC:i.push({targetId:l,channelId:o,changeType:at.PRIVATE_TO_PUBLIC,channelType:ot.PUBLIC});break;case ct.PRIVATE_CHANNEL_USER_JOIN_PUBLIC:break;case ct.CHANNEL_USER_KICKED:s.push({targetId:l,channelId:o,userId:c,channelType:a});break;case ct.PUBLIC_TO_PRIVATE_USER_NOT_IN:i.push({targetId:l,channelId:o,changeType:at.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:a})}})),i.length>0&&this._dispatchEvent("ultraGroupChannelChangeType",i),r.length>0&&this._dispatchEvent("ultraGroupChannelDelete",r),s.length>0&&this._dispatchEvent("ultraGroupChannelUserKicked",s)},bs=function(e){const t=JSON.parse(e).list.map((({obj:e})=>JSON.parse(e))),i=[],r=[],s=[],n=[],o=[],a=oe.ULTRA_GROUP;t.forEach((e=>{const{targetId:t,userGroupId:l,eventType:c,channelId:h,channelType:u}=e;switch(c){case ht.REMOVE_USER_GROUP:i.push({conversation:{conversationType:a,targetId:t},userGroupIds:l});break;case ht.JOIN_USER_GROUP:r.push({conversation:{conversationType:a,targetId:t},userGroupIds:l});break;case ht.EXIT_USER_GROUP:s.push({conversation:{conversationType:a,targetId:t},userGroupIds:l});break;case ht.CHANNEL_BIND_USER_GROUP:n.push({conversation:{conversationType:a,targetId:t,channelId:h},channelType:u,userGroupIds:l});break;case ht.CHANNEL_UNBIND_USER_GROUP:o.push({conversation:{conversationType:a,targetId:t,channelId:h},channelType:u,userGroupIds:l})}}));const l={};i.length>0&&(l.userGroupDisband=i),r.length>0&&(l.userAdded=r),s.length>0&&(l.userRemoved=s),n.length>0&&(l.userGroupBindChannel=n),o.length>0&&(l.userGroupUnBindChannel=o),this._dispatchEvent("userGroupStatus",l)},Ps=function(e,t,i){return _(this,void 0,void 0,(function*(){const r=(yield this.getConversation({conversationType:oe.ULTRA_GROUP,targetId:e,channelId:t})).data;this._dispatchEvent("conversation",[{conversation:r,updatedItems:{unreadMessageCount:{val:r.unreadMessageCount,time:i}}}])}))},Ls=function(e){const t=JSON.parse(e).list.map((({obj:e})=>{const{channelId:t,operateTime:i,operateType:r,targetId:s,userId:n}=JSON.parse(e);return{channelId:t,operationType:r,operationTime:i,targetId:s,userId:n}}));this._dispatchEvent("operateStatus",{conversationType:oe.ULTRA_GROUP,info:t,hasInfo:!0,hasSummary:!1,summary:[]})},Us=function(e){const t=JSON.parse(e).list.map((({obj:e})=>{const{targetId:t,channelId:i,userNum:r,operateType:s}=JSON.parse(e);return{targetId:t,channelId:i,count:r,operationType:s}}));this._dispatchEvent("operateStatus",{conversationType:oe.ULTRA_GROUP,info:[],hasInfo:!1,hasSummary:!0,summary:t})},Ds=function(e){const t=JSON.parse(e).list.map((({obj:e})=>this._buildMessage(e)));this._dispatchEvent("ultraGroupMessageExpansionUpdated",t)},ws=function(e){const t=JSON.parse(e).list.map((({obj:e})=>this._buildMessage(e)));this._dispatchEvent("messagesModified",t)},Vs=function(e){const t=JSON.parse(e).list.map((({obj:e})=>{const{channelId:t,conversationType:i,isAdmin:r,isDel:s,mentionType:n,msgUId:o,operatorId:a,sentTime:l,targetId:c}=JSON.parse(e);return{targetId:c,conversationType:i,sentTime:l,messageUId:o,senderUserId:a,channelId:t,content:{conversationType:i,targetId:c,channelId:t,isAdmin:r,isDelete:s,sentTime:l,messageUId:o},messageDirection:1,messageType:He,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:Mt.UNREAD,receivedStatusInfo:ti(Mt.UNREAD)}}));t.length>0&&(t.slice().forEach((e=>f(this,Ms,"m",Ys).call(this,e,"ugRecall"))),this._dispatchEvent("ultraGroupMessageRecalled",t))},ks=function(e,t){const{channelId:i,senderUserId:r,content:s,objectName:n,direction:o,status:a,messageId:l,sentTime:c,readReceiptRequest:h,supportExt:u,pushContent:d,pushTitle:E,pushId:I,pushConfig:_,templateId:f,disableTitle:g,forcePushDetail:R,hasMore:p,directedUsers:T,noNotification:N,disableUpdateLastMessage:S,needReceipt:O,sendReceipt:C,contentRecognition:v,convertExt:m,editTime:A,editContent:M,editStatus:y,quotedMsgStatus:b,hasChanged:P,quoteInfo:L,hasReactions:U}=e;let{conversationType:D,targetId:w,messageUid:V}=e,k=this._parseMessageJsonContent(s,l);const G=!!k.mentionedInfo;if(n===He&&r===this.tcpMgr.getCurrentUserId()&&(D=k.conversationType,w=k.targetId,V=k.messageUId),m){const e=JSON.parse(m);if(e.trans){const{targetLanguage:t,translatedText:i,translateStatus:r}=e.trans,s={targetLanguage:t,translatedText:i,status:r};k.translateInfo=s}}if(n===Ve||n===ke){const e=v?JSON.parse(v):{status:kt,text:"",visible:!1},t={status:e.status,text:e.text,isVisible:e.visible};k.sttInfo=t}const F=(B=n,ar.get(B)||{isPersited:!1,isCounted:!1,isStatusMessage:!1});var B;let H=this._buildSupportExt(u,e);const x=void 0===(J=t)||"[object Undefined]"===Object.prototype.toString.call(J)?c<this.tcpMgr.getConnectedTime():t;var J;let Y={};_&&(Y=((e,t)=>{const i={},r={notificationId:t||""},s={};if(!e)return{iOSConfig:i,androidConfig:r,harmonyOSConfig:s};try{const t=JSON.parse(e);null==t||t.forEach((e=>{var t,n,o,a,l,c,h,u,d,E,I,_,f,g;const R=Object.keys(e);if(0===R.length)return;const p=R[0];switch(p){case"HW":return r.channelIdHW=null===(t=e[p])||void 0===t?void 0:t.channelId,r.importanceHW=null===(n=e[p])||void 0===n?void 0:n.importance,r.imageUrlHW=null===(o=e[p])||void 0===o?void 0:o.image,void(r.categoryHW=null===(a=e[p])||void 0===a?void 0:a.category);case"MI":return r.channelIdMi=null===(l=e[p])||void 0===l?void 0:l.channelId,r.templateIdMi=null===(c=e[p])||void 0===c?void 0:c.templateId,void(r.templateParamMi=null===(h=e[p])||void 0===h?void 0:h.templateParam);case"OPPO":return void(r.channelIdOPPO=null===(u=e[p])||void 0===u?void 0:u.channelId);case"VIVO":return r.typeVivo=null===(d=e[p])||void 0===d?void 0:d.classification,void(r.categoryVivo=null===(E=e[p])||void 0===E?void 0:E.category);case"APNS":return i.threadId=e[p]["thread-id"],i.apnsCollapseId=e[p]["apns-collapse-id"],i.category=e[p].category,i.richMediaUri=e[p].richMediaUri,void(i.interruptionLevel=e[p]["interruption-level"]);case"FCM":return void(r.googleConfig={collapseKey:e[p].collapse_key||"",imageUrl:e[p].imageUrl||"",priority:e[p].priority||""});case"HONOR":return r.importanceHonor=null===(I=e[p])||void 0===I?void 0:I.importance,void(r.imageUrlHonor=null===(_=e[p])||void 0===_?void 0:_.image);case"OHOS":s.category=null===(f=e[p])||void 0===f?void 0:f.category,s.image=null===(g=e[p])||void 0===g?void 0:g.image}}))}catch(e){}return{iOSConfig:i,androidConfig:r,harmonyOSConfig:s}})(_,I));const j=Object.assign(Object.assign({},Y),{pushTitle:E,pushContent:d,pushData:d,disablePushTitle:g,forceShowDetailContent:R,templateId:f}),W={channelId:i,conversationType:D,targetId:w,senderUserId:r,content:k||{},messageType:n,messageUId:V||"",messageDirection:o,isOffLineMessage:x,sentTime:c,receivedTime:0,isPersited:F.isPersited,isCounted:F.isCounted,isMentioned:G,disableNotification:N,isStatusMessage:F.isStatusMessage||!1,canIncludeExpansion:u,expansion:u?H:null,receivedStatus:0,receivedStatusInfo:void 0,sentStatus:void 0,messageId:l,pushConfig:j,hasMore:p,directedUserIds:T||[],disableUpdateLastMessage:S,needReceipt:O,sendReceipt:C,hasReactions:U};if(L&&(W.quoteInfo=L),o===St.RECEIVE?(W.receivedStatus=a,W.receivedStatusInfo=ti(a)):W.sentStatus=a,h){const e=this._handleReadReceiptRequest(h);W.readReceiptInfo=e}return D===oe.ULTRA_GROUP?W.isModifyMessage=!!P:(W.isModifyMessage=!(!A&&!y),W.isModifyMessage&&(W.modifyInfo={timestamp:A,content:M?JSON.parse(M):{},status:y})),n===Be&&(W.content.referMsgStatus=b),W},Gs=function(e){const{channelId:t,conversationType:i,targetId:r,lastestMsg:s,isTop:n,blockStatus:o,matchCount:a,hasUnreadMention:l,unreadCount:c,mentionCount:h,mentionMeCount:u,conversationTime:d,draft:E,translateStrategy:I,channelType:_,metadata:f,includeRobot:g,entrustInfo:R}=e,p=-1===JSON.parse(s).messageId?null:this._buildMessage(s),T=f?JSON.parse(f):{},N=T.edited_message_draft?JSON.parse(T.edited_message_draft):void 0,S=JSON.parse(R),O={name:S.name,portraitUri:S.portraitUrl};return{channelId:t,conversationType:i,targetId:r,channelType:_,unreadMessageCount:c,unreadMentionedCount:h,unreadMentionedMeCount:u,hasMentioned:l,latestMessage:p,notificationStatus:At(o),isTop:n,lastUnreadTime:0,matchCount:a,operationTime:d,notificationLevel:o,draft:E,translateStrategy:I,editedMessageDraft:N?{messageUId:N.msg_uid,content:N.content}:void 0,includeRobot:!!g,dataMgmtInfo:O}},Fs=function(e,t){try{const{list:t}=JSON.parse(e),i=t.map((e=>this._buildConversation(e.obj)));return gi(i)}catch(e){const i=`parse conversation list result error, method: ${t}`;return Ri(ne.MAIN_PROCESS_ERROR,i)}},Bs=function(e){var t;const{messageType:i,targetId:r}=e;if(i===Qe){const t=function(e){const t={},i=[],r=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:r,userList:i}}(e);return this._sendChatroomEvents({userChange:t}),!1}if(i===$e){const t=function(e){const{chatroomId:t,status:i,reason:r,time:s,extra:n}=e.content;return{chatroomId:t,status:i,reason:r,time:s,extra:n||""}}(e);return this._sendChatroomEvents({chatroomNotifyMultiLoginSync:t}),!1}if(i===ze){const i=function(e){const{chatroomId:t,operateType:i,durationTime:r,operateTime:s,userList:n,extra:o}=e.content;return{chatroomId:t,operateType:i,durationTime:r,operateTime:s,userIdList:n,extra:o||""}}(e);return i.operateType===se.Blocked&&(null===(t=null==i?void 0:i.userIdList)||void 0===t?void 0:t.includes(this.tcpMgr.getCurrentUserId()))&&this._chatroomCache.delete(r),this._sendChatroomEvents({chatroomNotifyBlock:i}),!1}if(i===et){const t=function(e){const{chatroomId:t,operateType:i,durationTime:r,operateTime:s,userList:n,extra:o}=e.content;return{chatroomId:t,banType:i,durationTime:r,operateTime:s,userIdList:n,extra:o||""}}(e);return this._sendChatroomEvents({chatroomNotifyBan:t}),!1}return!0},Hs=function(e){const t=JSON.parse(e),i=f(this,Ms,"m",ks).call(this,t,!1),{messageType:r,conversationType:s}=i;if(r!==He||s!==oe.ULTRA_GROUP){if(this._lowPriorityMessageHandler.isLowPriorityMessage(r)){const e=this.tcpMgr.getCurrentUserId();return this._lowPriorityMessageHandler.push(i,e),void this._handleLowPriorityMessages(e,this.tcpMgr.getConnectedTime())}this._handleHighPriorityMessages([i],!1)}},xs=function(e,t){const i=this.tcpMgr.getConnectedTime(),r=this.tcpMgr.getCurrentUserId(),s=[],n=[];JSON.parse(e).list.forEach((e=>{const t=JSON.parse(e.obj),o=t.sentTime<i,a=f(this,Ms,"m",ks).call(this,t,o),{messageType:l}=a;this._lowPriorityMessageHandler.isLowPriorityMessage(l)?this._lowPriorityMessageHandler.push(a,r):o?s.push(a):n.push(a)})),s.length>0&&this._handleHighPriorityMessages(s,!!t);let o=!1;(!t||n.length>0)&&!this._pullOfflineMessageFinished&&(o=this._pullOfflineMessageFinished=!0),n.length>0&&this._handleHighPriorityMessages(n,!!t),(this._pullOfflineMessageFinished||this._lowPriorityMessageHandler.count>=1e4)&&this._handleLowPriorityMessages(r,i),o&&this._sendPullOfflineFinished()},Js=function(e){0!==e.length&&fs(this.logger,!1,"setExtraMessageInBatches",e)},Ys=function(e,t){var i;const{messageUId:r,sentTime:s,isAdmin:n,isDelete:o,extra:a}=e.content,l=this.logger.createTraceId();if(this.logger.info(Er.L_HADNLE_RECALL_CMD_T,JSON.stringify({recalledMessageUId:r,isDelete:o,source:t}),l),"number"!=typeof s||"string"!=typeof r||!r.length)return this.logger.warn(Er.L_HADNLE_RECALL_CMD_R,"Invalid message",l),!1;const c=f(this,Ms,"m",on).call(this,r);if(!c.isOk)return this.logger.info(Er.L_HADNLE_RECALL_CMD_R,"Msg Not Found",l),!1;const h=c.data;if(o)return f(this,Ms,"m",rn).call(this,[h.messageId],s),this.logger.info(Er.L_HADNLE_RECALL_CMD_R,`Delete Msg, messageId: ${h.messageId}`,l),!0;if(h.messageType===xe)return this.logger.info(Er.L_HADNLE_RECALL_CMD_R,"Msg has been processed",l),!1;(null===(i=h.receivedStatusInfo)||void 0===i?void 0:i.isRead)||f(this,Ms,"m",ln).call(this,h.messageId,1,s);const u={operatorId:e.senderUserId,recallTime:h.sentTime,originalObjectName:h.messageType,originalMessageContent:h.content,recallActionTime:e.sentTime,admin:!!n,delete:!!o,isDelete:!!o,extra:a};return e.content.user&&(u.user=e.content.user),e.content.extra&&(u.extra=e.content.extra),h.messageType===we&&(u.recallContent=h.content.content),f(this,Ms,"m",an).call(this,h.messageId,JSON.stringify(u),xe),this.logger.info(Er.L_HADNLE_RECALL_CMD_R,`Replace Msg with RC:RcNtf, messageId: ${h.messageId}`,l),!0},js=function(e,t){const{timestamp:i,count:r,order:s,messageType:n}=t,{conversationType:o,targetId:a,channelId:l}=e,c=fs(this.logger,!1,"getHistoryMessages",o,a,i,r+1,n,0===s,l||""),h=JSON.parse(c).list.map((({obj:e})=>this._buildMessage(e))).reverse();return{list:r===h.length-1?h.slice(1):h,hasMore:r<h.length}},Ws=function(e,t){return _(this,void 0,void 0,(function*(){const{timestamp:i,count:r,order:s}=t,{conversationType:n,targetId:o,channelId:a}=e,l=gs.create(this.logger,"getRemoteHistoryMessages",this.logger.createTraceId());return(yield l.asyncInvoke(n,o,i,r,((e,t)=>l.ok({listJson:e,hasMore:t})),(e=>l.fail(e)),s,!0,a||"",!0).result()).trans((({listJson:e,hasMore:t})=>{const i=JSON.parse(e).list.map((({obj:e})=>this._buildMessage(e)));return 0===s&&i.reverse(),{list:i,hasMore:!!t}}))}))},Ks=function(e){const{conversationType:t,targetId:i,channelId:r}=e;fs(this.logger,!1,"clearMessages",t,i,r||"")},Xs=function(e,t,i){fs(this.logger,!1,"deleteChatroomMessageAndKV",e,t,i)},Zs=function(e){var t;return!!(2&((null===(t=this.getNaviInfoFromCache())||void 0===t?void 0:t.ugDriven)||0))&&!e?"RCDefault":e||""},qs=function(e){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!1,"getConversation",t,i,r||"");return s?this._buildConversation(s):null},Qs=function(e){const{conversationType:t,targetId:i,channelId:r}=e;return fs(this.logger,!0,"getUnreadCount",t,i,r||"")},$s=function(e){const{conversationType:t,targetId:i,channelId:r}=e;return fs(this.logger,!1,"clearUnreadCount",t,i,r||"")},zs=function(e){const{conversationType:t,targetId:i,channelId:r}=e,s=fs(this.logger,!0,"getTheFirstUnreadMessage",t,i,r||""),n=this._buildMessage(s);return-1!==n.messageId?n:null},en=function(e,t,i,r,s,n){const o=this.logger.createTraceId(),a=gs.create(this.logger,"updateConversationStatus",o),l=JSON.stringify(e.map((e=>({conversation_query_param:{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,channel_id_valid:"string"==typeof e.channelId&&e.channelId.length>0},block_op:t,translate_strategy_op:r,top_op:i,create_conversation:!!n,update_time:!!s}))));return a.invoke(l,(()=>a.ok()),(e=>a.fail(e))).result()},tn=function(e,t){const{conversationType:i,targetId:r,channelId:s}=e,{content:n,senderUserId:o,messageType:a,messageDirection:l,readStatus:c,sentStatus:h,sentTime:u,searchContent:d,isUnread:E,messageUId:I,disableNotification:_,canIncludeExpansion:f,expansion:g,directedUserIds:R,disableUpdateLastMessage:p,quoteInfo:T}=t,N=u||0,S={};if(g)for(const e in g)S[e]={v:g[e],ts:N};const O=()=>{},C=fs(this.logger,!0,"insertMessage",i,r,o,a,JSON.stringify(n),O,O,l,c||1,h||30,N,d||"",E?0:1,I||"",!!_,!!f,JSON.stringify(S),s||"",R||[],!!p,(null==T?void 0:T.messageUId)||"",(null==T?void 0:T.senderId)||"",(null==T?void 0:T.objectName)||"",(null==T?void 0:T.quoteMessageStatus)||0),v=this._buildMessage(C,!1);return v.messageUId=I,v.sentTime=u,v},rn=function(e,t=0){fs(this.logger,!1,"deleteMessages",e,t)},sn=function(e,t,i){fs(this.logger,!1,"deleteMessagesByTimestamp",e.conversationType,e.targetId,t,i,e.channelId||"")},nn=function(e){const t=fs(this.logger,!0,"getMessage",e),i=JSON.parse(t);return i.messageId<=0?Ri(ne.RC_DB_DATA_NOT_FOUND,`msg not found: ${e}`):gi(i)},on=function(e){return f(this,Ms,"m",nn).call(this,e).trans((e=>f(this,Ms,"m",ks).call(this,e,!1)))},an=function(e,t,i){return fs(this.logger,!1,"setMessageContent",e,t,i)},ln=function(e,t,i=0){fs(this.logger,!1,"setMessageReceivedStatus",e,t,i)},cn=function(e){const t=e.map((e=>{const{conversationType:t,targetId:i,channelId:r=""}=e;return{targetId:i,channelId:r,type:t}})),i=fs(this.logger,!0,"getConversations",JSON.stringify(t));return JSON.parse(i).list.map((e=>this._buildConversation(e.obj)))},hn=function(e){let t=[];return e&&e.length>0&&(t=e.map((e=>{const t=JSON.parse(e.obj);return{messageUId:t.msg_uid,message:t.msg?this._buildMessage(t.msg):void 0,code:t.code}}))),t},un=function(e,t){try{const{list:i}=JSON.parse(e);t(f(this,Ms,"m",hn).call(this,i))}catch(t){this.logger.error(Er.P_PARSE_JSON_MSGS_E,e)}},dn=function(e){const t=fs(this.logger,!1,"getBlockedConversations",e);return f(this,Ms,"m",Fs).call(this,t,"getBlockedConversations")},En=function(e,t){return _(this,void 0,void 0,(function*(){const i=gs.create(this.logger,"getSubscribeStatusByUserIds",this.logger.createTraceId());return i.invoke(e,t,((e,t)=>{e!==ne.SUCCESS?i.fail(e):i.ok(t)})).result()}))},In=function(e){return JSON.parse(e).list.map((e=>{const t=JSON.parse(e);return{robotId:t.robotId,name:t.robotName,portraitUri:t.robotPortrait,robotType:t.robotType,metadata:t.metadata?JSON.parse(t.metadata):{},createTime:t.createTime,updateTime:t.updateTime}}))};class pn{static init(e){if(f(this,fn,"f",gn))return f(this,fn,"f",gn);if(!e.appkey)throw new Error("Initializ failed, `appkey` is required!");const r={appkey:e.appkey,dbpath:e.dbpath||t.resolve(i.app.getPath("userData")),logOutputLevel:e.logOutputLevel||Li.WARN,enableSyncEmptyTopConversation:!!e.enableSyncEmptyTopConversation,disableLogReport:!!e.disableLogReport,eventLoopBlockingCheck:!!e.eventLoopBlockingCheck,environment:e.environment||"default",reconnectKickEnable:!!e.reconnectKickEnable,runInMainProcess:!!e.runInMainProcess};return g(this,fn,new fn(r),0,gn),f(this,fn,"f",gn)}constructor(e){Object.defineProperty(this,"_rendererInitOptions",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_svr",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_senders",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),this._svr=new Rn(e,this._send2AllRenderer.bind(this)),this._initIpcEventListeners(),i.app.on("before-quit",(()=>this.destroy())),i.app.on("window-all-closed",(()=>this.destroy()))}_initIpcEventListeners(){i.ipcMain.on("__RC_CHANNEL_CALL_MAIN_SYNC__",((e,t,...i)=>{e.returnValue=this._svr[t].call(this._svr,...i)})),i.ipcMain.on("__RC_CHANNEL_CALL_MAIN__",((e,t,i,...r)=>_(this,[e,t,i,...r],void 0,(function*({sender:e},t,i,...r){if(!this._senders.has(e))return void this._send2Renderer(e,"__RC_CHANNEL_RESULT_FROM_MAIN__",t,Ri(ne.BIZ_ERROR_CLIENT_NOT_INIT));let s;if("sendMessage"===i){const[t,i,n,o]=r;s=this._svr.sendMessage(t,i,n,(t=>{this._send2Renderer(e,"__RC_CHANNEL_RESULT_FROM_MAIN__",o,t)}))}else if("refreshReferenceMessageWithParams"===i){const[t,i,n,o]=r;s=this._svr.refreshReferenceMessageWithParams(t,i,(t=>{this._send2Renderer(e,"__RC_CHANNEL_RESULT_FROM_MAIN__",n,t)}),(t=>{this._send2Renderer(e,"__RC_CHANNEL_RESULT_FROM_MAIN__",o,t)}))}else s=this._svr[i].apply(this._svr,r);s instanceof Promise&&(s=yield s),this._send2Renderer(e,"__RC_CHANNEL_RESULT_FROM_MAIN__",t,s)})))),i.ipcMain.on("__RC_CHANNEL_SEND_2_MAIN__",(({sender:e},t,...i)=>{this._senders.has(e)&&this._svr[t].apply(this._svr,i)})),i.ipcMain.on("__RC_INNER_COMMAND_INIT__",this._registerRenderers.bind(this))}_registerRenderers(e,t){if("d5bd8e7ccfe53e86ad9ceabb86e10852b5e02b5a"!==t.commitId)return;const{sender:i}=e;this._rendererInitOptions||(this._rendererInitOptions=t,this._svr.setRenderInitOption(t)),this._senders.has(i)||(this._senders.add(i),i.once("destroyed",(()=>{this._senders.delete(i)})))}_send2Renderer(e,t,...i){e.isDestroyed()?this._senders.delete(e):e.send(t,...i)}_send2AllRenderer(e,...t){this._senders.forEach((i=>{this._send2Renderer(i,"__RC_CHANNEL_NOTIFICATION_FROM_MAIN__",e,...t)}))}getCppProto(){return{destroy:()=>{console.warn("`.getCppProto().destroy()` has being deprecated, use `.destroy()` instead."),this.destroy()}}}destroy(){this._svr.destroy()}getDeviceId(){return this._svr.getDeviceId()}getServerTime(){return this._svr.getConnectedTime()}setDatabaseOperationTimeThreshold(e){return this._svr.setDataBaseLogConfig(e)}}fn=pn,gn={value:void 0};module.exports=e=>pn.init(e);